cssimage: Add an equal vfunc

No implementations for it exist yet.
This commit is contained in:
Benjamin Otte 2012-10-11 12:10:20 +02:00
parent 73fe9a2acf
commit c13efbf8b0
3 changed files with 37 additions and 1 deletions

View File

@ -69,6 +69,13 @@ gtk_css_image_real_compute (GtkCssImage *image,
return g_object_ref (image);
}
static gboolean
gtk_css_image_real_equal (GtkCssImage *image1,
GtkCssImage *image2)
{
return FALSE;
}
static GtkCssImage *
gtk_css_image_real_transition (GtkCssImage *start,
GtkCssImage *end,
@ -90,6 +97,7 @@ _gtk_css_image_class_init (GtkCssImageClass *klass)
klass->get_height = gtk_css_image_real_get_height;
klass->get_aspect_ratio = gtk_css_image_real_get_aspect_ratio;
klass->compute = gtk_css_image_real_compute;
klass->equal = gtk_css_image_real_equal;
klass->transition = gtk_css_image_real_transition;
}
@ -188,6 +196,29 @@ _gtk_css_image_transition (GtkCssImage *start,
return klass->transition (start, end, property_id, progress);
}
gboolean
_gtk_css_image_equal (GtkCssImage *image1,
GtkCssImage *image2)
{
GtkCssImageClass *klass;
g_return_val_if_fail (image1 == NULL || GTK_IS_CSS_IMAGE (image1), FALSE);
g_return_val_if_fail (image2 == NULL || GTK_IS_CSS_IMAGE (image2), FALSE);
if (image1 == image2)
return TRUE;
if (image1 == NULL || image2 == NULL)
return FALSE;
if (G_OBJECT_TYPE (image1) != G_OBJECT_TYPE (image2))
return FALSE;
klass = GTK_CSS_IMAGE_GET_CLASS (image1);
return klass->equal (image1, image2);
}
void
_gtk_css_image_draw (GtkCssImage *image,
cairo_t *cr,

View File

@ -61,6 +61,9 @@ struct _GtkCssImageClass
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies);
/* compare two images for equality */
gboolean (* equal) (GtkCssImage *image1,
GtkCssImage *image2);
/* transition between start and end image (end may be NULL), returns new reference */
GtkCssImage *(* transition) (GtkCssImage *start,
GtkCssImage *end,
@ -95,6 +98,8 @@ GtkCssImage * _gtk_css_image_compute (GtkCssImage *
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies);
gboolean _gtk_css_image_equal (GtkCssImage *image1,
GtkCssImage *image2);
GtkCssImage * _gtk_css_image_transition (GtkCssImage *start,
GtkCssImage *end,
guint property_id,

View File

@ -63,7 +63,7 @@ static gboolean
gtk_css_value_image_equal (const GtkCssValue *value1,
const GtkCssValue *value2)
{
return value1->image == value2->image;
return _gtk_css_image_equal (value1->image, value2->image);
}
static GtkCssValue *