PixBufs and TreeViews



Hello,
        Two questions...

        I'm in the process of porting a gtk1.2 app to gtk2.0 (along with
a lot of other general cleanups too).

        Anyway one thing I want to do it (and was doing) is place an
icon in a column to indicate if a certain field (a gboolean) in the store
is true.  (So render the icon if it is true, nothing if it is false).

        The short question is: How should I do this?  

        The long question is: This is what I am doing currently - it is
giving me a great little segfault.  (Note in the example code I have
replaced some of the variables with their values).  renderer, pixbuf and
column are all non-null (and look like heap variables).

        renderer = gtk_cell_renderer_pixbuf_new();
        pixbuf = gdk_pixbuf_new_from_file("myfile.xpm",&gerror);
        column = gtk_tree_view_column_new_with_attributes(
                        "P",renderer,
                        "pixmap",1, /* the store col */
                        "pixbuf",pixbuf,
                        NULL);
        gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);

        It dies in gtk_tree_view_column_get_type called from
gtk_tree_view_append_column().  (Top of stack trace below[1]).  I can
supply other details if (amazingly) the bug is _not_ in my code ;-).

        Regards,
        nash

[1]
(gdb) bt
#0  0x4017e274 in gtk_tree_view_column_get_type ()
   from /usr/lib/libgtk-x11-2.0.so.0
#1  0x4017e5c5 in _gtk_tree_view_column_set_tree_view ()
   from /usr/lib/libgtk-x11-2.0.so.0
#2  0x40178769 in gtk_tree_view_insert_column ()
   from /usr/lib/libgtk-x11-2.0.so.0
#3  0x401783f2 in gtk_tree_view_append_column ()
   from /usr/lib/libgtk-x11-2.0.so.0
#4  0x8055474 in make_tree (store=0x810e030, view_info=0x80597a0) at tree.c:91

-- 
Brett Nash <nash nash nu>
Sometimes it's better to light a flamethrower than curse the darkness.



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