[gimp/gtk3-port: 330/457] app: kill the last GtkTables.



commit b57eb87dc5a2ba144977c6330c054cd4a9896d86
Author: Simon Budig <simon budig de>
Date:   Fri May 4 02:19:39 2018 +0200

    app: kill the last GtkTables.

 app/widgets/gimpcolormapeditor.c    |   26 +++++++++--------
 app/widgets/gimpcontrollereditor.c  |   53 ++++++++++++++++++-----------------
 app/widgets/gimpdynamicseditor.c    |   44 +++++++++++++----------------
 app/widgets/gimpgrideditor.c        |   32 +++++++++++----------
 app/widgets/gimphistogrameditor.c   |   18 +++++------
 app/widgets/gimpsamplepointeditor.c |   22 +++++++-------
 app/widgets/gimpsamplepointeditor.h |    2 +-
 libgimpwidgets/gimppropwidgets.c    |    1 +
 8 files changed, 99 insertions(+), 99 deletions(-)
---
diff --git a/app/widgets/gimpcolormapeditor.c b/app/widgets/gimpcolormapeditor.c
index 9189e2a..18ac423 100644
--- a/app/widgets/gimpcolormapeditor.c
+++ b/app/widgets/gimpcolormapeditor.c
@@ -149,7 +149,7 @@ static void
 gimp_colormap_editor_init (GimpColormapEditor *editor)
 {
   GtkWidget *frame;
-  GtkWidget *table;
+  GtkWidget *grid;
 
   frame = gtk_frame_new (NULL);
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
@@ -186,30 +186,32 @@ gimp_colormap_editor_init (GimpColormapEditor *editor)
                     editor);
 
   /*  Some helpful hints  */
-  table = gtk_table_new (2, 2, FALSE);
-  gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
-  gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
-  gtk_box_pack_end (GTK_BOX (editor), table, FALSE, FALSE, 0);
-  gtk_widget_show (table);
+  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_end (GTK_BOX (editor), grid, FALSE, FALSE, 0);
+  gtk_widget_show (grid);
 
   editor->index_adjustment = gtk_adjustment_new (0, 0, 0, 1, 10, 0);
   editor->index_spinbutton = gtk_spin_button_new (editor->index_adjustment,
                                                   1.0, 0);
+  gtk_widget_set_halign (editor->index_spinbutton, GTK_ALIGN_START);
   gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (editor->index_spinbutton),
                                TRUE);
-  gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
-                             _("Color index:"), 0.0, 0.5,
-                             editor->index_spinbutton, 1, TRUE);
+  gimp_grid_attach_aligned (GTK_GRID (grid), 0, 0,
+                            _("Color index:"), 0.0, 0.5,
+                            editor->index_spinbutton, 1);
 
   g_signal_connect (editor->index_adjustment, "value-changed",
                     G_CALLBACK (gimp_colormap_adjustment_changed),
                     editor);
 
   editor->color_entry = gimp_color_hex_entry_new ();
+  gtk_widget_set_halign (editor->color_entry, GTK_ALIGN_START);
   gtk_entry_set_width_chars (GTK_ENTRY (editor->color_entry), 12);
-  gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
-                             _("HTML notation:"), 0.0, 0.5,
-                             editor->color_entry, 1, TRUE);
+  gimp_grid_attach_aligned (GTK_GRID (grid), 0, 1,
+                            _("HTML notation:"), 0.0, 0.5,
+                            editor->color_entry, 1);
 
   g_signal_connect (editor->color_entry, "color-changed",
                     G_CALLBACK (gimp_colormap_hex_entry_changed),
diff --git a/app/widgets/gimpcontrollereditor.c b/app/widgets/gimpcontrollereditor.c
index 3a82a56..0e9060f 100644
--- a/app/widgets/gimpcontrollereditor.c
+++ b/app/widgets/gimpcontrollereditor.c
@@ -161,7 +161,7 @@ gimp_controller_editor_constructed (GObject *object)
   GtkListStore         *store;
   GtkWidget            *frame;
   GtkWidget            *vbox;
-  GtkWidget            *table;
+  GtkWidget            *grid;
   GtkWidget            *hbox;
   GtkWidget            *button;
   GtkWidget            *tv;
@@ -213,25 +213,25 @@ gimp_controller_editor_constructed (GObject *object)
   gtk_container_add (GTK_CONTAINER (frame), vbox);
   gtk_widget_show (vbox);
 
-  table = gtk_table_new (2, 2, FALSE);
-  gtk_table_set_row_spacings (GTK_TABLE (table), 6);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 6);
-  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), 6);
+  gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
+  gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
+  gtk_widget_show (grid);
 
   row = 0;
 
-  gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
-                             _("Name:"), 0.0, 0.5,
-                             gimp_prop_label_new (G_OBJECT (controller),
-                                                  "name"),
-                             1, TRUE);
+  gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
+                            _("Name:"), 0.0, 0.5,
+                            gimp_prop_label_new (G_OBJECT (controller),
+                                                 "name"),
+                            1);
 
-  gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
-                             _("State:"), 0.0, 0.5,
-                             gimp_prop_label_new (G_OBJECT (controller),
-                                                  "state"),
-                             1, TRUE);
+  gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
+                            _("State:"), 0.0, 0.5,
+                            gimp_prop_label_new (G_OBJECT (controller),
+                                                 "state"),
+                            1);
 
   property_specs =
     g_object_class_list_properties (G_OBJECT_CLASS (controller_class),
@@ -249,21 +249,22 @@ gimp_controller_editor_constructed (GObject *object)
         {
           widget = gimp_controller_string_view_new (controller, pspec);
 
-          gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
-                                     g_param_spec_get_nick (pspec),
-                                     0.0, 0.5,
-                                     widget,
-                                     1, FALSE);
+          gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
+                                    g_param_spec_get_nick (pspec),
+                                    0.0, 0.5,
+                                    widget,
+                                    1);
         }
       else if (G_IS_PARAM_SPEC_INT (pspec))
         {
           widget = gimp_controller_int_view_new (controller, pspec);
+          gtk_widget_set_halign (widget, GTK_ALIGN_START);
 
-          gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
-                                     g_param_spec_get_nick (pspec),
-                                     0.0, 0.5,
-                                     widget,
-                                     1, TRUE);
+          gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
+                                    g_param_spec_get_nick (pspec),
+                                    0.0, 0.5,
+                                    widget,
+                                    1);
         }
     }
 
diff --git a/app/widgets/gimpdynamicseditor.c b/app/widgets/gimpdynamicseditor.c
index 3d5e602..e2e967c 100644
--- a/app/widgets/gimpdynamicseditor.c
+++ b/app/widgets/gimpdynamicseditor.c
@@ -60,7 +60,7 @@ static void   gimp_dynamics_editor_add_icon_editor (GimpDynamics       *dynamics
 
 static void   gimp_dynamics_editor_add_output_row  (GObject     *config,
                                                     const gchar *row_label,
-                                                    GtkTable    *table,
+                                                    GtkGrid     *grid,
                                                     gint         row);
 
 static void gimp_dynamics_editor_init_output_editors (GimpDynamics *dynamics,
@@ -70,7 +70,7 @@ static void gimp_dynamics_editor_init_output_editors (GimpDynamics *dynamics,
 
 static GtkWidget * dynamics_check_button_new       (GObject     *config,
                                                     const gchar *property_name,
-                                                    GtkTable    *table,
+                                                    GtkGrid     *grid,
                                                     gint         column,
                                                     gint         row);
 
@@ -130,7 +130,7 @@ gimp_dynamics_editor_constructed (GObject *object)
   GtkWidget          *input_labels[7];
   GtkWidget          *vbox;
   GtkWidget          *icon_box;
-  GtkWidget          *table;
+  GtkWidget          *grid;
   gint                n_inputs    = G_N_ELEMENTS (input_labels);
   gint                i;
 
@@ -149,14 +149,14 @@ gimp_dynamics_editor_constructed (GObject *object)
                                         data_editor->context->gimp,
                                         vbox);
 
-  table = gtk_table_new (10, n_inputs + 2, FALSE);
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
-  gtk_widget_show (table);
+  grid = gtk_grid_new ();
+  gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
+  gtk_widget_show (grid);
 
   gimp_dynamics_editor_init_output_editors (dynamics,
                                             editor->view_selector,
                                             editor->notebook,
-                                            table);
+                                            grid);
 
   input_labels[0] = gtk_label_new (_("Pressure"));
   input_labels[1] = gtk_label_new (_("Velocity"));
@@ -171,9 +171,7 @@ gimp_dynamics_editor_constructed (GObject *object)
       gtk_label_set_angle (GTK_LABEL (input_labels[i]), 90);
       gtk_label_set_yalign (GTK_LABEL (input_labels[i]), 1.0);
 
-      gtk_table_attach (GTK_TABLE (table), input_labels[i],
-                        i + 1, i + 2, 0, 1,
-                        GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+      gtk_grid_attach (GTK_GRID (grid), input_labels[i], i + 1, 0, 1, 1);
       gtk_widget_show (input_labels[i]);
     }
 
@@ -324,7 +322,7 @@ gimp_dynamics_editor_add_icon_editor (GimpDynamics *dynamics,
 static void
 gimp_dynamics_editor_add_output_row (GObject     *config,
                                      const gchar *row_label,
-                                     GtkTable    *table,
+                                     GtkGrid     *grid,
                                      gint         row)
 {
   GtkWidget *label;
@@ -332,43 +330,42 @@ gimp_dynamics_editor_add_output_row (GObject     *config,
 
   label = gtk_label_new (row_label);
   gtk_label_set_xalign (GTK_LABEL (label), 0.0);
-  gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row + 1,
-                    GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+  gtk_grid_attach (grid, label, 0, row, 1, 1);
   gtk_widget_show (label);
 
   dynamics_check_button_new (config, "use-pressure",
-                             table, column, row);
+                             grid, column, row);
   column++;
 
   dynamics_check_button_new (config, "use-velocity",
-                             table, column, row);
+                             grid, column, row);
   column++;
 
   dynamics_check_button_new (config, "use-direction",
-                             table, column, row);
+                             grid, column, row);
   column++;
 
   dynamics_check_button_new (config,  "use-tilt",
-                             table, column, row);
+                             grid, column, row);
   column++;
 
   dynamics_check_button_new (config,  "use-wheel",
-                             table, column, row);
+                             grid, column, row);
   column++;
 
   dynamics_check_button_new (config, "use-random",
-                             table, column, row);
+                             grid, column, row);
   column++;
 
   dynamics_check_button_new (config, "use-fade",
-                             table, column, row);
+                             grid, column, row);
   column++;
 }
 
 static GtkWidget *
 dynamics_check_button_new (GObject     *config,
                            const gchar *property_name,
-                           GtkTable    *table,
+                           GtkGrid     *grid,
                            gint         column,
                            gint         row)
 {
@@ -376,8 +373,7 @@ dynamics_check_button_new (GObject     *config,
 
   button = gimp_prop_check_button_new (config, property_name, NULL);
   gtk_widget_destroy (gtk_bin_get_child (GTK_BIN (button)));
-  gtk_table_attach (table, button, column, column + 1, row, row + 1,
-                    GTK_SHRINK, GTK_SHRINK, 0, 0);
+  gtk_grid_attach (grid, button, column, row, 1, 1);
   gtk_widget_show (button);
 
   return button;
@@ -422,7 +418,7 @@ gimp_dynamics_editor_init_output_editors (GimpDynamics *dynamics,
 
       gimp_dynamics_editor_add_output_row (G_OBJECT (output),
                                            label,
-                                           GTK_TABLE (check_grid),
+                                           GTK_GRID (check_grid),
                                            i);
 
       g_free (label);
diff --git a/app/widgets/gimpgrideditor.c b/app/widgets/gimpgrideditor.c
index 11390b1..6e0d088 100644
--- a/app/widgets/gimpgrideditor.c
+++ b/app/widgets/gimpgrideditor.c
@@ -122,7 +122,7 @@ gimp_grid_editor_constructed (GObject *object)
   GimpGridEditor *editor = GIMP_GRID_EDITOR (object);
   GtkWidget      *frame;
   GtkWidget      *hbox;
-  GtkWidget      *table;
+  GtkWidget      *grid;
   GtkWidget      *style;
   GtkWidget      *color_button;
   GtkWidget      *sizeentry;
@@ -135,41 +135,43 @@ gimp_grid_editor_constructed (GObject *object)
   gtk_box_pack_start (GTK_BOX (editor), frame, FALSE, FALSE, 0);
   gtk_widget_show (frame);
 
-  table = gtk_table_new (3, 2, FALSE);
-  gtk_table_set_row_spacings (GTK_TABLE (table), 6);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 6);
-  gtk_container_add (GTK_CONTAINER (frame), table);
+  grid = gtk_grid_new ();
+  gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
+  gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
+  gtk_container_add (GTK_CONTAINER (frame), grid);
 
   style = gimp_prop_enum_combo_box_new (G_OBJECT (editor->grid), "style",
                                         GIMP_GRID_DOTS,
                                         GIMP_GRID_SOLID);
-  gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
-                             _("Line _style:"), 0.0, 0.5,
-                             style, 1, FALSE);
+  gimp_grid_attach_aligned (GTK_GRID (grid), 0, 0,
+                            _("Line _style:"), 0.0, 0.5,
+                            style, 1);
 
   color_button = gimp_prop_color_button_new (G_OBJECT (editor->grid), "fgcolor",
                                              _("Change grid foreground color"),
                                              GRID_EDITOR_COLOR_BUTTON_WIDTH,
                                              GRID_EDITOR_COLOR_BUTTON_HEIGHT,
                                              GIMP_COLOR_AREA_FLAT);
+  gtk_widget_set_halign (color_button, GTK_ALIGN_START);
   gimp_color_panel_set_context (GIMP_COLOR_PANEL (color_button),
                                 editor->context);
-  gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
-                             _("_Foreground color:"), 0.0, 0.5,
-                             color_button, 1, TRUE);
+  gimp_grid_attach_aligned (GTK_GRID (grid), 0, 1,
+                            _("_Foreground color:"), 0.0, 0.5,
+                            color_button, 1);
 
   color_button = gimp_prop_color_button_new (G_OBJECT (editor->grid), "bgcolor",
                                              _("Change grid background color"),
                                              GRID_EDITOR_COLOR_BUTTON_WIDTH,
                                              GRID_EDITOR_COLOR_BUTTON_HEIGHT,
                                              GIMP_COLOR_AREA_FLAT);
+  gtk_widget_set_halign (color_button, GTK_ALIGN_START);
   gimp_color_panel_set_context (GIMP_COLOR_PANEL (color_button),
                                 editor->context);
-  gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
-                             _("_Background color:"), 0.0, 0.5,
-                             color_button, 1, TRUE);
+  gimp_grid_attach_aligned (GTK_GRID (grid), 0, 2,
+                            _("_Background color:"), 0.0, 0.5,
+                            color_button, 1);
 
-  gtk_widget_show (table);
+  gtk_widget_show (grid);
 
   frame = gimp_frame_new (_("Spacing"));
   gtk_box_pack_start (GTK_BOX (editor), frame, FALSE, FALSE, 0);
diff --git a/app/widgets/gimphistogrameditor.c b/app/widgets/gimphistogrameditor.c
index d2538fe..7758013 100644
--- a/app/widgets/gimphistogrameditor.c
+++ b/app/widgets/gimphistogrameditor.c
@@ -122,7 +122,7 @@ gimp_histogram_editor_init (GimpHistogramEditor *editor)
   GtkWidget         *hbox;
   GtkWidget         *label;
   GtkWidget         *menu;
-  GtkWidget         *table;
+  GtkWidget         *grid;
   gint               i;
 
   const gchar *gimp_histogram_editor_labels[] =
@@ -189,11 +189,10 @@ gimp_histogram_editor_init (GimpHistogramEditor *editor)
                             G_CALLBACK (gimp_histogram_editor_view_draw),
                             editor);
 
-  table = gtk_table_new (3, 4, FALSE);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 2);
-  gtk_table_set_col_spacing (GTK_TABLE (table), 1, 6);
-  gtk_box_pack_start (GTK_BOX (editor), table, FALSE, FALSE, 0);
-  gtk_widget_show (table);
+  grid = gtk_grid_new ();
+  gtk_grid_set_column_spacing (GTK_GRID (grid), 2);
+  gtk_box_pack_start (GTK_BOX (editor), grid, FALSE, FALSE, 0);
+  gtk_widget_show (grid);
 
   for (i = 0; i < 6; i++)
     {
@@ -206,8 +205,8 @@ gimp_histogram_editor_init (GimpHistogramEditor *editor)
                                  PANGO_ATTR_SCALE,  PANGO_SCALE_SMALL,
                                  -1);
       gtk_label_set_xalign (GTK_LABEL (label), 1.0);
-      gtk_table_attach (GTK_TABLE (table), label, x, x + 1, y, y + 1,
-                        GTK_FILL | GTK_EXPAND, GTK_FILL, 2, 2);
+      gtk_widget_set_hexpand (label, TRUE);
+      gtk_grid_attach (GTK_GRID (grid), label, x, y, 1, 1);
       gtk_widget_show (label);
 
       editor->labels[i] =
@@ -219,8 +218,7 @@ gimp_histogram_editor_init (GimpHistogramEditor *editor)
       gimp_label_set_attributes (GTK_LABEL (editor->labels[i]),
                                  PANGO_ATTR_SCALE, PANGO_SCALE_SMALL,
                                  -1);
-      gtk_table_attach (GTK_TABLE (table), label, x + 1, x + 2, y, y + 1,
-                        GTK_FILL, GTK_FILL, 2, 2);
+      gtk_grid_attach (GTK_GRID (grid), label, x + 1, y, 1, 1);
       gtk_widget_show (label);
     }
 }
diff --git a/app/widgets/gimpsamplepointeditor.c b/app/widgets/gimpsamplepointeditor.c
index 741ca94..fe7a956 100644
--- a/app/widgets/gimpsamplepointeditor.c
+++ b/app/widgets/gimpsamplepointeditor.c
@@ -161,11 +161,11 @@ gimp_sample_point_editor_init (GimpSamplePointEditor *editor)
                              -1);
   gtk_box_pack_start (GTK_BOX (vbox), editor->empty_label, TRUE, TRUE, 0);
 
-  editor->table = gtk_table_new (1, 2, TRUE);
-  gtk_table_set_row_spacings (GTK_TABLE (editor->table), content_spacing);
-  gtk_table_set_col_spacings (GTK_TABLE (editor->table), content_spacing);
-  gtk_box_pack_start (GTK_BOX (vbox), editor->table, FALSE, FALSE, 0);
-  gtk_widget_show (editor->table);
+  editor->grid = gtk_grid_new ();
+  gtk_grid_set_row_spacing (GTK_GRID (editor->grid), content_spacing);
+  gtk_grid_set_column_spacing (GTK_GRID (editor->grid), content_spacing);
+  gtk_box_pack_start (GTK_BOX (vbox), editor->grid, FALSE, FALSE, 0);
+  gtk_widget_show (editor->grid);
 }
 
 static void
@@ -238,7 +238,7 @@ gimp_sample_point_editor_style_updated (GtkWidget *widget)
 
   GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
-  if (editor->table)
+  if (editor->grid)
     {
       gint content_spacing;
 
@@ -246,8 +246,8 @@ gimp_sample_point_editor_style_updated (GtkWidget *widget)
                             "content-spacing", &content_spacing,
                             NULL);
 
-      gtk_table_set_row_spacings (GTK_TABLE (editor->table), content_spacing);
-      gtk_table_set_col_spacings (GTK_TABLE (editor->table), content_spacing);
+      gtk_grid_set_row_spacing (GTK_GRID (editor->grid), content_spacing);
+      gtk_grid_set_column_spacing (GTK_GRID (editor->grid), content_spacing);
     }
 }
 
@@ -453,14 +453,14 @@ gimp_sample_point_editor_points_changed (GimpSamplePointEditor *editor)
                           "number",         i + 1,
                           "has-color-area", TRUE,
                           "has-coords",     TRUE,
+                          "hexpand",        TRUE,
                           NULL);
 
           gimp_color_frame_set_color_config (GIMP_COLOR_FRAME (editor->color_frames[i]),
                                              config);
 
-          gtk_table_attach (GTK_TABLE (editor->table), editor->color_frames[i],
-                            column, column + 1, row, row + 1,
-                            GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+          gtk_grid_attach (GTK_GRID (editor->grid), editor->color_frames[i],
+                           column, row, 1, 1);
           gtk_widget_show (editor->color_frames[i]);
 
           g_object_set_data (G_OBJECT (editor->color_frames[i]),
diff --git a/app/widgets/gimpsamplepointeditor.h b/app/widgets/gimpsamplepointeditor.h
index 798c2a9..f09cbb1 100644
--- a/app/widgets/gimpsamplepointeditor.h
+++ b/app/widgets/gimpsamplepointeditor.h
@@ -42,7 +42,7 @@ struct _GimpSamplePointEditor
   GtkWidget       *empty_icon;
   GtkWidget       *empty_label;
 
-  GtkWidget       *table;
+  GtkWidget       *grid;
   GtkWidget      **color_frames;
   gint             n_color_frames;
 
diff --git a/libgimpwidgets/gimppropwidgets.c b/libgimpwidgets/gimppropwidgets.c
index d20c212..7f23495 100644
--- a/libgimpwidgets/gimppropwidgets.c
+++ b/libgimpwidgets/gimppropwidgets.c
@@ -1857,6 +1857,7 @@ gimp_prop_label_new (GObject     *config,
     }
 
   label = gtk_label_new (NULL);
+  gtk_widget_set_halign (label, GTK_ALIGN_START);
 
   set_param_spec (G_OBJECT (label), label, param_spec);
 


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