optimize table view updates

This commit is contained in:
Olaf Rempel 2008-03-19 03:13:06 +01:00
parent f2ac3923e7
commit 5c4bf8d3b7
2 changed files with 10 additions and 4 deletions

View File

@ -192,16 +192,20 @@ void gui_vartab_add_var(struct tdc_var *var)
COL_TYPE, typestr, COL_TYPE, typestr,
COL_NAME, var->name, COL_NAME, var->name,
-1); -1);
var->privdata = gtk_tree_iter_copy(&it);
} }
void gui_vartab_update_var(struct tdc_var *var) void gui_vartab_update_var(struct tdc_var *var)
{ {
// FIXME: don't update *all* columns when only *one* value changed /* do a dummy write to update cells */
gtk_tree_model_foreach(GTK_TREE_MODEL(list_store), header_toggle_update, NULL); GtkTreeIter *it = (GtkTreeIter *)var->privdata;
gtk_list_store_set(list_store, it, -1);
} }
void gui_vartab_remove_var(struct tdc_var *var) void gui_vartab_remove_var(struct tdc_var *var)
{ {
// FIXME: don't remove *all* columns when only *one* should be removed GtkTreeIter *it = (GtkTreeIter *)var->privdata;
gtk_list_store_clear(list_store); gtk_list_store_remove(list_store, it);
gtk_tree_iter_free(it);
} }

View File

@ -15,6 +15,8 @@ struct tdc_var {
float data_float; float data_float;
double data_double; double data_double;
}; };
void *privdata;
char name[0]; char name[0];
}; };