[xchat-gnome] Bug 635952 - [PATCH] Should use append hint for notifications
- From: Ritesh Khadgaray <rkhadgaray src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [xchat-gnome] Bug 635952 - [PATCH] Should use append hint for notifications
- Date: Mon, 14 Feb 2011 13:25:13 +0000 (UTC)
commit be95811135169b16d108448117c71dbe7386f254
Author: Ritesh Khadgaray <khadgaray gmail com>
Date: Mon Feb 14 18:54:03 2011 +0530
Bug 635952 - [PATCH] Should use append hint for notifications
Thanks to Jeremy Nickurak for tracing this.
plugins/notify-osd/notify-osd.c | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/plugins/notify-osd/notify-osd.c b/plugins/notify-osd/notify-osd.c
index c7e8f77..9582529 100644
--- a/plugins/notify-osd/notify-osd.c
+++ b/plugins/notify-osd/notify-osd.c
@@ -28,7 +28,7 @@
#include "xg-plugin.h"
#define NOTIFY_OSD_NAME _("On-screen display")
-#define NOTIFY_OSD_VERSION "0.1"
+#define NOTIFY_OSD_VERSION "0.2"
#define NOTIFY_OSD_DESCRIPTION _("Pops up notification of important messages when XChat-GNOME doesn't have the focus")
int xchat_gnome_plugin_init (xchat_gnome_plugin *xg_plugin);
@@ -49,6 +49,26 @@ static gboolean focused = TRUE;
static GdkPixbuf *notify_icon;
static GSList *notifications = NULL;
+static gboolean
+notify_str_equal (gconstpointer a, gconstpointer b)
+{
+ return !( g_str_equal (a,b) == TRUE) ;
+}
+
+static gboolean
+notify_manager_has_capability (const gchar *cap)
+{
+ gboolean ret;
+ GList *list = NULL;
+
+ list = notify_get_server_caps ();
+ ret = ( g_list_find_custom ( list, cap, notify_str_equal) != NULL );
+
+ g_list_free_full ( list, g_free);
+
+ return ret;
+}
+
static void
hide_notifications (NotifyNotification *notify)
{
@@ -75,6 +95,10 @@ add_notify (char *summary, char *message)
notify_notification_set_urgency (notify, NOTIFY_URGENCY_NORMAL);
notify_notification_set_icon_from_pixbuf (notify, notify_icon);
+
+ if (notify_manager_has_capability ("x-canonical-append"))
+ notify_notification_set_hint_string(notify, "x-canonical-append", "");
+
if (!notify_notification_show (notify, &error)) {
g_warning (_("Failed to send notification: %s\n"), error->message);
g_error_free (error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]