From bbb058df40a5e1acf7b8e42049c3cd5d966f762d Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 9 Feb 2010 10:34:41 +0000 Subject: [PATCH] actor: Improve readability of raise/lower warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Add the function name in the warning, since the text is the same in both clutter_actor_raise() and clutter_actor_lower(). • If an actor has a name then prefer it to the type name. --- clutter/clutter-actor.c | 46 ++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index ca564bda3..4eb4bbc26 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -7032,7 +7032,8 @@ clutter_actor_reparent (ClutterActor *self, * * Puts @self above @below. * - * Both actors must have the same parent. + * Both actors must have the same parent, and the parent must implement + * the #ClutterContainer interface * * This function is the equivalent of clutter_container_raise_child(). */ @@ -7045,21 +7046,26 @@ clutter_actor_raise (ClutterActor *self, g_return_if_fail (CLUTTER_IS_ACTOR (self)); parent = clutter_actor_get_parent (self); - if (!parent) + if (parent == NULL || !CLUTTER_IS_CONTAINER (parent)) { - g_warning ("Actor of type %s is not inside a container", - g_type_name (G_OBJECT_TYPE (self))); + g_warning ("%s: Actor '%s' is not inside a container", + G_STRFUNC, + self->priv->name != NULL ? self->priv->name + : G_OBJECT_TYPE_NAME (self)); return; } - if (below) + if (below != NULL) { if (parent != clutter_actor_get_parent (below)) { - g_warning ("Actor of type %s is not in the same " - "container of actor of type %s", - g_type_name (G_OBJECT_TYPE (self)), - g_type_name (G_OBJECT_TYPE (below))); + g_warning ("%s Actor '%s' is not in the same container as " + "actor '%s'", + G_STRFUNC, + self->priv->name != NULL ? self->priv->name + : G_OBJECT_TYPE_NAME (self), + below->priv->name != NULL ? below->priv->name + : G_OBJECT_TYPE_NAME (below)); return; } } @@ -7074,7 +7080,8 @@ clutter_actor_raise (ClutterActor *self, * * Puts @self below @above. * - * Both actors must have the same parent. + * Both actors must have the same parent, and the parent must implement + * the #ClutterContainer interface. * * This function is the equivalent of clutter_container_lower_child(). */ @@ -7087,10 +7094,12 @@ clutter_actor_lower (ClutterActor *self, g_return_if_fail (CLUTTER_IS_ACTOR(self)); parent = clutter_actor_get_parent (self); - if (!parent) + if (parent == NULL || !CLUTTER_IS_CONTAINER (parent)) { - g_warning ("Actor of type %s is not inside a container", - g_type_name (G_OBJECT_TYPE (self))); + g_warning ("%s: Actor of type %s is not inside a container", + G_STRFUNC, + self->priv->name != NULL ? self->priv->name + : G_OBJECT_TYPE_NAME (self)); return; } @@ -7098,10 +7107,13 @@ clutter_actor_lower (ClutterActor *self, { if (parent != clutter_actor_get_parent (above)) { - g_warning ("Actor of type %s is not in the same " - "container of actor of type %s", - g_type_name (G_OBJECT_TYPE (self)), - g_type_name (G_OBJECT_TYPE (above))); + g_warning ("%s: Actor '%s' is not in the same container as " + "actor '%s'", + G_STRFUNC, + self->priv->name != NULL ? self->priv->name + : G_OBJECT_TYPE_NAME (self), + above->priv->name != NULL ? above->priv->name + : G_OBJECT_TYPE_NAME (above)); return; } }