[gimp/gtk3-port: 300/362] dialogs: some table->grid conversion in the item dialogs
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 300/362] dialogs: some table->grid conversion in the item dialogs
- Date: Mon, 7 May 2018 19:30:00 +0000 (UTC)
commit be75cf526b5d123e7b0a9f740b42d024aff5ff31
Author: Simon Budig <simon budig de>
Date: Wed May 2 19:12:02 2018 +0200
dialogs: some table->grid conversion in the item dialogs
app/dialogs/item-options-dialog.c | 44 +++++++++++++++++-----------------
app/dialogs/item-options-dialog.h | 2 +-
app/dialogs/layer-options-dialog.c | 33 ++++++++-----------------
app/tools/gimpgradienttool-editor.c | 6 ++--
4 files changed, 37 insertions(+), 48 deletions(-)
---
diff --git a/app/dialogs/item-options-dialog.c b/app/dialogs/item-options-dialog.c
index 15a77c5..340af09 100644
--- a/app/dialogs/item-options-dialog.c
+++ b/app/dialogs/item-options-dialog.c
@@ -56,8 +56,8 @@ struct _ItemOptionsDialog
gpointer user_data;
GtkWidget *left_vbox;
- GtkWidget *left_table;
- gint table_row;
+ GtkWidget *left_grid;
+ gint grid_row;
GtkWidget *name_entry;
GtkWidget *right_frame;
GtkWidget *right_vbox;
@@ -105,7 +105,7 @@ item_options_dialog_new (GimpImage *image,
GtkWidget *dialog;
GimpViewable *viewable;
GtkWidget *main_hbox;
- GtkWidget *table;
+ GtkWidget *grid;
GtkWidget *button;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
@@ -171,11 +171,11 @@ item_options_dialog_new (GimpImage *image,
gtk_box_pack_start (GTK_BOX (main_hbox), private->left_vbox, TRUE, TRUE, 0);
gtk_widget_show (private->left_vbox);
- private->left_table = table = gtk_table_new (1, 2, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 6);
- gtk_table_set_row_spacings (GTK_TABLE (table), 6);
- gtk_box_pack_start (GTK_BOX (private->left_vbox), table, FALSE, FALSE, 0);
- gtk_widget_show (table);
+ private->left_grid = grid = gtk_grid_new ();
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
+ gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
+ gtk_box_pack_start (GTK_BOX (private->left_vbox), grid, FALSE, FALSE, 0);
+ gtk_widget_show (grid);
/* The name label and entry */
if (name_label)
@@ -189,14 +189,14 @@ item_options_dialog_new (GimpImage *image,
private->name_entry = gtk_entry_new ();
gtk_entry_set_activates_default (GTK_ENTRY (private->name_entry), TRUE);
gtk_entry_set_text (GTK_ENTRY (private->name_entry), item_name);
- gimp_table_attach_aligned (GTK_TABLE (table), 0, private->table_row++,
- name_label, 0.0, 0.5,
- private->name_entry, 1, FALSE);
+ gimp_grid_attach_aligned (GTK_GRID (grid), 0, private->grid_row++,
+ name_label, 0.0, 0.5,
+ private->name_entry, 1);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gimp_table_attach_aligned (GTK_TABLE (table), 0, private->table_row++,
- _("Color tag:"), 0.0, 0.5,
- hbox, 1, TRUE);
+ gimp_grid_attach_aligned (GTK_GRID (grid), 0, private->grid_row++,
+ _("Color tag:"), 0.0, 0.5,
+ hbox, 1);
radio_box = gimp_enum_radio_box_new (GIMP_TYPE_COLOR_TAG,
G_CALLBACK (gimp_radio_button_update),
@@ -320,8 +320,8 @@ item_options_dialog_get_vbox (GtkWidget *dialog)
}
GtkWidget *
-item_options_dialog_get_table (GtkWidget *dialog,
- gint *next_row)
+item_options_dialog_get_grid (GtkWidget *dialog,
+ gint *next_row)
{
ItemOptionsDialog *private;
@@ -333,9 +333,9 @@ item_options_dialog_get_table (GtkWidget *dialog,
g_return_val_if_fail (private != NULL, NULL);
- *next_row = private->table_row;
+ *next_row = private->grid_row;
- return private->left_table;
+ return private->left_grid;
}
GtkWidget *
@@ -383,10 +383,10 @@ item_options_dialog_add_widget (GtkWidget *dialog,
g_return_if_fail (private != NULL);
- gimp_table_attach_aligned (GTK_TABLE (private->left_table),
- 0, private->table_row++,
- label, 0.0, 0.5,
- widget, 1, FALSE);
+ gimp_grid_attach_aligned (GTK_GRID (private->left_grid),
+ 0, private->grid_row++,
+ label, 0.0, 0.5,
+ widget, 1);
}
GtkWidget *
diff --git a/app/dialogs/item-options-dialog.h b/app/dialogs/item-options-dialog.h
index 6177fdb..1eec57b 100644
--- a/app/dialogs/item-options-dialog.h
+++ b/app/dialogs/item-options-dialog.h
@@ -55,7 +55,7 @@ GtkWidget * item_options_dialog_new (GimpImage *image,
gpointer user_data);
GtkWidget * item_options_dialog_get_vbox (GtkWidget *dialog);
-GtkWidget * item_options_dialog_get_table (GtkWidget *dialog,
+GtkWidget * item_options_dialog_get_grid (GtkWidget *dialog,
gint *next_row);
GtkWidget * item_options_dialog_get_name_entry (GtkWidget *dialog);
GtkWidget * item_options_dialog_get_lock_position (GtkWidget *dialog);
diff --git a/app/dialogs/layer-options-dialog.c b/app/dialogs/layer-options-dialog.c
index 7b8cc06..dea850c 100644
--- a/app/dialogs/layer-options-dialog.c
+++ b/app/dialogs/layer-options-dialog.c
@@ -125,7 +125,7 @@ layer_options_dialog_new (GimpImage *image,
{
LayerOptionsDialog *private;
GtkWidget *dialog;
- GtkWidget *table;
+ GtkWidget *grid;
GtkListStore *space_model;
GtkWidget *combo;
GtkWidget *scale;
@@ -242,7 +242,7 @@ layer_options_dialog_new (GimpImage *image,
G_CALLBACK (gimp_double_adjustment_update),
&private->opacity);
- table = item_options_dialog_get_table (dialog, &row);
+ grid = item_options_dialog_get_grid (dialog, &row);
gimp_image_get_resolution (image, &xres, &yres);
@@ -251,14 +251,12 @@ layer_options_dialog_new (GimpImage *image,
/* The size labels */
label = gtk_label_new (_("Width:"));
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 (_("Height:"));
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 size sizeentry */
@@ -277,8 +275,7 @@ layer_options_dialog_new (GimpImage *image,
gtk_grid_attach (GTK_GRID (private->size_se), spinbutton, 1, 0, 1, 1);
gtk_widget_show (spinbutton);
- gtk_table_attach (GTK_TABLE (table), private->size_se, 1, 2, row, row + 2,
- GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), private->size_se, 1, row, 1, 2);
gtk_widget_show (private->size_se);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->size_se),
@@ -312,14 +309,12 @@ layer_options_dialog_new (GimpImage *image,
/* The offset labels */
label = gtk_label_new (_("Offset 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 (_("Offset 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 offset sizeentry */
@@ -338,8 +333,7 @@ layer_options_dialog_new (GimpImage *image,
gtk_grid_attach (GTK_GRID (private->offset_se), spinbutton, 1, 0, 1, 1);
gtk_widget_show (spinbutton);
- gtk_table_attach (GTK_TABLE (table), private->offset_se, 1, 2, row, row + 2,
- GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), private->offset_se, 1, row, 1, 2);
gtk_widget_show (private->offset_se);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->offset_se),
@@ -377,18 +371,13 @@ layer_options_dialog_new (GimpImage *image,
row += 2;
- /* set the spacings after adding widgets or GtkTable will warn */
- gtk_table_set_row_spacing (GTK_TABLE (table), 3, 4);
- if (! layer)
- gtk_table_set_row_spacing (GTK_TABLE (table), 5, 4);
-
if (! layer)
{
/* The fill type */
combo = gimp_enum_combo_box_new (GIMP_TYPE_FILL_TYPE);
- gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
- _("_Fill with:"), 0.0, 0.5,
- combo, 1, FALSE);
+ gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
+ _("_Fill with:"), 0.0, 0.5,
+ combo, 1);
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
private->fill_type,
G_CALLBACK (gimp_int_combo_box_get_active),
diff --git a/app/tools/gimpgradienttool-editor.c b/app/tools/gimpgradienttool-editor.c
index f4dc8b3..d5cfd80 100644
--- a/app/tools/gimpgradienttool-editor.c
+++ b/app/tools/gimpgradienttool-editor.c
@@ -1301,12 +1301,12 @@ gimp_gradient_tool_editor_init_endpoint_gui (GimpGradientTool *gradient_tool)
se = gimp_size_entry_new (1, GIMP_UNIT_PIXEL, "%a",
TRUE, TRUE, FALSE, 6,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
- gtk_table_set_row_spacings (GTK_TABLE (se), 4);
- gtk_table_set_col_spacings (GTK_TABLE (se), 2);
+ gtk_grid_set_row_spacing (GTK_GRID (se), 4);
+ gtk_grid_set_column_spacing (GTK_GRID (se), 2);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (se),
GTK_SPIN_BUTTON (spinbutton), NULL);
- gtk_table_attach_defaults (GTK_TABLE (se), spinbutton, 1, 2, 0, 1);
+ 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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]