[gnome-control-center/wip/gbsneto/new-goa-panel: 76/76] online-accounts: only show the accounts list when there are accounts



commit edb90bbccc96bb2f8025fafb34e481a859e6fca0
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Nov 10 19:27:44 2016 -0200

    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 deletions(-)
---
diff --git a/panels/online-accounts/cc-online-accounts-panel.c 
b/panels/online-accounts/cc-online-accounts-panel.c
index a57eca4..917a24a 100644
--- a/panels/online-accounts/cc-online-accounts-panel.c
+++ b/panels/online-accounts/cc-online-accounts-panel.c
@@ -44,6 +44,7 @@ struct _CcGoaPanel
   GoaObject *edited_object;
   GoaObject *removed_object;
 
+  GtkWidget *accounts_frame;
   GtkWidget *accounts_listbox;
   GtkWidget *edit_account_dialog;
   GtkWidget *edit_account_headerbar;
@@ -506,6 +507,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);
@@ -733,6 +735,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);
@@ -770,10 +773,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 3285f8c..432c5fa 100644
--- a/panels/online-accounts/online-accounts.ui
+++ b/panels/online-accounts/online-accounts.ui
@@ -140,7 +140,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]