[gnome-music/wip/jfelder/smartplaylists-ui-v2: 10/11] playlistsview: Hide the sidebar if there is no user playlist



commit 68cef4289f3ffc6f700d51f902942ab348c5cb51
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 | 3 +++
 2 files changed, 5 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 6a375b44..94cfcfcb 100644
--- a/gnomemusic/views/playlistsview.py
+++ b/gnomemusic/views/playlistsview.py
@@ -38,6 +38,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()
@@ -92,8 +93,10 @@ class PlaylistsView(Gtk.Stack):
             smart_row = self._smart_sidebar.get_row_at_index(0)
             self._smart_sidebar.select_row(smart_row)
             self._on_smart_playlist_activated(self._smart_sidebar, smart_row)
+            self._all_playlists_sidebar.props.visible = False
             return
 
+        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]