Re: GtkTreeView and pixbuf renderer



Peter Zelezny <pzel dodo com au> writes:

Hi All,

Could someone give me a little help with GtkTreeView? I'm trying to create
a column of pixbufs, but somehow it's not working. This is roughly what I have:

static GdkPixbuf *pix_op;
...
  renderer = gtk_cell_renderer_pixbuf_new ();
  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
                                             -1, "Icon", renderer,
                                             "pixbuf", COLUMN_ICON,
                                             NULL);
...
/* adding some rows */
  gtk_list_store_append (GTK_LIST_STORE (model), &iter);
  gtk_list_store_set (GTK_LIST_STORE (model), &iter,
                    COLUMN_ICON, pix_op,
                    COLUMN_NICK, "nickname",
                    COLUMN_HOST, "user host com",
                    -1);

I know the "pix_op" is valid, because I can render it manually. No pixbuf is
shown in the column, and I get this warning:

(ulist:2704): GLib-GObject-WARNING **: unable to set property `pixbuf' of type `GdkPixbuf' from value of 
type `gpointer'

The other columns (text ones) are working just fine. What could the problem be?

When you make your model, you need to do something like:

list = gtk_list_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);

-Jonathan



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