[gimp/gtk3-port: 307/391] app: undeprecate everything in propgui/, mostly table -> grid



commit dcc740729bf06cf1b9aaf9c0e5f226da9bc07f31
Author: Michael Natterer <mitch gimp org>
Date:   Thu May 3 00:15:31 2018 +0200

    app: undeprecate everything in propgui/, mostly table -> grid

 app/propgui/gimppropgui-color-balance.c      |   31 ++++++++--------
 app/propgui/gimppropgui-convolution-matrix.c |   17 ++++-----
 app/propgui/gimppropgui-hue-saturation.c     |   50 ++++++++++---------------
 3 files changed, 42 insertions(+), 56 deletions(-)
---
diff --git a/app/propgui/gimppropgui-color-balance.c b/app/propgui/gimppropgui-color-balance.c
index 5508427..75ca5ca 100644
--- a/app/propgui/gimppropgui-color-balance.c
+++ b/app/propgui/gimppropgui-color-balance.c
@@ -44,7 +44,7 @@ create_levels_scale (GObject     *config,
                      const gchar *property_name,
                      const gchar *left,
                      const gchar *right,
-                     GtkWidget   *table,
+                     GtkWidget   *grid,
                      gint         col)
 {
   GtkWidget *label;
@@ -52,21 +52,20 @@ create_levels_scale (GObject     *config,
 
   label = gtk_label_new (left);
   gtk_label_set_xalign (GTK_LABEL (label), 1.0);
-  gtk_table_attach (GTK_TABLE (table), label, 0, 1, col, col + 1,
-                    GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+  gtk_grid_attach (GTK_GRID (grid), label, 0, col, 1, 1);
   gtk_widget_show (label);
 
   scale = gimp_prop_spin_scale_new (config, property_name,
                                     NULL, 0.01, 0.1, 0);
   gimp_spin_scale_set_label (GIMP_SPIN_SCALE (scale), NULL);
   gimp_prop_widget_set_factor (scale, 100.0, 0.0, 0.0, 1);
-  gtk_table_attach_defaults (GTK_TABLE (table), scale, 1, 2, col, col + 1);
+  gtk_widget_set_hexpand (scale, TRUE);
+  gtk_grid_attach (GTK_GRID (grid), scale, 1, col, 1, 1);
   gtk_widget_show (scale);
 
   label = gtk_label_new (right);
   gtk_label_set_xalign (GTK_LABEL (label), 0.0);
-  gtk_table_attach (GTK_TABLE (table), label, 2, 3, col, col + 1,
-                    GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+  gtk_grid_attach (GTK_GRID (grid), label, 2, col, 1, 1);
   gtk_widget_show (label);
 }
 
@@ -83,7 +82,7 @@ _gimp_prop_gui_new_color_balance (GObject                  *config,
   GtkWidget *main_vbox;
   GtkWidget *vbox;
   GtkWidget *hbox;
-  GtkWidget *table;
+  GtkWidget *grid;
   GtkWidget *button;
   GtkWidget *frame;
 
@@ -108,24 +107,24 @@ _gimp_prop_gui_new_color_balance (GObject                  *config,
   gtk_container_add (GTK_CONTAINER (frame), vbox);
   gtk_widget_show (vbox);
 
-  /*  The table containing sliders  */
-  table = gtk_table_new (3, 3, FALSE);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 4);
-  gtk_table_set_row_spacings (GTK_TABLE (table), 2);
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
-  gtk_widget_show (table);
+  /*  The grid containing sliders  */
+  grid = gtk_grid_new ();
+  gtk_grid_set_column_spacing (GTK_GRID (grid), 4);
+  gtk_grid_set_row_spacing (GTK_GRID (grid), 2);
+  gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
+  gtk_widget_show (grid);
 
   create_levels_scale (config, "cyan-red",
                        _("Cyan"), _("Red"),
-                       table, 0);
+                       grid, 0);
 
   create_levels_scale (config, "magenta-green",
                        _("Magenta"), _("Green"),
-                       table, 1);
+                       grid, 1);
 
   create_levels_scale (config, "yellow-blue",
                        _("Yellow"), _("Blue"),
-                       table, 2);
+                       grid, 2);
 
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
diff --git a/app/propgui/gimppropgui-convolution-matrix.c b/app/propgui/gimppropgui-convolution-matrix.c
index 4d24aa5..a59a357 100644
--- a/app/propgui/gimppropgui-convolution-matrix.c
+++ b/app/propgui/gimppropgui-convolution-matrix.c
@@ -142,7 +142,7 @@ _gimp_prop_gui_new_convolution_matrix (GObject                  *config,
 {
   GtkWidget   *main_vbox;
   GtkWidget   *vbox;
-  GtkWidget   *table;
+  GtkWidget   *grid;
   GtkWidget   *hbox;
   GtkWidget   *scale;
   GtkWidget   *vbox2;
@@ -162,11 +162,11 @@ _gimp_prop_gui_new_convolution_matrix (GObject                  *config,
 
   /* matrix */
 
-  table = gtk_table_new (5, 5, TRUE);
-  gtk_table_set_row_spacings (GTK_TABLE (table), 2);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 4);
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
-  gtk_widget_show (table);
+  grid = gtk_grid_new ();
+  gtk_grid_set_row_spacing (GTK_GRID (grid), 2);
+  gtk_grid_set_column_spacing (GTK_GRID (grid), 4);
+  gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
+  gtk_widget_show (grid);
 
   for (y = 0; y < 5; y++)
     {
@@ -178,10 +178,7 @@ _gimp_prop_gui_new_convolution_matrix (GObject                  *config,
                                             convolution_matrix_prop_name (x, y),
                                             1.0, 10.0, 2);
           gtk_entry_set_width_chars (GTK_ENTRY (spin), 8);
-          gtk_table_attach (GTK_TABLE (table), spin,
-                            x, x + 1, y, y + 1,
-                            GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND,
-                            0, 0);
+          gtk_grid_attach (GTK_GRID (grid), spin, y, x, 1, 1);
           gtk_widget_show (spin);
         }
     }
diff --git a/app/propgui/gimppropgui-hue-saturation.c b/app/propgui/gimppropgui-hue-saturation.c
index a50bbc2..261cff7 100644
--- a/app/propgui/gimppropgui-hue-saturation.c
+++ b/app/propgui/gimppropgui-hue-saturation.c
@@ -111,8 +111,7 @@ _gimp_prop_gui_new_hue_saturation (GObject                  *config,
   GtkWidget *main_vbox;
   GtkWidget *frame;
   GtkWidget *vbox;
-  GtkWidget *abox;
-  GtkWidget *table;
+  GtkWidget *grid;
   GtkWidget *scale;
   GtkWidget *button;
   GtkWidget *hbox;
@@ -129,7 +128,7 @@ _gimp_prop_gui_new_hue_saturation (GObject                  *config,
     gint         frame_col;
     gint         frame_row;
   }
-  hue_range_table[] =
+  hue_range_grid[] =
   {
     { N_("M_aster"), N_("Adjust all colors"), 2, 3, 0, 0 },
     { N_("_R"),      N_("Red"),               2, 1, 2, 0 },
@@ -155,29 +154,24 @@ _gimp_prop_gui_new_hue_saturation (GObject                  *config,
   gtk_container_add (GTK_CONTAINER (frame), vbox);
   gtk_widget_show (vbox);
 
-  abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
-  gtk_box_pack_start (GTK_BOX (vbox), abox, TRUE, TRUE, 0);
-  gtk_widget_show (abox);
-
-  /*  The table containing hue ranges  */
-  table = gtk_table_new (7, 5, FALSE);
-  gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
-  gtk_table_set_col_spacing (GTK_TABLE (table), 3, 4);
-  gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
-  gtk_table_set_row_spacing (GTK_TABLE (table), 5, 2);
-  gtk_container_add (GTK_CONTAINER (abox), table);
+  /*  The grid containing hue ranges  */
+  grid = gtk_grid_new ();
+  gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
+  gtk_grid_set_column_spacing (GTK_GRID (grid), 4);
+  gtk_grid_set_row_spacing (GTK_GRID (grid), 2);
+  gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
 
   /*  the radio buttons for hue ranges  */
-  for (i = 0; i < G_N_ELEMENTS (hue_range_table); i++)
+  for (i = 0; i < G_N_ELEMENTS (hue_range_grid); i++)
     {
       button = gtk_radio_button_new_with_mnemonic (group,
-                                                   gettext (hue_range_table[i].label));
+                                                   gettext (hue_range_grid[i].label));
       group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
       g_object_set_data (G_OBJECT (button), "gimp-item-data",
                          GINT_TO_POINTER (i));
 
       gimp_help_set_help_data (button,
-                               gettext (hue_range_table[i].tooltip),
+                               gettext (hue_range_grid[i].tooltip),
                                NULL);
 
       if (i == 0)
@@ -187,12 +181,10 @@ _gimp_prop_gui_new_hue_saturation (GObject                  *config,
           range_radio = button;
         }
 
-      gtk_table_attach (GTK_TABLE (table), button,
-                        hue_range_table[i].label_col,
-                        hue_range_table[i].label_col + 1,
-                        hue_range_table[i].label_row,
-                        hue_range_table[i].label_row + 1,
-                        GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+      gtk_grid_attach (GTK_GRID (grid), button,
+                       hue_range_grid[i].label_col,
+                       hue_range_grid[i].label_row,
+                       1, 1);
 
       if (i > 0)
         {
@@ -201,12 +193,10 @@ _gimp_prop_gui_new_hue_saturation (GObject                  *config,
 
           frame = gtk_frame_new (NULL);
           gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
-          gtk_table_attach (GTK_TABLE (table), frame,
-                            hue_range_table[i].frame_col,
-                            hue_range_table[i].frame_col + 1,
-                            hue_range_table[i].frame_row,
-                            hue_range_table[i].frame_row + 1,
-                            GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+          gtk_grid_attach (GTK_GRID (grid), frame,
+                           hue_range_grid[i].frame_col,
+                           hue_range_grid[i].frame_row,
+                           1, 1);
           gtk_widget_show (frame);
 
           color_area = gimp_color_area_new (&color, GIMP_COLOR_AREA_FLAT, 0);
@@ -229,7 +219,7 @@ _gimp_prop_gui_new_hue_saturation (GObject                  *config,
       gtk_widget_show (button);
     }
 
-  gtk_widget_show (table);
+  gtk_widget_show (grid);
 
   /* Create the 'Overlap' option slider */
   scale = gimp_prop_spin_scale_new (config, "overlap",


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