[polari/gnome-3-24] serverRoomManager: Fix double-toggling of checkboxes



commit 88563ec76b435286b99ebd8f1d89ff087ed974d7
Author: mjash <mjashdev gmail com>
Date:   Mon May 22 16:49:56 2017 -0400

    serverRoomManager: Fix double-toggling of checkboxes
    
    As activating a checkbox via keyboard navigation does not emit
    the ::row-activated signal, we need to handle ::toggled as well.
    However as clicking a row will emit both signals, we currently
    end up toggling the checkbox twice in that case (that is, back
    to its original state). Address this by only handling ::toggled
    in response to keyboard events.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=782969

 src/serverRoomManager.js |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/serverRoomManager.js b/src/serverRoomManager.js
index 9c60f72..18249d7 100644
--- a/src/serverRoomManager.js
+++ b/src/serverRoomManager.js
@@ -1,6 +1,7 @@
 const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
+const Gdk = imports.gi.Gdk;
 const Pango = imports.gi.Pango;
 const Tp = imports.gi.TelepathyGLib;
 
@@ -189,7 +190,10 @@ const ServerRoomList = new Lang.Class({
         });
 
         this._toggleRenderer.connect('toggled', (cell, pathStr) => {
-            this._toggleChecked(Gtk.TreePath.new_from_string(pathStr));
+            // For pointer devices, ::row-activated is emitted as well
+            let dev = Gtk.get_current_event_device();
+            if (dev && dev.input_source == Gdk.InputSource.KEYBOARD)
+                this._toggleChecked(Gtk.TreePath.new_from_string(pathStr));
         });
 
         this._manager = getDefault();


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