[gnome-control-center] online-accounts: Remove unused widgets



commit dce3e168d226ea4d5d957311068c5be42c54023d
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Nov 9 17:11:47 2016 -0200

    online-accounts: Remove unused widgets
    
    These widgets are not used anymore, and they're not present in the
    latest designs.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=774222

 panels/online-accounts/cc-online-accounts-panel.c |  113 ------------------
 panels/online-accounts/online-accounts.ui         |  132 +-------------------
 2 files changed, 7 insertions(+), 238 deletions(-)
---
diff --git a/panels/online-accounts/cc-online-accounts-panel.c 
b/panels/online-accounts/cc-online-accounts-panel.c
index dfa3315..6529807 100644
--- a/panels/online-accounts/cc-online-accounts-panel.c
+++ b/panels/online-accounts/cc-online-accounts-panel.c
@@ -42,15 +42,9 @@ struct _CcGoaPanel
   GoaObject *active_object;
 
   GtkWidget *accounts_listbox;
-  GtkWidget *accounts_notebook;
-  GtkWidget *accounts_tree_box;
-  GtkWidget *accounts_tree_label;
   GtkWidget *edit_account_dialog;
   GtkWidget *edit_account_headerbar;
   GtkWidget *providers_listbox;
-  GtkWidget *toolbar;
-  GtkWidget *toolbar_add_button;
-  GtkWidget *toolbar_remove_button;
   GtkWidget *accounts_vbox;
 };
 
@@ -59,11 +53,6 @@ static gboolean on_edit_account_dialog_delete_event (CcGoaPanel *self);
 static void on_listbox_row_activated (CcGoaPanel    *self,
                                       GtkListBoxRow *activated_row);
 
-static void on_toolbar_add_button_clicked (GtkToolButton *button,
-                                           gpointer       user_data);
-static void on_toolbar_remove_button_clicked (GtkToolButton *button,
-                                              gpointer       user_data);
-
 static void fill_accounts_listbox (CcGoaPanel *self);
 
 static void on_account_added (GoaClient  *client,
@@ -280,10 +269,6 @@ cc_goa_panel_init (CcGoaPanel *panel)
                           panel->providers_listbox, "sensitive",
                           G_BINDING_SYNC_CREATE);
 
-  g_object_bind_property (monitor, "network-available",
-                          panel->toolbar_add_button, "sensitive",
-                          G_BINDING_SYNC_CREATE);
-
   /* TODO: probably want to avoid _sync() ... */
   error = NULL;
   panel->client = goa_client_new_sync (NULL /* GCancellable */, &error);
@@ -355,37 +340,20 @@ 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_listbox);
-  gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, accounts_notebook);
-  gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, accounts_tree_box);
-  gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, accounts_tree_label);
   gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, accounts_vbox);
   gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, edit_account_dialog);
   gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, edit_account_headerbar);
   gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, providers_listbox);
-  gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, toolbar);
-  gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, toolbar_add_button);
-  gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, toolbar_remove_button);
 
   gtk_widget_class_bind_template_callback (widget_class, on_edit_account_dialog_delete_event);
   gtk_widget_class_bind_template_callback (widget_class, on_listbox_row_activated);
-  gtk_widget_class_bind_template_callback (widget_class, on_toolbar_add_button_clicked);
-  gtk_widget_class_bind_template_callback (widget_class, on_toolbar_remove_button_clicked);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
-show_page (CcGoaPanel *panel,
-           gint page_num)
-{
-  gtk_notebook_set_current_page (GTK_NOTEBOOK (panel->accounts_notebook), page_num);
-}
-
-static void
 show_page_nothing_selected (CcGoaPanel *panel)
 {
-  gtk_widget_set_sensitive (panel->toolbar_remove_button, FALSE);
-  gtk_widget_show (panel->accounts_tree_label);
 }
 
 static void
@@ -396,7 +364,6 @@ show_page_account (CcGoaPanel  *panel,
   GList *l;
   GoaProvider *provider;
   GoaAccount *account;
-  gboolean is_locked;
   const gchar *provider_name;
   const gchar *provider_type;
   gchar *title;
@@ -405,13 +372,6 @@ show_page_account (CcGoaPanel  *panel,
 
   panel->active_object = object;
 
-  show_page (panel, 0);
-  gtk_widget_set_sensitive (panel->accounts_tree_box, TRUE);
-  gtk_widget_hide (panel->accounts_tree_label);
-
-  is_locked = goa_account_get_is_locked (goa_object_peek_account (object));
-  gtk_widget_set_sensitive (panel->toolbar_remove_button, !is_locked);
-
   /* Out with the old */
   children = gtk_container_get_children (GTK_CONTAINER (panel->accounts_vbox));
   for (l = children; l != NULL; l = l->next)
@@ -651,76 +611,3 @@ get_all_providers_cb (GObject      *source,
 
   g_list_free_full (providers, g_object_unref);
 }
-
-/* ---------------------------------------------------------------------------------------------------- */
-
-static void
-on_toolbar_add_button_clicked (GtkToolButton *button,
-                               gpointer       user_data)
-{
-}
-
-static void
-remove_account_cb (GoaAccount    *account,
-                   GAsyncResult  *res,
-                   gpointer       user_data)
-{
-  CcGoaPanel *panel = CC_GOA_PANEL (user_data);
-  GError *error;
-
-  error = NULL;
-  if (!goa_account_call_remove_finish (account, res, &error))
-    {
-      GtkWidget *dialog;
-      dialog = gtk_message_dialog_new (GTK_WINDOW (cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL 
(panel)))),
-                                       GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                       GTK_MESSAGE_ERROR,
-                                       GTK_BUTTONS_CLOSE,
-                                       _("Error removing account"));
-      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                                                "%s",
-                                                error->message);
-      gtk_widget_show_all (dialog);
-      gtk_dialog_run (GTK_DIALOG (dialog));
-      gtk_widget_destroy (dialog);
-      g_error_free (error);
-    }
-  g_object_unref (panel);
-}
-
-static void
-on_toolbar_remove_button_clicked (GtkToolButton *button,
-                                  gpointer       user_data)
-{
-  CcGoaPanel *panel = CC_GOA_PANEL (user_data);
-  GtkListBoxRow *selected_row;
-  GoaObject *object;
-  GtkWidget *dialog;
-  gint response;
-
-  selected_row = gtk_list_box_get_selected_row (GTK_LIST_BOX (panel->accounts_listbox));
-  if (selected_row == NULL)
-    return;
-
-  object = g_object_get_data (G_OBJECT (selected_row), "goa-object");
-
-  dialog = gtk_message_dialog_new (GTK_WINDOW (cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL 
(panel)))),
-                                   GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                   GTK_MESSAGE_QUESTION,
-                                   GTK_BUTTONS_CANCEL,
-                                   _("Are you sure you want to remove the account?"));
-  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                                            _("This will not remove the account on the server."));
-  gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Remove"), GTK_RESPONSE_OK);
-  gtk_widget_show_all (dialog);
-  response = gtk_dialog_run (GTK_DIALOG (dialog));
-  gtk_widget_destroy (dialog);
-
-  if (response == GTK_RESPONSE_OK)
-    {
-      goa_account_call_remove (goa_object_peek_account (object),
-                               NULL, /* GCancellable */
-                               (GAsyncReadyCallback) remove_account_cb,
-                               g_object_ref (panel));
-    }
-}
diff --git a/panels/online-accounts/online-accounts.ui b/panels/online-accounts/online-accounts.ui
index 033ffd8..16be4b0 100644
--- a/panels/online-accounts/online-accounts.ui
+++ b/panels/online-accounts/online-accounts.ui
@@ -29,88 +29,16 @@
               </object>
             </child>
             <child>
-              <object class="GtkBox" id="accounts_tree_box">
+              <object class="GtkFrame" id="accounts_frame">
                 <property name="visible">True</property>
-                <property name="orientation">vertical</property>
-                <property name="spacing">0</property>
-                <child>
-                  <object class="GtkOverlay" id="accounts-tree-overlay">
-                    <property name="visible">True</property>
-                    <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">
-                            <property name="vexpand">True</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="selection_mode">none</property>
-                            <signal name="row-activated" handler="on_listbox_row_activated" 
object="CcGoaPanel" swapped="yes" />
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                    <child type="overlay">
-                      <object class="GtkLabel" id="accounts_tree_label">
-                        <property name="can_focus">False</property>
-                        <property name="no-show-all">True</property>
-                        <property name="justify">center</property>
-                        <property name="label" translatable="yes">No online accounts configured</property>
-                        <property name="max-width-chars">18</property>
-                        <property name="wrap">True</property>
-                      </object>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
+                <property name="can_focus">False</property>
                 <child>
-                  <object class="GtkToolbar" id="toolbar">
+                  <object class="GtkListBox" id="accounts_listbox">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="toolbar_style">icons</property>
-                    <property name="icon_size">1</property>
-                    <style>
-                      <class name="inline-toolbar"/>
-                    </style>
-                    <child>
-                      <object class="GtkToolButton" id="toolbar_add_button">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="icon_name">list-add-symbolic</property>
-                        <property name="label" translatable="yes">Add Account</property>
-                        <signal name="clicked" handler="on_toolbar_add_button_clicked" object="CcGoaPanel" 
swapped="no" />
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkToolButton" id="toolbar_remove_button">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="icon_name">list-remove-symbolic</property>
-                        <property name="label" translatable="yes">Remove Account</property>
-                        <signal name="clicked" handler="on_toolbar_remove_button_clicked" 
object="CcGoaPanel" swapped="no" />
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
-                      </packing>
-                    </child>
+                    <property name="can_focus">True</property>
+                    <property name="selection_mode">none</property>
+                    <signal name="row-activated" handler="on_listbox_row_activated" object="CcGoaPanel" 
swapped="yes" />
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">2</property>
-                  </packing>
                 </child>
               </object>
             </child>
@@ -159,56 +87,10 @@
       </object>
     </child>
     <child internal-child="vbox">
-      <object class="GtkBox">
+      <object class="GtkBox" id="accounts_vbox">
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
         <property name="margin">18</property>
-        <child>
-          <object class="GtkNotebook" id="accounts_notebook">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="show_tabs">False</property>
-            <property name="show_border">False</property>
-            <child>
-              <object class="GtkBox" id="accounts_vbox">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="orientation">vertical</property>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-              </object>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label1">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label">page 1</property>
-              </object>
-              <packing>
-                <property name="tab_fill">False</property>
-              </packing>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child type="tab">
-              <placeholder/>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-          </packing>
-        </child>
       </object>
     </child>
   </object>


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