From 72ec8963d7df0e39f688838e42445c869e4875c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Thu, 2 Aug 2018 11:03:41 +0200 Subject: [PATCH 1/4] gdk: Use application_id as xdg_shell's app_id if available This (manually) reverts commit e1fd87728dd841cf1d71025983107765e395b152 This makes sure xdg_shell's app_id matches the DBus name of the the appliation when using GtkApplication. It also allows the compositor to derive the desktop file ID from the app_id: https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml?id=298d888ac718eae57ff2245d373d4327074506ea#n598 Closes #653 --- gdk/wayland/gdksurface-wayland.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 51eca561df1..af5881007d9 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -1515,7 +1515,9 @@ gdk_wayland_surface_create_xdg_toplevel (GdkSurface *surface) impl->initial_fullscreen_output = NULL; - app_id = g_get_prgname (); + app_id = impl->application.application_id; + if (app_id == NULL) + app_id = g_get_prgname (); if (app_id == NULL) app_id = "GTK+ Application"; -- GitLab From f25f3b3c47db97686f7ad396f16ad7d4976f089f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Thu, 2 Aug 2018 11:03:41 +0200 Subject: [PATCH 2/4] docs: Explain desktop file id == application_id in migration guide --- docs/reference/gtk/migrating-3to4.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/reference/gtk/migrating-3to4.xml b/docs/reference/gtk/migrating-3to4.xml index cd113bb79b0..6532974d3c1 100644 --- a/docs/reference/gtk/migrating-3to4.xml +++ b/docs/reference/gtk/migrating-3to4.xml @@ -177,6 +177,22 @@ +
+ Set a proper app_id + + In GTK+4 we want the application's #GApplication + 'application-id' (and therefore the D-Bus name), the desktop + file basename and Wayland's xdg-shell app_id to match. In + order to achieve this with GTK+3 call g_set_prgname() with the same + application id you passed to #GtkApplication. Rename your + desktop files to match the application id if needed. + + + The call to g_set_prgname() can be removed once you fully migrated + to GTK+4. + +
+
-- GitLab From 06e4c3c9913884331be01de848837c13f015de33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Thu, 2 Aug 2018 11:03:41 +0200 Subject: [PATCH 3/4] examples: Use appliction id as desktop file base name --- docs/reference/gtk/getting_started.xml | 2 +- examples/application1/README | 4 ++-- .../{exampleapp.desktop => org.gtk.exampleapp.desktop} | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename examples/application1/{exampleapp.desktop => org.gtk.exampleapp.desktop} (100%) diff --git a/docs/reference/gtk/getting_started.xml b/docs/reference/gtk/getting_started.xml index 036b9f471cf..18085134196 100644 --- a/docs/reference/gtk/getting_started.xml +++ b/docs/reference/gtk/getting_started.xml @@ -388,7 +388,7 @@ - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT Note that @bindir@ needs to be replaced diff --git a/examples/application1/README b/examples/application1/README index 4c4e75c4d9f..739ecd967d5 100644 --- a/examples/application1/README +++ b/examples/application1/README @@ -2,8 +2,8 @@ To make gnome-shell use the desktop file and icon for this example while running it uninstalled, do the following: mkdir -p ~/.local/share/applications -sed -e "s#@bindir@#$PWD#" exampleapp.desktop \ - > ~/.local/share/applications/lt-exampleapp.desktop +sed -e "s#@bindir@#$PWD#" org.gtk.exampleapp.desktop \ + > ~/.local/share/applications/org.gtk.exampleapp.desktop mkdir -p ~/.local/share/icons/hicolor/48x48/apps cp exampleapp.png ~/.local/share/icons/hicolor/48x48/apps diff --git a/examples/application1/exampleapp.desktop b/examples/application1/org.gtk.exampleapp.desktop similarity index 100% rename from examples/application1/exampleapp.desktop rename to examples/application1/org.gtk.exampleapp.desktop -- GitLab From 8fb8303ba0d70355a1af515a8f3100cbf2e496e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Thu, 2 Aug 2018 11:03:41 +0200 Subject: [PATCH 4/4] demos: Make desktop file names match the application id --- build-aux/flatpak/org.gtk.Demo.json | 1 - build-aux/flatpak/org.gtk.WidgetFactory.json | 1 - demos/gtk-demo/meson.build | 2 +- demos/gtk-demo/{gtk4-demo.desktop => org.gtk.Demo.desktop} | 0 demos/icon-browser/meson.build | 2 +- .../{gtk4-icon-browser.desktop => org.gtk.IconBrowser.desktop} | 0 demos/widget-factory/meson.build | 2 +- ...tk4-widget-factory.desktop => org.gtk.WidgetFactory.desktop} | 0 8 files changed, 3 insertions(+), 5 deletions(-) rename demos/gtk-demo/{gtk4-demo.desktop => org.gtk.Demo.desktop} (100%) rename demos/icon-browser/{gtk4-icon-browser.desktop => org.gtk.IconBrowser.desktop} (100%) rename demos/widget-factory/{gtk4-widget-factory.desktop => org.gtk.WidgetFactory.desktop} (100%) diff --git a/build-aux/flatpak/org.gtk.Demo.json b/build-aux/flatpak/org.gtk.Demo.json index a0c50855911..ca655a7bd65 100644 --- a/build-aux/flatpak/org.gtk.Demo.json +++ b/build-aux/flatpak/org.gtk.Demo.json @@ -5,7 +5,6 @@ "sdk": "org.gnome.Sdk", "command": "gtk4-demo", "tags": ["devel", "development", "nightly"], - "rename-desktop-file": "gtk4-demo.desktop", "rename-icon": "gtk4-demo", "desktop-file-name-prefix": "(Development) ", "finish-args": [ diff --git a/build-aux/flatpak/org.gtk.WidgetFactory.json b/build-aux/flatpak/org.gtk.WidgetFactory.json index c28acf426e4..ea6aaa99383 100644 --- a/build-aux/flatpak/org.gtk.WidgetFactory.json +++ b/build-aux/flatpak/org.gtk.WidgetFactory.json @@ -5,7 +5,6 @@ "sdk": "org.gnome.Sdk", "command": "gtk4-widget-factory", "tags": ["devel", "development", "nightly"], - "rename-desktop-file": "gtk4-widget-factory.desktop", "rename-icon": "gtk4-widget-factory", "desktop-file-name-prefix": "(Development) ", "finish-args": [ diff --git a/demos/gtk-demo/meson.build b/demos/gtk-demo/meson.build index e626fae503f..93c2902575c 100644 --- a/demos/gtk-demo/meson.build +++ b/demos/gtk-demo/meson.build @@ -129,7 +129,7 @@ foreach icon_size: [ '16x16', '22x22', '24x24', '32x32', '48x48', '256x256', ] endforeach # desktop file -install_data('gtk4-demo.desktop', install_dir: gtk_applicationsdir) +install_data('org.gtk.Demo.desktop', install_dir: gtk_applicationsdir) # GSettings install_data('org.gtk.Demo.gschema.xml', install_dir: gtk_schemasdir) diff --git a/demos/gtk-demo/gtk4-demo.desktop b/demos/gtk-demo/org.gtk.Demo.desktop similarity index 100% rename from demos/gtk-demo/gtk4-demo.desktop rename to demos/gtk-demo/org.gtk.Demo.desktop diff --git a/demos/icon-browser/meson.build b/demos/icon-browser/meson.build index 95b1c0f4e41..fcaca82d8d3 100644 --- a/demos/icon-browser/meson.build +++ b/demos/icon-browser/meson.build @@ -17,4 +17,4 @@ executable('gtk4-icon-browser', link_args: extra_demo_ldflags, install: true) -install_data('gtk4-icon-browser.desktop', install_dir: gtk_applicationsdir) +install_data('org.gtk.IconBrowser.desktop', install_dir: gtk_applicationsdir) diff --git a/demos/icon-browser/gtk4-icon-browser.desktop b/demos/icon-browser/org.gtk.IconBrowser.desktop similarity index 100% rename from demos/icon-browser/gtk4-icon-browser.desktop rename to demos/icon-browser/org.gtk.IconBrowser.desktop diff --git a/demos/widget-factory/meson.build b/demos/widget-factory/meson.build index 2050d2e7507..be7b5db57a2 100644 --- a/demos/widget-factory/meson.build +++ b/demos/widget-factory/meson.build @@ -13,7 +13,7 @@ executable('gtk4-widget-factory', install: true) # desktop file -install_data('gtk4-widget-factory.desktop', install_dir: gtk_applicationsdir) +install_data('org.gtk.WidgetFactory.desktop', install_dir: gtk_applicationsdir) # icons icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor') diff --git a/demos/widget-factory/gtk4-widget-factory.desktop b/demos/widget-factory/org.gtk.WidgetFactory.desktop similarity index 100% rename from demos/widget-factory/gtk4-widget-factory.desktop rename to demos/widget-factory/org.gtk.WidgetFactory.desktop -- GitLab