[gnome-clocks/wip/vala] Stop goes back to overview, no back button
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks/wip/vala] Stop goes back to overview, no back button
- Date: Mon, 18 Feb 2013 10:48:48 +0000 (UTC)
commit 592fb3fbe39ed81a466e5b4e96ece5eae249b2dd
Author: Paolo Borelli <pborelli gnome org>
Date: Mon Feb 18 11:48:08 2013 +0100
Stop goes back to overview, no back button
src/alarm.vala | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/src/alarm.vala b/src/alarm.vala
index 782bb63..d622bd8 100644
--- a/src/alarm.vala
+++ b/src/alarm.vala
@@ -23,6 +23,8 @@ private class Item : Object {
static const int SNOOZE_MINUTES = 9;
static const int RING_MINUTES = 3;
+ // FIXME: should we add a "MISSED" state where the alarm stopped
+ // ringing but we keep showing the standalone?
public enum State {
READY,
RINGING,
@@ -135,7 +137,7 @@ private class Item : Object {
ring_end_time = now.add_minutes (RING_MINUTES);
state = State.RINGING;
ring ();
- }
+ }
public void snooze () {
bell.stop ();
@@ -376,6 +378,7 @@ private class StandalonePanel : Gtk.EventBox {
stop_button.clicked.connect (() => {
alarm.stop ();
+ stop ();
});
snooze_button.clicked.connect (() => {
@@ -386,6 +389,8 @@ private class StandalonePanel : Gtk.EventBox {
add (grid);
}
+ public signal void stop ();
+
public void update () {
if (alarm != null) {
time_label.set_text (alarm.time_label);
@@ -469,6 +474,10 @@ public class MainPanel : Gd.Stack, Clocks.Clock {
standalone = new StandalonePanel ();
add (standalone);
+ standalone.stop.connect (() => {
+ visible_child = content_view;
+ });
+
load ();
var id = notify["visible-child"].connect (() => {
@@ -489,14 +498,13 @@ public class MainPanel : Gd.Stack, Clocks.Clock {
// Start ticking...
Utils.WallClock.get_default ().tick.connect (() => {
foreach (var a in alarms) {
+ // a.tick() returns true if the state changed
if (a.tick()) {
- // a.tick() returns true if the state changed
if (a.state == Item.State.RINGING) {
standalone.alarm = a;
standalone.update ();
ring ();
} else if (standalone.alarm == a) {
- // update the alarm shown in the standalone
standalone.update ();
}
}
@@ -572,10 +580,6 @@ public class MainPanel : Gd.Stack, Clocks.Clock {
case Toolbar.Mode.STANDALONE:
toolbar.set_labels_menu (null);
toolbar.set_labels (GLib.Markup.escape_text (standalone.alarm.name), null);
- var back_button = toolbar.add_button ("go-previous-symbolic", null, true);
- back_button.clicked.connect (() => {
- visible_child = content_view;
- });
break;
default:
assert_not_reached ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]