group: Move deprecated macro into its own header

This commit is contained in:
Emmanuele Bassi 2011-11-03 15:02:35 +00:00
parent 530b07f12b
commit 11420a7057
5 changed files with 49 additions and 48 deletions

View File

@ -241,6 +241,7 @@ deprecated_h = \
$(srcdir)/deprecated/clutter-behaviour-scale.h \ $(srcdir)/deprecated/clutter-behaviour-scale.h \
$(srcdir)/deprecated/clutter-fixed.h \ $(srcdir)/deprecated/clutter-fixed.h \
$(srcdir)/deprecated/clutter-frame-source.h \ $(srcdir)/deprecated/clutter-frame-source.h \
$(srcdir)/deprecated/clutter-group.h \
$(srcdir)/deprecated/clutter-keysyms.h \ $(srcdir)/deprecated/clutter-keysyms.h \
$(srcdir)/deprecated/clutter-main.h \ $(srcdir)/deprecated/clutter-main.h \
$(srcdir)/deprecated/clutter-timeout-pool.h \ $(srcdir)/deprecated/clutter-timeout-pool.h \

View File

@ -14,6 +14,7 @@
#include "deprecated/clutter-behaviour-scale.h" #include "deprecated/clutter-behaviour-scale.h"
#include "deprecated/clutter-fixed.h" #include "deprecated/clutter-fixed.h"
#include "deprecated/clutter-frame-source.h" #include "deprecated/clutter-frame-source.h"
#include "deprecated/clutter-group.h"
#include "deprecated/clutter-keysyms.h" #include "deprecated/clutter-keysyms.h"
#include "deprecated/clutter-main.h" #include "deprecated/clutter-main.h"
#include "deprecated/clutter-score.h" #include "deprecated/clutter-score.h"

View File

@ -353,7 +353,7 @@ clutter_group_dispose (GObject *object)
/* Note: we are careful to consider that destroying children could /* Note: we are careful to consider that destroying children could
* have the side-effect of destroying other children so * have the side-effect of destroying other children so
* priv->children may be modified during clutter_actor_destroy. */ * priv->children may be modified during clutter_actor_destroy. */
while (priv->children) while (priv->children != NULL)
{ {
ClutterActor *child = priv->children->data; ClutterActor *child = priv->children->data;
priv->children = g_list_delete_link (priv->children, priv->children); priv->children = g_list_delete_link (priv->children, priv->children);
@ -468,19 +468,22 @@ clutter_group_new (void)
* Removes all children actors from the #ClutterGroup. * Removes all children actors from the #ClutterGroup.
*/ */
void void
clutter_group_remove_all (ClutterGroup *group) clutter_group_remove_all (ClutterGroup *self)
{ {
ClutterContainer *container;
GList *children; GList *children;
g_return_if_fail (CLUTTER_IS_GROUP (group)); g_return_if_fail (CLUTTER_IS_GROUP (self));
children = group->priv->children; container = CLUTTER_CONTAINER (self);
while (children) children = self->priv->children;
while (children != NULL)
{ {
ClutterActor *child = children->data; ClutterActor *child = children->data;
children = children->next; children = children->next;
clutter_container_remove_actor (CLUTTER_CONTAINER (group), child); clutter_container_remove_actor (container, child);
} }
} }

View File

@ -34,27 +34,12 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define CLUTTER_TYPE_GROUP clutter_group_get_type() #define CLUTTER_TYPE_GROUP (clutter_group_get_type ())
#define CLUTTER_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_GROUP, ClutterGroup))
#define CLUTTER_GROUP(obj) \ #define CLUTTER_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_GROUP, ClutterGroupClass))
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \ #define CLUTTER_IS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_GROUP))
CLUTTER_TYPE_GROUP, ClutterGroup)) #define CLUTTER_IS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_GROUP))
#define CLUTTER_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_GROUP, ClutterGroupClass))
#define CLUTTER_GROUP_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_GROUP, ClutterGroupClass))
#define CLUTTER_IS_GROUP(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CLUTTER_TYPE_GROUP))
#define CLUTTER_IS_GROUP_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_GROUP))
#define CLUTTER_GROUP_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_GROUP, ClutterGroupClass))
typedef struct _ClutterGroup ClutterGroup; typedef struct _ClutterGroup ClutterGroup;
typedef struct _ClutterGroupClass ClutterGroupClass; typedef struct _ClutterGroupClass ClutterGroupClass;
@ -98,24 +83,12 @@ struct _ClutterGroupClass
}; };
GType clutter_group_get_type (void) G_GNUC_CONST; GType clutter_group_get_type (void) G_GNUC_CONST;
ClutterActor * clutter_group_new (void); ClutterActor * clutter_group_new (void);
ClutterActor * clutter_group_get_nth_child (ClutterGroup *self, ClutterActor * clutter_group_get_nth_child (ClutterGroup *self,
gint index_); gint index_);
gint clutter_group_get_n_children (ClutterGroup *self); gint clutter_group_get_n_children (ClutterGroup *self);
void clutter_group_remove_all (ClutterGroup *group); void clutter_group_remove_all (ClutterGroup *self);
#ifndef CLUTTER_DISABLE_DEPRECATED
/* for Mr. Mallum only */
#define clutter_group_add(group,actor) G_STMT_START { \
ClutterActor *_actor = (ClutterActor *) (actor); \
if (CLUTTER_IS_GROUP ((group)) && CLUTTER_IS_ACTOR ((_actor))) \
{ \
ClutterContainer *_container = (ClutterContainer *) (group); \
clutter_container_add_actor (_container, _actor); \
} } G_STMT_END
#endif /* CLUTTER_DISABLE_DEPRECATED */
G_END_DECLS G_END_DECLS

View File

@ -0,0 +1,23 @@
#ifndef __CLUTTER_GROUP_DEPRECATED_H__
#define __CLUTTER_GROUP_DEPRECATED_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#ifndef CLUTTER_DISABLE_DEPRECATED
/* for Mr. Mallum only */
#define clutter_group_add(group,actor) G_STMT_START { \
ClutterActor *_actor = (ClutterActor *) (actor); \
if (CLUTTER_IS_GROUP ((group)) && CLUTTER_IS_ACTOR ((_actor))) \
{ \
ClutterContainer *_container = (ClutterContainer *) (group); \
clutter_container_add_actor (_container, _actor); \
} } G_STMT_END
#endif /* CLUTTER_DISABLE_DEPRECATED */
G_END_DECLS
#endif /* __CLUTTER_GROUP_DEPRECATED_H__ */