2005-10-05 [colin] 1.9.15cvs14
authorColin Leroy <colin@colino.net>
Wed, 5 Oct 2005 19:26:02 +0000 (19:26 +0000)
committerColin Leroy <colin@colino.net>
Wed, 5 Oct 2005 19:26:02 +0000 (19:26 +0000)
* src/folder.c
* src/folder.h
* src/folderview.c
* src/folderview.h
* src/imap_gtk.c
* src/mh_gtk.c
* src/mainwindow.c
* src/setup.c
add a way to rescan without rebuilding
make moving a bit faster (less folders changes)
don't lock the tree on Get
* src/imap.c
Don't re-delete deleted messages before expunging
* src/summaryview.c
Set batch mode when deleting mails

13 files changed:
ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/folder.c
src/folder.h
src/folderview.c
src/folderview.h
src/imap.c
src/imap_gtk.c
src/mainwindow.c
src/mh_gtk.c
src/setup.c
src/summaryview.c

index ff418f5..da7828d 100644 (file)
@@ -1,3 +1,21 @@
+2005-10-05 [colin]     1.9.15cvs14
+
+       * src/folder.c
+       * src/folder.h
+       * src/folderview.c
+       * src/folderview.h
+       * src/imap_gtk.c
+       * src/mh_gtk.c
+       * src/mainwindow.c
+       * src/setup.c
+               add a way to rescan without rebuilding
+               make moving a bit faster (less folders changes)
+               don't lock the tree on Get 
+       * src/imap.c
+               Don't re-delete deleted messages before expunging
+       * src/summaryview.c
+               Set batch mode when deleting mails
+
 2005-10-05 [paul]      1.9.15cvs13
 
        * src/mainwindow.c
index bcd3f8d..2b90599 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.14.2.23 -r 1.14.2.24 src/plugins/trayicon/trayicon.c;  ) > 1.9.15cvs11.patchset
 ( cvs diff -u -r 1.382.2.178 -r 1.382.2.179 src/compose.c;  ) > 1.9.15cvs12.patchset
 ( cvs diff -u -r 1.274.2.68 -r 1.274.2.69 src/mainwindow.c;  cvs diff -u -r 1.39.2.8 -r 1.39.2.9 src/mainwindow.h;  cvs diff -u -r 1.43.2.27 -r 1.43.2.28 src/toolbar.c;  ) > 1.9.15cvs13.patchset
+( cvs diff -u -r 1.213.2.61 -r 1.213.2.62 src/folder.c;  cvs diff -u -r 1.87.2.20 -r 1.87.2.21 src/folder.h;  cvs diff -u -r 1.207.2.67 -r 1.207.2.68 src/folderview.c;  cvs diff -u -r 1.20.2.8 -r 1.20.2.9 src/folderview.h;  cvs diff -u -r 1.179.2.75 -r 1.179.2.76 src/imap.c;  cvs diff -u -r 1.1.2.21 -r 1.1.2.22 src/imap_gtk.c;  cvs diff -u -r 1.274.2.69 -r 1.274.2.70 src/mainwindow.c;  cvs diff -u -r 1.2.2.12 -r 1.2.2.13 src/mh_gtk.c;  cvs diff -u -r 1.5.2.8 -r 1.5.2.9 src/setup.c;  cvs diff -u -r 1.395.2.130 -r 1.395.2.131 src/summaryview.c;  ) > 1.9.15cvs14.patchset
index 9216461..859a54b 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=15
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=13
+EXTRA_VERSION=14
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index ccb93f7..f5a5998 100644 (file)
@@ -768,7 +768,7 @@ gboolean folder_scan_tree_func(GNode *node, gpointer data)
        return FALSE;
 }
 
-void folder_scan_tree(Folder *folder)
+void folder_scan_tree(Folder *folder, gboolean rebuild)
 {
        GHashTable *pptable;
        FolderUpdateData hookdata;
@@ -778,11 +778,9 @@ void folder_scan_tree(Folder *folder)
        
        pptable = folder_persist_prefs_new(folder);
 
-       /*
-        * should be changed and tree update should be done without 
-        * destroying the tree first
-        */
-       folder_tree_destroy(folder);
+       if (rebuild)
+               folder_tree_destroy(folder);
+
        folder->klass->scan_tree(folder);
 
        hookdata.folder = folder;
@@ -2741,6 +2739,42 @@ static gint do_copy_msgs(FolderItem *dest, GSList *msglist, gboolean remove_sour
                }
        }
 
+       if (remove_source) {
+               MsgInfo *msginfo = (MsgInfo *) msglist->data;
+               FolderItem *item = msginfo->folder;
+               /*
+                * Remove source messages from their folders if
+                * copying was successfull and update folder
+                * message counts
+                */
+               if (item->folder->klass->remove_msgs) {
+                       item->folder->klass->remove_msgs(item->folder,
+                                                               msginfo->folder,
+                                                               msglist,
+                                                               relation);
+               }
+               for (l = msglist; l != NULL; l = g_slist_next(l)) {
+                       GTuples *tuples;
+                       msginfo = (MsgInfo *) l->data;
+                       item = msginfo->folder;
+
+                       tuples = g_relation_select(relation, msginfo, 0);
+                       num = GPOINTER_TO_INT(g_tuples_index(tuples, 0, 1));
+                       g_tuples_destroy(tuples);
+
+                       if (g_slist_find(not_moved, msginfo))
+                               continue;
+
+                       if ((num >= 0) && (item->folder->klass->remove_msg != NULL)) {
+                               if (!item->folder->klass->remove_msgs)
+                                       item->folder->klass->remove_msg(item->folder,
+                                                               msginfo->folder,
+                                                               msginfo->msgnum);
+                               remove_msginfo_from_cache(item, msginfo);
+                       }
+               }
+       }
+
        /* Read cache for dest folder */
        if (!dest->cache) folder_item_read_cache(dest);
 
@@ -2795,42 +2829,6 @@ static gint do_copy_msgs(FolderItem *dest, GSList *msglist, gboolean remove_sour
                }
        }
 
-       if (remove_source) {
-               MsgInfo *msginfo = (MsgInfo *) msglist->data;
-               FolderItem *item = msginfo->folder;
-               /*
-                * Remove source messages from their folders if
-                * copying was successfull and update folder
-                * message counts
-                */
-               if (item->folder->klass->remove_msgs) {
-                       item->folder->klass->remove_msgs(item->folder,
-                                                               msginfo->folder,
-                                                               msglist,
-                                                               relation);
-               }
-               for (l = msglist; l != NULL; l = g_slist_next(l)) {
-                       GTuples *tuples;
-                       msginfo = (MsgInfo *) l->data;
-                       item = msginfo->folder;
-
-                       tuples = g_relation_select(relation, msginfo, 0);
-                       num = GPOINTER_TO_INT(g_tuples_index(tuples, 0, 1));
-                       g_tuples_destroy(tuples);
-
-                       if (g_slist_find(not_moved, msginfo))
-                               continue;
-
-                       if ((num >= 0) && (item->folder->klass->remove_msg != NULL)) {
-                               if (!item->folder->klass->remove_msgs)
-                                       item->folder->klass->remove_msg(item->folder,
-                                                               msginfo->folder,
-                                                               msginfo->msgnum);
-                               remove_msginfo_from_cache(item, msginfo);
-                       }
-               }
-       }
-
        g_relation_destroy(relation);
        if (not_moved != NULL) {
                g_slist_free(not_moved);
index e06f264..4487f23 100644 (file)
@@ -700,7 +700,7 @@ void   folder_remove                (Folder         *folder);
 GList *folder_get_list         (void);
 gint   folder_read_list                (void);
 void   folder_write_list       (void);
-void   folder_scan_tree                (Folder *folder);
+void   folder_scan_tree                (Folder *folder, gboolean rebuild);
 FolderItem *folder_create_folder(FolderItem    *parent, const gchar *name);
 gint   folder_item_rename      (FolderItem *item, gchar *newname);
 void   folder_update_op_count          (void);
index 8b8fd5a..8c3b61e 100644 (file)
@@ -955,7 +955,7 @@ static GtkWidget *label_window_create(const gchar *str)
        return window;
 }
 
-void folderview_rescan_tree(Folder *folder)
+void folderview_rescan_tree(Folder *folder, gboolean rebuild)
 {
        GtkWidget *window;
 
@@ -963,11 +963,24 @@ void folderview_rescan_tree(Folder *folder)
 
        if (!folder->klass->scan_tree) return;
 
+       if (rebuild && 
+           alertpanel_full(_("Rebuild folder tree"), 
+                        _("Rebuilding the folder tree will remove "
+                          "local caches. Do you want to continue?"),
+                        GTK_STOCK_YES, GTK_STOCK_NO, NULL, FALSE,
+                        NULL, ALERT_WARNING, G_ALERTALTERNATE) 
+               != G_ALERTDEFAULT) {
+               return;
+       }
+
        inc_lock();
-       window = label_window_create(_("Rebuilding folder tree..."));
+       if (rebuild)
+               window = label_window_create(_("Rebuilding folder tree..."));
+       else 
+               window = label_window_create(_("Scanning folder tree..."));
 
        folder_set_ui_func(folder, folderview_scan_tree_func, NULL);
-       folder_scan_tree(folder);
+       folder_scan_tree(folder, rebuild);
        folder_set_ui_func(folder, NULL, NULL);
 
        folderview_set_all();
@@ -999,7 +1012,6 @@ gint folderview_check_new(Folder *folder)
 
                inc_lock();
                main_window_lock(folderview->mainwin);
-               gtk_widget_set_sensitive(folderview->ctree, FALSE);
 
                for (node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
                     node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
@@ -1024,7 +1036,6 @@ gint folderview_check_new(Folder *folder)
                        former_new_msgs += former_new;
                }
 
-               gtk_widget_set_sensitive(folderview->ctree, TRUE);
                main_window_unlock(folderview->mainwin);
                inc_unlock();
        }
index 6423c08..8fa205c 100644 (file)
@@ -108,7 +108,8 @@ void folderview_update_msg_num              (FolderView     *folderview,
 
 void folderview_append_item            (FolderItem     *item);
 
-void folderview_rescan_tree            (Folder         *folder);
+void folderview_rescan_tree            (Folder         *folder,
+                                        gboolean        rebuild);
 void folderview_rescan_all             (void);
 gint folderview_check_new              (Folder         *folder);
 void folderview_check_new_all          (void);
index 98db8d5..8b7d7c9 100644 (file)
@@ -1231,7 +1231,7 @@ static gint imap_do_remove_msgs(Folder *folder, FolderItem *dest,
                                MsgInfoList *msglist, GRelation *relation)
 {
        gchar *destdir;
-       GSList *seq_list = NULL, *cur;
+       GSList *numlist = NULL, *cur;
        MsgInfo *msginfo;
        IMAPSession *session;
        gint ok = IMAP_SUCCESS;
@@ -1256,7 +1256,8 @@ static gint imap_do_remove_msgs(Folder *folder, FolderItem *dest,
        destdir = imap_get_real_path(IMAP_FOLDER(folder), dest->path);
        for (cur = msglist; cur; cur = cur->next) {
                msginfo = (MsgInfo *)cur->data;
-               seq_list = g_slist_append(seq_list, GINT_TO_POINTER(msginfo->msgnum));
+               if (!MSG_IS_DELETED(msginfo->flags))
+                       numlist = g_slist_append(numlist, GINT_TO_POINTER(msginfo->msgnum));
        }
 
        uid_mapping = g_relation_new(2);
@@ -1264,7 +1265,7 @@ static gint imap_do_remove_msgs(Folder *folder, FolderItem *dest,
 
        ok = imap_set_message_flags
                (IMAP_SESSION(REMOTE_FOLDER(folder)->session),
-               seq_list, IMAP_FLAG_DELETED, TRUE);
+               numlist, IMAP_FLAG_DELETED, TRUE);
        if (ok != IMAP_SUCCESS) {
                log_warning(_("can't set deleted flags\n"));
                return ok;
@@ -1276,7 +1277,7 @@ static gint imap_do_remove_msgs(Folder *folder, FolderItem *dest,
        }
        
        g_relation_destroy(uid_mapping);
-       g_slist_free(seq_list);
+       g_slist_free(numlist);
 
        g_free(destdir);
 
@@ -3894,7 +3895,7 @@ static GSList * imap_get_lep_set_from_numlist(MsgNumberList *numlist)
                        continue;
                
                item_count ++;
-               
+
                last = GPOINTER_TO_INT(cur->data);
                if (cur->next)
                        next = GPOINTER_TO_INT(cur->next->data);
index 6e7eba0..7ead78c 100644 (file)
@@ -63,7 +63,8 @@ static GtkItemFactoryEntry imap_popup_entries[] =
        {N_("/Down_load messages"),      NULL, download_cb,      0, NULL},
        {N_("/---"),                     NULL, NULL,             0, "<Separator>"},
        {N_("/_Check for new messages"), NULL, update_tree_cb,   0, NULL},
-       {N_("/R_ebuild folder tree"),    NULL, update_tree_cb,   1, NULL},
+       {N_("/C_heck for new folders"),  NULL, update_tree_cb,   1, NULL},
+       {N_("/R_ebuild folder tree"),    NULL, update_tree_cb,   2, NULL},
        {N_("/---"),                     NULL, NULL,             0, "<Separator>"},
        {N_("/IMAP4 _account settings"), NULL, imap_settings_cb, 0, NULL},
        {N_("/Remove _IMAP4 account"),   NULL, remove_server_cb, 0, NULL},
@@ -110,6 +111,7 @@ static void set_sensitivity(GtkItemFactory *factory, FolderItem *item)
        SET_SENS("/Delete folder",          item->stype == F_NORMAL && folder_item_parent(item) != NULL);
 
        SET_SENS("/Check for new messages", folder_item_parent(item) == NULL);
+       SET_SENS("/Check for new folders",  folder_item_parent(item) == NULL);
        SET_SENS("/Rebuild folder tree",    folder_item_parent(item) == NULL);
 
        SET_SENS("/Remove IMAP4 account",   folder_item_parent(item) == NULL);
@@ -370,8 +372,10 @@ static void update_tree_cb(FolderView *folderview, guint action,
 
        if (action == 0)
                folderview_check_new(item->folder);
-       else
-               folderview_rescan_tree(item->folder);
+       else if (action == 1)
+               folderview_rescan_tree(item->folder, FALSE);
+       else if (action == 2)
+               folderview_rescan_tree(item->folder, TRUE);
 }
 
 static void sync_cb(FolderView *folderview, guint action,
index c3f04ca..60e5286 100644 (file)
@@ -464,6 +464,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_File/_Print..."),                "<control>P", print_cb, 0, NULL},
        {N_("/_File/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_File/_Work offline"),            "<control>W", toggle_work_offline_cb, 0, "<ToggleItem>"},
+       {N_("/_File/Synchronise folders"),      "<control><shift>S", sync_cb, 0, NULL},
        {N_("/_File/---"),                      NULL, NULL, 0, "<Separator>"},
        /* {N_("/_File/_Close"),                "<alt>W", app_exit_cb, 0, NULL}, */
        {N_("/_File/E_xit"),                    "<control>Q", app_exit_cb, 0, NULL},
@@ -679,7 +680,6 @@ static GtkItemFactoryEntry mainwin_entries[] =
                                                NULL, inc_cancel_cb, 0, NULL},
        {N_("/_Message/Recei_ve/---"),          NULL, NULL, 0, "<Separator>"},
        {N_("/_Message/_Send queued messages"), NULL, send_queue_cb, 0, NULL},
-       {N_("/_Message/Synchronise folders"),   "<control><shift>S", sync_cb, 0, NULL},
        {N_("/_Message/---"),                   NULL, NULL, 0, "<Separator>"},
        {N_("/_Message/Compose a_n email message"),     "<control>M", compose_mail_cb, 0, NULL},
        {N_("/_Message/Compose a news message"),        NULL,   compose_news_cb, 0, NULL},
@@ -1699,7 +1699,7 @@ void main_window_add_mailbox(MainWindow *mainwin)
 
        folder_add(folder);
        folder_set_ui_func(folder, scan_tree_func, mainwin);
-       folder_scan_tree(folder);
+       folder_scan_tree(folder, TRUE);
        folder_set_ui_func(folder, NULL, NULL);
 }
 
index cf4a815..bcc8723 100644 (file)
@@ -53,7 +53,8 @@ static GtkItemFactoryEntry mh_popup_entries[] =
        {N_("/_Delete folder"),          NULL, delete_folder_cb,  0, NULL},
        {N_("/---"),                     NULL, NULL,              0, "<Separator>"},
        {N_("/_Check for new messages"), NULL, update_tree_cb,    0, NULL},
-       {N_("/R_ebuild folder tree"),    NULL, update_tree_cb,    1, NULL},
+       {N_("/C_heck for new folders"),  NULL, update_tree_cb,    1, NULL},
+       {N_("/R_ebuild folder tree"),    NULL, update_tree_cb,    2, NULL},
        {N_("/---"),                     NULL, NULL,              0, "<Separator>"},
        {N_("/Remove _mailbox"),         NULL, remove_mailbox_cb, 0, NULL},
        {N_("/---"),                     NULL, NULL,              0, "<Separator>"},
@@ -99,6 +100,7 @@ static void set_sensitivity(GtkItemFactory *factory, FolderItem *item)
        SET_SENS("/Delete folder",          item->stype == F_NORMAL && folder_item_parent(item) != NULL);
 
        SET_SENS("/Check for new messages", folder_item_parent(item) == NULL);
+       SET_SENS("/Check for new folders",  folder_item_parent(item) == NULL);
        SET_SENS("/Rebuild folder tree",    folder_item_parent(item) == NULL);
 
        SET_SENS("/Remove mailbox",         folder_item_parent(item) == NULL);
@@ -297,8 +299,10 @@ static void update_tree_cb(FolderView *folderview, guint action,
 
        if (action == 0)
                folderview_check_new(item->folder);
-       else
-               folderview_rescan_tree(item->folder);
+       else if (action == 1)
+               folderview_rescan_tree(item->folder, FALSE);
+       else if (action == 2)
+               folderview_rescan_tree(item->folder, TRUE);
 }
 
 static void remove_mailbox_cb(FolderView *folderview, guint action,
index f826218..b3b45ea 100644 (file)
@@ -60,7 +60,7 @@ gboolean setup_write_mailbox_path(MainWindow *mainwin, const gchar *path)
 
        folder_add(folder);
        folder_set_ui_func(folder, scan_tree_func, mainwin);
-       folder_scan_tree(folder);
+       folder_scan_tree(folder, TRUE);
        folder_set_ui_func(folder, NULL, NULL);
        g_free(base);
        return TRUE;
index b286eab..16c48cc 100644 (file)
@@ -3168,16 +3168,14 @@ void summary_delete(SummaryView *summaryview)
 
        /* next code sets current row focus right. We need to find a row
         * that is not deleted. */
-       summary_lock(summaryview);
-       folder_item_update_freeze();
-       gtk_clist_freeze(GTK_CLIST(summaryview->ctree)); 
+       START_LONG_OPERATION(summaryview);
+       folder_item_set_batch(summaryview->folder_item, TRUE);
        for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next) {
                sel_last = GTK_CTREE_NODE(cur->data);
                summary_delete_row(summaryview, sel_last);
        }
-       folder_item_update_thaw();
-       gtk_clist_thaw(GTK_CLIST(summaryview->ctree));
-       summary_unlock(summaryview);
+       folder_item_set_batch(summaryview->folder_item, FALSE);
+       END_LONG_OPERATION(summaryview);
 
        node = summary_find_next_msg(summaryview, sel_last);
        if (!node)
@@ -3192,6 +3190,7 @@ void summary_delete(SummaryView *summaryview)
                gtk_sctree_set_anchor_row(GTK_SCTREE(ctree), node);
        } else
                summary_status_show(summaryview);
+
                
        main_window_cursor_normal(summaryview->mainwin);
 }