tracker r1501 - in branches/xesam-support: . src/trackerd
- From: pvanhoof svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1501 - in branches/xesam-support: . src/trackerd
- Date: Tue, 27 May 2008 14:59:39 +0000 (UTC)
Author: pvanhoof
Date: Tue May 27 14:59:38 2008
New Revision: 1501
URL: http://svn.gnome.org/viewvc/tracker?rev=1501&view=rev
Log:
2008-05-27 Philip Van Hoof <pvanhoof gnome org>
* src/trackerd/tracker-xesam-live-search.c
* src/trackerd/tracker-xesam-query.c
* src/trackerd/tracker-dbus-xesam.c
* src/trackerd/tracker-dbus-xesam.h:
Xesam behaviour fixes:
Emit HitsAdded after StartSearch
Emit StartDone after StartSearch is finished searching
Modified:
branches/xesam-support/ChangeLog
branches/xesam-support/src/trackerd/tracker-dbus-xesam.c
branches/xesam-support/src/trackerd/tracker-dbus-xesam.h
branches/xesam-support/src/trackerd/tracker-xesam-live-search.c
branches/xesam-support/src/trackerd/tracker-xesam-query.c
Modified: branches/xesam-support/src/trackerd/tracker-dbus-xesam.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus-xesam.c (original)
+++ branches/xesam-support/src/trackerd/tracker-dbus-xesam.c Tue May 27 14:59:38 2008
@@ -499,6 +499,8 @@
tracker_xesam_live_search_activate (search, &error);
+ tracker_dbus_xesam_emit_search_done (object, search_id);
+
if (error) {
dbus_g_method_return_error (context, error);
g_error_free (error);
@@ -810,3 +812,20 @@
{
g_signal_emit (self, signals[XESAM_STATE_CHANGED], 0, state_info);
}
+
+
+
+/**
+ * tracker_dbus_xesam_emit_search_done:
+ * @self: A #TrackerDBusXesam
+ * @search_id: Search Id
+ *
+ * Emits the @search-done signal on the DBus proxy for Xesam.
+ *
+ **/
+void
+tracker_dbus_xesam_emit_search_done (TrackerDBusXesam *self,
+ const gchar *search_id)
+{
+ g_signal_emit (self, signals[XESAM_SEARCH_DONE], 0, search_id);
+}
Modified: branches/xesam-support/src/trackerd/tracker-dbus-xesam.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus-xesam.h (original)
+++ branches/xesam-support/src/trackerd/tracker-dbus-xesam.h Tue May 27 14:59:38 2008
@@ -113,6 +113,8 @@
const char *prev_owner,
const char *new_owner,
TrackerDBusXesam *self);
+void tracker_dbus_xesam_emit_search_done (TrackerDBusXesam *self,
+ const gchar *search_id);
void tracker_dbus_xesam_set_db_connection (TrackerDBusXesam *object,
DBConnection *db_con);
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 Tue May 27 14:59:38 2008
@@ -213,58 +213,13 @@
g_signal_emit_by_name (proxy, "search-done", tracker_xesam_live_search_get_id (self));
}
-
-/**
- * tracker_xesam_live_search_match_with_events:
- * @self: A #TrackerXesamLiveSearch
- * @added: (caller-owns) (out): added items
- * @removed: (caller-owns) (out): removed items
- * @modified: (caller-owns) (out): modified items
- *
- * Find all items that match with the current events for @self.
- **/
-void
-tracker_xesam_live_search_match_with_events (TrackerXesamLiveSearch *self, GArray **added, GArray **removed, GArray **modified)
+/* Created and Modified items */
+static void
+get_hits_added_modified (TrackerXesamLiveSearch *self, DBConnection *db_con, GArray **added, GArray **modified)
{
- TrackerDBusXesam *proxy = TRACKER_DBUS_XESAM (tracker_dbus_get_object (TRACKER_TYPE_DBUS_XESAM));
- DBConnection *db_con = NULL;
- TrackerDBResultSet *result_set;
+ GArray *m_added = NULL, *m_modified = NULL;
gboolean ls_valid = TRUE;
- GArray *m_added = NULL, *m_removed = NULL, *m_modified = NULL;
-
- g_object_get (proxy, "db-connection", &db_con, NULL);
-
- /* Deleted items */
-
- result_set = tracker_db_get_live_search_deleted_ids (db_con,
- tracker_xesam_live_search_get_id (self));
-
- if (!result_set)
- goto part_two;
-
- while (ls_valid) {
- GValue ls_value = { 0, };
- gint ls_i_value;
-
- _tracker_db_result_set_get_value (result_set, 0, &ls_value);
- ls_i_value = g_value_get_int (&ls_value);
-
- if (m_removed == NULL)
- m_removed = g_array_new (FALSE, TRUE, sizeof (guint32));
- g_array_append_val (m_removed, ls_i_value);
-
- g_value_unset (&ls_value);
-
- ls_valid = tracker_db_result_set_iter_next (result_set);
- }
-
- g_object_unref (result_set);
-
-part_two:
-
- /* Created and Modified items */
-
- ls_valid = TRUE;
+ TrackerDBResultSet *result_set;
result_set = tracker_db_get_live_search_new_ids (db_con,
tracker_xesam_live_search_get_id (self),
@@ -318,6 +273,61 @@
g_object_unref (result_set);
*added = m_added;
+ *modified = m_modified;
+}
+
+/**
+ * tracker_xesam_live_search_match_with_events:
+ * @self: A #TrackerXesamLiveSearch
+ * @added: (caller-owns) (out): added items
+ * @removed: (caller-owns) (out): removed items
+ * @modified: (caller-owns) (out): modified items
+ *
+ * Find all items that match with the current events for @self.
+ **/
+void
+tracker_xesam_live_search_match_with_events (TrackerXesamLiveSearch *self, GArray **added, GArray **removed, GArray **modified)
+{
+ TrackerDBusXesam *proxy = TRACKER_DBUS_XESAM (tracker_dbus_get_object (TRACKER_TYPE_DBUS_XESAM));
+ DBConnection *db_con = NULL;
+ TrackerDBResultSet *result_set;
+ gboolean ls_valid = TRUE;
+ GArray *m_added = NULL, *m_removed = NULL, *m_modified = NULL;
+
+ g_object_get (proxy, "db-connection", &db_con, NULL);
+
+ /* Deleted items */
+
+ result_set = tracker_db_get_live_search_deleted_ids (db_con,
+ tracker_xesam_live_search_get_id (self));
+
+ if (!result_set)
+ goto part_two;
+
+ while (ls_valid) {
+ GValue ls_value = { 0, };
+ gint ls_i_value;
+
+ _tracker_db_result_set_get_value (result_set, 0, &ls_value);
+ ls_i_value = g_value_get_int (&ls_value);
+
+ if (m_removed == NULL)
+ m_removed = g_array_new (FALSE, TRUE, sizeof (guint32));
+ g_array_append_val (m_removed, ls_i_value);
+
+ g_value_unset (&ls_value);
+
+ ls_valid = tracker_db_result_set_iter_next (result_set);
+ }
+
+ g_object_unref (result_set);
+
+part_two:
+
+ /* Created and Modified items */
+ get_hits_added_modified (self, db_con, &m_added, &m_modified);
+
+ *added = m_added;
*removed = m_removed;
*modified = m_modified;
@@ -665,7 +675,8 @@
else {
DBConnection *db_con = NULL;
TrackerDBusXesam *proxy = TRACKER_DBUS_XESAM (tracker_dbus_get_object (TRACKER_TYPE_DBUS_XESAM));
-
+ GArray *added = NULL, *modified = NULL;
+
g_object_get (proxy, "db-connection", &db_con, NULL);
g_debug ("The from query for activate: %s",tracker_xesam_live_search_get_from_query (self));
@@ -674,6 +685,24 @@
tracker_xesam_live_search_get_from_query (self),
tracker_xesam_live_search_get_where_query (self),
tracker_xesam_live_search_get_id (self));
+
+ get_hits_added_modified (self, db_con, &added, &modified);
+
+ if (added && added->len > 0) {
+ tracker_xesam_live_search_emit_hits_added (self, added->len);
+ }
+
+ if (added) {
+ g_array_free (added, TRUE);
+ }
+
+ if (modified && modified->len > 0) {
+ tracker_xesam_live_search_emit_hits_modified (self, modified);
+ }
+
+ if (modified) {
+ g_array_free (modified, TRUE);
+ }
}
priv->active = TRUE;
Modified: branches/xesam-support/src/trackerd/tracker-xesam-query.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-xesam-query.c (original)
+++ branches/xesam-support/src/trackerd/tracker-xesam-query.c Tue May 27 14:59:38 2008
@@ -844,7 +844,7 @@
str = g_string_new ("");
if (i>1) {
- g_string_append (str, " OR ");
+ g_string_append (str, " OR ");
}
if (tracker_field_data_get_data_type (field_data->data) == TRACKER_FIELD_TYPE_DATE) {
@@ -868,7 +868,7 @@
} else {
/* TODO Add error message */
return FALSE;
- }
+ }
} else {
value = g_strdup (avalue);
}
@@ -985,7 +985,7 @@
g_string_append_printf (str, ",'%s'", *p);
}
- g_string_append_printf (str, ") ) " );
+ g_string_append_printf (str, ") ) " );
}
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]