diff options
author | Jasper St. Pierre <jstpierre@mecheye.net> | 2013-09-26 17:19:21 -0400 |
---|---|---|
committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2013-10-02 18:22:28 -0400 |
commit | 45797a977bc57b0f01e398204bb530ee93f0f94e (patch) | |
tree | eef74c5ba1cb4979c3aa2ae472a371b66d00e588 | |
parent | 884b94233e92914b4a1c4b1cf936854ded7f4b75 (diff) | |
download | gnome-shell-wip/desktop-file-index.tar.gz |
app-system: Add back StartupWMClass matchingwip/desktop-file-index
While unfortunate that we still have to scan all apps with get_all(),
support for this feature will be short-lived, so hopefully we can drop
it in the future as new apps adapt to the desktop file / app ID
recommendations.
For now, simply scan all desktop IDs.
-rw-r--r-- | src/shell-app-system.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/shell-app-system.c b/src/shell-app-system.c index 291d3ceca..2fa971da4 100644 --- a/src/shell-app-system.c +++ b/src/shell-app-system.c @@ -72,11 +72,36 @@ static void shell_app_system_class_init(ShellAppSystemClass *klass) } static void +scan_startup_wm_class_to_id (ShellAppSystem *self) +{ + ShellAppSystemPrivate *priv = self->priv; + GList *apps, *l; + + g_hash_table_remove_all (priv->startup_wm_class_to_id); + + apps = g_app_info_get_all (); + for (l = apps; l != NULL; l = l->next) + { + GAppInfo *info = l->data; + const char *startup_wm_class, *id; + + id = g_app_info_get_id (info); + startup_wm_class = g_desktop_app_info_get_startup_wm_class (G_DESKTOP_APP_INFO (info)); + if (startup_wm_class != NULL) + g_hash_table_insert (priv->startup_wm_class_to_id, (char *) startup_wm_class, (char *) id); + } + + g_list_free_full (apps, g_object_unref); +} + +static void installed_changed (GAppInfoMonitor *monitor, gpointer user_data) { ShellAppSystem *self = user_data; + scan_startup_wm_class_to_id (self); + g_signal_emit (self, signals[INSTALLED_CHANGED], 0, NULL); } |