[Development] QFreedesktopApplication

Thiago Macieira thiago.macieira at intel.com
Sun Apr 24 16:53:49 CEST 2022

On Saturday, 23 April 2022 23:05:58 PDT Ilya Fedin wrote:
> Hello, I was asked to write here about QFreedesktopApplication[1]. My main
> intention was to get nice GApplication APIs that implement a number of XDG
> standarts to be accessble by Qt applications. The main thing is running the
> GApplication instance, although I made a number of wrapping APIs to use
> org.freedesktop.Application-related APIs without linking to glib for the
> application. Handlers for GApplication constructor/destructor,
> org.freedesktop.Application handlers, the control of command line
> processing by GApplication including its option parser and single instance.
> I also made integration with startup notifications and it's possible to add
> XDG activation token integration. What is not covered by these wrappers,
> but still interesting is
> g_application_send_notification/g_application_withdraw_notification, so one
> can easily send notification using
> org.freedesktop.Notifications/org.freedesktop.portal.Notification/org.gtk.N
> otifications without implementing all the APIs by hand. And, moreover,
> GNotification is integrated with GApplication/org.freedesktop.Application
> and can use its actions. 
> [1] https://codereview.qt-project.org/c/qt/qtbase/+/407263

Hello Ilya

Please explain why we need this API in the first place. If an application 
requires a Qt event loop that links to GLib and use GMainLoop, then they can 
easily link to glib directly themselves and access GApplication. So why isn't 
this an option?

Is it because it's not a nice, Qt-ish C++ API? Would creating a library that 
wraps this and a few other GLib APIs solve this problem?

Or does it need access to internals in Qt? If so, what ones?  

Or, inversely, does Qt need to do something so GApplication is accessible? 
There's no match to "GApplication" in qtbase today. Would adding this code 
without a front-end API suffice?

Have you investigated what happens to existing Qt + GLib hybrid applications 
when your code gets added?

On another note, just what is org.freedesktop.Application? There are ZERO 
references to it on freedesktop.org. If this isn't well-defined, should we 
adventure into it? If this is a D-Bus API, then the questions above about 
accessing the interface and implementing the server side of it apply: can we 
have it without a front-end API?

In fact, if it is a D-Bus API, should we have it even if the GLib event 
dispatchers aren't active?

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering

More information about the Development mailing list