[gnome-control-center/gbsneto/gtk4: 3/13] applications: Port to GTK4




commit 13253fa556965c00be715f295e13ee4961045ef7
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Oct 21 11:21:19 2021 -0300

    applications: Port to GTK4

 panels/applications/cc-action-row.ui         |  15 +---
 panels/applications/cc-applications-panel.c  |  79 +++++++----------
 panels/applications/cc-applications-panel.ui | 126 +++++++++------------------
 panels/applications/cc-applications-row.c    |   4 +-
 panels/applications/cc-applications-row.ui   |  10 +--
 panels/applications/cc-info-row.c            |   6 +-
 panels/applications/cc-info-row.ui           |  11 ++-
 panels/applications/cc-toggle-row.ui         |  10 +--
 panels/applications/utils.c                  |  10 +--
 panels/applications/utils.h                  |   2 +-
 panels/meson.build                           |   2 +-
 shell/cc-panel-loader.c                      |   4 +-
 12 files changed, 101 insertions(+), 178 deletions(-)
---
diff --git a/panels/applications/cc-action-row.ui b/panels/applications/cc-action-row.ui
index 6a7596479..8a10af310 100644
--- a/panels/applications/cc-action-row.ui
+++ b/panels/applications/cc-action-row.ui
@@ -1,33 +1,27 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <template class="CcActionRow" parent="GtkListBoxRow">
-    <property name="visible">True</property>
-    <property name="can-focus">True</property>
     <property name="activatable">False</property>
     <child>
       <object class="GtkBox">
-        <property name="visible">1</property>
-        <property name="border-width">12</property>
+        <property name="margin-top">12</property>
+        <property name="margin-bottom">12</property>
+        <property name="margin-start">12</property>
+        <property name="margin-end">12</property>
         <property name="spacing">12</property>
         <child>
           <object class="GtkBox">
-            <property name="visible">1</property>
             <property name="orientation">vertical</property>
             <property name="spacing">4</property>
             <child>
               <object class="GtkLabel" id="title">
-                <property name="visible">1</property>
                 <property name="xalign">0</property>
                 <property name="hexpand">1</property>
                 <property name="ellipsize">end</property>
               </object>
-              <packing>
-                <property name="expand">1</property>
-              </packing>
             </child>
             <child>
               <object class="GtkLabel" id="subtitle">
-                <property name="visible">1</property>
                 <property name="xalign">0</property>
                 <property name="hexpand">1</property>
                 <property name="ellipsize">end</property>
@@ -40,7 +34,6 @@
         </child>
         <child>
           <object class="GtkButton" id="button">
-            <property name="visible">1</property>
             <property name="valign">center</property>
             <signal name="clicked" handler="clicked_cb" swapped="yes"/>
           </object>
diff --git a/panels/applications/cc-applications-panel.c b/panels/applications/cc-applications-panel.c
index ab6ac68a2..74ffd834d 100644
--- a/panels/applications/cc-applications-panel.c
+++ b/panels/applications/cc-applications-panel.c
@@ -43,7 +43,6 @@
 #include "cc-snap-row.h"
 #endif
 #include "globs.h"
-#include "list-box-helper.h"
 #include "search.h"
 #include "utils.h"
 
@@ -782,7 +781,7 @@ add_static_permission_row (CcApplicationsPanel *self,
                       "title", title,
                       "info", subtitle,
                       NULL);
-  gtk_container_add (GTK_CONTAINER (self->builtin_list), row);
+  gtk_list_box_append (self->builtin_list, row);
 
   return 1;
 }
@@ -793,8 +792,10 @@ permission_row_activated_cb (CcApplicationsPanel *self,
 {
   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 (gtk_widget_get_toplevel (GTK_WIDGET (self))));
+                                    GTK_WINDOW (cc_shell_get_toplevel (shell)));
       gtk_window_present (GTK_WINDOW (self->builtin_dialog));
     }
 }
@@ -857,7 +858,7 @@ add_static_permissions (CcApplicationsPanel *self,
 static void
 remove_static_permissions (CcApplicationsPanel *self)
 {
-  container_remove_all (GTK_CONTAINER (self->builtin_list));
+  listbox_remove_all (self->builtin_list);
 }
 
 static void
@@ -1431,7 +1432,7 @@ update_handler_sections (CcApplicationsPanel *self,
   const gchar **types;
   gint i;
 
-  container_remove_all (GTK_CONTAINER (self->handler_list));
+  listbox_remove_all (self->handler_list);
 
   self->hypertext = NULL;
   self->text = NULL;
@@ -1479,8 +1480,10 @@ storage_row_activated_cb (CcApplicationsPanel *self,
 {
   if (list_row == GTK_LIST_BOX_ROW (self->storage))
     {
+      CcShell *shell = cc_panel_get_shell (CC_PANEL (self));
+
       gtk_window_set_transient_for (GTK_WINDOW (self->storage_dialog),
-                                    GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))));
+                                    GTK_WINDOW (cc_shell_get_toplevel (shell)));
       gtk_window_present (GTK_WINDOW (self->storage_dialog));
     }
 }
@@ -1687,7 +1690,7 @@ populate_applications (CcApplicationsPanel *self)
   g_autolist(GObject) infos = NULL;
   GList *l;
 
-  container_remove_all (GTK_CONTAINER (self->sidebar_listbox));
+  listbox_remove_all (self->sidebar_listbox);
 #ifdef HAVE_MALCONTENT
   g_signal_handler_block (self->manager, self->app_filter_id);
 #endif
@@ -1738,15 +1741,18 @@ filter_sidebar_rows (GtkListBoxRow *row,
   CcApplicationsPanel *self = CC_APPLICATIONS_PANEL (data);
   g_autofree gchar *app_name = NULL;
   g_autofree gchar *search_text = NULL;
+  const gchar *text;
   GAppInfo *info;
 
+  text = gtk_editable_get_text (GTK_EDITABLE (self->sidebar_search_entry));
+
   /* Only filter after the second character */
-  if (gtk_entry_get_text_length (self->sidebar_search_entry) < 2)
+  if (g_utf8_strlen (text, -1) < 2)
     return TRUE;
 
   info = cc_applications_row_get_info (CC_APPLICATIONS_ROW (row));
   app_name = cc_util_normalize_casefold_and_unaccent (g_app_info_get_name (info));
-  search_text = cc_util_normalize_casefold_and_unaccent (gtk_entry_get_text (self->sidebar_search_entry));
+  search_text = cc_util_normalize_casefold_and_unaccent (text);
 
   return g_strstr_len (app_name, -1, search_text) != NULL;
 }
@@ -1802,13 +1808,13 @@ static void
 select_app (CcApplicationsPanel *self,
             const gchar         *app_id)
 {
-  g_autoptr(GList) children = NULL;
-  GList *l;
+  GtkWidget *child;
 
-  children = gtk_container_get_children (GTK_CONTAINER (self->sidebar_listbox));
-  for (l = children; l; l = l->next)
+  for (child = gtk_widget_get_first_child (GTK_WIDGET (self->sidebar_listbox));
+       child;
+       child = gtk_widget_get_next_sibling (child))
     {
-      CcApplicationsRow *row = CC_APPLICATIONS_ROW (l->data);
+      CcApplicationsRow *row = CC_APPLICATIONS_ROW (child);
       GAppInfo *info = cc_applications_row_get_info (row);
       if (g_str_has_prefix (g_app_info_get_id (info), app_id))
         {
@@ -1834,7 +1840,7 @@ on_sidebar_search_entry_activated_cb (CcApplicationsPanel *self)
   g_signal_emit_by_name (row, "activate");
 
   /* Cleanup the entry */
-  gtk_entry_set_text (self->sidebar_search_entry, "");
+  gtk_editable_set_text (GTK_EDITABLE (self->sidebar_search_entry), "");
   gtk_widget_grab_focus (GTK_WIDGET (self->sidebar_search_entry));
 }
 
@@ -1847,7 +1853,7 @@ on_sidebar_search_entry_search_changed_cb (CcApplicationsPanel *self)
 static void
 on_sidebar_search_entry_search_stopped_cb (CcApplicationsPanel *self)
 {
-  gtk_entry_set_text (self->sidebar_search_entry, "");
+  gtk_editable_set_text (GTK_EDITABLE (self->sidebar_search_entry), "");
 }
 
 static void
@@ -1929,12 +1935,17 @@ static void
 cc_applications_panel_constructed (GObject *object)
 {
   CcApplicationsPanel *self = CC_APPLICATIONS_PANEL (object);
+  GtkListBoxRow *row;
   CcShell *shell;
 
   G_OBJECT_CLASS (cc_applications_panel_parent_class)->constructed (object);
 
   shell = cc_panel_get_shell (CC_PANEL (self));
   cc_shell_embed_widget_in_header (shell, GTK_WIDGET (self->header_button), GTK_POS_RIGHT);
+
+  /* Select the first row */
+  row = gtk_list_box_get_row_at_index (self->sidebar_listbox, 0);
+  gtk_list_box_select_row (self->sidebar_listbox, row);
 }
 
 static GtkWidget*
@@ -2040,7 +2051,6 @@ static void
 cc_applications_panel_init (CcApplicationsPanel *self)
 {
   g_autoptr(GtkStyleProvider) provider = NULL;
-  GtkListBoxRow *row;
 #ifdef HAVE_MALCONTENT
   g_autoptr(GDBusConnection) system_bus = NULL;
   g_autoptr(GError) error = NULL;
@@ -2059,39 +2069,15 @@ cc_applications_panel_init (CcApplicationsPanel *self)
   gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider),
                                        "/org/gnome/control-center/applications/cc-applications-panel.css");
 
-  gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
-                                             provider,
-                                             GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
+                                              provider,
+                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
 
   g_signal_connect_object (self->sidebar_listbox, "row-activated",
                            G_CALLBACK (row_activated_cb), self, G_CONNECT_SWAPPED);
 
   g_signal_connect_object (self->header_button, "clicked", G_CALLBACK (open_software_cb), self, 
G_CONNECT_SWAPPED);
 
-  gtk_list_box_set_header_func (self->permission_list,
-                                cc_list_box_update_header_func,
-                                NULL, NULL);
-
-  gtk_list_box_set_header_func (self->integration_list,
-                                cc_list_box_update_header_func,
-                                NULL, NULL);
-
-  gtk_list_box_set_header_func (self->handler_list,
-                                cc_list_box_update_header_func,
-                                NULL, NULL);
-
-  gtk_list_box_set_header_func (self->usage_list,
-                                cc_list_box_update_header_func,
-                                NULL, NULL);
-
-  gtk_list_box_set_header_func (self->builtin_list,
-                                cc_list_box_update_header_func,
-                                NULL, NULL);
-
-  gtk_list_box_set_header_func (self->storage_list,
-                                cc_list_box_update_header_func,
-                                NULL, NULL);
-
   gtk_list_box_set_sort_func (self->sidebar_listbox,
                               compare_rows,
                               NULL, NULL);
@@ -2145,9 +2131,4 @@ cc_applications_panel_init (CcApplicationsPanel *self)
 
   self->globs = parse_globs ();
   self->search_providers = parse_search_providers ();
-
-  /* Select the first row */
-  row = gtk_list_box_get_row_at_index (self->sidebar_listbox, 0);
-  gtk_list_box_select_row (self->sidebar_listbox, row);
-  g_signal_emit_by_name (row, "activate");
 }
diff --git a/panels/applications/cc-applications-panel.ui b/panels/applications/cc-applications-panel.ui
index 81b21151c..f8af188c8 100644
--- a/panels/applications/cc-applications-panel.ui
+++ b/panels/applications/cc-applications-panel.ui
@@ -1,30 +1,24 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <template class="CcApplicationsPanel" parent="CcPanel">
-    <property name="visible">True</property>
-    <property name="can-focus">False</property>
     <child>
       <object class="GtkScrolledWindow" id="main_scroll">
-        <property name="visible">1</property>
         <property name="hscrollbar-policy">never</property>
         <child>
-          <object class="HdyClamp">
-            <property name="visible">True</property>
+          <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>
             <child>
               <object class="GtkStack" id="stack">
-                <property name="visible">1</property>
+
                 <child>
                   <object class="GtkBox" id="empty_box">
-                    <property name="visible">1</property>
                     <property name="orientation">vertical</property>
                     <property name="valign">center</property>
                     <child>
                       <object class="GtkImage">
-                        <property name="visible">1</property>
                         <property name="valign">start</property>
                         <property name="pixel-size">80</property>
                         <property name="icon-name">org.gnome.Software-symbolic</property>
@@ -32,13 +26,9 @@
                           <class name="dim-label"/>
                         </style>
                       </object>
-                      <packing>
-                        <property name="fill">0</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkLabel">
-                        <property name="visible">1</property>
                         <property name="margin-bottom">15</property>
                         <property name="label" translatable="yes">No applications</property>
                         <style>
@@ -48,35 +38,24 @@
                           <attribute name="scale" value="1.2"/>
                         </attributes>
                       </object>
-                      <packing>
-                        <property name="position">1</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkButton" id="install_button">
                         <property name="label" translatable="yes">Install some…</property>
-                        <property name="visible">1</property>
-                        <property name="can-focus">1</property>
                         <property name="receives-default">1</property>
                         <property name="halign">center</property>
                         <signal name="clicked" handler="open_software_cb" object="CcApplicationsPanel" 
swapped="yes"/>
                       </object>
-                      <packing>
-                        <property name="fill">0</property>
-                        <property name="position">2</property>
-                      </packing>
                     </child>
                   </object>
                 </child>
                 <child>
                   <object class="GtkBox" id="settings_box">
-                    <property name="visible">1</property>
                     <property name="orientation">vertical</property>
                     <property name="spacing">24</property>
                     <property name="hexpand">1</property>
                     <child>
                       <object class="GtkBox" id="permission_section">
-                        <property name="visible">1</property>
                         <property name="orientation">vertical</property>
                         <property name="spacing">12</property>
                         <style>
@@ -84,12 +63,10 @@
                         </style>
                         <child>
                           <object class="GtkBox">
-                            <property name="visible">1</property>
                             <property name="orientation">vertical</property>
                             <property name="spacing">6</property>
                             <child>
                               <object class="GtkLabel">
-                                <property name="visible">1</property>
                                 <property name="xalign">0</property>
                                 <property name="label" translatable="yes">Permissions &amp; Access</property>
                                 <style>
@@ -99,7 +76,6 @@
                             </child>
                             <child>
                               <object class="GtkLabel">
-                                <property name="visible">1</property>
                                 <property name="xalign">0</property>
                                 <property name="wrap">1</property>
                                 <property name="max-width-chars">50</property>
@@ -113,9 +89,11 @@
                         </child>
                         <child>
                           <object class="GtkListBox" id="permission_list">
-                            <property name="visible">1</property>
                             <property name="selection-mode">none</property>
                             <signal name="row-activated" handler="permission_row_activated_cb" 
object="CcApplicationsPanel" swapped="yes"/>
+                            <style>
+                              <class name="content"/>
+                            </style>
                             <child>
                               <object class="CcToggleRow" id="camera">
                                 <property name="title" translatable="yes">Camera</property>
@@ -168,7 +146,6 @@
                         </child>
                         <child>
                           <object class="GtkLabel">
-                            <property name="visible">1</property>
                             <property name="xalign">0</property>
                             <property name="wrap">1</property>
                             <property name="max-width-chars">50</property>
@@ -181,7 +158,6 @@
                     </child>
                     <child>
                       <object class="GtkBox" id="integration_section">
-                        <property name="visible">1</property>
                         <property name="orientation">vertical</property>
                         <property name="spacing">12</property>
                         <style>
@@ -189,12 +165,10 @@
                         </style>
                         <child>
                           <object class="GtkBox">
-                            <property name="visible">1</property>
                             <property name="orientation">vertical</property>
                             <property name="spacing">6</property>
                             <child>
                               <object class="GtkLabel">
-                                <property name="visible">1</property>
                                 <property name="xalign">0</property>
                                 <property name="label" translatable="yes">Integration</property>
                                 <style>
@@ -204,7 +178,6 @@
                             </child>
                             <child>
                               <object class="GtkLabel">
-                                <property name="visible">1</property>
                                 <property name="xalign">0</property>
                                 <property name="wrap">1</property>
                                 <property name="max-width-chars">50</property>
@@ -218,8 +191,10 @@
                         </child>
                         <child>
                           <object class="GtkListBox" id="integration_list">
-                            <property name="visible">1</property>
                             <property name="selection-mode">none</property>
+                            <style>
+                              <class name="content"/>
+                            </style>
                             <child>
                               <object class="CcToggleRow" id="search">
                                 <property name="title" translatable="yes">Search</property>
@@ -278,7 +253,6 @@
                     </child>
                     <child>
                       <object class="GtkBox" id="handler_section">
-                        <property name="visible">1</property>
                         <property name="orientation">vertical</property>
                         <property name="spacing">12</property>
                         <style>
@@ -286,16 +260,13 @@
                         </style>
                         <child>
                           <object class="GtkBox">
-                            <property name="visible">1</property>
                             <property name="spacing">6</property>
                             <child>
                               <object class="GtkBox">
-                                <property name="visible">1</property>
                                 <property name="orientation">vertical</property>
                                 <property name="spacing">6</property>
                                 <child>
                                   <object class="GtkLabel">
-                                    <property name="visible">1</property>
                                     <property name="xalign">0</property>
                                     <property name="label" translatable="yes">Default Handlers</property>
                                     <style>
@@ -305,7 +276,7 @@
                                 </child>
                                 <child>
                                   <object class="GtkLabel">
-                                    <property name="visible">1</property>
+                                    <property name="hexpand">True</property>
                                     <property name="xalign">0</property>
                                     <property name="wrap">1</property>
                                     <property name="max-width-chars">50</property>
@@ -316,13 +287,9 @@
                                   </object>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="expand">1</property>
-                              </packing>
                             </child>
                             <child>
                               <object class="GtkButton" id="handler_reset">
-                                <property name="visible">1</property>
                                 <property name="halign">end</property>
                                 <property name="valign">center</property>
                                 <property name="label" translatable="yes">Reset</property>
@@ -333,12 +300,10 @@
                         </child>
                         <child>
                           <object class="GtkListBox" id="handler_list">
-                            <property name="visible">1</property>
                             <property name="selection-mode">none</property>
                             <signal name="row-activated" handler="handler_row_activated_cb" 
object="CcApplicationsPanel" swapped="yes"/>
                             <style>
-                              <class name="view"/>
-                              <class name="frame"/>
+                              <class name="content"/>
                             </style>
                           </object>
                         </child>
@@ -346,7 +311,6 @@
                     </child>
                     <child>
                       <object class="GtkBox" id="usage_section">
-                        <property name="visible">1</property>
                         <property name="orientation">vertical</property>
                         <property name="spacing">12</property>
                         <style>
@@ -354,12 +318,10 @@
                         </style>
                         <child>
                           <object class="GtkBox">
-                            <property name="visible">1</property>
                             <property name="orientation">vertical</property>
                             <property name="spacing">6</property>
                             <child>
                               <object class="GtkLabel">
-                                <property name="visible">1</property>
                                 <property name="xalign">0</property>
                                 <property name="label" translatable="yes">Usage</property>
                                 <style>
@@ -369,7 +331,6 @@
                             </child>
                             <child>
                               <object class="GtkLabel">
-                                <property name="visible">1</property>
                                 <property name="xalign">0</property>
                                 <property name="wrap">1</property>
                                 <property name="max-width-chars">50</property>
@@ -383,9 +344,11 @@
                         </child>
                         <child>
                           <object class="GtkListBox" id="usage_list">
-                            <property name="visible">1</property>
                             <property name="selection-mode">none</property>
                             <signal name="row-activated" handler="storage_row_activated_cb" 
object="CcApplicationsPanel" swapped="yes"/>
+                            <style>
+                              <class name="content"/>
+                            </style>
                             <child>
                               <object class="CcInfoRow" id="storage">
                                 <property name="title" translatable="yes">Storage</property>
@@ -412,7 +375,6 @@
     </child>
   </template>
   <object class="GtkLabel" id="title_label">
-    <property name="visible">1</property>
     <property name="label" translatable="yes">Applications</property>
     <property name="ellipsize">end</property>
     <style>
@@ -420,21 +382,18 @@
     </style>
   </object>
   <object class="GtkButton" id="header_button">
-    <property name="visible">1</property>
     <property name="label" translatable="yes">Open in Software</property>
   </object>
 
   <!-- Sidebar -->
   <object class="GtkBox" id="sidebar_box">
-    <property name="visible">True</property>
     <property name="orientation">vertical</property>
     <child>
       <object class="GtkSearchEntry" id="sidebar_search_entry">
-        <property name="visible">True</property>
-        <property name="can-focus">True</property>
-        <property name="has-focus">True</property>
-        <property name="margin">12</property>
+        <property name="margin-top">12</property>
         <property name="margin-bottom">6</property>
+        <property name="margin-start">12</property>
+        <property name="margin-end">12</property>
         <signal name="activate" handler="on_sidebar_search_entry_activated_cb" object="CcApplicationsPanel" 
swapped="yes" />
         <signal name="search-changed" handler="on_sidebar_search_entry_search_changed_cb" 
object="CcApplicationsPanel" swapped="yes" />
         <signal name="stop-search" handler="on_sidebar_search_entry_search_stopped_cb" 
object="CcApplicationsPanel" swapped="yes" />
@@ -442,23 +401,27 @@
     </child>
     <child>
       <object class="GtkListBox" id="sidebar_listbox">
-        <property name="visible">True</property>
         <property name="vexpand">True</property>
         <property name="selection-mode">browse</property>
+        <style>
+          <class name="navigation-sidebar" />
+        </style>
 
         <child type="placeholder">
           <object class="GtkBox" id="empty_search_placeholder">
-            <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="halign">center</property>
             <property name="valign">center</property>
-            <property name="expand">True</property>
-            <property name="border_width">18</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="margin-top">18</property>
+            <property name="margin-bottom">18</property>
+            <property name="margin-start">18</property>
+            <property name="margin-end">18</property>
             <property name="orientation">vertical</property>
             <property name="spacing">6</property>
             <child>
               <object class="GtkImage">
-                <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="pixel_size">64</property>
                 <property name="icon_name">edit-find-symbolic</property>
@@ -469,7 +432,6 @@
             </child>
             <child>
               <object class="GtkLabel">
-                <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label" translatable="yes">No results found</property>
                 <attributes>
@@ -480,7 +442,6 @@
             </child>
             <child>
               <object class="GtkLabel">
-                <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label" translatable="yes">Try a different search</property>
                 <style>
@@ -499,19 +460,19 @@
   <object class="GtkDialog" id="builtin_dialog">
     <property name="title" translatable="yes">Built-in Permissions</property>
     <property name="modal">1</property>
-    <property name="type-hint">dialog</property>
     <property name="use-header-bar">1</property>
     <property name="resizable">0</property>
-    <property name="border-width">24</property>
-    <signal name="delete-event" handler="gtk_widget_hide_on_delete"/>
-    <child internal-child="vbox">
+    <property name="hide-on-close">True</property>
+    <child>
       <object class="GtkBox">
-        <property name="visible">1</property>
+        <property name="margin-top">24</property>
+        <property name="margin-bottom">24</property>
+        <property name="margin-start">24</property>
+        <property name="margin-end">24</property>
         <property name="orientation">vertical</property>
         <property name="spacing">12</property>
         <child>
           <object class="GtkLabel" id="builtin_label">
-            <property name="visible">1</property>
             <property name="xalign">0</property>
             <property name="wrap">1</property>
             <property name="max-width-chars">50</property>
@@ -520,11 +481,9 @@
         </child>
         <child>
           <object class="GtkListBox" id="builtin_list">
-            <property name="visible">1</property>
             <property name="selection-mode">none</property>
             <style>
-              <class name="view"/>
-              <class name="frame"/>
+              <class name="content"/>
             </style>
           </object>
         </child>
@@ -536,19 +495,19 @@
   <object class="GtkDialog" id="storage_dialog">
     <property name="title" translatable="yes">Storage</property>
     <property name="modal">1</property>
-    <property name="type-hint">dialog</property>
     <property name="use-header-bar">1</property>
     <property name="resizable">0</property>
-    <property name="border-width">24</property>
-    <signal name="delete-event" handler="gtk_widget_hide_on_delete"/>
-    <child internal-child="vbox">
+    <property name="hide-on-close">True</property>
+    <child>
       <object class="GtkBox">
-        <property name="visible">1</property>
+        <property name="margin-top">24</property>
+        <property name="margin-bottom">24</property>
+        <property name="margin-start">24</property>
+        <property name="margin-end">24</property>
         <property name="orientation">vertical</property>
         <property name="spacing">12</property>
         <child>
           <object class="GtkLabel">
-            <property name="visible">1</property>
             <property name="xalign">0</property>
             <property name="wrap">1</property>
             <property name="max-width-chars">50</property>
@@ -557,8 +516,10 @@
         </child>
         <child>
           <object class="GtkListBox" id="storage_list">
-            <property name="visible">1</property>
             <property name="selection-mode">none</property>
+            <style>
+              <class name="content"/>
+            </style>
             <child>
               <object class="CcInfoRow" id="app">
                 <property name="title" translatable="yes">Application</property>
@@ -592,16 +553,11 @@
         </child>
         <child>
           <object class="GtkBox">
-            <property name="visible">1</property>
             <child>
               <object class="GtkButton" id="clear_cache_button">
-                <property name="visible">1</property>
                 <property name="label" translatable="yes">Clear Cache…</property>
                 <signal name="clicked" handler="clear_cache_cb" object="CcApplicationsPanel" swapped="yes"/>
               </object>
-              <packing>
-                <property name="pack-type">end</property>
-              </packing>
             </child>
           </object>
         </child>
diff --git a/panels/applications/cc-applications-row.c b/panels/applications/cc-applications-row.c
index 08516ac62..db1d4b557 100644
--- a/panels/applications/cc-applications-row.c
+++ b/panels/applications/cc-applications-row.c
@@ -86,9 +86,9 @@ cc_applications_row_new (GAppInfo *info)
 
   icon = g_app_info_get_icon (info);
   if (icon != NULL)
-    gtk_image_set_from_gicon (GTK_IMAGE (self->image), g_app_info_get_icon (info), GTK_ICON_SIZE_BUTTON);
+    gtk_image_set_from_gicon (GTK_IMAGE (self->image), g_app_info_get_icon (info));
   else
-    gtk_image_set_from_icon_name (GTK_IMAGE (self->image), "application-x-executable", GTK_ICON_SIZE_BUTTON);
+    gtk_image_set_from_icon_name (GTK_IMAGE (self->image), "application-x-executable");
 
   gtk_label_set_label (GTK_LABEL (self->label), g_app_info_get_display_name (info));
 
diff --git a/panels/applications/cc-applications-row.ui b/panels/applications/cc-applications-row.ui
index 819e48a44..5894dd8dd 100644
--- a/panels/applications/cc-applications-row.ui
+++ b/panels/applications/cc-applications-row.ui
@@ -1,16 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <template class="CcApplicationsRow" parent="GtkListBoxRow">
-    <property name="visible">True</property>
-    <property name="can-focus">True</property>
     <child>
       <object class="GtkBox" id="box">
-        <property name="visible">1</property>
-        <property name="border-width">6</property>
+        <property name="margin-top">6</property>
+        <property name="margin-bottom">6</property>
+        <property name="margin-start">6</property>
+        <property name="margin-end">6</property>
         <property name="spacing">12</property>
         <child>
           <object class="GtkImage" id="image">
-            <property name="visible">1</property>
             <property name="pixel-size">32</property>
             <style>
               <class name="sidebar-icon"/>
@@ -21,7 +20,6 @@
         </child>
         <child>
           <object class="GtkLabel" id="label">
-            <property name="visible">1</property>
             <property name="xalign">0</property>
             <property name="ellipsize">end</property>
           </object>
diff --git a/panels/applications/cc-info-row.c b/panels/applications/cc-info-row.c
index 3a8d88a76..e86b82e01 100644
--- a/panels/applications/cc-info-row.c
+++ b/panels/applications/cc-info-row.c
@@ -87,11 +87,11 @@ static void
 update_expander (CcInfoRow *row)
 {
   if (row->link)
-    gtk_image_set_from_icon_name (GTK_IMAGE (row->expander), "go-next-symbolic", GTK_ICON_SIZE_BUTTON);
+    gtk_image_set_from_icon_name (GTK_IMAGE (row->expander), "go-next-symbolic");
   else if (row->expanded)
-    gtk_image_set_from_icon_name (GTK_IMAGE (row->expander), "pan-down-symbolic", GTK_ICON_SIZE_BUTTON);
+    gtk_image_set_from_icon_name (GTK_IMAGE (row->expander), "pan-down-symbolic");
   else
-    gtk_image_set_from_icon_name (GTK_IMAGE (row->expander), "pan-end-symbolic", GTK_ICON_SIZE_BUTTON);
+    gtk_image_set_from_icon_name (GTK_IMAGE (row->expander), "pan-end-symbolic");
 }
 
 static void
diff --git a/panels/applications/cc-info-row.ui b/panels/applications/cc-info-row.ui
index dcc7a42cd..341bcb3a7 100644
--- a/panels/applications/cc-info-row.ui
+++ b/panels/applications/cc-info-row.ui
@@ -1,17 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <template class="CcInfoRow" parent="GtkListBoxRow">
-    <property name="visible">True</property>
-    <property name="can-focus">True</property>
     <property name="activatable">False</property>
     <child>
       <object class="GtkBox">
-        <property name="visible">1</property>
-        <property name="border-width">12</property>
+        <property name="margin-top">12</property>
+        <property name="margin-bottom">12</property>
+        <property name="margin-start">12</property>
+        <property name="margin-end">12</property>
         <property name="spacing">12</property>
         <child>
           <object class="GtkLabel" id="title">
-            <property name="visible">1</property>
             <property name="xalign">0</property>
             <property name="hexpand">1</property>
             <property name="ellipsize">end</property>
@@ -19,7 +18,6 @@
         </child>
         <child>
           <object class="GtkLabel" id="info">
-            <property name="visible">1</property>
             <property name="valign">center</property>
             <style>
               <class name="dim-label"/>
@@ -28,6 +26,7 @@
         </child>
         <child>
           <object class="GtkImage" id="expander">
+            <property name="visible">False</property>
             <property name="valign">center</property>
             <property name="icon-name">pan-end-symbolic</property>
             <style>
diff --git a/panels/applications/cc-toggle-row.ui b/panels/applications/cc-toggle-row.ui
index 8dea8f0da..9844b279b 100644
--- a/panels/applications/cc-toggle-row.ui
+++ b/panels/applications/cc-toggle-row.ui
@@ -1,17 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <template class="CcToggleRow" parent="GtkListBoxRow">
-    <property name="visible">True</property>
-    <property name="can-focus">True</property>
     <property name="activatable">False</property>
     <child>
       <object class="GtkBox">
-        <property name="visible">1</property>
-        <property name="border-width">12</property>
+        <property name="margin-top">12</property>
+        <property name="margin-bottom">12</property>
+        <property name="margin-start">12</property>
+        <property name="margin-end">12</property>
         <property name="spacing">12</property>
         <child>
           <object class="GtkLabel" id="title">
-            <property name="visible">1</property>
             <property name="xalign">0</property>
             <property name="hexpand">1</property>
             <property name="ellipsize">end</property>
@@ -19,7 +18,6 @@
         </child>
         <child>
           <object class="GtkSwitch" id="toggle">
-            <property name="visible">1</property>
             <property name="valign">center</property>
             <signal name="notify::active" handler="changed_cb" swapped="yes"/>
           </object>
diff --git a/panels/applications/utils.c b/panels/applications/utils.c
index 96704a4c0..bbf88d4b3 100644
--- a/panels/applications/utils.c
+++ b/panels/applications/utils.c
@@ -143,14 +143,12 @@ file_size_finish (GFile        *file,
 }
 
 void
-container_remove_all (GtkContainer *container)
+listbox_remove_all (GtkListBox *listbox)
 {
-  g_autoptr(GList) children = NULL;
-  GList *l;
+  GtkWidget *child;
 
-  children = gtk_container_get_children (container);
-  for (l = children; l; l = l->next)
-    gtk_widget_destroy (GTK_WIDGET (l->data));
+  while ((child = gtk_widget_get_first_child (GTK_WIDGET (listbox))))
+    gtk_list_box_remove (listbox, child);
 }
 
 static gchar *
diff --git a/panels/applications/utils.h b/panels/applications/utils.h
index 5f899d781..c3b30f74a 100644
--- a/panels/applications/utils.h
+++ b/panels/applications/utils.h
@@ -44,7 +44,7 @@ gboolean  file_size_finish     (GFile               *file,
                                 guint64             *size,
                                 GError             **error);
 
-void      container_remove_all (GtkContainer        *container);
+void      listbox_remove_all   (GtkListBox          *listbox);
 
 GKeyFile* get_flatpak_metadata (const gchar         *app_id);
 
diff --git a/panels/meson.build b/panels/meson.build
index 2108bd918..d480f2a06 100644
--- a/panels/meson.build
+++ b/panels/meson.build
@@ -1,7 +1,7 @@
 subdir('common')
 
 panels = [
-#  'applications',
+  'applications',
 #  'background',
   'camera',
 #  'color',
diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
index 1c8ea3d5d..bd0bbb960 100644
--- a/shell/cc-panel-loader.c
+++ b/shell/cc-panel-loader.c
@@ -31,7 +31,7 @@
 #ifndef CC_PANEL_LOADER_NO_GTYPES
 
 /* Extension points */
-//extern GType cc_applications_panel_get_type (void);
+extern GType cc_applications_panel_get_type (void);
 //extern GType cc_background_panel_get_type (void);
 #ifdef BUILD_BLUETOOTH
 //extern GType cc_bluetooth_panel_get_type (void);
@@ -97,7 +97,7 @@ extern GType cc_lock_panel_get_type (void);
 
 static CcPanelLoaderVtable default_panels[] =
 {
-  //PANEL_TYPE("applications",     cc_applications_panel_get_type,         NULL),
+  PANEL_TYPE("applications",     cc_applications_panel_get_type,         NULL),
   //PANEL_TYPE("background",       cc_background_panel_get_type,           NULL),
 #ifdef BUILD_BLUETOOTH
   //PANEL_TYPE("bluetooth",        cc_bluetooth_panel_get_type,            NULL),


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