summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2016-11-10 19:27:44 -0200
committerDebarshi Ray <debarshir@gnome.org>2017-02-16 12:28:07 +0100
commitfd095e82e062eee5e3843de144f632473d04989a (patch)
tree1f10a869585f5fbbd23acd804d5feb984a54ea48
parent572b853349f965645a2c83c39fb0a6ccc71798b8 (diff)
downloadgnome-control-center-wip/rishi/new-goa-panel.tar.gz
online-accounts: Only show the accounts list when there are accountswip/rishi/new-goa-panel
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
-rw-r--r--panels/online-accounts/cc-online-accounts-panel.c7
-rw-r--r--panels/online-accounts/online-accounts.ui1
2 files changed, 7 insertions, 1 deletions
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 @@
</child>
<child>
<object class="GtkFrame" id="accounts_frame">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkListBox" id="accounts_listbox">