[gnome-software] Do not use G_IO_ERROR_CANCELLED when using the loader



commit 55eff124a22b967971ada12833ab76f8fb8d2f70
Author: Richard Hughes <richard hughsie com>
Date:   Sat Sep 17 21:48:30 2016 +0100

    Do not use G_IO_ERROR_CANCELLED when using the loader
    
    This is fallout from making the plugins return errors in the GsPluginError
    domain. Fixes several angry warnings in the console.

 src/gs-dbus-helper.c            |    2 +-
 src/gs-page.c                   |    8 ++++----
 src/gs-shell-category.c         |    2 +-
 src/gs-shell-extras.c           |    6 +++---
 src/gs-shell-installed.c        |    2 +-
 src/gs-shell-moderate.c         |    2 +-
 src/gs-shell-overview.c         |   12 ++++++------
 src/gs-shell-search.c           |    2 +-
 src/gs-shell-updates.c          |   10 +++++-----
 src/gs-sources-dialog.c         |    4 ++--
 src/gs-update-dialog.c          |    4 ++--
 src/gs-update-monitor.c         |    6 +++---
 src/plugins/packagekit-common.c |    6 ++++++
 13 files changed, 36 insertions(+), 30 deletions(-)
---
diff --git a/src/gs-dbus-helper.c b/src/gs-dbus-helper.c
index 3cd5aeb..44fde32 100644
--- a/src/gs-dbus-helper.c
+++ b/src/gs-dbus-helper.c
@@ -671,7 +671,7 @@ bus_gotten_cb (GObject      *source_object,
 
        connection = g_bus_get_finish (res, &error);
        if (connection == NULL) {
-               if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+               if (!g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED))
                        g_warning ("Could not get session bus: %s", error->message);
                return;
        }
diff --git a/src/gs-page.c b/src/gs-page.c
index 231bddb..d0c7b27 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -139,8 +139,8 @@ gs_page_app_installed_cb (GObject *source,
                                                  res,
                                                  &error);
        if (g_error_matches (error,
-                            G_IO_ERROR,
-                            G_IO_ERROR_CANCELLED)) {
+                            GS_PLUGIN_ERROR,
+                            GS_PLUGIN_ERROR_CANCELLED)) {
                g_debug ("%s", error->message);
                return;
        }
@@ -198,8 +198,8 @@ gs_page_app_removed_cb (GObject *source,
                                                  res,
                                                  &error);
        if (g_error_matches (error,
-                            G_IO_ERROR,
-                            G_IO_ERROR_CANCELLED)) {
+                            GS_PLUGIN_ERROR,
+                            GS_PLUGIN_ERROR_CANCELLED)) {
                g_debug ("%s", error->message);
                return;
        }
diff --git a/src/gs-shell-category.c b/src/gs-shell-category.c
index 66de874..1867c52 100644
--- a/src/gs-shell-category.c
+++ b/src/gs-shell-category.c
@@ -91,7 +91,7 @@ gs_shell_category_get_apps_cb (GObject *source_object,
                                                          res,
                                                          &error);
        if (list == NULL) {
-               if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+               if (!g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED))
                        g_warning ("failed to get apps for category apps: %s", error->message);
                return;
        }
diff --git a/src/gs-shell-extras.c b/src/gs-shell-extras.c
index 73eafa7..1671c62 100644
--- a/src/gs-shell-extras.c
+++ b/src/gs-shell-extras.c
@@ -526,7 +526,7 @@ search_files_cb (GObject *source_object,
 
        list = gs_plugin_loader_search_finish (plugin_loader, res, &error);
        if (list == NULL) {
-               if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+               if (g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED)) {
                        g_debug ("extras: search files cancelled");
                        return;
                }
@@ -577,7 +577,7 @@ file_to_app_cb (GObject *source_object,
 
        app = gs_plugin_loader_file_to_app_finish (plugin_loader, res, &error);
        if (app == NULL) {
-               if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+               if (g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED)) {
                        g_debug ("extras: search what provides cancelled");
                        return;
                }
@@ -624,7 +624,7 @@ get_search_what_provides_cb (GObject *source_object,
 
        list = gs_plugin_loader_search_what_provides_finish (plugin_loader, res, &error);
        if (list == NULL) {
-               if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+               if (g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED)) {
                        g_debug ("extras: search what provides cancelled");
                        return;
                }
diff --git a/src/gs-shell-installed.c b/src/gs-shell-installed.c
index 1a739bc..4bc49f9 100644
--- a/src/gs-shell-installed.c
+++ b/src/gs-shell-installed.c
@@ -211,7 +211,7 @@ gs_shell_installed_get_installed_cb (GObject *source_object,
                                                      res,
                                                      &error);
        if (list == NULL) {
-               if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+               if (!g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED))
                        g_warning ("failed to get installed apps: %s", error->message);
                goto out;
        }
diff --git a/src/gs-shell-moderate.c b/src/gs-shell-moderate.c
index a62bdd3..8b957e6 100644
--- a/src/gs-shell-moderate.c
+++ b/src/gs-shell-moderate.c
@@ -152,7 +152,7 @@ gs_shell_moderate_get_unvoted_reviews_cb (GObject *source_object,
                                                            res,
                                                            &error);
        if (list == NULL) {
-               if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+               if (!g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED))
                        g_warning ("failed to get moderate apps: %s", error->message);
                return;
        }
diff --git a/src/gs-shell-overview.c b/src/gs-shell-overview.c
index b2d9bd8..467e7c2 100644
--- a/src/gs-shell-overview.c
+++ b/src/gs-shell-overview.c
@@ -163,7 +163,7 @@ gs_shell_overview_get_popular_cb (GObject *source_object,
        gtk_widget_set_visible (priv->box_popular, list != NULL);
        gtk_widget_set_visible (priv->popular_heading, list != NULL);
        if (list == NULL) {
-               if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+               if (!g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED))
                        g_warning ("failed to get popular apps: %s", error->message);
                goto out;
        }
@@ -226,7 +226,7 @@ gs_shell_overview_get_category_apps_cb (GObject *source_object,
        /* get popular apps */
        list = gs_plugin_loader_get_category_apps_finish (plugin_loader, res, &error);
        if (list == NULL) {
-               if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+               if (g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED))
                        goto out;
                g_warning ("failed to get category %s featured applications: %s",
                           gs_category_get_id (load_data->category),
@@ -309,7 +309,7 @@ gs_shell_overview_get_featured_cb (GObject *source_object,
        g_autoptr(GsAppList) list = NULL;
 
        list = gs_plugin_loader_get_featured_finish (plugin_loader, res, &error);
-       if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+       if (g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED))
                goto out;
 
        if (g_getenv ("GNOME_SOFTWARE_FEATURED") == NULL) {
@@ -375,7 +375,7 @@ gs_shell_overview_get_categories_cb (GObject *source_object,
 
        list = gs_plugin_loader_get_categories_finish (plugin_loader, res, &error);
        if (list == NULL) {
-               if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+               if (!g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED))
                        g_warning ("failed to get categories: %s", error->message);
                goto out;
        }
@@ -627,8 +627,8 @@ g_shell_overview_get_sources_cb (GsPluginLoader *plugin_loader,
        list = gs_plugin_loader_get_sources_finish (plugin_loader, res, &error);
        if (list == NULL) {
                if (g_error_matches (error,
-                                    G_IO_ERROR,
-                                    G_IO_ERROR_CANCELLED)) {
+                                    GS_PLUGIN_ERROR,
+                                    GS_PLUGIN_ERROR_CANCELLED)) {
                        g_debug ("get sources cancelled");
                } else {
                        g_warning ("failed to get sources: %s", error->message);
diff --git a/src/gs-shell-search.c b/src/gs-shell-search.c
index b82d956..cc6f5da 100644
--- a/src/gs-shell-search.c
+++ b/src/gs-shell-search.c
@@ -109,7 +109,7 @@ gs_shell_search_get_search_cb (GObject *source_object,
 
        list = gs_plugin_loader_search_finish (plugin_loader, res, &error);
        if (list == NULL) {
-               if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+               if (g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED)) {
                        g_debug ("search cancelled");
                        return;
                }
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 7c73cc0..8266d44 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -486,7 +486,7 @@ gs_shell_updates_get_updates_cb (GsPluginLoader *plugin_loader,
        list = gs_plugin_loader_get_updates_finish (plugin_loader, res, &error);
        if (list == NULL) {
                gs_shell_updates_clear_flag (self, GS_SHELL_UPDATES_FLAG_HAS_UPDATES);
-               if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+               if (!g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED))
                        g_warning ("updates-shell: failed to get updates: %s", error->message);
                gs_utils_error_strip_unique_id (error);
                gtk_label_set_label (GTK_LABEL (self->label_updates_failed),
@@ -568,7 +568,7 @@ gs_shell_updates_get_upgrades_cb (GObject *source_object,
        list = gs_plugin_loader_get_distro_upgrades_finish (plugin_loader, res, &error);
        if (list == NULL) {
                gs_shell_updates_clear_flag (self, GS_SHELL_UPDATES_FLAG_HAS_UPGRADES);
-               if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+               if (!g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED)) {
                        g_warning ("updates-shell: failed to get upgrades: %s",
                                   error->message);
                }
@@ -715,8 +715,8 @@ gs_shell_updates_refresh_cb (GsPluginLoader *plugin_loader,
        if (!ret) {
                /* user cancel */
                if (g_error_matches (error,
-                                    G_IO_ERROR,
-                                    G_IO_ERROR_CANCELLED)) {
+                                    GS_PLUGIN_ERROR,
+                                    GS_PLUGIN_ERROR_CANCELLED)) {
                        gs_shell_updates_set_state (self, GS_SHELL_UPDATES_STATE_IDLE);
                        return;
                }
@@ -1026,7 +1026,7 @@ upgrade_download_finished_cb (GObject *source,
        g_autoptr(GsPageHelper) helper = (GsPageHelper *) user_data;
 
        if (!gs_plugin_loader_app_action_finish (plugin_loader, res, &error)) {
-               if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+               if (g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED))
                        return;
                g_warning ("failed to upgrade-download: %s", error->message);
        }
diff --git a/src/gs-sources-dialog.c b/src/gs-sources-dialog.c
index ec08834..b201309 100644
--- a/src/gs-sources-dialog.c
+++ b/src/gs-sources-dialog.c
@@ -318,8 +318,8 @@ get_sources_cb (GsPluginLoader *plugin_loader,
        list = gs_plugin_loader_get_sources_finish (plugin_loader, res, &error);
        if (list == NULL) {
                if (g_error_matches (error,
-                                    G_IO_ERROR,
-                                    G_IO_ERROR_CANCELLED)) {
+                                    GS_PLUGIN_ERROR,
+                                    GS_PLUGIN_ERROR_CANCELLED)) {
                        g_debug ("get sources cancelled");
                } else {
                        g_warning ("failed to get sources: %s", error->message);
diff --git a/src/gs-update-dialog.c b/src/gs-update-dialog.c
index f8ce342..69e189c 100644
--- a/src/gs-update-dialog.c
+++ b/src/gs-update-dialog.c
@@ -179,8 +179,8 @@ get_installed_updates_cb (GsPluginLoader *plugin_loader,
        list = gs_plugin_loader_get_updates_finish (plugin_loader, res, &error);
        if (list == NULL) {
                if (g_error_matches (error,
-                                   G_IO_ERROR,
-                                   G_IO_ERROR_CANCELLED)) {
+                                   GS_PLUGIN_ERROR,
+                                   GS_PLUGIN_ERROR_CANCELLED)) {
                        /* This should only ever happen while the dialog is being closed */
                        g_debug ("get installed updates cancelled");
                        return;
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index f3123e7..ee3d867 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -165,7 +165,7 @@ get_updates_finished_cb (GObject *object,
        /* get result */
        apps = gs_plugin_loader_get_updates_finish (GS_PLUGIN_LOADER (object), res, &error);
        if (apps == NULL) {
-               if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+               if (!g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED))
                        g_warning ("failed to get updates: %s", error->message);
                return;
        }
@@ -241,7 +241,7 @@ get_upgrades_finished_cb (GObject *object,
        /* get result */
        apps = gs_plugin_loader_get_distro_upgrades_finish (GS_PLUGIN_LOADER (object), res, &error);
        if (apps == NULL) {
-               if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+               if (!g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED)) {
                        g_warning ("failed to get upgrades: %s",
                                   error->message);
                }
@@ -316,7 +316,7 @@ refresh_cache_finished_cb (GObject *object,
        g_autoptr(GError) error = NULL;
 
        if (!gs_plugin_loader_refresh_finish (GS_PLUGIN_LOADER (object), res, &error)) {
-               if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+               if (!g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED))
                        g_warning ("failed to refresh the cache: %s", error->message);
                return;
        }
diff --git a/src/plugins/packagekit-common.c b/src/plugins/packagekit-common.c
index 7644a04..6e1f440 100644
--- a/src/plugins/packagekit-common.c
+++ b/src/plugins/packagekit-common.c
@@ -88,6 +88,12 @@ gs_plugin_packagekit_error_convert (GError **error)
 
        if (error == NULL)
                return FALSE;
+
+       /* this are allowed for low-level errors */
+       if (gs_utils_error_convert_gio (error))
+               return TRUE;
+
+       /* not set */
        error_tmp = *error;
        if (error_tmp == NULL)
                return FALSE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]