[gnome-shell/wip/clutter-deprecation-fixes: 3/22] st: Don't use deprecated API



commit 5813def15996a9480427c8c606bfd61eca0285f6
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.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=670034

 src/st/st-bin.c         |   17 +++--------------
 src/st/st-entry.c       |    6 +++---
 src/st/st-icon.c        |    2 +-
 src/st/st-label.c       |    2 +-
 src/st/st-scroll-bar.c  |    8 ++++----
 src/st/st-scroll-view.c |    6 +++---
 6 files changed, 15 insertions(+), 26 deletions(-)
---
diff --git a/src/st/st-bin.c b/src/st/st-bin.c
index af6c2f7..4a8c332 100644
--- a/src/st/st-bin.c
+++ b/src/st/st-bin.c
@@ -456,25 +456,14 @@ st_bin_set_child (StBin        *bin,
     return;
 
   if (priv->child)
-    {
-      ClutterActor *old_child = priv->child;
-
-      g_object_ref (old_child);
-
-      priv->child = NULL;
-      clutter_actor_unparent (old_child);
+    clutter_actor_remove_child (CLUTTER_ACTOR (bin), priv->child);
 
-      g_signal_emit_by_name (bin, "actor-removed", old_child);
-
-      g_object_unref (old_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 479cfbf..8069d93 100644
--- a/src/st/st-scroll-bar.c
+++ b/src/st/st-scroll-bar.c
@@ -895,8 +895,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",
@@ -906,8 +906,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 0b304a0..c4a2796 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]