[gnome-control-center] online-accounts: Only show the accounts list when there are accounts



commit fa81d1679afa80d9c7c958db37ef407c3e18174c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Feb 22 13:23:44 2017 +0100

    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 |    6 ++++++
 panels/online-accounts/online-accounts.ui         |    1 -
 2 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/panels/online-accounts/cc-online-accounts-panel.c 
b/panels/online-accounts/cc-online-accounts-panel.c
index da11362..c1337eb 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;
@@ -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);
diff --git a/panels/online-accounts/online-accounts.ui b/panels/online-accounts/online-accounts.ui
index d85939b..a9b7c5c 100644
--- a/panels/online-accounts/online-accounts.ui
+++ b/panels/online-accounts/online-accounts.ui
@@ -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">


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