[gimp/gtk3-port: 253/457] app: port GimpColorHistory to GtkGrid



commit 44477ae3b169f8513a280e1493680cb90ebb7d84
Author: Michael Natterer <mitch gimp org>
Date:   Sun Apr 29 03:21:26 2018 +0200

    app: port GimpColorHistory to GtkGrid

 app/widgets/gimpcolorhistory.c |   15 +++++++--------
 app/widgets/gimpcolorhistory.h |    8 ++++----
 2 files changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/app/widgets/gimpcolorhistory.c b/app/widgets/gimpcolorhistory.c
index a7c38fe..a4def1a 100644
--- a/app/widgets/gimpcolorhistory.c
+++ b/app/widgets/gimpcolorhistory.c
@@ -77,7 +77,7 @@ static void   gimp_color_history_color_changed (GtkWidget         *widget,
                                                 gpointer           data);
 
 
-G_DEFINE_TYPE (GimpColorHistory, gimp_color_history, GTK_TYPE_TABLE)
+G_DEFINE_TYPE (GimpColorHistory, gimp_color_history, GTK_TYPE_GRID)
 
 #define parent_class gimp_color_history_parent_class
 
@@ -175,10 +175,8 @@ gimp_color_history_set_property (GObject      *object,
           gtk_container_foreach (GTK_CONTAINER (history),
                                  (GtkCallback) gtk_widget_destroy, NULL);
           history->history_size = g_value_get_int (value);
-          gtk_table_resize (GTK_TABLE (history),
-                            2, (history->history_size + 1)/ 2);
-          gtk_table_set_row_spacings (GTK_TABLE (history), 2);
-          gtk_table_set_col_spacings (GTK_TABLE (history), 2);
+          gtk_grid_set_row_spacing (GTK_GRID (history), 2);
+          gtk_grid_set_column_spacing (GTK_GRID (history), 2);
           history->color_areas = g_realloc_n (history->color_areas,
                                               history->history_size,
                                               sizeof (GtkWidget*));
@@ -191,9 +189,10 @@ gimp_color_history_set_property (GObject      *object,
               row    = i / (history->history_size / 2);
 
               button = gtk_button_new ();
-              gtk_widget_set_size_request (button, COLOR_AREA_SIZE, COLOR_AREA_SIZE);
-              gtk_table_attach_defaults (GTK_TABLE (history), button,
-                                         column, column + 1, row, row + 1);
+              gtk_widget_set_size_request (button,
+                                           COLOR_AREA_SIZE, COLOR_AREA_SIZE);
+              gtk_grid_attach (GTK_GRID (history), button,
+                               column, row, 1, 1);
               gtk_widget_show (button);
 
               history->color_areas[i] = gimp_color_area_new (&black,
diff --git a/app/widgets/gimpcolorhistory.h b/app/widgets/gimpcolorhistory.h
index d3e5948..130e00f 100644
--- a/app/widgets/gimpcolorhistory.h
+++ b/app/widgets/gimpcolorhistory.h
@@ -34,7 +34,7 @@ typedef struct _GimpColorHistoryClass GimpColorHistoryClass;
 
 struct _GimpColorHistory
 {
-  GtkTable      parent_instance;
+  GtkGrid       parent_instance;
 
   GimpContext  *context;
 
@@ -44,11 +44,11 @@ struct _GimpColorHistory
 
 struct _GimpColorHistoryClass
 {
-  GtkTableClass  parent_class;
+  GtkGridClass  parent_class;
 
   /*  signals  */
-  void   (* color_selected)             (GimpColorHistory *history,
-                                         const GimpRGB    *rgb);
+  void   (* color_selected) (GimpColorHistory *history,
+                             const GimpRGB    *rgb);
 };
 
 


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