Different Pixbuf on each treeview row



Hi people

I have a treeview with many columns (name,age ,etc)

In NAME column , i have (for now 2 renderers) :A GdkPixbuf Renderer and a text renderer
My problem is that every row has to have a different pixbuf loaded.
In the gtk reference manual i found this :

\"For example, you can bind the \"pixbuf\" property on the cell renderer to a pixbuf
value in the model, thus rendering a different image in each row of the
GtkTreeView.\"

How can i do this??

I tried with g_object_set , but thre result is that i see the same pixbuf on all rows.
Next  i tried this:

name_column = gtk_tree_view_get_column (treeview,NAME_COLUMN);
renderer_list = gtk_tree_view_column_get_cell_renderers (name_column);
pixbuf_renderer = (GtkCellRenderer *)g_list_nth_data(renderer_list,0);
gtk_tree_view_column_set_attributes(name_column,pixbuf_renderer,\"pixbuf\",file_pixbuf,NULL);

but look at the errors:

 Gtk-CRITICAL **: file gtktreestore.c: line 636 (gtk_tree_store_get_value):
 assertion `column < GTK_TREE_STORE (tree_model)->n_columns\' failed
                                                                                                                                                                                                  
(a.out:24064): GLib-GObject-CRITICAL **: file gobject.c: line 1019
(g_object_set_property): assertion `G_IS_VALUE (value)\' failed
                                                                                                                                                                                                  
(a.out:24064): GLib-GObject-CRITICAL **: file gvalue.c: line 147 (g_value_unset):
assertion `G_IS_VALUE (value)\' failed


Could you help me pls?
Or if you point me to a program that implemented this already, i\'ll be gratefull.
(anything except nautilus :-))

I have GNOME 2.2



Thanks

Acest email a fost trimis din interfata web http://www.bumerang.ro






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]