/* string to units */ static void clutter_value_transform_string_units (const GValue *src, GValue *dest) { ClutterUnits units = { CLUTTER_UNIT_PIXEL, 0.0f }; clutter_units_from_string (&units, g_value_get_string (src)); clutter_value_set_units (dest, &units); }
static void param_units_set_default (GParamSpec *pspec, GValue *value) { ClutterParamSpecUnits *uspec = CLUTTER_PARAM_SPEC_UNITS (pspec); ClutterUnits units; units.unit_type = uspec->default_type; units.value = uspec->default_value; units.pixels_set = FALSE; clutter_value_set_units (value, &units); }
static void dax_element_video_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { DaxElementVideo *video = (DaxElementVideo *) object; DaxElementVideoPrivate *priv = video->priv; switch (property_id) { case PROP_X: clutter_value_set_units (value, priv->x); break; case PROP_Y: clutter_value_set_units (value, priv->y); break; case PROP_WIDTH: clutter_value_set_units (value, priv->width); break; case PROP_HEIGHT: clutter_value_set_units (value, priv->height); break; case PROP_PAR: g_value_set_boxed (value, priv->par); break; case PROP_HREF: g_value_set_string (value, priv->href); break; case PROP_TYPE: g_value_set_string (value, priv->type); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } }
static gboolean clutter_units_progress (const GValue *a, const GValue *b, gdouble progress, GValue *retval) { ClutterUnits *a_units = (ClutterUnits *) clutter_value_get_units (a); ClutterUnits *b_units = (ClutterUnits *) clutter_value_get_units (b); ClutterUnits res; gfloat a_px, b_px, value; a_px = clutter_units_to_pixels (a_units); b_px = clutter_units_to_pixels (b_units); value = progress * (b_px - a_px) + a_px; clutter_units_from_pixels (&res, value); clutter_value_set_units (retval, &res); return TRUE; }