* config/.cvsignore
authorChristoph Hohmann <reboot@gmx.ch>
Thu, 10 Oct 2002 18:21:11 +0000 (18:21 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Thu, 10 Oct 2002 18:21:11 +0000 (18:21 +0000)
        added Makefile
* src/filtering.[ch]
* src/folder.[ch]
* src/folderview.[ch]
* src/import.c
* src/inc.[ch]
* src/mbox.[ch]
* src/procmsg.c
* src/summaryview.[ch]
        o added new flag need_update to FolderItem
        o removed folder_table from various functions from tracking
          folder updates
        o set need_update flags in folder.c's move, copy and delete
          functions and procmsg's flags functions
        o added function folderview_update_items_when_required that
          updates all folders with need_update set
        o call folderview_update_items_when_required instead of
          folderview_update_item_foreach

17 files changed:
ChangeLog.claws
config/.cvsignore
configure.in
src/filtering.c
src/filtering.h
src/folder.c
src/folder.h
src/folderview.c
src/folderview.h
src/import.c
src/inc.c
src/inc.h
src/mbox.c
src/mbox.h
src/procmsg.c
src/summaryview.c
src/summaryview.h

index 18e65d7..5ee818d 100644 (file)
@@ -1,3 +1,25 @@
+2002-10-10 [christoph] 0.8.5claws8
+
+       * config/.cvsignore
+               added Makefile
+       * src/filtering.[ch]
+       * src/folder.[ch]
+       * src/folderview.[ch]
+       * src/import.c
+       * src/inc.[ch]
+       * src/mbox.[ch]
+       * src/procmsg.c
+       * src/summaryview.[ch]
+               o added new flag need_update to FolderItem
+               o removed folder_table from various functions from tracking
+                 folder updates
+               o set need_update flags in folder.c's move, copy and delete
+                 functions and procmsg's flags functions
+               o added function folderview_update_items_when_required that
+                 updates all folders with need_update set
+               o call folderview_update_items_when_required instead of
+                 folderview_update_item_foreach
+
 2002-10-09 [sergey]    0.8.5claws7
 
        * src/compose.c
index 6f87e62..95ead33 100644 (file)
@@ -2,6 +2,7 @@ config.guess
 config.sub
 install-sh
 ltmain.sh
+Makefile
 Makefile.in
 missing
 mkinstalldirs
index 9378943..0165e55 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws7
+EXTRA_VERSION=claws8
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index e35c780..80e7dfb 100644 (file)
@@ -113,8 +113,7 @@ msginfo->folder->folder->change_flags(msginfo->folder->folder, \
                                      msginfo); \
 }
 
-static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info,
-                                     GHashTable *folder_table)
+static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info)
 {
        FolderItem * dest_folder;
        gint val;
@@ -134,14 +133,6 @@ static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info,
                        return FALSE;
                }       
 
-               if (folder_table) {
-                       val = GPOINTER_TO_INT(g_hash_table_lookup
-                                             (folder_table, dest_folder));
-                       if (val == 0) {
-                               g_hash_table_insert(folder_table, dest_folder,
-                                                   GINT_TO_POINTER(1));
-                       }
-               }
                return TRUE;
 
        case MATCHACTION_COPY:
@@ -154,14 +145,6 @@ static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info,
                if (folder_item_copy_msg(dest_folder, info) == -1)
                        return FALSE;
 
-               if (folder_table) {
-                       val = GPOINTER_TO_INT(g_hash_table_lookup
-                                             (folder_table, dest_folder));
-                       if (val == 0) {
-                               g_hash_table_insert(folder_table, dest_folder,
-                                                   GINT_TO_POINTER(1));
-                       }
-               }
                return TRUE;
 
        case MATCHACTION_DELETE:
@@ -268,13 +251,12 @@ static gboolean filtering_match_condition(FilteringProp *filtering, MsgInfo *inf
        return matcherlist_match(filtering->matchers, info);
 }
 
-static gboolean filtering_apply_rule(FilteringProp *filtering, MsgInfo *info, 
-                                    GHashTable *foldertable)
+static gboolean filtering_apply_rule(FilteringProp *filtering, MsgInfo *info)
 {
        gboolean result;
        gchar    buf[50];
 
-       if (FALSE == (result = filteringaction_apply(filtering->action, info, foldertable))) {
+       if (FALSE == (result = filteringaction_apply(filtering->action, info))) {
                g_warning(_("action %s could not be applied"), 
                filteringaction_to_string(buf, sizeof buf, filtering->action));
        }
@@ -303,7 +285,7 @@ static gboolean filtering_is_final_action(FilteringProp *filtering)
 }
 
 static void filter_msginfo(GSList * filtering_list, FolderItem *inbox,
-                          MsgInfo * info, GHashTable *folder_table)
+                          MsgInfo * info)
 {
        GSList  *l;
        gboolean final;
@@ -319,7 +301,7 @@ static void filter_msginfo(GSList * filtering_list, FolderItem *inbox,
                FilteringProp * filtering = (FilteringProp *) l->data;
 
                if (filtering_match_condition(filtering, info)) {
-                       applied = filtering_apply_rule(filtering, info, folder_table);
+                       applied = filtering_apply_rule(filtering, info);
                        if (TRUE == (final = filtering_is_final_action(filtering)))
                                break;
                }               
@@ -333,15 +315,6 @@ static void filter_msginfo(GSList * filtering_list, FolderItem *inbox,
                                debug_print("*** Could not drop message in inbox; check .processing\n");
                                return;
                        }       
-                       if (folder_table) {
-                               val = GPOINTER_TO_INT(g_hash_table_lookup
-                                                     (folder_table, inbox));
-                               if (val == 0) {
-                                       folder_item_scan(inbox);
-                                       g_hash_table_insert(folder_table, inbox,
-                                                           GINT_TO_POINTER(1));
-                               }
-                       }
                }       
        }
 }
@@ -351,9 +324,8 @@ static void filter_msginfo(GSList * filtering_list, FolderItem *inbox,
  *
  *\param       flist filter and actions list
  *\param       info message
- *\param       ftable table with changed folders after call
  */
-void filter_message_by_msginfo_with_inbox(GSList *flist, MsgInfo *info, GHashTable *ftable, FolderItem *def_inbox)
+void filter_message_by_msginfo_with_inbox(GSList *flist, MsgInfo *info, FolderItem *def_inbox)
 {
        FolderItem *inbox;
 
@@ -367,12 +339,12 @@ void filter_message_by_msginfo_with_inbox(GSList *flist, MsgInfo *info, GHashTab
         * message is already in a folder. the filtering code will
         * handle duplicate moves and copies.
         */
-       filter_msginfo(flist, inbox, info, ftable);
+       filter_msginfo(flist, inbox, info);
 }
 
-void filter_message_by_msginfo(GSList *flist, MsgInfo *info, GHashTable *ftable)
+void filter_message_by_msginfo(GSList *flist, MsgInfo *info)
 {
-       filter_message_by_msginfo_with_inbox(flist, info, ftable, info->folder);
+       filter_message_by_msginfo_with_inbox(flist, info, info->folder);
 }
 
 /*!
@@ -382,11 +354,10 @@ void filter_message_by_msginfo(GSList *flist, MsgInfo *info, GHashTable *ftable)
   *\param      filtering_list list of filters and actions
   *\param      inbox default inbox when no filter could be applied
   *\param      msgnum message number in processing folder
-  *\param      folder_table table with folders that have been
   *            changed after the call to this function
   */
 void filter_message(GSList *filtering_list, FolderItem *inbox,
-                   gint msgnum, GHashTable *folder_table)
+                   gint msgnum)
 {
        MsgInfo *msginfo;
        gchar *filename;
@@ -417,7 +388,7 @@ void filter_message(GSList *filtering_list, FolderItem *inbox,
        msginfo->folder = item;
        msginfo->msgnum = msgnum;
 
-       filter_msginfo(filtering_list, inbox, msginfo, folder_table);
+       filter_msginfo(filtering_list, inbox, msginfo);
 
        procmsg_msginfo_free(msginfo);
 }
index 3c9124c..3c1bb21 100644 (file)
@@ -57,15 +57,12 @@ void filteringprop_free(FilteringProp *prop);
 
 FilteringProp * filteringprop_parse(gchar **str);
 
-void filter_msginfo_move_or_delete(GSList *filtering_list, MsgInfo *info,
-                                  GHashTable *folder_table);
+void filter_msginfo_move_or_delete(GSList *filtering_list, MsgInfo *info);
 void filter_message_by_msginfo_with_inbox(GSList *flist, MsgInfo *info, 
-                                         GHashTable *ftable,
                                          FolderItem *def_inbox);
-void filter_message_by_msginfo(GSList *flist, MsgInfo *info, 
-                              GHashTable *ftable);
+void filter_message_by_msginfo(GSList *flist, MsgInfo *info);
 void filter_message(GSList *filtering_list, FolderItem *inbox,
-                   gint msgnum, GHashTable *folder_table);
+                   gint msgnum);
 
 gchar * filteringaction_to_string(gchar *dest, gint destlen, FilteringAction *action);
 void prefs_filtering_write_config(void);
index a5bbe26..8c8a7cf 100644 (file)
@@ -1113,7 +1113,6 @@ gint folder_item_scan(FolderItem *item)
                                procmsg_msginfo_free(msginfo);
                        }
                        g_slist_free(newmsg_list);
-                       folderview_update_item(item, FALSE);
                }
        } else if (folder->fetch_msginfo) {
                GSList *elem;
@@ -1135,7 +1134,6 @@ gint folder_item_scan(FolderItem *item)
                                debug_print("Added newly found message %d to cache.\n", num);
                        }
                }
-               folderview_update_item(item, FALSE);
        }
 
        item->new = newcnt;
@@ -1435,7 +1433,8 @@ gint folder_item_move_msg(FolderItem *dest, MsgInfo *msginfo)
        
        if (num != -1) {
                MsgInfo *newmsginfo;
-
+    
+               /* Add new msginfo to dest folder */
                if (NULL != (newmsginfo = folder->fetch_msginfo(folder, dest, num))) {
                        newmsginfo->flags.perm_flags = msginfo->flags.perm_flags;
                        
@@ -1445,26 +1444,29 @@ gint folder_item_move_msg(FolderItem *dest, MsgInfo *msginfo)
                                                     MSG_NEW|MSG_UNREAD|MSG_DELETED);
                        msgcache_add_msg(dest->cache, newmsginfo);
 
-                       /* CLAWS */
-                       if (src_folder->remove_msg)
-                               src_folder->remove_msg(src_folder, msginfo->folder,
-                                                      msginfo->msgnum);
-                       
-                       msgcache_remove_msg(msginfo->folder->cache, msginfo->msgnum);
-
-                       if (MSG_IS_NEW(msginfo->flags))
-                               msginfo->folder->new--;
                        if (MSG_IS_NEW(newmsginfo->flags))
                                dest->new++;
-                       if (MSG_IS_UNREAD(msginfo->flags))
-                               msginfo->folder->unread--;
                        if (MSG_IS_UNREAD(newmsginfo->flags))
                                dest->unread++;
-                       msginfo->folder->total--;
                        dest->total++;
+                       dest->need_update = TRUE;
 
                        procmsg_msginfo_free(newmsginfo);
                }
+
+               /* remove source message from it's folder */
+               if (src_folder->remove_msg) {
+                       src_folder->remove_msg(src_folder, msginfo->folder,
+                                              msginfo->msgnum);
+                       msgcache_remove_msg(msginfo->folder->cache, msginfo->msgnum);
+
+                       if (MSG_IS_NEW(msginfo->flags))
+                               msginfo->folder->new--;
+                       if (MSG_IS_UNREAD(msginfo->flags))
+                               msginfo->folder->unread--;
+                       msginfo->folder->total--;
+                       msginfo->folder->need_update = TRUE;
+               }
        }
        
        if (folder->finished_copy)
@@ -1556,6 +1558,7 @@ gint folder_item_move_msgs_with_dest(FolderItem *dest, GSList *msglist)
                                if (MSG_IS_UNREAD(newmsginfo->flags))
                                        dest->unread++;
                                dest->total++;
+                               dest->need_update = TRUE;
 
                                procmsg_msginfo_free(newmsginfo);
                        }
@@ -1587,6 +1590,7 @@ gint folder_item_move_msgs_with_dest(FolderItem *dest, GSList *msglist)
                        if (MSG_IS_UNREAD(msginfo->flags))
                                msginfo->folder->unread--;
                        msginfo->folder->total--;                       
+                       msginfo->folder->need_update = TRUE;
                }
 
                l2 = g_slist_next(l2);
@@ -1652,6 +1656,7 @@ gint folder_item_copy_msg(FolderItem *dest, MsgInfo *msginfo)
                        if (MSG_IS_UNREAD(newmsginfo->flags))
                                dest->unread++;
                        dest->total++;
+                       dest->need_update = TRUE;
 
                        procmsg_msginfo_free(newmsginfo);
                }                       
@@ -1740,6 +1745,7 @@ gint folder_item_copy_msgs_with_dest(FolderItem *dest, GSList *msglist)
                                if (MSG_IS_UNREAD(newmsginfo->flags))
                                        dest->unread++;
                                dest->total++;
+                               dest->need_update = TRUE;
 
                                procmsg_msginfo_free(newmsginfo);
                        }
@@ -1777,6 +1783,7 @@ gint folder_item_remove_msg(FolderItem *item, gint num)
                msgcache_remove_msg(item->cache, num);
        }
        item->total--;
+       item->need_update = TRUE;
 
        return ret;
 }
@@ -1824,6 +1831,7 @@ gint folder_item_remove_all_msg(FolderItem *item)
                item->new = 0;
                item->unread = 0;
                item->total = 0;
+               item->need_update = TRUE;
        }
 
        return result;
@@ -2419,14 +2427,12 @@ void folder_item_apply_processing(FolderItem *item)
 {
        GSList *processing_list;
        GSList *mlist, *cur;
-       GHashTable *folder_table;
        
        g_return_if_fail(item != NULL);
        
        processing_list = item->prefs->processing;
        if (processing_list == NULL)
                return;
-       folder_table = g_hash_table_new(NULL, NULL);
 
        mlist = folder_item_get_msg_list(item);
        
@@ -2434,15 +2440,11 @@ void folder_item_apply_processing(FolderItem *item)
                MsgInfo * msginfo;
 
                msginfo = (MsgInfo *) cur->data;
-               filter_message_by_msginfo(processing_list, msginfo,
-                                         folder_table);
+               filter_message_by_msginfo(processing_list, msginfo);
                procmsg_msginfo_free(msginfo);
        }
        
-       /* folder_item_scan_foreach(summaryview->folder_table); */
-       folderview_update_item_foreach(folder_table, FALSE);
+       folderview_update_items_when_required(FALSE);
 
        g_slist_free(mlist);
-       
-       g_hash_table_destroy(folder_table);
 }
index 974c1ac..62e9076 100644 (file)
@@ -241,6 +241,7 @@ struct _FolderItem
 
        gint op_count;
        guint opened    : 1; /* opened by summary view */
+       guint need_update    : 1; /* folderview for this folder should be updated */
 
        FolderSortKey sort_key;
        FolderSortType sort_type;
index 08bdd6f..ae99445 100644 (file)
@@ -1226,6 +1226,8 @@ 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);
 }
@@ -1252,6 +1254,31 @@ void folderview_update_item(FolderItem *item, gboolean update_summary)
        }
 }
 
+void folderview_update_items_when_required(gboolean update_summary)
+{
+       GList *list;
+       FolderView *folderview;
+       GtkCTree *ctree;
+       GtkCTreeNode *node;
+       FolderItem *item;
+
+       for (list = folderview_list; list != NULL; list = list->next) {
+               folderview = (FolderView *)list->data;
+               ctree = GTK_CTREE(folderview->ctree);
+
+               for (node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+                    node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
+                       item = gtk_ctree_node_get_row_data(ctree, node);
+
+                       if (item->need_update) {
+                               folderview_update_node(folderview, node);
+                               if (update_summary && folderview->opened == node)
+                                       summary_show(folderview->summaryview, item);
+                       }
+               }
+       }
+}
+
 static void folderview_update_item_foreach_func(gpointer key, gpointer val,
                                                gpointer data)
 {
index b534507..348c13b 100644 (file)
@@ -74,6 +74,8 @@ void folderview_check_new_all         (void);
 
 void folderview_update_item            (FolderItem     *item,
                                         gboolean        update_summary);
+void folderview_update_items_when_required
+                                       (gboolean        update_summary);
 void folderview_update_item_foreach    (GHashTable     *table,
                                         gboolean        update_summary);
 
index 8333c45..09c1490 100644 (file)
@@ -106,7 +106,7 @@ gint import_mbox(FolderItem *default_dest)
                        if (!dest) {
                                g_warning("Can't find the folder.\n");
                        } else {
-                               ok = proc_mbox(dest, filename, NULL);
+                               ok = proc_mbox(dest, filename);
                                folderview_update_item(dest, TRUE);
                        }
                }
index 108b627..93387e3 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -455,7 +455,6 @@ static IncSession *inc_session_new(PrefsAccount *account)
        session = g_new0(IncSession, 1);
        session->pop3_state = pop3_state_new(account);
        session->pop3_state->data = session;
-       session->folder_table = g_hash_table_new(NULL, NULL);
 
        return session;
 }
@@ -465,7 +464,6 @@ static void inc_session_destroy(IncSession *session)
        g_return_if_fail(session != NULL);
 
        pop3_state_destroy(session->pop3_state);
-       g_hash_table_destroy(session->folder_table);
        g_free(session);
 }
 
@@ -604,12 +602,9 @@ static gint inc_start(IncProgressDialog *inc_dialog)
                                /* filter if enabled in prefs or move to inbox if not */
                                if(pop3_state->ac_prefs->filter_on_recv) {
                                        filter_message_by_msginfo_with_inbox(global_processing, msginfo,
-                                                                            session->folder_table,
                                                                             inbox);
                                } else {
                                        folder_item_move_msg(inbox, msginfo);
-                                       g_hash_table_insert(session->folder_table, inbox,
-                                                           GINT_TO_POINTER(1));
                                }
                                procmsg_msginfo_free(msginfo);
                        }
@@ -620,10 +615,8 @@ static gint inc_start(IncProgressDialog *inc_dialog)
                new_msgs += pop3_state->cur_total_num;
 
                if (!prefs_common.scan_all_after_inc) {
-                       folder_item_scan_foreach(session->folder_table);
-                       folderview_update_item_foreach
-                               (session->folder_table,
-                                !prefs_common.open_inbox_on_inc);
+                       folderview_update_items_when_required
+                                (!prefs_common.open_inbox_on_inc);
                }
 
                if (pop3_state->error_val == PS_AUTHFAIL &&
@@ -1019,17 +1012,6 @@ gint inc_drop_message(const gchar *file, Pop3State *state)
                dropfolder = folder_get_default_processing();
        }
 
-       val = GPOINTER_TO_INT(g_hash_table_lookup
-                             (session->folder_table, dropfolder));
-       if (val == 0) {
-               folder_item_scan(dropfolder);
-               /* force updating */
-               if (FOLDER_IS_LOCAL(dropfolder->folder))
-                       dropfolder->mtime = 0;
-               g_hash_table_insert(session->folder_table, dropfolder,
-                                   GINT_TO_POINTER(1));
-       }
-       
        /* add msg file to drop folder */
        if ((msgnum = folder_item_add_msg(dropfolder, file, TRUE)) < 0) {
                unlink(file);
@@ -1165,7 +1147,6 @@ static gint get_spool(FolderItem *dest, const gchar *mbox)
        gint msgs, size;
        gint lockfd;
        gchar tmp_mbox[MAXPATHLEN + 1];
-       GHashTable *folder_table = NULL;
 
        g_return_val_if_fail(dest != NULL, -1);
        g_return_val_if_fail(mbox != NULL, -1);
@@ -1190,22 +1171,15 @@ static gint get_spool(FolderItem *dest, const gchar *mbox)
        debug_print("Getting new messages from %s into %s...\n",
                    mbox, dest->path);
 
-       if (prefs_common.filter_on_inc)
-               folder_table = g_hash_table_new(NULL, NULL);
-       msgs = proc_mbox(dest, tmp_mbox, folder_table);
+       msgs = proc_mbox(dest, tmp_mbox);
 
        unlink(tmp_mbox);
        if (msgs >= 0) empty_mbox(mbox);
        unlock_mbox(mbox, lockfd, LOCK_FLOCK);
 
-       if (folder_table) {
-               if (!prefs_common.scan_all_after_inc) {
-               g_hash_table_insert(folder_table, dest,
-                                   GINT_TO_POINTER(1));
-                       folderview_update_item_foreach
-                               (folder_table, !prefs_common.open_inbox_on_inc);
-               }
-               g_hash_table_destroy(folder_table);
+       if (!prefs_common.scan_all_after_inc) {
+               folderview_update_items_when_required
+                       (!prefs_common.open_inbox_on_inc);
        } else if (!prefs_common.scan_all_after_inc) {
                folderview_update_item(dest, TRUE);
        }
index 4a52e47..3e759ae 100644 (file)
--- a/src/inc.h
+++ b/src/inc.h
@@ -66,8 +66,6 @@ struct _IncSession
        Automaton *atm;
        IncState inc_state;
 
-       GHashTable *folder_table;       /* table of destination folders */
-
        gpointer data;
 };
 
index f999806..eb8015d 100644 (file)
@@ -57,7 +57,7 @@
        } \
 }
 
-gint proc_mbox(FolderItem *dest, const gchar *mbox, GHashTable *folder_table)
+gint proc_mbox(FolderItem *dest, const gchar *mbox)
 {
        FILE *mbox_fp;
        gchar buf[MSGBUFSIZE], from_line[MSGBUFSIZE];
@@ -205,27 +205,17 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, GHashTable *folder_table)
                        return -1;
                }
 
-               if (folder_table) {
-                       if (global_processing == NULL) {
-                               /* old filtering */
-                               dropfolder = filter_get_dest_folder
-                                       (prefs_common.fltlist, tmp_file);
-                               if (!dropfolder ||
-                                   !strcmp(dropfolder->path, FILTER_NOT_RECEIVE))
-                                       dropfolder = dest;
-                               val = GPOINTER_TO_INT(g_hash_table_lookup
-                                                     (folder_table, dropfolder));
-                               if (val == 0) {
-                                       g_hash_table_insert(folder_table, dropfolder,
-                                                           GINT_TO_POINTER(1));
-                               }
-                       }
-                       else {
-                               /* CLAWS: new filtering */
-                               dropfolder = folder_get_default_processing();
-                       }
-               } else
-                       dropfolder = dest;
+               if (global_processing == NULL) {
+                       /* old filtering */
+                       dropfolder = filter_get_dest_folder
+                               (prefs_common.fltlist, tmp_file);
+                       if (!dropfolder ||
+                           !strcmp(dropfolder->path, FILTER_NOT_RECEIVE))
+                               dropfolder = dest;
+               } else {
+                       /* CLAWS: new filtering */
+                       dropfolder = folder_get_default_processing();
+               }
 
                        
                if ((msgnum = folder_item_add_msg(dropfolder, tmp_file, TRUE)) < 0) {
@@ -237,10 +227,8 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, GHashTable *folder_table)
 
                if (global_processing) {
                        /* CLAWS: new filtering */
-                       if (folder_table) {
-                               filter_message(global_processing, inbox,
-                                              msgnum, folder_table);
-                       }
+                       filter_message(global_processing, inbox,
+                                      msgnum);
                }
 
                msgs++;
index 3b210f0..3f4c643 100644 (file)
@@ -30,8 +30,7 @@ typedef enum {
 } LockType;
 
 gint proc_mbox         (FolderItem     *dest,
-                        const gchar    *mbox,
-                        GHashTable     *folder_table);
+                        const gchar    *mbox);
 gint lock_mbox         (const gchar    *base,
                         LockType        type);
 gint unlock_mbox       (const gchar    *base,
index 770c087..8364ee0 100644 (file)
@@ -1432,7 +1432,6 @@ msginfo->folder->folder->change_flags(msginfo->folder->folder, \
 
 void procmsg_msginfo_set_flags(MsgInfo *msginfo, MsgPermFlags perm_flags, MsgTmpFlags tmp_flags)
 {
-       gboolean changed = FALSE;
        FolderItem *item = msginfo->folder;
 
        debug_print("Setting flags for message %d in folder %s\n", msginfo->msgnum, item->path);
@@ -1441,25 +1440,25 @@ 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++;
-               changed = TRUE;
+               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++;
-               changed = TRUE;
+               item->need_update = TRUE;
        }
 
        /* if ignore thread flag is set */
        if ((perm_flags & MSG_IGNORE_THREAD) && !MSG_IS_IGNORE_THREAD(msginfo->flags)) {
                if (MSG_IS_NEW(msginfo->flags) || (perm_flags & MSG_NEW)) {
                        item->new--;
-                       changed = TRUE;
+                       item->need_update = TRUE;
                }
                if (MSG_IS_UNREAD(msginfo->flags) || (perm_flags & MSG_UNREAD)) {
                        item->unread--;
-                       changed = TRUE;
+                       item->need_update = TRUE;
                }
        }
 
@@ -1469,16 +1468,12 @@ void procmsg_msginfo_set_flags(MsgInfo *msginfo, MsgPermFlags perm_flags, MsgTmp
        msginfo->flags.perm_flags |= perm_flags;
        msginfo->flags.tmp_flags |= tmp_flags;
 
-       if (changed) {
-               folderview_update_item(item, FALSE);
-       }
        CHANGE_FLAGS(msginfo);
        procmsg_msginfo_write_flags(msginfo);
 }
 
 void procmsg_msginfo_unset_flags(MsgInfo *msginfo, MsgPermFlags perm_flags, MsgTmpFlags tmp_flags)
 {
-       gboolean changed = FALSE;
        FolderItem *item = msginfo->folder;
        
        debug_print("Unsetting flags for message %d in folder %s\n", msginfo->msgnum, item->path);
@@ -1487,25 +1482,25 @@ 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--;
-               changed = TRUE;
+               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--;
-               changed = TRUE;
+               item->need_update = TRUE;
        }
 
        /* if ignore thread flag is unset */
        if ((perm_flags & MSG_IGNORE_THREAD) && MSG_IS_IGNORE_THREAD(msginfo->flags)) {
                if (MSG_IS_NEW(msginfo->flags) && !(perm_flags & MSG_NEW)) {
                        item->new++;
-                       changed = TRUE;
+                       item->need_update = TRUE;
                }
                if (MSG_IS_UNREAD(msginfo->flags) && !(perm_flags & MSG_UNREAD)) {
                        item->unread++;
-                       changed = TRUE;
+                       item->need_update = TRUE;
                }
        }
 
@@ -1515,8 +1510,6 @@ void procmsg_msginfo_unset_flags(MsgInfo *msginfo, MsgPermFlags perm_flags, MsgT
        msginfo->flags.perm_flags &= ~perm_flags;
        msginfo->flags.tmp_flags &= ~tmp_flags;
 
-       if (changed) 
-               folderview_update_item(item, FALSE);
        CHANGE_FLAGS(msginfo);
        procmsg_msginfo_write_flags(msginfo);
 }
index ed655f1..2d14482 100644 (file)
@@ -1064,10 +1064,6 @@ void summary_clear_list(SummaryView *summaryview)
                summaryview->subject_table = NULL;
        }
        summaryview->mlist = NULL;
-       if (summaryview->folder_table) {
-               g_hash_table_destroy(summaryview->folder_table);
-               summaryview->folder_table = NULL;
-       }
 
        gtk_clist_clear(clist);
        if (summaryview->col_pos[S_COL_SUBJECT] == N_SUMMARY_COLS - 1) {
@@ -2333,6 +2329,7 @@ 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);
+                       folderview_update_item(msginfo->folder, FALSE);
                        summary_set_row_marks(summaryview, row);
                        gtk_clist_thaw(GTK_CLIST(ctree));
                        summary_status_show(summaryview);
@@ -2739,6 +2736,7 @@ 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));
+       folderview_update_items_when_required(FALSE);
 
        summary_status_show(summaryview);
 }
@@ -2759,6 +2757,7 @@ void summary_mark_all_read(SummaryView *summaryview)
                        summary_set_row_marks(summaryview, node);
        }
        gtk_clist_thaw(clist);
+       folderview_update_items_when_required(FALSE);
 
        summary_status_show(summaryview);
 }
@@ -2795,6 +2794,7 @@ 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));
+       folderview_update_items_when_required(FALSE);
 
        summary_status_show(summaryview);
 }
@@ -3440,8 +3440,6 @@ static void summary_execute_move(SummaryView *summaryview)
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        GSList *cur;
 
-       summaryview->folder_table = g_hash_table_new(NULL, NULL);
-
        /* search moving messages and execute */
        gtk_ctree_pre_recursive(ctree, NULL, summary_execute_move_func,
                                summaryview);
@@ -3449,7 +3447,7 @@ static void summary_execute_move(SummaryView *summaryview)
        if (summaryview->mlist) {
                procmsg_move_messages(summaryview->mlist);
 
-               folderview_update_item_foreach(summaryview->folder_table, FALSE);
+               folderview_update_items_when_required(FALSE);
 
                for (cur = summaryview->mlist; cur != NULL; cur = cur->next)
                        procmsg_msginfo_free((MsgInfo *)cur->data);
@@ -3458,8 +3456,6 @@ static void summary_execute_move(SummaryView *summaryview)
        }
 
        folderview_update_item(summaryview->folder_item, FALSE);
-       g_hash_table_destroy(summaryview->folder_table);
-       summaryview->folder_table = NULL;
 }
 
 static void summary_execute_move_func(GtkCTree *ctree, GtkCTreeNode *node,
@@ -3475,9 +3471,6 @@ static void summary_execute_move_func(GtkCTree *ctree, GtkCTreeNode *node,
                    msginfo->to_folder->op_count > 0)
                        msginfo->to_folder->op_count--;
 
-               g_hash_table_insert(summaryview->folder_table,
-                                   msginfo->to_folder, GINT_TO_POINTER(1));
-
                summaryview->mlist =
                        g_slist_append(summaryview->mlist, msginfo);
                gtk_ctree_node_set_row_data(ctree, node, NULL);
@@ -3494,8 +3487,6 @@ static void summary_execute_copy(SummaryView *summaryview)
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
 
-       summaryview->folder_table = g_hash_table_new(NULL, NULL);
-
        /* search copying messages and execute */
        gtk_ctree_pre_recursive(ctree, NULL, summary_execute_copy_func,
                                summaryview);
@@ -3503,15 +3494,11 @@ static void summary_execute_copy(SummaryView *summaryview)
        if (summaryview->mlist) {
                procmsg_copy_messages(summaryview->mlist);
 
-               /* folder_item_scan_foreach(summaryview->folder_table); */
-               folderview_update_item_foreach(summaryview->folder_table, FALSE);
+               folderview_update_items_when_required(FALSE);
 
                g_slist_free(summaryview->mlist);
                summaryview->mlist = NULL;
        }
-
-       g_hash_table_destroy(summaryview->folder_table);
-       summaryview->folder_table = NULL;
 }
 
 static void summary_execute_copy_func(GtkCTree *ctree, GtkCTreeNode *node,
@@ -3527,9 +3514,6 @@ static void summary_execute_copy_func(GtkCTree *ctree, GtkCTreeNode *node,
                    msginfo->to_folder->op_count > 0)
                        msginfo->to_folder->op_count--;
 
-               g_hash_table_insert(summaryview->folder_table,
-                                   msginfo->to_folder, GINT_TO_POINTER(1));
-
                summaryview->mlist =
                        g_slist_append(summaryview->mlist, msginfo);
 
@@ -3859,19 +3843,13 @@ void summary_filter(SummaryView *summaryview)
                        summary_status_show(summaryview);
        }
        else {
-               summaryview->folder_table = g_hash_table_new(NULL, NULL);
-
                gtk_ctree_pre_recursive(GTK_CTREE(summaryview->ctree), NULL,
                                        GTK_CTREE_FUNC(summary_filter_func),
                                        summaryview);
 
                gtk_clist_thaw(GTK_CLIST(summaryview->ctree));
 
-               /* folder_item_scan_foreach(summaryview->folder_table); */
-               folderview_update_item_foreach(summaryview->folder_table, FALSE);
-
-               g_hash_table_destroy(summaryview->folder_table);
-               summaryview->folder_table = NULL;
+               folderview_update_items_when_required(FALSE);
        }
 
        debug_print("done.\n");
@@ -3907,7 +3885,7 @@ static void summary_filter_func(GtkCTree *ctree, GtkCTreeNode *node,
                    summaryview->folder_item != dest)
                        summary_move_row_to(summaryview, node, dest);
        } else 
-               filter_message_by_msginfo(global_processing, msginfo, summaryview->folder_table);
+               filter_message_by_msginfo(global_processing, msginfo);
 }
 
 void summary_filter_open(SummaryView *summaryview, PrefsFilterType type)
@@ -5060,6 +5038,7 @@ 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);
+                               folderview_update_item(msginfo->folder, FALSE);
                                procmsg_msginfo_set_flags(msginfo, mff->account->crosspost_col, 0);
                        }
                        g_hash_table_remove(mff->newsart, key);
index a6a001d..2e60c6f 100644 (file)
@@ -160,8 +160,6 @@ private:
 
        /* list for moving/deleting messages */
        GSList *mlist;
-       /* table for updating folder tree */
-       GHashTable *folder_table;
 };
 
 SummaryView    *summary_create(void);