GtkTReeView question(s)



Hello,
i'm actually using GtkTreeView  to display joystick's buttons and values.
This imply (for buttons ) changing a pixmap for another one when a button status change. Problem is : changing pixmap ( or analog value in a label ) is really slow, which is really bad for me due to close-to-real-time constaints, and the relative (~400Mhz) slowness of the computers
the program is destinated to run on.

I made a test changing pixmaps located in a fixed widget, and this is by far faster, letting
other thread ( video ) having time enough to make its job honestly.

So,
- Is tree widget inherenlty 'slow' at refreshing changes in model
- Is the model data update slow ?
- What am i doing wrong ( see code later ) ?
I'm using TreeView because of ease of use, but i may use other solutions. Is there other simple solutions to display a 2 levels tree-like structure, no need to unexpand, but selection of
one item is needed in a List / Tree like fashion ?

Here are the bits of code i use with the tree view. Disclaimer : This is my first beyond-hello-world-gtk-program.

GdkPixbuf *image_active;
...
// Images are set-up using glade support functions
image_notinit = create_pixbuf ( "not_init.xpm" );
image_active = create_pixbuf ( "active.xpm" );
...

/*
( GtkTreeIter iter ) p_device->dig_input[js.number].iter is an iterator to input's corresponding line in model
*/
...

// Model creation
tree_model = ( GtkTreeModel * ) gtk_tree_store_new ( 6, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF );
...

// View column is created like this
column = gtk_tree_view_column_new (  );     // Create a column
gtk_tree_view_append_column ( tree_view, column ); // Add it to view renderer = gtk_cell_renderer_pixbuf_new ( ); // Create a renderer
g_object_set ( G_OBJECT ( renderer ), "xalign", 0.0, NULL );
gtk_tree_view_column_pack_start ( column, renderer, TRUE ); // Add it to column gtk_tree_view_column_set_attributes ( column, renderer, "pixbuf", 5, "visible", 4, NULL );
...

// Model is filled like this
gtk_tree_store_set ( tree_store, &( device->dig_input[i].iter ), 0, image_digital, 1, "input", 2, "digital", 3, 5326, 4, TRUE, 5, image_notinit, -1 );
...

// Image is changed like this ( in a callback called by gtk_input system )
// This take 100% Processor time long enough to make alsa-player hickup while playing. Ok, few is needed for it, but anyway. gtk_tree_store_set ( p_device->tree_store, &( p_device->dig_input[js.number].iter ), 5, image_active, -1 );

Thanks in advance !!!!


___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com



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