0.8.8claws63
authorChristoph Hohmann <reboot@gmx.ch>
Tue, 7 Jan 2003 21:49:44 +0000 (21:49 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Tue, 7 Jan 2003 21:49:44 +0000 (21:49 +0000)
* src/compose.c
* src/folder.[ch]
* src/folderview.c
* src/import.c
* src/inc.c
* src/main.c
* src/mainwindow.c
* src/messageview.c
* src/prefs_folder_item.c
* src/procmsg.c
* src/summaryview.c
* src/toolbar.c
        o remove all folder update triggering from the UI code. The folder
          system should know much better when a folder needs an update.
        o to prevent multiple updates in a row the folder updates can be
          frozen for some time.

Note: - Please verify that no updates are missing
      - Check where freeze/thaws should be added

15 files changed:
ChangeLog.claws
configure.in
src/compose.c
src/folder.c
src/folder.h
src/folderview.c
src/import.c
src/inc.c
src/main.c
src/mainwindow.c
src/messageview.c
src/prefs_folder_item.c
src/procmsg.c
src/summaryview.c
src/toolbar.c

index 60e28c36812451aa4d7ec91ec07ceb5ae31065a7..3f3f797ba095c0d37bf1fa65c8225e475a2ceb14 100644 (file)
@@ -1,4 +1,26 @@
-2003-01-06 [Ivan Francolin Martinez (ivanfm@users.sourceforge.net)]    0.8.8claws62
+2003-01-07 [christoph] 0.8.8claws63
+
+       * src/compose.c
+       * src/folder.[ch]
+       * src/folderview.c
+       * src/import.c
+       * src/inc.c
+       * src/main.c
+       * src/mainwindow.c
+       * src/messageview.c
+       * src/prefs_folder_item.c
+       * src/procmsg.c
+       * src/summaryview.c
+       * src/toolbar.c
+               o remove all folder update triggering from the UI code. The folder
+                 system should know much better when a folder needs an update.
+               o to prevent multiple updates in a row the folder updates can be
+                 frozen for some time.
+
+               Note: - Please verify that no updates are missing
+                     - Check where freeze/thaws should be added
+
+2003-01-07 [Ivan Francolin Martinez (ivanfm@users.sourceforge.net)]    0.8.8claws62
 
        * src/prefs_actions.c
                don't translate empty strings
index 38ec060de9cbb58d983c4d537657f9d529f5873b..9f39a9211484f8a9896f311d56558c8eac89659b 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws62
+EXTRA_VERSION=claws63
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 3f9f44556e4dc5f93217604dca4624affc9d8070..6a670b443a902e3b377cfdb342389dfb44233eb9 100644 (file)
@@ -2816,7 +2816,6 @@ gint compose_send(Compose *compose)
        g_free(msgpath);
 
        folder_item_remove_msg(folder, msgnum);
-       folder_update_item(folder, TRUE);
 
        return val;
 }
@@ -2917,9 +2916,6 @@ gint compose_send(Compose *compose)
        } else {
                if (compose->mode == COMPOSE_REEDIT) {
                        compose_remove_reedit_target(compose);
-                       if (compose->targetinfo)
-                               folder_update_item
-                                       (compose->targetinfo->folder, TRUE);
                }
                /* save message to outbox */
                if (prefs_common.savemsg) {
@@ -2930,8 +2926,6 @@ gint compose_send(Compose *compose)
                        if (procmsg_save_to_outbox(outbox, tmp, FALSE) < 0)
                                alertpanel_error
                                        (_("Can't save the message to Sent."));
-                       else
-                               folder_update_item(outbox, TRUE);
                }
        }
 
@@ -3473,7 +3467,6 @@ void compose_remove_draft(Compose *compose)
 
        if (procmsg_msg_exist(msginfo)) {
                folder_item_remove_msg(drafts, msginfo->msgnum);
-               folder_update_item(drafts, TRUE);
        }
 
 }
@@ -3683,14 +3676,8 @@ static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
 
        if (compose->mode == COMPOSE_REEDIT) {
                compose_remove_reedit_target(compose);
-               if (compose->targetinfo &&
-                   compose->targetinfo->folder != queue)
-                       folder_update_item
-                               (compose->targetinfo->folder, TRUE);
        }
 
-       folder_update_item(queue, TRUE);
-
        if ((msgnum != NULL) && (item != NULL)) {
                *msgnum = num;
                *item = queue;
@@ -6065,17 +6052,12 @@ static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget)
 
        if (compose->mode == COMPOSE_REEDIT) {
                compose_remove_reedit_target(compose);
-               if (compose->targetinfo &&
-                   compose->targetinfo->folder != draft)
-                       folder_update_item(compose->targetinfo->folder,
-                                              TRUE);
        }
 
        newmsginfo = folder_item_get_msginfo(draft, msgnum);
        if (newmsginfo) {
                procmsg_msginfo_unset_flags(newmsginfo, ~0, ~0);
                procmsg_msginfo_set_flags(newmsginfo, 0, MSG_DRAFT);
-               folder_update_item(draft, TRUE);
                procmsg_msginfo_free(newmsginfo);
        }
        
index c2d84ca3ed36ab1be1b2643f1d5d6d7ffb158acc..bfac64ba4f6c1969168a1ad7d280aa5710865d30 100644 (file)
@@ -989,8 +989,7 @@ void folder_item_close(FolderItem *item)
 
        folder_item_write_cache(item);
        
-       folder_update_item(item, FALSE);
-
+       folder_item_update(item, F_ITEM_UPDATE_MSGCNT);
 }
 
 gint folder_item_scan(FolderItem *item)
@@ -999,7 +998,7 @@ gint folder_item_scan(FolderItem *item)
        GSList *folder_list = NULL, *cache_list = NULL, *folder_list_cur, *cache_list_cur, *new_list = NULL;
        guint newcnt = 0, unreadcnt = 0, totalcnt = 0, unreadmarkedcnt = 0;
        guint cache_max_num, folder_max_num, cache_cur_num, folder_cur_num;
-       gboolean contentchange = FALSE;
+       gboolean update_flags = 0;
     
        g_return_val_if_fail(item != NULL, -1);
        if (item->path == NULL) return -1;
@@ -1099,8 +1098,6 @@ gint folder_item_scan(FolderItem *item)
                        else
                                folder_cur_num = G_MAXINT;
 
-                       contentchange = TRUE;
-
                        continue;
                }
 
@@ -1120,7 +1117,7 @@ gint folder_item_scan(FolderItem *item)
                        else
                                cache_cur_num = G_MAXINT;
 
-                       contentchange = TRUE;
+                       update_flags |= F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT;
 
                        continue;
                }
@@ -1179,7 +1176,7 @@ gint folder_item_scan(FolderItem *item)
                        else
                                folder_cur_num = G_MAXINT;
 
-                       contentchange = TRUE;
+                       update_flags |= F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT;
 
                        continue;
                }
@@ -1212,6 +1209,8 @@ gint folder_item_scan(FolderItem *item)
                                        procmsg_msginfo_set_flags(msginfo, MSG_IGNORE_THREAD, 0);
                                totalcnt++;
                                procmsg_msginfo_free(msginfo);
+
+                               update_flags |= F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT;
                        }
                        g_slist_free(newmsg_list);
                }
@@ -1238,6 +1237,8 @@ gint folder_item_scan(FolderItem *item)
                                procmsg_msginfo_free(msginfo);
                                debug_print("Added newly found message %d to cache.\n", num);
                        }
+
+                       update_flags |= F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT;
                }
        }
 
@@ -1247,7 +1248,7 @@ gint folder_item_scan(FolderItem *item)
        item->unreadmarked = unreadmarkedcnt;
        g_slist_free(new_list);
 
-       folder_update_item(item, contentchange);
+       folder_item_update(item, update_flags);
 
        return 0;
 }
@@ -1489,7 +1490,7 @@ gint folder_item_add_msg(FolderItem *dest, const gchar *file,
                        if (procmsg_msg_has_flagged_parent(msginfo, MSG_IGNORE_THREAD))
                                procmsg_msginfo_set_flags(msginfo, MSG_IGNORE_THREAD, 0);
                        dest->total++;
-                       dest->need_update = TRUE;
+                       folder_item_update(dest, F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT);
 
                        msgcache_add_msg(dest->cache, msginfo);
 
@@ -1703,7 +1704,7 @@ gint folder_item_move_msg(FolderItem *dest, MsgInfo *msginfo)
                        if (procmsg_msg_has_flagged_parent(newmsginfo, MSG_IGNORE_THREAD))
                                procmsg_msginfo_set_flags(newmsginfo, MSG_IGNORE_THREAD, 0);
                        dest->total++;
-                       dest->need_update = TRUE;
+                       folder_item_update(dest, F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT);
 
                        procmsg_msginfo_free(newmsginfo);
                }
@@ -1721,7 +1722,7 @@ gint folder_item_move_msg(FolderItem *dest, MsgInfo *msginfo)
                        if (MSG_IS_UNREAD(msginfo->flags) && procmsg_msg_has_marked_parent(msginfo))
                                msginfo->folder->unreadmarked--;
                        msginfo->folder->total--;
-                       msginfo->folder->need_update = TRUE;
+                       folder_item_update(dest, F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT);
                }
        }
        
@@ -1818,7 +1819,7 @@ gint folder_item_move_msgs_with_dest(FolderItem *dest, GSList *msglist)
                                if (procmsg_msg_has_flagged_parent(newmsginfo, MSG_IGNORE_THREAD))
                                        procmsg_msginfo_set_flags(newmsginfo, MSG_IGNORE_THREAD, 0);
                                dest->total++;
-                               dest->need_update = TRUE;
+                               folder_item_update(dest, F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT);
 
                                procmsg_msginfo_free(newmsginfo);
                        }
@@ -1852,7 +1853,7 @@ gint folder_item_move_msgs_with_dest(FolderItem *dest, GSList *msglist)
                        if (MSG_IS_UNREAD(msginfo->flags) && procmsg_msg_has_marked_parent(msginfo))
                                msginfo->folder->unreadmarked--;
                        msginfo->folder->total--;                       
-                       msginfo->folder->need_update = TRUE;
+                       folder_item_update(dest, F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT);
                }
 
                l2 = g_slist_next(l2);
@@ -1922,7 +1923,7 @@ gint folder_item_copy_msg(FolderItem *dest, MsgInfo *msginfo)
                        if (procmsg_msg_has_flagged_parent(newmsginfo, MSG_IGNORE_THREAD))
                                procmsg_msginfo_set_flags(newmsginfo, MSG_IGNORE_THREAD, 0);
                        dest->total++;
-                       dest->need_update = TRUE;
+                       folder_item_update(dest, F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT);
 
                        procmsg_msginfo_free(newmsginfo);
                }                       
@@ -2015,7 +2016,7 @@ gint folder_item_copy_msgs_with_dest(FolderItem *dest, GSList *msglist)
                                if (procmsg_msg_has_flagged_parent(newmsginfo, MSG_IGNORE_THREAD))
                                        procmsg_msginfo_set_flags(newmsginfo, MSG_IGNORE_THREAD, 0);
                                dest->total++;
-                               dest->need_update = TRUE;
+                               folder_item_update(dest, F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT);
 
                                procmsg_msginfo_free(newmsginfo);
                        }
@@ -2055,7 +2056,7 @@ gint folder_item_remove_msg(FolderItem *item, gint num)
                msgcache_remove_msg(item->cache, num);
        }
        item->total--;
-       item->need_update = TRUE;
+       folder_item_update(item, F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT);
 
        return ret;
 }
@@ -2114,7 +2115,7 @@ gint folder_item_remove_all_msg(FolderItem *item)
                item->unread = 0;
                item->unreadmarked = 0;
                item->total = 0;
-               item->need_update = TRUE;
+               folder_item_update(item, F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT);
        }
 
        return result;
@@ -2521,7 +2522,7 @@ static void folder_update_op_count_rec(GNode *node)
        if (g_node_depth(node) > 0) {
                if (fitem->op_count > 0) {
                        fitem->op_count = 0;
-                       folder_update_item(fitem, FALSE);
+                       folder_item_update(fitem, F_ITEM_UPDATE_MSGCNT);
                }
                if (node->children) {
                        GNode *child;
@@ -2732,8 +2733,9 @@ void folder_item_apply_processing(FolderItem *item)
        if (processing_list == NULL)
                return;
 
+       folder_item_update_freeze();
+
        mlist = folder_item_get_msg_list(item);
-       
        for (cur = mlist ; cur != NULL ; cur = cur->next) {
                MsgInfo * msginfo;
 
@@ -2741,63 +2743,81 @@ void folder_item_apply_processing(FolderItem *item)
                filter_message_by_msginfo(processing_list, msginfo);
                procmsg_msginfo_free(msginfo);
        }
-       
-       folder_update_items_when_required(FALSE);
-
        g_slist_free(mlist);
+
+       folder_item_update_thaw();
 }
 
 /*
- *  Callback handling for FolderItem content changes
+ *  functions for handling FolderItem content changes
  */
-void folder_update_item(FolderItem *item, gboolean contentchange)
-{
-       FolderItemUpdateData source;
-       
-       source.item = item;
-       source.content_change = contentchange;
-       hooks_invoke(FOLDER_ITEM_UPDATE_HOOKLIST, &source);
-}
+static gint folder_item_update_freeze_cnt = 0;
 
-static void folder_update_item_func(FolderItem *item, gpointer contentchange)
+/**
+ * Notify the folder system about changes to a folder. If the
+ * update system is not frozen the FOLDER_ITEM_UPDATE_HOOKLIST will
+ * be invoked, otherwise the changes will be remebered until
+ * the folder system is thawed.
+ *
+ * \param item The FolderItem that was changed
+ * \param update_flags Type of changed that was made
+ */
+void folder_item_update(FolderItem *item, FolderItemUpdateFlags update_flags)
 {
-       FolderItemUpdateData source;
-
-       if (item->need_update) {
+       if (folder_item_update_freeze_cnt == 0) {
+               FolderItemUpdateData source;
+       
                source.item = item;
-               source.content_change = GPOINTER_TO_INT(contentchange);
-               hooks_invoke(FOLDER_ITEM_UPDATE_HOOKLIST, &source);
-
-               item->need_update = FALSE;
+               source.update_flags = update_flags;
+               hooks_invoke(FOLDER_ITEM_UPDATE_HOOKLIST, &source);
+       } else {
+               item->update_flags |= update_flags;
        }
 }
 
-void folder_update_items_when_required(gboolean contentchange)
-{
-       folder_func_to_all_folders(folder_update_item_func, GINT_TO_POINTER(contentchange));
-}
-
-void folder_update_item_recursive(FolderItem *item, gboolean update_summary)
+void folder_item_update_recursive(FolderItem *item, FolderItemUpdateFlags update_flags)
 {
        GNode *node = item->folder->node;       
-       FolderItemUpdateData source;
 
        node = g_node_find(node, G_PRE_ORDER, G_TRAVERSE_ALL, item);
        node = node->children;
 
-       source.item = item;
-       source.content_change = update_summary; 
-       hooks_invoke(FOLDER_ITEM_UPDATE_HOOKLIST, &source);
+       folder_item_update(item, update_flags);
        while (node != NULL) {
                if (node && node->data) {
                        FolderItem *next_item = (FolderItem*) node->data;
 
-                       source.item = next_item;
-                       source.content_change = update_summary; 
-                       hooks_invoke(FOLDER_ITEM_UPDATE_HOOKLIST, &source);
+                       folder_item_update(next_item, update_flags);
                }
                node = node->next;
        }
 }
 
+void folder_item_update_freeze()
+{
+       folder_item_update_freeze_cnt++;
+}
+
+static void folder_item_update_func(FolderItem *item, gpointer data)
+{
+       FolderItemUpdateData source;
+    
+       if (item->update_flags) {
+               source.item = item;
+               source.update_flags = item->update_flags;
+               hooks_invoke(FOLDER_ITEM_UPDATE_HOOKLIST, &source);                             
+               item->update_flags = 0;
+       }
+}
+
+void folder_item_update_thaw()
+{
+       if (folder_item_update_freeze_cnt > 0)
+               folder_item_update_freeze_cnt--;
+       if (folder_item_update_freeze_cnt == 0) {
+               /* Update all folders */
+               folder_func_to_all_folders(folder_item_update_func, NULL);
+       }
+}
+
 #undef PUT_ESCAPE_STR
index 2b12de6d6078378957292e69aad017a43b99912b..a6668ce4280b2776fa901c35fcc7470e9d147c36 100644 (file)
@@ -109,6 +109,12 @@ typedef enum
        F_MOVE_FAILED
 } FolderMoveStatus;
 
+typedef enum
+{
+       F_ITEM_UPDATE_MSGCNT = 1 << 0,
+       F_ITEM_UPDATE_CONTENT = 1 << 1,
+} FolderItemUpdateFlags;
+
 typedef void (*FolderUIFunc)           (Folder         *folder,
                                         FolderItem     *item,
                                         gpointer        data);
@@ -260,8 +266,8 @@ struct _FolderItem
        guint ret_rcpt       : 1; /* return receipt       */
 
        gint op_count;
-       guint opened    : 1; /* opened by summary view */
-       guint need_update    : 1; /* folderview for this folder should be updated */
+       guint opened         : 1; /* opened by summary view */
+       FolderItemUpdateFlags update_flags; /* folderview for this folder should be updated */
 
        FolderSortKey sort_key;
        FolderSortType sort_type;
@@ -292,8 +298,8 @@ typedef struct {
 
 struct _FolderItemUpdateData
 {
-       FolderItem      *item;
-       gboolean         content_change;
+       FolderItem              *item;
+       FolderItemUpdateFlags    update_flags;
 };
 
 Folder     *folder_new                 (FolderType      type,
@@ -409,10 +415,11 @@ void folder_item_set_default_flags        (FolderItem *dest, MsgFlags *flags);
 
 void folder_item_apply_processing      (FolderItem *item);
 
-void folder_update_item                        (FolderItem *item,
-                                        gboolean contentchange);
-void folder_update_items_when_required (gboolean contentchange);
-void folder_update_item_recursive      (FolderItem *item,
-                                        gboolean update_summary);
+void folder_item_update                        (FolderItem *item,
+                                        FolderItemUpdateFlags update_flags);
+void folder_item_update_recursive      (FolderItem *item,
+                                        FolderItemUpdateFlags update_flags);
+void folder_item_update_freeze         ();
+void folder_item_update_thaw           ();
 
 #endif /* __FOLDER_H__ */
index 2797094e3957b17157d3f29f3e3165782c22ad4b..50f231de0647fe6822ad0995517b44b1935f7fc5 100644 (file)
@@ -1255,8 +1255,6 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node)
 
        gtk_ctree_node_set_row_style(ctree, node, style);
 
-       item->need_update = FALSE;
-
        if ((node = gtkut_ctree_find_collapsed_parent(ctree, node)) != NULL)
                folderview_update_node(folderview, node);
 }
@@ -1276,8 +1274,9 @@ gboolean folderview_update_item(gpointer source, gpointer data)
 
        node = gtk_ctree_find_by_row_data(ctree, NULL, update_info->item);
        if (node) {
-               folderview_update_node(folderview, node);
-               if (update_info->content_change && folderview->opened == node)
+               if (update_info->update_flags & F_ITEM_UPDATE_MSGCNT)
+                       folderview_update_node(folderview, node);
+               if ((update_info->update_flags & F_ITEM_UPDATE_CONTENT) && (folderview->opened == node))
                        summary_show(folderview->summaryview, update_info->item);
        }
        
@@ -1849,12 +1848,6 @@ static void folderview_update_tree_cb(FolderView *folderview, guint action,
                folderview_check_new(item->folder);
        else
                folderview_rescan_tree(item->folder);
-       
-       if (folderview->opened) {
-               item = gtk_ctree_node_get_row_data(ctree, folderview->opened);
-               if (item)
-                       folder_update_item(item, TRUE);
-       }
 }
 
 void folderview_create_folder_node_recursive(FolderView *folderview, FolderItem *item)
@@ -2595,8 +2588,6 @@ static void folderview_move_to(FolderView *folderview, FolderItem *from_folder,
                        debug_print("can't remove src node: is null\n");
 
                folderview_create_folder_node_recursive(folderview, new_folder);
-               folder_update_item(from_parent, TRUE);
-               folder_update_item_recursive(new_folder, TRUE); 
                folderview_sort_folders(folderview, 
                        gtk_ctree_find_by_row_data(GTK_CTREE(folderview->ctree), 
                                NULL, new_folder->parent), new_folder->folder);
index ced1aaa027732561a4e83d7fe3862775cf398267..6a1af854865dc4cbd29a4ba30410cb7dcff9563a 100644 (file)
@@ -107,7 +107,6 @@ gint import_mbox(FolderItem *default_dest)
                                g_warning("Can't find the folder.\n");
                        } else {
                                ok = proc_mbox(dest, filename);
-                               folder_update_item(dest, TRUE);
                        }
                }
        }
index 52a19d3ef1b45aa5a45a1f68318e428dd9fccced..fc239f1bd4229e121c708ef6581930c3c13f1c13 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -151,11 +151,6 @@ static void inc_finished(MainWindow *mainwin, gboolean new_messages)
                        folderview_unselect(mainwin->folderview);
                        folderview_select(mainwin->folderview, item);
                }       
-       } else if (prefs_common.scan_all_after_inc) {
-               item = mainwin->summaryview->folder_item;
-               if (FOLDER_SUMMARY_MISMATCH(item, mainwin->summaryview)) {
-                       folder_update_item(item, TRUE);
-               }       
        }
 }
 
@@ -249,9 +244,6 @@ static gint inc_account_mail(PrefsAccount *account, MainWindow *mainwin)
        case A_IMAP4:
        case A_NNTP:
                folderview_check_new(FOLDER(account->folder));
-               if (!prefs_common.scan_all_after_inc && item != NULL &&
-                   FOLDER(account->folder) == item->folder)
-                       folder_update_item(item, TRUE);
                return 1;
 
        case A_POP3:
@@ -330,9 +322,6 @@ void inc_all_account_mail(MainWindow *mainwin, gboolean notify)
                        FolderItem *item = mainwin->summaryview->folder_item;
 
                        folderview_check_new(FOLDER(account->folder));
-                       if (!prefs_common.scan_all_after_inc && item != NULL &&
-                           FOLDER(account->folder) == item->folder)
-                               folder_update_item(item, TRUE);
                }
        }
 
@@ -619,11 +608,6 @@ static gint inc_start(IncProgressDialog *inc_dialog)
 
                new_msgs += pop3_state->cur_total_num;
 
-               if (!prefs_common.scan_all_after_inc) {
-                       folder_update_items_when_required
-                                (!prefs_common.open_inbox_on_inc);
-               }
-
                if (pop3_state->error_val == PS_AUTHFAIL &&
                    pop3_state->ac_prefs->tmp_pass) {
                        g_free(pop3_state->ac_prefs->tmp_pass);
@@ -1174,13 +1158,6 @@ static gint get_spool(FolderItem *dest, const gchar *mbox)
        if (msgs >= 0) empty_mbox(mbox);
        unlock_mbox(mbox, lockfd, LOCK_FLOCK);
 
-       if (!prefs_common.scan_all_after_inc) {
-               folder_update_items_when_required
-                       (!prefs_common.open_inbox_on_inc);
-       } else if (!prefs_common.scan_all_after_inc) {
-               folder_update_item(dest, TRUE);
-       }
-
        return msgs;
 }
 
index 9fcf09360e86869c63e0215417402c65ad8b976b..97575d362e5a44050425d767babeef11003ef745 100644 (file)
@@ -786,13 +786,9 @@ static void send_queue(void)
                                alertpanel_error(_("Some errors occurred while sending queued messages."));
                        folder_item_scan(folder->queue);
                        if (prefs_common.savemsg && folder->outbox) {
-                               folder_update_item(folder->outbox, TRUE);
                                if (folder->outbox == def_outbox)
                                        def_outbox = NULL;
                        }
                }
        }
-
-       if (prefs_common.savemsg && def_outbox)
-               folder_update_item(def_outbox, TRUE);
 }
index 7fbb37ea359686b26ec3a077ea789973126635c7..c6aa29b8d0b28d507b96404ea23ad527472b69d6 100644 (file)
@@ -1362,13 +1362,6 @@ void main_window_empty_trash(MainWindow *mainwin, gboolean confirm)
 
        procmsg_empty_trash();
 
-       for (list = folder_get_list(); list != NULL; list = list->next) {
-               folder = list->data;
-               if (folder && folder->trash) {
-                       folder_update_item(folder->trash, TRUE);
-               }
-       }
-
        if (mainwin->summaryview->folder_item &&
            mainwin->summaryview->folder_item->stype == F_TRASH)
                gtk_widget_grab_focus(mainwin->folderview->ctree);
index f7c6aab3d4a8d40edb04094e4a536507e629c4a5..2c3f96032b4739690510f4b8cfed6db37048c069 100644 (file)
@@ -354,8 +354,6 @@ static gint disposition_notification_queue(PrefsAccount * account,
        }
        g_free(tmp);
 
-       folder_update_item(queue, TRUE);
-
        return 0;
 }
 
index c7b02a6ee4b5cc2bfed9ce8a876ad3c6888c1559..988dff92e0f48d867cff5b6a0de8d5a020e74587 100644 (file)
@@ -617,7 +617,7 @@ void prefs_folder_item_ok_cb(GtkWidget *widget,
        prefs->color = dialog->item->prefs->color;
        /* update folder view */
        if (prefs->color > 0)
-               folder_update_item(dialog->item, FALSE);
+               folder_item_update(dialog->item, F_ITEM_UPDATE_MSGCNT);
 
        prefs_folder_item_save_config(dialog->item);
        prefs_folder_item_destroy(dialog);
index db179c1b3f843ec6e141e5a808ab107536f5bad2..f0f84ad44aab7834d3f98017d67849cb7fb08de2 100644 (file)
@@ -900,8 +900,6 @@ gint procmsg_send_queue(FolderItem *queue, gboolean save_msgs)
                procmsg_msginfo_free(msginfo);
        }
 
-       folder_update_item(queue, FALSE);
-
        return ret;
 }
 
@@ -969,7 +967,7 @@ gint procmsg_save_to_outbox(FolderItem *outbox, const gchar *file,
            procmsg_msginfo_unset_flags(msginfo, ~0, 0);
            procmsg_msginfo_free(msginfo);
        }
-       folder_update_item(outbox, TRUE);
+       folder_item_update(outbox, TRUE);
 
        return 0;
 }
@@ -1454,20 +1452,17 @@ void procmsg_msginfo_set_flags(MsgInfo *msginfo, MsgPermFlags perm_flags, MsgTmp
        if ((perm_flags & MSG_NEW) && !MSG_IS_NEW(msginfo->flags) &&
           !MSG_IS_IGNORE_THREAD(msginfo->flags)) {
                item->new++;
-               item->need_update = TRUE;
        }
 
        /* if unread flag is set */
        if ((perm_flags & MSG_UNREAD) && !MSG_IS_UNREAD(msginfo->flags) &&
           !MSG_IS_IGNORE_THREAD(msginfo->flags)) {
                item->unread++;
-               item->need_update = TRUE;
        }
 
        if (!MSG_IS_UNREAD(msginfo->flags) &&(perm_flags & MSG_UNREAD)
        && procmsg_msg_has_marked_parent(msginfo)) {
                item->unreadmarked++;
-               item->need_update = TRUE;
        }
        
        if (!MSG_IS_MARKED(msginfo->flags) && (perm_flags & MSG_MARKED)) {
@@ -1479,16 +1474,13 @@ void procmsg_msginfo_set_flags(MsgInfo *msginfo, MsgPermFlags perm_flags, MsgTmp
        if ((perm_flags & MSG_IGNORE_THREAD) && !MSG_IS_IGNORE_THREAD(msginfo->flags)) {
                if (MSG_IS_NEW(msginfo->flags) || (perm_flags & MSG_NEW)) {
                        item->new--;
-                       item->need_update = TRUE;
                }
                if (MSG_IS_UNREAD(msginfo->flags) || (perm_flags & MSG_UNREAD)) {
                        item->unread--;
-                       item->need_update = TRUE;
                }
                if ((perm_flags & MSG_UNREAD) || (MSG_IS_UNREAD(msginfo->flags)
                && procmsg_msg_has_marked_parent(msginfo))) {
                        item->unreadmarked--;
-                       item->need_update = TRUE;
                }
                if ((perm_flags & MSG_MARKED) || (MSG_IS_MARKED(msginfo->flags)
                && !MSG_IS_IGNORE_THREAD(msginfo->flags))) {
@@ -1505,6 +1497,7 @@ void procmsg_msginfo_set_flags(MsgInfo *msginfo, MsgPermFlags perm_flags, MsgTmp
 
        msginfo_update.msginfo = msginfo;
        hooks_invoke(MSGINFO_UPDATE_HOOKLIST, &msginfo_update);
+       folder_item_update(msginfo->folder, F_ITEM_UPDATE_MSGCNT);
 
        CHANGE_FLAGS(msginfo);
        procmsg_msginfo_write_flags(msginfo);
@@ -1525,21 +1518,18 @@ void procmsg_msginfo_unset_flags(MsgInfo *msginfo, MsgPermFlags perm_flags, MsgT
        if ((perm_flags & MSG_NEW) && MSG_IS_NEW(msginfo->flags) &&
           !MSG_IS_IGNORE_THREAD(msginfo->flags)) {
                item->new--;
-               item->need_update = TRUE;
        }
 
        /* if unread flag is unset */
        if ((perm_flags & MSG_UNREAD) && MSG_IS_UNREAD(msginfo->flags) &&
           !MSG_IS_IGNORE_THREAD(msginfo->flags)) {
                item->unread--;
-               item->need_update = TRUE;
        }
        
        if (MSG_IS_UNREAD(msginfo->flags) && (perm_flags & MSG_UNREAD)
        && !MSG_IS_IGNORE_THREAD(msginfo->flags)
        && procmsg_msg_has_marked_parent(msginfo)) {
                item->unreadmarked--;
-               item->need_update = TRUE;
        }
 
        if (MSG_IS_MARKED(msginfo->flags) && (perm_flags & MSG_MARKED)
@@ -1551,16 +1541,13 @@ void procmsg_msginfo_unset_flags(MsgInfo *msginfo, MsgPermFlags perm_flags, MsgT
        if ((perm_flags & MSG_IGNORE_THREAD) && MSG_IS_IGNORE_THREAD(msginfo->flags)) {
                if (MSG_IS_NEW(msginfo->flags) && !(perm_flags & MSG_NEW)) {
                        item->new++;
-                       item->need_update = TRUE;
                }
                if (MSG_IS_UNREAD(msginfo->flags) && !(perm_flags & MSG_UNREAD)) {
                        item->unread++;
-                       item->need_update = TRUE;
                }
                if (MSG_IS_UNREAD(msginfo->flags) && !(perm_flags & MSG_UNREAD)
                && procmsg_msg_has_marked_parent(msginfo)) {
                        item->unreadmarked++;
-                       item->need_update = TRUE;
                }
                if (MSG_IS_MARKED(msginfo->flags) && !(perm_flags & MSG_MARKED)) {
                        procmsg_update_unread_children(msginfo, TRUE);
@@ -1576,6 +1563,7 @@ void procmsg_msginfo_unset_flags(MsgInfo *msginfo, MsgPermFlags perm_flags, MsgT
 
        msginfo_update.msginfo = msginfo;
        hooks_invoke(MSGINFO_UPDATE_HOOKLIST, &msginfo_update);
+       folder_item_update(msginfo->folder, F_ITEM_UPDATE_MSGCNT);
 
        CHANGE_FLAGS(msginfo);
        procmsg_msginfo_write_flags(msginfo);
@@ -1704,7 +1692,7 @@ GSList *procmsg_find_children (MsgInfo *info)
        return children;
 }
 
-static void procmsg_update_unread_children (MsgInfo *info, gboolean newly_marked)
+static void procmsg_update_unread_children(MsgInfo *info, gboolean newly_marked)
 {
        GSList *children = procmsg_find_children(info);
        GSList *cur;
@@ -1715,7 +1703,7 @@ static void procmsg_update_unread_children (MsgInfo *info, gboolean newly_marked
                                info->folder->unreadmarked++;
                        else
                                info->folder->unreadmarked--;
-                       info->folder->need_update = TRUE;
+                       folder_item_update(info->folder, F_ITEM_UPDATE_MSGCNT);
                }
                procmsg_msginfo_free(tmp);
        }
index 132fa97ffa2ef3a0e4159ddf4738eada15cafbbe..3d2f36e23e7343518521fb386c9b402ca6afefef 100644 (file)
@@ -2255,8 +2255,6 @@ static void summary_set_ctree_from_list(SummaryView *summaryview,
 
                g_node_destroy(root);
 
-               folder_update_items_when_required(FALSE);
-
                summary_thread_init(summaryview);
        } else {
                gchar *text[N_SUMMARY_COLS];
@@ -2450,7 +2448,6 @@ static void summary_display_msg_full(SummaryView *summaryview,
                if (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)) {
                        procmsg_msginfo_unset_flags
                                (msginfo, MSG_NEW | MSG_UNREAD, 0);
-                       folder_update_item(msginfo->folder, FALSE);
                        summary_set_row_marks(summaryview, row);
                        gtk_clist_thaw(GTK_CLIST(ctree));
                        summary_status_show(summaryview);
@@ -2789,14 +2786,14 @@ static void summary_mark_row(SummaryView *summaryview, GtkCTreeNode *row)
                changed = TRUE;
                msginfo->to_folder->op_count--;
                if (msginfo->to_folder->op_count == 0)
-                       folder_update_item(msginfo->to_folder, FALSE);
+                       folder_item_update(msginfo->to_folder, F_ITEM_UPDATE_MSGCNT);
        }
        if (MSG_IS_COPY(msginfo->flags)) {
                summaryview->copied--;
                changed = TRUE;
                msginfo->to_folder->op_count--;
                if (msginfo->to_folder->op_count == 0)
-                       folder_update_item(msginfo->to_folder, FALSE);
+                       folder_item_update(msginfo->to_folder, F_ITEM_UPDATE_MSGCNT);
        }
        changed |= summary_update_unread_children (summaryview, msginfo, TRUE);
 
@@ -2828,7 +2825,7 @@ static void summary_lock_row(SummaryView *summaryview, GtkCTreeNode *row)
        if (changed && !prefs_common.immediate_exec) {
                msginfo->to_folder->op_count--;
                if (msginfo->to_folder->op_count == 0)
-                       folder_update_item(msginfo->to_folder, FALSE);
+                       folder_item_update(msginfo->to_folder, F_ITEM_UPDATE_MSGCNT);
        }
        msginfo->to_folder = NULL;
        procmsg_msginfo_unset_flags(msginfo, MSG_DELETED, MSG_MOVE | MSG_COPY);
@@ -2882,7 +2879,6 @@ void summary_mark_as_read(SummaryView *summaryview)
        for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next)
                summary_mark_row_as_read(summaryview,
                                         GTK_CTREE_NODE(cur->data));
-       folder_update_items_when_required(FALSE);
 
        summary_status_show(summaryview);
 }
@@ -2903,7 +2899,6 @@ void summary_mark_all_read(SummaryView *summaryview)
                        summary_set_row_marks(summaryview, node);
        }
        gtk_clist_thaw(clist);
-       folder_update_items_when_required(FALSE);
 
        summary_status_show(summaryview);
 }
@@ -2944,7 +2939,6 @@ void summary_mark_as_unread(SummaryView *summaryview)
        for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next)
                summary_mark_row_as_unread(summaryview,
                                           GTK_CTREE_NODE(cur->data));
-       folder_update_items_when_required(FALSE);
 
        summary_status_show(summaryview);
 }
@@ -3018,14 +3012,14 @@ static void summary_delete_row(SummaryView *summaryview, GtkCTreeNode *row)
                changed = TRUE;
                msginfo->to_folder->op_count--;
                if (msginfo->to_folder->op_count == 0)
-                       folder_update_item(msginfo->to_folder, FALSE);
+                       folder_item_update(msginfo->to_folder, F_ITEM_UPDATE_MSGCNT);
        }
        if (MSG_IS_COPY(msginfo->flags)) {
                summaryview->copied--;
                changed = TRUE;
                msginfo->to_folder->op_count--;
                if (msginfo->to_folder->op_count == 0)
-                       folder_update_item(msginfo->to_folder, FALSE);
+                       folder_item_update(msginfo->to_folder, F_ITEM_UPDATE_MSGCNT);
        }
        changed |= summary_update_unread_children (summaryview, msginfo, FALSE);
 
@@ -3185,7 +3179,7 @@ static void summary_unmark_row(SummaryView *summaryview, GtkCTreeNode *row)
                if (!prefs_common.immediate_exec) {
                        msginfo->to_folder->op_count--;
                        if (msginfo->to_folder->op_count == 0)
-                               folder_update_item(msginfo->to_folder, FALSE);
+                               folder_item_update(msginfo->to_folder, F_ITEM_UPDATE_MSGCNT);
                }
                summaryview->moved--;
                changed = TRUE;
@@ -3194,7 +3188,7 @@ static void summary_unmark_row(SummaryView *summaryview, GtkCTreeNode *row)
                if (!prefs_common.immediate_exec) {
                        msginfo->to_folder->op_count--;
                        if (msginfo->to_folder->op_count == 0)
-                               folder_update_item(msginfo->to_folder, FALSE);
+                               folder_item_update(msginfo->to_folder, F_ITEM_UPDATE_MSGCNT);
                }
                summaryview->copied--;
                changed = TRUE;
@@ -3234,7 +3228,7 @@ static void summary_move_row_to(SummaryView *summaryview, GtkCTreeNode *row,
                if (!prefs_common.immediate_exec) {
                        msginfo->to_folder->op_count--;
                        if (msginfo->to_folder->op_count == 0) {
-                               folder_update_item(msginfo->to_folder, FALSE);
+                               folder_item_update(msginfo->to_folder, F_ITEM_UPDATE_MSGCNT);
                                changed = TRUE;
                        }
                }
@@ -3258,7 +3252,7 @@ static void summary_move_row_to(SummaryView *summaryview, GtkCTreeNode *row,
                if (changed) {
                        msginfo->to_folder->op_count++;
                        if (msginfo->to_folder->op_count == 1)
-                               folder_update_item(msginfo->to_folder, FALSE);
+                               folder_item_update(msginfo->to_folder, F_ITEM_UPDATE_MSGCNT);
                }
        }
 
@@ -3292,8 +3286,6 @@ void summary_move_selected_to(SummaryView *summaryview, FolderItem *to_folder)
                summary_execute(summaryview);
        else {
                summary_status_show(summaryview);
-
-               folder_update_item(to_folder, FALSE);
        }
        
        if (!summaryview->selected) { /* this was the last message */
@@ -3331,7 +3323,6 @@ static void summary_copy_row_to(SummaryView *summaryview, GtkCTreeNode *row,
                if (!prefs_common.immediate_exec) {
                        msginfo->to_folder->op_count--;
                        if (msginfo->to_folder->op_count == 0) {
-                               folder_update_item(msginfo->to_folder, FALSE);
                                changed = TRUE;
                        }
                }
@@ -3355,7 +3346,7 @@ static void summary_copy_row_to(SummaryView *summaryview, GtkCTreeNode *row,
                if (changed) {
                        msginfo->to_folder->op_count++;
                        if (msginfo->to_folder->op_count == 1)
-                               folder_update_item(msginfo->to_folder, FALSE);
+                               folder_item_update(msginfo->to_folder, F_ITEM_UPDATE_MSGCNT);
                }
        }
 
@@ -3389,8 +3380,6 @@ void summary_copy_selected_to(SummaryView *summaryview, FolderItem *to_folder)
                summary_execute(summaryview);
        else {
                summary_status_show(summaryview);
-
-               folder_update_item(to_folder, FALSE);
        }
 }
 
@@ -3625,15 +3614,11 @@ static void summary_execute_move(SummaryView *summaryview)
        if (summaryview->mlist) {
                procmsg_move_messages(summaryview->mlist);
 
-               folder_update_items_when_required(FALSE);
-
                for (cur = summaryview->mlist; cur != NULL; cur = cur->next)
                        procmsg_msginfo_free((MsgInfo *)cur->data);
                g_slist_free(summaryview->mlist);
                summaryview->mlist = NULL;
        }
-
-       folder_update_item(summaryview->folder_item, FALSE);
 }
 
 static void summary_execute_move_func(GtkCTree *ctree, GtkCTreeNode *node,
@@ -3672,8 +3657,6 @@ static void summary_execute_copy(SummaryView *summaryview)
        if (summaryview->mlist) {
                procmsg_copy_messages(summaryview->mlist);
 
-               folder_update_items_when_required(FALSE);
-
                g_slist_free(summaryview->mlist);
                summaryview->mlist = NULL;
        }
@@ -3728,11 +3711,6 @@ static void summary_execute_delete(SummaryView *summaryview)
 
        g_slist_free(summaryview->mlist);
        summaryview->mlist = NULL;
-
-       if ((summaryview->folder_item != trash) && (trash != NULL)) {
-               folder_update_item(trash, FALSE);
-       }
-       folder_update_item(summaryview->folder_item, FALSE);
 }
 
 static void summary_execute_delete_func(GtkCTree *ctree, GtkCTreeNode *node,
@@ -4035,8 +4013,6 @@ void summary_filter(SummaryView *summaryview)
                                        summaryview);
 
                gtk_clist_thaw(GTK_CLIST(summaryview->ctree));
-
-               folder_update_items_when_required(FALSE);
        }
 
        debug_print("done.\n");
@@ -5228,7 +5204,6 @@ static void news_flag_crosspost(MsgInfo *msginfo)
                        debug_print(" <%s>", (gchar *)value);
                        if (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)) {
                                procmsg_msginfo_unset_flags(msginfo, MSG_NEW | MSG_UNREAD, 0);
-                               folder_update_item(msginfo->folder, FALSE);
                                procmsg_msginfo_set_flags(msginfo, mff->account->crosspost_col, 0);
                        }
                        g_hash_table_remove(mff->newsart, key);
@@ -5268,7 +5243,6 @@ static void summary_ignore_thread(SummaryView *summaryview)
        for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next) {
                gtk_ctree_pre_recursive(ctree, GTK_CTREE_NODE(cur->data), GTK_CTREE_FUNC(summary_ignore_thread_func), summaryview);
        }
-       folder_update_items_when_required(FALSE);
 
        summary_status_show(summaryview);
 }
@@ -5302,7 +5276,6 @@ static void summary_unignore_thread(SummaryView *summaryview)
        for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next) {
                gtk_ctree_pre_recursive(ctree, GTK_CTREE_NODE(cur->data), GTK_CTREE_FUNC(summary_unignore_thread_func), summaryview);
        }
-       folder_update_items_when_required(FALSE);
 
        summary_status_show(summaryview);
 }
index 619340e5e0e8ed53bc04d9ace9fb8e8a0ab7c691..6283acad006030a08946f4bb44e005072dd75310 100644 (file)
@@ -2102,7 +2102,6 @@ void send_queue_cb(gpointer data, guint action, GtkWidget *widget)
                                (folder->queue, prefs_common.savemsg) < 0)
                                alertpanel_error(_("Some errors occurred while sending queued messages."));
                        folder_item_scan(folder->queue);
-                       folder_update_item(folder->queue, TRUE);
                }
        }
 }