]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkiconview.c
GtkAboutDialog: Don't use an alignment
[~andy/gtk] / gtk / gtkiconview.c
index 47dc4c751a3736ae2c2ac5c258153739b274611f..b395f43f46f05ed8c305b6f9114d6f1c311eb7a0 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <atk/atk.h>
 
+#include "gtkaccessibleprivate.h"
 #include "gtkiconview.h"
 #include "gtkcelllayout.h"
 #include "gtkcellrenderer.h"
@@ -108,19 +109,19 @@ struct _GtkIconViewPrivate
 
   GtkSelectionMode selection_mode;
 
+  guint layout_idle_id;
+
   GdkWindow *bin_window;
 
   GList *children;
 
   GtkTreeModel *model;
-  
+
   GList *items;
-  
+
   GtkAdjustment *hadjustment;
   GtkAdjustment *vadjustment;
 
-  guint layout_idle_id;
-  
   gint rubberband_x1, rubberband_y1;
   gint rubberband_x2, rubberband_y2;
   GdkDevice *rubberband_device;
@@ -147,12 +148,11 @@ struct _GtkIconViewPrivate
   gint text_column;
   gint markup_column;
   gint pixbuf_column;
+  gint tooltip_column;
 
   GtkCellRenderer *pixbuf_cell;
   GtkCellRenderer *text_cell;
 
-  gint tooltip_column;
-
   /* Drag-and-drop. */
   GdkModifierType start_button_mask;
   gint pressed_button;
@@ -250,10 +250,9 @@ static void             gtk_icon_view_get_property              (GObject
 static void             gtk_icon_view_destroy                   (GtkWidget          *widget);
 static void             gtk_icon_view_realize                   (GtkWidget          *widget);
 static void             gtk_icon_view_unrealize                 (GtkWidget          *widget);
-static void             gtk_icon_view_style_set                 (GtkWidget        *widget,
-                                                                GtkStyle         *previous_style);
-static void             gtk_icon_view_state_changed             (GtkWidget        *widget,
-                                                                GtkStateType      previous_state);
+static void             gtk_icon_view_style_updated             (GtkWidget          *widget);
+static void             gtk_icon_view_state_flags_changed       (GtkWidget          *widget,
+                                                                GtkStateFlags       previous_state);
 static void             gtk_icon_view_get_preferred_width       (GtkWidget          *widget,
                                                                 gint               *minimum,
                                                                 gint               *natural);
@@ -371,6 +370,9 @@ static GtkIconViewItem *    gtk_icon_view_get_item_at_coords             (GtkIco
 static void                 gtk_icon_view_set_cell_data                  (GtkIconView            *icon_view,
                                                                          GtkIconViewItem        *item);
 
+static void                 gtk_icon_view_ensure_cell_area               (GtkIconView            *icon_view,
+                                                                          GtkCellArea            *cell_area);
+
 static GtkCellArea         *gtk_icon_view_cell_layout_get_area           (GtkCellLayout          *layout);
 
 static void                 gtk_icon_view_item_selected_changed          (GtkIconView            *icon_view,
@@ -389,6 +391,8 @@ static void                 gtk_icon_view_remove_editable                (GtkCel
 static void                 gtk_icon_view_context_changed                (GtkCellAreaContext     *context,
                                                                          GParamSpec             *pspec,
                                                                          GtkIconView            *icon_view);
+static void                 update_text_cell                             (GtkIconView            *icon_view);
+static void                 update_pixbuf_cell                           (GtkIconView            *icon_view);
 
 /* Source side drag signals */
 static void gtk_icon_view_drag_begin       (GtkWidget        *widget,
@@ -477,7 +481,7 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
   widget_class->destroy = gtk_icon_view_destroy;
   widget_class->realize = gtk_icon_view_realize;
   widget_class->unrealize = gtk_icon_view_unrealize;
-  widget_class->style_set = gtk_icon_view_style_set;
+  widget_class->style_updated = gtk_icon_view_style_updated;
   widget_class->get_accessible = gtk_icon_view_get_accessible;
   widget_class->get_preferred_width = gtk_icon_view_get_preferred_width;
   widget_class->get_preferred_height = gtk_icon_view_get_preferred_height;
@@ -496,7 +500,7 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
   widget_class->drag_motion = gtk_icon_view_drag_motion;
   widget_class->drag_drop = gtk_icon_view_drag_drop;
   widget_class->drag_data_received = gtk_icon_view_drag_data_received;
-  widget_class->state_changed = gtk_icon_view_state_changed;
+  widget_class->state_flags_changed = gtk_icon_view_state_flags_changed;
 
   container_class->remove = gtk_icon_view_remove;
   container_class->forall = gtk_icon_view_forall;
@@ -754,6 +758,9 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
    *
    * The #GtkCellArea used to layout cell renderers for this view.
    *
+   * If no area is specified when creating the icon view with gtk_icon_view_new_with_area() 
+   * a #GtkCellAreaBox will be used.
+   *
    * Since: 3.0
    */
   g_object_class_install_property (gobject_class,
@@ -1101,37 +1108,14 @@ gtk_icon_view_constructor (GType               type,
                           GObjectConstructParam *construct_properties)
 {
   GtkIconView        *icon_view;
-  GtkIconViewPrivate *priv;
   GObject            *object;
 
   object = G_OBJECT_CLASS (gtk_icon_view_parent_class)->constructor
     (type, n_construct_properties, construct_properties);
 
   icon_view = (GtkIconView *) object;
-  priv      = icon_view->priv;
-
-  if (!priv->cell_area)
-    {
-      priv->cell_area = gtk_cell_area_box_new ();
-      g_object_ref_sink (priv->cell_area);
-    }
-
-  if (GTK_IS_ORIENTABLE (priv->cell_area))
-    gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->cell_area), priv->item_orientation);
-
-  gtk_cell_area_set_style_detail (priv->cell_area, "icon_view");
-
-  priv->cell_area_context = gtk_cell_area_create_context (priv->cell_area);
 
-  priv->add_editable_id = 
-    g_signal_connect (priv->cell_area, "add-editable", 
-                     G_CALLBACK (gtk_icon_view_add_editable), icon_view);
-  priv->remove_editable_id = 
-    g_signal_connect (priv->cell_area, "remove-editable", 
-                     G_CALLBACK (gtk_icon_view_remove_editable), icon_view);
-  priv->context_changed_id = 
-    g_signal_connect (priv->cell_area_context, "notify", 
-                     G_CALLBACK (gtk_icon_view_context_changed), icon_view);
+  gtk_icon_view_ensure_cell_area (icon_view, NULL);
 
   return object;
 }
@@ -1240,9 +1224,17 @@ gtk_icon_view_set_property (GObject      *object,
     case PROP_CELL_AREA:
       /* Construct-only, can only be assigned once */
       area = g_value_get_object (value);
-
       if (area)
-       icon_view->priv->cell_area = g_object_ref_sink (area);
+        {
+          if (icon_view->priv->cell_area != NULL)
+            {
+              g_warning ("cell-area has already been set, ignoring construct property");
+              g_object_ref_sink (area);
+              g_object_unref (area);
+            }
+          else
+            gtk_icon_view_ensure_cell_area (icon_view, area);
+        }
       break;
 
     case PROP_HADJUSTMENT:
@@ -1393,6 +1385,7 @@ gtk_icon_view_realize (GtkWidget *widget)
   GdkWindow *window;
   GdkWindowAttr attributes;
   gint attributes_mask;
+  GtkStyleContext *context;
 
   gtk_widget_set_realized (widget, TRUE);
 
@@ -1435,9 +1428,12 @@ gtk_icon_view_realize (GtkWidget *widget)
                                                &attributes, attributes_mask);
   gdk_window_set_user_data (icon_view->priv->bin_window, widget);
 
-  gtk_widget_style_attach (widget);
-  gdk_window_set_background (icon_view->priv->bin_window,
-                             &gtk_widget_get_style (widget)->base[gtk_widget_get_state (widget)]);
+  context = gtk_widget_get_style_context (widget);
+
+  gtk_style_context_save (context);
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
+  gtk_style_context_set_background (context, icon_view->priv->bin_window);
+  gtk_style_context_restore (context);
 
   gdk_window_show (icon_view->priv->bin_window);
 }
@@ -1457,42 +1453,40 @@ gtk_icon_view_unrealize (GtkWidget *widget)
 }
 
 static void
-gtk_icon_view_state_changed (GtkWidget      *widget,
-                            GtkStateType    previous_state)
+_gtk_icon_view_update_background (GtkIconView *icon_view)
 {
-  GtkIconView *icon_view = GTK_ICON_VIEW (widget);
-  GtkStateType state;
-  GtkStyle *style;
+  GtkWidget *widget = GTK_WIDGET (icon_view);
 
   if (gtk_widget_get_realized (widget))
     {
-      style = gtk_widget_get_style (widget);
-      state = gtk_widget_get_state (widget);
+      GtkStyleContext *context;
+
+      context = gtk_widget_get_style_context (widget);
+
+      gtk_style_context_save (context);
+      gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
+
+      gtk_style_context_set_background (context, gtk_widget_get_window (widget));
+      gtk_style_context_set_background (context, icon_view->priv->bin_window);
 
-      gdk_window_set_background (gtk_widget_get_window (widget), &style->base[state]);
-      gdk_window_set_background (icon_view->priv->bin_window, &style->base[state]);
+      gtk_style_context_restore (context);
     }
+}
 
+static void
+gtk_icon_view_state_flags_changed (GtkWidget     *widget,
+                                   GtkStateFlags  previous_state)
+{
+  _gtk_icon_view_update_background (GTK_ICON_VIEW (widget));
   gtk_widget_queue_draw (widget);
 }
 
 static void
-gtk_icon_view_style_set (GtkWidget *widget,
-                        GtkStyle *previous_style)
+gtk_icon_view_style_updated (GtkWidget *widget)
 {
-  GtkIconView *icon_view = GTK_ICON_VIEW (widget);
-  GtkStateType state;
-  GtkStyle *style;
-
-  if (gtk_widget_get_realized (widget))
-    {
-      style = gtk_widget_get_style (widget);
-      state = gtk_widget_get_state (widget);
-
-      gdk_window_set_background (gtk_widget_get_window (widget), &style->base[state]);
-      gdk_window_set_background (icon_view->priv->bin_window, &style->base[state]);
-    }
+  GTK_WIDGET_CLASS (gtk_icon_view_parent_class)->style_updated (widget);
 
+  _gtk_icon_view_update_background (GTK_ICON_VIEW (widget));
   gtk_widget_queue_resize (widget);
 }
 
@@ -1635,50 +1629,52 @@ gtk_icon_view_draw (GtkWidget *widget,
       cairo_restore (cr);
     }
 
-  if (dest_item)
+  if (dest_item &&
+      dest_pos != GTK_ICON_VIEW_NO_DROP)
     {
-      GtkStateType state;
-      GtkStyle *style;
+      GtkStyleContext *context;
+      GtkStateFlags state;
+      GdkRectangle rect = { 0 };
 
-      style = gtk_widget_get_style (widget);
-      state = gtk_widget_get_state (widget);
+      context = gtk_widget_get_style_context (widget);
+      state = gtk_widget_get_state_flags (widget);
 
       switch (dest_pos)
        {
        case GTK_ICON_VIEW_DROP_INTO:
-         gtk_paint_focus (style, cr, state, widget,
-                          "iconview-drop-indicator",
-                          dest_item->cell_area.x, dest_item->cell_area.y,
-                          dest_item->cell_area.width, dest_item->cell_area.height);
+          rect = dest_item->cell_area;
          break;
        case GTK_ICON_VIEW_DROP_ABOVE:
-         gtk_paint_focus (style, cr, state, widget,
-                          "iconview-drop-indicator",
-                          dest_item->cell_area.x, dest_item->cell_area.y - 1,
-                          dest_item->cell_area.width, 2);
+          rect.x = dest_item->cell_area.x;
+          rect.y = dest_item->cell_area.y - 1;
+          rect.width = dest_item->cell_area.width;
+          rect.height = 2;
          break;
        case GTK_ICON_VIEW_DROP_LEFT:
-         gtk_paint_focus (style, cr, state, widget,
-                          "iconview-drop-indicator",
-                          dest_item->cell_area.x - 1, dest_item->cell_area.y,
-                          2, dest_item->cell_area.height);
+          rect.x = dest_item->cell_area.x - 1;
+          rect.y = dest_item->cell_area.y;
+          rect.width = 2;
+          rect.height = dest_item->cell_area.height;
          break;
        case GTK_ICON_VIEW_DROP_BELOW:
-         gtk_paint_focus (style, cr, state, widget,
-                          "iconview-drop-indicator",
-                          dest_item->cell_area.x, 
-                          dest_item->cell_area.y + dest_item->cell_area.height - 1,
-                          dest_item->cell_area.width, 2);
+          rect.x = dest_item->cell_area.x;
+          rect.y = dest_item->cell_area.y + dest_item->cell_area.height - 1;
+          rect.width = dest_item->cell_area.width;
+          rect.height = 2;
          break;
        case GTK_ICON_VIEW_DROP_RIGHT:
-         gtk_paint_focus (style, cr, state, widget,
-                          "iconview-drop-indicator",
-                          dest_item->cell_area.x + dest_item->cell_area.width - 1, 
-                          dest_item->cell_area.y,
-                          2, dest_item->cell_area.height);
+          rect.x = dest_item->cell_area.x + dest_item->cell_area.width - 1;
+          rect.y = dest_item->cell_area.y;
+          rect.width = 2;
+          rect.height = dest_item->cell_area.height;
        case GTK_ICON_VIEW_NO_DROP: ;
          break;
-       }
+        }
+
+      gtk_style_context_set_state (context, state);
+      gtk_render_focus (context, cr,
+                        rect.x, rect.y,
+                        rect.width, rect.height);
     }
   
   if (icon_view->priv->doing_rubberband)
@@ -1907,7 +1903,8 @@ gtk_icon_view_set_cursor (GtkIconView     *icon_view,
   g_return_if_fail (path != NULL);
   g_return_if_fail (cell == NULL || GTK_IS_CELL_RENDERER (cell));
 
-  gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+  if (icon_view->priv->cell_area)
+    gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
 
   if (gtk_tree_path_get_depth (path) == 1)
     item = g_list_nth_data (icon_view->priv->items,
@@ -1919,7 +1916,8 @@ gtk_icon_view_set_cursor (GtkIconView     *icon_view,
   gtk_icon_view_set_cursor_item (icon_view, item, cell);
   gtk_icon_view_scroll_to_path (icon_view, path, FALSE, 0.0, 0.0);
 
-  if (start_editing)
+  if (start_editing && 
+      icon_view->priv->cell_area)
     {
       GtkCellAreaContext *context;
 
@@ -1934,8 +1932,9 @@ gtk_icon_view_set_cursor (GtkIconView     *icon_view,
 /**
  * gtk_icon_view_get_cursor:
  * @icon_view: A #GtkIconView
- * @path: (allow-none): Return location for the current cursor path, or %NULL
- * @cell: (allow-none): Return location the current focus cell, or %NULL
+ * @path: (out) (allow-none): Return location for the current cursor path,
+ *        or %NULL
+ * @cell: (out) (allow-none): Return location the current focus cell, or %NULL
  *
  * Fills in @path and @cell with the current cursor path and cell. 
  * If the cursor isn't currently set, then *@path will be %NULL.  
@@ -1966,7 +1965,7 @@ gtk_icon_view_get_cursor (GtkIconView      *icon_view,
        *path = NULL;
     }
 
-  if (cell != NULL && item != NULL)
+  if (cell != NULL && item != NULL && icon_view->priv->cell_area != NULL)
     *cell = gtk_cell_area_get_focus_cell (icon_view->priv->cell_area);
 
   return (item != NULL);
@@ -2403,7 +2402,7 @@ static void
 gtk_icon_view_real_select_cursor_item (GtkIconView *icon_view)
 {
   gtk_icon_view_unselect_all (icon_view);
-  
+
   if (icon_view->priv->cursor_item != NULL)
     gtk_icon_view_select_item (icon_view, icon_view->priv->cursor_item);
 }
@@ -2412,19 +2411,19 @@ static gboolean
 gtk_icon_view_real_activate_cursor_item (GtkIconView *icon_view)
 {
   GtkTreePath *path;
-  gboolean activated;
   GtkCellAreaContext *context;
-  
+
   if (!icon_view->priv->cursor_item)
     return FALSE;
 
   context = g_ptr_array_index (icon_view->priv->row_contexts, icon_view->priv->cursor_item->row);
 
   gtk_icon_view_set_cell_data (icon_view, icon_view->priv->cursor_item);
-  activated = gtk_cell_area_activate (icon_view->priv->cell_area, context, 
-                                     GTK_WIDGET (icon_view), 
-                                     (GdkRectangle *)icon_view->priv->cursor_item, 
-                                     0 /* XXX flags */, FALSE);
+  gtk_cell_area_activate (icon_view->priv->cell_area, context,
+                          GTK_WIDGET (icon_view),
+                          (GdkRectangle *)icon_view->priv->cursor_item,
+                          0 /* XXX flags */,
+                          FALSE);
 
   path = gtk_tree_path_new_from_indices (icon_view->priv->cursor_item->index, -1);
   gtk_icon_view_item_activated (icon_view, path);
@@ -2891,11 +2890,14 @@ gtk_icon_view_invalidate_sizes (GtkIconView *icon_view)
                  (GFunc)gtk_icon_view_item_invalidate_size, NULL);
 
   /* Reset the context */
-  g_signal_handler_block (icon_view->priv->cell_area_context, 
-                         icon_view->priv->context_changed_id);
-  gtk_cell_area_context_reset (icon_view->priv->cell_area_context);
-  g_signal_handler_unblock (icon_view->priv->cell_area_context, 
-                           icon_view->priv->context_changed_id);
+  if (icon_view->priv->cell_area_context)
+    {
+      g_signal_handler_block (icon_view->priv->cell_area_context, 
+                             icon_view->priv->context_changed_id);
+      gtk_cell_area_context_reset (icon_view->priv->cell_area_context);
+      g_signal_handler_unblock (icon_view->priv->cell_area_context, 
+                               icon_view->priv->context_changed_id);
+    }
 
   /* Re-layout the items */
   gtk_icon_view_queue_layout (icon_view);
@@ -2910,52 +2912,49 @@ gtk_icon_view_item_invalidate_size (GtkIconViewItem *item)
 
 static void
 gtk_icon_view_paint_item (GtkIconView     *icon_view,
-                         cairo_t         *cr,
-                         GtkIconViewItem *item,
-                         gint             x,
-                         gint             y,
-                         gboolean         draw_focus)
+                          cairo_t         *cr,
+                          GtkIconViewItem *item,
+                          gint             x,
+                          gint             y,
+                          gboolean         draw_focus)
 {
   GdkRectangle cell_area;
-  GtkStateType state;
-  GtkCellRendererState flags;
+  GtkStateFlags state = 0;
+  GtkCellRendererState flags = 0;
+  GtkStyleContext *style_context;
   GtkWidget *widget = GTK_WIDGET (icon_view);
   GtkIconViewPrivate *priv = icon_view->priv;
-  GtkStyle *style;
   GtkCellAreaContext *context;
 
   if (priv->model == NULL)
     return;
-  
-  style = gtk_widget_get_style (widget);
+
   gtk_icon_view_set_cell_data (icon_view, item);
-  
-  if (item->selected)
-    {
-      flags = GTK_CELL_RENDERER_SELECTED;
-      if (gtk_widget_has_focus (widget))
-       state = GTK_STATE_SELECTED;
-      else
-       state = GTK_STATE_ACTIVE;
-    }
-  else
-    {
-      flags = 0;
-      state = GTK_STATE_NORMAL;
-    }
+
+  style_context = gtk_widget_get_style_context (widget);
+
+  gtk_style_context_save (style_context);
+  gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_VIEW);
+  gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_CELL);
 
   if (item->selected)
     {
-      gtk_paint_flat_box (style,
-                          cr,
-                          GTK_STATE_SELECTED,
-                          GTK_SHADOW_NONE,
-                          GTK_WIDGET (icon_view),
-                          "icon_view_item",
-                          x - icon_view->priv->item_padding, 
-                         y - icon_view->priv->item_padding,
-                          item->cell_area.width + icon_view->priv->item_padding * 2, 
-                         item->cell_area.height + icon_view->priv->item_padding * 2);
+      if (gtk_widget_has_focus (widget) &&
+          item == icon_view->priv->cursor_item)
+        {
+          state |= GTK_STATE_FLAG_FOCUSED;
+          flags |= GTK_CELL_RENDERER_FOCUSED;
+        }
+
+      state |= GTK_STATE_FLAG_SELECTED;
+      flags |= GTK_CELL_RENDERER_SELECTED;
+
+      gtk_style_context_set_state (style_context, state);
+      gtk_render_background (style_context, cr,
+                             x - icon_view->priv->item_padding,
+                             y - icon_view->priv->item_padding,
+                             item->cell_area.width  + icon_view->priv->item_padding * 2,
+                             item->cell_area.height + icon_view->priv->item_padding * 2);
     }
 
   cell_area.x      = x;
@@ -2963,22 +2962,20 @@ gtk_icon_view_paint_item (GtkIconView     *icon_view,
   cell_area.width  = item->cell_area.width;
   cell_area.height = item->cell_area.height;
 
-  if (gtk_widget_has_focus (widget) && item == icon_view->priv->cursor_item)
-    flags |= GTK_CELL_RENDERER_FOCUSED;
-
   context = g_ptr_array_index (priv->row_contexts, item->row);
   gtk_cell_area_render (priv->cell_area, context,
-                       widget, cr, &cell_area, &cell_area, flags, 
-                       draw_focus);
+                        widget, cr, &cell_area, &cell_area, flags,
+                        draw_focus);
+
+  gtk_style_context_restore (style_context);
 }
 
 static void
 gtk_icon_view_paint_rubberband (GtkIconView     *icon_view,
                                cairo_t         *cr)
 {
+  GtkStyleContext *context;
   GdkRectangle rect;
-  GdkColor *fill_color_gdk;
-  guchar fill_color_alpha;
 
   cairo_save (cr);
 
@@ -2987,28 +2984,22 @@ gtk_icon_view_paint_rubberband (GtkIconView     *icon_view,
   rect.width = ABS (icon_view->priv->rubberband_x1 - icon_view->priv->rubberband_x2) + 1;
   rect.height = ABS (icon_view->priv->rubberband_y1 - icon_view->priv->rubberband_y2) + 1;
 
-  gtk_widget_style_get (GTK_WIDGET (icon_view),
-                        "selection-box-color", &fill_color_gdk,
-                        "selection-box-alpha", &fill_color_alpha,
-                        NULL);
-
-  if (!fill_color_gdk)
-    fill_color_gdk = gdk_color_copy (&gtk_widget_get_style (GTK_WIDGET (icon_view))->base[GTK_STATE_SELECTED]);
+  context = gtk_widget_get_style_context (GTK_WIDGET (icon_view));
 
-  gdk_cairo_set_source_color (cr, fill_color_gdk);
+  gtk_style_context_save (context);
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_RUBBERBAND);
 
   gdk_cairo_rectangle (cr, &rect);
   cairo_clip (cr);
 
-  cairo_paint_with_alpha (cr, fill_color_alpha / 255.);
-
-  cairo_rectangle (cr, 
-                  rect.x + 0.5, rect.y + 0.5,
-                  rect.width - 1, rect.height - 1);
-  cairo_stroke (cr);
-
-  gdk_color_free (fill_color_gdk);
+  gtk_render_background (context, cr,
+                         rect.x, rect.y,
+                         rect.width, rect.height);
+  gtk_render_frame (context, cr,
+                    rect.x, rect.y,
+                    rect.width, rect.height);
 
+  gtk_style_context_restore (context);
   cairo_restore (cr);
 }
 
@@ -3266,29 +3257,29 @@ verify_items (GtkIconView *icon_view)
 
 static void
 gtk_icon_view_row_changed (GtkTreeModel *model,
-                          GtkTreePath  *path,
-                          GtkTreeIter  *iter,
-                          gpointer      data)
+                           GtkTreePath  *path,
+                           GtkTreeIter  *iter,
+                           gpointer      data)
 {
   GtkIconView *icon_view = GTK_ICON_VIEW (data);
-  GtkIconViewItem *item;
-  gint index;
 
   /* ignore changes in branches */
   if (gtk_tree_path_get_depth (path) > 1)
     return;
 
-  gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
-  
-  index = gtk_tree_path_get_indices(path)[0];
-  item = g_list_nth_data (icon_view->priv->items, index);
+  /* An icon view subclass might add it's own model and populate
+   * things at init() time instead of waiting for the constructor() 
+   * to be called 
+   */
+  if (icon_view->priv->cell_area)
+    gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
 
   /* Here we can use a "grow-only" strategy for optimization
-   * and only invalidate a single item and queue a relayout 
-   * instead of invalidating the whole thing. 
+   * and only invalidate a single item and queue a relayout
+   * instead of invalidating the whole thing.
    *
    * For now GtkIconView still cant deal with huge models
-   * so just invalidate the whole thing when the model 
+   * so just invalidate the whole thing when the model
    * changes.
    */
   gtk_icon_view_invalidate_sizes (icon_view);
@@ -3363,7 +3354,8 @@ gtk_icon_view_row_deleted (GtkTreeModel *model,
   list = g_list_nth (icon_view->priv->items, index);
   item = list->data;
 
-  gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+  if (icon_view->priv->cell_area)
+    gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
 
   if (item == icon_view->priv->anchor_item)
     icon_view->priv->anchor_item = NULL;
@@ -3411,7 +3403,8 @@ gtk_icon_view_rows_reordered (GtkTreeModel *model,
   if (iter != NULL)
     return;
 
-  gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+  if (icon_view->priv->cell_area)
+    gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
 
   length = gtk_tree_model_iter_n_children (model, NULL);
 
@@ -4068,63 +4061,106 @@ gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
 }
 
 
-static void     
-gtk_icon_view_scroll_to_item (GtkIconView     *icon_view, 
-                             GtkIconViewItem *item)
+static void
+gtk_icon_view_scroll_to_item (GtkIconView     *icon_view,
+                              GtkIconViewItem *item)
 {
-  GtkAllocation allocation;
+  GtkIconViewPrivate *priv = icon_view->priv;
   GtkWidget *widget = GTK_WIDGET (icon_view);
-  gint x, y, width, height;
-  GdkRectangle item_area = 
-    { 
-      item->cell_area.x - icon_view->priv->item_padding, 
-      item->cell_area.y - icon_view->priv->item_padding, 
-      item->cell_area.width  + icon_view->priv->item_padding * 2, 
-      item->cell_area.height + icon_view->priv->item_padding * 2 
-    };
-
-  width = gdk_window_get_width (icon_view->priv->bin_window);
-  height = gdk_window_get_height (icon_view->priv->bin_window);
-  gdk_window_get_position (icon_view->priv->bin_window, &x, &y);
+  GtkAdjustment *hadj, *vadj;
+  GtkAllocation allocation;
+  gint x, y;
+  GdkRectangle item_area;
+
+  item_area.x = item->cell_area.x - priv->item_padding;
+  item_area.y = item->cell_area.y - priv->item_padding;
+  item_area.width = item->cell_area.width  + priv->item_padding * 2;
+  item_area.height = item->cell_area.height + priv->item_padding * 2;
 
+  gdk_window_get_position (icon_view->priv->bin_window, &x, &y);
   gtk_widget_get_allocation (widget, &allocation);
 
+  hadj = icon_view->priv->hadjustment;
+  vadj = icon_view->priv->vadjustment;
+
   if (y + item_area.y < 0)
-    gtk_adjustment_set_value (icon_view->priv->vadjustment, 
-                             gtk_adjustment_get_value (icon_view->priv->vadjustment) + y + item_area.y);
+    gtk_adjustment_set_value (vadj,
+                              gtk_adjustment_get_value (vadj)
+                                + y + item_area.y);
   else if (y + item_area.y + item_area.height > allocation.height)
-    gtk_adjustment_set_value (icon_view->priv->vadjustment, 
-                             gtk_adjustment_get_value (icon_view->priv->vadjustment) + y + item_area.y + 
-                             item_area.height - allocation.height);
+    gtk_adjustment_set_value (vadj,
+                              gtk_adjustment_get_value (vadj)
+                                + y + item_area.y + item_area.height - allocation.height);
 
   if (x + item_area.x < 0)
-    gtk_adjustment_set_value (icon_view->priv->hadjustment, 
-                              gtk_adjustment_get_value (icon_view->priv->hadjustment) + x + item_area.x);
+    gtk_adjustment_set_value (hadj,
+                              gtk_adjustment_get_value (hadj)
+                                + x + item_area.x);
   else if (x + item_area.x + item_area.width > allocation.width)
-    gtk_adjustment_set_value (icon_view->priv->hadjustment, 
-                             gtk_adjustment_get_value (icon_view->priv->hadjustment) + x + item_area.x + 
-                             item_area.width - allocation.width);
+    gtk_adjustment_set_value (hadj,
+                              gtk_adjustment_get_value (hadj)
+                                + x + item_area.x + item_area.width - allocation.width);
 
-  gtk_adjustment_changed (icon_view->priv->hadjustment);
-  gtk_adjustment_changed (icon_view->priv->vadjustment);
+  gtk_adjustment_changed (hadj);
+  gtk_adjustment_changed (vadj);
 }
 
 /* GtkCellLayout implementation */
+
+static void
+gtk_icon_view_ensure_cell_area (GtkIconView *icon_view,
+                                GtkCellArea *cell_area)
+{
+  GtkIconViewPrivate *priv = icon_view->priv;
+
+  if (priv->cell_area)
+    return;
+
+  if (cell_area)
+    priv->cell_area = cell_area;
+  else
+    priv->cell_area = gtk_cell_area_box_new ();
+
+  g_object_ref_sink (priv->cell_area);
+
+  if (GTK_IS_ORIENTABLE (priv->cell_area))
+    gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->cell_area), priv->item_orientation);
+
+  priv->cell_area_context = gtk_cell_area_create_context (priv->cell_area);
+
+  priv->add_editable_id =
+    g_signal_connect (priv->cell_area, "add-editable",
+                      G_CALLBACK (gtk_icon_view_add_editable), icon_view);
+  priv->remove_editable_id =
+    g_signal_connect (priv->cell_area, "remove-editable",
+                      G_CALLBACK (gtk_icon_view_remove_editable), icon_view);
+  priv->context_changed_id =
+    g_signal_connect (priv->cell_area_context, "notify",
+                      G_CALLBACK (gtk_icon_view_context_changed), icon_view);
+
+  update_text_cell (icon_view);
+  update_pixbuf_cell (icon_view);
+}
+
 static GtkCellArea *
 gtk_icon_view_cell_layout_get_area (GtkCellLayout *cell_layout)
 {
   GtkIconView *icon_view = GTK_ICON_VIEW (cell_layout);
+  GtkIconViewPrivate *priv = icon_view->priv;
+
+  if (G_UNLIKELY (!priv->cell_area))
+    gtk_icon_view_ensure_cell_area (icon_view, NULL);
 
   return icon_view->priv->cell_area;
 }
 
 static void
-gtk_icon_view_set_cell_data (GtkIconView     *icon_view, 
+gtk_icon_view_set_cell_data (GtkIconView     *icon_view,
                             GtkIconViewItem *item)
 {
   gboolean iters_persist;
   GtkTreeIter iter;
-  
+
   iters_persist = gtk_tree_model_get_flags (icon_view->priv->model) & GTK_TREE_MODEL_ITERS_PERSIST;
   
   if (!iters_persist)
@@ -4202,8 +4238,8 @@ gtk_icon_view_new_with_model (GtkTreeModel *model)
  * @icon_view: a #GtkIconView 
  * @wx: X coordinate relative to the widget
  * @wy: Y coordinate relative to the widget
- * @bx: return location for bin_window X coordinate
- * @by: return location for bin_window Y coordinate
+ * @bx: (out): return location for bin_window X coordinate
+ * @by: (out): return location for bin_window Y coordinate
  * 
  * Converts widget coordinates to coordinates for the bin_window,
  * as expected by e.g. gtk_icon_view_get_path_at_pos(). 
@@ -4274,9 +4310,9 @@ gtk_icon_view_get_path_at_pos (GtkIconView *icon_view,
  * @icon_view: A #GtkIconView.
  * @x: The x position to be identified
  * @y: The y position to be identified
- * @path: (allow-none): Return location for the path, or %NULL
- * @cell: Return location for the renderer responsible for the cell
- *   at (@x, @y), or %NULL
+ * @path: (out) (allow-none): Return location for the path, or %NULL
+ * @cell: (out) (allow-none): Return location for the renderer
+ *   responsible for the cell at (@x, @y), or %NULL
  * 
  * Finds the path at the point (@x, @y), relative to bin_window coordinates.
  * In contrast to gtk_icon_view_get_path_at_pos(), this function also 
@@ -4407,8 +4443,8 @@ gtk_icon_view_set_tooltip_cell (GtkIconView     *icon_view,
 /**
  * gtk_icon_view_get_tooltip_context:
  * @icon_view: an #GtkIconView
- * @x: the x coordinate (relative to widget coordinates)
- * @y: the y coordinate (relative to widget coordinates)
+ * @x: (inout): the x coordinate (relative to widget coordinates)
+ * @y: (inout): the y coordinate (relative to widget coordinates)
  * @keyboard_tip: whether this is a keyboard tooltip or not
  * @model: (out) (allow-none): a pointer to receive a #GtkTreeModel or %NULL
  * @path: (out) (allow-none): a pointer to receive a #GtkTreePath or %NULL
@@ -4562,7 +4598,7 @@ gtk_icon_view_set_tooltip_column (GtkIconView *icon_view,
   g_object_notify (G_OBJECT (icon_view), "tooltip-column");
 }
 
-/** 
+/**
  * gtk_icon_view_get_tooltip_column:
  * @icon_view: a #GtkIconView
  *
@@ -4585,8 +4621,9 @@ gtk_icon_view_get_tooltip_column (GtkIconView *icon_view)
 /**
  * gtk_icon_view_get_visible_range:
  * @icon_view: A #GtkIconView
- * @start_path: (allow-none): Return location for start of region, or %NULL
- * @end_path: (allow-none): Return location for end of region, or %NULL
+ * @start_path: (out) (allow-none): Return location for start of region,
+ *              or %NULL
+ * @end_path: (out) (allow-none): Return location for end of region, or %NULL
  * 
  * Sets @start_path and @end_path to be the first and last visible path. 
  * Note that there may be invisible paths in between.
@@ -4863,6 +4900,9 @@ gtk_icon_view_get_model (GtkIconView *icon_view)
 static void
 update_text_cell (GtkIconView *icon_view)
 {
+  if (!icon_view->priv->cell_area)
+    return;
+
   if (icon_view->priv->text_column == -1 &&
       icon_view->priv->markup_column == -1)
     {
@@ -4913,6 +4953,9 @@ update_text_cell (GtkIconView *icon_view)
 static void
 update_pixbuf_cell (GtkIconView *icon_view)
 {
+  if (!icon_view->priv->cell_area)
+    return;
+
   if (icon_view->priv->pixbuf_column == -1)
     {
       if (icon_view->priv->pixbuf_cell != NULL)
@@ -4983,8 +5026,8 @@ gtk_icon_view_set_text_column (GtkIconView *icon_view,
       icon_view->priv->text_column = column;
     }
 
-
-  gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+  if (icon_view->priv->cell_area)
+    gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
 
   update_text_cell (icon_view);
 
@@ -5046,7 +5089,8 @@ gtk_icon_view_set_markup_column (GtkIconView *icon_view,
       icon_view->priv->markup_column = column;
     }
 
-  gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+  if (icon_view->priv->cell_area)
+    gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
 
   update_text_cell (icon_view);
 
@@ -5106,7 +5150,8 @@ gtk_icon_view_set_pixbuf_column (GtkIconView *icon_view,
       icon_view->priv->pixbuf_column = column;
     }
 
-  gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+  if (icon_view->priv->cell_area)
+    gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
 
   update_pixbuf_cell (icon_view);
 
@@ -5423,11 +5468,15 @@ gtk_icon_view_set_item_orientation (GtkIconView    *icon_view,
     {
       icon_view->priv->item_orientation = orientation;
 
-      if (GTK_IS_ORIENTABLE (icon_view->priv->cell_area))
-       gtk_orientable_set_orientation (GTK_ORIENTABLE (icon_view->priv->cell_area), 
-                                       icon_view->priv->item_orientation);
+      if (icon_view->priv->cell_area)
+       {
+         if (GTK_IS_ORIENTABLE (icon_view->priv->cell_area))
+           gtk_orientable_set_orientation (GTK_ORIENTABLE (icon_view->priv->cell_area), 
+                                           icon_view->priv->item_orientation);
+
+         gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+       }
 
-      gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
       gtk_icon_view_invalidate_sizes (icon_view);
 
       update_text_cell (icon_view);
@@ -5479,7 +5528,9 @@ gtk_icon_view_set_columns (GtkIconView *icon_view,
     {
       icon_view->priv->columns = columns;
 
-      gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+      if (icon_view->priv->cell_area)
+       gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+
       gtk_icon_view_queue_layout (icon_view);
       
       g_object_notify (G_OBJECT (icon_view), "columns");
@@ -5525,7 +5576,9 @@ gtk_icon_view_set_item_width (GtkIconView *icon_view,
     {
       icon_view->priv->item_width = item_width;
       
-      gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+      if (icon_view->priv->cell_area)
+       gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+
       gtk_icon_view_invalidate_sizes (icon_view);
       
       update_text_cell (icon_view);
@@ -5574,9 +5627,11 @@ gtk_icon_view_set_spacing (GtkIconView *icon_view,
     {
       icon_view->priv->spacing = spacing;
 
-      gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+      if (icon_view->priv->cell_area)
+       gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+
       gtk_icon_view_invalidate_sizes (icon_view);
-      
+
       g_object_notify (G_OBJECT (icon_view), "spacing");
     }  
 }
@@ -5619,9 +5674,11 @@ gtk_icon_view_set_row_spacing (GtkIconView *icon_view,
     {
       icon_view->priv->row_spacing = row_spacing;
 
-      gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+      if (icon_view->priv->cell_area)
+       gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+
       gtk_icon_view_invalidate_sizes (icon_view);
-      
+
       g_object_notify (G_OBJECT (icon_view), "row-spacing");
     }  
 }
@@ -5664,9 +5721,11 @@ gtk_icon_view_set_column_spacing (GtkIconView *icon_view,
     {
       icon_view->priv->column_spacing = column_spacing;
 
-      gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+      if (icon_view->priv->cell_area)
+       gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+
       gtk_icon_view_invalidate_sizes (icon_view);
-      
+
       g_object_notify (G_OBJECT (icon_view), "column-spacing");
     }  
 }
@@ -5710,9 +5769,11 @@ gtk_icon_view_set_margin (GtkIconView *icon_view,
     {
       icon_view->priv->margin = margin;
 
-      gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+      if (icon_view->priv->cell_area)
+       gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+
       gtk_icon_view_invalidate_sizes (icon_view);
-      
+
       g_object_notify (G_OBJECT (icon_view), "margin");
     }  
 }
@@ -5755,9 +5816,11 @@ gtk_icon_view_set_item_padding (GtkIconView *icon_view,
     {
       icon_view->priv->item_padding = item_padding;
 
-      gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+      if (icon_view->priv->cell_area)
+       gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
+
       gtk_icon_view_invalidate_sizes (icon_view);
-      
+
       g_object_notify (G_OBJECT (icon_view), "item-padding");
     }  
 }
@@ -6548,7 +6611,8 @@ gtk_icon_view_drag_data_received (GtkWidget        *widget,
  * gtk_icon_view_enable_model_drag_source:
  * @icon_view: a #GtkIconTreeView
  * @start_button_mask: Mask of allowed buttons to start drag
- * @targets: the table of targets that the drag will support
+ * @targets: (array length=n_targets): the table of targets that the drag will
+ *           support
  * @n_targets: the number of items in @targets
  * @actions: the bitmask of possible actions for a drag from this
  *    widget
@@ -6580,7 +6644,8 @@ gtk_icon_view_enable_model_drag_source (GtkIconView              *icon_view,
 /**
  * gtk_icon_view_enable_model_drag_dest:
  * @icon_view: a #GtkIconView
- * @targets: the table of targets that the drag will support
+ * @targets: (array length=n_targets): the table of targets that the drag will
+ *           support
  * @n_targets: the number of items in @targets
  * @actions: the bitmask of possible actions for a drag to this
  *    widget
@@ -6716,8 +6781,9 @@ gtk_icon_view_set_drag_dest_item (GtkIconView              *icon_view,
 /**
  * gtk_icon_view_get_drag_dest_item:
  * @icon_view: a #GtkIconView
- * @path: (allow-none): Return location for the path of the highlighted item, or %NULL.
- * @pos: (allow-none): Return location for the drop position, or %NULL
+ * @path: (out) (allow-none): Return location for the path of
+ *        the highlighted item, or %NULL.
+ * @pos: (out) (allow-none): Return location for the drop position, or %NULL
  * 
  * Gets information about the item that is highlighted for feedback.
  *
@@ -6747,8 +6813,9 @@ gtk_icon_view_get_drag_dest_item (GtkIconView              *icon_view,
  * @icon_view: a #GtkIconView
  * @drag_x: the position to determine the destination item for
  * @drag_y: the position to determine the destination item for
- * @path: (allow-none): Return location for the path of the item, or %NULL.
- * @pos: (allow-none): Return location for the drop position, or %NULL
+ * @path: (out) (allow-none): Return location for the path of the item,
+ *    or %NULL.
+ * @pos: (out) (allow-none): Return location for the drop position, or %NULL
  * 
  * Determines the destination item for a given position.
  * 
@@ -6814,7 +6881,7 @@ gtk_icon_view_get_dest_item_at_pos (GtkIconView              *icon_view,
  * Creates a #cairo_surface_t representation of the item at @path.  
  * This image is used for a drag icon.
  *
- * Return value: (transfer full) a newly-allocated surface of the drag icon.
+ * Return value: (transfer full): a newly-allocated surface of the drag icon.
  * 
  * Since: 2.8
  **/
@@ -6823,6 +6890,7 @@ gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
                                GtkTreePath *path)
 {
   GtkWidget *widget;
+  GtkStyleContext *context;
   cairo_t *cr;
   cairo_surface_t *surface;
   GList *l;
@@ -6832,6 +6900,7 @@ gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
   g_return_val_if_fail (path != NULL, NULL);
 
   widget = GTK_WIDGET (icon_view);
+  context = gtk_widget_get_style_context (widget);
 
   if (!gtk_widget_get_realized (widget))
     return NULL;
@@ -6859,9 +6928,8 @@ gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
          cr = cairo_create (surface);
          cairo_set_line_width (cr, 1.);
 
-          gdk_cairo_set_source_color (cr, &gtk_widget_get_style (widget)->base[gtk_widget_get_state (widget)]);
-         cairo_rectangle (cr, 0, 0, rect.width + 2, rect.height + 2);
-         cairo_fill (cr);
+          gtk_render_background (context, cr, 0, 0,
+                                 rect.width + 2, rect.height + 2);
 
           cairo_save (cr);
 
@@ -8149,26 +8217,6 @@ gtk_icon_view_item_accessible_finalize (GObject *object)
   G_OBJECT_CLASS (accessible_item_parent_class)->finalize (object);
 }
 
-static G_CONST_RETURN gchar*
-gtk_icon_view_item_accessible_get_name (AtkObject *obj)
-{
-  if (obj->name)
-    return obj->name;
-  else
-    {
-      GtkIconViewItemAccessible *item;
-      GtkTextIter start_iter;
-      GtkTextIter end_iter;
-
-      item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (obj);
-      gtk_text_buffer_get_start_iter (item->text_buffer, &start_iter); 
-      gtk_text_buffer_get_end_iter (item->text_buffer, &end_iter); 
-
-      return gtk_text_buffer_get_text (item->text_buffer, &start_iter, &end_iter, FALSE);
-    }
-}
-
 static AtkObject*
 gtk_icon_view_item_accessible_get_parent (AtkObject *obj)
 {
@@ -8230,10 +8278,9 @@ gtk_icon_view_item_accessible_class_init (AtkObjectClass *klass)
 
   gobject_class->finalize = gtk_icon_view_item_accessible_finalize;
 
-  klass->get_index_in_parent = gtk_icon_view_item_accessible_get_index_in_parent; 
-  klass->get_name = gtk_icon_view_item_accessible_get_name; 
-  klass->get_parent = gtk_icon_view_item_accessible_get_parent; 
-  klass->ref_state_set = gtk_icon_view_item_accessible_ref_state_set; 
+  klass->get_index_in_parent = gtk_icon_view_item_accessible_get_index_in_parent;
+  klass->get_parent = gtk_icon_view_item_accessible_get_parent;
+  klass->ref_state_set = gtk_icon_view_item_accessible_ref_state_set;
 }
 
 static GType
@@ -8554,13 +8601,11 @@ gtk_icon_view_accessible_model_row_changed (GtkTreeModel *tree_model,
   GtkWidget *widget;
   GtkIconView *icon_view;
   GtkIconViewItem *item;
-  GtkIconViewAccessible *a11y_view;
   GtkIconViewItemAccessible *a11y_item;
   const gchar *name;
   gchar *text;
 
   atk_obj = gtk_widget_get_accessible (GTK_WIDGET (user_data));
-  a11y_view = GTK_ICON_VIEW_ACCESSIBLE (atk_obj);
   index = gtk_tree_path_get_indices(path)[0];
   a11y_item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (
       gtk_icon_view_accessible_find_child (atk_obj, index));
@@ -8571,7 +8616,7 @@ gtk_icon_view_accessible_model_row_changed (GtkTreeModel *tree_model,
       icon_view = GTK_ICON_VIEW (widget);
       item = a11y_item->item;
 
-      name = gtk_icon_view_item_accessible_get_name (ATK_OBJECT (a11y_item));
+      name = atk_object_get_name (ATK_OBJECT (a11y_item));
 
       if (!name || strcmp (name, "") == 0)
         {
@@ -9290,28 +9335,10 @@ gtk_icon_view_get_accessible (GtkWidget *widget)
 
   if (first_time)
     {
-      AtkObjectFactory *factory;
-      AtkRegistry *registry;
-      GType derived_type; 
-      GType derived_atk_type; 
-
-      /*
-       * Figure out whether accessibility is enabled by looking at the
-       * type of the accessible object which would be created for
-       * the parent type of GtkIconView.
-       */
-      derived_type = g_type_parent (GTK_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, 
-                                      GTK_TYPE_ICON_VIEW,
-                                      gtk_icon_view_accessible_factory_get_type ());
+      _gtk_accessible_set_factory_type (GTK_TYPE_ICON_VIEW,
+                                        gtk_icon_view_accessible_factory_get_type ());
       first_time = FALSE;
-    } 
+    }
   return GTK_WIDGET_CLASS (gtk_icon_view_parent_class)->get_accessible (widget);
 }