[gimp/gtk3-port: 175/237] app: implement GtkWidget::style_updated() instead of style_set()



commit cfde87b5dce02eb8a86467eb40e2d04223e561e9
Author: Michael Natterer <mitch gimp org>
Date:   Wed Dec 22 23:34:47 2010 +0100

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

 app/display/gimpcanvas.c                 |   10 ++----
 app/display/gimpcursorview.c             |   14 ++++-----
 app/display/gimpdisplayshell-callbacks.c |    2 +-
 app/display/gimpimagewindow.c            |   10 ++----
 app/display/gimpscalecombobox.c          |   46 ++++++++++++-----------------
 app/display/gimpstatusbar.c              |   12 +++----
 6 files changed, 39 insertions(+), 55 deletions(-)
---
diff --git a/app/display/gimpcanvas.c b/app/display/gimpcanvas.c
index 399d826..e16abc0 100644
--- a/app/display/gimpcanvas.c
+++ b/app/display/gimpcanvas.c
@@ -55,8 +55,7 @@ static void       gimp_canvas_get_property    (GObject         *object,
                                                GParamSpec      *pspec);
 
 static void       gimp_canvas_unrealize       (GtkWidget       *widget);
-static void       gimp_canvas_style_set       (GtkWidget       *widget,
-                                               GtkStyle        *prev_style);
+static void       gimp_canvas_style_updated   (GtkWidget       *widget);
 static gboolean   gimp_canvas_focus_in_event  (GtkWidget       *widget,
                                                GdkEventFocus   *event);
 static gboolean   gimp_canvas_focus_out_event (GtkWidget       *widget,
@@ -80,7 +79,7 @@ gimp_canvas_class_init (GimpCanvasClass *klass)
   object_class->get_property    = gimp_canvas_get_property;
 
   widget_class->unrealize       = gimp_canvas_unrealize;
-  widget_class->style_set       = gimp_canvas_style_set;
+  widget_class->style_updated   = gimp_canvas_style_updated;
   widget_class->focus_in_event  = gimp_canvas_focus_in_event;
   widget_class->focus_out_event = gimp_canvas_focus_out_event;
   widget_class->focus           = gimp_canvas_focus;
@@ -157,12 +156,11 @@ gimp_canvas_unrealize (GtkWidget *widget)
 }
 
 static void
-gimp_canvas_style_set (GtkWidget *widget,
-                       GtkStyle  *prev_style)
+gimp_canvas_style_updated (GtkWidget *widget)
 {
   GimpCanvas *canvas = GIMP_CANVAS (widget);
 
-  GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
   if (canvas->layout)
     {
diff --git a/app/display/gimpcursorview.c b/app/display/gimpcursorview.c
index 289cda1..ffb851b 100644
--- a/app/display/gimpcursorview.c
+++ b/app/display/gimpcursorview.c
@@ -96,8 +96,7 @@ static void   gimp_cursor_view_get_property          (GObject             *objec
                                                       GValue              *value,
                                                       GParamSpec          *pspec);
 
-static void   gimp_cursor_view_style_set             (GtkWidget           *widget,
-                                                      GtkStyle            *prev_style);
+static void   gimp_cursor_view_style_updated         (GtkWidget           *widget);
 
 static void   gimp_cursor_view_set_aux_info          (GimpDocked          *docked,
                                                       GList               *aux_info);
@@ -146,10 +145,10 @@ gimp_cursor_view_class_init (GimpCursorViewClass* klass)
   GObjectClass   *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class->get_property = gimp_cursor_view_get_property;
-  object_class->set_property = gimp_cursor_view_set_property;
+  object_class->get_property  = gimp_cursor_view_get_property;
+  object_class->set_property  = gimp_cursor_view_set_property;
 
-  widget_class->style_set    = gimp_cursor_view_style_set;
+  widget_class->style_updated = gimp_cursor_view_style_updated;
 
   g_object_class_install_property (object_class, PROP_SAMPLE_MERGED,
                                    g_param_spec_boolean ("sample-merged",
@@ -477,13 +476,12 @@ gimp_cursor_view_set_label_italic (GtkWidget *label,
 }
 
 static void
-gimp_cursor_view_style_set (GtkWidget *widget,
-                            GtkStyle  *prev_style)
+gimp_cursor_view_style_updated (GtkWidget *widget)
 {
   GimpCursorView *view = GIMP_CURSOR_VIEW (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 (GTK_WIDGET (view),
                         "content-spacing", &content_spacing,
diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c
index b0857f7..2125668 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -370,7 +370,7 @@ gimp_display_shell_canvas_size_allocate (GtkWidget        *widget,
 static gboolean
 gimp_display_shell_is_double_buffered (GimpDisplayShell *shell)
 {
-  return TRUE; /* FIXME: repair this after cairo tool drawing is done */
+  return FALSE; /* FIXME: repair this after cairo tool drawing is done */
 
   /*  always double-buffer if there are overlay children or a
    *  transform preview, or they will flicker badly. Also double
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index 8795c24..1fa4523 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -128,8 +128,7 @@ static gboolean  gimp_image_window_configure_event     (GtkWidget           *wid
                                                         GdkEventConfigure   *event);
 static gboolean  gimp_image_window_window_state_event  (GtkWidget           *widget,
                                                         GdkEventWindowState *event);
-static void      gimp_image_window_style_set           (GtkWidget           *widget,
-                                                        GtkStyle            *prev_style);
+static void      gimp_image_window_style_updated       (GtkWidget           *widget);
 
 static void      gimp_image_window_config_notify       (GimpImageWindow     *window,
                                                         GParamSpec          *pspec,
@@ -210,7 +209,7 @@ gimp_image_window_class_init (GimpImageWindowClass *klass)
   widget_class->delete_event       = gimp_image_window_delete_event;
   widget_class->configure_event    = gimp_image_window_configure_event;
   widget_class->window_state_event = gimp_image_window_window_state_event;
-  widget_class->style_set          = gimp_image_window_style_set;
+  widget_class->style_updated      = gimp_image_window_style_updated;
 
   g_object_class_install_property (object_class, PROP_GIMP,
                                    g_param_spec_object ("gimp",
@@ -583,8 +582,7 @@ gimp_image_window_window_state_event (GtkWidget           *widget,
 }
 
 static void
-gimp_image_window_style_set (GtkWidget *widget,
-                             GtkStyle  *prev_style)
+gimp_image_window_style_updated (GtkWidget *widget)
 {
   GimpImageWindow        *window        = GIMP_IMAGE_WINDOW (widget);
   GimpImageWindowPrivate *private       = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
@@ -594,7 +592,7 @@ gimp_image_window_style_set (GtkWidget *widget,
   GdkGeometry             geometry      = { 0, };
   GdkWindowHints          geometry_mask = 0;
 
-  GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
   if (! shell)
     return;
diff --git a/app/display/gimpscalecombobox.c b/app/display/gimpscalecombobox.c
index 0261e28..ddf3cb2 100644
--- a/app/display/gimpscalecombobox.c
+++ b/app/display/gimpscalecombobox.c
@@ -55,8 +55,7 @@ enum
 static void      gimp_scale_combo_box_constructed     (GObject           *object);
 static void      gimp_scale_combo_box_finalize        (GObject           *object);
 
-static void      gimp_scale_combo_box_style_set       (GtkWidget         *widget,
-                                                       GtkStyle          *prev_style);
+static void      gimp_scale_combo_box_style_updated   (GtkWidget         *widget);
 
 static void      gimp_scale_combo_box_changed         (GimpScaleComboBox *combo_box);
 static void      gimp_scale_combo_box_entry_activate  (GtkWidget         *entry,
@@ -94,12 +93,12 @@ gimp_scale_combo_box_class_init (GimpScaleComboBoxClass *klass)
                   gimp_marshal_VOID__VOID,
                   G_TYPE_NONE, 0);
 
-  object_class->constructed = gimp_scale_combo_box_constructed;
-  object_class->finalize    = gimp_scale_combo_box_finalize;
+  object_class->constructed   = gimp_scale_combo_box_constructed;
+  object_class->finalize      = gimp_scale_combo_box_finalize;
 
-  widget_class->style_set   = gimp_scale_combo_box_style_set;
+  widget_class->style_updated = gimp_scale_combo_box_style_updated;
 
-  klass->entry_activated    = NULL;
+  klass->entry_activated      = NULL;
 
   gtk_widget_class_install_style_property (widget_class,
                                            g_param_spec_double ("label-scale",
@@ -208,37 +207,30 @@ gimp_scale_combo_box_finalize (GObject *object)
 }
 
 static void
-gimp_scale_combo_box_style_set (GtkWidget *widget,
-                                GtkStyle  *prev_style)
+gimp_scale_combo_box_style_updated (GtkWidget *widget)
 {
-  GtkWidget  *entry;
-  GtkRcStyle *rc_style;
-  gint        font_size;
-  gdouble     scale;
+  GtkWidget            *entry;
+  PangoContext         *context;
+  PangoFontDescription *font_desc;
+  gint                  font_size;
+  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);
 
   entry = gtk_bin_get_child (GTK_BIN (widget));
 
-  rc_style = gtk_widget_get_modifier_style (GTK_WIDGET (entry));
+  context = gtk_widget_get_pango_context (entry);
+  font_desc = pango_context_get_font_description (context);
+  font_desc = pango_font_description_copy (font_desc);
 
-  if (! rc_style->font_desc)
-    {
-      PangoContext         *context;
-      PangoFontDescription *font_desc;
-
-      context = gtk_widget_get_pango_context (widget);
-      font_desc = pango_context_get_font_description (context);
-
-      rc_style->font_desc = pango_font_description_copy (font_desc);
-    }
+  font_size = pango_font_description_get_size (font_desc);
+  pango_font_description_set_size (font_desc, scale * font_size);
 
-  font_size = pango_font_description_get_size (rc_style->font_desc);
-  pango_font_description_set_size (rc_style->font_desc, scale * font_size);
+  gtk_widget_override_font (entry, font_desc);
 
-  gtk_widget_modify_style (GTK_WIDGET (entry), rc_style);
+  pango_font_description_free (font_desc);
 }
 
 static void
diff --git a/app/display/gimpstatusbar.c b/app/display/gimpstatusbar.c
index 0183846..8c3779b 100644
--- a/app/display/gimpstatusbar.c
+++ b/app/display/gimpstatusbar.c
@@ -73,8 +73,7 @@ static void     gimp_statusbar_progress_iface_init (GimpProgressInterface *iface
 static void     gimp_statusbar_dispose            (GObject           *object);
 static void     gimp_statusbar_finalize           (GObject           *object);
 
-static void     gimp_statusbar_hbox_style_set     (GtkWidget         *widget,
-                                                   GtkStyle          *prev_style,
+static void     gimp_statusbar_hbox_style_updated (GtkWidget         *widget,
                                                    GimpStatusbar     *statusbar);
 
 static GimpProgress *
@@ -186,8 +185,8 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
 
   gtk_container_remove (GTK_CONTAINER (hbox), statusbar->label);
 
-  g_signal_connect_after (hbox, "style-set",
-                          G_CALLBACK (gimp_statusbar_hbox_style_set),
+  g_signal_connect_after (hbox, "style-updated",
+                          G_CALLBACK (gimp_statusbar_hbox_style_updated),
                           statusbar);
 
   statusbar->cursor_label = gtk_label_new ("8888, 8888");
@@ -296,9 +295,8 @@ gimp_statusbar_finalize (GObject *object)
 }
 
 static void
-gimp_statusbar_hbox_style_set (GtkWidget     *widget,
-                               GtkStyle      *prev_style,
-                               GimpStatusbar *statusbar)
+gimp_statusbar_hbox_style_updated (GtkWidget     *widget,
+                                   GimpStatusbar *statusbar)
 {
   GtkRequisition  requisition;
   GtkRequisition  child_requisition;



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