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



Author: pvanhoof
Date: Wed Apr 23 12:19:00 2008
New Revision: 1290
URL: http://svn.gnome.org/viewvc/tracker?rev=1290&view=rev

Log:
Using tracker_dbus_get_object

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

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	Wed Apr 23 12:19:00 2008
@@ -28,6 +28,7 @@
 #include <libtracker-common/tracker-utils.h>
 
 #include "tracker-dbus.h"
+#include "tracker-status.h"
 
 #define TRACKER_XESAM_SEARCH_C
 #include "tracker-xesam-search.h"
@@ -62,8 +63,8 @@
 };
 
 
-static void dbus_search_finalize     (GObject *object);
-static void dbus_search_set_property (GObject *object,
+static void xesam_search_finalize     (GObject *object);
+static void xesam_search_set_property (GObject *object,
 				      guint param_id,
 				      const GValue *value,
 				      GParamSpec *pspec);
@@ -77,8 +78,8 @@
 
 	object_class = G_OBJECT_CLASS (klass);
 
-	object_class->finalize = dbus_search_finalize;
-	object_class->set_property = dbus_search_set_property;
+	object_class->finalize = xesam_search_finalize;
+	object_class->set_property = xesam_search_set_property;
 
 	g_object_class_install_property (object_class,
 					 PROP_DB_CONNECTION,
@@ -167,7 +168,7 @@
 }
 
 static void
-dbus_search_finalize (GObject *object)
+xesam_search_finalize (GObject *object)
 {
 	TrackerXesamSearchPriv *priv;
 
@@ -181,7 +182,7 @@
 }
 
 static void
-dbus_search_set_property (GObject *object,
+xesam_search_set_property (GObject *object,
 			  guint param_id,
 			  const GValue *value,
 			  GParamSpec *pspec)
@@ -473,9 +474,15 @@
 
 gboolean 
 tracker_xesam_search_get_state (TrackerXesamSearch   *object,
-				gchar              **state_info,
+				gchar             ***state_info, /* not sure */
 				GError             **error)
 {
-	return FALSE;
+	if (state_info) {
+		gchar **state = g_malloc (sizeof (gchar *) * 1);
+		state[0] = g_strdup (tracker_status_get_as_string ());
+		*state_info = state;
+	}
+
+	return TRUE;
 }
 

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	Wed Apr 23 12:19:00 2008
@@ -122,7 +122,7 @@
 						const gchar         *search_id,
 						GError             **error);
 gboolean tracker_xesam_search_get_state       (TrackerXesamSearch   *object,
-						gchar              **state_info,
+						gchar             ***state_info, /* not sure */
 						GError             **error);
 
 G_END_DECLS

Modified: branches/xesam-support/src/trackerd/tracker-xesam-session.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-xesam-session.c	(original)
+++ branches/xesam-support/src/trackerd/tracker-xesam-session.c	Wed Apr 23 12:19:00 2008
@@ -24,7 +24,6 @@
 
 struct _TrackerXesamSessionPriv {
 	GHashTable *searches;
-	TrackerXesamSearch *dbus_proxy;
 	gchar *session_id;
 };
 
@@ -36,7 +35,6 @@
 {
 	TrackerXesamSessionPriv *priv = self->priv;
 
-	priv->dbus_proxy = NULL;
 	priv->session_id = NULL;
 
 	priv->searches = g_hash_table_new_full (g_str_hash, g_str_equal, 
@@ -88,14 +86,14 @@
 void 
 tracker_xesam_session_hits_added (TrackerXesamSession *self, TrackerXesamLiveSearch *search, guint count) 
 {
-	TrackerXesamSessionPriv *priv;
+	TrackerXesamSearch *proxy;
 
 	g_return_if_fail (TRACKER_IS_SESSION (self));
 	g_return_if_fail (search == NULL || TRACKER_IS_SEARCH (search));
 
-	priv = self->priv;
+	proxy = TRACKER_XESAM_SEARCH (tracker_dbus_get_object (TRACKER_TYPE_XESAM_SEARCH));
 
-	g_signal_emit (priv->dbus_proxy, xesam_signals[XESAM_HITS_ADDED], 0, 
+	g_signal_emit (proxy, xesam_signals[XESAM_HITS_ADDED], 0, 
 		tracker_xesam_live_search_get_id (search), count);
 }
 
@@ -103,14 +101,14 @@
 void 
 tracker_xesam_session_hits_removed (TrackerXesamSession *self, TrackerXesamLiveSearch *search, guint *hit_ids, gint hit_ids_length) 
 {
-	TrackerXesamSessionPriv *priv;
+	TrackerXesamSearch *proxy;
 
 	g_return_if_fail (TRACKER_IS_SESSION (self));
 	g_return_if_fail (search == NULL || TRACKER_IS_SEARCH (search));
 
-	priv = self->priv;
+	proxy = TRACKER_XESAM_SEARCH (tracker_dbus_get_object (TRACKER_TYPE_XESAM_SEARCH));
 
-	g_signal_emit (priv->dbus_proxy, xesam_signals[XESAM_HITS_REMOVED], 0, 
+	g_signal_emit (proxy, xesam_signals[XESAM_HITS_REMOVED], 0, 
 		tracker_xesam_live_search_get_id (search), 0); // todo
 }
 
@@ -118,14 +116,14 @@
 void 
 tracker_xesam_session_hits_modified (TrackerXesamSession *self, TrackerXesamLiveSearch *search, guint *hit_ids, gint hit_ids_length) 
 {
-	TrackerXesamSessionPriv *priv;
+	TrackerXesamSearch *proxy;
 
 	g_return_if_fail (TRACKER_IS_SESSION (self));
 	g_return_if_fail (search == NULL || TRACKER_IS_SEARCH (search));
 
-	priv = self->priv;
+	proxy = TRACKER_XESAM_SEARCH (tracker_dbus_get_object (TRACKER_TYPE_XESAM_SEARCH));
 
-	g_signal_emit (priv->dbus_proxy, xesam_signals[XESAM_HITS_MODIFIED], 0, 
+	g_signal_emit (proxy, xesam_signals[XESAM_HITS_MODIFIED], 0, 
 		tracker_xesam_live_search_get_id (search), 0); // todo
 }
 
@@ -133,14 +131,14 @@
 void 
 tracker_xesam_session_search_done (TrackerXesamSession *self, TrackerXesamLiveSearch *search) 
 {
-	TrackerXesamSessionPriv *priv;
+	TrackerXesamSearch *proxy;
 
 	g_return_if_fail (TRACKER_IS_SESSION (self));
 	g_return_if_fail (search == NULL || TRACKER_IS_SEARCH (search));
 
-	priv = self->priv;
+	proxy = TRACKER_XESAM_SEARCH (tracker_dbus_get_object (TRACKER_TYPE_XESAM_SEARCH));
 
-	g_signal_emit (priv->dbus_proxy, xesam_signals[XESAM_SEARCH_DONE], 0, 
+	g_signal_emit (proxy, xesam_signals[XESAM_SEARCH_DONE], 0, 
 		tracker_xesam_live_search_get_id (search)); 
 }
 
@@ -148,14 +146,13 @@
 void 
 tracker_xesam_session_state_changed (TrackerXesamSession *self, gchar **state_info, gint state_info_length) 
 {
-	TrackerXesamSessionPriv *priv;
+	TrackerXesamSearch *proxy;
 
 	g_return_if_fail (TRACKER_IS_SESSION (self));
 
-	priv = self->priv;
+	proxy = TRACKER_XESAM_SEARCH (tracker_dbus_get_object (TRACKER_TYPE_XESAM_SEARCH));
 
-	g_signal_emit (priv->dbus_proxy, xesam_signals[XESAM_STATE_CHANGED], 0, 
-		0); // todo
+	g_signal_emit (proxy, xesam_signals[XESAM_STATE_CHANGED], 0, 0); // todo
 }
 
 
@@ -204,7 +201,7 @@
 }
 
 TrackerXesamLiveSearch* 
-tracker_xesam_session_get_search (TrackerXesamSession *self, const gchar *search_id)
+tracker_xesam_session_get_search (TrackerXesamSession *self, const gchar *search_id, GError **error)
 {
 	TrackerXesamSessionPriv *priv = self->priv;
 	TrackerXesamLiveSearch *search = g_hash_table_lookup (priv->searches, search_id);
@@ -214,18 +211,9 @@
 }
 
 TrackerXesamSession* 
-tracker_xesam_session_new (TrackerXesamSearch *dbus_proxy) 
+tracker_xesam_session_new (void) 
 {
-	TrackerXesamSession * self;
-	TrackerXesamSessionPriv *priv;
-	self = g_object_newv (TRACKER_TYPE_SESSION, 0, NULL);
-
-	priv = self->priv;
-	priv->dbus_proxy = dbus_proxy;
-
-	return self;
+	return g_object_newv (TRACKER_TYPE_SESSION, 0, NULL);
 }
 
 
-
-

Modified: branches/xesam-support/src/trackerd/tracker-xesam-session.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-xesam-session.h	(original)
+++ branches/xesam-support/src/trackerd/tracker-xesam-session.h	Wed Apr 23 12:19:00 2008
@@ -61,13 +61,13 @@
 void tracker_xesam_session_set_property (TrackerXesamSession *self, const gchar *prop, const gchar* val);
 char* tracker_xesam_session_get_property (TrackerXesamSession *self, const gchar *prop);
 TrackerXesamLiveSearch* tracker_xesam_session_create_search (TrackerXesamSession *self, const gchar *query_xml , gchar **search_id);
-TrackerXesamLiveSearch* tracker_xesam_session_get_search (TrackerXesamSession *self, const gchar *search_id);
+TrackerXesamLiveSearch* tracker_xesam_session_get_search (TrackerXesamSession *self, const gchar *search_id, GError **error);
 GList *tracker_xesam_session_get_searches (TrackerXesamSession *self);
 void tracker_xesam_session_set_id (TrackerXesamSession *self, const gchar *session_id);
 const gchar* tracker_xesam_session_get_id (TrackerXesamSession *self);
 void tracker_xesam_session_close_search (TrackerXesamSession *self, TrackerXesamLiveSearch *search);
 
-TrackerXesamSession* tracker_xesam_session_new (TrackerXesamSearch *dbus_proxy);
+TrackerXesamSession* tracker_xesam_session_new (void);
 GType tracker_xesam_session_get_type (void);
 
 

Modified: branches/xesam-support/src/trackerd/tracker-xesam.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-xesam.c	(original)
+++ branches/xesam-support/src/trackerd/tracker-xesam.c	Wed Apr 23 12:19:00 2008
@@ -36,7 +36,7 @@
 {
 	TrackerXesamSession *session;
 
-	session = tracker_xesam_session_new (dbus_proxy);
+	session = tracker_xesam_session_new ();
 	tracker_xesam_session_set_id (session, tracker_unique_key ());
 
 	g_hash_table_insert (tracker->xesam_sessions, 
@@ -83,7 +83,7 @@
 	GList * sessions = g_hash_table_get_values (tracker->xesam_sessions);
 
 	while (sessions) {
-		TrackerXesamLiveSearch *search = tracker_xesam_session_get_search (sessions->data, search_id);
+		TrackerXesamLiveSearch *search = tracker_xesam_session_get_search (sessions->data, search_id, NULL);
 		if (search) {
 			if (search_in)
 				*search_in = g_object_ref (search);
@@ -109,7 +109,7 @@
 	GList * sessions = g_hash_table_get_values (tracker->xesam_sessions);
 
 	while (sessions) {
-		TrackerXesamLiveSearch *search = tracker_xesam_session_get_search (sessions->data, search_id);
+		TrackerXesamLiveSearch *search = tracker_xesam_session_get_search (sessions->data, search_id, NULL);
 		if (search) {
 			retval = g_object_ref (search);
 			break;

Modified: branches/xesam-support/src/trackerd/tracker-xesam.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-xesam.h	(original)
+++ branches/xesam-support/src/trackerd/tracker-xesam.h	Wed Apr 23 12:19:00 2008
@@ -2,6 +2,7 @@
 #define _TRACKER_XESAM_H_
 
 #include "tracker-utils.h"
+#include "tracker-dbus.h"
 #include "tracker-xesam-session.h"
 #include "tracker-xesam-live-search.h"
 



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