Commit 6cd8c747 authored by Jean Felder's avatar Jean Felder
Browse files

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.
parent ad31ba0f
Pipeline #275210 passed with stages
in 11 minutes and 37 seconds
......@@ -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>
......
......@@ -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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment