aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-10-16 16:48:28 -0500
committerCharles Kerr <charles.kerr@canonical.com>2013-10-16 16:48:28 -0500
commit42b338cdced3f34d719ffda6108818df2e85a84b (patch)
tree513bb5c9895ccad5209a5a014b5095d2da92e519 /src
parenta96e714329ea80e676af5dc5db69ba5b62a25b6e (diff)
downloadayatana-indicator-datetime-42b338cdced3f34d719ffda6108818df2e85a84b.tar.gz
ayatana-indicator-datetime-42b338cdced3f34d719ffda6108818df2e85a84b.tar.bz2
ayatana-indicator-datetime-42b338cdced3f34d719ffda6108818df2e85a84b.zip
use a two-button snap decision because one-button snap decisions don't show up.
Diffstat (limited to 'src')
-rw-r--r--src/service.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/service.c b/src/service.c
index fd3d937..09ee4d4 100644
--- a/src/service.c
+++ b/src/service.c
@@ -401,8 +401,10 @@ appointment_has_alarm_url (const struct IndicatorDatetimeAppt * appt)
}
static gboolean
-datetimes_have_the_same_minute (GDateTime * a, GDateTime * b)
+datetimes_have_the_same_minute (GDateTime * a G_GNUC_UNUSED, GDateTime * b G_GNUC_UNUSED)
{
+return TRUE;
+#if 0
int ay, am, ad;
int by, bm, bd;
@@ -414,6 +416,7 @@ datetimes_have_the_same_minute (GDateTime * a, GDateTime * b)
(ad == bd) &&
(g_date_time_get_hour (a) == g_date_time_get_hour (b)) &&
(g_date_time_get_minute (a) == g_date_time_get_minute (b));
+#endif
}
static void
@@ -433,13 +436,18 @@ dispatch_alarm_url (const struct IndicatorDatetimeAppt * appt)
}
static void
-action_ok (NotifyNotification *notification G_GNUC_UNUSED,
- char *action,
- gpointer gurl)
+on_snap_decided (NotifyNotification * notification G_GNUC_UNUSED,
+ char * action,
+ gpointer gurl)
{
- const char * url = gurl;
- g_debug ("'%s' clicked for snap decision %s", action, url);
- url_dispatch_send (url, NULL, NULL);
+ g_debug ("%s: %s", G_STRFUNC, action);
+
+ if (!g_strcmp0 (action, "ok"))
+ {
+ const gchar * url = gurl;
+ g_debug ("dispatching url '%s'", url);
+ url_dispatch_send (url, NULL, NULL);
+ }
}
static void
@@ -461,10 +469,10 @@ show_snap_decision_for_alarm (const struct IndicatorDatetimeAppt * appt)
nn = notify_notification_new (title, body, icon_name);
notify_notification_set_hint (nn, "x-canonical-snap-decisions",
g_variant_new_boolean(TRUE));
- notify_notification_set_hint (nn, "x-canonical-private-button-tint",
- g_variant_new_boolean(TRUE));
- notify_notification_add_action (nn, "action_accept", _("OK"),
- action_ok, g_strdup(appt->url), g_free);
+ notify_notification_add_action (nn, "ok", _("OK"),
+ on_snap_decided, g_strdup(appt->url), g_free);
+ notify_notification_add_action (nn, "cancel", _("Cancel"),
+ on_snap_decided, NULL, NULL);
error = NULL;
notify_notification_show (nn, &error);
@@ -493,6 +501,8 @@ on_alarm_timer (gpointer gself)
{
const struct IndicatorDatetimeAppt * appt = l->data;
+g_message ("[%s][%s]", g_date_time_format (appt->begin, "%F %T"), appt->url);
+
if (appointment_has_alarm_url (appt))
if (datetimes_have_the_same_minute (now, appt->begin))
show_snap_decision_for_alarm (appt);
@@ -1975,7 +1985,7 @@ on_name_lost (GDBusConnection * connection G_GNUC_UNUSED,
unexport (self);
- //g_signal_emit (self, signals[SIGNAL_NAME_LOST], 0, NULL);
+ g_signal_emit (self, signals[SIGNAL_NAME_LOST], 0, NULL);
}