cally/actor: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
This commit is contained in:
parent
105c8583ee
commit
4483d3ee96
@ -222,7 +222,7 @@ cally_actor_initialize (AtkObject *obj,
|
||||
ATK_OBJECT_CLASS (cally_actor_parent_class)->initialize (obj, data);
|
||||
|
||||
self = CALLY_ACTOR(obj);
|
||||
priv = self->priv;
|
||||
priv = cally_actor_get_instance_private (self);
|
||||
actor = CLUTTER_ACTOR (data);
|
||||
|
||||
g_signal_connect (actor,
|
||||
@ -284,8 +284,6 @@ cally_actor_init (CallyActor *cally_actor)
|
||||
{
|
||||
CallyActorPrivate *priv = cally_actor_get_instance_private (cally_actor);
|
||||
|
||||
cally_actor->priv = priv;
|
||||
|
||||
priv->action_queue = NULL;
|
||||
priv->action_idle_handler = 0;
|
||||
|
||||
@ -301,7 +299,7 @@ cally_actor_finalize (GObject *obj)
|
||||
CallyActorPrivate *priv = NULL;
|
||||
|
||||
cally_actor = CALLY_ACTOR (obj);
|
||||
priv = cally_actor->priv;
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
|
||||
_cally_actor_clean_action_list (cally_actor);
|
||||
|
||||
@ -561,7 +559,7 @@ cally_actor_real_add_actor (ClutterActor *container,
|
||||
AtkObject *atk_parent = ATK_OBJECT (data);
|
||||
AtkObject *atk_child = clutter_actor_get_accessible (actor);
|
||||
CallyActor *cally_actor = CALLY_ACTOR (atk_parent);
|
||||
CallyActorPrivate *priv = cally_actor->priv;
|
||||
CallyActorPrivate *priv = cally_actor_get_instance_private (cally_actor);
|
||||
gint index;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (container), 0);
|
||||
@ -611,7 +609,7 @@ cally_actor_real_remove_actor (ClutterActor *container,
|
||||
g_object_unref (atk_child);
|
||||
}
|
||||
|
||||
priv = CALLY_ACTOR (atk_parent)->priv;
|
||||
priv = cally_actor_get_instance_private (CALLY_ACTOR (atk_parent));
|
||||
index = g_list_index (priv->children, actor);
|
||||
g_list_free (priv->children);
|
||||
|
||||
@ -733,7 +731,7 @@ cally_actor_action_do_action (AtkAction *action,
|
||||
gboolean did_action = FALSE;
|
||||
|
||||
cally_actor = CALLY_ACTOR (action);
|
||||
priv = cally_actor->priv;
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
|
||||
set = atk_object_ref_state_set (ATK_OBJECT (cally_actor));
|
||||
|
||||
@ -776,7 +774,7 @@ idle_do_action (gpointer data)
|
||||
ClutterActor *actor = NULL;
|
||||
|
||||
cally_actor = CALLY_ACTOR (data);
|
||||
priv = cally_actor->priv;
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
actor = CALLY_GET_CLUTTER_ACTOR (cally_actor);
|
||||
priv->action_idle_handler = 0;
|
||||
|
||||
@ -804,7 +802,7 @@ cally_actor_action_get_n_actions (AtkAction *action)
|
||||
g_return_val_if_fail (CALLY_IS_ACTOR (action), 0);
|
||||
|
||||
cally_actor = CALLY_ACTOR (action);
|
||||
priv = cally_actor->priv;
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
|
||||
return g_list_length (priv->action_list);
|
||||
}
|
||||
@ -953,7 +951,7 @@ _cally_actor_clean_action_list (CallyActor *cally_actor)
|
||||
{
|
||||
CallyActorPrivate *priv = NULL;
|
||||
|
||||
priv = cally_actor->priv;
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
|
||||
if (priv->action_list)
|
||||
{
|
||||
@ -972,7 +970,7 @@ _cally_actor_get_action_info (CallyActor *cally_actor,
|
||||
|
||||
g_return_val_if_fail (CALLY_IS_ACTOR (cally_actor), NULL);
|
||||
|
||||
priv = cally_actor->priv;
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
|
||||
if (priv->action_list == NULL)
|
||||
return NULL;
|
||||
@ -1041,7 +1039,7 @@ cally_actor_add_action_full (CallyActor *cally_actor,
|
||||
g_return_val_if_fail (CALLY_IS_ACTOR (cally_actor), -1);
|
||||
g_return_val_if_fail (callback != NULL, -1);
|
||||
|
||||
priv = cally_actor->priv;
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
|
||||
info = g_new0 (CallyActorActionInfo, 1);
|
||||
info->name = g_strdup (action_name);
|
||||
@ -1073,7 +1071,7 @@ cally_actor_remove_action (CallyActor *cally_actor,
|
||||
CallyActorPrivate *priv = NULL;
|
||||
|
||||
g_return_val_if_fail (CALLY_IS_ACTOR (cally_actor), FALSE);
|
||||
priv = cally_actor->priv;
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
|
||||
list_node = g_list_nth (priv->action_list, action_id - 1);
|
||||
|
||||
@ -1106,7 +1104,7 @@ cally_actor_remove_action_by_name (CallyActor *cally_actor,
|
||||
CallyActorPrivate *priv = NULL;
|
||||
|
||||
g_return_val_if_fail (CALLY_IS_ACTOR (cally_actor), FALSE);
|
||||
priv = CALLY_ACTOR (cally_actor)->priv;
|
||||
priv = cally_actor_get_instance_private (cally_actor);
|
||||
|
||||
for (node = priv->action_list; node && !action_found;
|
||||
node = node->next)
|
||||
|
@ -35,11 +35,13 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CALLY_TYPE_ACTOR (cally_actor_get_type ())
|
||||
#define CALLY_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_ACTOR, CallyActor))
|
||||
#define CALLY_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_ACTOR, CallyActorClass))
|
||||
#define CALLY_IS_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_ACTOR))
|
||||
#define CALLY_IS_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_ACTOR))
|
||||
#define CALLY_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_ACTOR, CallyActorClass))
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (CallyActor,
|
||||
cally_actor,
|
||||
CALLY,
|
||||
ACTOR,
|
||||
AtkGObjectAccessible)
|
||||
|
||||
typedef struct _CallyActor CallyActor;
|
||||
typedef struct _CallyActorClass CallyActorClass;
|
||||
@ -68,14 +70,6 @@ typedef void (* CallyActionFunc) (CallyActor *cally_actor);
|
||||
typedef void (* CallyActionCallback) (CallyActor *cally_actor,
|
||||
gpointer user_data);
|
||||
|
||||
struct _CallyActor
|
||||
{
|
||||
/*< private >*/
|
||||
AtkGObjectAccessible parent;
|
||||
|
||||
CallyActorPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* CallyActorClass:
|
||||
* @notify_clutter: Signal handler for notify signal on Clutter actor
|
||||
@ -100,9 +94,6 @@ struct _CallyActorClass
|
||||
gpointer data);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType cally_actor_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
AtkObject* cally_actor_new (ClutterActor *actor);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user