summaryrefslogtreecommitdiff
path: root/gtk/gtkcellview.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/gtkcellview.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/gtkcellview.c')
-rw-r--r--gtk/gtkcellview.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gtk/gtkcellview.c b/gtk/gtkcellview.c
index b307573d6..7f4655569 100644
--- a/gtk/gtkcellview.c
+++ b/gtk/gtkcellview.c
@@ -100,6 +100,9 @@ static void gtk_cell_view_cell_layout_set_cell_data_func (GtkCellLayout
GtkCellLayoutDataFunc func,
gpointer func_data,
GDestroyNotify destroy);
+static void gtk_cell_view_cell_layout_reorder (GtkCellLayout *layout,
+ GtkCellRenderer *cell,
+ gint position);
#define GTK_CELL_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_VIEW, GtkCellViewPrivate))
@@ -203,6 +206,7 @@ gtk_cell_view_cell_layout_init (GtkCellLayoutIface *iface)
iface->add_attribute = gtk_cell_view_cell_layout_add_attribute;
iface->set_cell_data_func = gtk_cell_view_cell_layout_set_cell_data_func;
iface->clear_attributes = gtk_cell_view_cell_layout_clear_attributes;
+ iface->reorder = gtk_cell_view_cell_layout_reorder;
}
static void
@@ -698,6 +702,34 @@ gtk_cell_view_cell_layout_clear_attributes (GtkCellLayout *layout,
info->attributes = NULL;
}
+static void
+gtk_cell_view_cell_layout_reorder (GtkCellLayout *layout,
+ GtkCellRenderer *cell,
+ gint position)
+{
+ GList *link;
+ GtkCellViewCellInfo *info;
+ GtkCellView *cellview = GTK_CELL_VIEW (layout);
+
+ g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
+ g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
+
+ info = gtk_cell_view_get_cell_info (cellview, cell);
+
+ g_return_if_fail (info != NULL);
+ g_return_if_fail (position >= 0);
+
+ link = g_list_find (cellview->priv->cell_list, info);
+
+ g_return_if_fail (link != NULL);
+
+ cellview->priv->cell_list = g_list_remove_link (cellview->priv->cell_list,
+ link);
+ cellview->priv->cell_list = g_list_insert (cellview->priv->cell_list,
+ info, position);
+
+ gtk_widget_queue_draw (GTK_WIDGET (cellview));
+}
/* public API */
GtkWidget *