[gnome-music/wip/jfelder/baseview-must-die: 5/5] views: Define a title property
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/baseview-must-die: 5/5] views: Define a title property
- Date: Thu, 14 May 2020 21:19:01 +0000 (UTC)
commit f47863b989408161b68ffeb21c22673f11ee6c4c
Author: Jean Felder <jfelder src gnome org>
Date: Fri Mar 13 23:12:35 2020 +0100
views: Define a title property
If a view has a defined title, it is visible in the main
GtkStackSwitcher. Only the SearchView and EmptyView are not visible.
gnomemusic/views/albumsview.py | 4 ++--
gnomemusic/views/artistsview.py | 5 +++--
gnomemusic/views/playlistsview.py | 5 +++--
gnomemusic/views/searchview.py | 4 ++--
gnomemusic/views/songsview.py | 5 +++--
gnomemusic/window.py | 4 ++--
6 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/gnomemusic/views/albumsview.py b/gnomemusic/views/albumsview.py
index 61be76e5..1a1018cc 100644
--- a/gnomemusic/views/albumsview.py
+++ b/gnomemusic/views/albumsview.py
@@ -43,6 +43,8 @@ class AlbumsView(Gtk.Stack):
search_mode_active = GObject.Property(type=bool, default=False)
selection_mode = GObject.Property(type=bool, default=False)
+ title = GObject.Property(
+ type=str, default=_("Albums"), flags=GObject.ParamFlags.READABLE)
_scrolled_window = Gtk.Template.Child()
_flowbox = Gtk.Template.Child()
@@ -55,9 +57,7 @@ class AlbumsView(Gtk.Stack):
"""
super().__init__(transition_type=Gtk.StackTransitionType.CROSSFADE)
- # FIXME: Make these properties.
self.props.name = "albums"
- self.title = _("Albums")
self._application = application
self._window = application.props.window
diff --git a/gnomemusic/views/artistsview.py b/gnomemusic/views/artistsview.py
index 213db18a..d81b1891 100644
--- a/gnomemusic/views/artistsview.py
+++ b/gnomemusic/views/artistsview.py
@@ -39,6 +39,9 @@ class ArtistsView(Gtk.Stack):
__gtype_name__ = "ArtistsView"
+ title = GObject.Property(
+ type=str, default=_("Artists"), flags=GObject.ParamFlags.READABLE)
+
_artist_container = Gtk.Template.Child()
_artist_view = Gtk.Template.Child()
_sidebar = Gtk.Template.Child()
@@ -51,9 +54,7 @@ class ArtistsView(Gtk.Stack):
"""
super().__init__(transition_type=Gtk.StackTransitionType.CROSSFADE)
- # FIXME: Make these properties.
self.props.name = "artists"
- self.title = _("Artists")
self._application = application
self._artists = {}
diff --git a/gnomemusic/views/playlistsview.py b/gnomemusic/views/playlistsview.py
index 6ff0115b..58906280 100644
--- a/gnomemusic/views/playlistsview.py
+++ b/gnomemusic/views/playlistsview.py
@@ -37,6 +37,9 @@ class PlaylistsView(Gtk.Stack):
__gtype_name__ = "PlaylistsView"
+ title = GObject.Property(
+ type=str, default=_("Playlists"), flags=GObject.ParamFlags.READABLE)
+
_main_container = Gtk.Template.Child()
_sidebar = Gtk.Template.Child()
@@ -47,9 +50,7 @@ class PlaylistsView(Gtk.Stack):
"""
super().__init__(transition_type=Gtk.StackTransitionType.CROSSFADE)
- # FIXME: Make these properties.
self.props.name = "playlists"
- self.title = _("Playlists")
self._coremodel = application.props.coremodel
self._model = self._coremodel.props.playlists_sort
diff --git a/gnomemusic/views/searchview.py b/gnomemusic/views/searchview.py
index 65505829..1b727e09 100644
--- a/gnomemusic/views/searchview.py
+++ b/gnomemusic/views/searchview.py
@@ -58,6 +58,8 @@ class SearchView(Gtk.Stack):
search_state = GObject.Property(type=int, default=Search.State.NONE)
selection_mode = GObject.Property(type=bool, default=False)
state = GObject.Property(type=int, default=State.MAIN)
+ title = GObject.Property(
+ type=str, default="", flags=GObject.ParamFlags.READABLE)
_album_header = Gtk.Template.Child()
_album_flowbox = Gtk.Template.Child()
@@ -79,9 +81,7 @@ class SearchView(Gtk.Stack):
"""
super().__init__(transition_type=Gtk.StackTransitionType.CROSSFADE)
- # FIXME: Make these properties.
self.props.name = "search"
- self.title = None
self._application = application
self._coremodel = application.props.coremodel
diff --git a/gnomemusic/views/songsview.py b/gnomemusic/views/songsview.py
index c74462a5..a16c7375 100644
--- a/gnomemusic/views/songsview.py
+++ b/gnomemusic/views/songsview.py
@@ -41,6 +41,9 @@ class SongsView(Gtk.Stack):
__gtype_name__ = "SongsView"
+ title = GObject.Property(
+ type=str, default=_("Songs"), flags=GObject.ParamFlags.READABLE)
+
_duration_renderer = Gtk.Template.Child()
_now_playing_column = Gtk.Template.Child()
_now_playing_cell = Gtk.Template.Child()
@@ -55,9 +58,7 @@ class SongsView(Gtk.Stack):
"""
super().__init__(transition_type=Gtk.StackTransitionType.CROSSFADE)
- # FIXME: Make these properties.
self.props.name = "songs"
- self.title = _("Songs")
self._window = application.props.window
self._coremodel = application.props.coremodel
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 84ea2f80..fde76cdf 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -259,8 +259,8 @@ class Window(Gtk.ApplicationWindow):
# empty view state is changed once album view is visible to prevent it
# from being displayed during startup
for i in self.views[View.ALBUM:]:
- if i.title:
- self._stack.add_titled(i, i.props.name, i.title)
+ if i.props.title:
+ self._stack.add_titled(i, i.props.name, i.props.title)
else:
self._stack.add_named(i, i.props.name)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]