[grilo-plugins] [jamendo] Use skip and handle when sending top-level categories
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] [jamendo] Use skip and handle when sending top-level categories
- Date: Tue, 4 May 2010 10:26:09 +0000 (UTC)
commit 0404a2fb842425de71694fb5e9b20c16f65ef6d4
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Tue May 4 12:25:17 2010 +0200
[jamendo] Use skip and handle when sending top-level categories
We were sending all top-level categories without checking nor offset nor count.
src/jamendo/grl-jamendo.c | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/src/jamendo/grl-jamendo.c b/src/jamendo/grl-jamendo.c
index 3bd7154..a144619 100644
--- a/src/jamendo/grl-jamendo.c
+++ b/src/jamendo/grl-jamendo.c
@@ -739,14 +739,28 @@ static void
send_toplevel_categories (GrlMediaSourceBrowseSpec *bs)
{
GrlMedia *media;
+ gint remaining;
- media = grl_media_box_new ();
- update_media_from_artists (media);
- bs->callback (bs->source, bs->browse_id, media, 1, bs->user_data, NULL);
+ /* Check if all elements must be skipped */
+ if (bs->skip > 1 || bs->count == 0) {
+ bs->callback (bs->source, bs->browse_id, NULL, 0, bs->user_data, NULL);
+ return;
+ }
+
+ remaining = bs->count;
- media = grl_media_box_new ();
- update_media_from_albums (media);
- bs->callback (bs->source, bs->browse_id, media, 0, bs->user_data, NULL);
+ if (bs->skip == 0) {
+ media = grl_media_box_new ();
+ update_media_from_artists (media);
+ remaining--;
+ bs->callback (bs->source, bs->browse_id, media, remaining, bs->user_data, NULL);
+ }
+
+ if (remaining) {
+ media = grl_media_box_new ();
+ update_media_from_albums (media);
+ bs->callback (bs->source, bs->browse_id, media, 0, bs->user_data, NULL);
+ }
}
static gchar *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]