container: Deprecate more methods

The get_children(), foreach(), and foreach_with_internals() methods and
virtual functions are superceded by the Actor API, and should not be
used in newly written code.
This commit is contained in:
Emmanuele Bassi 2011-12-20 14:58:08 +00:00 committed by Emmanuele Bassi
parent 4eaa899871
commit 959f875cbc
3 changed files with 31 additions and 14 deletions

View File

@ -34,7 +34,9 @@
#include <glib-object.h>
#include <gobject/gvaluecollector.h>
#include "clutter-container.h"
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-container.h"
#include "clutter-child-meta.h"
#include "clutter-debug.h"
@ -191,7 +193,7 @@ container_add_actor (ClutterContainer *container,
}
parent = clutter_actor_get_parent (actor);
if (G_UNLIKELY (parent == NULL))
if (G_UNLIKELY (parent != NULL))
{
g_warning ("Attempting to add actor of type '%s' to a "
"container of type '%s', but the actor has "
@ -444,6 +446,8 @@ get_children_cb (ClutterActor *child,
* list when done.
*
* Since: 0.4
*
* Deprecated: 1.10: Use clutter_actor_get_children() instead.
*/
GList *
clutter_container_get_children (ClutterContainer *container)
@ -470,6 +474,11 @@ clutter_container_get_children (ClutterContainer *container)
* container's own implementation, if any.
*
* Since: 0.4
*
* Deprecated: 1.10: Use clutter_actor_get_first_child() or
* clutter_actor_get_last_child() to retrieve the beginning of
* the list of children, and clutter_actor_get_next_sibling()
* and clutter_actor_get_previous_sibling() to iterate over it.
*/
void
clutter_container_foreach (ClutterContainer *container,
@ -502,6 +511,8 @@ clutter_container_foreach (ClutterContainer *container,
* by the application.
*
* Since: 1.0
*
* Deprecated: 1.10: See clutter_container_foreach().
*/
void
clutter_container_foreach_with_internals (ClutterContainer *container,

View File

@ -55,12 +55,12 @@ typedef struct _ClutterContainerIface ClutterContainerIface;
/**
* ClutterContainerIface:
* @add: virtual function for adding an actor to the container. The
* implementation of this virtual function is required.
* @remove: virtual function for removing an actor from the container. The
* implementation of this virtual function is required.
* @add: virtual function for adding an actor to the container. This virtual
* function is deprecated, and it should not be overridden.
* @remove: virtual function for removing an actor from the container. This
* virtual function is deprecated, and it should not be overridden.
* @foreach: virtual function for iterating over the container's children.
* The implementation of this virtual function is required.
* This virtual function is deprecated, and it should not be overridden.
* @foreach_with_internals: virtual functions for iterating over the
* container's children, both added using the #ClutterContainer API
* and internal children. The implementation of this virtual function
@ -139,13 +139,6 @@ struct _ClutterContainerIface
GType clutter_container_get_type (void) G_GNUC_CONST;
GList * clutter_container_get_children (ClutterContainer *container);
void clutter_container_foreach (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data);
void clutter_container_foreach_with_internals (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data);
ClutterActor *clutter_container_find_child_by_name (ClutterContainer *container,
const gchar *child_name);
void clutter_container_raise_child (ClutterContainer *container,

View File

@ -59,6 +59,19 @@ void clutter_container_remove_valist (ClutterContainer *container,
ClutterActor *first_actor,
va_list var_args);
CLUTTER_DEPRECATED_FOR(clutter_actor_get_children)
GList * clutter_container_get_children (ClutterContainer *container);
CLUTTER_DEPRECATED
void clutter_container_foreach (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data);
CLUTTER_DEPRECATED
void clutter_container_foreach_with_internals (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data);
G_END_DECLS
#endif /* __CLUTTER_CONTAINER_DEPRECATED_H__ */