[gtk+] a11y: Don't duplicate information anymore



commit acfb3b3d88262d721b5e5591aca7e3c951831c2f
Author: Benjamin Otte <otte redhat com>
Date:   Sun Dec 11 03:02:12 2011 +0100

    a11y: Don't duplicate information anymore
    
    We do provide the expandable and expanded information via
    GtkCellRendererState now so there is no need to use extra flags.

 gtk/a11y/gtkcellaccessible.c       |   25 +++++--------------------
 gtk/a11y/gtkcellaccessible.h       |    4 +---
 gtk/a11y/gtkcellaccessibleparent.c |   11 ++---------
 gtk/a11y/gtkcellaccessibleparent.h |    8 ++------
 gtk/a11y/gtktreeviewaccessible.c   |   11 +----------
 5 files changed, 11 insertions(+), 48 deletions(-)
---
diff --git a/gtk/a11y/gtkcellaccessible.c b/gtk/a11y/gtkcellaccessible.c
index 802d054..eda4518 100644
--- a/gtk/a11y/gtkcellaccessible.c
+++ b/gtk/a11y/gtkcellaccessible.c
@@ -109,7 +109,6 @@ gtk_cell_accessible_ref_state_set (AtkObject *accessible)
   GtkCellAccessible *cell_accessible;
   AtkStateSet *state_set;
   GtkCellRendererState flags;
-  gboolean expandable, expanded;
 
   cell_accessible = GTK_CELL_ACCESSIBLE (accessible);
 
@@ -121,7 +120,7 @@ gtk_cell_accessible_ref_state_set (AtkObject *accessible)
       return state_set;
     }
 
-  flags = _gtk_cell_accessible_get_state (cell_accessible, &expandable, &expanded);
+  flags = _gtk_cell_accessible_get_state (cell_accessible);
 
   atk_state_set_add_state (state_set, ATK_STATE_TRANSIENT);
 
@@ -151,9 +150,9 @@ gtk_cell_accessible_ref_state_set (AtkObject *accessible)
       atk_state_set_add_state (state_set, ATK_STATE_FOCUSED);
     }
 
-  if (expandable)
+  if (flags & GTK_CELL_RENDERER_EXPANDABLE)
     atk_state_set_add_state (state_set, ATK_STATE_EXPANDABLE);
-  if (expanded)
+  if (flags & GTK_CELL_RENDERER_EXPANDED)
     atk_state_set_add_state (state_set, ATK_STATE_EXPANDED);
   
   return state_set;
@@ -475,35 +474,21 @@ _gtk_cell_accessible_set_cell_data (GtkCellAccessible *cell)
 /**
  * _gtk_cell_accessible_get_state:
  * @cell: a #GtkCellAccessible
- * @expandable: (out): %NULL or pointer to boolean that gets set to
- *     whether the cell can be expanded
- * @expanded: (out): %NULL or pointer to boolean that gets set to
- *     whether the cell is expanded
  *
  * Gets the state that would be used to render the area referenced by @cell.
  *
  * Returns: the #GtkCellRendererState for cell
  **/
 GtkCellRendererState
-_gtk_cell_accessible_get_state (GtkCellAccessible *cell,
-                                gboolean          *expandable,
-                                gboolean          *expanded)
+_gtk_cell_accessible_get_state (GtkCellAccessible *cell)
 {
   AtkObject *parent;
 
   g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), 0);
 
-  if (expandable)
-    *expandable = FALSE;
-  if (expanded)
-    *expanded = FALSE;
-
   parent = gtk_widget_get_accessible (cell->widget);
   if (parent == NULL)
     return 0;
 
-  return _gtk_cell_accessible_parent_get_renderer_state (GTK_CELL_ACCESSIBLE_PARENT (parent),
-                                                         cell,
-                                                         expandable,
-                                                         expanded);
+  return _gtk_cell_accessible_parent_get_renderer_state (GTK_CELL_ACCESSIBLE_PARENT (parent), cell);
 }
diff --git a/gtk/a11y/gtkcellaccessible.h b/gtk/a11y/gtkcellaccessible.h
index 597f262..730c21a 100644
--- a/gtk/a11y/gtkcellaccessible.h
+++ b/gtk/a11y/gtkcellaccessible.h
@@ -50,9 +50,7 @@ struct _GtkCellAccessibleClass
 GType    _gtk_cell_accessible_get_type      (void);
 
 GtkCellRendererState
-         _gtk_cell_accessible_get_state     (GtkCellAccessible *cell,
-                                             gboolean          *expandable,
-                                             gboolean          *expanded);
+         _gtk_cell_accessible_get_state     (GtkCellAccessible *cell);
 void     _gtk_cell_accessible_set_cell_data (GtkCellAccessible *cell);
 
 void     _gtk_cell_accessible_initialise    (GtkCellAccessible *cell,
diff --git a/gtk/a11y/gtkcellaccessibleparent.c b/gtk/a11y/gtkcellaccessibleparent.c
index 6f76ccb..82603ec 100644
--- a/gtk/a11y/gtkcellaccessibleparent.c
+++ b/gtk/a11y/gtkcellaccessibleparent.c
@@ -114,9 +114,7 @@ _gtk_cell_accessible_parent_get_child_index (GtkCellAccessibleParent *parent,
 
 GtkCellRendererState
 _gtk_cell_accessible_parent_get_renderer_state (GtkCellAccessibleParent *parent,
-                                                GtkCellAccessible       *cell,
-                                                gboolean                *expandable,
-                                                gboolean                *expanded)
+                                                GtkCellAccessible       *cell)
 {
   GtkCellAccessibleParentIface *iface;
 
@@ -125,13 +123,8 @@ _gtk_cell_accessible_parent_get_renderer_state (GtkCellAccessibleParent *parent,
 
   iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
 
-  if (expandable)
-    *expandable = FALSE;
-  if (expanded)
-    *expanded = FALSE;
-
   if (iface->get_renderer_state)
-    return (iface->get_renderer_state) (parent, cell, expandable, expanded);
+    return (iface->get_renderer_state) (parent, cell);
   else
     return 0;
 }
diff --git a/gtk/a11y/gtkcellaccessibleparent.h b/gtk/a11y/gtkcellaccessibleparent.h
index 78edf02..1a0c7e4 100644
--- a/gtk/a11y/gtkcellaccessibleparent.h
+++ b/gtk/a11y/gtkcellaccessibleparent.h
@@ -62,9 +62,7 @@ struct _GtkCellAccessibleParentIface
                                  GtkCellAccessible       *cell);
   GtkCellRendererState
            ( *get_renderer_state) (GtkCellAccessibleParent *parent,
-                                 GtkCellAccessible       *cell,
-                                 gboolean                *expandable,
-                                 gboolean                *expanded);
+                                 GtkCellAccessible       *cell);
   void     ( *set_cell_data)    (GtkCellAccessibleParent *parent,
                                  GtkCellAccessible       *cell);
 
@@ -88,9 +86,7 @@ int      _gtk_cell_accessible_parent_get_child_index  (GtkCellAccessibleParent *
                                                        GtkCellAccessible       *cell);
 GtkCellRendererState
          _gtk_cell_accessible_parent_get_renderer_state(GtkCellAccessibleParent *parent,
-                                                       GtkCellAccessible       *cell,
-                                                       gboolean                *expandable,
-                                                       gboolean                *expanded);
+                                                       GtkCellAccessible       *cell);
 void     _gtk_cell_accessible_parent_set_cell_data    (GtkCellAccessibleParent *parent,
                                                        GtkCellAccessible       *cell);
 
diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c
index d0e2eb1..dc396f1 100644
--- a/gtk/a11y/gtktreeviewaccessible.c
+++ b/gtk/a11y/gtktreeviewaccessible.c
@@ -1516,9 +1516,7 @@ gtk_tree_view_accessible_get_child_index (GtkCellAccessibleParent *parent,
 
 static GtkCellRendererState
 gtk_tree_view_accessible_get_renderer_state (GtkCellAccessibleParent *parent,
-                                             GtkCellAccessible       *cell,
-                                             gboolean                *expandable,
-                                             gboolean                *expanded)
+                                             GtkCellAccessible       *cell)
 {
   GtkTreeViewAccessibleCellInfo *cell_info;
   GtkTreeView *treeview;
@@ -1572,13 +1570,6 @@ gtk_tree_view_accessible_get_renderer_state (GtkCellAccessibleParent *parent,
         flags |= GTK_CELL_RENDERER_FOCUSED;
     }
 
-  if (expandable)
-    *expandable = GTK_RBNODE_FLAG_SET (cell_info->node, GTK_RBNODE_IS_PARENT)
-                  && cell_info->cell_col_ref == gtk_tree_view_get_expander_column (treeview);
-  if (expanded)
-    *expanded = cell_info->node->children
-                && cell_info->cell_col_ref == gtk_tree_view_get_expander_column (treeview);
-
   return flags;
 }
 



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