From 61accb9ce497e1f1cbe8038ac495d66d6a4505ff Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 4 Feb 2014 09:57:51 -0600 Subject: use the appointment's beginning time in the title of the alarm Snap Decision --- include/datetime/snap.h | 9 ++------- src/main.cpp | 2 +- src/snap.cpp | 15 ++++++++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/datetime/snap.h b/include/datetime/snap.h index d6f5aad..584d895 100644 --- a/include/datetime/snap.h +++ b/include/datetime/snap.h @@ -21,8 +21,6 @@ #define INDICATOR_DATETIME_SNAP_H #include -#include -#include #include @@ -36,12 +34,9 @@ namespace datetime { class Snap { public: - Snap(const std::shared_ptr&); - virtual ~Snap() =default; + Snap(); + virtual ~Snap(); void operator()(const Appointment&); - -private: - PhoneFormatter m_formatter; }; } // namespace datetime 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 #include #include +#include // generate_full_format_string_at_time() #include @@ -72,8 +73,11 @@ void on_snap_decided(NotifyNotification * /*notification*/, **** ***/ -Snap::Snap(const std::shared_ptr& 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); } /*** -- cgit v1.2.3