[gnome-software/603-gnome-software-reports-unknown-error-when-there-is-a-signing-issue: 48/48] packagekit: Ask the user what to do when there's a package signing issue
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/603-gnome-software-reports-unknown-error-when-there-is-a-signing-issue: 48/48] packagekit: Ask the user what to do when there's a package signing issue
- Date: Thu, 14 Oct 2021 15:02:37 +0000 (UTC)
commit 04098e139ddd5263298152d00be0773f59349667
Author: Milan Crha <mcrha redhat com>
Date: Thu Oct 14 16:56:21 2021 +0200
packagekit: Ask the user what to do when there's a package signing issue
Ask the user what to do, rather than error out with a cryptic error
message "could not do untrusted question as no klass support".
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/603
plugins/packagekit/gs-packagekit-task.c | 229 ++++++++++++++++++++++
plugins/packagekit/gs-packagekit-task.h | 32 +++
plugins/packagekit/gs-plugin-packagekit-refresh.c | 9 +-
plugins/packagekit/gs-plugin-packagekit.c | 37 ++--
plugins/packagekit/meson.build | 2 +
po/POTFILES.in | 1 +
6 files changed, 288 insertions(+), 22 deletions(-)
---
diff --git a/plugins/packagekit/gs-packagekit-task.c b/plugins/packagekit/gs-packagekit-task.c
new file mode 100644
index 000000000..a2aee0bf0
--- /dev/null
+++ b/plugins/packagekit/gs-packagekit-task.c
@@ -0,0 +1,229 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ * vi:set noexpandtab tabstop=8 shiftwidth=8:
+ *
+ * Copyright (C) 2021 Red Hat <www.redhat.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include "config.h"
+
+#include <glib/gi18n-lib.h>
+
+#include "gs-packagekit-task.h"
+
+typedef struct _GsPackageKitTaskPrivate {
+ GWeakRef plugin_weakref; /* GsPlugin * */
+ GsPluginAction action;
+} GsPackageKitTaskPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (GsPackageKitTask, gs_packagekit_task, PK_TYPE_TASK)
+
+static gboolean
+gs_packagekit_task_user_accepted (PkTask *task,
+ const gchar *title,
+ const gchar *msg,
+ const gchar *details,
+ const gchar *accept_label)
+{
+ GsPackageKitTask *gs_task = GS_PACKAGEKIT_TASK (task);
+ GsPackageKitTaskPrivate *priv = gs_packagekit_task_get_instance_private (gs_task);
+ g_autoptr(GsPlugin) plugin = NULL;
+ gboolean accepts = FALSE;
+
+ plugin = g_weak_ref_get (&priv->plugin_weakref);
+ if (plugin)
+ accepts = gs_plugin_ask_untrusted (plugin, title, msg, details, accept_label);
+
+ return accepts;
+}
+
+typedef struct _QuestionData {
+ GWeakRef task_weakref;
+ guint request;
+ gchar *title;
+ gchar *msg;
+ gchar *details;
+ gchar *accept_label;
+} QuestionData;
+
+static QuestionData *
+question_data_new (GsPackageKitTask *task,
+ guint request,
+ const gchar *title,
+ const gchar *msg,
+ const gchar *details,
+ const gchar *accept_label)
+{
+ QuestionData *qd;
+
+ qd = g_slice_new0 (QuestionData);
+ g_weak_ref_init (&qd->task_weakref, task);
+ qd->request = request;
+ qd->title = g_strdup (title);
+ qd->msg = g_strdup (msg);
+ qd->details = g_strdup (details);
+ qd->accept_label = g_strdup (accept_label);
+
+ return qd;
+}
+
+static void
+question_data_free (gpointer ptr)
+{
+ QuestionData *qd = ptr;
+
+ if (qd) {
+ g_weak_ref_clear (&qd->task_weakref);
+ g_free (qd->title);
+ g_free (qd->msg);
+ g_free (qd->details);
+ g_free (qd->accept_label);
+ g_slice_free (QuestionData, qd);
+ }
+}
+
+static gboolean
+gs_packagekit_task_question_idle_cb (gpointer user_data)
+{
+ QuestionData *qd = user_data;
+ g_autoptr(PkTask) task = NULL;
+
+ task = g_weak_ref_get (&qd->task_weakref);
+ if (task) {
+ if (gs_packagekit_task_user_accepted (task, qd->title, qd->msg, qd->details,
qd->accept_label))
+ pk_task_user_accepted (task, qd->request);
+ else
+ pk_task_user_declined (task, qd->request);
+ }
+
+ return G_SOURCE_REMOVE;
+}
+
+static void
+gs_packagekit_task_schedule_question (GsPackageKitTask *task,
+ guint request,
+ const gchar *title,
+ const gchar *msg,
+ const gchar *details,
+ const gchar *accept_label)
+{
+ QuestionData *qd;
+
+ qd = question_data_new (task, request, title, msg, details, accept_label);
+ g_idle_add_full (G_PRIORITY_HIGH_IDLE, gs_packagekit_task_question_idle_cb, qd, question_data_free);
+}
+
+static void
+gs_packagekit_task_untrusted_question (PkTask *task,
+ guint request,
+ PkResults *results)
+{
+ GsPackageKitTask *gs_task = GS_PACKAGEKIT_TASK (task);
+ GsPackageKitTaskPrivate *priv = gs_packagekit_task_get_instance_private (gs_task);
+ g_autoptr(PkError) error = NULL;
+ const gchar *title;
+ const gchar *msg;
+ const gchar *details;
+ const gchar *accept_label;
+
+ switch (priv->action) {
+ case GS_PLUGIN_ACTION_INSTALL:
+ title = _("Install Unsigned Software?");
+ msg = _("Software that is to be installed is not signed. It will not be possible to verify
the origin of updates to this software, or whether updates have been tampered with.");
+ accept_label = _("_Install");
+ break;
+ case GS_PLUGIN_ACTION_DOWNLOAD:
+ title = _("Download Unsigned Software?");
+ msg = _("Unsigned updates are available. Without a signature, it is not possible to verify
the origin of the update, or whether it has been tampered with.");
+ accept_label = _("_Download");
+ break;
+ case GS_PLUGIN_ACTION_UPDATE:
+ title = _("Update Unsigned Software?");
+ msg = _("Unsigned updates are available. Without a signature, it is not possible to verify
the origin of the update, or whether it has been tampered with. Software updates will be disabled until
unsigned updates are either removed or updated.");
+ accept_label = _("_Update");
+ break;
+ default:
+ pk_task_user_declined (task, request);
+ return;
+ }
+
+ error = pk_results_get_error_code (results);
+ if (error)
+ details = pk_error_get_details (error);
+ else
+ details = NULL;
+
+ gs_packagekit_task_schedule_question (gs_task, request, title, msg, details, accept_label);
+}
+
+static void
+gs_packagekit_task_finalize (GObject *object)
+{
+ GsPackageKitTask *task = GS_PACKAGEKIT_TASK (object);
+ GsPackageKitTaskPrivate *priv = gs_packagekit_task_get_instance_private (task);
+
+ g_weak_ref_clear (&priv->plugin_weakref);
+
+ G_OBJECT_CLASS (gs_packagekit_task_parent_class)->finalize (object);
+}
+
+static void
+gs_packagekit_task_class_init (GsPackageKitTaskClass *klass)
+{
+ GObjectClass *object_class;
+ PkTaskClass *task_class;
+
+ task_class = PK_TASK_CLASS (klass);
+ task_class->untrusted_question = gs_packagekit_task_untrusted_question;
+
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = gs_packagekit_task_finalize;
+}
+
+static void
+gs_packagekit_task_init (GsPackageKitTask *task)
+{
+ GsPackageKitTaskPrivate *priv = gs_packagekit_task_get_instance_private (task);
+
+ g_weak_ref_init (&priv->plugin_weakref, NULL);
+}
+
+PkTask *
+gs_packagekit_task_new (GsPlugin *plugin)
+{
+ GsPackageKitTask *task;
+ GsPackageKitTaskPrivate *priv;
+
+ g_return_val_if_fail (GS_IS_PLUGIN (plugin), NULL);
+
+ task = g_object_new (GS_TYPE_PACKAGEKIT_TASK, NULL);
+ priv = gs_packagekit_task_get_instance_private (task);
+
+ g_weak_ref_set (&priv->plugin_weakref, plugin);
+
+ return PK_TASK (task);
+}
+
+void
+gs_packagekit_task_setup (GsPackageKitTask *task,
+ GsPluginAction action,
+ gboolean interactive)
+{
+ GsPackageKitTaskPrivate *priv = gs_packagekit_task_get_instance_private (task);
+
+ g_return_if_fail (GS_IS_PACKAGEKIT_TASK (task));
+
+ priv->action = action;
+ pk_client_set_interactive (PK_CLIENT (task), interactive);
+}
+
+GsPluginAction
+gs_packagekit_task_get_action (GsPackageKitTask *task)
+{
+ GsPackageKitTaskPrivate *priv = gs_packagekit_task_get_instance_private (task);
+
+ g_return_val_if_fail (GS_IS_PACKAGEKIT_TASK (task), GS_PLUGIN_ACTION_UNKNOWN);
+
+ return priv->action;
+}
diff --git a/plugins/packagekit/gs-packagekit-task.h b/plugins/packagekit/gs-packagekit-task.h
new file mode 100644
index 000000000..ff8ef42e3
--- /dev/null
+++ b/plugins/packagekit/gs-packagekit-task.h
@@ -0,0 +1,32 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ * vi:set noexpandtab tabstop=8 shiftwidth=8:
+ *
+ * Copyright (C) 2021 Red Hat <www.redhat.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#pragma once
+
+#include <glib-object.h>
+#include <gnome-software.h>
+#include <packagekit-glib2/packagekit.h>
+
+G_BEGIN_DECLS
+
+#define GS_TYPE_PACKAGEKIT_TASK (gs_packagekit_task_get_type ())
+
+G_DECLARE_DERIVABLE_TYPE (GsPackageKitTask, gs_packagekit_task, GS, PACKAGEKIT_TASK, PkTask)
+
+struct _GsPackageKitTaskClass
+{
+ PkTaskClass parent_class;
+};
+
+PkTask *gs_packagekit_task_new (GsPlugin *plugin);
+void gs_packagekit_task_setup (GsPackageKitTask *task,
+ GsPluginAction action,
+ gboolean interactive);
+GsPluginAction gs_packagekit_task_get_action (GsPackageKitTask *task);
+
+G_END_DECLS
diff --git a/plugins/packagekit/gs-plugin-packagekit-refresh.c
b/plugins/packagekit/gs-plugin-packagekit-refresh.c
index c76450625..119f85f3b 100644
--- a/plugins/packagekit/gs-plugin-packagekit-refresh.c
+++ b/plugins/packagekit/gs-plugin-packagekit-refresh.c
@@ -14,6 +14,7 @@
#include "gs-metered.h"
#include "gs-packagekit-helper.h"
+#include "gs-packagekit-task.h"
#include "packagekit-common.h"
#include "gs-plugin-packagekit-refresh.h"
@@ -39,7 +40,7 @@ gs_plugin_packagekit_refresh_init (GsPluginPackagekitRefresh *self)
GsPlugin *plugin = GS_PLUGIN (self);
g_mutex_init (&self->task_mutex);
- self->task = pk_task_new ();
+ self->task = gs_packagekit_task_new (plugin);
pk_task_set_only_download (self->task, TRUE);
pk_client_set_background (PK_CLIENT (self->task), TRUE);
pk_client_set_interactive (PK_CLIENT (self->task), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
@@ -89,7 +90,7 @@ _download_only (GsPluginPackagekitRefresh *self,
* we end up downloading a different set of packages than what was
* shown to the user */
pk_client_set_cache_age (PK_CLIENT (self->task), G_MAXUINT);
- pk_client_set_interactive (PK_CLIENT (self->task), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task), GS_PLUGIN_ACTION_DOWNLOAD,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
results = pk_client_get_updates (PK_CLIENT (self->task),
pk_bitfield_value (PK_FILTER_ENUM_NONE),
cancellable,
@@ -114,7 +115,7 @@ _download_only (GsPluginPackagekitRefresh *self,
* we end up downloading a different set of packages than what was
* shown to the user */
pk_client_set_cache_age (PK_CLIENT (self->task), G_MAXUINT);
- pk_client_set_interactive (PK_CLIENT (self->task), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task), GS_PLUGIN_ACTION_DOWNLOAD,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
results2 = pk_task_update_packages_sync (self->task,
package_ids,
cancellable,
@@ -201,7 +202,7 @@ gs_plugin_refresh (GsPlugin *plugin,
g_mutex_lock (&self->task_mutex);
/* cache age of 1 is user-initiated */
pk_client_set_background (PK_CLIENT (self->task), cache_age > 1);
- pk_client_set_interactive (PK_CLIENT (self->task), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task), GS_PLUGIN_ACTION_REFRESH,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
pk_client_set_cache_age (PK_CLIENT (self->task), cache_age);
/* refresh the metadata */
results = pk_client_refresh_cache (PK_CLIENT (self->task),
diff --git a/plugins/packagekit/gs-plugin-packagekit.c b/plugins/packagekit/gs-plugin-packagekit.c
index 31f50d1cd..e2950fe23 100644
--- a/plugins/packagekit/gs-plugin-packagekit.c
+++ b/plugins/packagekit/gs-plugin-packagekit.c
@@ -20,6 +20,7 @@
#include "packagekit-common.h"
#include "gs-markdown.h"
#include "gs-packagekit-helper.h"
+#include "gs-packagekit-task.h"
#include "gs-plugin-packagekit.h"
@@ -87,7 +88,7 @@ gs_plugin_packagekit_init (GsPluginPackagekit *self)
/* core */
g_mutex_init (&self->task_mutex);
- self->task = pk_task_new ();
+ self->task = gs_packagekit_task_new (plugin);
pk_client_set_background (PK_CLIENT (self->task), FALSE);
pk_client_set_cache_age (PK_CLIENT (self->task), G_MAXUINT);
pk_client_set_interactive (PK_CLIENT (self->task), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
@@ -106,7 +107,7 @@ gs_plugin_packagekit_init (GsPluginPackagekit *self)
/* local */
g_mutex_init (&self->task_mutex_local);
- self->task_local = pk_task_new ();
+ self->task_local = gs_packagekit_task_new (plugin);
pk_client_set_background (PK_CLIENT (self->task_local), FALSE);
pk_client_set_interactive (PK_CLIENT (self->task_local), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
@@ -139,7 +140,7 @@ gs_plugin_packagekit_init (GsPluginPackagekit *self)
/* upgrade */
g_mutex_init (&self->task_mutex_upgrade);
- self->task_upgrade = pk_task_new ();
+ self->task_upgrade = gs_packagekit_task_new (plugin);
pk_task_set_only_download (self->task_upgrade, TRUE);
pk_client_set_background (PK_CLIENT (self->task_upgrade), TRUE);
pk_client_set_cache_age (PK_CLIENT (self->task_upgrade), 60 * 60 * 24);
@@ -221,7 +222,7 @@ gs_plugin_add_sources_related (GsPlugin *plugin,
PK_FILTER_ENUM_NOT_COLLECTIONS,
-1);
g_mutex_lock (&self->task_mutex);
- pk_client_set_interactive (PK_CLIENT (self->task), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task), GS_PLUGIN_ACTION_GET_SOURCES,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
results = pk_client_get_packages (PK_CLIENT(self->task),
filter,
cancellable,
@@ -284,7 +285,7 @@ gs_plugin_add_sources (GsPlugin *plugin,
PK_FILTER_ENUM_NOT_DEVELOPMENT,
-1);
g_mutex_lock (&self->task_mutex);
- pk_client_set_interactive (PK_CLIENT (self->task), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task), GS_PLUGIN_ACTION_GET_SOURCES,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
results = pk_client_get_repo_list (PK_CLIENT(self->task),
filter,
cancellable,
@@ -352,7 +353,7 @@ gs_plugin_app_origin_repo_enable (GsPluginPackagekit *self,
/* do sync call */
gs_plugin_status_update (plugin, app, GS_PLUGIN_STATUS_WAITING);
g_mutex_lock (&self->task_mutex);
- pk_client_set_interactive (PK_CLIENT (self->task), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task), GS_PLUGIN_ACTION_INSTALL,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
results = pk_client_repo_enable (PK_CLIENT (self->task),
repo_id,
TRUE,
@@ -441,7 +442,7 @@ gs_plugin_app_install (GsPlugin *plugin,
/* actually install the package */
gs_packagekit_helper_add_app (helper, app);
g_mutex_lock (&self->task_mutex);
- pk_client_set_interactive (PK_CLIENT (self->task), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task), GS_PLUGIN_ACTION_INSTALL,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
results = pk_task_install_packages_sync (self->task,
package_ids,
cancellable,
@@ -519,7 +520,7 @@ gs_plugin_app_install (GsPlugin *plugin,
}
gs_packagekit_helper_add_app (helper, app);
g_mutex_lock (&self->task_mutex);
- pk_client_set_interactive (PK_CLIENT (self->task), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task), GS_PLUGIN_ACTION_INSTALL,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
results = pk_task_install_packages_sync (self->task,
(gchar **) array_package_ids->pdata,
cancellable,
@@ -561,7 +562,7 @@ gs_plugin_app_install (GsPlugin *plugin,
gs_app_set_state (app, GS_APP_STATE_INSTALLING);
gs_packagekit_helper_add_app (helper, app);
g_mutex_lock (&self->task_mutex);
- pk_client_set_interactive (PK_CLIENT (self->task), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task), GS_PLUGIN_ACTION_INSTALL,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
results = pk_task_install_files_sync (self->task,
package_ids,
cancellable,
@@ -647,7 +648,7 @@ gs_plugin_app_remove (GsPlugin *plugin,
gs_app_set_state (app, GS_APP_STATE_REMOVING);
gs_packagekit_helper_add_app (helper, app);
g_mutex_lock (&self->task_mutex);
- pk_client_set_interactive (PK_CLIENT (self->task), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task), GS_PLUGIN_ACTION_REMOVE,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
results = pk_task_remove_packages_sync (self->task,
package_ids,
TRUE, GS_PACKAGEKIT_AUTOREMOVE,
@@ -719,7 +720,7 @@ gs_plugin_add_updates (GsPlugin *plugin,
/* do sync call */
gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_WAITING);
g_mutex_lock (&self->task_mutex);
- pk_client_set_interactive (PK_CLIENT (self->task), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task), GS_PLUGIN_ACTION_GET_UPDATES,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
results = pk_client_get_updates (PK_CLIENT (self->task),
pk_bitfield_value (PK_FILTER_ENUM_NONE),
cancellable,
@@ -758,7 +759,7 @@ gs_plugin_add_search_files (GsPlugin *plugin,
PK_FILTER_ENUM_ARCH,
-1);
g_mutex_lock (&self->task_mutex);
- pk_client_set_interactive (PK_CLIENT (self->task), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task), GS_PLUGIN_ACTION_SEARCH_FILES,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
results = pk_client_search_files (PK_CLIENT (self->task),
filter,
search,
@@ -791,7 +792,7 @@ gs_plugin_add_search_what_provides (GsPlugin *plugin,
PK_FILTER_ENUM_ARCH,
-1);
g_mutex_lock (&self->task_mutex);
- pk_client_set_interactive (PK_CLIENT (self->task), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task), GS_PLUGIN_ACTION_SEARCH_PROVIDES,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
results = pk_client_what_provides (PK_CLIENT (self->task),
filter,
search,
@@ -1844,7 +1845,7 @@ gs_plugin_packagekit_refresh_guess_app_id (GsPluginPackagekit *self,
files = g_strsplit (filename, "\t", -1);
gs_packagekit_helper_add_app (helper, app);
g_mutex_lock (&self->task_mutex_local);
- pk_client_set_interactive (PK_CLIENT (self->task_local), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task_local), GS_PLUGIN_ACTION_FILE_TO_APP,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
results = pk_client_get_files_local (PK_CLIENT (self->task_local),
files,
cancellable,
@@ -1978,7 +1979,7 @@ gs_plugin_file_to_app (GsPlugin *plugin,
files = g_strsplit (filename, "\t", -1);
g_mutex_lock (&self->task_mutex_local);
pk_client_set_cache_age (PK_CLIENT (self->task_local), G_MAXUINT);
- pk_client_set_interactive (PK_CLIENT (self->task_local), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task_local), GS_PLUGIN_ACTION_FILE_TO_APP,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
results = pk_client_get_details_local (PK_CLIENT (self->task_local),
files,
cancellable,
@@ -2570,7 +2571,7 @@ gs_plugin_app_upgrade_download (GsPlugin *plugin,
gs_app_set_state (app, GS_APP_STATE_INSTALLING);
gs_packagekit_helper_set_progress_app (helper, app);
g_mutex_lock (&self->task_mutex_upgrade);
- pk_client_set_interactive (PK_CLIENT (self->task_upgrade), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task_upgrade), GS_PLUGIN_ACTION_UPGRADE_DOWNLOAD,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
results = pk_task_upgrade_system_sync (self->task_upgrade,
gs_app_get_version (app),
PK_UPGRADE_KIND_ENUM_COMPLETE,
@@ -2612,7 +2613,7 @@ gs_plugin_enable_repo (GsPlugin *plugin,
gs_app_set_state (repo, GS_APP_STATE_INSTALLING);
gs_packagekit_helper_add_app (helper, repo);
g_mutex_lock (&self->task_mutex);
- pk_client_set_interactive (PK_CLIENT (self->task), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task), GS_PLUGIN_ACTION_ENABLE_REPO,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
results = pk_client_repo_enable (PK_CLIENT (self->task),
gs_app_get_id (repo),
TRUE,
@@ -2664,7 +2665,7 @@ gs_plugin_disable_repo (GsPlugin *plugin,
gs_app_set_state (repo, GS_APP_STATE_REMOVING);
gs_packagekit_helper_add_app (helper, repo);
g_mutex_lock (&self->task_mutex);
- pk_client_set_interactive (PK_CLIENT (self->task), gs_plugin_has_flags (plugin,
GS_PLUGIN_FLAGS_INTERACTIVE));
+ gs_packagekit_task_setup (GS_PACKAGEKIT_TASK (self->task), GS_PLUGIN_ACTION_DISABLE_REPO,
gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
results = pk_client_repo_enable (PK_CLIENT (self->task),
gs_app_get_id (repo),
FALSE,
diff --git a/plugins/packagekit/meson.build b/plugins/packagekit/meson.build
index a7cfcd7d4..07f570c12 100644
--- a/plugins/packagekit/meson.build
+++ b/plugins/packagekit/meson.build
@@ -31,6 +31,7 @@ shared_module(
sources : [
'gs-plugin-packagekit.c',
'gs-packagekit-helper.c',
+ 'gs-packagekit-task.c',
'packagekit-common.c',
'gs-markdown.c',
],
@@ -65,6 +66,7 @@ shared_module(
'gs_plugin_packagekit-refresh',
sources : [
'gs-plugin-packagekit-refresh.c',
+ 'gs-packagekit-task.c',
'gs-packagekit-helper.c',
'packagekit-common.c',
],
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d9105d846..5e139f15b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -111,6 +111,7 @@ plugins/flatpak/gs-plugin-flatpak.c
plugins/fwupd/gs-fwupd-app.c
plugins/fwupd/gs-plugin-fwupd.c
plugins/fwupd/org.gnome.Software.Plugin.Fwupd.metainfo.xml.in
+plugins/packagekit/gs-packagekit-task.c
plugins/packagekit/gs-plugin-packagekit.c
plugins/rpm-ostree/gs-plugin-rpm-ostree.c
plugins/snap/gs-plugin-snap.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]