[gnome-software/wip/hughsie/GsAppList2: 2/4] Do not return an error when it was successful but had no results
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/hughsie/GsAppList2: 2/4] Do not return an error when it was successful but had no results
- Date: Thu, 19 May 2016 08:56:28 +0000 (UTC)
commit dc5ce75cff1b9bb839ffb5653f605b8a239e8def
Author: Richard Hughes <richard hughsie com>
Date: Wed May 18 21:47:23 2016 +0100
Do not return an error when it was successful but had no results
src/gs-plugin-loader.c | 96 +++++------------------------------------------
src/gs-plugin-loader.h | 1 -
src/gs-shell-details.c | 2 +-
src/gs-shell-extras.c | 6 +-
src/gs-shell-moderate.c | 17 ++++----
src/gs-shell-search.c | 21 +++++-----
src/gs-shell-updates.c | 36 +++++++----------
src/gs-sources-dialog.c | 16 ++++---
src/gs-update-dialog.c | 19 +++++----
src/gs-update-monitor.c | 51 +++++++++++--------------
10 files changed, 90 insertions(+), 175 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index b4585c6..1d1c2c3 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -275,6 +275,10 @@ gs_plugin_loader_run_refine (GsPluginLoader *plugin_loader,
gboolean ret = TRUE;
g_autoptr(GsAppList) freeze_list = NULL;
+ /* nothing to do */
+ if (gs_app_list_length (list) == 0)
+ return TRUE;
+
/* freeze all apps */
freeze_list = gs_app_list_copy (list);
for (i = 0; i < gs_app_list_length (freeze_list); i++) {
@@ -540,14 +544,6 @@ gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
/* filter package list */
gs_app_list_filter_duplicates (list);
- /* no results */
- if (gs_app_list_length (list) == 0) {
- g_set_error (error,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
- "no results to show");
- return NULL;
- }
return g_steal_pointer (&list);
}
@@ -967,13 +963,6 @@ gs_plugin_loader_get_updates_thread_cb (GTask *task,
/* remove any packages that are not proper applications or
* OS updates */
gs_app_list_filter (state->list, gs_plugin_loader_app_is_valid, state);
- if (gs_app_list_length (state->list) == 0) {
- g_task_return_new_error (task,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
- "no updates to show after invalid");
- return;
- }
/* success */
g_task_return_pointer (task, g_object_ref (state->list), (GDestroyNotify) g_object_unref);
@@ -1228,15 +1217,6 @@ gs_plugin_loader_get_sources_thread_cb (GTask *task,
/* filter package list */
gs_app_list_filter_duplicates (state->list);
- /* none left? */
- if (gs_app_list_length (state->list) == 0) {
- g_task_return_new_error (task,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
- "no sources to show");
- return;
- }
-
/* success */
g_task_return_pointer (task, g_object_ref (state->list), (GDestroyNotify) g_object_unref);
}
@@ -1320,13 +1300,6 @@ gs_plugin_loader_get_installed_thread_cb (GTask *task,
/* filter package list */
gs_app_list_filter (state->list, gs_plugin_loader_app_is_valid, state);
gs_app_list_filter (state->list, gs_plugin_loader_app_is_valid_installed, state);
- if (gs_app_list_length (state->list) == 0) {
- g_task_return_new_error (task,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
- "no installed applications to show after invalid");
- return;
- }
/* success */
g_task_return_pointer (task, g_object_ref (state->list), (GDestroyNotify) g_object_unref);
@@ -1442,13 +1415,6 @@ gs_plugin_loader_get_popular_thread_cb (GTask *task,
gs_app_list_filter (state->list, gs_plugin_loader_app_is_valid, state);
gs_app_list_filter (state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
gs_app_list_filter (state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
- if (gs_app_list_length (state->list) == 0) {
- g_task_return_new_error (task,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
- "no popular apps to show");
- return;
- }
/* success */
g_task_return_pointer (task, g_object_ref (state->list), (GDestroyNotify) g_object_unref);
@@ -1543,13 +1509,6 @@ gs_plugin_loader_get_featured_thread_cb (GTask *task,
gs_app_list_filter (state->list, gs_plugin_loader_app_is_valid, state);
gs_app_list_filter (state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
}
- if (gs_app_list_length (state->list) == 0) {
- g_task_return_new_error (task,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
- "no featured apps to show");
- return;
- }
/* success */
g_task_return_pointer (task, g_object_ref (state->list), (GDestroyNotify) g_object_unref);
@@ -1708,7 +1667,7 @@ gs_plugin_loader_search_thread_cb (GTask *task,
if (values == NULL) {
g_task_return_new_error (task,
GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
+ GS_PLUGIN_LOADER_ERROR_FAILED,
"no valid search terms");
return;
}
@@ -1771,17 +1730,10 @@ gs_plugin_loader_search_thread_cb (GTask *task,
gs_app_list_filter (state->list, gs_plugin_loader_app_is_valid, state);
gs_app_list_filter (state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
gs_app_list_filter (state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
- if (gs_app_list_length (state->list) == 0) {
- g_task_return_new_error (task,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
- "no search results to show");
- return;
- }
if (gs_app_list_length (state->list) > 500) {
g_task_return_new_error (task,
GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
+ GS_PLUGIN_LOADER_ERROR_FAILED,
"Too many search results returned");
return;
}
@@ -1941,17 +1893,10 @@ gs_plugin_loader_search_files_thread_cb (GTask *task,
gs_app_list_filter (state->list, gs_plugin_loader_app_is_non_installed, NULL);
gs_app_list_filter (state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
gs_app_list_filter (state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
- if (gs_app_list_length (state->list) == 0) {
- g_task_return_new_error (task,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
- "no search results to show");
- return;
- }
if (gs_app_list_length (state->list) > 500) {
g_task_return_new_error (task,
GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
+ GS_PLUGIN_LOADER_ERROR_FAILED,
"Too many search results returned");
return;
}
@@ -2111,17 +2056,10 @@ gs_plugin_loader_search_what_provides_thread_cb (GTask *task,
gs_app_list_filter (state->list, gs_plugin_loader_app_is_non_installed, NULL);
gs_app_list_filter (state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
gs_app_list_filter (state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
- if (gs_app_list_length (state->list) == 0) {
- g_task_return_new_error (task,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
- "no search results to show");
- return;
- }
if (gs_app_list_length (state->list) > 500) {
g_task_return_new_error (task,
GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
+ GS_PLUGIN_LOADER_ERROR_FAILED,
"Too many search results returned");
return;
}
@@ -2299,7 +2237,7 @@ gs_plugin_loader_get_categories_thread_cb (GTask *task,
if (state->catlist->len == 0) {
g_task_return_new_error (task,
GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
+ GS_PLUGIN_LOADER_ERROR_FAILED,
"no categories to show");
return;
}
@@ -2435,13 +2373,6 @@ gs_plugin_loader_get_category_apps_thread_cb (GTask *task,
gs_app_list_filter (state->list, gs_plugin_loader_app_is_valid, state);
gs_app_list_filter (state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
gs_app_list_filter (state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
- if (gs_app_list_length (state->list) == 0) {
- g_task_return_new_error (task,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
- "no get_category_apps results to show");
- return;
- }
/* sort, just in case the UI doesn't do this */
gs_app_list_sort (state->list, gs_plugin_loader_app_sort_cb, NULL);
@@ -4005,13 +3936,6 @@ gs_plugin_loader_file_to_app_thread_cb (GTask *task,
/* filter package list */
gs_app_list_filter_duplicates (state->list);
- if (gs_app_list_length (state->list) == 0) {
- g_task_return_new_error (task,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
- "no file_to_app results to show");
- return;
- }
/* check the apps have an icon set */
for (j = 0; j < gs_app_list_length (state->list); j++) {
@@ -4043,7 +3967,7 @@ gs_plugin_loader_file_to_app_thread_cb (GTask *task,
if (gs_app_list_length (state->list) != 1) {
g_task_return_new_error (task,
GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
+ GS_PLUGIN_LOADER_ERROR_FAILED,
"no application was created for %s",
g_file_get_path (state->file));
return;
diff --git a/src/gs-plugin-loader.h b/src/gs-plugin-loader.h
index 184cab4..d8f6284 100644
--- a/src/gs-plugin-loader.h
+++ b/src/gs-plugin-loader.h
@@ -48,7 +48,6 @@ struct _GsPluginLoaderClass
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-details.c b/src/gs-shell-details.c
index 03da15c..f89c977 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -1376,7 +1376,7 @@ gs_shell_details_file_to_app_cb (GObject *source,
if (g_error_matches (error,
GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS)) {
+ GS_PLUGIN_LOADER_ERROR_FAILED)) {
/* TRANSLATORS: the file format was not recognised by
* any plugin, e.g. if you try installing a .tar.gz */
msg = _("The file is not supported.");
diff --git a/src/gs-shell-extras.c b/src/gs-shell-extras.c
index b7f783a..aaf4b90 100644
--- a/src/gs-shell-extras.c
+++ b/src/gs-shell-extras.c
@@ -528,7 +528,7 @@ search_files_cb (GObject *source_object,
}
if (g_error_matches (error,
GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS)) {
+ GS_PLUGIN_LOADER_ERROR_FAILED)) {
GsApp *app;
g_debug ("extras: no search result for %s, showing as missing", search_data->title);
@@ -579,7 +579,7 @@ file_to_app_cb (GObject *source_object,
}
if (g_error_matches (error,
GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS)) {
+ GS_PLUGIN_LOADER_ERROR_FAILED)) {
g_debug ("extras: no search result for %s, showing as missing", search_data->title);
app = create_missing_app (search_data);
} else {
@@ -626,7 +626,7 @@ get_search_what_provides_cb (GObject *source_object,
}
if (g_error_matches (error,
GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS)) {
+ GS_PLUGIN_LOADER_ERROR_FAILED)) {
GsApp *app;
g_debug ("extras: no search result for %s, showing as missing", search_data->title);
diff --git a/src/gs-shell-moderate.c b/src/gs-shell-moderate.c
index a2992cf..5e5872e 100644
--- a/src/gs-shell-moderate.c
+++ b/src/gs-shell-moderate.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2013 Richard Hughes <richard hughsie com>
+ * Copyright (C) 2013-2016 Richard Hughes <richard hughsie com>
* Copyright (C) 2013 Matthias Clasen <mclasen redhat com>
*
* Licensed under the GNU General Public License Version 2
@@ -157,17 +157,18 @@ gs_shell_moderate_get_unvoted_reviews_cb (GObject *source_object,
res,
&error);
if (list == NULL) {
- if (g_error_matches (error,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS)) {
- gtk_stack_set_visible_child_name (GTK_STACK (self->stack_install),
- "uptodate");
- return;
- }
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_warning ("failed to get moderate apps: %s", error->message);
return;
}
+
+ /* no results */
+ if (gs_app_list_length (list) == 0) {
+ gtk_stack_set_visible_child_name (GTK_STACK (self->stack_install),
+ "uptodate");
+ return;
+ }
+
for (i = 0; i < gs_app_list_length (list); i++) {
app = gs_app_list_index (list, i);
gs_shell_moderate_add_app (self, app);
diff --git a/src/gs-shell-search.c b/src/gs-shell-search.c
index acb2395..cb17cf8 100644
--- a/src/gs-shell-search.c
+++ b/src/gs-shell-search.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2013 Richard Hughes <richard hughsie com>
+ * Copyright (C) 2013-2016 Richard Hughes <richard hughsie com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -89,8 +89,8 @@ gs_shell_search_app_row_clicked_cb (GsAppRow *app_row,
**/
static void
gs_shell_search_get_search_cb (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
guint i;
GsApp *app;
@@ -106,18 +106,19 @@ gs_shell_search_get_search_cb (GObject *source_object,
g_debug ("search cancelled");
return;
}
- 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_warning ("failed to get search apps: %s", error->message);
gs_stop_spinner (GTK_SPINNER (self->spinner_search));
gtk_stack_set_visible_child_name (GTK_STACK (self->stack_search), "no-results");
return;
}
+ /* no results */
+ if (gs_app_list_length (list) == 0) {
+ g_debug ("no search results to show");
+ gtk_stack_set_visible_child_name (GTK_STACK (self->stack_search), "no-results");
+ return;
+ }
+
gs_stop_spinner (GTK_SPINNER (self->spinner_search));
gtk_stack_set_visible_child_name (GTK_STACK (self->stack_search), "results");
for (i = 0; i < gs_app_list_length (list); i++) {
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 975e4bc..a5554a8 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -523,18 +523,18 @@ gs_shell_updates_get_updates_cb (GsPluginLoader *plugin_loader,
if (list == NULL) {
gs_shell_updates_clear_flag (self, GS_SHELL_UPDATES_FLAG_HAS_UPDATES);
- if (g_error_matches (error,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS)) {
- g_debug ("updates-shell: no updates to show");
- } else {
- if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
- g_warning ("updates-shell: failed to get updates: %s", error->message);
- gtk_label_set_label (GTK_LABEL (self->label_updates_failed),
- error->message);
- gs_shell_updates_set_state (self,
- GS_SHELL_UPDATES_STATE_FAILED);
- }
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ g_warning ("updates-shell: failed to get updates: %s", error->message);
+ gtk_label_set_label (GTK_LABEL (self->label_updates_failed),
+ error->message);
+ gs_shell_updates_set_state (self,
+ GS_SHELL_UPDATES_STATE_FAILED);
+ }
+
+ /* no results */
+ if (gs_app_list_length (list) == 0) {
+ g_debug ("updates-shell: no updates to show");
+ gs_shell_updates_clear_flag (self, GS_SHELL_UPDATES_FLAG_HAS_UPDATES);
} else {
gs_shell_updates_set_flag (self, GS_SHELL_UPDATES_FLAG_HAS_UPDATES);
}
@@ -558,15 +558,9 @@ 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,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS)) {
- g_debug ("updates-shell: no upgrades to show");
- } else {
- if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
- g_warning ("updates-shell: failed to get upgrades: %s",
- error->message);
- }
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ g_warning ("updates-shell: failed to get upgrades: %s",
+ error->message);
}
} else if (gs_app_list_length (list) == 0) {
g_debug ("updates-shell: no upgrades to show");
diff --git a/src/gs-sources-dialog.c b/src/gs-sources-dialog.c
index 0430f3a..a7b7826 100644
--- a/src/gs-sources-dialog.c
+++ b/src/gs-sources-dialog.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2013 Richard Hughes <richard hughsie com>
+ * Copyright (C) 2013-2016 Richard Hughes <richard hughsie com>
* Copyright (C) 2013 Matthias Clasen <mclasen redhat com>
*
* Licensed under the GNU General Public License Version 2
@@ -159,12 +159,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,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS)) {
- g_debug ("no sources to show");
- } else if (g_error_matches (error,
- G_IO_ERROR,
- G_IO_ERROR_CANCELLED)) {
+ G_IO_ERROR,
+ G_IO_ERROR_CANCELLED)) {
g_debug ("get sources cancelled");
} else {
g_warning ("failed to get sources: %s", error->message);
@@ -175,6 +171,12 @@ get_sources_cb (GsPluginLoader *plugin_loader,
return;
}
+ /* no results */
+ if (gs_app_list_length (list) == 0) {
+ g_debug ("no sources to show");
+ return;
+ }
+
gtk_style_context_remove_class (gtk_widget_get_style_context (dialog->label_header),
"dim-label");
diff --git a/src/gs-update-dialog.c b/src/gs-update-dialog.c
index ae8bcb8..8620c87 100644
--- a/src/gs-update-dialog.c
+++ b/src/gs-update-dialog.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2013-2014 Richard Hughes <richard hughsie com>
+ * Copyright (C) 2013-2016 Richard Hughes <richard hughsie com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -179,14 +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,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS)) {
- g_debug ("no installed updates to show");
- gtk_stack_set_visible_child_name (GTK_STACK (dialog->stack), "empty");
- return;
- } else if (g_error_matches (error,
- G_IO_ERROR,
- G_IO_ERROR_CANCELLED)) {
+ G_IO_ERROR,
+ G_IO_ERROR_CANCELLED)) {
/* This should only ever happen while the dialog is being closed */
g_debug ("get installed updates cancelled");
return;
@@ -197,6 +191,13 @@ get_installed_updates_cb (GsPluginLoader *plugin_loader,
return;
}
+ /* no results */
+ if (gs_app_list_length (list) == 0) {
+ g_debug ("no installed updates to show");
+ gtk_stack_set_visible_child_name (GTK_STACK (dialog->stack), "empty");
+ return;
+ }
+
/* set the header title using any one of the applications */
install_date = gs_app_get_install_date (gs_app_list_index (list, 0));
if (install_date > 0) {
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index 594b596..916d693 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -209,16 +209,18 @@ 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)) {
+ g_warning ("failed to get upgrades: %s",
+ error->message);
+ }
+ return;
+ }
+
+ /* no results */
+ if (gs_app_list_length (apps) == 0) {
g_debug ("no upgrades; withdrawing upgrades-available notification");
g_application_withdraw_notification (monitor->application,
"upgrades-available");
- if (g_error_matches (error,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS)) {
- g_debug ("no upgrades to show");
- } else if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
- g_warning ("failed to get upgrades: %s", error->message);
- }
return;
}
@@ -416,28 +418,19 @@ get_updates_historical_cb (GObject *object, GAsyncResult *res, gpointer data)
apps = gs_plugin_loader_get_updates_finish (GS_PLUGIN_LOADER (object), res, &error);
if (apps == NULL) {
- /* nothing has been updated offline */
- if (g_error_matches (error,
- GS_PLUGIN_LOADER_ERROR,
- GS_PLUGIN_LOADER_ERROR_NO_RESULTS)) {
- g_debug ("no historical updates; withdrawing notification");
- g_application_withdraw_notification (monitor->application,
- "updates-available");
- } else {
- /* save this in case the user clicks the
- * 'Show Details' button from the notification below */
- g_clear_error (&monitor->last_offline_error);
- monitor->last_offline_error = g_error_copy (error);
-
- /* TRANSLATORS: title when we offline updates have failed */
- notification = g_notification_new (_("Software Updates Failed"));
- /* TRANSLATORS: message when we offline updates have failed */
- g_notification_set_body (notification, _("An important OS update failed to be
installed."));
- g_application_send_notification (monitor->application, "offline-updates",
notification);
- g_notification_add_button (notification, _("Show Details"),
"app.show-offline-update-error");
- g_notification_set_default_action (notification, "app.show-offline-update-error");
- g_application_send_notification (monitor->application, "offline-updates",
notification);
- }
+ /* save this in case the user clicks the
+ * 'Show Details' button from the notification below */
+ g_clear_error (&monitor->last_offline_error);
+ monitor->last_offline_error = g_error_copy (error);
+
+ /* TRANSLATORS: title when we offline updates have failed */
+ notification = g_notification_new (_("Software Updates Failed"));
+ /* TRANSLATORS: message when we offline updates have failed */
+ g_notification_set_body (notification, _("An important OS update failed to be installed."));
+ g_application_send_notification (monitor->application, "offline-updates", notification);
+ g_notification_add_button (notification, _("Show Details"), "app.show-offline-update-error");
+ g_notification_set_default_action (notification, "app.show-offline-update-error");
+ g_application_send_notification (monitor->application, "offline-updates", notification);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]