[grilo] core: Allow NULL text search()
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] core: Allow NULL text search()
- Date: Mon, 7 Feb 2011 20:40:10 +0000 (UTC)
commit d16ca2c10b67d770aee346c41a67ebba7e6e0384
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Wed Feb 2 08:47:39 2011 +0100
core: Allow NULL text search()
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 d76a5fb..2afe1e3 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
@@ -61,6 +62,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 088fb1e..bcbdae3 100644
--- a/src/grl-media-source.c
+++ b/src/grl-media-source.c
@@ -1479,6 +1479,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
@@ -1506,7 +1511,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)) &
@@ -1607,6 +1611,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) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]