[gnome-music/wip/jfelder/smartplaylists-ui-v2: 10/12] playlistsview: Hide the sidebar if there is no user playlist
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/smartplaylists-ui-v2: 10/12] playlistsview: Hide the sidebar if there is no user playlist
- Date: Wed, 22 Jan 2020 00:01:25 +0000 (UTC)
commit bbbdfea9ea502c3fe926fefdcb2c670dfae24d30
Author: Jean Felder <jfelder src gnome org>
Date: Mon Jan 20 16:58:37 2020 +0100
playlistsview: Hide the sidebar if there is no user playlist
data/ui/PlaylistsView.ui | 4 ++--
gnomemusic/views/playlistsview.py | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/data/ui/PlaylistsView.ui b/data/ui/PlaylistsView.ui
index 58294101..1eb89877 100644
--- a/data/ui/PlaylistsView.ui
+++ b/data/ui/PlaylistsView.ui
@@ -7,8 +7,8 @@
<object class="GtkBox" id="_main_container">
<property name="visible">True</property>
<child>
- <object class="GtkScrolledWindow" id="all_playlists">
- <property name="visible">True</property>
+ <object class="GtkScrolledWindow" id="_all_playlists_sidebar">
+ <property name="visible">False</property>
<property name="width-request">220</property>
<style>
<class name="sidebar"/>
diff --git a/gnomemusic/views/playlistsview.py b/gnomemusic/views/playlistsview.py
index 0b4d9459..f3c1d345 100644
--- a/gnomemusic/views/playlistsview.py
+++ b/gnomemusic/views/playlistsview.py
@@ -39,6 +39,7 @@ class PlaylistsView(Gtk.Stack):
__gtype_name__ = "PlaylistsView"
+ _all_playlists_sidebar = Gtk.Template.Child()
_main_container = Gtk.Template.Child()
_smart_sidebar = Gtk.Template.Child()
_user_sidebar = Gtk.Template.Child()
@@ -93,6 +94,8 @@ class PlaylistsView(Gtk.Stack):
self._coremodel.disconnect(self._loaded_id)
self._users_playlists_model.connect(
"items-changed", self._on_user_playlists_model_changed)
+ self._on_user_playlists_model_changed(
+ self._users_playlists_model, 0, 0, 0)
smart_row = self._smart_sidebar.get_row_at_index(0)
self._smart_sidebar.select_row(smart_row)
@@ -100,6 +103,7 @@ class PlaylistsView(Gtk.Stack):
def _on_user_playlists_model_changed(
self, model, position, removed, added):
+ self._all_playlists_sidebar.props.visible = (model.get_n_items() > 0)
if removed == 0:
return
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]