[gnome-initial-setup] goa: Only set page visible when we have a network connection



commit fe4d592957b2aed29020a2a60420e2e74c9bd222
Author: Michael Wood <michael g wood intel com>
Date:   Fri Apr 12 19:45:31 2013 +0100

    goa: Only set page visible when we have a network connection
    
    If you have no network connection then this page won't be displayed. It
    will become visible again if a network connection is established.

 gnome-initial-setup/pages/goa/gis-goa-page.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/gnome-initial-setup/pages/goa/gis-goa-page.c b/gnome-initial-setup/pages/goa/gis-goa-page.c
index 37a543b..af1c2b3 100644
--- a/gnome-initial-setup/pages/goa/gis-goa-page.c
+++ b/gnome-initial-setup/pages/goa/gis-goa-page.c
@@ -321,12 +321,23 @@ goa_account_removed (GoaClient *client, GoaObject *object, gpointer user_data)
 }
 
 static void
+network_status_changed (GNetworkMonitor *monitor,
+                        gboolean         available,
+                        gpointer         user_data)
+{
+  GisGoaPage *page = GIS_GOA_PAGE (user_data);
+
+  gtk_widget_set_visible (GTK_WIDGET (page), available);
+}
+
+static void
 gis_goa_page_constructed (GObject *object)
 {
   GisGoaPage *page = GIS_GOA_PAGE (object);
   GisGoaPagePrivate *priv = page->priv;
   GtkWidget *button;
   GError *error = NULL;
+  GNetworkMonitor *network_monitor = g_network_monitor_get_default ();
 
   G_OBJECT_CLASS (gis_goa_page_parent_class)->constructed (object);
 
@@ -352,9 +363,13 @@ gis_goa_page_constructed (GObject *object)
   g_signal_connect (priv->goa_client, "account-removed",
                     G_CALLBACK (goa_account_removed), page);
 
+  g_signal_connect (network_monitor, "network-changed",
+                    G_CALLBACK (network_status_changed), page);
+
   gis_page_set_complete (GIS_PAGE (page), TRUE);
 
-  gtk_widget_show (GTK_WIDGET (page));
+  if (g_network_monitor_get_network_available (network_monitor))
+    gtk_widget_show (GTK_WIDGET (page));
 }
 
 static void


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