tracker r1311 - branches/xesam-support/src/trackerd



Author: pvanhoof
Date: Fri Apr 25 13:47:35 2008
New Revision: 1311
URL: http://svn.gnome.org/viewvc/tracker?rev=1311&view=rev

Log:
NameOwnerChanged

Modified:
   branches/xesam-support/src/trackerd/tracker-dbus.c
   branches/xesam-support/src/trackerd/tracker-xesam-search.c
   branches/xesam-support/src/trackerd/tracker-xesam-search.h

Modified: branches/xesam-support/src/trackerd/tracker-dbus.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus.c	(original)
+++ branches/xesam-support/src/trackerd/tracker-dbus.c	Fri Apr 25 13:47:35 2008
@@ -118,6 +118,12 @@
 	g_slice_free (GValue, value);
 }
 
+static void 
+name_owner_changed_done (gpointer data, GClosure *closure)
+{
+	g_object_unref (data);
+}
+
 gboolean
 tracker_dbus_init (gpointer tracker_pointer)
 {
@@ -231,6 +237,15 @@
                 return FALSE;
         }
 
+        dbus_g_proxy_add_signal (proxy, "NameOwnerChanged",
+                           G_TYPE_STRING, G_TYPE_STRING,
+                           G_TYPE_STRING, G_TYPE_INVALID);
+
+        dbus_g_proxy_connect_signal (proxy, "NameOwnerChanged", 
+                  G_CALLBACK (tracker_xesam_search_name_owner_changed), 
+                  g_object_ref (object),
+                  name_owner_changed_done);
+
         objects = g_slist_prepend (objects, object);
 
 

Modified: branches/xesam-support/src/trackerd/tracker-xesam-search.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-xesam-search.c	(original)
+++ branches/xesam-support/src/trackerd/tracker-xesam-search.c	Fri Apr 25 13:47:35 2008
@@ -130,6 +130,38 @@
 	return g_object_new (TRACKER_TYPE_XESAM_SEARCH, NULL);
 }
 
+
+static void
+tracker_xesam_search_close_session_interal (const gchar         *session_id,
+					    GError             **error)
+{
+	TrackerXesamSession *session = tracker_xesam_get_session (session_id, error);
+	if (session) {
+		GList *searches = tracker_xesam_session_get_searches (session);
+		while (searches) {
+			TrackerXesamLiveSearch *search = searches->data;
+			tracker_xesam_live_search_close (search, NULL);
+			searches = g_list_next (searches);
+		}
+		g_list_free (searches);
+
+		tracker_xesam_close_session (session_id, error);
+		g_object_unref (session);
+	}
+}
+
+void 
+tracker_xesam_search_name_owner_changed (DBusGProxy        *proxy,
+					 const char        *name,
+					 const char        *prev_owner,
+					 const char        *new_owner,
+					 TrackerXesamSearch *self)
+{
+	// Todo: figure out the session_id based on prev_owner
+
+	tracker_xesam_search_close_session_interal (prev_owner, NULL);
+}
+
 /*
  * Functions
  */
@@ -155,20 +187,8 @@
 				    GError             **error)
 {
 	guint request_id = tracker_dbus_get_next_request_id ();
-	TrackerXesamSession *session = tracker_xesam_get_session (session_id, error);
 
-	if (session) {
-		GList *searches = tracker_xesam_session_get_searches (session);
-		while (searches) {
-			TrackerXesamLiveSearch *search = searches->data;
-			tracker_xesam_live_search_close (search, NULL);
-			searches = g_list_next (searches);
-		}
-		g_list_free (searches);
-
-		tracker_xesam_close_session (session_id, error);
-		g_object_unref (session);
-	}
+	tracker_xesam_search_close_session_interal (session_id, error);
 
 	tracker_dbus_request_success (request_id);
 

Modified: branches/xesam-support/src/trackerd/tracker-xesam-search.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-xesam-search.h	(original)
+++ branches/xesam-support/src/trackerd/tracker-xesam-search.h	Fri Apr 25 13:47:35 2008
@@ -123,6 +123,12 @@
 
 void tracker_xesam_search_emit_state_changed (TrackerXesamSearch *self, GStrv state_info);
 
+void tracker_xesam_search_name_owner_changed (DBusGProxy        *proxy,
+					      const char        *name,
+					      const char        *prev_owner,
+					      const char        *new_owner,
+					      TrackerXesamSearch *self);
+
 G_END_DECLS
 
 #endif /* __TRACKER_XESAM_SEARCH_H__ */



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