Mercurial > pidgin.yaz
diff finch/libgnt/pygnt/gnttree.override @ 18679:6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
for each row in a tree needs to be a GObject, which, really is quite simple
to do in python (examples coming up shortly).
There is a wrapper for gpointer, which I am going to remove shortly.
I also need to fix the install location. The way to go, I think, is to
change the configure script in libgnt/configure.ac. This involves checking
for python and doing things of that sort.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 28 Jul 2007 11:16:05 +0000 |
parents | 5e1412f4e67a |
children | 254823d66aa5 |
line wrap: on
line diff
--- a/finch/libgnt/pygnt/gnttree.override Fri Jul 27 16:13:34 2007 +0000 +++ b/finch/libgnt/pygnt/gnttree.override Sat Jul 28 11:16:05 2007 +0000 @@ -49,7 +49,7 @@ return NULL; } while (list) { - PyObject *obj = pyg_pointer_new(G_TYPE_POINTER, list->data); + PyObject *obj = list->data; PyList_Append(py_list, obj); Py_DECREF(obj); list = list->next; @@ -63,7 +63,7 @@ { static char *kwlist[] = {"key", "row", "parent", "bigbro", NULL}; PyObject *py_list; - gpointer key, parent, bigbro; + PyGObject *key, *parent, *bigbro; int len, i; GList *list = NULL; GntTreeRow *row; @@ -100,4 +100,65 @@ Py_INCREF(Py_None); return Py_None; } +%% +override gnt_tree_get_selection_data noargs +static PyObject * +_wrap_gnt_tree_get_selection_data(PyGObject *self) +{ + PyObject *ret = gnt_tree_get_selection_data(GNT_TREE(self->obj)); + if (!ret) + ret = Py_None; + Py_INCREF(ret); + return ret; +} +%% +override gnt_tree_change_text +static PyObject * +_wrap_gnt_tree_change_text(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "key", "colno", "text", NULL }; + char *text; + int colno; + gpointer key; + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"Ois:GntTree.change_text", kwlist, &key, &colno, &text)) + return NULL; + + gnt_tree_change_text(GNT_TREE(self->obj), key, colno, text); + + Py_INCREF(Py_None); + return Py_None; +} +%% +override gnt_tree_set_row_flags +static PyObject * +_wrap_gnt_tree_set_row_flags(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "key", "flag", NULL }; + int flag; + gpointer key; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"Oi:GntTree.set_row_flags", kwlist, &key, &flag)) + return NULL; + + gnt_tree_set_row_flags(GNT_TREE(self->obj), key, flag); + + Py_INCREF(Py_None); + return Py_None; +} +%% +override gnt_tree_remove +static PyObject * +_wrap_gnt_tree_remove(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "key", NULL }; + gpointer key; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:GntTree.remove", kwlist, &key)) + return NULL; + + gnt_tree_remove(GNT_TREE(self->obj), key); + + Py_INCREF(Py_None); + return Py_None; +}