aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-02-04 09:57:51 -0600
committerCharles Kerr <charles.kerr@canonical.com>2014-02-04 09:57:51 -0600
commit61accb9ce497e1f1cbe8038ac495d66d6a4505ff (patch)
tree38bdeca217e4042d0b8578b663df99a922dd918a
parent894c0c625ff1e2f2d031f48f157a3008302cb5a7 (diff)
downloadayatana-indicator-datetime-61accb9ce497e1f1cbe8038ac495d66d6a4505ff.tar.gz
ayatana-indicator-datetime-61accb9ce497e1f1cbe8038ac495d66d6a4505ff.tar.bz2
ayatana-indicator-datetime-61accb9ce497e1f1cbe8038ac495d66d6a4505ff.zip
use the appointment's beginning time in the title of the alarm Snap Decision
-rw-r--r--include/datetime/snap.h9
-rw-r--r--src/main.cpp2
-rw-r--r--src/snap.cpp15
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);
}
/***