Re: gtk tree store
- From: Burra <burra colorado edu>
- To: gtk-app-devel-list gnome org
- Subject: Re: gtk tree store
- Date: Tue, 15 Jan 2002 00:07:03 -0700 (MST)
Anyone have an example of using gtk_cell_renderer_pixbuf? I am having a
few troubles...
What is the type for the ...
gtk_tree_store_new (4, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, ???G_TYPE_PIXBIF??);
... function?
This look ok?
pixcol = gtk_cell_renderer_pixbuf_new();
column = gtk_tree_view_column_new_with_attributes ("Source",
pixcol, "pixbuf", "/usr/share/pixmaps/dialog-warning.png", NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
--------------------[-- burra colorado edu --]--------------------------
On 14 Jan 2002, Keith Sharp wrote:
On Mon, 2002-01-14 at 05:35, Burra wrote:
I am trying to create a table of data, but I cannot figure out how to
populate the store.
This is what I am doing...
/* Create a new store */
model = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
/* Create the view */
view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
/* Try to create a new row */
gtk_tree_store_append (GTK_TREE_STORE (model), &iter, NULL);
...no idea how to populate the model...
My model is a GtkTreeStore, so I use gtk_tree_store_set to populate my
row with data:
gtk_tree_store_set (model, &iter, 0, "String 1", -1);
gtk_tree_store_set (model, &iter, 1, "String 2", -1);
0 and 1 are the cells in the row that I want to populate, -1 terminates
the list of cells to populate.
Keith.
/* Renderer for first column */
cell_renderer1 = gtk_cell_renderer_text_new();
g_object_set (G_OBJECT (cell_renderer1), "foreground", "dodger blue",
NULL);
column1 = gtk_tree_view_column_new_with_attributes ("Column 1",
cell_renderer1, "text", 0, NULL);
/* Renderer for second column */
cell_renderer2 = gtk_cell_renderer_text_new();
g_object_set (G_OBJECT (cell_renderer2), "weight", "bold", NULL);
column2 = gtk_tree_view_column_new_with_attributes ("Column 2",
cell_renderer2,"text", 0, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (view), column1);
gtk_tree_view_append_column (GTK_TREE_VIEW (view), column2);
gtk_container_add (GTK_CONTAINER (window), view);
..etc...
Anyone know the proper way to populate the model? ...or a good example of
it?
help.
--------------------[-- burra colorado edu --]--------------------------
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]