Hi everyone,

the patch linked above is already included in Debian. Still, we have another problem with 
"Show" button.

I see several problems within fix-notify-osd.diff:

* The name of discussed server capability is "actions" not "action", according to http://developer.gnome.org/notification-spec/ (see Table 5. Server Capabilities)
* g_list_index() finds value by comparing pointers, not strings, so search for 
a string constant always returns -1

Because if these two, the "Show" button is not displayed by *any* notification 
server, even if it supports actions.

* List of capabilities obtained by calling notify_get_server_caps() should be freed after use, (see http://developer.gnome.org/libnotify/0.7/libnotify-notify.html#notify-get-server-caps)

Attached file is meant as a replacement for current fix-notify-osd.diff in 
debian/patches

BR

Jakub
From: Jakub Adam <[email protected]>
Date: Sun, 21 Aug 2011 20:01:57 +0200
Subject: fix-notify-osd.diff

---
 src/pidgin-libnotify.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/pidgin-libnotify.c b/src/pidgin-libnotify.c
index 9e2194d..fc24d4b 100644
--- a/src/pidgin-libnotify.c
+++ b/src/pidgin-libnotify.c
@@ -264,6 +264,7 @@ notify (const gchar *title,
 	PurpleBuddyIcon *buddy_icon;
 	gchar *tr_body;
 	PurpleContact *contact;
+	GList *caps;
 
 	contact = purple_buddy_get_contact (buddy);
 
@@ -318,7 +319,11 @@ notify (const gchar *title,
 
 	notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL);
 
-	notify_notification_add_action (notification, "show", _("Show"), action_cb, NULL, NULL);
+	caps = notify_get_server_caps ();
+	if (g_list_find_custom (caps, "actions", (GCompareFunc)g_strcmp0)) {
+		notify_notification_add_action (notification, "show", _("Show"), action_cb, NULL, NULL);
+	}
+	g_list_free_full (caps, g_free);
 
 	if (!notify_notification_show (notification, NULL)) {
 		purple_debug_error (PLUGIN_ID, "notify(), failed to send notification\n");
-- 

Reply via email to