[gedit] Separate ParseAndActivate from Activate for snippets
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Separate ParseAndActivate from Activate for snippets
- Date: Sat, 3 Dec 2011 16:02:52 +0000 (UTC)
commit c741f284cf2bbbd5fde679085acd31da68f43ce6
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date: Sat Dec 3 17:02:41 2011 +0100
Separate ParseAndActivate from Activate for snippets
plugins/snippets/snippets/windowactivatable.py | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/plugins/snippets/snippets/windowactivatable.py b/plugins/snippets/snippets/windowactivatable.py
index 15bf993..7b99e98 100644
--- a/plugins/snippets/snippets/windowactivatable.py
+++ b/plugins/snippets/snippets/windowactivatable.py
@@ -26,11 +26,16 @@ from library import Library
from shareddata import SharedData
from signals import Signals
-class Activate(Gedit.Message):
+class Message(Gedit.Message):
view = GObject.property(type=Gedit.View)
iter = GObject.property(type=Gtk.TextIter)
+
+class Activate(Message):
trigger = GObject.property(type=str)
+class ParseAndActivate(Message):
+ snippet = GObject.property(type=str)
+
class WindowActivatable(GObject.Object, Gedit.WindowActivatable, Signals):
__gtype_name__ = "GeditSnippetsWindowActivatable"
@@ -87,11 +92,13 @@ class WindowActivatable(GObject.Object, Gedit.WindowActivatable, Signals):
bus = self.window.get_message_bus()
bus.register(Activate, '/plugins/snippets', 'activate')
- bus.register(Activate, '/plugins/snippets', 'parse-and-activate')
+ bus.register(ParseAndActivate, '/plugins/snippets', 'parse-and-activate')
self.signal_ids = set()
+
sid = bus.connect('/plugins/snippets', 'activate', self.on_message_activate, None)
self.signal_ids.add(sid)
+
sid = bus.connect('/plugins/snippets', 'parse-and-activate', self.on_message_parse_and_activate, None)
self.signal_ids.add(sid)
@@ -117,6 +124,7 @@ class WindowActivatable(GObject.Object, Gedit.WindowActivatable, Signals):
if not iter:
iter = view.get_buffer().get_iter_at_mark(view.get_buffer().get_insert())
+
controller.run_snippet_trigger(message.props.trigger, (iter, iter))
def on_message_parse_and_activate(self, bus, message, userdata):
@@ -134,7 +142,8 @@ class WindowActivatable(GObject.Object, Gedit.WindowActivatable, Signals):
if not iter:
iter = view.get_buffer().get_iter_at_mark(view.get_buffer().get_insert())
- controller.parse_and_run_snippet(message.props.trigger, iter)
+
+ controller.parse_and_run_snippet(message.props.snippet, iter)
def insert_menu(self):
manager = self.window.get_ui_manager()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]