[gnome-clocks/wip/exalm/libhandy-1: 16/16] alarm: Use actions for alarm ringing buttons
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks/wip/exalm/libhandy-1: 16/16] alarm: Use actions for alarm ringing buttons
- Date: Wed, 3 Jun 2020 14:58:14 +0000 (UTC)
commit deb106f47c77432c4850ca08463c9d29fef272f6
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Wed Jun 3 19:40:13 2020 +0500
alarm: Use actions for alarm ringing buttons
data/ui/alarmringing.ui | 4 ++--
src/alarm.vala | 22 +++++++---------------
2 files changed, 9 insertions(+), 17 deletions(-)
---
diff --git a/data/ui/alarmringing.ui b/data/ui/alarmringing.ui
index 7697377..454ad63 100644
--- a/data/ui/alarmringing.ui
+++ b/data/ui/alarmringing.ui
@@ -35,7 +35,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="clicked" handler="stop_clicked" swapped="no"/>
+ <property name="action_name">app.stop-alarm</property>
<style>
<class name="clocks-button"/>
<class name="clocks-stop"/>
@@ -55,7 +55,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
- <signal name="clicked" handler="snooze_clicked" swapped="no"/>
+ <property name="action_name">app.snooze-alarm</property>
<style>
<class name="clocks-button"/>
<class name="clocks-snooze"/>
diff --git a/src/alarm.vala b/src/alarm.vala
index b650179..3328d67 100644
--- a/src/alarm.vala
+++ b/src/alarm.vala
@@ -735,6 +735,9 @@ private class RingingPanel : Gtk.Bin {
dismiss ();
}
});
+
+ stop_button.action_target = ((Item) _alarm).id;
+ snooze_button.action_target = ((Item) _alarm).id;
}
update ();
@@ -747,27 +750,16 @@ private class RingingPanel : Gtk.Bin {
private Gtk.Label title_label;
[GtkChild]
private Gtk.Label time_label;
+ [GtkChild]
+ private Gtk.Button stop_button;
+ [GtkChild]
+ private Gtk.Button snooze_button;
construct {
// Start ticking...
Utils.WallClock.get_default ().tick.connect (update);
}
- [GtkCallback]
- private void stop_clicked () requires (alarm != null) {
- ((Item) alarm).stop ();
- }
-
- [GtkCallback]
- private void snooze_clicked () requires (alarm != null) {
- if (((Item) alarm).state != Item.State.SNOOZING) {
- ((Item) alarm).snooze ();
- } else {
- // The alarm is already snoozed, simply dismiss the panel.
- dismiss ();
- }
- }
-
public virtual signal void dismiss () {
alarm = null;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]