[gnome-software] Fix the cancel action on the updates refresh button
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Fix the cancel action on the updates refresh button
- Date: Thu, 30 Jan 2014 11:12:47 +0000 (UTC)
commit fb98f395d19e8a6620792cc376dfffde78d66ad0
Author: Richard Hughes <richard hughsie com>
Date: Thu Jan 30 11:12:38 2014 +0000
Fix the cancel action on the updates refresh button
src/gs-plugin-loader.c | 2 +-
src/gs-shell-updates.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 8aea0af..67c11b4 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -2922,7 +2922,7 @@ gs_plugin_loader_refresh_thread_cb (GSimpleAsyncResult *res,
state->ret = gs_plugin_loader_run_refresh (plugin_loader,
state->cache_age,
state->flags,
- cancellable,
+ state->cancellable,
&error);
if (!state->ret) {
gs_plugin_loader_refresh_state_finish (state, error);
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index d2eb23c..ea8e162 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -674,6 +674,25 @@ gs_shell_updates_refresh_cb (GsPluginLoader *plugin_loader,
/* get the results */
ret = gs_plugin_loader_refresh_finish (plugin_loader, res, &error);
if (!ret) {
+ /* user cancel */
+ if (g_error_matches (error,
+ G_IO_ERROR,
+ G_IO_ERROR_CANCELLED)) {
+ switch (priv->state) {
+ case GS_SHELL_UPDATES_STATE_ACTION_REFRESH_HAS_UPDATES:
+ gs_shell_updates_set_state (shell_updates,
+ GS_SHELL_UPDATES_STATE_HAS_UPDATES);
+ break;
+ case GS_SHELL_UPDATES_STATE_ACTION_REFRESH_NO_UPDATES:
+ gs_shell_updates_set_state (shell_updates,
+ GS_SHELL_UPDATES_STATE_NO_UPDATES);
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+ return;
+ }
g_warning ("failed to refresh: %s", error->message);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"label_updates_failed"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]