* Boston, MA 02111-1307, USA.
*/
-#include <config.h>
+#include "config.h"
#include <string.h>
#include <atk/atk.h>
#include "gtkbindings.h"
#include "gtkdnd.h"
#include "gtkmain.h"
-#include "gtksignal.h"
#include "gtkintl.h"
#include "gtkaccessible.h"
#include "gtkwindow.h"
gint row_spacing;
gint column_spacing;
gint margin;
+ gint item_padding;
gint text_column;
gint markup_column;
gint press_start_x;
gint press_start_y;
- GtkTargetList *source_targets;
GdkDragAction source_actions;
-
- GtkTargetList *dest_targets;
GdkDragAction dest_actions;
GtkTreeRowReference *dest_item;
guint empty_view_drop :1;
guint ctrl_pressed : 1;
- guint shift_pressed : 1;
+ guint shift_pressed : 1;
+
+ guint draw_focus : 1;
};
/* Signals */
PROP_COLUMN_SPACING,
PROP_MARGIN,
PROP_REORDERABLE,
- PROP_TOOLTIP_COLUMN
+ PROP_TOOLTIP_COLUMN,
+ PROP_ITEM_PADDING
};
/* GObject vfuncs */
GdkEventMotion *event);
static void remove_scroll_timeout (GtkIconView *icon_view);
-static void clear_dest_info (GtkIconView *icon_view);
-static void clear_source_info (GtkIconView *icon_view);
static void adjust_wrap_width (GtkIconView *icon_view,
GtkIconViewItem *item);
0, G_MAXINT, 6,
GTK_PARAM_READWRITE));
-
/**
* GtkIconView:orientation:
*
-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 */
GTK_PARAM_READABLE));
/* Signals */
+ /**
+ * GtkIconView::set-scroll-adjustments
+ * @horizontal: the horizontal #GtkAdjustment
+ * @vertical: the vertical #GtkAdjustment
+ *
+ * Set the scroll adjustments for the icon view. Usually scrolled containers
+ * like #GtkScrolledWindow will emit this signal to connect two instances
+ * of #GtkScrollbar to the scroll directions of the #GtkIconView.
+ */
widget_class->set_scroll_adjustments_signal =
- g_signal_new (I_("set_scroll_adjustments"),
+ g_signal_new (I_("set-scroll-adjustments"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkIconViewClass, set_scroll_adjustments),
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_signal_new (I_("item-activated"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkIconViewClass, item_activated),
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),
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_signal_new (I_("select-all"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkIconViewClass, select_all),
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_signal_new (I_("unselect-all"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkIconViewClass, unselect_all),
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_signal_new (I_("select-cursor-item"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkIconViewClass, select_cursor_item),
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_signal_new (I_("toggle-cursor-item"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkIconViewClass, toggle_cursor_item),
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_signal_new (I_("activate-cursor-item"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkIconViewClass, activate_cursor_item),
_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_signal_new (I_("move-cursor"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkIconViewClass, move_cursor),
/* Key bindings */
gtk_binding_entry_add_signal (binding_set, GDK_a, GDK_CONTROL_MASK,
- "select_all", 0);
+ "select-all", 0);
gtk_binding_entry_add_signal (binding_set, GDK_a, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
- "unselect_all", 0);
+ "unselect-all", 0);
gtk_binding_entry_add_signal (binding_set, GDK_space, GDK_CONTROL_MASK,
- "toggle_cursor_item", 0);
+ "toggle-cursor-item", 0);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Space, GDK_CONTROL_MASK,
- "toggle_cursor_item", 0);
+ "toggle-cursor-item", 0);
gtk_binding_entry_add_signal (binding_set, GDK_space, 0,
- "activate_cursor_item", 0);
+ "activate-cursor-item", 0);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Space, 0,
- "activate_cursor_item", 0);
+ "activate-cursor-item", 0);
gtk_binding_entry_add_signal (binding_set, GDK_Return, 0,
- "activate_cursor_item", 0);
+ "activate-cursor-item", 0);
gtk_binding_entry_add_signal (binding_set, GDK_ISO_Enter, 0,
- "activate_cursor_item", 0);
+ "activate-cursor-item", 0);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0,
- "activate_cursor_item", 0);
+ "activate-cursor-item", 0);
gtk_icon_view_add_move_binding (binding_set, GDK_Up, 0,
GTK_MOVEMENT_DISPLAY_LINES, -1);
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;
}
static void
icon_view->priv->vadjustment = NULL;
}
- clear_dest_info (icon_view);
- clear_source_info (icon_view);
-
- (* GTK_OBJECT_CLASS (gtk_icon_view_parent_class)->destroy) (object);
+ GTK_OBJECT_CLASS (gtk_icon_view_parent_class)->destroy (object);
}
/* GObject methods */
{
gtk_icon_view_cell_layout_clear (GTK_CELL_LAYOUT (object));
- (* G_OBJECT_CLASS (gtk_icon_view_parent_class)->finalize) (object);
+ G_OBJECT_CLASS (gtk_icon_view_parent_class)->finalize (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;
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;
gdk_window_destroy (icon_view->priv->bin_window);
icon_view->priv->bin_window = NULL;
- /* GtkWidget::unrealize destroys children and widget->window */
- if (GTK_WIDGET_CLASS (gtk_icon_view_parent_class)->unrealize)
- (* GTK_WIDGET_CLASS (gtk_icon_view_parent_class)->unrealize) (widget);
+ GTK_WIDGET_CLASS (gtk_icon_view_parent_class)->unrealize (widget);
}
static void
/* totally ignore our child's requisition */
if (child->cell < 0)
{
- allocation.x = child->item->x;
- allocation.y = child->item->y;
- allocation.width = child->item->width;
- allocation.height = child->item->height;
+ 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
{
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.);
gtk_icon_view_paint_item (icon_view, cr, item, &expose->area,
icon_view->priv->bin_window,
- item->x, item->y, TRUE);
+ item->x, item->y,
+ icon_view->priv->draw_focus);
if (dest_index == item->index)
dest_item = item;
cairo_destroy (cr);
- (* GTK_WIDGET_CLASS (gtk_icon_view_parent_class)->expose_event) (widget, expose);
+ GTK_WIDGET_CLASS (gtk_icon_view_parent_class)->expose_event (widget, expose);
return TRUE;
}
0);
g_free (path_string);
- /* FIXME ugly special case */
- if (GTK_IS_ENTRY (editable) || GTK_IS_COMBO_BOX (editable))
- g_object_set (editable, "has-frame", TRUE, NULL);
-
/* the rest corresponds to tree_view_real_start_editing... */
icon_view->priv->edited_item = item;
icon_view->priv->editable = editable;
gtk_cell_editable_start_editing (GTK_CELL_EDITABLE (editable),
(GdkEvent *)event);
gtk_widget_grab_focus (GTK_WIDGET (editable));
- g_signal_connect (editable, "remove_widget",
+ g_signal_connect (editable, "remove-widget",
G_CALLBACK (gtk_icon_view_remove_widget),
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.
GtkIconViewCellInfo *info = NULL;
gboolean dirty = FALSE;
GtkCellRendererMode mode;
- gint cursor_cell;
+ gint cursor_cell = -1;
icon_view = GTK_ICON_VIEW (widget);
{
item = gtk_icon_view_get_item_at_coords (icon_view,
event->x, event->y,
- TRUE,
- &info);
- if (item != NULL)
+ FALSE,
+ &info);
+
+ /*
+ * We consider only the the cells' area as the item area if the
+ * item is not selected, but if it *is* selected, the complete
+ * selection rectangle is considered to be part of the item.
+ */
+ if (item != NULL && (info != NULL || item->selected))
{
- g_object_get (info->cell, "mode", &mode, NULL);
-
- if (mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE ||
- mode == GTK_CELL_RENDERER_MODE_EDITABLE)
- cursor_cell = g_list_index (icon_view->priv->cell_list, info);
- else
- cursor_cell = -1;
-
+ if (info != NULL)
+ {
+ g_object_get (info->cell, "mode", &mode, NULL);
+
+ if (mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE ||
+ mode == GTK_CELL_RENDERER_MODE_EDITABLE)
+ cursor_cell = g_list_index (icon_view->priv->cell_list, info);
+ }
+
gtk_icon_view_scroll_to_item (icon_view, item);
if (icon_view->priv->selection_mode == GTK_SELECTION_NONE)
}
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;
/* cancel the current editing, if it exists */
gtk_icon_view_stop_editing (icon_view, TRUE);
-
- if (mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE)
- gtk_icon_view_item_activate_cell (icon_view, item, info,
- (GdkEvent *)event);
- else if (mode == GTK_CELL_RENDERER_MODE_EDITABLE)
- gtk_icon_view_start_editing (icon_view, item, info,
- (GdkEvent *)event);
+
+ if (info != NULL)
+ {
+ if (mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE)
+ gtk_icon_view_item_activate_cell (icon_view, item, info,
+ (GdkEvent *)event);
+ else if (mode == GTK_CELL_RENDERER_MODE_EDITABLE)
+ gtk_icon_view_start_editing (icon_view, item, info,
+ (GdkEvent *)event);
+ }
}
else
{
gtk_icon_view_start_rubberbanding (icon_view, event->x, event->y);
}
+ /* don't draw keyboard focus around an clicked-on item */
+ icon_view->priv->draw_focus = FALSE;
}
if (event->button == 1 && event->type == GDK_2BUTTON_PRESS)
{
item = gtk_icon_view_get_item_at_coords (icon_view,
event->x, event->y,
- TRUE,
+ FALSE,
NULL);
if (item && item == icon_view->priv->last_single_clicked)
return TRUE;
}
- return (* GTK_WIDGET_CLASS (gtk_icon_view_parent_class)->key_press_event) (widget, event);
+ return GTK_WIDGET_CLASS (gtk_icon_view_parent_class)->key_press_event (widget, event);
}
static gboolean
if (icon_view->priv->doing_rubberband)
return TRUE;
- return (* GTK_WIDGET_CLASS (gtk_icon_view_parent_class)->key_press_event) (widget, event);
+ return GTK_WIDGET_CLASS (gtk_icon_view_parent_class)->key_press_event (widget, event);
}
static void
icon_view->priv->hadjustment = hadj;
g_object_ref_sink (icon_view->priv->hadjustment);
- g_signal_connect (icon_view->priv->hadjustment, "value_changed",
+ g_signal_connect (icon_view->priv->hadjustment, "value-changed",
G_CALLBACK (gtk_icon_view_adjustment_changed),
icon_view);
need_adjust = TRUE;
icon_view->priv->vadjustment = vadj;
g_object_ref_sink (icon_view->priv->vadjustment);
- g_signal_connect (icon_view->priv->vadjustment, "value_changed",
+ g_signal_connect (icon_view->priv->vadjustment, "value-changed",
G_CALLBACK (gtk_icon_view_adjustment_changed),
icon_view);
need_adjust = TRUE;
current_width += icon_view->priv->column_spacing + 2 * focus_width;
item->y = *y + focus_width;
- item->x = rtl ? GTK_WIDGET (icon_view)->allocation.width - item->width - x : x;
+ item->x = x;
x = current_width - (icon_view->priv->margin + focus_width);
{
GtkIconViewItem *item = items->data;
+ if (rtl)
+ {
+ item->x = *maximum_width - item->width - item->x;
+ item->col = col - 1 - item->col;
+ }
+
gtk_icon_view_calculate_item_size2 (icon_view, item, max_height);
/* We may want to readjust the new y coordinate. */
if (item->y + item->height + focus_width + icon_view->priv->row_spacing > *y)
*y = item->y + item->height + focus_width + icon_view->priv->row_spacing;
-
- if (rtl)
- item->col = col - 1 - item->col;
}
g_free (max_height);
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;
+ 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;
+ cell_area->height = item->height - icon_view->priv->item_padding * 2;
}
else
{
- cell_area->x = item->x;
+ 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;
+ 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];
}
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 -= 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);
item->height += item->box[info->position].height + (info->position > 0 ? spacing : 0);
}
}
+
+ item->width += icon_view->priv->item_padding * 2;
+ item->height += icon_view->priv->item_padding * 2;
}
static void
item->height += max_height[i] + (i > 0 ? spacing : 0);
}
- cell_area.x = item->x;
- cell_area.y = item->y;
+ 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++)
if (icon_view->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
+ /* 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.
+ */
cell_area.width = item->box[info->position].width;
cell_area.height = item->height;
}
else
{
- cell_area.width = item->width;
+ /* item->width is not recalculated and thus needs to be
+ * corrected for the padding.
+ */
+ cell_area.width = item->width - 2 * icon_view->priv->item_padding;
cell_area.height = max_height[i];
}
}
else
{
- if (item->box[info->position].width > item->width)
+ if (item->box[info->position].width > item->width - icon_view->priv->item_padding * 2)
{
- item->width = item->box[info->position].width;
+ 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;
item->box[i].x = item->x + item->width -
(item->box[i].x + item->box[i].width - item->x);
}
- }
+ }
+
+ item->height += icon_view->priv->item_padding * 2;
}
static void
gint y,
gboolean draw_focus)
{
- gint focus_width, focus_pad;
+ gint focus_width;
gint padding;
GdkRectangle cell_area, box;
GList *l;
gtk_widget_style_get (GTK_WIDGET (icon_view),
"focus-line-width", &focus_width,
- "focus-padding", &focus_pad,
NULL);
padding = focus_width;
#endif
if (item->selected)
- 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);
-
- /* FIXME we hardwire background drawing behind text
- * cell renderers here
- */
- if (GTK_IS_CELL_RENDERER_TEXT (info->cell))
- {
- gdk_cairo_set_source_color (cr, >K_WIDGET (icon_view)->style->base[state]);
- cairo_rectangle (cr,
- x - item->x + box.x,
- y - item->y + box.y,
- box.width, box.height);
- cairo_fill (cr);
- }
- }
+ {
+ gtk_paint_flat_box (GTK_WIDGET (icon_view)->style,
+ (GdkWindow *) drawable,
+ GTK_STATE_SELECTED,
+ GTK_SHADOW_NONE,
+ area,
+ GTK_WIDGET (icon_view),
+ "icon_view_item",
+ x, y,
+ item->width, item->height);
+ }
for (l = icon_view->priv->cell_list; l; l = l->next)
{
drawable,
GTK_WIDGET (icon_view),
&cell_area, &cell_area, area, flags);
-
}
- /* FIXME where to draw the focus with generic cell renderers ? */
- if (draw_focus &&
+ if (draw_focus &&
GTK_WIDGET_HAS_FOCUS (icon_view) &&
item == icon_view->priv->cursor_item)
- for (l = icon_view->priv->cell_list, i = 0; l; l = l->next, i++)
- {
- GtkIconViewCellInfo *info = (GtkIconViewCellInfo *)l->data;
-
- if (!info->cell->visible)
- continue;
-
- if (icon_view->priv->cursor_cell < 0 &&
- (info->cell->mode != GTK_CELL_RENDERER_MODE_INERT ||
- GTK_IS_CELL_RENDERER_TEXT (info->cell)))
- icon_view->priv->cursor_cell = i;
-
- if (i == icon_view->priv->cursor_cell)
- {
- gtk_icon_view_get_cell_box (icon_view, item, info, &box);
-
- gtk_paint_focus (GTK_WIDGET (icon_view)->style,
- drawable,
- GTK_STATE_NORMAL,
- area,
- GTK_WIDGET (icon_view),
- "icon_view",
- x - item->x + box.x - padding,
- y - item->y + box.y - padding,
- box.width + 2 * padding,
- box.height + 2 * padding);
- break;
- }
- }
+ {
+ for (l = icon_view->priv->cell_list, i = 0; l; l = l->next, i++)
+ {
+ GtkIconViewCellInfo *info = (GtkIconViewCellInfo *)l->data;
+
+ if (!info->cell->visible)
+ continue;
+
+ /* If found a editable/activatable cell, draw focus on it. */
+ if (icon_view->priv->cursor_cell < 0 &&
+ info->cell->mode != GTK_CELL_RENDERER_MODE_INERT)
+ icon_view->priv->cursor_cell = i;
+
+ gtk_icon_view_get_cell_box (icon_view, item, info, &box);
+
+ if (i == icon_view->priv->cursor_cell)
+ {
+ gtk_paint_focus (GTK_WIDGET (icon_view)->style,
+ drawable,
+ GTK_STATE_NORMAL,
+ area,
+ GTK_WIDGET (icon_view),
+ "icon_view",
+ x - item->x + box.x - padding,
+ y - item->y + box.y - padding,
+ box.width + 2 * padding,
+ box.height + 2 * padding);
+ break;
+ }
+ }
+
+ /* If there are no editable/activatable cells, draw focus
+ * around the whole item.
+ */
+ if (icon_view->priv->cursor_cell < 0)
+ gtk_paint_focus (GTK_WIDGET (icon_view)->style,
+ drawable,
+ GTK_STATE_NORMAL,
+ area,
+ GTK_WIDGET (icon_view),
+ "icon_view",
+ x - padding,
+ y - padding,
+ item->width + 2 * padding,
+ item->height + 2 * padding);
+ }
}
static void
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;
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 &&
{
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;
{
gtk_binding_entry_add_signal (binding_set, keyval, modmask,
- I_("move_cursor"), 2,
+ I_("move-cursor"), 2,
G_TYPE_ENUM, step,
G_TYPE_INT, count);
gtk_binding_entry_add_signal (binding_set, keyval, GDK_SHIFT_MASK,
- "move_cursor", 2,
+ "move-cursor", 2,
G_TYPE_ENUM, step,
G_TYPE_INT, count);
return;
gtk_binding_entry_add_signal (binding_set, keyval, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
- "move_cursor", 2,
+ "move-cursor", 2,
G_TYPE_ENUM, step,
G_TYPE_INT, count);
gtk_binding_entry_add_signal (binding_set, keyval, GDK_CONTROL_MASK,
- "move_cursor", 2,
+ "move-cursor", 2,
G_TYPE_ENUM, step,
G_TYPE_INT, count);
}
icon_view->priv->ctrl_pressed = FALSE;
icon_view->priv->shift_pressed = FALSE;
+ icon_view->priv->draw_focus = TRUE;
+
return TRUE;
}
{
gint n_focusable;
gint *focusable;
- gint first_text;
gint current;
gint i, k;
GList *l;
focusable = g_new0 (gint, icon_view->priv->n_cells);
n_focusable = 0;
- first_text = 0;
current = 0;
for (k = 0; k < 2; k++)
for (l = icon_view->priv->cell_list, i = 0; l; l = l->next, i++)
if (!info->cell->visible)
continue;
-
- if (GTK_IS_CELL_RENDERER_TEXT (info->cell))
- first_text = i;
if (info->cell->mode != GTK_CELL_RENDERER_MODE_INERT)
{
}
if (n_focusable == 0)
- focusable[n_focusable++] = first_text;
+ {
+ g_free (focusable);
+ return -1;
+ }
if (cell < 0)
{
/**
* gtk_icon_view_convert_widget_to_bin_window_coords:
+ * @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
* @path: a #GtkTreePath
*
* Sets the tip area of @tooltip to be the area covered by the item at @path.
+ * See also gtk_icon_view_set_tooltip_column() for a simpler alternative.
* See also gtk_tooltip_set_tip_area().
*
* Since: 2.12
* 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().
*
+ * See also gtk_icon_view_set_tooltip_column() for a simpler alternative.
+ *
* Since: 2.12
*/
void
/**
* gtk_icon_view_set_tooltip_column:
* @icon_view: a #GtkIconView
- *
* @column: an integer, which is a valid column number for @icon_view's model
*
* If you only plan to have simple (text-only) tooltips on full items, you
/**
* 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.
*
{
g_object_ref (icon_view->priv->model);
g_signal_connect (icon_view->priv->model,
- "row_changed",
+ "row-changed",
G_CALLBACK (gtk_icon_view_row_changed),
icon_view);
g_signal_connect (icon_view->priv->model,
- "row_inserted",
+ "row-inserted",
G_CALLBACK (gtk_icon_view_row_inserted),
icon_view);
g_signal_connect (icon_view->priv->model,
- "row_deleted",
+ "row-deleted",
G_CALLBACK (gtk_icon_view_row_deleted),
icon_view);
g_signal_connect (icon_view->priv->model,
- "rows_reordered",
+ "rows-reordered",
G_CALLBACK (gtk_icon_view_rows_reordered),
icon_view);
if (icon_view->priv->orientation == GTK_ORIENTATION_VERTICAL)
g_object_set (info->cell,
- "follow-state", TRUE,
"xalign", 0.5,
"yalign", 1.0,
NULL);
else
g_object_set (info->cell,
- "follow-state", TRUE,
"xalign", 0.0,
"yalign", 0.0,
NULL);
*
* 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
**/
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,
}
}
-static void
-clear_source_info (GtkIconView *icon_view)
-{
- if (icon_view->priv->source_targets)
- gtk_target_list_unref (icon_view->priv->source_targets);
- icon_view->priv->source_targets = NULL;
-
- icon_view->priv->source_set = FALSE;
-}
-
-static void
-clear_dest_info (GtkIconView *icon_view)
-{
- if (icon_view->priv->dest_targets)
- gtk_target_list_unref (icon_view->priv->dest_targets);
- icon_view->priv->dest_targets = NULL;
-
- icon_view->priv->dest_set = FALSE;
-}
-
static void
set_source_row (GdkDragContext *context,
GtkTreeModel *model,
return FALSE; /* no longer a drop site */
}
- *target = gtk_drag_dest_find_target (widget, context, icon_view->priv->dest_targets);
+ *target = gtk_drag_dest_find_target (widget, context,
+ gtk_drag_dest_get_target_list (widget));
if (*target == GDK_NONE)
return FALSE;
gtk_icon_view_maybe_begin_drag (GtkIconView *icon_view,
GdkEventMotion *event)
{
+ GtkWidget *widget = GTK_WIDGET (icon_view);
GdkDragContext *context;
GtkTreePath *path = NULL;
gint button;
retval = TRUE;
- context = gtk_drag_begin (GTK_WIDGET (icon_view),
- icon_view->priv->source_targets,
+ context = gtk_drag_begin (widget,
+ gtk_drag_source_get_target_list (widget),
icon_view->priv->source_actions,
button,
(GdkEvent*)event);
if (model == NULL)
return;
- if (!icon_view->priv->dest_set)
+ if (!icon_view->priv->source_set)
return;
source_row = get_source_row (context);
icon_view = GTK_ICON_VIEW (widget);
model = gtk_icon_view_get_model (icon_view);
- if (!check_model_dnd (model, GTK_TYPE_TREE_DRAG_SOURCE, "drag_data_delete"))
+ if (!check_model_dnd (model, GTK_TYPE_TREE_DRAG_SOURCE, "drag-data-delete"))
return;
- if (!icon_view->priv->dest_set)
+ if (!icon_view->priv->source_set)
return;
source_row = get_source_row (context);
if (!icon_view->priv->dest_set)
return FALSE;
- if (!check_model_dnd (model, GTK_TYPE_TREE_DRAG_DEST, "drag_drop"))
+ if (!check_model_dnd (model, GTK_TYPE_TREE_DRAG_DEST, "drag-drop"))
return FALSE;
if (!set_destination (icon_view, context, x, y, &suggested_action, &target))
icon_view = GTK_ICON_VIEW (widget);
model = gtk_icon_view_get_model (icon_view);
- if (!check_model_dnd (model, GTK_TYPE_TREE_DRAG_DEST, "drag_data_received"))
+ if (!check_model_dnd (model, GTK_TYPE_TREE_DRAG_DEST, "drag-data-received"))
return;
if (!icon_view->priv->dest_set)
* @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
**/
{
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
- gtk_drag_source_set (GTK_WIDGET (icon_view), 0, NULL, 0, actions);
+ gtk_drag_source_set (GTK_WIDGET (icon_view), 0, targets, n_targets, actions);
- clear_source_info (icon_view);
icon_view->priv->start_button_mask = start_button_mask;
- icon_view->priv->source_targets = gtk_target_list_new (targets, n_targets);
icon_view->priv->source_actions = actions;
icon_view->priv->source_set = TRUE;
* @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
**/
{
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
- gtk_drag_dest_set (GTK_WIDGET (icon_view), 0, NULL, 0, actions);
-
- clear_dest_info (icon_view);
+ gtk_drag_dest_set (GTK_WIDGET (icon_view), 0, targets, n_targets, actions);
- icon_view->priv->dest_targets = gtk_target_list_new (targets, n_targets);
icon_view->priv->dest_actions = actions;
icon_view->priv->dest_set = TRUE;
* 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
**/
if (icon_view->priv->source_set)
{
gtk_drag_source_unset (GTK_WIDGET (icon_view));
- clear_source_info (icon_view);
+ icon_view->priv->source_set = FALSE;
}
unset_reorderable (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
**/
if (icon_view->priv->dest_set)
{
gtk_drag_dest_unset (GTK_WIDGET (icon_view));
- clear_dest_info (icon_view);
+ icon_view->priv->dest_set = FALSE;
}
unset_reorderable (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
/* 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)
{
* #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
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;
}
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;
atk_object_notify_state_change (ATK_OBJECT (item), state_type, TRUE);
/* If state_type is ATK_STATE_VISIBLE, additional notification */
if (state_type == ATK_STATE_VISIBLE)
- g_signal_emit_by_name (item, "visible_data_changed");
+ g_signal_emit_by_name (item, "visible-data-changed");
}
return rc;
atk_object_notify_state_change (ATK_OBJECT (item), state_type, FALSE);
/* If state_type is ATK_STATE_VISIBLE, additional notification */
if (state_type == ATK_STATE_VISIBLE)
- g_signal_emit_by_name (item, "visible_data_changed");
+ g_signal_emit_by_name (item, "visible-data-changed");
}
return rc;
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,
gtk_icon_view_accessible_model_row_changed (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter,
- gpointer user_data)
+ gpointer user_data)
{
AtkObject *atk_obj;
+ gint index;
+ 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));
- g_signal_emit_by_name (atk_obj, "visible_data_changed");
+ 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));
+
+ 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));
+
+ if (!name || strcmp (name, "") == 0)
+ {
+ 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);
+ }
+ }
+ }
+
+ g_signal_emit_by_name (atk_obj, "visible-data-changed");
return;
}
items = items->next;
}
gtk_icon_view_accessible_traverse_items (view, tmp_list);
- g_signal_emit_by_name (atk_obj, "children_changed::add",
+ g_signal_emit_by_name (atk_obj, "children-changed::add",
index, NULL, NULL);
return;
}
{
if (tmp_list == NULL)
tmp_list = items;
- else
- info->index = item->item->index;
+
+ info->index = item->item->index;
}
items = items->next;
{
info = deleted_item->data;
gtk_icon_view_item_accessible_add_state (GTK_ICON_VIEW_ITEM_ACCESSIBLE (info->item), ATK_STATE_DEFUNCT, TRUE);
- }
- g_signal_emit_by_name (atk_obj, "children_changed::remove",
- index, NULL, NULL);
- if (deleted_item)
- {
+ g_signal_emit_by_name (atk_obj, "children-changed::remove",
+ index, NULL, NULL);
priv->items = g_list_remove_link (priv->items, deleted_item);
g_free (info);
}
GtkIconViewItemAccessible *item;
GList *items;
AtkObject *atk_obj;
+ gint *order;
+ gint length, i;
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (user_data));
icon_view = GTK_ICON_VIEW (user_data);
priv = gtk_icon_view_accessible_get_priv (atk_obj);
+ length = gtk_tree_model_iter_n_children (tree_model, NULL);
+
+ order = g_new (gint, length);
+ for (i = 0; i < length; i++)
+ order [new_order[i]] = i;
+
items = priv->items;
while (items)
{
info = items->data;
item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (info->item);
- info->index = new_order[info->index];
+ info->index = order[info->index];
item->item = g_list_nth_data (icon_view->priv->items, info->index);
items = items->next;
}
+ g_free (order);
priv->items = g_list_sort (priv->items,
(GCompareFunc)gtk_icon_view_accessible_item_compare);
GObject *obj;
obj = G_OBJECT (icon_view->priv->model);
- g_signal_connect_data (obj, "row_changed",
+ g_signal_connect_data (obj, "row-changed",
(GCallback) gtk_icon_view_accessible_model_row_changed,
icon_view, NULL, 0);
- g_signal_connect_data (obj, "row_inserted",
+ g_signal_connect_data (obj, "row-inserted",
(GCallback) gtk_icon_view_accessible_model_row_inserted,
icon_view, NULL, G_CONNECT_AFTER);
- g_signal_connect_data (obj, "row_deleted",
+ g_signal_connect_data (obj, "row-deleted",
(GCallback) gtk_icon_view_accessible_model_row_deleted,
icon_view, NULL, G_CONNECT_AFTER);
- g_signal_connect_data (obj, "rows_reordered",
+ g_signal_connect_data (obj, "rows-reordered",
(GCallback) gtk_icon_view_accessible_model_rows_reordered,
icon_view, NULL, G_CONNECT_AFTER);
}
icon_view);
}
g_signal_connect_after (data,
- "set_scroll_adjustments",
+ "set-scroll-adjustments",
G_CALLBACK (gtk_icon_view_accessible_set_scroll_adjustments),
NULL);
g_signal_connect (data,
if (!type)
{
- static GTypeInfo tinfo =
+ GTypeInfo tinfo =
{
0, /* class size */
(GBaseInitFunc) NULL, /* base init */
(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,
gtk_icon_view_accessible_factory_get_type ());
first_time = FALSE;
}
- return (* GTK_WIDGET_CLASS (gtk_icon_view_parent_class)->get_accessible) (widget);
+ return GTK_WIDGET_CLASS (gtk_icon_view_parent_class)->get_accessible (widget);
}
static gboolean