tracker r1874 - in branches/indexer-split: . data/dbus src/libtracker-common src/trackerd tests/libtracker-common
- From: ifrade svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1874 - in branches/indexer-split: . data/dbus src/libtracker-common src/trackerd tests/libtracker-common
- Date: Tue, 15 Jul 2008 10:01:21 +0000 (UTC)
Author: ifrade
Date: Tue Jul 15 10:01:21 2008
New Revision: 1874
URL: http://svn.gnome.org/viewvc/tracker?rev=1874&view=rev
Log:
Keywords dbus API async
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/data/dbus/tracker-keywords.xml
branches/indexer-split/src/libtracker-common/tracker-dbus.c
branches/indexer-split/src/libtracker-common/tracker-dbus.h
branches/indexer-split/src/trackerd/tracker-keywords.c
branches/indexer-split/src/trackerd/tracker-keywords.h
branches/indexer-split/tests/libtracker-common/tracker-dbus-test.c
Modified: branches/indexer-split/data/dbus/tracker-keywords.xml
==============================================================================
--- branches/indexer-split/data/dbus/tracker-keywords.xml (original)
+++ branches/indexer-split/data/dbus/tracker-keywords.xml Tue Jul 15 10:01:21 2008
@@ -10,37 +10,42 @@
KeywordCount].
-->
<method name="GetList">
- <arg type="s" name="service" direction="in" />
- <arg type="aas" name="value" direction="out" />
+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+ <arg type="s" name="service_type" direction="in" />
+ <arg type="aas" name="keywords" direction="out" />
</method>
<!-- Gets all unique keywords/tags for specified service and id. -->
<method name="Get">
- <arg type="s" name="service" direction="in" />
- <arg type="s" name="id" direction="in" />
- <arg type="as" name="value" direction="out" />
+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+ <arg type="s" name="service_type" direction="in" />
+ <arg type="s" name="uri" direction="in" />
+ <arg type="as" name="keywords" direction="out" />
</method>
<!-- Adds new keywords/tags for specified service and id -->
<method name="Add">
- <arg type="s" name="service" direction="in" />
- <arg type="s" name="id" direction="in" />
- <arg type="as" name="values" direction="in" />
+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+ <arg type="s" name="service_type" direction="in" />
+ <arg type="s" name="uri" direction="in" />
+ <arg type="as" name="keywords" direction="in" />
</method>
<!-- Removes all specified keywords/tags for specified service and
id.
-->
<method name="Remove">
- <arg type="s" name="service" direction="in" />
- <arg type="s" name="id" direction="in" />
+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+ <arg type="s" name="service_type" direction="in" />
+ <arg type="s" name="uri" direction="in" />
<arg type="as" name="keywords" direction="in" />
</method>
<!-- Removes all keywords/tags for specified service and id. -->
<method name="RemoveAll">
- <arg type="s" name="service" direction="in" />
- <arg type="s" name="id" direction="in" />
+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+ <arg type="s" name="service_type" direction="in" />
+ <arg type="s" name="uri" direction="in" />
</method>
<!-- Searches specified service for matching keyword/tag and
@@ -48,8 +53,9 @@
-->
<method name="Search">
<annotation name="org.freedesktop.DBus.Deprecated" value="true"/>
+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
<arg type="i" name="live_query_id" direction="in" />
- <arg type="s" name="service" direction="in" />
+ <arg type="s" name="service_type" direction="in" />
<arg type="as" name="keywords" direction="in" />
<arg type="i" name="offset" direction="in" />
<arg type="i" name="max_hits" direction="in" />
Modified: branches/indexer-split/src/libtracker-common/tracker-dbus.c
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-dbus.c (original)
+++ branches/indexer-split/src/libtracker-common/tracker-dbus.c Tue Jul 15 10:01:21 2008
@@ -167,6 +167,19 @@
return strv;
}
+void
+tracker_dbus_results_ptr_array_free (GPtrArray **ptr_array)
+{
+ if (!ptr_array || !(*ptr_array)) {
+ return;
+ }
+
+ g_ptr_array_foreach (*ptr_array, (GFunc) g_strfreev, NULL);
+ g_ptr_array_free (*ptr_array, TRUE);
+ *ptr_array = NULL;
+}
+
+
guint
tracker_dbus_get_next_request_id (void)
{
Modified: branches/indexer-split/src/libtracker-common/tracker-dbus.h
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-dbus.h (original)
+++ branches/indexer-split/src/libtracker-common/tracker-dbus.h Tue Jul 15 10:01:21 2008
@@ -74,33 +74,36 @@
gpointer data2;
} TrackerDBusData;
-GQuark tracker_dbus_error_quark (void);
+GQuark tracker_dbus_error_quark (void);
+TrackerDBusData *tracker_dbus_data_new (const gpointer arg1,
+ const gpointer arg2);
-TrackerDBusData *tracker_dbus_data_new (const gpointer arg1,
- const gpointer arg2);
/* Utils */
-GValue * tracker_dbus_gvalue_slice_new (GType type);
-void tracker_dbus_gvalue_slice_free (GValue *value);
-gchar ** tracker_dbus_slist_to_strv (GSList *list);
-gchar ** tracker_dbus_queue_str_to_strv (GQueue *queue,
- gint max);
-gchar ** tracker_dbus_queue_gfile_to_strv (GQueue *queue,
- gint max);
+GValue * tracker_dbus_gvalue_slice_new (GType type);
+void tracker_dbus_gvalue_slice_free (GValue *value);
+gchar ** tracker_dbus_slist_to_strv (GSList *list);
+gchar ** tracker_dbus_queue_str_to_strv (GQueue *queue,
+ gint max);
+gchar ** tracker_dbus_queue_gfile_to_strv (GQueue *queue,
+ gint max);
+void tracker_dbus_results_ptr_array_free (GPtrArray **ptr_array);
+
/* Requests */
-guint tracker_dbus_get_next_request_id (void);
-void tracker_dbus_request_new (gint request_id,
- const gchar *format,
- ...);
-void tracker_dbus_request_success (gint request_id);
-void tracker_dbus_request_failed (gint request_id,
- GError **error,
- const gchar *format,
- ...);
-void tracker_dbus_request_comment (gint request_id,
- const gchar *format,
- ...);
+guint tracker_dbus_get_next_request_id (void);
+void tracker_dbus_request_new (gint request_id,
+ const gchar *format,
+ ...);
+void tracker_dbus_request_success (gint request_id);
+void tracker_dbus_request_failed (gint request_id,
+ GError **error,
+ const gchar *format,
+ ...);
+void tracker_dbus_request_comment (gint request_id,
+ const gchar *format,
+ ...);
+
G_END_DECLS
#endif /* __LIBTRACKER_DBUS_H__ */
Modified: branches/indexer-split/src/trackerd/tracker-keywords.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-keywords.c (original)
+++ branches/indexer-split/src/trackerd/tracker-keywords.c Tue Jul 15 10:01:21 2008
@@ -110,302 +110,350 @@
/*
* Functions
*/
-gboolean
+void
tracker_keywords_get_list (TrackerKeywords *object,
- const gchar *service,
- GPtrArray **values,
+ const gchar *service_type,
+ DBusGMethodInvocation *context,
GError **error)
{
TrackerDBInterface *iface;
TrackerDBResultSet *result_set;
guint request_id;
+ GError *actual_error = NULL;
+ GPtrArray *values;
request_id = tracker_dbus_get_next_request_id ();
- tracker_dbus_return_val_if_fail (service != NULL, FALSE, error);
- tracker_dbus_return_val_if_fail (values != NULL, FALSE, error);
+ tracker_dbus_async_return_if_fail (service_type != NULL, FALSE);
tracker_dbus_request_new (request_id,
"DBus request to get keywords list, "
- "service:'%s'",
- service);
+ "service type:'%s'",
+ service_type);
+
+ if (!tracker_ontology_is_valid_service_type (service_type)) {
- if (!tracker_ontology_is_valid_service_type (service)) {
tracker_dbus_request_failed (request_id,
- error,
- "Service '%s' is invalid or has not been implemented yet",
- service);
- return FALSE;
+ &actual_error,
+ "Service type '%s' is invalid or has not been implemented yet",
+ service_type);
+ dbus_g_method_return_error (context, actual_error);
+ g_error_free (actual_error);
+ return;
}
- iface = tracker_db_manager_get_db_interface_by_service (service);
- result_set = tracker_db_keywords_get_list (iface, service);
- *values = tracker_dbus_query_result_to_ptr_array (result_set);
-
+ iface = tracker_db_manager_get_db_interface_by_service (service_type);
+ result_set = tracker_db_keywords_get_list (iface, service_type);
+ values = tracker_dbus_query_result_to_ptr_array (result_set);
+
if (result_set) {
g_object_unref (result_set);
}
- tracker_dbus_request_success (request_id);
+ dbus_g_method_return (context, values);
+ tracker_dbus_results_ptr_array_free (&values);
- return TRUE;
+ tracker_dbus_request_success (request_id);
}
-gboolean
-tracker_keywords_get (TrackerKeywords *object,
- const gchar *service,
- const gchar *uri,
- gchar ***values,
- GError **error)
+void
+tracker_keywords_get (TrackerKeywords *object,
+ const gchar *service_type,
+ const gchar *uri,
+ DBusGMethodInvocation *context,
+ GError **error)
{
TrackerDBInterface *iface;
TrackerDBResultSet *result_set;
guint request_id;
gchar *id;
+ GError *actual_error = NULL;
+ gchar **values;
request_id = tracker_dbus_get_next_request_id ();
- tracker_dbus_return_val_if_fail (service != NULL, FALSE, error);
- tracker_dbus_return_val_if_fail (values != NULL, FALSE, error);
+ tracker_dbus_async_return_if_fail (service_type != NULL, FALSE);
+ tracker_dbus_async_return_if_fail (uri != NULL, FALSE);
tracker_dbus_request_new (request_id,
"DBus request to get keywords, "
- "service:'%s', uri:'%s'",
- service,
+ "service type:'%s', uri:'%s'",
+ service_type,
uri);
- if (!tracker_ontology_is_valid_service_type (service)) {
+ if (!tracker_ontology_is_valid_service_type (service_type)) {
tracker_dbus_request_failed (request_id,
- error,
- "Service '%s' is invalid or has not been implemented yet",
- service);
- return FALSE;
+ &actual_error,
+ "Service type '%s' is invalid or has not been implemented yet",
+ service_type);
}
- if (tracker_is_empty_string (uri)) {
+ if (!actual_error && tracker_is_empty_string (uri)) {
tracker_dbus_request_failed (request_id,
- error,
+ &actual_error,
"URI is empty");
- return FALSE;
}
- iface = tracker_db_manager_get_db_interface_by_service (service);
- id = tracker_db_file_get_id_as_string (iface, service, uri);
+ if (actual_error) {
+ dbus_g_method_return_error (context, actual_error);
+ g_error_free (actual_error);
+ return;
+ }
+
+
+ iface = tracker_db_manager_get_db_interface_by_service (service_type);
+ id = tracker_db_file_get_id_as_string (iface, service_type, uri);
if (!id) {
tracker_dbus_request_failed (request_id,
- error,
+ &actual_error,
"Entity '%s' was not found",
uri);
- return FALSE;
+ dbus_g_method_return_error (context, actual_error);
+ g_error_free (actual_error);
+ return;
}
result_set = tracker_db_metadata_get (iface,
id,
"User:Keywords");
- *values = tracker_dbus_query_result_to_strv (result_set, 0, NULL);
-
+ values = tracker_dbus_query_result_to_strv (result_set, 0, NULL);
+
if (result_set) {
g_object_unref (result_set);
}
g_free (id);
- tracker_dbus_request_success (request_id);
+ dbus_g_method_return (context, values);
+
+ if (values) {
+ g_strfreev (values);
+ }
- return TRUE;
+ tracker_dbus_request_success (request_id);
}
-gboolean
-tracker_keywords_add (TrackerKeywords *object,
- const gchar *service,
- const gchar *uri,
- gchar **values,
- GError **error)
+void
+tracker_keywords_add (TrackerKeywords *object,
+ const gchar *service_type,
+ const gchar *uri,
+ gchar **keywords,
+ DBusGMethodInvocation *context,
+ GError **error)
{
TrackerDBInterface *iface;
guint request_id;
gchar *id;
gchar **p;
+ GError *actual_error = NULL;
request_id = tracker_dbus_get_next_request_id ();
- tracker_dbus_return_val_if_fail (service != NULL, FALSE, error);
- tracker_dbus_return_val_if_fail (uri != NULL, FALSE, error);
- tracker_dbus_return_val_if_fail (values != NULL, FALSE, error);
+ tracker_dbus_async_return_if_fail (service_type != NULL, FALSE);
+ tracker_dbus_async_return_if_fail (uri != NULL, FALSE);
+ tracker_dbus_async_return_if_fail (keywords != NULL && *keywords != NULL, FALSE);
tracker_dbus_request_new (request_id,
"DBus request to add keywords, "
- "service:'%s', uri:'%s'",
- service,
+ "service type:'%s', uri:'%s'",
+ service_type,
uri);
- if (!tracker_ontology_is_valid_service_type (service)) {
+ if (!tracker_ontology_is_valid_service_type (service_type)) {
tracker_dbus_request_failed (request_id,
- error,
- "Service '%s' is invalid or has not been implemented yet",
- service);
- return FALSE;
+ &actual_error,
+ "Service type '%s' is invalid or has not been implemented yet",
+ service_type);
+ dbus_g_method_return_error (context, actual_error);
+ g_error_free (actual_error);
+ return;
}
if (tracker_is_empty_string (uri)) {
tracker_dbus_request_failed (request_id,
- error,
+ &actual_error,
"URI is empty");
- return FALSE;
+ dbus_g_method_return_error (context, actual_error);
+ g_error_free (actual_error);
+ return;
}
- iface = tracker_db_manager_get_db_interface_by_service (service);
- id = tracker_db_file_get_id_as_string (iface, service, uri);
- tracker_dbus_return_val_if_fail (id != NULL, FALSE, error);
+ iface = tracker_db_manager_get_db_interface_by_service (service_type);
+ id = tracker_db_file_get_id_as_string (iface, service_type, uri);
+ if (!id) {
+ tracker_dbus_request_failed (request_id,
+ &actual_error,
+ "Entity '%s' was not found",
+ uri);
+ dbus_g_method_return_error (context, actual_error);
+ g_error_free (actual_error);
+ return;
+ }
tracker_db_metadata_set (iface,
- service,
+ service_type,
id,
"User:Keywords",
- values,
+ keywords,
TRUE);
- g_free (id);
-
- for (p = values; *p; p++) {
+ for (p = keywords; *p; p++) {
g_message ("Added keyword %s to %s with ID %s", *p, uri, id);
- g_signal_emit (object, signals[KEYWORD_ADDED], 0, service, uri, *p);
+ g_signal_emit (object, signals[KEYWORD_ADDED], 0, service_type, uri, *p);
}
- tracker_dbus_request_success (request_id);
+ g_free (id);
- return TRUE;
+ dbus_g_method_return (context);
+
+ tracker_dbus_request_success (request_id);
}
-gboolean
-tracker_keywords_remove (TrackerKeywords *object,
- const gchar *service,
- const gchar *uri,
- gchar **values,
- GError **error)
+void
+tracker_keywords_remove (TrackerKeywords *object,
+ const gchar *service_type,
+ const gchar *uri,
+ gchar **keywords,
+ DBusGMethodInvocation *context,
+ GError **error)
{
TrackerDBInterface *iface;
guint request_id;
gchar *id;
gchar **p;
+ GError *actual_error = NULL;
request_id = tracker_dbus_get_next_request_id ();
- tracker_dbus_return_val_if_fail (service != NULL, FALSE, error);
- tracker_dbus_return_val_if_fail (uri != NULL, FALSE, error);
- tracker_dbus_return_val_if_fail (values != NULL, FALSE, error);
+ tracker_dbus_async_return_if_fail (service_type != NULL, FALSE);
+ tracker_dbus_async_return_if_fail (uri != NULL, FALSE);
+ tracker_dbus_async_return_if_fail (keywords != NULL && *keywords != NULL, FALSE);
tracker_dbus_request_new (request_id,
"DBus request to remove keywords, "
- "service:'%s', uri:'%s'",
- service,
+ "service type:'%s', uri:'%s'",
+ service_type,
uri);
- if (!tracker_ontology_is_valid_service_type (service)) {
+ if (!tracker_ontology_is_valid_service_type (service_type)) {
tracker_dbus_request_failed (request_id,
- error,
- "Service '%s' is invalid or has not been implemented yet",
- service);
- return FALSE;
+ &actual_error,
+ "Service type '%s' is invalid or has not been implemented yet",
+ service_type);
+ dbus_g_method_return_error (context, actual_error);
+ g_error_free (actual_error);
+ return;
}
if (tracker_is_empty_string (uri)) {
tracker_dbus_request_failed (request_id,
- error,
+ &actual_error,
"URI is empty");
- return FALSE;
+ dbus_g_method_return_error (context, actual_error);
+ g_error_free (actual_error);
+ return;
}
- iface = tracker_db_manager_get_db_interface_by_service (service);
- id = tracker_db_file_get_id_as_string (iface, service, uri);
+ iface = tracker_db_manager_get_db_interface_by_service (service_type);
+ id = tracker_db_file_get_id_as_string (iface, service_type, uri);
if (!id) {
tracker_dbus_request_failed (request_id,
- error,
+ &actual_error,
"Entity '%s' was not found",
uri);
- return FALSE;
+ dbus_g_method_return_error (context, actual_error);
+ g_error_free (actual_error);
+ return;
}
- for (p = values; *p; p++) {
+ for (p = keywords; *p; p++) {
g_message ("Removed keyword %s from %s with ID %s", *p, uri, id);
- tracker_db_metadata_delete_value (iface, service, id, "User:Keywords", *p);
+ tracker_db_metadata_delete_value (iface, service_type, id, "User:Keywords", *p);
- g_signal_emit (object, signals[KEYWORD_REMOVED], 0, service, uri, *p);
+ g_signal_emit (object, signals[KEYWORD_REMOVED], 0, service_type, uri, *p);
}
g_free (id);
- tracker_dbus_request_success (request_id);
+ dbus_g_method_return (context);
- return TRUE;
+ tracker_dbus_request_success (request_id);
}
-gboolean
-tracker_keywords_remove_all (TrackerKeywords *object,
- const gchar *service,
- const gchar *uri,
- GError **error)
+void
+tracker_keywords_remove_all (TrackerKeywords *object,
+ const gchar *service_type,
+ const gchar *uri,
+ DBusGMethodInvocation *context,
+ GError **error)
{
TrackerDBInterface *iface;
guint request_id;
gchar *id;
+ GError *actual_error = NULL;
request_id = tracker_dbus_get_next_request_id ();
- tracker_dbus_return_val_if_fail (service != NULL, FALSE, error);
- tracker_dbus_return_val_if_fail (uri != NULL, FALSE, error);
+ tracker_dbus_async_return_if_fail (service_type != NULL, FALSE);
+ tracker_dbus_async_return_if_fail (uri != NULL, FALSE);
tracker_dbus_request_new (request_id,
"DBus request to remove all keywords, "
- "service:'%s', uri:'%s'",
- service,
+ "service type:'%s', uri:'%s'",
+ service_type,
uri);
- if (!tracker_ontology_is_valid_service_type (service)) {
+ if (!tracker_ontology_is_valid_service_type (service_type)) {
tracker_dbus_request_failed (request_id,
- error,
- "Service '%s' is invalid or has not been implemented yet",
- service);
- return FALSE;
+ &actual_error,
+ "Service type '%s' is invalid or has not been implemented yet",
+ service_type);
+ dbus_g_method_return_error (context, actual_error);
+ g_error_free (actual_error);
+ return;
}
if (tracker_is_empty_string (uri)) {
tracker_dbus_request_failed (request_id,
- error,
+ &actual_error,
"URI is empty");
- return FALSE;
+ dbus_g_method_return_error (context, actual_error);
+ g_error_free (actual_error);
+ return;
}
- iface = tracker_db_manager_get_db_interface_by_service (service);
- id = tracker_db_file_get_id_as_string (iface, service, uri);
+ iface = tracker_db_manager_get_db_interface_by_service (service_type);
+ id = tracker_db_file_get_id_as_string (iface, service_type, uri);
if (!id) {
tracker_dbus_request_failed (request_id,
- error,
+ &actual_error,
"Entity '%s' was not found",
uri);
- return FALSE;
+ dbus_g_method_return_error (context, actual_error);
+ g_error_free (actual_error);
+ return;
}
tracker_db_metadata_delete (iface,
- service,
+ service_type,
id,
"User:Keywords",
TRUE);
g_free (id);
- tracker_dbus_request_success (request_id);
+ dbus_g_method_return (context);
- return TRUE;
+ tracker_dbus_request_success (request_id);
}
-gboolean
-tracker_keywords_search (TrackerKeywords *object,
- gint live_query_id,
- const gchar *service,
- const gchar **keywords,
- gint offset,
- gint max_hits,
- gchar ***values,
- GError **error)
+void
+tracker_keywords_search (TrackerKeywords *object,
+ gint live_query_id,
+ const gchar *service_type,
+ const gchar **keywords,
+ gint offset,
+ gint max_hits,
+ DBusGMethodInvocation *context,
+ GError **error)
{
TrackerDBInterface *iface;
TrackerDBResultSet *result_set;
@@ -416,31 +464,35 @@
GString *where;
gchar *related_metadata;
gchar *query;
+ gchar **values;
+ GError *actual_error = NULL;
request_id = tracker_dbus_get_next_request_id ();
- tracker_dbus_return_val_if_fail (service != NULL, FALSE, error);
- tracker_dbus_return_val_if_fail (keywords != NULL, FALSE, error);
- tracker_dbus_return_val_if_fail (values != NULL, FALSE, error);
+ tracker_dbus_async_return_if_fail (service_type != NULL, FALSE);
+ tracker_dbus_async_return_if_fail (keywords != NULL, FALSE);
+ tracker_dbus_async_return_if_fail (values != NULL, FALSE);
tracker_dbus_request_new (request_id,
"DBus request to search keywords, "
- "query id:%d, service:'%s', offset:%d, "
+ "query id:%d, service type:'%s', offset:%d, "
"max hits:%d",
live_query_id,
- service,
+ service_type,
offset,
max_hits);
- if (!tracker_ontology_is_valid_service_type (service)) {
+ if (!tracker_ontology_is_valid_service_type (service_type)) {
tracker_dbus_request_failed (request_id,
- error,
- "Service '%s' is invalid or has not been implemented yet",
- service);
- return FALSE;
+ &actual_error,
+ "Service_Type '%s' is invalid or has not been implemented yet",
+ service_type);
+ dbus_g_method_return_error (context, actual_error);
+ g_error_free (actual_error);
+ return;
}
- iface = tracker_db_manager_get_db_interface_by_service (service);
+ iface = tracker_db_manager_get_db_interface_by_service (service_type);
/* Sanity check values */
offset = MAX (offset, 0);
@@ -478,8 +530,8 @@
g_string_append_printf (where,
" and (S.ServiceTypeID in (select TypeId from ServiceTypes where TypeName = '%s' or Parent = '%s')) ",
- service,
- service);
+ service_type,
+ service_type);
/* Add offset and max_hits */
g_string_append_printf (where,
@@ -495,7 +547,7 @@
g_debug (query);
result_set = tracker_db_interface_execute_query (iface, NULL, query);
- *values = tracker_dbus_query_result_to_strv (result_set, 0, NULL);
+ values = tracker_dbus_query_result_to_strv (result_set, 0, NULL);
if (result_set) {
g_object_unref (result_set);
@@ -503,7 +555,11 @@
g_free (query);
- tracker_dbus_request_success (request_id);
+ dbus_g_method_return (context, values);
+
+ if (values) {
+ g_strfreev (values);
+ }
- return TRUE;
+ tracker_dbus_request_success (request_id);
}
Modified: branches/indexer-split/src/trackerd/tracker-keywords.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-keywords.h (original)
+++ branches/indexer-split/src/trackerd/tracker-keywords.h Tue Jul 15 10:01:21 2008
@@ -48,39 +48,43 @@
GObjectClass parent;
};
-GType tracker_keywords_get_type (void);
-TrackerKeywords *tracker_keywords_new (void);
-gboolean tracker_keywords_get_list (TrackerKeywords *object,
- const gchar *service,
- GPtrArray **values,
- GError **error);
-gboolean tracker_keywords_get (TrackerKeywords *object,
- const gchar *service,
- const gchar *uri,
- gchar ***values,
- GError **error);
-gboolean tracker_keywords_add (TrackerKeywords *object,
- const gchar *service,
- const gchar *uri,
- gchar **values,
- GError **error);
-gboolean tracker_keywords_remove (TrackerKeywords *object,
- const gchar *service,
- const gchar *uri,
- gchar **values,
- GError **error);
-gboolean tracker_keywords_remove_all (TrackerKeywords *object,
- const gchar *service,
- const gchar *uri,
- GError **error);
-gboolean tracker_keywords_search (TrackerKeywords *object,
- gint live_query_id,
- const gchar *service,
- const gchar **keywords,
- gint offset,
- gint max_hits,
- gchar ***result,
- GError **error);
+GType tracker_keywords_get_type (void);
+TrackerKeywords *tracker_keywords_new (void);
+void tracker_keywords_get_list (TrackerKeywords *object,
+ const gchar *service_type,
+ DBusGMethodInvocation *context,
+ GError **error);
+void tracker_keywords_get (TrackerKeywords *object,
+ const gchar *service_type,
+ const gchar *uri,
+ DBusGMethodInvocation *context,
+ GError **error);
+void tracker_keywords_add (TrackerKeywords *object,
+ const gchar *service_type,
+ const gchar *uri,
+ gchar **keywords,
+ DBusGMethodInvocation *context,
+ GError **error);
+void tracker_keywords_remove (TrackerKeywords *object,
+ const gchar *service_type,
+ const gchar *uri,
+ gchar **keywords,
+ DBusGMethodInvocation *context,
+ GError **error);
+void tracker_keywords_remove_all (TrackerKeywords *object,
+ const gchar *service_type,
+ const gchar *uri,
+ DBusGMethodInvocation *context,
+ GError **error);
+void tracker_keywords_search (TrackerKeywords *object,
+ gint live_query_id,
+ const gchar *service_type,
+ const gchar **keywords,
+ gint offset,
+ gint max_hits,
+ DBusGMethodInvocation *context,
+ GError **error);
+
G_END_DECLS
Modified: branches/indexer-split/tests/libtracker-common/tracker-dbus-test.c
==============================================================================
--- branches/indexer-split/tests/libtracker-common/tracker-dbus-test.c (original)
+++ branches/indexer-split/tests/libtracker-common/tracker-dbus-test.c Tue Jul 15 10:01:21 2008
@@ -104,6 +104,29 @@
async_queue_to_strv (FALSE);
}
+static void
+test_results_ptr_array_free (void)
+{
+ GPtrArray *array = NULL;
+
+ /* NULL */
+ tracker_dbus_results_ptr_array_free (&array);
+
+ /* Empty */
+ array = g_ptr_array_new ();
+ g_assert (array != NULL);
+
+ tracker_dbus_results_ptr_array_free (&array);
+ g_assert (array == NULL);
+
+ /* With contents */
+ array = g_ptr_array_new ();
+ g_ptr_array_add (array, g_strsplit ("one two three", " ", -1));
+
+ tracker_dbus_results_ptr_array_free (&array);
+ g_assert (array == NULL);
+}
+
int
main (int argc, char **argv) {
@@ -118,6 +141,7 @@
g_test_add_func ("/libtracker-common/tracker-dbus/slist_to_strv_nonutf8", test_slist_to_strv_nonutf8);
g_test_add_func ("/libtracker-common/tracker-dbus/async_queue_to_strv_ok", test_async_queue_to_strv);
g_test_add_func ("/libtracker-common/tracker-dbus/async_queue_to_strv_nonutf8", test_async_queue_to_strv_nonutf8);
+ g_test_add_func ("/libtracker-common/tracker-dbus/free_ptr_array", test_results_ptr_array_free);
result = g_test_run ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]