[meld] filediff: Fix change deletion shortcut for non-keypad deletes
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] filediff: Fix change deletion shortcut for non-keypad deletes
- Date: Thu, 31 May 2018 22:53:57 +0000 (UTC)
commit 3604009b10868e684f0fe22bec8a4adaaea57da8
Author: Kai Willadsen <kai willadsen gmail com>
Date: Fri Jun 1 08:17:49 2018 +1000
filediff: Fix change deletion shortcut for non-keypad deletes
This was broken by 30bd3231, because you can't actually expect multiple
accelerators to work.
The change here is kind of unpleasant. Really, it would be nice if
this was a generic helper that ran on focus, probably as part of MeldDoc
handling... but that's very overkill for this one accelerator.
data/ui/filediff.ui | 1 -
meld/filediff.py | 21 +++++++++++++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
---
diff --git a/data/ui/filediff.ui b/data/ui/filediff.ui
index 65ac2d81..e49766f0 100644
--- a/data/ui/filediff.ui
+++ b/data/ui/filediff.ui
@@ -132,7 +132,6 @@
<signal name="activate" handler="delete_change" swapped="no"/>
</object>
<accelerator key="Delete" modifiers="GDK_MOD1_MASK"/>
- <accelerator key="KP_Delete" modifiers="GDK_MOD1_MASK"/>
</child>
<child>
<object class="GtkAction" id="MergeFromLeft">
diff --git a/meld/filediff.py b/meld/filediff.py
index 6827bc68..682af4f8 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -191,6 +191,11 @@ class FileDiff(MeldDoc, Component):
self.actiongroup = self.FilediffActions
self.actiongroup.set_translation_domain("meld")
+ # Alternate keybindings for a few commands.
+ self.extra_accels = (
+ ("<Alt>KP_Delete", self.delete_change),
+ )
+
self.findbar = FindBar(self.grid)
self.grid.attach(self.findbar.widget, 1, 2, 5, 1)
@@ -279,6 +284,22 @@ class FileDiff(MeldDoc, Component):
self.connect("notify::ignore-blank-lines", self.refresh_comparison)
+ def on_container_switch_in_event(self, ui):
+ MeldDoc.on_container_switch_in_event(self, ui)
+
+ accel_group = ui.get_accel_group()
+ for accel, callback in self.extra_accels:
+ keyval, mask = Gtk.accelerator_parse(accel)
+ accel_group.connect(keyval, mask, 0, callback)
+
+ def on_container_switch_out_event(self, ui):
+ accel_group = ui.get_accel_group()
+ for accel, callback in self.extra_accels:
+ keyval, mask = Gtk.accelerator_parse(accel)
+ accel_group.disconnect_key(keyval, mask)
+
+ MeldDoc.on_container_switch_out_event(self, ui)
+
def get_keymask(self):
return self._keymask
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]