[gimp] libgimpwidgets: make a proper function out of the macro...
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpwidgets: make a proper function out of the macro...
- Date: Tue, 30 Jul 2019 12:13:31 +0000 (UTC)
commit 9691d73058ba1ad924821d565c722ada6013fb6a
Author: Jehan <jehan girinstud io>
Date: Tue Jul 30 13:54:29 2019 +0200
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 3be0d13be34.
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.
libgimpwidgets/gimpdialog.c | 26 ++++++++++++++++++++++++++
libgimpwidgets/gimpdialog.h | 17 +++++++++--------
2 files changed, 35 insertions(+), 8 deletions(-)
---
diff --git a/libgimpwidgets/gimpdialog.c b/libgimpwidgets/gimpdialog.c
index c1457d2342..79be39f987 100644
--- a/libgimpwidgets/gimpdialog.c
+++ b/libgimpwidgets/gimpdialog.c
@@ -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
diff --git a/libgimpwidgets/gimpdialog.h b/libgimpwidgets/gimpdialog.h
index 6e774cfe62..b6a3842a20 100644
--- a/libgimpwidgets/gimpdialog.h
+++ b/libgimpwidgets/gimpdialog.h
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]