[gnome-sound-recorder/wip/cdavis/gtk4] window: Use AdwStatusPage



commit 7fdb35a89686897de9b703a1b0af8918d8ba04e1
Author: Christopher Davis <christopherdavis gnome org>
Date:   Tue Sep 21 04:23:36 2021 -0700

    window: Use AdwStatusPage
    
    In libadwaita we have a standardized widget for empty pages
    that we can and should use. This commit transitions us to
    using said widget.

 data/ui/window.ui | 40 +++-------------------------------------
 src/window.js     |  4 ++--
 2 files changed, 5 insertions(+), 39 deletions(-)
---
diff --git a/data/ui/window.ui b/data/ui/window.ui
index 07a367e..3c5cbbd 100644
--- a/data/ui/window.ui
+++ b/data/ui/window.ui
@@ -73,43 +73,9 @@
                   <object class="GtkStackPage">
                     <property name="name">empty</property>
                     <property name="child">
-                      <object class="GtkBox">
-                        <property name="halign">center</property>
-                        <property name="valign">center</property>
-                        <property name="orientation">vertical</property>
-                        <child>
-                          <object class="GtkImage" id="emptyIcon">
-                            <property name="halign">center</property>
-                            <property name="valign">center</property>
-                            <property name="pixel_size">96</property>
-                            <style>
-                              <class name="dim-label"/>
-                            </style>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="GtkLabel">
-                            <property name="margin_top">8</property>
-                            <property name="label" translatable="yes">Add Recordings</property>
-                            <style>
-                              <class name="dim-label"/>
-                              <class name="title-1"/>
-                            </style>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="GtkLabel">
-                            <property name="margin_top">4</property>
-                            <property name="label" translatable="yes">Use the &lt;b&gt;Record&lt;/b&gt; 
button to make sound recordings</property>
-                            <property name="use_markup">True</property>
-                            <property name="justify">center</property>
-                            <property name="wrap">True</property>
-                            <property name="max_width_chars">50</property>
-                            <style>
-                              <class name="dim-label"/>
-                            </style>
-                          </object>
-                        </child>
+                      <object class="AdwStatusPage" id="emptyPage">
+                        <property name="title" translatable="yes">Add Recordings</property>
+                        <property name="description" translatable="yes">Use the &lt;b&gt;Record&lt;/b&gt; 
button to make sound recordings</property>
                       </object>
                     </property>
                   </object>
diff --git a/src/window.js b/src/window.js
index 67bac65..cde7edd 100644
--- a/src/window.js
+++ b/src/window.js
@@ -34,7 +34,7 @@ var WindowState = {
 var Window = GObject.registerClass({
     Template: 'resource:///org/gnome/SoundRecorder/ui/window.ui',
     InternalChildren: [
-        'mainStack', 'emptyIcon', 'column', 'headerRevealer',
+        'mainStack', 'emptyPage', 'column', 'headerRevealer',
         'notificationRevealer', 'notificationMessage',
         'notificationUndoBtn', 'notificationCloseBtn',
     ],
@@ -99,7 +99,7 @@ var Window = GObject.registerClass({
         this.recorderWidget.connect('canceled', this.onRecorderCanceled.bind(this));
         this.recorderWidget.connect('stopped', this.onRecorderStopped.bind(this));
         this.insert_action_group('recorder', this.recorderWidget.actionsGroup);
-        this._emptyIcon.icon_name = `${pkg.name}-symbolic`;
+        this._emptyPage.icon_name = `${pkg.name}-symbolic`;
         this.show();
     }
 


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