431
432
url_dispatch_send (appt->url, NULL, NULL);
434
/* Check for alarms that start at the current time.
435
If we find any, we dispatch the URL associated with them. */
437
dispatch_alarm_urls (IndicatorDatetimeService * self)
439
GDateTime * now = indicator_datetime_service_get_localtime (self);
437
on_notification_closed (NotifyNotification * nn, gpointer gself)
439
//IndicatorDatetimeService * self = INDICATOR_DATETIME_SERVICE (gself);
441
g_message ("hello world");
444
g_signal_handlers_disconnect_by_data (nn, gself);
450
on_alarm_popup_ok_clicked (NotifyNotification * nn G_GNUC_UNUSED, char * action G_GNUC_UNUSED, gpointer gurl)
452
const char * url = gurl;
453
url_dispatch_send (url, NULL, NULL);
456
#define ALARM_ICON_NAME "alarm-symbolic"
458
static void update_appointment_lists (IndicatorDatetimeService * self);
461
on_alarm_timer (gpointer gself)
465
IndicatorDatetimeService * self = INDICATOR_DATETIME_SERVICE (gself);
467
/* Check for alarms that start at the current time.
468
* If we find one, trigger a snap decision displaying
469
* the appointment text and a single button to dismiss */
470
now = indicator_datetime_service_get_localtime (self);
442
471
for (l=self->priv->upcoming_appointments; l!=NULL; l=l->next)
444
475
const struct IndicatorDatetimeAppt * appt = l->data;
446
if (appointment_has_alarm_url (appt) && datetimes_have_the_same_minute (now, appt->begin))
447
dispatch_alarm_url (appt);
476
NotifyNotification * nn;
479
if (!appointment_has_alarm_url (appt))
482
if (!datetimes_have_the_same_minute (now, appt->begin))
485
title = g_date_time_format (now, get_terse_time_format_string (now));
486
body = appt->summary;
487
nn = notify_notification_new (title, body, ALARM_ICON_NAME);
489
notify_notification_set_hint (nn, "x-canonical-snap-decisions",
490
g_variant_new_boolean(TRUE));
491
notify_notification_set_hint (nn, "x-canonical-private-button-tint",
492
g_variant_new_boolean(TRUE));
493
notify_notification_add_action (nn, "ok", _("OK"),
494
on_alarm_popup_ok_clicked,
495
g_strdup (appt->url), g_free);
496
//g_signal_connect (nn, "closed", G_CALLBACK(on_notification_closed), self);
499
notify_notification_show (nn, &error);
502
g_warning ("Unable to show alarm '%s' popup: %s", body, error->message);
503
g_error_free (error);
504
dispatch_alarm_url (appt);
450
508
g_date_time_unref (now);
453
static void update_appointment_lists (IndicatorDatetimeService * self);
456
on_alarm_timer (gpointer self)
458
dispatch_alarm_urls (self);
460
510
/* rebuild the alarm list asynchronously.
461
511
when it's done, set_upcoming_appointments() will update the alarm timer */