2007-08-19 [colin] 2.10.0cvs135
authorColin Leroy <colin@colino.net>
Sun, 19 Aug 2007 13:11:01 +0000 (13:11 +0000)
committerColin Leroy <colin@colino.net>
Sun, 19 Aug 2007 13:11:01 +0000 (13:11 +0000)
* src/imap.c
Fix previous commit. Sensitivity update is needed
for "Cancel receiving". However when batching we
don't need to do it for every message flag change,
just once at the start and once at the end.

ChangeLog
PATCHSETS
configure.ac
src/imap.c

index 2f51e206e443b0026979969bb9ee9f01e1c3ce05..0614d475080f07ac0cebb5b4b9c697c38a5e479b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-08-19 [colin]     2.10.0cvs135
+
+       * src/imap.c
+               Fix previous commit. Sensitivity update is needed
+               for "Cancel receiving". However when batching we
+               don't need to do it for every message flag change,
+               just once at the start and once at the end.
+
 2007-08-19 [colin]     2.10.0cvs134
 
        * src/imap.c
 2007-08-19 [colin]     2.10.0cvs134
 
        * src/imap.c
index 351d541c2e74644162a37d46eefd4967c0169935..c08af97fcfc79c0241a7e672a895c191d378e4da 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.26.2.33 -r 1.26.2.34 src/foldersel.c;  cvs diff -u -r 1.207.2.174 -r 1.207.2.175 src/folderview.c;  cvs diff -u -r 1.395.2.320 -r 1.395.2.321 src/summaryview.c;  ) > 2.10.0cvs132.patchset
 ( cvs diff -u -r 1.1.4.82 -r 1.1.4.83 src/etpan/imap-thread.c;  ) > 2.10.0cvs133.patchset
 ( cvs diff -u -r 1.179.2.181 -r 1.179.2.182 src/imap.c;  ) > 2.10.0cvs134.patchset
 ( cvs diff -u -r 1.26.2.33 -r 1.26.2.34 src/foldersel.c;  cvs diff -u -r 1.207.2.174 -r 1.207.2.175 src/folderview.c;  cvs diff -u -r 1.395.2.320 -r 1.395.2.321 src/summaryview.c;  ) > 2.10.0cvs132.patchset
 ( cvs diff -u -r 1.1.4.82 -r 1.1.4.83 src/etpan/imap-thread.c;  ) > 2.10.0cvs133.patchset
 ( cvs diff -u -r 1.179.2.181 -r 1.179.2.182 src/imap.c;  ) > 2.10.0cvs134.patchset
+( cvs diff -u -r 1.179.2.182 -r 1.179.2.183 src/imap.c;  ) > 2.10.0cvs135.patchset
index f35102662d5f999ce8faaf92d4fdadcec933afd0..2b78e444dd2211e647e6263524b6dad7c0fcfaf7 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=10
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=134
+EXTRA_VERSION=135
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 0e60d6fe051030feccae2b65ce95e3a913b5fb9e..74c5ba75a99726dc67eb4fa0f37df2c94aaf9a93 100644 (file)
@@ -117,6 +117,7 @@ struct _IMAPSession
        Folder * folder;
        gboolean busy;
        gboolean cancelled;
        Folder * folder;
        gboolean busy;
        gboolean cancelled;
+       gboolean sens_update_block;
 };
 
 struct _IMAPNameSpace
 };
 
 struct _IMAPNameSpace
@@ -697,15 +698,27 @@ static IMAPSession *imap_reconnect_if_possible(Folder *folder, IMAPSession *sess
        return session;
 }
 
        return session;
 }
 
+static void imap_refresh_sensitivity (IMAPSession *session)
+{
+        MainWindow *mainwin;
+
+       if (session->sens_update_block)
+               return;
+       mainwin = mainwindow_get_mainwindow();
+       if (mainwin) {
+               toolbar_main_set_sensitive(mainwin);
+               main_window_set_menu_sensitive(mainwin);
+       }
+}
+
 static void lock_session(IMAPSession *session)
 {
        if (session) {
 static void lock_session(IMAPSession *session)
 {
        if (session) {
-                MainWindow *mainwin;
-               
                debug_print("locking session %p (%d)\n", session, session->busy);
                if (session->busy)
                        debug_print("         SESSION WAS LOCKED !!      \n");
                 session->busy = TRUE;
                debug_print("locking session %p (%d)\n", session, session->busy);
                if (session->busy)
                        debug_print("         SESSION WAS LOCKED !!      \n");
                 session->busy = TRUE;
+               imap_refresh_sensitivity(session);
        } else {
                debug_print("can't lock null session\n");
        }
        } else {
                debug_print("can't lock null session\n");
        }
@@ -714,10 +727,10 @@ static void lock_session(IMAPSession *session)
 static void unlock_session(IMAPSession *session)
 {
        if (session) {
 static void unlock_session(IMAPSession *session)
 {
        if (session) {
-                MainWindow *mainwin;
                
                debug_print("unlocking session %p\n", session);
                session->busy = FALSE;
                
                debug_print("unlocking session %p\n", session);
                session->busy = FALSE;
+               imap_refresh_sensitivity(session);
        } else {
                debug_print("can't unlock null session\n");
        }
        } else {
                debug_print("can't unlock null session\n");
        }
@@ -3926,8 +3939,7 @@ void imap_change_flags(Folder *folder, FolderItem *item, MsgInfo *msginfo, MsgPe
                                g_hash_table_insert(IMAP_FOLDER_ITEM(item)->flags_set_table, 
                                        GINT_TO_POINTER(flags_set), ht_data);
                        }
                                g_hash_table_insert(IMAP_FOLDER_ITEM(item)->flags_set_table, 
                                        GINT_TO_POINTER(flags_set), ht_data);
                        }
-                       if (!g_slist_find(ht_data->msglist, GINT_TO_POINTER(msginfo->msgnum)))
-                               ht_data->msglist = g_slist_prepend(ht_data->msglist, GINT_TO_POINTER(msginfo->msgnum));
+                       ht_data->msglist = g_slist_prepend(ht_data->msglist, GINT_TO_POINTER(msginfo->msgnum));
                } 
                if (flags_unset) {
                        ht_data = g_hash_table_lookup(IMAP_FOLDER_ITEM(item)->flags_unset_table, 
                } 
                if (flags_unset) {
                        ht_data = g_hash_table_lookup(IMAP_FOLDER_ITEM(item)->flags_unset_table, 
@@ -3939,8 +3951,7 @@ void imap_change_flags(Folder *folder, FolderItem *item, MsgInfo *msginfo, MsgPe
                                g_hash_table_insert(IMAP_FOLDER_ITEM(item)->flags_unset_table, 
                                        GINT_TO_POINTER(flags_unset), ht_data);
                        }
                                g_hash_table_insert(IMAP_FOLDER_ITEM(item)->flags_unset_table, 
                                        GINT_TO_POINTER(flags_unset), ht_data);
                        }
-                       if (!g_slist_find(ht_data->msglist, GINT_TO_POINTER(msginfo->msgnum)))
-                               ht_data->msglist = g_slist_prepend(ht_data->msglist, 
+                       ht_data->msglist = g_slist_prepend(ht_data->msglist, 
                                        GINT_TO_POINTER(msginfo->msgnum));              
                }
        } else {
                                        GINT_TO_POINTER(msginfo->msgnum));              
                }
        } else {
@@ -4352,11 +4363,13 @@ static void process_hashtable(IMAPFolderItem *item)
                g_hash_table_destroy(item->flags_unset_table);
                item->flags_unset_table = NULL;
        }
                g_hash_table_destroy(item->flags_unset_table);
                item->flags_unset_table = NULL;
        }
+       
 }
 
 static void imap_set_batch (Folder *folder, FolderItem *_item, gboolean batch)
 {
        IMAPFolderItem *item = (IMAPFolderItem *)_item;
 }
 
 static void imap_set_batch (Folder *folder, FolderItem *_item, gboolean batch)
 {
        IMAPFolderItem *item = (IMAPFolderItem *)_item;
+       IMAPSession *session;
 
        g_return_if_fail(item != NULL);
        
 
        g_return_if_fail(item != NULL);
        
@@ -4372,11 +4385,23 @@ static void imap_set_batch (Folder *folder, FolderItem *_item, gboolean batch)
                if (!item->flags_unset_table) {
                        item->flags_unset_table = g_hash_table_new(NULL, g_direct_equal);
                }
                if (!item->flags_unset_table) {
                        item->flags_unset_table = g_hash_table_new(NULL, g_direct_equal);
                }
+               session = imap_session_get(folder);
+               if (session) {
+                       imap_refresh_sensitivity(session);
+                       session->sens_update_block = TRUE;
+                       unlock_session(session);
+               }
        } else {
                debug_print("IMAP switching away from batch mode\n");
                /* process stuff */
                process_hashtable(item);
                item->batching = FALSE;
        } else {
                debug_print("IMAP switching away from batch mode\n");
                /* process stuff */
                process_hashtable(item);
                item->batching = FALSE;
+               session = imap_session_get(folder);
+               if (session) {
+                       unlock_session(session);
+                       session->sens_update_block = FALSE;
+                       imap_refresh_sensitivity(session);
+               }
        }
 }
 
        }
 }