From 80764dcbbf6d0285fcd7abd85859b2aa16e83536 Mon Sep 17 00:00:00 2001 From: John Finlay Date: Sat, 12 Jul 2003 07:07:51 +0000 Subject: gtk/gtk.defs (gtk_tree_model_sort_convert_iter_to_child_iter) Allow * gtk/gtk.defs (gtk_tree_model_sort_convert_iter_to_child_iter) Allow sort_iter to be NULL. Fixes #113097 (gtk_tree_model_sort_convert_child_iter_to_iter) Allow child_iter to be NULL. Fixes #113097 * gtk/gtktreeview.override (_wrap_gtk_tree_model_sort_convert_iter_to_child_iter) Allow the child_iter to be NULL and return the converted iter but allow child_iter to be passed in for backward compatibility. Fixes #113097 (_wrap_gtk_tree_model_sort_convert_child_iter_to_iter) Allow the sort_iter to be NULL and return the converted iter but allow sort_iter to be passed in for backward compatibility. Fixes #113097 --- ChangeLog | 17 ++++++++++++ gtk/gtk.defs | 4 +-- gtk/gtktreeview.override | 67 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f972f4c..1ba1f082 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2003-07-11 John Finlay + + * gtk/gtk.defs (gtk_tree_model_sort_convert_iter_to_child_iter) + Allow sort_iter to be NULL. Fixes #113097 + (gtk_tree_model_sort_convert_child_iter_to_iter) + Allow child_iter to be NULL. Fixes #113097 + + * gtk/gtktreeview.override + (_wrap_gtk_tree_model_sort_convert_iter_to_child_iter) + Allow the child_iter to be NULL and return the converted iter but + allow child_iter to be passed in for backward compatibility. + Fixes #113097 + (_wrap_gtk_tree_model_sort_convert_child_iter_to_iter) + Allow the sort_iter to be NULL and return the converted iter but + allow sort_iter to be passed in for backward compatibility. + Fixes #113097 + 2003-07-03 James Henstridge * gtk/gtk.defs (GtkWindow.set_icon): allow passing None as the diff --git a/gtk/gtk.defs b/gtk/gtk.defs index bf7655a9..91dd874d 100644 --- a/gtk/gtk.defs +++ b/gtk/gtk.defs @@ -13992,7 +13992,7 @@ (c-name "gtk_tree_model_sort_convert_child_iter_to_iter") (return-type "none") (parameters - '("GtkTreeIter*" "sort_iter") + '("GtkTreeIter*" "sort_iter" (null-ok)) '("GtkTreeIter*" "child_iter") ) ) @@ -14012,7 +14012,7 @@ (c-name "gtk_tree_model_sort_convert_iter_to_child_iter") (return-type "none") (parameters - '("GtkTreeIter*" "child_iter") + '("GtkTreeIter*" "child_iter" (null-ok)) '("GtkTreeIter*" "sorted_iter") ) ) diff --git a/gtk/gtktreeview.override b/gtk/gtktreeview.override index f74dc15f..9fae2f6a 100644 --- a/gtk/gtktreeview.override +++ b/gtk/gtktreeview.override @@ -1809,3 +1809,70 @@ _wrap_gtk_cell_renderer_get_fixed_size(PyGObject *self) return Py_BuildValue("(ii)", width, height); } +%% +override gtk_tree_model_sort_convert_child_iter_to_iter kwargs +static PyObject * +_wrap_gtk_tree_model_sort_convert_child_iter_to_iter(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "sort_iter", "child_iter", NULL }; + PyObject *py_sort_iter = Py_None, *py_child_iter; + GtkTreeIter iter, *sort_iter, *child_iter = NULL; + + sort_iter = &iter; + if (!PyArg_ParseTupleAndKeywords( + args, kwargs, "OO:GtkTreeModelSort.convert_child_iter_to_iter", + kwlist, &py_sort_iter, &py_child_iter)) + return NULL; + if (pyg_boxed_check(py_sort_iter, GTK_TYPE_TREE_ITER)) + sort_iter = pyg_boxed_get(py_sort_iter, GtkTreeIter); + else if (py_sort_iter != Py_None) { + PyErr_SetString(PyExc_TypeError, + "sort_iter should be a GtkTreeIter or None"); + return NULL; + } + if (pyg_boxed_check(py_child_iter, GTK_TYPE_TREE_ITER)) + child_iter = pyg_boxed_get(py_child_iter, GtkTreeIter); + else { + PyErr_SetString(PyExc_TypeError, "child_iter should be a GtkTreeIter"); + return NULL; + } + gtk_tree_model_sort_convert_child_iter_to_iter( + GTK_TREE_MODEL_SORT(self->obj), sort_iter, child_iter); + return pyg_boxed_new(GTK_TYPE_TREE_ITER, sort_iter, TRUE, TRUE); +} +%% +override gtk_tree_model_sort_convert_iter_to_child_iter kwargs +static PyObject * +_wrap_gtk_tree_model_sort_convert_iter_to_child_iter(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "child_iter", "sorted_iter", NULL }; + PyObject *py_child_iter = Py_None, *py_sorted_iter; + GtkTreeIter iter, *child_iter, *sorted_iter = NULL; + + child_iter = &iter; + if (!PyArg_ParseTupleAndKeywords( + args, kwargs, "OO:GtkTreeModelSort.convert_iter_to_child_iter", + kwlist, &py_child_iter, &py_sorted_iter)) + return NULL; + if (pyg_boxed_check(py_child_iter, GTK_TYPE_TREE_ITER)) + child_iter = pyg_boxed_get(py_child_iter, GtkTreeIter); + else if (py_child_iter != Py_None) { + PyErr_SetString(PyExc_TypeError, + "child_iter should be a GtkTreeIter or None"); + return NULL; + } + if (pyg_boxed_check(py_sorted_iter, GTK_TYPE_TREE_ITER)) + sorted_iter = pyg_boxed_get(py_sorted_iter, GtkTreeIter); + else { + PyErr_SetString(PyExc_TypeError, + "sorted_iter should be a GtkTreeIter"); + return NULL; + } + gtk_tree_model_sort_convert_iter_to_child_iter( + GTK_TREE_MODEL_SORT(self->obj), child_iter, sorted_iter); + return pyg_boxed_new(GTK_TYPE_TREE_ITER, child_iter, TRUE, TRUE); +} -- cgit v1.2.1