summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorPaul Pogonyshev <pogonyshev@gmx.net>2009-05-02 18:38:10 +0300
committerPaul Pogonyshev <pogonyshev@gmx.net>2009-06-19 23:30:52 +0300
commit3c400cf3b775b0fe0fd32b0e680afb3123a1f5c6 (patch)
treeae1875fa9abfe60823a56343d900684c2b182ae3 /gtk
parent8383c5ef563e9fae6d13d026402776210ed5e90e (diff)
downloadpygtk-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')
-rw-r--r--gtk/Makefile.am1
-rw-r--r--gtk/gtk-base.defs13
-rw-r--r--gtk/gtk.override1
-rw-r--r--gtk/gtkstatusbar.override65
4 files changed, 80 insertions, 0 deletions
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 690a6aa2..5b30fa7a 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -109,6 +109,7 @@ GTK_OVERRIDES = \
gtkctree.override \
gtkiconview.override \
gtkrcstyle.override \
+ gtkstatusbar.override \
gtkstyle.override \
gtktextview.override \
gtktoolbar.override \
diff --git a/gtk/gtk-base.defs b/gtk/gtk-base.defs
index cd8feda2..60730d72 100644
--- a/gtk/gtk-base.defs
+++ b/gtk/gtk-base.defs
@@ -16589,8 +16589,21 @@
)
)
+;; Weird c-name is not used, it is overriden. See the next entry.
(define-method remove
(of-object "GtkStatusbar")
+ (c-name "gtk_statusbar_remove_compatibility")
+ (return-type "none")
+ (parameters
+ '("guint" "context_id")
+ '("guint" "message_id")
+ )
+ (deprecated "use gtk.Statusbar.remove_message")
+)
+
+;; Renamed because it hides gtk.Container.remove, see bug #564587.
+(define-method remove_message
+ (of-object "GtkStatusbar")
(c-name "gtk_statusbar_remove")
(return-type "none")
(parameters
diff --git a/gtk/gtk.override b/gtk/gtk.override
index a2894897..3fb6fd5f 100644
--- a/gtk/gtk.override
+++ b/gtk/gtk.override
@@ -137,6 +137,7 @@ include
gtkctree.override
gtkiconview.override
gtkrcstyle.override
+ gtkstatusbar.override
gtkstyle.override
gtktextview.override
gtktoolbar.override
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;
+}