From 5c91c53c1d56a356e091d6910b8c71e7c139f46a Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 5 Feb 2014 16:30:11 -0600 Subject: if an alarm doesn't have a URL associated with it, use 'appid://com.ubuntu.clock/clock/current-user-version' as a fallback url. --- src/main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 5f5ee3c..2be727f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -70,7 +70,14 @@ main(int /*argc*/, char** /*argv*/) Snap snap; clock_watcher.alarm_reached().connect([&snap,&eds_planner](const Appointment& appt){ eds_planner->block_appointment(appt); // when we show a snap decision, take it out of the menu - auto snap_show = [](const Appointment& a){url_dispatch_send(a.url.c_str(), nullptr, nullptr);}; + auto snap_show = [](const Appointment& a){ + const char* url; + if(!a.url.empty()) + url = a.url.c_str(); + else // alarm doesn't have a URl associated with it; use a fallback + url = "appid://com.ubuntu.clock/clock/current-user-version"; + url_dispatch_send(url, nullptr, nullptr); + }; auto snap_dismiss = [](const Appointment&){}; snap(appt, snap_show, snap_dismiss); }); -- cgit v1.2.3