[gnome-software] snap: Simulate install/remove progress to avoid triggering a warning.



commit 68581aa94b2533d2405d16678b818c72a8eb8d68
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri Jul 12 11:35:53 2019 +1200

    snap: Simulate install/remove progress to avoid triggering a warning.
    
    The warning was:
    Gs-WARNING **: 11:20:21.487: State change on system/snap/Snap Store/desktop/io.snapcraft.snap-snap/* from 
available to installed is not OK

 plugins/snap/gs-self-test.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
---
diff --git a/plugins/snap/gs-self-test.c b/plugins/snap/gs-self-test.c
index 4d0175dc..aa6762de 100644
--- a/plugins/snap/gs-self-test.c
+++ b/plugins/snap/gs-self-test.c
@@ -201,8 +201,24 @@ snapd_client_install2_sync (SnapdClient *client,
                            SnapdProgressCallback progress_callback, gpointer progress_callback_data,
                            GCancellable *cancellable, GError **error)
 {
+       g_autoptr(SnapdChange) change = NULL;
+       g_autoptr(GPtrArray) tasks = NULL;
+       SnapdTask *task;
+
        g_assert_cmpstr (name, ==, "snap");
        g_assert (channel == NULL);
+
+       tasks = g_ptr_array_new_with_free_func (g_object_unref);
+       task = g_object_new (SNAPD_TYPE_TASK,
+                            "progress-done", 0,
+                            "progress-total", 1,
+                            NULL);
+       g_ptr_array_add (tasks, task);
+       change = g_object_new (SNAPD_TYPE_CHANGE,
+                              "tasks", tasks,
+                              NULL);
+       progress_callback (client, change, NULL, progress_callback_data);
+
        snap_installed = TRUE;
        return TRUE;
 }
@@ -213,7 +229,24 @@ snapd_client_remove_sync (SnapdClient *client,
                          SnapdProgressCallback progress_callback, gpointer progress_callback_data,
                          GCancellable *cancellable, GError **error)
 {
+       g_autoptr(SnapdChange) change = NULL;
+       g_autoptr(GPtrArray) tasks = NULL;
+       SnapdTask *task;
+
        g_assert_cmpstr (name, ==, "snap");
+
+       tasks = g_ptr_array_new_with_free_func (g_object_unref);
+       task = g_object_new (SNAPD_TYPE_TASK,
+                            "progress-done", 0,
+                            "progress-total", 1,
+                            NULL);
+       g_ptr_array_add (tasks, task);
+       change = g_object_new (SNAPD_TYPE_CHANGE,
+                              "tasks", tasks,
+                              NULL);
+       progress_callback (client, change, NULL, progress_callback_data);
+
+       snap_installed = FALSE;
        return TRUE;
 }
 


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