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



commit 7539e163c0161c7c1a392c26e7b1af75ae4a562e
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 620b2f9..b929b3b 100644
--- a/app/widgets/gimpcoloreditor.c
+++ b/app/widgets/gimpcoloreditor.c
@@ -63,8 +63,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);
@@ -112,11 +111,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",
@@ -474,12 +473,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 634f0f5..b1d9cb3 100644
--- a/app/widgets/gimpcolorframe.c
+++ b/app/widgets/gimpcolorframe.c
@@ -57,8 +57,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);
 
@@ -78,12 +77,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",
@@ -252,12 +251,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 e435180..af773b1 100644
--- a/app/widgets/gimpcurveview.c
+++ b/app/widgets/gimpcurveview.c
@@ -77,8 +77,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,
@@ -122,7 +121,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;
@@ -349,12 +348,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->layout)
     {
diff --git a/app/widgets/gimpdataeditor.c b/app/widgets/gimpdataeditor.c
index 6d8521c..dca8820 100644
--- a/app/widgets/gimpdataeditor.c
+++ b/app/widgets/gimpdataeditor.c
@@ -70,8 +70,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);
@@ -120,14 +119,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 1af97af..5f310b1 100644
--- a/app/widgets/gimpdock.c
+++ b/app/widgets/gimpdock.c
@@ -74,8 +74,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,
@@ -141,7 +141,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;
@@ -215,13 +215,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 5b0d282..c2d25f9 100644
--- a/app/widgets/gimpdockable.c
+++ b/app/widgets/gimpdockable.c
@@ -117,8 +117,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);
@@ -157,7 +156,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;
@@ -189,6 +188,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;
@@ -412,12 +412,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,
@@ -968,8 +967,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));
 
@@ -985,7 +984,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 99d51a0..bc4967f 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",
@@ -353,13 +352,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 ce55482..5d5e231 100644
--- a/app/widgets/gimpitemtreeview.c
+++ b/app/widgets/gimpitemtreeview.c
@@ -104,8 +104,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);
@@ -245,7 +244,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;
@@ -523,8 +522,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;
@@ -595,7 +593,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 739d662..897c3a8 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;
 
@@ -225,20 +224,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 f843d03..33b2d96 100644
--- a/app/widgets/gimptoolpalette.c
+++ b/app/widgets/gimptoolpalette.c
@@ -75,9 +75,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,
@@ -108,7 +106,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 1abf2dc..6d437b9 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:
@@ -214,36 +213,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 dcf48db..c0fe993 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:
@@ -216,23 +215,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 3ace571..8cf56c6 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));
 
@@ -377,46 +376,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]