problems to make the datas appear in a TREE ...



Hi every one,

I'm getting some troubles to make datas appear in a gtk tree store ...
i'm pasting the piece of code in my app that is resposible to create
and  populate the tree

(...)
    /*Create store and columns */
    store =
    gtk_tree_store_new(1,G_TYPE_STRING);
    dialog_widgets->tree =
        gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));

    column = gtk_tree_view_column_new();
    renderer = gtk_cell_renderer_text_new();
    gtk_tree_view_column_pack_start(column, renderer, TRUE);
    gtk_tree_view_column_add_attribute(column, renderer, "text", 0);
    gtk_tree_view_append_column(GTK_TREE_VIEW(dialog_widgets->tree),
                                column);
    gtk_tree_view_set_expander_column(GTK_TREE_VIEW(dialog_widgets->tree),
                                column);


(...populating the tree...)

        for (list = history_list->history, i = 0; list ; list =
list->next, i++) {

                add_to_node(history_list, &iter, dialog_widgets->tree, i);

        }

        GtkTreeModel *model =
gtk_tree_view_get_model(GTK_TREE_VIEW(dialog_widgets->tree));

(...)

static void add_to_node(HistoryStruct * history_list,
                        GtkTreeIter * iter, GtkWidget * tree, gint index)
{
    GtkTreeIter C_iter;
    gchar *buffer = NULL;

    GtkTreeStore *store = 
        GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(tree)));

    gtk_tree_store_append(store, &C_iter, iter);

    gtk_tree_store_set(store, &C_iter, 0, (const gchar *)
g_slist_nth_data (history_list->history, index), -1);
}
        

after all this code, there is no segfaults but nothing occurs ... just
a line is created in the tree with no content :S ...

am I doing some thing wrong or is missing any details !!?

Best regards

-- 
Antonio Gomes
E-mail: antonio gomes indt org br
Embedded Linux Lab - 10LE
INdT - Instituto Nokia de Tecnologia (Manaus/Br)
NOKIA's Technology Institute



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