[pygtk] Fix GtkAssistant.set_forward_page_func



commit c5f0622b20c56988d369083cb822ab492269d6f9
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date:   Fri Dec 24 10:04:56 2010 +1300

    Fix GtkAssistant.set_forward_page_func
    
    	* Allow passing None to set default func.
    	* Fixes bug 625603

 gtk/gtk.override |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtk.override b/gtk/gtk.override
index 4c9f98d..75018f4 100644
--- a/gtk/gtk.override
+++ b/gtk/gtk.override
@@ -6950,20 +6950,26 @@ _wrap_gtk_assistant_set_forward_page_func(PyGObject *self, PyObject *args,
                           kwlist, &pyfunc, &pyarg))
         return NULL;
 
-    if (!PyCallable_Check(pyfunc)) {
+    if (pyfunc != Py_None  && !PyCallable_Check(pyfunc)) {
         PyErr_SetString(PyExc_TypeError,
                         "page_func must be a callable object");
         return NULL;
     }
-    cunote = g_new0(PyGtkCustomNotify, 1);
-    cunote->func = pyfunc;
-    cunote->data = pyarg;
-    Py_INCREF(cunote->func);
-    Py_XINCREF(cunote->data);
+
+    if (pyfunc == Py_None) {
+        gtk_assistant_set_forward_page_func(GTK_ASSISTANT(self->obj),
+                                            NULL, NULL, NULL);
+    } else {
+        cunote = g_new0(PyGtkCustomNotify, 1);
+        cunote->func = pyfunc;
+        cunote->data = pyarg;
+        Py_INCREF(cunote->func);
+        Py_XINCREF(cunote->data);
  
-    gtk_assistant_set_forward_page_func(GTK_ASSISTANT(self->obj),
-                                        pygtk_assistant_set_forward_page_func_cb,
-                                        cunote, pygtk_custom_destroy_notify);
+        gtk_assistant_set_forward_page_func(GTK_ASSISTANT(self->obj),
+                                            pygtk_assistant_set_forward_page_func_cb,
+                                            cunote, pygtk_custom_destroy_notify);
+    }
 
     Py_INCREF(Py_None);
     return Py_None;



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