[gnome-music/wip/merge: 215/343] Fix set_block for LoadMoreButton and make switching to songsview not crash
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/merge: 215/343] Fix set_block for LoadMoreButton and make switching to songsview not crash
- Date: Thu, 25 Jul 2013 11:30:53 +0000 (UTC)
commit 362ff5b28650fd2bf3b3d00d0a46c743a53d7788
Author: Seif Lotfy <seif lotfy com>
Date: Tue Jul 16 18:19:12 2013 +0200
Fix set_block for LoadMoreButton and make switching to songsview
not crash
gnomemusic/grilo.py | 6 ++++--
gnomemusic/view.py | 30 +++++++++++++++---------------
2 files changed, 19 insertions(+), 17 deletions(-)
---
diff --git a/gnomemusic/grilo.py b/gnomemusic/grilo.py
index 601428b..85a9c84 100644
--- a/gnomemusic/grilo.py
+++ b/gnomemusic/grilo.py
@@ -52,7 +52,7 @@ class Grilo(GObject.GObject):
def populate_albums(self, offset, callback, count=50):
self.populate_items(Query.ALBUMS, offset, callback, count)
- def populate_songs(self, offset, callback):
+ def populate_songs(self, offset, callback, count=50):
self.populate_items(Query.SONGS, offset, callback)
def populate_items(self, query, offset, callback, count=50):
@@ -61,7 +61,9 @@ class Grilo(GObject.GObject):
Grl.ResolutionFlags.IDLE_RELAY)
options.set_skip(offset)
options.set_count(count)
- self.tracker.query(query, self.METADATA_KEYS, options, callback, None)
+ def _callback(source, param, item, count, data, offset):
+ callback(source, param, item)
+ self.tracker.query(query, self.METADATA_KEYS, options, _callback, None)
def get_album_songs(self, album_id, callback):
query = Query.album_songs(album_id)
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index 6128a41..367111b 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -104,7 +104,7 @@ class ViewContainer(Gtk.Stack):
self.header_bar.get_stack().connect('notify::visible-child', self._on_header_bar_visible)
def _on_header_bar_visible(self, widget, param):
- if self == widget.get_visible_child() and self._init:
+ if self == widget.get_visible_child() and not self._init:
self._populate()
def _on_view_selection_changed(self):
@@ -151,7 +151,7 @@ class ViewContainer(Gtk.Stack):
def populate(self):
print("populate")
- def _add_item(self, source, param, item, a, b, c):
+ def _add_item(self, source, param, item):
if item is not None:
self._offset += 1
iter = self._model.append()
@@ -328,50 +328,50 @@ class Songs(ViewContainer):
typeRenderer.ellipsize = Pango.EllipsizeMode.END
listWidget.add_renderer(typeRenderer, self._on_list_widget_type_render, None)
- def _on_list_widget_title_render(self, col, cell, model, iter):
- item = model.get_value(iter, 5)
+ def _on_list_widget_title_render(self, col, cell, model, itr, data):
+ item = model.get_value(itr, 5)
self.xalign = 0.0
self.yalign = 0.5
self.height = 48
self.ellipsize = Pango.EllipsizeMode.END
self.text = item.get_title()
- def _on_list_widget_star_render(self, col, cell, model, iter):
- showstar = model.get_value(iter, 9)
+ def _on_list_widget_star_render(self, col, cell, model, itr, data):
+ showstar = model.get_value(itr, 9)
if(showstar):
self.icon_name = self.starIconName
else:
self.pixbuf = None
- def _on_list_widget_duration_render(self, col, cell, model, iter):
- item = model.get_value(iter, 5)
+ def _on_list_widget_duration_render(self, col, cell, model, itr, data):
+ item = model.get_value(itr, 5)
if item:
duration = item.get_duration()
minutes = int(duration / 60)
seconds = duration % 60
time = None
if seconds < 10:
- time = minutes + ":0" + seconds
+ time = str(minutes) + ":0" + str(seconds)
else:
- time = minutes + ":" + seconds
+ time = str(minutes) + ":" + str(seconds)
self.xalign = 1.0
self.text = time
- def _on_list_widget_artist_render(self, col, cell, model, iter):
- item = model.get_value(iter, 5)
+ def _on_list_widget_artist_render(self, col, cell, model, itr, data):
+ item = model.get_value(itr, 5)
if item:
self.ellipsize = Pango.EllipsizeMode.END
self.text = item.get_string(Grl.METADATA_KEY_ARTIST)
- def _on_list_widget_type_render(self, coll, cell, model, iter):
- item = model.get_value(iter, 5)
+ def _on_list_widget_type_render(self, coll, cell, model, itr, data):
+ item = model.get_value(itr, 5)
if item:
self.ellipsize = Pango.EllipsizeMode.END
self.text = item.get_string(Grl.METADATA_KEY_ALBUM)
def populate(self):
if grilo.tracker is not None:
- grilo.populate_songs(self._offset, self._add_item, None)
+ grilo.populate_songs(self._offset, self._add_item)
class Playlist(ViewContainer):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]