gtkroomlist responsiveness

Gabriel Schulhof nix at go-nix.ca
Sun Jan 6 08:46:59 EST 2008


Hi!

The use of while(g_main_context_iteration(NULL, FALSE)); as in the patch
below makes gtkroomlist much more responsive (read: usable) on slow
processors (such as the OMAP 2420 used in certain Internet
tablets ;o) ), and doesn't seem to cause any adverse effects on the
desktop:

============================================================
--- pidgin/gtkroomlist.c        c93305e14b0798bee63d6ebf7563d294ba0da3b9
+++ pidgin/gtkroomlist.c        5fad85ba87de2b9da3dc5b74292a24e5f9d7fd3e
@@ -671,6 +671,8 @@ static gint int_sort_func(GtkTreeModel *
                return -1;
        else
                return 1;
+
+       while(g_main_context_iteration(NULL, FALSE));
 }
 
 static gboolean
@@ -879,6 +881,8 @@ static void pidgin_roomlist_add_room(Pur
                        continue;
                gtk_tree_store_set(rl->model, &iter, j, l->data, -1);
        }
+
+       while(g_main_context_iteration(NULL, FALSE));
 }
 
 static void pidgin_roomlist_in_progress(PurpleRoomlist *list, gboolean
flag)
============================================================

In fact, when you start scrolling the room list while the progress bar
still pulsates, the pulsation starts to hiccup - an intuitive feedback,
I think. Also, the effect of sorting seems to be reflected in the
displayed list much quicker than without these loops.

Since pidgin_roomlist_add_room() is a UI op called fairly one-to-one
from the core (i.e., the core passes it straight through from the prpl),
one idea might be to place the second "while(g_main_..." line into the
core after the call to the UI op, rather than at the end of the UI op.
This would nicen the behaviour for other UIs as well - for what little
that's necessary ... *shrug*:

============================================================
--- libpurple/roomlist.c        ce8e8e7a5ba9402fc1f05e420f28463420fa077a
+++ libpurple/roomlist.c        5afac89719c713de9a0330cc9406688925ee9e5f
@@ -165,6 +165,8 @@ void purple_roomlist_room_add(PurpleRoom
 
        if (ops && ops->add_room)
                ops->add_room(list, room);
+
+       while(g_main_context_iteration(NULL, FALSE));
 }
 
 PurpleRoomlist *purple_roomlist_get_list(PurpleConnection *gc)
============================================================

Either way, I think it'd be useful if at least one of these alternatives
made it into im.pidgin.pidgin.

HTH,



Gabriel




More information about the Devel mailing list