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
This commit is contained in:
Georges Basile Stavracas Neto 2017-02-22 13:23:44 +01:00
parent af7c214aaf
commit fa81d1679a
2 changed files with 6 additions and 1 deletions

View file

@ -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;
@ -499,6 +500,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);
@ -662,18 +664,21 @@ static void
hide_row_for_account (CcGoaPanel *self, GtkWidget *row, GList *other_rows)
{
gtk_widget_hide (row);
gtk_widget_set_visible (self->accounts_frame, other_rows != NULL);
}
static void
remove_row_for_account (CcGoaPanel *self, GtkWidget *row, GList *other_rows)
{
gtk_widget_destroy (row);
gtk_widget_set_visible (self->accounts_frame, other_rows != NULL);
}
static void
show_row_for_account (CcGoaPanel *self, GtkWidget *row, GList *other_rows)
{
gtk_widget_show (row);
gtk_widget_show (self->accounts_frame);
}
static void
@ -780,6 +785,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);

View file

@ -138,7 +138,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">