[grilo-plugins] jamendo: return "no results" when browsing out of range feeds
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] jamendo: return "no results" when browsing out of range feeds
- Date: Wed, 28 Nov 2012 18:13:15 +0000 (UTC)
commit 3d09ed8e46676847b3e4d3e73725a82b0938e235
Author: Andrzej Bieniek <andyhelp gmail com>
Date: Tue Nov 27 00:23:02 2012 +0000
jamendo: return "no results" when browsing out of range feeds
When skip was greater or equal number of elements in feeds table,
plugin never called result callback causing grilo to lockup.
Reproduced with gril-mediaserver2 and gupnp-av-cp when requesting items from starting index 6.
https://bugzilla.gnome.org/show_bug.cgi?id=689125
src/jamendo/grl-jamendo.c | 35 +++++++++++++++++++++--------------
1 files changed, 21 insertions(+), 14 deletions(-)
---
diff --git a/src/jamendo/grl-jamendo.c b/src/jamendo/grl-jamendo.c
index 4021013..f711695 100644
--- a/src/jamendo/grl-jamendo.c
+++ b/src/jamendo/grl-jamendo.c
@@ -849,24 +849,31 @@ update_media_from_feed (GrlMedia *media, int i)
static void
send_feeds (GrlSourceBrowseSpec *bs)
{
- int i;
- int remaining;
gint count = grl_operation_options_get_count (bs->options);
guint skip = grl_operation_options_get_skip (bs->options);
- remaining = MIN (count, G_N_ELEMENTS (feeds));
- for (i = skip; remaining > 0 && i < G_N_ELEMENTS (feeds); i++) {
- GrlMedia *media;
+ if( skip >= G_N_ELEMENTS (feeds) )
+ {
+ //Signal "no results"
+ bs->callback (bs->source, bs->operation_id,
+ NULL, 0, bs->user_data, NULL);
+ } else {
+ int remaining = MIN (count, G_N_ELEMENTS (feeds));
+ int i;
- media = grl_media_box_new ();
- update_media_from_feed (media, i);
- remaining--;
- bs->callback (bs->source,
- bs->operation_id,
- media,
- remaining,
- bs->user_data,
- NULL);
+ for (i = skip; remaining > 0 && i < G_N_ELEMENTS (feeds); i++) {
+ GrlMedia *media;
+
+ media = grl_media_box_new ();
+ update_media_from_feed (media, i);
+ remaining--;
+ bs->callback (bs->source,
+ bs->operation_id,
+ media,
+ remaining,
+ bs->user_data,
+ NULL);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]