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 784053 - Allow to register on the system bus
Allow to register on the system bus
Status: RESOLVED DUPLICATE of bug 765545
Product: glib
Classification: Platform
Component: gapplication
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2017-06-21 17:22 UTC by Ignacio Casal Quinteiro (nacho)
Modified: 2017-06-21 18:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
rename (9.09 KB, patch)
2017-06-21 17:23 UTC, Ignacio Casal Quinteiro (nacho)
none Details | Review
flag (2.31 KB, patch)
2017-06-21 17:24 UTC, Ignacio Casal Quinteiro (nacho)
none Details | Review

Description Ignacio Casal Quinteiro (nacho) 2017-06-21 17:22:53 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)
Comment 1 Ignacio Casal Quinteiro (nacho) 2017-06-21 17:23:40 UTC
Created attachment 354189 [details] [review]
rename

Patch renaming internal variable
Comment 2 Ignacio Casal Quinteiro (nacho) 2017-06-21 17:24:07 UTC
Created attachment 354190 [details] [review]
flag

Patch adding the flag to Gapplication
Comment 3 Emmanuele Bassi (:ebassi) 2017-06-21 17:32:57 UTC
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.
Comment 4 Emmanuele Bassi (:ebassi) 2017-06-21 18:02:24 UTC
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 ***