GNOME Bugzilla – Bug 470243
Doesn't convert Comboboxes properly
Last modified: 2007-08-25 18:46:49 UTC
In totem.glade: <widget class="GtkComboBox" id="tpw_visuals_type_combobox"> <property name="visible">True</property> <property name="items" translatable="yes"></property> <property name="add_tearoffs">False</property> <property name="focus_on_click">True</property> </widget> In totem.ui: <object class="GtkListStore" id="tpw_visuals_type_liststore"> <columns> <column type="gchararray"/> </columns> <data> </data> </object> <object class="GtkComboBox" id="tpw_visuals_type_combobox"> <property name="visible">True</property> <property name="add_tearoffs">False</property> <property name="focus_on_click">True</property> <property name="model">tpw_visuals_type_liststore</property> <signal name="changed" handler="visual_menu_changed"/> </object> With the glade file, a text cell renderer was created automatically, so that it was enough to do: gtk_combo_box_append_text (combobox, text); to add new items to the list. With GtkBuilder, I need to add a text cell renderer to the combobox myself, as done in gtk_combo_box_new_text(). What would I need to do to add the text cell renderer to the combobox in the .ui file?
GtkBuilder has the policy of trying to do as little as possible implicitly, that incluses creating cell renderers behind your back. GtkComboBox implements the custom tag 'attribute' in GtkBuildable interface. It should be enough by adding; <attributes> <attribute name="text">0</attribute> </attributes> Check the test_combo_box function in buildertest.c for a complete example: http://svn.gnome.org/viewcvs/gtk+/trunk/tests/buildertest.c?view=markup Does this address your problems?
Works great. But if the GtkComboBoxes in glade were really text combo boxes, the convert tool should add those lines automatically to the .ui, right?
Yes, definitely. It was an oversight.
Actually, it does add a GtkListStore and a GtkCellRendererText renderer, but only iff there's an items property. You must have converted that file using an older version of the converter script, if not reopen the bug and attach the file which the converter script (from trunk) fails to convert.