gtk_tree_view_column_set_cell_data_func gives GTK-CRITICAL error
- From: James Steward <jamessteward optusnet com au>
- To: gtk app devel list <gtk-app-devel-list gnome org>
- Subject: gtk_tree_view_column_set_cell_data_func gives GTK-CRITICAL error
- Date: Wed, 30 Nov 2011 12:58:11 +1100
Hi,
Wanting to display floats with a particular format in a tree view.
void render_float(GtkTreeViewColumn *column,
GtkCellRenderer *renderer,
GtkTreeModel *model,
GtkTreeIter *iter,
gpointer user_data)
{
gfloat f;
gchar buf[20];
int col = GPOINTER_TO_INT(user_data);
gtk_tree_model_get(model, iter, col, &f, -1);
g_snprintf(buf, sizeof(buf), "%.2f", f);
g_object_set(renderer, "text", buf, NULL);
}
G_MODULE_EXPORT gboolean on_menu_show_results_activate(
GtkWidget *w,
GdkEvent *event,
gpointer user_data)
{
...
renderer = gtk_cell_renderer_text_new ();
col = gtk_tree_view_insert_column_with_attributes (
GTK_TREE_VIEW (view),
-1,
"Title",
renderer,
"text", i,
"strikethrough", j,
"background", k,
"background-set", TRUE,
NULL);
gtk_tree_view_column_set_cell_data_func(
gtk_tree_view_get_column(GTK_TREE_VIEW(view), col),
renderer,
render_float,
GINT_TO_POINTER(i),
NULL);
...
}
When I run the app I get:
Gtk-CRITICAL **: gtk_cell_layout_set_cell_data_func: assertion
`GTK_IS_CELL_LAYOUT (cell_layout)' failed
Can anyone spot what I've done wrong? There's no compiler warnings,
just this runtime error.
--
James.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]