[grilo] core: Add synchronous version of grl_media_source_search() function
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] core: Add synchronous version of grl_media_source_search() function
- Date: Thu, 15 Jul 2010 14:25:26 +0000 (UTC)
commit 379e3863ff166be8bcf174d0521d0ecadb9aa564
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Thu Jul 15 13:40:09 2010 +0200
core: Add synchronous version of grl_media_source_search() function
src/grl-media-source.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++
src/grl-media-source.h | 8 ++++++
2 files changed, 64 insertions(+), 0 deletions(-)
---
diff --git a/src/grl-media-source.c b/src/grl-media-source.c
index 0523f39..5a163f3 100644
--- a/src/grl-media-source.c
+++ b/src/grl-media-source.c
@@ -1485,6 +1485,62 @@ grl_media_source_search (GrlMediaSource *source,
}
/**
+ * grl_media_source_search_sync:
+ * @source: a media source
+ * @text: the text to search
+ * @keys: the list of #GrlKeyID to request
+ * @skip: the number if elements to skip in the search operation
+ * @count: the number of elements to retrieve in the search operation
+ * @flags: the resolution mode
+ * @error: a #GError, or @NULL
+ *
+ * Search for the @text string in a media source for data identified with
+ * that string.
+ *
+ * This method is synchronous.
+ *
+ * Returns: a list with #GrlMedia elements
+ */
+GList *
+grl_media_source_search_sync (GrlMediaSource *source,
+ const gchar *text,
+ const GList *keys,
+ guint skip,
+ guint count,
+ GrlMetadataResolutionFlags flags,
+ GError **error)
+{
+ struct OperationAsyncCb *oa;
+ GList *result;
+
+ oa = g_slice_new0 (struct OperationAsyncCb);
+
+ grl_media_source_search (source,
+ text,
+ keys,
+ skip,
+ count,
+ flags,
+ multiple_result_async_cb,
+ oa);
+
+ wait_for_async_operation_complete (oa);
+
+ if (oa->error) {
+ if (error) {
+ *error = oa->error;
+ } else {
+ g_error_free (oa->error);
+ }
+ }
+
+ result = (GList *) oa->data;
+ g_slice_free (struct OperationAsyncCb, oa);
+
+ return result;
+}
+
+/**
* grl_media_source_query:
* @source: a media source
* @query: the query to process
diff --git a/src/grl-media-source.h b/src/grl-media-source.h
index 8084a42..7f1de65 100644
--- a/src/grl-media-source.h
+++ b/src/grl-media-source.h
@@ -354,6 +354,14 @@ guint grl_media_source_search (GrlMediaSource *source,
GrlMediaSourceResultCb callback,
gpointer user_data);
+GList *grl_media_source_search_sync (GrlMediaSource *source,
+ const gchar *text,
+ const GList *keys,
+ guint skip,
+ guint count,
+ GrlMetadataResolutionFlags flags,
+ GError **error);
+
guint grl_media_source_query (GrlMediaSource *source,
const gchar *query,
const GList *keys,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]