[tracker/harmattan-pre-signal-updates: 1304/1380] libtracker-miner: Fixes for previous commit
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/harmattan-pre-signal-updates: 1304/1380] libtracker-miner: Fixes for previous commit
- Date: Wed, 22 Sep 2010 15:43:53 +0000 (UTC)
commit 045d0a711f4bae89f8f5e0d5da0cf39c2348c17b
Author: Philip Van Hoof <philip codeminded be>
Date: Wed Sep 15 12:17:09 2010 +0200
libtracker-miner: Fixes for previous commit
src/libtracker-miner/tracker-dbus.c | 40 ++++++++++++++++++++-------
src/libtracker-miner/tracker-dbus.h | 21 ++++++++------
src/libtracker-miner/tracker-miner-object.c | 2 +
3 files changed, 44 insertions(+), 19 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-dbus.c b/src/libtracker-miner/tracker-dbus.c
index f9b12bd..184a7ee 100644
--- a/src/libtracker-miner/tracker-dbus.c
+++ b/src/libtracker-miner/tracker-dbus.c
@@ -23,6 +23,8 @@
#include <dbus/dbus-glib-bindings.h>
+#include <libtracker-common/tracker-utils.h>
+
#include "tracker-dbus.h"
#include "tracker-miner-dbus.h"
@@ -129,16 +131,6 @@ name_owner_changed_cb (const gchar *name,
available = (new_owner && *new_owner);
(func) (miner, name, available);
-
- if (g_strcmp0 (new_owner, "") == 0 && g_strcmp0 (name, old_owner) == 0) {
- gchar *match_rule;
- /* "name" disappeared from the bus and we have a registry for it */
- g_hash_table_remove (data->name_monitors, name);
- match_rule = get_name_owner_changed_match_rule (name);
- dbus_bus_remove_match (dbus_g_connection_get_connection (data->connection),
- match_rule, NULL);
- g_free (match_rule);
- }
}
static DBusHandlerResult
@@ -320,6 +312,34 @@ _tracker_miner_dbus_shutdown (TrackerMiner *miner)
}
void
+_tracker_miner_dbus_remove_name_watch (TrackerMiner *miner,
+ const gchar *name,
+ TrackerMinerDBusNameFunc func)
+{
+ DBusData *data;
+ gchar *match_rule;
+
+ g_return_if_fail (TRACKER_IS_MINER (miner));
+ g_return_if_fail (name != NULL);
+
+ data = g_object_get_qdata (G_OBJECT (miner), dbus_data);
+
+ if (!data) {
+ g_critical ("Miner '%s' was not registered on "
+ "DBus, can watch for owner changes",
+ G_OBJECT_TYPE_NAME (miner));
+ return;
+ }
+
+ g_hash_table_remove (data->name_monitors, name);
+
+ match_rule = get_name_owner_changed_match_rule (name);
+ dbus_bus_remove_match (dbus_g_connection_get_connection (data->connection),
+ match_rule, NULL);
+ g_free (match_rule);
+}
+
+void
_tracker_miner_dbus_add_name_watch (TrackerMiner *miner,
const gchar *name,
TrackerMinerDBusNameFunc func)
diff --git a/src/libtracker-miner/tracker-dbus.h b/src/libtracker-miner/tracker-dbus.h
index ce2ccf8..11f2c80 100644
--- a/src/libtracker-miner/tracker-dbus.h
+++ b/src/libtracker-miner/tracker-dbus.h
@@ -28,15 +28,18 @@
#include "tracker-miner-object.h"
-typedef void (* TrackerMinerDBusNameFunc) (TrackerMiner *miner,
- const gchar *name,
- gboolean available);
+typedef void (* TrackerMinerDBusNameFunc) (TrackerMiner *miner,
+ const gchar *name,
+ gboolean available);
-void _tracker_miner_dbus_init (TrackerMiner *miner,
- const DBusGObjectInfo *info);
-void _tracker_miner_dbus_shutdown (TrackerMiner *miner);
-void _tracker_miner_dbus_add_name_watch (TrackerMiner *miner,
- const gchar *name,
- TrackerMinerDBusNameFunc func);
+void _tracker_miner_dbus_init (TrackerMiner *miner,
+ const DBusGObjectInfo *info);
+void _tracker_miner_dbus_shutdown (TrackerMiner *miner);
+void _tracker_miner_dbus_add_name_watch (TrackerMiner *miner,
+ const gchar *name,
+ TrackerMinerDBusNameFunc func);
+void _tracker_miner_dbus_remove_name_watch (TrackerMiner *miner,
+ const gchar *name,
+ TrackerMinerDBusNameFunc func);
#endif /* __LIBTRACKER_MINER_DBUS_H__ */
diff --git a/src/libtracker-miner/tracker-miner-object.c b/src/libtracker-miner/tracker-miner-object.c
index 8211ac8..785da12 100644
--- a/src/libtracker-miner/tracker-miner-object.c
+++ b/src/libtracker-miner/tracker-miner-object.c
@@ -359,6 +359,8 @@ miner_finalize (GObject *object)
g_hash_table_unref (miner->private->pauses);
+ _tracker_miner_dbus_remove_name_watch (miner, "org.freedesktop.Tracker1",
+ store_name_monitor_cb);
_tracker_miner_dbus_shutdown (miner);
G_OBJECT_CLASS (tracker_miner_parent_class)->finalize (object);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]