[gnome-software] fwupd: Update state when enabling/disabling a repo



commit 6f780868bb3a61f887db39de357f25bdfd0208ba
Author: Kalev Lember <klember redhat com>
Date:   Wed Feb 14 21:35:04 2018 +0100

    fwupd: Update state when enabling/disabling a repo

 plugins/fwupd/gs-plugin-fwupd.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/plugins/fwupd/gs-plugin-fwupd.c b/plugins/fwupd/gs-plugin-fwupd.c
index c8d52ea5..d85d8a25 100644
--- a/plugins/fwupd/gs-plugin-fwupd.c
+++ b/plugins/fwupd/gs-plugin-fwupd.c
@@ -1185,12 +1185,20 @@ gs_plugin_fwupd_modify_source (GsPlugin *plugin, GsApp *app, gboolean enabled,
                             gs_app_get_unique_id (app));
                return FALSE;
        }
-       return fwupd_client_modify_remote (priv->client,
-                                          remote_id,
-                                          "Enabled",
-                                          enabled ? "true" : "false",
-                                          cancellable,
-                                          error);
+       gs_app_set_state (app, enabled ?
+                         AS_APP_STATE_INSTALLING : AS_APP_STATE_REMOVING);
+       if (!fwupd_client_modify_remote (priv->client,
+                                        remote_id,
+                                        "Enabled",
+                                        enabled ? "true" : "false",
+                                        cancellable,
+                                        error)) {
+               gs_app_set_state_recover (app);
+               return FALSE;
+       }
+       gs_app_set_state (app, enabled ?
+                         AS_APP_STATE_INSTALLED : AS_APP_STATE_AVAILABLE);
+       return TRUE;
 }
 
 gboolean


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