[gedit] Make sure to propagate result of accelerator activation
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Make sure to propagate result of accelerator activation
- Date: Sun, 28 Mar 2010 22:57:40 +0000 (UTC)
commit 1b8a29918ba08ceb87971e209a0e4a22d6803e51
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Sun Mar 28 13:35:06 2010 +0200
Make sure to propagate result of accelerator activation
This ensures that when a snippet is activated with an accelerator,
the other possible signal handlers (such as for toplevel menus) are
blocked.
plugins/snippets/snippets/Document.py | 2 +-
plugins/snippets/snippets/Library.py | 6 +++++-
plugins/snippets/snippets/__init__.py | 6 +++++-
3 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/plugins/snippets/snippets/Document.py b/plugins/snippets/snippets/Document.py
index 53f08bb..414486d 100644
--- a/plugins/snippets/snippets/Document.py
+++ b/plugins/snippets/snippets/Document.py
@@ -185,7 +185,7 @@ class Document:
def accelerator_activate(self, keyval, mod):
if not self.view or not self.view.get_editable():
- return
+ return False
accelerator = gtk.accelerator_name(keyval, mod)
snippets = Library().from_accelerator(accelerator, \
diff --git a/plugins/snippets/snippets/Library.py b/plugins/snippets/snippets/Library.py
index b147625..a522ead 100644
--- a/plugins/snippets/snippets/Library.py
+++ b/plugins/snippets/snippets/Library.py
@@ -660,8 +660,12 @@ class Library(Singleton):
self._accelerator_activated_cb = cb
def accelerator_activated(self, group, obj, keyval, mod):
+ ret = False
+
if self._accelerator_activated_cb:
- self._accelerator_activated_cb(group, obj, keyval, mod)
+ ret = self._accelerator_activated_cb(group, obj, keyval, mod)
+
+ return ret
def add_snippet(self, library, element):
container = self.container(library.language)
diff --git a/plugins/snippets/snippets/__init__.py b/plugins/snippets/snippets/__init__.py
index fe69d53..8afa745 100644
--- a/plugins/snippets/snippets/__init__.py
+++ b/plugins/snippets/snippets/__init__.py
@@ -89,5 +89,9 @@ class SnippetsPlugin(gedit.Plugin):
return self.dlg.dlg
def accelerator_activated(self, group, obj, keyval, mod):
+ ret = False
+
if hasattr(obj, '_snippets_plugin_data'):
- obj._snippets_plugin_data.accelerator_activated(keyval, mod)
+ ret = obj._snippets_plugin_data.accelerator_activated(keyval, mod)
+
+ return ret
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]