On Sun, Dec 17, 2006 at 11:06:14PM -0500, Tony Freeman wrote: > > >a > What am I doing wrong? > > g_object_set(icon_renderer, "stock-id", "gtk-close", NULL); > ... > g_object_set(icon_renderer, "stock-id", "gtk-save", NULL); > ... > g_object_set(icon_renderer, "stock-id", "gtk-open", NULL);
So while the model is constructed, some random renderer's "stock-id" property is set to various things, at the end to "gtk-open" stock icon. And it remains so. Then this renderer is used for rendering some view which accidentally displays the model. Therefore when the icons are actually rendered it always renders "gtk-open" icon. What happens to some renderer duing the tree model construction is absolutely irrelevant, there is no connection between these two: the tree view may not exist at that time at all, the model data can be shown by a thousand of different renderes later... Your code is exactly equivalent to liststore = gtk_list_store_new(2, GDK_TYPE_PIXBUF, G_TYPE_STRING); /* workstations */ count = g_strv_length(workstations); for (i=0; i<count; i++) { gtk_list_store_append(liststore, &iter); gtk_list_store_set(liststore, &iter, 0, icon_renderer, 1, workstations[i], -1); } /* linux servers */ count = g_strv_length(servers_linux); for (i=0; i<count; i++) { gtk_list_store_append(liststore, &iter); gtk_list_store_set(liststore, &iter, 0, icon_renderer, 1, servers_linux[i], -1); } /* hp servers */ count = g_strv_length(servers_hp); for (i=0; i<count; i++) { gtk_list_store_append(liststore, &iter); gtk_list_store_set(liststore, &iter, 0, icon_renderer, 1, servers_hp[i], -1); } icon_renderer = gtk_cell_renderer_pixbuf_new(); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(treeview), 0, " ", icon_renderer, NULL); g_object_set(icon_renderer, "stock-id", "gtk-close", NULL); g_object_set(icon_renderer, "stock-id", "gtk-save", NULL); g_object_set(icon_renderer, "stock-id", "gtk-open", NULL); text_renderer = gtk_cell_renderer_text_new(); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(treeview), 1, " ", text_renderer, NULL); (In fact, this is the order on would normally write it.) Only the properties of the renderer *when a cell is being rendered* matter. So you either have to actually store the icons to the now useless GDK_TYPE_PIXBUF column and map column 0 to the "pixbuf" property with gtk_tree_view_insert_column_with_attributes(), or change it to a G_TYPE_STRING column, store the stock ids to this column and map it to the "stock-id" property (or use a cell data func, or just anything that sets the properties when they are actually used). Yeti -- Whatever. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list