[gnome-clocks/bilelmoussaoui/redesign-timer] Timer: ring when a timer is up
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks/bilelmoussaoui/redesign-timer] Timer: ring when a timer is up
- Date: Tue, 28 Jan 2020 15:11:31 +0000 (UTC)
commit 329f5b75765309f64fc6facdb928a7c347941a07
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date: Tue Jan 28 16:11:06 2020 +0100
Timer: ring when a timer is up
src/timer.vala | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/src/timer.vala b/src/timer.vala
index 49781f3..4513bb9 100644
--- a/src/timer.vala
+++ b/src/timer.vala
@@ -214,6 +214,7 @@ public class Setup : Gtk.Box {
[GtkTemplate (ui = "/org/gnome/clocks/ui/timer_row.ui")]
public class Row : Gtk.ListBoxRow {
+ public signal void ringing ();
public enum State {
STOPPED,
RUNNING,
@@ -334,6 +335,7 @@ public class Row : Gtk.ListBoxRow {
timer.reset ();
countdown_label.get_style_context ().add_class ("timer-paused");
+ countdown_label.get_style_context ().remove_class ("timer-ringing");
countdown_label.get_style_context ().remove_class ("timer-running");
start_stack.visible_child_name = "start";
name_stack.visible_child_name = "edit";
@@ -342,6 +344,7 @@ public class Row : Gtk.ListBoxRow {
private void start () {
update_name_label ();
countdown_label.get_style_context ().add_class ("timer-running");
+ countdown_label.get_style_context ().remove_class ("timer-ringing");
countdown_label.get_style_context ().remove_class ("timer-paused");
reset_stack.visible_child_name = "empty";
@@ -359,7 +362,7 @@ public class Row : Gtk.ListBoxRow {
var e = timer.elapsed ();
if (e >= span) {
reset ();
- // ring ();
+ ring ();
timeout_id = 0;
return false;
}
@@ -368,8 +371,17 @@ public class Row : Gtk.ListBoxRow {
});
}
+ private void ring () {
+ countdown_label.get_style_context ().add_class ("timer-ringing");
+ countdown_label.get_style_context ().remove_class ("timer-paused");
+ countdown_label.get_style_context ().remove_class ("timer-running");
+
+ ringing ();
+ }
+
private void pause () {
countdown_label.get_style_context ().add_class ("timer-paused");
+ countdown_label.get_style_context ().remove_class ("timer-ringing");
countdown_label.get_style_context ().remove_class ("timer-running");
reset_stack.visible_child_name = "button";
@@ -466,6 +478,7 @@ public class Face : Gtk.Stack, Clocks.Clock {
var row = new Row ((Item) timer);
row.deleted.connect (() => remove_timer ((Item) timer));
row.edited.connect (() => save ());
+ row.ringing.connect (() => ring ());
return row;
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]