Call signature of Gtk2::MessageDialog->new
- From: Bjarne Steinsbø <bosteins broadpark no>
- To: gtk-perl list <gtk-perl-list gnome org>
- Subject: Call signature of Gtk2::MessageDialog->new
- Date: Thu, 27 Nov 2003 12:57:03 +0100
A slightly tricky one:
The call signature of Gtk2::MessageDialog->new () is not consistent with
the C documentation. It's now:
GtkWidget *
gtk_message_dialog_new (class, parent, flags, type, buttons, message)
GtkWindow_ornull * parent
GtkDialogFlags flags
GtkMessageType type
GtkButtonsType buttons
char * message
From C, the message part is a printf()-style format string, with
additional arguments allowed for the sprintf.
Now, even I can understand why you don't want to pass the varargs
through to gtk+, you would have to parse the format string in order to
determine what data types to map the additional arguments to.
But what about doing the sprintf (the perl one) from the xs layer to
keep the signatures identical? The one remaining problem (which is also
present in the current implementation) is that any '%' in the string
would be interpreted by the sprintf in gtk+ as a go-ahead to eat up more
arguments, worst case dumping core and best case producing garbage.
So, how about calling gtk+ as:
... (parent, flags, type, buttons, '%s', result_of_perl_sprintf);
Bjarne
P.S. The same goes of course for Gtk2::MessageDialog->new_with_markup
() in gtk-2.3.0
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]