GNOME Bugzilla – Bug 784053
Allow to register on the system bus
Last modified: 2017-06-21 18:02:24 UTC
Following up I will attach a couple of patches to allow passing in a new flag to GApplication in order to register on the system bus instead of the session one. A possible use case for this is in order to create a daemon like application using GApplication instead of having to create something custom. Even if not all GApplication features are useful in the context of a daemon there are others that are still interesting: - Have a base class `GApplication` shared among different libraries - Single instance support - Allow to handle command line options - Allow to register a custom interface on the dbus connection - Mainloop integration with the application life cycle (g_application_hold/release)
Created attachment 354189 [details] [review] rename Patch renaming internal variable
Created attachment 354190 [details] [review] flag Patch adding the flag to Gapplication
I think we already resisted something like that — at least, I remember various discussions with Allison about it on IRC and mailing lists — in favour of just telling people to use g_bus_own_name(). What happens if you attempt to use GNotification on a GApplication on the system bus? At least, GtkApplication would have to check if the flags passed include the "use the system bus please" and abort; and GApplication would have to avoid a lot of work done on connecting to session services. Personally, I'm -1 on this. GApplication is clearly geared towards user applications, not random system daemons. We have far too many hooks into session interfaces and services, and far too many API that are geared towards that use; on top of that, we have GtkApplication and desktop services.
Ah, I remember correctly that there was a bug about it already. :-)Thanks for taking the time to report this. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of bug 765545 ***