summaryrefslogtreecommitdiff
path: root/gtk/gtktreeviewcolumn.c
diff options
context:
space:
mode:
authorKristian Rietveld <kris@gtk.org>2003-12-19 22:47:20 +0000
committerKristian Rietveld <kristian@src.gnome.org>2003-12-19 22:47:20 +0000
commit2f4326e40633536ffea31e266f1985ca0fb805f3 (patch)
tree5ae741b553cfad54a1969207659eb381693794cb /gtk/gtktreeviewcolumn.c
parent30d9f88996c6cf5148837063ea45cef3f17c96da (diff)
downloadgdk-pixbuf-2f4326e40633536ffea31e266f1985ca0fb805f3.tar.gz
Fixes #108458.
Fri Dec 19 23:36:00 2003 Kristian Rietveld <kris@gtk.org> Fixes #108458. * gtk/gtkcelllayout.[ch]: added a reorder method. * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_cell_layout_init), (gtk_tree_view_column_cell_layout_reorder): implement reorder. * gtk/gtkcellview.c (gtk_cell_view_cell_layout_init), (gtk_cell_view_cell_layout_reorder): ditto. * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_init), (gtk_combo_box_cell_layout_reorder): ditto. * gtk/gtkentrycompletion.c (gtk_entry_completion_cell_layout_init), (gtk_entry_completion_reorder): ditto.
Diffstat (limited to 'gtk/gtktreeviewcolumn.c')
-rw-r--r--gtk/gtktreeviewcolumn.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index 6bd4000e6..6a5d80e4e 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -107,6 +107,9 @@ static void gtk_tree_view_column_cell_layout_set_cell_data_func (GtkCellLayout
GDestroyNotify destroy);
static void gtk_tree_view_column_cell_layout_clear_attributes (GtkCellLayout *cell_layout,
GtkCellRenderer *cell);
+static void gtk_tree_view_column_cell_layout_reorder (GtkCellLayout *cell_layout,
+ GtkCellRenderer *cell,
+ gint position);
/* Button handling code */
static void gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column);
@@ -356,6 +359,7 @@ gtk_tree_view_column_cell_layout_init (GtkCellLayoutIface *iface)
iface->add_attribute = gtk_tree_view_column_cell_layout_add_attribute;
iface->set_cell_data_func = gtk_tree_view_column_cell_layout_set_cell_data_func;
iface->clear_attributes = gtk_tree_view_column_cell_layout_clear_attributes;
+ iface->reorder = gtk_tree_view_column_cell_layout_reorder;
}
static void
@@ -740,6 +744,33 @@ gtk_tree_view_column_cell_layout_clear_attributes (GtkCellLayout *cell_layout
}
static void
+gtk_tree_view_column_cell_layout_reorder (GtkCellLayout *cell_layout,
+ GtkCellRenderer *cell,
+ gint position)
+{
+ GList *link;
+ GtkTreeViewColumn *column;
+ GtkTreeViewColumnCellInfo *info;
+
+ g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (cell_layout));
+ column = GTK_TREE_VIEW_COLUMN (cell_layout);
+
+ info = gtk_tree_view_column_get_cell_info (column, cell);
+
+ g_return_if_fail (info != NULL);
+ g_return_if_fail (position >= 0);
+
+ link = g_list_find (column->cell_list, info);
+
+ g_return_if_fail (link != NULL);
+
+ column->cell_list = g_list_remove_link (column->cell_list, link);
+ column->cell_list = g_list_insert (column->cell_list, info, position);
+
+ gtk_widget_queue_draw (column->tree_view);
+}
+
+static void
gtk_tree_view_column_clear_attributes_by_info (GtkTreeViewColumn *tree_column,
GtkTreeViewColumnCellInfo *info)
{