[gnome-shell/wip/clutter-deprecation-fixes: 6/25] st: Don't use deprecated API
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/clutter-deprecation-fixes: 6/25] st: Don't use deprecated API
- Date: Tue, 14 Feb 2012 04:39:37 +0000 (UTC)
commit 4ed817531005ab0397bfea754fd7305e32c4b04f
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Feb 13 15:22:53 2012 -0500
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.
src/st/st-bin.c | 19 ++++++-------------
src/st/st-entry.c | 6 +++---
src/st/st-icon.c | 2 +-
src/st/st-label.c | 2 +-
src/st/st-scroll-bar.c | 24 ++++++++++++------------
src/st/st-scroll-view.c | 6 +++---
6 files changed, 26 insertions(+), 33 deletions(-)
---
diff --git a/src/st/st-bin.c b/src/st/st-bin.c
index af6c2f7..5e53692 100644
--- a/src/st/st-bin.c
+++ b/src/st/st-bin.c
@@ -457,24 +457,17 @@ st_bin_set_child (StBin *bin,
if (priv->child)
{
- ClutterActor *old_child = priv->child;
-
- g_object_ref (old_child);
-
- priv->child = NULL;
- clutter_actor_unparent (old_child);
-
- g_signal_emit_by_name (bin, "actor-removed", old_child);
-
- g_object_unref (old_child);
+ g_object_ref (priv->child);
+ clutter_actor_remove_child (CLUTTER_ACTOR (bin), priv->child);
+ g_object_unref (priv->child);
}
+ priv->child = NULL;
+
if (child)
{
priv->child = child;
- clutter_actor_set_parent (child, CLUTTER_ACTOR (bin));
-
- g_signal_emit_by_name (bin, "actor-added", priv->child);
+ clutter_actor_add_child (CLUTTER_ACTOR (bin), child);
}
clutter_actor_queue_relayout (CLUTTER_ACTOR (bin));
diff --git a/src/st/st-entry.c b/src/st/st-entry.c
index e267c70..3856a46 100644
--- a/src/st/st-entry.c
+++ b/src/st/st-entry.c
@@ -741,7 +741,7 @@ st_entry_init (StEntry *entry)
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);
/* set cursor hidden until we receive focus */
@@ -918,7 +918,7 @@ _st_entry_set_icon (StEntry *entry,
g_signal_handlers_disconnect_by_func (*icon,
_st_entry_icon_press_cb,
entry);
- clutter_actor_unparent (*icon);
+ clutter_actor_remove_child (CLUTTER_ACTOR (entry), *icon);
*icon = NULL;
}
@@ -927,7 +927,7 @@ _st_entry_set_icon (StEntry *entry,
*icon = g_object_ref (new_icon);
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_CALLBACK (_st_entry_icon_press_cb), entry);
}
diff --git a/src/st/st-icon.c b/src/st/st-icon.c
index f20c8e8..c2c4205 100644
--- a/src/st/st-icon.c
+++ b/src/st/st-icon.c
@@ -432,7 +432,7 @@ st_icon_finish_update (StIcon *icon)
{
priv->icon_texture = priv->pending_texture;
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 */
g_object_unref (priv->icon_texture);
diff --git a/src/st/st-label.c b/src/st/st-label.c
index 7cbb45d..dfb1428 100644
--- a/src/st/st-label.c
+++ b/src/st/st-label.c
@@ -304,7 +304,7 @@ st_label_init (StLabel *label)
label->priv->shadow_width = -1.;
label->priv->shadow_height = -1.;
- clutter_actor_set_parent (priv->label, CLUTTER_ACTOR (label));
+ clutter_actor_add_child (CLUTTER_ACTOR (label), priv->label);
}
/**
diff --git a/src/st/st-scroll-bar.c b/src/st/st-scroll-bar.c
index 9f64a53..a52bc3b 100644
--- a/src/st/st-scroll-bar.c
+++ b/src/st/st-scroll-bar.c
@@ -184,25 +184,25 @@ st_scroll_bar_dispose (GObject *gobject)
g_signal_handlers_disconnect_by_func (priv->handle,
G_CALLBACK (handle_button_press_event_cb),
bar);
- clutter_actor_unparent (priv->handle);
+ clutter_actor_remove_child (CLUTTER_ACTOR (priv->trough), priv->handle);
priv->handle = NULL;
}
if (priv->bw_stepper)
{
- clutter_actor_unparent (priv->bw_stepper);
+ clutter_actor_remove_child (CLUTTER_ACTOR (bar), priv->bw_stepper);
priv->bw_stepper = NULL;
}
if (priv->fw_stepper)
{
- clutter_actor_unparent (priv->fw_stepper);
+ clutter_actor_remove_child (CLUTTER_ACTOR (bar), priv->fw_stepper);
priv->fw_stepper = NULL;
}
if (priv->trough)
{
- clutter_actor_unparent (priv->trough);
+ clutter_actor_remove_child (CLUTTER_ACTOR (bar), priv->trough);
priv->trough = NULL;
}
@@ -1134,8 +1134,8 @@ st_scroll_bar_init (StScrollBar *self)
self->priv->bw_stepper = (ClutterActor *) st_button_new ();
clutter_actor_set_name (CLUTTER_ACTOR (self->priv->bw_stepper),
"backward-stepper");
- clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->bw_stepper),
- CLUTTER_ACTOR (self));
+ clutter_actor_add_child (CLUTTER_ACTOR (self),
+ CLUTTER_ACTOR (self->priv->bw_stepper));
g_signal_connect (self->priv->bw_stepper, "button-press-event",
G_CALLBACK (stepper_button_press_event_cb), self);
g_signal_connect (self->priv->bw_stepper, "button-release-event",
@@ -1144,8 +1144,8 @@ st_scroll_bar_init (StScrollBar *self)
self->priv->fw_stepper = (ClutterActor *) st_button_new ();
clutter_actor_set_name (CLUTTER_ACTOR (self->priv->fw_stepper),
"forward-stepper");
- clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->fw_stepper),
- CLUTTER_ACTOR (self));
+ clutter_actor_add_child (CLUTTER_ACTOR (self),
+ CLUTTER_ACTOR (self->priv->fw_stepper));
g_signal_connect (self->priv->fw_stepper, "button-press-event",
G_CALLBACK (stepper_button_press_event_cb), self);
g_signal_connect (self->priv->fw_stepper, "button-release-event",
@@ -1154,8 +1154,8 @@ st_scroll_bar_init (StScrollBar *self)
self->priv->trough = (ClutterActor *) st_bin_new ();
clutter_actor_set_reactive ((ClutterActor *) self->priv->trough, TRUE);
clutter_actor_set_name (CLUTTER_ACTOR (self->priv->trough), "trough");
- clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->trough),
- CLUTTER_ACTOR (self));
+ clutter_actor_add_child (CLUTTER_ACTOR (self),
+ CLUTTER_ACTOR (self->priv->trough));
g_signal_connect (self->priv->trough, "button-press-event",
G_CALLBACK (trough_button_press_event_cb), self);
g_signal_connect (self->priv->trough, "button-release-event",
@@ -1165,8 +1165,8 @@ st_scroll_bar_init (StScrollBar *self)
self->priv->handle = (ClutterActor *) st_button_new ();
clutter_actor_set_name (CLUTTER_ACTOR (self->priv->handle), "hhandle");
- clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->handle),
- CLUTTER_ACTOR (self));
+ clutter_actor_add_child (CLUTTER_ACTOR (self),
+ CLUTTER_ACTOR (self->priv->handle));
g_signal_connect (self->priv->handle, "button-press-event",
G_CALLBACK (handle_button_press_event_cb), self);
diff --git a/src/st/st-scroll-view.c b/src/st/st-scroll-view.c
index e5de8c8..7828942 100644
--- a/src/st/st-scroll-view.c
+++ b/src/st/st-scroll-view.c
@@ -852,8 +852,8 @@ st_scroll_view_init (StScrollView *self)
"vertical", TRUE,
NULL);
- clutter_actor_set_parent (priv->hscroll, CLUTTER_ACTOR (self));
- clutter_actor_set_parent (priv->vscroll, CLUTTER_ACTOR (self));
+ clutter_actor_add_child (CLUTTER_ACTOR (self), priv->hscroll);
+ clutter_actor_add_child (CLUTTER_ACTOR (self), priv->vscroll);
/* mouse scroll is enabled by default, so we also need to be reactive */
priv->mouse_scroll = TRUE;
@@ -915,7 +915,7 @@ st_scroll_view_remove (ClutterContainer *container,
else
g_assert ("Unknown child removed from StScrollView");
- clutter_actor_unparent (actor);
+ clutter_actor_remove_child (CLUTTER_ACTOR (container), actor);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]