GNOME Bugzilla – Bug 608086
wrong return value of notify_init()
Last modified: 2010-06-26 23:33:46 UTC
Created attachment 152261 [details] [review] patch notify_init from http://trac.galago-project.org/ticket/184 "/usr/include/libnotify/notify.h says: <-- snip --> ... * @return TRUE if the library initialized properly and a connection to a * notification server was made. */ gboolean notify_init(const char *app_name); ... <-- snip --> Different from the documentation, notify_init() returns TRUE when no notification server is available at all (which also implies that no connection could be made to a notification server). In Liferea 1.5.12 we have the problem that due to this bug notify_get_server_caps() generates "libnotify-Message: GetCapabilities call failed: The name org.freedesktop.Notifications was not provided by any .service files" messages. 03/06/09 14:08:58: Modified by Adrian Bunk My patch does not fully address the problem (it does not try to make a connection), but it checks whether a notification server is available at all, and returns FALSE if there isn't one (this would at least be enough for Liferea). Someone who knows all the notification stuff can most likely make a better patch. 03/08/09 04:03:18: Modified by Adrian Bunk * attachment patch-notify_init added. 03/08/09 04:09:09: Modified by Adrian Bunk This new patch might be the correct solution: Make a GetCapabilities? at the end of notify_init(), and if it fails call notify_uninit() and return FALSE. Note that we must not print any message here, since depending on the caller a failed notify_init() could either be fatal or no big problem. The latter is e.g. true for Liferea, where it is optional functionality, and it's perfectly fine for a user to install a distribution package of Liferea with libnotify support without having a notification-daemon running. 03/08/09 04:38:50: Modified by Adrian Bunk * patch_included set to 1. "
Don't think it is a good idea to make a synchronous dbus call in notify_init(). Also, the fix for bug 610880 means this bug shouldn't be fixed. I've changed the comment in the header file instead. commit 560aaaadd1583c1c421553b56f31e677e118f7a2 Author: William Jon McCann <jmccann@redhat.com> Date: Wed Jun 23 19:55:09 2010 -0400 Don't claim that notify_init connects to the server https://bugzilla.gnome.org/show_bug.cgi?id=608086
This does not address my actual problem. How can I check at the libnotify API level if a notification server is running?
I'm not sure what you are trying to do. But perhaps using notify_get_server_caps (void); to make a round trip to the server?
(In reply to comment #3) > I'm not sure what you are trying to do. I said in my bug report: In Liferea 1.5.12 we have the problem that due to this bug notify_get_server_caps() generates "libnotify-Message: GetCapabilities call failed: The name org.freedesktop.Notifications was not provided by any .service files" messages. > But perhaps using > notify_get_server_caps (void); to make a round trip to the server? That runs into exactly the message I want to avoid...
Besides the warning message what is the issue? That is the message I'd expect to see when you don't have a daemon that is configured to activate on demand for that D-Bus interface.
(In reply to comment #5) > Besides the warning message what is the issue? That is the message I'd expect > to see when you don't have a daemon that is configured to activate on demand > for that D-Bus interface. The warning message is the issue. Distributions compile liferea with libnotify support enabled. The user might or might not have a notification server installed. Not having a notification server installed is a perfectly fine situation in this case, and printing a scary warning message for a perfectly fine situation isn't right. Whether a missing notification server is a problem or perfectly fine is nothing that can be decided inside libnotify. I'm not insisting on the solution from my patch, but I really want some way to check for the presence of a notification server without getting any warning message printed, and without manually doing dbus calls.
Oh so you just want to patch out the g_message? That's fine.
Removed in master.