From 5d4974ed365d9882945f211f1dadd067b4b2d8b1 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 29 May 2009 14:45:53 +0100 Subject: [PATCH] [stage manager] Add peek_stages() We need an method for StageManager that returns a const pointer to the internal list, to avoid the copy. --- clutter/clutter-stage-manager.c | 24 ++++++++++++++++++++++-- clutter/clutter-stage-manager.h | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/clutter/clutter-stage-manager.c b/clutter/clutter-stage-manager.c index 65ea52097..1d9401143 100644 --- a/clutter/clutter-stage-manager.c +++ b/clutter/clutter-stage-manager.c @@ -224,8 +224,9 @@ clutter_stage_manager_get_default_stage (ClutterStageManager *stage_manager) * * Lists all currently used stages. * - * Return value: (transfer container) (element-type ClutterStage): a newly allocated list - * of #ClutterStage objects. Use g_slist_free() to deallocate it when done. + * Return value: (transfer container) (element-type ClutterStage): a newly + * allocated list of #ClutterStage objects. Use g_slist_free() to + * deallocate it when done. * * Since: 0.8 */ @@ -235,6 +236,25 @@ clutter_stage_manager_list_stages (ClutterStageManager *stage_manager) return g_slist_copy (stage_manager->stages); } +/** + * clutter_stage_manager_list_stage: + * @stage_manager: a #ClutterStageManager + * + * Lists all currently used stages. + * + * Return value: (transfer none) (element-type ClutterStage): a pointer + * to the internal list of #ClutterStage objects. The returned list + * is owned by the #ClutterStageManager and should never be modified + * or freed + * + * Since: 1.0 + */ +const GSList * +clutter_stage_manager_peek_stages (ClutterStageManager *stage_manager) +{ + return stage_manager->stages; +} + void _clutter_stage_manager_add_stage (ClutterStageManager *stage_manager, ClutterStage *stage) diff --git a/clutter/clutter-stage-manager.h b/clutter/clutter-stage-manager.h index f2484d7e9..c8a36eca9 100644 --- a/clutter/clutter-stage-manager.h +++ b/clutter/clutter-stage-manager.h @@ -61,6 +61,7 @@ void clutter_stage_manager_set_default_stage (ClutterStageManage ClutterStage *stage); ClutterStage * clutter_stage_manager_get_default_stage (ClutterStageManager *stage_manager); GSList * clutter_stage_manager_list_stages (ClutterStageManager *stage_manager); +const GSList * clutter_stage_manager_peek_stages (ClutterStageManager *stage_manager); G_END_DECLS