aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp2
-rw-r--r--src/snap.cpp15
2 files changed, 11 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 87bfed1..71a1ce5 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -71,7 +71,7 @@ main(int /*argc*/, char** /*argv*/)
// snap decisions
ClockWatcherImpl clock_watcher(state);
- Snap snap(state->clock);
+ Snap snap;
clock_watcher.alarm_reached().connect([&snap](const Appointment& appt){
snap(appt);
});
diff --git a/src/snap.cpp b/src/snap.cpp
index 7acac9c..a290f99 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -20,6 +20,7 @@
#include <datetime/appointment.h>
#include <datetime/formatter.h>
#include <datetime/snap.h>
+#include <datetime/utils.h> // generate_full_format_string_at_time()
#include <url-dispatcher.h>
@@ -72,8 +73,11 @@ void on_snap_decided(NotifyNotification * /*notification*/,
****
***/
-Snap::Snap(const std::shared_ptr<Clock>& clock):
- m_formatter(clock)
+Snap::Snap()
+{
+}
+
+Snap::~Snap()
{
}
@@ -82,10 +86,10 @@ void Snap::operator()(const Appointment& appointment)
if (!appointment.has_alarms)
return;
- const auto timestr = m_formatter.header.get();
+ auto timestr = generate_full_format_string_at_time (appointment.begin.get(), nullptr, nullptr);
+ auto title = g_strdup_printf(_("Alarm %s"), timestr);
const auto body = appointment.summary;
- gchar* title = g_strdup_printf(_("Alarm %s"), timestr.c_str());
- const gchar* icon_name = "clock";
+ const gchar* icon_name = "alarm-clock";
g_debug("creating a snap decision with title '%s', body '%s', icon '%s'", title, body.c_str(), icon_name);
auto nn = notify_notification_new(title, body.c_str(), icon_name);
@@ -104,6 +108,7 @@ void Snap::operator()(const Appointment& appointment)
}
g_free(title);
+ g_free(timestr);
}
/***