diff options
author | Paul Pogonyshev <pogonyshev@gmx.net> | 2009-05-02 18:38:10 +0300 |
---|---|---|
committer | Paul Pogonyshev <pogonyshev@gmx.net> | 2009-06-19 23:30:52 +0300 |
commit | 3c400cf3b775b0fe0fd32b0e680afb3123a1f5c6 (patch) | |
tree | ae1875fa9abfe60823a56343d900684c2b182ae3 /gtk/gtkstatusbar.override | |
parent | 8383c5ef563e9fae6d13d026402776210ed5e90e (diff) | |
download | pygtk-3c400cf3b775b0fe0fd32b0e680afb3123a1f5c6.tar.gz |
Rename gtk.Statusbar.remove() to gtk.Statusbar.remove_message()
Avoids hiding gtk.Container method with the same name. It is still
possible to use remove() to operate on messages, but in this case
there will be a deprecation warning. Fixes bug #564587.
Diffstat (limited to 'gtk/gtkstatusbar.override')
-rw-r--r-- | gtk/gtkstatusbar.override | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/gtk/gtkstatusbar.override b/gtk/gtkstatusbar.override new file mode 100644 index 00000000..2c202c48 --- /dev/null +++ b/gtk/gtkstatusbar.override @@ -0,0 +1,65 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 2009 Paul Pogonyshev + * + * gtkstatusbar.override: overrides for the gtk.Statusbar object. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + */ +%% +override gtk_statusbar_remove_compatibility kwargs + +static PyObject * +_wrap_gtk_statusbar_remove(PyGObject *self, PyObject *args, PyObject *kwargs); + +static PyObject * +_wrap_gtk_statusbar_remove_compatibility(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "widget", NULL }; + PyGObject *widget; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:gtk.Statusbar.remove", kwlist, + &PyGtkWidget_Type, &widget)) { + PyObject *exc_type, *exc_value, *exc_traceback; + PyObject *result; + + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + + /* For compatibility reasons, call remove_message(). See bug #564587. */ + result = _wrap_gtk_statusbar_remove(self, args, kwargs); + if (result) { + Py_XDECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_traceback); + + if (PyErr_Warn(PyExc_DeprecationWarning, "use gtk.Statusbar.remove_message")) { + Py_DECREF(result); + return NULL; + } + + return result; + } + else { + PyErr_Restore(exc_type, exc_value, exc_traceback); + return NULL; + } + } + + gtk_container_remove(GTK_CONTAINER(self->obj), GTK_WIDGET(widget->obj)); + + Py_INCREF(Py_None); + return Py_None; +} |