[gnome-music/wip/mschraal/gtk4: 71/81] playertoolbar: Fix playback images



commit 15f0703717e3db9909f8cd374f78370edeb4a149
Author: Marinus Schraal <mschraal gnome org>
Date:   Thu Oct 31 17:38:29 2019 +0100

    playertoolbar: Fix playback images

 data/ui/PlayerToolbar.ui            | 26 +++-----------------------
 gnomemusic/widgets/playertoolbar.py | 10 ++++------
 2 files changed, 7 insertions(+), 29 deletions(-)
---
diff --git a/data/ui/PlayerToolbar.ui b/data/ui/PlayerToolbar.ui
index 094f9218..accc5228 100644
--- a/data/ui/PlayerToolbar.ui
+++ b/data/ui/PlayerToolbar.ui
@@ -23,26 +23,6 @@
       <attribute name="target">none</attribute>
     </item>
   </menu>
-  <object class="GtkImage" id="next_image">
-    <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="margin_top">1</property>
-    <property name="icon_name">media-playback-pause-symbolic</property>
-    <property name="icon_size">1</property>
-  </object>
-  <object class="GtkImage" id="_play_image">
-    <property name="margin_top">1</property>
-    <property name="icon_name">media-playback-start-symbolic</property>
-    <property name="icon_size">1</property>
-  </object>
-  <object class="GtkImage" id="previous_image">
-    <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">
     <child>
       <object class="GtkBox" id="buttons">
@@ -52,7 +32,7 @@
             <property name="sensitive">0</property>
             <property name="can_focus">1</property>
             <property name="receives_default">1</property>
-<!--            <property name="image">previous_image</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"/>
           </object>
@@ -63,7 +43,7 @@
             <property name="sensitive">0</property>
             <property name="can_focus">1</property>
             <property name="receives_default">1</property>
-<!--            <property name="image">_play_image</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"/>
           </object>
@@ -74,7 +54,7 @@
             <property name="sensitive">0</property>
             <property name="can_focus">1</property>
             <property name="receives_default">1</property>
-<!--            <property name="image">next_image</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"/>
           </object>
diff --git a/gnomemusic/widgets/playertoolbar.py b/gnomemusic/widgets/playertoolbar.py
index 6e531b80..c0a7e8eb 100644
--- a/gnomemusic/widgets/playertoolbar.py
+++ b/gnomemusic/widgets/playertoolbar.py
@@ -47,9 +47,7 @@ class PlayerToolbar(Gtk.ActionBar):
     _cover_stack = 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()
@@ -140,14 +138,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]