[gnome-music] In updateModel, return false instead of true
- From: Seif Lotfy <seiflotfy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] In updateModel, return false instead of true
- Date: Wed, 8 May 2013 10:41:27 +0000 (UTC)
commit c4ed674e2cfe05546c8137d3f1341511796d8f35
Author: Guillaume Quintard <guillaume quintard gmail com>
Date: Wed May 8 12:12:03 2013 +0200
In updateModel, return false instead of true
This allow the signal to continue be handled by all callbacks.
Also, make sure we clean the artist view.
Signed-off-by: Seif Lotfy <seif lotfy com>
src/widgets.js | 38 ++++++++++++++++++++++++++------------
1 files changed, 26 insertions(+), 12 deletions(-)
---
diff --git a/src/widgets.js b/src/widgets.js
index 975298a..56a0fc2 100644
--- a/src/widgets.js
+++ b/src/widgets.js
@@ -197,16 +197,14 @@ const AlbumWidget = new Lang.Class({
updateModel: function(player, playlist, currentIter){
//this is not our playlist, return
if (playlist != this.model){
- return true;}
- let currentSong = playlist.get_value(currentIter, 5);
+ return false;}
+ let currentSong = playlist.get_value(currentIter, 5);
let [res, iter] = playlist.get_iter_first();
if (!res)
- return true;
+ return false;
let songPassed = false;
let iconVisible, title;
- let i = 0;
do{
- i++;
let song = playlist.get_value(iter, 5);
let escapedTitle = GLib.markup_escape_text(song.get_title(), song.get_title().length);
@@ -224,7 +222,7 @@ const AlbumWidget = new Lang.Class({
playlist.set_value(iter, 0, title);
playlist.set_value(iter, 3, iconVisible);
} while(playlist.iter_next(iter));
- return true;
+ return false;
},
});
Signals.addSignalMethods(AlbumWidget.prototype);
@@ -272,19 +270,21 @@ const ArtistAlbums = new Lang.Class({
updateModel: function(player, playlist, currentIter){
//this is not our playlist, return
if (playlist != this.model){
- return true;}
+ //TODO, only clean once, but that can wait util we have clean
+ //the code a bit, and until the playlist refactoring.
+ //the overhead is acceptable for now
+ this.cleanModel();
+ return false;}
let currentSong = playlist.get_value(currentIter, 5);
let [res, iter] = playlist.get_iter_first();
if (!res)
- return true;
+ return false;
let songPassed = false;
- let i = 0;
do{
- i++;
let song = playlist.get_value(iter, 5);
let songWidget = song.songWidget;
- let escapedTitle = GLib.markup_escape_text(song.get_title(), song.get_title().length)
+ let escapedTitle = GLib.markup_escape_text(song.get_title(), song.get_title().length);
if (song == currentSong){
songWidget.nowPlayingSign.show();
songWidget.title.set_markup("<b>" + escapedTitle + "</b>");
@@ -297,9 +297,23 @@ const ArtistAlbums = new Lang.Class({
songWidget.title.set_markup("<span color='grey'>" + escapedTitle + "</span>");
}
} while(playlist.iter_next(iter));
- return true;
+ return false;
},
+ cleanModel: function(){
+ let [res, iter] = this.model.get_iter_first();
+ if (!res)
+ return false;
+ do{
+ let song = this.model.get_value(iter, 5);
+ let songWidget = song.songWidget;
+ let escapedTitle = GLib.markup_escape_text(song.get_title(), song.get_title().length);
+ songWidget.nowPlayingSign.hide();
+ songWidget.title.set_markup("<span>" + escapedTitle + "</span>");
+ } while(this.model.iter_next(iter));
+ return false;
+
+ }
});
Signals.addSignalMethods(ArtistAlbums.prototype);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]