[gnome-software] Ensure PackageKit actions are tagged with the correct GsApp



commit 93da066f9d9bce98b18b19fdb5a834c2178cc529
Author: Richard Hughes <richard hughsie com>
Date:   Thu May 26 14:56:13 2016 +0100

    Ensure PackageKit actions are tagged with the correct GsApp

 src/plugins/gs-plugin-packagekit-local.c  |    2 +-
 src/plugins/gs-plugin-packagekit-refine.c |   11 +++++++++--
 src/plugins/gs-plugin-packagekit.c        |   14 +++++++-------
 3 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/src/plugins/gs-plugin-packagekit-local.c b/src/plugins/gs-plugin-packagekit-local.c
index 8db10af..3a5aad8 100644
--- a/src/plugins/gs-plugin-packagekit-local.c
+++ b/src/plugins/gs-plugin-packagekit-local.c
@@ -66,7 +66,7 @@ gs_plugin_packagekit_progress_cb (PkProgress *progress,
                PkStatusEnum status = pk_progress_get_status (progress);
                plugin_status = packagekit_status_enum_to_plugin_status (status);
                if (plugin_status != GS_PLUGIN_STATUS_UNKNOWN)
-                       gs_plugin_status_update (plugin, NULL, plugin_status);
+                       gs_plugin_status_update (plugin, data->app, plugin_status);
        } else if (type == PK_PROGRESS_TYPE_PERCENTAGE) {
                gint percentage = pk_progress_get_percentage (progress);
                if (percentage >= 0 && percentage <= 100) {
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index 1321db6..d96ecd8 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -95,6 +95,7 @@ gs_plugin_adopt_app (GsPlugin *plugin, GsApp *app)
 }
 
 typedef struct {
+       GsApp           *app;
        GsPlugin        *plugin;
        AsProfileTask   *ptask;
        gchar           *profile_id;
@@ -130,7 +131,7 @@ gs_plugin_packagekit_progress_cb (PkProgress *progress,
 
        plugin_status = packagekit_status_enum_to_plugin_status (status);
        if (plugin_status != GS_PLUGIN_STATUS_UNKNOWN)
-               gs_plugin_status_update (plugin, NULL, plugin_status);
+               gs_plugin_status_update (plugin, data->app, plugin_status);
 }
 
 static void
@@ -264,6 +265,7 @@ gs_plugin_packagekit_resolve_packages (GsPlugin *plugin,
        }
        g_ptr_array_add (package_ids, NULL);
 
+       data.app = NULL;
        data.plugin = plugin;
        data.ptask = NULL;
        data.profile_id = NULL;
@@ -291,7 +293,7 @@ gs_plugin_packagekit_resolve_packages (GsPlugin *plugin,
 
 static gboolean
 gs_plugin_packagekit_refine_from_desktop (GsPlugin *plugin,
-                                         GsApp  *app,
+                                         GsApp *app,
                                          const gchar *filename,
                                          GCancellable *cancellable,
                                          GError **error)
@@ -302,6 +304,7 @@ gs_plugin_packagekit_refine_from_desktop (GsPlugin *plugin,
        g_autoptr(PkResults) results = NULL;
        g_autoptr(GPtrArray) packages = NULL;
 
+       data.app = app;
        data.plugin = plugin;
        data.ptask = NULL;
        data.profile_id = g_path_get_basename (filename);
@@ -380,6 +383,7 @@ gs_plugin_packagekit_refine_updatedetails (GsPlugin *plugin,
                package_ids[i++] = package_id;
        }
 
+       data.app = NULL;
        data.plugin = plugin;
        data.ptask = NULL;
        data.profile_id = NULL;
@@ -519,6 +523,7 @@ gs_plugin_packagekit_refine_details (GsPlugin *plugin,
        }
        g_ptr_array_add (package_ids, NULL);
 
+       data.app = NULL;
        data.plugin = plugin;
        data.ptask = NULL;
        data.profile_id = g_strjoinv (",", (gchar **) package_ids->pdata);
@@ -556,6 +561,7 @@ gs_plugin_packagekit_refine_update_urgency (GsPlugin *plugin,
        g_autoptr(PkPackageSack) sack = NULL;
        g_autoptr(PkResults) results = NULL;
 
+       data.app = NULL;
        data.plugin = plugin;
        data.ptask = NULL;
        data.profile_id = NULL;
@@ -735,6 +741,7 @@ gs_plugin_packagekit_refine_distro_upgrade (GsPlugin *plugin,
        g_autoptr(PkResults) results = NULL;
        g_autoptr(GsAppList) list = NULL;
 
+       data.app = app;
        data.plugin = plugin;
        data.ptask = NULL;
        data.profile_id = NULL;
diff --git a/src/plugins/gs-plugin-packagekit.c b/src/plugins/gs-plugin-packagekit.c
index c6dec89..331b773 100644
--- a/src/plugins/gs-plugin-packagekit.c
+++ b/src/plugins/gs-plugin-packagekit.c
@@ -89,7 +89,7 @@ gs_plugin_packagekit_progress_cb (PkProgress *progress,
 
                plugin_status = packagekit_status_enum_to_plugin_status (status);
                if (plugin_status != GS_PLUGIN_STATUS_UNKNOWN)
-                       gs_plugin_status_update (plugin, NULL, plugin_status);
+                       gs_plugin_status_update (plugin, data->app, plugin_status);
 
        } else if (type == PK_PROGRESS_TYPE_PERCENTAGE) {
                gint percentage = pk_progress_get_percentage (progress);
@@ -226,12 +226,12 @@ gs_plugin_app_source_enable (GsPlugin *plugin,
        ProgressData data;
        g_autoptr(PkResults) results = NULL;
 
-       data.app = NULL;
+       data.app = app;
        data.plugin = plugin;
        data.ptask = NULL;
 
        /* do sync call */
-       gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_WAITING);
+       gs_plugin_status_update (plugin, app, GS_PLUGIN_STATUS_WAITING);
        results = pk_client_repo_enable (PK_CLIENT (priv->task),
                                         gs_app_get_origin (app),
                                         TRUE,
@@ -429,12 +429,12 @@ gs_plugin_app_source_disable (GsPlugin *plugin,
        ProgressData data;
        g_autoptr(PkResults) results = NULL;
 
-       data.app = NULL;
+       data.app = app;
        data.plugin = plugin;
        data.ptask = NULL;
 
        /* do sync call */
-       gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_WAITING);
+       gs_plugin_status_update (plugin, app, GS_PLUGIN_STATUS_WAITING);
        results = pk_client_repo_enable (PK_CLIENT (priv->task),
                                         gs_app_get_id (app),
                                         FALSE,
@@ -462,7 +462,7 @@ gs_plugin_app_source_remove (GsPlugin *plugin,
        data.ptask = NULL;
 
        /* do sync call */
-       gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_WAITING);
+       gs_plugin_status_update (plugin, app, GS_PLUGIN_STATUS_WAITING);
        results = pk_client_repo_remove (PK_CLIENT (priv->task),
                                         pk_bitfield_from_enums (PK_TRANSACTION_FLAG_ENUM_NONE, -1),
                                         gs_app_get_id (app),
@@ -495,7 +495,7 @@ gs_plugin_app_remove (GsPlugin *plugin,
        g_autoptr(PkResults) results = NULL;
        g_auto(GStrv) package_ids = NULL;
 
-       data.app = NULL;
+       data.app = app;
        data.plugin = plugin;
        data.ptask = NULL;
 


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