After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 584857 - [patch] support notification deamon without actions capabilities
[patch] support notification deamon without actions capabilities
Status: RESOLVED FIXED
Product: gnome-bluetooth
Classification: Core
Component: general
2.27.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-bluetooth-general-maint@gnome.bugs
gnome-bluetooth-general-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2009-06-04 19:17 UTC by Baptiste Mille-Mathias
Modified: 2009-06-10 18:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (4.84 KB, patch)
2009-06-04 19:20 UTC, Baptiste Mille-Mathias
none Details | Review
support notification deamon without actions capabilities (5.09 KB, patch)
2009-06-08 20:28 UTC, Baptiste Mille-Mathias
none Details | Review
support notification deamon without actions capabilities (5.10 KB, patch)
2009-06-08 21:01 UTC, Baptiste Mille-Mathias
committed Details | Review

Description Baptiste Mille-Mathias 2009-06-04 19:17:32 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.
Comment 1 Baptiste Mille-Mathias 2009-06-04 19:20:36 UTC
Created attachment 135973 [details] [review]
patch

the patch is against latest tarball, but seems to apply cleanly.
Comment 2 Bastien Nocera 2009-06-04 23:12:36 UTC
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().
Comment 3 Baptiste Mille-Mathias 2009-06-08 20:28:33 UTC
Created attachment 136167 [details] [review]
support notification deamon without actions capabilities
Comment 4 Baptiste Mille-Mathias 2009-06-08 20:32:53 UTC
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 5 Bastien Nocera 2009-06-08 20:37:39 UTC
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)
Comment 6 Baptiste Mille-Mathias 2009-06-08 21:01:18 UTC
Created attachment 136169 [details] [review]
support notification deamon without actions capabilities
Comment 7 Baptiste Mille-Mathias 2009-06-08 21:02:25 UTC
New patch attach, I didn't check for NULLity because I've been said it wasn't needed :)
Comment 8 Bastien Nocera 2009-06-09 20:28:15 UTC
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.
Comment 9 Baptiste Mille-Mathias 2009-06-10 16:46:19 UTC
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.