[PATCH 1/2] core: Allow NULL text search()
- From: "Juan A. Suarez Romero" <jasuarez igalia com>
- To: grilo-list gnome org
- Subject: [PATCH 1/2] core: Allow NULL text search()
- Date: Thu, 3 Feb 2011 10:40:16 +0100
Searching for a NULL text returns all non-boxes elements in the source.
Basically, it is equal as "search all elements" with no restriction.
Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>
---
src/grl-error.h | 2 ++
src/grl-media-source.c | 11 ++++++++++-
src/grl-multiple.c | 4 +++-
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/grl-error.h b/src/grl-error.h
index 4f654ab..f26b6ed 100644
--- a/src/grl-error.h
+++ b/src/grl-error.h
@@ -40,6 +40,7 @@
* GrlCoreError:
* @GRL_CORE_ERROR_BROWSE_FAILED: The browse operation failed
* @GRL_CORE_ERROR_SEARCH_FAILED: The search operation failed
+ * @GRL_CORE_ERROR_SEARCH_NULL_UNSUPPORTED: Searching NULL-text is not supported
* @GRL_CORE_ERROR_QUERY_FAILED: The query operation failed
* @GRL_CORE_ERROR_METADATA_FAILED: The metadata search failed
* @GRL_CORE_ERROR_RESOLVE_FAILED: The resolution operation failed
@@ -60,6 +61,7 @@
typedef enum {
GRL_CORE_ERROR_BROWSE_FAILED = 1,
GRL_CORE_ERROR_SEARCH_FAILED,
+ GRL_CORE_ERROR_SEARCH_NULL_UNSUPPORTED,
GRL_CORE_ERROR_QUERY_FAILED,
GRL_CORE_ERROR_METADATA_FAILED,
GRL_CORE_ERROR_RESOLVE_FAILED,
diff --git a/src/grl-media-source.c b/src/grl-media-source.c
index e5312d8..cf6991b 100644
--- a/src/grl-media-source.c
+++ b/src/grl-media-source.c
@@ -1439,6 +1439,11 @@ grl_media_source_browse_sync (GrlMediaSource *source,
* Search for the @text string in a media source for data identified with
* that string.
*
+ * If @text is @NULL then no text filter will be applied, and thus, no media
+ * items from @source will be filtered. If @source does not support NULL-text
+ * search operations it should notiy the client by setting
+ * @GRL_CORE_ERROR_SEARCH_NULL_UNSUPPORTED in @callback's error parameter.
+ *
* This method is asynchronous.
*
* Returns: the operation identifier
@@ -1466,7 +1471,6 @@ grl_media_source_search (GrlMediaSource *source,
gboolean full_chained = FALSE;
g_return_val_if_fail (GRL_IS_MEDIA_SOURCE (source), 0);
- g_return_val_if_fail (text != NULL, 0);
g_return_val_if_fail (callback != NULL, 0);
g_return_val_if_fail (count > 0, 0);
g_return_val_if_fail (grl_metadata_source_supported_operations (GRL_METADATA_SOURCE (source)) &
@@ -1567,6 +1571,11 @@ grl_media_source_search (GrlMediaSource *source,
* Search for the @text string in a media source for data identified with
* that string.
*
+ * If @text is @NULL then no text filter will be applied, and thus, no media
+ * items from @source will be filtered. If @source does not support NULL-text
+ * search operations it should notiy the client by setting
+ * @GRL_CORE_ERROR_SEARCH_NULL_UNSUPPORTED in the error parameter.
+ *
* This method is synchronous.
*
* Returns: (element-type Grl.Media) (transfer full): a #GList with #GrlMedia
diff --git a/src/grl-multiple.c b/src/grl-multiple.c
index a9db969..1c423ad 100644
--- a/src/grl-multiple.c
+++ b/src/grl-multiple.c
@@ -486,6 +486,9 @@ media_from_uri_cb (GrlMediaSource *source,
*
* Search for @text in all the sources specified in @sources.
*
+ * If @text is @NULL then NULL-text searchs will be used for each searchable
+ * plugin (see #grl_media_source_search for more details).
+ *
* This method is asynchronous.
*
* Returns: the operation identifier
@@ -509,7 +512,6 @@ grl_multiple_search (const GList *sources,
GRL_DEBUG ("grl_multiple_search");
g_return_val_if_fail (count > 0, 0);
- g_return_val_if_fail (text != NULL, 0);
g_return_val_if_fail (callback != NULL, 0);
if (!pending_operations) {
--
1.7.1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]