[gnome-shell/wip/clutter-deprecation-fixes: 14/27] st-widget: Copy get_focus_chain from StContainer



commit 1ad2b9c0e002f952e7ff6554d3ffb2b4ba9568ce
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Feb 13 19:55:30 2012 -0500

    st-widget: Copy get_focus_chain from StContainer
    
    This is a prerequisite to getting rid of StContainer

 src/shell-generic-container.c |    8 ++++----
 src/st/st-container.c         |   38 +-------------------------------------
 src/st/st-container.h         |    4 ----
 src/st/st-widget.c            |   24 ++++++++++++++++++++++++
 src/st/st-widget.h            |    5 +++++
 5 files changed, 34 insertions(+), 45 deletions(-)
---
diff --git a/src/shell-generic-container.c b/src/shell-generic-container.c
index a3fc1b6..e852971 100644
--- a/src/shell-generic-container.c
+++ b/src/shell-generic-container.c
@@ -163,9 +163,9 @@ shell_generic_container_pick (ClutterActor        *actor,
 }
 
 static GList *
-shell_generic_container_get_focus_chain (StContainer *container)
+shell_generic_container_get_focus_chain (StWidget *widget)
 {
-  ShellGenericContainer *self = SHELL_GENERIC_CONTAINER (container);
+  ShellGenericContainer *self = SHELL_GENERIC_CONTAINER (widget);
   GList *children, *focus_chain;
 
   focus_chain = NULL;
@@ -252,7 +252,7 @@ shell_generic_container_class_init (ShellGenericContainerClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
-  StContainerClass *container_class = ST_CONTAINER_CLASS (klass);
+  StWidgetClass *widget_class = ST_WIDGET_CLASS (klass);
 
   gobject_class->finalize = shell_generic_container_finalize;
 
@@ -262,7 +262,7 @@ shell_generic_container_class_init (ShellGenericContainerClass *klass)
   actor_class->paint = shell_generic_container_paint;
   actor_class->pick = shell_generic_container_pick;
 
-  container_class->get_focus_chain = shell_generic_container_get_focus_chain;
+  widget_class->get_focus_chain = shell_generic_container_get_focus_chain;
 
   /**
    * ShellGenericContainer::get-preferred-width:
diff --git a/src/st/st-container.c b/src/st/st-container.c
index c249407..1e8380f 100644
--- a/src/st/st-container.c
+++ b/src/st/st-container.c
@@ -182,40 +182,6 @@ st_container_get_children_list (StContainer *container)
   return container->priv->children;
 }
 
-static GList *
-st_container_real_get_focus_chain (StContainer *container)
-{
-  GList *chain, *children;
-
-  chain = NULL;
-  for (children = container->priv->children; children; children = children->next)
-    {
-      ClutterActor *child = children->data;
-
-      if (CLUTTER_ACTOR_IS_VISIBLE (child))
-        chain = g_list_prepend (chain, child);
-    }
-
-  return g_list_reverse (chain);
-}
-
-/**
- * st_container_get_focus_chain:
- * @container: An #StContainer
- *
- * Gets a list of the focusable children of @container, in "Tab"
- * order. By default, this returns all visible
- * (as in CLUTTER_ACTOR_IS_VISIBLE()) children of @container.
- *
- * Returns: (element-type Clutter.Actor) (transfer container):
- *   @container's focusable children
- */
-GList *
-st_container_get_focus_chain (StContainer *container)
-{
-  return ST_CONTAINER_GET_CLASS (container)->get_focus_chain (container);
-}
-
 static gint
 sort_z_order (gconstpointer a,
               gconstpointer b)
@@ -649,7 +615,7 @@ st_container_navigate_focus (StWidget         *widget,
    * "first" being determined by @direction.)
    */
 
-  children = st_container_get_focus_chain (container);
+  children = st_widget_get_focus_chain (ST_WIDGET (container));
   if (direction == GTK_DIR_TAB_FORWARD ||
       direction == GTK_DIR_TAB_BACKWARD)
     {
@@ -761,6 +727,4 @@ st_container_class_init (StContainerClass *klass)
   actor_class->get_paint_volume = st_container_get_paint_volume;
 
   widget_class->navigate_focus = st_container_navigate_focus;
-
-  container_class->get_focus_chain = st_container_real_get_focus_chain;
 }
diff --git a/src/st/st-container.h b/src/st/st-container.h
index 023bef9..418ca43 100644
--- a/src/st/st-container.h
+++ b/src/st/st-container.h
@@ -47,16 +47,12 @@ struct _StContainer {
 
 struct _StContainerClass {
   StWidgetClass parent_class;
-
-  GList * (*get_focus_chain) (StContainer *container);
 };
 
 GType   st_container_get_type             (void) G_GNUC_CONST;
 
 void    st_container_destroy_children     (StContainer *container);
 
-GList * st_container_get_focus_chain      (StContainer *container);
-
 /* Only to be used by subclasses of StContainer */
 void    st_container_move_child           (StContainer  *container,
                                            ClutterActor *actor,
diff --git a/src/st/st-widget.c b/src/st/st-widget.c
index 9522ec6..79145ef 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -772,6 +772,12 @@ st_widget_get_paint_volume (ClutterActor *self,
   return TRUE;
 }
 
+static GList *
+st_widget_real_get_focus_chain (StWidget *widget)
+{
+  return clutter_actor_get_children (CLUTTER_ACTOR (widget));
+}
+
 
 static void
 st_widget_class_init (StWidgetClass *klass)
@@ -809,6 +815,7 @@ st_widget_class_init (StWidgetClass *klass)
   klass->style_changed = st_widget_real_style_changed;
   klass->navigate_focus = st_widget_real_navigate_focus;
   klass->get_accessible_type = st_widget_accessible_get_type;
+  klass->get_focus_chain = st_widget_real_get_focus_chain;
 
   /**
    * StWidget:pseudo-class:
@@ -2527,3 +2534,20 @@ check_labels (StWidgetAccessible *widget_accessible,
                                    ATK_OBJECT (widget_accessible));
     }
 }
+
+/**
+ * st_widget_get_focus_chain:
+ * @widget: An #StWidget
+ *
+ * Gets a list of the focusable children of @widget, in "Tab"
+ * order. By default, this returns all visible
+ * (as in CLUTTER_ACTOR_IS_VISIBLE()) children of @widget.
+ *
+ * Returns: (element-type Clutter.Actor) (transfer container):
+ *   @widget's focusable children
+ */
+GList *
+st_widget_get_focus_chain (StWidget *widget)
+{
+  return ST_WIDGET_GET_CLASS (widget)->get_focus_chain (widget);
+}
diff --git a/src/st/st-widget.h b/src/st/st-widget.h
index 2ed46b3..e4a57fb 100644
--- a/src/st/st-widget.h
+++ b/src/st/st-widget.h
@@ -86,6 +86,8 @@ struct _StWidgetClass
                                     ClutterActor     *from,
                                     GtkDirectionType  direction);
   GType    (* get_accessible_type) (void);
+
+  GList *  (* get_focus_chain)     (StWidget         *widget);
 };
 
 GType st_widget_get_type (void) G_GNUC_CONST;
@@ -161,6 +163,9 @@ void                  st_widget_style_changed             (StWidget        *widg
 StThemeNode *         st_widget_get_theme_node            (StWidget        *widget);
 StThemeNode *         st_widget_peek_theme_node           (StWidget        *widget);
 
+GList *               st_widget_get_focus_chain           (StWidget        *widget);
+
+
 /* debug methods */
 char  *st_describe_actor       (ClutterActor *actor);
 void   st_set_slow_down_factor (gfloat factor);



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