From bb17dc1ce5d91f68da53944b5d7565be00b179eb Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 26 Aug 2009 16:49:45 +0100 Subject: [PATCH] [script] Clean up the ad hoc parsing code in Actor The old parsing code still assumed we had integers for pixels and floating point values for percentages; this is not the case anymore. --- clutter/clutter-actor.c | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 9b7eacbfa..27569c3d7 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -7227,9 +7227,9 @@ parse_units (ClutterActor *self, { retval = (gfloat) g_value_get_int64 (&value); } - else if (G_VALUE_HOLDS (&value, G_TYPE_FLOAT)) + else if (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE)) { - retval = g_value_get_float (&value); + retval = g_value_get_double (&value); } else if (G_VALUE_HOLDS (&value, G_TYPE_STRING)) { @@ -7249,39 +7249,6 @@ parse_units (ClutterActor *self, retval = 0; } } - else if (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE)) - { - ClutterActor *stage; - gdouble val; - - stage = clutter_actor_get_stage (self); - if (stage == NULL) - stage = clutter_stage_get_default (); - - if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) - { - g_warning ("Unable to set percentage of %s on a top-level " - "actor of type '%s'", - (dimension == PARSE_X || dimension == PARSE_WIDTH) ? "width" - : "height", - g_type_name (G_OBJECT_TYPE (self))); - retval = 0; - goto out; - } - - val = g_value_get_double (&value); - - if (dimension == PARSE_X || - dimension == PARSE_WIDTH || - dimension == PARSE_ANCHOR_X) - { - retval = clutter_actor_get_width (stage) * val; - } - else - { - retval = clutter_actor_get_height (stage) * val; - } - } else { g_warning ("Invalid value of type '%s': integers, strings of floating " @@ -7290,7 +7257,6 @@ parse_units (ClutterActor *self, g_type_name (G_VALUE_TYPE (&value))); } -out: g_value_unset (&value); return retval;