[gimp/gtk3-port: 310/444] app/tools: get rid of GtkTable
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 310/444] app/tools: get rid of GtkTable
- Date: Sun, 13 May 2018 20:25:37 +0000 (UTC)
commit e72e272bb7327bef89a5c48d90e559eafca47fd1
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 4263c0f..2e7d23a 100644
--- a/app/tools/gimpcurvestool.c
+++ b/app/tools/gimpcurvestool.c
@@ -378,7 +378,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;
@@ -459,16 +459,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);
@@ -484,8 +483,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 ();
@@ -512,8 +510,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);
@@ -535,7 +532,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 fce7420..dfc2066 100644
--- a/app/tools/gimpgradienttool-editor.c
+++ b/app/tools/gimpgradienttool-editor.c
@@ -1260,7 +1260,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;
@@ -1275,24 +1275,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 */
@@ -1312,10 +1310,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);
@@ -1344,18 +1339,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++;
@@ -1365,10 +1356,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;
@@ -1380,18 +1371,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 */
@@ -1400,10 +1390,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",
@@ -1415,62 +1402,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++;
@@ -1487,7 +1457,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;
@@ -1500,18 +1470,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 */
@@ -1520,10 +1489,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",
@@ -1535,17 +1501,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",
@@ -1557,17 +1519,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",
@@ -1578,10 +1536,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]