2006-12-26 [colin] 2.6.1cvs75
authorColin Leroy <colin@colino.net>
Tue, 26 Dec 2006 21:34:00 +0000 (21:34 +0000)
committerColin Leroy <colin@colino.net>
Tue, 26 Dec 2006 21:34:00 +0000 (21:34 +0000)
* src/folder.c
* src/folder.h
* src/folderview.c
* src/folderview.h
* src/imap_gtk.c
* src/mh_gtk.c
Make it possible to copy folders accross
mailboxes (this was an arbitrary limitation).
Still make it impossible to move folders
accross mailboxes.

ChangeLog
PATCHSETS
configure.ac
src/folder.c
src/folder.h
src/folderview.c
src/folderview.h
src/imap_gtk.c
src/mh_gtk.c

index 391e99a..79600e8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2006-12-26 [colin]     2.6.1cvs75
+
+       * src/folder.c
+       * src/folder.h
+       * src/folderview.c
+       * src/folderview.h
+       * src/imap_gtk.c
+       * src/mh_gtk.c
+               Make it possible to copy folders accross
+               mailboxes (this was an arbitrary limitation).
+               Still make it impossible to move folders 
+               accross mailboxes.
+
 2006-12-26 [colin]     2.6.1cvs74
 
        * src/etpan/imap-thread.c
index 0862679..6e02d8a 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.2.2.14 -r 1.2.2.15 src/folder_item_prefs.c;  ) > 2.6.1cvs72.patchset
 ( cvs diff -u -r 1.2.2.15 -r 1.2.2.16 src/folder_item_prefs.c;  ) > 2.6.1cvs73.patchset
 ( cvs diff -u -r 1.1.4.59 -r 1.1.4.60 src/etpan/imap-thread.c;  ) > 2.6.1cvs74.patchset
+( cvs diff -u -r 1.213.2.126 -r 1.213.2.127 src/folder.c;  cvs diff -u -r 1.87.2.33 -r 1.87.2.34 src/folder.h;  cvs diff -u -r 1.207.2.138 -r 1.207.2.139 src/folderview.c;  cvs diff -u -r 1.20.2.14 -r 1.20.2.15 src/folderview.h;  cvs diff -u -r 1.1.2.32 -r 1.1.2.33 src/imap_gtk.c;  cvs diff -u -r 1.2.2.22 -r 1.2.2.23 src/mh_gtk.c;  ) > 2.6.1cvs75.patchset
index eb76f1f..bbde247 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=6
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=74
+EXTRA_VERSION=75
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 32f72d4..db4f9b4 100644 (file)
@@ -2780,7 +2780,7 @@ gint folder_item_add_msgs(FolderItem *dest, GSList *file_list,
         return lastnum;
 }
                
-FolderItem *folder_item_move_recursive(FolderItem *src, FolderItem *dest
+static FolderItem *folder_item_move_recursive(FolderItem *src, FolderItem *dest, gboolean copy
 {
        GSList *mlist;
        FolderItem *new_item;
@@ -2789,7 +2789,7 @@ FolderItem *folder_item_move_recursive(FolderItem *src, FolderItem *dest)
        gchar *old_id, *new_id;
 
        /* move messages */
-       debug_print("Moving %s to %s\n", src->path, dest->path);
+       debug_print("%s %s to %s\n", copy?"Copying":"Moving", src->path, dest->path);
        new_item = folder_create_folder(dest, src->name);
        if (new_item == NULL) {
                printf("Can't create folder\n");
@@ -2800,13 +2800,16 @@ FolderItem *folder_item_move_recursive(FolderItem *src, FolderItem *dest)
                new_item->folder = dest->folder;
 
        /* move messages */
-       log_message(_("Moving %s to %s...\n"), 
+       log_message(copy ?_("Copying %s to %s...\n"):_("Moving %s to %s...\n"), 
                        src->name, new_item->path);
 
        mlist = folder_item_get_msg_list(src);
        
        if (mlist != NULL) {
-               folder_item_move_msgs(new_item, mlist);
+               if (copy)
+                       folder_item_copy_msgs(new_item, mlist);
+               else
+                       folder_item_move_msgs(new_item, mlist);
                procmsg_msg_list_free(mlist);
        }
        
@@ -2836,7 +2839,7 @@ FolderItem *folder_item_move_recursive(FolderItem *src, FolderItem *dest)
                if (srcnode && srcnode->data) {
                        next_item = (FolderItem*) srcnode->data;
                        srcnode = srcnode->next;
-                       if (folder_item_move_recursive(next_item, new_item) == NULL) {
+                       if (folder_item_move_recursive(next_item, new_item, copy) == NULL) {
                                return NULL;
                        }
                }
@@ -2846,7 +2849,7 @@ FolderItem *folder_item_move_recursive(FolderItem *src, FolderItem *dest)
        debug_print("updating rules : %s => %s\n", old_id, new_id);
 
        /* if src supports removing, otherwise only copy folder */
-       if (src->folder->klass->remove_folder != NULL 
+       if (src->folder->klass->remove_folder != NULL && !copy) 
                src->folder->klass->remove_folder(src->folder, src);
        folder_write_list();
 
@@ -2860,12 +2863,12 @@ FolderItem *folder_item_move_recursive(FolderItem *src, FolderItem *dest)
        return new_item;
 }
 
-gint folder_item_move_to(FolderItem *src, FolderItem *dest, FolderItem **new_item)
+gint folder_item_move_to(FolderItem *src, FolderItem *dest, FolderItem **new_item, gboolean copy)
 {
        FolderItem *tmp = folder_item_parent(dest);
        gchar * src_identifier, * dst_identifier;
        gchar * phys_srcpath, * phys_dstpath, *tmppath;
-       
+
        while (tmp) {
                if (tmp == src) {
                        return F_MOVE_FAILED_DEST_IS_CHILD;
@@ -2887,7 +2890,7 @@ gint folder_item_move_to(FolderItem *src, FolderItem *dest, FolderItem **new_ite
                return F_MOVE_FAILED;
        }
 
-       if (src->folder != dest->folder) {
+       if (src->folder != dest->folder && !copy) {
                return F_MOVE_FAILED_DEST_OUTSIDE_MAILBOX;
        }
 
@@ -2907,7 +2910,7 @@ gint folder_item_move_to(FolderItem *src, FolderItem *dest, FolderItem **new_ite
                return F_MOVE_FAILED_DEST_IS_PARENT;
        }
        debug_print("moving \"%s\" to \"%s\"\n", phys_srcpath, phys_dstpath);
-       if ((tmp = folder_item_move_recursive(src, dest)) == NULL) {
+       if ((tmp = folder_item_move_recursive(src, dest, copy)) == NULL) {
                return F_MOVE_FAILED;
        }
        
index ef22c49..56c6b5d 100644 (file)
@@ -798,7 +798,8 @@ gint   folder_item_add_msgs             (FolderItem     *dest,
                                          gboolean        remove_source);
 gint   folder_item_move_to             (FolderItem     *src,
                                         FolderItem     *dest,
-                                        FolderItem    **new_item);
+                                        FolderItem    **new_item,
+                                        gboolean        copy);
 gint   folder_item_move_msg            (FolderItem     *dest,
                                         MsgInfo        *msginfo);
 gint   folder_item_move_msgs           (FolderItem     *dest,
index 7f1c0a0..8ebbffa 100644 (file)
@@ -2422,7 +2422,7 @@ static void folderview_recollapse_nodes(FolderView *folderview, GtkCTreeNode *no
 }
 
 void folderview_move_folder(FolderView *folderview, FolderItem *from_folder,
-                           FolderItem *to_folder)
+                           FolderItem *to_folder, gboolean copy)
 {
        FolderItem *from_parent = NULL;
        FolderItem *new_folder = NULL;
@@ -2438,10 +2438,10 @@ void folderview_move_folder(FolderView *folderview, FolderItem *from_folder,
        from_parent = folder_item_parent(from_folder);
        
        if (prefs_common.warn_dnd) {
-               buf = g_strdup_printf(_("Do you really want to make folder '%s' a "
-                                       "sub-folder of '%s' ?"), from_folder->name,
-                                       to_folder->name);
-               status = alertpanel_full(_("Move folder"), buf,
+               buf = g_strdup_printf(copy ? _("Do you really want to copy folder '%s' in '%s' ?"):
+                                            _("Do you really want to make folder '%s' a sub-folder of '%s' ?"), 
+                                       from_folder->name, to_folder->name);
+               status = alertpanel_full(copy ? _("Copy folder"):_("Move folder"), buf,
                                         GTK_STOCK_NO, GTK_STOCK_YES, NULL, TRUE,
                                         NULL, ALERT_QUESTION, G_ALERTDEFAULT);
                g_free(buf);
@@ -2452,7 +2452,8 @@ void folderview_move_folder(FolderView *folderview, FolderItem *from_folder,
                        prefs_common.warn_dnd = FALSE;
        }
 
-       buf = g_strdup_printf(_("Moving %s to %s..."), from_folder->name, to_folder->name);
+       buf = g_strdup_printf(copy ? _("Copying %s to %s..."):_("Moving %s to %s..."), 
+                               from_folder->name, to_folder->name);
        STATUSBAR_PUSH(folderview->mainwin, buf);
        g_free(buf);
        summary_clear_all(folderview->summaryview);
@@ -2463,7 +2464,7 @@ void folderview_move_folder(FolderView *folderview, FolderItem *from_folder,
        main_window_cursor_wait(folderview->mainwin);
        statusbar_verbosity_set(TRUE);
        folder_item_update_freeze();
-       if ((status = folder_item_move_to(from_folder, to_folder, &new_folder)) == F_MOVE_OK) {
+       if ((status = folder_item_move_to(from_folder, to_folder, &new_folder, copy)) == F_MOVE_OK) {
                statusbar_verbosity_set(FALSE);
                main_window_cursor_normal(folderview->mainwin);
                STATUSBAR_POP(folderview->mainwin);
@@ -2484,13 +2485,14 @@ void folderview_move_folder(FolderView *folderview, FolderItem *from_folder,
                        alertpanel_error(_("Source and destination are the same."));
                        break;
                case F_MOVE_FAILED_DEST_IS_CHILD:
-                       alertpanel_error(_("Can't move a folder to one of its children."));
+                       alertpanel_error(copy ? _("Can't copy a folder to one of its children."):
+                                               _("Can't move a folder to one of its children."));
                        break;
                case F_MOVE_FAILED_DEST_OUTSIDE_MAILBOX:
                        alertpanel_error(_("Folder moving cannot be done between different mailboxes."));
                        break;
                default:
-                       alertpanel_error(_("Move failed!"));
+                       alertpanel_error(copy ? _("Copy failed!"):_("Move failed!"));
                        break;
                }
        }       
@@ -2912,6 +2914,7 @@ static void folderview_drag_received_cb(GtkWidget        *widget,
                        /* comes from folderview */
                        char *source;
                        gboolean folder_is_normal = TRUE;
+                       gboolean copy = (drag_context->action == GDK_ACTION_COPY);
 
                        source = data->data + 17;
                        if (gtk_clist_get_selection_info
@@ -2937,7 +2940,7 @@ static void folderview_drag_received_cb(GtkWidget        *widget,
                                return;
                        }
 
-                       folderview_move_folder(folderview, src_item, item);
+                       folderview_move_folder(folderview, src_item, item, copy);
                        gtk_drag_finish(drag_context, TRUE, TRUE, time);
                }
                folderview->nodes_to_recollapse = NULL;
index fce025b..6b21f8c 100644 (file)
@@ -122,7 +122,8 @@ void folderview_update_all_updated  (gboolean        update_summary);
 
 void folderview_move_folder            (FolderView     *folderview,
                                         FolderItem     *from_folder,
-                                        FolderItem     *to_folder);
+                                        FolderItem     *to_folder,
+                                        gboolean        copy);
 
 void folderview_set_target_folder_color (gint          color_op);
 
index 5e68152..67e9b83 100644 (file)
@@ -254,7 +254,7 @@ static void move_folder_cb(FolderView *folderview, guint action, GtkWidget *widg
        if (!to_folder)
                return;
        
-       folderview_move_folder(folderview, from_folder, to_folder);
+       folderview_move_folder(folderview, from_folder, to_folder, FALSE);
 }
 
 static void delete_folder_cb(FolderView *folderview, guint action,
index 25f6730..edb8b95 100644 (file)
@@ -282,7 +282,7 @@ static void move_folder_cb(FolderView *folderview, guint action, GtkWidget *widg
        if (!to_folder)
                return;
        
-       folderview_move_folder(folderview, from_folder, to_folder);
+       folderview_move_folder(folderview, from_folder, to_folder, FALSE);
 }
 
 static void update_tree_cb(FolderView *folderview, guint action,