2006-08-25 [cleroy] 2.4.0cvs86
authorColin Leroy <colin@colino.net>
Fri, 25 Aug 2006 06:20:23 +0000 (06:20 +0000)
committerColin Leroy <colin@colino.net>
Fri, 25 Aug 2006 06:20:23 +0000 (06:20 +0000)
* src/common/utils.c
* src/common/utils.h
Add the sc_g_*list_bigger functions in
a place everyone can use it
* src/summaryview.c
Only freeze/thaw the list when working
on the selection, if it's bigger than 1
* src/gtk/gtksctree.c
Only freeze/thaw the list when unselec-
ting 'all' if ('all' != 1)
This avoids some flickering

ChangeLog
PATCHSETS
configure.ac
src/common/utils.c
src/common/utils.h
src/gtk/gtksctree.c
src/summaryview.c

index 5c70ff50a196d936d8f459bd6fee901e401411db..5af39493df1a7113a72d0455fdf4ead50261c846 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2006-08-25 [colin]     2.4.0cvs86
+
+       * src/common/utils.c
+       * src/common/utils.h
+               Add the sc_g_*list_bigger functions in
+               a place everyone can use it
+       * src/summaryview.c
+               Only freeze/thaw the list when working
+               on the selection, if it's bigger than 1
+       * src/gtk/gtksctree.c
+               Only freeze/thaw the list when unselec-
+               ting 'all' if ('all' != 1)
+               This avoids some flickering
+
 2006-08-24 [colin]     2.4.0cvs85
 
        * src/addressbook.c
index 6ca02fccc6f5373e94971bd840abeb2e3be9e055..a640bc3189a740d08ddaa53bd50ef7cdf8e62076 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.8.2.17 -r 1.8.2.18 src/headerview.c;  cvs diff -u -r 1.274.2.139 -r 1.274.2.140 src/mainwindow.c;  cvs diff -u -r 1.94.2.98 -r 1.94.2.99 src/messageview.c;  cvs diff -u -r 1.16.2.35 -r 1.16.2.36 src/msgcache.c;  cvs diff -u -r 1.1.2.11 -r 1.1.2.12 src/partial_download.c;  cvs diff -u -r 1.47.2.32 -r 1.47.2.33 src/procheader.c;  cvs diff -u -r 1.150.2.74 -r 1.150.2.75 src/procmsg.c;  cvs diff -u -r 1.60.2.31 -r 1.60.2.32 src/procmsg.h;  cvs diff -u -r 1.96.2.140 -r 1.96.2.141 src/textview.c;  cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/common/timing.h;  ) > 2.4.0cvs83.patchset
 ( cvs diff -u -r 1.17.2.25 -r 1.17.2.26 src/alertpanel.c;  cvs diff -u -r 1.2.2.18 -r 1.2.2.19 src/gtk/inputdialog.c;  cvs diff -u -r 1.1.2.17 -r 1.1.2.18 src/plugins/pgpcore/passphrase.c;  ) > 2.4.0cvs84.patchset
 ( cvs diff -u -r 1.60.2.62 -r 1.60.2.63 src/addressbook.c;  ) > 2.4.0cvs85.patchset
+( cvs diff -u -r 1.395.2.231 -r 1.395.2.232 src/summaryview.c;  cvs diff -u -r 1.36.2.76 -r 1.36.2.77 src/common/utils.c;  cvs diff -u -r 1.20.2.36 -r 1.20.2.37 src/common/utils.h;  cvs diff -u -r 1.1.4.23 -r 1.1.4.24 src/gtk/gtksctree.c;  ) > 2.4.0cvs86.patchset
index 11451dd97483ffc7873c46c30ba0f112ad07322b..118bd9e231bb0a1dac38d77b3a9298ad1916c59c 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=4
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=85
+EXTRA_VERSION=86
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 111c3296964724c71bb979541bb8348278dea847..bd3fc89a8c9bf1e25281ba3a72f6c28e42a799fc 100644 (file)
@@ -4931,3 +4931,25 @@ gboolean file_is_email (const gchar *filename)
        fclose(fp);
        return (score >= 3);
 }
+
+gboolean sc_g_list_bigger(GList *list, gint max)
+{
+       GList *cur = list;
+       int i = 0;
+       while (cur && i <= max+1) {
+               i++;
+               cur = cur->next;
+       }
+       return (i > max);
+}
+
+gboolean sc_g_slist_bigger(GSList *list, gint max)
+{
+       GSList *cur = list;
+       int i = 0;
+       while (cur && i <= max+1) {
+               i++;
+               cur = cur->next;
+       }
+       return (i > max);
+}
index 0f997bfc7749ba3da957882b8135cda3edc3a8bc..a82520ff9b12567a311491560132d4249065dfa5 100644 (file)
@@ -577,7 +577,8 @@ void mailcap_update_default    (const gchar *type,
                                    const gchar *command);
 
 gboolean file_is_email(const gchar *filename);
-
+gboolean sc_g_list_bigger(GList *list, gint max);
+gboolean sc_g_slist_bigger(GSList *list, gint max);
 #ifdef __cplusplus
 }
 #endif
index 438c24673a23499bf91091d9f1040bf4bdc23bf5..19188d10a5fedcbbff00f85bde7a109c13f420f0 100644 (file)
@@ -7,6 +7,7 @@
 #include "gtksctree.h"
 #include "sylpheed-marshal.h"
 #include "stock_pixmap.h"
+#include "utils.h"
 
 #define CLIST_UNFROZEN(clist)     (((GtkCList*) (clist))->freeze_count == 0)
 #define CLIST_REFRESH(clist)    G_STMT_START { \
@@ -261,17 +262,6 @@ select_range (GtkSCTree *sctree, gint row)
        gtk_clist_select_row (GTK_CLIST (sctree), max, -1);
 }
 
-static gboolean sc_g_list_bigger(GList *list, gint max)
-{
-       GList *cur = list;
-       int i = 0;
-       while (cur && i <= max+1) {
-               i++;
-               cur = cur->next;
-       }
-       return (i > max);
-}
-
 /* Handles row selection according to the specified modifier state */
 /* in certain cases, we arrive here from a function knowing the GtkCTreeNode, and having
  * already slowly found row using g_list_position. In which case, _node will be non-NULL
@@ -665,10 +655,15 @@ void gtk_sctree_select_with_state (GtkSCTree *sctree, GtkCTreeNode *node, int st
 
 void gtk_sctree_unselect_all (GtkSCTree *sctree)
 {
+       gboolean froze = FALSE;
        sctree->selecting_range = TRUE;
-       gtk_clist_freeze(GTK_CLIST(sctree));
+       if (sc_g_list_bigger(GTK_CLIST(sctree)->selection, 1)) {
+               gtk_clist_freeze(GTK_CLIST(sctree));
+               froze = TRUE;
+       }
        gtk_clist_unselect_all(GTK_CLIST(sctree));
-       gtk_clist_thaw(GTK_CLIST(sctree));
+       if (froze)
+               gtk_clist_thaw(GTK_CLIST(sctree));
        sctree->selecting_range = FALSE;
        sctree->anchor_row = NULL;
 }
index d885d6fcfd975ee36bd1540b0068df89c9c7ccdc..15bdd07c76084c884a39489864b3d644c5e65eea 100644 (file)
@@ -493,7 +493,10 @@ static const gchar *const col_label[N_SUMMARY_COLS] = {
 #define START_LONG_OPERATION(summaryview) {                    \
        summary_lock(summaryview);                              \
        main_window_cursor_wait(summaryview->mainwin);          \
-       gtk_clist_freeze(GTK_CLIST(summaryview->ctree));        \
+       if (sc_g_list_bigger(GTK_CLIST(summaryview->ctree)->selection, 1)) {\
+               froze = TRUE;                                           \
+               gtk_clist_freeze(GTK_CLIST(summaryview->ctree));        \
+       }                                                       \
        folder_item_update_freeze();                            \
        inc_lock();                                             \
        hooks_unregister_hook(MSGINFO_UPDATE_HOOKLIST,          \
@@ -502,7 +505,8 @@ static const gchar *const col_label[N_SUMMARY_COLS] = {
 #define END_LONG_OPERATION(summaryview) {                      \
        inc_unlock();                                           \
        folder_item_update_thaw();                              \
-       gtk_clist_thaw(GTK_CLIST(summaryview->ctree));          \
+       if (froze)                                              \
+               gtk_clist_thaw(GTK_CLIST(summaryview->ctree));  \
        main_window_cursor_normal(summaryview->mainwin);        \
        summary_unlock(summaryview);                            \
        summaryview->msginfo_update_callback_id =               \
@@ -2466,7 +2470,6 @@ static void summary_set_ctree_from_list(SummaryView *summaryview,
                END_TIMING();
        } else {
                gchar *text[N_SUMMARY_COLS];
-               gint *col_pos = summaryview->col_pos;
                START_TIMING("summaryview_set_ctree_from_list(2)");
                cur = mlist;
                for (; mlist != NULL; mlist = mlist->next) {
@@ -3192,6 +3195,7 @@ void summary_mark(SummaryView *summaryview)
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        GList *cur;
+       gboolean froze = FALSE;
 
        START_LONG_OPERATION(summaryview);
        folder_item_set_batch(summaryview->folder_item, TRUE);
@@ -3226,6 +3230,7 @@ void summary_mark_as_read
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        GList *cur;
+       gboolean froze = FALSE;
 
        START_LONG_OPERATION(summaryview);
        folder_item_set_batch(summaryview->folder_item, TRUE);
@@ -3242,6 +3247,7 @@ void summary_msgs_lock(SummaryView *summaryview)
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        GList *cur;
+       gboolean froze = FALSE;
 
        START_LONG_OPERATION(summaryview);
        for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
@@ -3256,6 +3262,7 @@ void summary_msgs_unlock(SummaryView *summaryview)
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        GList *cur;
+       gboolean froze = FALSE;
 
        START_LONG_OPERATION(summaryview);
        for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
@@ -3271,6 +3278,7 @@ void summary_mark_all_read(SummaryView *summaryview)
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        GtkCTreeNode *node;
        AlertValue val;
+       gboolean froze = FALSE;
 
        if (prefs_common.ask_mark_all_read) {
                val = alertpanel_full(_("Mark all as read"),
@@ -3308,6 +3316,8 @@ void summary_mark_as_spam(SummaryView *summaryview, guint action, GtkWidget *wid
        GSList *msgs = NULL;
        gboolean immediate_exec = prefs_common.immediate_exec;
        gboolean moved = FALSE;
+       gboolean froze = FALSE;
+
        prefs_common.immediate_exec = FALSE;
 
        START_LONG_OPERATION(summaryview);
@@ -3379,6 +3389,7 @@ void summary_mark_as_unread(SummaryView *summaryview)
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        GList *cur;
+       gboolean froze = FALSE;
 
        START_LONG_OPERATION(summaryview);
        folder_item_set_batch(summaryview->folder_item, TRUE);
@@ -3507,6 +3518,7 @@ void summary_delete(SummaryView *summaryview)
        GtkCTreeNode *node;
        AlertValue aval;
        MsgInfo *msginfo;
+       gboolean froze = FALSE;
 
        if (!item) return;
 
@@ -3608,6 +3620,7 @@ void summary_unmark(SummaryView *summaryview)
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        GList *cur;
+       gboolean froze = FALSE;
 
        START_LONG_OPERATION(summaryview);
        folder_item_set_batch(summaryview->folder_item, TRUE);
@@ -3657,6 +3670,8 @@ void summary_move_selected_to(SummaryView *summaryview, FolderItem *to_folder)
 {
        GList *cur;
        GtkCTreeNode *sel_last = NULL;
+       gboolean froze = FALSE;
+
        if (!to_folder) return;
        if (!summaryview->folder_item ||
            FOLDER_TYPE(summaryview->folder_item->folder) == F_NEWS) return;
@@ -3745,6 +3760,7 @@ static void summary_copy_row_to(SummaryView *summaryview, GtkCTreeNode *row,
 void summary_copy_selected_to(SummaryView *summaryview, FolderItem *to_folder)
 {
        GList *cur;
+       gboolean froze = FALSE;
 
        if (!to_folder) return;
        if (!summaryview->folder_item) return;
@@ -4050,23 +4066,21 @@ gboolean summary_execute(SummaryView *summaryview)
        }
 
        folder_item_update_thaw();
-       gtk_clist_thaw(GTK_CLIST(summaryview->ctree));
 
        if (new_selected) {
                summary_unlock(summaryview);
                gtk_sctree_select
-                       (GTK_SCTREE(ctree),
-                        new_selected);
+                       (GTK_SCTREE(ctree), new_selected);
                summary_lock(summaryview);
        }
 
        if (summaryview->threaded) {
-               gtk_clist_freeze(GTK_CLIST(summaryview->ctree));
                summary_thread_build(summaryview);
                summary_thread_init(summaryview);
-               gtk_clist_thaw(GTK_CLIST(summaryview->ctree));
        }
 
+       gtk_clist_thaw(GTK_CLIST(summaryview->ctree));
+
        summaryview->selected = clist->selection ?
                GTK_CTREE_NODE(clist->selection->data) : NULL;
 
@@ -4334,6 +4348,7 @@ static void summary_unthread_for_exec(SummaryView *summaryview)
 {
        GtkCTreeNode *node;
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       gboolean froze = FALSE;
 
        debug_print("Unthreading for execution...");
 
@@ -4718,6 +4733,7 @@ void summary_set_colorlabel(SummaryView *summaryview, guint labelcolor,
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        GList *cur;
+       gboolean froze = FALSE;
 
        START_LONG_OPERATION(summaryview);
 
@@ -5810,6 +5826,7 @@ static void summary_ignore_thread(SummaryView *summaryview)
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        GList *cur;
+       gboolean froze = FALSE;
 
        START_LONG_OPERATION(summaryview);
        for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
@@ -5841,6 +5858,7 @@ static void summary_unignore_thread(SummaryView *summaryview)
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        GList *cur;
+       gboolean froze = FALSE;
 
        START_LONG_OPERATION(summaryview);
        for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)