[gedit] Rework snippets to not use set/get_data
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Rework snippets to not use set/get_data
- Date: Sun, 16 Sep 2012 20:00:32 +0000 (UTC)
commit 7f37ff4fa2c9dd8f42ff527f4e1d0a148c39eb0e
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Sep 16 21:39:37 2012 +0200
Rework snippets to not use set/get_data
plugins/snippets/snippets/helper.py | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/plugins/snippets/snippets/helper.py b/plugins/snippets/snippets/helper.py
index 3bdf4e6..8d84221 100644
--- a/plugins/snippets/snippets/helper.py
+++ b/plugins/snippets/snippets/helper.py
@@ -61,8 +61,9 @@ def spaces_instead_of_tabs(view, text):
def insert_with_indent(view, piter, text, indentfirst = True, context = None):
text = spaces_instead_of_tabs(view, text)
lines = text.split('\n')
+ buf = view.get_buffer()
- view.get_buffer().set_data('GeditSnippetsPluginContext', context)
+ buf._snippets_context = context
if len(lines) == 1:
view.get_buffer().insert(piter, text)
@@ -77,12 +78,14 @@ def insert_with_indent(view, piter, text, indentfirst = True, context = None):
else:
text += lines[i] + '\n'
- view.get_buffer().insert(piter, text[:-1])
+ buf.insert(piter, text[:-1])
- view.get_buffer().set_data('GeditSnippetsPluginContext', None)
+ buf._snippets_context = None
def get_buffer_context(buf):
- return buf.get_data('GeditSnippetsPluginContext')
+ if hasattr(buf, "_snippets_context"):
+ return buf._snippets_context
+ return None
def snippets_debug(*s):
return
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]