[Xfce4-commits] <exo:master> Add accessibility support to exo icon view.

Nick Schermer noreply at xfce.org
Sun Nov 4 20:04:03 CET 2012


Updating branch refs/heads/master
         to 65a0233c35f24d3cc7978f69768ee510cd34b3d8 (commit)
       from c48d8fdc0a969421777174fdabba91cc47d2baf5 (commit)

commit 65a0233c35f24d3cc7978f69768ee510cd34b3d8
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Nov 4 18:26:05 2012 +0100

    Add accessibility support to exo icon view.

 exo/Makefile.am                |    1 +
 exo/exo-icon-view-accessible.c | 2094 ++++++++++++++++++++++++++++++++++++++++
 exo/exo-icon-view.c            |   85 ++-
 po/POTFILES.skip               |    1 +
 4 files changed, 2167 insertions(+), 14 deletions(-)

diff --git a/exo/Makefile.am b/exo/Makefile.am
index bf30234..cc700c2 100644
--- a/exo/Makefile.am
+++ b/exo/Makefile.am
@@ -197,6 +197,7 @@ EXTRA_DIST = 								\
 	exo.symbols							\
 	exo-alias.h							\
 	exo-aliasdef.c							\
+	exo-icon-view-accessible.c					\
 	exo-marshal.list						\
 	make-exo-alias.pl
 
diff --git a/exo/exo-icon-view-accessible.c b/exo/exo-icon-view-accessible.c
new file mode 100644
index 0000000..9201538
--- /dev/null
+++ b/exo/exo-icon-view-accessible.c
@@ -0,0 +1,2094 @@
+/*-
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+/* Accessibility Support */
+
+static gpointer accessible_parent_class;
+static gpointer accessible_item_parent_class;
+static GQuark accessible_private_data_quark = 0;
+
+#define GTK_TYPE_ICON_VIEW_ITEM_ACCESSIBLE      (exo_icon_view_item_accessible_get_type ())
+#define EXO_ICON_VIEW_ITEM_ACCESSIBLE(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_VIEW_ITEM_ACCESSIBLE, ExoIconViewItemAccessible))
+#define EXO_IS_ICON_VIEW_ITEM_ACCESSIBLE(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_VIEW_ITEM_ACCESSIBLE))
+
+static GType exo_icon_view_item_accessible_get_type (void);
+
+enum {
+    ACTION_ACTIVATE,
+    LAST_ACTION
+};
+
+typedef struct
+{
+  AtkObject parent;
+
+  ExoIconViewItem *item;
+
+  GtkWidget *widget;
+
+  AtkStateSet *state_set;
+
+  gchar *text;
+
+  GtkTextBuffer *text_buffer;
+
+  gchar *action_descriptions[LAST_ACTION];
+  gchar *image_description;
+  guint action_idle_handler;
+} ExoIconViewItemAccessible;
+
+static const gchar *const exo_icon_view_item_accessible_action_names[] = 
+{
+  "activate",
+  NULL
+};
+
+static const gchar *const exo_icon_view_item_accessible_action_descriptions[] =
+{
+  "Activate item",
+  NULL
+};
+typedef struct _ExoIconViewItemAccessibleClass
+{
+  AtkObjectClass parent_class;
+
+} ExoIconViewItemAccessibleClass;
+
+static gboolean exo_icon_view_item_accessible_is_showing (ExoIconViewItemAccessible *item);
+
+static gboolean
+exo_icon_view_item_accessible_idle_do_action (gpointer data)
+{
+  ExoIconViewItemAccessible *item;
+  ExoIconView *icon_view;
+  GtkTreePath *path;
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (data);
+  item->action_idle_handler = 0;
+
+  if (item->widget != NULL)
+    {
+      icon_view = EXO_ICON_VIEW (item->widget);
+      path = gtk_tree_path_new_from_indices (item->item->index, -1);
+      exo_icon_view_item_activated (icon_view, path);
+      gtk_tree_path_free (path);
+    }
+
+  return FALSE;
+}
+
+static gboolean
+exo_icon_view_item_accessible_action_do_action (AtkAction *action,
+                                                gint       i)
+{
+  ExoIconViewItemAccessible *item;
+
+  if (i < 0 || i >= LAST_ACTION) 
+    return FALSE;
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (action);
+
+  if (!EXO_IS_ICON_VIEW (item->widget))
+    return FALSE;
+
+  if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
+    return FALSE;
+
+  switch (i)
+    {
+    case ACTION_ACTIVATE:
+      if (!item->action_idle_handler)
+        item->action_idle_handler = gdk_threads_add_idle (exo_icon_view_item_accessible_idle_do_action, item);
+      break;
+    default:
+      g_assert_not_reached ();
+      return FALSE;
+
+    }        
+  return TRUE;
+}
+
+static gint
+exo_icon_view_item_accessible_action_get_n_actions (AtkAction *action)
+{
+        return LAST_ACTION;
+}
+
+static const gchar *
+exo_icon_view_item_accessible_action_get_description (AtkAction *action,
+                                                      gint       i)
+{
+  ExoIconViewItemAccessible *item;
+
+  if (i < 0 || i >= LAST_ACTION) 
+    return NULL;
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (action);
+
+  if (item->action_descriptions[i])
+    return item->action_descriptions[i];
+  else
+    return exo_icon_view_item_accessible_action_descriptions[i];
+}
+
+static const gchar *
+exo_icon_view_item_accessible_action_get_name (AtkAction *action,
+                                               gint       i)
+{
+  if (i < 0 || i >= LAST_ACTION) 
+    return NULL;
+
+  return exo_icon_view_item_accessible_action_names[i];
+}
+
+static gboolean
+exo_icon_view_item_accessible_action_set_description (AtkAction   *action,
+                                                      gint         i,
+                                                      const gchar *description)
+{
+  ExoIconViewItemAccessible *item;
+
+  if (i < 0 || i >= LAST_ACTION) 
+    return FALSE;
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (action);
+
+  g_free (item->action_descriptions[i]);
+
+  item->action_descriptions[i] = g_strdup (description);
+
+  return TRUE;
+}
+
+static void
+atk_action_item_interface_init (AtkActionIface *iface)
+{
+  iface->do_action = exo_icon_view_item_accessible_action_do_action;
+  iface->get_n_actions = exo_icon_view_item_accessible_action_get_n_actions;
+  iface->get_description = exo_icon_view_item_accessible_action_get_description;
+  iface->get_name = exo_icon_view_item_accessible_action_get_name;
+  iface->set_description = exo_icon_view_item_accessible_action_set_description;
+}
+
+static const gchar *
+exo_icon_view_item_accessible_image_get_image_description (AtkImage *image)
+{
+  ExoIconViewItemAccessible *item;
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (image);
+
+  return item->image_description;
+}
+
+static gboolean
+exo_icon_view_item_accessible_image_set_image_description (AtkImage    *image,
+                                                           const gchar *description)
+{
+  ExoIconViewItemAccessible *item;
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (image);
+
+  g_free (item->image_description);
+  item->image_description = g_strdup (description);
+
+  return TRUE;
+}
+
+static gboolean
+get_pixbuf_box (ExoIconView     *icon_view,
+                ExoIconViewItem *item,
+                GdkRectangle    *box)
+{
+  GList *l;
+  gint n;
+  GParamSpec *pspec;
+
+  for (l = icon_view->priv->cell_list, n = 0; l; l = l->next, n++)
+    {
+      ExoIconViewCellInfo *info = l->data;
+      
+      pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (info->cell), "pixmap");
+      if (pspec != NULL)
+        {
+          *box = item->box[n];
+          return TRUE;
+        }
+    }
+
+  return FALSE;
+}
+
+static gchar *
+get_text (ExoIconView     *icon_view,
+          ExoIconViewItem *item)
+{
+  GList *l;
+  gchar *text;
+  GParamSpec *text_spec;
+
+  for (l = icon_view->priv->cell_list; l; l = l->next)
+    {
+      ExoIconViewCellInfo *info = l->data;
+      
+      text_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (info->cell), "text");
+      if (text_spec != NULL
+          && G_PARAM_SPEC_STRING (text_spec))
+        {
+          g_object_get (info->cell, "text", &text, NULL);
+          return text;
+        }
+    }
+
+  return NULL;
+}
+
+static void
+exo_icon_view_item_accessible_image_get_image_size (AtkImage *image,
+                                                    gint     *width,
+                                                    gint     *height)
+{
+  ExoIconViewItemAccessible *item;
+  GdkRectangle box;
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (image);
+
+  if (!EXO_IS_ICON_VIEW (item->widget))
+    return;
+
+  if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
+    return;
+
+  if (get_pixbuf_box (EXO_ICON_VIEW (item->widget), item->item, &box))
+    {
+      *width = box.width;
+      *height = box.height;  
+    }
+}
+
+static void
+exo_icon_view_item_accessible_image_get_image_position (AtkImage    *image,
+                                                        gint        *x,
+                                                        gint        *y,
+                                                        AtkCoordType coord_type)
+{
+  ExoIconViewItemAccessible *item;
+  GdkRectangle box;
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (image);
+
+  if (!EXO_IS_ICON_VIEW (item->widget))
+    return;
+
+  if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
+    return;
+
+  atk_component_get_position (ATK_COMPONENT (image), x, y, coord_type);
+
+  if (get_pixbuf_box (EXO_ICON_VIEW (item->widget), item->item, &box))
+    {
+      *x+= box.x - item->item->area.x;
+      *y+= box.y - item->item->area.y;
+    }
+
+}
+
+static void
+atk_image_item_interface_init (AtkImageIface *iface)
+{
+  iface->get_image_description = exo_icon_view_item_accessible_image_get_image_description;
+  iface->set_image_description = exo_icon_view_item_accessible_image_set_image_description;
+  iface->get_image_size = exo_icon_view_item_accessible_image_get_image_size;
+  iface->get_image_position = exo_icon_view_item_accessible_image_get_image_position;
+}
+
+static gchar *
+exo_icon_view_item_accessible_text_get_text (AtkText *text,
+                                             gint     start_pos,
+                                             gint     end_pos)
+{
+  ExoIconViewItemAccessible *item;
+  GtkTextIter start, end;
+  GtkTextBuffer *buffer;
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (text);
+
+  if (!EXO_IS_ICON_VIEW (item->widget))
+    return NULL;
+
+  if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
+    return NULL;
+
+  buffer = item->text_buffer;
+  gtk_text_buffer_get_iter_at_offset (buffer, &start, start_pos);
+  if (end_pos < 0)
+    gtk_text_buffer_get_end_iter (buffer, &end);
+  else
+    gtk_text_buffer_get_iter_at_offset (buffer, &end, end_pos);
+
+  return gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
+}
+
+static gunichar
+exo_icon_view_item_accessible_text_get_character_at_offset (AtkText *text,
+                                                            gint     offset)
+{
+  ExoIconViewItemAccessible *item;
+  GtkTextIter start, end;
+  GtkTextBuffer *buffer;
+  gchar *string;
+  gunichar unichar;
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (text);
+
+  if (!EXO_IS_ICON_VIEW (item->widget))
+    return '\0';
+
+  if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
+    return '\0';
+
+  buffer = item->text_buffer;
+  if (offset >= gtk_text_buffer_get_char_count (buffer))
+    return '\0';
+
+  gtk_text_buffer_get_iter_at_offset (buffer, &start, offset);
+  end = start;
+  gtk_text_iter_forward_char (&end);
+  string = gtk_text_buffer_get_slice (buffer, &start, &end, FALSE);
+  unichar = g_utf8_get_char (string);
+  g_free(string);
+
+  return unichar;
+}
+
+static gchar*
+exo_icon_view_item_accessible_text_get_text_before_offset (AtkText         *text,
+                                                           gint            offset,
+                                                           AtkTextBoundary boundary_type,
+                                                           gint            *start_offset,
+                                                           gint            *end_offset)
+{
+  ExoIconViewItemAccessible *item;
+  GtkTextIter start, end;
+  GtkTextBuffer *buffer;
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (text);
+
+  if (!EXO_IS_ICON_VIEW (item->widget))
+    return NULL;
+
+  if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
+    return NULL;
+
+  buffer = item->text_buffer;
+
+  if (!gtk_text_buffer_get_char_count (buffer))
+    {
+      *start_offset = 0;
+      *end_offset = 0;
+      return g_strdup ("");
+    }
+  gtk_text_buffer_get_iter_at_offset (buffer, &start, offset);
+   
+  end = start;
+
+  switch (boundary_type)
+    {
+    case ATK_TEXT_BOUNDARY_CHAR:
+      gtk_text_iter_backward_char(&start);
+      break;
+    case ATK_TEXT_BOUNDARY_WORD_START:
+      if (!gtk_text_iter_starts_word (&start))
+        gtk_text_iter_backward_word_start (&start);
+      end = start;
+      gtk_text_iter_backward_word_start(&start);
+      break;
+    case ATK_TEXT_BOUNDARY_WORD_END:
+      if (gtk_text_iter_inside_word (&start) &&
+          !gtk_text_iter_starts_word (&start))
+        gtk_text_iter_backward_word_start (&start);
+      while (!gtk_text_iter_ends_word (&start))
+        {
+          if (!gtk_text_iter_backward_char (&start))
+            break;
+        }
+      end = start;
+      gtk_text_iter_backward_word_start(&start);
+      while (!gtk_text_iter_ends_word (&start))
+        {
+          if (!gtk_text_iter_backward_char (&start))
+            break;
+        }
+      break;
+    case ATK_TEXT_BOUNDARY_SENTENCE_START:
+      if (!gtk_text_iter_starts_sentence (&start))
+        gtk_text_iter_backward_sentence_start (&start);
+      end = start;
+      gtk_text_iter_backward_sentence_start (&start);
+      break;
+    case ATK_TEXT_BOUNDARY_SENTENCE_END:
+      if (gtk_text_iter_inside_sentence (&start) &&
+          !gtk_text_iter_starts_sentence (&start))
+        gtk_text_iter_backward_sentence_start (&start);
+      while (!gtk_text_iter_ends_sentence (&start))
+        {
+          if (!gtk_text_iter_backward_char (&start))
+            break;
+        }
+      end = start;
+      gtk_text_iter_backward_sentence_start (&start);
+      while (!gtk_text_iter_ends_sentence (&start))
+        {
+          if (!gtk_text_iter_backward_char (&start))
+            break;
+        }
+      break;
+   case ATK_TEXT_BOUNDARY_LINE_START:
+   case ATK_TEXT_BOUNDARY_LINE_END:
+      break;
+    }
+
+  *start_offset = gtk_text_iter_get_offset (&start);
+  *end_offset = gtk_text_iter_get_offset (&end);
+
+  return gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
+}
+
+static gchar*
+exo_icon_view_item_accessible_text_get_text_at_offset (AtkText         *text,
+                                                       gint            offset,
+                                                       AtkTextBoundary boundary_type,
+                                                       gint            *start_offset,
+                                                       gint            *end_offset)
+{
+  ExoIconViewItemAccessible *item;
+  GtkTextIter start, end;
+  GtkTextBuffer *buffer;
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (text);
+
+  if (!EXO_IS_ICON_VIEW (item->widget))
+    return NULL;
+
+  if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
+    return NULL;
+
+  buffer = item->text_buffer;
+
+  if (!gtk_text_buffer_get_char_count (buffer))
+    {
+      *start_offset = 0;
+      *end_offset = 0;
+      return g_strdup ("");
+    }
+  gtk_text_buffer_get_iter_at_offset (buffer, &start, offset);
+   
+  end = start;
+
+  switch (boundary_type)
+    {
+    case ATK_TEXT_BOUNDARY_CHAR:
+      gtk_text_iter_forward_char (&end);
+      break;
+    case ATK_TEXT_BOUNDARY_WORD_START:
+      if (!gtk_text_iter_starts_word (&start))
+        gtk_text_iter_backward_word_start (&start);
+      if (gtk_text_iter_inside_word (&end))
+        gtk_text_iter_forward_word_end (&end);
+      while (!gtk_text_iter_starts_word (&end))
+        {
+          if (!gtk_text_iter_forward_char (&end))
+            break;
+        }
+      break;
+    case ATK_TEXT_BOUNDARY_WORD_END:
+      if (gtk_text_iter_inside_word (&start) &&
+          !gtk_text_iter_starts_word (&start))
+        gtk_text_iter_backward_word_start (&start);
+      while (!gtk_text_iter_ends_word (&start))
+        {
+          if (!gtk_text_iter_backward_char (&start))
+            break;
+        }
+      gtk_text_iter_forward_word_end (&end);
+      break;
+    case ATK_TEXT_BOUNDARY_SENTENCE_START:
+      if (!gtk_text_iter_starts_sentence (&start))
+        gtk_text_iter_backward_sentence_start (&start);
+      if (gtk_text_iter_inside_sentence (&end))
+        gtk_text_iter_forward_sentence_end (&end);
+      while (!gtk_text_iter_starts_sentence (&end))
+        {
+          if (!gtk_text_iter_forward_char (&end))
+            break;
+        }
+      break;
+    case ATK_TEXT_BOUNDARY_SENTENCE_END:
+      if (gtk_text_iter_inside_sentence (&start) &&
+          !gtk_text_iter_starts_sentence (&start))
+        gtk_text_iter_backward_sentence_start (&start);
+      while (!gtk_text_iter_ends_sentence (&start))
+        {
+          if (!gtk_text_iter_backward_char (&start))
+            break;
+        }
+      gtk_text_iter_forward_sentence_end (&end);
+      break;
+   case ATK_TEXT_BOUNDARY_LINE_START:
+   case ATK_TEXT_BOUNDARY_LINE_END:
+      break;
+    }
+
+
+  *start_offset = gtk_text_iter_get_offset (&start);
+  *end_offset = gtk_text_iter_get_offset (&end);
+
+  return gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
+}
+
+static gchar*
+exo_icon_view_item_accessible_text_get_text_after_offset (AtkText         *text,
+                                                          gint            offset,
+                                                          AtkTextBoundary boundary_type,
+                                                          gint            *start_offset,
+                                                          gint            *end_offset)
+{
+  ExoIconViewItemAccessible *item;
+  GtkTextIter start, end;
+  GtkTextBuffer *buffer;
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (text);
+
+  if (!EXO_IS_ICON_VIEW (item->widget))
+    return NULL;
+
+  if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
+    return NULL;
+
+  buffer = item->text_buffer;
+
+  if (!gtk_text_buffer_get_char_count (buffer))
+    {
+      *start_offset = 0;
+      *end_offset = 0;
+      return g_strdup ("");
+    }
+  gtk_text_buffer_get_iter_at_offset (buffer, &start, offset);
+   
+  end = start;
+
+  switch (boundary_type)
+    {
+    case ATK_TEXT_BOUNDARY_CHAR:
+      gtk_text_iter_forward_char(&start);
+      gtk_text_iter_forward_chars(&end, 2);
+      break;
+    case ATK_TEXT_BOUNDARY_WORD_START:
+      if (gtk_text_iter_inside_word (&end))
+        gtk_text_iter_forward_word_end (&end);
+      while (!gtk_text_iter_starts_word (&end))
+        {
+          if (!gtk_text_iter_forward_char (&end))
+            break;
+        }
+      start = end;
+      if (!gtk_text_iter_is_end (&end))
+        {
+          gtk_text_iter_forward_word_end (&end);
+          while (!gtk_text_iter_starts_word (&end))
+            {
+              if (!gtk_text_iter_forward_char (&end))
+                break;
+            }
+        }
+      break;
+    case ATK_TEXT_BOUNDARY_WORD_END:
+      gtk_text_iter_forward_word_end (&end);
+      start = end;
+      if (!gtk_text_iter_is_end (&end))
+        gtk_text_iter_forward_word_end (&end);
+      break;
+    case ATK_TEXT_BOUNDARY_SENTENCE_START:
+      if (gtk_text_iter_inside_sentence (&end))
+        gtk_text_iter_forward_sentence_end (&end);
+      while (!gtk_text_iter_starts_sentence (&end))
+        {
+          if (!gtk_text_iter_forward_char (&end))
+            break;
+        }
+      start = end;
+      if (!gtk_text_iter_is_end (&end))
+        {
+          gtk_text_iter_forward_sentence_end (&end);
+          while (!gtk_text_iter_starts_sentence (&end))
+            {
+              if (!gtk_text_iter_forward_char (&end))
+                break;
+            }
+        }
+      break;
+    case ATK_TEXT_BOUNDARY_SENTENCE_END:
+      gtk_text_iter_forward_sentence_end (&end);
+      start = end;
+      if (!gtk_text_iter_is_end (&end))
+        gtk_text_iter_forward_sentence_end (&end);
+      break;
+   case ATK_TEXT_BOUNDARY_LINE_START:
+   case ATK_TEXT_BOUNDARY_LINE_END:
+      break;
+    }
+  *start_offset = gtk_text_iter_get_offset (&start);
+  *end_offset = gtk_text_iter_get_offset (&end);
+
+  return gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
+}
+
+static gint
+exo_icon_view_item_accessible_text_get_character_count (AtkText *text)
+{
+  ExoIconViewItemAccessible *item;
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (text);
+
+  if (!EXO_IS_ICON_VIEW (item->widget))
+    return 0;
+
+  if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
+    return 0;
+
+  return gtk_text_buffer_get_char_count (item->text_buffer);
+}
+
+static void
+exo_icon_view_item_accessible_text_get_character_extents (AtkText      *text,
+                                                          gint         offset,
+                                                          gint         *x,
+                                                          gint         *y,
+                                                          gint         *width,
+                                                          gint         *height,
+                                                          AtkCoordType coord_type)
+{
+  ExoIconViewItemAccessible *item;
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (text);
+
+  if (!EXO_IS_ICON_VIEW (item->widget))
+    return;
+
+  if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
+    return;
+}
+
+static gint
+exo_icon_view_item_accessible_text_get_offset_at_point (AtkText      *text,
+                                                        gint          x,
+                                                        gint          y,
+                                                        AtkCoordType coord_type)
+{
+  ExoIconViewItemAccessible *item;
+  gint offset = 0;
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (text);
+
+  if (!EXO_IS_ICON_VIEW (item->widget))
+    return -1;
+
+  if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
+    return -1;
+
+  return offset;
+}
+
+static void
+atk_text_item_interface_init (AtkTextIface *iface)
+{
+  iface->get_text = exo_icon_view_item_accessible_text_get_text;
+  iface->get_character_at_offset = exo_icon_view_item_accessible_text_get_character_at_offset;
+  iface->get_text_before_offset = exo_icon_view_item_accessible_text_get_text_before_offset;
+  iface->get_text_at_offset = exo_icon_view_item_accessible_text_get_text_at_offset;
+  iface->get_text_after_offset = exo_icon_view_item_accessible_text_get_text_after_offset;
+  iface->get_character_count = exo_icon_view_item_accessible_text_get_character_count;
+  iface->get_character_extents = exo_icon_view_item_accessible_text_get_character_extents;
+  iface->get_offset_at_point = exo_icon_view_item_accessible_text_get_offset_at_point;
+}
+
+static void
+exo_icon_view_item_accessible_get_extents (AtkComponent *component,
+                                           gint         *x,
+                                           gint         *y,
+                                           gint         *width,
+                                           gint         *height,
+                                           AtkCoordType  coord_type)
+{
+  ExoIconViewItemAccessible *item;
+  AtkObject *parent_obj;
+  gint l_x, l_y;
+
+  g_return_if_fail (EXO_IS_ICON_VIEW_ITEM_ACCESSIBLE (component));
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (component);
+  if (!GTK_IS_WIDGET (item->widget))
+    return;
+
+  if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
+    return;
+
+  *width = item->item->area.width;
+  *height = item->item->area.height;
+  if (exo_icon_view_item_accessible_is_showing (item))
+    {
+      parent_obj = gtk_widget_get_accessible (item->widget);
+      atk_component_get_position (ATK_COMPONENT (parent_obj), &l_x, &l_y, coord_type);
+      *x = l_x + item->item->area.x;
+      *y = l_y + item->item->area.y;
+    }
+  else
+    {
+      *x = G_MININT;
+      *y = G_MININT;
+    }
+}
+
+static gboolean
+exo_icon_view_item_accessible_grab_focus (AtkComponent *component)
+{
+  ExoIconViewItemAccessible *item;
+  GtkWidget *toplevel;
+
+  g_return_val_if_fail (EXO_IS_ICON_VIEW_ITEM_ACCESSIBLE (component), FALSE);
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (component);
+  if (!GTK_IS_WIDGET (item->widget))
+    return FALSE;
+
+  gtk_widget_grab_focus (item->widget);
+  exo_icon_view_set_cursor_item (EXO_ICON_VIEW (item->widget), item->item, -1);
+  toplevel = gtk_widget_get_toplevel (GTK_WIDGET (item->widget));
+  if (gtk_widget_is_toplevel (toplevel))
+    gtk_window_present (GTK_WINDOW (toplevel));
+
+  return TRUE;
+}
+
+static void
+atk_component_item_interface_init (AtkComponentIface *iface)
+{
+  iface->get_extents = exo_icon_view_item_accessible_get_extents;
+  iface->grab_focus = exo_icon_view_item_accessible_grab_focus;
+}
+
+static gboolean
+exo_icon_view_item_accessible_add_state (ExoIconViewItemAccessible *item,
+                                         AtkStateType               state_type,
+                                         gboolean                   emit_signal)
+{
+  gboolean rc;
+
+  rc = atk_state_set_add_state (item->state_set, state_type);
+  /*
+   * The signal should only be generated if the value changed,
+   * not when the item is set up.  So states that are set
+   * initially should pass FALSE as the emit_signal argument.
+   */
+
+  if (emit_signal)
+    {
+      atk_object_notify_state_change (ATK_OBJECT (item), state_type, TRUE);
+      /* If state_type is ATK_STATE_VISIBLE, additional notification */
+      if (state_type == ATK_STATE_VISIBLE)
+        g_signal_emit_by_name (item, "visible-data-changed");
+    }
+
+  return rc;
+}
+
+static gboolean
+exo_icon_view_item_accessible_remove_state (ExoIconViewItemAccessible *item,
+                                            AtkStateType               state_type,
+                                            gboolean                   emit_signal)
+{
+  if (atk_state_set_contains_state (item->state_set, state_type))
+    {
+      gboolean rc;
+
+      rc = atk_state_set_remove_state (item->state_set, state_type);
+      /*
+       * The signal should only be generated if the value changed,
+       * not when the item is set up.  So states that are set
+       * initially should pass FALSE as the emit_signal argument.
+       */
+
+      if (emit_signal)
+        {
+          atk_object_notify_state_change (ATK_OBJECT (item), state_type, FALSE);
+          /* If state_type is ATK_STATE_VISIBLE, additional notification */
+          if (state_type == ATK_STATE_VISIBLE)
+            g_signal_emit_by_name (item, "visible-data-changed");
+        }
+
+      return rc;
+    }
+  else
+    return FALSE;
+}
+
+static gboolean
+exo_icon_view_item_accessible_is_showing (ExoIconViewItemAccessible *item)
+{
+  ExoIconView *icon_view;
+  GdkRectangle visible_rect;
+  gboolean is_showing;
+
+  /*
+   * An item is considered "SHOWING" if any part of the item is in the
+   * visible rectangle.
+   */
+
+  if (!EXO_IS_ICON_VIEW (item->widget))
+    return FALSE;
+
+  if (item->item == NULL)
+    return FALSE;
+
+  icon_view = EXO_ICON_VIEW (item->widget);
+  visible_rect.x = 0;
+  if (icon_view->priv->hadjustment)
+    visible_rect.x += icon_view->priv->hadjustment->value;
+  visible_rect.y = 0;
+  if (icon_view->priv->hadjustment)
+    visible_rect.y += icon_view->priv->vadjustment->value;
+  visible_rect.width = item->widget->allocation.width;
+  visible_rect.height = item->widget->allocation.height;
+
+  if (((item->item->area.x + item->item->area.width) < visible_rect.x) ||
+     ((item->item->area.y + item->item->area.height) < (visible_rect.y)) ||
+     (item->item->area.x > (visible_rect.x + visible_rect.width)) ||
+     (item->item->area.y > (visible_rect.y + visible_rect.height)))
+    is_showing =  FALSE;
+  else
+    is_showing = TRUE;
+
+  return is_showing;
+}
+
+static gboolean
+exo_icon_view_item_accessible_set_visibility (ExoIconViewItemAccessible *item,
+                                              gboolean                   emit_signal)
+{
+  if (exo_icon_view_item_accessible_is_showing (item))
+    return exo_icon_view_item_accessible_add_state (item, ATK_STATE_SHOWING,
+                                                    emit_signal);
+  else
+    return exo_icon_view_item_accessible_remove_state (item, ATK_STATE_SHOWING,
+                                                       emit_signal);
+}
+
+static void
+exo_icon_view_item_accessible_object_init (ExoIconViewItemAccessible *item)
+{
+  gint i;
+
+  item->state_set = atk_state_set_new ();
+
+  atk_state_set_add_state (item->state_set, ATK_STATE_ENABLED);
+  atk_state_set_add_state (item->state_set, ATK_STATE_FOCUSABLE);
+  atk_state_set_add_state (item->state_set, ATK_STATE_SENSITIVE);
+  atk_state_set_add_state (item->state_set, ATK_STATE_SELECTABLE);
+  atk_state_set_add_state (item->state_set, ATK_STATE_VISIBLE);
+
+  for (i = 0; i < LAST_ACTION; i++)
+    item->action_descriptions[i] = NULL;
+
+  item->image_description = NULL;
+
+  item->action_idle_handler = 0;
+}
+
+static void
+exo_icon_view_item_accessible_finalize (GObject *object)
+{
+  ExoIconViewItemAccessible *item;
+  gint i;
+
+  g_return_if_fail (EXO_IS_ICON_VIEW_ITEM_ACCESSIBLE (object));
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (object);
+
+  if (item->widget)
+    g_object_remove_weak_pointer (G_OBJECT (item->widget), (gpointer) &item->widget);
+
+  if (item->state_set)
+    g_object_unref (item->state_set);
+
+  if (item->text_buffer)
+     g_object_unref (item->text_buffer);
+
+  for (i = 0; i < LAST_ACTION; i++)
+    g_free (item->action_descriptions[i]);
+
+  g_free (item->image_description);
+
+  if (item->action_idle_handler)
+    {
+      g_source_remove (item->action_idle_handler);
+      item->action_idle_handler = 0;
+    }
+
+  G_OBJECT_CLASS (accessible_item_parent_class)->finalize (object);
+}
+
+static AtkObject*
+exo_icon_view_item_accessible_get_parent (AtkObject *obj)
+{
+  ExoIconViewItemAccessible *item;
+
+  g_return_val_if_fail (EXO_IS_ICON_VIEW_ITEM_ACCESSIBLE (obj), NULL);
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (obj);
+
+  if (item->widget)
+    return gtk_widget_get_accessible (item->widget);
+  else
+    return NULL;
+}
+
+static gint
+exo_icon_view_item_accessible_get_index_in_parent (AtkObject *obj)
+{
+  ExoIconViewItemAccessible *item;
+
+  g_return_val_if_fail (EXO_IS_ICON_VIEW_ITEM_ACCESSIBLE (obj), 0);
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (obj);
+
+  return item->item->index; 
+}
+
+static AtkStateSet *
+exo_icon_view_item_accessible_ref_state_set (AtkObject *obj)
+{
+  ExoIconViewItemAccessible *item;
+  ExoIconView *icon_view;
+
+  item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (obj);
+  g_return_val_if_fail (item->state_set, NULL);
+
+  if (!item->widget)
+    return NULL;
+
+  icon_view = EXO_ICON_VIEW (item->widget);
+  if (icon_view->priv->cursor_item == item->item)
+    atk_state_set_add_state (item->state_set, ATK_STATE_FOCUSED);
+  else
+    atk_state_set_remove_state (item->state_set, ATK_STATE_FOCUSED);
+  if (item->item->selected)
+    atk_state_set_add_state (item->state_set, ATK_STATE_SELECTED);
+  else
+    atk_state_set_remove_state (item->state_set, ATK_STATE_SELECTED);
+
+  return g_object_ref (item->state_set);
+}
+
+static void
+exo_icon_view_item_accessible_class_init (AtkObjectClass *klass)
+{
+  GObjectClass *gobject_class;
+
+  accessible_item_parent_class = g_type_class_peek_parent (klass);
+
+  gobject_class = (GObjectClass *)klass;
+
+  gobject_class->finalize = exo_icon_view_item_accessible_finalize;
+
+  klass->get_index_in_parent = exo_icon_view_item_accessible_get_index_in_parent;
+  klass->get_parent = exo_icon_view_item_accessible_get_parent;
+  klass->ref_state_set = exo_icon_view_item_accessible_ref_state_set;
+}
+
+static GType
+exo_icon_view_item_accessible_get_type (void)
+{
+  static GType type = 0;
+
+  if (!type)
+    {
+      const GTypeInfo tinfo =
+      {
+        sizeof (ExoIconViewItemAccessibleClass),
+        (GBaseInitFunc) NULL, /* base init */
+        (GBaseFinalizeFunc) NULL, /* base finalize */
+        (GClassInitFunc) exo_icon_view_item_accessible_class_init, /* class init */
+        (GClassFinalizeFunc) NULL, /* class finalize */
+        NULL, /* class data */
+        sizeof (ExoIconViewItemAccessible), /* instance size */
+        0, /* nb preallocs */
+        (GInstanceInitFunc) exo_icon_view_item_accessible_object_init, /* instance init */
+        NULL /* value table */
+      };
+
+      const GInterfaceInfo atk_component_info =
+      {
+        (GInterfaceInitFunc) atk_component_item_interface_init,
+        (GInterfaceFinalizeFunc) NULL,
+        NULL
+      };
+      const GInterfaceInfo atk_action_info =
+      {
+        (GInterfaceInitFunc) atk_action_item_interface_init,
+        (GInterfaceFinalizeFunc) NULL,
+        NULL
+      };
+      const GInterfaceInfo atk_image_info =
+      {
+        (GInterfaceInitFunc) atk_image_item_interface_init,
+        (GInterfaceFinalizeFunc) NULL,
+        NULL
+      };
+      const GInterfaceInfo atk_text_info =
+      {
+        (GInterfaceInitFunc) atk_text_item_interface_init,
+        (GInterfaceFinalizeFunc) NULL,
+        NULL
+      };
+
+      type = g_type_register_static (ATK_TYPE_OBJECT,
+                                     I_("ExoIconViewItemAccessible"), &tinfo, 0);
+      g_type_add_interface_static (type, ATK_TYPE_COMPONENT,
+                                   &atk_component_info);
+      g_type_add_interface_static (type, ATK_TYPE_ACTION,
+                                   &atk_action_info);
+      g_type_add_interface_static (type, ATK_TYPE_IMAGE,
+                                   &atk_image_info);
+      g_type_add_interface_static (type, ATK_TYPE_TEXT,
+                                   &atk_text_info);
+    }
+
+  return type;
+}
+
+#define GTK_TYPE_ICON_VIEW_ACCESSIBLE      (exo_icon_view_accessible_get_type ())
+#define EXO_ICON_VIEW_ACCESSIBLE(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_VIEW_ACCESSIBLE, ExoIconViewAccessible))
+#define EXO_IS_ICON_VIEW_ACCESSIBLE(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_VIEW_ACCESSIBLE))
+
+static GType exo_icon_view_accessible_get_type (void);
+
+typedef struct
+{
+   AtkObject parent;
+} ExoIconViewAccessible;
+
+typedef struct
+{
+  AtkObject *item;
+  gint       index;
+} ExoIconViewItemAccessibleInfo;
+
+typedef struct
+{
+  GList *items;
+
+  GtkAdjustment *old_hadj;
+  GtkAdjustment *old_vadj;
+
+  GtkTreeModel *model;
+
+} ExoIconViewAccessiblePrivate;
+
+static ExoIconViewAccessiblePrivate *
+exo_icon_view_accessible_get_priv (AtkObject *accessible)
+{
+  return g_object_get_qdata (G_OBJECT (accessible),
+                             accessible_private_data_quark);
+}
+
+static void
+exo_icon_view_item_accessible_info_new (AtkObject *accessible,
+                                        AtkObject *item,
+                                        gint       index)
+{
+  ExoIconViewItemAccessibleInfo *info;
+  ExoIconViewItemAccessibleInfo *tmp_info;
+  ExoIconViewAccessiblePrivate *priv;
+  GList *items;
+
+  info = g_new (ExoIconViewItemAccessibleInfo, 1);
+  info->item = item;
+  info->index = index;
+
+  priv = exo_icon_view_accessible_get_priv (accessible);
+  items = priv->items;
+  while (items)
+    {
+      tmp_info = items->data;
+      if (tmp_info->index > index)
+        break;
+      items = items->next;
+    }
+  priv->items = g_list_insert_before (priv->items, items, info);
+  priv->old_hadj = NULL;
+  priv->old_vadj = NULL;
+}
+
+static gint
+exo_icon_view_accessible_get_n_children (AtkObject *accessible)
+{
+  ExoIconView *icon_view;
+  GtkWidget *widget;
+
+  widget = GTK_ACCESSIBLE (accessible)->widget;
+  if (!widget)
+      return 0;
+
+  icon_view = EXO_ICON_VIEW (widget);
+
+  return g_list_length (icon_view->priv->items);
+}
+
+static AtkObject *
+exo_icon_view_accessible_find_child (AtkObject *accessible,
+                                     gint       index)
+{
+  ExoIconViewAccessiblePrivate *priv;
+  ExoIconViewItemAccessibleInfo *info;
+  GList *items;
+
+  priv = exo_icon_view_accessible_get_priv (accessible);
+  items = priv->items;
+
+  while (items)
+    {
+      info = items->data;
+      if (info->index == index)
+        return info->item;
+      items = items->next; 
+    }
+  return NULL;
+}
+
+static AtkObject *
+exo_icon_view_accessible_ref_child (AtkObject *accessible,
+                                    gint       index)
+{
+  ExoIconView *icon_view;
+  GtkWidget *widget;
+  GList *icons;
+  AtkObject *obj;
+  ExoIconViewItemAccessible *a11y_item;
+
+  widget = GTK_ACCESSIBLE (accessible)->widget;
+  if (!widget)
+    return NULL;
+
+  icon_view = EXO_ICON_VIEW (widget);
+  icons = g_list_nth (icon_view->priv->items, index);
+  obj = NULL;
+  if (icons)
+    {
+      ExoIconViewItem *item = icons->data;
+   
+      g_return_val_if_fail (item->index == index, NULL);
+      obj = exo_icon_view_accessible_find_child (accessible, index);
+      if (!obj)
+        {
+          gchar *text;
+
+          obj = g_object_new (exo_icon_view_item_accessible_get_type (), NULL);
+          exo_icon_view_item_accessible_info_new (accessible,
+                                                  obj,
+                                                  index);
+          obj->role = ATK_ROLE_ICON;
+          a11y_item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (obj);
+          a11y_item->item = item;
+          a11y_item->widget = widget;
+          a11y_item->text_buffer = gtk_text_buffer_new (NULL);
+
+          exo_icon_view_set_cell_data (icon_view, item);
+          text = get_text (icon_view, item);
+          if (text)
+            {
+              gtk_text_buffer_set_text (a11y_item->text_buffer, text, -1);
+              g_free (text);
+            } 
+
+          exo_icon_view_item_accessible_set_visibility (a11y_item, FALSE);
+          g_object_add_weak_pointer (G_OBJECT (widget), (gpointer) &(a11y_item->widget));
+       }
+      g_object_ref (obj);
+    }
+  return obj;
+}
+
+static void
+exo_icon_view_accessible_traverse_items (ExoIconViewAccessible *view,
+                                         GList                 *list)
+{
+  ExoIconViewAccessiblePrivate *priv;
+  ExoIconViewItemAccessibleInfo *info;
+  ExoIconViewItemAccessible *item;
+  GList *items;
+  
+  priv =  exo_icon_view_accessible_get_priv (ATK_OBJECT (view));
+  if (priv->items)
+    {
+      GtkWidget *widget;
+      gboolean act_on_item;
+
+      widget = GTK_ACCESSIBLE (view)->widget;
+      if (widget == NULL)
+        return;
+
+      items = priv->items;
+
+      act_on_item = (list == NULL);
+
+      while (items)
+        {
+
+          info = (ExoIconViewItemAccessibleInfo *)items->data;
+          item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (info->item);
+
+          if (act_on_item == FALSE && list == items)
+            act_on_item = TRUE;
+
+          if (act_on_item)
+            exo_icon_view_item_accessible_set_visibility (item, TRUE);
+
+          items = items->next;
+       }
+   }
+}
+
+static void
+exo_icon_view_accessible_adjustment_changed (GtkAdjustment *adjustment,
+                                             ExoIconView   *icon_view)
+{
+  AtkObject *obj;
+  ExoIconViewAccessible *view;
+
+  /*
+   * The scrollbars have changed
+   */
+  obj = gtk_widget_get_accessible (GTK_WIDGET (icon_view));
+  view = EXO_ICON_VIEW_ACCESSIBLE (obj);
+
+  exo_icon_view_accessible_traverse_items (view, NULL);
+}
+
+static void
+exo_icon_view_accessible_set_scroll_adjustments (GtkWidget      *widget,
+                                                 GtkAdjustment *hadj,
+                                                 GtkAdjustment *vadj)
+{
+  AtkObject *atk_obj;
+  ExoIconViewAccessiblePrivate *priv;
+
+  atk_obj = gtk_widget_get_accessible (widget);
+  priv = exo_icon_view_accessible_get_priv (atk_obj);
+
+  if (priv->old_hadj != hadj)
+    {
+      if (priv->old_hadj)
+        {
+          g_object_remove_weak_pointer (G_OBJECT (priv->old_hadj),
+                                        (gpointer *)&priv->old_hadj);
+          
+          g_signal_handlers_disconnect_by_func (priv->old_hadj,
+                                                (gpointer) exo_icon_view_accessible_adjustment_changed,
+                                                widget);
+        }
+      priv->old_hadj = hadj;
+      if (priv->old_hadj)
+        {
+          g_object_add_weak_pointer (G_OBJECT (priv->old_hadj),
+                                     (gpointer *)&priv->old_hadj);
+          g_signal_connect (hadj,
+                            "value-changed",
+                            G_CALLBACK (exo_icon_view_accessible_adjustment_changed),
+                            widget);
+        }
+    }
+  if (priv->old_vadj != vadj)
+    {
+      if (priv->old_vadj)
+        {
+          g_object_remove_weak_pointer (G_OBJECT (priv->old_vadj),
+                                        (gpointer *)&priv->old_vadj);
+          
+          g_signal_handlers_disconnect_by_func (priv->old_vadj,
+                                                (gpointer) exo_icon_view_accessible_adjustment_changed,
+                                                widget);
+        }
+      priv->old_vadj = vadj;
+      if (priv->old_vadj)
+        {
+          g_object_add_weak_pointer (G_OBJECT (priv->old_vadj),
+                                     (gpointer *)&priv->old_vadj);
+          g_signal_connect (vadj,
+                            "value-changed",
+                            G_CALLBACK (exo_icon_view_accessible_adjustment_changed),
+                            widget);
+        }
+    }
+}
+
+static void
+exo_icon_view_accessible_model_row_changed (GtkTreeModel *tree_model,
+                                            GtkTreePath  *path,
+                                            GtkTreeIter  *iter,
+                                            gpointer      user_data)
+{
+  AtkObject *atk_obj;
+  gint index;
+  GtkWidget *widget;
+  ExoIconView *icon_view;
+  ExoIconViewItem *item;
+  ExoIconViewItemAccessible *a11y_item;
+  const gchar *name;
+  gchar *text;
+
+  atk_obj = gtk_widget_get_accessible (GTK_WIDGET (user_data));
+  index = gtk_tree_path_get_indices(path)[0];
+  a11y_item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (
+      exo_icon_view_accessible_find_child (atk_obj, index));
+
+  if (a11y_item)
+    {
+      widget = GTK_ACCESSIBLE (atk_obj)->widget;
+      icon_view = EXO_ICON_VIEW (widget);
+      item = a11y_item->item;
+
+      name = atk_object_get_name (ATK_OBJECT (a11y_item));
+
+      if (!name || strcmp (name, "") == 0)
+        {
+          exo_icon_view_set_cell_data (icon_view, item);
+          text = get_text (icon_view, item);
+          if (text)
+            {
+              gtk_text_buffer_set_text (a11y_item->text_buffer, text, -1);
+              g_free (text);
+            }
+        }
+    }
+
+  g_signal_emit_by_name (atk_obj, "visible-data-changed");
+
+  return;
+}
+
+static void
+exo_icon_view_accessible_model_row_inserted (GtkTreeModel *tree_model,
+                                             GtkTreePath  *path,
+                                             GtkTreeIter  *iter,
+                                             gpointer     user_data)
+{
+  ExoIconViewAccessiblePrivate *priv;
+  ExoIconViewItemAccessibleInfo *info;
+  ExoIconViewAccessible *view;
+  ExoIconViewItemAccessible *item;
+  GList *items;
+  GList *tmp_list;
+  AtkObject *atk_obj;
+  gint index;
+
+  index = gtk_tree_path_get_indices(path)[0];
+  atk_obj = gtk_widget_get_accessible (GTK_WIDGET (user_data));
+  view = EXO_ICON_VIEW_ACCESSIBLE (atk_obj);
+  priv = exo_icon_view_accessible_get_priv (atk_obj);
+
+  items = priv->items;
+  tmp_list = NULL;
+  while (items)
+    {
+      info = items->data;
+      item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (info->item);
+      if (info->index != item->item->index)
+        {
+          if (info->index < index)
+            g_warning ("Unexpected index value on insertion %d %d", index, info->index);
+ 
+          if (tmp_list == NULL)
+            tmp_list = items;
+   
+          info->index = item->item->index;
+        }
+
+      items = items->next;
+    }
+  exo_icon_view_accessible_traverse_items (view, tmp_list);
+  g_signal_emit_by_name (atk_obj, "children-changed::add",
+                         index, NULL, NULL);
+  return;
+}
+
+static void
+exo_icon_view_accessible_model_row_deleted (GtkTreeModel *tree_model,
+                                            GtkTreePath  *path,
+                                            gpointer     user_data)
+{
+  ExoIconViewAccessiblePrivate *priv;
+  ExoIconViewItemAccessibleInfo *info;
+  ExoIconViewAccessible *view;
+  ExoIconViewItemAccessible *item;
+  GList *items;
+  GList *tmp_list;
+  GList *deleted_item;
+  AtkObject *atk_obj;
+  gint index;
+
+  index = gtk_tree_path_get_indices(path)[0];
+  atk_obj = gtk_widget_get_accessible (GTK_WIDGET (user_data));
+  view = EXO_ICON_VIEW_ACCESSIBLE (atk_obj);
+  priv = exo_icon_view_accessible_get_priv (atk_obj);
+
+  items = priv->items;
+  tmp_list = NULL;
+  deleted_item = NULL;
+  info = NULL;
+  while (items)
+    {
+      info = items->data;
+      item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (info->item);
+      if (info->index == index)
+        {
+          deleted_item = items;
+        }
+      if (info->index != item->item->index)
+        {
+          if (tmp_list == NULL)
+            tmp_list = items;
+            
+          info->index = item->item->index;
+        }
+
+      items = items->next;
+    }
+  exo_icon_view_accessible_traverse_items (view, tmp_list);
+  if (deleted_item)
+    {
+      info = deleted_item->data;
+      exo_icon_view_item_accessible_add_state (EXO_ICON_VIEW_ITEM_ACCESSIBLE (info->item), ATK_STATE_DEFUNCT, TRUE);
+      g_signal_emit_by_name (atk_obj, "children-changed::remove",
+                             index, NULL, NULL);
+      priv->items = g_list_remove_link (priv->items, deleted_item);
+      g_free (info);
+    }
+
+  return;
+}
+
+static gint
+exo_icon_view_accessible_item_compare (ExoIconViewItemAccessibleInfo *i1,
+                                       ExoIconViewItemAccessibleInfo *i2)
+{
+  return i1->index - i2->index;
+}
+
+static void
+exo_icon_view_accessible_model_rows_reordered (GtkTreeModel *tree_model,
+                                               GtkTreePath  *path,
+                                               GtkTreeIter  *iter,
+                                               gint         *new_order,
+                                               gpointer     user_data)
+{
+  ExoIconViewAccessiblePrivate *priv;
+  ExoIconViewItemAccessibleInfo *info;
+  ExoIconView *icon_view;
+  ExoIconViewItemAccessible *item;
+  GList *items;
+  AtkObject *atk_obj;
+  gint *order;
+  gint length, i;
+
+  atk_obj = gtk_widget_get_accessible (GTK_WIDGET (user_data));
+  icon_view = EXO_ICON_VIEW (user_data);
+  priv = exo_icon_view_accessible_get_priv (atk_obj);
+
+  length = gtk_tree_model_iter_n_children (tree_model, NULL);
+
+  order = g_new (gint, length);
+  for (i = 0; i < length; i++)
+    order [new_order[i]] = i;
+
+  items = priv->items;
+  while (items)
+    {
+      info = items->data;
+      item = EXO_ICON_VIEW_ITEM_ACCESSIBLE (info->item);
+      info->index = order[info->index];
+      item->item = g_list_nth_data (icon_view->priv->items, info->index);
+      items = items->next;
+    }
+  g_free (order);
+  priv->items = g_list_sort (priv->items, 
+                             (GCompareFunc)exo_icon_view_accessible_item_compare);
+
+  return;
+}
+
+static void
+exo_icon_view_accessible_disconnect_model_signals (GtkTreeModel *model,
+                                                   GtkWidget *widget)
+{
+  GObject *obj;
+
+  obj = G_OBJECT (model);
+  g_signal_handlers_disconnect_by_func (obj, (gpointer) exo_icon_view_accessible_model_row_changed, widget);
+  g_signal_handlers_disconnect_by_func (obj, (gpointer) exo_icon_view_accessible_model_row_inserted, widget);
+  g_signal_handlers_disconnect_by_func (obj, (gpointer) exo_icon_view_accessible_model_row_deleted, widget);
+  g_signal_handlers_disconnect_by_func (obj, (gpointer) exo_icon_view_accessible_model_rows_reordered, widget);
+}
+
+static void
+exo_icon_view_accessible_connect_model_signals (ExoIconView *icon_view)
+{
+  GObject *obj;
+
+  obj = G_OBJECT (icon_view->priv->model);
+  g_signal_connect_data (obj, "row-changed",
+                         (GCallback) exo_icon_view_accessible_model_row_changed,
+                         icon_view, NULL, 0);
+  g_signal_connect_data (obj, "row-inserted",
+                         (GCallback) exo_icon_view_accessible_model_row_inserted, 
+                         icon_view, NULL, G_CONNECT_AFTER);
+  g_signal_connect_data (obj, "row-deleted",
+                         (GCallback) exo_icon_view_accessible_model_row_deleted, 
+                         icon_view, NULL, G_CONNECT_AFTER);
+  g_signal_connect_data (obj, "rows-reordered",
+                         (GCallback) exo_icon_view_accessible_model_rows_reordered, 
+                         icon_view, NULL, G_CONNECT_AFTER);
+}
+
+static void
+exo_icon_view_accessible_clear_cache (ExoIconViewAccessiblePrivate *priv)
+{
+  ExoIconViewItemAccessibleInfo *info;
+  GList *items;
+
+  items = priv->items;
+  while (items)
+    {
+      info = (ExoIconViewItemAccessibleInfo *) items->data;
+      g_object_unref (info->item);
+      g_free (items->data);
+      items = items->next;
+    }
+  g_list_free (priv->items);
+  priv->items = NULL;
+}
+
+static void
+exo_icon_view_accessible_notify_gtk (GObject *obj,
+                                     GParamSpec *pspec)
+{
+  ExoIconView *icon_view;
+  GtkWidget *widget;
+  AtkObject *atk_obj;
+  ExoIconViewAccessiblePrivate *priv;
+
+  if (strcmp (pspec->name, "model") == 0)
+    {
+      widget = GTK_WIDGET (obj); 
+      atk_obj = gtk_widget_get_accessible (widget);
+      priv = exo_icon_view_accessible_get_priv (atk_obj);
+      if (priv->model)
+        {
+          g_object_remove_weak_pointer (G_OBJECT (priv->model),
+                                        (gpointer *)&priv->model);
+          exo_icon_view_accessible_disconnect_model_signals (priv->model, widget);
+        }
+      exo_icon_view_accessible_clear_cache (priv);
+
+      icon_view = EXO_ICON_VIEW (obj);
+      priv->model = icon_view->priv->model;
+      /* If there is no model the ExoIconView is probably being destroyed */
+      if (priv->model)
+        {
+          g_object_add_weak_pointer (G_OBJECT (priv->model), (gpointer *)&priv->model);
+          exo_icon_view_accessible_connect_model_signals (icon_view);
+        }
+    }
+
+  return;
+}
+
+static void
+exo_icon_view_accessible_initialize (AtkObject *accessible,
+                                     gpointer   data)
+{
+  ExoIconViewAccessiblePrivate *priv;
+  ExoIconView *icon_view;
+
+  if (ATK_OBJECT_CLASS (accessible_parent_class)->initialize)
+    ATK_OBJECT_CLASS (accessible_parent_class)->initialize (accessible, data);
+
+  priv = g_new0 (ExoIconViewAccessiblePrivate, 1);
+  g_object_set_qdata (G_OBJECT (accessible),
+                      accessible_private_data_quark,
+                      priv);
+
+  icon_view = EXO_ICON_VIEW (data);
+  if (icon_view->priv->hadjustment)
+    {
+      priv->old_hadj = icon_view->priv->hadjustment;
+      g_object_add_weak_pointer (G_OBJECT (priv->old_hadj), (gpointer *)&priv->old_hadj);
+      g_signal_connect (icon_view->priv->hadjustment,
+                        "value-changed",
+                        G_CALLBACK (exo_icon_view_accessible_adjustment_changed),
+                        icon_view);
+    } 
+  if (icon_view->priv->vadjustment)
+    {
+      priv->old_vadj = icon_view->priv->vadjustment;
+      g_object_add_weak_pointer (G_OBJECT (priv->old_vadj), (gpointer *)&priv->old_vadj);
+      g_signal_connect (icon_view->priv->vadjustment,
+                        "value-changed",
+                        G_CALLBACK (exo_icon_view_accessible_adjustment_changed),
+                        icon_view);
+    }
+  g_signal_connect_after (data,
+                          "set-scroll-adjustments",
+                          G_CALLBACK (exo_icon_view_accessible_set_scroll_adjustments),
+                          NULL);
+  g_signal_connect (data,
+                    "notify",
+                    G_CALLBACK (exo_icon_view_accessible_notify_gtk),
+                    NULL);
+
+  priv->model = icon_view->priv->model;
+  if (priv->model)
+    {
+      g_object_add_weak_pointer (G_OBJECT (priv->model), (gpointer *)&priv->model);
+      exo_icon_view_accessible_connect_model_signals (icon_view);
+    }
+                          
+  accessible->role = ATK_ROLE_LAYERED_PANE;
+}
+
+static void
+exo_icon_view_accessible_finalize (GObject *object)
+{
+  ExoIconViewAccessiblePrivate *priv;
+
+  priv = exo_icon_view_accessible_get_priv (ATK_OBJECT (object));
+  exo_icon_view_accessible_clear_cache (priv);
+
+  g_free (priv);
+
+  G_OBJECT_CLASS (accessible_parent_class)->finalize (object);
+}
+
+static void
+exo_icon_view_accessible_destroyed (GtkWidget *widget,
+                                    GtkAccessible *accessible)
+{
+  AtkObject *atk_obj;
+  ExoIconViewAccessiblePrivate *priv;
+
+  atk_obj = ATK_OBJECT (accessible);
+  priv = exo_icon_view_accessible_get_priv (atk_obj);
+  if (priv->old_hadj)
+    {
+      g_object_remove_weak_pointer (G_OBJECT (priv->old_hadj),
+                                    (gpointer *)&priv->old_hadj);
+          
+      g_signal_handlers_disconnect_by_func (priv->old_hadj,
+                                            (gpointer) exo_icon_view_accessible_adjustment_changed,
+                                            widget);
+      priv->old_hadj = NULL;
+    }
+  if (priv->old_vadj)
+    {
+      g_object_remove_weak_pointer (G_OBJECT (priv->old_vadj),
+                                    (gpointer *)&priv->old_vadj);
+          
+      g_signal_handlers_disconnect_by_func (priv->old_vadj,
+                                            (gpointer) exo_icon_view_accessible_adjustment_changed,
+                                            widget);
+      priv->old_vadj = NULL;
+    }
+}
+
+static void
+exo_icon_view_accessible_connect_widget_destroyed (GtkAccessible *accessible)
+{
+  if (accessible->widget)
+    {
+      g_signal_connect_after (accessible->widget,
+                              "destroy",
+                              G_CALLBACK (exo_icon_view_accessible_destroyed),
+                              accessible);
+    }
+  GTK_ACCESSIBLE_CLASS (accessible_parent_class)->connect_widget_destroyed (accessible);
+}
+
+static void
+exo_icon_view_accessible_class_init (AtkObjectClass *klass)
+{
+  GObjectClass *gobject_class;
+  GtkAccessibleClass *accessible_class;
+
+  accessible_parent_class = g_type_class_peek_parent (klass);
+
+  gobject_class = (GObjectClass *)klass;
+  accessible_class = (GtkAccessibleClass *)klass;
+
+  gobject_class->finalize = exo_icon_view_accessible_finalize;
+
+  klass->get_n_children = exo_icon_view_accessible_get_n_children;
+  klass->ref_child = exo_icon_view_accessible_ref_child;
+  klass->initialize = exo_icon_view_accessible_initialize;
+
+  accessible_class->connect_widget_destroyed = exo_icon_view_accessible_connect_widget_destroyed;
+
+  accessible_private_data_quark = g_quark_from_static_string ("icon_view-accessible-private-data");
+}
+
+static AtkObject*
+exo_icon_view_accessible_ref_accessible_at_point (AtkComponent *component,
+                                                  gint          x,
+                                                  gint          y,
+                                                  AtkCoordType  coord_type)
+{
+  GtkWidget *widget;
+  ExoIconView *icon_view;
+  ExoIconViewItem *item;
+  gint x_pos, y_pos;
+
+  widget = GTK_ACCESSIBLE (component)->widget;
+  if (widget == NULL)
+  /* State is defunct */
+    return NULL;
+
+  icon_view = EXO_ICON_VIEW (widget);
+  atk_component_get_extents (component, &x_pos, &y_pos, NULL, NULL, coord_type);
+  item = exo_icon_view_get_item_at_coords (icon_view, x - x_pos, y - y_pos, TRUE, NULL);
+  if (item)
+    return exo_icon_view_accessible_ref_child (ATK_OBJECT (component), item->index);
+
+  return NULL;
+}
+
+static void
+atk_component_interface_init (AtkComponentIface *iface)
+{
+  iface->ref_accessible_at_point = exo_icon_view_accessible_ref_accessible_at_point;
+}
+
+static gboolean
+exo_icon_view_accessible_add_selection (AtkSelection *selection,
+                                        gint i)
+{
+  GtkWidget *widget;
+  ExoIconView *icon_view;
+  ExoIconViewItem *item;
+
+  widget = GTK_ACCESSIBLE (selection)->widget;
+  if (widget == NULL)
+    return FALSE;
+
+  icon_view = EXO_ICON_VIEW (widget);
+
+  item = g_list_nth_data (icon_view->priv->items, i);
+
+  if (!item)
+    return FALSE;
+
+  exo_icon_view_select_item (icon_view, item);
+
+  return TRUE;
+}
+
+static gboolean
+exo_icon_view_accessible_clear_selection (AtkSelection *selection)
+{
+  GtkWidget *widget;
+  ExoIconView *icon_view;
+
+  widget = GTK_ACCESSIBLE (selection)->widget;
+  if (widget == NULL)
+    return FALSE;
+
+  icon_view = EXO_ICON_VIEW (widget);
+  exo_icon_view_unselect_all (icon_view);
+
+  return TRUE;
+}
+
+static AtkObject*
+exo_icon_view_accessible_ref_selection (AtkSelection *selection,
+                                        gint          i)
+{
+  GList *l;
+  GtkWidget *widget;
+  ExoIconView *icon_view;
+  ExoIconViewItem *item;
+
+  widget = GTK_ACCESSIBLE (selection)->widget;
+  if (widget == NULL)
+    return NULL;
+
+  icon_view = EXO_ICON_VIEW (widget);
+
+  l = icon_view->priv->items;
+  while (l)
+    {
+      item = l->data;
+      if (item->selected)
+        {
+          if (i == 0)
+            return atk_object_ref_accessible_child (gtk_widget_get_accessible (widget), item->index);
+          else
+            i--;
+        }
+      l = l->next;
+    }
+
+  return NULL;
+}
+
+static gint
+exo_icon_view_accessible_get_selection_count (AtkSelection *selection)
+{
+  GtkWidget *widget;
+  ExoIconView *icon_view;
+  ExoIconViewItem *item;
+  GList *l;
+  gint count;
+
+  widget = GTK_ACCESSIBLE (selection)->widget;
+  if (widget == NULL)
+    return 0;
+
+  icon_view = EXO_ICON_VIEW (widget);
+
+  l = icon_view->priv->items;
+  count = 0;
+  while (l)
+    {
+      item = l->data;
+
+      if (item->selected)
+        count++;
+
+      l = l->next;
+    }
+
+  return count;
+}
+
+static gboolean
+exo_icon_view_accessible_is_child_selected (AtkSelection *selection,
+                                            gint          i)
+{
+  GtkWidget *widget;
+  ExoIconView *icon_view;
+  ExoIconViewItem *item;
+
+  widget = GTK_ACCESSIBLE (selection)->widget;
+  if (widget == NULL)
+    return FALSE;
+
+  icon_view = EXO_ICON_VIEW (widget);
+
+  item = g_list_nth_data (icon_view->priv->items, i);
+  if (!item)
+    return FALSE;
+
+  return item->selected;
+}
+
+static gboolean
+exo_icon_view_accessible_remove_selection (AtkSelection *selection,
+                                           gint          i)
+{
+  GtkWidget *widget;
+  ExoIconView *icon_view;
+  ExoIconViewItem *item;
+  GList *l;
+  gint count;
+
+  widget = GTK_ACCESSIBLE (selection)->widget;
+  if (widget == NULL)
+    return FALSE;
+
+  icon_view = EXO_ICON_VIEW (widget);
+  l = icon_view->priv->items;
+  count = 0;
+  while (l)
+    {
+      item = l->data;
+      if (item->selected)
+        {
+          if (count == i)
+            {
+              exo_icon_view_unselect_item (icon_view, item);
+              return TRUE;
+            }
+          count++;
+        }
+      l = l->next;
+    }
+
+  return FALSE;
+}
+ 
+static gboolean
+exo_icon_view_accessible_select_all_selection (AtkSelection *selection)
+{
+  GtkWidget *widget;
+  ExoIconView *icon_view;
+
+  widget = GTK_ACCESSIBLE (selection)->widget;
+  if (widget == NULL)
+    return FALSE;
+
+  icon_view = EXO_ICON_VIEW (widget);
+  exo_icon_view_select_all (icon_view);
+  return TRUE;
+}
+
+static void
+exo_icon_view_accessible_selection_interface_init (AtkSelectionIface *iface)
+{
+  iface->add_selection = exo_icon_view_accessible_add_selection;
+  iface->clear_selection = exo_icon_view_accessible_clear_selection;
+  iface->ref_selection = exo_icon_view_accessible_ref_selection;
+  iface->get_selection_count = exo_icon_view_accessible_get_selection_count;
+  iface->is_child_selected = exo_icon_view_accessible_is_child_selected;
+  iface->remove_selection = exo_icon_view_accessible_remove_selection;
+  iface->select_all_selection = exo_icon_view_accessible_select_all_selection;
+}
+
+static GType
+exo_icon_view_accessible_get_type (void)
+{
+  static GType type = 0;
+
+  if (!type)
+    {
+      GTypeInfo tinfo =
+      {
+        0, /* class size */
+        (GBaseInitFunc) NULL, /* base init */
+        (GBaseFinalizeFunc) NULL, /* base finalize */
+        (GClassInitFunc) exo_icon_view_accessible_class_init,
+        (GClassFinalizeFunc) NULL, /* class finalize */
+        NULL, /* class data */
+        0, /* instance size */
+        0, /* nb preallocs */
+        (GInstanceInitFunc) NULL, /* instance init */
+        NULL /* value table */
+      };
+      const GInterfaceInfo atk_component_info =
+      {
+        (GInterfaceInitFunc) atk_component_interface_init,
+        (GInterfaceFinalizeFunc) NULL,
+        NULL
+      };
+      const GInterfaceInfo atk_selection_info =
+      {
+        (GInterfaceInitFunc) exo_icon_view_accessible_selection_interface_init,
+        (GInterfaceFinalizeFunc) NULL,
+        NULL
+      };
+
+      /*
+       * Figure out the size of the class and instance
+       * we are deriving from
+       */
+      AtkObjectFactory *factory;
+      GType derived_type;
+      GTypeQuery query;
+      GType derived_atk_type;
+
+      derived_type = g_type_parent (GTK_TYPE_ICON_VIEW);
+      factory = atk_registry_get_factory (atk_get_default_registry (), 
+                                          derived_type);
+      derived_atk_type = atk_object_factory_get_accessible_type (factory);
+      g_type_query (derived_atk_type, &query);
+      tinfo.class_size = query.class_size;
+      tinfo.instance_size = query.instance_size;
+ 
+      type = g_type_register_static (derived_atk_type, 
+                                     I_("ExoIconViewAccessible"), 
+                                     &tinfo, 0);
+      g_type_add_interface_static (type, ATK_TYPE_COMPONENT,
+                                   &atk_component_info);
+      g_type_add_interface_static (type, ATK_TYPE_SELECTION,
+                                   &atk_selection_info);
+    }
+  return type;
+}
+
+static AtkObject *
+exo_icon_view_accessible_new (GObject *obj)
+{
+  AtkObject *accessible;
+
+  g_return_val_if_fail (GTK_IS_WIDGET (obj), NULL);
+
+  accessible = g_object_new (exo_icon_view_accessible_get_type (), NULL);
+  atk_object_initialize (accessible, obj);
+
+  return accessible;
+}
+
+static GType
+exo_icon_view_accessible_factory_get_accessible_type (void)
+{
+  return exo_icon_view_accessible_get_type ();
+}
+
+static AtkObject*
+exo_icon_view_accessible_factory_create_accessible (GObject *obj)
+{
+  return exo_icon_view_accessible_new (obj);
+}
+
+static void
+exo_icon_view_accessible_factory_class_init (AtkObjectFactoryClass *klass)
+{
+  klass->create_accessible = exo_icon_view_accessible_factory_create_accessible;
+  klass->get_accessible_type = exo_icon_view_accessible_factory_get_accessible_type;
+}
+
+
+static GType
+exo_icon_view_accessible_factory_get_type (void)
+{
+  static GType type = 0;
+
+  if (!type)
+    {
+      const GTypeInfo tinfo =
+      {
+        sizeof (AtkObjectFactoryClass),
+        NULL,           /* base_init */
+        NULL,           /* base_finalize */
+        (GClassInitFunc) exo_icon_view_accessible_factory_class_init,
+        NULL,           /* class_finalize */
+        NULL,           /* class_data */
+        sizeof (AtkObjectFactory),
+        0,             /* n_preallocs */
+        NULL, NULL
+      };
+
+      type = g_type_register_static (ATK_TYPE_OBJECT_FACTORY, 
+                                    I_("ExoIconViewAccessibleFactory"),
+                                    &tinfo, 0);
+    }
+  return type;
+}
diff --git a/exo/exo-icon-view.c b/exo/exo-icon-view.c
index 050b8be..3f6f4c5 100644
--- a/exo/exo-icon-view.c
+++ b/exo/exo-icon-view.c
@@ -427,6 +427,9 @@ struct _ExoIconViewItem
    */
   GdkRectangle area;
 
+  /* position of the item in the list */
+  gint index;
+
   /* Individual cells.
    * box[i] is the actual area occupied by cell i,
    * before, after are used to calculate the cell
@@ -568,6 +571,10 @@ struct _ExoIconViewPrivate
 
 
 
+#include <exo/exo-icon-view-accessible.c>
+
+
+
 static guint icon_view_signals[LAST_SIGNAL];
 
 
@@ -575,7 +582,34 @@ static guint icon_view_signals[LAST_SIGNAL];
 G_DEFINE_TYPE_WITH_CODE (ExoIconView, exo_icon_view, GTK_TYPE_CONTAINER,
     G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT, exo_icon_view_cell_layout_init))
 
+static AtkObject *
+exo_icon_view_get_accessible (GtkWidget *widget)
+{
+  static gboolean initited = FALSE;
+  GType derived_type; 
+  AtkObjectFactory *factory;
+  AtkRegistry *registry;
+  GType derived_atk_type;
+  
+  if (!initited)
+    {
+      derived_type = g_type_parent (EXO_TYPE_ICON_VIEW);
+
+      registry = atk_get_default_registry ();
+      factory = atk_registry_get_factory (registry, derived_type);
+      derived_atk_type = atk_object_factory_get_accessible_type (factory);
 
+      if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE))
+        {
+          atk_registry_set_factory_type (registry, EXO_TYPE_ICON_VIEW,
+                                         exo_icon_view_accessible_factory_get_type ());
+        }
+
+      initited = TRUE;
+    }
+
+  return GTK_WIDGET_CLASS (exo_icon_view_parent_class)->get_accessible (widget);
+}
 
 static void
 exo_icon_view_class_init (ExoIconViewClass *klass)
@@ -600,6 +634,7 @@ exo_icon_view_class_init (ExoIconViewClass *klass)
   gtkwidget_class->size_request = exo_icon_view_size_request;
   gtkwidget_class->size_allocate = exo_icon_view_size_allocate;
   gtkwidget_class->style_set = exo_icon_view_style_set;
+  gtkwidget_class->get_accessible = exo_icon_view_get_accessible;
   gtkwidget_class->expose_event = exo_icon_view_expose_event;
   gtkwidget_class->motion_notify_event = exo_icon_view_motion_notify_event;
   gtkwidget_class->button_press_event = exo_icon_view_button_press_event;
@@ -1696,8 +1731,10 @@ exo_icon_view_expose_event (GtkWidget      *widget,
       if (G_LIKELY (gdk_region_rect_in (event->region, &item->area) != GDK_OVERLAP_RECTANGLE_OUT))
         {
           exo_icon_view_paint_item (icon_view, item, &event_area, event->window, item->area.x, item->area.y, TRUE);
-          if (G_UNLIKELY (dest_index >= 0 && dest_item == NULL && dest_index == g_list_index (priv->items, item)))
-            dest_item = item;
+          if (G_UNLIKELY (dest_index >= 0 && dest_item == NULL)) {
+                  
+           if (dest_index == g_list_index (priv->items, item))
+            dest_item = item;}
         }
     }
 
@@ -3871,6 +3908,7 @@ exo_icon_view_row_inserted (GtkTreeModel *model,
 {
   ExoIconViewItem *item;
   gint             idx;
+  GList           *list;
 
   idx = gtk_tree_path_get_indices (path)[0];
 
@@ -3878,8 +3916,17 @@ exo_icon_view_row_inserted (GtkTreeModel *model,
   item = g_slice_new0 (ExoIconViewItem);
   item->iter = *iter;
   item->area.width = -1;
+  item->index = idx;
   icon_view->priv->items = g_list_insert (icon_view->priv->items, item, idx);
 
+  /* update index of items in tail */
+  list = g_list_nth (icon_view->priv->items, idx + 1);
+  for (; list != NULL; list = list->next)
+    {
+      item = list->data;
+      item->index++;
+    }
+
   /* recalculate the layout */
   exo_icon_view_queue_layout (icon_view);
 }
@@ -3956,11 +4003,12 @@ exo_icon_view_rows_reordered (GtkTreeModel *model,
                               gint         *new_order,
                               ExoIconView  *icon_view)
 {
-  GList **list_array;
-  GList  *list;
-  gint   *order;
-  gint     length;
-  gint     i;
+  GList          **list_array;
+  GList           *list;
+  gint            *order;
+  gint              length;
+  gint              i;
+  ExoIconViewItem  *item;
 
   /* cancel any editing attempt */
   exo_icon_view_stop_editing (icon_view, TRUE);
@@ -3983,11 +4031,17 @@ exo_icon_view_rows_reordered (GtkTreeModel *model,
   icon_view->priv->items = list_array[0];
   list_array[0]->prev = NULL;
 
+  item = list_array[0]->data;
+  item->index = 0;
+
   /* hook up the remaining items */
   for (i = 1; i < length; ++i)
     {
       list_array[i - 1]->next = list_array[i];
       list_array[i]->prev = list_array[i - 1];
+
+      item = list_array[i]->data;
+      item->index = i;
     }
 
   /* hook up the last item */
@@ -5374,11 +5428,13 @@ exo_icon_view_set_model (ExoIconView  *icon_view,
       /* build up the initial items list */
       if (gtk_tree_model_get_iter_first (model, &iter))
         {
+          n = 0;
           do
             {
               item = g_slice_new0 (ExoIconViewItem);
               item->iter = iter;
               item->area.width = -1;
+              item->index = n++;
               items = g_list_prepend (items, item);
             }
           while (gtk_tree_model_iter_next (model, &iter));
@@ -7440,12 +7496,13 @@ GdkPixmap*
 exo_icon_view_create_drag_icon (ExoIconView *icon_view,
                                 GtkTreePath *path)
 {
-  GdkRectangle area;
-  GtkWidget   *widget = GTK_WIDGET (icon_view);
-  GdkPixmap   *drawable;
-  GdkGC       *gc;
-  GList       *lp;
-  gint         idx;
+  GdkRectangle     area;
+  GtkWidget       *widget = GTK_WIDGET (icon_view);
+  GdkPixmap       *drawable;
+  GdkGC           *gc;
+  GList           *lp;
+  gint             idx;
+  ExoIconViewItem *item;
 
   g_return_val_if_fail (EXO_IS_ICON_VIEW (icon_view), NULL);
   g_return_val_if_fail (gtk_tree_path_get_depth (path) > 0, NULL);
@@ -7458,7 +7515,7 @@ exo_icon_view_create_drag_icon (ExoIconView *icon_view,
 
   for (lp = icon_view->priv->items; lp != NULL; lp = lp->next)
     {
-      ExoIconViewItem *item = lp->data;
+      item = lp->data;
       if (G_UNLIKELY (idx == g_list_index (icon_view->priv->items, item)))
         {
           drawable = gdk_pixmap_new (icon_view->priv->bin_window,
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index dc6dd74..67c8e72 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -1,2 +1,3 @@
 exo-desktop-item-edit/exo-die-command-model.c
 exo/exo-utils.h
+exo/exo-icon-view-accessible.c


More information about the Xfce4-commits mailing list