[pygtksourceview/gtksourcecompletion] Updated for new API
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: svn-commits-list gnome org
- Subject: [pygtksourceview/gtksourcecompletion] Updated for new API
- Date: Fri, 24 Apr 2009 18:13:47 -0400 (EDT)
commit 0b4ace28a6388a49a20158fd146987bff529d868
Author: Jesse van den Kieboom <jesse icecrew nl>
Date: Sat Apr 25 00:13:39 2009 +0200
Updated for new API
---
gtksourceview2.defs | 38 +++++++++++++++++++++++++++-----------
gtksourceview2.override | 42 ++++++++++++++++++++++++++++++------------
2 files changed, 57 insertions(+), 23 deletions(-)
diff --git a/gtksourceview2.defs b/gtksourceview2.defs
index 4d837e2..eece535 100644
--- a/gtksourceview2.defs
+++ b/gtksourceview2.defs
@@ -1215,20 +1215,13 @@
(return-type "GType")
)
-(define-function completion_get_from_provider
- (c-name "gtk_source_completion_get_from_provider")
- (return-type "GtkSourceCompletion*")
- (parameters
- '("GtkSourceCompletionProvider*" "provider")
- )
-)
-
(define-method add_provider
(of-object "GtkSourceCompletion")
(c-name "gtk_source_completion_add_provider")
(return-type "gboolean")
(parameters
'("GtkSourceCompletionProvider*" "provider")
+ '("GError**" "error")
)
)
@@ -1238,22 +1231,24 @@
(return-type "gboolean")
(parameters
'("GtkSourceCompletionProvider*" "provider")
+ '("GError**" "error")
)
)
-(define-method popup
+(define-method show
(of-object "GtkSourceCompletion")
(c-name "gtk_source_completion_popup")
(return-type "gboolean")
(parameters
'("GList*" "providers")
'("const-gchar*" "criteria")
+ '("GtkTextIter*" "place")
)
)
-(define-method finish
+(define-method hide
(of-object "GtkSourceCompletion")
- (c-name "gtk_source_completion_finish")
+ (c-name "gtk_source_completion_hide")
(return-type "none")
)
@@ -1375,6 +1370,12 @@
(return-type "const-gchar*")
)
+(define-method changed
+ (of-object "GtkSourceCompletionProposal")
+ (c-name "gtk_source_completion_proposal_changed")
+ (return-type "none")
+)
+
;; From gtksourcecompletionprovider.h
@@ -1399,6 +1400,9 @@
(of-object "GtkSourceCompletionProvider")
(c-name "gtk_source_completion_provider_get_proposals")
(return-type "GList*")
+ (parameters
+ '("GtkTextIter*" "iter")
+ )
)
(define-method filter_proposal
@@ -1407,6 +1411,7 @@
(return-type "gboolean")
(parameters
'("GtkSourceCompletionProposal*" "proposal")
+ '("GtkTextIter*" "iter")
'("const-gchar*" "criteria")
)
)
@@ -1449,6 +1454,7 @@
(return-type "gboolean")
(parameters
'("GtkSourceCompletionProposal*" "proposal")
+ '("GtkTextIter*" "iter")
)
)
@@ -1478,6 +1484,11 @@
(return-type "const-gchar*")
)
+(define-virtual changed
+ (of-object "GtkSourceCompletionProposal")
+ (return-type "none")
+)
+
(define-virtual get_name
(of-object "GtkSourceCompletionProvider")
(return-type "const-gchar*")
@@ -1491,6 +1502,9 @@
(define-virtual get_proposals
(of-object "GtkSourceCompletionProvider")
(return-type "GList*")
+ (parameters
+ '("GtkTextIter*" "iter")
+ )
)
(define-virtual filter_proposal
@@ -1498,6 +1512,7 @@
(return-type "gboolean")
(parameters
'("GtkSourceCompletionProposal*" "proposal")
+ '("GtkTextIter*" "iter")
'("const-gchar*" "criteria")
)
)
@@ -1535,5 +1550,6 @@
(return-type "gboolean")
(parameters
'("GtkSourceCompletionProposal*" "proposal")
+ '("GtkTextIter*" "iter")
)
)
diff --git a/gtksourceview2.override b/gtksourceview2.override
index 94db2d6..1871e1d 100644
--- a/gtksourceview2.override
+++ b/gtksourceview2.override
@@ -126,6 +126,7 @@ import gtk.TextMark as PyGtkTextMark_Type
import gtk.PrintContext as PyGtkPrintContext_Type
import gtk.Widget as PyGtkWidget_Type
import gtk.Window as PyGtkWindow_Type
+import gtk.TextIter as PyGtkTextIter_Type
%%
ignore-glob
*_get_type
@@ -549,21 +550,22 @@ _wrap_gtk_source_view_show_completion (PyGObject *self,
}
%%
-override gtk_source_completion_popup kwargs
+override gtk_source_completion_show kwargs
static PyObject *
-_wrap_gtk_source_completion_popup(PyGObject *self,
+_wrap_gtk_source_completion_show(PyGObject *self,
PyObject *args,
PyObject *kwargs)
{
- static char *kwlist[] = { "providers", "criteria", NULL };
+ static char *kwlist[] = { "providers", "criteria", "place", NULL };
PyObject *providers;
const char *criteria;
GList *items;
+ PyGBoxed *iter;
if (!PyArg_ParseTupleAndKeywords(args,
kwargs,
- "|Oz:GtkSourceCompletion.popup",
- kwlist, &providers, &criteria));
+ "|OzO!:GtkSourceCompletion.show",
+ kwlist, &providers, &criteria, &PyGtkTextIter_Type, &iter));
if (providers != Py_None && !PySequence_Check(providers)) {
PyErr_SetString(PyExc_TypeError, "providers must be a list");
@@ -571,7 +573,7 @@ _wrap_gtk_source_completion_popup(PyGObject *self,
}
items = pylist_to_glist_gobjs (providers, GTK_TYPE_SOURCE_COMPLETION_PROVIDER);
- gtk_source_completion_popup (GTK_SOURCE_COMPLETION(self), items, criteria);
+ gtk_source_completion_show (GTK_SOURCE_COMPLETION(self), items, criteria, pyg_boxed_get (iter, GtkTextIter));
g_list_foreach (items, (GFunc)g_object_unref, NULL);
g_list_free (items);
@@ -587,15 +589,16 @@ _wrap_GtkSourceCompletionProvider__do_get_proposals(PyObject *cls,
PyObject *kwargs)
{
GtkSourceCompletionProviderIface *iface;
- static char *kwlist[] = { "self", NULL };
+ static char *kwlist[] = { "self", "iter", NULL };
PyGObject *self;
+ PyGBoxed *iter;
GList *ret;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:GtkSourceCompletionProvider.get_proposals", kwlist, &PyGtkSourceCompletionProvider_Type, &self))
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!O!:GtkSourceCompletionProvider.get_proposals", kwlist, &PyGtkSourceCompletionProvider_Type, &self, &PyGtkTextIter_Type, &iter))
return NULL;
iface = g_type_interface_peek(g_type_class_peek(pyg_type_from_object(cls)), GTK_TYPE_SOURCE_COMPLETION_PROVIDER);
if (iface->get_proposals)
- ret = iface->get_proposals(GTK_SOURCE_COMPLETION_PROVIDER(self->obj));
+ ret = iface->get_proposals(GTK_SOURCE_COMPLETION_PROVIDER(self->obj), pyg_boxed_get(iter, GtkTextIter));
else {
PyErr_SetString(PyExc_NotImplementedError, "interface method GtkSourceCompletionProvider.get_proposals not implemented");
return NULL;
@@ -612,21 +615,29 @@ _wrap_gtk_source_completion_provider_get_proposals(PyGObject *self,
PyObject *kwargs)
{
GList *proposals;
+ static char *kwlist[] = { "iter", NULL };
+ PyGBoxed *iter;
- proposals = gtk_source_completion_provider_get_proposals (GTK_SOURCE_COMPLETION_PROVIDER (self));
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!:GtkSourceCompletionProvider.get_proposals", kwlist, &PyGtkTextIter_Type, &iter))
+ return NULL;
+
+ proposals = gtk_source_completion_provider_get_proposals (GTK_SOURCE_COMPLETION_PROVIDER (self),
+ pyg_boxed_get(iter, GtkTextIter));
return glist_to_pylist_objs (proposals);
}
%%
override GtkSourceCompletionProvider__proxy_do_get_proposals
static GList *
-_wrap_GtkSourceCompletionProvider__proxy_do_get_proposals(GtkSourceCompletionProvider *self)
+_wrap_GtkSourceCompletionProvider__proxy_do_get_proposals(GtkSourceCompletionProvider *self, GtkTextIter *iter)
{
PyGILState_STATE __py_state;
PyObject *py_self;
GList *retval;
PyObject *py_retval;
PyObject *py_method;
+ PyObject *py_iter;
+ PyObject *py_args;
__py_state = pyg_gil_state_ensure();
py_self = pygobject_new((GObject *) self);
@@ -646,7 +657,14 @@ _wrap_GtkSourceCompletionProvider__proxy_do_get_proposals(GtkSourceCompletionPro
pyg_gil_state_release(__py_state);
return FALSE;
}
- py_retval = PyObject_CallObject(py_method, NULL);
+
+ py_iter = pyg_boxed_new (GTK_TYPE_TEXT_ITER, iter, FALSE, FALSE);
+ py_args = PyTuple_New(1);
+ PyTuple_SET_ITEM(py_args, 0, py_iter);
+
+ py_retval = PyObject_CallObject(py_method, py_args);
+ Py_XDECREF(py_args);
+
if (!py_retval) {
if (PyErr_Occurred())
PyErr_Print();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]