[animation] Remove InitiallyUnowned from Animation

ClutterAnimation currently inherits the initial floating reference
semantics from GInitiallyUnowned. An Animation is, though, meant to
be used as a top-level object, like a Timeline or a Behaviour, and
not "owned" by another object. For this reason, the initial floating
reference does not make any sense.
This commit is contained in:
Emmanuele Bassi 2009-05-06 17:01:44 +01:00
parent 0f7a3b9739
commit 79cb0a3515
2 changed files with 10 additions and 12 deletions

View File

@ -102,7 +102,7 @@ static guint animation_signals[LAST_SIGNAL] = { 0, };
static GQuark quark_object_animation = 0; static GQuark quark_object_animation = 0;
G_DEFINE_TYPE (ClutterAnimation, clutter_animation, G_TYPE_INITIALLY_UNOWNED); G_DEFINE_TYPE (ClutterAnimation, clutter_animation, G_TYPE_OBJECT);
static void on_animation_weak_notify (gpointer data, static void on_animation_weak_notify (gpointer data,
GObject *animation_pointer); GObject *animation_pointer);
@ -853,9 +853,8 @@ on_animation_weak_notify (gpointer data,
* lifetime of a #ClutterAnimation instance, so you should consider using * lifetime of a #ClutterAnimation instance, so you should consider using
* those functions instead of manually creating an animation. * those functions instead of manually creating an animation.
* *
* Return value: the newly created #ClutterAnimation. Use g_object_ref_sink() * Return value: the newly created #ClutterAnimation. Use g_object_unref()
* to take ownership of the Animation instance, and g_object_unref() to * to release the associated resources
* release the associated resources
* *
* Since: 1.0 * Since: 1.0
*/ */
@ -886,8 +885,6 @@ clutter_animation_set_object (ClutterAnimation *animation,
priv = animation->priv; priv = animation->priv;
g_object_ref (object);
if (priv->object) if (priv->object)
{ {
g_object_weak_unref (G_OBJECT (animation), g_object_weak_unref (G_OBJECT (animation),
@ -897,13 +894,14 @@ clutter_animation_set_object (ClutterAnimation *animation,
g_object_unref (priv->object); g_object_unref (priv->object);
} }
priv->object = object; priv->object = g_object_ref (object);
g_object_weak_ref (G_OBJECT (animation), g_object_weak_ref (G_OBJECT (animation),
on_animation_weak_notify, on_animation_weak_notify,
priv->object); priv->object);
g_object_set_qdata (G_OBJECT (priv->object), g_object_set_qdata_full (G_OBJECT (priv->object),
quark_object_animation, quark_object_animation,
animation); animation,
NULL);
g_object_notify (G_OBJECT (animation), "object"); g_object_notify (G_OBJECT (animation), "object");
} }

View File

@ -59,7 +59,7 @@ typedef struct _ClutterAnimationClass ClutterAnimationClass;
struct _ClutterAnimation struct _ClutterAnimation
{ {
/*< private >*/ /*< private >*/
GInitiallyUnowned parent_instance; GObject parent_instance;
ClutterAnimationPrivate *priv; ClutterAnimationPrivate *priv;
}; };
@ -77,7 +77,7 @@ struct _ClutterAnimation
struct _ClutterAnimationClass struct _ClutterAnimationClass
{ {
/*< private >*/ /*< private >*/
GInitiallyUnownedClass parent_class; GObjectClass parent_class;
/*< public >*/ /*< public >*/
void (* started) (ClutterAnimation *animation); void (* started) (ClutterAnimation *animation);