[gnome-music/wip/jfelder/new-playertoolbar: 12/14] playertoolbar: Center the button controls and the progress scale
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/new-playertoolbar: 12/14] playertoolbar: Center the button controls and the progress scale
- Date: Tue, 4 May 2021 14:18:17 +0000 (UTC)
commit f394a430b3b3e0d490a7b006863dacd4a18a7da3
Author: Jean Felder <jfelder src gnome org>
Date: Thu Jan 28 16:51:18 2021 +0100
playertoolbar: Center the button controls and the progress scale
data/ui/PlayerToolbar.ui | 7 +++++--
gnomemusic/widgets/playertoolbar.py | 8 ++++++++
2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/data/ui/PlayerToolbar.ui b/data/ui/PlayerToolbar.ui
index e3f735cdf..8813affae 100644
--- a/data/ui/PlayerToolbar.ui
+++ b/data/ui/PlayerToolbar.ui
@@ -110,8 +110,8 @@
</child>
</object>
</child>
- <child>
- <object class="GtkBox" id="buttons_and_scale">
+ <child type="center">
+ <object class="GtkBox" id="_buttons_and_scale">
<property name="orientation">vertical</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -260,6 +260,9 @@
</object>
</child>
</object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
</child>
</template>
</interface>
diff --git a/gnomemusic/widgets/playertoolbar.py b/gnomemusic/widgets/playertoolbar.py
index 87d7106a4..79171d4fd 100644
--- a/gnomemusic/widgets/playertoolbar.py
+++ b/gnomemusic/widgets/playertoolbar.py
@@ -44,6 +44,7 @@ class PlayerToolbar(Gtk.ActionBar):
_artist_label = Gtk.Template.Child()
_art_stack = Gtk.Template.Child()
+ _buttons_and_scale = Gtk.Template.Child()
_duration_label = Gtk.Template.Child()
_next_button = Gtk.Template.Child()
_pause_image = Gtk.Template.Child()
@@ -72,6 +73,13 @@ class PlayerToolbar(Gtk.ActionBar):
self._tooltip = TwoLineTip()
+ # A centered widget has an expand child property set to False
+ # by default. It needs to be True to have a progress scale
+ # at the correct size.
+ main_container = self._buttons_and_scale.get_parent()
+ main_container.child_set_property(
+ self._buttons_and_scale, "expand", True)
+
# FIXME: This is a workaround for not being able to pass the player
# object via init when using Gtk.Builder.
@GObject.Property(type=Player, default=None)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]