[evolution] Bug 691047 - Support notification filtering



commit bed514dd862a5b7968d42c0cfb2bd3afe46e4d84
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Jan 8 11:33:46 2013 -0500

    Bug 691047 - Support notification filtering
    
    For compliance with:
    https://live.gnome.org/GnomeGoals/NotificationSource

 calendar/alarm-notify/alarm-queue.c           |   16 ++++++++++++----
 data/evolution.desktop.in.in                  |    1 +
 plugins/mail-notification/mail-notification.c |    4 ++++
 plugins/publish-calendar/publish-calendar.c   |    3 +++
 4 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/calendar/alarm-notify/alarm-queue.c b/calendar/alarm-notify/alarm-queue.c
index 18bd49e..2270879 100644
--- a/calendar/alarm-notify/alarm-queue.c
+++ b/calendar/alarm-notify/alarm-queue.c
@@ -1724,7 +1724,7 @@ popup_notification (time_t trigger,
 	gchar *str, *start_str, *end_str, *alarm_str, *time_str;
 	icaltimezone *current_zone;
 	ECalComponentOrganizer organiser;
-	NotifyNotification *n;
+	NotifyNotification *notify;
 	gchar *body;
 
 	debug (("..."));
@@ -1780,9 +1780,17 @@ popup_notification (time_t trigger,
 				"%s %s", start_str, time_str);
 	}
 
-	n = notify_notification_new (summary, body, "appointment-soon");
-	if (!notify_notification_show (n, NULL))
-	    g_warning ("Could not send notification to daemon\n");
+	notify = notify_notification_new (summary, body, "appointment-soon");
+
+	/* If the user wants Evolution notifications suppressed, honor
+	 * it even though evolution-alarm-notify is a separate process
+	 * with its own .desktop file. */
+	notify_notification_set_hint (
+		notify, "desktop-entry",
+		g_variant_new_string (PACKAGE));
+
+	if (!notify_notification_show (notify, NULL))
+		g_warning ("Could not send notification to daemon\n");
 
 	/* create the private structure */
 	g_free (start_str);
diff --git a/data/evolution.desktop.in.in b/data/evolution.desktop.in.in
index 6a4bd72..bc17b3b 100644
--- a/data/evolution.desktop.in.in
+++ b/data/evolution.desktop.in.in
@@ -15,4 +15,5 @@ X-GNOME-Bugzilla-Product=Evolution
 X-GNOME-Bugzilla-Component=BugBuddyBugs
 X-GNOME-Bugzilla-Version= BASE_VERSION@.x
 X-GNOME-Bugzilla-OtherBinaries=e-addressbook-factory;e-calendar-factory
+X-GNOME-UsesNotifications=true
 MimeType=text/calendar;text/x-vcard;text/directory;application/mbox;message/rfc822;x-scheme-handler/mailto;
diff --git a/plugins/mail-notification/mail-notification.c b/plugins/mail-notification/mail-notification.c
index e0973d2..bbfc685 100644
--- a/plugins/mail-notification/mail-notification.c
+++ b/plugins/mail-notification/mail-notification.c
@@ -442,6 +442,10 @@ new_notify_status (EMEventTargetFolder *t)
 		notify_notification_set_timeout (
 			notify, NOTIFY_EXPIRES_DEFAULT);
 
+		notify_notification_set_hint (
+			notify, "desktop-entry",
+			g_variant_new_string (PACKAGE));
+
 		/* Check if actions are supported */
 		if (can_support_actions ()) {
 			gchar *label;
diff --git a/plugins/publish-calendar/publish-calendar.c b/plugins/publish-calendar/publish-calendar.c
index 95fa155..cc04b2e 100644
--- a/plugins/publish-calendar/publish-calendar.c
+++ b/plugins/publish-calendar/publish-calendar.c
@@ -149,6 +149,9 @@ update_publish_notification (GtkMessageType msg_type,
 			notify  = notify_notification_new (_("Calendar Publishing"), actual_msg->str, stock_name);
 			notify_notification_set_urgency (notify, NOTIFY_URGENCY_NORMAL);
 			notify_notification_set_timeout (notify, NOTIFY_EXPIRES_DEFAULT);
+			notify_notification_set_hint (
+				notify, "desktop-entry",
+				g_variant_new_string (PACKAGE));
 			g_timeout_add (500, show_notify_cb, NULL);
 
 			g_signal_connect (



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]