aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKen VanDine <kvandine@gnome.org>2009-08-06 21:36:21 +0800
committerMilan Crha <mcrha@redhat.com>2009-08-06 21:36:21 +0800
commit8dec339ee4ac39659df7c44a7c4ee3d64e399686 (patch)
tree6b7e747bb46085962d72f8563f1bdfe69620f3a2 /plugins
parentfb94f1534d16f3971633cdd008ddb54cf0711a75 (diff)
downloadgsoc2013-evolution-8dec339ee4ac39659df7c44a7c4ee3d64e399686.tar.gz
gsoc2013-evolution-8dec339ee4ac39659df7c44a7c4ee3d64e399686.tar.zst
gsoc2013-evolution-8dec339ee4ac39659df7c44a7c4ee3d64e399686.zip
Bug #573919 - [Mail-Notification] Check for 'actions' capability
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mail-notification/mail-notification.c41
1 files changed, 37 insertions, 4 deletions
diff --git a/plugins/mail-notification/mail-notification.c b/plugins/mail-notification/mail-notification.c
index b0a0aa279e..9bc8458eb4 100644
--- a/plugins/mail-notification/mail-notification.c
+++ b/plugins/mail-notification/mail-notification.c
@@ -449,6 +449,36 @@ notifyActionCallback (NotifyNotification *n, gchar *label, gpointer a)
status_count = 0;
g_static_mutex_unlock (&mlock);
}
+
+/* Function to check if actions are supported by the notification daemon */
+static gboolean
+can_support_actions (void)
+{
+ static gboolean supports_actions = FALSE;
+ static gboolean have_checked = FALSE;
+
+ if (!have_checked) {
+ GList *caps = NULL;
+ GList *c;
+
+ have_checked = TRUE;
+
+ caps = notify_get_server_caps ();
+ if (caps != NULL) {
+ for (c = caps; c != NULL; c = c->next) {
+ if (strcmp ((char*)c->data, "actions") == 0) {
+ supports_actions = TRUE;
+ break;
+ }
+ }
+ }
+
+ g_list_foreach (caps, (GFunc)g_free, NULL);
+ g_list_free (caps);
+ }
+
+ return supports_actions;
+}
#endif
static void
@@ -495,10 +525,13 @@ new_notify_status (EMEventTargetFolder *t)
notify = notify_notification_new (_("New email"), msg, "mail-unread", NULL);
notify_notification_attach_to_status_icon (notify, status_icon);
- notify_notification_set_urgency (notify, NOTIFY_URGENCY_NORMAL);
- notify_notification_set_timeout (notify, NOTIFY_EXPIRES_DEFAULT);
- notify_notification_add_action(notify, "default", "Default", notifyActionCallback, NULL, NULL);
- g_timeout_add (500, notification_callback, notify);
+ /* Check if actions are supported */
+ if (can_support_actions ()) {
+ notify_notification_set_urgency (notify, NOTIFY_URGENCY_NORMAL);
+ notify_notification_set_timeout (notify, NOTIFY_EXPIRES_DEFAULT);
+ notify_notification_add_action(notify, "default", "Default", notifyActionCallback, NULL, NULL);
+ g_timeout_add (500, notification_callback, notify);
+ }
}
}
#endif