[pygtk] Rename gtk.Statusbar.remove() to gtk.Statusbar.remove_message()
- From: Paul Pogonyshev <paulp src gnome org>
- To: svn-commits-list gnome org
- Subject: [pygtk] Rename gtk.Statusbar.remove() to gtk.Statusbar.remove_message()
- Date: Fri, 19 Jun 2009 16:35:52 -0400 (EDT)
commit 3c400cf3b775b0fe0fd32b0e680afb3123a1f5c6
Author: Paul Pogonyshev <pogonyshev gmx net>
Date: Sat May 2 18:38:10 2009 +0300
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.
docs/reference/pygtk-gtkstatusbar.xml | 35 +++++++++++++++---
gtk/Makefile.am | 1 +
gtk/gtk-base.defs | 13 +++++++
gtk/gtk.override | 1 +
gtk/gtkstatusbar.override | 65 +++++++++++++++++++++++++++++++++
5 files changed, 110 insertions(+), 5 deletions(-)
---
diff --git a/docs/reference/pygtk-gtkstatusbar.xml b/docs/reference/pygtk-gtkstatusbar.xml
index fc82f68..d1e63e0 100644
--- a/docs/reference/pygtk-gtkstatusbar.xml
+++ b/docs/reference/pygtk-gtkstatusbar.xml
@@ -46,6 +46,14 @@ linkend="method-gtkstatusbar--pop">pop</link></methodname>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
+linkend="method-gtkstatusbar--remove-message">remove_message</link></methodname>
+ <methodparam><parameter
+ role="keyword">context_id</parameter></methodparam>
+ <methodparam><parameter
+ role="keyword">message_id</parameter></methodparam>
+ </methodsynopsis>
+ <methodsynopsis language="python">
+ <methodname><link
linkend="method-gtkstatusbar--remove">remove</link></methodname>
<methodparam><parameter
role="keyword">context_id</parameter></methodparam>
@@ -310,7 +318,7 @@ identifier</simpara></listitem>
specified by <parameter>text</parameter> with the specified
<parameter>context_id</parameter> onto a statusbar's stack and returns a
message id that that can be used with the <link
-linkend="method-gtkstatusbar--remove"><methodname>remove</methodname>()</link>
+linkend="method-gtkstatusbar--remove-message"><methodname>remove_message</methodname>()</link>
method.</para>
</refsect2>
@@ -337,11 +345,11 @@ statusbar's stack.</para>
</refsect2>
- <refsect2 id="method-gtkstatusbar--remove">
- <title>gtk.Statusbar.remove</title>
+ <refsect2 id="method-gtkstatusbar--remove-message">
+ <title>gtk.Statusbar.remove_message</title>
<programlisting><methodsynopsis language="python">
- <methodname>remove</methodname>
+ <methodname>remove_message</methodname>
<methodparam><parameter
role="keyword">context_id</parameter></methodparam>
<methodparam><parameter
@@ -360,12 +368,29 @@ role="keyword">message_id</parameter> :</term>
</varlistentry>
</variablelist>
- <para>The <methodname>remove</methodname>() method removes the message
+ <para>The <methodname>remove_message</methodname>() method removes the message
with the specified <parameter>message_id</parameter> and
<parameter>context_id</parameter> from the statusbar's message stack.</para>
</refsect2>
+ <refsect2 id="method-gtkstatusbar--remove">
+ <title>gtk.Statusbar.remove</title>
+
+ <warning>
+ <para>This method is deprecated in PyGTK 2.18 and above</para>
+ </warning>
+
+ <para>This method calls either
+ <link linkend="method-gtkcontainer--remove">gtk.Container.remove</link>
+ or <link linkend="method-gtkstatusbar--remove-message">gtk.Statusbar.remove_message</link>
+ depending on parameters. The second option is for compatibility only and will be
+ eventually removed. New code should use <literal>remove</literal> only to remove
+ widgets (as in <literal>gtk.Container</literal> method). To remove messages, use
+ <link linkend="method-gtkstatusbar--remove-message">gtk.Statusbar.remove_message</link>
+ directly.</para>
+ </refsect2>
+
<refsect2 id="method-gtkstatusbar--set-has-resize-grip">
<title>gtk.Statusbar.set_has_resize_grip</title>
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 690a6aa..5b30fa7 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 cd8feda..60730d7 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 a289489..3fb6fd5 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 0000000..2c202c4
--- /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;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]