[balsa/gtk3] Change button sensitivity in an idle callback



commit 0786c9f27f90019594887357d049fece08650f52
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Wed Feb 20 21:42:32 2013 -0500

    Change button sensitivity in an idle callback
    
        * src/main-window.c: change button sensitivity in an idle
        callback.

 ChangeLog         |    5 +++++
 src/main-window.c |   14 +++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b5ccf17..83451e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2013-02-20  Peter Bloomfield
 
+       * src/main-window.c: change button sensitivity in an idle
+       callback.
+
+2013-02-20  Peter Bloomfield
+
        * src/balsa-app.c (balsa_find_iter_by_data): check for
        sub-thread.
 
diff --git a/src/main-window.c b/src/main-window.c
index 54629ae..91a06b6 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -3134,6 +3134,15 @@ bw_mailbox_check(LibBalsaMailbox * mailbox, BalsaWindow * window)
     libbalsa_mailbox_check(mailbox);
 }
 
+static gboolean
+bw_check_messages_thread_idle_cb(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)
 {
@@ -3161,14 +3170,13 @@ 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);
+        g_idle_add((GSourceFunc) bw_check_messages_thread_idle_cb,
+                   g_object_ref(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]