diff options
author | Matt Wilson <msw@redhat.com> | 2001-09-19 18:20:19 +0000 |
---|---|---|
committer | Matt Wilson <msw@src.gnome.org> | 2001-09-19 18:20:19 +0000 |
commit | ace1b5579dd5ba2b1878ff6901ed00a6511e7b2f (patch) | |
tree | c50d5ba8c94d98f55d032503a80fa5f28d935c42 | |
parent | f299d52e5a633473295d477807a8ae160e936412 (diff) | |
download | pygtk-ace1b5579dd5ba2b1878ff6901ed00a6511e7b2f.tar.gz |
define defaults
2001-09-19 Matt Wilson <msw@redhat.com>
* gtk/gtk.defs (gtk_message_dialog_new): define defaults
* gtk/gtk.override (_wrap_gtk_message_dialog_new): override this
function so we can use "%s" as the format string and pass the
entire last argument as a string securely.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | gtk/gtk.defs | 10 | ||||
-rw-r--r-- | gtk/gtk.override | 42 |
3 files changed, 55 insertions, 5 deletions
@@ -1,3 +1,11 @@ +2001-09-19 Matt Wilson <msw@redhat.com> + + * gtk/gtk.defs (gtk_message_dialog_new): define defaults + + * gtk/gtk.override (_wrap_gtk_message_dialog_new): override this + function so we can use "%s" as the format string and pass the + entire last argument as a string securely. + 2001-09-19 James Henstridge <james@daa.com.au> * pango.defs: update for newer Pango API. diff --git a/gtk/gtk.defs b/gtk/gtk.defs index 480a1191..4484cc92 100644 --- a/gtk/gtk.defs +++ b/gtk/gtk.defs @@ -8462,11 +8462,11 @@ (is-constructor-of GtkMessageDialog) (return-type "GtkWidget*") (parameters - '("GtkWindow*" "parent") - '("GtkDialogFlags" "flags") - '("GtkMessageType" "type") - '("GtkButtonsType" "buttons") - '("const-gchar*" "message_format") + '("GtkWindow*" "parent" (null-ok) (default "NULL")) + '("GtkDialogFlags" "flags" (default "0")) + '("GtkMessageType" "type" (default "GTK_MESSAGE_INFO")) + '("GtkButtonsType" "buttons" (default "GTK_BUTTONS_NONE")) + '("const-gchar*" "message_format" (null-ok) (default "NULL")) ) (varargs #t) ) diff --git a/gtk/gtk.override b/gtk/gtk.override index e904a6b9..4cc3bb16 100644 --- a/gtk/gtk.override +++ b/gtk/gtk.override @@ -3669,5 +3669,47 @@ _wrap_gtk_dialog_new_with_buttons(PyGObject *self, PyObject *args, PyObject *kwa Py_INCREF(Py_None); return Py_None; } +%% +override gtk_message_dialog_new kwargs +static PyObject * +_wrap_gtk_message_dialog_new(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + GtkButtonsType buttons = GTK_BUTTONS_NONE; + static char *kwlist[] = { "parent", "flags", "type", "buttons", "message_format", NULL }; + PyObject *py_flags = NULL, *py_type = NULL, *py_buttons = NULL; + GtkDialogFlags flags = 0; + GtkWindow *parent = NULL; + GtkMessageType type = GTK_MESSAGE_INFO; + PyGObject *py_parent = NULL; + char *message_format = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOOOz:GtkMessageDialog.__init__", kwlist, &py_parent, &py_flags, &py_type, &py_buttons, &message_format)) + return NULL; + if ((PyObject *)py_parent == Py_None) + parent = NULL; + else if (py_parent && pygobject_check(py_parent, &PyGtkWindow_Type)) + parent = GTK_WINDOW(py_parent->obj); + else if (py_parent) { + PyErr_SetString(PyExc_TypeError, "parent should be a GtkWindow or None"); + return NULL; + } + if (pyg_enum_get_value(GTK_TYPE_DIALOG_FLAGS, py_flags, (gint *)&flags)) + return NULL; + if (pyg_enum_get_value(GTK_TYPE_MESSAGE_TYPE, py_type, (gint *)&type)) + return NULL; + if (pyg_enum_get_value(GTK_TYPE_BUTTONS_TYPE, py_buttons, (gint *)&buttons)) + return NULL; + + self->obj = (GObject *)gtk_message_dialog_new(parent, flags, type, buttons, "%s", message_format); + if (!self->obj) { + PyErr_SetString(PyExc_RuntimeError, "could not create GtkMessageDialog object"); + return NULL; + } + gtk_object_ref(GTK_OBJECT(self->obj)); + gtk_object_sink(GTK_OBJECT(self->obj)); + pygobject_register_wrapper((PyObject *)self); + Py_INCREF(Py_None); + return Py_None; +} |