From 1e580c679b8b61d089531b814ec8ecbdccf8128a Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 10 Nov 2016 14:56:27 -0200 Subject: [PATCH] online-accounts: Add an offline message label When offline, we currently block the new accounts listbox so that users can't add new accounts. There is, however, no visual indication that we're offline, besides the listbox. Fix that by adding a descriptive label that's only visible when offline. https://bugzilla.gnome.org/show_bug.cgi?id=774222 --- panels/online-accounts/cc-online-accounts-panel.c | 8 +++++++- panels/online-accounts/online-accounts.ui | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/panels/online-accounts/cc-online-accounts-panel.c b/panels/online-accounts/cc-online-accounts-panel.c index 4a2b40edd..f9759d07d 100644 --- a/panels/online-accounts/cc-online-accounts-panel.c +++ b/panels/online-accounts/cc-online-accounts-panel.c @@ -49,6 +49,7 @@ struct _CcGoaPanel GtkWidget *new_account_vbox; GtkWidget *notification_label; GtkWidget *notification_revealer; + GtkWidget *offline_label; GtkWidget *providers_listbox; GtkWidget *remove_account_button; GtkWidget *stack; @@ -420,6 +421,10 @@ cc_goa_panel_init (CcGoaPanel *panel) monitor = g_network_monitor_get_default(); + g_object_bind_property (monitor, "network-available", + panel->offline_label, "visible", + G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN); + g_object_bind_property (monitor, "network-available", panel->providers_listbox, "sensitive", G_BINDING_SYNC_CREATE); @@ -454,7 +459,7 @@ cc_goa_panel_init (CcGoaPanel *panel) fill_accounts_listbox (panel); goa_provider_get_all (get_all_providers_cb, panel); - gtk_widget_show_all (GTK_WIDGET (panel)); + gtk_widget_show (GTK_WIDGET (panel)); } static const char * @@ -502,6 +507,7 @@ cc_goa_panel_class_init (CcGoaPanelClass *klass) gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, new_account_vbox); gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, notification_label); gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, notification_revealer); + gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, offline_label); gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, providers_listbox); gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, remove_account_button); gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, stack); diff --git a/panels/online-accounts/online-accounts.ui b/panels/online-accounts/online-accounts.ui index 97a2d1f08..fa6f27bda 100644 --- a/panels/online-accounts/online-accounts.ui +++ b/panels/online-accounts/online-accounts.ui @@ -91,6 +91,14 @@ + + + True + False + True + No internet connection — connect to setup new online accounts + + True