Skip to content

Commit

Permalink
gs-plugin-apk: adapt to new launch async API
Browse files Browse the repository at this point in the history
We stop using "has_management_plugin", since it was remove upstream
for packagekit and ostree. Basically since it would be nuts to have
this plugin installed alonside any other of those.
  • Loading branch information
pabloyoyoista committed Aug 28, 2024
1 parent b571483 commit 800688e
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions src/gs-plugin-apk/gs-plugin-apk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,11 +1077,20 @@ apk_polkit_get_packages_details_cb (GObject *object_source,
g_task_return_boolean (task, TRUE);
}

static gboolean
gs_plugin_apk_launch_finish (GsPlugin *plugin,
GAsyncResult *result,
GError **error)
{
return gs_plugin_app_launch_filtered_finish (plugin, result, error);
}

static gboolean
gs_plugin_apk_filter_desktop_file_cb (GsPlugin *plugin,
GsApp *app,
const gchar *filename,
GKeyFile *key_file)
GKeyFile *key_file,
gpointer user_data)
{
return strstr (filename, "/snapd/") == NULL &&
strstr (filename, "/snap/") == NULL &&
Expand All @@ -1091,17 +1100,16 @@ gs_plugin_apk_filter_desktop_file_cb (GsPlugin *plugin,
!g_key_file_has_key (key_file, "Desktop Entry", "X-SnapInstanceName", NULL);
}

gboolean
gs_plugin_launch (GsPlugin *plugin,
GsApp *app,
GCancellable *cancellable,
GError **error)
{
/* only process this app if was created by this plugin */
if (!gs_app_has_management_plugin (app, plugin))
return TRUE;
static void
gs_plugin_apk_launch_async (GsPlugin *plugin,
GsApp *app,
GsPluginLaunchFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)

return gs_plugin_app_launch_filtered (plugin, app, gs_plugin_apk_filter_desktop_file_cb, NULL, error);
{
gs_plugin_app_launch_filtered_async (plugin, app, flags, gs_plugin_apk_filter_desktop_file_cb, NULL, cancellable, callback, user_data);
}

gboolean
Expand Down Expand Up @@ -1385,6 +1393,8 @@ gs_plugin_apk_class_init (GsPluginApkClass *klass)
plugin_class->remove_repository_finish = gs_plugin_apk_remove_repository_finish;
plugin_class->update_apps_async = gs_plugin_apk_update_apps_async;
plugin_class->update_apps_finish = gs_plugin_apk_update_apps_finish;
plugin_class->launch_async = gs_plugin_apk_launch_async;
plugin_class->launch_finish = gs_plugin_apk_launch_finish;
}

GType
Expand Down

0 comments on commit 800688e

Please sign in to comment.