diff options
-rw-r--r-- | include/datetime/snap.h | 9 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | 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 <datetime/appointment.h> -#include <datetime/clock.h> -#include <datetime/formatter.h> #include <memory> @@ -36,12 +34,9 @@ namespace datetime { class Snap { public: - Snap(const std::shared_ptr<Clock>&); - 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 <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); } /*** |