summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@linux.intel.com>2012-04-11 14:18:56 +0100
committerEmmanuele Bassi <ebassi@linux.intel.com>2012-04-27 12:30:48 +0100
commitd24eccd026e991f00e9e92a3df4e23334573891e (patch)
tree2477deda22c830187ac74f9821843f459760c5b4
parentbf12e231998fc299549023ede79b77225528a907 (diff)
downloadclutter-d24eccd026e991f00e9e92a3df4e23334573891e.tar.gz
interval: Allow passing NULL values to the constructor
Given that we can create a ClutterInterval without an initial and final values using g_object_new(), it stands to reason that we ought to be able to create an instance when passing NULL GValue pointers to the new_with_values() constructor as well.
-rw-r--r--clutter/clutter-interval.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/clutter/clutter-interval.c b/clutter/clutter-interval.c
index 5f4f6d73c..5d095453d 100644
--- a/clutter/clutter-interval.c
+++ b/clutter/clutter-interval.c
@@ -567,8 +567,8 @@ out:
/**
* clutter_interval_new_with_values:
* @gtype: the type of the values in the interval
- * @initial: a #GValue holding the initial value of the interval
- * @final: a #GValue holding the final value of the interval
+ * @initial: (allow-none): a #GValue holding the initial value of the interval
+ * @final: (allow-none): a #GValue holding the final value of the interval
*
* Creates a new #ClutterInterval of type @gtype, between @initial
* and @final.
@@ -587,15 +587,16 @@ clutter_interval_new_with_values (GType gtype,
ClutterInterval *retval;
g_return_val_if_fail (gtype != G_TYPE_INVALID, NULL);
- g_return_val_if_fail (initial != NULL, NULL);
- g_return_val_if_fail (final != NULL, NULL);
- g_return_val_if_fail (G_VALUE_TYPE (initial) == gtype, NULL);
- g_return_val_if_fail (G_VALUE_TYPE (final) == gtype, NULL);
+ g_return_val_if_fail (initial == NULL || G_VALUE_TYPE (initial) == gtype, NULL);
+ g_return_val_if_fail (final == NULL || G_VALUE_TYPE (final) == gtype, NULL);
retval = g_object_new (CLUTTER_TYPE_INTERVAL, "value-type", gtype, NULL);
- clutter_interval_set_initial_value (retval, initial);
- clutter_interval_set_final_value (retval, final);
+ if (initial != NULL)
+ clutter_interval_set_initial_value (retval, initial);
+
+ if (final != NULL)
+ clutter_interval_set_final_value (retval, final);
return retval;
}