[gnome-software] trivial: Recover the application state if the plugin forgets on action failure
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: Recover the application state if the plugin forgets on action failure
- Date: Thu, 21 Apr 2016 22:07:07 +0000 (UTC)
commit f7c06cebb673e6715d2c07702920b0ffa139e4f8
Author: Richard Hughes <richard hughsie com>
Date: Thu Apr 21 22:14:04 2016 +0100
trivial: Recover the application state if the plugin forgets on action failure
src/gs-plugin-loader.c | 1 +
src/gs-upgrade-banner.c | 3 ++-
src/plugins/gs-plugin-dummy.c | 4 +++-
3 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 8b3639e..7115a85 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -2575,6 +2575,7 @@ gs_plugin_loader_app_action_thread_cb (GTask *task,
g_task_return_error (task, error);
}
} else {
+ gs_app_set_state_recover (state->app);
g_task_return_error (task, error);
}
diff --git a/src/gs-upgrade-banner.c b/src/gs-upgrade-banner.c
index 762bd6b..6ab29dd 100644
--- a/src/gs-upgrade-banner.c
+++ b/src/gs-upgrade-banner.c
@@ -111,7 +111,8 @@ gs_upgrade_banner_refresh (GsUpgradeBanner *self)
gtk_widget_set_visible (priv->button_upgrades_cancel, FALSE);
break;
default:
- g_critical ("Unexpected app state");
+ g_critical ("Unexpected app state %s",
+ as_app_state_to_string (gs_app_get_state (priv->app)));
break;
}
diff --git a/src/plugins/gs-plugin-dummy.c b/src/plugins/gs-plugin-dummy.c
index 2199b25..fafdd44 100644
--- a/src/plugins/gs-plugin-dummy.c
+++ b/src/plugins/gs-plugin-dummy.c
@@ -616,8 +616,10 @@ gs_plugin_app_upgrade_download (GsPlugin *plugin, GsApp *app,
g_debug ("starting download");
gs_app_set_state (app, AS_APP_STATE_INSTALLING);
- if (!gs_plugin_dummy_delay (plugin, app, 5000, cancellable, error))
+ if (!gs_plugin_dummy_delay (plugin, app, 5000, cancellable, error)) {
+ gs_app_set_state_recover (app);
return FALSE;
+ }
gs_app_set_state (app, AS_APP_STATE_UPDATABLE);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]