[pygtksourceview] Added bindings for context classes



commit 2579e2557195b4a0c99bdf109136ee957af46a6c
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date:   Mon Jan 4 19:32:04 2010 +0100

    Added bindings for context classes

 gtksourceview2.defs     |   37 +++++++++++++++++++++++++++++++++++++
 gtksourceview2.override |   37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview2.defs b/gtksourceview2.defs
index 2a827bb..538f91d 100644
--- a/gtksourceview2.defs
+++ b/gtksourceview2.defs
@@ -382,7 +382,44 @@
   )
 )
 
+(define-method iter_has_context_class
+  (of-object "GtkSourceBuffer")
+  (c-name "gtk_source_buffer_iter_has_context_class")
+  (return-type "gboolean")
+  (parameters
+    '("GtkTextIter*" "iter")
+    '("const-gchar*" "context_class")
+  )
+)
+
+(define-method get_context_classes_at_iter
+  (of-object "GtkSourceBuffer")
+  (c-name "gtk_source_buffer_get_context_classes_at_iter")
+  (return-type "gchar**")
+  (parameters
+    '("GtkTextIter*" "iter")
+  )
+)
 
+(define-method iter_forward_to_context_class_toggle
+  (of-object "GtkSourceBuffer")
+  (c-name "gtk_source_buffer_iter_forward_to_context_class_toggle")
+  (return-type "gboolean")
+  (parameters
+    '("GtkTextIter*" "iter")
+    '("const-gchar*" "context_class")
+  )
+)
+
+(define-method iter_backward_to_context_class_toggle
+  (of-object "GtkSourceBuffer")
+  (c-name "gtk_source_buffer_iter_backward_to_context_class_toggle")
+  (return-type "gboolean")
+  (parameters
+    '("GtkTextIter*" "iter")
+    '("const-gchar*" "context_class")
+  )
+)
 
 ;; From gtksourcegutter.h
 
diff --git a/gtksourceview2.override b/gtksourceview2.override
index 5c1bfad..96273a5 100644
--- a/gtksourceview2.override
+++ b/gtksourceview2.override
@@ -1234,3 +1234,40 @@ _wrap_gtk_source_completion_words_new(PyGObject *self, PyObject *args, PyObject
     pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
+
+%%
+override gtk_source_buffer_get_context_classes_at_iter kwargs
+static PyObject *
+_wrap_gtk_source_buffer_get_context_classes_at_iter(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+    static char *kwlist[] = { "iter", NULL };
+    PyObject *py_iter;
+    GtkTextIter *iter = NULL;
+    gchar **context_classes;
+
+    PyObject *ret;
+
+    if (!PyArg_ParseTupleAndKeywords(args,
+                                     kwargs,
+                                     "Os:GtkSourceBuffer.get_context_classes_at_iter",
+                                     kwlist,
+                                     &py_iter))
+        return NULL;
+
+    if (pyg_boxed_check(py_iter, GTK_TYPE_TEXT_ITER))
+    {
+        iter = pyg_boxed_get(py_iter, GtkTextIter);
+    }
+    else
+    {
+        PyErr_SetString(PyExc_TypeError, "iter should be a GtkTextIter");
+        return NULL;
+    }
+
+    context_classes = gtk_source_buffer_get_context_classes_at_iter (GTK_SOURCE_BUFFER (self->obj),
+                                                                     iter);
+    ret = strv_to_pylist (context_classes);
+    g_strfreev (context_classes);
+
+    return ret;
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]