diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2016-05-14 12:18:45 -0500 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2021-08-29 14:37:39 +0200 |
commit | b639e39dc4a2aa82a40f0a6922577b65ff3dd35f (patch) | |
tree | 416622d85b18d329d7e355e2c65cdf1f299e5712 /src/main.cpp | |
parent | a6422822a9b9a18bae705e56f2b53ee0b61ff1dc (diff) | |
download | ayatana-indicator-datetime-b639e39dc4a2aa82a40f0a6922577b65ff3dd35f.tar.gz ayatana-indicator-datetime-b639e39dc4a2aa82a40f0a6922577b65ff3dd35f.tar.bz2 ayatana-indicator-datetime-b639e39dc4a2aa82a40f0a6922577b65ff3dd35f.zip |
add a new Snap::Response enum for more flexible handling of snap decisions
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp index 034a5ef..9defed0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -153,14 +153,21 @@ main(int /*argc*/, char** /*argv*/) auto notification_engine = std::make_shared<ain::Engine>("ayatana-indicator-datetime-service"); std::unique_ptr<Snap> snap (new Snap(notification_engine, state->settings)); auto alarm_queue = create_simple_alarm_queue(state->clock, snooze_planner, engine, timezone_); - auto on_snooze = [snooze_planner](const Appointment& appointment, const Alarm& alarm) { - snooze_planner->add(appointment, alarm); + auto sound_builder = std::make_shared<uin::DefaultSoundBuilder>(); + auto on_response = [snooze_planner, actions](const Appointment& appointment, const Alarm& alarm, const Snap::Response& response) { + switch(response) { + case Snap::Response::Snooze: + snooze_planner->add(appointment, alarm); + break; + case Snap::Response::ShowApp: + actions->open_appointment(appointment, appointment.begin); + break; + case Snap::Response::None: + break; + } }; - auto on_ok = [actions](const Appointment& app, const Alarm&){ - actions->open_appointment(app, app.begin); - }; - auto on_alarm_reached = [&engine, &snap, &on_snooze, &on_ok](const Appointment& appointment, const Alarm& alarm) { - (*snap)(appointment, alarm, on_snooze, on_ok); + auto on_alarm_reached = [&engine, &snap, &on_response](const Appointment& appointment, const Alarm& alarm) { + (*snap)(appointment, alarm, on_response); engine->disable_ubuntu_alarm(appointment); }; alarm_queue->alarm_reached().connect(on_alarm_reached); |