[gnome-music/wip/jfelder/playlist-improvements: 4/5] playlistcontrols: Add a play button




commit b2bcc1595586c79b99ff38f63435eeb9adf41d75
Author: Jean Felder <jfelder src gnome org>
Date:   Thu Jan 28 02:58:57 2021 +0100

    playlistcontrols: Add a play button
    
    Related: #446

 data/ui/PlaylistControls.ui            | 59 +++++++++++++++++++++++++---------
 gnomemusic/widgets/playlistcontrols.py |  4 +++
 2 files changed, 48 insertions(+), 15 deletions(-)
---
diff --git a/data/ui/PlaylistControls.ui b/data/ui/PlaylistControls.ui
index 49a3b471f..a32c8b176 100644
--- a/data/ui/PlaylistControls.ui
+++ b/data/ui/PlaylistControls.ui
@@ -22,6 +22,13 @@
     <property name="icon_name">view-more-symbolic</property>
     <property name="icon_size">1</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">1</property>
+  </object>
   <template class="PlaylistControls" parent="GtkBox">
     <property name="orientation">vertical</property>
     <property name="visible">True</property>
@@ -101,23 +108,45 @@
       </object>
     </child>
     <child>
-      <object class="GtkMenuButton" id="_menubutton">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-        <property name="halign">start</property>
-        <property name="valign">center</property>
-        <property name="focus_on_click">False</property>
-        <property name="menu-model">playlistMenu</property>
-        <property name="direction">none</property>
-        <property name="use_popover">True</property>
-        <property name="image">_view_more_image</property>
+      <object class="GtkBox">
+       <property name="orientation">horizontal</property>
+       <property name="visible">True</property>
+       <property name="spacing">12</property>
        <property name="margin_top">18</property>
        <property name="margin_bottom">8</property>
-        <style>
-          <class name="image-button"/>
-          <class name="circular"/>
-        </style>
+       <child>
+         <object class="GtkButton">
+            <property name="visible">True</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="tooltip_text" translatable="yes">Play</property>
+           <property name="valign">center</property>
+            <signal name="clicked" handler="_on_play_button_clicked" swapped="no"/>
+           <style>
+              <class name="circular"/>
+            </style>
+         </object>
+       </child>
+       <child>
+         <object class="GtkMenuButton" id="_menubutton">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="halign">start</property>
+            <property name="valign">center</property>
+            <property name="focus_on_click">False</property>
+            <property name="menu-model">playlistMenu</property>
+            <property name="direction">none</property>
+            <property name="use_popover">True</property>
+            <property name="image">_view_more_image</property>
+            <style>
+              <class name="image-button"/>
+              <class name="circular"/>
+            </style>
+         </object>
+       </child>
       </object>
     </child>
   </template>
diff --git a/gnomemusic/widgets/playlistcontrols.py b/gnomemusic/widgets/playlistcontrols.py
index 359d8f3a3..1d6137de4 100644
--- a/gnomemusic/widgets/playlistcontrols.py
+++ b/gnomemusic/widgets/playlistcontrols.py
@@ -101,6 +101,10 @@ class PlaylistControls(Gtk.Box):
             self._window.notifications_popup, self._application,
             PlaylistNotification.Type.PLAYLIST, self.props.playlist)
 
+    @Gtk.Template.Callback()
+    def _on_play_button_clicked(self, button: Gtk.Button) -> None:
+        self._play_action.activate()
+
     @Gtk.Template.Callback()
     def _on_rename_entry_changed(self, selection):
         selection_length = selection.props.text_length


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