[gnome-contacts] contacts-list: don't show checkbox on hovering



commit ec6c52706e1882d897463517e1b5cf9cc3c67c4f
Author: Lorenz Wildberg <lorenz wild-fisch de>
Date:   Mon Aug 9 12:35:19 2021 +0200

    contacts-list: don't show checkbox on hovering
    
    You can select an item trough right-click or holding on touchscreens.
    In the mockup is nothing like this showed too.

 src/contacts-contact-list.vala | 22 +---------------------
 1 file changed, 1 insertion(+), 21 deletions(-)
---
diff --git a/src/contacts-contact-list.vala b/src/contacts-contact-list.vala
index 816784d0..266545d8 100644
--- a/src/contacts-contact-list.vala
+++ b/src/contacts-contact-list.vala
@@ -30,8 +30,6 @@ public class Contacts.ContactList : Gtk.ListBox {
     private Gtk.Label label;
     private Avatar avatar;
     public Gtk.CheckButton selector_button;
-    // Whether the selector should always be visible (or only on hover)
-    private bool checkbox_exposed = false;
 
     public ContactDataRow(Individual i) {
       this.individual = i;
@@ -72,24 +70,6 @@ public class Contacts.ContactList : Gtk.ListBox {
       this.label.set_text (this.individual.display_name);
       changed ();
     }
-
-    // Sets whether the checbox should always be shown (and not only on hover)
-    public void expose_checkbox (bool expose) {
-      this.checkbox_exposed = expose;
-
-      var hovering = Gtk.StateFlags.PRELIGHT in get_state_flags ();
-      this.selector_button.visible = expose || hovering;
-    }
-
-    // Normally, we would use the (enter/leave)_notify_event here, but since ListBoxRow
-    // doesn't have its own Gdk.Window, this won't work (at least in GTK+3).
-    public override void state_flags_changed (Gtk.StateFlags previous_state) {
-      var hovering_now = Gtk.StateFlags.PRELIGHT in get_state_flags ();
-      var was_hovering = Gtk.StateFlags.PRELIGHT in previous_state;
-
-      if (hovering_now != was_hovering) // If hovering changed
-        this.selector_button.visible = checkbox_exposed || hovering_now;
-    }
   }
 
   public signal void selection_changed (Individual? individual);
@@ -148,7 +128,7 @@ public class Contacts.ContactList : Gtk.ListBox {
   private void on_ui_state_changed (Object obj, ParamSpec pspec) {
     foreach (var widget in get_children ()) {
       var row = widget as ContactDataRow;
-      row.expose_checkbox (this.state == UiState.SELECTING);
+      row.selector_button.visible = (this.state == UiState.SELECTING);
 
       if (this.state != UiState.SELECTING)
         row.selector_button.active = false;


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