[gnome-clocks/wip/vala] Make also snoozing dismiss the ringing panel



commit 2d27054d8b9c0a21dc9de35b9ac9c89949d6995d
Author: Paolo Borelli <pborelli gnome org>
Date:   Mon Feb 18 19:09:16 2013 +0100

    Make also snoozing dismiss the ringing panel

 src/alarm.vala |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/src/alarm.vala b/src/alarm.vala
index d622bd8..2cbeaba 100644
--- a/src/alarm.vala
+++ b/src/alarm.vala
@@ -60,6 +60,12 @@ private class Item : Object {
          }
     }
 
+    public string snooze_time_label {
+         owned get {
+            return Utils.WallClock.get_default ().format_time (snooze_time);
+         }
+    }
+
     public bool active {
         get {
             return _active;
@@ -71,7 +77,7 @@ private class Item : Object {
                 if (_active) {
                     reset ();
                 } else if (state == State.RINGING) {
-                    bell.stop ();
+                    stop ();
                 }
             }
         }
@@ -378,23 +384,22 @@ private class StandalonePanel : Gtk.EventBox {
 
         stop_button.clicked.connect (() => {
             alarm.stop ();
-            stop ();
+            dismiss ();
         });
 
         snooze_button.clicked.connect (() => {
             alarm.snooze ();
-            snooze_button.sensitive = false;
+            dismiss ();
         });
 
         add (grid);
     }
 
-    public signal void stop ();
+    public signal void dismiss ();
 
     public void update () {
         if (alarm != null) {
             time_label.set_text (alarm.time_label);
-            snooze_button.sensitive = (alarm.state == Item.State.RINGING);
         }
     }
 }
@@ -428,8 +433,13 @@ public class MainPanel : Gd.Stack, Clocks.Clock {
             Item alarm;
             model.get (iter, Column.ITEM, out alarm);
             var renderer = (DigitalClockRenderer) cell;
-            renderer.text = alarm.time_label;
-            renderer.subtext = alarm.repeat_label;
+            if (alarm.state == Item.State.SNOOZING) {
+                renderer.text = alarm.snooze_time_label;
+                renderer.subtext = "(%s)".printf(alarm.time_label);
+            } else {
+                renderer.text = alarm.time_label;
+                renderer.subtext = alarm.repeat_label;
+            }
             renderer.css_class = alarm.active ? "active" : "inactive";
         });
 
@@ -474,7 +484,7 @@ public class MainPanel : Gd.Stack, Clocks.Clock {
         standalone = new StandalonePanel ();
         add (standalone);
 
-        standalone.stop.connect (() => {
+        standalone.dismiss.connect (() => {
             visible_child = content_view;
         });
 


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