[gnome-music/wip/jfelder/notification-box] notificationspopup: Use a Box instead of a Grid as main container




commit 6cd8c7478457c4c9a9845dd0cbab071713fbf784
Author: Jean Felder <jfelder src gnome org>
Date:   Fri Apr 16 15:33:49 2021 +0200

    notificationspopup: Use a Box instead of a Grid as main container
    
    The container acts as a GtkGrid with a single column. It can directly
    be a GtkBox.

 data/ui/NotificationsPopup.ui            |  4 ++--
 gnomemusic/widgets/notificationspopup.py | 16 ++++++++--------
 2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/data/ui/NotificationsPopup.ui b/data/ui/NotificationsPopup.ui
index 470416a22..5215c413c 100644
--- a/data/ui/NotificationsPopup.ui
+++ b/data/ui/NotificationsPopup.ui
@@ -8,10 +8,10 @@
       <object class="GtkFrame">
         <property name="visible">True</property>
         <child>
-          <object class="GtkGrid" id="_grid">
+          <object class="GtkBox" id="_box">
             <property name="visible">True</property>
             <property name="orientation">vertical</property>
-            <property name="row_spacing">6</property>
+            <property name="spacing">6</property>
           </object>
         </child>
         <style>
diff --git a/gnomemusic/widgets/notificationspopup.py b/gnomemusic/widgets/notificationspopup.py
index 4095621c6..5d78f98e9 100644
--- a/gnomemusic/widgets/notificationspopup.py
+++ b/gnomemusic/widgets/notificationspopup.py
@@ -39,7 +39,7 @@ class NotificationsPopup(Gtk.Revealer):
 
     __gtype_name__ = "NotificationsPopup"
 
-    _grid = Gtk.Template.Child()
+    _box = Gtk.Template.Child()
 
     def __init__(self):
         super().__init__()
@@ -47,11 +47,11 @@ class NotificationsPopup(Gtk.Revealer):
         self._loading_notification = LoadingNotification()
         self._loading_notification.connect('visible', self._set_visibility)
         self._loading_notification.connect('invisible', self._set_visibility)
-        self._grid.add(self._loading_notification)
+        self._box.add(self._loading_notification)
 
     def _hide_notifications(self, notification, remove):
         if remove:
-            self._grid.remove(notification)
+            self._box.remove(notification)
         self._loading_notification.hide()
         self.hide()
 
@@ -62,14 +62,14 @@ class NotificationsPopup(Gtk.Revealer):
         deletion is in progress.
         """
         loading_finished = self._loading_notification._counter == 0
-        no_other_notif = (len(self._grid.get_children()) == 1
-                          or (len(self._grid.get_children()) == 2
+        no_other_notif = (len(self._box.get_children()) == 1
+                          or (len(self._box.get_children()) == 2
                               and notification != self._loading_notification))
         invisible = loading_finished and no_other_notif
 
         if not invisible:
             if remove:
-                self._grid.remove(notification)
+                self._box.remove(notification)
             self.show()
         else:
             # notification has to be removed from grid once unreveal is
@@ -98,7 +98,7 @@ class NotificationsPopup(Gtk.Revealer):
 
         :param notification: notification to display
         """
-        self._grid.add(notification)
+        self._box.add(notification)
         self.show()
         self.set_reveal_child(True)
 
@@ -111,7 +111,7 @@ class NotificationsPopup(Gtk.Revealer):
 
     def terminate_pending(self):
         """Terminate all pending playlists notifications"""
-        children = self._grid.get_children()
+        children = self._box.get_children()
         if len(children) > 1:
             for notification in children[:-1]:
                 notification._finish_deletion()


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