[balsa/gtk3] Change widget sensitivity in main thread



commit a5320f79be9ea30592159770d3443a32aae636b6
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Jun 3 13:10:26 2012 -0400

    Change widget sensitivity in main thread
    
    	* src/main-window.c: change sensitivity of mail-check button in
    	the main thread, in an idle callback.

 ChangeLog         |    5 +++++
 src/main-window.c |   15 +++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0d1c50e..738c181 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-06-03  Peter Bloomfield
 
+	* src/main-window.c: change sensitivity of mail-check button in
+	the main thread, in an idle callback.
+
+2012-06-03  Peter Bloomfield
+
 	Call Gtk from only the main thread when opening a mailbox
 
 	* libbalsa/mailbox.c (lbm_cache_message): avoid infinite
diff --git a/src/main-window.c b/src/main-window.c
index a90ba6a..f8a9df7 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -3022,6 +3022,15 @@ bw_mailbox_check(LibBalsaMailbox * mailbox, BalsaWindow * window)
     libbalsa_mailbox_check(mailbox);
 }
 
+static gboolean
+bw_check_messages_thread_idle(BalsaWindow * window)
+{
+    bw_set_sensitive(window, "GetNewMail", TRUE);
+    g_object_unref(window);
+
+    return FALSE;
+}
+
 static void
 bw_check_messages_thread(struct check_messages_thread_info *info)
 {
@@ -3049,14 +3058,12 @@ bw_check_messages_thread(struct check_messages_thread_info *info)
     checking_mail = 0;
 
     if (info->window) {
-        gdk_threads_enter();
-        bw_set_sensitive(info->window, "GetNewMail", TRUE);
+        gdk_threads_add_idle((GSourceFunc) bw_check_messages_thread_idle,
+                             info->window);
 #if defined(HAVE_LIBNM_GLIB)
         if (info->window->nm_state == NM_STATE_CONNECTED)
             time(&info->window->last_check_time);
 #endif                          /* defined(HAVE_LIBNM_GLIB) */
-        g_object_unref(info->window);
-        gdk_threads_leave();
     }
     pthread_mutex_unlock(&checking_mail_lock);
 



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