Re: signal SIGSEGV, Segmentation fault for GtkTreeView
- From: "David Necas (Yeti)" <yeti physics muni cz>
- To: DC A <adc4444 hotmail com>
- Cc: gtk-list gnome org
- Subject: Re: signal SIGSEGV, Segmentation fault for GtkTreeView
- Date: Sat, 29 Apr 2006 02:08:38 +0200
On Fri, Apr 28, 2006 at 11:02:38PM +0000, DC A wrote:
> I want to add pixbuf and a string in a single GtkTreeView cell. My code for
> adding these to list store:
>
>
> pixbuf = gdk_pixbuf_new_from_file("example.png", &error);
> model = gtk_list_store_new(3, GDK_TYPE_PIXBUF | G_TYPE_STRING,
> G_TYPE_INT);
This creates a list store with 3 columns of following types:
1. an invalid type GDK_TYPE_PIXBUF | G_TYPE_STRING
(GTypes are ugly numbers that definitely cannot be bitwise
or-ed)
2. G_TYPE_INT
3. some random junk that happens to lie on stack after the
first two arguments
Therefore
> After compilation I get segmentation fault.
GtkTreeView is based on the Model-View-Controller pattern
thus
****************************************************************************
* *
* GtkTreeModel columns and GtkTreeView columns are *
* two unrelated sets of columns. *
* *
****************************************************************************
A tree *model* column holds one value of a specific type [in
each row]. To create a model with a pixbuf, a string, and
an int in each row, do
model = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT);
Now you create a view that consists of some columns and use
cell data functions or column attributte mapping to relate
the view columns to the model columns. This relation can be
arbitrary -- even none at all in the extreme case.
If you want to pack more cells (i.e., cell renderers) to one
tree *view* column, do just that (examples can be found in
many places, one recent probably not very didactic is here:
http://mail.gnome.org/archives/gtk-app-devel-list/2006-April/msg00008.html).
Please read the tree view tutorial.
Yeti
--
That's enough.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]