[gnome-software/gnome-3-20] 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/gnome-3-20] trivial: Recover the application state if the plugin forgets on action failure
- Date: Fri, 22 Apr 2016 10:42:43 +0000 (UTC)
commit adae1add87d2917a59aac3b8e28d943de6b26478
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 43ce2c0..73e7b07 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -2363,6 +2363,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 86f5c07..acf8327 100644
--- a/src/gs-upgrade-banner.c
+++ b/src/gs-upgrade-banner.c
@@ -108,7 +108,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 773ba4b..93ce13a 100644
--- a/src/plugins/gs-plugin-dummy.c
+++ b/src/plugins/gs-plugin-dummy.c
@@ -494,8 +494,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]