[gnome-control-center/gbsneto/applications-panel-cleanups: 1/16] applications: Use AdwStatusPage for the empty page




commit f7d6c102c9f8c27dd18dc0284fc82ed21d9c25b9
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Jan 20 12:18:26 2022 -0300

    applications: Use AdwStatusPage for the empty page
    
    Make it streamlined with other panels

 panels/applications/cc-applications-panel.c  |  8 ++--
 panels/applications/cc-applications-panel.ui | 72 +++++++++++-----------------
 2 files changed, 31 insertions(+), 49 deletions(-)
---
diff --git a/panels/applications/cc-applications-panel.c b/panels/applications/cc-applications-panel.c
index 3fe73f0bf..5e14df953 100644
--- a/panels/applications/cc-applications-panel.c
+++ b/panels/applications/cc-applications-panel.c
@@ -84,8 +84,8 @@ struct _CcApplicationsPanel
   GSettings       *search_settings;
 
   GtkStack        *stack;
-  GtkBox          *empty_box;
-  GtkBox          *settings_box;
+  GtkWidget       *empty_box;
+  GtkWidget       *settings_box;
   GtkButton       *install_button;
 
   GtkBox          *permission_section;
@@ -1661,7 +1661,7 @@ update_panel (CcApplicationsPanel *self,
   if (row == NULL)
     {
       adw_window_title_set_title (self->header_title, _("Applications"));
-      gtk_stack_set_visible_child (self->stack, GTK_WIDGET (self->empty_box));
+      gtk_stack_set_visible_child (self->stack, self->empty_box);
       gtk_widget_hide (GTK_WIDGET (GTK_WIDGET (self->header_button)));
       return;
     }
@@ -1669,7 +1669,7 @@ update_panel (CcApplicationsPanel *self,
   info = cc_applications_row_get_info (CC_APPLICATIONS_ROW (row));
 
   adw_window_title_set_title (self->header_title, g_app_info_get_display_name (info));
-  gtk_stack_set_visible_child (self->stack, GTK_WIDGET (self->settings_box));
+  gtk_stack_set_visible_child (self->stack, self->settings_box);
   gtk_widget_set_visible (GTK_WIDGET (self->header_button), gnome_software_is_installed ());
 
   g_clear_pointer (&self->current_app_id, g_free);
diff --git a/panels/applications/cc-applications-panel.ui b/panels/applications/cc-applications-panel.ui
index 6e4530386..c9c4606cf 100644
--- a/panels/applications/cc-applications-panel.ui
+++ b/panels/applications/cc-applications-panel.ui
@@ -28,55 +28,37 @@
     </child>
 
     <child type="content">
-      <object class="GtkScrolledWindow" id="main_scroll">
-        <property name="hscrollbar-policy">never</property>
+      <object class="GtkStack" id="stack">
+
         <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="AdwStatusPage" id="empty_box">
+            <property name="icon-name">org.gnome.Software-symbolic</property>
+            <property name="title" translatable="yes">No applications</property>
             <child>
-              <object class="GtkStack" id="stack">
+              <object class="GtkButton" id="install_button">
+                <property name="label" translatable="yes">Install some…</property>
+                <property name="halign">center</property>
+                <signal name="clicked" handler="open_software_cb" object="CcApplicationsPanel" 
swapped="yes"/>
+                <style>
+                  <class name="pill" />
+                </style>
+              </object>
+            </child>
+          </object>
+        </child>
+
+        <child>
+          <object class="GtkScrolledWindow" id="settings_box">
+            <property name="hscrollbar-policy">never</property>
+            <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>
 
                 <child>
-                  <object class="GtkBox" id="empty_box">
-                    <property name="orientation">vertical</property>
-                    <property name="valign">center</property>
-                    <child>
-                      <object class="GtkImage">
-                        <property name="valign">start</property>
-                        <property name="pixel-size">80</property>
-                        <property name="icon-name">org.gnome.Software-symbolic</property>
-                        <style>
-                          <class name="dim-label"/>
-                        </style>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkLabel">
-                        <property name="margin-bottom">15</property>
-                        <property name="label" translatable="yes">No applications</property>
-                        <style>
-                          <class name="dim-label"/>
-                        </style>
-                        <attributes>
-                          <attribute name="scale" value="1.2"/>
-                        </attributes>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkButton" id="install_button">
-                        <property name="label" translatable="yes">Install some…</property>
-                        <property name="receives-default">1</property>
-                        <property name="halign">center</property>
-                        <signal name="clicked" handler="open_software_cb" object="CcApplicationsPanel" 
swapped="yes"/>
-                      </object>
-                    </child>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkBox" id="settings_box">
+                  <object class="GtkBox">
                     <property name="orientation">vertical</property>
                     <property name="spacing">24</property>
                     <property name="hexpand">1</property>


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