[gnome-software/1266-indeterminate-progress-bar-for-os-updates] packagekit: Add a 'progress_list' member to the helper
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1266-indeterminate-progress-bar-for-os-updates] packagekit: Add a 'progress_list' member to the helper
- Date: Wed, 13 Oct 2021 14:00:54 +0000 (UTC)
commit 4071520b442396c19b829db42bbaf5e069380d3e
Author: Milan Crha <mcrha redhat com>
Date: Wed Oct 13 15:50:58 2021 +0200
packagekit: Add a 'progress_list' member to the helper
This can be used to provide an overall progress of the operation
on a GsAppList.
plugins/packagekit/gs-packagekit-helper.c | 10 ++++++++++
plugins/packagekit/gs-packagekit-helper.h | 2 ++
2 files changed, 12 insertions(+)
---
diff --git a/plugins/packagekit/gs-packagekit-helper.c b/plugins/packagekit/gs-packagekit-helper.c
index 3afadcc8b..7ae42c140 100644
--- a/plugins/packagekit/gs-packagekit-helper.c
+++ b/plugins/packagekit/gs-packagekit-helper.c
@@ -18,6 +18,7 @@ struct _GsPackagekitHelper {
GObject parent_instance;
GHashTable *apps;
GsApp *progress_app;
+ GsAppList *progress_list;
GsPlugin *plugin;
};
@@ -46,6 +47,8 @@ gs_packagekit_helper_cb (PkProgress *progress, PkProgressType type, gpointer use
gint percentage = pk_progress_get_percentage (progress);
if (app != NULL && percentage >= 0 && percentage <= 100)
gs_app_set_progress (app, (guint) percentage);
+ if (self->progress_list != NULL && percentage >= 0 && percentage <= 100)
+ gs_app_list_override_progress (self->progress_list, (guint) percentage);
}
/* Only go from TRUE to FALSE - it doesn't make sense for a package
@@ -76,6 +79,12 @@ gs_packagekit_helper_set_progress_app (GsPackagekitHelper *self, GsApp *progress
g_set_object (&self->progress_app, progress_app);
}
+void
+gs_packagekit_helper_set_progress_list (GsPackagekitHelper *self, GsAppList *progress_list)
+{
+ g_set_object (&self->progress_list, progress_list);
+}
+
GsPlugin *
gs_packagekit_helper_get_plugin (GsPackagekitHelper *self)
{
@@ -102,6 +111,7 @@ gs_packagekit_helper_finalize (GObject *object)
g_object_unref (self->plugin);
g_clear_object (&self->progress_app);
+ g_clear_object (&self->progress_list);
g_hash_table_unref (self->apps);
G_OBJECT_CLASS (gs_packagekit_helper_parent_class)->finalize (object);
diff --git a/plugins/packagekit/gs-packagekit-helper.h b/plugins/packagekit/gs-packagekit-helper.h
index 94a6ea1a7..594d0c05f 100644
--- a/plugins/packagekit/gs-packagekit-helper.h
+++ b/plugins/packagekit/gs-packagekit-helper.h
@@ -25,6 +25,8 @@ void gs_packagekit_helper_add_app (GsPackagekitHelper *self,
GsApp *app);
void gs_packagekit_helper_set_progress_app (GsPackagekitHelper *self,
GsApp *progress_app);
+void gs_packagekit_helper_set_progress_list (GsPackagekitHelper *self,
+ GsAppList *progress_list);
GsApp *gs_packagekit_helper_get_app_by_id (GsPackagekitHelper *self,
const gchar *package_id);
void gs_packagekit_helper_cb (PkProgress *progress,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]