[gnome-clocks/zbrown/list-alarms: 21/25] alarms: avoid using a magic number



commit df476abc27ec0d44cf957054f642e41f405618db
Author: Zander Brown <zbrown gnome org>
Date:   Mon Jan 27 02:56:28 2020 +0000

    alarms: avoid using a magic number

 src/alarm.vala | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/alarm.vala b/src/alarm.vala
index 751ecb2..5db4f4c 100644
--- a/src/alarm.vala
+++ b/src/alarm.vala
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2013  Paolo Borelli <pborelli gnome org>
+ * Copyright (C) 2020  Zander Brown <zbrown gnome org>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -518,6 +519,9 @@ public class DayPickerRow : Hdy.ActionRow {
     }
 }
 
+// Response used for the "Delete Alarm" button in the edit dialogue
+const int DELETE_ALARM = 2;
+
 [GtkTemplate (ui = "/org/gnome/clocks/ui/alarmsetupdialog.ui")]
 private class SetupDialog : Hdy.Dialog {
     private Utils.WallClock.Format format;
@@ -695,7 +699,7 @@ private class SetupDialog : Hdy.Dialog {
 
     [GtkCallback]
     private void delete () {
-        response (2);
+        response (DELETE_ALARM);
     }
 }
 
@@ -882,7 +886,7 @@ public class Face : Gtk.Stack, Clocks.Clock {
             if (response == 1) {
                 ((SetupDialog) dialog).apply_to_alarm (alarm);
                 save ();
-            } else if (response == 2) {
+            } else if (response == DELETE_ALARM) {
                 alarms.delete_item (alarm);
                 save ();
             }


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