[PATCH 1/2] 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-media-source.c |    9 ++++++++-
 src/grl-multiple.c     |    3 ++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/grl-media-source.c b/src/grl-media-source.c
index e5312d8..0c65b9a 100644
--- a/src/grl-media-source.c
+++ b/src/grl-media-source.c
@@ -1439,6 +1439,10 @@ 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 search will return all elements from @source. If
+ * @source does not support this option then it will send an error in the
+ * callback.
+ *
  * This method is asynchronous.
  *
  * Returns: the operation identifier
@@ -1466,7 +1470,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 +1570,10 @@ 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 search will return all elements from @source. If
+ * @source does not support this option then it will send an error in the
+ * callback.
+ *
  * 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..dfae8a9 100644
--- a/src/grl-multiple.c
+++ b/src/grl-multiple.c
@@ -486,6 +486,8 @@ media_from_uri_cb (GrlMediaSource *source,
  *
  * Search for @text in all the sources specified in @sources.
  *
+ * If @text is @NULL then search will return all elements from @sources.
+ *
  * This method is asynchronous.
  *
  * Returns: the operation identifier
@@ -509,7 +511,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.3.5



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]