[nautilus/wip/cdavis/use-status-page: 2/5] resources: Use AdwStatusPage for empty views



commit e7eb2c206779a9fda4449513acffb87748da7c4a
Author: Christopher Davis <christopherdavis gnome org>
Date:   Sat Jul 16 16:18:26 2022 -0400

    resources: Use AdwStatusPage for empty views
    
    libadwaita provides a widget for status/empty pages. Instead
    of rolling our own lookalike, we can now use the original
    since we have a GtkStack instead of a GtkOverlay managing
    views.

 src/resources/ui/nautilus-folder-is-empty.ui   | 35 ++----------------
 src/resources/ui/nautilus-no-search-results.ui | 51 ++------------------------
 src/resources/ui/nautilus-starred-is-empty.ui  | 35 ++----------------
 src/resources/ui/nautilus-trash-is-empty.ui    | 35 ++----------------
 4 files changed, 13 insertions(+), 143 deletions(-)
---
diff --git a/src/resources/ui/nautilus-folder-is-empty.ui b/src/resources/ui/nautilus-folder-is-empty.ui
index e1c0ff78c..8ace4ea92 100644
--- a/src/resources/ui/nautilus-folder-is-empty.ui
+++ b/src/resources/ui/nautilus-folder-is-empty.ui
@@ -1,37 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk" version="4.0"/>
-  <object class="GtkGrid" id="folder_is_empty">
-    <property name="halign">center</property>
-    <property name="valign">center</property>
-    <property name="hexpand">True</property>
-    <property name="vexpand">True</property>
-    <property name="row_spacing">36</property>
-    <child>
-      <object class="GtkImage">
-        <property name="pixel_size">128</property>
-        <property name="icon_name">folder-symbolic</property>
-        <style>
-          <class name="dim-label"/>
-          <class name="nautilus-empty-state-icon"/>
-        </style>
-        <layout>
-          <property name="column">0</property>
-          <property name="row">0</property>
-        </layout>
-      </object>
-    </child>
-    <child>
-      <object class="GtkLabel">
-        <property name="label" translatable="yes">Folder is Empty</property>
-        <style>
-          <class name="large-title"/>
-        </style>
-        <layout>
-          <property name="column">0</property>
-          <property name="row">1</property>
-        </layout>
-      </object>
-    </child>
+  <object class="AdwStatusPage" id="folder_is_empty">
+    <property name="icon_name">folder-symbolic</property>
+    <property name="title" translatable="yes">Folder is Empty</property>
   </object>
 </interface>
diff --git a/src/resources/ui/nautilus-no-search-results.ui b/src/resources/ui/nautilus-no-search-results.ui
index c747af346..04a767d6f 100644
--- a/src/resources/ui/nautilus-no-search-results.ui
+++ b/src/resources/ui/nautilus-no-search-results.ui
@@ -1,52 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk" version="4.0"/>
-  <object class="GtkGrid" id="no_search_results">
-    <property name="halign">center</property>
-    <property name="valign">center</property>
-    <property name="hexpand">True</property>
-    <property name="vexpand">True</property>
-    <property name="row_spacing">12</property>
-    <child>
-      <object class="GtkImage">
-        <property name="pixel_size">80</property>
-        <property name="icon_name">edit-find-symbolic</property>
-        <style>
-          <class name="dim-label"/>
-        </style>
-        <layout>
-          <property name="column">0</property>
-          <property name="row">0</property>
-        </layout>
-      </object>
-    </child>
-    <child>
-      <object class="GtkLabel">
-        <property name="label" translatable="yes">No Results Found</property>
-        <attributes>
-          <attribute name="weight" value="bold"></attribute>
-          <attribute name="scale" value="1.44"></attribute>
-        </attributes>
-        <layout>
-          <property name="column">0</property>
-          <property name="row">1</property>
-        </layout>
-      </object>
-    </child>
-    <child>
-      <object class="GtkLabel">
-        <property name="label" translatable="yes">Try a different search</property>
-        <style>
-          <class name="dim-label"/>
-        </style>
-        <layout>
-          <property name="column">0</property>
-          <property name="row">2</property>
-        </layout>
-      </object>
-    </child>
-    <style>
-      <class name="dim-label"/>
-    </style>
+  <object class="AdwStatusPage" id="no_search_results">
+    <property name="icon_name">edit-find-symbolic</property>
+    <property name="title" translatable="yes">No Results Found</property>
+    <property name="description" translatable="yes">Try a different search</property>
   </object>
 </interface>
diff --git a/src/resources/ui/nautilus-starred-is-empty.ui b/src/resources/ui/nautilus-starred-is-empty.ui
index 6661e5586..6f90359dc 100644
--- a/src/resources/ui/nautilus-starred-is-empty.ui
+++ b/src/resources/ui/nautilus-starred-is-empty.ui
@@ -1,37 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk" version="4.0"/>
-  <object class="GtkGrid" id="starred_is_empty">
-    <property name="halign">center</property>
-    <property name="valign">center</property>
-    <property name="hexpand">True</property>
-    <property name="vexpand">True</property>
-    <property name="row_spacing">36</property>
-    <child>
-      <object class="GtkImage">
-        <property name="pixel_size">128</property>
-        <property name="icon_name">starred-symbolic</property>
-        <style>
-          <class name="dim-label"/>
-          <class name="nautilus-empty-state-icon"/>
-        </style>
-        <layout>
-          <property name="column">0</property>
-          <property name="row">0</property>
-        </layout>
-      </object>
-    </child>
-    <child>
-      <object class="GtkLabel">
-        <property name="label" translatable="yes">Starred files will appear here</property>
-        <style>
-          <class name="large-title"/>
-        </style>
-        <layout>
-          <property name="column">0</property>
-          <property name="row">1</property>
-        </layout>
-      </object>
-    </child>
+  <object class="AdwStatusPage" id="starred_is_empty">
+    <property name="icon_name">starred-symbolic</property>
+    <property name="title" translatable="yes">Starred files will appear here</property>
   </object>
 </interface>
diff --git a/src/resources/ui/nautilus-trash-is-empty.ui b/src/resources/ui/nautilus-trash-is-empty.ui
index 4dea5da69..6df2fd566 100644
--- a/src/resources/ui/nautilus-trash-is-empty.ui
+++ b/src/resources/ui/nautilus-trash-is-empty.ui
@@ -1,37 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk" version="4.0"/>
-  <object class="GtkGrid" id="trash_is_empty">
-    <property name="halign">center</property>
-    <property name="valign">center</property>
-    <property name="hexpand">True</property>
-    <property name="vexpand">True</property>
-    <property name="row_spacing">36</property>
-    <child>
-      <object class="GtkImage">
-        <property name="pixel_size">128</property>
-        <property name="icon_name">user-trash-symbolic</property>
-        <style>
-          <class name="dim-label"/>
-          <class name="nautilus-empty-state-icon"/>
-        </style>
-        <layout>
-          <property name="column">0</property>
-          <property name="row">0</property>
-        </layout>
-      </object>
-    </child>
-    <child>
-      <object class="GtkLabel">
-        <property name="label" translatable="yes">Trash is Empty</property>
-        <style>
-          <class name="large-title"/>
-        </style>
-        <layout>
-          <property name="column">0</property>
-          <property name="row">1</property>
-        </layout>
-      </object>
-    </child>
+  <object class="AdwStatusPage" id="trash_is_empty">
+    <property name="icon_name">user-trash-symbolic</property>
+    <property name="title" translatable="yes">Trash is Empty</property>
   </object>
 </interface>


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