[gimp] libgimp: gimp_procedure_dialog_fill() allows no properties listed.



commit 891097ba2f828fbb1e1aa66892b59683392653d4
Author: Jehan <jehan girinstud io>
Date:   Mon Apr 5 18:51:33 2021 +0200

    libgimp: gimp_procedure_dialog_fill() allows no properties listed.
    
    As the docs says, this was always allowed and would just imply we want a
    dialog with all properties in order of declaration.
    
    Yet this usage would output this warning:
    
    > plug-ins/file-fli/fli-gimp.c:976:3: warning: not enough variable arguments to fit a sentinel [-Wformat=]
    
    This commit take care of this warning.

 libgimp/gimpproceduredialog.c | 18 ++++++------------
 libgimp/gimpproceduredialog.h |  1 -
 2 files changed, 6 insertions(+), 13 deletions(-)
---
diff --git a/libgimp/gimpproceduredialog.c b/libgimp/gimpproceduredialog.c
index 0d764cc2aa..3e64384bf1 100644
--- a/libgimp/gimpproceduredialog.c
+++ b/libgimp/gimpproceduredialog.c
@@ -781,8 +781,7 @@ gimp_procedure_dialog_get_label (GimpProcedureDialog *dialog,
 /**
  * gimp_procedure_dialog_fill:
  * @dialog: the #GimpProcedureDialog.
- * @first_property: the first property name.
- * @...: a %NULL-terminated list of other property names.
+ * @...: a %NULL-terminated list of property names.
  *
  * Populate @dialog with the widgets corresponding to every listed
  * properties. If the list is empty, @dialog will be filled by the whole
@@ -806,25 +805,20 @@ gimp_procedure_dialog_get_label (GimpProcedureDialog *dialog,
  */
 void
 gimp_procedure_dialog_fill (GimpProcedureDialog *dialog,
-                            const gchar         *first_property,
                             ...)
 {
-  const gchar *prop_name = first_property;
+  const gchar *prop_name;
   GList       *list      = NULL;
   va_list      va_args;
 
   g_return_if_fail (GIMP_IS_PROCEDURE_DIALOG (dialog));
 
-  if (first_property)
-    {
-      va_start (va_args, first_property);
+  va_start (va_args, dialog);
 
-      do
-        list = g_list_prepend (list, (gpointer) prop_name);
-      while ((prop_name = va_arg (va_args, const gchar *)));
+  while ((prop_name = va_arg (va_args, const gchar *)))
+    list = g_list_prepend (list, (gpointer) prop_name);
 
-      va_end (va_args);
-    }
+  va_end (va_args);
 
   list = g_list_reverse (list);
   gimp_procedure_dialog_fill_list (dialog, list);
diff --git a/libgimp/gimpproceduredialog.h b/libgimp/gimpproceduredialog.h
index f8b8137478..c0e6b996df 100644
--- a/libgimp/gimpproceduredialog.h
+++ b/libgimp/gimpproceduredialog.h
@@ -110,7 +110,6 @@ GtkWidget * gimp_procedure_dialog_fill_frame        (GimpProcedureDialog *dialog
                                                      const gchar         *contents_id);
 
 void        gimp_procedure_dialog_fill              (GimpProcedureDialog *dialog,
-                                                     const gchar         *first_property,
                                                      ...) G_GNUC_NULL_TERMINATED;
 void        gimp_procedure_dialog_fill_list         (GimpProcedureDialog *dialog,
                                                      GList               *properties);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]