Re: GtkCellRendererPixbuf question.
- From: Iago Rubio <iago rubio hispalinux es>
- To: gtk-app-devel-list gnome org
- Subject: Re: GtkCellRendererPixbuf question.
- Date: Sat, 19 Mar 2005 22:05:09 +0100
On Sat, 2005-03-19 at 11:33 -0800, Deekshit M wrote:
Hi all,
I wanted to have some images on the tree nodes. I
created my column like
GtkCellRenderer *renderer_image;
renderer_image = gtk_cell_renderer_pixbuf_new();
column = gtk_tree_view_column_new();
gtk_tree_view_column_pack_start(column,renderer_image,FALSE);
gtk_tree_view_column_add_attribute(column,
renderer_image,
"pixbuf",0);
How did you defined the model ?
I wanted to create root node like,
GdkPixbuf *pb;
gtk_tree_store_append (GTK_TREE_STORE (model), &iter,
NULL);
pb = get_pixbuf("play.xpm");
gtk_tree_store_set(GTK_TREE_STORE (model),&iter,
0,pb,-1);
But I get like
GLib-GObject-WARNING **: unable to set property
`pixbuf' of type `GdkPixbuf' from value of type
`gchararray'
Can anybody help me to solve the problem....
What does the function get_pixbuf returns ?
Is there any example of using images in TreeStore
treeview = gtk_tree_view_new ();
gtk_widget_show (treeview);
gtk_container_add (GTK_CONTAINER (the_container), treeview);
text_renderer = gtk_cell_renderer_text_new();
image_renderer = gtk_cell_renderer_pixbuf_new();
store = gtk_tree_store_new(2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
image_col = gtk_tree_view_column_new_with_attributes ("Image",
image_renderer,
"pixbuf", 0,
NULL);
text_col = gtk_tree_view_column_new_with_attributes ("Text",
text_renderer,
"text", 1,
NULL);
gtk_tree_view_set_model (GTK_TREE_VIEW (treeview),
GTK_TREE_MODEL (store));
gtk_tree_view_insert_column ( GTK_TREE_VIEW(treeview), image_col, 0);
gtk_tree_view_insert_column ( GTK_TREE_VIEW(treeview), text_col, 1);
// this is yours
gtk_tree_store_append (GTK_TREE_STORE (store), &iter,NULL);
pb = get_pixbuf("play.xpm"); // does it returns a GdkPixbuf ?
gtk_tree_store_set(GTK_TREE_STORE (model), &iter, 0, pb,-1);
--
Iago Rubio
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]