From: Colin Leroy Date: Sun, 19 Aug 2007 13:11:01 +0000 (+0000) Subject: 2007-08-19 [colin] 2.10.0cvs135 X-Git-Tag: rel_3_0_0~58 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=935b376046b302838cc923a07baca0b1be4e6aff 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. --- diff --git a/ChangeLog b/ChangeLog index 2f51e206e..0614d4750 100644 --- 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 diff --git a/PATCHSETS b/PATCHSETS index 351d541c2..c08af97fc 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -2789,3 +2789,4 @@ ( 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 diff --git a/configure.ac b/configure.ac index f35102662..2b78e444d 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=10 MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=134 +EXTRA_VERSION=135 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/imap.c b/src/imap.c index 0e60d6fe0..74c5ba75a 100644 --- a/src/imap.c +++ b/src/imap.c @@ -117,6 +117,7 @@ struct _IMAPSession Folder * folder; gboolean busy; gboolean cancelled; + gboolean sens_update_block; }; struct _IMAPNameSpace @@ -697,15 +698,27 @@ static IMAPSession *imap_reconnect_if_possible(Folder *folder, IMAPSession *sess 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) { - MainWindow *mainwin; - 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"); } @@ -714,10 +727,10 @@ static void lock_session(IMAPSession *session) static void unlock_session(IMAPSession *session) { if (session) { - MainWindow *mainwin; debug_print("unlocking session %p\n", session); session->busy = FALSE; + imap_refresh_sensitivity(session); } 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); } - 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, @@ -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); } - 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 { @@ -4352,11 +4363,13 @@ static void process_hashtable(IMAPFolderItem *item) 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; + IMAPSession *session; 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); } + 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; + session = imap_session_get(folder); + if (session) { + unlock_session(session); + session->sens_update_block = FALSE; + imap_refresh_sensitivity(session); + } } }