aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-07-26 23:35:38 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-07-26 23:35:38 -0500
commitfcd77b806a8826d5f694f78c63943d0f768ef6ec (patch)
tree22738c06ae6599e729ad386bc3126772dda13299 /src/main.cpp
parenta7e8b219e8a9301249301cff6fbe989670d4e312 (diff)
downloadayatana-indicator-datetime-fcd77b806a8826d5f694f78c63943d0f768ef6ec.tar.gz
ayatana-indicator-datetime-fcd77b806a8826d5f694f78c63943d0f768ef6ec.tar.bz2
ayatana-indicator-datetime-fcd77b806a8826d5f694f78c63943d0f768ef6ec.zip
refactor the Notifications / sound / awake code
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index cc81cd7..eb90020 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -32,6 +32,7 @@
#include <datetime/timezone-file.h>
#include <datetime/timezones-live.h>
#include <datetime/wakeup-timer-mainloop.h>
+#include <notifications/notifications.h>
#ifdef HAVE_UBUNTU_HW_ALARM_H
#include <datetime/wakeup-timer-uha.h>
@@ -45,6 +46,8 @@
#include <locale.h>
#include <cstdlib> // exit()
+namespace uin = unity::indicator::notifications;
+
using namespace unity::indicator::datetime;
namespace
@@ -141,7 +144,8 @@ main(int /*argc*/, char** /*argv*/)
MenuFactory factory(actions, state);
// set up the snap decisions
- Snap snap (state->clock, state->settings);
+ auto notification_engine = std::make_shared<uin::Engine>("indicator-datetime-service");
+ std::unique_ptr<Snap> snap (new Snap(notification_engine, state->settings));
auto alarm_queue = create_simple_alarm_queue(state->clock, engine, timezone);
alarm_queue->alarm_reached().connect([&snap](const Appointment& appt){
auto snap_show = [](const Appointment& a){
@@ -153,7 +157,7 @@ main(int /*argc*/, char** /*argv*/)
url_dispatch_send(url, nullptr, nullptr);
};
auto snap_dismiss = [](const Appointment&){};
- snap(appt, snap_show, snap_dismiss);
+ (*snap)(appt, snap_show, snap_dismiss);
});
// create the menus
@@ -170,6 +174,7 @@ main(int /*argc*/, char** /*argv*/)
});
exporter.publish(actions, menus);
g_main_loop_run(loop);
+
g_main_loop_unref(loop);
return 0;
}