]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkiconview.c
Reset gail library versioning to 0.0.0, since we changed soname
[~andy/gtk] / gtk / gtkiconview.c
index 81ef0bded7ea65b00b3101e89b5b58dd979b06ec..ebb63a12b0e2b542df9a158e944db11f04106e78 100644 (file)
@@ -46,7 +46,6 @@
 #undef DEBUG_ICON_VIEW
 
 #define SCROLL_EDGE_SIZE 15
-#define ITEM_PADDING     6
 
 #define GTK_ICON_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ICON_VIEW, GtkIconViewPrivate))
 
@@ -150,6 +149,7 @@ struct _GtkIconViewPrivate
   gint row_spacing;
   gint column_spacing;
   gint margin;
+  gint item_padding;
 
   gint text_column;
   gint markup_column;
@@ -160,8 +160,6 @@ struct _GtkIconViewPrivate
 
   gint tooltip_column;
 
-  guint draw_focus : 1;
-
   /* Drag-and-drop. */
   GdkModifierType start_button_mask;
   gint pressed_button;
@@ -186,7 +184,9 @@ struct _GtkIconViewPrivate
   guint empty_view_drop :1;
 
   guint ctrl_pressed : 1;
-  guint shift_pressed : 1;  
+  guint shift_pressed : 1;
+
+  guint draw_focus : 1;
 };
 
 /* Signals */
@@ -220,7 +220,8 @@ enum
   PROP_COLUMN_SPACING,
   PROP_MARGIN,
   PROP_REORDERABLE,
-  PROP_TOOLTIP_COLUMN
+  PROP_TOOLTIP_COLUMN,
+  PROP_ITEM_PADDING
 };
 
 /* GObject vfuncs */
@@ -714,7 +715,6 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
                                                     0, G_MAXINT, 6,
                                                     GTK_PARAM_READWRITE));
 
-
   /**
    * GtkIconView:orientation:
    *
@@ -758,6 +758,22 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
                                                        -1,
                                                        GTK_PARAM_READWRITE));
 
+  /**
+   * GtkIconView:item-padding:
+   *
+   * The item-padding property specifies the padding around each
+   * of the icon view's item.
+   *
+   * Since: 2.18
+   */
+  g_object_class_install_property (gobject_class,
+                                   PROP_ITEM_PADDING,
+                                   g_param_spec_int ("item-padding",
+                                                    P_("Item Padding"),
+                                                    P_("Padding around icon view items"),
+                                                    0, G_MAXINT, 6,
+                                                    GTK_PARAM_READWRITE));
+
 
 
   /* Style properties */
@@ -796,6 +812,17 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
                  G_TYPE_NONE, 2,
                  GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
 
+  /**
+   * GtkIconView::item-activated:
+   * @iconview: the object on which the signal is emitted
+   * @path: the #GtkTreePath for the activated item
+   *
+   * The ::item-activated signal is emitted when the method
+   * gtk_icon_view_item_activated() is called or the user double 
+   * clicks an item. It is also emitted when a non-editable item
+   * is selected and one of the keys: Space, Return or Enter is
+   * pressed.
+   */
   icon_view_signals[ITEM_ACTIVATED] =
     g_signal_new (I_("item-activated"),
                  G_TYPE_FROM_CLASS (gobject_class),
@@ -806,6 +833,13 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
                  G_TYPE_NONE, 1,
                  GTK_TYPE_TREE_PATH);
 
+  /**
+   * GtkIconView::selection-changed:
+   * @iconview: the object on which the signal is emitted
+   *
+   * The ::selection-changed signal is emitted when the selection
+   * (i.e. the set of selected items) changes.
+   */
   icon_view_signals[SELECTION_CHANGED] =
     g_signal_new (I_("selection-changed"),
                  G_TYPE_FROM_CLASS (gobject_class),
@@ -815,6 +849,19 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
                  g_cclosure_marshal_VOID__VOID,
                  G_TYPE_NONE, 0);
   
+  /**
+   * GtkIconView::select-all:
+   * @iconview: the object on which the signal is emitted
+   *
+   * A <link linkend="keybinding-signals">keybinding signal</link>
+   * which gets emitted when the user selects all items.
+   *
+   * Applications should not connect to it, but may emit it with
+   * g_signal_emit_by_name() if they need to control selection
+   * programmatically.
+   * 
+   * The default binding for this signal is Ctrl-a.
+   */
   icon_view_signals[SELECT_ALL] =
     g_signal_new (I_("select-all"),
                  G_TYPE_FROM_CLASS (gobject_class),
@@ -824,6 +871,19 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
                  g_cclosure_marshal_VOID__VOID,
                  G_TYPE_NONE, 0);
   
+  /**
+   * GtkIconView::unselect-all:
+   * @iconview: the object on which the signal is emitted
+   *
+   * A <link linkend="keybinding-signals">keybinding signal</link>
+   * which gets emitted when the user unselects all items.
+   *
+   * Applications should not connect to it, but may emit it with
+   * g_signal_emit_by_name() if they need to control selection
+   * programmatically.
+   * 
+   * The default binding for this signal is Ctrl-Shift-a. 
+   */
   icon_view_signals[UNSELECT_ALL] =
     g_signal_new (I_("unselect-all"),
                  G_TYPE_FROM_CLASS (gobject_class),
@@ -833,6 +893,20 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
                  g_cclosure_marshal_VOID__VOID,
                  G_TYPE_NONE, 0);
 
+  /**
+   * GtkIconView::select-cursor-item:
+   * @iconview: the object on which the signal is emitted
+   *
+   * A <link linkend="keybinding-signals">keybinding signal</link>
+   * which gets emitted when the user selects the item that is currently
+   * focused.
+   *
+   * Applications should not connect to it, but may emit it with
+   * g_signal_emit_by_name() if they need to control selection
+   * programmatically.
+   * 
+   * There is no default binding for this signal.
+   */
   icon_view_signals[SELECT_CURSOR_ITEM] =
     g_signal_new (I_("select-cursor-item"),
                  G_TYPE_FROM_CLASS (gobject_class),
@@ -842,6 +916,21 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
                  g_cclosure_marshal_VOID__VOID,
                  G_TYPE_NONE, 0);
 
+  /**
+   * GtkIconView::toggle-cursor-item:
+   * @iconview: the object on which the signal is emitted
+   *
+   * A <link linkend="keybinding-signals">keybinding signal</link>
+   * which gets emitted when the user toggles whether the currently
+   * focused item is selected or not. The exact effect of this 
+   * depend on the selection mode.
+   *
+   * Applications should not connect to it, but may emit it with
+   * g_signal_emit_by_name() if they need to control selection
+   * programmatically.
+   * 
+   * There is no default binding for this signal is Ctrl-Space.
+   */
   icon_view_signals[TOGGLE_CURSOR_ITEM] =
     g_signal_new (I_("toggle-cursor-item"),
                  G_TYPE_FROM_CLASS (gobject_class),
@@ -851,6 +940,20 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
                  g_cclosure_marshal_VOID__VOID,
                  G_TYPE_NONE, 0);
 
+  /**
+   * GtkIconView::activate-cursor-item:
+   * @iconview: the object on which the signal is emitted
+   *
+   * A <link linkend="keybinding-signals">keybinding signal</link>
+   * which gets emitted when the user activates the currently 
+   * focused item. 
+   *
+   * Applications should not connect to it, but may emit it with
+   * g_signal_emit_by_name() if they need to control activation
+   * programmatically.
+   * 
+   * The default bindings for this signal are Space, Return and Enter.
+   */
   icon_view_signals[ACTIVATE_CURSOR_ITEM] =
     g_signal_new (I_("activate-cursor-item"),
                  G_TYPE_FROM_CLASS (gobject_class),
@@ -860,6 +963,30 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
                  _gtk_marshal_BOOLEAN__VOID,
                  G_TYPE_BOOLEAN, 0);
   
+  /**
+   * GtkIconView::move-cursor:
+   * @iconview: the object which received the signal
+   * @step: the granularity of the move, as a #GtkMovementStep
+   * @count: the number of @step units to move
+   *
+   * The ::move-cursor signal is a
+   * <link linkend="keybinding-signals">keybinding signal</link>
+   * which gets emitted when the user initiates a cursor movement.
+   *
+   * Applications should not connect to it, but may emit it with
+   * g_signal_emit_by_name() if they need to control the cursor
+   * programmatically.
+   *
+   * The default bindings for this signal include
+   * <itemizedlist>
+   * <listitem>Arrow keys which move by individual steps</listitem>
+   * <listitem>Home/End keys which move to the first/last item</listitem>
+   * <listitem>PageUp/PageDown which move by "pages"</listitem>
+   * </itemizedlist>
+   *
+   * All of these will extend the selection when combined with
+   * the Shift modifier.
+   */
   icon_view_signals[MOVE_CURSOR] =
     g_signal_new (I_("move-cursor"),
                  G_TYPE_FROM_CLASS (gobject_class),
@@ -979,7 +1106,7 @@ gtk_icon_view_init (GtkIconView *icon_view)
   icon_view->priv->pixbuf_cell = -1;  
   icon_view->priv->tooltip_column = -1;  
 
-  GTK_WIDGET_SET_FLAGS (icon_view, GTK_CAN_FOCUS);
+  gtk_widget_set_can_focus (GTK_WIDGET (icon_view), TRUE);
   
   gtk_icon_view_set_adjustments (icon_view, NULL, NULL);
 
@@ -995,6 +1122,7 @@ gtk_icon_view_init (GtkIconView *icon_view)
   icon_view->priv->row_spacing = 6;
   icon_view->priv->column_spacing = 6;
   icon_view->priv->margin = 6;
+  icon_view->priv->item_padding = 6;
 
   icon_view->priv->draw_focus = TRUE;
 }
@@ -1105,6 +1233,10 @@ gtk_icon_view_set_property (GObject      *object,
       gtk_icon_view_set_tooltip_column (icon_view, g_value_get_int (value));
       break;
 
+    case PROP_ITEM_PADDING:
+      gtk_icon_view_set_item_padding (icon_view, g_value_get_int (value));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1166,6 +1298,10 @@ gtk_icon_view_get_property (GObject      *object,
       g_value_set_int (value, icon_view->priv->tooltip_column);
       break;
 
+    case PROP_ITEM_PADDING:
+      g_value_set_int (value, icon_view->priv->item_padding);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1182,7 +1318,7 @@ gtk_icon_view_realize (GtkWidget *widget)
   
   icon_view = GTK_ICON_VIEW (widget);
 
-  GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+  gtk_widget_set_realized (widget, TRUE);
 
   /* Make the main, clipping window */
   attributes.window_type = GDK_WINDOW_CHILD;
@@ -1246,7 +1382,7 @@ gtk_icon_view_state_changed (GtkWidget      *widget,
 {
   GtkIconView *icon_view = GTK_ICON_VIEW (widget);
 
-  if (GTK_WIDGET_REALIZED (widget))
+  if (gtk_widget_get_realized (widget))
     {
       gdk_window_set_background (widget->window, &widget->style->base[widget->state]);
       gdk_window_set_background (icon_view->priv->bin_window, &widget->style->base[widget->state]);
@@ -1261,7 +1397,7 @@ gtk_icon_view_style_set (GtkWidget *widget,
 {
   GtkIconView *icon_view = GTK_ICON_VIEW (widget);
 
-  if (GTK_WIDGET_REALIZED (widget))
+  if (gtk_widget_get_realized (widget))
     {
       gdk_window_set_background (widget->window, &widget->style->base[widget->state]);
       gdk_window_set_background (icon_view->priv->bin_window, &widget->style->base[widget->state]);
@@ -1289,7 +1425,7 @@ gtk_icon_view_size_request (GtkWidget      *widget,
 
       tmp_list = tmp_list->next;
 
-      if (GTK_WIDGET_VISIBLE (child->widget))
+      if (gtk_widget_get_visible (child->widget))
         gtk_widget_size_request (child->widget, &child_requisition);
     }  
 }
@@ -1307,10 +1443,10 @@ gtk_icon_view_allocate_children (GtkIconView *icon_view)
       /* totally ignore our child's requisition */
       if (child->cell < 0)
        {
-         allocation.x = child->item->x + ITEM_PADDING;
-         allocation.y = child->item->y + ITEM_PADDING;
-         allocation.width = child->item->width - ITEM_PADDING * 2;
-         allocation.height = child->item->height - ITEM_PADDING * 2;
+         allocation.x = child->item->x + icon_view->priv->item_padding;
+         allocation.y = child->item->y + icon_view->priv->item_padding;
+         allocation.width = child->item->width - icon_view->priv->item_padding * 2;
+         allocation.height = child->item->height - icon_view->priv->item_padding * 2;
        }
       else
        {
@@ -1336,7 +1472,7 @@ gtk_icon_view_size_allocate (GtkWidget      *widget,
 
   widget->allocation = *allocation;
   
-  if (GTK_WIDGET_REALIZED (widget))
+  if (gtk_widget_get_realized (widget))
     {
       gdk_window_move_resize (widget->window,
                              allocation->x, allocation->y,
@@ -1360,7 +1496,7 @@ gtk_icon_view_size_allocate (GtkWidget      *widget,
   hadjustment->upper = MAX (allocation->width, icon_view->priv->width);
 
   if (hadjustment->value > hadjustment->upper - hadjustment->page_size)
-    gtk_adjustment_set_value (hadjustment, hadjustment->upper - hadjustment->page_size);
+    gtk_adjustment_set_value (hadjustment, MAX (0, hadjustment->upper - hadjustment->page_size));
 
   vadjustment->page_size = allocation->height;
   vadjustment->page_increment = allocation->height * 0.9;
@@ -1369,9 +1505,9 @@ gtk_icon_view_size_allocate (GtkWidget      *widget,
   vadjustment->upper = MAX (allocation->height, icon_view->priv->height);
 
   if (vadjustment->value > vadjustment->upper - vadjustment->page_size)
-    gtk_adjustment_set_value (vadjustment, vadjustment->upper - vadjustment->page_size);
+    gtk_adjustment_set_value (vadjustment, MAX (0, vadjustment->upper - vadjustment->page_size));
 
-  if (GTK_WIDGET_REALIZED (widget) &&
+  if (gtk_widget_get_realized (widget) &&
       icon_view->priv->scroll_to_path)
     {
       GtkTreePath *path;
@@ -1409,6 +1545,11 @@ gtk_icon_view_expose (GtkWidget *widget,
   if (expose->window != icon_view->priv->bin_window)
     return FALSE;
 
+  /* If a layout has been scheduled, do it now so that all
+   * cell view items have valid sizes before we proceed. */
+  if (icon_view->priv->layout_idle_id != 0)
+    gtk_icon_view_layout (icon_view);
+
   cr = gdk_cairo_create (icon_view->priv->bin_window);
   cairo_set_line_width (cr, 1.);
 
@@ -1451,7 +1592,7 @@ gtk_icon_view_expose (GtkWidget *widget,
        case GTK_ICON_VIEW_DROP_INTO:
          gtk_paint_focus (widget->style,
                           icon_view->priv->bin_window,
-                          GTK_WIDGET_STATE (widget),
+                          gtk_widget_get_state (widget),
                           NULL,
                           widget,
                           "iconview-drop-indicator",
@@ -1461,7 +1602,7 @@ gtk_icon_view_expose (GtkWidget *widget,
        case GTK_ICON_VIEW_DROP_ABOVE:
          gtk_paint_focus (widget->style,
                           icon_view->priv->bin_window,
-                          GTK_WIDGET_STATE (widget),
+                          gtk_widget_get_state (widget),
                           NULL,
                           widget,
                           "iconview-drop-indicator",
@@ -1471,7 +1612,7 @@ gtk_icon_view_expose (GtkWidget *widget,
        case GTK_ICON_VIEW_DROP_LEFT:
          gtk_paint_focus (widget->style,
                           icon_view->priv->bin_window,
-                          GTK_WIDGET_STATE (widget),
+                          gtk_widget_get_state (widget),
                           NULL,
                           widget,
                           "iconview-drop-indicator",
@@ -1481,7 +1622,7 @@ gtk_icon_view_expose (GtkWidget *widget,
        case GTK_ICON_VIEW_DROP_BELOW:
          gtk_paint_focus (widget->style,
                           icon_view->priv->bin_window,
-                          GTK_WIDGET_STATE (widget),
+                          gtk_widget_get_state (widget),
                           NULL,
                           widget,
                           "iconview-drop-indicator",
@@ -1491,7 +1632,7 @@ gtk_icon_view_expose (GtkWidget *widget,
        case GTK_ICON_VIEW_DROP_RIGHT:
          gtk_paint_focus (widget->style,
                           icon_view->priv->bin_window,
-                          GTK_WIDGET_STATE (widget),
+                          gtk_widget_get_state (widget),
                           NULL,
                           widget,
                           "iconview-drop-indicator",
@@ -1527,11 +1668,17 @@ gtk_icon_view_expose (GtkWidget *widget,
 static gboolean
 rubberband_scroll_timeout (gpointer data)
 {
-  GtkIconView *icon_view = data;
+  GtkIconView *icon_view;
+  gdouble value;
 
-  gtk_adjustment_set_value (icon_view->priv->vadjustment,
-                            icon_view->priv->vadjustment->value +
-                            icon_view->priv->scroll_value_diff);
+  icon_view = data;
+
+  value = MIN (icon_view->priv->vadjustment->value +
+              icon_view->priv->scroll_value_diff,
+              icon_view->priv->vadjustment->upper -
+              icon_view->priv->vadjustment->page_size);
+
+  gtk_adjustment_set_value (icon_view->priv->vadjustment, value);
 
   gtk_icon_view_update_rubberband (icon_view);
   
@@ -1702,7 +1849,7 @@ gtk_icon_view_put (GtkIconView     *icon_view,
 
   icon_view->priv->children = g_list_append (icon_view->priv->children, child);
 
-  if (GTK_WIDGET_REALIZED (icon_view))
+  if (gtk_widget_get_realized (GTK_WIDGET (icon_view)))
     gtk_widget_set_parent_window (child->widget, icon_view->priv->bin_window);
   
   gtk_widget_set_parent (widget, GTK_WIDGET (icon_view));
@@ -1728,7 +1875,7 @@ gtk_icon_view_remove_widget (GtkCellEditable *editable,
       info->editing = FALSE;
     }
 
-  if (GTK_WIDGET_HAS_FOCUS (editable))
+  if (gtk_widget_has_focus (GTK_WIDGET (editable)))
     gtk_widget_grab_focus (GTK_WIDGET (icon_view));
   
   g_signal_handlers_disconnect_by_func (editable,
@@ -1845,11 +1992,11 @@ gtk_icon_view_stop_editing (GtkIconView *icon_view,
  * gtk_icon_view_set_cursor:
  * @icon_view: A #GtkIconView
  * @path: A #GtkTreePath
- * @cell: One of the cell renderers of @icon_view, or %NULL
+ * @cell: (allow-none): One of the cell renderers of @icon_view, or %NULL
  * @start_editing: %TRUE if the specified cell should start being edited.
  *
  * Sets the current keyboard focus to be at @path, and selects it.  This is
- * useful when you want to focus the user's attention on a particular item.  
+ * useful when you want to focus the user's attention on a particular item.
  * If @cell is not %NULL, then focus is given to the cell specified by 
  * it. Additionally, if @start_editing is %TRUE, then editing should be 
  * started in the specified cell.  
@@ -1910,8 +2057,8 @@ gtk_icon_view_set_cursor (GtkIconView     *icon_view,
 /**
  * gtk_icon_view_get_cursor:
  * @icon_view: A #GtkIconView
- * @path: Return location for the current cursor path, or %NULL
- * @cell: Return location the current focus cell, or %NULL
+ * @path: (allow-none): Return location for the current cursor path, or %NULL
+ * @cell: (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.  
@@ -1975,7 +2122,7 @@ gtk_icon_view_button_press (GtkWidget      *widget,
   if (event->window != icon_view->priv->bin_window)
     return FALSE;
 
-  if (!GTK_WIDGET_HAS_FOCUS (widget))
+  if (!gtk_widget_has_focus (widget))
     gtk_widget_grab_focus (widget);
 
   if (event->button == 1 && event->type == GDK_BUTTON_PRESS)
@@ -2033,14 +2180,11 @@ gtk_icon_view_button_press (GtkWidget      *widget,
                }
              else
                {
-                 if (!item->selected)
-                   {
-                     gtk_icon_view_unselect_all_internal (icon_view);
-                     
-                     item->selected = TRUE;
-                     gtk_icon_view_queue_draw_item (icon_view, item);
-                     dirty = TRUE;
-                   }
+                 gtk_icon_view_unselect_all_internal (icon_view);
+
+                 item->selected = TRUE;
+                 gtk_icon_view_queue_draw_item (icon_view, item);
+                 dirty = TRUE;
                }
              gtk_icon_view_set_cursor_item (icon_view, item, cursor_cell);
              icon_view->priv->anchor_item = item;
@@ -2508,7 +2652,7 @@ static void
 gtk_icon_view_adjustment_changed (GtkAdjustment *adjustment,
                                  GtkIconView   *icon_view)
 {
-  if (GTK_WIDGET_REALIZED (icon_view))
+  if (gtk_widget_get_realized (GTK_WIDGET (icon_view)))
     {
       gdk_window_move (icon_view->priv->bin_window,
                       - icon_view->priv->hadjustment->value,
@@ -2710,7 +2854,7 @@ gtk_icon_view_layout (GtkIconView *icon_view)
       icon_view->priv->height != widget->requisition.height)
     gtk_widget_queue_resize_no_redraw (widget);
 
-  if (GTK_WIDGET_REALIZED (icon_view))
+  if (gtk_widget_get_realized (GTK_WIDGET (icon_view)))
     gdk_window_resize (icon_view->priv->bin_window,
                       MAX (icon_view->priv->width, widget->allocation.width),
                       MAX (icon_view->priv->height, widget->allocation.height));
@@ -2744,16 +2888,16 @@ gtk_icon_view_get_cell_area (GtkIconView         *icon_view,
   if (icon_view->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
     {
       cell_area->x = item->box[info->position].x - item->before[info->position];
-      cell_area->y = item->y + ITEM_PADDING;
+      cell_area->y = item->y + icon_view->priv->item_padding;
       cell_area->width = item->box[info->position].width + 
        item->before[info->position] + item->after[info->position];
-      cell_area->height = item->height - ITEM_PADDING * 2;
+      cell_area->height = item->height - icon_view->priv->item_padding * 2;
     }
   else
     {
-      cell_area->x = item->x + ITEM_PADDING;
+      cell_area->x = item->x + icon_view->priv->item_padding;
       cell_area->y = item->box[info->position].y - item->before[info->position];
-      cell_area->width = item->width - ITEM_PADDING * 2;
+      cell_area->width = item->width - icon_view->priv->item_padding * 2;
       cell_area->height = item->box[info->position].height + 
        item->before[info->position] + item->after[info->position];
     }
@@ -2802,19 +2946,16 @@ adjust_wrap_width (GtkIconView     *icon_view,
       else
        item_width = item->width;
 
-      if (item->width == -1)
-        {
-         if (item_width > 0)
-           wrap_width = item_width - pixbuf_width - icon_view->priv->spacing;
-         else
-           wrap_width = MAX (2 * pixbuf_width, 50);
-       }
-      else if (icon_view->priv->orientation == GTK_ORIENTATION_VERTICAL)
-       wrap_width = item_width;
-      else
-       wrap_width = item_width - pixbuf_width - icon_view->priv->spacing;
+      if (icon_view->priv->orientation == GTK_ORIENTATION_VERTICAL)
+        wrap_width = item_width;
+      else {
+        if (item->width == -1 && item_width <= 0)
+          wrap_width = MAX (2 * pixbuf_width, 50);
+        else
+          wrap_width = item_width - pixbuf_width - icon_view->priv->spacing;
+        }
 
-      wrap_width -= ITEM_PADDING * 2;
+      wrap_width -= icon_view->priv->item_padding * 2;
 
       g_object_set (text_info->cell, "wrap-width", wrap_width, NULL);
       g_object_set (text_info->cell, "width", wrap_width, NULL);
@@ -2875,8 +3016,8 @@ gtk_icon_view_calculate_item_size (GtkIconView     *icon_view,
        }
     }
 
-  item->width += ITEM_PADDING * 2;
-  item->height += ITEM_PADDING * 2;
+  item->width += icon_view->priv->item_padding * 2;
+  item->height += icon_view->priv->item_padding * 2;
 }
 
 static void
@@ -2905,8 +3046,8 @@ gtk_icon_view_calculate_item_size2 (GtkIconView     *icon_view,
        item->height += max_height[i] + (i > 0 ? spacing : 0);
     }
 
-  cell_area.x = item->x + ITEM_PADDING;
-  cell_area.y = item->y + ITEM_PADDING;
+  cell_area.x = item->x + icon_view->priv->item_padding;
+  cell_area.y = item->y + icon_view->priv->item_padding;
       
   for (k = 0; k < 2; k++)
     for (l = icon_view->priv->cell_list, i = 0; l; l = l->next, i++)
@@ -2921,7 +3062,7 @@ gtk_icon_view_calculate_item_size2 (GtkIconView     *icon_view,
 
        if (icon_view->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
          {
-            /* We should not subtract ITEM_PADDING from item->height,
+            /* We should not subtract icon_view->priv->item_padding from item->height,
              * because item->height is recalculated above using
              * max_height which does not contain item padding.
              */
@@ -2933,7 +3074,7 @@ gtk_icon_view_calculate_item_size2 (GtkIconView     *icon_view,
             /* item->width is not recalculated and thus needs to be
              * corrected for the padding.
              */
-           cell_area.width = item->width - 2 * ITEM_PADDING;
+           cell_area.width = item->width - 2 * icon_view->priv->item_padding;
            cell_area.height = max_height[i];
          }
        
@@ -2952,9 +3093,9 @@ gtk_icon_view_calculate_item_size2 (GtkIconView     *icon_view,
          }
        else
          {
-           if (item->box[info->position].width > item->width - ITEM_PADDING * 2)
+           if (item->box[info->position].width > item->width - icon_view->priv->item_padding * 2)
              {
-               item->width = item->box[info->position].width + ITEM_PADDING * 2;
+               item->width = item->box[info->position].width + icon_view->priv->item_padding * 2;
                cell_area.width = item->width;
              }
            item->before[info->position] = item->box[info->position].y - cell_area.y;
@@ -2972,7 +3113,7 @@ gtk_icon_view_calculate_item_size2 (GtkIconView     *icon_view,
        }      
     }
 
-  item->height += ITEM_PADDING * 2;
+  item->height += icon_view->priv->item_padding * 2;
 }
 
 static void
@@ -3021,7 +3162,7 @@ gtk_icon_view_paint_item (GtkIconView     *icon_view,
   if (item->selected)
     {
       flags = GTK_CELL_RENDERER_SELECTED;
-      if (GTK_WIDGET_HAS_FOCUS (icon_view))
+      if (gtk_widget_has_focus (GTK_WIDGET (icon_view)))
        state = GTK_STATE_SELECTED;
       else
        state = GTK_STATE_ACTIVE;
@@ -3090,7 +3231,7 @@ gtk_icon_view_paint_item (GtkIconView     *icon_view,
     }
 
   if (draw_focus &&
-      GTK_WIDGET_HAS_FOCUS (icon_view) &&
+      gtk_widget_has_focus (GTK_WIDGET (icon_view)) &&
       item == icon_view->priv->cursor_item)
     {
       for (l = icon_view->priv->cell_list, i = 0; l; l = l->next, i++)
@@ -3333,6 +3474,9 @@ gtk_icon_view_get_item_at_coords (GtkIconView          *icon_view,
   GList *items, *l;
   GdkRectangle box;
 
+  if (cell_at_pos)
+    *cell_at_pos = NULL;
+
   for (items = icon_view->priv->items; items; items = items->next)
     {
       GtkIconViewItem *item = items->data;
@@ -3347,12 +3491,12 @@ gtk_icon_view_get_item_at_coords (GtkIconView          *icon_view,
              for (l = icon_view->priv->cell_list; l; l = l->next)
                {
                  GtkIconViewCellInfo *info = (GtkIconViewCellInfo *)l->data;
-                 
+
                  if (!info->cell->visible)
                    continue;
-                 
+
                  gtk_icon_view_get_cell_box (icon_view, item, info, &box);
-                 
+
                  if ((x >= box.x && x <= box.x + box.width &&
                       y >= box.y && y <= box.y + box.height) ||
                      (x >= box.x  &&
@@ -3362,16 +3506,13 @@ gtk_icon_view_get_item_at_coords (GtkIconView          *icon_view,
                    {
                      if (cell_at_pos)
                        *cell_at_pos = info;
-                     
+
                      return item;
                    }
                }
 
              if (only_in_cell)
                return NULL;
-             
-             if (cell_at_pos)
-               *cell_at_pos = NULL;
            }
 
          return item;
@@ -3685,7 +3826,7 @@ gtk_icon_view_real_move_cursor (GtkIconView     *icon_view,
                        step == GTK_MOVEMENT_PAGES ||
                        step == GTK_MOVEMENT_BUFFER_ENDS, FALSE);
 
-  if (!GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (icon_view)))
+  if (!gtk_widget_has_focus (GTK_WIDGET (icon_view)))
     return FALSE;
 
   gtk_icon_view_stop_editing (icon_view, FALSE);
@@ -3940,7 +4081,7 @@ gtk_icon_view_move_cursor_up_down (GtkIconView *icon_view,
   gboolean dirty = FALSE;
   gint step;
   
-  if (!GTK_WIDGET_HAS_FOCUS (icon_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (icon_view)))
     return;
   
   if (!icon_view->priv->cursor_item)
@@ -4009,7 +4150,7 @@ gtk_icon_view_move_cursor_page_up_down (GtkIconView *icon_view,
   GtkIconViewItem *item;
   gboolean dirty = FALSE;
   
-  if (!GTK_WIDGET_HAS_FOCUS (icon_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (icon_view)))
     return;
   
   if (!icon_view->priv->cursor_item)
@@ -4066,7 +4207,7 @@ gtk_icon_view_move_cursor_left_right (GtkIconView *icon_view,
   gboolean dirty = FALSE;
   gint step;
   
-  if (!GTK_WIDGET_HAS_FOCUS (icon_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (icon_view)))
     return;
   
   if (!icon_view->priv->cursor_item)
@@ -4135,7 +4276,7 @@ gtk_icon_view_move_cursor_start_end (GtkIconView *icon_view,
   GList *list;
   gboolean dirty = FALSE;
   
-  if (!GTK_WIDGET_HAS_FOCUS (icon_view))
+  if (!gtk_widget_has_focus (GTK_WIDGET (icon_view)))
     return;
   
   if (count < 0)
@@ -4217,7 +4358,8 @@ gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
     item = g_list_nth_data (icon_view->priv->items,
                            gtk_tree_path_get_indices(path)[0]);
   
-  if (!GTK_WIDGET_REALIZED (icon_view) || !item || item->width < 0)
+  if (!item || item->width < 0 ||
+      !gtk_widget_get_realized (GTK_WIDGET (icon_view)))
     {
       if (icon_view->priv->scroll_to_path)
        gtk_tree_row_reference_free (icon_view->priv->scroll_to_path);
@@ -4238,7 +4380,7 @@ gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
     {
       gint x, y;
       gint focus_width;
-      gfloat offset;
+      gfloat offset, value;
 
       gtk_widget_style_get (GTK_WIDGET (icon_view),
                            "focus-line-width", &focus_width,
@@ -4248,15 +4390,17 @@ gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
       
       offset =  y + item->y - focus_width - 
        row_align * (GTK_WIDGET (icon_view)->allocation.height - item->height);
-
-      gtk_adjustment_set_value (icon_view->priv->vadjustment,
-                                icon_view->priv->vadjustment->value + offset);
+      value = CLAMP (icon_view->priv->vadjustment->value + offset, 
+                    icon_view->priv->vadjustment->lower,
+                    icon_view->priv->vadjustment->upper - icon_view->priv->vadjustment->page_size);
+      gtk_adjustment_set_value (icon_view->priv->vadjustment, value);
 
       offset = x + item->x - focus_width - 
        col_align * (GTK_WIDGET (icon_view)->allocation.width - item->width);
-
-      gtk_adjustment_set_value (icon_view->priv->hadjustment,
-                                icon_view->priv->hadjustment->value + offset);
+      value = CLAMP (icon_view->priv->hadjustment->value + offset, 
+                    icon_view->priv->hadjustment->lower,
+                    icon_view->priv->hadjustment->upper - icon_view->priv->hadjustment->page_size);
+      gtk_adjustment_set_value (icon_view->priv->hadjustment, value);
 
       gtk_adjustment_changed (icon_view->priv->hadjustment);
       gtk_adjustment_changed (icon_view->priv->vadjustment);
@@ -4683,7 +4827,7 @@ 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: Return location for the path, or %NULL
+ * @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
  * 
@@ -4759,7 +4903,7 @@ gtk_icon_view_set_tooltip_item (GtkIconView     *icon_view,
  * @icon_view: a #GtkIconView
  * @tooltip: a #GtkTooltip
  * @path: a #GtkTreePath
- * @cell: a #GtkCellRenderer or %NULL
+ * @cell: (allow-none): a #GtkCellRenderer or %NULL
  *
  * Sets the tip area of @tooltip to the area which @cell occupies in
  * the item pointed to by @path. See also gtk_tooltip_set_tip_area().
@@ -4820,9 +4964,9 @@ gtk_icon_view_set_tooltip_cell (GtkIconView     *icon_view,
  * @x: the x coordinate (relative to widget coordinates)
  * @y: the y coordinate (relative to widget coordinates)
  * @keyboard_tip: whether this is a keyboard tooltip or not
- * @model: a pointer to receive a #GtkTreeModel or %NULL
- * @path: a pointer to receive a #GtkTreePath or %NULL
- * @iter: a pointer to receive a #GtkTreeIter or %NULL
+ * @model: (allow-none): a pointer to receive a #GtkTreeModel or %NULL
+ * @path: (allow-none): a pointer to receive a #GtkTreePath or %NULL
+ * @iter: (allow-none): a pointer to receive a #GtkTreeIter or %NULL
  *
  * This function is supposed to be used in a #GtkWidget::query-tooltip
  * signal handler for #GtkIconView.  The @x, @y and @keyboard_tip values
@@ -4992,8 +5136,8 @@ gtk_icon_view_get_tooltip_column (GtkIconView *icon_view)
 /**
  * gtk_icon_view_get_visible_range:
  * @icon_view: A #GtkIconView
- * @start_path: Return location for start of region, or %NULL
- * @end_path: Return location for end of region, or %NULL
+ * @start_path: (allow-none): Return location for start of region, or %NULL
+ * @end_path: (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.
@@ -5123,10 +5267,10 @@ gtk_icon_view_get_selection_mode (GtkIconView *icon_view)
 /**
  * gtk_icon_view_set_model:
  * @icon_view: A #GtkIconView.
- * @model: The model.
+ * @model: (allow-none): The model.
  *
- * Sets the model for a #GtkIconView.  
- * If the @icon_view already has a model set, it will remove 
+ * Sets the model for a #GtkIconView.
+ * If the @icon_view already has a model set, it will remove
  * it before setting the new model.  If @model is %NULL, then
  * it will unset the old model.
  *
@@ -5238,7 +5382,7 @@ gtk_icon_view_set_model (GtkIconView *icon_view,
 
   g_object_notify (G_OBJECT (icon_view), "model");  
 
-  if (GTK_WIDGET_REALIZED (icon_view))
+  if (gtk_widget_get_realized (GTK_WIDGET (icon_view)))
     gtk_widget_queue_resize (GTK_WIDGET (icon_view));
 }
 
@@ -5651,11 +5795,11 @@ gtk_icon_view_unselect_path (GtkIconView *icon_view,
  *
  * To free the return value, use:
  * |[
- * g_list_foreach (list, gtk_tree_path_free, NULL);
+ * g_list_foreach (list, (GFunc)gtk_tree_path_free, NULL);
  * g_list_free (list);
  * ]|
  *
- * Return value: A #GList containing a #GtkTreePath for each selected row.
+ * Return value: (element-type GtkTreePath) (transfer full): A #GList containing a #GtkTreePath for each selected row.
  *
  * Since: 2.6
  **/
@@ -6126,6 +6270,51 @@ gtk_icon_view_get_margin (GtkIconView *icon_view)
   return icon_view->priv->margin;
 }
 
+/**
+ * gtk_icon_view_set_item_padding:
+ * @icon_view: a #GtkIconView
+ * @item_padding: the item padding
+ *
+ * Sets the #GtkIconView:item-padding property which specifies the padding
+ * around each of the icon view's items.
+ *
+ * Since: 2.18
+ */
+void
+gtk_icon_view_set_item_padding (GtkIconView *icon_view,
+                               gint         item_padding)
+{
+  g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
+  
+  if (icon_view->priv->item_padding != item_padding)
+    {
+      icon_view->priv->item_padding = item_padding;
+
+      gtk_icon_view_stop_editing (icon_view, TRUE);
+      gtk_icon_view_invalidate_sizes (icon_view);
+      gtk_icon_view_queue_layout (icon_view);
+      
+      g_object_notify (G_OBJECT (icon_view), "item-padding");
+    }  
+}
+
+/**
+ * gtk_icon_view_get_item_padding:
+ * @icon_view: a #GtkIconView
+ * 
+ * Returns the value of the ::item-padding property.
+ * 
+ * Return value: the padding around items
+ *
+ * Since: 2.18
+ */
+gint
+gtk_icon_view_get_item_padding (GtkIconView *icon_view)
+{
+  g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
+
+  return icon_view->priv->item_padding;
+}
 
 /* Get/set whether drag_motion requested the drag data and
  * drag_data_received should thus not actually insert the data,
@@ -6296,6 +6485,7 @@ gtk_icon_view_autoscroll (GtkIconView *icon_view)
 {
   gint px, py, x, y, width, height;
   gint hoffset, voffset;
+  gfloat value;
 
   gdk_window_get_pointer (GTK_WIDGET (icon_view)->window, &px, &py, NULL);
   gdk_window_get_geometry (GTK_WIDGET (icon_view)->window, &x, &y, &width, &height, NULL);
@@ -6310,12 +6500,19 @@ gtk_icon_view_autoscroll (GtkIconView *icon_view)
     hoffset = MAX (px - (x + width - 2 * SCROLL_EDGE_SIZE), 0);
 
   if (voffset != 0)
-    gtk_adjustment_set_value (icon_view->priv->vadjustment,
-                              icon_view->priv->vadjustment->value + voffset);
-
+    {
+      value = CLAMP (icon_view->priv->vadjustment->value + voffset, 
+                    icon_view->priv->vadjustment->lower,
+                    icon_view->priv->vadjustment->upper - icon_view->priv->vadjustment->page_size);
+      gtk_adjustment_set_value (icon_view->priv->vadjustment, value);
+    }
   if (hoffset != 0)
-    gtk_adjustment_set_value (icon_view->priv->hadjustment,
-                              icon_view->priv->hadjustment->value + hoffset);
+    {
+      value = CLAMP (icon_view->priv->hadjustment->value + hoffset, 
+                    icon_view->priv->hadjustment->lower,
+                    icon_view->priv->hadjustment->upper - icon_view->priv->hadjustment->page_size);
+      gtk_adjustment_set_value (icon_view->priv->hadjustment, value);
+    }
 }
 
 
@@ -6898,8 +7095,9 @@ gtk_icon_view_drag_data_received (GtkWidget        *widget,
  * @n_targets: the number of items in @targets
  * @actions: the bitmask of possible actions for a drag from this
  *    widget
- * 
- * Turns @icon_view into a drag source for automatic DND.
+ *
+ * Turns @icon_view into a drag source for automatic DND. Calling this
+ * method sets #GtkIconView:reorderable to %FALSE.
  *
  * Since: 2.8
  **/
@@ -6929,8 +7127,9 @@ gtk_icon_view_enable_model_drag_source (GtkIconView              *icon_view,
  * @n_targets: the number of items in @targets
  * @actions: the bitmask of possible actions for a drag to this
  *    widget
- * 
- * Turns @icon_view into a drop destination for automatic DND.
+ *
+ * Turns @icon_view into a drop destination for automatic DND. Calling this
+ * method sets #GtkIconView:reorderable to %FALSE.
  *
  * Since: 2.8
  **/
@@ -6955,7 +7154,8 @@ gtk_icon_view_enable_model_drag_dest (GtkIconView          *icon_view,
  * gtk_icon_view_unset_model_drag_source:
  * @icon_view: a #GtkIconView
  * 
- * Undoes the effect of gtk_icon_view_enable_model_drag_source().
+ * Undoes the effect of gtk_icon_view_enable_model_drag_source(). Calling this
+ * method sets #GtkIconView:reorderable to %FALSE.
  *
  * Since: 2.8
  **/
@@ -6977,7 +7177,8 @@ gtk_icon_view_unset_model_drag_source (GtkIconView *icon_view)
  * gtk_icon_view_unset_model_drag_dest:
  * @icon_view: a #GtkIconView
  * 
- * Undoes the effect of gtk_icon_view_enable_model_drag_dest().
+ * Undoes the effect of gtk_icon_view_enable_model_drag_dest(). Calling this
+ * method sets #GtkIconView:reorderable to %FALSE.
  *
  * Since: 2.8
  **/
@@ -6999,9 +7200,9 @@ gtk_icon_view_unset_model_drag_dest (GtkIconView *icon_view)
 /**
  * gtk_icon_view_set_drag_dest_item:
  * @icon_view: a #GtkIconView
- * @path: The path of the item to highlight, or %NULL.
+ * @path: (allow-none): The path of the item to highlight, or %NULL.
  * @pos: Specifies where to drop, relative to the item
- * 
+ *
  * Sets the item that is highlighted for feedback.
  *
  * Since: 2.8
@@ -7030,7 +7231,7 @@ gtk_icon_view_set_drag_dest_item (GtkIconView              *icon_view,
   
   /* special case a drop on an empty model */
   icon_view->priv->empty_view_drop = FALSE;
-  if (pos == GTK_TREE_VIEW_DROP_BEFORE && path
+  if (pos == GTK_ICON_VIEW_DROP_ABOVE && path
       && gtk_tree_path_get_depth (path) == 1
       && gtk_tree_path_get_indices (path)[0] == 0)
     {
@@ -7058,8 +7259,8 @@ gtk_icon_view_set_drag_dest_item (GtkIconView              *icon_view,
 /**
  * gtk_icon_view_get_drag_dest_item:
  * @icon_view: a #GtkIconView
- * @path: Return location for the path of the highlighted item, or %NULL.
- * @pos: Return location for the drop position, or %NULL
+ * @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
  * 
  * Gets information about the item that is highlighted for feedback.
  *
@@ -7089,8 +7290,8 @@ 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: Return location for the path of the item, or %NULL.
- * @pos: Return location for the drop position, or %NULL
+ * @path: (allow-none): Return location for the path of the item, or %NULL.
+ * @pos: (allow-none): Return location for the drop position, or %NULL
  * 
  * Determines the destination item for a given position.
  * 
@@ -7176,7 +7377,7 @@ gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
 
   widget = GTK_WIDGET (icon_view);
 
-  if (!GTK_WIDGET_REALIZED (widget))
+  if (!gtk_widget_get_realized (widget))
     return NULL;
 
   index = gtk_tree_path_get_indices (path)[0];
@@ -7196,7 +7397,7 @@ gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
          cairo_set_line_width (cr, 1.);
 
          gdk_cairo_set_source_color
-           (cr, &widget->style->base[GTK_WIDGET_STATE (widget)]);
+           (cr, &widget->style->base[gtk_widget_get_state (widget)]);
          cairo_rectangle (cr, 0, 0, item->width + 2, item->height + 2);
          cairo_fill (cr);
 
@@ -7255,7 +7456,9 @@ static const GtkTargetEntry item_targets[] = {
  * #GtkTreeStore and #GtkListStore support these.  If @reorderable is %TRUE, then
  * the user can reorder the model by dragging and dropping rows.  The
  * developer can listen to these changes by connecting to the model's
- * row_inserted and row_deleted signals.
+ * row_inserted and row_deleted signals. The reordering is implemented by setting up
+ * the icon view as a drag source and destination. Therefore, drag and
+ * drop can not be used in a reorderable view for any other purpose.
  *
  * This function does not give you any degree of control over the order -- any
  * reordering is allowed.  If more control is needed, you should probably
@@ -7486,7 +7689,7 @@ gtk_icon_view_item_accessible_image_set_image_description (AtkImage    *image,
   item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (image);
 
   g_free (item->image_description);
-  item->image_description = g_strdup (item->image_description);
+  item->image_description = g_strdup (description);
 
   return TRUE;
 }
@@ -8285,7 +8488,7 @@ gtk_icon_view_item_accessible_grab_focus (AtkComponent *component)
   gtk_widget_grab_focus (item->widget);
   gtk_icon_view_set_cursor_item (GTK_ICON_VIEW (item->widget), item->item, -1);
   toplevel = gtk_widget_get_toplevel (GTK_WIDGET (item->widget));
-  if (GTK_WIDGET_TOPLEVEL (toplevel))
+  if (gtk_widget_is_toplevel (toplevel))
     gtk_window_present (GTK_WINDOW (toplevel));
 
   return TRUE;
@@ -8566,25 +8769,25 @@ gtk_icon_view_item_accessible_get_type (void)
         NULL /* value table */
       };
 
-      static const GInterfaceInfo atk_component_info =
+      const GInterfaceInfo atk_component_info =
       {
         (GInterfaceInitFunc) atk_component_item_interface_init,
         (GInterfaceFinalizeFunc) NULL,
         NULL
       };
-      static const GInterfaceInfo atk_action_info =
+      const GInterfaceInfo atk_action_info =
       {
         (GInterfaceInitFunc) atk_action_item_interface_init,
         (GInterfaceFinalizeFunc) NULL,
         NULL
       };
-      static const GInterfaceInfo atk_image_info =
+      const GInterfaceInfo atk_image_info =
       {
         (GInterfaceInitFunc) atk_image_item_interface_init,
         (GInterfaceFinalizeFunc) NULL,
         NULL
       };
-      static const GInterfaceInfo atk_text_info =
+      const GInterfaceInfo atk_text_info =
       {
         (GInterfaceInitFunc) atk_text_item_interface_init,
         (GInterfaceFinalizeFunc) NULL,
@@ -8884,27 +9087,32 @@ gtk_icon_view_accessible_model_row_changed (GtkTreeModel *tree_model,
   GtkIconViewItem *item;
   GtkIconViewAccessible *a11y_view;
   GtkIconViewItemAccessible *a11y_item;
-  gchar *name, *text;
+  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_accessible_find_child (atk_obj, index);
+  a11y_item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (
+      gtk_icon_view_accessible_find_child (atk_obj, index));
 
-  widget = GTK_ACCESSIBLE (atk_obj)->widget;
-  icon_view = GTK_ICON_VIEW (widget);
-  item = a11y_item->item;
+  if (a11y_item)
+    {
+      widget = GTK_ACCESSIBLE (atk_obj)->widget;
+      icon_view = GTK_ICON_VIEW (widget);
+      item = a11y_item->item;
 
-  name = gtk_icon_view_item_accessible_get_name (ATK_OBJECT (a11y_item));
+      name = gtk_icon_view_item_accessible_get_name (ATK_OBJECT (a11y_item));
 
-  if (!name || strcmp (name, "") == 0)
-    {
-      gtk_icon_view_set_cell_data (icon_view, item);
-      text = get_text (icon_view, item);
-      if (text)
+      if (!name || strcmp (name, "") == 0)
         {
-          gtk_text_buffer_set_text (a11y_item->text_buffer, text, -1);
-          g_free (text);
+          gtk_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);
+            }
         }
     }
 
@@ -9504,7 +9712,7 @@ gtk_icon_view_accessible_get_type (void)
 
   if (!type)
     {
-      static GTypeInfo tinfo =
+      GTypeInfo tinfo =
       {
         0, /* class size */
         (GBaseInitFunc) NULL, /* base init */
@@ -9517,13 +9725,13 @@ gtk_icon_view_accessible_get_type (void)
         (GInstanceInitFunc) NULL, /* instance init */
         NULL /* value table */
       };
-      static const GInterfaceInfo atk_component_info =
+      const GInterfaceInfo atk_component_info =
       {
         (GInterfaceInitFunc) atk_component_interface_init,
         (GInterfaceFinalizeFunc) NULL,
         NULL
       };
-      static const GInterfaceInfo atk_selection_info = 
+      const GInterfaceInfo atk_selection_info =
       {
         (GInterfaceInitFunc) gtk_icon_view_accessible_selection_interface_init,
         (GInterfaceFinalizeFunc) NULL,