[grilo] core: Add synchronous version of grl_media_source_query() 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_query() function
- Date: Thu, 15 Jul 2010 14:25:31 +0000 (UTC)
commit cd6eeb03e43b5dcce1877a6a280c6a03f8e13ba3
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Thu Jul 15 13:40:52 2010 +0200
core: Add synchronous version of grl_media_source_query() 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 5a163f3..5a33e4f 100644
--- a/src/grl-media-source.c
+++ b/src/grl-media-source.c
@@ -1673,6 +1673,62 @@ grl_media_source_query (GrlMediaSource *source,
}
/**
+ * grl_media_source_query_sync:
+ * @source: a media source
+ * @query: the query to process
+ * @keys: the list of #GrlKeyID to request
+ * @skip: the number if elements to skip in the query operation
+ * @count: the number of elements to retrieve in the query operation
+ * @flags: the resolution mode
+ * @error: a #GError, or @NULL
+ *
+ * Execute a specialized query (specific for each provider) on a media
+ * repository.
+ *
+ * This method is synchronous.
+ *
+ * Returns: a list with #GrlMedia elements
+ */
+GList *
+grl_media_source_query_sync (GrlMediaSource *source,
+ const gchar *query,
+ 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_query (source,
+ query,
+ 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_metadata:
* @source: a media source
* @media: a data transfer object
diff --git a/src/grl-media-source.h b/src/grl-media-source.h
index 7f1de65..0bbc125 100644
--- a/src/grl-media-source.h
+++ b/src/grl-media-source.h
@@ -371,6 +371,14 @@ guint grl_media_source_query (GrlMediaSource *source,
GrlMediaSourceResultCb callback,
gpointer user_data);
+GList *grl_media_source_query_sync (GrlMediaSource *source,
+ const gchar *query,
+ const GList *keys,
+ guint skip,
+ guint count,
+ GrlMetadataResolutionFlags flags,
+ GError **error);
+
guint grl_media_source_metadata (GrlMediaSource *source,
GrlMedia *media,
const GList *keys,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]