[gimp/gtk3-port: 196/236] Implement GtkWidget::style_updated() instead of ::style_set()



commit e9d0b84e1d9a31f563e6413acae549c3b02adcfc
Author: Michael Natterer <mitch gimp org>
Date:   Sun Jan 9 20:38:01 2011 +0100

    Implement GtkWidget::style_updated() instead of ::style_set()

 app/widgets/gimpcoloreditor.c       |   16 ++---
 app/widgets/gimpcolorframe.c        |   18 ++---
 app/widgets/gimpcurveview.c         |   10 +--
 app/widgets/gimpdataeditor.c        |   20 +++---
 app/widgets/gimpdock.c              |   11 ++--
 app/widgets/gimpdockable.c          |   17 ++---
 app/widgets/gimpeditor.c            |   18 ++---
 app/widgets/gimpitemtreeview.c      |   10 +--
 app/widgets/gimpmenudock.c          |   11 ++--
 app/widgets/gimpsamplepointeditor.c |   26 ++++----
 app/widgets/gimptoolpalette.c       |   11 +--
 libgimp/gimpaspectpreview.c         |  124 +++++++++++++++++-----------------
 libgimp/gimpdrawablepreview.c       |   45 +++++++------
 libgimp/gimpzoompreview.c           |   97 ++++++++++++++-------------
 14 files changed, 210 insertions(+), 224 deletions(-)
---
diff --git a/app/widgets/gimpcoloreditor.c b/app/widgets/gimpcoloreditor.c
index 69cbc0b..fd54fa5 100644
--- a/app/widgets/gimpcoloreditor.c
+++ b/app/widgets/gimpcoloreditor.c
@@ -62,8 +62,7 @@ static void   gimp_color_editor_get_property    (GObject           *object,
                                                  GValue            *value,
                                                  GParamSpec        *pspec);
 
-static void   gimp_color_editor_style_set       (GtkWidget         *widget,
-                                                 GtkStyle          *prev_style);
+static void   gimp_color_editor_style_updated   (GtkWidget         *widget);
 
 static void   gimp_color_editor_set_aux_info    (GimpDocked        *docked,
                                                  GList             *aux_info);
@@ -111,11 +110,11 @@ gimp_color_editor_class_init (GimpColorEditorClass* klass)
   GObjectClass   *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class->dispose      = gimp_color_editor_dispose;
-  object_class->set_property = gimp_color_editor_set_property;
-  object_class->get_property = gimp_color_editor_get_property;
+  object_class->dispose       = gimp_color_editor_dispose;
+  object_class->set_property  = gimp_color_editor_set_property;
+  object_class->get_property  = gimp_color_editor_get_property;
 
-  widget_class->style_set    = gimp_color_editor_style_set;
+  widget_class->style_updated = gimp_color_editor_style_updated;
 
   g_object_class_install_property (object_class, PROP_CONTEXT,
                                    g_param_spec_object ("context",
@@ -471,12 +470,11 @@ gimp_color_editor_new (GimpContext *context)
 }
 
 static void
-gimp_color_editor_style_set (GtkWidget *widget,
-                             GtkStyle  *prev_style)
+gimp_color_editor_style_updated (GtkWidget *widget)
 {
   GimpColorEditor *editor = GIMP_COLOR_EDITOR (widget);
 
-  GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
   if (editor->hbox)
     gimp_editor_set_box_style (GIMP_EDITOR (editor), GTK_BOX (editor->hbox));
diff --git a/app/widgets/gimpcolorframe.c b/app/widgets/gimpcolorframe.c
index 90ae96b..df93c55 100644
--- a/app/widgets/gimpcolorframe.c
+++ b/app/widgets/gimpcolorframe.c
@@ -55,8 +55,7 @@ static void       gimp_color_frame_set_property  (GObject        *object,
                                                   const GValue   *value,
                                                   GParamSpec     *pspec);
 
-static void       gimp_color_frame_style_set     (GtkWidget      *widget,
-                                                  GtkStyle       *prev_style);
+static void       gimp_color_frame_style_updated (GtkWidget      *widget);
 static gboolean   gimp_color_frame_draw          (GtkWidget      *widget,
                                                   cairo_t        *cr);
 
@@ -76,12 +75,12 @@ gimp_color_frame_class_init (GimpColorFrameClass *klass)
   GObjectClass   *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class->finalize     = gimp_color_frame_finalize;
-  object_class->get_property = gimp_color_frame_get_property;
-  object_class->set_property = gimp_color_frame_set_property;
+  object_class->finalize      = gimp_color_frame_finalize;
+  object_class->get_property  = gimp_color_frame_get_property;
+  object_class->set_property  = gimp_color_frame_set_property;
 
-  widget_class->style_set    = gimp_color_frame_style_set;
-  widget_class->draw         = gimp_color_frame_draw;
+  widget_class->style_updated = gimp_color_frame_style_updated;
+  widget_class->draw          = gimp_color_frame_draw;
 
   g_object_class_install_property (object_class, PROP_MODE,
                                    g_param_spec_enum ("mode",
@@ -249,12 +248,11 @@ gimp_color_frame_set_property (GObject      *object,
 }
 
 static void
-gimp_color_frame_style_set (GtkWidget *widget,
-                            GtkStyle  *prev_style)
+gimp_color_frame_style_updated (GtkWidget *widget)
 {
   GimpColorFrame *frame = GIMP_COLOR_FRAME (widget);
 
-  GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
   if (frame->number_layout)
     {
diff --git a/app/widgets/gimpcurveview.c b/app/widgets/gimpcurveview.c
index 4a54ceb..bb9d89f 100644
--- a/app/widgets/gimpcurveview.c
+++ b/app/widgets/gimpcurveview.c
@@ -74,8 +74,7 @@ static void       gimp_curve_view_get_property    (GObject          *object,
                                                    GValue           *value,
                                                    GParamSpec       *pspec);
 
-static void       gimp_curve_view_style_set       (GtkWidget        *widget,
-                                                   GtkStyle         *prev_style);
+static void       gimp_curve_view_style_updated   (GtkWidget        *widget);
 static gboolean   gimp_curve_view_draw            (GtkWidget        *widget,
                                                    cairo_t          *cr);
 static gboolean   gimp_curve_view_button_press    (GtkWidget        *widget,
@@ -119,7 +118,7 @@ gimp_curve_view_class_init (GimpCurveViewClass *klass)
   object_class->set_property         = gimp_curve_view_set_property;
   object_class->get_property         = gimp_curve_view_get_property;
 
-  widget_class->style_set            = gimp_curve_view_style_set;
+  widget_class->style_updated        = gimp_curve_view_style_updated;
   widget_class->draw                 = gimp_curve_view_draw;
   widget_class->button_press_event   = gimp_curve_view_button_press;
   widget_class->button_release_event = gimp_curve_view_button_release;
@@ -309,12 +308,11 @@ gimp_curve_view_get_property (GObject    *object,
 }
 
 static void
-gimp_curve_view_style_set (GtkWidget *widget,
-                           GtkStyle  *prev_style)
+gimp_curve_view_style_updated (GtkWidget *widget)
 {
   GimpCurveView *view = GIMP_CURVE_VIEW (widget);
 
-  GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
   if (view->xpos_layout)
     {
diff --git a/app/widgets/gimpdataeditor.c b/app/widgets/gimpdataeditor.c
index 2375175..7450757 100644
--- a/app/widgets/gimpdataeditor.c
+++ b/app/widgets/gimpdataeditor.c
@@ -69,8 +69,7 @@ static void       gimp_data_editor_get_property      (GObject        *object,
                                                       GValue         *value,
                                                       GParamSpec     *pspec);
 
-static void       gimp_data_editor_style_set         (GtkWidget      *widget,
-                                                      GtkStyle       *prev_style);
+static void       gimp_data_editor_style_updated     (GtkWidget      *widget);
 
 static void       gimp_data_editor_set_context       (GimpDocked     *docked,
                                                       GimpContext    *context);
@@ -119,14 +118,14 @@ gimp_data_editor_class_init (GimpDataEditorClass *klass)
   GObjectClass   *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class->constructed  = gimp_data_editor_constructed;
-  object_class->dispose      = gimp_data_editor_dispose;
-  object_class->set_property = gimp_data_editor_set_property;
-  object_class->get_property = gimp_data_editor_get_property;
+  object_class->constructed   = gimp_data_editor_constructed;
+  object_class->set_property  = gimp_data_editor_set_property;
+  object_class->get_property  = gimp_data_editor_get_property;
+  object_class->dispose       = gimp_data_editor_dispose;
 
-  widget_class->style_set    = gimp_data_editor_style_set;
+  widget_class->style_updated = gimp_data_editor_style_updated;
 
-  klass->set_data            = gimp_data_editor_real_set_data;
+  klass->set_data             = gimp_data_editor_real_set_data;
 
   g_object_class_install_property (object_class, PROP_DATA_FACTORY,
                                    g_param_spec_object ("data-factory",
@@ -298,13 +297,12 @@ gimp_data_editor_get_property (GObject    *object,
 }
 
 static void
-gimp_data_editor_style_set (GtkWidget *widget,
-                            GtkStyle  *prev_style)
+gimp_data_editor_style_updated (GtkWidget *widget)
 {
   GimpDataEditor *editor = GIMP_DATA_EDITOR (widget);
   gint            minimal_height;
 
-  GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
   gtk_widget_style_get (widget,
                         "minimal-height", &minimal_height,
diff --git a/app/widgets/gimpdock.c b/app/widgets/gimpdock.c
index ccdeac1..85db7e7 100644
--- a/app/widgets/gimpdock.c
+++ b/app/widgets/gimpdock.c
@@ -73,8 +73,8 @@ struct _GimpDockPrivate
 
 static void       gimp_dock_dispose                (GObject      *object);
 
-static void       gimp_dock_style_set              (GtkWidget    *widget,
-                                                    GtkStyle     *prev_style);
+static void       gimp_dock_style_updated          (GtkWidget    *widget);
+
 static gchar    * gimp_dock_real_get_description   (GimpDock     *dock,
                                                     gboolean      complete);
 static void       gimp_dock_real_book_added        (GimpDock     *dock,
@@ -140,7 +140,7 @@ gimp_dock_class_init (GimpDockClass *klass)
 
   object_class->dispose          = gimp_dock_dispose;
 
-  widget_class->style_set        = gimp_dock_style_set;
+  widget_class->style_updated    = gimp_dock_style_updated;
 
   klass->get_description         = gimp_dock_real_get_description;
   klass->set_host_geometry_hints = NULL;
@@ -207,13 +207,12 @@ gimp_dock_dispose (GObject *object)
 }
 
 static void
-gimp_dock_style_set (GtkWidget *widget,
-                     GtkStyle  *prev_style)
+gimp_dock_style_updated (GtkWidget *widget)
 {
   GimpDock *dock       = GIMP_DOCK (widget);
   gdouble   font_scale = 1.0;
 
-  GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
   gtk_widget_style_get (widget,
                         "font-scale", &font_scale,
diff --git a/app/widgets/gimpdockable.c b/app/widgets/gimpdockable.c
index c9caed8..d194a09 100644
--- a/app/widgets/gimpdockable.c
+++ b/app/widgets/gimpdockable.c
@@ -116,8 +116,7 @@ static gboolean   gimp_dockable_drag_drop            (GtkWidget      *widget,
                                                       gint            y,
                                                       guint           time);
 
-static void       gimp_dockable_style_set            (GtkWidget      *widget,
-                                                      GtkStyle       *prev_style);
+static void       gimp_dockable_style_updated        (GtkWidget      *widget);
 
 static void       gimp_dockable_add                  (GtkContainer   *container,
                                                       GtkWidget      *widget);
@@ -156,7 +155,7 @@ gimp_dockable_class_init (GimpDockableClass *klass)
   widget_class->get_preferred_width  = gimp_dockable_get_preferred_width;
   widget_class->get_preferred_height = gimp_dockable_get_preferred_height;
   widget_class->size_allocate        = gimp_dockable_size_allocate;
-  widget_class->style_set            = gimp_dockable_style_set;
+  widget_class->style_updated        = gimp_dockable_style_updated;
   widget_class->drag_leave           = gimp_dockable_drag_leave;
   widget_class->drag_motion          = gimp_dockable_drag_motion;
   widget_class->drag_drop            = gimp_dockable_drag_drop;
@@ -188,6 +187,7 @@ gimp_dockable_init (GimpDockable *dockable)
   dockable->p = G_TYPE_INSTANCE_GET_PRIVATE (dockable,
                                              GIMP_TYPE_DOCKABLE,
                                              GimpDockablePrivate);
+
   dockable->p->tab_style        = GIMP_TAB_STYLE_AUTOMATIC;
   dockable->p->actual_tab_style = GIMP_TAB_STYLE_UNDEFINED;
   dockable->p->drag_x           = GIMP_DOCKABLE_DRAG_OFFSET;
@@ -411,12 +411,11 @@ gimp_dockable_drag_drop (GtkWidget      *widget,
 }
 
 static void
-gimp_dockable_style_set (GtkWidget *widget,
-                         GtkStyle  *prev_style)
+gimp_dockable_style_updated (GtkWidget *widget)
 {
   gint content_border;
 
-  GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
   gtk_widget_style_get (widget,
                         "content-border", &content_border,
@@ -967,8 +966,8 @@ gimp_dockable_set_aux_info (GimpSessionManaged *session_managed,
 }
 
 static GimpTabStyle
-gimp_dockable_convert_tab_style (GimpDockable   *dockable,
-                                 GimpTabStyle    tab_style)
+gimp_dockable_convert_tab_style (GimpDockable *dockable,
+                                 GimpTabStyle  tab_style)
 {
   GtkWidget *child = gtk_bin_get_child (GTK_BIN (dockable));
 
@@ -984,7 +983,7 @@ gimp_dockable_blink_timeout (GimpDockable *dockable)
   gimp_highlight_widget (GTK_WIDGET (dockable),
                          dockable->p->blink_counter % 2 == 1);
   dockable->p->blink_counter++;
-  
+
   if (dockable->p->blink_counter == 3)
     {
       dockable->p->blink_timeout_id = 0;
diff --git a/app/widgets/gimpeditor.c b/app/widgets/gimpeditor.c
index 1126159..9b81506 100644
--- a/app/widgets/gimpeditor.c
+++ b/app/widgets/gimpeditor.c
@@ -81,8 +81,7 @@ static void            gimp_editor_get_property        (GObject        *object,
                                                         GValue         *value,
                                                         GParamSpec     *pspec);
 
-static void            gimp_editor_style_set           (GtkWidget      *widget,
-                                                        GtkStyle       *prev_style);
+static void            gimp_editor_style_updated       (GtkWidget      *widget);
 
 static GimpUIManager * gimp_editor_get_menu            (GimpDocked     *docked,
                                                         const gchar   **ui_path,
@@ -109,12 +108,12 @@ gimp_editor_class_init (GimpEditorClass *klass)
   GObjectClass   *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class->constructed  = gimp_editor_constructed;
-  object_class->dispose      = gimp_editor_dispose;
-  object_class->set_property = gimp_editor_set_property;
-  object_class->get_property = gimp_editor_get_property;
+  object_class->constructed   = gimp_editor_constructed;
+  object_class->dispose       = gimp_editor_dispose;
+  object_class->set_property  = gimp_editor_set_property;
+  object_class->get_property  = gimp_editor_get_property;
 
-  widget_class->style_set    = gimp_editor_style_set;
+  widget_class->style_updated = gimp_editor_style_updated;
 
   g_object_class_install_property (object_class, PROP_MENU_FACTORY,
                                    g_param_spec_object ("menu-factory",
@@ -354,13 +353,12 @@ gimp_editor_get_property (GObject    *object,
 }
 
 static void
-gimp_editor_style_set (GtkWidget *widget,
-                       GtkStyle  *prev_style)
+gimp_editor_style_updated (GtkWidget *widget)
 {
   GimpEditor  *editor = GIMP_EDITOR (widget);
   gint         content_spacing;
 
-  GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
   gtk_widget_style_get (widget, "content-spacing",  &content_spacing, NULL);
 
diff --git a/app/widgets/gimpitemtreeview.c b/app/widgets/gimpitemtreeview.c
index 3b05ed2..0438b48 100644
--- a/app/widgets/gimpitemtreeview.c
+++ b/app/widgets/gimpitemtreeview.c
@@ -101,8 +101,7 @@ static void   gimp_item_tree_view_docked_iface_init (GimpDockedInterface *docked
 static void   gimp_item_tree_view_constructed       (GObject           *object);
 static void   gimp_item_tree_view_dispose           (GObject           *object);
 
-static void   gimp_item_tree_view_style_set         (GtkWidget         *widget,
-                                                     GtkStyle          *prev_style);
+static void   gimp_item_tree_view_style_updated     (GtkWidget         *widget);
 
 static void   gimp_item_tree_view_real_set_image    (GimpItemTreeView  *view,
                                                      GimpImage         *image);
@@ -238,7 +237,7 @@ gimp_item_tree_view_class_init (GimpItemTreeViewClass *klass)
   object_class->constructed      = gimp_item_tree_view_constructed;
   object_class->dispose          = gimp_item_tree_view_dispose;
 
-  widget_class->style_set        = gimp_item_tree_view_style_set;
+  widget_class->style_updated    = gimp_item_tree_view_style_updated;
 
   tree_view_class->drop_possible = gimp_item_tree_view_drop_possible;
   tree_view_class->drop_viewable = gimp_item_tree_view_drop_viewable;
@@ -493,8 +492,7 @@ gimp_item_tree_view_dispose (GObject *object)
 }
 
 static void
-gimp_item_tree_view_style_set (GtkWidget *widget,
-                               GtkStyle  *prev_style)
+gimp_item_tree_view_style_updated (GtkWidget *widget)
 {
   GimpItemTreeView *view = GIMP_ITEM_TREE_VIEW (widget);
   GList            *children;
@@ -565,7 +563,7 @@ gimp_item_tree_view_style_set (GtkWidget *widget,
       g_list_free (children);
     }
 
-  GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 }
 
 GtkWidget *
diff --git a/app/widgets/gimpmenudock.c b/app/widgets/gimpmenudock.c
index 7303e7b..db6237c 100644
--- a/app/widgets/gimpmenudock.c
+++ b/app/widgets/gimpmenudock.c
@@ -45,14 +45,14 @@
 
 #define DEFAULT_MINIMAL_WIDTH  200
 
+
 struct _GimpMenuDockPrivate
 {
   gint make_sizeof_greater_than_zero;
 };
 
 
-static void   gimp_menu_dock_style_set               (GtkWidget      *widget,
-                                                      GtkStyle       *prev_style);
+static void   gimp_menu_dock_style_updated (GtkWidget *widget);
 
 
 G_DEFINE_TYPE (GimpMenuDock, gimp_menu_dock, GIMP_TYPE_DOCK)
@@ -65,7 +65,7 @@ gimp_menu_dock_class_init (GimpMenuDockClass *klass)
 {
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  widget_class->style_set = gimp_menu_dock_style_set;
+  widget_class->style_updated = gimp_menu_dock_style_updated;
 
   gtk_widget_class_install_style_property (widget_class,
                                            g_param_spec_int ("minimal-width",
@@ -84,12 +84,11 @@ gimp_menu_dock_init (GimpMenuDock *dock)
 }
 
 static void
-gimp_menu_dock_style_set (GtkWidget *widget,
-                          GtkStyle  *prev_style)
+gimp_menu_dock_style_updated (GtkWidget *widget)
 {
   gint minimal_width = -1;
 
-  GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
   gtk_widget_style_get (widget,
                         "minimal-width", &minimal_width,
diff --git a/app/widgets/gimpsamplepointeditor.c b/app/widgets/gimpsamplepointeditor.c
index 54069de..35929cb 100644
--- a/app/widgets/gimpsamplepointeditor.c
+++ b/app/widgets/gimpsamplepointeditor.c
@@ -59,8 +59,7 @@ static void   gimp_sample_point_editor_get_property   (GObject               *ob
                                                        GValue                *value,
                                                        GParamSpec            *pspec);
 
-static void   gimp_sample_point_editor_style_set      (GtkWidget             *widget,
-                                                       GtkStyle              *prev_style);
+static void   gimp_sample_point_editor_style_updated  (GtkWidget             *widget);
 static void   gimp_sample_point_editor_set_image      (GimpImageEditor       *editor,
                                                        GimpImage             *image);
 
@@ -104,7 +103,7 @@ gimp_sample_point_editor_class_init (GimpSamplePointEditorClass *klass)
   object_class->get_property    = gimp_sample_point_editor_get_property;
   object_class->set_property    = gimp_sample_point_editor_set_property;
 
-  widget_class->style_set       = gimp_sample_point_editor_style_set;
+  widget_class->style_updated   = gimp_sample_point_editor_style_updated;
 
   image_editor_class->set_image = gimp_sample_point_editor_set_image;
 
@@ -226,20 +225,23 @@ gimp_sample_point_editor_get_property (GObject    *object,
 }
 
 static void
-gimp_sample_point_editor_style_set (GtkWidget *widget,
-                                    GtkStyle  *prev_style)
+gimp_sample_point_editor_style_updated (GtkWidget *widget)
 {
   GimpSamplePointEditor *editor = GIMP_SAMPLE_POINT_EDITOR (widget);
-  gint                   content_spacing;
 
-  GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
-  gtk_widget_style_get (widget,
-                        "content-spacing", &content_spacing,
-                        NULL);
+  if (editor->table)
+    {
+      gint content_spacing;
 
-  gtk_table_set_row_spacing (GTK_TABLE (editor->table), 0, content_spacing);
-  gtk_table_set_col_spacing (GTK_TABLE (editor->table), 0, content_spacing);
+      gtk_widget_style_get (widget,
+                            "content-spacing", &content_spacing,
+                            NULL);
+
+      gtk_table_set_row_spacing (GTK_TABLE (editor->table), 0, content_spacing);
+      gtk_table_set_col_spacing (GTK_TABLE (editor->table), 0, content_spacing);
+    }
 }
 
 static void
diff --git a/app/widgets/gimptoolpalette.c b/app/widgets/gimptoolpalette.c
index 08d1f7c..b4b2159 100644
--- a/app/widgets/gimptoolpalette.c
+++ b/app/widgets/gimptoolpalette.c
@@ -73,9 +73,7 @@ static void     gimp_tool_palette_height_for_width    (GtkWidget       *widget,
                                                        gint             width,
                                                        gint            *min_width,
                                                        gint            *pref_width);
-
-static void     gimp_tool_palette_style_set           (GtkWidget       *widget,
-                                                       GtkStyle        *previous_style);
+static void     gimp_tool_palette_style_updated       (GtkWidget       *widget);
 
 static void     gimp_tool_palette_tool_changed        (GimpContext     *context,
                                                        GimpToolInfo    *tool_info,
@@ -109,7 +107,7 @@ gimp_tool_palette_class_init (GimpToolPaletteClass *klass)
   widget_class->get_preferred_width            = gimp_tool_palette_get_preferred_width;
   widget_class->get_preferred_height           = gimp_tool_palette_get_preferred_height;
   widget_class->get_preferred_height_for_width = gimp_tool_palette_height_for_width;
-  widget_class->style_set                      = gimp_tool_palette_style_set;
+  widget_class->style_updated                  = gimp_tool_palette_style_updated;
 
   gtk_widget_class_install_style_property (widget_class,
                                            g_param_spec_enum ("tool-icon-size",
@@ -212,8 +210,7 @@ gimp_tool_palette_height_for_width (GtkWidget *widget,
 }
 
 static void
-gimp_tool_palette_style_set (GtkWidget *widget,
-                             GtkStyle  *previous_style)
+gimp_tool_palette_style_updated (GtkWidget *widget)
 {
   GimpToolPalettePrivate *private = GET_PRIVATE (widget);
   Gimp                   *gimp;
@@ -221,7 +218,7 @@ gimp_tool_palette_style_set (GtkWidget *widget,
   GtkReliefStyle          relief;
   GList                  *list;
 
-  GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
   if (! gimp_toolbox_get_context (private->toolbox))
     return;
diff --git a/libgimp/gimpaspectpreview.c b/libgimp/gimpaspectpreview.c
index e2fbea0..07b4c04 100644
--- a/libgimp/gimpaspectpreview.c
+++ b/libgimp/gimpaspectpreview.c
@@ -54,36 +54,35 @@ typedef struct
 } PreviewSettings;
 
 
-static void  gimp_aspect_preview_constructed  (GObject         *object);
-static void  gimp_aspect_preview_dispose      (GObject         *object);
-static void  gimp_aspect_preview_get_property (GObject         *object,
-                                               guint            property_id,
-                                               GValue          *value,
-                                               GParamSpec      *pspec);
-static void  gimp_aspect_preview_set_property (GObject         *object,
-                                               guint            property_id,
-                                               const GValue    *value,
-                                               GParamSpec      *pspec);
-
-static void  gimp_aspect_preview_style_set    (GtkWidget       *widget,
-                                               GtkStyle        *prev_style);
-static void  gimp_aspect_preview_draw         (GimpPreview     *preview);
-static void  gimp_aspect_preview_draw_buffer  (GimpPreview     *preview,
-                                               const guchar    *buffer,
-                                               gint             rowstride);
-static void  gimp_aspect_preview_transform    (GimpPreview     *preview,
-                                               gint             src_x,
-                                               gint             src_y,
-                                               gint            *dest_x,
-                                               gint            *dest_y);
-static void  gimp_aspect_preview_untransform  (GimpPreview     *preview,
-                                               gint             src_x,
-                                               gint             src_y,
-                                               gint            *dest_x,
-                                               gint            *dest_y);
-
-static void  gimp_aspect_preview_set_drawable (GimpAspectPreview *preview,
-                                               GimpDrawable      *drawable);
+static void  gimp_aspect_preview_constructed   (GObject         *object);
+static void  gimp_aspect_preview_dispose       (GObject         *object);
+static void  gimp_aspect_preview_get_property  (GObject         *object,
+                                                guint            property_id,
+                                                GValue          *value,
+                                                GParamSpec      *pspec);
+static void  gimp_aspect_preview_set_property  (GObject         *object,
+                                                guint            property_id,
+                                                const GValue    *value,
+                                                GParamSpec      *pspec);
+
+static void  gimp_aspect_preview_style_updated (GtkWidget       *widget);
+static void  gimp_aspect_preview_draw          (GimpPreview     *preview);
+static void  gimp_aspect_preview_draw_buffer   (GimpPreview     *preview,
+                                                const guchar    *buffer,
+                                                gint             rowstride);
+static void  gimp_aspect_preview_transform     (GimpPreview     *preview,
+                                                gint             src_x,
+                                                gint             src_y,
+                                                gint            *dest_x,
+                                                gint            *dest_y);
+static void  gimp_aspect_preview_untransform   (GimpPreview     *preview,
+                                                gint             src_x,
+                                                gint             src_y,
+                                                gint            *dest_x,
+                                                gint            *dest_y);
+
+static void  gimp_aspect_preview_set_drawable  (GimpAspectPreview *preview,
+                                                GimpDrawable      *drawable);
 
 
 G_DEFINE_TYPE (GimpAspectPreview, gimp_aspect_preview, GIMP_TYPE_PREVIEW)
@@ -100,17 +99,17 @@ gimp_aspect_preview_class_init (GimpAspectPreviewClass *klass)
   GtkWidgetClass   *widget_class  = GTK_WIDGET_CLASS (klass);
   GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass);
 
-  object_class->constructed  = gimp_aspect_preview_constructed;
-  object_class->dispose      = gimp_aspect_preview_dispose;
-  object_class->get_property = gimp_aspect_preview_get_property;
-  object_class->set_property = gimp_aspect_preview_set_property;
+  object_class->constructed   = gimp_aspect_preview_constructed;
+  object_class->dispose       = gimp_aspect_preview_dispose;
+  object_class->get_property  = gimp_aspect_preview_get_property;
+  object_class->set_property  = gimp_aspect_preview_set_property;
 
-  widget_class->style_set    = gimp_aspect_preview_style_set;
+  widget_class->style_updated = gimp_aspect_preview_style_updated;
 
-  preview_class->draw        = gimp_aspect_preview_draw;
-  preview_class->draw_buffer = gimp_aspect_preview_draw_buffer;
-  preview_class->transform   = gimp_aspect_preview_transform;
-  preview_class->untransform = gimp_aspect_preview_untransform;
+  preview_class->draw         = gimp_aspect_preview_draw;
+  preview_class->draw_buffer  = gimp_aspect_preview_draw_buffer;
+  preview_class->transform    = gimp_aspect_preview_transform;
+  preview_class->untransform  = gimp_aspect_preview_untransform;
 
   /**
    * GimpAspectPreview:drawable:
@@ -215,36 +214,37 @@ gimp_aspect_preview_set_property (GObject      *object,
 }
 
 static void
-gimp_aspect_preview_style_set (GtkWidget *widget,
-                               GtkStyle  *prev_style)
+gimp_aspect_preview_style_updated (GtkWidget *widget)
 {
-  GimpPreview  *preview  = GIMP_PREVIEW (widget);
-  GimpDrawable *drawable = GIMP_ASPECT_PREVIEW (preview)->drawable;
-  gint          size;
-
-  if (GTK_WIDGET_CLASS (parent_class)->style_set)
-    GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GimpPreview *preview = GIMP_PREVIEW (widget);
 
-  gtk_widget_style_get (widget,
-                        "size", &size,
-                        NULL);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
-  if (drawable->width > drawable->height)
-    {
-      preview->width  = MIN (drawable->width, size);
-      preview->height = (drawable->height * preview->width) / drawable->width;
-    }
-  else
+  if (preview->area)
     {
-      preview->height = MIN (drawable->height, size);
-      preview->width  = (drawable->width * preview->height) / drawable->height;
+      GimpDrawable *drawable = GIMP_ASPECT_PREVIEW (preview)->drawable;
+      gint          size;
+
+      gtk_widget_style_get (widget,
+                            "size", &size,
+                            NULL);
+
+      if (drawable->width > drawable->height)
+        {
+          preview->width  = MIN (drawable->width, size);
+          preview->height = (drawable->height * preview->width) / drawable->width;
+        }
+      else
+        {
+          preview->height = MIN (drawable->height, size);
+          preview->width  = (drawable->width * preview->height) / drawable->height;
+        }
+
+      gtk_widget_set_size_request (preview->area,
+                                   preview->width, preview->height);
     }
-
-  gtk_widget_set_size_request (preview->area,
-                               preview->width, preview->height);
 }
 
-
 static void
 gimp_aspect_preview_draw (GimpPreview *preview)
 {
diff --git a/libgimp/gimpdrawablepreview.c b/libgimp/gimpdrawablepreview.c
index e291dca..afffb10 100644
--- a/libgimp/gimpdrawablepreview.c
+++ b/libgimp/gimpdrawablepreview.c
@@ -67,8 +67,7 @@ static void  gimp_drawable_preview_set_property  (GObject         *object,
                                                   const GValue    *value,
                                                   GParamSpec      *pspec);
 
-static void  gimp_drawable_preview_style_set     (GtkWidget       *widget,
-                                                  GtkStyle        *prev_style);
+static void  gimp_drawable_preview_style_updated (GtkWidget       *widget);
 
 static void  gimp_drawable_preview_draw_original (GimpPreview     *preview);
 static void  gimp_drawable_preview_draw_thumb    (GimpPreview     *preview,
@@ -98,16 +97,16 @@ gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass)
   GtkWidgetClass   *widget_class  = GTK_WIDGET_CLASS (klass);
   GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass);
 
-  object_class->constructed  = gimp_drawable_preview_constructed;
-  object_class->dispose      = gimp_drawable_preview_dispose;
-  object_class->get_property = gimp_drawable_preview_get_property;
-  object_class->set_property = gimp_drawable_preview_set_property;
+  object_class->constructed   = gimp_drawable_preview_constructed;
+  object_class->dispose       = gimp_drawable_preview_dispose;
+  object_class->get_property  = gimp_drawable_preview_get_property;
+  object_class->set_property  = gimp_drawable_preview_set_property;
 
-  widget_class->style_set    = gimp_drawable_preview_style_set;
+  widget_class->style_updated = gimp_drawable_preview_style_updated;
 
-  preview_class->draw        = gimp_drawable_preview_draw_original;
-  preview_class->draw_thumb  = gimp_drawable_preview_draw_thumb;
-  preview_class->draw_buffer = gimp_drawable_preview_draw_buffer;
+  preview_class->draw         = gimp_drawable_preview_draw_original;
+  preview_class->draw_thumb   = gimp_drawable_preview_draw_thumb;
+  preview_class->draw_buffer  = gimp_drawable_preview_draw_buffer;
 
   /**
    * GimpDrawablePreview:drawable:
@@ -217,23 +216,25 @@ gimp_drawable_preview_set_property (GObject      *object,
 }
 
 static void
-gimp_drawable_preview_style_set (GtkWidget *widget,
-                                 GtkStyle  *prev_style)
+gimp_drawable_preview_style_updated (GtkWidget *widget)
 {
   GimpPreview *preview = GIMP_PREVIEW (widget);
-  gint         width   = preview->xmax - preview->xmin;
-  gint         height  = preview->ymax - preview->ymin;
-  gint         size;
 
-  if (GTK_WIDGET_CLASS (parent_class)->style_set)
-    GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
-  gtk_widget_style_get (widget,
-                        "size", &size,
-                        NULL);
+  if (preview->area)
+    {
+      gint width  = preview->xmax - preview->xmin;
+      gint height = preview->ymax - preview->ymin;
+      gint size;
+
+      gtk_widget_style_get (widget,
+                            "size", &size,
+                            NULL);
 
-  gtk_widget_set_size_request (GIMP_PREVIEW (preview)->area,
-                               MIN (width, size), MIN (height, size));
+      gtk_widget_set_size_request (GIMP_PREVIEW (preview)->area,
+                                   MIN (width, size), MIN (height, size));
+    }
 }
 
 static void
diff --git a/libgimp/gimpzoompreview.c b/libgimp/gimpzoompreview.c
index 99155b5..5256d4f 100644
--- a/libgimp/gimpzoompreview.c
+++ b/libgimp/gimpzoompreview.c
@@ -84,8 +84,7 @@ static void     gimp_zoom_preview_set_adjustments (GimpZoomPreview *preview,
 static void     gimp_zoom_preview_size_allocate   (GtkWidget       *widget,
                                                    GtkAllocation   *allocation,
                                                    GimpZoomPreview *preview);
-static void     gimp_zoom_preview_style_set       (GtkWidget       *widget,
-                                                   GtkStyle        *prev_style);
+static void     gimp_zoom_preview_style_updated   (GtkWidget       *widget);
 static gboolean gimp_zoom_preview_scroll_event    (GtkWidget       *widget,
                                                    GdkEventScroll  *event,
                                                    GimpZoomPreview *preview);
@@ -135,20 +134,20 @@ gimp_zoom_preview_class_init (GimpZoomPreviewClass *klass)
   GtkWidgetClass   *widget_class  = GTK_WIDGET_CLASS (klass);
   GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass);
 
-  object_class->constructed  = gimp_zoom_preview_constructed;
-  object_class->finalize     = gimp_zoom_preview_finalize;
-  object_class->dispose      = gimp_zoom_preview_dispose;
-  object_class->get_property = gimp_zoom_preview_get_property;
-  object_class->set_property = gimp_zoom_preview_set_property;
+  object_class->constructed   = gimp_zoom_preview_constructed;
+  object_class->finalize      = gimp_zoom_preview_finalize;
+  object_class->dispose       = gimp_zoom_preview_dispose;
+  object_class->get_property  = gimp_zoom_preview_get_property;
+  object_class->set_property  = gimp_zoom_preview_set_property;
 
-  widget_class->style_set    = gimp_zoom_preview_style_set;
+  widget_class->style_updated = gimp_zoom_preview_style_updated;
 
-  preview_class->draw        = gimp_zoom_preview_draw;
-  preview_class->draw_buffer = gimp_zoom_preview_draw_buffer;
-  preview_class->draw_thumb  = gimp_zoom_preview_draw_thumb;
-  preview_class->set_cursor  = gimp_zoom_preview_set_cursor;
-  preview_class->transform   = gimp_zoom_preview_transform;
-  preview_class->untransform = gimp_zoom_preview_untransform;
+  preview_class->draw         = gimp_zoom_preview_draw;
+  preview_class->draw_buffer  = gimp_zoom_preview_draw_buffer;
+  preview_class->draw_thumb   = gimp_zoom_preview_draw_thumb;
+  preview_class->set_cursor   = gimp_zoom_preview_set_cursor;
+  preview_class->transform    = gimp_zoom_preview_transform;
+  preview_class->untransform  = gimp_zoom_preview_untransform;
 
   g_type_class_add_private (object_class, sizeof (GimpZoomPreviewPrivate));
 
@@ -378,46 +377,48 @@ gimp_zoom_preview_size_allocate (GtkWidget       *widget,
 }
 
 static void
-gimp_zoom_preview_style_set (GtkWidget *widget,
-                             GtkStyle  *prev_style)
+gimp_zoom_preview_style_updated (GtkWidget *widget)
 {
-  GimpPreview            *preview  = GIMP_PREVIEW (widget);
-  GimpZoomPreviewPrivate *priv     = GIMP_ZOOM_PREVIEW_GET_PRIVATE (preview);
-  GimpDrawable           *drawable = priv->drawable;
-  gint                    size;
-  gint                    width, height;
-  gint                    x1, y1;
-  gint                    x2, y2;
-
-  if (GTK_WIDGET_CLASS (parent_class)->style_set)
-    GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GimpPreview *preview = GIMP_PREVIEW (widget);
 
-  gtk_widget_style_get (widget, "size", &size, NULL);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
-  if (_gimp_drawable_preview_get_bounds (drawable, &x1, &y1, &x2, &y2))
-    {
-      width  = x2 - x1;
-      height = y2 - y1;
-    }
-  else
+  if (preview->area)
     {
-      width  = gimp_drawable_width  (drawable->drawable_id);
-      height = gimp_drawable_height (drawable->drawable_id);
-    }
+      GimpZoomPreviewPrivate *priv     = GIMP_ZOOM_PREVIEW_GET_PRIVATE (preview);
+      GimpDrawable           *drawable = priv->drawable;
+      gint                    size;
+      gint                    width, height;
+      gint                    x1, y1;
+      gint                    x2, y2;
 
-  if (width > height)
-    {
-      preview->width  = MIN (width, size);
-      preview->height = (height * preview->width) / width;
-    }
-  else
-    {
-      preview->height = MIN (height, size);
-      preview->width  = (width * preview->height) / height;
-    }
+      gtk_widget_style_get (widget, "size", &size, NULL);
+
+      if (_gimp_drawable_preview_get_bounds (drawable, &x1, &y1, &x2, &y2))
+        {
+          width  = x2 - x1;
+          height = y2 - y1;
+        }
+      else
+        {
+          width  = gimp_drawable_width  (drawable->drawable_id);
+          height = gimp_drawable_height (drawable->drawable_id);
+        }
 
-  gtk_widget_set_size_request (preview->area,
-                               preview->width, preview->height);
+      if (width > height)
+        {
+          preview->width  = MIN (width, size);
+          preview->height = (height * preview->width) / width;
+        }
+      else
+        {
+          preview->height = MIN (height, size);
+          preview->width  = (width * preview->height) / height;
+        }
+
+      gtk_widget_set_size_request (preview->area,
+                                   preview->width, preview->height);
+    }
 }
 
 static gboolean



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