[gimp/gtk3-port: 310/336] app/tools: get rid of GtkTable
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 310/336] app/tools: get rid of GtkTable
- Date: Fri, 4 May 2018 10:14:26 +0000 (UTC)
commit 1b5fe256cd8112004cdf928032775453170bb3d7
Author: Simon Budig <simon budig de>
Date: Thu May 3 01:27:00 2018 +0200
app/tools: get rid of GtkTable
app/tools/gimpcurvestool.c | 23 +++---
app/tools/gimpgradienttool-editor.c | 141 ++++++++++++-----------------------
2 files changed, 58 insertions(+), 106 deletions(-)
---
diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c
index 2ed792f..65fe53e 100644
--- a/app/tools/gimpcurvestool.c
+++ b/app/tools/gimpcurvestool.c
@@ -377,7 +377,7 @@ gimp_curves_tool_dialog (GimpFilterTool *filter_tool)
GtkWidget *label;
GtkWidget *main_frame;
GtkWidget *frame;
- GtkWidget *table;
+ GtkWidget *grid;
GtkWidget *button;
GtkWidget *bar;
GtkWidget *combo;
@@ -458,16 +458,15 @@ gimp_curves_tool_dialog (GimpFilterTool *filter_tool)
gtk_container_add (GTK_CONTAINER (main_frame), frame_vbox);
gtk_widget_show (frame_vbox);
- /* The table for the color bars and the graph */
- table = gtk_table_new (2, 2, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 2);
- gtk_table_set_row_spacings (GTK_TABLE (table), 2);
- gtk_box_pack_start (GTK_BOX (frame_vbox), table, TRUE, TRUE, 0);
+ /* The grid for the color bars and the graph */
+ grid = gtk_grid_new ();
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 2);
+ gtk_grid_set_row_spacing (GTK_GRID (grid), 2);
+ gtk_box_pack_start (GTK_BOX (frame_vbox), grid, TRUE, TRUE, 0);
/* The left color bar */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_table_attach (GTK_TABLE (table), vbox, 0, 1, 0, 1,
- GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), vbox, 0, 0, 1, 1);
gtk_widget_show (vbox);
frame = gtk_frame_new (NULL);
@@ -483,8 +482,7 @@ gimp_curves_tool_dialog (GimpFilterTool *filter_tool)
/* The curves graph */
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
- gtk_table_attach (GTK_TABLE (table), frame, 1, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), frame, 1, 0, 1, 1);
gtk_widget_show (frame);
tool->graph = gimp_curve_view_new ();
@@ -511,8 +509,7 @@ gimp_curves_tool_dialog (GimpFilterTool *filter_tool)
/* The bottom color bar */
hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_table_attach (GTK_TABLE (table), hbox2, 1, 2, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), hbox2, 1, 1, 1, 1);
gtk_widget_show (hbox2);
frame = gtk_frame_new (NULL);
@@ -534,7 +531,7 @@ gimp_curves_tool_dialog (GimpFilterTool *filter_tool)
gtk_box_pack_start (GTK_BOX (vbox), bar, TRUE, TRUE, 0);
gtk_widget_show (bar);
- gtk_widget_show (table);
+ gtk_widget_show (grid);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_end (GTK_BOX (frame_vbox), hbox, FALSE, FALSE, 0);
diff --git a/app/tools/gimpgradienttool-editor.c b/app/tools/gimpgradienttool-editor.c
index d5cfd80..b604b48 100644
--- a/app/tools/gimpgradienttool-editor.c
+++ b/app/tools/gimpgradienttool-editor.c
@@ -1257,7 +1257,7 @@ gimp_gradient_tool_editor_init_endpoint_gui (GimpGradientTool *gradient_tool)
gdouble xres;
gdouble yres;
GtkWidget *editor;
- GtkWidget *table;
+ GtkWidget *grid;
GtkWidget *label;
GtkWidget *spinbutton;
GtkWidget *se;
@@ -1272,24 +1272,22 @@ gimp_gradient_tool_editor_init_endpoint_gui (GimpGradientTool *gradient_tool)
gtk_box_pack_start (GTK_BOX (gimp_tool_gui_get_vbox (gradient_tool->gui)),
editor, FALSE, TRUE, 0);
- /* the main table */
- table = gtk_table_new (1, 2, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 4);
- gtk_table_set_col_spacings (GTK_TABLE (table), 4);
- gtk_box_pack_start (GTK_BOX (editor), table, FALSE, TRUE, 0);
- gtk_widget_show (table);
+ /* the main grid */
+ grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (grid), 4);
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 4);
+ gtk_box_pack_start (GTK_BOX (editor), grid, FALSE, TRUE, 0);
+ gtk_widget_show (grid);
/* the position labels */
label = gtk_label_new (_("X:"));
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, 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, row, 1, 1);
gtk_widget_show (label);
label = gtk_label_new (_("Y:"));
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, row + 1, row + 2,
- GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, row + 1, 1, 1);
gtk_widget_show (label);
/* the position size entry */
@@ -1309,10 +1307,7 @@ gimp_gradient_tool_editor_init_endpoint_gui (GimpGradientTool *gradient_tool)
gtk_grid_attach (GTK_GRID (se), spinbutton, 1, 0, 1, 1);
gtk_widget_show (spinbutton);
- gtk_table_attach (GTK_TABLE (table), se, 1, 2, row, row + 2,
- GTK_SHRINK | GTK_FILL | GTK_EXPAND,
- GTK_SHRINK | GTK_FILL,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), se, 1, row, 1, 2);
gtk_widget_show (se);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (se), shell->unit);
@@ -1341,18 +1336,14 @@ gimp_gradient_tool_editor_init_endpoint_gui (GimpGradientTool *gradient_tool)
/* the color label */
label = gtk_label_new (_("Color:"));
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, 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, row, 1, 1);
gtk_widget_show (label);
/* the color entry */
hbox = gimp_gradient_tool_editor_color_entry_new (
gradient_tool, _("Change Endpoint Color"), DIRECTION_NONE, NULL,
&gradient_tool->endpoint_color_panel, &gradient_tool->endpoint_type_combo);
- gtk_table_attach (GTK_TABLE (table), hbox, 1, 2, row, row + 1,
- GTK_SHRINK | GTK_FILL | GTK_EXPAND,
- GTK_SHRINK | GTK_FILL,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), hbox, 1, row, 1, 1);
gtk_widget_show (hbox);
row++;
@@ -1362,10 +1353,10 @@ static void
gimp_gradient_tool_editor_init_stop_gui (GimpGradientTool *gradient_tool)
{
GtkWidget *editor;
- GtkWidget *table;
+ GtkWidget *grid;
GtkWidget *label;
GtkWidget *se;
- GtkWidget *table2;
+ GtkWidget *grid2;
GtkWidget *button;
GtkWidget *hbox;
GtkWidget *separator;
@@ -1377,18 +1368,17 @@ gimp_gradient_tool_editor_init_stop_gui (GimpGradientTool *gradient_tool)
gtk_box_pack_start (GTK_BOX (gimp_tool_gui_get_vbox (gradient_tool->gui)),
editor, FALSE, TRUE, 0);
- /* the main table */
- table = gtk_table_new (1, 2, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 4);
- gtk_table_set_col_spacings (GTK_TABLE (table), 4);
- gtk_box_pack_start (GTK_BOX (editor), table, FALSE, TRUE, 0);
- gtk_widget_show (table);
+ /* the main grid */
+ grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (grid), 4);
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 4);
+ gtk_box_pack_start (GTK_BOX (editor), grid, FALSE, TRUE, 0);
+ gtk_widget_show (grid);
/* the position label */
label = gtk_label_new (_("Position:"));
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, 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, row, 1, 1);
gtk_widget_show (label);
/* the position size entry */
@@ -1397,10 +1387,7 @@ gimp_gradient_tool_editor_init_stop_gui (GimpGradientTool *gradient_tool)
FALSE, TRUE, FALSE, 6,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_show_unit_menu (GIMP_SIZE_ENTRY (se), FALSE);
- gtk_table_attach (GTK_TABLE (table), se, 1, 2, row, row + 1,
- GTK_SHRINK | GTK_FILL | GTK_EXPAND,
- GTK_SHRINK | GTK_FILL,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), se, 1, row, 1, 1);
gtk_widget_show (se);
g_signal_connect (se, "value-changed",
@@ -1412,62 +1399,45 @@ gimp_gradient_tool_editor_init_stop_gui (GimpGradientTool *gradient_tool)
/* the color labels */
label = gtk_label_new (_("Left color:"));
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, 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, row, 1, 1);
gtk_widget_show (label);
label = gtk_label_new (_("Right color:"));
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, row + 1, row + 2,
- GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, row + 1, 1, 1);
gtk_widget_show (label);
- /* the color entries table */
- table2 = gtk_table_new (1, 2, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table2), 4);
- gtk_table_set_col_spacings (GTK_TABLE (table2), 2);
- gtk_table_attach (GTK_TABLE (table), table2, 1, 2, row, row + 2,
- GTK_SHRINK | GTK_FILL | GTK_EXPAND,
- GTK_SHRINK | GTK_FILL,
- 0, 0);
- gtk_widget_show (table2);
+ /* the color entries grid */
+ grid2 = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (grid2), 4);
+ gtk_grid_set_column_spacing (GTK_GRID (grid2), 2);
+ gtk_grid_attach (GTK_GRID (grid), grid2, 1, row, 1, 2);
+ gtk_widget_show (grid2);
/* the color entries chain button */
gradient_tool->stop_chain_button =
button = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
- gtk_table_attach (GTK_TABLE (table2), button, 1, 2, 0, 2,
- GTK_SHRINK | GTK_FILL,
- GTK_SHRINK | GTK_FILL | GTK_EXPAND,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (grid2), button, 1, 0, 1, 2);
gtk_widget_show (button);
/* the color entries */
hbox = gimp_gradient_tool_editor_color_entry_new (
gradient_tool, _("Change Stop Color"), DIRECTION_LEFT, button,
&gradient_tool->stop_left_color_panel, &gradient_tool->stop_left_type_combo);
- gtk_table_attach (GTK_TABLE (table2), hbox, 0, 1, 0, 1,
- GTK_SHRINK | GTK_FILL | GTK_EXPAND,
- GTK_SHRINK | GTK_FILL,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (grid2), hbox, 0, 0, 1, 1);
gtk_widget_show (hbox);
hbox = gimp_gradient_tool_editor_color_entry_new (
gradient_tool, _("Change Stop Color"), DIRECTION_RIGHT, button,
&gradient_tool->stop_right_color_panel, &gradient_tool->stop_right_type_combo);
- gtk_table_attach (GTK_TABLE (table2), hbox, 0, 1, 1, 2,
- GTK_SHRINK | GTK_FILL | GTK_EXPAND,
- GTK_SHRINK | GTK_FILL,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (grid2), hbox, 0, 1, 1, 1);
gtk_widget_show (hbox);
row += 2;
/* the action buttons separator */
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_table_attach (GTK_TABLE (table), separator, 0, 2, row, row + 1,
- GTK_SHRINK | GTK_FILL | GTK_EXPAND,
- GTK_SHRINK | GTK_FILL,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), separator, 0, row, 2, 1);
gtk_widget_show (separator);
row++;
@@ -1484,7 +1454,7 @@ static void
gimp_gradient_tool_editor_init_midpoint_gui (GimpGradientTool *gradient_tool)
{
GtkWidget *editor;
- GtkWidget *table;
+ GtkWidget *grid;
GtkWidget *label;
GtkWidget *se;
GtkWidget *combo;
@@ -1497,18 +1467,17 @@ gimp_gradient_tool_editor_init_midpoint_gui (GimpGradientTool *gradient_tool)
gtk_box_pack_start (GTK_BOX (gimp_tool_gui_get_vbox (gradient_tool->gui)),
editor, FALSE, TRUE, 0);
- /* the main table */
- table = gtk_table_new (1, 2, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 4);
- gtk_table_set_col_spacings (GTK_TABLE (table), 4);
- gtk_box_pack_start (GTK_BOX (editor), table, FALSE, TRUE, 0);
- gtk_widget_show (table);
+ /* the main grid */
+ grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (grid), 4);
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 4);
+ gtk_box_pack_start (GTK_BOX (editor), grid, FALSE, TRUE, 0);
+ gtk_widget_show (grid);
/* the position label */
label = gtk_label_new (_("Position:"));
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, 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, row, 1, 1);
gtk_widget_show (label);
/* the position size entry */
@@ -1517,10 +1486,7 @@ gimp_gradient_tool_editor_init_midpoint_gui (GimpGradientTool *gradient_tool)
FALSE, TRUE, FALSE, 6,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_show_unit_menu (GIMP_SIZE_ENTRY (se), FALSE);
- gtk_table_attach (GTK_TABLE (table), se, 1, 2, row, row + 1,
- GTK_SHRINK | GTK_FILL | GTK_EXPAND,
- GTK_SHRINK | GTK_FILL,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), se, 1, row, 1, 1);
gtk_widget_show (se);
g_signal_connect (se, "value-changed",
@@ -1532,17 +1498,13 @@ gimp_gradient_tool_editor_init_midpoint_gui (GimpGradientTool *gradient_tool)
/* the type label */
label = gtk_label_new (_("Blending:"));
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, 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, row, 1, 1);
gtk_widget_show (label);
/* the type combo */
gradient_tool->midpoint_type_combo =
combo = gimp_enum_combo_box_new (GIMP_TYPE_GRADIENT_SEGMENT_TYPE);
- gtk_table_attach (GTK_TABLE (table), combo, 1, 2, row, row + 1,
- GTK_SHRINK | GTK_FILL | GTK_EXPAND,
- GTK_SHRINK | GTK_FILL,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), combo, 1, row, 1, 1);
gtk_widget_show (combo);
g_signal_connect (combo, "changed",
@@ -1554,17 +1516,13 @@ gimp_gradient_tool_editor_init_midpoint_gui (GimpGradientTool *gradient_tool)
/* the color label */
label = gtk_label_new (_("Coloring:"));
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, 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, row, 1, 1);
gtk_widget_show (label);
/* the color combo */
gradient_tool->midpoint_color_combo =
combo = gimp_enum_combo_box_new (GIMP_TYPE_GRADIENT_SEGMENT_COLOR);
- gtk_table_attach (GTK_TABLE (table), combo, 1, 2, row, row + 1,
- GTK_SHRINK | GTK_FILL | GTK_EXPAND,
- GTK_SHRINK | GTK_FILL,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), combo, 1, row, 1, 1);
gtk_widget_show (combo);
g_signal_connect (combo, "changed",
@@ -1575,10 +1533,7 @@ gimp_gradient_tool_editor_init_midpoint_gui (GimpGradientTool *gradient_tool)
/* the action buttons separator */
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_table_attach (GTK_TABLE (table), separator, 0, 2, row, row + 1,
- GTK_SHRINK | GTK_FILL | GTK_EXPAND,
- GTK_SHRINK | GTK_FILL,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), separator, 0, row, 2, 1);
gtk_widget_show (separator);
row++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]