[gimp/gtk3-port: 135/227] libgimpwidgets: implement GtkWidget::style_updated() instead of style_set()



commit 48a4531d78d4116e8315d626aa5e4e1a94e6e201
Author: Michael Natterer <mitch gimp org>
Date:   Tue Dec 21 09:32:10 2010 +0100

    libgimpwidgets: implement GtkWidget::style_updated() instead of style_set()

 libgimpwidgets/gimpcolornotebook.c |   11 ++++-------
 libgimpwidgets/gimpframe.c         |   10 +++++-----
 libgimpwidgets/gimppageselector.c  |   24 +++++++++++-------------
 libgimpwidgets/gimpruler.c         |   10 ++++------
 libgimpwidgets/gimpunitcombobox.c  |   10 ++++------
 5 files changed, 28 insertions(+), 37 deletions(-)
---
diff --git a/libgimpwidgets/gimpcolornotebook.c b/libgimpwidgets/gimpcolornotebook.c
index 8ee6999..7916646 100644
--- a/libgimpwidgets/gimpcolornotebook.c
+++ b/libgimpwidgets/gimpcolornotebook.c
@@ -54,8 +54,7 @@
 #define DEFAULT_TAB_ICON_SIZE  GTK_ICON_SIZE_BUTTON
 
 
-static void   gimp_color_notebook_style_set       (GtkWidget         *widget,
-                                                   GtkStyle          *prev_style);
+static void   gimp_color_notebook_style_updated   (GtkWidget         *widget);
 
 static void   gimp_color_notebook_togg_visible    (GimpColorSelector *selector,
                                                    gboolean           visible);
@@ -104,7 +103,7 @@ gimp_color_notebook_class_init (GimpColorNotebookClass *klass)
   GtkWidgetClass         *widget_class   = GTK_WIDGET_CLASS (klass);
   GimpColorSelectorClass *selector_class = GIMP_COLOR_SELECTOR_CLASS (klass);
 
-  widget_class->style_set               = gimp_color_notebook_style_set;
+  widget_class->style_updated           = gimp_color_notebook_style_updated;
 
   selector_class->name                  = "Notebook";
   selector_class->help_id               = "gimp-colorselector-notebook";
@@ -176,16 +175,14 @@ gimp_color_notebook_init (GimpColorNotebook *notebook)
 }
 
 static void
-gimp_color_notebook_style_set (GtkWidget *widget,
-                               GtkStyle  *prev_style)
+gimp_color_notebook_style_updated (GtkWidget *widget)
 {
   GimpColorNotebook *notebook = GIMP_COLOR_NOTEBOOK (widget);
   GList             *list;
   gint               tab_border;
   GtkIconSize        icon_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,
                         "tab-border",    &tab_border,
diff --git a/libgimpwidgets/gimpframe.c b/libgimpwidgets/gimpframe.c
index 9d9a88d..2d5d910 100644
--- a/libgimpwidgets/gimpframe.c
+++ b/libgimpwidgets/gimpframe.c
@@ -55,8 +55,7 @@ static void      gimp_frame_get_preferred_height (GtkWidget      *widget,
                                                   gint           *natural_height);
 static void      gimp_frame_size_allocate        (GtkWidget      *widget,
                                                   GtkAllocation  *allocation);
-static void      gimp_frame_style_set            (GtkWidget      *widget,
-                                                  GtkStyle       *previous);
+static void      gimp_frame_style_updated        (GtkWidget      *widget);
 static gboolean  gimp_frame_draw                 (GtkWidget      *widget,
                                                   cairo_t        *cr);
 static void      gimp_frame_child_allocate       (GtkFrame       *frame,
@@ -79,7 +78,7 @@ gimp_frame_class_init (GimpFrameClass *klass)
   widget_class->get_preferred_width  = gimp_frame_get_preferred_width;
   widget_class->get_preferred_height = gimp_frame_get_preferred_height;
   widget_class->size_allocate        = gimp_frame_size_allocate;
-  widget_class->style_set            = gimp_frame_style_set;
+  widget_class->style_updated        = gimp_frame_style_updated;
   widget_class->draw                 = gimp_frame_draw;
 
   gtk_widget_class_install_style_property (widget_class,
@@ -246,9 +245,10 @@ gimp_frame_child_allocate (GtkFrame      *frame,
 }
 
 static void
-gimp_frame_style_set (GtkWidget *widget,
-                      GtkStyle  *previous)
+gimp_frame_style_updated (GtkWidget *widget)
 {
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
+
   /*  font changes invalidate the indentation  */
   g_object_set_data (G_OBJECT (widget), GIMP_FRAME_INDENT_KEY, NULL);
 
diff --git a/libgimpwidgets/gimppageselector.c b/libgimpwidgets/gimppageselector.c
index 57990af..8059881 100644
--- a/libgimpwidgets/gimppageselector.c
+++ b/libgimpwidgets/gimppageselector.c
@@ -102,8 +102,8 @@ static void   gimp_page_selector_set_property      (GObject          *object,
                                                     guint             property_id,
                                                     const GValue     *value,
                                                     GParamSpec       *pspec);
-static void   gimp_page_selector_style_set         (GtkWidget        *widget,
-                                                    GtkStyle         *prev_style);
+
+static void   gimp_page_selector_style_updated     (GtkWidget        *widget);
 
 static void   gimp_page_selector_selection_changed (GtkIconView      *icon_view,
                                                     GimpPageSelector *selector);
@@ -141,15 +141,15 @@ gimp_page_selector_class_init (GimpPageSelectorClass *klass)
   GObjectClass   *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class->dispose      = gimp_page_selector_dispose;
-  object_class->finalize     = gimp_page_selector_finalize;
-  object_class->get_property = gimp_page_selector_get_property;
-  object_class->set_property = gimp_page_selector_set_property;
+  object_class->dispose       = gimp_page_selector_dispose;
+  object_class->finalize      = gimp_page_selector_finalize;
+  object_class->get_property  = gimp_page_selector_get_property;
+  object_class->set_property  = gimp_page_selector_set_property;
 
-  widget_class->style_set    = gimp_page_selector_style_set;
+  widget_class->style_updated = gimp_page_selector_style_updated;
 
-  klass->selection_changed   = NULL;
-  klass->activate            = NULL;
+  klass->selection_changed    = NULL;
+  klass->activate             = NULL;
 
   /**
    * GimpPageSelector::selection-changed:
@@ -415,8 +415,7 @@ gimp_page_selector_set_property (GObject      *object,
 }
 
 static void
-gimp_page_selector_style_set (GtkWidget *widget,
-                              GtkStyle  *prev_style)
+gimp_page_selector_style_updated (GtkWidget *widget)
 {
   GimpPageSelectorPrivate *priv = GIMP_PAGE_SELECTOR_GET_PRIVATE (widget);
   PangoLayout             *layout;
@@ -426,8 +425,7 @@ gimp_page_selector_style_set (GtkWidget *widget,
   gint                     focus_padding;
   gint                     item_width;
 
-  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);
 
   layout = gtk_widget_create_pango_layout (widget, _("Page 000"));
   pango_layout_get_extents (layout, &ink_rect, &logical_rect);
diff --git a/libgimpwidgets/gimpruler.c b/libgimpwidgets/gimpruler.c
index fc5b5c2..cf8e4a0 100644
--- a/libgimpwidgets/gimpruler.c
+++ b/libgimpwidgets/gimpruler.c
@@ -115,8 +115,7 @@ static void          gimp_ruler_get_preferred_width  (GtkWidget      *widget,
 static void          gimp_ruler_get_preferred_height (GtkWidget      *widget,
                                                       gint           *minimum_height,
                                                       gint           *natural_height);
-static void          gimp_ruler_style_set            (GtkWidget      *widget,
-                                                      GtkStyle       *prev_style);
+static void          gimp_ruler_style_updated        (GtkWidget      *widget);
 static gboolean      gimp_ruler_motion_notify        (GtkWidget      *widget,
                                                       GdkEventMotion *event);
 static gboolean      gimp_ruler_draw                 (GtkWidget      *widget,
@@ -152,7 +151,7 @@ gimp_ruler_class_init (GimpRulerClass *klass)
   widget_class->get_preferred_width  = gimp_ruler_get_preferred_width;
   widget_class->get_preferred_height = gimp_ruler_get_preferred_height;
   widget_class->size_allocate        = gimp_ruler_size_allocate;
-  widget_class->style_set            = gimp_ruler_style_set;
+  widget_class->style_updated        = gimp_ruler_style_updated;
   widget_class->motion_notify_event  = gimp_ruler_motion_notify;
   widget_class->draw                 = gimp_ruler_draw;
 
@@ -886,12 +885,11 @@ gimp_ruler_get_preferred_height (GtkWidget *widget,
 }
 
 static void
-gimp_ruler_style_set (GtkWidget *widget,
-                      GtkStyle  *prev_style)
+gimp_ruler_style_updated (GtkWidget *widget)
 {
   GimpRulerPrivate *priv = GIMP_RULER_GET_PRIVATE (widget);
 
-  GTK_WIDGET_CLASS (gimp_ruler_parent_class)->style_set (widget, prev_style);
+  GTK_WIDGET_CLASS (gimp_ruler_parent_class)->style_updated (widget);
 
   gtk_widget_style_get (widget,
                         "font-scale", &priv->font_scale,
diff --git a/libgimpwidgets/gimpunitcombobox.c b/libgimpwidgets/gimpunitcombobox.c
index c71cb3c..0a11e51 100644
--- a/libgimpwidgets/gimpunitcombobox.c
+++ b/libgimpwidgets/gimpunitcombobox.c
@@ -40,8 +40,7 @@
  **/
 
 
-static void  gimp_unit_combo_box_style_set (GtkWidget *widget,
-                                            GtkStyle  *prev_style);
+static void   gimp_unit_combo_box_style_updated (GtkWidget *widget);
 
 
 G_DEFINE_TYPE (GimpUnitComboBox, gimp_unit_combo_box, GTK_TYPE_COMBO_BOX)
@@ -54,7 +53,7 @@ gimp_unit_combo_box_class_init (GimpUnitComboBoxClass *klass)
 {
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  widget_class->style_set = gimp_unit_combo_box_style_set;
+  widget_class->style_updated = gimp_unit_combo_box_style_updated;
 
   gtk_widget_class_install_style_property (widget_class,
                                            g_param_spec_double ("label-scale",
@@ -79,14 +78,13 @@ gimp_unit_combo_box_init (GimpUnitComboBox *combo)
 }
 
 static void
-gimp_unit_combo_box_style_set (GtkWidget *widget,
-                               GtkStyle  *prev_style)
+gimp_unit_combo_box_style_updated (GtkWidget *widget)
 {
   GtkCellLayout   *layout;
   GtkCellRenderer *cell;
   gdouble          scale;
 
-  GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
   gtk_widget_style_get (widget, "label-scale", &scale, NULL);
 



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