--- a/ui/gtk/model.c Wed Jul 13 16:40:59 2016 +0200 +++ b/ui/gtk/model.c Sat Sep 17 19:32:44 2016 +0200 @@ -105,14 +105,14 @@ return G_TYPE_INVALID; } -static void ui_model_set_value(GType type, void *data, GValue *value) { +static void ui_model_set_value(UiModelType type, void *data, GValue *value) { switch(type) { - case G_TYPE_STRING: { + case UI_STRING: { value->g_type = G_TYPE_STRING; g_value_set_string(value, data); return; } - case G_TYPE_INT: { + case UI_INTEGER: { value->g_type = G_TYPE_INT; int *i = data; g_value_set_int(value, *i); @@ -126,20 +126,11 @@ UiListModel *model = g_object_new(list_model_type, NULL); model->info = info; model->list = list; - model->columntypes = calloc(sizeof(GType), 2 * info->columns); - int ncol = 0; + model->columntypes = malloc(sizeof(GType)); + model->numcolumns = info->columns; for(int i=0;i<info->columns;i++) { - UiModelType type = info->types[i]; - if(type == UI_ICON_TEXT) { - model->columntypes[ncol] = G_TYPE_STRING; - ncol++; - model->columntypes[ncol] = G_TYPE_STRING; - } else { - model->columntypes[ncol] = ui_gtk_type(info->types[i]); - } - ncol++; + model->columntypes[i] = ui_gtk_type(info->types[i]); } - model->numcolumns = ncol; return model; } @@ -246,7 +237,7 @@ //list->current = iter->user_data3; if(model->info->getvalue) { void *data = model->info->getvalue(iter->user_data3, column); - ui_model_set_value(model->columntypes[column], data, value); + ui_model_set_value(model->info->types[column], data, value); } else { value->g_type = G_TYPE_INVALID; }