[gnome-music] Stop using show_all



commit ad0e9a9fecb7e9cf8fe16e535e2a339bb7aa2b94
Author: Erik Inkinen <erik inkinen gmail com>
Date:   Sun Mar 15 11:13:27 2020 +0200

    Stop using show_all
    
    Currently, the application uses show_all function, but it will not be
    supported in GTK4. To fix the situation, replace show_all with the
    visible property.
    
    Closes: #320

 data/ui/EmptyView.ui                     | 2 ++
 gnomemusic/views/artistsview.py          | 7 +++++--
 gnomemusic/views/baseview.py             | 5 ++++-
 gnomemusic/views/emptyview.py            | 1 -
 gnomemusic/views/songsview.py            | 3 +++
 gnomemusic/widgets/artistalbumswidget.py | 2 +-
 gnomemusic/widgets/artistartstack.py     | 6 +++++-
 gnomemusic/widgets/coverstack.py         | 6 +++++-
 gnomemusic/widgets/notificationspopup.py | 4 +---
 gnomemusic/widgets/songwidget.py         | 2 +-
 gnomemusic/widgets/starimage.py          | 2 +-
 gnomemusic/window.py                     | 2 +-
 12 files changed, 29 insertions(+), 13 deletions(-)
---
diff --git a/data/ui/EmptyView.ui b/data/ui/EmptyView.ui
index 66f71f54..cc7ae76c 100644
--- a/data/ui/EmptyView.ui
+++ b/data/ui/EmptyView.ui
@@ -3,6 +3,7 @@
   <!-- interface-requires gtk+ 3.0 -->
   <template class="EmptyView" parent="GtkStack">
     <property name="transition_type">crossfade</property>
+    <property name="visible">True</property>
     <child>
       <object class="GtkBox" id="_container">
         <property name="visible">True</property>
@@ -32,6 +33,7 @@
         <child>
           <object class="GtkBox" id="box">
             <property name="orientation">vertical</property>
+                <property name="visible">True</property>
             <child>
               <object class="GtkLabel" id="_main_label">
                 <property name="visible">True</property>
diff --git a/gnomemusic/views/artistsview.py b/gnomemusic/views/artistsview.py
index 18212c13..d56a4384 100644
--- a/gnomemusic/views/artistsview.py
+++ b/gnomemusic/views/artistsview.py
@@ -43,8 +43,10 @@ class ArtistsView(BaseView):
         :param GtkApplication application: The application object
         """
         self._sidebar = Gtk.ListBox()
+        self._sidebar.props.visible = True
         sidebar_container = Gtk.ScrolledWindow()
         sidebar_container.add(self._sidebar)
+        sidebar_container.props.visible = True
 
         super().__init__(
             'artists', _("Artists"), application, sidebar_container)
@@ -74,8 +76,6 @@ class ArtistsView(BaseView):
         self._sidebar.props.selection_mode = Gtk.SelectionMode.SINGLE
         self._sidebar.connect('row-activated', self._on_artist_activated)
 
-        self.show_all()
-
     def _create_widget(self, coreartist):
         row = ArtistTile(coreartist)
         row.props.text = coreartist.props.artist
@@ -128,6 +128,9 @@ class ArtistsView(BaseView):
             vhomogeneous=False)
         self._view_container.add(self._view)
 
+        self._view.props.visible = True
+        self._view_container.props.visible = True
+
     def _on_artist_activated(self, sidebar, row, data=None, untouched=False):
         """Initializes new artist album widgets"""
         # On application start the first row of ArtistView is activated
diff --git a/gnomemusic/views/baseview.py b/gnomemusic/views/baseview.py
index 4b0ad0cc..a96a7727 100644
--- a/gnomemusic/views/baseview.py
+++ b/gnomemusic/views/baseview.py
@@ -57,7 +57,10 @@ class BaseView(Gtk.Stack):
         self.title = title
 
         self.add(self._grid)
-        self.show_all()
+
+        self._grid.props.visible = True
+        self._box.props.visible = True
+        self.props.visible = True
 
         self.bind_property(
             "selection-mode", self._window, "selection-mode",
diff --git a/gnomemusic/views/emptyview.py b/gnomemusic/views/emptyview.py
index 2736f085..b7efcd2a 100644
--- a/gnomemusic/views/emptyview.py
+++ b/gnomemusic/views/emptyview.py
@@ -106,7 +106,6 @@ class EmptyView(Gtk.Stack):
             self._set_no_tracker_state()
         elif self._state == EmptyView.State.TRACKER_OUTDATED:
             self._set_tracker_outdated_state()
-        self.show_all()
 
     def _set_initial_state(self):
         self._information_label.props.label = self._content_text
diff --git a/gnomemusic/views/songsview.py b/gnomemusic/views/songsview.py
index d76cd0e1..38013dc1 100644
--- a/gnomemusic/views/songsview.py
+++ b/gnomemusic/views/songsview.py
@@ -80,6 +80,9 @@ class SongsView(BaseView):
 
         view_container.add(self._view)
 
+        self._view.props.visible = True
+        view_container.props.visible = True
+
     def _add_list_renderers(self):
         now_playing_symbol_renderer = Gtk.CellRendererPixbuf(
             xpad=0, xalign=0.5, yalign=0.5)
diff --git a/gnomemusic/widgets/artistalbumswidget.py b/gnomemusic/widgets/artistalbumswidget.py
index f682465a..87045b5e 100644
--- a/gnomemusic/widgets/artistalbumswidget.py
+++ b/gnomemusic/widgets/artistalbumswidget.py
@@ -61,7 +61,7 @@ class ArtistAlbumsWidget(Gtk.ListBox):
         self.bind_model(self._model, self._add_album)
 
         self.get_style_context().add_class("artist-albums-widget")
-        self.show_all()
+        self.props.visible = True
 
     def _song_activated(self, widget, song_widget):
         self._album = None
diff --git a/gnomemusic/widgets/artistartstack.py b/gnomemusic/widgets/artistartstack.py
index b86d0ef8..5cf3bb9a 100644
--- a/gnomemusic/widgets/artistartstack.py
+++ b/gnomemusic/widgets/artistartstack.py
@@ -67,7 +67,11 @@ class ArtistArtStack(Gtk.Stack):
         self.props.transition_type = Gtk.StackTransitionType.CROSSFADE
         self.props.visible_child_name = "loading"
 
-        self.show_all()
+        self._loading_cover.props.visible = True
+        self._cover_a.props.visible = True
+        self._cover_b.props.visible = True
+
+        self.props.visible = True
 
     @GObject.Property(type=object, flags=GObject.ParamFlags.READWRITE)
     def size(self):
diff --git a/gnomemusic/widgets/coverstack.py b/gnomemusic/widgets/coverstack.py
index 91a127a6..1e97e489 100644
--- a/gnomemusic/widgets/coverstack.py
+++ b/gnomemusic/widgets/coverstack.py
@@ -65,7 +65,11 @@ class CoverStack(Gtk.Stack):
 
         self.connect("destroy", self._on_destroy)
 
-        self.show_all()
+        self._loading_cover.props.visible = True
+        self._cover_a.props.visible = True
+        self._cover_b.props.visible = True
+
+        self.props.visible = True
 
     @GObject.Property(type=object, flags=GObject.ParamFlags.READWRITE)
     def size(self):
diff --git a/gnomemusic/widgets/notificationspopup.py b/gnomemusic/widgets/notificationspopup.py
index 1827153f..a7774d97 100644
--- a/gnomemusic/widgets/notificationspopup.py
+++ b/gnomemusic/widgets/notificationspopup.py
@@ -49,8 +49,6 @@ class NotificationsPopup(Gtk.Revealer):
         self._loading_notification.connect('invisible', self._set_visibility)
         self._grid.add(self._loading_notification)
 
-        self._loading_notification.hide()
-
     def _hide_notifications(self, notification, remove):
         if remove:
             self._grid.remove(notification)
@@ -154,7 +152,7 @@ class LoadingNotification(Gtk.Grid):
     def push(self):
         """Increase the counter. Start notification if necessary."""
         def callback():
-            self.show_all()
+            self.props.visible = True
             self.emit('visible')
 
         if self._counter == 0:
diff --git a/gnomemusic/widgets/songwidget.py b/gnomemusic/widgets/songwidget.py
index cd0fbe97..c022fff1 100644
--- a/gnomemusic/widgets/songwidget.py
+++ b/gnomemusic/widgets/songwidget.py
@@ -184,7 +184,7 @@ class SongWidget(Gtk.EventBox):
         drag_row = SongWidget(self.props.coresong)
         self._drag_widget.add(drag_row)
         self._drag_widget.drag_highlight_row(drag_row.get_parent())
-        self._drag_widget.show_all()
+        self._drag_widget.props.visible = True
         Gtk.drag_set_icon_widget(context, self._drag_widget, x, y)
 
     @Gtk.Template.Callback()
diff --git a/gnomemusic/widgets/starimage.py b/gnomemusic/widgets/starimage.py
index 0bfd7f5f..032bf6e3 100644
--- a/gnomemusic/widgets/starimage.py
+++ b/gnomemusic/widgets/starimage.py
@@ -36,7 +36,7 @@ class StarImage(Gtk.Image):
         self._hover = False
 
         self.get_style_context().add_class("star")
-        self.show_all()
+        self.props.visible = True
 
     @GObject.Property(type=bool, default=False)
     def favorite(self):
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index bcdae2f8..66150f48 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -176,7 +176,7 @@ class Window(Gtk.ApplicationWindow):
         self._search.connect("notify::state", self._on_search_state_changed)
 
         self._headerbar.props.state = HeaderBar.State.MAIN
-        self._headerbar_stack.show_all()
+        self._headerbar_stack.props.visible = True
 
         self._app.props.coremodel.connect(
             "notify::songs-available", self._on_songs_available)


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