From 77882f0ebb0ce91db8ab9ef70d651ee3c872d49d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Correa=20G=C3=B3mez?= Date: Mon, 14 Nov 2022 19:54:55 +0100 Subject: [PATCH] gs-plugin-apk: port launching apps to GS43 The code is directly copied from the packagekit plugin and is quite an usability improvement --- src/gs-plugin-apk/gs-plugin-apk.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gs-plugin-apk/gs-plugin-apk.c b/src/gs-plugin-apk/gs-plugin-apk.c index 4eb2abe..f98f0f4 100644 --- a/src/gs-plugin-apk/gs-plugin-apk.c +++ b/src/gs-plugin-apk/gs-plugin-apk.c @@ -1017,6 +1017,20 @@ apk_polkit_get_packages_details_cb (GObject *object_source, g_task_return_boolean (task, TRUE); } +static gboolean +gs_plugin_apk_filter_desktop_file_cb (GsPlugin *plugin, + GsApp *app, + const gchar *filename, + GKeyFile *key_file) +{ + return strstr (filename, "/snapd/") == NULL && + strstr (filename, "/snap/") == NULL && + strstr (filename, "/flatpak/") == NULL && + g_key_file_has_group (key_file, "Desktop Entry") && + !g_key_file_has_key (key_file, "Desktop Entry", "X-Flatpak", NULL) && + !g_key_file_has_key (key_file, "Desktop Entry", "X-SnapInstanceName", NULL); +} + gboolean gs_plugin_launch (GsPlugin *plugin, GsApp *app, @@ -1027,7 +1041,7 @@ gs_plugin_launch (GsPlugin *plugin, if (!gs_app_has_management_plugin (app, plugin)) return TRUE; - return gs_plugin_app_launch (plugin, app, error); + return gs_plugin_app_launch_filtered (plugin, app, gs_plugin_apk_filter_desktop_file_cb, NULL, error); } gboolean