-   Programming (
-   -   GTK Lists (

rubadub 02-29-2008 04:32 PM

GTK Lists
I've written a little app using GTK+ 2.0. In it is a tree with a list store. I can add data to it and clear it, but I can't dynamically add data to it, it always waits until the process is finished before it updates. Here's the function which is called every time something needs to be added:

void add_entry(char *nm, int size, char*perms)        //GtkWidget *list, const gchar *str)
        GtkTreeIter            iter;
        gtk_list_store_append (the_store, &iter);
        gtk_list_store_set (the_store, &iter,
                                COL_NAME, nm,
                                COL_SIZE, size,
                                COL_PERMS, perms,

I don't even need to call this any more? (not sure if I really should (it's from when I did the whole thing at once))

gtk_tree_view_set_model(GTK_TREE_VIEW (the_view), GTK_TREE_MODEL (the_store));

ararus 03-03-2008 10:28 AM

For efficiency reasons, Gtk doesn't update anything on screen until control returns from your program back to gtk. If you want to force an update, you can add a gtk_main_iteration() at the end of the add_entry function. As the name suggests, this will make a pass through gtk's main loop, which will update whatever needs to be updated.

rubadub 04-26-2008 09:05 AM

mmm, it's taken a while to get back to this project but thanks that does the trick!


while (gtk_events_pending())

All times are GMT -5. The time now is 04:21 PM.