Elements not shown in treeview and combobox?



Hello all.
Surely I'm missing something, but:

GtkWidget *w;
GtkComboBox *cb1;
GtkTreeStore *m;
GtkTreeIter n[6];
GladeXML *xml;
[...]
m=gtk_tree_store_new(3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_store_append(m, n+0, NULL);
gtk_tree_store_append(m, n+1, NULL);
gtk_tree_store_append(m, n+2, n+0);
gtk_tree_store_append(m, n+3, n+0);
gtk_tree_store_append(m, n+4, n+2);
gtk_tree_store_append(m, n+5, n+1);

gtk_tree_store_set(m, n+0, 0, 0, 1, "top", 2, "level", -1);
gtk_tree_store_set(m, n+1, 0, 1, 1, "another", 2, "top", -1);
gtk_tree_store_set(m, n+2, 0, 2, 1, "first", 2, "level", -1);
gtk_tree_store_set(m, n+3, 0, 3, 1, "another", 2, "first", -1);
gtk_tree_store_set(m, n+4, 0, 4, 1, "second", 2, "level", -1);
gtk_tree_store_set(m, n+5, 0, 5, 1, "1's", 2, "son", -1);

w=glade_xml_get_widget (xml, "combobox1");
cb1=GTK_COMBO_BOX(w);
gtk_combo_box_set_model(cb1, GTK_TREE_MODEL(m));

w=glade_xml_get_widget (xml, "treeview1");
//g_signal_connect (w, "realize", G_CALLBACK (gtk_tree_view_expand_all),
NULL);
gtk_tree_view_set_model(GTK_TREE_VIEW(w), GTK_TREE_MODEL(m));

Seems to create the correct tree (the menu in the combo box is
multi-level), but both the menu and the tree are "empty" (no characters
drawn).
IIRC the same code built a valid tree in 2.4 (I'm now using 2.6 to have
a tree in the combobox). GtkDemo works ok and I can't see anything
obvious in the code :-(

BYtE,
 Diego.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]