[gnome-software/wip/hughsie/GsPluginFailureFlags: 11/11] Add GsPluginFailureFlags
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/hughsie/GsPluginFailureFlags: 11/11] Add GsPluginFailureFlags
- Date: Wed, 23 Nov 2016 15:42:49 +0000 (UTC)
commit 59e1adf909e6b53bd73dc466b2a1f9cb0413c735
Author: Richard Hughes <richard hughsie com>
Date: Tue Nov 22 16:31:54 2016 +0000
Add GsPluginFailureFlags
src/gs-application.c | 3 +
src/gs-auth-dialog.c | 1 +
src/gs-cmd.c | 18 +-
src/gs-page.c | 10 +
src/gs-plugin-loader-sync.c | 87 ++++--
src/gs-plugin-loader-sync.h | 43 ++-
src/gs-plugin-loader.c | 672 ++++++++++++++++++++-------------------
src/gs-plugin-loader.h | 50 ++-
src/gs-plugin-types.h | 24 ++
src/gs-self-test.c | 41 +++-
src/gs-shell-category.c | 1 +
src/gs-shell-details.c | 9 +
src/gs-shell-extras.c | 3 +
src/gs-shell-installed.c | 1 +
src/gs-shell-loading.c | 1 +
src/gs-shell-moderate.c | 3 +
src/gs-shell-overview.c | 5 +
src/gs-shell-search-provider.c | 1 +
src/gs-shell-search.c | 1 +
src/gs-shell-updates.c | 8 +
src/gs-sources-dialog.c | 4 +
src/gs-update-dialog.c | 1 +
src/gs-update-monitor.c | 4 +
23 files changed, 605 insertions(+), 386 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 5892856..d3aefe7 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -177,6 +177,7 @@ gs_application_initialize_plugins (GsApplication *app)
if (!gs_plugin_loader_setup (app->plugin_loader,
plugin_whitelist,
plugin_blacklist,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
&error)) {
g_warning ("Failed to setup plugins: %s", error->message);
exit (1);
@@ -398,6 +399,7 @@ reboot_failed_cb (GObject *source, GAsyncResult *res, gpointer user_data)
gs_plugin_loader_app_action_async (app->plugin_loader,
NULL, /* everything! */
GS_PLUGIN_ACTION_UPDATE_CANCEL,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
app->cancellable,
cancel_trigger_failed_cb,
app);
@@ -473,6 +475,7 @@ reboot_and_install (GSimpleAction *action,
gs_application_initialize_plugins (app);
gs_plugin_loader_update_async (app->plugin_loader,
NULL,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
app->cancellable,
(GAsyncReadyCallback) offline_update_cb,
app);
diff --git a/src/gs-auth-dialog.c b/src/gs-auth-dialog.c
index 21743da..8d2e820 100644
--- a/src/gs-auth-dialog.c
+++ b/src/gs-auth-dialog.c
@@ -172,6 +172,7 @@ gs_auth_dialog_continue_cb (GtkWidget *widget, GsAuthDialog *dialog)
gs_plugin_loader_auth_action_async (dialog->plugin_loader,
dialog->auth,
action,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
dialog->cancellable,
gs_auth_dialog_authenticate_cb,
dialog);
diff --git a/src/gs-cmd.c b/src/gs-cmd.c
index f4bf40a..4c66e87 100644
--- a/src/gs-cmd.c
+++ b/src/gs-cmd.c
@@ -276,6 +276,7 @@ main (int argc, char **argv)
ret = gs_plugin_loader_setup (plugin_loader,
plugin_whitelist,
plugin_blacklist,
+ GS_PLUGIN_FAILURE_FLAGS_NONE,
&error);
if (!ret) {
g_print ("Failed to setup plugins: %s\n", error->message);
@@ -290,6 +291,7 @@ main (int argc, char **argv)
g_object_unref (list);
list = gs_plugin_loader_get_installed (plugin_loader,
refine_flags,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
if (list == NULL) {
@@ -304,6 +306,7 @@ main (int argc, char **argv)
list = gs_plugin_loader_search (plugin_loader,
argv[2],
refine_flags,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
if (list == NULL) {
@@ -317,6 +320,7 @@ main (int argc, char **argv)
ret = gs_plugin_loader_app_action (plugin_loader,
app,
GS_PLUGIN_ACTION_UPGRADE_DOWNLOAD,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
if (ret)
@@ -327,6 +331,7 @@ main (int argc, char **argv)
ret = gs_plugin_loader_app_refine (plugin_loader,
app,
refine_flags,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
if (!ret)
@@ -339,6 +344,7 @@ main (int argc, char **argv)
ret = gs_plugin_loader_app_action (plugin_loader,
app,
GS_PLUGIN_ACTION_LAUNCH,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
if (!ret)
@@ -349,6 +355,7 @@ main (int argc, char **argv)
app = gs_plugin_loader_file_to_app (plugin_loader,
file,
refine_flags,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
if (app == NULL) {
@@ -363,6 +370,7 @@ main (int argc, char **argv)
g_object_unref (list);
list = gs_plugin_loader_get_updates (plugin_loader,
refine_flags,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
if (list == NULL) {
@@ -376,6 +384,7 @@ main (int argc, char **argv)
g_object_unref (list);
list = gs_plugin_loader_get_distro_upgrades (plugin_loader,
refine_flags,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
if (list == NULL) {
@@ -386,6 +395,7 @@ main (int argc, char **argv)
} else if (argc == 2 && g_strcmp0 (argv[1], "sources") == 0) {
list = gs_plugin_loader_get_sources (plugin_loader,
refine_flags,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
if (list == NULL)
@@ -396,6 +406,7 @@ main (int argc, char **argv)
g_object_unref (list);
list = gs_plugin_loader_get_popular (plugin_loader,
refine_flags,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
if (list == NULL) {
@@ -409,6 +420,7 @@ main (int argc, char **argv)
g_object_unref (list);
list = gs_plugin_loader_get_featured (plugin_loader,
refine_flags,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
if (list == NULL) {
@@ -422,6 +434,7 @@ main (int argc, char **argv)
g_ptr_array_unref (categories);
categories = gs_plugin_loader_get_categories (plugin_loader,
refine_flags,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
if (categories == NULL) {
@@ -447,6 +460,7 @@ main (int argc, char **argv)
list = gs_plugin_loader_get_category_apps (plugin_loader,
category,
refine_flags,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
if (list == NULL) {
@@ -458,7 +472,9 @@ main (int argc, char **argv)
GsPluginRefreshFlags refresh_flags;
refresh_flags = gs_cmd_refresh_flag_from_string (argv[2]);
ret = gs_plugin_loader_refresh (plugin_loader, cache_age,
- refresh_flags, NULL, &error);
+ refresh_flags,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
+ NULL, &error);
} else {
ret = FALSE;
g_set_error_literal (&error,
diff --git a/src/gs-page.c b/src/gs-page.c
index 5c21b0a..7a94e32 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -91,6 +91,7 @@ gs_page_install_authenticate_cb (GtkDialog *dialog,
gs_plugin_loader_app_action_async (priv->plugin_loader,
helper->app,
GS_PLUGIN_ACTION_INSTALL,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
helper->cancellable,
gs_page_app_installed_cb,
helper);
@@ -118,6 +119,7 @@ gs_page_remove_authenticate_cb (GtkDialog *dialog,
gs_plugin_loader_app_action_async (priv->plugin_loader,
helper->app,
GS_PLUGIN_ACTION_REMOVE,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
helper->cancellable,
gs_page_app_removed_cb,
helper);
@@ -291,6 +293,7 @@ gs_page_install_app (GsPage *page, GsApp *app, GCancellable *cancellable)
gs_plugin_loader_app_action_async (priv->plugin_loader,
app,
helper->action,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
helper->cancellable,
gs_page_app_installed_cb,
helper);
@@ -315,6 +318,7 @@ gs_page_update_app_response_cb (GtkDialog *dialog,
gs_plugin_loader_app_action_async (priv->plugin_loader,
helper->app,
GS_PLUGIN_ACTION_UPDATE,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
helper->cancellable,
gs_page_app_installed_cb,
helper);
@@ -410,6 +414,7 @@ gs_page_update_app (GsPage *page, GsApp *app, GCancellable *cancellable)
gs_plugin_loader_app_action_async (priv->plugin_loader,
helper->app,
helper->action,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
helper->cancellable,
gs_page_app_installed_cb,
helper);
@@ -434,6 +439,7 @@ gs_page_remove_app_response_cb (GtkDialog *dialog,
gs_plugin_loader_app_action_async (priv->plugin_loader,
helper->app,
helper->action,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
helper->cancellable,
gs_page_app_removed_cb,
helper);
@@ -459,6 +465,7 @@ gs_page_remove_app (GsPage *page, GsApp *app, GCancellable *cancellable)
gs_plugin_loader_app_action_async (priv->plugin_loader,
app,
GS_PLUGIN_ACTION_REMOVE,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
helper->cancellable,
gs_page_app_removed_cb,
helper);
@@ -529,6 +536,7 @@ gs_page_launch_app (GsPage *page, GsApp *app, GCancellable *cancellable)
gs_plugin_loader_app_action_async (priv->plugin_loader,
app,
GS_PLUGIN_ACTION_LAUNCH,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
cancellable,
gs_page_app_launched_cb,
NULL);
@@ -554,6 +562,7 @@ gs_page_shortcut_add (GsPage *page, GsApp *app, GCancellable *cancellable)
gs_plugin_loader_app_action_async (priv->plugin_loader,
app,
GS_PLUGIN_ACTION_ADD_SHORTCUT,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
cancellable,
gs_page_app_shortcut_added_cb,
NULL);
@@ -579,6 +588,7 @@ gs_page_shortcut_remove (GsPage *page, GsApp *app, GCancellable *cancellable)
gs_plugin_loader_app_action_async (priv->plugin_loader,
app,
GS_PLUGIN_ACTION_REMOVE_SHORTCUT,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
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 5da526e..9c1cc24 100644
--- a/src/gs-plugin-loader-sync.c
+++ b/src/gs-plugin-loader-sync.c
@@ -26,7 +26,7 @@
GsApp *
gs_plugin_loader_get_app_by_id (GsPluginLoader *plugin_loader,
const gchar *id,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
GCancellable *cancellable,
GError **error)
{
@@ -34,7 +34,8 @@ gs_plugin_loader_get_app_by_id (GsPluginLoader *plugin_loader,
gboolean ret;
app = gs_app_new (id);
- ret = gs_plugin_loader_app_refine (plugin_loader, app, flags,
+ ret = gs_plugin_loader_app_refine (plugin_loader, app, refine_flags,
+ GS_PLUGIN_FAILURE_FLAGS_NONE,
cancellable, error);
if (!ret)
g_clear_object (&app);
@@ -65,7 +66,8 @@ gs_plugin_loader_get_installed_finish_sync (GsPluginLoader *plugin_loader,
GsAppList *
gs_plugin_loader_get_installed (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -80,7 +82,8 @@ gs_plugin_loader_get_installed (GsPluginLoader *plugin_loader,
/* run async method */
gs_plugin_loader_get_installed_async (plugin_loader,
- flags,
+ refine_flags,
+ failure_flags,
cancellable,
(GAsyncReadyCallback)
gs_plugin_loader_get_installed_finish_sync,
&helper);
@@ -108,7 +111,8 @@ gs_plugin_loader_search_finish_sync (GsPluginLoader *plugin_loader,
GsAppList *
gs_plugin_loader_search (GsPluginLoader *plugin_loader,
const gchar *value,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -124,7 +128,8 @@ gs_plugin_loader_search (GsPluginLoader *plugin_loader,
/* run async method */
gs_plugin_loader_search_async (plugin_loader,
value,
- flags,
+ refine_flags,
+ failure_flags,
cancellable,
(GAsyncReadyCallback) gs_plugin_loader_search_finish_sync,
&helper);
@@ -151,7 +156,8 @@ gs_plugin_loader_get_updates_finish_sync (GsPluginLoader *plugin_loader,
GsAppList *
gs_plugin_loader_get_updates (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -166,7 +172,8 @@ gs_plugin_loader_get_updates (GsPluginLoader *plugin_loader,
/* run async method */
gs_plugin_loader_get_updates_async (plugin_loader,
- flags,
+ refine_flags,
+ failure_flags,
cancellable,
(GAsyncReadyCallback) gs_plugin_loader_get_updates_finish_sync,
&helper);
@@ -193,9 +200,10 @@ gs_plugin_loader_get_distro_upgrades_finish_sync (GsPluginLoader *plugin_loader,
GsAppList *
gs_plugin_loader_get_distro_upgrades (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
- GCancellable *cancellable,
- GError **error)
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
+ GCancellable *cancellable,
+ GError **error)
{
GsPluginLoaderHelper helper;
@@ -208,7 +216,8 @@ gs_plugin_loader_get_distro_upgrades (GsPluginLoader *plugin_loader,
/* run async method */
gs_plugin_loader_get_distro_upgrades_async (plugin_loader,
- flags,
+ refine_flags,
+ failure_flags,
cancellable,
(GAsyncReadyCallback)
gs_plugin_loader_get_distro_upgrades_finish_sync,
&helper);
@@ -235,7 +244,8 @@ gs_plugin_loader_get_sources_finish_sync (GsPluginLoader *plugin_loader,
GsAppList *
gs_plugin_loader_get_sources (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -250,7 +260,8 @@ gs_plugin_loader_get_sources (GsPluginLoader *plugin_loader,
/* run async method */
gs_plugin_loader_get_sources_async (plugin_loader,
- flags,
+ refine_flags,
+ failure_flags,
cancellable,
(GAsyncReadyCallback) gs_plugin_loader_get_sources_finish_sync,
&helper);
@@ -277,7 +288,8 @@ gs_plugin_loader_get_popular_finish_sync (GsPluginLoader *plugin_loader,
GsAppList *
gs_plugin_loader_get_popular (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -292,7 +304,8 @@ gs_plugin_loader_get_popular (GsPluginLoader *plugin_loader,
/* run async method */
gs_plugin_loader_get_popular_async (plugin_loader,
- flags,
+ refine_flags,
+ failure_flags,
cancellable,
(GAsyncReadyCallback) gs_plugin_loader_get_popular_finish_sync,
&helper);
@@ -319,7 +332,8 @@ gs_plugin_loader_get_featured_finish_sync (GsPluginLoader *plugin_loader,
GsAppList *
gs_plugin_loader_get_featured (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -334,7 +348,8 @@ gs_plugin_loader_get_featured (GsPluginLoader *plugin_loader,
/* run async method */
gs_plugin_loader_get_featured_async (plugin_loader,
- flags,
+ refine_flags,
+ failure_flags,
cancellable,
(GAsyncReadyCallback) gs_plugin_loader_get_featured_finish_sync,
&helper);
@@ -361,7 +376,8 @@ gs_plugin_loader_get_categories_finish_sync (GsPluginLoader *plugin_loader,
GPtrArray *
gs_plugin_loader_get_categories (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -376,7 +392,8 @@ gs_plugin_loader_get_categories (GsPluginLoader *plugin_loader,
/* run async method */
gs_plugin_loader_get_categories_async (plugin_loader,
- flags,
+ refine_flags,
+ failure_flags,
cancellable,
(GAsyncReadyCallback)
gs_plugin_loader_get_categories_finish_sync,
&helper);
@@ -404,7 +421,8 @@ gs_plugin_loader_get_category_apps_finish_sync (GsPluginLoader *plugin_loader,
GsAppList *
gs_plugin_loader_get_category_apps (GsPluginLoader *plugin_loader,
GsCategory *category,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -420,7 +438,8 @@ gs_plugin_loader_get_category_apps (GsPluginLoader *plugin_loader,
/* run async method */
gs_plugin_loader_get_category_apps_async (plugin_loader,
category,
- flags,
+ refine_flags,
+ failure_flags,
cancellable,
(GAsyncReadyCallback)
gs_plugin_loader_get_category_apps_finish_sync,
&helper);
@@ -448,7 +467,8 @@ gs_plugin_loader_app_refine_finish_sync (GsPluginLoader *plugin_loader,
gboolean
gs_plugin_loader_app_refine (GsPluginLoader *plugin_loader,
GsApp *app,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -464,7 +484,8 @@ gs_plugin_loader_app_refine (GsPluginLoader *plugin_loader,
/* run async method */
gs_plugin_loader_app_refine_async (plugin_loader,
app,
- flags,
+ refine_flags,
+ failure_flags,
cancellable,
(GAsyncReadyCallback) gs_plugin_loader_app_refine_finish_sync,
&helper);
@@ -493,6 +514,7 @@ gboolean
gs_plugin_loader_app_action (GsPluginLoader *plugin_loader,
GsApp *app,
GsPluginAction action,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -509,6 +531,7 @@ gs_plugin_loader_app_action (GsPluginLoader *plugin_loader,
gs_plugin_loader_app_action_async (plugin_loader,
app,
action,
+ failure_flags,
cancellable,
(GAsyncReadyCallback) gs_plugin_loader_app_action_finish_sync,
&helper);
@@ -538,6 +561,7 @@ gs_plugin_loader_review_action (GsPluginLoader *plugin_loader,
GsApp *app,
AsReview *review,
GsPluginAction action,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -555,6 +579,7 @@ gs_plugin_loader_review_action (GsPluginLoader *plugin_loader,
app,
review,
action,
+ failure_flags,
cancellable,
(GAsyncReadyCallback)
gs_plugin_loader_review_action_finish_sync,
&helper);
@@ -583,6 +608,7 @@ gboolean
gs_plugin_loader_auth_action (GsPluginLoader *plugin_loader,
GsAuth *auth,
GsPluginAction action,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -599,6 +625,7 @@ gs_plugin_loader_auth_action (GsPluginLoader *plugin_loader,
gs_plugin_loader_auth_action_async (plugin_loader,
auth,
action,
+ failure_flags,
cancellable,
(GAsyncReadyCallback) gs_plugin_loader_auth_action_finish_sync,
&helper);
@@ -626,7 +653,8 @@ gs_plugin_loader_refresh_finish_sync (GsPluginLoader *plugin_loader,
gboolean
gs_plugin_loader_refresh (GsPluginLoader *plugin_loader,
guint cache_age,
- GsPluginRefreshFlags flags,
+ GsPluginRefreshFlags refresh_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -642,7 +670,8 @@ gs_plugin_loader_refresh (GsPluginLoader *plugin_loader,
/* run async method */
gs_plugin_loader_refresh_async (plugin_loader,
cache_age,
- flags,
+ refresh_flags,
+ failure_flags,
cancellable,
(GAsyncReadyCallback) gs_plugin_loader_refresh_finish_sync,
&helper);
@@ -672,7 +701,8 @@ gs_plugin_loader_file_to_app_finish_sync (GObject *source_object,
GsApp *
gs_plugin_loader_file_to_app (GsPluginLoader *plugin_loader,
GFile *file,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -689,7 +719,8 @@ gs_plugin_loader_file_to_app (GsPluginLoader *plugin_loader,
/* run async method */
gs_plugin_loader_file_to_app_async (plugin_loader,
file,
- flags,
+ refine_flags,
+ failure_flags,
cancellable,
gs_plugin_loader_file_to_app_finish_sync,
&helper);
diff --git a/src/gs-plugin-loader-sync.h b/src/gs-plugin-loader-sync.h
index 8fd2abf..1fb6003 100644
--- a/src/gs-plugin-loader-sync.h
+++ b/src/gs-plugin-loader-sync.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2007-2015 Richard Hughes <richard hughsie com>
+ * Copyright (C) 2007-2016 Richard Hughes <richard hughsie com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -29,77 +29,92 @@
G_BEGIN_DECLS
GsAppList *gs_plugin_loader_get_installed (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error);
GsAppList *gs_plugin_loader_search (GsPluginLoader *plugin_loader,
const gchar *value,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error);
GsAppList *gs_plugin_loader_get_updates (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error);
GsAppList *gs_plugin_loader_get_distro_upgrades (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error);
GsAppList *gs_plugin_loader_get_sources (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error);
GsAppList *gs_plugin_loader_get_popular (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error);
GsAppList *gs_plugin_loader_get_featured (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error);
GPtrArray *gs_plugin_loader_get_categories (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error);
GsAppList *gs_plugin_loader_get_category_apps (GsPluginLoader *plugin_loader,
GsCategory *category,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error);
gboolean gs_plugin_loader_app_refine (GsPluginLoader *plugin_loader,
GsApp *app,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error);
gboolean gs_plugin_loader_app_action (GsPluginLoader *plugin_loader,
GsApp *app,
GsPluginAction action,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error);
gboolean gs_plugin_loader_review_action (GsPluginLoader *plugin_loader,
GsApp *app,
AsReview *review,
GsPluginAction action,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error);
gboolean gs_plugin_loader_auth_action (GsPluginLoader *plugin_loader,
GsAuth *auth,
GsPluginAction action,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error);
gboolean gs_plugin_loader_refresh (GsPluginLoader *plugin_loader,
guint cache_age,
- GsPluginRefreshFlags flags,
+ GsPluginRefreshFlags refresh_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error);
GsApp *gs_plugin_loader_get_app_by_id (GsPluginLoader *plugin_loader,
const gchar *id,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
GCancellable *cancellable,
GError **error);
GsApp *gs_plugin_loader_file_to_app (GsPluginLoader *plugin_loader,
GFile *file,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error);
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 5877ae5..0d246e1 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -122,23 +122,23 @@ typedef gboolean (*GsPluginAuthFunc) (GsPlugin *plugin,
GError **error);
typedef gboolean (*GsPluginRefineFunc) (GsPlugin *plugin,
GsAppList *list,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
GCancellable *cancellable,
GError **error);
typedef gboolean (*GsPluginRefineAppFunc) (GsPlugin *plugin,
GsApp *app,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
GCancellable *cancellable,
GError **error);
typedef gboolean (*GsPluginRefineWildcardFunc) (GsPlugin *plugin,
GsApp *app,
GsAppList *list,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
GCancellable *cancellable,
GError **error);
typedef gboolean (*GsPluginRefreshFunc ) (GsPlugin *plugin,
guint cache_age,
- GsPluginRefreshFlags flags,
+ GsPluginRefreshFlags refresh_flags,
GCancellable *cancellable,
GError **error);
typedef gboolean (*GsPluginFileToAppFunc) (GsPlugin *plugin,
@@ -158,7 +158,9 @@ typedef struct {
const gchar *function_name;
GsAppList *list;
GPtrArray *catlist;
- GsPluginRefineFlags flags;
+ GsPluginRefineFlags refine_flags;
+ GsPluginRefreshFlags refresh_flags;
+ GsPluginFailureFlags failure_flags;
gchar *value;
GFile *file;
guint cache_age;
@@ -326,6 +328,65 @@ gs_plugin_loader_create_event_from_error (GsPluginLoader *plugin_loader,
gs_plugin_loader_add_event (plugin_loader, event);
}
+static gboolean
+gs_plugin_loader_is_error_fatal (GsPluginFailureFlags failure_flags, GError *err)
+{
+ if (failure_flags & GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL)
+ return TRUE;
+ if (failure_flags & GS_PLUGIN_FAILURE_FLAGS_FATAL_AUTH) {
+ if (g_error_matches (err, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_AUTH_REQUIRED))
+ return TRUE;
+ if (g_error_matches (err, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_AUTH_INVALID))
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static gboolean
+gs_plugin_error_handle_failure (GsPluginLoader *plugin_loader,
+ GsPlugin *plugin,
+ GsApp *app,
+ GsPluginAction action,
+ const gchar *function_name,
+ GsPluginFailureFlags failure_flags,
+ const GError *error_local,
+ GError **error)
+{
+ /* badly behaved plugin */
+ if (error_local == NULL) {
+ g_critical ("%s did not set error for %s",
+ gs_plugin_get_name (plugin),
+ function_name);
+ return TRUE;
+ }
+
+ /* abort early to allow main thread to process */
+ if (gs_plugin_loader_is_error_fatal (failure_flags, error_local)) {
+ if (error != NULL)
+ *error = g_error_copy (error_local);
+ return FALSE;
+ }
+
+ /* create event which is handled by the GsShell */
+ if (failure_flags & GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS) {
+ gs_plugin_loader_create_event_from_error (plugin_loader,
+ action,
+ plugin,
+ app,
+ error_local);
+ }
+
+ /* fallback to console warning */
+ if ((failure_flags & GS_PLUGIN_FAILURE_FLAGS_NO_CONSOLE) == 0) {
+ g_warning ("failed to call %s on %s: %s",
+ function_name,
+ gs_plugin_get_name (plugin),
+ error_local->message);
+ }
+
+ return TRUE;
+}
+
static void
gs_plugin_loader_run_adopt (GsPluginLoader *plugin_loader, GsAppList *list)
{
@@ -387,7 +448,8 @@ gs_plugin_loader_run_refine_wildcard (GsPluginLoader *plugin_loader,
GsPlugin *plugin,
GsApp *app,
GsAppList *list,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable)
{
GsPluginRefineWildcardFunc plugin_func = NULL;
@@ -403,26 +465,18 @@ gs_plugin_loader_run_refine_wildcard (GsPluginLoader *plugin_loader,
return;
gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
- ret = plugin_func (plugin, app, list, flags,
+ ret = plugin_func (plugin, app, list, refine_flags,
cancellable, &error_local);
gs_plugin_loader_action_stop (plugin_loader, plugin);
if (!ret) {
- /* badly behaved plugin */
- if (error_local == NULL) {
- g_critical ("%s did not set error for %s",
- gs_plugin_get_name (plugin),
- function_name);
- return;
- }
- g_warning ("failed to call %s on %s: %s",
- function_name,
- gs_plugin_get_name (plugin),
- error_local->message);
- gs_plugin_loader_create_event_from_error (plugin_loader,
- GS_PLUGIN_ACTION_REFINE,
- plugin,
- NULL, /* app */
- error_local);
+ gs_plugin_error_handle_failure (plugin_loader,
+ plugin,
+ NULL, /* app */
+ GS_PLUGIN_ACTION_REFINE,
+ function_name,
+ failure_flags,
+ error_local,
+ NULL);
}
}
@@ -431,7 +485,8 @@ gs_plugin_loader_run_refine_app (GsPluginLoader *plugin_loader,
GsPlugin *plugin,
GsApp *app,
GsAppList *list,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable)
{
GsPluginRefineAppFunc plugin_func = NULL;
@@ -446,35 +501,27 @@ gs_plugin_loader_run_refine_app (GsPluginLoader *plugin_loader,
return;
gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
- ret = plugin_func (plugin, app, flags,
- cancellable, &error_local);
+ ret = plugin_func (plugin, app, refine_flags,
+ cancellable, &error_local);
gs_plugin_loader_action_stop (plugin_loader, plugin);
if (!ret) {
- /* badly behaved plugin */
- if (error_local == NULL) {
- g_critical ("%s did not set error for %s",
- gs_plugin_get_name (plugin),
- function_name);
- return;
- }
- g_warning ("failed to call %s on %s: %s",
- function_name,
- gs_plugin_get_name (plugin),
- error_local->message);
- gs_plugin_loader_create_event_from_error (plugin_loader,
- GS_PLUGIN_ACTION_REFINE,
- plugin,
- app,
- error_local);
+ gs_plugin_error_handle_failure (plugin_loader,
+ plugin,
+ app,
+ GS_PLUGIN_ACTION_REFINE,
+ function_name,
+ failure_flags,
+ error_local,
+ NULL);
}
-
}
static gboolean
gs_plugin_loader_run_refine_internal (GsPluginLoader *plugin_loader,
const gchar *function_name_parent,
GsAppList *list,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -489,10 +536,10 @@ gs_plugin_loader_run_refine_internal (GsPluginLoader *plugin_loader,
gboolean ret = TRUE;
/* this implies the other */
- if (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_UI)
- flags |= GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN;
- if (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME)
- flags |= GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN;
+ if (refine_flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_UI)
+ refine_flags |= GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN;
+ if (refine_flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME)
+ refine_flags |= GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN;
/* try to adopt each application with a plugin */
gs_plugin_loader_run_adopt (plugin_loader, list);
@@ -532,26 +579,18 @@ gs_plugin_loader_run_refine_internal (GsPluginLoader *plugin_loader,
gboolean ret_local;
gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
- ret_local = plugin_func (plugin, list, flags,
+ ret_local = plugin_func (plugin, list, refine_flags,
cancellable, &error_local);
gs_plugin_loader_action_stop (plugin_loader, plugin);
if (!ret_local) {
- /* badly behaved plugin */
- if (error_local == NULL) {
- g_critical ("%s did not set error for %s",
- gs_plugin_get_name (plugin),
- function_name);
- continue;
- }
- g_warning ("failed to call %s on %s: %s",
- function_name,
- gs_plugin_get_name (plugin),
- error_local->message);
- gs_plugin_loader_create_event_from_error (plugin_loader,
- GS_PLUGIN_ACTION_REFINE,
- plugin,
- NULL, /* app */
- error_local);
+ gs_plugin_error_handle_failure (plugin_loader,
+ plugin,
+ NULL, /* app */
+ GS_PLUGIN_ACTION_REFINE,
+ function_name,
+ failure_flags,
+ error_local,
+ NULL);
continue;
}
}
@@ -562,7 +601,8 @@ gs_plugin_loader_run_refine_internal (GsPluginLoader *plugin_loader,
plugin,
app,
list,
- flags,
+ refine_flags,
+ failure_flags,
cancellable);
continue;
}
@@ -570,14 +610,15 @@ gs_plugin_loader_run_refine_internal (GsPluginLoader *plugin_loader,
plugin,
app,
list,
- flags,
+ refine_flags,
+ failure_flags,
cancellable);
}
gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_FINISHED);
}
/* ensure these are sorted by score */
- if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEWS) > 0) {
+ if ((refine_flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEWS) > 0) {
GPtrArray *reviews;
for (i = 0; i < gs_app_list_length (list); i++) {
app = gs_app_list_index (list, i);
@@ -588,12 +629,12 @@ gs_plugin_loader_run_refine_internal (GsPluginLoader *plugin_loader,
}
/* refine addons one layer deep */
- if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_ADDONS) > 0) {
+ if ((refine_flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_ADDONS) > 0) {
g_autoptr(GsAppList) addons_list = NULL;
- flags &= ~GS_PLUGIN_REFINE_FLAGS_REQUIRE_ADDONS;
- flags &= ~GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEWS;
- flags &= ~GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEW_RATINGS;
+ refine_flags &= ~GS_PLUGIN_REFINE_FLAGS_REQUIRE_ADDONS;
+ refine_flags &= ~GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEWS;
+ refine_flags &= ~GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEW_RATINGS;
addons_list = gs_app_list_new ();
for (i = 0; i < gs_app_list_length (list); i++) {
app = gs_app_list_index (list, i);
@@ -610,7 +651,8 @@ gs_plugin_loader_run_refine_internal (GsPluginLoader *plugin_loader,
ret = gs_plugin_loader_run_refine_internal (plugin_loader,
function_name_parent,
addons_list,
- flags,
+ refine_flags,
+ failure_flags,
cancellable,
error);
if (!ret)
@@ -619,7 +661,7 @@ gs_plugin_loader_run_refine_internal (GsPluginLoader *plugin_loader,
}
/* also do runtime */
- if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_RELATED) > 0) {
+ if ((refine_flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_RELATED) > 0) {
g_autoptr(GsAppList) list2 = gs_app_list_new ();
for (i = 0; i < gs_app_list_length (list); i++) {
GsApp *runtime;
@@ -632,7 +674,8 @@ gs_plugin_loader_run_refine_internal (GsPluginLoader *plugin_loader,
ret = gs_plugin_loader_run_refine_internal (plugin_loader,
function_name_parent,
list2,
- flags,
+ refine_flags,
+ failure_flags,
cancellable,
error);
if (!ret)
@@ -641,10 +684,10 @@ gs_plugin_loader_run_refine_internal (GsPluginLoader *plugin_loader,
}
/* also do related packages one layer deep */
- if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_RELATED) > 0) {
+ if ((refine_flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_RELATED) > 0) {
g_autoptr(GsAppList) related_list = NULL;
- flags &= ~GS_PLUGIN_REFINE_FLAGS_REQUIRE_RELATED;
+ refine_flags &= ~GS_PLUGIN_REFINE_FLAGS_REQUIRE_RELATED;
related_list = gs_app_list_new ();
for (i = 0; i < gs_app_list_length (list); i++) {
app = gs_app_list_index (list, i);
@@ -661,7 +704,8 @@ gs_plugin_loader_run_refine_internal (GsPluginLoader *plugin_loader,
ret = gs_plugin_loader_run_refine_internal (plugin_loader,
function_name_parent,
related_list,
- flags,
+ refine_flags,
+ failure_flags,
cancellable,
error);
if (!ret)
@@ -677,7 +721,8 @@ static gboolean
gs_plugin_loader_run_refine (GsPluginLoader *plugin_loader,
const gchar *function_name_parent,
GsAppList *list,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -701,7 +746,8 @@ gs_plugin_loader_run_refine (GsPluginLoader *plugin_loader,
ret = gs_plugin_loader_run_refine_internal (plugin_loader,
function_name_parent,
list,
- flags,
+ refine_flags,
+ failure_flags,
cancellable,
error);
if (!ret)
@@ -720,7 +766,8 @@ gs_plugin_loader_run_refine (GsPluginLoader *plugin_loader,
ret = gs_plugin_loader_run_refine_internal (plugin_loader,
function_name_parent,
list,
- flags,
+ refine_flags,
+ failure_flags,
cancellable,
error);
if (!ret)
@@ -740,7 +787,8 @@ static GsAppList *
gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
GsPluginAction action,
const gchar *function_name,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -792,22 +840,14 @@ gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
ret = plugin_func (plugin, list, cancellable, &error_local);
gs_plugin_loader_action_stop (plugin_loader, plugin);
if (!ret) {
- /* badly behaved plugin */
- if (error_local == NULL) {
- g_critical ("%s did not set error for %s",
- gs_plugin_get_name (plugin),
- function_name);
- continue;
- }
- g_warning ("failed to call %s on %s: %s",
- function_name,
- gs_plugin_get_name (plugin),
- error_local->message);
- gs_plugin_loader_create_event_from_error (plugin_loader,
- action,
- plugin,
- NULL, /* app */
- error_local);
+ gs_plugin_error_handle_failure (plugin_loader,
+ plugin,
+ NULL, /* app */
+ action,
+ function_name,
+ failure_flags,
+ error_local,
+ NULL);
continue;
}
gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_FINISHED);
@@ -817,7 +857,8 @@ gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
ret = gs_plugin_loader_run_refine (plugin_loader,
function_name,
list,
- flags,
+ refine_flags,
+ failure_flags,
cancellable,
error);
if (!ret)
@@ -949,7 +990,7 @@ gs_plugin_loader_app_is_valid (GsApp *app, gpointer user_data)
}
/* don't show unconverted packages in the application view */
- if (((state->flags & GS_PLUGIN_REFINE_FLAGS_ALLOW_PACKAGES) == 0) &&
+ if (((state->refine_flags & GS_PLUGIN_REFINE_FLAGS_ALLOW_PACKAGES) == 0) &&
(gs_app_get_kind (app) == AS_APP_KIND_GENERIC)) {
// g_debug ("app invalid as only a %s: %s",
// as_app_kind_to_string (gs_app_get_kind (app)),
@@ -1074,20 +1115,11 @@ gs_plugin_loader_get_event_by_id (GsPluginLoader *plugin_loader, const gchar *un
}
static gboolean
-gs_plugin_loader_is_auth_error (GError *err)
-{
- if (g_error_matches (err, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_AUTH_REQUIRED))
- return TRUE;
- if (g_error_matches (err, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_AUTH_INVALID))
- return TRUE;
- return FALSE;
-}
-
-static gboolean
gs_plugin_loader_run_action (GsPluginLoader *plugin_loader,
GsApp *app,
GsPluginAction action,
const gchar *function_name,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -1124,30 +1156,16 @@ gs_plugin_loader_run_action (GsPluginLoader *plugin_loader,
ret = plugin_func (plugin, app, cancellable, &error_local);
gs_plugin_loader_action_stop (plugin_loader, plugin);
if (!ret) {
- /* badly behaved plugin */
- if (error_local == NULL) {
- g_critical ("%s did not set error for %s",
- gs_plugin_get_name (plugin),
- function_name);
- continue;
- }
-
- /* abort early to allow main thread to process */
- if (gs_plugin_loader_is_auth_error (error_local)) {
- g_propagate_error (error, error_local);
- error_local = NULL;
+ if (!gs_plugin_error_handle_failure (plugin_loader,
+ plugin,
+ NULL, /* app */
+ action,
+ function_name,
+ failure_flags,
+ error_local,
+ error)) {
return FALSE;
}
-
- g_warning ("failed to call %s on %s: %s",
- function_name,
- gs_plugin_get_name (plugin),
- error_local->message);
- gs_plugin_loader_create_event_from_error (plugin_loader,
- action,
- plugin,
- app,
- error_local);
continue;
}
anything_ran = TRUE;
@@ -1244,11 +1262,12 @@ gs_plugin_loader_get_updates_thread_cb (GTask *task,
gboolean ret;
/* do things that would block */
- if ((state->flags & GS_PLUGIN_REFINE_FLAGS_USE_HISTORY) > 0) {
+ if ((state->refine_flags & GS_PLUGIN_REFINE_FLAGS_USE_HISTORY) > 0) {
state->list = gs_plugin_loader_run_results (plugin_loader,
state->action,
"gs_plugin_add_updates_historical",
- state->flags,
+ state->refine_flags,
+ state->failure_flags,
cancellable,
&error);
if (error != NULL) {
@@ -1260,7 +1279,8 @@ gs_plugin_loader_get_updates_thread_cb (GTask *task,
state->list = gs_plugin_loader_run_results (plugin_loader,
state->action,
"gs_plugin_add_updates",
- state->flags,
+ state->refine_flags,
+ state->failure_flags,
cancellable,
&error);
if (error != NULL) {
@@ -1274,7 +1294,8 @@ gs_plugin_loader_get_updates_thread_cb (GTask *task,
list = gs_plugin_loader_run_results (plugin_loader,
state->action,
"gs_plugin_add_updates_pending",
- state->flags,
+ state->refine_flags,
+ state->failure_flags,
cancellable,
&error);
if (error != NULL) {
@@ -1291,6 +1312,7 @@ gs_plugin_loader_get_updates_thread_cb (GTask *task,
"gs_plugin_add_updates_*",
state->list,
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+ state->failure_flags,
cancellable,
&error);
if (!ret) {
@@ -1337,7 +1359,8 @@ gs_plugin_loader_get_updates_thread_cb (GTask *task,
**/
void
gs_plugin_loader_get_updates_async (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -1350,7 +1373,8 @@ gs_plugin_loader_get_updates_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
- state->flags = flags;
+ state->refine_flags = refine_flags;
+ state->failure_flags = failure_flags;
state->action = GS_PLUGIN_ACTION_GET_UPDATES;
/* run in a thread */
@@ -1393,7 +1417,8 @@ gs_plugin_loader_get_distro_upgrades_thread_cb (GTask *task,
state->list = gs_plugin_loader_run_results (plugin_loader,
state->action,
"gs_plugin_add_distro_upgrades",
- state->flags,
+ state->refine_flags,
+ state->failure_flags,
cancellable,
&error);
if (error != NULL) {
@@ -1417,7 +1442,8 @@ gs_plugin_loader_get_distro_upgrades_thread_cb (GTask *task,
**/
void
gs_plugin_loader_get_distro_upgrades_async (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -1430,7 +1456,8 @@ gs_plugin_loader_get_distro_upgrades_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
- state->flags = flags;
+ state->refine_flags = refine_flags;
+ state->failure_flags = failure_flags;
state->action = GS_PLUGIN_ACTION_GET_DISTRO_UPDATES;
/* run in a thread */
@@ -1473,7 +1500,8 @@ gs_plugin_loader_get_unvoted_reviews_thread_cb (GTask *task,
state->list = gs_plugin_loader_run_results (plugin_loader,
state->action,
"gs_plugin_add_unvoted_reviews",
- state->flags,
+ state->refine_flags,
+ state->failure_flags,
cancellable,
&error);
if (error != NULL) {
@@ -1497,7 +1525,8 @@ gs_plugin_loader_get_unvoted_reviews_thread_cb (GTask *task,
**/
void
gs_plugin_loader_get_unvoted_reviews_async (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -1510,7 +1539,8 @@ gs_plugin_loader_get_unvoted_reviews_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
- state->flags = flags;
+ state->refine_flags = refine_flags;
+ state->failure_flags = failure_flags;
state->action = GS_PLUGIN_ACTION_GET_UNVOTED_REVIEWS;
/* run in a thread */
@@ -1553,7 +1583,8 @@ gs_plugin_loader_get_sources_thread_cb (GTask *task,
state->list = gs_plugin_loader_run_results (plugin_loader,
state->action,
"gs_plugin_add_sources",
- state->flags,
+ state->refine_flags,
+ state->failure_flags,
cancellable,
&error);
if (error != NULL) {
@@ -1580,7 +1611,8 @@ gs_plugin_loader_get_sources_thread_cb (GTask *task,
**/
void
gs_plugin_loader_get_sources_async (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -1593,7 +1625,8 @@ gs_plugin_loader_get_sources_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
- state->flags = flags;
+ state->refine_flags = refine_flags;
+ state->failure_flags = failure_flags;
state->action = GS_PLUGIN_ACTION_GET_SOURCES;
/* run in a thread */
@@ -1637,7 +1670,8 @@ gs_plugin_loader_get_installed_thread_cb (GTask *task,
state->list = gs_plugin_loader_run_results (plugin_loader,
state->action,
"gs_plugin_add_installed",
- state->flags,
+ state->refine_flags,
+ state->failure_flags,
cancellable,
&error);
if (error != NULL) {
@@ -1676,7 +1710,8 @@ gs_plugin_loader_get_installed_thread_cb (GTask *task,
**/
void
gs_plugin_loader_get_installed_async (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -1689,7 +1724,8 @@ gs_plugin_loader_get_installed_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
- state->flags = flags;
+ state->refine_flags = refine_flags;
+ state->failure_flags = failure_flags;
state->action = GS_PLUGIN_ACTION_GET_INSTALLED;
/* run in a thread */
@@ -1751,7 +1787,8 @@ gs_plugin_loader_get_popular_thread_cb (GTask *task,
state->list = gs_plugin_loader_run_results (plugin_loader,
state->action,
"gs_plugin_add_popular",
- state->flags,
+ state->refine_flags,
+ state->failure_flags,
cancellable,
&error);
if (error != NULL) {
@@ -1775,7 +1812,8 @@ gs_plugin_loader_get_popular_thread_cb (GTask *task,
void
gs_plugin_loader_get_popular_async (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -1788,7 +1826,8 @@ gs_plugin_loader_get_popular_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
- state->flags = flags;
+ state->refine_flags = refine_flags;
+ state->failure_flags = failure_flags;
state->action = GS_PLUGIN_ACTION_GET_POPULAR;
/* run in a thread */
@@ -1841,7 +1880,8 @@ gs_plugin_loader_get_featured_thread_cb (GTask *task,
state->list = gs_plugin_loader_run_results (plugin_loader,
state->action,
"gs_plugin_add_featured",
- state->flags,
+ state->refine_flags,
+ state->failure_flags,
cancellable,
&error);
if (error != NULL) {
@@ -1888,7 +1928,8 @@ gs_plugin_loader_get_featured_thread_cb (GTask *task,
**/
void
gs_plugin_loader_get_featured_async (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -1901,7 +1942,8 @@ gs_plugin_loader_get_featured_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
- state->flags = flags;
+ state->refine_flags = refine_flags;
+ state->failure_flags = failure_flags;
state->action = GS_PLUGIN_ACTION_GET_FEATURED;
/* run in a thread */
@@ -2058,7 +2100,8 @@ gs_plugin_loader_search_thread_cb (GTask *task,
ret = gs_plugin_loader_run_refine (plugin_loader,
function_name,
state->list,
- state->flags,
+ state->refine_flags,
+ state->failure_flags,
cancellable,
&error);
if (!ret) {
@@ -2115,7 +2158,8 @@ gs_plugin_loader_search_thread_cb (GTask *task,
void
gs_plugin_loader_search_async (GsPluginLoader *plugin_loader,
const gchar *value,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -2128,7 +2172,8 @@ gs_plugin_loader_search_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
- state->flags = flags;
+ state->refine_flags = refine_flags;
+ state->failure_flags = failure_flags;
state->list = gs_app_list_new ();
state->value = g_strdup (value);
state->action = GS_PLUGIN_ACTION_SEARCH;
@@ -2224,7 +2269,8 @@ gs_plugin_loader_search_files_thread_cb (GTask *task,
ret = gs_plugin_loader_run_refine (plugin_loader,
function_name,
state->list,
- state->flags,
+ state->refine_flags,
+ state->failure_flags,
cancellable,
&error);
if (!ret) {
@@ -2282,7 +2328,8 @@ gs_plugin_loader_search_files_thread_cb (GTask *task,
void
gs_plugin_loader_search_files_async (GsPluginLoader *plugin_loader,
const gchar *value,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -2295,7 +2342,8 @@ gs_plugin_loader_search_files_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
- state->flags = flags;
+ state->refine_flags = refine_flags;
+ state->failure_flags = failure_flags;
state->list = gs_app_list_new ();
state->value = g_strdup (value);
state->action = GS_PLUGIN_ACTION_SEARCH_FILES;
@@ -2391,7 +2439,8 @@ gs_plugin_loader_search_what_provides_thread_cb (GTask *task,
ret = gs_plugin_loader_run_refine (plugin_loader,
function_name,
state->list,
- state->flags,
+ state->refine_flags,
+ state->failure_flags,
cancellable,
&error);
if (!ret) {
@@ -2449,7 +2498,8 @@ gs_plugin_loader_search_what_provides_thread_cb (GTask *task,
void
gs_plugin_loader_search_what_provides_async (GsPluginLoader *plugin_loader,
const gchar *value,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -2462,7 +2512,8 @@ gs_plugin_loader_search_what_provides_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
- state->flags = flags;
+ state->refine_flags = refine_flags;
+ state->failure_flags = failure_flags;
state->list = gs_app_list_new ();
state->value = g_strdup (value);
state->action = GS_PLUGIN_ACTION_SEARCH_PROVIDES;
@@ -2579,22 +2630,14 @@ gs_plugin_loader_get_categories_thread_cb (GTask *task,
cancellable, &error_local);
gs_plugin_loader_action_stop (plugin_loader, plugin);
if (!ret) {
- /* badly behaved plugin */
- if (error_local == NULL) {
- g_critical ("%s did not set error for %s",
- gs_plugin_get_name (plugin),
- function_name);
- continue;
- }
- g_warning ("failed to call %s on %s: %s",
- function_name,
- gs_plugin_get_name (plugin),
- error_local->message);
- gs_plugin_loader_create_event_from_error (plugin_loader,
- state->action,
- plugin,
- NULL, /* app */
- error_local);
+ gs_plugin_error_handle_failure (plugin_loader,
+ plugin,
+ NULL, /* app */
+ state->action,
+ function_name,
+ state->failure_flags,
+ error_local,
+ NULL);
continue;
}
gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_FINISHED);
@@ -2634,7 +2677,8 @@ gs_plugin_loader_get_categories_thread_cb (GTask *task,
**/
void
gs_plugin_loader_get_categories_async (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -2647,7 +2691,8 @@ gs_plugin_loader_get_categories_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
- state->flags = flags;
+ state->refine_flags = refine_flags;
+ state->failure_flags = failure_flags;
state->catlist = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
state->action = GS_PLUGIN_ACTION_GET_CATEGORIES;
@@ -2718,22 +2763,18 @@ gs_plugin_loader_get_category_apps_thread_cb (GTask *task,
cancellable, &error_local);
gs_plugin_loader_action_stop (plugin_loader, plugin);
if (!ret) {
- /* badly behaved plugin */
- if (error_local == NULL) {
- g_critical ("%s did not set error for %s",
- gs_plugin_get_name (plugin),
- function_name);
- continue;
+ if (!gs_plugin_error_handle_failure (plugin_loader,
+ plugin,
+ NULL, /* app */
+ state->action,
+ function_name,
+ state->failure_flags,
+ error_local,
+ NULL)) {
+ g_task_return_error (task, error_local);
+ error_local = NULL;
+ return;
}
- g_warning ("failed to call %s on %s: %s",
- function_name,
- gs_plugin_get_name (plugin),
- error_local->message);
- gs_plugin_loader_create_event_from_error (plugin_loader,
- state->action,
- plugin,
- NULL, /* app */
- error_local);
continue;
}
gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_FINISHED);
@@ -2743,7 +2784,8 @@ gs_plugin_loader_get_category_apps_thread_cb (GTask *task,
ret = gs_plugin_loader_run_refine (plugin_loader,
function_name,
state->list,
- state->flags,
+ state->refine_flags,
+ state->failure_flags,
cancellable,
&error);
if (!ret) {
@@ -2792,7 +2834,8 @@ gs_plugin_loader_get_category_apps_thread_cb (GTask *task,
void
gs_plugin_loader_get_category_apps_async (GsPluginLoader *plugin_loader,
GsCategory *category,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -2805,7 +2848,8 @@ gs_plugin_loader_get_category_apps_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
- state->flags = flags;
+ state->refine_flags = refine_flags;
+ state->failure_flags = failure_flags;
state->list = gs_app_list_new ();
state->category = g_object_ref (category);
state->action = GS_PLUGIN_ACTION_GET_CATEGORY_APPS;
@@ -2854,7 +2898,8 @@ gs_plugin_loader_app_refine_thread_cb (GTask *task,
ret = gs_plugin_loader_run_refine (plugin_loader,
NULL,
list,
- state->flags,
+ state->refine_flags,
+ state->failure_flags,
cancellable,
&error);
if (!ret) {
@@ -2877,7 +2922,8 @@ out:
void
gs_plugin_loader_app_refine_async (GsPluginLoader *plugin_loader,
GsApp *app,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -2892,12 +2938,13 @@ gs_plugin_loader_app_refine_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
state->app = g_object_ref (app);
- state->flags = flags;
+ state->refine_flags = refine_flags;
+ state->failure_flags = failure_flags;
state->action = GS_PLUGIN_ACTION_REFINE;
/* enforce this */
- if (state->flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_KEY_COLORS)
- state->flags |= GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON;
+ if (state->refine_flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_KEY_COLORS)
+ state->refine_flags |= GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON;
/* run in a thread */
task = g_task_new (plugin_loader, cancellable, callback, user_data);
@@ -2960,6 +3007,7 @@ gs_plugin_loader_app_action_thread_cb (GTask *task,
state->app,
state->action,
state->function_name,
+ state->failure_flags,
cancellable,
&error);
if (ret) {
@@ -2978,6 +3026,7 @@ gs_plugin_loader_app_action_thread_cb (GTask *task,
state->function_name,
list,
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN,
+ state->failure_flags,
cancellable,
&error);
if (ret) {
@@ -3054,29 +3103,18 @@ gs_plugin_loader_review_action_thread_cb (GTask *task,
cancellable, &error_local);
gs_plugin_loader_action_stop (plugin_loader, plugin);
if (!ret) {
- /* badly behaved plugin */
- if (error_local == NULL) {
- g_critical ("%s did not set error for %s",
- gs_plugin_get_name (plugin),
- state->function_name);
- continue;
- }
-
- /* abort early to allow main thread to process */
- if (gs_plugin_loader_is_auth_error (error_local)) {
+ if (!gs_plugin_error_handle_failure (plugin_loader,
+ plugin,
+ state->app,
+ state->action,
+ state->function_name,
+ state->failure_flags,
+ error_local,
+ NULL)) {
g_task_return_error (task, error_local);
error_local = NULL;
return;
}
- g_warning ("failed to call %s on %s: %s",
- state->function_name,
- gs_plugin_get_name (plugin),
- error_local->message);
- gs_plugin_loader_create_event_from_error (plugin_loader,
- state->action,
- plugin,
- state->app,
- error_local);
continue;
}
anything_ran = TRUE;
@@ -3151,6 +3189,7 @@ load_install_queue (GsPluginLoader *plugin_loader, GError **error)
NULL,
list,
GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
NULL, //FIXME?
error);
if (!ret)
@@ -3266,6 +3305,7 @@ void
gs_plugin_loader_app_action_async (GsPluginLoader *plugin_loader,
GsApp *app,
GsPluginAction action,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -3283,6 +3323,7 @@ gs_plugin_loader_app_action_async (GsPluginLoader *plugin_loader,
g_autoptr(GsAppList) list = gs_app_list_new ();
gs_app_list_add (list, app);
gs_plugin_loader_update_async (plugin_loader, list,
+ failure_flags,
cancellable, callback,
user_data);
return;
@@ -3353,6 +3394,7 @@ gs_plugin_loader_review_action_async (GsPluginLoader *plugin_loader,
GsApp *app,
AsReview *review,
GsPluginAction action,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -3369,6 +3411,7 @@ gs_plugin_loader_review_action_async (GsPluginLoader *plugin_loader,
state->app = g_object_ref (app);
state->review = g_object_ref (review);
state->action = action;
+ state->failure_flags = failure_flags;
switch (action) {
case GS_PLUGIN_ACTION_REVIEW_SUBMIT:
@@ -3457,18 +3500,19 @@ gs_plugin_loader_auth_action_thread_cb (GTask *task,
ret = plugin_func (plugin, state->auth, cancellable, &error_local);
gs_plugin_loader_action_stop (plugin_loader, plugin);
if (!ret) {
- /* badly behaved plugin */
- if (error_local == NULL) {
- g_critical ("%s did not set error for %s",
- gs_plugin_get_name (plugin),
- state->function_name);
- continue;
+ if (!gs_plugin_error_handle_failure (plugin_loader,
+ plugin,
+ NULL, /* app */
+ state->action,
+ state->function_name,
+ state->failure_flags,
+ error_local,
+ NULL)) {
+ g_task_return_error (task, error_local);
+ error_local = NULL;
+ return;
}
-
- /* stop running other plugins on failure */
- g_task_return_error (task, error_local);
- error_local = NULL;
- return;
+ continue;
}
gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_FINISHED);
}
@@ -3480,6 +3524,7 @@ void
gs_plugin_loader_auth_action_async (GsPluginLoader *plugin_loader,
GsAuth *auth,
GsPluginAction action,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -3495,6 +3540,7 @@ gs_plugin_loader_auth_action_async (GsPluginLoader *plugin_loader,
state = g_slice_new0 (GsPluginLoaderAsyncState);
state->auth = g_object_ref (auth);
state->action = action;
+ state->failure_flags = failure_flags;
switch (action) {
case GS_PLUGIN_ACTION_AUTH_LOGIN:
@@ -3959,6 +4005,7 @@ gboolean
gs_plugin_loader_setup (GsPluginLoader *plugin_loader,
gchar **whitelist,
gchar **blacklist,
+ GsPluginFailureFlags failure_flags,
GError **error)
{
GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
@@ -4194,21 +4241,17 @@ gs_plugin_loader_setup (GsPluginLoader *plugin_loader,
ret = plugin_func (plugin, NULL, &error_local);
gs_plugin_loader_action_stop (plugin_loader, plugin);
if (!ret) {
- /* badly behaved plugin */
- if (error_local == NULL) {
- g_critical ("%s did not set error for %s",
- gs_plugin_get_name (plugin),
- function_name);
- } else {
- g_debug ("disabling %s as setup failed: %s",
- gs_plugin_get_name (plugin),
- error_local->message);
- gs_plugin_loader_create_event_from_error (plugin_loader,
- GS_PLUGIN_ACTION_SETUP,
- plugin,
- NULL, /* app */
- error_local);
- }
+ gs_plugin_error_handle_failure (plugin_loader,
+ plugin,
+ NULL, /* app */
+ GS_PLUGIN_ACTION_SETUP,
+ function_name,
+ failure_flags | GS_PLUGIN_FAILURE_FLAGS_NO_CONSOLE,
+ error_local,
+ NULL);
+ g_debug ("disabling %s as setup failed: %s",
+ gs_plugin_get_name (plugin),
+ error_local->message);
gs_plugin_set_enabled (plugin, FALSE);
}
}
@@ -4515,6 +4558,7 @@ gs_plugin_loader_set_network_status (GsPluginLoader *plugin_loader,
gs_plugin_loader_app_action_async (plugin_loader,
app,
GS_PLUGIN_ACTION_INSTALL,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
NULL,
gs_plugin_loader_app_installed_cb,
g_object_ref (app));
@@ -4526,7 +4570,8 @@ gs_plugin_loader_set_network_status (GsPluginLoader *plugin_loader,
static gboolean
gs_plugin_loader_run_refresh (GsPluginLoader *plugin_loader,
guint cache_age,
- GsPluginRefreshFlags flags,
+ GsPluginRefreshFlags refresh_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GError **error)
{
@@ -4562,31 +4607,19 @@ gs_plugin_loader_run_refresh (GsPluginLoader *plugin_loader,
function_name);
g_assert (ptask != NULL);
gs_plugin_loader_action_start (plugin_loader, plugin, TRUE);
- ret = plugin_func (plugin, cache_age, flags, cancellable, &error_local);
+ ret = plugin_func (plugin, cache_age, refresh_flags, cancellable, &error_local);
gs_plugin_loader_action_stop (plugin_loader, plugin);
if (!ret) {
- /* badly behaved plugin */
- if (error_local == NULL) {
- g_critical ("%s did not set error for %s",
- gs_plugin_get_name (plugin),
- function_name);
- continue;
- }
- if (flags & GS_PLUGIN_REFRESH_FLAGS_INTERACTIVE) {
- g_propagate_error (error, error_local);
- error_local = NULL;
+ if (!gs_plugin_error_handle_failure (plugin_loader,
+ plugin,
+ NULL, /* app */
+ GS_PLUGIN_ACTION_REFRESH,
+ function_name,
+ failure_flags,
+ error_local,
+ error)) {
return FALSE;
- } else {
- gs_plugin_loader_create_event_from_error (plugin_loader,
- GS_PLUGIN_ACTION_REFRESH,
- plugin,
- NULL, /* app */
- error_local);
}
- g_warning ("failed to call %s on %s: %s",
- function_name,
- gs_plugin_get_name (plugin),
- error_local->message);
continue;
}
anything_ran = TRUE;
@@ -4617,7 +4650,8 @@ gs_plugin_loader_refresh_thread_cb (GTask *task,
ret = gs_plugin_loader_run_refresh (plugin_loader,
state->cache_age,
- state->flags,
+ state->refresh_flags,
+ state->failure_flags,
cancellable,
&error);
if (!ret) {
@@ -4639,7 +4673,8 @@ gs_plugin_loader_refresh_thread_cb (GTask *task,
void
gs_plugin_loader_refresh_async (GsPluginLoader *plugin_loader,
guint cache_age,
- GsPluginRefreshFlags flags,
+ GsPluginRefreshFlags refresh_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -4652,7 +4687,8 @@ gs_plugin_loader_refresh_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
- state->flags = flags;
+ state->refresh_flags = refresh_flags;
+ state->failure_flags = failure_flags;
state->cache_age = cache_age;
state->action = GS_PLUGIN_ACTION_REFRESH;
@@ -4736,22 +4772,14 @@ gs_plugin_loader_file_to_app_thread_cb (GTask *task,
cancellable, &error_local);
gs_plugin_loader_action_stop (plugin_loader, plugin);
if (!ret) {
- /* badly behaved plugin */
- if (error_local == NULL) {
- g_critical ("%s did not set error for %s",
- gs_plugin_get_name (plugin),
- function_name);
- continue;
- }
- g_warning ("failed to call %s on %s: %s",
- function_name,
- gs_plugin_get_name (plugin),
- error_local->message);
- gs_plugin_loader_create_event_from_error (plugin_loader,
- state->action,
- plugin,
- NULL, /* app */
- error_local);
+ gs_plugin_error_handle_failure (plugin_loader,
+ plugin,
+ NULL, /* app */
+ state->action,
+ function_name,
+ state->failure_flags,
+ error_local,
+ NULL);
continue;
}
gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_FINISHED);
@@ -4768,7 +4796,8 @@ gs_plugin_loader_file_to_app_thread_cb (GTask *task,
ret = gs_plugin_loader_run_refine (plugin_loader,
function_name,
state->list,
- state->flags,
+ state->refine_flags,
+ state->failure_flags,
cancellable,
&error);
if (!ret) {
@@ -4801,6 +4830,7 @@ gs_plugin_loader_file_to_app_thread_cb (GTask *task,
function_name,
state->list,
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+ state->failure_flags,
cancellable,
&error);
if (!ret) {
@@ -4838,7 +4868,8 @@ gs_plugin_loader_file_to_app_thread_cb (GTask *task,
void
gs_plugin_loader_file_to_app_async (GsPluginLoader *plugin_loader,
GFile *file,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -4851,7 +4882,8 @@ gs_plugin_loader_file_to_app_async (GsPluginLoader *plugin_loader,
/* save state */
state = g_slice_new0 (GsPluginLoaderAsyncState);
- state->flags = flags;
+ state->refine_flags = refine_flags;
+ state->failure_flags = failure_flags;
state->list = gs_app_list_new ();
state->file = g_object_ref (file);
state->action = GS_PLUGIN_ACTION_FILE_TO_APP;
@@ -4921,22 +4953,14 @@ gs_plugin_loader_update_thread_cb (GTask *task,
ret = plugin_func (plugin, state->list, cancellable, &error_local);
gs_plugin_loader_action_stop (plugin_loader, plugin);
if (!ret) {
- /* badly behaved plugin */
- if (error_local == NULL) {
- g_critical ("%s did not set error for %s",
- gs_plugin_get_name (plugin),
- function_name);
- continue;
- }
- g_warning ("failed to call %s on %s: %s",
- function_name,
- gs_plugin_get_name (plugin),
- error_local->message);
- gs_plugin_loader_create_event_from_error (plugin_loader,
- state->action,
- plugin,
- NULL, /* app */
- error_local);
+ gs_plugin_error_handle_failure (plugin_loader,
+ plugin,
+ NULL, /* app */
+ state->action,
+ function_name,
+ state->failure_flags,
+ error_local,
+ NULL);
continue;
}
gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_FINISHED);
@@ -4977,22 +5001,14 @@ gs_plugin_loader_update_thread_cb (GTask *task,
&error_local);
gs_plugin_loader_action_stop (plugin_loader, plugin);
if (!ret) {
- /* badly behaved plugin */
- if (error_local == NULL) {
- g_critical ("%s did not set error for %s",
- gs_plugin_get_name (plugin),
- function_name);
- continue;
- }
- g_warning ("failed to call %s on %s: %s",
- function_name,
- gs_plugin_get_name (plugin),
- error_local->message);
- gs_plugin_loader_create_event_from_error (plugin_loader,
- state->action,
- plugin,
- app,
- error_local);
+ gs_plugin_error_handle_failure (plugin_loader,
+ plugin,
+ app,
+ state->action,
+ function_name,
+ state->failure_flags,
+ error_local,
+ NULL);
continue;
}
}
@@ -5011,6 +5027,7 @@ gs_plugin_loader_update_thread_cb (GTask *task,
void
gs_plugin_loader_update_async (GsPluginLoader *plugin_loader,
GsAppList *apps,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -5025,6 +5042,7 @@ gs_plugin_loader_update_async (GsPluginLoader *plugin_loader,
state = g_slice_new0 (GsPluginLoaderAsyncState);
state->list = gs_app_list_copy (apps);
state->action = GS_PLUGIN_ACTION_UPDATE;
+ state->failure_flags = failure_flags;
/* 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 9049d8e..2c2c4e1 100644
--- a/src/gs-plugin-loader.h
+++ b/src/gs-plugin-loader.h
@@ -53,7 +53,8 @@ typedef void (*GsPluginLoaderFinishedFunc) (GsPluginLoader *plugin_loader,
GsPluginLoader *gs_plugin_loader_new (void);
void gs_plugin_loader_get_installed_async (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -61,7 +62,8 @@ GsAppList *gs_plugin_loader_get_installed_finish (GsPluginLoader *plugin_loader,
GAsyncResult *res,
GError **error);
void gs_plugin_loader_get_updates_async (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -69,7 +71,8 @@ GsAppList *gs_plugin_loader_get_updates_finish (GsPluginLoader *plugin_loader,
GAsyncResult *res,
GError **error);
void gs_plugin_loader_get_distro_upgrades_async (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -77,7 +80,8 @@ GsAppList *gs_plugin_loader_get_distro_upgrades_finish (GsPluginLoader *plugin_l
GAsyncResult *res,
GError **error);
void gs_plugin_loader_get_unvoted_reviews_async (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -85,7 +89,8 @@ GsAppList *gs_plugin_loader_get_unvoted_reviews_finish (GsPluginLoader *plugin_l
GAsyncResult *res,
GError **error);
void gs_plugin_loader_get_sources_async (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -93,7 +98,8 @@ GsAppList *gs_plugin_loader_get_sources_finish (GsPluginLoader *plugin_loader,
GAsyncResult *res,
GError **error);
void gs_plugin_loader_get_popular_async (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -101,7 +107,8 @@ GsAppList *gs_plugin_loader_get_popular_finish (GsPluginLoader *plugin_loader,
GAsyncResult *res,
GError **error);
void gs_plugin_loader_get_featured_async (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -109,7 +116,8 @@ GsAppList *gs_plugin_loader_get_featured_finish (GsPluginLoader *plugin_loader,
GAsyncResult *res,
GError **error);
void gs_plugin_loader_get_categories_async (GsPluginLoader *plugin_loader,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -118,7 +126,8 @@ GPtrArray *gs_plugin_loader_get_categories_finish (GsPluginLoader *plugin_loader
GError **error);
void gs_plugin_loader_get_category_apps_async (GsPluginLoader *plugin_loader,
GsCategory *category,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -127,7 +136,8 @@ GsAppList *gs_plugin_loader_get_category_apps_finish (GsPluginLoader *plugin_loa
GError **error);
void gs_plugin_loader_search_async (GsPluginLoader *plugin_loader,
const gchar *value,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -136,7 +146,8 @@ GsAppList *gs_plugin_loader_search_finish (GsPluginLoader *plugin_loader,
GError **error);
void gs_plugin_loader_search_files_async (GsPluginLoader *plugin_loader,
const gchar *value,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -145,7 +156,8 @@ GsAppList *gs_plugin_loader_search_files_finish (GsPluginLoader *plugin_loader,
GError **error);
void gs_plugin_loader_search_what_provides_async (GsPluginLoader *plugin_loader,
const gchar *value,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -154,7 +166,8 @@ GsAppList *gs_plugin_loader_search_what_provides_finish (GsPluginLoader *plugin_
GError **error);
void gs_plugin_loader_file_to_app_async (GsPluginLoader *plugin_loader,
GFile *file,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -163,6 +176,7 @@ GsApp *gs_plugin_loader_file_to_app_finish (GsPluginLoader
*plugin_loader,
GError **error);
void gs_plugin_loader_update_async (GsPluginLoader *plugin_loader,
GsAppList *apps,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -172,6 +186,7 @@ gboolean gs_plugin_loader_update_finish (GsPluginLoader *plugin_loader,
gboolean gs_plugin_loader_setup (GsPluginLoader *plugin_loader,
gchar **whitelist,
gchar **blacklist,
+ GsPluginFailureFlags failure_flags,
GError **error);
void gs_plugin_loader_dump_state (GsPluginLoader *plugin_loader);
gboolean gs_plugin_loader_get_enabled (GsPluginLoader *plugin_loader,
@@ -185,7 +200,8 @@ void gs_plugin_loader_set_scale (GsPluginLoader
*plugin_loader,
guint scale);
void gs_plugin_loader_app_refine_async (GsPluginLoader *plugin_loader,
GsApp *app,
- GsPluginRefineFlags flags,
+ GsPluginRefineFlags refine_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -195,6 +211,7 @@ gboolean gs_plugin_loader_app_refine_finish (GsPluginLoader *plugin_loader,
void gs_plugin_loader_app_action_async (GsPluginLoader *plugin_loader,
GsApp *app,
GsPluginAction a,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -208,6 +225,7 @@ void gs_plugin_loader_review_action_async (GsPluginLoader
*plugin_loader,
GsApp *app,
AsReview *review,
GsPluginAction action,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -217,6 +235,7 @@ gboolean gs_plugin_loader_auth_action_finish (GsPluginLoader *plugin_loader,
void gs_plugin_loader_auth_action_async (GsPluginLoader *plugin_loader,
GsAuth *auth,
GsPluginAction action,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -225,7 +244,8 @@ gboolean gs_plugin_loader_refresh_finish (GsPluginLoader *plugin_loader,
GError **error);
void gs_plugin_loader_refresh_async (GsPluginLoader *plugin_loader,
guint cache_age,
- GsPluginRefreshFlags flags,
+ GsPluginRefreshFlags refresh_flags,
+ GsPluginFailureFlags failure_flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
diff --git a/src/gs-plugin-types.h b/src/gs-plugin-types.h
index b4f6d42..498d2b9 100644
--- a/src/gs-plugin-types.h
+++ b/src/gs-plugin-types.h
@@ -300,6 +300,30 @@ typedef enum {
GS_PLUGIN_ACTION_LAST
} GsPluginAction;
+/**
+ * GsPluginFailureFlags:
+ * @GS_PLUGIN_FAILURE_FLAGS_NONE: No flags set
+ * @GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS: Report errors out-of-band
+ * @GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL: Abort after any plugin error
+ * @GS_PLUGIN_FAILURE_FLAGS_FATAL_AUTH: Abort after a authentication error
+ * @GS_PLUGIN_FAILURE_FLAGS_NO_CONSOLE: Do not show a message on the console
+ *
+ * The failure flags for the plugin action.
+ *
+ * When %GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS is specified plugin errors are not
+ * treated as fatal errors and are reported to the in-app notification system
+ * where they may or may not be shown depending on policy.
+ **/
+typedef enum {
+ GS_PLUGIN_FAILURE_FLAGS_NONE = 0,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS = 1 << 0,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL = 1 << 1,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_AUTH = 1 << 2,
+ GS_PLUGIN_FAILURE_FLAGS_NO_CONSOLE = 1 << 3,
+ /*< private >*/
+ GS_PLUGIN_FAILURE_FLAGS_LAST
+} GsPluginFailureFlags;
+
G_END_DECLS
#endif /* __GS_PLUGIN_TYPES_H */
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index 3f2a494..82b2f4c 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -390,6 +390,7 @@ gs_plugin_loader_install_func (GsPluginLoader *plugin_loader)
gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
ret = gs_plugin_loader_app_action (plugin_loader, app,
GS_PLUGIN_ACTION_INSTALL,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -400,6 +401,7 @@ gs_plugin_loader_install_func (GsPluginLoader *plugin_loader)
* but dummy::refine() sets it */
ret = gs_plugin_loader_app_action (plugin_loader, app,
GS_PLUGIN_ACTION_REMOVE,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -430,6 +432,7 @@ gs_plugin_loader_error_func (GsPluginLoader *plugin_loader)
gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
ret = gs_plugin_loader_app_action (plugin_loader, app,
GS_PLUGIN_ACTION_UPDATE,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
NULL,
&error);
g_assert_no_error (error);
@@ -475,6 +478,7 @@ gs_plugin_loader_refine_func (GsPluginLoader *plugin_loader)
GS_PLUGIN_REFINE_FLAGS_REQUIRE_DESCRIPTION |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_LICENSE |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_URL,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -498,6 +502,7 @@ gs_plugin_loader_key_colors_func (GsPluginLoader *plugin_loader)
app = gs_app_new ("zeus.desktop");
ret = gs_plugin_loader_app_refine (plugin_loader, app,
GS_PLUGIN_REFINE_FLAGS_REQUIRE_KEY_COLORS,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -529,6 +534,7 @@ gs_plugin_loader_updates_func (GsPluginLoader *plugin_loader)
/* get the updates list */
list = gs_plugin_loader_get_updates (plugin_loader,
GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -564,6 +570,7 @@ gs_plugin_loader_distro_upgrades_func (GsPluginLoader *plugin_loader)
/* get the updates list */
list = gs_plugin_loader_get_distro_upgrades (plugin_loader,
GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -583,6 +590,7 @@ gs_plugin_loader_distro_upgrades_func (GsPluginLoader *plugin_loader)
ret = gs_plugin_loader_app_action (plugin_loader,
app,
GS_PLUGIN_ACTION_UPGRADE_DOWNLOAD,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -593,6 +601,7 @@ gs_plugin_loader_distro_upgrades_func (GsPluginLoader *plugin_loader)
ret = gs_plugin_loader_app_action (plugin_loader,
app,
GS_PLUGIN_ACTION_UPGRADE_TRIGGER,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -619,6 +628,7 @@ gs_plugin_loader_installed_func (GsPluginLoader *plugin_loader)
GS_PLUGIN_REFINE_FLAGS_REQUIRE_MENU_PATH |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -677,6 +687,7 @@ gs_plugin_loader_search_func (GsPluginLoader *plugin_loader)
list = gs_plugin_loader_search (plugin_loader,
"spell",
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -701,6 +712,7 @@ gs_plugin_loader_modalias_func (GsPluginLoader *plugin_loader)
list = gs_plugin_loader_search (plugin_loader,
"colorhug2",
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -731,6 +743,7 @@ gs_plugin_loader_webapps_func (GsPluginLoader *plugin_loader)
gs_app_set_kind (app, AS_APP_KIND_WEB_APP);
ret = gs_plugin_loader_app_refine (plugin_loader, app,
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -758,6 +771,7 @@ gs_plugin_loader_dpkg_func (GsPluginLoader *plugin_loader)
app = gs_plugin_loader_file_to_app (plugin_loader,
file,
GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -793,6 +807,7 @@ gs_plugin_loader_packagekit_local_func (GsPluginLoader *plugin_loader)
app = gs_plugin_loader_file_to_app (plugin_loader,
file,
GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -827,6 +842,7 @@ gs_plugin_loader_fwupd_func (GsPluginLoader *plugin_loader)
app = gs_plugin_loader_file_to_app (plugin_loader,
file,
GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -863,6 +879,7 @@ gs_plugin_loader_repos_func (GsPluginLoader *plugin_loader)
gs_app_set_origin (app, "utopia");
ret = gs_plugin_loader_app_refine (plugin_loader, app,
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -896,6 +913,7 @@ gs_plugin_loader_flatpak_repo_func (GsPluginLoader *plugin_loader)
app = gs_plugin_loader_file_to_app (plugin_loader,
file,
GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -916,6 +934,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_ACTION_INSTALL,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -943,6 +962,7 @@ gs_plugin_loader_flatpak_repo_func (GsPluginLoader *plugin_loader)
app2 = gs_plugin_loader_file_to_app (plugin_loader,
file,
GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -952,6 +972,7 @@ gs_plugin_loader_flatpak_repo_func (GsPluginLoader *plugin_loader)
/* remove it */
ret = gs_plugin_loader_app_action (plugin_loader, app,
GS_PLUGIN_ACTION_REMOVE,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -1020,6 +1041,7 @@ gs_plugin_loader_flatpak_func (GsPluginLoader *plugin_loader)
gs_app_set_metadata (app_source, "flatpak::url", testdir_repourl);
ret = gs_plugin_loader_app_action (plugin_loader, app_source,
GS_PLUGIN_ACTION_INSTALL,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -1037,6 +1059,7 @@ gs_plugin_loader_flatpak_func (GsPluginLoader *plugin_loader)
/* check the source now exists */
sources = gs_plugin_loader_get_sources (plugin_loader,
GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -1050,6 +1073,7 @@ gs_plugin_loader_flatpak_func (GsPluginLoader *plugin_loader)
ret = gs_plugin_loader_refresh (plugin_loader,
G_MAXUINT,
GS_PLUGIN_REFRESH_FLAGS_METADATA,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -1061,6 +1085,7 @@ gs_plugin_loader_flatpak_func (GsPluginLoader *plugin_loader)
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -1082,6 +1107,7 @@ gs_plugin_loader_flatpak_func (GsPluginLoader *plugin_loader)
/* install, also installing runtime */
ret = gs_plugin_loader_app_action (plugin_loader, app,
GS_PLUGIN_ACTION_INSTALL,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -1129,6 +1155,7 @@ gs_plugin_loader_flatpak_func (GsPluginLoader *plugin_loader)
/* remove the application */
ret = gs_plugin_loader_app_action (plugin_loader, app,
GS_PLUGIN_ACTION_REMOVE,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -1150,6 +1177,7 @@ gs_plugin_loader_plugin_cache_func (GsPluginLoader *plugin_loader)
/* ensure we get the same results back from calling the methods twice */
list1 = gs_plugin_loader_get_distro_upgrades (plugin_loader,
GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -1159,6 +1187,7 @@ gs_plugin_loader_plugin_cache_func (GsPluginLoader *plugin_loader)
list2 = gs_plugin_loader_get_distro_upgrades (plugin_loader,
GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -1189,6 +1218,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_PLUGIN_ACTION_AUTH_REGISTER,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL, &error);
g_assert_error (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_AUTH_INVALID);
g_assert (!ret);
@@ -1200,6 +1230,7 @@ gs_plugin_loader_authentication_func (GsPluginLoader *plugin_loader)
review = as_review_new ();
ret = gs_plugin_loader_review_action (plugin_loader, app, review,
GS_PLUGIN_ACTION_REVIEW_REMOVE,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL, &error);
g_assert_error (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_AUTH_REQUIRED);
g_assert (!ret);
@@ -1208,6 +1239,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_PLUGIN_ACTION_AUTH_LOGIN,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL, &error);
g_assert_error (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_AUTH_INVALID);
g_assert (!ret);
@@ -1219,6 +1251,7 @@ gs_plugin_loader_authentication_func (GsPluginLoader *plugin_loader)
gs_auth_set_password (auth, "dummy");
ret = gs_plugin_loader_auth_action (plugin_loader, auth,
GS_PLUGIN_ACTION_AUTH_LOGIN,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL, &error);
g_assert_no_error (error);
g_assert (ret);
@@ -1228,6 +1261,7 @@ gs_plugin_loader_authentication_func (GsPluginLoader *plugin_loader)
review2 = as_review_new ();
ret = gs_plugin_loader_review_action (plugin_loader, app, review2,
GS_PLUGIN_ACTION_REVIEW_REMOVE,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL, &error);
g_assert_no_error (error);
g_assert (ret);
@@ -1280,6 +1314,7 @@ gs_plugin_loader_wildcard_func (GsPluginLoader *plugin_loader)
list = gs_plugin_loader_get_popular (plugin_loader,
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
NULL,
&error);
g_assert_no_error (error);
@@ -1442,7 +1477,11 @@ main (int argc, char **argv)
g_signal_connect (plugin_loader, "status-changed",
G_CALLBACK (gs_plugin_loader_status_changed_cb), NULL);
gs_plugin_loader_set_location (plugin_loader, "./plugins/.libs");
- ret = gs_plugin_loader_setup (plugin_loader, (gchar**) whitelist, NULL, &error);
+ ret = gs_plugin_loader_setup (plugin_loader,
+ (gchar**) whitelist,
+ NULL,
+ GS_PLUGIN_FAILURE_FLAGS_NONE,
+ &error);
g_assert_no_error (error);
g_assert (ret);
g_assert (!gs_plugin_loader_get_enabled (plugin_loader, "notgoingtoexist"));
diff --git a/src/gs-shell-category.c b/src/gs-shell-category.c
index 1867c52..5c401ed 100644
--- a/src/gs-shell-category.c
+++ b/src/gs-shell-category.c
@@ -150,6 +150,7 @@ gs_shell_category_reload (GsPage *page)
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_VERSION |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->cancellable,
gs_shell_category_get_apps_cb,
self);
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 29193d4..369891d 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -1102,6 +1102,8 @@ gs_shell_details_authenticate_cb (GtkDialog *dialog,
helper->app,
helper->review,
helper->action,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS |
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
helper->self->cancellable,
gs_shell_details_app_set_review_cb,
helper);
@@ -1158,6 +1160,8 @@ gs_shell_details_review_button_clicked_cb (GsReviewRow *row,
helper->app,
helper->review,
helper->action,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS |
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
self->cancellable,
gs_shell_details_app_set_review_cb,
helper);
@@ -1306,6 +1310,7 @@ gs_shell_details_app_refine2 (GsShellDetails *self)
GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEW_RATINGS |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEWS,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->cancellable,
gs_shell_details_app_refine2_cb,
self);
@@ -1497,6 +1502,7 @@ gs_shell_details_set_filename (GsShellDetails *self, const gchar *filename)
GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_RELATED |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->cancellable,
gs_shell_details_file_to_app_cb,
self);
@@ -1519,6 +1525,7 @@ gs_shell_details_load (GsShellDetails *self)
GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ADDONS,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->cancellable,
gs_shell_details_app_refine_cb,
self);
@@ -1729,6 +1736,8 @@ gs_shell_details_review_response_cb (GtkDialog *dialog,
helper->app,
helper->review,
helper->action,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS |
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
self->cancellable,
gs_shell_details_app_set_review_cb,
helper);
diff --git a/src/gs-shell-extras.c b/src/gs-shell-extras.c
index d38d5cc..12e2dee 100644
--- a/src/gs-shell-extras.c
+++ b/src/gs-shell-extras.c
@@ -694,6 +694,7 @@ gs_shell_extras_load (GsShellExtras *self, GPtrArray *array_search_data)
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING |
GS_PLUGIN_REFINE_FLAGS_ALLOW_PACKAGES,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->search_cancellable,
search_files_cb,
search_data);
@@ -706,6 +707,7 @@ gs_shell_extras_load (GsShellExtras *self, GPtrArray *array_search_data)
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING |
GS_PLUGIN_REFINE_FLAGS_ALLOW_PACKAGES,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->search_cancellable,
file_to_app_cb,
search_data);
@@ -722,6 +724,7 @@ gs_shell_extras_load (GsShellExtras *self, GPtrArray *array_search_data)
GS_PLUGIN_REFINE_FLAGS_REQUIRE_LICENSE |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING |
GS_PLUGIN_REFINE_FLAGS_ALLOW_PACKAGES,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->search_cancellable,
get_search_what_provides_cb,
search_data);
diff --git a/src/gs-shell-installed.c b/src/gs-shell-installed.c
index 4bc49f9..0de6173 100644
--- a/src/gs-shell-installed.c
+++ b/src/gs-shell-installed.c
@@ -248,6 +248,7 @@ gs_shell_installed_load (GsShellInstalled *self)
GS_PLUGIN_REFINE_FLAGS_REQUIRE_DESCRIPTION |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_LICENSE |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->cancellable,
gs_shell_installed_get_installed_cb,
self);
diff --git a/src/gs-shell-loading.c b/src/gs-shell-loading.c
index d9e4fb8..bd7e6e1 100644
--- a/src/gs-shell-loading.c
+++ b/src/gs-shell-loading.c
@@ -105,6 +105,7 @@ gs_shell_loading_load (GsShellLoading *self)
* spin up the plugins enough as to prime caches */
gs_plugin_loader_refresh_async (priv->plugin_loader, G_MAXUINT,
GS_PLUGIN_REFRESH_FLAGS_METADATA,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
priv->cancellable,
gs_shell_loading_refresh_cb,
self);
diff --git a/src/gs-shell-moderate.c b/src/gs-shell-moderate.c
index 8b957e6..00d8769 100644
--- a/src/gs-shell-moderate.c
+++ b/src/gs-shell-moderate.c
@@ -75,6 +75,8 @@ gs_shell_moderate_review_clicked_cb (GsReviewRow *row,
app,
gs_review_row_get_review (row),
action,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL |
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->cancellable,
gs_shell_moderate_app_set_review_cb,
self);
@@ -188,6 +190,7 @@ gs_shell_moderate_load (GsShellModerate *self)
GS_PLUGIN_REFINE_FLAGS_REQUIRE_DESCRIPTION |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_LICENSE |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEWS,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->cancellable,
gs_shell_moderate_get_unvoted_reviews_cb,
self);
diff --git a/src/gs-shell-overview.c b/src/gs-shell-overview.c
index eacfa74..2066162 100644
--- a/src/gs-shell-overview.c
+++ b/src/gs-shell-overview.c
@@ -491,6 +491,7 @@ gs_shell_overview_load (GsShellOverview *self)
priv->loading_featured = TRUE;
gs_plugin_loader_get_featured_async (priv->plugin_loader,
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
priv->cancellable,
gs_shell_overview_get_featured_cb,
self);
@@ -502,6 +503,7 @@ gs_shell_overview_load (GsShellOverview *self)
gs_plugin_loader_get_popular_async (priv->plugin_loader,
GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEW_RATINGS |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
priv->cancellable,
gs_shell_overview_get_popular_cb,
self);
@@ -537,6 +539,7 @@ gs_shell_overview_load (GsShellOverview *self)
featured_category,
GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEW_RATINGS |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
priv->cancellable,
gs_shell_overview_get_category_apps_cb,
load_data);
@@ -549,6 +552,7 @@ gs_shell_overview_load (GsShellOverview *self)
priv->loading_categories = TRUE;
gs_plugin_loader_get_categories_async (priv->plugin_loader,
GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
priv->cancellable,
gs_shell_overview_get_categories_cb,
self);
@@ -672,6 +676,7 @@ g_shell_overview_rescan_proprietary_sources (GsShellOverview *self)
GsShellOverviewPrivate *priv = gs_shell_overview_get_instance_private (self);
gs_plugin_loader_get_sources_async (priv->plugin_loader,
GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
priv->cancellable,
(GAsyncReadyCallback) g_shell_overview_get_sources_cb,
self);
diff --git a/src/gs-shell-search-provider.c b/src/gs-shell-search-provider.c
index 85edb14..727429d 100644
--- a/src/gs-shell-search-provider.c
+++ b/src/gs-shell-search-provider.c
@@ -136,6 +136,7 @@ execute_search (GsShellSearchProvider *self,
gs_plugin_loader_search_async (self->plugin_loader,
string,
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+ GS_PLUGIN_FAILURE_FLAGS_NONE,
self->cancellable,
search_done_cb,
pending_search);
diff --git a/src/gs-shell-search.c b/src/gs-shell-search.c
index cc6f5da..4126429 100644
--- a/src/gs-shell-search.c
+++ b/src/gs-shell-search.c
@@ -198,6 +198,7 @@ gs_shell_search_load (GsShellSearch *self)
GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->search_cancellable,
gs_shell_search_get_search_cb,
self);
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 51cc1ae..212e438 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -607,6 +607,7 @@ gs_shell_updates_load (GsShellUpdates *self)
self->action_cnt++;
gs_plugin_loader_get_updates_async (self->plugin_loader,
refine_flags,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->cancellable,
(GAsyncReadyCallback) gs_shell_updates_get_updates_cb,
self);
@@ -616,6 +617,7 @@ gs_shell_updates_load (GsShellUpdates *self)
refine_flags |= GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPGRADE_REMOVED;
gs_plugin_loader_get_distro_upgrades_async (self->plugin_loader,
refine_flags,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->cancellable,
gs_shell_updates_get_upgrades_cb,
self);
@@ -765,6 +767,7 @@ gs_shell_updates_get_new_updates (GsShellUpdates *self)
gs_plugin_loader_refresh_async (self->plugin_loader,
10 * 60,
refresh_flags,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->cancellable_refresh,
(GAsyncReadyCallback) gs_shell_updates_refresh_cb,
self);
@@ -937,6 +940,7 @@ gs_shell_updates_reboot_failed_cb (GObject *source, GAsyncResult *res, gpointer
gs_plugin_loader_app_action_async (self->plugin_loader,
gs_app_list_index (apps, 0),
GS_PLUGIN_ACTION_UPDATE_CANCEL,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->cancellable,
cancel_trigger_failed_cb,
self);
@@ -1002,6 +1006,7 @@ gs_shell_updates_button_update_all_cb (GtkButton *button,
apps = gs_update_list_get_apps (GS_UPDATE_LIST (self->list_box_updates));
gs_plugin_loader_update_async (self->plugin_loader,
apps,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->cancellable,
(GAsyncReadyCallback) gs_shell_updates_perform_update_cb,
self);
@@ -1064,6 +1069,7 @@ gs_shell_updates_upgrade_download_cb (GsUpgradeBanner *upgrade_banner,
gs_plugin_loader_app_action_async (self->plugin_loader,
app,
GS_PLUGIN_ACTION_UPGRADE_DOWNLOAD,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->cancellable_upgrade_download,
upgrade_download_finished_cb,
helper);
@@ -1099,6 +1105,7 @@ upgrade_reboot_failed_cb (GObject *source,
gs_plugin_loader_app_action_async (self->plugin_loader,
app,
GS_PLUGIN_ACTION_UPDATE_CANCEL,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->cancellable,
cancel_trigger_failed_cb,
self);
@@ -1146,6 +1153,7 @@ trigger_upgrade (GsShellUpdates *self)
gs_plugin_loader_app_action_async (self->plugin_loader,
upgrade,
GS_PLUGIN_ACTION_UPGRADE_TRIGGER,
+ GS_PLUGIN_FAILURE_FLAGS_USE_EVENTS,
self->cancellable,
upgrade_trigger_finished_cb,
self);
diff --git a/src/gs-sources-dialog.c b/src/gs-sources-dialog.c
index b201309..b1ff95f 100644
--- a/src/gs-sources-dialog.c
+++ b/src/gs-sources-dialog.c
@@ -203,6 +203,7 @@ gs_sources_dialog_rescan_proprietary_sources (GsSourcesDialog *dialog)
gs_plugin_loader_app_action_async (dialog->plugin_loader,
app,
GS_PLUGIN_ACTION_INSTALL,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
dialog->cancellable,
source_modified_cb,
dialog);
@@ -212,6 +213,7 @@ gs_sources_dialog_rescan_proprietary_sources (GsSourcesDialog *dialog)
gs_plugin_loader_app_action_async (dialog->plugin_loader,
app,
GS_PLUGIN_ACTION_REMOVE,
+ GS_PLUGIN_FAILURE_FLAGS_FATAL_ALL,
dialog->cancellable,
source_modified_cb,
dialog);
@@ -365,6 +367,7 @@ reload_sources (GsSourcesDialog *dialog)
gs_plugin_loader_get_sources_async (dialog->plugin_loader,
GS_PLUGIN_REFINE_FLAGS_DEFAULT |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_RELATED,
+ GS_PLUGIN_FAILURE_FLAGS_NONE,
dialog->cancellable,
(GAsyncReadyCallback) get_sources_cb,
dialog);
@@ -512,6 +515,7 @@ remove_button_cb (GtkWidget *widget, GsSourcesDialog *dialog)
gs_plugin_loader_app_action_async (dialog->plugin_loader,
app,
GS_PLUGIN_ACTION_REMOVE,
+ GS_PLUGIN_FAILURE_FLAGS_NONE,
dialog->cancellable,
app_removed_cb,
dialog);
diff --git a/src/gs-update-dialog.c b/src/gs-update-dialog.c
index 69e189c..2c2d1a3 100644
--- a/src/gs-update-dialog.c
+++ b/src/gs-update-dialog.c
@@ -246,6 +246,7 @@ gs_update_dialog_show_installed_updates (GsUpdateDialog *dialog)
gs_plugin_loader_get_updates_async (dialog->plugin_loader,
refine_flags,
+ GS_PLUGIN_FAILURE_FLAGS_NONE,
dialog->cancellable,
(GAsyncReadyCallback) get_installed_updates_cb,
dialog);
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index 99f5c7f..61e496e 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -288,6 +288,7 @@ get_updates (GsUpdateMonitor *monitor)
gs_plugin_loader_get_updates_async (monitor->plugin_loader,
GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPDATE_DETAILS |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPDATE_SEVERITY,
+ GS_PLUGIN_FAILURE_FLAGS_NONE,
monitor->cancellable,
get_updates_finished_cb,
monitor);
@@ -302,6 +303,7 @@ get_upgrades (GsUpdateMonitor *monitor)
g_debug ("Getting upgrades");
gs_plugin_loader_get_distro_upgrades_async (monitor->plugin_loader,
GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+ GS_PLUGIN_FAILURE_FLAGS_NONE,
monitor->cancellable,
get_upgrades_finished_cb,
monitor);
@@ -415,6 +417,7 @@ check_updates (GsUpdateMonitor *monitor)
gs_plugin_loader_refresh_async (monitor->plugin_loader,
60 * 60 * 24,
refresh_flags,
+ GS_PLUGIN_FAILURE_FLAGS_NONE,
monitor->cancellable,
refresh_cache_finished_cb,
monitor);
@@ -605,6 +608,7 @@ cleanup_notifications_cb (gpointer user_data)
g_debug ("getting historical updates for fresh session");
gs_plugin_loader_get_updates_async (monitor->plugin_loader,
GS_PLUGIN_REFINE_FLAGS_USE_HISTORY,
+ GS_PLUGIN_FAILURE_FLAGS_NONE,
monitor->cancellable,
get_updates_historical_cb,
monitor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]