Any advice?
James
Below is the code that I used to emulate adding dynamic data to the tree view.
#include <gtk/gtk.h>
struct info { GtkTreeStore *store; int val; };
gboolean addval( gpointer data ) { struct info *i = (struct info *)data; GtkTreeIter iter;
gtk_tree_store_append( i->store, &iter, NULL );
gtk_tree_store_set( i->store, &iter, 0, i->val, -1 );
if( i->val < 50 ) { i->val += 1; return TRUE; }
return FALSE; }
int main( int argc, char **argv ) { GtkWidget *window; GtkScrolledWindow *scroll; GtkTreeStore *store; GtkTreeView *view; struct info i;
gtk_init( &argc, &argv );
window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); g_signal_connect( G_OBJECT(window), "delete_event", G_CALLBACK(gtk_main_quit), NULL );
scroll = GTK_SCROLLED_WINDOW( gtk_scrolled_window_new(NULL, NULL) );
store = gtk_tree_store_new( 1, G_TYPE_INT );
view = gtk_tree_view_new_with_model(store);
gtk_tree_view_insert_column_with_attributes( view, 0, "Value", gtk_cell_renderer_text_new(), "text", 0, NULL );
gtk_tree_sortable_set_sort_column_id( store, 0, GTK_SORT_DESCENDING );
gtk_container_add( scroll, view ); gtk_container_add( window, scroll );
i.store = store; i.val = 0;
gtk_timeout_add( 2000, addval, &i );
gtk_widget_show_all( window );
gtk_main();
return 0; } _______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list