clutter/stage-manager: Mark as final
It is not something that can be replaced Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3962>
This commit is contained in:
parent
3fb1c9ab21
commit
5391ab56e8
@ -28,11 +28,6 @@
|
|||||||
*
|
*
|
||||||
* #ClutterStageManager is a singleton object, owned by Clutter, which
|
* #ClutterStageManager is a singleton object, owned by Clutter, which
|
||||||
* maintains the list of currently active stages
|
* maintains the list of currently active stages
|
||||||
*
|
|
||||||
* Every newly-created [class@Stage] will cause the emission of the
|
|
||||||
* [signal@StageManager::stage-added] signal; once a [class@Stage] has
|
|
||||||
* been destroyed, the [signal@StageManager::stage-removed] signal will
|
|
||||||
* be emitted
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -49,22 +44,14 @@ enum
|
|||||||
PROP_0,
|
PROP_0,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
struct _ClutterStageManager
|
||||||
{
|
{
|
||||||
STAGE_ADDED,
|
GObject parent;
|
||||||
STAGE_REMOVED,
|
|
||||||
|
|
||||||
LAST_SIGNAL
|
GSList *stages;
|
||||||
};
|
};
|
||||||
|
|
||||||
static guint manager_signals[LAST_SIGNAL] = { 0, };
|
G_DEFINE_FINAL_TYPE (ClutterStageManager,
|
||||||
|
|
||||||
typedef struct _ClutterStageManagerPrivate
|
|
||||||
{
|
|
||||||
GSList *stages;
|
|
||||||
} ClutterStageManagerPrivate;
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterStageManager,
|
|
||||||
clutter_stage_manager,
|
clutter_stage_manager,
|
||||||
G_TYPE_OBJECT);
|
G_TYPE_OBJECT);
|
||||||
|
|
||||||
@ -72,12 +59,10 @@ static void
|
|||||||
clutter_stage_manager_dispose (GObject *gobject)
|
clutter_stage_manager_dispose (GObject *gobject)
|
||||||
{
|
{
|
||||||
ClutterStageManager *stage_manager = CLUTTER_STAGE_MANAGER (gobject);
|
ClutterStageManager *stage_manager = CLUTTER_STAGE_MANAGER (gobject);
|
||||||
ClutterStageManagerPrivate *priv =
|
|
||||||
clutter_stage_manager_get_instance_private (stage_manager);
|
|
||||||
|
|
||||||
g_slist_free_full (priv->stages,
|
g_slist_free_full (stage_manager->stages,
|
||||||
(GDestroyNotify) clutter_actor_destroy);
|
(GDestroyNotify) clutter_actor_destroy);
|
||||||
priv->stages = NULL;
|
stage_manager->stages = NULL;
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_stage_manager_parent_class)->dispose (gobject);
|
G_OBJECT_CLASS (clutter_stage_manager_parent_class)->dispose (gobject);
|
||||||
}
|
}
|
||||||
@ -88,39 +73,6 @@ clutter_stage_manager_class_init (ClutterStageManagerClass *klass)
|
|||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
gobject_class->dispose = clutter_stage_manager_dispose;
|
gobject_class->dispose = clutter_stage_manager_dispose;
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterStageManager::stage-added:
|
|
||||||
* @stage_manager: the object which received the signal
|
|
||||||
* @stage: the added stage
|
|
||||||
*
|
|
||||||
* The signal is emitted each time a new #ClutterStage
|
|
||||||
* has been added to the stage manager.
|
|
||||||
*/
|
|
||||||
manager_signals[STAGE_ADDED] =
|
|
||||||
g_signal_new ("stage-added",
|
|
||||||
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
||||||
G_SIGNAL_RUN_LAST,
|
|
||||||
G_STRUCT_OFFSET (ClutterStageManagerClass, stage_added),
|
|
||||||
NULL, NULL, NULL,
|
|
||||||
G_TYPE_NONE, 1,
|
|
||||||
CLUTTER_TYPE_STAGE);
|
|
||||||
/**
|
|
||||||
* ClutterStageManager::stage-removed:
|
|
||||||
* @stage_manager: the object which received the signal
|
|
||||||
* @stage: the removed stage
|
|
||||||
*
|
|
||||||
* The signal is emitted each time a #ClutterStage
|
|
||||||
* has been removed from the stage manager.
|
|
||||||
*/
|
|
||||||
manager_signals[STAGE_REMOVED] =
|
|
||||||
g_signal_new ("stage-removed",
|
|
||||||
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
||||||
G_SIGNAL_RUN_LAST,
|
|
||||||
G_STRUCT_OFFSET (ClutterStageManagerClass, stage_removed),
|
|
||||||
NULL, NULL, NULL,
|
|
||||||
G_TYPE_NONE, 1,
|
|
||||||
CLUTTER_TYPE_STAGE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -160,10 +112,7 @@ clutter_stage_manager_get_default (void)
|
|||||||
GSList *
|
GSList *
|
||||||
clutter_stage_manager_list_stages (ClutterStageManager *stage_manager)
|
clutter_stage_manager_list_stages (ClutterStageManager *stage_manager)
|
||||||
{
|
{
|
||||||
ClutterStageManagerPrivate *priv =
|
return g_slist_copy (stage_manager->stages);
|
||||||
clutter_stage_manager_get_instance_private (stage_manager);
|
|
||||||
|
|
||||||
return g_slist_copy (priv->stages);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -180,24 +129,19 @@ clutter_stage_manager_list_stages (ClutterStageManager *stage_manager)
|
|||||||
const GSList *
|
const GSList *
|
||||||
clutter_stage_manager_peek_stages (ClutterStageManager *stage_manager)
|
clutter_stage_manager_peek_stages (ClutterStageManager *stage_manager)
|
||||||
{
|
{
|
||||||
ClutterStageManagerPrivate *priv =
|
return stage_manager->stages;
|
||||||
clutter_stage_manager_get_instance_private (stage_manager);
|
|
||||||
|
|
||||||
return priv->stages;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_clutter_stage_manager_add_stage (ClutterStageManager *stage_manager,
|
_clutter_stage_manager_add_stage (ClutterStageManager *stage_manager,
|
||||||
ClutterStage *stage)
|
ClutterStage *stage)
|
||||||
{
|
{
|
||||||
ClutterStageManagerPrivate *priv =
|
|
||||||
clutter_stage_manager_get_instance_private (stage_manager);
|
|
||||||
AtkObject *stage_accessible = clutter_actor_get_accessible (CLUTTER_ACTOR (stage));
|
AtkObject *stage_accessible = clutter_actor_get_accessible (CLUTTER_ACTOR (stage));
|
||||||
AtkObject *stage_manager_accessible =
|
AtkObject *stage_manager_accessible =
|
||||||
atk_gobject_accessible_for_object (G_OBJECT (stage_manager));
|
atk_gobject_accessible_for_object (G_OBJECT (stage_manager));
|
||||||
int index = -1;
|
int index = -1;
|
||||||
|
|
||||||
if (g_slist_find (priv->stages, stage))
|
if (g_slist_find (stage_manager->stages, stage))
|
||||||
{
|
{
|
||||||
g_warning ("Trying to add a stage to the list of managed stages, "
|
g_warning ("Trying to add a stage to the list of managed stages, "
|
||||||
"but it is already in it, aborting.");
|
"but it is already in it, aborting.");
|
||||||
@ -206,8 +150,8 @@ _clutter_stage_manager_add_stage (ClutterStageManager *stage_manager,
|
|||||||
|
|
||||||
g_object_ref_sink (stage);
|
g_object_ref_sink (stage);
|
||||||
|
|
||||||
priv->stages = g_slist_append (priv->stages, stage);
|
stage_manager->stages = g_slist_append (stage_manager->stages, stage);
|
||||||
index = g_slist_index (priv->stages, stage);
|
index = g_slist_index (stage_manager->stages, stage);
|
||||||
|
|
||||||
if (stage_accessible && stage_manager_accessible)
|
if (stage_accessible && stage_manager_accessible)
|
||||||
{
|
{
|
||||||
@ -216,16 +160,12 @@ _clutter_stage_manager_add_stage (ClutterStageManager *stage_manager,
|
|||||||
index, stage_accessible, NULL);
|
index, stage_accessible, NULL);
|
||||||
g_signal_emit_by_name (stage_manager_accessible, "create", 0);
|
g_signal_emit_by_name (stage_manager_accessible, "create", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_signal_emit (stage_manager, manager_signals[STAGE_ADDED], 0, stage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_clutter_stage_manager_remove_stage (ClutterStageManager *stage_manager,
|
_clutter_stage_manager_remove_stage (ClutterStageManager *stage_manager,
|
||||||
ClutterStage *stage)
|
ClutterStage *stage)
|
||||||
{
|
{
|
||||||
ClutterStageManagerPrivate *priv =
|
|
||||||
clutter_stage_manager_get_instance_private (stage_manager);
|
|
||||||
AtkObject *stage_accessible = clutter_actor_get_accessible (CLUTTER_ACTOR (stage));
|
AtkObject *stage_accessible = clutter_actor_get_accessible (CLUTTER_ACTOR (stage));
|
||||||
AtkObject *stage_manager_accessible =
|
AtkObject *stage_manager_accessible =
|
||||||
atk_gobject_accessible_for_object (G_OBJECT (stage_manager));
|
atk_gobject_accessible_for_object (G_OBJECT (stage_manager));
|
||||||
@ -233,13 +173,11 @@ _clutter_stage_manager_remove_stage (ClutterStageManager *stage_manager,
|
|||||||
/* this might be called multiple times from a ::dispose, so it
|
/* this might be called multiple times from a ::dispose, so it
|
||||||
* needs to just return without warning
|
* needs to just return without warning
|
||||||
*/
|
*/
|
||||||
if (!g_slist_find (priv->stages, stage))
|
if (!g_slist_find (stage_manager->stages, stage))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
index = g_slist_index (priv->stages, stage);
|
index = g_slist_index (stage_manager->stages, stage);
|
||||||
priv->stages = g_slist_remove (priv->stages, stage);
|
stage_manager->stages = g_slist_remove (stage_manager->stages, stage);
|
||||||
|
|
||||||
g_signal_emit (stage_manager, manager_signals[STAGE_REMOVED], 0, stage);
|
|
||||||
|
|
||||||
if (stage_manager_accessible && stage_accessible)
|
if (stage_manager_accessible && stage_accessible)
|
||||||
{
|
{
|
||||||
|
@ -34,29 +34,12 @@ G_BEGIN_DECLS
|
|||||||
#define CLUTTER_TYPE_STAGE_MANAGER (clutter_stage_manager_get_type ())
|
#define CLUTTER_TYPE_STAGE_MANAGER (clutter_stage_manager_get_type ())
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
G_DECLARE_DERIVABLE_TYPE (ClutterStageManager,
|
G_DECLARE_FINAL_TYPE (ClutterStageManager,
|
||||||
clutter_stage_manager,
|
clutter_stage_manager,
|
||||||
CLUTTER,
|
CLUTTER,
|
||||||
STAGE_MANAGER,
|
STAGE_MANAGER,
|
||||||
GObject)
|
GObject)
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterStageManagerClass:
|
|
||||||
*
|
|
||||||
* The #ClutterStageManagerClass structure contains only private data
|
|
||||||
* and should be accessed using the provided API
|
|
||||||
*/
|
|
||||||
struct _ClutterStageManagerClass
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
GObjectClass parent_class;
|
|
||||||
|
|
||||||
void (* stage_added) (ClutterStageManager *stage_manager,
|
|
||||||
ClutterStage *stage);
|
|
||||||
void (* stage_removed) (ClutterStageManager *stage_manager,
|
|
||||||
ClutterStage *stage);
|
|
||||||
};
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterStageManager *clutter_stage_manager_get_default (void);
|
ClutterStageManager *clutter_stage_manager_get_default (void);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
|
Loading…
x
Reference in New Issue
Block a user