libgimpwidgets: make a proper function out of the macro...

... gimp_dialog_set_alternative_button_order_from_array()
Macros are not introspectable, which means this call would not be
available for non-C plug-ins. Also adding a "Since: 3.0" since these
macros were added in commit 3be0d13be3.

Note that I don't do the same for the macro
gimp_dialog_set_alternative_button_order() because varargs functions
won't be introspected anyway. So this one can just stay a macro for C
plug-ins only.
This commit is contained in:
Jehan 2019-07-30 13:54:29 +02:00
parent 62d87f15d9
commit 9691d73058
2 changed files with 35 additions and 8 deletions

View file

@ -672,6 +672,32 @@ gimp_dialog_run (GimpDialog *dialog)
return ri.response_id;
}
/**
* gimp_dialog_set_alternative_button_order_from_array:
* @dialog: The #GimpDialog
* @n_buttons: The size of @order
* @order: (array length=n_buttons) array of buttons' response ids.
*
* Reorder @dialog's buttons if "gtk-alternative-button-order" setting
* is set to TRUE. This is mostly a wrapper around the GTK function
* gtk_dialog_set_alternative_button_order(), except it won't output a
* deprecation warning.
*
* Since: 3.0
**/
void
gimp_dialog_set_alternative_button_order_from_array (GimpDialog *dialog,
gint n_buttons,
gint *order)
{
/* since we don't know yet what to do about alternative button order,
* just hide the warnings for now...
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
gtk_dialog_set_alternative_button_order_from_array (dialog, n_buttons, order);
G_GNUC_END_IGNORE_DEPRECATIONS;
}
/**
* gimp_dialogs_show_help_button:
* @show: whether a help button should be added when creating a GimpDialog

View file

@ -93,23 +93,24 @@ void gimp_dialog_add_buttons_valist (GimpDialog *dialog,
gint gimp_dialog_run (GimpDialog *dialog);
void gimp_dialog_set_alternative_button_order_from_array
(GimpDialog *dialog,
gint n_buttons,
gint *order);
/* for internal use only! */
void gimp_dialogs_show_help_button (gboolean show);
/* since we don't know yet what to do about alternative button order,
* just hide the warnings for now...
/* gimp_dialog_set_alternative_button_order() doesn't need a dedicated
* wrapper function because anyway it won't be introspectable.
* GObject-Introspection bindings will have to use
* gimp_dialog_set_alternative_button_order_from_array().
*/
#define gimp_dialog_set_alternative_button_order(d,f...) \
G_GNUC_BEGIN_IGNORE_DEPRECATIONS; \
gtk_dialog_set_alternative_button_order(d,f); \
G_GNUC_END_IGNORE_DEPRECATIONS;
#define gimp_dialog_set_alternative_button_order_from_array(d,n,o) \
G_GNUC_BEGIN_IGNORE_DEPRECATIONS; \
gtk_dialog_set_alternative_button_order_from_array(d,n,o); \
G_GNUC_END_IGNORE_DEPRECATIONS;
G_END_DECLS