[gnome-software] Add GsPluginAction and store the action for async actions
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add GsPluginAction and store the action for async actions
- Date: Wed, 7 Sep 2016 19:31:35 +0000 (UTC)
commit af30b7f5118514ef9a86658fe2917f5835c8721b
Author: Richard Hughes <richard hughsie com>
Date: Wed Sep 7 19:30:59 2016 +0100
Add GsPluginAction and store the action for async actions
src/gs-application.c | 2 +-
src/gs-auth-dialog.c | 6 ++--
src/gs-auth.h | 18 ---------
src/gs-cmd.c | 4 +-
src/gs-common.c | 8 ++--
src/gs-common.h | 2 +-
src/gs-page.c | 28 +++++++-------
src/gs-plugin-loader-sync.c | 6 ++--
src/gs-plugin-loader-sync.h | 6 ++--
src/gs-plugin-loader.c | 72 +++++++++++++++++++++++-------------
src/gs-plugin-loader.h | 44 ++--------------------
src/gs-plugin-private.h | 82 +++++++++++++++++++++++++++++++++++++++++
src/gs-plugin.c | 84 +++++++++++++++++++++++++++++++++++++++++++
src/gs-review-row.c | 26 +++++++-------
src/gs-review-row.h | 2 +-
src/gs-self-test.c | 35 ++++++++++--------
src/gs-shell-details.c | 26 +++++++-------
src/gs-shell-moderate.c | 10 +++---
src/gs-shell-updates.c | 10 +++---
src/gs-sources-dialog.c | 6 ++--
20 files changed, 307 insertions(+), 170 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 1333472..8e43970 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -428,7 +428,7 @@ reboot_failed_cb (GObject *source, GAsyncResult *res, gpointer user_data)
/* cancel trigger */
gs_plugin_loader_app_action_async (app->plugin_loader,
NULL, /* everything! */
- GS_PLUGIN_LOADER_ACTION_UPDATE_CANCEL,
+ GS_PLUGIN_ACTION_UPDATE_CANCEL,
app->cancellable,
cancel_trigger_failed_cb,
app);
diff --git a/src/gs-auth-dialog.c b/src/gs-auth-dialog.c
index eb6fb3c..21743da 100644
--- a/src/gs-auth-dialog.c
+++ b/src/gs-auth-dialog.c
@@ -159,16 +159,16 @@ gs_auth_dialog_authenticate_cb (GObject *source,
static void
gs_auth_dialog_continue_cb (GtkWidget *widget, GsAuthDialog *dialog)
{
- GsPluginLoaderAction action = GS_AUTH_ACTION_LOGIN;
+ GsPluginAction action = GS_PLUGIN_ACTION_AUTH_LOGIN;
gtk_widget_set_sensitive (dialog->box_dialog, FALSE);
gtk_widget_set_sensitive (dialog->button_continue, FALSE);
/* alternate actions */
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->radiobutton_lost_pwd)))
- action = GS_AUTH_ACTION_LOST_PASSWORD;
+ action = GS_PLUGIN_ACTION_AUTH_LOST_PASSWORD;
else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->radiobutton_register)))
- action = GS_AUTH_ACTION_REGISTER;
+ action = GS_PLUGIN_ACTION_AUTH_REGISTER;
gs_plugin_loader_auth_action_async (dialog->plugin_loader,
dialog->auth,
action,
diff --git a/src/gs-auth.h b/src/gs-auth.h
index 9f34e92..c9f572f 100644
--- a/src/gs-auth.h
+++ b/src/gs-auth.h
@@ -48,24 +48,6 @@ typedef enum {
} GsAuthFlags;
/**
- * GsAuthAction:
- * @GS_AUTH_ACTION_LOGIN: Login action
- * @GS_AUTH_ACTION_LOGOUT: Logout action
- * @GS_AUTH_ACTION_REGISTER: Register action
- * @GS_AUTH_ACTION_LOST_PASSWORD: Lost password action
- *
- * The actions that can be performed on an authentication.
- **/
-typedef enum {
- GS_AUTH_ACTION_LOGIN,
- GS_AUTH_ACTION_LOGOUT,
- GS_AUTH_ACTION_REGISTER,
- GS_AUTH_ACTION_LOST_PASSWORD,
- /*< private >*/
- GS_AUTH_ACTION_LAST
-} GsAuthAction;
-
-/**
* GsAuthStoreFlags:
* @GS_AUTH_STORE_FLAG_NONE: No special flags set
* @GS_AUTH_STORE_FLAG_USERNAME: Load or save the username
diff --git a/src/gs-cmd.c b/src/gs-cmd.c
index 7355ee9..439d812 100644
--- a/src/gs-cmd.c
+++ b/src/gs-cmd.c
@@ -317,7 +317,7 @@ main (int argc, char **argv)
gs_app_set_kind (app, AS_APP_KIND_OS_UPGRADE);
ret = gs_plugin_loader_app_action (plugin_loader,
app,
- GS_PLUGIN_LOADER_ACTION_UPGRADE_DOWNLOAD,
+ GS_PLUGIN_ACTION_UPGRADE_DOWNLOAD,
NULL,
&error);
if (ret)
@@ -339,7 +339,7 @@ main (int argc, char **argv)
for (i = 0; i < repeat; i++) {
ret = gs_plugin_loader_app_action (plugin_loader,
app,
- GS_PLUGIN_LOADER_ACTION_LAUNCH,
+ GS_PLUGIN_ACTION_LAUNCH,
NULL,
&error);
if (!ret)
diff --git a/src/gs-common.c b/src/gs-common.c
index 2bb225c..4cc2914 100644
--- a/src/gs-common.c
+++ b/src/gs-common.c
@@ -150,7 +150,7 @@ gs_app_notify_installed (GsApp *app)
void
gs_app_notify_failed_modal (GsApp *app,
GtkWindow *parent_window,
- GsPluginLoaderAction action,
+ GsPluginAction action,
const GError *error)
{
const gchar *title;
@@ -163,17 +163,17 @@ gs_app_notify_failed_modal (GsApp *app,
/* say what we tried to do */
msg = g_string_new ("");
switch (action) {
- case GS_PLUGIN_LOADER_ACTION_INSTALL:
+ case GS_PLUGIN_ACTION_INSTALL:
/* TRANSLATORS: this is when the install fails */
g_string_append_printf (msg, _("Installation of %s failed."),
gs_app_get_name (app));
break;
- case GS_PLUGIN_LOADER_ACTION_REMOVE:
+ case GS_PLUGIN_ACTION_REMOVE:
/* TRANSLATORS: this is when the remove fails */
g_string_append_printf (msg, _("Removal of %s failed."),
gs_app_get_name (app));
break;
- case GS_PLUGIN_LOADER_ACTION_UPGRADE_DOWNLOAD:
+ case GS_PLUGIN_ACTION_UPGRADE_DOWNLOAD:
{
g_autofree gchar *name_version = g_strdup_printf ("%s %s",
gs_app_get_name (app),
diff --git a/src/gs-common.h b/src/gs-common.h
index e7b4507..f31f0d9 100644
--- a/src/gs-common.h
+++ b/src/gs-common.h
@@ -38,7 +38,7 @@ void gs_grab_focus_when_mapped (GtkWidget *widget);
void gs_app_notify_installed (GsApp *app);
void gs_app_notify_failed_modal (GsApp *app,
GtkWindow *parent_window,
- GsPluginLoaderAction action,
+ GsPluginAction action,
const GError *error);
GtkResponseType
gs_app_notify_unavailable (GsApp *app,
diff --git a/src/gs-page.c b/src/gs-page.c
index 19e5f42..9a501b7 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -89,7 +89,7 @@ gs_page_install_authenticate_cb (GtkDialog *dialog,
}
gs_plugin_loader_app_action_async (priv->plugin_loader,
helper->app,
- GS_PLUGIN_LOADER_ACTION_INSTALL,
+ GS_PLUGIN_ACTION_INSTALL,
helper->cancellable,
gs_page_app_installed_cb,
helper);
@@ -116,7 +116,7 @@ gs_page_remove_authenticate_cb (GtkDialog *dialog,
}
gs_plugin_loader_app_action_async (priv->plugin_loader,
helper->app,
- GS_PLUGIN_LOADER_ACTION_REMOVE,
+ GS_PLUGIN_ACTION_REMOVE,
helper->cancellable,
gs_page_app_removed_cb,
helper);
@@ -171,7 +171,7 @@ gs_page_app_installed_cb (GObject *source,
error->message);
gs_app_notify_failed_modal (helper->app,
gs_shell_get_window (priv->shell),
- GS_PLUGIN_LOADER_ACTION_INSTALL,
+ GS_PLUGIN_ACTION_INSTALL,
error);
return;
}
@@ -184,7 +184,7 @@ gs_page_app_installed_cb (GObject *source,
last_error->message);
gs_app_notify_failed_modal (helper->app,
gs_shell_get_window (priv->shell),
- GS_PLUGIN_LOADER_ACTION_INSTALL,
+ GS_PLUGIN_ACTION_INSTALL,
last_error);
return;
}
@@ -245,7 +245,7 @@ gs_page_app_removed_cb (GObject *source,
g_warning ("failed to remove: %s", error->message);
gs_app_notify_failed_modal (helper->app,
gs_shell_get_window (priv->shell),
- GS_PLUGIN_LOADER_ACTION_REMOVE,
+ GS_PLUGIN_ACTION_REMOVE,
error);
return;
}
@@ -258,7 +258,7 @@ gs_page_app_removed_cb (GObject *source,
last_error->message);
gs_app_notify_failed_modal (helper->app,
gs_shell_get_window (priv->shell),
- GS_PLUGIN_LOADER_ACTION_REMOVE,
+ GS_PLUGIN_ACTION_REMOVE,
last_error);
return;
}
@@ -319,7 +319,7 @@ gs_page_install_app (GsPage *page, GsApp *app, GCancellable *cancellable)
helper->cancellable = g_object_ref (cancellable);
gs_plugin_loader_app_action_async (priv->plugin_loader,
app,
- GS_PLUGIN_LOADER_ACTION_INSTALL,
+ GS_PLUGIN_ACTION_INSTALL,
helper->cancellable,
gs_page_app_installed_cb,
helper);
@@ -343,7 +343,7 @@ gs_page_update_app_response_cb (GtkDialog *dialog,
g_debug ("update %s", gs_app_get_id (helper->app));
gs_plugin_loader_app_action_async (priv->plugin_loader,
helper->app,
- GS_PLUGIN_LOADER_ACTION_UPDATE,
+ GS_PLUGIN_ACTION_UPDATE,
helper->cancellable,
gs_page_app_installed_cb,
helper);
@@ -437,7 +437,7 @@ gs_page_update_app (GsPage *page, GsApp *app, GCancellable *cancellable)
/* generic fallback */
gs_plugin_loader_app_action_async (priv->plugin_loader,
helper->app,
- GS_PLUGIN_LOADER_ACTION_UPDATE,
+ GS_PLUGIN_ACTION_UPDATE,
helper->cancellable,
gs_page_app_installed_cb,
helper);
@@ -461,7 +461,7 @@ gs_page_remove_app_response_cb (GtkDialog *dialog,
g_debug ("remove %s", gs_app_get_id (helper->app));
gs_plugin_loader_app_action_async (priv->plugin_loader,
helper->app,
- GS_PLUGIN_LOADER_ACTION_REMOVE,
+ GS_PLUGIN_ACTION_REMOVE,
helper->cancellable,
gs_page_app_removed_cb,
helper);
@@ -485,7 +485,7 @@ gs_page_remove_app (GsPage *page, GsApp *app, GCancellable *cancellable)
g_debug ("remove %s", gs_app_get_id (app));
gs_plugin_loader_app_action_async (priv->plugin_loader,
app,
- GS_PLUGIN_LOADER_ACTION_REMOVE,
+ GS_PLUGIN_ACTION_REMOVE,
helper->cancellable,
gs_page_app_removed_cb,
helper);
@@ -555,7 +555,7 @@ gs_page_launch_app (GsPage *page, GsApp *app, GCancellable *cancellable)
GsPagePrivate *priv = gs_page_get_instance_private (page);
gs_plugin_loader_app_action_async (priv->plugin_loader,
app,
- GS_PLUGIN_LOADER_ACTION_LAUNCH,
+ GS_PLUGIN_ACTION_LAUNCH,
cancellable,
gs_page_app_launched_cb,
NULL);
@@ -580,7 +580,7 @@ gs_page_shortcut_add (GsPage *page, GsApp *app, GCancellable *cancellable)
GsPagePrivate *priv = gs_page_get_instance_private (page);
gs_plugin_loader_app_action_async (priv->plugin_loader,
app,
- GS_PLUGIN_LOADER_ACTION_ADD_SHORTCUT,
+ GS_PLUGIN_ACTION_ADD_SHORTCUT,
cancellable,
gs_page_app_shortcut_added_cb,
NULL);
@@ -605,7 +605,7 @@ gs_page_shortcut_remove (GsPage *page, GsApp *app, GCancellable *cancellable)
GsPagePrivate *priv = gs_page_get_instance_private (page);
gs_plugin_loader_app_action_async (priv->plugin_loader,
app,
- GS_PLUGIN_LOADER_ACTION_REMOVE_SHORTCUT,
+ GS_PLUGIN_ACTION_REMOVE_SHORTCUT,
cancellable,
gs_page_app_shortcut_removed_cb,
NULL);
diff --git a/src/gs-plugin-loader-sync.c b/src/gs-plugin-loader-sync.c
index 73f75c5..5da526e 100644
--- a/src/gs-plugin-loader-sync.c
+++ b/src/gs-plugin-loader-sync.c
@@ -492,7 +492,7 @@ gs_plugin_loader_app_action_finish_sync (GsPluginLoader *plugin_loader,
gboolean
gs_plugin_loader_app_action (GsPluginLoader *plugin_loader,
GsApp *app,
- GsPluginLoaderAction action,
+ GsPluginAction action,
GCancellable *cancellable,
GError **error)
{
@@ -537,7 +537,7 @@ gboolean
gs_plugin_loader_review_action (GsPluginLoader *plugin_loader,
GsApp *app,
AsReview *review,
- GsPluginReviewAction action,
+ GsPluginAction action,
GCancellable *cancellable,
GError **error)
{
@@ -582,7 +582,7 @@ gs_plugin_loader_auth_action_finish_sync (GsPluginLoader *plugin_loader,
gboolean
gs_plugin_loader_auth_action (GsPluginLoader *plugin_loader,
GsAuth *auth,
- GsAuthAction action,
+ GsPluginAction action,
GCancellable *cancellable,
GError **error)
{
diff --git a/src/gs-plugin-loader-sync.h b/src/gs-plugin-loader-sync.h
index ba49320..8fd2abf 100644
--- a/src/gs-plugin-loader-sync.h
+++ b/src/gs-plugin-loader-sync.h
@@ -73,18 +73,18 @@ gboolean gs_plugin_loader_app_refine (GsPluginLoader *plugin_loader,
GError **error);
gboolean gs_plugin_loader_app_action (GsPluginLoader *plugin_loader,
GsApp *app,
- GsPluginLoaderAction action,
+ GsPluginAction action,
GCancellable *cancellable,
GError **error);
gboolean gs_plugin_loader_review_action (GsPluginLoader *plugin_loader,
GsApp *app,
AsReview *review,
- GsPluginReviewAction action,
+ GsPluginAction action,
GCancellable *cancellable,
GError **error);
gboolean gs_plugin_loader_auth_action (GsPluginLoader *plugin_loader,
GsAuth *auth,
- GsAuthAction action,
+ GsPluginAction action,
GCancellable *cancellable,
GError **error);
gboolean gs_plugin_loader_refresh (GsPluginLoader *plugin_loader,
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 8005871..738d1d0 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -148,6 +148,7 @@ typedef struct {
GsApp *app;
AsReview *review;
GsAuth *auth;
+ GsPluginAction action;
} GsPluginLoaderAsyncState;
static void
@@ -1145,6 +1146,7 @@ gs_plugin_loader_get_updates_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
state->flags = flags;
+ state->action = GS_PLUGIN_ACTION_GET_UPDATES;
/* run in a thread */
task = g_task_new (plugin_loader, cancellable, callback, user_data);
@@ -1222,6 +1224,7 @@ gs_plugin_loader_get_distro_upgrades_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
state->flags = flags;
+ state->action = GS_PLUGIN_ACTION_GET_DISTRO_UPDATES;
/* run in a thread */
task = g_task_new (plugin_loader, cancellable, callback, user_data);
@@ -1299,6 +1302,7 @@ gs_plugin_loader_get_unvoted_reviews_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
state->flags = flags;
+ state->action = GS_PLUGIN_ACTION_GET_UNVOTED_REVIEWS;
/* run in a thread */
task = g_task_new (plugin_loader, cancellable, callback, user_data);
@@ -1379,6 +1383,7 @@ gs_plugin_loader_get_sources_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
state->flags = flags;
+ state->action = GS_PLUGIN_ACTION_GET_SOURCES;
/* run in a thread */
task = g_task_new (plugin_loader, cancellable, callback, user_data);
@@ -1472,6 +1477,7 @@ gs_plugin_loader_get_installed_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
state->flags = flags;
+ state->action = GS_PLUGIN_ACTION_GET_INSTALLED;
/* run in a thread */
task = g_task_new (plugin_loader, cancellable, callback, user_data);
@@ -1568,6 +1574,7 @@ gs_plugin_loader_get_popular_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
state->flags = flags;
+ state->action = GS_PLUGIN_ACTION_GET_POPULAR;
/* run in a thread */
task = g_task_new (plugin_loader, cancellable, callback, user_data);
@@ -1678,6 +1685,7 @@ gs_plugin_loader_get_featured_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
state->flags = flags;
+ state->action = GS_PLUGIN_ACTION_GET_FEATURED;
/* run in a thread */
task = g_task_new (plugin_loader, cancellable, callback, user_data);
@@ -1906,6 +1914,7 @@ gs_plugin_loader_search_async (GsPluginLoader *plugin_loader,
state->flags = flags;
state->list = gs_app_list_new ();
state->value = g_strdup (value);
+ state->action = GS_PLUGIN_ACTION_SEARCH;
/* run in a thread */
task = g_task_new (plugin_loader, cancellable, callback, user_data);
@@ -2072,6 +2081,7 @@ gs_plugin_loader_search_files_async (GsPluginLoader *plugin_loader,
state->flags = flags;
state->list = gs_app_list_new ();
state->value = g_strdup (value);
+ state->action = GS_PLUGIN_ACTION_SEARCH_FILES;
/* run in a thread */
task = g_task_new (plugin_loader, cancellable, callback, user_data);
@@ -2238,6 +2248,7 @@ gs_plugin_loader_search_what_provides_async (GsPluginLoader *plugin_loader,
state->flags = flags;
state->list = gs_app_list_new ();
state->value = g_strdup (value);
+ state->action = GS_PLUGIN_ACTION_SEARCH_PROVIDES;
/* run in a thread */
task = g_task_new (plugin_loader, cancellable, callback, user_data);
@@ -2416,6 +2427,7 @@ gs_plugin_loader_get_categories_async (GsPluginLoader *plugin_loader,
state = g_slice_new0 (GsPluginLoaderAsyncState);
state->flags = flags;
state->catlist = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+ state->action = GS_PLUGIN_ACTION_GET_CATEGORIES;
/* run in a thread */
task = g_task_new (plugin_loader, cancellable, callback, user_data);
@@ -2569,6 +2581,7 @@ gs_plugin_loader_get_category_apps_async (GsPluginLoader *plugin_loader,
state->flags = flags;
state->list = gs_app_list_new ();
state->category = g_object_ref (category);
+ state->action = GS_PLUGIN_ACTION_GET_CATEGORY_APPS;
/* run in a thread */
task = g_task_new (plugin_loader, cancellable, callback, user_data);
@@ -2652,6 +2665,7 @@ gs_plugin_loader_app_refine_async (GsPluginLoader *plugin_loader,
state = g_slice_new0 (GsPluginLoaderAsyncState);
state->app = g_object_ref (app);
state->flags = flags;
+ state->action = GS_PLUGIN_ACTION_REFINE;
/* enforce this */
if (state->flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_KEY_COLORS)
@@ -3011,7 +3025,7 @@ remove_app_from_install_queue (GsPluginLoader *plugin_loader, GsApp *app)
void
gs_plugin_loader_app_action_async (GsPluginLoader *plugin_loader,
GsApp *app,
- GsPluginLoaderAction action,
+ GsPluginAction action,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -3025,7 +3039,7 @@ gs_plugin_loader_app_action_async (GsPluginLoader *plugin_loader,
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
/* handle with a fake list */
- if (action == GS_PLUGIN_LOADER_ACTION_UPDATE) {
+ if (action == GS_PLUGIN_ACTION_UPDATE) {
g_autoptr(GsAppList) list = gs_app_list_new ();
gs_app_list_add (list, app);
gs_plugin_loader_update_async (plugin_loader, list,
@@ -3034,7 +3048,7 @@ gs_plugin_loader_app_action_async (GsPluginLoader *plugin_loader,
return;
}
- if (action == GS_PLUGIN_LOADER_ACTION_REMOVE) {
+ if (action == GS_PLUGIN_ACTION_REMOVE) {
if (remove_app_from_install_queue (plugin_loader, app)) {
task = g_task_new (plugin_loader, cancellable, callback, user_data);
g_task_return_boolean (task, TRUE);
@@ -3042,7 +3056,7 @@ gs_plugin_loader_app_action_async (GsPluginLoader *plugin_loader,
}
}
- if (action == GS_PLUGIN_LOADER_ACTION_INSTALL &&
+ if (action == GS_PLUGIN_ACTION_INSTALL &&
!priv->online) {
add_app_to_install_queue (plugin_loader, app);
task = g_task_new (plugin_loader, cancellable, callback, user_data);
@@ -3053,33 +3067,34 @@ gs_plugin_loader_app_action_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
state->app = g_object_ref (app);
+ state->action = action;
switch (action) {
- case GS_PLUGIN_LOADER_ACTION_INSTALL:
+ case GS_PLUGIN_ACTION_INSTALL:
state->function_name = "gs_plugin_app_install";
break;
- case GS_PLUGIN_LOADER_ACTION_REMOVE:
+ case GS_PLUGIN_ACTION_REMOVE:
state->function_name = "gs_plugin_app_remove";
break;
- case GS_PLUGIN_LOADER_ACTION_SET_RATING:
+ case GS_PLUGIN_ACTION_SET_RATING:
state->function_name = "gs_plugin_app_set_rating";
break;
- case GS_PLUGIN_LOADER_ACTION_UPGRADE_DOWNLOAD:
+ case GS_PLUGIN_ACTION_UPGRADE_DOWNLOAD:
state->function_name = "gs_plugin_app_upgrade_download";
break;
- case GS_PLUGIN_LOADER_ACTION_UPGRADE_TRIGGER:
+ case GS_PLUGIN_ACTION_UPGRADE_TRIGGER:
state->function_name = "gs_plugin_app_upgrade_trigger";
break;
- case GS_PLUGIN_LOADER_ACTION_LAUNCH:
+ case GS_PLUGIN_ACTION_LAUNCH:
state->function_name = "gs_plugin_launch";
break;
- case GS_PLUGIN_LOADER_ACTION_UPDATE_CANCEL:
+ case GS_PLUGIN_ACTION_UPDATE_CANCEL:
state->function_name = "gs_plugin_update_cancel";
break;
- case GS_PLUGIN_LOADER_ACTION_ADD_SHORTCUT:
+ case GS_PLUGIN_ACTION_ADD_SHORTCUT:
state->function_name = "gs_plugin_add_shortcut";
break;
- case GS_PLUGIN_LOADER_ACTION_REMOVE_SHORTCUT:
+ case GS_PLUGIN_ACTION_REMOVE_SHORTCUT:
state->function_name = "gs_plugin_remove_shortcut";
break;
default:
@@ -3097,7 +3112,7 @@ void
gs_plugin_loader_review_action_async (GsPluginLoader *plugin_loader,
GsApp *app,
AsReview *review,
- GsPluginReviewAction action,
+ GsPluginAction action,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -3113,24 +3128,25 @@ gs_plugin_loader_review_action_async (GsPluginLoader *plugin_loader,
state = g_slice_new0 (GsPluginLoaderAsyncState);
state->app = g_object_ref (app);
state->review = g_object_ref (review);
+ state->action = action;
switch (action) {
- case GS_PLUGIN_REVIEW_ACTION_SUBMIT:
+ case GS_PLUGIN_ACTION_REVIEW_SUBMIT:
state->function_name = "gs_plugin_review_submit";
break;
- case GS_PLUGIN_REVIEW_ACTION_UPVOTE:
+ case GS_PLUGIN_ACTION_REVIEW_UPVOTE:
state->function_name = "gs_plugin_review_upvote";
break;
- case GS_PLUGIN_REVIEW_ACTION_DOWNVOTE:
+ case GS_PLUGIN_ACTION_REVIEW_DOWNVOTE:
state->function_name = "gs_plugin_review_downvote";
break;
- case GS_PLUGIN_REVIEW_ACTION_REPORT:
+ case GS_PLUGIN_ACTION_REVIEW_REPORT:
state->function_name = "gs_plugin_review_report";
break;
- case GS_PLUGIN_REVIEW_ACTION_REMOVE:
+ case GS_PLUGIN_ACTION_REVIEW_REMOVE:
state->function_name = "gs_plugin_review_remove";
break;
- case GS_PLUGIN_REVIEW_ACTION_DISMISS:
+ case GS_PLUGIN_ACTION_REVIEW_DISMISS:
state->function_name = "gs_plugin_review_dismiss";
break;
default:
@@ -3222,7 +3238,7 @@ gs_plugin_loader_auth_action_thread_cb (GTask *task,
void
gs_plugin_loader_auth_action_async (GsPluginLoader *plugin_loader,
GsAuth *auth,
- GsAuthAction action,
+ GsPluginAction action,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -3237,18 +3253,19 @@ gs_plugin_loader_auth_action_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
state->auth = g_object_ref (auth);
+ state->action = action;
switch (action) {
- case GS_AUTH_ACTION_LOGIN:
+ case GS_PLUGIN_ACTION_AUTH_LOGIN:
state->function_name = "gs_plugin_auth_login";
break;
- case GS_AUTH_ACTION_LOGOUT:
+ case GS_PLUGIN_ACTION_AUTH_LOGOUT:
state->function_name = "gs_plugin_auth_logout";
break;
- case GS_AUTH_ACTION_REGISTER:
+ case GS_PLUGIN_ACTION_AUTH_REGISTER:
state->function_name = "gs_plugin_auth_register";
break;
- case GS_AUTH_ACTION_LOST_PASSWORD:
+ case GS_PLUGIN_ACTION_AUTH_LOST_PASSWORD:
state->function_name = "gs_plugin_auth_lost_password";
break;
default:
@@ -4033,7 +4050,7 @@ gs_plugin_loader_set_network_status (GsPluginLoader *plugin_loader,
app = gs_app_list_index (queue, i);
gs_plugin_loader_app_action_async (plugin_loader,
app,
- GS_PLUGIN_LOADER_ACTION_INSTALL,
+ GS_PLUGIN_ACTION_INSTALL,
NULL,
gs_plugin_loader_app_installed_cb,
g_object_ref (app));
@@ -4166,6 +4183,7 @@ gs_plugin_loader_refresh_async (GsPluginLoader *plugin_loader,
state = g_slice_new0 (GsPluginLoaderAsyncState);
state->flags = flags;
state->cache_age = cache_age;
+ state->action = GS_PLUGIN_ACTION_REFRESH;
/* run in a thread */
task = g_task_new (plugin_loader, cancellable, callback, user_data);
@@ -4361,6 +4379,7 @@ gs_plugin_loader_file_to_app_async (GsPluginLoader *plugin_loader,
state->flags = flags;
state->list = gs_app_list_new ();
state->file = g_object_ref (file);
+ state->action = GS_PLUGIN_ACTION_FILE_TO_APP;
/* run in a thread */
task = g_task_new (plugin_loader, cancellable, callback, user_data);
@@ -4522,6 +4541,7 @@ gs_plugin_loader_update_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
state->list = gs_app_list_copy (apps);
+ state->action = GS_PLUGIN_ACTION_UPDATE;
/* run in a thread */
task = g_task_new (plugin_loader, cancellable, callback, user_data);
diff --git a/src/gs-plugin-loader.h b/src/gs-plugin-loader.h
index daac548..c43a2dd 100644
--- a/src/gs-plugin-loader.h
+++ b/src/gs-plugin-loader.h
@@ -27,7 +27,7 @@
#include "gs-app.h"
#include "gs-auth.h"
#include "gs-category.h"
-#include "gs-plugin.h"
+#include "gs-plugin-private.h"
G_BEGIN_DECLS
@@ -46,42 +46,6 @@ struct _GsPluginLoaderClass
void (*reload) (GsPluginLoader *plugin_loader);
};
-typedef enum {
- GS_PLUGIN_LOADER_ACTION_INSTALL,
- GS_PLUGIN_LOADER_ACTION_REMOVE,
- GS_PLUGIN_LOADER_ACTION_UPDATE,
- GS_PLUGIN_LOADER_ACTION_SET_RATING,
- GS_PLUGIN_LOADER_ACTION_UPGRADE_DOWNLOAD,
- GS_PLUGIN_LOADER_ACTION_UPGRADE_TRIGGER,
- GS_PLUGIN_LOADER_ACTION_LAUNCH,
- GS_PLUGIN_LOADER_ACTION_UPDATE_CANCEL,
- GS_PLUGIN_LOADER_ACTION_ADD_SHORTCUT,
- GS_PLUGIN_LOADER_ACTION_REMOVE_SHORTCUT,
- GS_PLUGIN_LOADER_ACTION_LAST
-} GsPluginLoaderAction;
-
-/**
- * GsPluginReviewAction:
- * @GS_PLUGIN_REVIEW_ACTION_SUBMIT: Submit a new review
- * @GS_PLUGIN_REVIEW_ACTION_UPVOTE: Upvote an existing review
- * @GS_PLUGIN_REVIEW_ACTION_DOWNVOTE: Downvote an existing review
- * @GS_PLUGIN_REVIEW_ACTION_REPORT: Report an existing review
- * @GS_PLUGIN_REVIEW_ACTION_REMOVE: Remove a review written by the user
- * @GS_PLUGIN_REVIEW_ACTION_DISMISS: Dismiss (ignore) a review when moderating
- *
- * The review action.
- **/
-typedef enum {
- GS_PLUGIN_REVIEW_ACTION_SUBMIT,
- GS_PLUGIN_REVIEW_ACTION_UPVOTE,
- GS_PLUGIN_REVIEW_ACTION_DOWNVOTE,
- GS_PLUGIN_REVIEW_ACTION_REPORT,
- GS_PLUGIN_REVIEW_ACTION_REMOVE,
- GS_PLUGIN_REVIEW_ACTION_DISMISS,
- /*< private >*/
- GS_PLUGIN_REVIEW_ACTION_LAST
-} GsPluginReviewAction;
-
typedef void (*GsPluginLoaderFinishedFunc) (GsPluginLoader *plugin_loader,
GsApp *app,
gpointer user_data);
@@ -229,7 +193,7 @@ gboolean gs_plugin_loader_app_refine_finish (GsPluginLoader *plugin_loader,
GError **error);
void gs_plugin_loader_app_action_async (GsPluginLoader *plugin_loader,
GsApp *app,
- GsPluginLoaderAction a,
+ GsPluginAction a,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -242,7 +206,7 @@ gboolean gs_plugin_loader_review_action_finish (GsPluginLoader *plugin_loader,
void gs_plugin_loader_review_action_async (GsPluginLoader *plugin_loader,
GsApp *app,
AsReview *review,
- GsPluginReviewAction action,
+ GsPluginAction action,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -251,7 +215,7 @@ gboolean gs_plugin_loader_auth_action_finish (GsPluginLoader *plugin_loader,
GError **error);
void gs_plugin_loader_auth_action_async (GsPluginLoader *plugin_loader,
GsAuth *auth,
- GsAuthAction action,
+ GsPluginAction action,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
diff --git a/src/gs-plugin-private.h b/src/gs-plugin-private.h
index 9c90107..ba0cada 100644
--- a/src/gs-plugin-private.h
+++ b/src/gs-plugin-private.h
@@ -31,10 +31,92 @@
G_BEGIN_DECLS
+/**
+ * GsPluginAction:
+ * @GS_PLUGIN_ACTION_INSTALL: Install an application
+ * @GS_PLUGIN_ACTION_REMOVE: Remove an application
+ * @GS_PLUGIN_ACTION_UPDATE: Update an application
+ * @GS_PLUGIN_ACTION_SET_RATING: Set rating on an application
+ * @GS_PLUGIN_ACTION_UPGRADE_DOWNLOAD: Download a distro upgrade
+ * @GS_PLUGIN_ACTION_UPGRADE_TRIGGER: Trigger a distro upgrade
+ * @GS_PLUGIN_ACTION_LAUNCH: Launch an application
+ * @GS_PLUGIN_ACTION_UPDATE_CANCEL: Cancel the update
+ * @GS_PLUGIN_ACTION_ADD_SHORTCUT: Add a shortcut to an application
+ * @GS_PLUGIN_ACTION_REMOVE_SHORTCUT: Remove a shortcut to an application
+ * @GS_PLUGIN_ACTION_REVIEW_SUBMIT: Submit a new review
+ * @GS_PLUGIN_ACTION_REVIEW_UPVOTE: Upvote an existing review
+ * @GS_PLUGIN_ACTION_REVIEW_DOWNVOTE: Downvote an existing review
+ * @GS_PLUGIN_ACTION_REVIEW_REPORT: Report an existing review
+ * @GS_PLUGIN_ACTION_REVIEW_REMOVE: Remove a review written by the user
+ * @GS_PLUGIN_ACTION_REVIEW_DISMISS: Dismiss (ignore) a review when moderating
+ * @GS_PLUGIN_ACTION_GET_UPDATES: Get the list of updates
+ * @GS_PLUGIN_ACTION_GET_DISTRO_UPDATES: Get the list of distro updates
+ * @GS_PLUGIN_ACTION_GET_UNVOTED_REVIEWS: Get the list of moderatable reviews
+ * @GS_PLUGIN_ACTION_GET_SOURCES: Get the list of sources
+ * @GS_PLUGIN_ACTION_GET_INSTALLED: Get the list of installed applications
+ * @GS_PLUGIN_ACTION_GET_POPULAR: Get the list of popular applications
+ * @GS_PLUGIN_ACTION_GET_FEATURED: Get the list of featured applications
+ * @GS_PLUGIN_ACTION_SEARCH: Get the search results for a query
+ * @GS_PLUGIN_ACTION_SEARCH_FILES: Get the search results for a file query
+ * @GS_PLUGIN_ACTION_SEARCH_PROVIDES: Get the search results for a provide query
+ * @GS_PLUGIN_ACTION_GET_CATEGORIES: Get the list of categories
+ * @GS_PLUGIN_ACTION_GET_CATEGORY_APPS: Get the apps for a specific category
+ * @GS_PLUGIN_ACTION_REFINE: Refine the application
+ * @GS_PLUGIN_ACTION_REFRESH: Refresh all the sources
+ * @GS_PLUGIN_ACTION_FILE_TO_APP: Convert the file to an application
+ * @GS_PLUGIN_ACTION_AUTH_LOGIN: Authentication login action
+ * @GS_PLUGIN_ACTION_AUTH_LOGOUT: Authentication logout action
+ * @GS_PLUGIN_ACTION_AUTH_REGISTER: Authentication register action
+ * @GS_PLUGIN_ACTION_AUTH_LOST_PASSWORD: Authentication lost password action
+ *
+ * The plugin action.
+ **/
+typedef enum {
+ GS_PLUGIN_ACTION_INSTALL,
+ GS_PLUGIN_ACTION_REMOVE,
+ GS_PLUGIN_ACTION_UPDATE,
+ GS_PLUGIN_ACTION_SET_RATING,
+ GS_PLUGIN_ACTION_UPGRADE_DOWNLOAD,
+ GS_PLUGIN_ACTION_UPGRADE_TRIGGER,
+ GS_PLUGIN_ACTION_LAUNCH,
+ GS_PLUGIN_ACTION_UPDATE_CANCEL,
+ GS_PLUGIN_ACTION_ADD_SHORTCUT,
+ GS_PLUGIN_ACTION_REMOVE_SHORTCUT,
+ GS_PLUGIN_ACTION_REVIEW_SUBMIT,
+ GS_PLUGIN_ACTION_REVIEW_UPVOTE,
+ GS_PLUGIN_ACTION_REVIEW_DOWNVOTE,
+ GS_PLUGIN_ACTION_REVIEW_REPORT,
+ GS_PLUGIN_ACTION_REVIEW_REMOVE,
+ GS_PLUGIN_ACTION_REVIEW_DISMISS,
+ GS_PLUGIN_ACTION_GET_UPDATES,
+ GS_PLUGIN_ACTION_GET_DISTRO_UPDATES,
+ GS_PLUGIN_ACTION_GET_UNVOTED_REVIEWS,
+ GS_PLUGIN_ACTION_GET_SOURCES,
+ GS_PLUGIN_ACTION_GET_INSTALLED,
+ GS_PLUGIN_ACTION_GET_POPULAR,
+ GS_PLUGIN_ACTION_GET_FEATURED,
+ GS_PLUGIN_ACTION_SEARCH,
+ GS_PLUGIN_ACTION_SEARCH_FILES,
+ GS_PLUGIN_ACTION_SEARCH_PROVIDES,
+ GS_PLUGIN_ACTION_GET_CATEGORIES,
+ GS_PLUGIN_ACTION_GET_CATEGORY_APPS,
+ GS_PLUGIN_ACTION_REFINE,
+ GS_PLUGIN_ACTION_REFRESH,
+ GS_PLUGIN_ACTION_FILE_TO_APP,
+ GS_PLUGIN_ACTION_AUTH_LOGIN,
+ GS_PLUGIN_ACTION_AUTH_LOGOUT,
+ GS_PLUGIN_ACTION_AUTH_REGISTER,
+ GS_PLUGIN_ACTION_AUTH_LOST_PASSWORD,
+ /*< private >*/
+ GS_PLUGIN_ACTION_LAST
+} GsPluginAction;
+
GsPlugin *gs_plugin_new (void);
GsPlugin *gs_plugin_create (const gchar *filename,
GError **error);
const gchar *gs_plugin_error_to_string (GsPluginError error);
+const gchar *gs_plugin_action_to_string (GsPluginAction action);
+
void gs_plugin_action_start (GsPlugin *plugin,
gboolean exclusive);
void gs_plugin_action_stop (GsPlugin *plugin);
diff --git a/src/gs-plugin.c b/src/gs-plugin.c
index 2149627..6a2f6f1 100644
--- a/src/gs-plugin.c
+++ b/src/gs-plugin.c
@@ -1314,6 +1314,90 @@ gs_plugin_error_to_string (GsPluginError error)
return NULL;
}
+/**
+ * gs_plugin_action_to_string:
+ * @action: a #GsPluginAction, e.g. %GS_PLUGIN_ERROR_NO_NETWORK
+ *
+ * Converts the enumerated action to a string.
+ *
+ * Returns: a string, or %NULL for invalid
+ **/
+const gchar *
+gs_plugin_action_to_string (GsPluginAction action)
+{
+ if (action == GS_PLUGIN_ACTION_INSTALL)
+ return "install";
+ if (action == GS_PLUGIN_ACTION_REMOVE)
+ return "remove";
+ if (action == GS_PLUGIN_ACTION_UPDATE)
+ return "update";
+ if (action == GS_PLUGIN_ACTION_SET_RATING)
+ return "set-rating";
+ if (action == GS_PLUGIN_ACTION_UPGRADE_DOWNLOAD)
+ return "upgrade-download";
+ if (action == GS_PLUGIN_ACTION_UPGRADE_TRIGGER)
+ return "upgrade-trigger";
+ if (action == GS_PLUGIN_ACTION_LAUNCH)
+ return "launch";
+ if (action == GS_PLUGIN_ACTION_UPDATE_CANCEL)
+ return "update-cancel";
+ if (action == GS_PLUGIN_ACTION_ADD_SHORTCUT)
+ return "add-shortcut";
+ if (action == GS_PLUGIN_ACTION_REMOVE_SHORTCUT)
+ return "remove-shortcut";
+ if (action == GS_PLUGIN_ACTION_REVIEW_SUBMIT)
+ return "review-submit";
+ if (action == GS_PLUGIN_ACTION_REVIEW_UPVOTE)
+ return "review-upvote";
+ if (action == GS_PLUGIN_ACTION_REVIEW_DOWNVOTE)
+ return "review-downvote";
+ if (action == GS_PLUGIN_ACTION_REVIEW_REPORT)
+ return "review-report";
+ if (action == GS_PLUGIN_ACTION_REVIEW_REMOVE)
+ return "review-remove";
+ if (action == GS_PLUGIN_ACTION_REVIEW_DISMISS)
+ return "review-dismiss";
+ if (action == GS_PLUGIN_ACTION_GET_UPDATES)
+ return "get-updates";
+ if (action == GS_PLUGIN_ACTION_GET_DISTRO_UPDATES)
+ return "get-distro-updates";
+ if (action == GS_PLUGIN_ACTION_GET_UNVOTED_REVIEWS)
+ return "get-unvoted-reviews";
+ if (action == GS_PLUGIN_ACTION_GET_SOURCES)
+ return "get-sources";
+ if (action == GS_PLUGIN_ACTION_GET_INSTALLED)
+ return "get-installed";
+ if (action == GS_PLUGIN_ACTION_GET_POPULAR)
+ return "get-popular";
+ if (action == GS_PLUGIN_ACTION_GET_FEATURED)
+ return "get-featured";
+ if (action == GS_PLUGIN_ACTION_SEARCH)
+ return "search";
+ if (action == GS_PLUGIN_ACTION_SEARCH_FILES)
+ return "search-files";
+ if (action == GS_PLUGIN_ACTION_SEARCH_PROVIDES)
+ return "search-provides";
+ if (action == GS_PLUGIN_ACTION_GET_CATEGORIES)
+ return "get-categories";
+ if (action == GS_PLUGIN_ACTION_GET_CATEGORY_APPS)
+ return "get-category-apps";
+ if (action == GS_PLUGIN_ACTION_REFINE)
+ return "refine";
+ if (action == GS_PLUGIN_ACTION_REFRESH)
+ return "refresh";
+ if (action == GS_PLUGIN_ACTION_FILE_TO_APP)
+ return "file-to-app";
+ if (action == GS_PLUGIN_ACTION_AUTH_LOGIN)
+ return "auth-login";
+ if (action == GS_PLUGIN_ACTION_AUTH_LOGOUT)
+ return "auth-logout";
+ if (action == GS_PLUGIN_ACTION_AUTH_REGISTER)
+ return "auth-register";
+ if (action == GS_PLUGIN_ACTION_AUTH_LOST_PASSWORD)
+ return "auth-lost-password";
+ return NULL;
+}
+
static void
gs_plugin_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
diff --git a/src/gs-review-row.c b/src/gs-review-row.c
index c85c71a..8cc2781 100644
--- a/src/gs-review-row.c
+++ b/src/gs-review-row.c
@@ -83,23 +83,23 @@ gs_review_row_refresh (GsReviewRow *row)
priv->actions = 0;
/* set actions up */
- if ((priv->actions & (1 << GS_PLUGIN_REVIEW_ACTION_UPVOTE |
- 1 << GS_PLUGIN_REVIEW_ACTION_DOWNVOTE |
- 1 << GS_PLUGIN_REVIEW_ACTION_DISMISS)) == 0) {
+ if ((priv->actions & (1 << GS_PLUGIN_ACTION_REVIEW_UPVOTE |
+ 1 << GS_PLUGIN_ACTION_REVIEW_DOWNVOTE |
+ 1 << GS_PLUGIN_ACTION_REVIEW_DISMISS)) == 0) {
gtk_widget_set_visible (priv->box_voting, FALSE);
} else {
gtk_widget_set_visible (priv->box_voting, TRUE);
gtk_widget_set_visible (priv->button_yes,
- priv->actions & 1 << GS_PLUGIN_REVIEW_ACTION_UPVOTE);
+ priv->actions & 1 << GS_PLUGIN_ACTION_REVIEW_UPVOTE);
gtk_widget_set_visible (priv->button_no,
- priv->actions & 1 << GS_PLUGIN_REVIEW_ACTION_DOWNVOTE);
+ priv->actions & 1 << GS_PLUGIN_ACTION_REVIEW_DOWNVOTE);
gtk_widget_set_visible (priv->button_dismiss,
- priv->actions & 1 << GS_PLUGIN_REVIEW_ACTION_DISMISS);
+ priv->actions & 1 << GS_PLUGIN_ACTION_REVIEW_DISMISS);
}
gtk_widget_set_visible (priv->button_remove,
- priv->actions & 1 << GS_PLUGIN_REVIEW_ACTION_REMOVE);
+ priv->actions & 1 << GS_PLUGIN_ACTION_REVIEW_REMOVE);
gtk_widget_set_visible (priv->button_report,
- priv->actions & 1 << GS_PLUGIN_REVIEW_ACTION_REPORT);
+ priv->actions & 1 << GS_PLUGIN_ACTION_REVIEW_REPORT);
}
static gboolean
@@ -173,14 +173,14 @@ static void
gs_review_row_button_clicked_upvote_cb (GtkButton *button, GsReviewRow *row)
{
g_signal_emit (row, signals[SIGNAL_BUTTON_CLICKED], 0,
- GS_PLUGIN_REVIEW_ACTION_UPVOTE);
+ GS_PLUGIN_ACTION_REVIEW_UPVOTE);
}
static void
gs_review_row_button_clicked_downvote_cb (GtkButton *button, GsReviewRow *row)
{
g_signal_emit (row, signals[SIGNAL_BUTTON_CLICKED], 0,
- GS_PLUGIN_REVIEW_ACTION_DOWNVOTE);
+ GS_PLUGIN_ACTION_REVIEW_DOWNVOTE);
}
static void
@@ -188,7 +188,7 @@ gs_review_row_confirm_cb (GtkDialog *dialog, gint response_id, GsReviewRow *row)
{
if (response_id == GTK_RESPONSE_YES) {
g_signal_emit (row, signals[SIGNAL_BUTTON_CLICKED], 0,
- GS_PLUGIN_REVIEW_ACTION_REPORT);
+ GS_PLUGIN_ACTION_REVIEW_REPORT);
}
gtk_widget_destroy (GTK_WIDGET (dialog));
}
@@ -242,14 +242,14 @@ static void
gs_review_row_button_clicked_dismiss_cb (GtkButton *button, GsReviewRow *row)
{
g_signal_emit (row, signals[SIGNAL_BUTTON_CLICKED], 0,
- GS_PLUGIN_REVIEW_ACTION_DISMISS);
+ GS_PLUGIN_ACTION_REVIEW_DISMISS);
}
static void
gs_review_row_button_clicked_remove_cb (GtkButton *button, GsReviewRow *row)
{
g_signal_emit (row, signals[SIGNAL_BUTTON_CLICKED], 0,
- GS_PLUGIN_REVIEW_ACTION_REMOVE);
+ GS_PLUGIN_ACTION_REVIEW_REMOVE);
}
AsReview *
diff --git a/src/gs-review-row.h b/src/gs-review-row.h
index c6c60be..0306b7f 100644
--- a/src/gs-review-row.h
+++ b/src/gs-review-row.h
@@ -36,7 +36,7 @@ struct _GsReviewRowClass
{
GtkListBoxRowClass parent_class;
void (*button_clicked) (GsReviewRow *review_row,
- GsPluginReviewAction action);
+ GsPluginAction action);
};
GtkWidget *gs_review_row_new (AsReview *review);
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index 4223739..cc37442 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -139,6 +139,11 @@ gs_plugin_func (void)
GsAppList *list_dup;
GsAppList *list_remove;
GsApp *app;
+ guint i;
+
+ /* check enums converted */
+ for (i = 0; i < GS_PLUGIN_ACTION_LAST; i++)
+ g_assert (gs_plugin_action_to_string (i) != NULL);
/* add a couple of duplicate IDs */
app = gs_app_new ("a");
@@ -331,7 +336,7 @@ gs_plugin_loader_install_func (GsPluginLoader *plugin_loader)
gs_app_set_management_plugin (app, "dummy");
gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
ret = gs_plugin_loader_app_action (plugin_loader, app,
- GS_PLUGIN_LOADER_ACTION_INSTALL,
+ GS_PLUGIN_ACTION_INSTALL,
NULL,
&error);
g_assert_no_error (error);
@@ -341,7 +346,7 @@ gs_plugin_loader_install_func (GsPluginLoader *plugin_loader)
/* remove -- we're really testing for return code UNKNOWN,
* but dummy::refine() sets it */
ret = gs_plugin_loader_app_action (plugin_loader, app,
- GS_PLUGIN_LOADER_ACTION_REMOVE,
+ GS_PLUGIN_ACTION_REMOVE,
NULL,
&error);
g_assert_no_error (error);
@@ -366,7 +371,7 @@ gs_plugin_loader_error_func (GsPluginLoader *plugin_loader)
gs_app_set_management_plugin (app, "dummy");
gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
ret = gs_plugin_loader_app_action (plugin_loader, app,
- GS_PLUGIN_LOADER_ACTION_UPDATE,
+ GS_PLUGIN_ACTION_UPDATE,
NULL,
&error);
g_assert_no_error (error);
@@ -501,7 +506,7 @@ gs_plugin_loader_distro_upgrades_func (GsPluginLoader *plugin_loader)
/* download the update */
ret = gs_plugin_loader_app_action (plugin_loader,
app,
- GS_PLUGIN_LOADER_ACTION_UPGRADE_DOWNLOAD,
+ GS_PLUGIN_ACTION_UPGRADE_DOWNLOAD,
NULL,
&error);
g_assert_no_error (error);
@@ -511,7 +516,7 @@ gs_plugin_loader_distro_upgrades_func (GsPluginLoader *plugin_loader)
/* trigger the update */
ret = gs_plugin_loader_app_action (plugin_loader,
app,
- GS_PLUGIN_LOADER_ACTION_UPGRADE_TRIGGER,
+ GS_PLUGIN_ACTION_UPGRADE_TRIGGER,
NULL,
&error);
g_assert_no_error (error);
@@ -834,7 +839,7 @@ gs_plugin_loader_flatpak_repo_func (GsPluginLoader *plugin_loader)
/* now install the remote */
ret = gs_plugin_loader_app_action (plugin_loader, app,
- GS_PLUGIN_LOADER_ACTION_INSTALL,
+ GS_PLUGIN_ACTION_INSTALL,
NULL,
&error);
g_assert_no_error (error);
@@ -870,7 +875,7 @@ gs_plugin_loader_flatpak_repo_func (GsPluginLoader *plugin_loader)
/* remove it */
ret = gs_plugin_loader_app_action (plugin_loader, app,
- GS_PLUGIN_LOADER_ACTION_REMOVE,
+ GS_PLUGIN_ACTION_REMOVE,
NULL,
&error);
g_assert_no_error (error);
@@ -937,7 +942,7 @@ gs_plugin_loader_flatpak_func (GsPluginLoader *plugin_loader)
gs_app_set_state (app_source, AS_APP_STATE_AVAILABLE);
gs_app_set_url (app_source, AS_URL_KIND_HOMEPAGE, testdir_repourl);
ret = gs_plugin_loader_app_action (plugin_loader, app_source,
- GS_PLUGIN_LOADER_ACTION_INSTALL,
+ GS_PLUGIN_ACTION_INSTALL,
NULL,
&error);
g_assert_no_error (error);
@@ -998,7 +1003,7 @@ gs_plugin_loader_flatpak_func (GsPluginLoader *plugin_loader)
/* install, also installing runtime */
ret = gs_plugin_loader_app_action (plugin_loader, app,
- GS_PLUGIN_LOADER_ACTION_INSTALL,
+ GS_PLUGIN_ACTION_INSTALL,
NULL,
&error);
g_assert_no_error (error);
@@ -1045,7 +1050,7 @@ gs_plugin_loader_flatpak_func (GsPluginLoader *plugin_loader)
/* remove the application */
ret = gs_plugin_loader_app_action (plugin_loader, app,
- GS_PLUGIN_LOADER_ACTION_REMOVE,
+ GS_PLUGIN_ACTION_REMOVE,
NULL,
&error);
g_assert_no_error (error);
@@ -1105,7 +1110,7 @@ gs_plugin_loader_authentication_func (GsPluginLoader *plugin_loader)
/* do an action that returns a URL */
ret = gs_plugin_loader_auth_action (plugin_loader, auth,
- GS_AUTH_ACTION_REGISTER,
+ GS_PLUGIN_ACTION_AUTH_REGISTER,
NULL, &error);
g_assert_error (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_AUTH_INVALID);
g_assert (!ret);
@@ -1116,7 +1121,7 @@ gs_plugin_loader_authentication_func (GsPluginLoader *plugin_loader)
app = gs_app_new (NULL);
review = as_review_new ();
ret = gs_plugin_loader_review_action (plugin_loader, app, review,
- GS_PLUGIN_REVIEW_ACTION_REMOVE,
+ GS_PLUGIN_ACTION_REVIEW_REMOVE,
NULL, &error);
g_assert_error (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_AUTH_REQUIRED);
g_assert (!ret);
@@ -1124,7 +1129,7 @@ gs_plugin_loader_authentication_func (GsPluginLoader *plugin_loader)
/* pretend to auth with no credentials */
ret = gs_plugin_loader_auth_action (plugin_loader, auth,
- GS_AUTH_ACTION_LOGIN,
+ GS_PLUGIN_ACTION_AUTH_LOGIN,
NULL, &error);
g_assert_error (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_AUTH_INVALID);
g_assert (!ret);
@@ -1135,7 +1140,7 @@ gs_plugin_loader_authentication_func (GsPluginLoader *plugin_loader)
gs_auth_set_username (auth, "dummy");
gs_auth_set_password (auth, "dummy");
ret = gs_plugin_loader_auth_action (plugin_loader, auth,
- GS_AUTH_ACTION_LOGIN,
+ GS_PLUGIN_ACTION_AUTH_LOGIN,
NULL, &error);
g_assert_no_error (error);
g_assert (ret);
@@ -1144,7 +1149,7 @@ gs_plugin_loader_authentication_func (GsPluginLoader *plugin_loader)
/* do the action that requires a login */
review2 = as_review_new ();
ret = gs_plugin_loader_review_action (plugin_loader, app, review2,
- GS_PLUGIN_REVIEW_ACTION_REMOVE,
+ GS_PLUGIN_ACTION_REVIEW_REMOVE,
NULL, &error);
g_assert_no_error (error);
g_assert (ret);
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index b4703ac..7a24048 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -1059,7 +1059,7 @@ typedef struct {
GsShellDetails *self;
AsReview *review;
GsApp *app;
- GsPluginReviewAction action;
+ GsPluginAction action;
} GsShellDetailsReviewHelper;
static void
@@ -1138,7 +1138,7 @@ gs_shell_details_app_set_review_cb (GObject *source,
static void
gs_shell_details_review_button_clicked_cb (GsReviewRow *row,
- GsPluginReviewAction action,
+ GsPluginAction action,
GsShellDetails *self)
{
GsShellDetailsReviewHelper *helper = g_new0 (GsShellDetailsReviewHelper, 1);
@@ -1166,15 +1166,15 @@ gs_shell_details_refresh_reviews (GsShellDetails *self)
guint64 possible_actions = 0;
guint i;
struct {
- GsPluginReviewAction action;
+ GsPluginAction action;
const gchar *plugin_func;
} plugin_vfuncs[] = {
- { GS_PLUGIN_REVIEW_ACTION_UPVOTE, "gs_plugin_review_upvote" },
- { GS_PLUGIN_REVIEW_ACTION_DOWNVOTE, "gs_plugin_review_downvote" },
- { GS_PLUGIN_REVIEW_ACTION_REPORT, "gs_plugin_review_report" },
- { GS_PLUGIN_REVIEW_ACTION_SUBMIT, "gs_plugin_review_submit" },
- { GS_PLUGIN_REVIEW_ACTION_REMOVE, "gs_plugin_review_remove" },
- { GS_PLUGIN_REVIEW_ACTION_LAST, NULL }
+ { GS_PLUGIN_ACTION_REVIEW_UPVOTE, "gs_plugin_review_upvote" },
+ { GS_PLUGIN_ACTION_REVIEW_DOWNVOTE, "gs_plugin_review_downvote" },
+ { GS_PLUGIN_ACTION_REVIEW_REPORT, "gs_plugin_review_report" },
+ { GS_PLUGIN_ACTION_REVIEW_SUBMIT, "gs_plugin_review_submit" },
+ { GS_PLUGIN_ACTION_REVIEW_REMOVE, "gs_plugin_review_remove" },
+ { GS_PLUGIN_ACTION_LAST, NULL }
};
/* show or hide the entire reviews section */
@@ -1235,7 +1235,7 @@ gs_shell_details_refresh_reviews (GsShellDetails *self)
return;
/* find what the plugins support */
- for (i = 0; plugin_vfuncs[i].action != GS_PLUGIN_REVIEW_ACTION_LAST; i++) {
+ for (i = 0; plugin_vfuncs[i].action != GS_PLUGIN_ACTION_LAST; i++) {
if (gs_plugin_loader_get_plugin_supported (self->plugin_loader,
plugin_vfuncs[i].plugin_func)) {
possible_actions |= 1u << plugin_vfuncs[i].action;
@@ -1257,10 +1257,10 @@ gs_shell_details_refresh_reviews (GsShellDetails *self)
g_signal_connect (row, "button-clicked",
G_CALLBACK (gs_shell_details_review_button_clicked_cb), self);
if (as_review_get_flags (review) & AS_REVIEW_FLAG_SELF) {
- actions = possible_actions & 1 << GS_PLUGIN_REVIEW_ACTION_REMOVE;
+ actions = possible_actions & 1 << GS_PLUGIN_ACTION_REVIEW_REMOVE;
show_review_button = FALSE;
} else {
- actions = possible_actions & ~(1u << GS_PLUGIN_REVIEW_ACTION_REMOVE);
+ actions = possible_actions & ~(1u << GS_PLUGIN_ACTION_REVIEW_REMOVE);
}
gs_review_row_set_actions (GS_REVIEW_ROW (row), actions);
gtk_container_add (GTK_CONTAINER (self->list_box_reviews), row);
@@ -1644,7 +1644,7 @@ gs_shell_details_review_response_cb (GtkDialog *dialog,
helper->self = g_object_ref (self);
helper->app = g_object_ref (self->app);
helper->review = g_object_ref (review);
- helper->action = GS_PLUGIN_REVIEW_ACTION_SUBMIT;
+ helper->action = GS_PLUGIN_ACTION_REVIEW_SUBMIT;
gs_plugin_loader_review_action_async (self->plugin_loader,
helper->app,
helper->review,
diff --git a/src/gs-shell-moderate.c b/src/gs-shell-moderate.c
index febbfde..ab3023e 100644
--- a/src/gs-shell-moderate.c
+++ b/src/gs-shell-moderate.c
@@ -67,7 +67,7 @@ gs_shell_moderate_app_set_review_cb (GObject *source,
static void
gs_shell_moderate_review_clicked_cb (GsReviewRow *row,
- GsPluginReviewAction action,
+ GsPluginAction action,
GsShellModerate *self)
{
GsApp *app = g_object_get_data (G_OBJECT (row), "GsApp");
@@ -119,10 +119,10 @@ gs_shell_moderate_add_app (GsShellModerate *self, GsApp *app)
gtk_widget_set_margin_start (row, 250);
gtk_widget_set_margin_end (row, 250);
gs_review_row_set_actions (GS_REVIEW_ROW (row),
- 1 << GS_PLUGIN_REVIEW_ACTION_UPVOTE |
- 1 << GS_PLUGIN_REVIEW_ACTION_DOWNVOTE |
- 1 << GS_PLUGIN_REVIEW_ACTION_DISMISS |
- 1 << GS_PLUGIN_REVIEW_ACTION_REPORT);
+ 1 << GS_PLUGIN_ACTION_REVIEW_UPVOTE |
+ 1 << GS_PLUGIN_ACTION_REVIEW_DOWNVOTE |
+ 1 << GS_PLUGIN_ACTION_REVIEW_DISMISS |
+ 1 << GS_PLUGIN_ACTION_REVIEW_REPORT);
g_signal_connect (row, "button-clicked",
G_CALLBACK (gs_shell_moderate_review_clicked_cb), self);
g_object_set_data_full (G_OBJECT (row), "GsApp",
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 0dd03f7..a0fc79e 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -906,7 +906,7 @@ gs_shell_updates_reboot_failed_cb (GObject *source, GAsyncResult *res, gpointer
apps = gs_update_list_get_apps (GS_UPDATE_LIST (self->list_box_updates));
gs_plugin_loader_app_action_async (self->plugin_loader,
gs_app_list_index (apps, 0),
- GS_PLUGIN_LOADER_ACTION_UPDATE_CANCEL,
+ GS_PLUGIN_ACTION_UPDATE_CANCEL,
self->cancellable,
cancel_trigger_failed_cb,
self);
@@ -1018,7 +1018,7 @@ upgrade_download_finished_cb (GObject *source,
last_error->message);
gs_app_notify_failed_modal (helper->app,
gs_shell_get_window (helper->self->shell),
- GS_PLUGIN_LOADER_ACTION_UPGRADE_DOWNLOAD,
+ GS_PLUGIN_ACTION_UPGRADE_DOWNLOAD,
last_error);
return;
}
@@ -1046,7 +1046,7 @@ gs_shell_updates_upgrade_download_cb (GsUpgradeBanner *upgrade_banner,
self->cancellable_upgrade_download = g_cancellable_new ();
gs_plugin_loader_app_action_async (self->plugin_loader,
app,
- GS_PLUGIN_LOADER_ACTION_UPGRADE_DOWNLOAD,
+ GS_PLUGIN_ACTION_UPGRADE_DOWNLOAD,
self->cancellable_upgrade_download,
upgrade_download_finished_cb,
helper);
@@ -1081,7 +1081,7 @@ upgrade_reboot_failed_cb (GObject *source,
/* cancel trigger */
gs_plugin_loader_app_action_async (self->plugin_loader,
app,
- GS_PLUGIN_LOADER_ACTION_UPDATE_CANCEL,
+ GS_PLUGIN_ACTION_UPDATE_CANCEL,
self->cancellable,
cancel_trigger_failed_cb,
self);
@@ -1128,7 +1128,7 @@ trigger_upgrade (GsShellUpdates *self)
gs_plugin_loader_app_action_async (self->plugin_loader,
upgrade,
- GS_PLUGIN_LOADER_ACTION_UPGRADE_TRIGGER,
+ GS_PLUGIN_ACTION_UPGRADE_TRIGGER,
self->cancellable,
upgrade_trigger_finished_cb,
self);
diff --git a/src/gs-sources-dialog.c b/src/gs-sources-dialog.c
index 0d1c8e6..ec08834 100644
--- a/src/gs-sources-dialog.c
+++ b/src/gs-sources-dialog.c
@@ -202,7 +202,7 @@ gs_sources_dialog_rescan_proprietary_sources (GsSourcesDialog *dialog)
if (gs_app_get_state (app) == AS_APP_STATE_AVAILABLE) {
gs_plugin_loader_app_action_async (dialog->plugin_loader,
app,
- GS_PLUGIN_LOADER_ACTION_INSTALL,
+ GS_PLUGIN_ACTION_INSTALL,
dialog->cancellable,
source_modified_cb,
dialog);
@@ -211,7 +211,7 @@ gs_sources_dialog_rescan_proprietary_sources (GsSourcesDialog *dialog)
if (gs_app_get_state (app) == AS_APP_STATE_INSTALLED) {
gs_plugin_loader_app_action_async (dialog->plugin_loader,
app,
- GS_PLUGIN_LOADER_ACTION_REMOVE,
+ GS_PLUGIN_ACTION_REMOVE,
dialog->cancellable,
source_modified_cb,
dialog);
@@ -511,7 +511,7 @@ remove_button_cb (GtkWidget *widget, GsSourcesDialog *dialog)
g_debug ("removing source '%s'", gs_app_get_name (app));
gs_plugin_loader_app_action_async (dialog->plugin_loader,
app,
- GS_PLUGIN_LOADER_ACTION_REMOVE,
+ GS_PLUGIN_ACTION_REMOVE,
dialog->cancellable,
app_removed_cb,
dialog);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]