[gimp] libgimp: always keep the same number of columns for metadata settings.



commit ce9bfdca8da37d8f8d30e06b4f082817986f9197
Author: Jehan <jehan girinstud io>
Date:   Wed Dec 30 22:32:52 2020 +0100

    libgimp: always keep the same number of columns for metadata settings.
    
    I was trying to avoid too large dialogs as this `metadata` frame can
    hold random plug-in settings. But let's go for always the same number as
    columns as the max number of common settings (i.e. most often 3
    columns).

 libgimp/gimpsaveproceduredialog.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)
---
diff --git a/libgimp/gimpsaveproceduredialog.c b/libgimp/gimpsaveproceduredialog.c
index e7c4ec8018..ea4a72825a 100644
--- a/libgimp/gimpsaveproceduredialog.c
+++ b/libgimp/gimpsaveproceduredialog.c
@@ -194,6 +194,9 @@ gimp_save_procedure_dialog_fill_list (GimpProcedureDialog *dialog,
       n_metadata = gimp_save_procedure_get_support_exif (save_procedure) +
                    gimp_save_procedure_get_support_iptc (save_procedure) +
                    gimp_save_procedure_get_support_xmp  (save_procedure);
+      n_metadata = MAX (n_metadata,
+                        gimp_save_procedure_get_support_profile (save_procedure) +
+                        gimp_save_procedure_get_support_thumbnail (save_procedure));
 
       if (gimp_save_procedure_get_support_exif (save_procedure))
         {
@@ -228,8 +231,6 @@ gimp_save_procedure_dialog_fill_list (GimpProcedureDialog *dialog,
 
       /* Line for specific metadata: profile, thumbnail. */
       left = 0;
-      n_metadata = gimp_save_procedure_get_support_profile (save_procedure) +
-                   gimp_save_procedure_get_support_thumbnail (save_procedure);
 
       if (gimp_save_procedure_get_support_profile (save_procedure))
         {
@@ -252,26 +253,23 @@ gimp_save_procedure_dialog_fill_list (GimpProcedureDialog *dialog,
       if (n_metadata > 0)
         top++;
 
-      /* Custom metadata: 2 items per line. */
+      /* Custom metadata: n_metadata items per line. */
       left = 0;
       for (iter = save_dialog->priv->additional_metadata; iter; iter = iter->next)
         {
           widget = gimp_procedure_dialog_get_widget (dialog, iter->data, G_TYPE_NONE);
           g_object_ref (widget);
-          gtk_grid_attach (GTK_GRID (grid), widget, left, top, 3, 1);
-          if (left == 0)
-            {
-              left = 3;
-            }
-          else
+          gtk_grid_attach (GTK_GRID (grid), widget, left, top, 6 / n_metadata, 1);
+          left += 6 / n_metadata;
+          if (left >= 6)
             {
-              left = 0;
               top++;
+              left = 0;
             }
+
           gtk_widget_show (widget);
         }
-      if (left == 3)
-        top++;
+      top++;
 
       /* Last line for comment field. */
       if (gimp_save_procedure_get_support_comment (save_procedure))


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