Skip to content

Commit

Permalink
gs-plugin-apk: reorder install and remove async functions
Browse files Browse the repository at this point in the history
Should better help understanding the logic, but no functional changes.
  • Loading branch information
pabloyoyoista committed Nov 11, 2022
1 parent 62a56fd commit 93b75c6
Showing 1 changed file with 55 additions and 47 deletions.
102 changes: 55 additions & 47 deletions src/gs-plugin-apk/gs-plugin-apk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,61 @@ apk_polkit_add_repository_cb (GObject *object_source,
GAsyncResult *res,
gpointer user_data);

static void
gs_plugin_apk_repo_update_async (GsPlugin *plugin,
GsApp *repo,
gboolean is_install,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);

static gboolean
gs_plugin_apk_install_repository_finish (GsPlugin *plugin,
GAsyncResult *res,
GError **error)
{
return g_task_propagate_boolean (G_TASK (res), error);
}

static void
gs_plugin_apk_install_repository_async (GsPlugin *plugin,
GsApp *repo,
GsPluginManageRepositoryFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_assert (gs_app_get_kind (repo) == AS_COMPONENT_KIND_REPOSITORY);

gs_app_set_state (repo, GS_APP_STATE_INSTALLING);

gs_plugin_apk_repo_update_async (plugin, repo, TRUE, cancellable, callback, user_data);
}

static gboolean
gs_plugin_apk_remove_repository_finish (GsPlugin *plugin,
GAsyncResult *res,
GError **error)
{
return g_task_propagate_boolean (G_TASK (res), error);
}

static void
gs_plugin_apk_remove_repository_async (GsPlugin *plugin,
GsApp *repo,
GsPluginManageRepositoryFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)

{
g_assert (gs_app_get_kind (repo) == AS_COMPONENT_KIND_REPOSITORY);

gs_app_set_state (repo, GS_APP_STATE_REMOVING);

gs_plugin_apk_repo_update_async (plugin, repo, FALSE, cancellable, callback, user_data);
}

static void
gs_plugin_apk_repo_update_async (GsPlugin *plugin,
GsApp *repo,
Expand Down Expand Up @@ -1223,53 +1278,6 @@ apk_polkit_remove_repository_cb (GObject *object_source,
g_task_return_boolean (task, TRUE);
}

static gboolean
gs_plugin_apk_install_repository_finish (GsPlugin *plugin,
GAsyncResult *res,
GError **error)
{
return g_task_propagate_boolean (G_TASK (res), error);
}

static void
gs_plugin_apk_install_repository_async (GsPlugin *plugin,
GsApp *repo,
GsPluginManageRepositoryFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_assert (gs_app_get_kind (repo) == AS_COMPONENT_KIND_REPOSITORY);

gs_app_set_state (repo, GS_APP_STATE_INSTALLING);

gs_plugin_apk_repo_update_async (plugin, repo, TRUE, cancellable, callback, user_data);
}

static gboolean
gs_plugin_apk_remove_repository_finish (GsPlugin *plugin,
GAsyncResult *res,
GError **error)
{
return g_task_propagate_boolean (G_TASK (res), error);
}

static void
gs_plugin_apk_remove_repository_async (GsPlugin *plugin,
GsApp *repo,
GsPluginManageRepositoryFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)

{
g_assert (gs_app_get_kind (repo) == AS_COMPONENT_KIND_REPOSITORY);

gs_app_set_state (repo, GS_APP_STATE_REMOVING);

gs_plugin_apk_repo_update_async (plugin, repo, FALSE, cancellable, callback, user_data);
}

static void
gs_plugin_apk_class_init (GsPluginApkClass *klass)
{
Expand Down

0 comments on commit 93b75c6

Please sign in to comment.