GNOME Bugzilla – Bug 141004
GtkFileChooserDialog use varargs which is difficult for language bindings
Last modified: 2012-10-09 15:52:30 UTC
The API for creating a new GtkFileChooserDialog or GtkFileChooserWidget use C's varargs feature and do not provide an alternative. This feature of C is particularly hard for some language's foreign functions interfaces. For example Haskell's (otherwise excelent) FFI does not support varargs at all. In most places in the GTK API where varargs are used (which I understand is easier for C programmers to use), there is also an alternative API that is easier for language bindings. GtkFileChooserDialog and GtkFileChooserWidget provide no alternative. For the Haskel bindings I have been forced to go look at the code inside the gtk_file_chooser_(dialog|widget)_new constructor and replicate it as Haskell code. This is obviously not good from a maintainance point of view. So a request for an accessable alternative like the rest of GTK provides, for example see g_object_new () vs g_object_newv (). BTW, the rest of the GtkFileChooser API is nice and simple to wrap. Well thought out.
Oops, GtkFileChooserWidget doen't use varargs. My mistake. Only GtkFileChooserDialog uses varargs: gtk_file_chooser_dialog_new gtk_file_chooser_dialog_new_with_backend
gtk_dialog_add_button() is all that is needed for a language binding to provide whatever button-adding-interface it wants.
Re-opening, there should be a language friendly constructor for GtkFileChooserDialog which does not use varargs.
*** Bug 630588 has been marked as a duplicate of this bug. ***
How do you deal with e.g. GtkMessageDialog?
Closing as we now have GObject Introspection.