[gimp] app, plug-ins: use the updated gimp_prop_scale_entry_new() API.



commit d81b151e792c451acb19efd2d4dd77454838ac3c
Author: Jehan <jehan girinstud io>
Date:   Fri Oct 30 00:00:28 2020 +0100

    app, plug-ins: use the updated gimp_prop_scale_entry_new() API.

 app/widgets/gimpstrokeeditor.c        | 13 ++++++++-----
 plug-ins/common/despeckle.c           | 34 +++++++++++++++++++---------------
 plug-ins/common/file-csource.c        | 17 ++++++-----------
 plug-ins/common/file-gbr.c            | 12 +++++++-----
 plug-ins/common/file-heif.c           | 14 +++++++++-----
 plug-ins/common/file-png.c            | 13 ++++++++-----
 plug-ins/common/file-xpm.c            | 19 ++++++-------------
 plug-ins/file-webp/file-webp-dialog.c | 14 ++++++++------
 8 files changed, 71 insertions(+), 65 deletions(-)
---
diff --git a/app/widgets/gimpstrokeeditor.c b/app/widgets/gimpstrokeeditor.c
index d0aef759a7..7da1c4aa5c 100644
--- a/app/widgets/gimpstrokeeditor.c
+++ b/app/widgets/gimpstrokeeditor.c
@@ -106,6 +106,7 @@ gimp_stroke_editor_constructed (GObject *object)
   GimpEnumStore     *store;
   GEnumClass        *enum_class;
   GEnumValue        *value;
+  GtkWidget         *scale;
   GtkWidget         *box;
   GtkWidget         *size;
   GtkWidget         *label;
@@ -164,11 +165,13 @@ gimp_stroke_editor_constructed (GObject *object)
                             _("_Join style:"), 0.0, 0.5,
                             box, 2);
 
-  gimp_prop_scale_entry_new (G_OBJECT (options), "miter-limit",
-                             GTK_GRID (grid), 0, row++,
-                             _("_Miter limit:"),
-                             1.0, 1.0, 1,
-                             FALSE, 0.0, 0.0);
+  scale = gimp_prop_scale_entry_new (G_OBJECT (options), "miter-limit",
+                                     NULL, 1.0, 1.0, 1,
+                                     FALSE, 0.0, 0.0);
+  gtk_widget_hide (gimp_scale_entry_get_label (GIMP_SCALE_ENTRY (scale)));
+  gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
+                            _("_Miter limit:"),
+                            0.0, 0.5, scale, 2);
 
   frame = gtk_frame_new (NULL);
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
diff --git a/plug-ins/common/despeckle.c b/plug-ins/common/despeckle.c
index 0ad02b4fae..52f84ad59b 100644
--- a/plug-ins/common/despeckle.c
+++ b/plug-ins/common/despeckle.c
@@ -385,6 +385,7 @@ despeckle_dialog (GimpProcedure *procedure,
   GtkWidget *grid;
   GtkWidget *frame;
   GtkWidget *button;
+  GtkWidget *scale;
   gint       filter_type;
   gboolean   run;
 
@@ -456,31 +457,34 @@ despeckle_dialog (GimpProcedure *procedure,
    * Box size (diameter) control...
    */
 
-  gimp_prop_scale_entry_new (config, "radius",
-                             GTK_GRID (grid), 0, 0,
-                             _("_Radius:"),
-                             1, 5, 0,
-                             FALSE, 0, 0);
+  scale = gimp_prop_scale_entry_new (config, "radius",
+                                     _("_Radius:"),
+                                     1, 5, 0,
+                                     FALSE, 0, 0);
+  gtk_grid_attach (GTK_GRID (grid), scale, 0, 0, 1, 1);
+  gtk_widget_show (scale);
 
   /*
    * Black level control...
    */
 
-  gimp_prop_scale_entry_new (config, "black",
-                             GTK_GRID (grid), 0, 1,
-                             _("_Black level:"),
-                             1, 8, 0,
-                             FALSE, 0, 0);
+  scale = gimp_prop_scale_entry_new (config, "black",
+                                     _("_Black level:"),
+                                     1, 8, 0,
+                                     FALSE, 0, 0);
+  gtk_grid_attach (GTK_GRID (grid), scale, 0, 1, 1, 1);
+  gtk_widget_show (scale);
 
   /*
    * White level control...
    */
 
-  gimp_prop_scale_entry_new (config, "white",
-                             GTK_GRID (grid), 0, 2,
-                             _("_White level:"),
-                             1, 8, 0,
-                             FALSE, 0, 0);
+  scale = gimp_prop_scale_entry_new (config, "white",
+                                     _("_White level:"),
+                                     1, 8, 0,
+                                     FALSE, 0, 0);
+  gtk_grid_attach (GTK_GRID (grid), scale, 0, 2, 1, 1);
+  gtk_widget_show (scale);
 
   g_signal_connect_swapped (config, "notify",
                             G_CALLBACK (gimp_preview_invalidate),
diff --git a/plug-ins/common/file-csource.c b/plug-ins/common/file-csource.c
index 1454599fb7..818092ac87 100644
--- a/plug-ins/common/file-csource.c
+++ b/plug-ins/common/file-csource.c
@@ -959,6 +959,7 @@ save_dialog (GimpProcedure *procedure,
   GtkWidget *grid;
   GtkWidget *entry;
   GtkWidget *toggle;
+  GtkWidget *scale;
   gboolean   run;
 
   dialog = gimp_procedure_dialog_new (procedure,
@@ -1034,17 +1035,11 @@ save_dialog (GimpProcedure *procedure,
 
   /* Max Alpha Value
    */
-  grid = gtk_grid_new ();
-  gtk_grid_set_column_spacing (GTK_GRID (grid), 4);
-  gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
-  gtk_widget_show (grid);
-
-  gimp_prop_scale_entry_new (config, "opacity",
-                             GTK_GRID (grid), 0, 0,
-                             _("Op_acity:"),
-                             1, 10, 1,
-                             FALSE, 0, 0);
-
+  scale = gimp_prop_scale_entry_new (config, "opacity",
+                                     _("Op_acity:"), 1, 10, 1,
+                                     FALSE, 0, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 4);
+  gtk_widget_show (scale);
   gtk_widget_show (dialog);
 
   run = gimp_procedure_dialog_run (GIMP_PROCEDURE_DIALOG (dialog));
diff --git a/plug-ins/common/file-gbr.c b/plug-ins/common/file-gbr.c
index 106225eda4..4b882bdb5b 100644
--- a/plug-ins/common/file-gbr.c
+++ b/plug-ins/common/file-gbr.c
@@ -293,6 +293,7 @@ save_dialog (GimpProcedure *procedure,
   GtkWidget *dialog;
   GtkWidget *grid;
   GtkWidget *entry;
+  GtkWidget *scale;
   gboolean   run;
 
   dialog = gimp_procedure_dialog_new (procedure,
@@ -316,11 +317,12 @@ save_dialog (GimpProcedure *procedure,
                             _("_Description:"), 1.0, 0.5,
                             entry, 2);
 
-  gimp_prop_scale_entry_new (config, "spacing",
-                             GTK_GRID (grid), 0, 1,
-                             _("_Spacing:"),
-                             1, 10, 0,
-                             FALSE, 0, 0);
+  scale = gimp_prop_scale_entry_new (config, "spacing",
+                                     NULL, 1, 10, 0,
+                                     FALSE, 0, 0);
+  gtk_widget_hide (gimp_scale_entry_get_label (GIMP_SCALE_ENTRY (scale)));
+  gimp_grid_attach_aligned (GTK_GRID (grid), 0, 1,
+                            _("_Spacing:"), 0.0, 0.5, scale, 4);
 
   gtk_widget_show (dialog);
 
diff --git a/plug-ins/common/file-heif.c b/plug-ins/common/file-heif.c
index bcd27b5812..8a8393c03e 100644
--- a/plug-ins/common/file-heif.c
+++ b/plug-ins/common/file-heif.c
@@ -2480,6 +2480,7 @@ save_dialog (GimpProcedure *procedure,
   GtkWidget *main_vbox;
   GtkWidget *grid;
   GtkWidget *button;
+  GtkWidget *scale;
   GtkWidget *frame;
 #if LIBHEIF_HAVE_VERSION(1,8,0)
   GtkWidget *grid2;
@@ -2519,11 +2520,14 @@ save_dialog (GimpProcedure *procedure,
                           G_BINDING_SYNC_CREATE |
                           G_BINDING_INVERT_BOOLEAN);
 
-  gimp_prop_scale_entry_new (config, "quality",
-                             GTK_GRID (grid), 0, 1,
-                             _("_Quality"),
-                             1, 10, 0,
-                             FALSE, 0, 0);
+  scale = gimp_prop_scale_entry_new (config, "quality",
+                                     NULL,
+                                     1, 10, 0,
+                                     FALSE, 0, 0);
+  gtk_widget_hide (gimp_scale_entry_get_label (GIMP_SCALE_ENTRY (scale)));
+  gimp_grid_attach_aligned (GTK_GRID (grid), 0, 1,
+                            _("_Quality"),
+                            0.0, 0.5, scale, 2);
 
 #if LIBHEIF_HAVE_VERSION(1,9,0)
   store = gimp_int_store_new (_("RGB"), HEIFPLUGIN_EXPORT_FORMAT_RGB,
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index 0138d0fe97..e9d22cc27f 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -2206,6 +2206,7 @@ save_dialog (GimpImage     *image,
   GtkWidget    *button;
   GtkListStore *store;
   GtkWidget    *combo;
+  GtkWidget    *scale;
   GimpParasite *parasite;
   gint          col;
   gint          row;
@@ -2323,11 +2324,13 @@ save_dialog (GimpImage     *image,
                             combo, 2);
 
   /* Compression level scale */
-  gimp_prop_scale_entry_new (config, "compression",
-                             GTK_GRID (grid), 0, 1,
-                             _("Co_mpression level:"),
-                             1, 1, 0,
-                             FALSE, 0, 0);
+  scale = gimp_prop_scale_entry_new (config, "compression",
+                                     NULL, 1, 1, 0,
+                                     FALSE, 0, 0);
+  gtk_widget_hide (gimp_scale_entry_get_label (GIMP_SCALE_ENTRY (scale)));
+  gimp_grid_attach_aligned (GTK_GRID (grid), 0, 1,
+                            _("Co_mpression level:"),
+                            0.0, 0.5, scale, 2);
 
   gtk_widget_show (dialog);
 
diff --git a/plug-ins/common/file-xpm.c b/plug-ins/common/file-xpm.c
index 41dd853b29..0c5deef529 100644
--- a/plug-ins/common/file-xpm.c
+++ b/plug-ins/common/file-xpm.c
@@ -889,26 +889,19 @@ save_dialog (GimpProcedure *procedure,
              GObject       *config)
 {
   GtkWidget *dialog;
-  GtkWidget *grid;
+  GtkWidget *scale;
   gboolean   run;
 
   dialog = gimp_procedure_dialog_new (procedure,
                                       GIMP_PROCEDURE_CONFIG (config),
                                       _("Export Image as XPM"));
 
-  grid = gtk_grid_new ();
-  gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
-  gtk_container_set_border_width (GTK_CONTAINER (grid), 12);
+  scale = gimp_prop_scale_entry_new (config, "threshold",
+                                     NULL, 1, 8, 0,
+                                     FALSE, 0, 0);
   gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
-                      grid, TRUE, TRUE, 0);
-  gtk_widget_show (grid);
-
-  gimp_prop_scale_entry_new (config, "threshold",
-                             GTK_GRID (grid), 0, 0,
-                             _("_Alpha threshold:"),
-                             1, 8, 0,
-                             FALSE, 0, 0);
-
+                      scale, TRUE, TRUE, 6);
+  gtk_widget_show (scale);
   gtk_widget_show (dialog);
 
   run = gimp_procedure_dialog_run (GIMP_PROCEDURE_DIALOG (dialog));
diff --git a/plug-ins/file-webp/file-webp-dialog.c b/plug-ins/file-webp/file-webp-dialog.c
index 06e4c4b574..4f520fe9cf 100644
--- a/plug-ins/file-webp/file-webp-dialog.c
+++ b/plug-ins/file-webp/file-webp-dialog.c
@@ -35,7 +35,7 @@
 static void
 save_dialog_toggle_scale (GObject          *config,
                           const GParamSpec *pspec,
-                          GtkAdjustment    *adjustment)
+                          GtkWidget        *scale)
 {
   gboolean lossless;
 
@@ -43,7 +43,7 @@ save_dialog_toggle_scale (GObject          *config,
                 "lossless", &lossless,
                 NULL);
 
-  gimp_scale_entry_set_sensitive (adjustment, ! lossless);
+  gtk_widget_set_sensitive (scale, ! lossless);
 }
 
 static void
@@ -86,8 +86,8 @@ save_dialog (GimpImage     *image,
   GtkWidget     *toggle;
   GtkListStore  *store;
   GtkWidget     *combo;
-  GtkAdjustment *quality_scale;
-  GtkAdjustment *alpha_quality_scale;
+  GtkWidget     *quality_scale;
+  GtkWidget     *alpha_quality_scale;
   gint32         nlayers;
   gboolean       animation_supported = FALSE;
   gboolean       run;
@@ -122,17 +122,19 @@ save_dialog (GimpImage     *image,
 
   /* Create the slider for image quality */
   quality_scale = gimp_prop_scale_entry_new (config, "quality",
-                                             GTK_GRID (grid), 0, row++,
                                              _("Image _quality:"),
                                              1.0, 10.0, 0,
                                              FALSE, 0, 0);
+  gtk_grid_attach (GTK_GRID (grid), quality_scale, 0, row++, 3, 1);
+  gtk_widget_show (quality_scale);
 
   /* Create the slider for alpha channel quality */
   alpha_quality_scale = gimp_prop_scale_entry_new (config, "alpha-quality",
-                                                   GTK_GRID (grid), 0, row++,
                                                    _("Alpha q_uality:"),
                                                    1.0, 10.0, 0,
                                                    FALSE, 0, 0);
+  gtk_grid_attach (GTK_GRID (grid), alpha_quality_scale, 0, row++, 3, 1);
+  gtk_widget_show (alpha_quality_scale);
 
   /* Enable and disable the sliders when the lossless option is selected */
   g_signal_connect (config, "notify::lossless",


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