Cannot call gtk_dialog_new_with_buttons from bindings
Both gtk_dialog_add_buttons
and gtk_dialog_new_with_buttons
have varargs and thus cannot be used by gobject-introspection.
Implementing gtk_dialog_add_buttons
by repeatedly calling gtk_dialog_add_button
is easy enough and exactly replicates the gtk behavior in C.
But implementing gtk_dialog_new_with_buttons
is much more difficult because gtk_dialog_new_empty
, which it uses, is private.
An implementation is this:
(define (dialog:add-buttons dialog buttons-and-responses)
(for-each
(match-lambda
((text response)
(dialog:add-button dialog text response)))
buttons-and-responses)
dialog)
(define (dialog:new-with-buttons title parent flags . buttons-and-responses)
(let ((dialog (make <GtkDialog> #:use-header-bar (and (member 'use-header-bar flags) #t)))
(set-title dialog title)
(set-transient-for dialog parent)
(when (member 'modal flags)
(set-modal dialog #t))
(when (member 'destroy-with-parent flags)
(set-destroy-with-parent dialog #t))
(dialog:add-buttons dialog buttons-and-responses)
dialog))
I don't think it is reasonable to duplicate maintenance of this function like this.
Please provide a gtk_dialog_new_with_buttonsv
that bindings can call.