From: Enrico Zini Date: Sun, 28 Mar 2010 15:17:03 +0000 (+0100) Subject: Wire auxbutton and vibrator properly X-Git-Url: https://git.toastfreeware.priv.at/gregoa/zavai.git/commitdiff_plain/5aa56f12f0169381a6112a6c9fd4685e4ade2b16?hp=fc78e7dc311a6027925ce2cdbfb1d6928501a981 Wire auxbutton and vibrator properly --- diff --git a/README b/README index 97f1d24..3256c08 100644 --- a/README +++ b/README @@ -193,10 +193,10 @@ using vala-dbus-binding-tool: system time, automatically sync it if GPS time is more than 1 hour different than the system time, show a "SYNC" button that will sync it if pressed - - stacked notifier, with stacked modal dialogs + + stacked notifier, with stacked modal dialogs (notify sms received during phone ringing during alarm) - aux acks the topmost dialog - - custom ringtone per every notifier (stops ringtone of modifier below, + + custom ringtone per every notifier (stops ringtone of modifier below, saving the time offset of playing so it can be reloaded and resumed) - log - flash aux when there are unacknowledged log entries diff --git a/src/app_alarm.vala b/src/app_alarm.vala index e09879f..2d2699b 100644 --- a/src/app_alarm.vala +++ b/src/app_alarm.vala @@ -72,7 +72,7 @@ protected class AlarmNotifierDialog : ui.notify.Notifier { var state = new zavai.led.LedState(notifier_name); state.set_blink(255); - zavai.led.aux.push_state(state); + zavai.led.vibrator.push_state(state); return true; } @@ -103,6 +103,9 @@ public class AlarmNotifier : zavai.Resource, ui.notify.Notifier current = info; dialog = new AlarmNotifierDialog("Alarm", info.label); + if (zavai.led.auxbutton != null) + zavai.led.auxbutton.event += on_auxbutton; + uint cancel_timeout = 0; cancel_timeout = Timeout.add(30 * 1000, () => { dialog.response(Gtk.ResponseType.CANCEL); @@ -120,11 +123,22 @@ public class AlarmNotifier : zavai.Resource, ui.notify.Notifier clock.alarm_trigger_queue.cancel(current); break; } + + if (zavai.led.auxbutton != null) + zavai.led.auxbutton.event -= on_auxbutton; + dialog.destroy(); dialog = null; current = null; } + protected bool on_auxbutton(ulong time, bool pressed) + { + if (dialog == null) return false; + dialog.response(Gtk.ResponseType.OK); + return true; + } + public void on_done(clock.AlarmTriggerInfo info) { if (current == null || dialog == null || current != info) return;