static void append_row(uat_t *uat, guint idx) { GPtrArray *a = g_ptr_array_new(); void *rec = UAT_INDEX_PTR(uat, idx); uat_field_t *f = uat->fields; guint colnum; GtkTreeIter iter; if (! uat->rep) return; gtk_list_store_insert_before(uat->rep->list_store, &iter, NULL); for ( colnum = 0; colnum < uat->ncols; colnum++ ) { g_ptr_array_add(a, fld_tostr(rec, &(f[colnum]))); gtk_list_store_set(uat->rep->list_store, &iter, colnum, fld_tostr(rec, &(f[colnum])), -1); } g_ptr_array_free(a, TRUE); }
static void append_row(uat_t *uat, guint idx) { void *rec = UAT_INDEX_PTR(uat, idx); uat_field_t *f = uat->fields; guint colnum; GtkTreeIter iter; gchar* tmp_str; if (! uat->rep) return; gtk_list_store_insert_before(uat->rep->list_store, &iter, NULL); for ( colnum = 0; colnum < uat->ncols; colnum++ ) { tmp_str = fld_tostr(rec, &(f[colnum])); gtk_list_store_set(uat->rep->list_store, &iter, colnum, tmp_str, -1); g_free(tmp_str); } }
static void reset_row(uat_t *uat, guint idx) { void *rec = UAT_INDEX_PTR(uat, idx); uat_field_t *f = uat->fields; guint colnum; GtkTreePath *path; GtkTreeIter iter; if (! uat->rep) return; path = gtk_tree_path_new_from_indices(idx, -1); if (!path || !gtk_tree_model_get_iter(GTK_TREE_MODEL(uat->rep->list_store), &iter, path)) { return; } for ( colnum = 0; colnum < uat->ncols; colnum++ ) { gtk_list_store_set(uat->rep->list_store, &iter, colnum, fld_tostr(rec, &(f[colnum])), -1); } }