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



commit a3347184257cef5bb05a1f4742ecaa0536597eb4
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            | 112 +++++++++++++--------------------
 gnomemusic/widgets/playlistcontrols.py |  12 ++--
 2 files changed, 49 insertions(+), 75 deletions(-)
---
diff --git a/data/ui/PlaylistControls.ui b/data/ui/PlaylistControls.ui
index 0c52d1b8..33584e6f 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,15 +15,11 @@
     </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>
@@ -34,9 +29,7 @@
         <property name="visible">True</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>
@@ -46,94 +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="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 c406c18f..f2f993d5 100644
--- a/gnomemusic/widgets/playlistcontrols.py
+++ b/gnomemusic/widgets/playlistcontrols.py
@@ -24,7 +24,7 @@
 
 import gettext
 
-from gi.repository import Gdk, GObject, Gio, Gtk
+from gi.repository import GObject, Gio, Gtk
 
 from gnomemusic.grilowrappers.grltrackerplaylists import Playlist
 from gnomemusic.widgets.notificationspopup import PlaylistNotification
@@ -106,11 +106,11 @@ class PlaylistControls(Gtk.Grid):
         selection_length = selection.props.text_length
         self._rename_done_button.props.sensitive = selection_length > 0
 
-    @Gtk.Template.Callback()
-    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()
+    # 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()
     def _on_playlist_renamed(self, widget):


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