From 66bf555f8360e858243044ad7288d9770ba5326b Mon Sep 17 00:00:00 2001 From: Martijn Braam Date: Fri, 26 Aug 2022 20:27:41 +0200 Subject: [PATCH] Implement longpress for copying keys --- himitsu_gtk/window.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/himitsu_gtk/window.py b/himitsu_gtk/window.py index 282cd85..cdd6212 100644 --- a/himitsu_gtk/window.py +++ b/himitsu_gtk/window.py @@ -184,8 +184,15 @@ class KeyringWindow: row.set_margin_start(8) row.set_margin_end(8) lbr = Gtk.ListBoxRow() - lbr.add(row) + eb = Gtk.EventBox() + eb.add(row) + lbr.add(eb) lbr.pair = pair + + lbr.longpress = Gtk.GestureLongPress.new(eb) + lbr.longpress.connect("pressed", self.on_key_row_longpress) + lbr.longpress.row = lbr + self.keyinfo.insert(lbr, -1) name = Gtk.Label(pair.key, xalign=0.0) @@ -239,6 +246,9 @@ class KeyringWindow: self.mainstack.set_visible_child_name('nokey') dialog.destroy() + def on_key_row_longpress(self, widget, x, y): + self.on_key_row_activate(widget, widget.row) + def on_key_row_activate(self, widget, row): pair = row.pair if pair.value is not None: -- 2.45.2