diff -r 853685152c1d -r dd0ae1c62a72 ui/gtk/model.c --- a/ui/gtk/model.c Sun Nov 12 12:03:50 2017 +0100 +++ b/ui/gtk/model.c Thu Nov 16 12:04:10 2017 +0100 @@ -30,6 +30,7 @@ #include #include "model.h" +#include "image.h" #define IS_UI_LIST_MODEL(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE((obj), list_model_type)) @@ -107,6 +108,11 @@ static void ui_model_set_value(GType type, void *data, GValue *value) { switch(type) { + case G_TYPE_OBJECT: { + value->g_type = G_TYPE_OBJECT; + g_value_set_object(value, data); + return; + } case G_TYPE_STRING: { value->g_type = G_TYPE_STRING; g_value_set_string(value, data); @@ -131,7 +137,7 @@ for(int i=0;icolumns;i++) { UiModelType type = info->types[i]; if(type == UI_ICON_TEXT) { - model->columntypes[ncol] = G_TYPE_STRING; + model->columntypes[ncol] = G_TYPE_OBJECT; ncol++; model->columntypes[ncol] = G_TYPE_STRING; } else { @@ -245,7 +251,12 @@ //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); + if(model->columntypes[column] == G_TYPE_OBJECT) { + UiImage *img = data; + ui_model_set_value(model->columntypes[column], img->pixbuf, value); + } else { + ui_model_set_value(model->columntypes[column], data, value); + } } else { value->g_type = G_TYPE_INVALID; } @@ -257,7 +268,11 @@ { g_return_val_if_fail(IS_UI_LIST_MODEL(tree_model), FALSE); g_return_val_if_fail(iter != NULL, FALSE); - g_return_val_if_fail(iter->user_data != NULL, FALSE); + //g_return_val_if_fail(iter->user_data != NULL, FALSE); + + if(!iter->user_data) { + return FALSE; + } UiListModel *model = UI_LIST_MODEL(tree_model); UiList *list = model->var->value;