[gnome-shell] ShellWindowTracker: support looking apps from GApplication IDs
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] ShellWindowTracker: support looking apps from GApplication IDs
- Date: Sun, 18 Aug 2013 20:08:37 +0000 (UTC)
commit 4a3f020cd91eccb23f9c8a3bfc8e7b31fbe90760
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sun Aug 18 18:41:22 2013 +0200
ShellWindowTracker: support looking apps from GApplication IDs
In the new application model, there is one ID shared by GApplication,
DBus and .desktop files, so we can use that for the association,
instead of fiddling with badly cased wm classes.
https://bugzilla.gnome.org/show_bug.cgi?id=706252
src/shell-window-tracker.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/shell-window-tracker.c b/src/shell-window-tracker.c
index e922cdd..b686893 100644
--- a/src/shell-window-tracker.c
+++ b/src/shell-window-tracker.c
@@ -258,6 +258,27 @@ get_app_from_window_wmclass (MetaWindow *window)
return NULL;
}
+static ShellApp *
+get_app_from_gapplication_id (MetaWindow *window)
+{
+ ShellApp *app;
+ ShellAppSystem *appsys;
+ const char *id;
+ char *desktop_file;
+
+ appsys = shell_app_system_get_default ();
+
+ id = meta_window_get_gtk_application_id (window);
+ if (!id)
+ return FALSE;
+
+ desktop_file = g_strconcat (id, ".desktop", NULL);
+ app = shell_app_system_lookup_app (appsys, desktop_file);
+
+ g_free (desktop_file);
+ return app;
+}
+
/**
* get_app_from_window_group:
* @monitor: a #ShellWindowTracker
@@ -374,6 +395,13 @@ get_app_for_window (ShellWindowTracker *tracker,
if (meta_window_is_remote (window))
return _shell_app_new_for_window (window);
+ /* Check if the window has a GApplication ID attached; this is
+ * canonical if it does
+ */
+ result = get_app_from_gapplication_id (window);
+ if (result != NULL)
+ return result;
+
/* Check if the app's WM_CLASS specifies an app; this is
* canonical if it does.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]