[gnome-boxes/select-child-on-activate: 6/6] icon-view: Select child on child activated



commit 5b0257e4daa431311a56d33e6a12c5065f4f53ee
Author: Felipe Borges <felipeborges gnome org>
Date:   Thu Apr 5 14:00:12 2018 +0200

    icon-view: Select child on child activated
    
    If the view is in selection-mode, clicking in a child should
    toggle the selection.
    
    This behavior is consistent with what gnome-photos does.

 src/icon-view.vala | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/icon-view.vala b/src/icon-view.vala
index 6e910bff..b9dfe6ca 100644
--- a/src/icon-view.vala
+++ b/src/icon-view.vala
@@ -162,8 +162,15 @@ private void ui_state_changed () {
 
     [GtkCallback]
     private void on_child_activated (Gtk.FlowBoxChild child) {
-        if (window.selection_mode)
+        if (window.selection_mode) {
+            var view_child = child.get_child () as IconViewChild;
+            if (view_child.selected)
+                unselect_child (child);
+            else
+                select_child (child);
+
             return;
+        }
 
         var item = get_item_for_child (child);
         if (item is LibvirtMachine && (item as LibvirtMachine).importing)


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