[gnome-control-center/gbsneto/applications-panel-cleanups: 11/16] applications: Remove integration_list and usage_list




commit e1088495d078853e8e5b2540deca5ffd73a44fa6
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Jan 20 14:43:43 2022 -0300

    applications: Remove integration_list and usage_list
    
    Now that the rows are derivated from AdwPreferencesRow, we can
    add them directly into the corresponding preferences groups.
    
    Other groups can't benefit from this cleanup yet because they
    have custom widgets.

 panels/applications/cc-applications-panel.c  |  48 ++++-----
 panels/applications/cc-applications-panel.ui | 140 +++++++++++----------------
 2 files changed, 78 insertions(+), 110 deletions(-)
---
diff --git a/panels/applications/cc-applications-panel.c b/panels/applications/cc-applications-panel.c
index 74130e48e..e11166424 100644
--- a/panels/applications/cc-applications-panel.c
+++ b/panels/applications/cc-applications-panel.c
@@ -108,7 +108,6 @@ struct _CcApplicationsPanel
   GtkListBox      *builtin_list;
 
   GtkWidget       *integration_section;
-  GtkListBox      *integration_list;
   CcToggleRow     *notification;
   CcToggleRow     *background;
   CcToggleRow     *wallpaper;
@@ -132,7 +131,6 @@ struct _CcApplicationsPanel
   CcInfoRow       *link;
 
   GtkWidget       *usage_section;
-  GtkListBox      *usage_list;
   CcInfoRow       *storage;
   GtkDialog       *storage_dialog;
   GtkListBox      *storage_list;
@@ -791,20 +789,6 @@ add_static_permission_row (CcApplicationsPanel *self,
   return 1;
 }
 
-static void
-permission_row_activated_cb (CcApplicationsPanel *self,
-                             GtkListBoxRow       *list_row)
-{
-  if (list_row == GTK_LIST_BOX_ROW (self->builtin))
-    {
-      CcShell *shell = cc_panel_get_shell (CC_PANEL (self));
-
-      gtk_window_set_transient_for (GTK_WINDOW (self->builtin_dialog),
-                                    GTK_WINDOW (cc_shell_get_toplevel (shell)));
-      gtk_window_present (GTK_WINDOW (self->builtin_dialog));
-    }
-}
-
 static gboolean
 add_static_permissions (CcApplicationsPanel *self,
                         GAppInfo            *info,
@@ -1491,17 +1475,25 @@ update_handler_sections (CcApplicationsPanel *self,
 /* --- usage section --- */
 
 static void
-storage_row_activated_cb (CcApplicationsPanel *self,
-                          GtkListBoxRow       *list_row)
+on_builtin_row_activated_cb (GtkListBoxRow       *row,
+                             CcApplicationsPanel *self)
 {
-  if (list_row == GTK_LIST_BOX_ROW (self->storage))
-    {
-      CcShell *shell = cc_panel_get_shell (CC_PANEL (self));
+  CcShell *shell = cc_panel_get_shell (CC_PANEL (self));
 
-      gtk_window_set_transient_for (GTK_WINDOW (self->storage_dialog),
-                                    GTK_WINDOW (cc_shell_get_toplevel (shell)));
-      gtk_window_present (GTK_WINDOW (self->storage_dialog));
-    }
+  gtk_window_set_transient_for (GTK_WINDOW (self->builtin_dialog),
+                                GTK_WINDOW (cc_shell_get_toplevel (shell)));
+  gtk_window_present (GTK_WINDOW (self->builtin_dialog));
+}
+
+static void
+on_storage_row_activated_cb (GtkListBoxRow       *row,
+                             CcApplicationsPanel *self)
+{
+  CcShell *shell = cc_panel_get_shell (CC_PANEL (self));
+
+  gtk_window_set_transient_for (GTK_WINDOW (self->storage_dialog),
+                                GTK_WINDOW (cc_shell_get_toplevel (shell)));
+  gtk_window_present (GTK_WINDOW (self->storage_dialog));
 }
 
 static void
@@ -2032,7 +2024,6 @@ cc_applications_panel_class_init (CcApplicationsPanelClass *klass)
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, handler_list);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, header_title);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, install_button);
-  gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, integration_list);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, integration_section);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, launch_button);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, location);
@@ -2059,7 +2050,6 @@ cc_applications_panel_class_init (CcApplicationsPanelClass *klass)
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage_dialog);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage_list);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, total);
-  gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, usage_list);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, usage_section);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, view_details_button);
 
@@ -2073,16 +2063,16 @@ cc_applications_panel_class_init (CcApplicationsPanelClass *klass)
   gtk_widget_class_bind_template_callback (widget_class, shortcuts_cb);
   gtk_widget_class_bind_template_callback (widget_class, privacy_link_cb);
   gtk_widget_class_bind_template_callback (widget_class, sound_cb);
-  gtk_widget_class_bind_template_callback (widget_class, permission_row_activated_cb);
   gtk_widget_class_bind_template_callback (widget_class, handler_row_activated_cb);
   gtk_widget_class_bind_template_callback (widget_class, clear_cache_cb);
-  gtk_widget_class_bind_template_callback (widget_class, storage_row_activated_cb);
   gtk_widget_class_bind_template_callback (widget_class, open_software_cb);
   gtk_widget_class_bind_template_callback (widget_class, handler_reset_cb);
+  gtk_widget_class_bind_template_callback (widget_class, on_builtin_row_activated_cb);
   gtk_widget_class_bind_template_callback (widget_class, on_launch_button_clicked_cb);
   gtk_widget_class_bind_template_callback (widget_class, on_sidebar_search_entry_activated_cb);
   gtk_widget_class_bind_template_callback (widget_class, on_sidebar_search_entry_search_changed_cb);
   gtk_widget_class_bind_template_callback (widget_class, on_sidebar_search_entry_search_stopped_cb);
+  gtk_widget_class_bind_template_callback (widget_class, on_storage_row_activated_cb);
 }
 
 static void
diff --git a/panels/applications/cc-applications-panel.ui b/panels/applications/cc-applications-panel.ui
index 956f3fb6c..8015bca47 100644
--- a/panels/applications/cc-applications-panel.ui
+++ b/panels/applications/cc-applications-panel.ui
@@ -110,7 +110,6 @@
                 <child>
                   <object class="GtkListBox" id="permission_list">
                     <property name="selection-mode">none</property>
-                    <signal name="row-activated" handler="permission_row_activated_cb" 
object="CcApplicationsPanel" swapped="yes"/>
                     <style>
                       <class name="boxed-list"/>
                     </style>
@@ -172,62 +171,51 @@
             <child>
               <object class="AdwPreferencesGroup" id="integration_section">
                 <child>
-                  <object class="GtkListBox" id="integration_list">
-                    <property name="selection-mode">none</property>
-                    <style>
-                      <class name="boxed-list"/>
-                    </style>
-                    <child>
-                      <object class="CcToggleRow" id="search">
-                        <property name="title" translatable="yes">Search</property>
-                        <signal name="notify::allowed" handler="search_cb" object="CcApplicationsPanel" 
swapped="yes"/>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="CcInfoRow" id="no_search">
-                        <property name="title" translatable="yes">Search</property>
-                        <property name="info" translatable="yes">Disabled</property>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="CcToggleRow" id="notification">
-                        <property name="title" translatable="yes">Notifications</property>
-                        <signal name="notify::allowed" handler="notification_cb" 
object="CcApplicationsPanel" swapped="yes"/>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="CcToggleRow" id="background">
-                        <property name="title" translatable="yes">Run in background</property>
-                        <signal name="notify::allowed" handler="background_cb" swapped="yes"/>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="CcToggleRow" id="wallpaper">
-                        <property name="title" translatable="yes">Set Desktop Background</property>
-                        <signal name="notify::allowed" handler="wallpaper_cb" swapped="yes"/>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="CcToggleRow" id="sound">
-                        <property name="title" translatable="yes">Sounds</property>
-                        <signal name="notify::allowed" handler="sound_cb" object="CcApplicationsPanel" 
swapped="yes"/>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="CcInfoRow" id="no_sound">
-                        <property name="title" translatable="yes">Sounds</property>
-                        <property name="info" translatable="yes">Disabled</property>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="CcToggleRow" id="shortcuts">
-                        <property name="title" translatable="yes">Inhibit system keyboard 
shortcuts</property>
-                        <signal name="notify::allowed" handler="shortcuts_cb" swapped="yes"/>
-                      </object>
-                    </child>
-                    <style>
-                      <class name="boxed-list"/>
-                    </style>
+                  <object class="CcToggleRow" id="search">
+                    <property name="title" translatable="yes">Search</property>
+                    <signal name="notify::allowed" handler="search_cb" object="CcApplicationsPanel" 
swapped="yes"/>
+                  </object>
+                </child>
+                <child>
+                  <object class="CcInfoRow" id="no_search">
+                    <property name="title" translatable="yes">Search</property>
+                    <property name="info" translatable="yes">Disabled</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="CcToggleRow" id="notification">
+                    <property name="title" translatable="yes">Notifications</property>
+                    <signal name="notify::allowed" handler="notification_cb" object="CcApplicationsPanel" 
swapped="yes"/>
+                  </object>
+                </child>
+                <child>
+                  <object class="CcToggleRow" id="background">
+                    <property name="title" translatable="yes">Run in background</property>
+                    <signal name="notify::allowed" handler="background_cb" swapped="yes"/>
+                  </object>
+                </child>
+                <child>
+                  <object class="CcToggleRow" id="wallpaper">
+                    <property name="title" translatable="yes">Set Desktop Background</property>
+                    <signal name="notify::allowed" handler="wallpaper_cb" swapped="yes"/>
+                  </object>
+                </child>
+                <child>
+                  <object class="CcToggleRow" id="sound">
+                    <property name="title" translatable="yes">Sounds</property>
+                    <signal name="notify::allowed" handler="sound_cb" object="CcApplicationsPanel" 
swapped="yes"/>
+                  </object>
+                </child>
+                <child>
+                  <object class="CcInfoRow" id="no_sound">
+                    <property name="title" translatable="yes">Sounds</property>
+                    <property name="info" translatable="yes">Disabled</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="CcToggleRow" id="shortcuts">
+                    <property name="title" translatable="yes">Inhibit system keyboard shortcuts</property>
+                    <signal name="notify::allowed" handler="shortcuts_cb" swapped="yes"/>
                   </object>
                 </child>
               </object>
@@ -259,30 +247,20 @@
             <child>
               <object class="AdwPreferencesGroup" id="usage_section">
                 <child>
-                  <object class="GtkListBox" id="usage_list">
-                    <property name="selection-mode">none</property>
-                    <signal name="row-activated" handler="storage_row_activated_cb" 
object="CcApplicationsPanel" swapped="yes"/>
-                    <style>
-                      <class name="boxed-list"/>
-                    </style>
-                    <child>
-                      <object class="CcInfoRow" id="builtin">
-                        <property name="title" translatable="yes">Built-in Permissions</property>
-                        <property name="subtitle" translatable="yes">System access that is required by the 
app</property>
-                        <property name="has-expander">True</property>
-                        <property name="is-link">True</property>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="CcInfoRow" id="storage">
-                        <property name="title" translatable="yes">Storage</property>
-                        <property name="has-expander">1</property>
-                        <property name="is-link">1</property>
-                      </object>
-                    </child>
-                    <style>
-                      <class name="boxed-list"/>
-                    </style>
+                  <object class="CcInfoRow" id="builtin">
+                    <property name="title" translatable="yes">Built-in Permissions</property>
+                    <property name="subtitle" translatable="yes">System access that is required by the 
app</property>
+                    <property name="has-expander">True</property>
+                    <property name="is-link">True</property>
+                    <signal name="activated" handler="on_builtin_row_activated_cb" 
object="CcApplicationsPanel" swapped="no" />
+                  </object>
+                </child>
+                <child>
+                  <object class="CcInfoRow" id="storage">
+                    <property name="title" translatable="yes">Storage</property>
+                    <property name="has-expander">1</property>
+                    <property name="is-link">1</property>
+                    <signal name="activated" handler="on_storage_row_activated_cb" 
object="CcApplicationsPanel" swapped="no" />
                   </object>
                 </child>
               </object>


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