From 137790bec9d4c29a4e5504ea49623884e90e3cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Pi=C3=B1eiro?= Date: Tue, 6 Jul 2010 13:25:44 +0200 Subject: [PATCH] cally: Refactoring "window:create" and "window:destroy" emission code Previously "window:create" and "window:destroy" were emitted on CallyUtil. Although it works, and CallyUtil already have callbacks to stage_added/removed signals, I think that it is more tidy/clear to do that on CallyRoot: * CallyRoot already has code to manage ClutterStage addition/removal * In fact, we can see CallyRoot as the object exposing the a11y information from ClutterStageManager, so it fits better here. * CallyUtil callbacks these signals are related to key event listeners (key snooper simulation). One of the main CallyUtil responsabilities is managing event (connecting, emitting), so I would prefer to not start to add/mix more functionalities here. Ideally it would be better to emit all CallyStage methods from CallyStage, but it is clear that "create" and "destroy" are more easy to emit from a external object --- clutter/cally/cally-root.c | 2 ++ clutter/cally/cally-util.c | 10 ---------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/clutter/cally/cally-root.c b/clutter/cally/cally-root.c index f919c8531..aaad2f86b 100644 --- a/clutter/cally/cally-root.c +++ b/clutter/cally/cally-root.c @@ -248,6 +248,7 @@ cally_util_stage_added_cb (ClutterStageManager *stage_manager, index = g_slist_index (root->priv->stage_list, cally_stage); g_signal_emit_by_name (root, "children_changed::add", index, cally_stage, NULL); + g_signal_emit_by_name (cally_stage, "create", 0); } static void @@ -269,4 +270,5 @@ cally_util_stage_removed_cb (ClutterStageManager *stage_manager, index = g_slist_index (root->priv->stage_list, cally_stage); g_signal_emit_by_name (root, "children_changed::remove", index, cally_stage, NULL); + g_signal_emit_by_name (cally_stage, "destroy", 0); } diff --git a/clutter/cally/cally-util.c b/clutter/cally/cally-util.c index 40396fdea..fd0b43a2a 100644 --- a/clutter/cally/cally-util.c +++ b/clutter/cally/cally-util.c @@ -535,13 +535,8 @@ cally_util_stage_added_cb (ClutterStageManager *stage_manager, gpointer data) { GCallback cally_key_snooper_cb = G_CALLBACK (data); - AtkObject *cally_stage = NULL; g_signal_connect (G_OBJECT (stage), "captured-event", cally_key_snooper_cb, NULL); - - cally_stage = clutter_actor_get_accessible (CLUTTER_ACTOR (stage)); - if (cally_stage != NULL) - g_signal_emit_by_name (G_OBJECT(cally_stage), "create", 0); } static void @@ -551,13 +546,8 @@ cally_util_stage_removed_cb (ClutterStageManager *stage_manager, { GCallback cally_key_snooper_cb = G_CALLBACK (data); gint num = 0; - AtkObject *cally_stage = NULL; num = g_signal_handlers_disconnect_by_func (stage, cally_key_snooper_cb, NULL); - - cally_stage = clutter_actor_get_accessible (CLUTTER_ACTOR (stage)); - if (cally_stage != NULL) - g_signal_emit_by_name (G_OBJECT(cally_stage), "destroy", 0); } static void