gtk tree store



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...


/* 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 --]--------------------------





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