GNOME Bugzilla – Bug 165411
Combo box items entered in Glade do not show up in derived widget at runtime
Last modified: 2011-01-16 23:33:41 UTC
Please describe the problem: My application's UI is wholly designed in Glade and I would rather not have to resort to code for any reason. In one dialog window, I needed a simple combo box widget. I quickly realized that Gtk::ComboBoxText was the most appropriate one for my need. So I created a class derived from Gtk::ComboBoxText and gave it the special-form constructor in order to be able to use libglademm's get_widget_derived(). The widget is actually found and retrieved; however, the items entered on the Glade interface do not show up. It seems like the combo box's popup menu is empty. Steps to reproduce: 1. In Glade, add a combo box to a window and enter some items for it. 2. Derive a class from Gtk::ComboBoxText. 3. Use get_widget_derived() to load the widget into a pointer variable of the above defined class. Actual results: The items defined in Glade do not show up; i.e,, when the combo box is activated, an empty popup is shown. Expected results: The popup shown when the combo box is activated should contain the items defined in Glade. Does this happen every time? Yes. Other information: Entering the items in code, via Gtk::ComboBoxText::append_text() does make them show up. However, for some reason, they come off doubled, i.e. the same item appears twice on each row. I will file another bug report on that.
The problem here is that GtkComboBox::Text has a model but Glade is adding another model. I have added this text to the Gtk::ComboBoxText documentation: * Note that you can not use this class with Gnome::Glade::Xml::get_widget_derived() to wrap a GtkComboBox added * in the Glade user interface designer, because Glade adds its own TreeModel instead of using the TreeModel from * this class. You could use a normal Gtk::ComboBox instead, though you can not use Glade to add rows to a TreeModel that is defined in your C++ code. > Gtk::ComboBoxText::append_text() does make them show up. I am surprised, and I think that valgrind would report some strange uses of memory.