[gnome-control-center] Network: refresh ui in an idle



commit d4b88f12a6e3b1fb122f84c573a7a37607aa7fcf
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed May 25 08:54:35 2011 -0400

    Network: refresh ui in an idle
    
    This seems a lot safer than doing it directly from all kinds
    of callbacks.

 panels/network/cc-network-panel.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 9d4b1db..10fbf22 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -62,6 +62,7 @@ struct _CcNetworkPanelPrivate
         NMClient         *client;
         NMRemoteSettings *remote_settings;
         gboolean          updating_device;
+        guint             refresh_idle;
 };
 
 enum {
@@ -1697,9 +1698,10 @@ nm_device_refresh_vpn_ui (CcNetworkPanel *panel, NetVpn *vpn)
                                 net_vpn_get_password (vpn));
 }
 
-static void
-refresh_ui (CcNetworkPanel *panel)
+static gboolean
+refresh_ui_idle (gpointer data)
 {
+        CcNetworkPanel *panel = data;
         GtkTreeSelection *selection;
         GtkTreeIter iter;
         GtkTreeModel *model;
@@ -1776,7 +1778,18 @@ refresh_ui (CcNetworkPanel *panel)
                 nm_device_refresh_device_ui (panel, NET_DEVICE (object));
         }
 out:
-        return;
+        priv->refresh_idle = 0;
+
+        return FALSE;
+}
+
+static void
+refresh_ui (CcNetworkPanel *panel)
+{
+        if (panel->priv->refresh_idle != 0)
+                return;
+
+        panel->priv->refresh_idle = g_idle_add (refresh_ui_idle, panel);
 }
 
 static void



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