GtkComboBox madness



I'm trying to just stick some strings in a plain old GtkComboBox that
I'm getting from Glade.  There seems to be an easier way to do this if
you're writing the code w/o Glade (using gtk_combo_box_new_text()) but
that doesn't seem possible using Glade.  (I'll be needing to stick some
other hidden data in the combobox so I need to figure out the "regular"
way anyway).

There are so many different interfaces coming into play here that it's
confusing as heck!

Here's what I have so far:

gchar *vehicle;
GtkComboBox *comboVehicles = GTK_COMBO_BOX(glade_xml_get_widget(glade,
"comboVehicles"));

GtkListStore *listVehicles = gtk_list_store_new(1, G_TYPE_STRING);
gtk_combo_box_set_model(comboVehicles, GTK_TREE_MODEL(listVehicles));

vehicle = (char*) row[2];

GtkCellRendererText *cell = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(comboVehicles),
GTK_CELL_RENDERER(cell), TRUE);

gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(comboVehicles),
GTK_CELL_RENDERER(cell), "text", 0);

GtkTreeIter iter;
gtk_list_store_append(listVehicles, &iter);
gtk_list_store_set(listVehicles, &iter, 0, vehicle, -1);
gtk_list_store_set(listVehicles, &iter, 0, "HELLLO", -1);

Thanks in advance,

Jay




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