[gnome-music/wip/mschraal/gtk4-v2: 50/89] Adapt PlayerToolbar to GTK4 changes
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/gtk4-v2: 50/89] Adapt PlayerToolbar to GTK4 changes
- Date: Mon, 10 May 2021 10:39:01 +0000 (UTC)
commit e14db8f4c46ee9f21b1c13f3ad6fbcc2838072bf
Author: Marinus Schraal <mschraal gnome org>
Date: Sun Apr 11 21:10:39 2021 +0200
Adapt PlayerToolbar to GTK4 changes
data/ui/PlayerToolbar.ui | 43 +++++--------------------------------
gnomemusic/widgets/playertoolbar.py | 12 +++++------
2 files changed, 10 insertions(+), 45 deletions(-)
---
diff --git a/data/ui/PlayerToolbar.ui b/data/ui/PlayerToolbar.ui
index 7e2f58e8e..8c5ddf450 100644
--- a/data/ui/PlayerToolbar.ui
+++ b/data/ui/PlayerToolbar.ui
@@ -23,34 +23,6 @@
<attribute name="target">none</attribute>
</item>
</menu>
- <object class="GtkImage" id="next_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin-top">1</property>
- <property name="icon_name">media-skip-forward-symbolic</property>
- <property name="icon_size">1</property>
- </object>
- <object class="GtkImage" id="_pause_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin-top">1</property>
- <property name="icon_name">media-playback-pause-symbolic</property>
- <property name="icon_size">5</property>
- </object>
- <object class="GtkImage" id="_play_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin-top">1</property>
- <property name="icon_name">media-playback-start-symbolic</property>
- <property name="icon_size">5</property>
- </object>
- <object class="GtkImage" id="previous_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin-top">1</property>
- <property name="icon_name">media-skip-backward-symbolic</property>
- <property name="icon_size">1</property>
- </object>
<template class="PlayerToolbar" parent="GtkActionBar">
<property name="can_focus">False</property>
<child>
@@ -112,6 +84,7 @@
</child>
<child type="center">
<object class="GtkBox" id="_buttons_and_scale">
+ <property name="hexpand">True</property>
<property name="orientation">vertical</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -128,8 +101,7 @@
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="image">previous_image</property>
- <property name="always_show_image">True</property>
+ <property name="icon_name">media-skip-backward-symbolic</property>
<property name="tooltip_text" translatable="yes">Previous</property>
<signal name="clicked" handler="_on_prev_button_clicked" swapped="no"/>
<style>
@@ -145,8 +117,7 @@
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="image">_play_image</property>
- <property name="always_show_image">True</property>
+ <property name="icon_name">media-playback-start-symbolic</property>
<property name="tooltip_text" translatable="yes">Play</property>
<signal name="clicked" handler="_on_play_button_clicked" swapped="no"/>
<style>
@@ -162,8 +133,7 @@
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="image">next_image</property>
- <property name="always_show_image">True</property>
+ <property name="icon_name">media-skip-forward-symbolic</property>
<property name="tooltip_text" translatable="yes">Next</property>
<signal name="clicked" handler="_on_next_button_clicked" swapped="no"/>
<style>
@@ -224,7 +194,7 @@
</child>
</object>
</child>
- <child>
+ <child type="end">
<object class="GtkBox" id="menuBox">
<property name="height_request">34</property>
<property name="visible">True</property>
@@ -264,9 +234,6 @@
</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 79171d4fd..a4b905ec2 100644
--- a/gnomemusic/widgets/playertoolbar.py
+++ b/gnomemusic/widgets/playertoolbar.py
@@ -47,9 +47,7 @@ class PlayerToolbar(Gtk.ActionBar):
_buttons_and_scale = Gtk.Template.Child()
_duration_label = Gtk.Template.Child()
_next_button = Gtk.Template.Child()
- _pause_image = Gtk.Template.Child()
_play_button = Gtk.Template.Child()
- _play_image = Gtk.Template.Child()
_prev_button = Gtk.Template.Child()
_progress_scale = Gtk.Template.Child()
_progress_time_label = Gtk.Template.Child()
@@ -135,7 +133,7 @@ class PlayerToolbar(Gtk.ActionBar):
def _sync_repeat_image(self):
icon = self._repeat_dict[self._player.props.repeat_mode]
- self._repeat_image.set_from_icon_name(icon, Gtk.IconSize.MENU)
+ self._repeat_image.set_from_icon_name(icon)
def _sync_playing(self, player, state):
if (self._player.props.state == Playback.STOPPED
@@ -147,14 +145,14 @@ class PlayerToolbar(Gtk.ActionBar):
self.show()
if self._player.props.state == Playback.PLAYING:
- image = self._pause_image
+ icon_name = "media-playback-pause-symbolic"
tooltip = _("Pause")
else:
- image = self._play_image
+ icon_name = "media-playback-start-symbolic"
tooltip = _("Play")
- if self._play_button.get_image() != image:
- self._play_button.set_image(image)
+ if self._play_button.props.icon_name != icon_name:
+ self._play_button.props.icon_name = icon_name
self._play_button.set_tooltip_text(tooltip)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]