[gtk+/wip/css-icons: 3/6] themingengine: Draw icons for spinners



commit 1ae72fcddc731be5b206a9fb3a4909deb0eade31
Author: Benjamin Otte <otte redhat com>
Date:   Fri May 2 21:47:54 2014 +0200

    themingengine: Draw icons for spinners
    
    If the -gtk-icon-source property is not set to "none" (the default),
    draw it as the spinner icon. Otherwise fall back to previous methods.

 gtk/gtkthemingengine.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index f780e17..b009c75 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -31,6 +31,7 @@
 #include "gtkcssarrayvalueprivate.h"
 #include "gtkcsscornervalueprivate.h"
 #include "gtkcssenumvalueprivate.h"
+#include "gtkcssimagevalueprivate.h"
 #include "gtkcssnumbervalueprivate.h"
 #include "gtkcssrgbavalueprivate.h"
 #include "gtkcssshadowsvalueprivate.h"
@@ -2142,6 +2143,26 @@ gtk_theming_engine_render_extension (GtkThemingEngine *engine,
                          hidden_side, junction);
 }
 
+static gboolean
+render_icon_image (GtkThemingEngine *engine,
+                   cairo_t          *cr,
+                   double            x,
+                   double            y,
+                   double            width,
+                   double            height)
+{
+  GtkCssImage *image;
+
+  image = _gtk_css_image_value_get_image (_gtk_theming_engine_peek_property (engine, 
GTK_CSS_PROPERTY_ICON_SOURCE));
+  if (image == NULL)
+    return FALSE;
+
+  cairo_translate (cr, x, y);
+  _gtk_css_image_draw (image, cr, width, height);
+
+  return TRUE;
+}
+
 static void
 render_dot (cairo_t       *cr,
             const GdkRGBA *lighter,
@@ -2571,6 +2592,9 @@ gtk_theming_engine_render_activity (GtkThemingEngine *engine,
 {
   GtkThemingBackground bg;
   
+  if (render_icon_image (engine, cr, x, y, width, height))
+    return;
+
   _gtk_theming_background_init (&bg, engine, x, y, width, height, 0);
   
   if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_SPINNER) &&


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