} gridCol;
typedef struct {
int count;
- gridCol **columns;
+ gridCol *columns;
GtkTreeStore *store;
char *flds;
char *buf;
GtkTreeIter iter;
GValue value = {0};
char* bf;
- gridCol* cp;
for (v = agfstnode(g); v; v = agnxtnode(g, v)) {
if (!ND_selected(v))
gtk_tree_store_append(grid->store, &iter, NULL);
for (id = 0; id < grid->count; id++) {
- cp = grid->columns[id];
+ gridCol *cp = &grid->columns[id];
if (strcmp(cp->name, ID) == 0) continue;
if (strcmp(cp->name, Name) == 0)
continue;
g_value_init(&value, cp->type);
- switch (grid->columns[id]->type) {
+ switch (grid->columns[id].type) {
case G_TYPE_BOOLEAN:
if (bf) {
if ((strcmp(bf, "1") == 0) || (strcmp(bf, "true") == 0)
if (g->count > 0) {
types = gv_calloc((size_t)g->count, sizeof(GType));
for (id = 0; id < g->count; id++)
- types[id] = g->columns[id]->type;
+ types[id] = g->columns[id].type;
store = update_tree_store(g->store, g->count, types);
free (types);
gtk_tree_view_set_model(tree, (GtkTreeModel *) store);
/*insert columns */
for (id = 0; id < g->count; id++)
- create_column(g->columns[id], tree, id);
+ create_column(&g->columns[id], tree, id);
}
g->store = store;
return tree;
return;
assert(g->count >= 0);
g->columns = gv_recalloc(g->columns, (size_t)g->count, (size_t)g->count + 1,
- sizeof(gridCol*));
- g->columns[g->count] = gv_alloc(sizeof(gridCol));
- g->columns[g->count]->editable = editable;
- g->columns[g->count]->name = gv_strdup(name);
- g->columns[g->count]->type = g_type;
+ sizeof(gridCol));
+ g->columns[g->count].editable = editable;
+ g->columns[g->count].name = gv_strdup(name);
+ g->columns[g->count].type = g_type;
g->count++;
}
{
int id;
for (id = 0; id < g->count; id++) {
- free(g->columns[id]->name);
- free(g->columns[id]);
+ free(g->columns[id].name);
}
free(g->columns);
free(g->buf);