GNOME Bugzilla – Bug 584857
[patch] support notification deamon without actions capabilities
Last modified: 2009-06-10 18:05:23 UTC
Following http://www.galago-project.org/specs/notification/0.9/x408.html#command-get-capabilities the support of capability "actions" for notification daemon is not mandatory. Ubuntu has a patch for bluez-gnome that I updated for gnome-bluetooth. I attach it now.
Created attachment 135973 [details] [review] patch the patch is against latest tarball, but seems to apply cleanly.
Comment on attachment 135973 [details] [review] patch ># patch for notification daemons that doesn't handle action capabilities ># From Cody Russell <crussell@canonical.com> ># Updated for gnome-bluetooth by Baptiste Mille-Mathias <baptiste.millemathias@gmail.com> ># >diff -Nur -x '*.orig' -x '*~' gnome-bluetooth-2.27.5/applet/agent.c gnome-bluetooth-2.27.5.new/applet/agent.c >--- gnome-bluetooth-2.27.5/applet/agent.c 2009-04-17 14:39:23.000000000 +0200 >+++ gnome-bluetooth-2.27.5.new/applet/agent.c 2009-06-02 22:56:21.000000000 +0200 >@@ -259,7 +259,10 @@ > gtk_window_set_title(GTK_WINDOW(dialog), _("Authentication request")); > gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); > gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); >- gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE); >+ if (supports_actions ()) if (notification_supports_actions () != FALSE) >+ gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE); >+ else >+ gtk_window_set_focus_on_map(GTK_WINDOW(dialog), FALSE); Use tabs, not 4 spaces. >-static void notification_closed(GObject *object, gpointer user_data) >+static void present_notification_dialogs () static void present_notification_dialogs (void) >+gboolean >+supports_actions () >+{ I've seen this cut'n'pasted in a gazillion apps. Can't we have it added to libnotify instead? <snip> >+ 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); >+ } Use g_list_find_custom().
Created attachment 136167 [details] [review] support notification deamon without actions capabilities
I think the patch just attached address the problems you reported. a ticket was opened for adding check server capabilities -> http://trac.galago-project.org/ticket/188
Comment on attachment 136167 [details] [review] support notification deamon without actions capabilities <snip> >+gboolean notification_supports_actions (void) >+{ >+ gboolean supports_actions = FALSE; >+ GList *caps = NULL; >+ >+ caps = notify_get_server_caps (); >+ if (g_list_find_custom(caps, "actions", strcmp) != NULL) Use g_strcmp0 instead of strcmp, so we can avoid crashing if anything is NULL in the list. >+gboolean notification_supports_actions(); Prototype doesn't match function (hint: void)
Created attachment 136169 [details] [review] support notification deamon without actions capabilities
New patch attach, I didn't check for NULLity because I've been said it wasn't needed :)
Fix this warning: notify.c: In function ‘notification_supports_actions’: notify.c:50: warning: passing argument 3 of ‘g_list_find_custom’ from incompatible pointer type And it's ready to be committed for me.
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.