[gnome-software/wip/kalev/unfinished-GsProgress-XXX: 1/5] GsProgress
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/kalev/unfinished-GsProgress-XXX: 1/5] GsProgress
- Date: Tue, 14 Jan 2020 16:46:38 +0000 (UTC)
commit df7fb01bc2238d5bcf4d23339f6430ac8dffd561
Author: Kalev Lember <klember redhat com>
Date: Thu Oct 3 15:02:35 2019 +0200
GsProgress
lib/gnome-software.h | 1 +
lib/gs-plugin-job.c | 28 +++
lib/gs-plugin-job.h | 4 +
lib/gs-plugin-loader.c | 43 +++++
lib/gs-progress.c | 301 +++++++++++++++++++++++++++++++
lib/gs-progress.h | 32 ++++
lib/meson.build | 1 +
plugins/flatpak/gs-flatpak-transaction.c | 22 +++
plugins/flatpak/gs-flatpak-transaction.h | 1 +
plugins/flatpak/gs-plugin-flatpak.c | 15 +-
src/gs-page.c | 2 +
11 files changed, 444 insertions(+), 6 deletions(-)
---
diff --git a/lib/gnome-software.h b/lib/gnome-software.h
index 94ea14b1..9fed0df0 100644
--- a/lib/gnome-software.h
+++ b/lib/gnome-software.h
@@ -20,4 +20,5 @@
#include <gs-os-release.h>
#include <gs-plugin.h>
#include <gs-plugin-vfuncs.h>
+#include <gs-progress.h>
#include <gs-utils.h>
diff --git a/lib/gs-plugin-job.c b/lib/gs-plugin-job.c
index 36dc6bea..ba95f99a 100644
--- a/lib/gs-plugin-job.c
+++ b/lib/gs-plugin-job.c
@@ -33,6 +33,7 @@ struct _GsPluginJob
GFile *file;
GsCategory *category;
AsReview *review;
+ GsProgress *progress;
gint64 time_created;
};
@@ -52,6 +53,7 @@ enum {
PROP_REVIEW,
PROP_MAX_RESULTS,
PROP_TIMEOUT,
+ PROP_PROGRESS,
PROP_LAST
};
@@ -399,6 +401,20 @@ gs_plugin_job_get_review (GsPluginJob *self)
return self->review;
}
+void
+gs_plugin_job_set_progress (GsPluginJob *self, GsProgress *progress)
+{
+ g_return_if_fail (GS_IS_PLUGIN_JOB (self));
+ g_set_object (&self->progress, progress);
+}
+
+GsProgress *
+gs_plugin_job_get_progress (GsPluginJob *self)
+{
+ g_return_val_if_fail (GS_IS_PLUGIN_JOB (self), NULL);
+ return self->progress;
+}
+
static void
gs_plugin_job_get_property (GObject *obj, guint prop_id, GValue *value, GParamSpec *pspec)
{
@@ -441,6 +457,9 @@ gs_plugin_job_get_property (GObject *obj, guint prop_id, GValue *value, GParamSp
case PROP_REVIEW:
g_value_set_object (value, self->review);
break;
+ case PROP_PROGRESS:
+ g_value_set_object (value, self->progress);
+ break;
case PROP_MAX_RESULTS:
g_value_set_uint (value, self->max_results);
break;
@@ -501,6 +520,9 @@ gs_plugin_job_set_property (GObject *obj, guint prop_id, const GValue *value, GP
case PROP_TIMEOUT:
gs_plugin_job_set_timeout (self, g_value_get_uint (value));
break;
+ case PROP_PROGRESS:
+ gs_plugin_job_set_progress (self, g_value_get_object (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
@@ -518,6 +540,7 @@ gs_plugin_job_finalize (GObject *obj)
g_clear_object (&self->plugin);
g_clear_object (&self->category);
g_clear_object (&self->review);
+ g_clear_object (&self->progress);
G_OBJECT_CLASS (gs_plugin_job_parent_class)->finalize (obj);
}
@@ -602,6 +625,11 @@ gs_plugin_job_class_init (GsPluginJobClass *klass)
0, G_MAXUINT, 60,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
g_object_class_install_property (object_class, PROP_TIMEOUT, pspec);
+
+ pspec = g_param_spec_object ("progress", NULL, NULL,
+ GS_TYPE_PROGRESS,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (object_class, PROP_PROGRESS, pspec);
}
static void
diff --git a/lib/gs-plugin-job.h b/lib/gs-plugin-job.h
index 5100fdf0..0e68669e 100644
--- a/lib/gs-plugin-job.h
+++ b/lib/gs-plugin-job.h
@@ -12,6 +12,7 @@
#include "gs-app-list-private.h"
#include "gs-category.h"
#include "gs-plugin-types.h"
+#include "gs-progress.h"
G_BEGIN_DECLS
@@ -51,6 +52,9 @@ void gs_plugin_job_set_category (GsPluginJob *self,
GsCategory *category);
void gs_plugin_job_set_review (GsPluginJob *self,
AsReview *review);
+void gs_plugin_job_set_progress (GsPluginJob *self,
+ GsProgress *progress);
+GsProgress *gs_plugin_job_get_progress (GsPluginJob *self);
#define gs_plugin_job_newv(a,...)
GS_PLUGIN_JOB(g_object_new(GS_TYPE_PLUGIN_JOB, "action", a, __VA_ARGS__))
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 5209b70f..31852065 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -491,6 +491,25 @@ gs_plugin_loader_review_score_sort_cb (gconstpointer a, gconstpointer b)
return 0;
}
+static gboolean
+gs_plugin_loader_progress_changed_idle (gpointer user_data)
+{
+ GsPluginJob *plugin_job = (GsPluginJob *) user_data;
+
+ g_object_notify (G_OBJECT (plugin_job), "progress");
+ g_print (" --- gs_plugin_loader_progress_changed_idle\n");
+
+ return G_SOURCE_REMOVE;
+}
+
+static void
+gs_plugin_loader_progress_changed_cb (GsProgress *progress, GParamSpec *pspec, GsPluginJob *plugin_job)
+{
+ g_print (" --- gs_plugin_loader_progress_changed_cb\n");
+
+ g_idle_add (gs_plugin_loader_progress_changed_idle, plugin_job);
+}
+
static gboolean
gs_plugin_loader_call_vfunc (GsPluginLoaderHelper *helper,
GsPlugin *plugin,
@@ -503,6 +522,7 @@ gs_plugin_loader_call_vfunc (GsPluginLoaderHelper *helper,
GsPluginAction action = gs_plugin_job_get_action (helper->plugin_job);
gboolean ret = TRUE;
gpointer func = NULL;
+ GsProgress *progress;
g_autoptr(GError) error_local = NULL;
g_autoptr(GTimer) timer = g_timer_new ();
@@ -522,6 +542,29 @@ gs_plugin_loader_call_vfunc (GsPluginLoaderHelper *helper,
/* set what plugin is running on the job */
gs_plugin_job_set_plugin (helper->plugin_job, plugin);
+ /* set the data on either the app or the app list as the plugin job isn't passed to the plugins */
+ progress = gs_plugin_job_get_progress (helper->plugin_job);
+ if (progress != NULL) {
+ if (app != NULL)
+ g_object_set_data (G_OBJECT (app), "job-progress", progress);
+ if (list != NULL)
+ g_object_set_data (G_OBJECT (list), "job-progress", progress);
+
+ // XXX: debug
+ g_signal_connect_object (progress, "notify::size-downloaded",
+ G_CALLBACK (gs_plugin_loader_progress_changed_cb),
+ helper->plugin_job, 0);
+ g_signal_connect_object (progress, "notify::size-total",
+ G_CALLBACK (gs_plugin_loader_progress_changed_cb),
+ helper->plugin_job, 0);
+ g_signal_connect_object (progress, "notify::message",
+ G_CALLBACK (gs_plugin_loader_progress_changed_cb),
+ helper->plugin_job, 0);
+ g_signal_connect_object (progress, "notify::percentage",
+ G_CALLBACK (gs_plugin_loader_progress_changed_cb),
+ helper->plugin_job, 0);
+ }
+
/* run the correct vfunc */
if (gs_plugin_job_get_interactive (helper->plugin_job))
gs_plugin_interactive_inc (plugin);
diff --git a/lib/gs-progress.c b/lib/gs-progress.c
new file mode 100644
index 00000000..0d9df2b1
--- /dev/null
+++ b/lib/gs-progress.c
@@ -0,0 +1,301 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2019 Kalev Lember <klember redhat com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include "config.h"
+
+#include "gs-progress.h"
+#include <glib.h>
+
+struct _GsProgress
+{
+ GObject parent_instance;
+ GMutex mutex;
+ guint64 size_downloaded;
+ guint64 size_total;
+ gchar *message;
+ guint percentage;
+};
+
+G_DEFINE_TYPE (GsProgress, gs_progress, G_TYPE_OBJECT)
+
+enum {
+ PROP_0,
+ PROP_SIZE_DOWNLOADED,
+ PROP_SIZE_TOTAL,
+ PROP_MESSAGE,
+ PROP_PERCENTAGE,
+ PROP_LAST
+};
+
+/**
+ * gs_progress_get_size_downloaded:
+ * @self: A #GsProgress
+ *
+ * Gets the bytes downloaded.
+ *
+ * Since: 3.32
+ **/
+guint64
+gs_progress_get_size_downloaded (GsProgress *self)
+{
+ g_autoptr(GMutexLocker) locker = NULL;
+
+ g_return_val_if_fail (GS_IS_PROGRESS (self), 0);
+
+ locker = g_mutex_locker_new (&self->mutex);
+ return self->size_downloaded;
+}
+
+/**
+ * gs_progress_set_size_downloaded:
+ * @self: A #GsApp
+ * @size_downloaded: the bytes downloaded
+ *
+ * Sets the size in bytes that have been downloaded.
+ *
+ * Since: 3.32
+ **/
+void
+gs_progress_set_size_downloaded (GsProgress *self, guint64 size_downloaded)
+{
+ g_autoptr(GMutexLocker) locker = NULL;
+
+ g_return_if_fail (GS_IS_PROGRESS (self));
+ g_print ("gs_progress_set_size_downloaded: %lu\n", size_downloaded);
+
+ locker = g_mutex_locker_new (&self->mutex);
+ if (self->size_downloaded != size_downloaded) {
+ self->size_downloaded = size_downloaded;
+ g_object_notify (G_OBJECT (self), "size-downloaded");
+ }
+}
+
+/**
+ * gs_progress_get_size_total:
+ * @self: A #GsProgress
+ *
+ * Gets the total size of the download in bytes.
+ *
+ * Since: 3.32
+ **/
+guint64
+gs_progress_get_size_total (GsProgress *self)
+{
+ g_autoptr(GMutexLocker) locker = NULL;
+
+ g_return_val_if_fail (GS_IS_PROGRESS (self), 0);
+
+ locker = g_mutex_locker_new (&self->mutex);
+ return self->size_total;
+}
+
+/**
+ * gs_progress_set_size_total:
+ * @self: A #GsApp
+ * @size_total: the total download size
+ *
+ * Sets the size in bytes that need to be downloaded.
+ *
+ * Since: 3.32
+ **/
+void
+gs_progress_set_size_total (GsProgress *self, guint64 size_total)
+{
+ g_autoptr(GMutexLocker) locker = NULL;
+
+ g_return_if_fail (GS_IS_PROGRESS (self));
+ g_print ("gs_progress_set_size_total: %lu\n", size_total);
+
+ locker = g_mutex_locker_new (&self->mutex);
+ if (self->size_total != size_total) {
+ self->size_total = size_total;
+ g_object_notify (G_OBJECT (self), "size-total");
+ }
+}
+
+/**
+ * gs_progress_get_message:
+ * @self: A #GsProgress
+ *
+ * Gets the progress message.
+ *
+ * Since: 3.32
+ **/
+gchar *
+gs_progress_get_message (GsProgress *self)
+{
+ g_autoptr(GMutexLocker) locker = NULL;
+
+ g_return_val_if_fail (GS_IS_PROGRESS (self), NULL);
+
+ locker = g_mutex_locker_new (&self->mutex);
+ return g_strdup (self->message);
+}
+
+/**
+ * gs_progress_set_message:
+ * @self: A #GsApp
+ * @message: progress message
+ *
+ * Sets a custom progress message to show in the UI.
+ *
+ * Since: 3.32
+ **/
+void
+gs_progress_set_message (GsProgress *self, const gchar *message)
+{
+ g_autoptr(GMutexLocker) locker = NULL;
+
+ g_return_if_fail (GS_IS_PROGRESS (self));
+ g_print ("gs_progress_set_message: %s\n", message);
+
+ locker = g_mutex_locker_new (&self->mutex);
+ if (g_strcmp0 (self->message, message) != 0) {
+ g_free (self->message);
+ self->message = g_strdup (message);
+ g_object_notify (G_OBJECT (self), "message");
+ }
+}
+
+/**
+ * gs_progress_get_percentage:
+ * @self: A #GsProgress
+ *
+ * Gets the percentage completed.
+ *
+ * Since: 3.32
+ **/
+guint
+gs_progress_get_percentage (GsProgress *self)
+{
+ g_autoptr(GMutexLocker) locker = NULL;
+
+ g_return_val_if_fail (GS_IS_PROGRESS (self), 0);
+
+ locker = g_mutex_locker_new (&self->mutex);
+ return self->percentage;
+}
+
+/**
+ * gs_progress_set_percentage:
+ * @self: A #GsApp
+ * @percentage: the percentage completed
+ *
+ * Sets the percentage that has been completed.
+ *
+ * Since: 3.32
+ **/
+void
+gs_progress_set_percentage (GsProgress *self, guint percentage)
+{
+ g_autoptr(GMutexLocker) locker = NULL;
+
+ g_return_if_fail (GS_IS_PROGRESS (self));
+ g_print ("gs_progress_set_percentage: %u\n", percentage);
+
+ percentage = MIN (percentage, 100);
+
+ locker = g_mutex_locker_new (&self->mutex);
+ if (self->percentage != percentage) {
+ self->percentage = percentage;
+ g_object_notify (G_OBJECT (self), "percentage");
+ }
+}
+
+static void
+gs_progress_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+ GsProgress *self = GS_PROGRESS (object);
+ switch (prop_id) {
+ case PROP_SIZE_DOWNLOADED:
+ g_value_set_uint64 (value, gs_progress_get_size_downloaded (self));
+ break;
+ case PROP_SIZE_TOTAL:
+ g_value_set_uint64 (value, gs_progress_get_size_total (self));
+ break;
+ case PROP_MESSAGE:
+ g_value_take_string (value, gs_progress_get_message (self));
+ break;
+ case PROP_PERCENTAGE:
+ g_value_set_uint (value, gs_progress_get_percentage (self));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gs_progress_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gs_progress_finalize (GObject *object)
+{
+ GsProgress *self = GS_PROGRESS (object);
+
+ g_free (self->message);
+ g_mutex_clear (&self->mutex);
+
+ G_OBJECT_CLASS (gs_progress_parent_class)->finalize (object);
+}
+
+static void
+gs_progress_class_init (GsProgressClass *klass)
+{
+ GParamSpec *pspec;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->get_property = gs_progress_get_property;
+ object_class->set_property = gs_progress_set_property;
+ object_class->finalize = gs_progress_finalize;
+
+ pspec = g_param_spec_uint64 ("size-downloaded", NULL, NULL, 0, G_MAXUINT64, 0,
+ G_PARAM_READABLE);
+ g_object_class_install_property (object_class, PROP_SIZE_DOWNLOADED, pspec);
+
+ pspec = g_param_spec_uint64 ("size-total", NULL, NULL, 0, G_MAXUINT64, 0,
+ G_PARAM_READABLE);
+ g_object_class_install_property (object_class, PROP_SIZE_DOWNLOADED, pspec);
+
+ pspec = g_param_spec_string ("message", NULL, NULL, NULL,
+ G_PARAM_READABLE);
+ g_object_class_install_property (object_class, PROP_MESSAGE, pspec);
+
+ pspec = g_param_spec_uint ("percentage", NULL, NULL, 0, 100, 0,
+ G_PARAM_READABLE);
+ g_object_class_install_property (object_class, PROP_PERCENTAGE, pspec);
+}
+
+static void
+gs_progress_init (GsProgress *self)
+{
+ g_mutex_init (&self->mutex);
+}
+
+/**
+ * gs_progress_new:
+ *
+ * Creates a new progress object.
+ *
+ * Returns: A newly allocated #GsProgress
+ *
+ * Since: 3.32
+ **/
+GsProgress *
+gs_progress_new (void)
+{
+ GsProgress *self;
+ self = g_object_new (GS_TYPE_PROGRESS, NULL);
+ return GS_PROGRESS (self);
+}
diff --git a/lib/gs-progress.h b/lib/gs-progress.h
new file mode 100644
index 00000000..7759d294
--- /dev/null
+++ b/lib/gs-progress.h
@@ -0,0 +1,32 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2019 Kalev Lember <klember redhat com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#pragma once
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GS_TYPE_PROGRESS (gs_progress_get_type ())
+
+G_DECLARE_FINAL_TYPE (GsProgress, gs_progress, GS, PROGRESS, GObject)
+
+GsProgress *gs_progress_new (void);
+guint64 gs_progress_get_size_downloaded (GsProgress *self);
+void gs_progress_set_size_downloaded (GsProgress *self,
+ guint64 size_downloaded);
+guint64 gs_progress_get_size_total (GsProgress *self);
+void gs_progress_set_size_total (GsProgress *self,
+ guint64 size_total);
+gchar *gs_progress_get_message (GsProgress *self);
+void gs_progress_set_message (GsProgress *self,
+ const gchar *message);
+guint gs_progress_get_percentage (GsProgress *self);
+void gs_progress_set_percentage (GsProgress *self,
+ guint percentage);
+
+G_END_DECLS
diff --git a/lib/meson.build b/lib/meson.build
index 376beebd..9b74f961 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -88,6 +88,7 @@ libgnomesoftware = static_library(
'gs-plugin-job.c',
'gs-plugin-loader.c',
'gs-plugin-loader-sync.c',
+ 'gs-progress.c',
'gs-test.c',
'gs-utils.c',
],
diff --git a/plugins/flatpak/gs-flatpak-transaction.c b/plugins/flatpak/gs-flatpak-transaction.c
index 57b7a05c..884015d3 100644
--- a/plugins/flatpak/gs-flatpak-transaction.c
+++ b/plugins/flatpak/gs-flatpak-transaction.c
@@ -14,6 +14,7 @@
struct _GsFlatpakTransaction {
FlatpakTransaction parent_instance;
GHashTable *refhash; /* ref:GsApp */
+ GsProgress *progress;
GError *first_operation_error;
#if !FLATPAK_CHECK_VERSION(1,5,1)
gboolean no_deploy;
@@ -45,6 +46,7 @@ gs_flatpak_transaction_finalize (GObject *object)
g_assert (self != NULL);
g_hash_table_unref (self->refhash);
+ g_clear_object (&self->progress);
if (self->first_operation_error != NULL)
g_error_free (self->first_operation_error);
@@ -194,6 +196,21 @@ _transaction_progress_changed_cb (FlatpakTransactionProgress *progress,
gs_app_set_progress (app, percent);
}
+static void
+_transaction_progress_changed_cb2 (FlatpakTransactionProgress *progress,
+ gpointer user_data)
+{
+ GsFlatpakTransaction *self = GS_FLATPAK_TRANSACTION (user_data);
+ guint percent = flatpak_transaction_progress_get_progress (progress);
+ g_autofree char *status = flatpak_transaction_progress_get_status (progress);
+
+ g_print ("FLATPAK STATUS (%u%%): %s\n", percent, status);
+ if (self->progress != NULL) {
+ gs_progress_set_message (self->progress, status);
+ gs_progress_set_percentage (self->progress, percent);
+ }
+}
+
static const gchar *
_flatpak_transaction_operation_type_to_string (FlatpakTransactionOperationType ot)
{
@@ -230,6 +247,9 @@ _transaction_new_operation (FlatpakTransaction *transaction,
g_signal_connect_object (progress, "changed",
G_CALLBACK (_transaction_progress_changed_cb),
app, 0);
+ g_signal_connect_object (progress, "changed",
+ G_CALLBACK (_transaction_progress_changed_cb2),
+ transaction, 0);
flatpak_transaction_progress_set_update_frequency (progress, 100); /* FIXME? */
/* set app status */
@@ -446,6 +466,7 @@ gs_flatpak_transaction_init (GsFlatpakTransaction *self)
FlatpakTransaction *
gs_flatpak_transaction_new (FlatpakInstallation *installation,
+ GsProgress *progress,
GCancellable *cancellable,
GError **error)
{
@@ -456,5 +477,6 @@ gs_flatpak_transaction_new (FlatpakInstallation *installation,
NULL);
if (self == NULL)
return NULL;
+ g_set_object (&self->progress, progress);
return FLATPAK_TRANSACTION (self);
}
diff --git a/plugins/flatpak/gs-flatpak-transaction.h b/plugins/flatpak/gs-flatpak-transaction.h
index f0dfd107..386b54fa 100644
--- a/plugins/flatpak/gs-flatpak-transaction.h
+++ b/plugins/flatpak/gs-flatpak-transaction.h
@@ -17,6 +17,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (GsFlatpakTransaction, gs_flatpak_transaction, GS, FLATPAK_TRANSACTION,
FlatpakTransaction)
FlatpakTransaction *gs_flatpak_transaction_new (FlatpakInstallation *installation,
+ GsProgress *progress,
GCancellable *cancellable,
GError **error);
GsApp *gs_flatpak_transaction_get_app_by_ref (FlatpakTransaction *transaction,
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index 628d2da2..2cc8e473 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -441,7 +441,7 @@ _group_apps_by_installation (GsPlugin *plugin,
}
static FlatpakTransaction *
-_build_transaction (GsPlugin *plugin, GsFlatpak *flatpak,
+_build_transaction (GsPlugin *plugin, GsFlatpak *flatpak, GsProgress *job_progress,
GCancellable *cancellable, GError **error)
{
FlatpakInstallation *installation;
@@ -454,7 +454,7 @@ _build_transaction (GsPlugin *plugin, GsFlatpak *flatpak,
flatpak_installation_set_no_interaction (installation, TRUE);
/* create transaction */
- transaction = gs_flatpak_transaction_new (installation, cancellable, error);
+ transaction = gs_flatpak_transaction_new (installation, job_progress, cancellable, error);
if (transaction == NULL) {
g_prefix_error (error, "failed to build transaction: ");
gs_flatpak_error_convert (error);
@@ -502,7 +502,7 @@ gs_plugin_download (GsPlugin *plugin, GsAppList *list,
}
/* build and run non-deployed transaction */
- transaction = _build_transaction (plugin, flatpak, cancellable, error);
+ transaction = _build_transaction (plugin, flatpak, NULL, cancellable, error);
if (transaction == NULL) {
gs_flatpak_error_convert (error);
return FALSE;
@@ -551,7 +551,7 @@ gs_plugin_app_remove (GsPlugin *plugin,
return gs_flatpak_app_remove_source (flatpak, app, cancellable, error);
/* build and run transaction */
- transaction = _build_transaction (plugin, flatpak, cancellable, error);
+ transaction = _build_transaction (plugin, flatpak, NULL, cancellable, error);
if (transaction == NULL) {
gs_flatpak_error_convert (error);
return FALSE;
@@ -600,6 +600,7 @@ gs_plugin_app_install (GsPlugin *plugin,
{
GsPluginData *priv = gs_plugin_get_data (plugin);
GsFlatpak *flatpak;
+ GsProgress *job_progress;
g_autoptr(FlatpakTransaction) transaction = NULL;
/* queue for install if installation needs the network */
@@ -648,8 +649,10 @@ gs_plugin_app_install (GsPlugin *plugin,
}
}
+ job_progress = g_object_get_data (G_OBJECT (app), "job-progress");
+
/* build */
- transaction = _build_transaction (plugin, flatpak, cancellable, error);
+ transaction = _build_transaction (plugin, flatpak, job_progress, cancellable, error);
if (transaction == NULL) {
gs_flatpak_error_convert (error);
return FALSE;
@@ -743,7 +746,7 @@ gs_plugin_flatpak_update (GsPlugin *plugin,
g_autoptr(FlatpakTransaction) transaction = NULL;
/* build and run transaction */
- transaction = _build_transaction (plugin, flatpak, cancellable, error);
+ transaction = _build_transaction (plugin, flatpak, NULL, cancellable, error);
if (transaction == NULL) {
gs_flatpak_error_convert (error);
return FALSE;
diff --git a/src/gs-page.c b/src/gs-page.c
index 98665dcb..8ebb738d 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -179,6 +179,7 @@ gs_page_install_app (GsPage *page,
GsPagePrivate *priv = gs_page_get_instance_private (page);
GsPageHelper *helper;
g_autoptr(GsPluginJob) plugin_job = NULL;
+ g_autoptr(GsProgress) progress = gs_progress_new ();
/* probably non-free */
if (gs_app_get_state (app) == AS_APP_STATE_UNAVAILABLE) {
@@ -199,6 +200,7 @@ gs_page_install_app (GsPage *page,
plugin_job = gs_plugin_job_newv (helper->action,
"interactive", TRUE,
"app", helper->app,
+ "progress", progress,
NULL);
gs_plugin_loader_job_process_async (priv->plugin_loader,
plugin_job,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]