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
This commit is contained in:
Alejandro Piñeiro 2010-07-06 13:25:44 +02:00
parent ffd1f12560
commit 137790bec9
2 changed files with 2 additions and 10 deletions

View File

@ -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);
}

View File

@ -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