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



Author: pvanhoof
Date: Thu Apr 24 11:56:22 2008
New Revision: 1303
URL: http://svn.gnome.org/viewvc/tracker?rev=1303&view=rev

Log:
Added some documentation and fixed some API

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

Modified: branches/xesam-support/src/trackerd/tracker-xesam-live-search.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-xesam-live-search.c	(original)
+++ branches/xesam-support/src/trackerd/tracker-xesam-live-search.c	Thu Apr 24 11:56:22 2008
@@ -22,10 +22,12 @@
 #include "tracker-xesam-live-search.h"
 #include "tracker-xesam-search.h"
 #include "tracker-dbus.h"
+#include "tracker-xesam.h"
 
 struct _TrackerXesamLiveSearchPriv {
 	gchar *search_id;
 	gboolean active;
+	gboolean closed;
 };
 
 G_DEFINE_TYPE(TrackerXesamLiveSearch, tracker_xesam_live_search, G_TYPE_OBJECT)
@@ -53,6 +55,7 @@
 	TrackerXesamLiveSearchPriv *priv = self->priv;
 	priv->search_id = NULL;
 	priv->active = FALSE;
+	priv->closed = FALSE;
 }
 
 
@@ -154,6 +157,12 @@
 void 
 tracker_xesam_live_search_close (TrackerXesamLiveSearch *self, GError **error)
 {
+	TrackerXesamLiveSearchPriv *priv = self->priv;
+	if (priv->closed)
+		g_set_error (error, TRACKER_XESAM_ERROR, 
+				TRACKER_XESAM_ERROR_SEARCH_CLOSED,
+				"Search was already closed");
+	priv->closed = TRUE;
 	// todo
 }
 
@@ -172,7 +181,15 @@
 void 
 tracker_xesam_live_search_get_hit_count (TrackerXesamLiveSearch *self, guint *count, GError **error)
 {
+	TrackerXesamLiveSearchPriv *priv = self->priv;
+
 	// todo
+
+	if (!priv->active)
+		g_set_error (error, TRACKER_XESAM_ERROR, 
+				TRACKER_XESAM_ERROR_SEARCH_NOT_ACTIVE,
+				"Search is not active yet");
+
 	*count = 0;
 }
 
@@ -193,7 +210,15 @@
 void 
 tracker_xesam_live_search_get_hits (TrackerXesamLiveSearch *self, guint num, gpointer **hits, GError **error)
 {
+	TrackerXesamLiveSearchPriv *priv = self->priv;
+
 	// todo
+
+	if (!priv->active)
+		g_set_error (error, TRACKER_XESAM_ERROR, 
+				TRACKER_XESAM_ERROR_SEARCH_NOT_ACTIVE,
+				"Search is not active yet");
+
 	*hits = NULL;
 }
 
@@ -227,7 +252,15 @@
 void 
 tracker_xesam_live_search_get_hit_data (TrackerXesamLiveSearch *self, guint *hit_ids, const gchar **fields, gpointer **hit_data, GError **error)
 {
+	TrackerXesamLiveSearchPriv *priv = self->priv;
+
 	// todo
+
+	if (!priv->active)
+		g_set_error (error, TRACKER_XESAM_ERROR, 
+				TRACKER_XESAM_ERROR_SEARCH_NOT_ACTIVE,
+				"Search is not active yet");
+
 	*hit_data = NULL;
 }
 
@@ -259,6 +292,10 @@
 {
 	TrackerXesamLiveSearchPriv *priv = self->priv;
 	// todo
+	if (priv->closed)
+		g_set_error (error, TRACKER_XESAM_ERROR, 
+				TRACKER_XESAM_ERROR_SEARCH_CLOSED,
+				"Search is closed");
 	priv->active = TRUE;
 }
 

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	Thu Apr 24 11:56:22 2008
@@ -39,6 +39,8 @@
 typedef enum {
 	TRACKER_XESAM_ERROR_SEARCH_ID_NOT_REGISTERED = 1,
 	TRACKER_XESAM_ERROR_SESSION_ID_NOT_REGISTERED = 2,
+	TRACKER_XESAM_ERROR_SEARCH_CLOSED = 3,
+	TRACKER_XESAM_ERROR_SEARCH_NOT_ACTIVE = 4
 } TrackerXesamError;
 
 



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