[gimp/gtk3-port: 143/233] app: port GimpScaleButton to GtkStyleContext



commit 35e93b8e168b426cfbcbdfc884ea86a9f6ddcc2e
Author: Michael Natterer <mitch gimp org>
Date:   Wed Dec 29 15:56:39 2010 +0100

    app: port GimpScaleButton to GtkStyleContext

 app/widgets/gimpscalebutton.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/app/widgets/gimpscalebutton.c b/app/widgets/gimpscalebutton.c
index 7c5ae3e..2cf8bd3 100644
--- a/app/widgets/gimpscalebutton.c
+++ b/app/widgets/gimpscalebutton.c
@@ -114,12 +114,13 @@ gimp_scale_button_image_draw (GtkWidget       *widget,
                               cairo_t         *cr,
                               GimpScaleButton *button)
 {
-  GtkStyle      *style = gtk_widget_get_style (widget);
-  GtkAllocation  allocation;
-  GtkAdjustment *adj;
-  gint           value;
-  gint           steps;
-  gint           i;
+  GtkStyleContext *style = gtk_widget_get_style_context (widget);
+  GtkAllocation    allocation;
+  GtkAdjustment   *adj;
+  GdkRGBA          color;
+  gint             value;
+  gint             steps;
+  gint             i;
 
   gtk_widget_get_allocation (widget, &allocation);
 
@@ -154,7 +155,9 @@ gimp_scale_button_image_draw (GtkWidget       *widget,
       cairo_line_to (cr, i, i + 0.5);
     }
 
-  gdk_cairo_set_source_color (cr, &style->fg[gtk_widget_get_state (widget)]);
+  gtk_style_context_get_color (style, gtk_widget_get_state_flags (widget),
+                               &color);
+  gdk_cairo_set_source_rgba (cr, &color);
   cairo_stroke (cr);
 
   for ( ; i < steps; i++)
@@ -163,7 +166,9 @@ gimp_scale_button_image_draw (GtkWidget       *widget,
       cairo_line_to (cr, i, i + 0.5);
     }
 
-  gdk_cairo_set_source_color (cr, &style->fg[GTK_STATE_INSENSITIVE]);
+  gtk_style_context_get_background_color (style, GTK_STATE_FLAG_INSENSITIVE,
+                                          &color);
+  gdk_cairo_set_source_rgba (cr, &color);
   cairo_stroke (cr);
 
   return TRUE;


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