Re: Some annoyance is message list update after delete



On 10/07/2007 02:23:16 PM Sun, Jean-Luc Coulon (f5ibh) wrote:
[ snip ]
I've gtk 2.12.0. The change from gtl 2.10.13 was done on september
21th. But the problem is more recent IIRC.

Some other changes may have affected the timing of the scroll, which is currently done in an idle callback. The attached patch does away with the idle call--could you test it to see if it fixes the issue?

Thanks!

Peter
Index: src/balsa-index.c
===================================================================
--- src/balsa-index.c	(revision 7750)
+++ src/balsa-index.c	(working copy)
@@ -614,51 +614,13 @@
         message_window_new(mailbox, msgno);
 }
 
-/*
- * Scroll in an idle handler, otherwise it gets ignored.
- */
-#define BALSA_INDEX_ROW_REF_KEY "balsa-index-row-ref-key"
-static gboolean
-bndx_scroll_idle(BalsaIndex * index)
+static void
+bndx_scroll_to_row(BalsaIndex * index, GtkTreePath * path)
 {
-    GtkTreeRowReference *row_ref;
-    GtkTreePath *path;
-
-    gdk_threads_enter();
-
-    row_ref = g_object_get_data(G_OBJECT(index), BALSA_INDEX_ROW_REF_KEY);
-    if (row_ref && (path = gtk_tree_row_reference_get_path(row_ref))) {
         gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(index), path, NULL,
                                      FALSE, 0, 0);
-        gtk_tree_path_free(path);
-    }
-
-    g_object_set_data(G_OBJECT(index), BALSA_INDEX_ROW_REF_KEY, NULL);
-    g_object_unref(index);
-
-    gdk_threads_leave();
-
-    return FALSE;
 }
 
-static void
-bndx_scroll_to_row(BalsaIndex * index, GtkTreePath * path)
-{
-    GtkTreeRowReference *row_ref;
-
-    row_ref = g_object_get_data(G_OBJECT(index), BALSA_INDEX_ROW_REF_KEY);
-    if (!row_ref) {
-        g_object_ref(index);
-        g_idle_add((GSourceFunc) bndx_scroll_idle, index);
-    }
-
-    row_ref =
-        gtk_tree_row_reference_new(gtk_tree_view_get_model
-                                   (GTK_TREE_VIEW(index)), path);
-    g_object_set_data_full(G_OBJECT(index), BALSA_INDEX_ROW_REF_KEY, row_ref,
-                           (GDestroyNotify) gtk_tree_row_reference_free);
-}
-
 static gboolean
 bndx_find_current_msgno(BalsaIndex * bindex,
                         GtkTreePath ** path , GtkTreeIter * iter)
@@ -2369,7 +2331,7 @@
     GdkRectangle rect;
     GtkTreePath *path = NULL;
 
-    if (bndx_find_current_msgno(index, &path, NULL)) {
+    if (!bndx_find_current_msgno(index, &path, NULL)) {
         /* Current message not displayed, make sure that something
            else is... */
         gtk_tree_view_get_visible_rect(tree_view, &rect);
Index: libbalsa/mailbox.c
===================================================================
--- libbalsa/mailbox.c	(revision 7749)
+++ libbalsa/mailbox.c	(working copy)
@@ -2949,7 +2949,7 @@
     node = iter ? iter->user_data
                 : LIBBALSA_MAILBOX(tree_model)->msg_tree;
 
-    return g_node_n_children(node);
+    return node ? g_node_n_children(node) : 0;
 }
 
 static gboolean

Attachment: pgpXk9eyNQfBn.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]