[gnome-music: 1/2] widgets: Create model of AlbumWidget in a private function
- From: Arnel A. Borja <arnelborja src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music: 1/2] widgets: Create model of AlbumWidget in a private function
- Date: Wed, 14 Aug 2013 18:03:08 +0000 (UTC)
commit 3bd496b6bf17e14308fe163b7f153c53d83a81db
Author: Jackson <jacksonisaac2008 gmail com>
Date: Wed Aug 14 23:10:32 2013 +0530
widgets: Create model of AlbumWidget in a private function
Create model of AlbumWidget in a private function as clearing it causes
crash in Albums view.
gnomemusic/widgets.py | 30 ++++++++++++++++--------------
1 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/gnomemusic/widgets.py b/gnomemusic/widgets.py
index a6c8f80..71fa00a 100644
--- a/gnomemusic/widgets.py
+++ b/gnomemusic/widgets.py
@@ -84,19 +84,7 @@ class AlbumWidget(Gtk.EventBox):
self.ui = Gtk.Builder()
self.ui.add_from_resource('/org/gnome/Music/AlbumWidget.ui')
- self.model = Gtk.ListStore(
- GObject.TYPE_STRING, # title
- GObject.TYPE_STRING,
- GObject.TYPE_STRING,
- GObject.TYPE_STRING,
- GdkPixbuf.Pixbuf, # icon
- GObject.TYPE_OBJECT, # song object
- GObject.TYPE_BOOLEAN, # item selected
- GObject.TYPE_STRING,
- GObject.TYPE_BOOLEAN,
- GObject.TYPE_BOOLEAN, # icon shown
- )
-
+ self._create_model()
self.view = Gd.MainView(
shadow_type=Gtk.ShadowType.NONE
)
@@ -174,6 +162,20 @@ class AlbumWidget(Gtk.EventBox):
cols[0].clear_attributes(durationRenderer)
cols[0].add_attribute(durationRenderer, 'markup', 1)
+ def _create_model(self):
+ self.model = Gtk.ListStore(
+ GObject.TYPE_STRING, # title
+ GObject.TYPE_STRING,
+ GObject.TYPE_STRING,
+ GObject.TYPE_STRING,
+ GdkPixbuf.Pixbuf, # icon
+ GObject.TYPE_OBJECT, # song object
+ GObject.TYPE_BOOLEAN, # item selected
+ GObject.TYPE_STRING,
+ GObject.TYPE_BOOLEAN,
+ GObject.TYPE_BOOLEAN, # icon shown
+ )
+
def update(self, artist, album, item, header_bar, selection_toolbar):
self.selection_toolbar = selection_toolbar
self.header_bar = header_bar
@@ -190,7 +192,7 @@ class AlbumWidget(Gtk.EventBox):
self.update_model(self.player, cached_playlist,
self.player.currentTrack)
else:
- self.model.clear()
+ self._create_model()
GLib.idle_add(grilo.populate_album_songs, item.get_id(),
self._on_populate_album_songs)
header_bar._select_button.connect(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]