[gnome-software] Call gs_plugin_updates_changed() when another tool touches the package database
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Call gs_plugin_updates_changed() when another tool touches the package database
- Date: Mon, 1 Sep 2014 14:23:25 +0000 (UTC)
commit 145fffcfe7003bb86e7427b7d886c7e2814912f1
Author: Richard Hughes <richard hughsie com>
Date: Mon Sep 1 11:55:45 2014 +0100
Call gs_plugin_updates_changed() when another tool touches the package database
src/plugins/gs-plugin-packagekit-refine.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index 9ee460f..add2908 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -31,6 +31,7 @@
#include "packagekit-common.h"
struct GsPluginPrivate {
+ PkControl *control;
PkClient *client;
GHashTable *sources;
};
@@ -47,11 +48,25 @@ gs_plugin_get_name (void)
/**
* gs_plugin_initialize:
*/
+static void
+gs_plugin_packagekit_cache_invalid_cb (PkControl *control, GsPlugin *plugin)
+{
+ gs_plugin_updates_changed (plugin);
+}
+
+/**
+ * gs_plugin_initialize:
+ */
void
gs_plugin_initialize (GsPlugin *plugin)
{
plugin->priv = GS_PLUGIN_GET_PRIVATE (GsPluginPrivate);
plugin->priv->client = pk_client_new ();
+ plugin->priv->control = pk_control_new ();
+ g_signal_connect (plugin->priv->control, "updates-changed",
+ G_CALLBACK (gs_plugin_packagekit_cache_invalid_cb), plugin);
+ g_signal_connect (plugin->priv->control, "repo-list-changed",
+ G_CALLBACK (gs_plugin_packagekit_cache_invalid_cb), plugin);
pk_client_set_background (plugin->priv->client, FALSE);
pk_client_set_interactive (plugin->priv->client, FALSE);
pk_client_set_cache_age (plugin->priv->client, G_MAXUINT);
@@ -82,6 +97,7 @@ gs_plugin_destroy (GsPlugin *plugin)
{
g_hash_table_unref (plugin->priv->sources);
g_object_unref (plugin->priv->client);
+ g_object_unref (plugin->priv->control);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]