[gimp/gtk3-port: 328/336] app/widgets: port the gimpstrokeeditor to GtkGrid



commit 64869ff0bdc9d7eb7537dd7134aead7433816cf8
Author: Simon Budig <simon budig de>
Date:   Fri May 4 01:02:55 2018 +0200

    app/widgets: port the gimpstrokeeditor to GtkGrid

 app/widgets/gimpstrokeeditor.c   |   40 +++++++++++++++++-------------------
 libgimpwidgets/gimppropwidgets.c |   42 +++++++++++++++++++-------------------
 libgimpwidgets/gimppropwidgets.h |    4 +-
 3 files changed, 42 insertions(+), 44 deletions(-)
---
diff --git a/app/widgets/gimpstrokeeditor.c b/app/widgets/gimpstrokeeditor.c
index 40bbd32..aec18b0 100644
--- a/app/widgets/gimpstrokeeditor.c
+++ b/app/widgets/gimpstrokeeditor.c
@@ -109,7 +109,7 @@ gimp_stroke_editor_constructed (GObject *object)
   GtkWidget         *size;
   GtkWidget         *label;
   GtkWidget         *frame;
-  GtkWidget         *table;
+  GtkWidget         *grid;
   GtkWidget         *expander;
   GtkWidget         *dash_editor;
   GtkWidget         *button;
@@ -146,37 +146,35 @@ gimp_stroke_editor_constructed (GObject *object)
   gtk_container_add (GTK_CONTAINER (expander), frame);
   gtk_widget_show (frame);
 
-  table = gtk_table_new (5, 3, FALSE);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 6);
-  gtk_table_set_row_spacings (GTK_TABLE (table), 3);
-  gtk_table_set_row_spacing (GTK_TABLE (table), 2, 6);
-  gtk_table_set_row_spacing (GTK_TABLE (table), 4, 6);
-  gtk_container_add (GTK_CONTAINER (frame), table);
-  gtk_widget_show (table);
+  grid = gtk_grid_new ();
+  gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
+  gtk_grid_set_row_spacing (GTK_GRID (grid), 3);
+  gtk_container_add (GTK_CONTAINER (frame), grid);
+  gtk_widget_show (grid);
 
   box = gimp_prop_enum_icon_box_new (G_OBJECT (options), "cap-style",
                                      "gimp-cap", 0, 0);
-  gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
-                             _("_Cap style:"), 0.0, 0.5,
-                             box, 2, TRUE);
+  gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
+                            _("_Cap style:"), 0.0, 0.5,
+                            box, 2);
 
   box = gimp_prop_enum_icon_box_new (G_OBJECT (options), "join-style",
                                      "gimp-join", 0, 0);
-  gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
-                             _("_Join style:"), 0.0, 0.5,
-                             box, 2, TRUE);
+  gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
+                            _("_Join style:"), 0.0, 0.5,
+                            box, 2);
 
   gimp_prop_scale_entry_new (G_OBJECT (options), "miter-limit",
-                             GTK_TABLE (table), 0, row++,
+                             GTK_GRID (grid), 0, row++,
                              _("_Miter limit:"),
                              1.0, 1.0, 1,
                              FALSE, 0.0, 0.0);
 
   frame = gtk_frame_new (NULL);
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
-  gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
-                             _("Dash pattern:"), 0.0, 0.5,
-                             frame, 2, FALSE);
+  gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
+                            _("Dash pattern:"), 0.0, 0.5,
+                            frame, 2);
 
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
   gtk_container_add (GTK_CONTAINER (frame), box);
@@ -237,9 +235,9 @@ gimp_stroke_editor_constructed (GObject *object)
   g_object_unref (store);
 
   gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (box), GIMP_DASH_CUSTOM);
-  gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
-                             _("Dash _preset:"), 0.0, 0.5,
-                             box, 2, FALSE);
+  gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
+                            _("Dash _preset:"), 0.0, 0.5,
+                            box, 2);
 
   cell = g_object_new (GIMP_TYPE_CELL_RENDERER_DASHES,
                        "xpad", 2,
diff --git a/libgimpwidgets/gimppropwidgets.c b/libgimpwidgets/gimppropwidgets.c
index 2a99390..d20c212 100644
--- a/libgimpwidgets/gimppropwidgets.c
+++ b/libgimpwidgets/gimppropwidgets.c
@@ -1315,7 +1315,7 @@ gimp_prop_hscale_new (GObject     *config,
  * gimp_prop_scale_entry_new:
  * @config:         Object to which property is attached.
  * @property_name:  Name of double property controlled by the spin button.
- * @table:          The #GtkTable the widgets will be attached to.
+ * @grid:           The #GtkGrid the widgets will be attached to.
  * @column:         The column to start with.
  * @row:            The row to attach the widgets.
  * @label:          The text for the #GtkLabel which will appear left of
@@ -1344,7 +1344,7 @@ gimp_prop_hscale_new (GObject     *config,
 GtkAdjustment *
 gimp_prop_scale_entry_new (GObject     *config,
                            const gchar *property_name,
-                           GtkTable    *table,
+                           GtkGrid     *grid,
                            gint         column,
                            gint         row,
                            const gchar *label,
@@ -1377,25 +1377,25 @@ gimp_prop_scale_entry_new (GObject     *config,
 
   if (! limit_scale)
     {
-      adjustment = gimp_scale_entry_new (table, column, row,
-                                         label, -1, -1,
-                                         value, lower, upper,
-                                         step_increment, page_increment,
-                                         digits,
-                                         TRUE, 0.0, 0.0,
-                                         tooltip,
-                                         NULL);
+      adjustment = gimp_scale_entry_new_grid (grid, column, row,
+                                              label, -1, -1,
+                                              value, lower, upper,
+                                              step_increment, page_increment,
+                                              digits,
+                                              TRUE, 0.0, 0.0,
+                                              tooltip,
+                                              NULL);
     }
   else
     {
-      adjustment = gimp_scale_entry_new (table, column, row,
-                                         label, -1, -1,
-                                         value, lower_limit, upper_limit,
-                                         step_increment, page_increment,
-                                         digits,
-                                         FALSE, lower, upper,
-                                         tooltip,
-                                         NULL);
+      adjustment = gimp_scale_entry_new_grid (grid, column, row,
+                                              label, -1, -1,
+                                              value, lower_limit, upper_limit,
+                                              step_increment, page_increment,
+                                              digits,
+                                              FALSE, lower, upper,
+                                              tooltip,
+                                              NULL);
     }
 
   set_param_spec (G_OBJECT (adjustment), NULL,  param_spec);
@@ -1472,7 +1472,7 @@ gimp_prop_widget_set_factor (GtkWidget     *widget,
  * gimp_prop_opacity_entry_new:
  * @config:        Object to which property is attached.
  * @property_name: Name of double property controlled by the spin button.
- * @table:         The #GtkTable the widgets will be attached to.
+ * @grid:          The #GtkGrid the widgets will be attached to.
  * @column:        The column to start with.
  * @row:           The row to attach the widgets.
  * @label:         The text for the #GtkLabel which will appear left of the
@@ -1490,7 +1490,7 @@ gimp_prop_widget_set_factor (GtkWidget     *widget,
 GtkAdjustment *
 gimp_prop_opacity_entry_new (GObject     *config,
                              const gchar *property_name,
-                             GtkTable    *table,
+                             GtkGrid     *grid,
                              gint         column,
                              gint         row,
                              const gchar *label)
@@ -1501,7 +1501,7 @@ gimp_prop_opacity_entry_new (GObject     *config,
   g_return_val_if_fail (property_name != NULL, NULL);
 
   adjustment = gimp_prop_scale_entry_new (config, property_name,
-                                          table, column, row, label,
+                                          grid, column, row, label,
                                           0.01, 0.1, 1,
                                           FALSE, 0.0, 0.0);
 
diff --git a/libgimpwidgets/gimppropwidgets.h b/libgimpwidgets/gimppropwidgets.h
index baacdd2..05725b1 100644
--- a/libgimpwidgets/gimppropwidgets.h
+++ b/libgimpwidgets/gimppropwidgets.h
@@ -110,7 +110,7 @@ GtkWidget     * gimp_prop_hscale_new              (GObject      *config,
 
 GtkAdjustment * gimp_prop_scale_entry_new         (GObject      *config,
                                                    const gchar  *property_name,
-                                                   GtkTable     *table,
+                                                   GtkGrid      *grid,
                                                    gint          column,
                                                    gint          row,
                                                    const gchar  *label,
@@ -125,7 +125,7 @@ GtkAdjustment * gimp_prop_scale_entry_new         (GObject      *config,
 
 GtkAdjustment * gimp_prop_opacity_entry_new       (GObject       *config,
                                                    const gchar   *property_name,
-                                                   GtkTable      *table,
+                                                   GtkGrid       *grid,
                                                    gint           column,
                                                    gint           row,
                                                    const gchar   *label);


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