Re: Problems with GtkTreeStore



  GTK+ 2.0 Tree View Tutorial

for excellent and clear examples.

You need to generate a renderer for each column. This might be the cause
of all your problems. Also, you seem to set the model of the view twice
(which might not cause problems).


On Mon, 20 Jun 2005 02:41:58 +0200
"Francisco Fernandez" <franfernandezb coit es> wrote:

Hi guys!

    I need your valuable help with I subject that is driving me
crazy!!!  I am trying to create a TreeStore from a file, and to fill
from another source file. After getting many segmetation faults and
assertion failures, I've realized that I am not doing it in the right
way. This is what I want:

(+) ==> Device 1
  |               |          
  |            (+) ===> Attribute 1
  |              |
  |            (+) ===> Attribute 2
(+)==> Device 2 
  |              |
  |            (+) ===> Attribute 1
  |              |
  |            [...]
  |              |
  |            (+) ===> Attribute n
(+) ==> Device n

In my application's main window it should be displayed some kind of
devices monitored from my pc, plus their correspondent internal
attributes that will be fetched from the functions within a different
source file, as I stated before:

This is an overall of what i have:


GtkTreeStore *store;

GtkTreeIter *parent;
GtkTreeIter *child;

GtkWidget *view;

GList devList; //Here the present devices are stored

void deviceList(){

//This function populates the tree with the present devices but is not
able to //access their individual attributes.

store = gtk_tree_store_new(4, GTK_TYPE_STRING, GTK_TYPE_STRING,
GTK_TYPE_STRING, GTK_TYPE_STRING); //We will be monitoring four

view =  gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
renderer = gtk_cell_renderer_text_new();

gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), 0,
"name", renderer, "text", 0, NULL); [...]    //here come the other
three gtk_tree_view_intsert_column_with_attributes() func...

gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(store));

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