[gnome-music] Don't change view type after setting up the view



commit 96bad84d2c5b1839817fe65dfc7c3a65b7970f6b
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Wed Apr 2 15:11:49 2014 +0200

    Don't change view type after setting up the view

 gnomemusic/view.py |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index 5d8d562..1f06f7d 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -66,7 +66,7 @@ class ViewContainer(Stack):
     countQuery = None
     filter = None
 
-    def __init__(self, title, header_bar, selection_toolbar, use_sidebar=False, sidebar=None):
+    def __init__(self, title, header_bar, selection_toolbar, view_type, use_sidebar=False, sidebar=None):
         Stack.__init__(self,
                        transition_type=StackTransitionType.CROSSFADE)
         self._grid = Gtk.Grid(orientation=Gtk.Orientation.HORIZONTAL)
@@ -92,7 +92,7 @@ class ViewContainer(Stack):
         self.view = Gd.MainView(
             shadow_type=Gtk.ShadowType.NONE
         )
-        self.view.set_view_type(Gd.MainViewType.ICON)
+        self.view.set_view_type(view_type)
         self.filter = self._model.filter_new(None)
         self.view.set_model(self.filter)
         self.vadjustment = self.view.get_vadjustment()
@@ -328,8 +328,7 @@ class Empty(Stack):
 class Albums(ViewContainer):
     def __init__(self, header_bar, selection_toolbar, player):
         ViewContainer.__init__(self, _("Albums"), header_bar,
-                               selection_toolbar)
-        self.view.set_view_type(Gd.MainViewType.ICON)
+                               selection_toolbar, Gd.MainViewType.ICON)
         self.countQuery = Query.ALBUMS_COUNT
         self._albumWidget = Widgets.AlbumWidget(player)
         self.player = player
@@ -400,12 +399,11 @@ class Albums(ViewContainer):
 
 class Songs(ViewContainer):
     def __init__(self, header_bar, selection_toolbar, player):
-        ViewContainer.__init__(self, _("Songs"), header_bar, selection_toolbar)
+        ViewContainer.__init__(self, _("Songs"), header_bar, selection_toolbar, Gd.MainViewType.LIST)
         self.countQuery = Query.SONGS_COUNT
         self._items = {}
         self.isStarred = None
         self.iter_to_clean = None
-        self.view.set_view_type(Gd.MainViewType.LIST)
         self.view.get_generic_view().get_style_context()\
             .add_class('songs-list')
         self._iconHeight = 32
@@ -554,7 +552,7 @@ class Songs(ViewContainer):
 class Artists (ViewContainer):
     def __init__(self, header_bar, selection_toolbar, player):
         ViewContainer.__init__(self, _("Artists"), header_bar,
-                               selection_toolbar, True)
+                               selection_toolbar, Gd.MainViewType.LIST, True)
         self.artists_counter = 0
         self.player = player
         self._artists = {}
@@ -571,7 +569,6 @@ class Artists (ViewContainer):
         )
         self.artistAlbumsStack.add_named(self._artistAlbumsWidget, "sidebar")
         self.artistAlbumsStack.set_visible_child_name("sidebar")
-        self.view.set_view_type(Gd.MainViewType.LIST)
         self.view.set_hexpand(False)
         self.view.get_style_context().add_class('artist-panel')
         self.view.get_generic_view().get_selection().set_mode(
@@ -733,9 +730,8 @@ class Playlist(ViewContainer):
         )
 
         ViewContainer.__init__(self, _("Playlists"), header_bar,
-                               selection_toolbar, True, self.playlists_sidebar)
+                               selection_toolbar, Gd.MainViewType.LIST, True, self.playlists_sidebar)
 
-        self.view.set_view_type(Gd.MainViewType.LIST)
         self.view.get_generic_view().get_style_context()\
             .add_class('songs-list')
         self._add_list_renderers()
@@ -766,8 +762,8 @@ class Playlist(ViewContainer):
             GObject.TYPE_BOOLEAN,
             GObject.TYPE_BOOLEAN
         )
-        self.playlists_sidebar.set_model(self.playlists_model)
         self.playlists_sidebar.set_view_type(Gd.MainViewType.LIST)
+        self.playlists_sidebar.set_model(self.playlists_model)
         self.playlists_sidebar.set_hexpand(False)
         self.playlists_sidebar.get_style_context().add_class('artist-panel')
         self.playlists_sidebar.get_generic_view().get_selection().set_mode(


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