st: Don't use deprecated API

clutter_actor_set_parent and clutter_actor_unparent are both
deprecated, and come from a time before a well-thought API
was introduced.

https://bugzilla.gnome.org/show_bug.cgi?id=670034
This commit is contained in:
Jasper St. Pierre 2012-02-13 15:22:53 -05:00
parent f9e456bb47
commit 92ee17493c
6 changed files with 15 additions and 26 deletions

View File

@ -456,25 +456,14 @@ st_bin_set_child (StBin *bin,
return; return;
if (priv->child) if (priv->child)
{ clutter_actor_remove_child (CLUTTER_ACTOR (bin), priv->child);
ClutterActor *old_child = priv->child;
g_object_ref (old_child); priv->child = NULL;
priv->child = NULL;
clutter_actor_unparent (old_child);
g_signal_emit_by_name (bin, "actor-removed", old_child);
g_object_unref (old_child);
}
if (child) if (child)
{ {
priv->child = child; priv->child = child;
clutter_actor_set_parent (child, CLUTTER_ACTOR (bin)); clutter_actor_add_child (CLUTTER_ACTOR (bin), child);
g_signal_emit_by_name (bin, "actor-added", priv->child);
} }
clutter_actor_queue_relayout (CLUTTER_ACTOR (bin)); clutter_actor_queue_relayout (CLUTTER_ACTOR (bin));

View File

@ -741,7 +741,7 @@ st_entry_init (StEntry *entry)
priv->spacing = 6.0f; priv->spacing = 6.0f;
clutter_actor_set_parent (priv->entry, CLUTTER_ACTOR (entry)); clutter_actor_add_child (CLUTTER_ACTOR (entry), priv->entry);
clutter_actor_set_reactive ((ClutterActor *) entry, TRUE); clutter_actor_set_reactive ((ClutterActor *) entry, TRUE);
/* set cursor hidden until we receive focus */ /* set cursor hidden until we receive focus */
@ -918,7 +918,7 @@ _st_entry_set_icon (StEntry *entry,
g_signal_handlers_disconnect_by_func (*icon, g_signal_handlers_disconnect_by_func (*icon,
_st_entry_icon_press_cb, _st_entry_icon_press_cb,
entry); entry);
clutter_actor_unparent (*icon); clutter_actor_remove_child (CLUTTER_ACTOR (entry), *icon);
*icon = NULL; *icon = NULL;
} }
@ -927,7 +927,7 @@ _st_entry_set_icon (StEntry *entry,
*icon = g_object_ref (new_icon); *icon = g_object_ref (new_icon);
clutter_actor_set_reactive (*icon, TRUE); clutter_actor_set_reactive (*icon, TRUE);
clutter_actor_set_parent (*icon, CLUTTER_ACTOR (entry)); clutter_actor_add_child (CLUTTER_ACTOR (entry), *icon);
g_signal_connect (*icon, "button-release-event", g_signal_connect (*icon, "button-release-event",
G_CALLBACK (_st_entry_icon_press_cb), entry); G_CALLBACK (_st_entry_icon_press_cb), entry);
} }

View File

@ -432,7 +432,7 @@ st_icon_finish_update (StIcon *icon)
{ {
priv->icon_texture = priv->pending_texture; priv->icon_texture = priv->pending_texture;
priv->pending_texture = NULL; priv->pending_texture = NULL;
clutter_actor_set_parent (priv->icon_texture, CLUTTER_ACTOR (icon)); clutter_actor_add_child (CLUTTER_ACTOR (icon), priv->icon_texture);
/* Remove the temporary ref we added */ /* Remove the temporary ref we added */
g_object_unref (priv->icon_texture); g_object_unref (priv->icon_texture);

View File

@ -304,7 +304,7 @@ st_label_init (StLabel *label)
label->priv->shadow_width = -1.; label->priv->shadow_width = -1.;
label->priv->shadow_height = -1.; label->priv->shadow_height = -1.;
clutter_actor_set_parent (priv->label, CLUTTER_ACTOR (label)); clutter_actor_add_child (CLUTTER_ACTOR (label), priv->label);
} }
/** /**

View File

@ -895,8 +895,8 @@ st_scroll_bar_init (StScrollBar *self)
self->priv->trough = (ClutterActor *) st_bin_new (); self->priv->trough = (ClutterActor *) st_bin_new ();
clutter_actor_set_reactive ((ClutterActor *) self->priv->trough, TRUE); clutter_actor_set_reactive ((ClutterActor *) self->priv->trough, TRUE);
clutter_actor_set_name (CLUTTER_ACTOR (self->priv->trough), "trough"); clutter_actor_set_name (CLUTTER_ACTOR (self->priv->trough), "trough");
clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->trough), clutter_actor_add_child (CLUTTER_ACTOR (self),
CLUTTER_ACTOR (self)); CLUTTER_ACTOR (self->priv->trough));
g_signal_connect (self->priv->trough, "button-press-event", g_signal_connect (self->priv->trough, "button-press-event",
G_CALLBACK (trough_button_press_event_cb), self); G_CALLBACK (trough_button_press_event_cb), self);
g_signal_connect (self->priv->trough, "button-release-event", g_signal_connect (self->priv->trough, "button-release-event",
@ -906,8 +906,8 @@ st_scroll_bar_init (StScrollBar *self)
self->priv->handle = (ClutterActor *) st_button_new (); self->priv->handle = (ClutterActor *) st_button_new ();
clutter_actor_set_name (CLUTTER_ACTOR (self->priv->handle), "hhandle"); clutter_actor_set_name (CLUTTER_ACTOR (self->priv->handle), "hhandle");
clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->handle), clutter_actor_add_child (CLUTTER_ACTOR (self),
CLUTTER_ACTOR (self)); CLUTTER_ACTOR (self->priv->handle));
g_signal_connect (self->priv->handle, "button-press-event", g_signal_connect (self->priv->handle, "button-press-event",
G_CALLBACK (handle_button_press_event_cb), self); G_CALLBACK (handle_button_press_event_cb), self);

View File

@ -852,8 +852,8 @@ st_scroll_view_init (StScrollView *self)
"vertical", TRUE, "vertical", TRUE,
NULL); NULL);
clutter_actor_set_parent (priv->hscroll, CLUTTER_ACTOR (self)); clutter_actor_add_child (CLUTTER_ACTOR (self), priv->hscroll);
clutter_actor_set_parent (priv->vscroll, CLUTTER_ACTOR (self)); clutter_actor_add_child (CLUTTER_ACTOR (self), priv->vscroll);
/* mouse scroll is enabled by default, so we also need to be reactive */ /* mouse scroll is enabled by default, so we also need to be reactive */
priv->mouse_scroll = TRUE; priv->mouse_scroll = TRUE;
@ -915,7 +915,7 @@ st_scroll_view_remove (ClutterContainer *container,
else else
g_assert ("Unknown child removed from StScrollView"); g_assert ("Unknown child removed from StScrollView");
clutter_actor_unparent (actor); clutter_actor_remove_child (CLUTTER_ACTOR (container), actor);
} }
} }