ui/gtk/list.c

changeset 50
9c25e2616bfa
parent 46
31bc86844659
child 51
e324291ca9f8
equal deleted inserted replaced
49:2f71f4ee247a 50:9c25e2616bfa
112 } 112 }
113 case UI_ICON_TEXT: 113 case UI_ICON_TEXT:
114 case UI_ICON_TEXT_FREE: { 114 case UI_ICON_TEXT_FREE: {
115 UiIcon *icon = data; 115 UiIcon *icon = data;
116 #if GTK_MAJOR_VERSION >= 4 116 #if GTK_MAJOR_VERSION >= 4
117 GValue iconvalue = G_VALUE_INIT; 117 if(icon) {
118 g_value_init(&iconvalue, G_TYPE_OBJECT); 118 GValue iconvalue = G_VALUE_INIT;
119 g_value_set_object(&iconvalue, ui_icon_pixbuf(icon)); 119 g_value_init(&iconvalue, G_TYPE_OBJECT);
120 gtk_list_store_set_value(store, &iter, c, &iconvalue); 120 g_value_set_object(&iconvalue, ui_icon_pixbuf(icon));
121 gtk_list_store_set_value(store, &iter, c, &iconvalue);
122 }
121 #else 123 #else
122 GValue pixbufvalue = G_VALUE_INIT; 124 GValue pixbufvalue = G_VALUE_INIT;
123 if(!icon->pixbuf && icon->info) { 125 if(icon) {
124 GError *error = NULL; 126 if(!icon->pixbuf && icon->info) {
125 GdkPixbuf *pixbuf = gtk_icon_info_load_icon(icon->info, &error); 127 GError *error = NULL;
126 icon->pixbuf = pixbuf; 128 GdkPixbuf *pixbuf = gtk_icon_info_load_icon(icon->info, &error);
129 icon->pixbuf = pixbuf;
130 }
131 g_value_init(&pixbufvalue, G_TYPE_OBJECT);
132 g_value_set_object(&pixbufvalue, icon->pixbuf);
133 gtk_list_store_set_value(store, &iter, c, &pixbufvalue);
127 } 134 }
128 g_value_init(&pixbufvalue, G_TYPE_OBJECT);
129 g_value_set_object(&pixbufvalue, icon->pixbuf);
130 gtk_list_store_set_value(store, &iter, c, &pixbufvalue);
131 #endif 135 #endif
132 c++; 136 c++;
133 137
134 char *str = model->getvalue(elm, c); 138 char *str = model->getvalue(elm, c);
135 g_value_init(&value, G_TYPE_STRING); 139 g_value_init(&value, G_TYPE_STRING);

mercurial