[gnome-music/wip/jfelder/gtk4-v3: 93/108] artistsearchtile: Cleanup and fixes




commit 6ffbca2d5fff3ad3eacf9fa25b2c49d77add7c3b
Author: Marinus Schraal <mschraal gnome org>
Date:   Thu Feb 10 14:53:14 2022 +0100

    artistsearchtile: Cleanup and fixes

 data/ui/ArtistSearchTile.ui            | 21 ++++-----------------
 gnomemusic/widgets/artistsearchtile.py |  9 +++------
 2 files changed, 7 insertions(+), 23 deletions(-)
---
diff --git a/data/ui/ArtistSearchTile.ui b/data/ui/ArtistSearchTile.ui
index fb282e8f2..ac9896af4 100644
--- a/data/ui/ArtistSearchTile.ui
+++ b/data/ui/ArtistSearchTile.ui
@@ -1,25 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <requires lib="gtk+" version="3.18"/>
   <template class="ArtistSearchTile" parent="GtkFlowBoxChild">
     <child>
       <object class="GtkBox">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
         <property name="has_tooltip">True</property>
         <property name="valign">start</property>
         <property name="orientation">vertical</property>
         <signal name="query-tooltip" handler="_on_tooltip_query" swapped="no"/>
         <child>
           <object class="GtkOverlay">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <property name="margin-bottom">4</property>
             <child>
               <object class="GtkBox">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <signal name="button-release-event" handler="_on_artist_event" swapped="no"/>
                 <child>
                   <object class="GtkGestureClick">
                     <signal name="released" handler="_on_artist_event" swapped="no"/>
@@ -27,30 +19,25 @@
                 </child>
                 <child>
                   <object class="ArtStack" id="_art_stack">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="vexpand">True</property>
-                    <property name="valign">end</property>
-                    <property name="halign">center</property>
+                    <property name="hexpand">True</property>
                   </object>
                 </child>
               </object>
             </child>
             <child type="overlay">
               <object class="GtkCheckButton" id="_check">
-                <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
                 <property name="halign">end</property>
                 <property name="valign">end</property>
-                <property name="draw_indicator">True</property>
+                <style>
+                  <class name="selection-mode"/>
+                </style>
               </object>
             </child>
           </object>
         </child>
         <child>
           <object class="GtkLabel" id="_artist_label">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <property name="justify">center</property>
             <property name="wrap">True</property>
             <property name="ellipsize">middle</property>
diff --git a/gnomemusic/widgets/artistsearchtile.py b/gnomemusic/widgets/artistsearchtile.py
index 926a9adc3..5706e6f4f 100644
--- a/gnomemusic/widgets/artistsearchtile.py
+++ b/gnomemusic/widgets/artistsearchtile.py
@@ -83,14 +83,11 @@ class ArtistSearchTile(Gtk.FlowBoxChild):
             "selection-mode", self._check, "visible",
             GObject.BindingFlags.BIDIRECTIONAL)
 
-        # self._events.add_events(Gdk.EventMask.TOUCH_MASK)
-
-        self.show()
-
     @Gtk.Template.Callback()
-    def _on_artist_event(self, evbox, event, data=None):
+    def _on_artist_event(self, gesture_click, n_press, x, y):
+        state = gesture_click.get_current_event_state()
         modifiers = Gtk.accelerator_get_default_mod_mask()
-        if ((event.get_state() & modifiers) == Gdk.ModifierType.CONTROL_MASK
+        if (state & modifiers == Gdk.ModifierType.CONTROL_MASK
                 and not self.props.selection_mode):
             self.props.selection_mode = True
 


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