The version of pygnome that ships with debian unstable doesn't allow the passing of extra data to the callback functions that are attached with the GnomeDialog.button_connect() function. This patch simply copies the semantics from the generic connect() function and allows the passing of these extra arguments.
This makes the pygnome wrapper of button_connect() have basically the same function as it's C counterpart. mh -- Martin Hicks || [EMAIL PROTECTED] Use PGP/GnuPG || DSS PGP Key: 0x4C7F2BEE Beer: So much more than just a breakfast drink.
--- python-gnome-1.4.1/pygnome/gnomeuimodule.orig.c Wed Jan 9 23:15:18 2002 +++ python-gnome-1.4.1/pygnome/gnomeuimodule.c Wed Jan 9 23:15:26 2002 @@ -827,18 +827,21 @@ } static PyObject *_wrap_gnome_dialog_button_connect(PyObject *self, PyObject *args) { - PyObject *obj, *callback, * extra, * data; + PyObject *obj, *callback, *extra = NULL, *data; int button; - if (!PyArg_ParseTuple(args, "O!iO:gnome_dialog_button_connect", &PyGtk_Type, - &obj, &button, &callback)) + if (!PyArg_ParseTuple(args, "O!iO|O!:gnome_dialog_button_connect", &PyGtk_Type, + &obj, &button, &callback, &PyTuple_Type, &extra)) return NULL; if (!PyCallable_Check(callback)) { PyErr_SetString(PyExc_TypeError, "third argument not callable"); return NULL; } - extra = PyTuple_New(0); + if (extra) + Py_INCREF(extra); + else + extra = PyTuple_New(0); if (extra == NULL) return NULL; --- python-gnome-1.4.1/pygnome/gnome/ui.orig.py Thu Jan 10 10:40:25 2002 +++ python-gnome-1.4.1/pygnome/gnome/ui.py Thu Jan 10 10:40:45 2002 @@ -37,8 +37,8 @@ return _gnomeui.gnome_dialog_run(self._o) def run_and_close(self): return _gnomeui.gnome_dialog_run_and_close(self._o) - def button_connect(self, button, callback): - _gnomeui.gnome_dialog_button_connect(self._o, button, callback) + def button_connect(self, button, callback, *extra): + _gnomeui.gnome_dialog_button_connect(self._o, button, callback, extra) def set_default(self, button): _gnomeui.gnome_dialog_set_default(self._o, button) def set_sensitive(self, button, setting):
msg03437/pgp00000.pgp
Description: PGP signature