[gnome-clocks] timer-row: Visual nits, hide label when empty



commit ec282fd427c404849a2f321ef562372c4fb07b4d
Author: Maximiliano Sandoval R <msandova gnome org>
Date:   Tue Dec 14 17:23:21 2021 +0100

    timer-row: Visual nits, hide label when empty

 data/ui/timer-row.ui | 49 +++++++++++++++++++++++++++----------------------
 src/timer-row.vala   |  5 +++++
 2 files changed, 32 insertions(+), 22 deletions(-)
---
diff --git a/data/ui/timer-row.ui b/data/ui/timer-row.ui
index a15b8c58..15a20ed1 100644
--- a/data/ui/timer-row.ui
+++ b/data/ui/timer-row.ui
@@ -19,30 +19,35 @@
           </object>
         </child>
         <child>
-          <object class="GtkStack" id="name_stack">
+          <object class="GtkRevealer" id="name_revealer">
             <child>
-              <object class="GtkStackPage">
-                <property name="name">edit</property>
-                <property name="child">
-                  <object class="GtkEntry" id="title">
-                    <property name="halign">center</property>
-                    <property name="width_chars">26</property>
-                    <property name="placeholder_text" translatable="yes">Title…</property>
+              <object class="GtkStack" id="name_stack">
+                <child>
+                  <object class="GtkStackPage">
+                    <property name="name">edit</property>
+                    <property name="child">
+                      <object class="GtkEntry" id="title">
+                        <property name="halign">center</property>
+                        <property name="width_chars">26</property>
+                        <property name="placeholder_text" translatable="yes">Title…</property>
+                      </object>
+                    </property>
                   </object>
-                </property>
-              </object>
-            </child>
-            <child>
-              <object class="GtkStackPage">
-                <property name="name">display</property>
-                <property name="child">
-                  <object class="GtkLabel" id="timer_name">
-                    <property name="halign">center</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
+                </child>
+                <child>
+                  <object class="GtkStackPage">
+                    <property name="name">display</property>
+                    <property name="child">
+                      <object class="GtkLabel" id="timer_name">
+                        <property name="halign">center</property>
+                        <property name="valign">start</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
+                      </object>
+                    </property>
                   </object>
-                </property>
+                </child>
               </object>
             </child>
           </object>
@@ -140,7 +145,7 @@
                       <object class="GtkButton" id="delete_button">
                         <property name="halign">center</property>
                         <property name="valign">center</property>
-                        <property name="icon_name">edit-delete-symbolic</property>
+                        <property name="icon_name">user-trash-symbolic</property>
                         <style>
                           <class name="circular"/>
                         </style>
diff --git a/src/timer-row.vala b/src/timer-row.vala
index ca81f309..8afa6df8 100644
--- a/src/timer-row.vala
+++ b/src/timer-row.vala
@@ -49,6 +49,8 @@ public class Row : Gtk.ListBoxRow {
 
     [GtkChild]
     private unowned Gtk.Stack name_stack;
+    [GtkChild]
+    private unowned Gtk.Revealer name_revealer;
 
     [GtkChild]
     private unowned Gtk.Stack start_stack;
@@ -104,6 +106,7 @@ public class Row : Gtk.ListBoxRow {
         countdown_label.remove_css_class ("timer-ringing");
         countdown_label.remove_css_class ("timer-running");
         start_stack.visible_child_name = "start";
+        name_revealer.reveal_child = true;
         name_stack.visible_child_name = "edit";
 
         update_countdown (item.hours, item.minutes, item.seconds);
@@ -118,6 +121,7 @@ public class Row : Gtk.ListBoxRow {
         delete_stack.visible_child_name = "empty";
 
         start_stack.visible_child_name = "pause";
+        name_revealer.reveal_child = (timer_name.label != "");
         name_stack.visible_child_name = "display";
     }
 
@@ -135,6 +139,7 @@ public class Row : Gtk.ListBoxRow {
         reset_stack.visible_child_name = "button";
         delete_stack.visible_child_name = "button";
         start_stack.visible_child_name = "start";
+        name_revealer.reveal_child = (timer_name.label != "");
         name_stack.visible_child_name = "display";
     }
 


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