2006-04-17 [colin] 2.1.1cvs6
authorColin Leroy <colin@colino.net>
Mon, 17 Apr 2006 12:01:18 +0000 (12:01 +0000)
committerColin Leroy <colin@colino.net>
Mon, 17 Apr 2006 12:01:18 +0000 (12:01 +0000)
* src/folderview.c
Don't scan if not necessary, apart in current
folder and INBOX to fetch flags.
* src/imap.c
Scan is necessary if unread count changes

ChangeLog
PATCHSETS
configure.ac
src/folderview.c
src/imap.c

index aff0060fd0cd3d69d0d9d440ffe9bba6497fcf94..a565d397f678bdb6d3ad00cdcec1e241d932b98a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-04-17 [colin]     2.1.1cvs6
+
+       * src/folderview.c
+               Don't scan if not necessary, apart in current
+               folder and INBOX to fetch flags.
+       * src/imap.c
+               Scan is necessary if unread count changes
+
 2006-04-17 [colin]     2.1.1cvs5
 
        * src/imap.c
index 1e3605df91c464220b6827950f4170a291ca108e..cd82f26ef9a12c1edff5d54922b4fe05c7efc78f 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.179.2.99 -r 1.179.2.100 src/imap.c;  ) > 2.1.1cvs3.patchset
 ( cvs diff -u -r 1.179.2.100 -r 1.179.2.101 src/imap.c;  ) > 2.1.1cvs4.patchset
 ( cvs diff -u -r 1.179.2.101 -r 1.179.2.102 src/imap.c;  ) > 2.1.1cvs5.patchset
+( cvs diff -u -r 1.207.2.94 -r 1.207.2.95 src/folderview.c;  cvs diff -u -r 1.179.2.102 -r 1.179.2.103 src/imap.c;  ) > 2.1.1cvs6.patchset
index 8b96d90bef5bb5e35a909f15ec105a299604c882..23dd618fa831a479e454abdae654aa43bd578d34 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=1
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=5
+EXTRA_VERSION=6
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 71c6fa805a3b22a2d8fe7f83ae6e797ae1780bab..fc8e6d515d7f79f2b76edcdc804f0b5952d09fef 100644 (file)
@@ -951,23 +951,24 @@ static void folderview_set_folders(FolderView *folderview)
        }
 }
 
+static gchar *get_scan_str(FolderItem *item)
+{
+       if (item->path)
+               return g_strdup_printf(_("Scanning folder %s%c%s ..."),
+                                     item->folder->name, G_DIR_SEPARATOR,
+                                     item->path);
+       else
+               return g_strdup_printf(_("Scanning folder %s ..."),
+                                     item->folder->name);      
+}
 static void folderview_scan_tree_func(Folder *folder, FolderItem *item,
                                      gpointer data)
 {
        GList *list;
-
        for (list = folderview_list; list != NULL; list = list->next) {
                FolderView *folderview = (FolderView *)list->data;
                MainWindow *mainwin = folderview->mainwin;
-               gchar *str;
-
-               if (item->path)
-                       str = g_strdup_printf(_("Scanning folder %s%c%s ..."),
-                                             item->folder->name, G_DIR_SEPARATOR,
-                                             item->path);
-               else
-                       str = g_strdup_printf(_("Scanning folder %s ..."),
-                                             item->folder->name);
+               gchar *str = get_scan_str(item);
 
                STATUSBAR_PUSH(mainwin, str);
                STATUSBAR_POP(mainwin);
@@ -1035,24 +1036,46 @@ gint folderview_check_new(Folder *folder)
 
                for (node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
                     node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
+                       gchar *str = NULL;
                        item = gtk_ctree_node_get_row_data(ctree, node);
                        if (!item || !item->path || !item->folder) continue;
                        if (item->no_select) continue;
                        if (folder && folder != item->folder) continue;
                        if (!folder && !FOLDER_IS_LOCAL(item->folder)) continue;
                        if (!item->prefs->newmailcheck) continue;
+                       
+                       str = get_scan_str(item);
+
+                       STATUSBAR_PUSH(folderview->mainwin, str);
+
+                       g_free(str);
 
                        folderview_scan_tree_func(item->folder, item, NULL);
                        former_new    = item->new_msgs;
                        former_unread = item->unread_msgs;
                        former_total  = item->total_msgs;
 
-                       if (folder_item_scan(item) < 0) {
-                               summaryview_unlock(folderview->summaryview, item);
-                               if (folder && !FOLDER_IS_LOCAL(folder))
-                                       break;
+                       if (item->folder->klass->scan_required &&
+                           (item->folder->klass->scan_required(item->folder, item) ||
+                            item->folder->inbox == item ||
+                            item->opened == TRUE ||
+                            item->processing_pending == TRUE)) {
+                               if (folder_item_scan(item) < 0) {
+                                       summaryview_unlock(folderview->summaryview, item);
+                                       if (folder && !FOLDER_IS_LOCAL(folder)) {
+                                               STATUSBAR_POP(folderview->mainwin);
+                                               break;
+                                       }
+                               }
+                       } else if (!item->folder->klass->scan_required) {
+                               if (folder_item_scan(item) < 0) {
+                                       summaryview_unlock(folderview->summaryview, item);
+                                       if (folder && !FOLDER_IS_LOCAL(folder)) {
+                                               STATUSBAR_POP(folderview->mainwin);
+                                               break;
+                                       }
+                               }
                        }
-
                        if (former_new    != item->new_msgs ||
                            former_unread != item->unread_msgs ||
                            former_total  != item->total_msgs)
@@ -1060,6 +1083,7 @@ gint folderview_check_new(Folder *folder)
 
                        new_msgs += item->new_msgs;
                        former_new_msgs += former_new;
+                       STATUSBAR_POP(folderview->mainwin);
                }
 
                main_window_unlock(folderview->mainwin);
index 104faa7be13ca3e438050aa21beb5de1e5dce4e7..cc49e45a9c6a8fe1ddf6a8dc419a131edb1985fb 100644 (file)
@@ -3084,8 +3084,15 @@ gint imap_get_num_list(Folder *folder, FolderItem *_item, GSList **msgnum_list,
        session = imap_session_get(folder);
        g_return_val_if_fail(session != NULL, -1);
        lock_session();
-       statusbar_print_all("Scanning %s...\n", FOLDER_ITEM(item)->path 
-                               ? FOLDER_ITEM(item)->path:"");
+
+       if (FOLDER_ITEM(item)->path) 
+               statusbar_print_all(_("Scanning folder %s%c%s ..."),
+                                     FOLDER_ITEM(item)->folder->name, 
+                                     G_DIR_SEPARATOR,
+                                     FOLDER_ITEM(item)->path);
+       else
+               statusbar_print_all(_("Scanning folder %s ..."),
+                                     FOLDER_ITEM(item)->folder->name);
 
        selected_folder = (session->mbox != NULL) &&
                          (!strcmp(session->mbox, item->item.path));
@@ -3378,7 +3385,8 @@ gboolean imap_scan_required(Folder *folder, FolderItem *_item)
                item->item.last_num = uid_next - 1;
                debug_print("uidnext %d, item->uid_next %d, exists %d, item->item.total_msgs %d\n", 
                        uid_next, item->uid_next, exists, item->item.total_msgs);
-               if ((uid_next != item->uid_next) || (exists != item->item.total_msgs)) {
+               if ((uid_next != item->uid_next) || (exists != item->item.total_msgs)
+                   || unseen != item->item.unread_msgs) {
                        unlock_session();
                        return TRUE;
                }