Deprecate Container add() and remove() methods
This will make things interesting. We have better replacements in ClutterActor, that do The Right Thing™ instead of deferring control and requiring reimplementation in every single container actor.
This commit is contained in:
parent
f61916fc5e
commit
5959099473
@ -235,6 +235,7 @@ deprecated_h = \
|
||||
$(srcdir)/deprecated/clutter-behaviour-rotate.h \
|
||||
$(srcdir)/deprecated/clutter-behaviour-scale.h \
|
||||
$(srcdir)/deprecated/clutter-box.h \
|
||||
$(srcdir)/deprecated/clutter-container.h \
|
||||
$(srcdir)/deprecated/clutter-fixed.h \
|
||||
$(srcdir)/deprecated/clutter-frame-source.h \
|
||||
$(srcdir)/deprecated/clutter-group.h \
|
||||
|
@ -293,19 +293,17 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
/* for ClutterShader */
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "clutter-actor-private.h"
|
||||
|
||||
#include "clutter-action.h"
|
||||
#include "clutter-actor-meta-private.h"
|
||||
#include "clutter-animatable.h"
|
||||
#include "clutter-behaviour.h"
|
||||
#include "clutter-color-static.h"
|
||||
#include "clutter-color.h"
|
||||
#include "clutter-constraint.h"
|
||||
@ -322,10 +320,14 @@
|
||||
#include "clutter-profile.h"
|
||||
#include "clutter-scriptable.h"
|
||||
#include "clutter-script-private.h"
|
||||
#include "clutter-shader.h"
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-units.h"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "deprecated/clutter-behaviour.h"
|
||||
#include "deprecated/clutter-container.h"
|
||||
#include "deprecated/clutter-shader.h"
|
||||
|
||||
typedef struct _ShaderData ShaderData;
|
||||
|
||||
#define CLUTTER_ACTOR_GET_PRIVATE(obj) \
|
||||
|
@ -93,6 +93,9 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "deprecated/clutter-container.h"
|
||||
|
||||
#include "clutter-actor.h"
|
||||
#include "clutter-animatable.h"
|
||||
#include "clutter-bin-layout.h"
|
||||
|
@ -75,6 +75,9 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "deprecated/clutter-container.h"
|
||||
|
||||
#include "clutter-box-layout.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-enum-types.h"
|
||||
|
@ -176,67 +176,22 @@ clutter_container_default_init (ClutterContainerInterface *iface)
|
||||
iface->child_notify = child_notify;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_add: (skip)
|
||||
* @container: a #ClutterContainer
|
||||
* @first_actor: the first #ClutterActor to add
|
||||
* @...: %NULL terminated list of actors to add
|
||||
*
|
||||
* Adds a list of #ClutterActor<!-- -->s to @container. Each time and
|
||||
* actor is added, the "actor-added" signal is emitted. Each actor should
|
||||
* be parented to @container, which takes a reference on the actor. You
|
||||
* cannot add a #ClutterActor to more than one #ClutterContainer.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
void
|
||||
clutter_container_add (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (first_actor));
|
||||
|
||||
va_start (args, first_actor);
|
||||
clutter_container_add_valist (container, first_actor, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_add_actor:
|
||||
* @container: a #ClutterContainer
|
||||
* @actor: the first #ClutterActor to add
|
||||
*
|
||||
* Adds a #ClutterActor to @container. This function will emit the
|
||||
* "actor-added" signal. The actor should be parented to
|
||||
* @container. You cannot add a #ClutterActor to more than one
|
||||
* #ClutterContainer.
|
||||
*
|
||||
* Virtual: add
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
void
|
||||
clutter_container_add_actor (ClutterContainer *container,
|
||||
ClutterActor *actor)
|
||||
static inline void
|
||||
container_add_actor (ClutterContainer *container,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterContainerIface *iface;
|
||||
ClutterActor *parent;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
iface = CLUTTER_CONTAINER_GET_IFACE (container);
|
||||
if (!iface->add)
|
||||
if (G_UNLIKELY (iface->add == NULL))
|
||||
{
|
||||
CLUTTER_CONTAINER_WARN_NOT_IMPLEMENTED (container, "add");
|
||||
return;
|
||||
}
|
||||
|
||||
parent = clutter_actor_get_parent (actor);
|
||||
if (parent)
|
||||
if (G_UNLIKELY (parent == NULL))
|
||||
{
|
||||
g_warning ("Attempting to add actor of type '%s' to a "
|
||||
"container of type '%s', but the actor has "
|
||||
@ -252,89 +207,15 @@ clutter_container_add_actor (ClutterContainer *container,
|
||||
iface->add (container, actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_add_valist: (skip)
|
||||
* @container: a #ClutterContainer
|
||||
* @first_actor: the first #ClutterActor to add
|
||||
* @var_args: list of actors to add, followed by %NULL
|
||||
*
|
||||
* Alternative va_list version of clutter_container_add().
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
void
|
||||
clutter_container_add_valist (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
va_list var_args)
|
||||
{
|
||||
ClutterActor *actor;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (first_actor));
|
||||
|
||||
actor = first_actor;
|
||||
while (actor)
|
||||
{
|
||||
clutter_container_add_actor (container, actor);
|
||||
actor = va_arg (var_args, ClutterActor*);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_remove: (skip)
|
||||
* @container: a #ClutterContainer
|
||||
* @first_actor: first #ClutterActor to remove
|
||||
* @...: a %NULL-terminated list of actors to remove
|
||||
*
|
||||
* Removes a %NULL terminated list of #ClutterActor<!-- -->s from
|
||||
* @container. Each actor should be unparented, so if you want to keep it
|
||||
* around you must hold a reference to it yourself, using g_object_ref().
|
||||
* Each time an actor is removed, the "actor-removed" signal is
|
||||
* emitted by @container.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
void
|
||||
clutter_container_remove (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
...)
|
||||
{
|
||||
va_list var_args;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (first_actor));
|
||||
|
||||
va_start (var_args, first_actor);
|
||||
clutter_container_remove_valist (container, first_actor, var_args);
|
||||
va_end (var_args);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_remove_actor:
|
||||
* @container: a #ClutterContainer
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Removes @actor from @container. The actor should be unparented, so
|
||||
* if you want to keep it around you must hold a reference to it
|
||||
* yourself, using g_object_ref(). When the actor has been removed,
|
||||
* the "actor-removed" signal is emitted by @container.
|
||||
*
|
||||
* Virtual: remove
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
void
|
||||
clutter_container_remove_actor (ClutterContainer *container,
|
||||
ClutterActor *actor)
|
||||
static inline void
|
||||
container_remove_actor (ClutterContainer *container,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterContainerIface *iface;
|
||||
ClutterActor *parent;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
iface = CLUTTER_CONTAINER_GET_IFACE (container);
|
||||
if (!iface->remove)
|
||||
if (G_UNLIKELY (iface->remove == NULL))
|
||||
{
|
||||
CLUTTER_CONTAINER_WARN_NOT_IMPLEMENTED (container, "remove");
|
||||
return;
|
||||
@ -356,6 +237,170 @@ clutter_container_remove_actor (ClutterContainer *container,
|
||||
iface->remove (container, actor);
|
||||
}
|
||||
|
||||
static inline void
|
||||
container_add_valist (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
va_list args)
|
||||
{
|
||||
ClutterActor *actor = first_actor;
|
||||
|
||||
while (actor != NULL)
|
||||
{
|
||||
container_add_actor (container, actor);
|
||||
actor = va_arg (args, ClutterActor *);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
container_remove_valist (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
va_list args)
|
||||
{
|
||||
ClutterActor *actor = first_actor;
|
||||
|
||||
while (actor != NULL)
|
||||
{
|
||||
container_remove_actor (container, actor);
|
||||
actor = va_arg (args, ClutterActor *);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_add: (skip)
|
||||
* @container: a #ClutterContainer
|
||||
* @first_actor: the first #ClutterActor to add
|
||||
* @...: %NULL terminated list of actors to add
|
||||
*
|
||||
* Adds a list of #ClutterActor<!-- -->s to @container. Each time and
|
||||
* actor is added, the "actor-added" signal is emitted. Each actor should
|
||||
* be parented to @container, which takes a reference on the actor. You
|
||||
* cannot add a #ClutterActor to more than one #ClutterContainer.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_actor_add_child() instead.
|
||||
*/
|
||||
void
|
||||
clutter_container_add (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (first_actor));
|
||||
|
||||
va_start (args, first_actor);
|
||||
container_add_valist (container, first_actor, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_add_actor:
|
||||
* @container: a #ClutterContainer
|
||||
* @actor: the first #ClutterActor to add
|
||||
*
|
||||
* Adds a #ClutterActor to @container. This function will emit the
|
||||
* "actor-added" signal. The actor should be parented to
|
||||
* @container. You cannot add a #ClutterActor to more than one
|
||||
* #ClutterContainer.
|
||||
*
|
||||
* Virtual: add
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_actor_add_child() instead.
|
||||
*/
|
||||
void
|
||||
clutter_container_add_actor (ClutterContainer *container,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
container_add_actor (container, actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_add_valist: (skip)
|
||||
* @container: a #ClutterContainer
|
||||
* @first_actor: the first #ClutterActor to add
|
||||
* @var_args: list of actors to add, followed by %NULL
|
||||
*
|
||||
* Alternative va_list version of clutter_container_add().
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_actor_add_child() instead.
|
||||
*/
|
||||
void
|
||||
clutter_container_add_valist (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
va_list var_args)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (first_actor));
|
||||
|
||||
container_add_valist (container, first_actor, var_args);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_remove: (skip)
|
||||
* @container: a #ClutterContainer
|
||||
* @first_actor: first #ClutterActor to remove
|
||||
* @...: a %NULL-terminated list of actors to remove
|
||||
*
|
||||
* Removes a %NULL terminated list of #ClutterActor<!-- -->s from
|
||||
* @container. Each actor should be unparented, so if you want to keep it
|
||||
* around you must hold a reference to it yourself, using g_object_ref().
|
||||
* Each time an actor is removed, the "actor-removed" signal is
|
||||
* emitted by @container.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_actor_remove_child() instead.
|
||||
*/
|
||||
void
|
||||
clutter_container_remove (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
...)
|
||||
{
|
||||
va_list var_args;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (first_actor));
|
||||
|
||||
va_start (var_args, first_actor);
|
||||
container_remove_valist (container, first_actor, var_args);
|
||||
va_end (var_args);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_remove_actor:
|
||||
* @container: a #ClutterContainer
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Removes @actor from @container. The actor should be unparented, so
|
||||
* if you want to keep it around you must hold a reference to it
|
||||
* yourself, using g_object_ref(). When the actor has been removed,
|
||||
* the "actor-removed" signal is emitted by @container.
|
||||
*
|
||||
* Virtual: remove
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_actor_remove_child() instead.
|
||||
*/
|
||||
void
|
||||
clutter_container_remove_actor (ClutterContainer *container,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
container_remove_actor (container, actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_remove_valist: (skip)
|
||||
* @container: a #ClutterContainer
|
||||
@ -365,23 +410,18 @@ clutter_container_remove_actor (ClutterContainer *container,
|
||||
* Alternative va_list version of clutter_container_remove().
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_actor_remove_child() instead.
|
||||
*/
|
||||
void
|
||||
clutter_container_remove_valist (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
va_list var_args)
|
||||
{
|
||||
ClutterActor *actor;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (first_actor));
|
||||
|
||||
actor = first_actor;
|
||||
while (actor)
|
||||
{
|
||||
clutter_container_remove_actor (container, actor);
|
||||
actor = va_arg (var_args, ClutterActor*);
|
||||
}
|
||||
container_remove_valist (container, first_actor, var_args);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -139,22 +139,6 @@ struct _ClutterContainerIface
|
||||
|
||||
GType clutter_container_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void clutter_container_add (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
void clutter_container_add_actor (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
void clutter_container_add_valist (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
va_list var_args);
|
||||
void clutter_container_remove (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
void clutter_container_remove_actor (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
void clutter_container_remove_valist (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
va_list var_args);
|
||||
GList * clutter_container_get_children (ClutterContainer *container);
|
||||
void clutter_container_foreach (ClutterContainer *container,
|
||||
ClutterCallback callback,
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "deprecated/clutter-behaviour-rotate.h"
|
||||
#include "deprecated/clutter-behaviour-scale.h"
|
||||
#include "deprecated/clutter-box.h"
|
||||
#include "deprecated/clutter-container.h"
|
||||
#include "deprecated/clutter-fixed.h"
|
||||
#include "deprecated/clutter-frame-source.h"
|
||||
#include "deprecated/clutter-group.h"
|
||||
|
@ -73,6 +73,9 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "deprecated/clutter-container.h"
|
||||
|
||||
#include "clutter-actor.h"
|
||||
#include "clutter-animatable.h"
|
||||
#include "clutter-child-meta.h"
|
||||
|
@ -34,8 +34,10 @@
|
||||
#include <glib.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "deprecated/clutter-container.h"
|
||||
|
||||
#include "clutter-actor.h"
|
||||
#include "clutter-container.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-enum-types.h"
|
||||
|
||||
|
@ -76,6 +76,9 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "deprecated/clutter-container.h"
|
||||
|
||||
#include "clutter-table-layout.h"
|
||||
|
||||
#include "clutter-debug.h"
|
||||
|
@ -77,6 +77,9 @@
|
||||
#include <glib-object.h>
|
||||
#include <gobject/gvaluecollector.h>
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "deprecated/clutter-container.h"
|
||||
|
||||
#include "clutter-box.h"
|
||||
|
||||
#include "clutter-actor-private.h"
|
||||
|
64
clutter/deprecated/clutter-container.h
Normal file
64
clutter/deprecated/clutter-container.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2006, 2007, 2008 OpenedHand
|
||||
* Copyright (C) 2009, 2010, 2011 Intel Corporation
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* ClutterContainer: Generic actor container interface.
|
||||
*
|
||||
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_CONTAINER_DEPRECATED_H__
|
||||
#define __CLUTTER_CONTAINER_DEPRECATED_H__
|
||||
|
||||
#include <clutter/clutter-container.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_add_child)
|
||||
void clutter_container_add (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_add_child)
|
||||
void clutter_container_add_actor (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_add_child)
|
||||
void clutter_container_add_valist (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
va_list var_args);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_remove_child)
|
||||
void clutter_container_remove (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_remove_child)
|
||||
void clutter_container_remove_actor (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_remove_child)
|
||||
void clutter_container_remove_valist (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
va_list var_args);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CONTAINER_DEPRECATED_H__ */
|
Loading…
x
Reference in New Issue
Block a user