From fd095e82e062eee5e3843de144f632473d04989a Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 10 Nov 2016 19:27:44 -0200 Subject: online-accounts: Only show the accounts list when there are accounts When the user has no account set, the current implementation of the Online Accounts panel shows a weird 1px line that is the empty list. Fix that by only showing the list when there are accounts available. https://bugzilla.gnome.org/show_bug.cgi?id=774222 --- panels/online-accounts/cc-online-accounts-panel.c | 7 +++++++ panels/online-accounts/online-accounts.ui | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/panels/online-accounts/cc-online-accounts-panel.c b/panels/online-accounts/cc-online-accounts-panel.c index ea3b349ae..05acc4892 100644 --- a/panels/online-accounts/cc-online-accounts-panel.c +++ b/panels/online-accounts/cc-online-accounts-panel.c @@ -42,6 +42,7 @@ struct _CcGoaPanel GoaObject *active_object; GoaObject *removed_object; + GtkWidget *accounts_frame; GtkWidget *accounts_listbox; GtkWidget *edit_account_dialog; GtkWidget *edit_account_headerbar; @@ -495,6 +496,7 @@ cc_goa_panel_class_init (CcGoaPanelClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/online-accounts/online-accounts.ui"); + gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, accounts_frame); gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, accounts_listbox); gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, accounts_vbox); gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, edit_account_dialog); @@ -718,6 +720,7 @@ on_account_added (GoaClient *client, /* Add to the listbox */ gtk_container_add (GTK_CONTAINER (self->accounts_listbox), row); gtk_widget_show_all (row); + gtk_widget_show (self->accounts_frame); g_clear_pointer (&title, g_free); g_clear_object (&gicon); @@ -755,10 +758,14 @@ on_account_removed (GoaClient *client, if (row_object == object) { gtk_widget_destroy (l->data); + children = g_list_remove (children, l->data); break; } } + /* Hide the list if we removed the last account */ + gtk_widget_set_visible (self->accounts_frame, children != NULL); + g_list_free (children); } diff --git a/panels/online-accounts/online-accounts.ui b/panels/online-accounts/online-accounts.ui index ea423e639..049481c60 100644 --- a/panels/online-accounts/online-accounts.ui +++ b/panels/online-accounts/online-accounts.ui @@ -139,7 +139,6 @@ - True False -- cgit v1.2.1