[gnome-software] Invalidate the source IDs when installing or removing



commit 67c0411f9034d908d73048e6c47e9dad98049232
Author: Richard Hughes <richard hughsie com>
Date:   Mon Sep 1 13:28:19 2014 +0100

    Invalidate the source IDs when installing or removing

 src/gs-app.c                       |   10 ++++++++++
 src/gs-app.h                       |    1 +
 src/plugins/gs-plugin-packagekit.c |    6 ++++++
 3 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index ba7d183..6c9deca 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -701,6 +701,16 @@ gs_app_get_source_ids (GsApp *app)
 }
 
 /**
+ * gs_app_clear_source_ids:
+ */
+void
+gs_app_clear_source_ids (GsApp *app)
+{
+       g_return_if_fail (GS_IS_APP (app));
+       g_ptr_array_set_size (app->priv->source_ids, 0);
+}
+
+/**
  * gs_app_set_source_ids:
  * @app:       A #GsApp instance
  * @source_id: The source-id, e.g. ["gnome-calculator;0.134;fedora"]
diff --git a/src/gs-app.h b/src/gs-app.h
index 9fbe3ec..86251d6 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -145,6 +145,7 @@ void                 gs_app_add_source_id           (GsApp          *app,
 GPtrArray      *gs_app_get_source_ids          (GsApp          *app);
 void            gs_app_set_source_ids          (GsApp          *app,
                                                 GPtrArray      *source_ids);
+void            gs_app_clear_source_ids        (GsApp          *app);
 const gchar    *gs_app_get_project_group       (GsApp          *app);
 void            gs_app_set_project_group       (GsApp          *app,
                                                 const gchar    *source);
diff --git a/src/plugins/gs-plugin-packagekit.c b/src/plugins/gs-plugin-packagekit.c
index 379ef44..a859352 100644
--- a/src/plugins/gs-plugin-packagekit.c
+++ b/src/plugins/gs-plugin-packagekit.c
@@ -392,6 +392,9 @@ gs_plugin_app_install (GsPlugin *plugin,
                goto out;
        }
 
+       /* no longer valid */
+       gs_app_clear_source_ids (app);
+
        /* check error code */
        error_code = pk_results_get_error_code (results);
        if (error_code != NULL) {
@@ -559,6 +562,9 @@ gs_plugin_app_remove (GsPlugin *plugin,
                goto out;
        }
 
+       /* no longer valid */
+       gs_app_clear_source_ids (app);
+
        /* check error code */
        error_code = pk_results_get_error_code (results);
        if (error_code != NULL) {


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