[gnome-software/wip/temp/ubuntu-xenial-rebased-corrected: 71/331] Set package states when installing / removing



commit 3589242522633d0aa5e63cafee7d5e960866aff8
Author: Robert Ancell <robert ancell canonical com>
Date:   Tue Feb 2 21:23:08 2016 +1300

    Set package states when installing / removing

 src/plugins/gs-plugin-snappy.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/gs-plugin-snappy.c b/src/plugins/gs-plugin-snappy.c
index 2c6e8a4..a6822d4 100644
--- a/src/plugins/gs-plugin-snappy.c
+++ b/src/plugins/gs-plugin-snappy.c
@@ -448,6 +448,8 @@ send_package_action (GsPlugin *plugin, const char *id, const gchar *action, GErr
                return FALSE;
        }
 
+       // FIXME: Need to poll for status - may stil have failed
+
        return TRUE;
 }
 
@@ -457,13 +459,19 @@ gs_plugin_app_install (GsPlugin *plugin,
                       GCancellable *cancellable,
                       GError **error)
 {
+       gboolean result;
+
        g_printerr ("SNAPPY: gs_plugin_app_install\n");
 
        /* We can only install apps we know of */
        if (g_strcmp0 (gs_app_get_management_plugin (app), "snappy") != 0)
                return TRUE;
 
-       return send_package_action (plugin, gs_app_get_id (app), "install", error);
+       gs_app_set_state (app, AS_APP_STATE_INSTALLING);
+       result = send_package_action (plugin, gs_app_get_id (app), "install", error);
+       gs_app_set_state (app, AS_APP_STATE_INSTALLED);
+
+       return result;
 }
 
 gboolean
@@ -472,11 +480,17 @@ gs_plugin_app_remove (GsPlugin *plugin,
                      GCancellable *cancellable,
                      GError **error)
 {
+       gboolean result;
+
        g_printerr ("SNAPPY: gs_plugin_app_remove\n");
 
        /* We can only remove apps we know of */
        if (g_strcmp0 (gs_app_get_management_plugin (app), "snappy") != 0)
                return TRUE;
 
-       return send_package_action (plugin, gs_app_get_id (app), "remove", error);
+       gs_app_set_state (app, AS_APP_STATE_REMOVING);
+       result = send_package_action (plugin, gs_app_get_id (app), "remove", error);
+       gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
+
+       return result;
 }


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