[gnome-music/artists] change albums count to 10 instead of 50



commit f0552b2cecae43ba932a1558d26a918be28ea19d
Author: Eslam Mostafa <cseslam gmail com>
Date:   Sun May 19 21:20:51 2013 +0200

    change albums count to 10 instead of 50

 src/grilo.js |   16 ++++++++--------
 src/view.js  |   18 +++++++++---------
 2 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/src/grilo.js b/src/grilo.js
index d597715..142d72e 100644
--- a/src/grilo.js
+++ b/src/grilo.js
@@ -65,23 +65,23 @@ const Grilo = new Lang.Class({
         }
     },
 
-    populateArtists: function (offset, callback) {
-        this.populateItems (Query.artist, offset, callback)
+    populateArtists: function (offset, callback, count=50) {
+        this.populateItems (Query.artist, offset, callback, count)
     },
 
-    populateAlbums: function (offset, callback) {
-        this.populateItems (Query.album, offset, callback)
+    populateAlbums: function (offset, callback, count=50) {
+        this.populateItems (Query.album, offset, callback, count)
     },
 
-    populateSongs: function (offset, callback) {
-        this.populateItems (Query.songs, offset, callback)
+    populateSongs: function (offset, callback, count=50) {
+        this.populateItems (Query.songs, offset, callback, count)
     },
 
-    populateItems: function (query, offset, callback) {
+    populateItems: function (query, offset, callback, count) {
         var options = Grl.OperationOptions.new(null);
         options.set_flags (Grl.ResolutionFlags.FULL | Grl.ResolutionFlags.IDLE_RELAY);
         options.set_skip (offset);
-        options.set_count(50);
+        options.set_count(count);
         grilo.tracker.query(
             query,
                 [Grl.METADATA_KEY_ID, Grl.METADATA_KEY_TITLE, Grl.METADATA_KEY_ARTIST, 
Grl.METADATA_KEY_CREATION_DATE],
diff --git a/src/view.js b/src/view.js
index 1c92551..41e4623 100644
--- a/src/view.js
+++ b/src/view.js
@@ -131,7 +131,7 @@ const ViewContainer = new Lang.Class({
             GObject.TYPE_BOOLEAN
         ]);
         this.view = new Gd.MainView({
-            shadow_type:    Gtk.ShadowType.NONE
+            shadow_type: Gtk.ShadowType.NONE
         });
         this.view.set_view_type(Gd.MainViewType.ICON);
         this.view.set_model(this._model);
@@ -533,7 +533,8 @@ const Artists = new Lang.Class({
         this.view.get_style_context().add_class("artist-panel");
         this.view.get_generic_view().get_selection().set_mode(Gtk.SelectionMode.SINGLE);
         this.albumsCountQuery = Query.album_count;
-        let loadMoreBtn = new LoadMoreButton(this._getRemainingAlbumsCount);
+        this.countQuery = Query.album_count;
+        let loadMoreBtn = new LoadMoreButton(this._getRemainingItemCount);
         var scrolledWindow = new Gtk.ScrolledWindow();
         scrolledWindow.set_policy(
             Gtk.PolicyType.NEVER,
@@ -556,10 +557,9 @@ const Artists = new Lang.Class({
             ["All Artists", "All Artists", "All Artists", "All Artists"]
         );
         this.emit("artist-added");
-        this.view.emit('item-activated', "0", this._model.get_path(iter));
         loadMoreBtn.widget.connect("clicked", Lang.bind(this, this.populateAlbums));
         this.show_all();
-
+        this.view.emit('item-activated', "0", this._model.get_path(iter));
     },
 
     _addListRenderers: function() {
@@ -624,6 +624,8 @@ const Artists = new Lang.Class({
 
     _addAlbum: function (source, param, album) {
         this._albumsOffset += 1
+        if(album == null)
+            return
         this._artists["All Artists".toLowerCase()]["albums"].push(album)
     },
 
@@ -636,12 +638,9 @@ const Artists = new Lang.Class({
 
     populateAlbums: function () {
         if (grilo.tracker != null) 
-            grilo.populateAlbums (this._albumsOffset, Lang.bind(this, function(source, param, album) {
-                this._artists["All Artists".toLowerCase()]["albums"].push(album)
-                this._albumsOffset += 1
-            }));
+            grilo.populateAlbums (this._albumsOffset, Lang.bind(this, this._addAlbum), 10);
     },
-
+/*
     _getRemainingAlbumsCount: function () {
         let count = -1;
         if (this.albumsCountQuery != null) {
@@ -651,4 +650,5 @@ const Artists = new Lang.Class({
         }
         return ( count - this._offset);
     },
+*/
 });


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