summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2013-05-09 09:30:38 -0400
committerRyan Lortie <desrt@desrt.ca>2013-06-05 12:50:50 -0400
commit7baea0aee559c70139e03421487d5aa213a547c0 (patch)
treefa5d869ffdd86c05cc7ba824ad151a75a8b922e1
parent25d6560588bee636466ad62127f306a5d68bb872 (diff)
downloadglib-7baea0aee559c70139e03421487d5aa213a547c0.tar.gz
glib-7baea0aee559c70139e03421487d5aa213a547c0.tar.bz2
glib-7baea0aee559c70139e03421487d5aa213a547c0.zip
GApplication: set prgname to appid for services
Since services are based on D-Bus activation and desktop files are supposed to be named like the busname for DBusActivatable applications and since gnome-shell wants wmclass equal to the desktop file name, we therefore want wmclass equal to the application ID in this case. wmclass is determined from the prgname, which is otherwise pretty pointless to set to some random thing in $(libexec) for a D-Bus service, so set that to the appid. This means that for D-Bus services, the following things are now all the same: - application ID - prgname - wmclass property set on all windows - desktop file name - well-known bus name There are not many applications running as D-Bus services at present so this shouldn't impact anybody except for gnome-clocks (where this change will be fixing a bug) and gnome-terminal. https://bugzilla.gnome.org/show_bug.cgi?id=699259
-rw-r--r--gio/gapplication.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/gio/gapplication.c b/gio/gapplication.c
index 638bb31c8..5218348c9 100644
--- a/gio/gapplication.c
+++ b/gio/gapplication.c
@@ -1539,6 +1539,13 @@ g_application_open (GApplication *application,
* except in the case that g_application_set_inactivity_timeout() is in
* use.
*
+ * This function sets the prgname (g_set_prgname()), if not already set,
+ * to the basename of argv[0]. Since 2.38, if %G_APPLICATION_IS_SERVICE
+ * is specified, the prgname is set to the application ID. The main
+ * impact of this is is that the wmclass of windows created by Gtk+ will
+ * be set accordingly, which helps the window manager determine which
+ * application is showing the window.
+ *
* Returns: the exit status
*
* Since: 2.28
@@ -1561,13 +1568,20 @@ g_application_run (GApplication *application,
arguments[i] = g_strdup (argv[i]);
arguments[i] = NULL;
- if (g_get_prgname () == NULL && argc > 0)
+ if (g_get_prgname () == NULL)
{
- gchar *prgname;
+ if (application->priv->flags & G_APPLICATION_IS_SERVICE)
+ {
+ g_set_prgname (application->priv->id);
+ }
+ else if (argc > 0)
+ {
+ gchar *prgname;
- prgname = g_path_get_basename (argv[0]);
- g_set_prgname (prgname);
- g_free (prgname);
+ prgname = g_path_get_basename (argv[0]);
+ g_set_prgname (prgname);
+ g_free (prgname);
+ }
}
if (!G_APPLICATION_GET_CLASS (application)