[gimp/gtk3-port: 432/444] libgimpwidgets: kill the last remaining occurencces of GtkTable



commit 2c0921963b15caca447d209f5aa3c86fa3a7d68d
Author: Simon Budig <simon budig de>
Date:   Fri May 11 13:20:09 2018 +0200

    libgimpwidgets: kill the last remaining occurencces of GtkTable

 libgimpwidgets/gimpscaleentry.c   |  146 ++-----------------------------------
 libgimpwidgets/gimpscaleentry.h   |   33 --------
 libgimpwidgets/gimpwidgetsutils.c |   71 ------------------
 libgimpwidgets/gimpwidgetsutils.h |    9 --
 4 files changed, 8 insertions(+), 251 deletions(-)
---
diff --git a/libgimpwidgets/gimpscaleentry.c b/libgimpwidgets/gimpscaleentry.c
index b6dd2a6..59d0495 100644
--- a/libgimpwidgets/gimpscaleentry.c
+++ b/libgimpwidgets/gimpscaleentry.c
@@ -41,7 +41,7 @@ static gboolean        gimp_scale_entry_log_to_linear (GBinding     *binding,
                                                        gpointer      user_data);
 
 static GtkAdjustment * gimp_scale_entry_new_internal  (gboolean      color_scale,
-                                                       GtkWidget    *grid,
+                                                       GtkGrid      *grid,
                                                        gint          column,
                                                        gint          row,
                                                        const gchar  *text,
@@ -104,7 +104,7 @@ gimp_scale_entry_log_to_linear (GBinding     *binding,
 
 static GtkAdjustment *
 gimp_scale_entry_new_internal (gboolean     color_scale,
-                               GtkWidget   *parent,
+                               GtkGrid     *grid,
                                gint         column,
                                gint         row,
                                const gchar *text,
@@ -188,32 +188,11 @@ gimp_scale_entry_new_internal (gboolean     color_scale,
     gtk_widget_set_size_request (scale, scale_width, -1);
   gtk_widget_show (scale);
 
-  if (GTK_IS_GRID (parent))
-    {
-      GtkGrid *grid = GTK_GRID (parent);
-
-      gtk_widget_set_hexpand (scale, TRUE);
-
-      gtk_grid_attach (grid, label,      column,     row, 1, 1);
-      gtk_grid_attach (grid, scale,      column + 1, row, 1, 1);
-      gtk_grid_attach (grid, spinbutton, column + 2, row, 1, 1);
-    }
-  else
-    {
-      GtkTable *table = GTK_TABLE (parent);
-
-      gtk_table_attach (table, label,
-                        column, column + 1, row, row + 1,
-                        GTK_FILL, GTK_FILL, 0, 0);
+  gtk_widget_set_hexpand (scale, TRUE);
 
-      gtk_table_attach (table, scale,
-                        column + 1, column + 2, row, row + 1,
-                        GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
-
-      gtk_table_attach (table, spinbutton,
-                        column + 2, column + 3, row, row + 1,
-                        GTK_FILL | GTK_SHRINK, GTK_SHRINK, 0, 0);
-    }
+  gtk_grid_attach (grid, label,      column,     row, 1, 1);
+  gtk_grid_attach (grid, scale,      column + 1, row, 1, 1);
+  gtk_grid_attach (grid, spinbutton, column + 2, row, 1, 1);
 
   if (tooltip || help_id)
     {
@@ -231,66 +210,6 @@ gimp_scale_entry_new_internal (gboolean     color_scale,
 }
 
 /**
- * gimp_scale_entry_new:
- * @table:               The #GtkTable the widgets will be attached to.
- * @column:              The column to start with.
- * @row:                 The row to attach the widgets.
- * @text:                The text for the #GtkLabel which will appear
- *                       left of the #GtkHScale.
- * @scale_width:         The minimum horizontal size of the #GtkHScale.
- * @spinbutton_width:    The minimum horizontal size of the #GtkSpinButton.
- * @value:               The initial value.
- * @lower:               The lower boundary.
- * @upper:               The upper boundary.
- * @step_increment:      The step increment.
- * @page_increment:      The page increment.
- * @digits:              The number of decimal digits.
- * @constrain:           %TRUE if the range of possible values of the
- *                       #GtkSpinButton should be the same as of the #GtkHScale.
- * @unconstrained_lower: The spinbutton's lower boundary
- *                       if @constrain == %FALSE.
- * @unconstrained_upper: The spinbutton's upper boundary
- *                       if @constrain == %FALSE.
- * @tooltip:             A tooltip message for the scale and the spinbutton.
- * @help_id:             The widgets' help_id (see gimp_help_set_help_data()).
- *
- * This function creates a #GtkLabel, a #GtkHScale and a #GtkSpinButton and
- * attaches them to a 3-column #GtkTable.
- *
- * Returns: The #GtkSpinButton's #GtkAdjustment.
- **/
-GtkAdjustment *
-gimp_scale_entry_new (GtkTable    *table,
-                      gint         column,
-                      gint         row,
-                      const gchar *text,
-                      gint         scale_width,
-                      gint         spinbutton_width,
-                      gdouble      value,
-                      gdouble      lower,
-                      gdouble      upper,
-                      gdouble      step_increment,
-                      gdouble      page_increment,
-                      guint        digits,
-                      gboolean     constrain,
-                      gdouble      unconstrained_lower,
-                      gdouble      unconstrained_upper,
-                      const gchar *tooltip,
-                      const gchar *help_id)
-{
-  return gimp_scale_entry_new_internal (FALSE,
-                                        GTK_WIDGET (table), column, row,
-                                        text, scale_width, spinbutton_width,
-                                        value, lower, upper,
-                                        step_increment, page_increment,
-                                        digits,
-                                        constrain,
-                                        unconstrained_lower,
-                                        unconstrained_upper,
-                                        tooltip, help_id);
-}
-
-/**
  * gimp_scale_entry_new_grid:
  * @grid:                The #GtkGrid the widgets will be attached to.
  * @column:              The column to start with.
@@ -339,7 +258,7 @@ gimp_scale_entry_new_grid (GtkGrid     *grid,
                            const gchar *help_id)
 {
   return gimp_scale_entry_new_internal (FALSE,
-                                        GTK_WIDGET (grid), column, row,
+                                        grid, column, row,
                                         text, scale_width, spinbutton_width,
                                         value, lower, upper,
                                         step_increment, page_increment,
@@ -351,55 +270,6 @@ gimp_scale_entry_new_grid (GtkGrid     *grid,
 }
 
 /**
- * gimp_color_scale_entry_new:
- * @table:               The #GtkTable the widgets will be attached to.
- * @column:              The column to start with.
- * @row:                 The row to attach the widgets.
- * @text:                The text for the #GtkLabel which will appear
- *                       left of the #GtkHScale.
- * @scale_width:         The minimum horizontal size of the #GtkHScale.
- * @spinbutton_width:    The minimum horizontal size of the #GtkSpinButton.
- * @value:               The initial value.
- * @lower:               The lower boundary.
- * @upper:               The upper boundary.
- * @step_increment:      The step increment.
- * @page_increment:      The page increment.
- * @digits:              The number of decimal digits.
- * @tooltip:             A tooltip message for the scale and the spinbutton.
- * @help_id:             The widgets' help_id (see gimp_help_set_help_data()).
- *
- * This function creates a #GtkLabel, a #GimpColorScale and a
- * #GtkSpinButton and attaches them to a 3-column #GtkTable.
- *
- * Returns: The #GtkSpinButton's #GtkAdjustment.
- **/
-GtkAdjustment *
-gimp_color_scale_entry_new (GtkTable    *table,
-                            gint         column,
-                            gint         row,
-                            const gchar *text,
-                            gint         scale_width,
-                            gint         spinbutton_width,
-                            gdouble      value,
-                            gdouble      lower,
-                            gdouble      upper,
-                            gdouble      step_increment,
-                            gdouble      page_increment,
-                            guint        digits,
-                            const gchar *tooltip,
-                            const gchar *help_id)
-{
-  return gimp_scale_entry_new_internal (TRUE,
-                                        GTK_WIDGET (table), column, row,
-                                        text, scale_width, spinbutton_width,
-                                        value, lower, upper,
-                                        step_increment, page_increment,
-                                        digits,
-                                        TRUE, 0.0, 0.0,
-                                        tooltip, help_id);
-}
-
-/**
  * gimp_color_scale_entry_new_grid:
  * @grid:                The #GtkGrid the widgets will be attached to.
  * @column:              The column to start with.
@@ -439,7 +309,7 @@ gimp_color_scale_entry_new_grid (GtkGrid     *grid,
                                  const gchar *help_id)
 {
   return gimp_scale_entry_new_internal (TRUE,
-                                        GTK_WIDGET (grid), column, row,
+                                        grid, column, row,
                                         text, scale_width, spinbutton_width,
                                         value, lower, upper,
                                         step_increment, page_increment,
diff --git a/libgimpwidgets/gimpscaleentry.h b/libgimpwidgets/gimpscaleentry.h
index c0332d6..eb0e730 100644
--- a/libgimpwidgets/gimpscaleentry.h
+++ b/libgimpwidgets/gimpscaleentry.h
@@ -78,24 +78,6 @@ G_BEGIN_DECLS
         (GTK_SPIN_BUTTON (g_object_get_data (G_OBJECT (adj), "spinbutton")))
 
 
-GtkAdjustment * gimp_scale_entry_new             (GtkTable    *table,
-                                                  gint         column,
-                                                  gint         row,
-                                                  const gchar *text,
-                                                  gint         scale_width,
-                                                  gint         spinbutton_width,
-                                                  gdouble      value,
-                                                  gdouble      lower,
-                                                  gdouble      upper,
-                                                  gdouble      step_increment,
-                                                  gdouble      page_increment,
-                                                  guint        digits,
-                                                  gboolean     constrain,
-                                                  gdouble      unconstrained_lower,
-                                                  gdouble      unconstrained_upper,
-                                                  const gchar *tooltip,
-                                                  const gchar *help_id);
-
 GtkAdjustment * gimp_scale_entry_new_grid        (GtkGrid     *grid,
                                                   gint         column,
                                                   gint         row,
@@ -114,21 +96,6 @@ GtkAdjustment * gimp_scale_entry_new_grid        (GtkGrid     *grid,
                                                   const gchar *tooltip,
                                                   const gchar *help_id);
 
-GtkAdjustment * gimp_color_scale_entry_new       (GtkTable    *table,
-                                                  gint         column,
-                                                  gint         row,
-                                                  const gchar *text,
-                                                  gint         scale_width,
-                                                  gint         spinbutton_width,
-                                                  gdouble      value,
-                                                  gdouble      lower,
-                                                  gdouble      upper,
-                                                  gdouble      step_increment,
-                                                  gdouble      page_increment,
-                                                  guint        digits,
-                                                  const gchar *tooltip,
-                                                  const gchar *help_id);
-
 GtkAdjustment * gimp_color_scale_entry_new_grid  (GtkGrid     *grid,
                                                   gint         column,
                                                   gint         row,
diff --git a/libgimpwidgets/gimpwidgetsutils.c b/libgimpwidgets/gimpwidgetsutils.c
index 2fea165..98d2d44 100644
--- a/libgimpwidgets/gimpwidgetsutils.c
+++ b/libgimpwidgets/gimpwidgetsutils.c
@@ -104,77 +104,6 @@ find_mnemonic_widget (GtkWidget *widget,
 }
 
 /**
- * gimp_table_attach_aligned:
- * @table:      The #GtkTable the widgets will be attached to.
- * @column:     The column to start with.
- * @row:        The row to attach the widgets.
- * @label_text: The text for the #GtkLabel which will be attached left of
- *              the widget.
- * @xalign:     The horizontal alignment of the #GtkLabel.
- * @yalign:     The vertical alignment of the #GtkLabel.
- * @widget:     The #GtkWidget to attach right of the label.
- * @colspan:    The number of columns the widget will use.
- * @left_align: %TRUE if the widget should be left-aligned.
- *
- * Note that the @label_text can be %NULL and that the widget will be
- * attached starting at (@column + 1) in this case, too.
- *
- * Returns: The created #GtkLabel.
- **/
-GtkWidget *
-gimp_table_attach_aligned (GtkTable    *table,
-                           gint         column,
-                           gint         row,
-                           const gchar *label_text,
-                           gfloat       xalign,
-                           gfloat       yalign,
-                           GtkWidget   *widget,
-                           gint         colspan,
-                           gboolean     left_align)
-{
-  GtkWidget *label = NULL;
-
-  if (label_text)
-    {
-      GtkWidget *mnemonic_widget;
-
-      label = gtk_label_new_with_mnemonic (label_text);
-      gtk_label_set_xalign (GTK_LABEL (label), xalign);
-      gtk_label_set_yalign (GTK_LABEL (label), yalign);
-      gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
-      gtk_table_attach (table, label,
-                        column, column + 1,
-                        row, row + 1,
-                        GTK_FILL, GTK_FILL, 0, 0);
-      gtk_widget_show (label);
-
-      mnemonic_widget = find_mnemonic_widget (widget, 0);
-
-      if (mnemonic_widget)
-        gtk_label_set_mnemonic_widget (GTK_LABEL (label), mnemonic_widget);
-    }
-
-  if (left_align)
-    {
-      GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-
-      gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
-      gtk_widget_show (widget);
-
-      widget = hbox;
-    }
-
-  gtk_table_attach (table, widget,
-                    column + 1, column + 1 + colspan,
-                    row, row + 1,
-                    GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
-
-  gtk_widget_show (widget);
-
-  return label;
-}
-
-/**
  * gimp_grid_attach_aligned:
  * @grid:       The #GtkGrid the widgets will be attached to.
  * @left:       The column to start with.
diff --git a/libgimpwidgets/gimpwidgetsutils.h b/libgimpwidgets/gimpwidgetsutils.h
index e2a7e77..1871393 100644
--- a/libgimpwidgets/gimpwidgetsutils.h
+++ b/libgimpwidgets/gimpwidgetsutils.h
@@ -30,15 +30,6 @@ G_BEGIN_DECLS
 /* For information look into the C source or the html documentation */
 
 
-GtkWidget          * gimp_table_attach_aligned       (GtkTable          *table,
-                                                      gint               column,
-                                                      gint               row,
-                                                      const gchar       *label_text,
-                                                      gfloat             xalign,
-                                                      gfloat             yalign,
-                                                      GtkWidget         *widget,
-                                                      gint               colspan,
-                                                      gboolean           left_align);
 GtkWidget          * gimp_grid_attach_aligned        (GtkGrid           *grid,
                                                       gint               left,
                                                       gint               top,


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