[gnome-music/wip/jfelder/gtk4-v3: 203/208] headerbar: Handle empty subtitle




commit c3dedee083b8dc0809ffd6a26aa08ad2c9bbe1a2
Author: Jean Felder <jfelder src gnome org>
Date:   Fri Feb 11 09:48:01 2022 +0100

    headerbar: Handle empty subtitle

 gnomemusic/widgets/headerbar.py | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/gnomemusic/widgets/headerbar.py b/gnomemusic/widgets/headerbar.py
index 5740f7953..19dd6a96f 100644
--- a/gnomemusic/widgets/headerbar.py
+++ b/gnomemusic/widgets/headerbar.py
@@ -219,6 +219,12 @@ class HeaderBar(Adw.Bin):
         self._headerbar.props.title_widget = self._label_title_box
         self._label_title.props.label = title
         self._label_subtitle.props.label = subtitle
+        if not subtitle:
+            self._label_title.props.valign = Gtk.Align.CENTER
+            self._label_subtitle.props.visible = False
+        else:
+            self._label_title.props.valign = Gtk.Align.FILL
+            self._label_subtitle.props.visible = True
 
     @Gtk.Template.Callback()
     def _on_back_button_clicked(self, widget=None):


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