[gnome-control-center/gbsneto/applications-panel-cleanups: 2/18] applications: Switch to AdwPreferencesPage & family




commit 2e526b17060e216715bf280f09873bc2c4db5e0f
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Jan 20 12:31:46 2022 -0300

    applications: Switch to AdwPreferencesPage & family
    
    This brings a good cleanup in the UI file.

 panels/applications/cc-applications-panel.c  |  22 +-
 panels/applications/cc-applications-panel.ui | 487 +++++++++++----------------
 2 files changed, 204 insertions(+), 305 deletions(-)
---
diff --git a/panels/applications/cc-applications-panel.c b/panels/applications/cc-applications-panel.c
index 5e14df953..89f1d55fc 100644
--- a/panels/applications/cc-applications-panel.c
+++ b/panels/applications/cc-applications-panel.c
@@ -88,7 +88,7 @@ struct _CcApplicationsPanel
   GtkWidget       *settings_box;
   GtkButton       *install_button;
 
-  GtkBox          *permission_section;
+  GtkWidget       *permission_section;
   GtkListBox      *permission_list;
   CcToggleRow     *camera;
   CcInfoRow       *no_camera;
@@ -102,7 +102,7 @@ struct _CcApplicationsPanel
   GtkLabel        *builtin_label;
   GtkListBox      *builtin_list;
 
-  GtkBox          *integration_section;
+  GtkWidget       *integration_section;
   GtkListBox      *integration_list;
   CcToggleRow     *notification;
   CcToggleRow     *background;
@@ -112,7 +112,7 @@ struct _CcApplicationsPanel
   CcToggleRow     *search;
   CcInfoRow       *no_search;
 
-  GtkBox          *handler_section;
+  GtkWidget       *handler_section;
   GtkButton       *handler_reset;
   GtkListBox      *handler_list;
   CcInfoRow       *hypertext;
@@ -126,7 +126,7 @@ struct _CcApplicationsPanel
   CcInfoRow       *other;
   CcInfoRow       *link;
 
-  GtkBox          *usage_section;
+  GtkWidget       *usage_section;
   GtkListBox      *usage_list;
   CcInfoRow       *storage;
   GtkDialog       *storage_dialog;
@@ -871,7 +871,7 @@ update_permission_section (CcApplicationsPanel *self,
 
   if (portal_app_id == NULL)
     {
-      gtk_widget_hide (GTK_WIDGET (self->permission_section));
+      gtk_widget_hide (self->permission_section);
       return;
     }
 
@@ -906,7 +906,7 @@ update_permission_section (CcApplicationsPanel *self,
   gtk_widget_set_visible (GTK_WIDGET (self->builtin), has_builtin);
   has_any |= has_builtin;
 
-  gtk_widget_set_visible (GTK_WIDGET (self->permission_section), has_any);
+  gtk_widget_set_visible (self->permission_section, has_any);
 }
 
 /* --- gintegration section --- */
@@ -976,7 +976,7 @@ update_integration_section (CcApplicationsPanel *self,
       gtk_widget_hide (GTK_WIDGET (self->no_sound));
     }
 
-  gtk_widget_set_visible (GTK_WIDGET (self->integration_section), has_any);
+  gtk_widget_set_visible (self->integration_section, has_any);
 }
 
 /* --- handler section --- */
@@ -1326,7 +1326,7 @@ static void
 add_handler_row (CcApplicationsPanel *self,
                  const gchar         *type)
 {
-  gtk_widget_show (GTK_WIDGET (self->handler_section));
+  gtk_widget_show (self->handler_section);
 
   if (g_content_type_is_a (type, "x-scheme-handler/*"))
     add_link_type (self, type);
@@ -1445,7 +1445,7 @@ update_handler_sections (CcApplicationsPanel *self,
   self->other = NULL;
   self->link = NULL;
 
-  gtk_widget_hide (GTK_WIDGET (self->handler_section));
+  gtk_widget_hide (self->handler_section);
 
   types = g_app_info_get_supported_types (info);
   if (types == NULL || types[0] == NULL)
@@ -1635,12 +1635,12 @@ update_usage_section (CcApplicationsPanel *self,
 
   if (portal_app_id != NULL)
     {
-      gtk_widget_show (GTK_WIDGET (self->usage_section));
+      gtk_widget_show (self->usage_section);
       update_app_sizes (self, portal_app_id);
     }
   else
     {
-      gtk_widget_hide (GTK_WIDGET (self->usage_section));
+      gtk_widget_hide (self->usage_section);
     }
 }
 
diff --git a/panels/applications/cc-applications-panel.ui b/panels/applications/cc-applications-panel.ui
index c9c4606cf..984fc12dc 100644
--- a/panels/applications/cc-applications-panel.ui
+++ b/panels/applications/cc-applications-panel.ui
@@ -48,328 +48,227 @@
         </child>
 
         <child>
-          <object class="GtkScrolledWindow" id="settings_box">
-            <property name="hscrollbar-policy">never</property>
+          <object class="AdwPreferencesPage" id="settings_box">
+
+            <child>
+              <object class="AdwPreferencesGroup" id="permission_section">
+                <property name="title" translatable="yes">Permissions &amp;amp; Access</property>
+                <property name="description" translatable="yes">Data and services that this app has asked 
for access to and permissions that it requires.</property>
+
+                <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>
+                    <child>
+                      <object class="CcToggleRow" id="camera">
+                        <property name="title" translatable="yes">Camera</property>
+                        <signal name="notify::allowed" handler="camera_cb" object="CcApplicationsPanel" 
swapped="yes"/>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="CcInfoRow" id="no_camera">
+                        <property name="title" translatable="yes">Camera</property>
+                        <property name="info" translatable="yes">Disabled</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="CcToggleRow" id="microphone">
+                        <property name="title" translatable="yes">Microphone</property>
+                        <signal name="notify::allowed" handler="microphone_cb" object="CcApplicationsPanel" 
swapped="yes"/>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="CcInfoRow" id="no_microphone">
+                        <property name="title" translatable="yes">Microphone</property>
+                        <property name="info" translatable="yes">Disabled</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="CcToggleRow" id="location">
+                        <property name="title" translatable="yes">Location Services</property>
+                        <signal name="notify::allowed" handler="location_cb" object="CcApplicationsPanel" 
swapped="yes"/>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="CcInfoRow" id="no_location">
+                        <property name="title" translatable="yes">Location Services</property>
+                        <property name="info" translatable="yes">Disabled</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="CcInfoRow" id="builtin">
+                        <property name="title" translatable="yes">Built-in Permissions</property>
+                        <property name="info" translatable="yes">Cannot be changed</property>
+                        <property name="has-expander">True</property>
+                        <property name="is-link">True</property>
+                      </object>
+                    </child>
+                    <style>
+                      <class name="boxed-list"/>
+                    </style>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="xalign">0</property>
+                    <property name="wrap">1</property>
+                    <property name="max-width-chars">50</property>
+                    <property name="margin-top">12</property>
+                    <property name="label" translatable="yes">Individual permissions for applications can be 
reviewed in the &lt;a href=&quot;privacy&quot;&gt;Privacy&lt;/a&gt; Settings.</property>
+                    <property name="use-markup">1</property>
+                    <signal name="activate-link" handler="privacy_link_cb" object="CcApplicationsPanel" 
swapped="yes"/>
+                  </object>
+                </child>
+              </object>
+            </child>
+
             <child>
-              <object class="AdwClamp">
-                <property name="margin_top">32</property>
-                <property name="margin_bottom">32</property>
-                <property name="margin_start">12</property>
-                <property name="margin_end">12</property>
+              <object class="AdwPreferencesGroup" id="integration_section">
+                <property name="title" translatable="yes">Integration</property>
+                <property name="description" translatable="yes">System features used by this 
application.</property>
+                <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>
+                </child>
+              </object>
+            </child>
 
+            <child>
+              <object class="AdwPreferencesGroup" id="handler_section">
                 <child>
                   <object class="GtkBox">
-                    <property name="orientation">vertical</property>
-                    <property name="spacing">24</property>
-                    <property name="hexpand">1</property>
+                    <property name="margin-bottom">12</property>
+                    <property name="spacing">6</property>
                     <child>
-                      <object class="GtkBox" id="permission_section">
+                      <object class="GtkBox">
                         <property name="orientation">vertical</property>
-                        <property name="spacing">12</property>
-                        <style>
-                          <class name="section"/>
-                        </style>
+                        <property name="spacing">6</property>
                         <child>
-                          <object class="GtkBox">
-                            <property name="orientation">vertical</property>
-                            <property name="spacing">6</property>
-                            <child>
-                              <object class="GtkLabel">
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Permissions &amp; Access</property>
-                                <style>
-                                  <class name="section-title"/>
-                                </style>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="GtkLabel">
-                                <property name="xalign">0</property>
-                                <property name="wrap">1</property>
-                                <property name="max-width-chars">50</property>
-                                <property name="label" translatable="yes">Data and services that this app 
has asked for access to and permissions that it requires.</property>
-                                <style>
-                                  <class name="section-subtitle"/>
-                                </style>
-                              </object>
-                            </child>
-                          </object>
-                        </child>
-                        <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>
-                            <child>
-                              <object class="CcToggleRow" id="camera">
-                                <property name="title" translatable="yes">Camera</property>
-                                <signal name="notify::allowed" handler="camera_cb" 
object="CcApplicationsPanel" swapped="yes"/>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="CcInfoRow" id="no_camera">
-                                <property name="title" translatable="yes">Camera</property>
-                                <property name="info" translatable="yes">Disabled</property>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="CcToggleRow" id="microphone">
-                                <property name="title" translatable="yes">Microphone</property>
-                                <signal name="notify::allowed" handler="microphone_cb" 
object="CcApplicationsPanel" swapped="yes"/>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="CcInfoRow" id="no_microphone">
-                                <property name="title" translatable="yes">Microphone</property>
-                                <property name="info" translatable="yes">Disabled</property>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="CcToggleRow" id="location">
-                                <property name="title" translatable="yes">Location Services</property>
-                                <signal name="notify::allowed" handler="location_cb" 
object="CcApplicationsPanel" swapped="yes"/>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="CcInfoRow" id="no_location">
-                                <property name="title" translatable="yes">Location Services</property>
-                                <property name="info" translatable="yes">Disabled</property>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="CcInfoRow" id="builtin">
-                                <property name="title" translatable="yes">Built-in Permissions</property>
-                                <property name="info" translatable="yes">Cannot be changed</property>
-                                <property name="has-expander">True</property>
-                                <property name="is-link">True</property>
-                              </object>
-                            </child>
+                          <object class="GtkLabel">
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Default Handlers</property>
                             <style>
-                              <class name="boxed-list"/>
+                              <class name="heading"/>
+                              <class name="h4"/>
                             </style>
                           </object>
                         </child>
                         <child>
                           <object class="GtkLabel">
+                            <property name="hexpand">True</property>
                             <property name="xalign">0</property>
                             <property name="wrap">1</property>
                             <property name="max-width-chars">50</property>
-                            <property name="label" translatable="yes">Individual permissions for 
applications can be reviewed in the &lt;a href=&quot;privacy&quot;&gt;Privacy&lt;/a&gt; Settings.</property>
-                            <property name="use-markup">1</property>
-                            <signal name="activate-link" handler="privacy_link_cb" 
object="CcApplicationsPanel" swapped="yes"/>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkBox" id="integration_section">
-                        <property name="orientation">vertical</property>
-                        <property name="spacing">12</property>
-                        <style>
-                          <class name="section"/>
-                        </style>
-                        <child>
-                          <object class="GtkBox">
-                            <property name="orientation">vertical</property>
-                            <property name="spacing">6</property>
-                            <child>
-                              <object class="GtkLabel">
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Integration</property>
-                                <style>
-                                  <class name="section-title"/>
-                                </style>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="GtkLabel">
-                                <property name="xalign">0</property>
-                                <property name="wrap">1</property>
-                                <property name="max-width-chars">50</property>
-                                <property name="label" translatable="yes">System features used by this 
application.</property>
-                                <style>
-                                  <class name="section-subtitle"/>
-                                </style>
-                              </object>
-                            </child>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="GtkListBox" id="integration_list">
-                            <property name="selection-mode">none</property>
+                            <property name="label" translatable="yes">Types of files and links that this 
application opens.</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"/>
+                              <class name="dim-label"/>
                             </style>
                           </object>
                         </child>
                       </object>
                     </child>
                     <child>
-                      <object class="GtkBox" id="handler_section">
-                        <property name="orientation">vertical</property>
-                        <property name="spacing">12</property>
-                        <style>
-                          <class name="section"/>
-                        </style>
-                        <child>
-                          <object class="GtkBox">
-                            <property name="spacing">6</property>
-                            <child>
-                              <object class="GtkBox">
-                                <property name="orientation">vertical</property>
-                                <property name="spacing">6</property>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">Default Handlers</property>
-                                    <style>
-                                      <class name="section-title"/>
-                                    </style>
-                                  </object>
-                                </child>
-                                <child>
-                                  <object class="GtkLabel">
-                                    <property name="hexpand">True</property>
-                                    <property name="xalign">0</property>
-                                    <property name="wrap">1</property>
-                                    <property name="max-width-chars">50</property>
-                                    <property name="label" translatable="yes">Types of files and links that 
this application opens.</property>
-                                    <style>
-                                      <class name="section-subtitle"/>
-                                    </style>
-                                  </object>
-                                </child>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="GtkButton" id="handler_reset">
-                                <property name="halign">end</property>
-                                <property name="valign">center</property>
-                                <property name="label" translatable="yes">Reset</property>
-                                <signal name="clicked" handler="handler_reset_cb" 
object="CcApplicationsPanel" swapped="yes"/>
-                              </object>
-                            </child>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="GtkListBox" id="handler_list">
-                            <property name="selection-mode">none</property>
-                            <signal name="row-activated" handler="handler_row_activated_cb" 
object="CcApplicationsPanel" swapped="yes"/>
-                            <style>
-                              <class name="boxed-list"/>
-                            </style>
-                          </object>
-                        </child>
+                      <object class="GtkButton" id="handler_reset">
+                        <property name="halign">end</property>
+                        <property name="valign">center</property>
+                        <property name="label" translatable="yes">Reset</property>
+                        <signal name="clicked" handler="handler_reset_cb" object="CcApplicationsPanel" 
swapped="yes"/>
                       </object>
                     </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkListBox" id="handler_list">
+                    <property name="selection-mode">none</property>
+                    <signal name="row-activated" handler="handler_row_activated_cb" 
object="CcApplicationsPanel" swapped="yes"/>
+                    <style>
+                      <class name="boxed-list"/>
+                    </style>
+                  </object>
+                </child>
+              </object>
+            </child>
+
+            <child>
+              <object class="AdwPreferencesGroup" id="usage_section">
+                <property name="title" translatable="yes">Usage</property>
+                <property name="description" translatable="yes">How much resources this application is 
using.</property>
+                <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="GtkBox" id="usage_section">
-                        <property name="orientation">vertical</property>
-                        <property name="spacing">12</property>
-                        <style>
-                          <class name="section"/>
-                        </style>
-                        <child>
-                          <object class="GtkBox">
-                            <property name="orientation">vertical</property>
-                            <property name="spacing">6</property>
-                            <child>
-                              <object class="GtkLabel">
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Usage</property>
-                                <style>
-                                  <class name="section-title"/>
-                                </style>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="GtkLabel">
-                                <property name="xalign">0</property>
-                                <property name="wrap">1</property>
-                                <property name="max-width-chars">50</property>
-                                <property name="label" translatable="yes">How much resources this 
application is using.</property>
-                                <style>
-                                  <class name="section-subtitle"/>
-                                </style>
-                              </object>
-                            </child>
-                          </object>
-                        </child>
-                        <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="storage">
-                                <property name="title" translatable="yes">Storage</property>
-                                <property name="info">unknown</property>
-                                <property name="has-expander">1</property>
-                                <property name="is-link">1</property>
-                              </object>
-                            </child>
-                            <style>
-                              <class name="boxed-list"/>
-                            </style>
-                          </object>
-                        </child>
+                      <object class="CcInfoRow" id="storage">
+                        <property name="title" translatable="yes">Storage</property>
+                        <property name="info">unknown</property>
+                        <property name="has-expander">1</property>
+                        <property name="is-link">1</property>
                       </object>
                     </child>
+                    <style>
+                      <class name="boxed-list"/>
+                    </style>
                   </object>
                 </child>
               </object>


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