[gnome-clocks/zbrown/list-alarms: 47/59] alarms: show repeats on separate label



commit 669892010ef93073631d77e49b968564b900dd2c
Author: Zander Brown <zbrown gnome org>
Date:   Tue Aug 6 22:28:57 2019 +0100

    alarms: show repeats on separate label

 data/ui/alarmtile.ui |  9 +++++++++
 src/alarm.vala       | 16 +++++-----------
 2 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/data/ui/alarmtile.ui b/data/ui/alarmtile.ui
index 4b0192b..cbf4cd4 100644
--- a/data/ui/alarmtile.ui
+++ b/data/ui/alarmtile.ui
@@ -19,5 +19,14 @@
         <property name="margin-bottom">8</property>
       </object>
     </child>
+    <child type="action">
+      <object class="GtkLabel" id="repeats">
+        <property name="visible">True</property>
+        <property name="valign">center</property>
+        <style>
+          <class name="dim-label" />
+        </style>
+      </object>
+    </child>
   </template>
 </interface>
diff --git a/src/alarm.vala b/src/alarm.vala
index efbf43c..13e0fad 100644
--- a/src/alarm.vala
+++ b/src/alarm.vala
@@ -281,6 +281,8 @@ private class Row : Hdy.ActionRow {
 
     [GtkChild]
     private Gtk.Switch toggle;
+    [GtkChild]
+    private Gtk.Label repeats;
 
     public Row (Item alarm, Face face) {
         Object (alarm: alarm, face: face);
@@ -301,8 +303,6 @@ private class Row : Hdy.ActionRow {
     }
 
     private void update () {
-        string text, sub_text;
-
         if (alarm.active) {
             get_style_context ().add_class ("active");
         } else {
@@ -311,19 +311,13 @@ private class Row : Hdy.ActionRow {
 
         if (alarm.state == Item.State.SNOOZING) {
             get_style_context ().add_class ("snoozing");
-            text = alarm.snooze_time_label;
-            sub_text = "(%s)".printf (alarm.time_label);
+            title = "%s (%s)".printf (alarm.snooze_time_label, alarm.time_label);
         } else {
             get_style_context ().remove_class ("snoozing");
-            text = alarm.time_label;
-            sub_text = alarm.days_label;
+            title = alarm.time_label;
         }
 
-        if (sub_text != null && sub_text != "") {
-            title = "%s • %s".printf (text, sub_text);
-        } else {
-            title = text;
-        }
+        repeats.label = alarm.days_label;
     }
 }
 


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