[gnome-music/wip/mschraal/gtk4: 39/58] playlistcontrols: Cleanup & disable some event stuff



commit ec44aafe32df11ca7dce0fd7fcb2b158ee1061c5
Author: Marinus Schraal <mschraal gnome org>
Date:   Thu Oct 31 15:48:18 2019 +0100

    playlistcontrols: Cleanup & disable some event stuff

 data/ui/PlaylistControls.ui            | 114 +++++++++++++--------------------
 gnomemusic/widgets/playlistcontrols.py |  12 ++--
 2 files changed, 50 insertions(+), 76 deletions(-)
---
diff --git a/data/ui/PlaylistControls.ui b/data/ui/PlaylistControls.ui
index 4f4c0e3d..ac258581 100644
--- a/data/ui/PlaylistControls.ui
+++ b/data/ui/PlaylistControls.ui
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <!-- interface-requires gtk+ 3.12 -->
   <menu id="playlistMenu">
     <item>
       <attribute name="label" translatable="yes">_Play</attribute>
@@ -16,26 +15,21 @@
     </item>
   </menu>
   <object class="GtkImage" id="_view_more_image">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
     <property name="margin_top">1</property>
     <property name="icon_name">view-more-symbolic</property>
     <property name="icon_size">1</property>
   </object>
   <template class="PlaylistControls" parent="GtkGrid">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
     <property name="margin_start">18</property>
     <property name="margin_end">24</property>
     <property name="margin_top">18</property>
     <property name="margin_bottom">18</property>
     <child>
       <object class="GtkStack" id="_name_stack">
+        <property name="visible">0</property>
         <child>
           <object class="GtkLabel" id="_name_label">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="hexpand">True</property>
+            <property name="hexpand">1</property>
             <property name="xalign">0</property>
             <property name="label" translatable="yes">Playlist Name</property>
             <property name="ellipsize">middle</property>
@@ -45,95 +39,75 @@
           </object>
         </child>
         <child>
-          <object class="GtkBox">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="orientation">horizontal</property>
-            <style>
-              <class name="linked"/>
-            </style>
-            <child>
-              <object class="GtkEntry" id="_rename_entry">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="is_focus">True</property>
-                <property name="has_focus">True</property>
-                <property name="receives_default">True</property>
-                <signal name="activate" handler="_on_playlist_renamed" swapped="no"/>
-                <signal name="changed" handler="_on_rename_entry_changed" swapped="no"/>
-                <signal name="key-press-event" handler="_on_rename_entry_key_pressed" swapped="no"/>
-              </object>
-            </child>
-            <child>
-              <object class="GtkButton" id="_rename_done_button">
-                <property name="visible">True</property>
-                <property name="no_show_all">True</property>
-                <property name="can_focus">True</property>
-                <property name="has_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="label" translatable="yes">_Done</property>
-                <property name="use_underline">True</property>
-                <property name="valign">center</property>
-                <property name="sensitive">True</property>
-                <signal name="clicked" handler="_on_playlist_renamed" swapped="no" />
+          <object class="GtkStackPage">
+            <property name="name">renaming_dialog</property>
+            <property name="child">
+              <object class="GtkBox">
                 <style>
-                  <class name="suggested-action"/>
+                  <class name="linked"/>
                 </style>
+                <child>
+                  <object class="GtkEntry" id="_rename_entry">
+                    <property name="can_focus">1</property>
+                    <property name="is_focus">1</property>
+                    <property name="has_focus">1</property>
+                    <property name="receives_default">1</property>
+                    <signal name="activate" handler="_on_playlist_renamed" swapped="no"/>
+                    <signal name="changed" handler="_on_rename_entry_changed" swapped="no"/>
+<!--                    <signal name="key-press-event" handler="_on_rename_entry_key_pressed" swapped="no"/> 
 -->
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkButton" id="_rename_done_button">
+                    <property name="can_focus">1</property>
+                    <property name="has_focus">1</property>
+                    <property name="receives_default">1</property>
+                    <property name="label" translatable="yes">_Done</property>
+                    <property name="use_underline">1</property>
+                    <property name="valign">center</property>
+                    <signal name="clicked" handler="_on_playlist_renamed" swapped="no"/>
+                    <style>
+                      <class name="suggested-action"/>
+                    </style>
+                  </object>
+                </child>
               </object>
-            </child>
+            </property>
           </object>
-          <packing>
-            <property name="name">renaming_dialog</property>
-          </packing>
         </child>
       </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">0</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
-      </packing>
     </child>
     <child>
       <object class="GtkLabel" id="_songs_count_label">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
         <property name="xalign">0</property>
         <property name="label">3 Songs</property>
         <style>
           <class name="dim-label"/>
         </style>
+        <layout>
+          <property name="top_attach">1</property>
+        </layout>
       </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">1</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
-      </packing>
     </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="can_focus">1</property>
+        <property name="receives_default">1</property>
         <property name="halign">end</property>
         <property name="valign">center</property>
-        <property name="focus_on_click">False</property>
+        <property name="focus_on_click">0</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>
+<!--        <property name="image">_view_more_image</property>  -->
         <style>
           <class name="image-button"/>
           <class name="circular"/>
         </style>
+        <layout>
+          <property name="left_attach">1</property>
+          <property name="row-span">2</property>
+        </layout>
       </object>
-      <packing>
-        <property name="left_attach">1</property>
-        <property name="top_attach">0</property>
-        <property name="width">1</property>
-        <property name="height">2</property>
-      </packing>
     </child>
   </template>
 </interface>
diff --git a/gnomemusic/widgets/playlistcontrols.py b/gnomemusic/widgets/playlistcontrols.py
index 9a08a397..1fabb226 100644
--- a/gnomemusic/widgets/playlistcontrols.py
+++ b/gnomemusic/widgets/playlistcontrols.py
@@ -59,12 +59,12 @@ class PlaylistControls(Gtk.Grid):
         selection_length = selection.props.text_length
         self._rename_done_button.props.sensitive = selection_length > 0
 
-    @Gtk.Template.Callback()
-    @log
-    def _on_rename_entry_key_pressed(self, widget, event):
-        (_, keyval) = event.get_keyval()
-        if keyval == Gdk.KEY_Escape:
-            self.disable_rename_playlist()
+    # @Gtk.Template.Callback()
+    # @log
+    # def _on_rename_entry_key_pressed(self, widget, event):
+    #     (_, keyval) = event.get_keyval()
+    #     if keyval == Gdk.KEY_Escape:
+    #         self.disable_rename_playlist()
 
     @Gtk.Template.Callback()
     @log


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