Re: [gtkmm] Pixbufs in treeviews under win32
- From: Ole Laursen <olau hardworking dk>
- To: gtkmm-list gnome org
- Subject: Re: [gtkmm] Pixbufs in treeviews under win32
- Date: 30 Apr 2003 00:12:41 +0200
Murray Cumming Comneon com writes:
[...]
> > My fix for this was to create a Gtk::CellRendererPixbuf, and
> > add it to
> > a Gtk::TreeColumn, connecting all of the properties to the
> > ColumnRecord
> > manually. Then add the Gtk::TreeViewColumn to the Gtk::TreeView. For
> > some reason this method works while the "easy" way doesn't.
>
> This shouldn't be necessary. I'd be very surprised if it's necessary on
> linux, because it's being used lots. You should tell us about problems.
I had a similar issue with pixbufs and treeviews where compiling the
program with -O3 would make the program crash with a mystical type
mismatch error from glib, whereas -O0 worked fine. I just need to get
around to producing a smaller test program that exhibits the same
behaviour.
The error is
GLib-GObject-WARNING **: unable to set property `text' of type
`gchararray' from value of type `GdkPixbuf'
It is completely reproducible. Here's a stack trace produced with
--g-fatal-warnings:
#0 0x40d46a41 in kill () from /lib/libc.so.6
#1 0x40cd924b in pthread_kill () from /lib/libpthread.so.0
#2 0x40cd9521 in raise () from /lib/libpthread.so.0
#3 0x40d47976 in abort () from /lib/libc.so.6
#4 0x40bb5490 in g_logv () from /usr/lib/libglib-2.0.so.0
#5 0x40bb54b3 in g_log () from /usr/lib/libglib-2.0.so.0
#6 0x40b66ce6 in g_object_set_property () from /usr/lib/libgobject-2.0.so.0
#7 0x408269fe in gtk_tree_view_column_cell_set_cell_data ()
from /usr/lib/libgtk-x11-2.0.so.0
#8 0x40816bbe in gtk_tree_view_get_type () from /usr/lib/libgtk-x11-2.0.so.0
#9 0x408173ee in gtk_tree_view_get_type () from /usr/lib/libgtk-x11-2.0.so.0
#10 0x40817d2b in gtk_tree_view_get_type () from /usr/lib/libgtk-x11-2.0.so.0
#11 0x40817d88 in gtk_tree_view_get_type () from /usr/lib/libgtk-x11-2.0.so.0
#12 0x40bb0be8 in g_timeout_add () from /usr/lib/libglib-2.0.so.0
#13 0x40bae44f in g_get_current_time () from /usr/lib/libglib-2.0.so.0
#14 0x40baf369 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#15 0x40baf66f in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#16 0x40bafcbe in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#17 0x40773c97 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#18 0x404d7f62 in Gtk::Main::run_impl() () from /usr/lib/libgtkmm-2.0.so.1
#19 0x404d7e01 in Gtk::Main::run(Gtk::Window&) ()
from /usr/lib/libgtkmm-2.0.so.1
#20 0x08062ae5 in main (argc=3, argv=0xbffffa04) at main.cpp:49
The code is using the methods described in the tutorial to put the
pixbufs into the treeview, i.e.
class MyColumns: public Gtk::TreeModel::ColumnRecord
{
public:
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon;
Glib::ustring text;
MyColumns() { add(icon); add(text); }
};
and then
static MyColumns c;
my_store = Gtk::TreeStore::create(c);
my_treeview->set_model(my_store);
my_treeview->append_column("icon", c.icon);
my_treeview->append_column("text", c.text);
store_iter iter = my_store->append();
(*iter)[c.icon] = some_pixbuf;
(*iter)[c.text] = "hello";
I'm sure some_pixbuf is valid because displaying it elsewhere in a
Gtk::Image widget works fine.
--
Ole Laursen
http://www.cs.auc.dk/~olau/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]