Commit 66152ab6 authored by Jonathan Blandford's avatar Jonathan Blandford Committed by Jonathan Blandford

Evil function to deal with very large (TM) amounts of text. May be moved

Tue May 22 15:13:52 2001  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtkcellrenderertext.c
	(gtk_cell_renderer_text_set_fixed_size): Evil function to deal
	with very large (TM) amounts of text.  May be moved to
	GtkCellRenderer in the future, though I'm not sure it wants to be
	this accessible.

	* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_button):
	More sanity brought to this class.  I like it.

	* tests/testtreecolumns.c (ViewColumnModel): Amazingly scary test
	case.  Kids, don't try this at home.

	* gtk/gtktreemodel.c (gtk_tree_model_get_iter_root): new
	convenience function.

	* gtk/gtkwindow.c (gtk_window_set_geometry_hints): Fix typo in docs.
parent e8d54ce0
Tue May 22 15:13:52 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcellrenderertext.c
(gtk_cell_renderer_text_set_fixed_size): Evil function to deal
with very large (TM) amounts of text. May be moved to
GtkCellRenderer in the future, though I'm not sure it wants to be
this accessible.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_button):
More sanity brought to this class. I like it.
* tests/testtreecolumns.c (ViewColumnModel): Amazingly scary test
case. Kids, don't try this at home.
* gtk/gtktreemodel.c (gtk_tree_model_get_iter_root): new
convenience function.
* gtk/gtkwindow.c (gtk_window_set_geometry_hints): Fix typo in docs.
2001-05-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkfontsel.c:
......
Tue May 22 15:13:52 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcellrenderertext.c
(gtk_cell_renderer_text_set_fixed_size): Evil function to deal
with very large (TM) amounts of text. May be moved to
GtkCellRenderer in the future, though I'm not sure it wants to be
this accessible.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_button):
More sanity brought to this class. I like it.
* tests/testtreecolumns.c (ViewColumnModel): Amazingly scary test
case. Kids, don't try this at home.
* gtk/gtktreemodel.c (gtk_tree_model_get_iter_root): new
convenience function.
* gtk/gtkwindow.c (gtk_window_set_geometry_hints): Fix typo in docs.
2001-05-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkfontsel.c:
......
Tue May 22 15:13:52 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcellrenderertext.c
(gtk_cell_renderer_text_set_fixed_size): Evil function to deal
with very large (TM) amounts of text. May be moved to
GtkCellRenderer in the future, though I'm not sure it wants to be
this accessible.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_button):
More sanity brought to this class. I like it.
* tests/testtreecolumns.c (ViewColumnModel): Amazingly scary test
case. Kids, don't try this at home.
* gtk/gtktreemodel.c (gtk_tree_model_get_iter_root): new
convenience function.
* gtk/gtkwindow.c (gtk_window_set_geometry_hints): Fix typo in docs.
2001-05-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkfontsel.c:
......
Tue May 22 15:13:52 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcellrenderertext.c
(gtk_cell_renderer_text_set_fixed_size): Evil function to deal
with very large (TM) amounts of text. May be moved to
GtkCellRenderer in the future, though I'm not sure it wants to be
this accessible.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_button):
More sanity brought to this class. I like it.
* tests/testtreecolumns.c (ViewColumnModel): Amazingly scary test
case. Kids, don't try this at home.
* gtk/gtktreemodel.c (gtk_tree_model_get_iter_root): new
convenience function.
* gtk/gtkwindow.c (gtk_window_set_geometry_hints): Fix typo in docs.
2001-05-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkfontsel.c:
......
Tue May 22 15:13:52 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcellrenderertext.c
(gtk_cell_renderer_text_set_fixed_size): Evil function to deal
with very large (TM) amounts of text. May be moved to
GtkCellRenderer in the future, though I'm not sure it wants to be
this accessible.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_button):
More sanity brought to this class. I like it.
* tests/testtreecolumns.c (ViewColumnModel): Amazingly scary test
case. Kids, don't try this at home.
* gtk/gtktreemodel.c (gtk_tree_model_get_iter_root): new
convenience function.
* gtk/gtkwindow.c (gtk_window_set_geometry_hints): Fix typo in docs.
2001-05-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkfontsel.c:
......
Tue May 22 15:13:52 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcellrenderertext.c
(gtk_cell_renderer_text_set_fixed_size): Evil function to deal
with very large (TM) amounts of text. May be moved to
GtkCellRenderer in the future, though I'm not sure it wants to be
this accessible.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_button):
More sanity brought to this class. I like it.
* tests/testtreecolumns.c (ViewColumnModel): Amazingly scary test
case. Kids, don't try this at home.
* gtk/gtktreemodel.c (gtk_tree_model_get_iter_root): new
convenience function.
* gtk/gtkwindow.c (gtk_window_set_geometry_hints): Fix typo in docs.
2001-05-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkfontsel.c:
......
Tue May 22 15:13:52 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcellrenderertext.c
(gtk_cell_renderer_text_set_fixed_size): Evil function to deal
with very large (TM) amounts of text. May be moved to
GtkCellRenderer in the future, though I'm not sure it wants to be
this accessible.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_button):
More sanity brought to this class. I like it.
* tests/testtreecolumns.c (ViewColumnModel): Amazingly scary test
case. Kids, don't try this at home.
* gtk/gtktreemodel.c (gtk_tree_model_get_iter_root): new
convenience function.
* gtk/gtkwindow.c (gtk_window_set_geometry_hints): Fix typo in docs.
2001-05-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkfontsel.c:
......
......@@ -1087,6 +1087,16 @@ gtk_cell_renderer_text_get_size (GtkCellRenderer *cell,
PangoRectangle rect;
PangoLayout *layout;
if (celltext->fixed_size)
{
if (width)
*width = celltext->width;
if (height)
*height = celltext->height;
return;
}
layout = get_layout (celltext, widget, FALSE, 0);
pango_layout_get_pixel_extents (layout, NULL, &rect);
......@@ -1175,3 +1185,31 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
g_object_unref (G_OBJECT (layout));
}
/**
* gtk_cell_renderer_text_set_fixed_size:
* @renderer: A #GtkCellRendererText
* @fixed_size: TRUE if the renderer should be a fixed height.
* @width: The width of the cell
* @height: The height it of the cell, or -1
*
* Sets the height of a renderer to explicitly be a certain size. This
* function is unflexible, and should really only be used if calculating the
* size of a cell is too slow.
**/
void
gtk_cell_renderer_text_set_fixed_size (GtkCellRendererText *renderer,
gboolean fixed_size,
gint width,
gint height)
{
g_return_if_fail (GTK_IS_CELL_RENDERER_TEXT (renderer));
if (renderer->fixed_size == (fixed_size)?TRUE:FALSE)
return;
renderer->fixed_size = (fixed_size)?TRUE:FALSE;
renderer->height = height;
renderer->width = width;
}
......@@ -53,7 +53,10 @@ struct _GtkCellRendererText
PangoUnderline underline_style;
gint rise;
gint width;
gint height;
guint fixed_size : 1;
guint strikethrough : 1;
/* editable feature doesn't work */
......@@ -86,8 +89,14 @@ struct _GtkCellRendererTextClass
GtkCellRendererClass parent_class;
};
GtkType gtk_cell_renderer_text_get_type (void);
GtkCellRenderer *gtk_cell_renderer_text_new (void);
GtkType gtk_cell_renderer_text_get_type (void);
GtkCellRenderer *gtk_cell_renderer_text_new (void);
void gtk_cell_renderer_text_set_fixed_size (GtkCellRendererText *renderer,
gboolean fixed_size,
gint width,
gint height);
#ifdef __cplusplus
}
......
......@@ -480,13 +480,9 @@ gtk_list_store_iter_next (GtkTreeModel *tree_model,
g_return_val_if_fail (GTK_IS_LIST_STORE (tree_model), FALSE);
g_return_val_if_fail (GTK_LIST_STORE (tree_model)->stamp == iter->stamp, FALSE);
if (G_SLIST (iter->user_data)->next)
{
iter->user_data = G_SLIST (iter->user_data)->next;
return TRUE;
}
else
return FALSE;
iter->user_data = G_SLIST (iter->user_data)->next;
return (iter->user_data != NULL);
}
static gboolean
......
......@@ -653,10 +653,9 @@ gtk_tree_model_get_iter (GtkTreeModel *tree_model,
gint *indices;
gint depth, i;
g_return_val_if_fail (tree_model != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (path != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
if (GTK_TREE_MODEL_GET_IFACE (tree_model)->get_iter != NULL)
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->get_iter) (tree_model, iter, path);
......@@ -679,6 +678,33 @@ gtk_tree_model_get_iter (GtkTreeModel *tree_model,
return TRUE;
}
/**
* gtk_tree_model_get_iter_root:
* @tree_model: A #GtkTreeModel.
* @iter: The uninitialized #GtkTreeIter.
*
* Gets the root iter, if it exists.
*
* Return value: TRUE, if @iter was set.
**/
gboolean
gtk_tree_model_get_iter_root (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
GtkTreePath *path;
gboolean retval;
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
path = gtk_tree_path_new_root ();
retval = gtk_tree_model_get_iter (tree_model, iter, path);
gtk_tree_path_free (path);
return retval;
}
/**
* gtk_tree_model_get_first:
* @tree_model: a #GtkTreeModel
......
......@@ -176,6 +176,8 @@ GType gtk_tree_model_get_column_type (GtkTreeModel *tree_model,
gboolean gtk_tree_model_get_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreePath *path);
gboolean gtk_tree_model_get_iter_root (GtkTreeModel *tree_model,
GtkTreeIter *iter);
gboolean gtk_tree_model_get_first (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GtkTreePath * gtk_tree_model_get_path (GtkTreeModel *tree_model,
......
......@@ -75,20 +75,13 @@ static void gtk_tree_view_column_create_button (GtkTreeViewColum
static void gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column);
/* Button signal handlers */
static gint gtk_tree_view_column_button_passive_func (GtkWidget *widget,
static gint gtk_tree_view_column_button_event (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void gtk_tree_view_column_button_realize (GtkWidget *widget,
gpointer data);
static void gtk_tree_view_column_button_pressed (GtkWidget *widget,
gpointer data);
static void gtk_tree_view_column_button_released (GtkWidget *widget,
gpointer data);
static void gtk_tree_view_column_button_clicked (GtkWidget *widget,
gpointer data);
static gint gtk_tree_view_column_button_motion_event (GtkWidget *widget,
GdkEventMotion *event,
gpointer data);
/* Property handlers */
static void gtk_tree_view_model_property_changed (GtkTreeView *view,
......@@ -102,7 +95,6 @@ static void gtk_tree_view_model_sort_column_changed (GtkTreeSortable
static void gtk_tree_view_column_sort (GtkTreeViewColumn *tree_column,
gpointer data);
static void gtk_tree_view_column_setup_sort_column_id_callback (GtkTreeViewColumn *tree_column);
static void gtk_tree_view_column_set_clickable_real (GtkTreeViewColumn *tree_column);
static void gtk_tree_view_column_set_attributesv (GtkTreeViewColumn *tree_column,
va_list args);
......@@ -507,18 +499,14 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column)
gtk_signal_connect (GTK_OBJECT (tree_column->button), "realize",
(GtkSignalFunc) gtk_tree_view_column_button_realize,
NULL);
gtk_signal_connect (GTK_OBJECT (tree_column->button), "event",
(GtkSignalFunc) gtk_tree_view_column_button_event,
(gpointer) tree_column);
gtk_signal_connect (GTK_OBJECT (tree_column->button), "clicked",
(GtkSignalFunc) gtk_tree_view_column_button_clicked,
(gpointer) tree_column);
gtk_signal_connect (GTK_OBJECT (tree_column->button), "pressed",
(GtkSignalFunc) gtk_tree_view_column_button_pressed,
(gpointer) tree_column);
gtk_signal_connect (GTK_OBJECT (tree_column->button), "motion_notify_event",
(GtkSignalFunc) gtk_tree_view_column_button_motion_event,
(gpointer) tree_column);
gtk_signal_connect (GTK_OBJECT (tree_column->button), "released",
(GtkSignalFunc) gtk_tree_view_column_button_released,
(gpointer) tree_column);
tree_column->alignment = gtk_alignment_new (tree_column->xalign, 0.5, 0.0, 0.0);
......@@ -546,8 +534,6 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column)
gtk_widget_show (hbox);
gtk_widget_show (tree_column->alignment);
gtk_tree_view_column_update_button (tree_column);
gtk_tree_view_column_set_clickable_real (tree_column);
}
static void
......@@ -558,7 +544,6 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
GtkWidget *arrow;
GtkWidget *current_child;
/* Create a button if necessary */
if (tree_column->visible &&
tree_column->button == NULL &&
......@@ -680,6 +665,11 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
gdk_window_hide (tree_column->window);
}
}
if (tree_column->reorderable || tree_column->clickable)
GTK_WIDGET_SET_FLAGS (tree_column->button, GTK_CAN_FOCUS);
else
GTK_WIDGET_UNSET_FLAGS (tree_column->button, GTK_CAN_FOCUS);
tree_column->dirty = TRUE;
gtk_widget_queue_resize (tree_column->tree_view);
......@@ -689,24 +679,56 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
*/
static gint
gtk_tree_view_column_button_passive_func (GtkWidget *widget,
GdkEvent *event,
gpointer data)
gtk_tree_view_column_button_event (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
GtkTreeViewColumn *column = (GtkTreeViewColumn *) data;
g_return_val_if_fail (event != NULL, FALSE);
switch (event->type)
if (event->type == GDK_BUTTON_PRESS &&
column->reorderable)
{
column->maybe_reordered = TRUE;
gdk_window_get_pointer (widget->window,
&column->drag_x,
&column->drag_y,
NULL);
gtk_widget_grab_focus (widget);
}
if (event->type == GDK_BUTTON_RELEASE &&
column->maybe_reordered)
column->maybe_reordered = FALSE;
if (event->type == GDK_MOTION_NOTIFY &&
(column->maybe_reordered) &&
(gtk_drag_check_threshold (widget,
column->drag_x,
column->drag_y,
(gint) ((GdkEventMotion *)event)->x,
(gint) ((GdkEventMotion *)event)->y)))
{
case GDK_MOTION_NOTIFY:
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
column->maybe_reordered = FALSE;
_gtk_tree_view_column_start_drag (GTK_TREE_VIEW (column->tree_view), column);
return TRUE;
default:
break;
}
if (column->clickable == FALSE)
{
switch (event->type)
{
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_MOTION_NOTIFY:
case GDK_BUTTON_RELEASE:
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
return TRUE;
default:
return FALSE;
}
}
return FALSE;
}
......@@ -717,57 +739,12 @@ gtk_tree_view_column_button_realize (GtkWidget *widget, gpointer data)
gdk_window_set_events (widget->window, gdk_window_get_events (widget->window) | GDK_POINTER_MOTION_MASK);
}
static void
gtk_tree_view_column_button_pressed (GtkWidget *widget, gpointer data)
{
GtkTreeViewColumn *tree_column = (GtkTreeViewColumn *) data;
if (! tree_column->reorderable)
return;
tree_column->maybe_reordered = TRUE;
gdk_window_get_pointer (widget->window,
&tree_column->drag_x,
&tree_column->drag_y,
NULL);
}
static void
gtk_tree_view_column_button_released (GtkWidget *widget, gpointer data)
{
GtkTreeViewColumn *tree_column = (GtkTreeViewColumn *) data;
tree_column->maybe_reordered = FALSE;
}
static void
gtk_tree_view_column_button_clicked (GtkWidget *widget, gpointer data)
{
g_signal_emit_by_name (G_OBJECT (data), "clicked");
}
static gint
gtk_tree_view_column_button_motion_event (GtkWidget *widget,
GdkEventMotion *event,
gpointer data)
{
GtkTreeViewColumn *tree_column = (GtkTreeViewColumn *) data;
if ((tree_column->maybe_reordered) &&
(gtk_drag_check_threshold (widget,
tree_column->drag_x,
tree_column->drag_y,
(gint) event->x,
(gint) event->y)))
{
tree_column->maybe_reordered = FALSE;
_gtk_tree_view_column_start_drag (GTK_TREE_VIEW (tree_column->tree_view), tree_column);
}
return TRUE;
}
static void
gtk_tree_view_model_property_changed (GtkTreeView *view,
guint n_pspecs,
......@@ -1636,7 +1613,6 @@ gtk_tree_view_column_set_title (GtkTreeViewColumn *tree_column,
tree_column->title = NULL;
gtk_tree_view_column_update_button (tree_column);
g_object_notify (G_OBJECT (tree_column), "title");
}
......@@ -1657,40 +1633,6 @@ gtk_tree_view_column_get_title (GtkTreeViewColumn *tree_column)
return tree_column->title;
}
static void
gtk_tree_view_column_set_clickable_real (GtkTreeViewColumn *tree_column)
{
if (!tree_column->button)
return;
if (tree_column->clickable)
{
if (tree_column->clickable_signal)
{
g_signal_handler_disconnect (G_OBJECT (tree_column->button), tree_column->clickable_signal);
tree_column->clickable_signal = 0;
}
GTK_WIDGET_SET_FLAGS (tree_column->button, GTK_CAN_FOCUS);
if (GTK_WIDGET_VISIBLE (tree_column->tree_view))
gtk_widget_queue_draw (tree_column->button);
}
else
{
tree_column->clickable_signal =
gtk_signal_connect (GTK_OBJECT (tree_column->button),
"event",
(GtkSignalFunc) gtk_tree_view_column_button_passive_func,
NULL);
GTK_WIDGET_UNSET_FLAGS (tree_column->button, GTK_CAN_FOCUS);
if (GTK_WIDGET_VISIBLE (tree_column->tree_view))
gtk_widget_queue_draw (tree_column->button);
}
}
/**
* gtk_tree_view_column_set_clickable:
* @tree_column: A #GtkTreeViewColumn.
......@@ -1709,7 +1651,7 @@ gtk_tree_view_column_set_clickable (GtkTreeViewColumn *tree_column,
return;
tree_column->clickable = (clickable?TRUE:FALSE);
gtk_tree_view_column_set_clickable_real (tree_column);
gtk_tree_view_column_update_button (tree_column);
g_object_notify (G_OBJECT (tree_column), "clickable");
}
......@@ -1813,6 +1755,9 @@ gtk_tree_view_column_set_reorderable (GtkTreeViewColumn *tree_column,
{
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
/* if (reorderable)
gtk_tree_view_column_set_clickable (tree_column, TRUE);*/
if (tree_column->reorderable == (reorderable?TRUE:FALSE))
return;
......
......@@ -1451,7 +1451,7 @@ gtk_window_get_geometry_info (GtkWindow *window,
/**
* gtk_window_set_geometry_hints:
* @window: a #GdkWindow
* @window: a #GtkWindow
* @geometry_widget: widget the geometry hints will be applied to
* @geometry: struct containing geometry information
* @geom_mask: mask indicating which struct fields should be paid attention to
......
......@@ -10,6 +10,384 @@ GtkTreeModel *bottom_right_tree_model;
GtkWidget *sample_tree_view_top;
GtkWidget *sample_tree_view_bottom;
#define column_data "my_column_data"
/* Kids, don't try this at home.
*/
/* Small GtkTreeModel to model columns */
typedef struct _ViewColumnModel ViewColumnModel;
typedef struct _ViewColumnModelClass ViewColumnModelClass;
struct _ViewColumnModel
{
GObject parent;
GtkTreeView *view;
GList *columns;
gint stamp;
};
struct _ViewColumnModelClass
{
GObjectClass parent_class;
};
static void view_column_model_class_init (ViewColumnModelClass *model)
{
}
static void view_column_model_init (ViewColumnModel *model)
{
model->stamp = g_random_int ();
}
static gint
view_column_model_get_n_columns (GtkTreeModel *tree_model)
{
return 2;
}
static GType
view_column_model_get_column_type (GtkTreeModel *tree_model,
gint index)
{
switch (index)
{
case 0:
return G_TYPE_STRING;
case 1:
return GTK_TYPE_TREE_VIEW_COLUMN;
default:
return G_TYPE_INVALID;
}
}
static gboolean
view_column_model_get_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreePath *path)
{
ViewColumnModel *view_model = (ViewColumnModel *)tree_model;
GList *list;
gint i;
g_return_val_if_fail (gtk_tree_path_get_depth (path) > 0, FALSE);
i = gtk_tree_path_get_indices (path)[0];
list = g_list_nth (view_model->columns, i);
if (list == NULL)
return FALSE;
iter->stamp = view_model->stamp;
iter->user_data = list;
return TRUE;
}
static GtkTreePath *
view_column_model_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
ViewColumnModel *view_model = (ViewColumnModel *)tree_model;
GtkTreePath *retval;
GList *list;
gint i = 0;
g_return_val_if_fail (iter->stamp == view_model->stamp, NULL);
for (list = view_model->columns; list; list = list->next)
{
if (list == (GList *)iter->user_data)
break;
i++;
}
if (list == NULL)
return NULL;
retval = gtk_tree_path_new ();
gtk_tree_path_append_index (retval, i);
return retval;
}
static void
view_column_model_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gint column,
GValue *value)
{
ViewColumnModel *view_model = (ViewColumnModel *)tree_model;
g_return_if_fail (column < 2);
g_return_if_fail (view_model->stamp == iter->stamp);
g_return_if_fail (iter->user_data != NULL);
if (column == 0)
{
g_value_init (value, G_TYPE_STRING);
g_value_set_string (value, gtk_tree_view_column_get_title (GTK_TREE_VIEW_COLUMN (((GList *)iter->user_data)->data)));
}
else
{
g_value_init (value, GTK_TYPE_TREE_VIEW_COLUMN);
g_value_set_object (value, ((GList *)iter->user_data)->data);
}
}
static gboolean
view_column_model_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
ViewColumnModel *view_model = (ViewColumnModel *)tree_model;
g_return_val_if_fail (view_model->stamp == iter->stamp, FALSE);
g_return_val_if_fail (iter->user_data != NULL, FALSE);
iter->user_data = ((GList *)iter->user_data)->next;
return iter->user_data != NULL;
}
static gboolean
view_column_model_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent)
{
ViewColumnModel *view_model = (ViewColumnModel *)tree_model;
/* this is a list, nodes have no children */
if (parent)
return FALSE;