[gnome-software] Do not show a warning when there were no search results found



commit 30cb4783a00ed5d17c3bd91408827d77b729ffd1
Author: Richard Hughes <richard hughsie com>
Date:   Wed Oct 30 09:59:20 2013 +0000

    Do not show a warning when there were no search results found
    
    It's not a warning, it's just fine.

 src/gs-plugin-loader.c |   16 ++++++++--------
 src/gs-plugin-loader.h |    1 +
 src/gs-shell-search.c  |    9 ++++++++-
 src/gs-shell-updates.c |    8 +++++++-
 4 files changed, 24 insertions(+), 10 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 0ef5f60..e9bf466 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -395,7 +395,7 @@ gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
        if (list == NULL) {
                g_set_error (error,
                             GS_PLUGIN_LOADER_ERROR,
-                            GS_PLUGIN_LOADER_ERROR_FAILED,
+                            GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
                             "no results to show");
                goto out;
        }
@@ -803,7 +803,7 @@ gs_plugin_loader_get_updates_thread_cb (GSimpleAsyncResult *res,
        if (state->list == NULL) {
                g_set_error_literal (&error,
                                     GS_PLUGIN_LOADER_ERROR,
-                                    GS_PLUGIN_LOADER_ERROR_FAILED,
+                                    GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
                                     "no updates to show after invalid");
                gs_plugin_loader_get_all_state_finish (state, error);
                g_error_free (error);
@@ -930,7 +930,7 @@ gs_plugin_loader_get_installed_thread_cb (GSimpleAsyncResult *res,
        if (state->list == NULL) {
                g_set_error_literal (&error,
                                     GS_PLUGIN_LOADER_ERROR,
-                                    GS_PLUGIN_LOADER_ERROR_FAILED,
+                                    GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
                                     "no installed applications to show after invalid");
                gs_plugin_loader_get_all_state_finish (state, error);
                g_error_free (error);
@@ -1054,7 +1054,7 @@ gs_plugin_loader_get_popular_thread_cb (GSimpleAsyncResult *res,
        if (state->list == NULL) {
                g_set_error_literal (&error,
                                     GS_PLUGIN_LOADER_ERROR,
-                                    GS_PLUGIN_LOADER_ERROR_FAILED,
+                                    GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
                                     "no popular apps to show");
                gs_plugin_loader_get_all_state_finish (state, error);
                g_error_free (error);
@@ -1160,7 +1160,7 @@ gs_plugin_loader_get_featured_thread_cb (GSimpleAsyncResult *res,
        if (state->list == NULL) {
                g_set_error_literal (&error,
                                     GS_PLUGIN_LOADER_ERROR,
-                                    GS_PLUGIN_LOADER_ERROR_FAILED,
+                                    GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
                                     "no featured apps to show");
                gs_plugin_loader_get_all_state_finish (state, error);
                g_error_free (error);
@@ -1398,7 +1398,7 @@ gs_plugin_loader_search_thread_cb (GSimpleAsyncResult *res,
        if (state->list == NULL) {
                g_set_error (&error,
                             GS_PLUGIN_LOADER_ERROR,
-                            GS_PLUGIN_LOADER_ERROR_FAILED,
+                            GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
                             "no search results to show");
                gs_plugin_loader_get_all_state_finish (state, error);
                g_error_free (error);
@@ -1564,7 +1564,7 @@ gs_plugin_loader_get_categories_thread_cb (GSimpleAsyncResult *res,
        if (state->list == NULL) {
                g_set_error (&error,
                             GS_PLUGIN_LOADER_ERROR,
-                            GS_PLUGIN_LOADER_ERROR_FAILED,
+                            GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
                             "no categories to show");
                gs_plugin_loader_get_all_state_finish (state, error);
                g_error_free (error);
@@ -1717,7 +1717,7 @@ gs_plugin_loader_get_category_apps_thread_cb (GSimpleAsyncResult *res,
        if (state->list == NULL) {
                g_set_error (&error,
                             GS_PLUGIN_LOADER_ERROR,
-                            GS_PLUGIN_LOADER_ERROR_FAILED,
+                            GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
                             "no get_category_apps results to show");
                gs_plugin_loader_get_all_state_finish (state, error);
                g_error_free (error);
diff --git a/src/gs-plugin-loader.h b/src/gs-plugin-loader.h
index 29014c4..7e94b7e 100644
--- a/src/gs-plugin-loader.h
+++ b/src/gs-plugin-loader.h
@@ -59,6 +59,7 @@ typedef struct
 typedef enum
 {
        GS_PLUGIN_LOADER_ERROR_FAILED,
+       GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
        GS_PLUGIN_LOADER_ERROR_LAST
 } GsPluginLoaderError;
 
diff --git a/src/gs-shell-search.c b/src/gs-shell-search.c
index a7b9d8b..2cbcf9c 100644
--- a/src/gs-shell-search.c
+++ b/src/gs-shell-search.c
@@ -257,7 +257,14 @@ gs_shell_search_get_search_cb (GObject *source_object,
 
        list = gs_plugin_loader_search_finish (plugin_loader, res, &error);
        if (list == NULL) {
-               g_warning ("failed to get search apps: %s", error->message);
+               if (g_error_matches (error,
+                                    GS_PLUGIN_LOADER_ERROR,
+                                    GS_PLUGIN_LOADER_ERROR_NO_RESULTS)) {
+                       g_debug ("no search results to show");
+               } else {
+                       g_warning ("failed to get search apps: %s",
+                                  error->message);
+               }
                g_error_free (error);
                gtk_stack_set_visible_child_name (GTK_STACK (widget), "no-results");
                goto out;
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index e20d1f3..57a0dd9 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -125,7 +125,13 @@ gs_shell_updates_get_updates_cb (GsPluginLoader *plugin_loader,
                gtk_widget_set_visible (widget, list != NULL);
        }
        if (list == NULL) {
-               g_warning ("failed to get updates: %s", error->message);
+               if (g_error_matches (error,
+                                    GS_PLUGIN_LOADER_ERROR,
+                                    GS_PLUGIN_LOADER_ERROR_NO_RESULTS)) {
+                       g_debug ("no updates to show");
+               } else {
+                       g_warning ("failed to get updates: %s", error->message);
+               }
                g_error_free (error);
                goto out;
        }


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