[PATCH 6/7] podcasts: Implement search all elements
- From: "Juan A. Suarez Romero" <jasuarez igalia com>
- To: grilo-list gnome org
- Subject: [PATCH 6/7] podcasts: Implement search all elements
- Date: Wed, 2 Feb 2011 21:26:40 +0100
Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>
---
src/podcasts/grl-podcasts.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/podcasts/grl-podcasts.c b/src/podcasts/grl-podcasts.c
index bf4e406..b66d369 100644
--- a/src/podcasts/grl-podcasts.c
+++ b/src/podcasts/grl-podcasts.c
@@ -120,6 +120,10 @@ GRL_LOG_DOMAIN_STATIC(podcasts_log_domain);
" OR p.title LIKE '%%%s%%' OR p.desc LIKE '%%%s%%' " \
"LIMIT %u OFFSET %u"
+#define GRL_SQL_GET_PODCAST_STREAMS_ALL \
+ "SELECT * FROM streams " \
+ "LIMIT %u OFFSET %u"
+
#define GRL_SQL_GET_PODCAST_STREAM \
"SELECT * FROM streams " \
"WHERE url='%s' " \
@@ -636,9 +640,16 @@ produce_podcast_contents_from_db (OperationSpec *os)
db = GRL_PODCASTS_SOURCE (os->source)->priv->db;
/* Check if searching or browsing */
if (os->is_query) {
- sql = g_strdup_printf (GRL_SQL_GET_PODCAST_STREAMS_BY_TEXT,
- os->text, os->text, os->text, os->text,
- os->count, os->skip);
+ if (os->text) {
+ /* Search text */
+ sql = g_strdup_printf (GRL_SQL_GET_PODCAST_STREAMS_BY_TEXT,
+ os->text, os->text, os->text, os->text,
+ os->count, os->skip);
+ } else {
+ /* Return all */
+ sql = g_strdup_printf (GRL_SQL_GET_PODCAST_STREAMS_ALL,
+ os->count, os->skip);
+ }
} else {
sql = g_strdup_printf (GRL_SQL_GET_PODCAST_STREAMS,
os->media_id, os->count, os->skip);
--
1.7.3.5
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]