Commit 96bad84d authored by Vadim Rutkovsky's avatar Vadim Rutkovsky

Don't change view type after setting up the view

parent befe426b
......@@ -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(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment