[gnome-shell/wip/clutter-deprecation-fixes: 13/22] shell, st: Use clutter_actor_set_allocation rather than chaining up



commit c2fb09b90139f5a1dae8067475b09747d6bc2a63
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Feb 13 22:47:03 2012 -0500

    shell, st: Use clutter_actor_set_allocation rather than chaining up
    
    Since we now have a fixed layout manager by default in StWidget which
    always runs, any subclasses of StWidget which want custom allocation
    semantics should use clutter_actor_set_allocation rather than chaining
    up.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=670034

 src/shell-generic-container.c |    2 +-
 src/shell-slicer.c            |    4 +---
 src/shell-stack.c             |    2 +-
 src/st/st-bin.c               |    3 +--
 src/st/st-box-layout.c        |    3 +--
 src/st/st-entry.c             |    4 +---
 src/st/st-icon.c              |    2 +-
 src/st/st-label.c             |    6 ++----
 src/st/st-scroll-bar.c        |    3 +--
 src/st/st-scroll-view.c       |   13 +------------
 src/st/st-table.c             |    2 +-
 11 files changed, 12 insertions(+), 32 deletions(-)
---
diff --git a/src/shell-generic-container.c b/src/shell-generic-container.c
index bed22b2..4766d9f 100644
--- a/src/shell-generic-container.c
+++ b/src/shell-generic-container.c
@@ -66,7 +66,7 @@ shell_generic_container_allocate (ClutterActor           *self,
   StThemeNode *theme_node;
   ClutterActorBox content_box;
 
-  CLUTTER_ACTOR_CLASS (shell_generic_container_parent_class)->allocate (self, box, flags);
+  clutter_actor_set_allocation (self, box, flags);
 
   theme_node = st_widget_get_theme_node (ST_WIDGET (self));
   st_theme_node_get_content_box (theme_node, box, &content_box);
diff --git a/src/shell-slicer.c b/src/shell-slicer.c
index 986214e..1d3f3ec 100644
--- a/src/shell-slicer.c
+++ b/src/shell-slicer.c
@@ -81,9 +81,7 @@ shell_slicer_allocate (ClutterActor           *self,
 {
   ClutterActor *child;
 
-  /* Chain up directly to ClutterActor to set actor->allocation.  We explicitly skip our parent class
-   * StBin here because we want to override the allocate function. */
-  CLUTTER_ACTOR_CLASS (g_type_class_peek (clutter_actor_get_type ()))->allocate (self, box, flags);
+  clutter_actor_set_allocation (self, box, flags);
 
   child = st_bin_get_child (ST_BIN (self));
   if (child)
diff --git a/src/shell-stack.c b/src/shell-stack.c
index 4093f40..e7d4175 100644
--- a/src/shell-stack.c
+++ b/src/shell-stack.c
@@ -51,7 +51,7 @@ shell_stack_allocate (ClutterActor           *self,
   ClutterActorBox content_box;
   GList *children, *iter;
 
-  CLUTTER_ACTOR_CLASS (shell_stack_parent_class)->allocate (self, box, flags);
+  clutter_actor_set_allocation (self, box, flags);
 
   st_theme_node_get_content_box (theme_node, box, &content_box);
 
diff --git a/src/st/st-bin.c b/src/st/st-bin.c
index 4a8c332..226bec6 100644
--- a/src/st/st-bin.c
+++ b/src/st/st-bin.c
@@ -137,8 +137,7 @@ st_bin_allocate (ClutterActor          *self,
 {
   StBinPrivate *priv = ST_BIN (self)->priv;
 
-  CLUTTER_ACTOR_CLASS (st_bin_parent_class)->allocate (self, box,
-                                                       flags);
+  clutter_actor_set_allocation (self, box, flags);
 
   if (priv->child)
     {
diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c
index c57b7e0..dd44ccb 100644
--- a/src/st/st-box-layout.c
+++ b/src/st/st-box-layout.c
@@ -628,8 +628,7 @@ st_box_layout_allocate (ClutterActor          *actor,
   gboolean flip = (st_widget_get_direction (ST_WIDGET (actor)) == ST_TEXT_DIRECTION_RTL)
                    && (!priv->is_vertical);
 
-  CLUTTER_ACTOR_CLASS (st_box_layout_parent_class)->allocate (actor, box,
-                                                              flags);
+  clutter_actor_set_allocation (actor, box, flags);
 
   children = st_container_get_children_list (ST_CONTAINER (actor));
   if (children == NULL)
diff --git a/src/st/st-entry.c b/src/st/st-entry.c
index 3856a46..1f302ed 100644
--- a/src/st/st-entry.c
+++ b/src/st/st-entry.c
@@ -382,13 +382,11 @@ st_entry_allocate (ClutterActor          *actor,
 {
   StEntryPrivate *priv = ST_ENTRY_PRIV (actor);
   StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
-  ClutterActorClass *parent_class;
   ClutterActorBox content_box, child_box, icon_box;
   gfloat icon_w, icon_h;
   gfloat entry_h, min_h, pref_h, avail_h;
 
-  parent_class = CLUTTER_ACTOR_CLASS (st_entry_parent_class);
-  parent_class->allocate (actor, box, flags);
+  clutter_actor_set_allocation (actor, box, flags);
 
   st_theme_node_get_content_box (theme_node, box, &content_box);
 
diff --git a/src/st/st-icon.c b/src/st/st-icon.c
index 45c2122..4ff3535 100644
--- a/src/st/st-icon.c
+++ b/src/st/st-icon.c
@@ -232,7 +232,7 @@ st_icon_allocate (ClutterActor           *actor,
   StIconPrivate *priv = ST_ICON (actor)->priv;
   StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
 
-  CLUTTER_ACTOR_CLASS (st_icon_parent_class)->allocate (actor, box, flags);
+  clutter_actor_set_allocation (actor, box, flags);
 
   if (priv->icon_texture)
     {
diff --git a/src/st/st-label.c b/src/st/st-label.c
index 594b5d8..0d00ba7 100644
--- a/src/st/st-label.c
+++ b/src/st/st-label.c
@@ -172,13 +172,11 @@ st_label_allocate (ClutterActor          *actor,
 {
   StLabelPrivate *priv = ST_LABEL (actor)->priv;
   StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
-  ClutterActorClass *parent_class;
   ClutterActorBox content_box;
 
-  st_theme_node_get_content_box (theme_node, box, &content_box);
+  clutter_actor_set_allocation (actor, box, flags);
 
-  parent_class = CLUTTER_ACTOR_CLASS (st_label_parent_class);
-  parent_class->allocate (actor, box, flags);
+  st_theme_node_get_content_box (theme_node, box, &content_box);
 
   clutter_actor_allocate (priv->label, &content_box, flags);
 }
diff --git a/src/st/st-scroll-bar.c b/src/st/st-scroll-bar.c
index 8069d93..bda341b 100644
--- a/src/st/st-scroll-bar.c
+++ b/src/st/st-scroll-bar.c
@@ -395,8 +395,7 @@ st_scroll_bar_allocate (ClutterActor          *actor,
 {
   StScrollBar *bar = ST_SCROLL_BAR (actor);
 
-  /* Chain up */
-  CLUTTER_ACTOR_CLASS (st_scroll_bar_parent_class)->allocate (actor, box, flags);
+  clutter_actor_set_allocation (actor, box, flags);
 
   scroll_bar_allocate_children (bar, box, flags);
 }
diff --git a/src/st/st-scroll-view.c b/src/st/st-scroll-view.c
index 3dd9327..34da253 100644
--- a/src/st/st-scroll-view.c
+++ b/src/st/st-scroll-view.c
@@ -492,24 +492,13 @@ st_scroll_view_allocate (ClutterActor          *actor,
                          ClutterAllocationFlags flags)
 {
   ClutterActorBox content_box, child_box;
-  ClutterActorClass *parent_parent_class;
   gfloat avail_width, avail_height, sb_width, sb_height;
   gboolean hscrollbar_visible, vscrollbar_visible;
 
   StScrollViewPrivate *priv = ST_SCROLL_VIEW (actor)->priv;
   StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
 
-  /* Chain up to the parent's parent class
-   *
-   * We do this because we do not want StBin to allocate the child, as we
-   * give it a different allocation later, depending on whether the scrollbars
-   * are visible
-   */
-  parent_parent_class
-    = g_type_class_peek_parent (st_scroll_view_parent_class);
-
-  CLUTTER_ACTOR_CLASS (parent_parent_class)->
-  allocate (actor, box, flags);
+  clutter_actor_set_allocation (actor, box, flags);
 
   st_theme_node_get_content_box (theme_node, box, &content_box);
 
diff --git a/src/st/st-table.c b/src/st/st-table.c
index a44f21f..8542084 100644
--- a/src/st/st-table.c
+++ b/src/st/st-table.c
@@ -717,7 +717,7 @@ st_table_allocate (ClutterActor          *self,
   StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (self));
   ClutterActorBox content_box;
 
-  CLUTTER_ACTOR_CLASS (st_table_parent_class)->allocate (self, box, flags);
+  clutter_actor_set_allocation (self, box, flags);
 
   if (priv->n_cols < 1 || priv->n_rows < 1)
     return;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]