[gnome-software/gnome-3-22] Remove the GsApp cache component if the backing AppStream AsApp is deleted
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-22] Remove the GsApp cache component if the backing AppStream AsApp is deleted
- Date: Mon, 7 Nov 2016 13:41:29 +0000 (UTC)
commit 925e1609e5b1cec43fc6afa1ca229cf6680654df
Author: Richard Hughes <richard hughsie com>
Date: Mon Oct 31 15:01:32 2016 +0000
Remove the GsApp cache component if the backing AppStream AsApp is deleted
This means we can update the AppStream file in-place and have the changes
reflected in the GNOME Software UI.
(cherry picked from commit 34e9dce2ac89106914323a590a06bc7b77b7fc7f)
src/plugins/gs-flatpak.c | 10 ++++++++++
src/plugins/gs-plugin-appstream.c | 12 ++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index f0d66c8..16534e2 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -2447,6 +2447,13 @@ gs_flatpak_add_featured (GsFlatpak *self,
}
static void
+gs_flatpak_store_app_removed_cb (AsStore *store, AsApp *app, GsFlatpak *self)
+{
+ g_debug ("AppStream app was removed, doing delete from global cache");
+ gs_plugin_cache_remove (self->plugin, as_app_get_unique_id (app));
+}
+
+static void
gs_flatpak_finalize (GObject *object)
{
GsFlatpak *self;
@@ -2473,6 +2480,9 @@ gs_flatpak_init (GsFlatpak *self)
self->broken_remotes = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
self->store = as_store_new ();
+ g_signal_connect (self->store, "app-removed",
+ G_CALLBACK (gs_flatpak_store_app_removed_cb),
+ self);
as_store_set_add_flags (self->store, AS_STORE_ADD_FLAG_USE_UNIQUE_ID);
as_store_set_watch_flags (self->store, AS_STORE_WATCH_FLAG_REMOVED);
}
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index ad0b4da..0fbf4ad 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -132,6 +132,15 @@ gs_plugin_appstream_store_changed_cb (AsStore *store, GsPlugin *plugin)
gs_plugin_reload (plugin);
}
+static void
+gs_plugin_appstream_store_app_removed_cb (AsStore *store,
+ AsApp *app,
+ GsPlugin *plugin)
+{
+ g_debug ("AppStream app was removed, doing delete from global cache");
+ gs_plugin_cache_remove (plugin, as_app_get_unique_id (app));
+}
+
void
gs_plugin_initialize (GsPlugin *plugin)
{
@@ -264,6 +273,9 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
g_signal_connect (priv->store, "changed",
G_CALLBACK (gs_plugin_appstream_store_changed_cb),
plugin);
+ g_signal_connect (priv->store, "app-removed",
+ G_CALLBACK (gs_plugin_appstream_store_app_removed_cb),
+ plugin);
/* add search terms for apps not in the main source */
origins = gs_plugin_appstream_get_origins_hash (items);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]