[gnome-control-center] network: Fix parenting of the broadband wizard



commit 446f7cf0272f5ba88790c012cde193c393246f07
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Oct 2 08:57:38 2012 +0200

    network: Fix parenting of the broadband wizard
    
    By showing the wizard in an idle by default, or waiting until
    the shell is visible.

 panels/network/network-dialogs.c |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/panels/network/network-dialogs.c b/panels/network/network-dialogs.c
index 6934035..b5bc533 100644
--- a/panels/network/network-dialogs.c
+++ b/panels/network/network-dialogs.c
@@ -473,6 +473,25 @@ done:
         nma_mobile_wizard_destroy (wizard);
 }
 
+static void
+toplevel_shown (GtkWindow       *toplevel,
+                GParamSpec      *pspec,
+                NMAMobileWizard *wizard)
+{
+        gboolean visible = FALSE;
+
+        g_object_get (G_OBJECT (toplevel), "visible", &visible, NULL);
+        if (visible)
+                nma_mobile_wizard_present (wizard);
+}
+
+static gboolean
+show_wizard_idle_cb (NMAMobileWizard *wizard)
+{
+        nma_mobile_wizard_present (wizard);
+        return FALSE;
+}
+
 void
 cc_network_panel_connect_to_3g_network (CcNetworkPanel   *panel,
                                         NMClient         *client,
@@ -483,6 +502,7 @@ cc_network_panel_connect_to_3g_network (CcNetworkPanel   *panel,
         MobileDialogClosure *closure;
         NMAMobileWizard *wizard;
 	NMDeviceModemCapabilities caps;
+        gboolean visible = FALSE;
 
         g_debug ("connect to 3g");
         if (!NM_IS_DEVICE_MODEM (device)) {
@@ -518,5 +538,13 @@ cc_network_panel_connect_to_3g_network (CcNetworkPanel   *panel,
                 return;
         }
 
-        nma_mobile_wizard_present (wizard);
+        g_object_get (G_OBJECT (toplevel), "visible", &visible, NULL);
+        if (visible) {
+                g_debug ("Scheduling showing the Mobile wizard");
+                g_idle_add ((GSourceFunc) show_wizard_idle_cb, wizard);
+        } else {
+                g_debug ("Will show wizard a bit later, toplevel is not visible");
+                g_signal_connect (G_OBJECT (toplevel), "notify::visible",
+                                  G_CALLBACK (toplevel_shown), wizard);
+        }
 }



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