[gtk+/gtk-style-context: 253/540] Use cairo gobject support instead of a new boxed type.



commit fa331998d99ae44965eb8b7c6aeed57b2e692dd5
Author: Benjamin Berg <benjamin sipsolutions net>
Date:   Wed Oct 13 16:33:38 2010 +0200

    Use cairo gobject support instead of a new boxed type.

 gdk/gdkcairo.c       |    2 --
 gdk/gdkcairo.h       |    3 ---
 gtk/gtkcssprovider.c |    3 ++-
 gtk/gtkstyleset.c    |   13 +++++++------
 4 files changed, 9 insertions(+), 12 deletions(-)
---
diff --git a/gdk/gdkcairo.c b/gdk/gdkcairo.c
index 51eed2d..7160207 100644
--- a/gdk/gdkcairo.c
+++ b/gdk/gdkcairo.c
@@ -25,8 +25,6 @@
 
 #include <math.h>
 
-G_DEFINE_BOXED_TYPE (cairo_pattern_t, gdk_cairo_pattern, cairo_pattern_reference, cairo_pattern_destroy)
-
 /**
  * SECTION:cairo_interaction
  * @Short_description: Functions to support using Cairo
diff --git a/gdk/gdkcairo.h b/gdk/gdkcairo.h
index 836c0be..67e08aa 100644
--- a/gdk/gdkcairo.h
+++ b/gdk/gdkcairo.h
@@ -32,9 +32,6 @@
 G_BEGIN_DECLS
 
 cairo_t *gdk_cairo_create            (GdkWindow          *window);
-#define GDK_TYPE_CAIRO_PATTERN (gdk_cairo_pattern_get_type ())
-
-GType    gdk_cairo_pattern_get_type  (void) G_GNUC_CONST;
 gboolean gdk_cairo_get_clip_rectangle(cairo_t            *cr,
                                       GdkRectangle       *rect);
 
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 1150b08..d4faf88 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -24,6 +24,7 @@
 #include <gtk/gtk.h>
 #include <gtkstyleprovider.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
+#include <cairo/cairo-gobject.h>
 
 #include "gtkanimationdescription.h"
 #include "gtk9slice.h"
@@ -1926,7 +1927,7 @@ css_provider_parse_value (GtkCssProvider *css_provider,
       if (parsed)
         g_value_set_boxed (value, &border);
     }
-  else if (type == GDK_TYPE_CAIRO_PATTERN)
+  else if (type == CAIRO_GOBJECT_TYPE_PATTERN)
     {
       GtkGradient *gradient;
 
diff --git a/gtk/gtkstyleset.c b/gtk/gtkstyleset.c
index 59ac9f5..2f71f71 100644
--- a/gtk/gtkstyleset.c
+++ b/gtk/gtkstyleset.c
@@ -21,6 +21,7 @@
 
 #include <stdlib.h>
 #include <gobject/gvaluecollector.h>
+#include <cairo/cairo-gobject.h>
 
 #include "gtkstyleprovider.h"
 #include "gtkstyleset.h"
@@ -90,7 +91,7 @@ gtk_style_set_class_init (GtkStyleSetClass *klass)
   gtk_style_set_register_property ("padding", GTK_TYPE_BORDER, NULL, NULL);
   gtk_style_set_register_property ("border", G_TYPE_INT, NULL, NULL);
 
-  gtk_style_set_register_property ("background-image", GDK_TYPE_CAIRO_PATTERN, NULL, NULL);
+  gtk_style_set_register_property ("background-image", CAIRO_GOBJECT_TYPE_PATTERN, NULL, NULL);
   gtk_style_set_register_property ("border-image", GTK_TYPE_9SLICE, NULL, NULL);
 
   g_value_init (&val, GTK_TYPE_THEMING_ENGINE);
@@ -501,10 +502,10 @@ gtk_style_set_set_property (GtkStyleSet   *set,
       /* Allow GtkSymbolicColor as well */
       g_return_if_fail (value_type == GDK_TYPE_COLOR || value_type == GTK_TYPE_SYMBOLIC_COLOR);
     }
-  else if (node->property_type == GDK_TYPE_CAIRO_PATTERN)
+  else if (node->property_type == CAIRO_GOBJECT_TYPE_PATTERN)
     {
       /* Allow GtkGradient as a substitute */
-      g_return_if_fail (value_type == GDK_TYPE_CAIRO_PATTERN ||
+      g_return_if_fail (value_type == CAIRO_GOBJECT_TYPE_PATTERN ||
                         value_type == GTK_TYPE_GRADIENT);
     }
   else
@@ -639,7 +640,7 @@ resolve_gradient (GtkStyleSet *set,
 
   /* Store it back, this is where cairo_pattern_t caching happens */
   g_value_unset (value);
-  g_value_init (value, GDK_TYPE_CAIRO_PATTERN);
+  g_value_init (value, CAIRO_GOBJECT_TYPE_PATTERN);
   g_value_take_boxed (value, gradient);
 
   return TRUE;
@@ -693,7 +694,7 @@ gtk_style_set_get_property (GtkStyleSet   *set,
     }
   else if (G_VALUE_TYPE (val) == GTK_TYPE_GRADIENT)
     {
-      g_return_val_if_fail (node->property_type == GDK_TYPE_CAIRO_PATTERN, FALSE);
+      g_return_val_if_fail (node->property_type == CAIRO_GOBJECT_TYPE_PATTERN, FALSE);
 
       if (!resolve_gradient (set, val))
         return FALSE;
@@ -750,7 +751,7 @@ gtk_style_set_get_valist (GtkStyleSet   *set,
         }
       else if (G_VALUE_TYPE (val) == GTK_TYPE_GRADIENT)
         {
-          g_return_if_fail (node->property_type == GDK_TYPE_CAIRO_PATTERN);
+          g_return_if_fail (node->property_type == CAIRO_GOBJECT_TYPE_PATTERN);
 
           if (!resolve_gradient (set, val))
             val = &node->default_value;



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