From 04afb1066c566d6e365e4fd1ccf71b72ab66a245 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 28 Nov 2007 10:27:33 +0000 Subject: [PATCH] 2007-11-28 Emmanuele Bassi * clutter/clutter-effect.[ch]: Add clutter_effect_template_construct() function, for language bindings that need to set the alpha function but cannot call the clutter_effect_template_new() ctor themselves. --- ChangeLog | 11 +++- clutter/clutter-effect.c | 80 +++++++++++++++++-------- clutter/clutter-effect.h | 5 ++ doc/reference/ChangeLog | 5 ++ doc/reference/clutter-sections.txt | 95 +----------------------------- 5 files changed, 74 insertions(+), 122 deletions(-) diff --git a/ChangeLog b/ChangeLog index a8123e206..84f30ec52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,13 @@ +2007-11-28 Emmanuele Bassi + + * clutter/clutter-effect.[ch]: Add clutter_effect_template_construct() + function, for language bindings that need to set the alpha function + but cannot call the clutter_effect_template_new() ctor themselves. + 2007-11-27 Tomas Frydrych - * clutter/clutter-behaviour-ellipse.c: - * clutter/clutter-behaviour-ellipse.h: + + * clutter/clutter-behaviour-ellipse.c: + * clutter/clutter-behaviour-ellipse.h: (clutter_behaviour_ellipse_get_angle_startx): (clutter_behaviour_ellipse_set_angle_startx): (clutter_behaviour_ellipse_get_angle_endx): diff --git a/clutter/clutter-effect.c b/clutter/clutter-effect.c index f1d8e844a..4d3d58843 100644 --- a/clutter/clutter-effect.c +++ b/clutter/clutter-effect.c @@ -82,7 +82,9 @@ G_DEFINE_TYPE (ClutterEffectTemplate, clutter_effect_template, G_TYPE_OBJECT); struct _ClutterEffectTemplatePrivate { ClutterTimeline *timeline; - gboolean do_clone; + + guint do_clone : 1; + guint dirty : 1; ClutterAlphaFunc alpha_func; gpointer alpha_data; @@ -93,7 +95,6 @@ enum { PROP_0, - PROP_ALPHA_FUNC, PROP_TIMELINE, PROP_DO_CLONE }; @@ -148,12 +149,8 @@ clutter_effect_template_set_property (GObject *object, switch (prop_id) { - case PROP_ALPHA_FUNC: - priv->alpha_func = g_value_get_pointer (value); - break; case PROP_TIMELINE: - priv->timeline = g_value_get_object (value); - g_object_ref(priv->timeline); + priv->timeline = g_value_dup_object (value); break; case PROP_DO_CLONE: clutter_effect_template_set_timeline_clone (template, @@ -179,9 +176,6 @@ clutter_effect_template_get_property (GObject *object, switch (prop_id) { - case PROP_ALPHA_FUNC: - g_value_set_pointer (value, priv->alpha_func); - break; case PROP_TIMELINE: g_value_set_object (value, priv->timeline); break; @@ -206,21 +200,6 @@ clutter_effect_template_class_init (ClutterEffectTemplateClass *klass) object_class->set_property = clutter_effect_template_set_property; object_class->get_property = clutter_effect_template_get_property; - /** - * ClutterEffectTemplate:alpha-func: - * - * #ClutterAlphaFunc to be used by the template - * - * Since: 0.4 - */ - g_object_class_install_property - (object_class, - PROP_ALPHA_FUNC, - g_param_spec_pointer ("alpha-func", - "Alpha-Function", - "Alpha reference Function", - G_PARAM_CONSTRUCT_ONLY | - CLUTTER_PARAM_READWRITE)); /** * ClutterEffectTemplate:timeline: * @@ -260,7 +239,9 @@ static void clutter_effect_template_init (ClutterEffectTemplate *self) { self->priv = EFFECT_TEMPLATE_PRIVATE (self); + self->priv->do_clone = TRUE; + self->priv->dirty = TRUE; } static void @@ -282,6 +263,8 @@ clutter_effect_template_set_alpha_func (ClutterEffectTemplate *self, priv->alpha_data = alpha_data; priv->alpha_notify = alpha_notify; priv->alpha_func = alpha_func; + + priv->dirty = FALSE; } /** @@ -405,7 +388,9 @@ clutter_effect_template_new_full (ClutterTimeline *timeline, "timeline", timeline, NULL); - clutter_effect_template_set_alpha_func (retval, alpha_func, user_data, notify); + clutter_effect_template_set_alpha_func (retval, + alpha_func, + user_data, notify); return retval; } @@ -452,6 +437,49 @@ clutter_effect_template_new_for_duration (guint msecs, return retval; } +/** + * clutter_effect_template_construct: + * @template_: a #ClutterEffectTemplate + * @timeline: a #ClutterTimeline + * @alpha_func: an alpha function to use for the template + * @user_data: data to be passed to the alpha function, or %NULL + * @notify: function to be called when disposing the alpha function's use + * data, or %NULL + * + * Constructs a #ClutterEffectTemplate, to be used with the effects API. + * + * This function can only be called once after the creation of @template_ + * and is only useful for language bindings. + * + * Since: 0.6 + */ +void +clutter_effect_template_construct (ClutterEffectTemplate *template_, + ClutterTimeline *timeline, + ClutterAlphaFunc alpha_func, + gpointer user_data, + GDestroyNotify notify) +{ + ClutterEffectTemplatePrivate *priv; + + g_return_if_fail (CLUTTER_IS_EFFECT_TEMPLATE (template_)); + g_return_if_fail (CLUTTER_IS_TIMELINE (timeline)); + g_return_if_fail (alpha_func != NULL); + + if (!template_->priv->dirty) + return; + + priv = template_->priv; + + if (priv->timeline) + g_object_unref (priv->timeline); + + priv->timeline = g_object_ref (timeline); + clutter_effect_template_set_alpha_func (template_, + alpha_func, + user_data, notify); +} + static void clutter_effect_closure_destroy (ClutterEffectClosure *c) { diff --git a/clutter/clutter-effect.h b/clutter/clutter-effect.h index d7fe4bd23..40419f08c 100644 --- a/clutter/clutter-effect.h +++ b/clutter/clutter-effect.h @@ -102,6 +102,11 @@ ClutterEffectTemplate *clutter_effect_template_new_full (ClutterTimeli GDestroyNotify notify); ClutterEffectTemplate *clutter_effect_template_new_for_duration (guint msecs, ClutterAlphaFunc alpha_func); +void clutter_effect_template_construct (ClutterEffectTemplate *template_, + ClutterTimeline *timeline, + ClutterAlphaFunc alpha_func, + gpointer user_data, + GDestroyNotify notify); void clutter_effect_template_set_timeline_clone (ClutterEffectTemplate *template_, gboolean setting); gboolean clutter_effect_template_get_timeline_clone (ClutterEffectTemplate *template_); diff --git a/doc/reference/ChangeLog b/doc/reference/ChangeLog index 4eef005e8..53678741e 100644 --- a/doc/reference/ChangeLog +++ b/doc/reference/ChangeLog @@ -1,3 +1,8 @@ +2007-11-28 Emmanuele Bassi + + * clutter-sections.txt: Add the new ClutterEffectTemplate::construct + method. + 2007-11-23 Emmanuele Bassi * clutter-docs.sgml: Shuffle around non-actor classes. diff --git a/doc/reference/clutter-sections.txt b/doc/reference/clutter-sections.txt index d4a5c942d..ed9533da6 100644 --- a/doc/reference/clutter-sections.txt +++ b/doc/reference/clutter-sections.txt @@ -235,31 +235,6 @@ CLUTTER_CONTAINER_GET_IFACE clutter_container_get_type -
-clutter-layout -ClutterLayout -ClutterLayout -ClutterLayoutIface -ClutterLayoutFlags -CLUTTER_LAYOUT_HAS -CLUTTER_LAYOUT_HAS_HEIGHT_FOR_WIDTH -CLUTTER_LAYOUT_HAS_NATURAL_SIZE -CLUTTER_LAYOUT_HAS_TUNABLE_SIZE -CLUTTER_LAYOUT_HAS_WIDTH_FOR_HEIGHT -clutter_layout_get_layout_flags -clutter_layout_height_for_width -clutter_layout_natural_request -clutter_layout_tune_request -clutter_layout_width_for_height - -CLUTTER_TYPE_LAYOUT -CLUTTER_LAYOUT -CLUTTER_IS_LAYOUT -CLUTTER_LAYOUT_GET_IFACE - -clutter_layout_get_type -
-
clutter-rectangle ClutterRectangle @@ -1020,41 +995,6 @@ ClutterEntryPrivate clutter_entry_get_type
-
-clutter-box -ClutterBox -ClutterBox -ClutterBoxClass -ClutterPackType -clutter_box_set_color -clutter_box_get_color -ClutterPadding -clutter_box_pack -clutter_box_set_default_padding -clutter_box_get_default_padding -clutter_box_pack_defaults -clutter_box_remove_all -ClutterMargin -clutter_box_set_margin -clutter_box_get_margin -ClutterBoxChild -clutter_box_query_child -clutter_box_query_nth_child - -CLUTTER_TYPE_BOX -CLUTTER_BOX -CLUTTER_IS_BOX -CLUTTER_BOX_CLASS -CLUTTER_IS_BOX_CLASS -CLUTTER_BOX_GET_CLASS -CLUTTER_TYPE_MARGIN -CLUTTER_TYPE_PADDING - -clutter_box_get_type -clutter_margin_get_type -clutter_padding_get_type -
-
clutter-effect Clutter Effects @@ -1063,6 +1003,7 @@ ClutterEffectTemplateClass clutter_effect_template_new clutter_effect_template_new_full clutter_effect_template_new_for_duration +clutter_effect_template_construct clutter_effect_template_get_timeline_clone clutter_effect_template_set_timeline_clone @@ -1087,40 +1028,6 @@ ClutterEffectTemplatePrivate clutter_effect_template_get_type
-
-clutter-hbox -ClutterHBox -ClutterHBox -ClutterHBoxClass -clutter_hbox_new - -CLUTTER_TYPE_HBOX -CLUTTER_HBOX -CLUTTER_IS_HBOX -CLUTTER_HBOX_CLASS -CLUTTER_IS_HBOX_CLASS -CLUTTER_HBOX_GET_CLASS - -clutter_hbox_get_type -
- -
-clutter-vbox -ClutterVBox -ClutterVBox -ClutterVBoxClass -clutter_vbox_new - -CLUTTER_TYPE_VBOX -CLUTTER_VBOX -CLUTTER_IS_VBOX -CLUTTER_VBOX_CLASS -CLUTTER_IS_VBOX_CLASS -CLUTTER_VBOX_GET_CLASS - -clutter_vbox_get_type -
-
clutter-behaviour-depth ClutterBehaviourDepth