[balsa/gtk3] Use gdk_threads_add_idle() for convenience



commit 7668a6dad684b3922948de42f8f0245d3d13ffee
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sat Aug 20 11:42:51 2011 -0400

    Use gdk_threads_add_idle() for convenience
    
    	(lbav_ensure_blank_line): use gdk_threads_add_idle() for
    	convenience;
    	* libbalsa/address-view.c (lbav_ensure_blank_line_idle_cb): no
    	need to check GSource removal.

 ChangeLog               |    7 +++++++
 libbalsa/address-view.c |   17 ++++++-----------
 2 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 62cceb8..8a9013f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2011-08-20  Peter Bloomfield
 
+	(lbav_ensure_blank_line): use gdk_threads_add_idle() for
+	convenience;
+	* libbalsa/address-view.c (lbav_ensure_blank_line_idle_cb): no
+	need to check GSource removal.
+
+2011-08-20  Peter Bloomfield
+
 	* src/sendmsg-window.c (create_lang_menu): use
 	enchant_broker_dict_exists() to check languages for Balsa's
 	spell-checker.
diff --git a/libbalsa/address-view.c b/libbalsa/address-view.c
index e8eea6b..26bd683 100644
--- a/libbalsa/address-view.c
+++ b/libbalsa/address-view.c
@@ -267,19 +267,15 @@ lbav_entry_setup_matches(LibBalsaAddressView * address_view,
 
 /*
  *     Idle callback to set the GtkTreeView's cursor.
+ *
+ *     Scheduled with gdk_threads_add_idle, so it already holds the GDK
+ *     lock, and its GSource has not been removed.
  */
 static gboolean
 lbav_ensure_blank_line_idle_cb(LibBalsaAddressView * address_view)
 {
     GtkTreePath *focus_path;
 
-    gdk_threads_enter();
-
-    if (g_source_is_destroyed(g_main_current_source())) {
-        gdk_threads_leave();
-        return FALSE;
-    }
-
     focus_path = gtk_tree_row_reference_get_path(address_view->focus_row);
     gtk_tree_row_reference_free(address_view->focus_row);
     address_view->focus_row = NULL;
@@ -296,8 +292,6 @@ lbav_ensure_blank_line_idle_cb(LibBalsaAddressView * address_view)
 
     address_view->focus_idle_id = 0;
 
-    gdk_threads_leave();
-
     return FALSE;
 }
 
@@ -363,8 +357,9 @@ lbav_ensure_blank_line(LibBalsaAddressView * address_view,
 
     if (!address_view->focus_idle_id)
         address_view->focus_idle_id =
-            g_idle_add((GSourceFunc) lbav_ensure_blank_line_idle_cb,
-                       address_view);
+            gdk_threads_add_idle((GSourceFunc)
+                                 lbav_ensure_blank_line_idle_cb,
+                                 address_view);
 }
 
 /*



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