cally: Use the new macros for adding private data

This commit is contained in:
Emmanuele Bassi 2013-07-03 14:02:09 +01:00
parent 13e3fc286d
commit 8532ca2104
4 changed files with 34 additions and 55 deletions

View File

@ -173,18 +173,6 @@ static void cally_actor_notify_clutter (GObject *obj,
static void cally_actor_real_notify_clutter (GObject *obj, static void cally_actor_real_notify_clutter (GObject *obj,
GParamSpec *pspec); GParamSpec *pspec);
G_DEFINE_TYPE_WITH_CODE (CallyActor,
cally_actor,
ATK_TYPE_GOBJECT_ACCESSIBLE,
G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT,
cally_actor_component_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION,
cally_actor_action_interface_init));
#define CALLY_ACTOR_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), CALLY_TYPE_ACTOR, CallyActorPrivate))
struct _CallyActorPrivate struct _CallyActorPrivate
{ {
GQueue *action_queue; GQueue *action_queue;
@ -194,6 +182,15 @@ struct _CallyActorPrivate
GList *children; GList *children;
}; };
G_DEFINE_TYPE_WITH_CODE (CallyActor,
cally_actor,
ATK_TYPE_GOBJECT_ACCESSIBLE,
G_ADD_PRIVATE (CallyActor)
G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT,
cally_actor_component_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION,
cally_actor_action_interface_init));
/** /**
* cally_actor_new: * cally_actor_new:
* @actor: a #ClutterActor * @actor: a #ClutterActor
@ -287,14 +284,12 @@ cally_actor_class_init (CallyActorClass *klass)
class->get_n_children = cally_actor_get_n_children; class->get_n_children = cally_actor_get_n_children;
class->ref_child = cally_actor_ref_child; class->ref_child = cally_actor_ref_child;
class->get_attributes = cally_actor_get_attributes; class->get_attributes = cally_actor_get_attributes;
g_type_class_add_private (gobject_class, sizeof (CallyActorPrivate));
} }
static void static void
cally_actor_init (CallyActor *cally_actor) cally_actor_init (CallyActor *cally_actor)
{ {
CallyActorPrivate *priv = CALLY_ACTOR_GET_PRIVATE (cally_actor); CallyActorPrivate *priv = cally_actor_get_instance_private (cally_actor);
cally_actor->priv = priv; cally_actor->priv = priv;
@ -306,7 +301,6 @@ cally_actor_init (CallyActor *cally_actor)
priv->children = NULL; priv->children = NULL;
} }
static void static void
cally_actor_finalize (GObject *obj) cally_actor_finalize (GObject *obj)
{ {

View File

@ -58,10 +58,6 @@ static void cally_util_stage_removed_cb (ClutterStageManager *st
ClutterStage *stage, ClutterStage *stage,
gpointer data); gpointer data);
#define CALLY_ROOT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CALLY_TYPE_ROOT, CallyRootPrivate))
G_DEFINE_TYPE (CallyRoot, cally_root, ATK_TYPE_GOBJECT_ACCESSIBLE)
struct _CallyRootPrivate struct _CallyRootPrivate
{ {
/* We save the CallyStage objects. Other option could save the stage /* We save the CallyStage objects. Other option could save the stage
@ -77,6 +73,8 @@ struct _CallyRootPrivate
guint stage_removed_id; guint stage_removed_id;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (CallyRoot, cally_root, ATK_TYPE_GOBJECT_ACCESSIBLE)
static void static void
cally_root_class_init (CallyRootClass *klass) cally_root_class_init (CallyRootClass *klass)
{ {
@ -91,14 +89,12 @@ cally_root_class_init (CallyRootClass *klass)
class->get_parent = cally_root_get_parent; class->get_parent = cally_root_get_parent;
class->initialize = cally_root_initialize; class->initialize = cally_root_initialize;
class->get_name = cally_root_get_name; class->get_name = cally_root_get_name;
g_type_class_add_private (gobject_class, sizeof (CallyRootPrivate));
} }
static void static void
cally_root_init (CallyRoot *root) cally_root_init (CallyRoot *root)
{ {
root->priv = CALLY_ROOT_GET_PRIVATE (root); root->priv = cally_root_get_instance_private (root);
root->priv->stage_list = NULL; root->priv->stage_list = NULL;
root->priv->stage_added_id = 0; root->priv->stage_added_id = 0;

View File

@ -52,16 +52,6 @@ static void cally_stage_activate_cb (ClutterStage *stage,
static void cally_stage_deactivate_cb (ClutterStage *stage, static void cally_stage_deactivate_cb (ClutterStage *stage,
gpointer data); gpointer data);
G_DEFINE_TYPE_WITH_CODE (CallyStage,
cally_stage,
CALLY_TYPE_GROUP,
G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW,
cally_stage_window_interface_init));
#define CALLY_STAGE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), CALLY_TYPE_STAGE, CallyStagePrivate))
struct _CallyStagePrivate struct _CallyStagePrivate
{ {
/* NULL means that the stage will receive the focus */ /* NULL means that the stage will receive the focus */
@ -70,24 +60,27 @@ struct _CallyStagePrivate
gboolean active; gboolean active;
}; };
G_DEFINE_TYPE_WITH_CODE (CallyStage,
cally_stage,
CALLY_TYPE_GROUP,
G_ADD_PRIVATE (CallyStage)
G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW,
cally_stage_window_interface_init));
static void static void
cally_stage_class_init (CallyStageClass *klass) cally_stage_class_init (CallyStageClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
AtkObjectClass *class = ATK_OBJECT_CLASS (klass); AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
/* CallyActorClass *cally_class = CALLY_ACTOR_CLASS (klass); */
/* AtkObject */ /* AtkObject */
class->initialize = cally_stage_real_initialize; class->initialize = cally_stage_real_initialize;
class->ref_state_set = cally_stage_ref_state_set; class->ref_state_set = cally_stage_ref_state_set;
g_type_class_add_private (gobject_class, sizeof (CallyStagePrivate));
} }
static void static void
cally_stage_init (CallyStage *cally_stage) cally_stage_init (CallyStage *cally_stage)
{ {
CallyStagePrivate *priv = CALLY_STAGE_GET_PRIVATE (cally_stage); CallyStagePrivate *priv = cally_stage_get_instance_private (cally_stage);
cally_stage->priv = priv; cally_stage->priv = priv;

View File

@ -172,17 +172,6 @@ static int _cally_misc_get_index_at_point (ClutterText *clutter
gint y, gint y,
AtkCoordType coords); AtkCoordType coords);
G_DEFINE_TYPE_WITH_CODE (CallyText,
cally_text,
CALLY_TYPE_ACTOR,
G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT,
cally_text_text_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT,
cally_text_editable_text_interface_init));
#define CALLY_TEXT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), CALLY_TYPE_TEXT, CallyTextPrivate))
struct _CallyTextPrivate struct _CallyTextPrivate
{ {
/* Cached ClutterText values*/ /* Cached ClutterText values*/
@ -204,6 +193,15 @@ struct _CallyTextPrivate
guint activate_action_id; guint activate_action_id;
}; };
G_DEFINE_TYPE_WITH_CODE (CallyText,
cally_text,
CALLY_TYPE_ACTOR,
G_ADD_PRIVATE (CallyText)
G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT,
cally_text_text_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT,
cally_text_editable_text_interface_init));
static void static void
cally_text_class_init (CallyTextClass *klass) cally_text_class_init (CallyTextClass *klass)
{ {
@ -217,14 +215,12 @@ cally_text_class_init (CallyTextClass *klass)
class->ref_state_set = cally_text_ref_state_set; class->ref_state_set = cally_text_ref_state_set;
cally_class->notify_clutter = cally_text_notify_clutter; cally_class->notify_clutter = cally_text_notify_clutter;
g_type_class_add_private (gobject_class, sizeof (CallyTextPrivate));
} }
static void static void
cally_text_init (CallyText *cally_text) cally_text_init (CallyText *cally_text)
{ {
CallyTextPrivate *priv = CALLY_TEXT_GET_PRIVATE (cally_text); CallyTextPrivate *priv = cally_text_get_instance_private (cally_text);
cally_text->priv = priv; cally_text->priv = priv;