[pygtksourceview/gtksourcecompletion] Provide bindings for WordsCompletion



commit 64819552012ccc2e55c0f0c541e14d8b4c107da8
Author: Jesse van den Kieboom <jesse icecrew nl>
Date:   Sat Sep 26 19:58:14 2009 +0200

    Provide bindings for WordsCompletion

 gtksourceview2.defs     |   40 ++++++++++++++++++++++++++++++++++++++++
 gtksourceview2.override |   27 +++++++++++++++++++++++++++
 2 files changed, 67 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview2.defs b/gtksourceview2.defs
index c9137c4..fa8cd0e 100644
--- a/gtksourceview2.defs
+++ b/gtksourceview2.defs
@@ -110,6 +110,12 @@
   (gtype-id "GTK_TYPE_SOURCE_COMPLETION_CONTEXT")
 )
 
+(define-object CompletionWords
+  (in-module "GtkSourceView")
+  (c-name "GtkSourceCompletionWords")
+  (gtype-id "GTK_TYPE_SOURCE_COMPLETION_WORDS")
+)
+
 ;; Enumerations and flags ...
 
 (define-flags SearchFlags
@@ -1680,6 +1686,40 @@
   )
 )
 
+;; From gtksourcecompletionwords.h
+
+(define-function gtk_source_completion_words_get_type
+  (c-name "gtk_source_completion_words_get_type")
+  (return-type "GType")
+)
+
+(define-function gtk_source_completion_words_new
+  (c-name "gtk_source_completion_words_new")
+  (is-constructor-of "GtkSourceCompletionWords")
+  (return-type "GtkSourceCompletionWords*")
+  (parameters
+    '("const-gchar*" "name")
+    '("GdkPixbuf*" "icon")
+  )
+)
+
+(define-method register
+  (of-object "GtkSourceCompletionWords")
+  (c-name "gtk_source_completion_words_register")
+  (return-type "none")
+  (parameters
+    '("GtkTextBuffer*" "buffer")
+  )
+)
+
+(define-method unregister
+  (of-object "GtkSourceCompletionWords")
+  (c-name "gtk_source_completion_words_unregister")
+  (return-type "none")
+  (parameters
+    '("GtkTextBuffer*" "buffer")
+  )
+)
 
 ;; From gtksourcecompletioncontext.h
 
diff --git a/gtksourceview2.override b/gtksourceview2.override
index 6b9bec5..68adb69 100644
--- a/gtksourceview2.override
+++ b/gtksourceview2.override
@@ -22,6 +22,7 @@ headers
 #include <gtksourceview/gtksourcecompletionitem.h>
 #include <gtksourceview/gtksourcecompletionprovider.h>
 #include <gtksourceview/gtksourcecompletioninfo.h>
+#include <gtksourceview/completion-providers/words/gtksourcecompletionwords.h>
 
 static PyObject *
 glist_to_pylist_objs (const GList *source)
@@ -1191,3 +1192,29 @@ _wrap_gtk_source_view_set_mark_category_tooltip_markup_func (PyGObject *self,
     Py_INCREF(Py_None);
     return Py_None;
 }
+
+%%
+override gtk_source_completion_words_new kwargs
+static int
+_wrap_gtk_source_completion_words_new(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+    static char *kwlist[] = { "name", "icon", NULL };
+    char *name = NULL;
+    PyGObject *icon = NULL;
+
+    if (!PyArg_ParseTupleAndKeywords(args, 
+                                     kwargs,
+                                     "|sO!:GtkSourceCompletionWords.__init__", 
+                                     kwlist, 
+                                     &name, &PyGdkPixbuf_Type, &icon))
+        return -1;
+
+    self->obj = (GObject *)gtk_source_completion_words_new(name, icon ? GDK_PIXBUF(icon->obj) : NULL);
+
+    if (!self->obj) {
+        PyErr_SetString(PyExc_RuntimeError, "could not create GtkSourceCompletionWords object");
+        return -1;
+    }
+    pygobject_register_wrapper((PyObject *)self);
+    return 0;
+}



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