GNOME Bugzilla – Bug 90474
Combo API is incomplete
Last modified: 2004-12-22 21:47:04 UTC
A brief thread on the ml startet by ERDI Gergo about the Combo API which currently lacks functionality to manipulate the pull-down list ended in Murray's comment: "You could add methods that use GList* internally. I'd accept that API change. But you would need to turn off the DEPRECATED #defines (maybe just an #undef) so that it builds, and I'd prefer it if you did that for just one .cc file rather than the whole library." Well, I think the easiest thing to do is to add thin wrappers around GtkListItem and GtkList and before fussing around a lot I had a go at it. The patch will follow immediately. ChangeLog entry: * tools/m4/list.m4: Fix a bug in macro GP_LIST_FIND(). * gtk/src/combo.{ccg,hg}: Complete the API: Generate thin wrappers around GtkListItem and GtkList (named ComboDropDownItem and ComboDropDown) that contain the functionality necessary to manipulate the pull-down list of a Gtk::Combo. Insertion and removal to/from the list is provided by an STL-style wrapper (named Gtk::ComboDropDown_Helpers::ComboDropDownList). * tools/m4/convert_gtk.m4: Add conversions from (const) GtkWidget* to (const) Gtk::ComboDropDown*.
Created attachment 10414 [details] [review] Promised patch...
Martin, do you have cvs write access? If not, do you want it?
I don't have cvs write access. I guess it might speed up things in future if you gave it to me, e.g. when it comes to improving the documentation etc. ... For bigger changes like the one in this bug report I would continue to ask for approval because my work for gtkmm is quite irregular and I'm afraid it will stay like this in the forseen future :)
I think this a good solution, and well implemented. Yes, even Daniel and I post patches for review. However: I would like more ChangeLog information about the list.m4 fix, and whether it fixes any other problems. I would like you to add something to the examples/book/combo example to test this new API.
Yes, the example proves absolutely necessary. There is a problem: I don't have clue why class ComboDropDownItem : public Gtk::Item { _CLASS_GTKOBJECT(ComboDropDownItem,GtkListItem,GTK_LIST,Gtk::Item,GtkItem) ... }; should lead to code generated in gtkmm/combo.cc like this: const Glib::Class& ComboDropDownItem_Class::init() { if(!gtype_) // create the GType if necessary { ... // Create the wrapper type, with the same class/instance size as the base type. register_derived_type(gtk_list_get_type()); ... } return *this; } and: GType ComboDropDownItem::get_base_type() { return gtk_list_get_type(); } when it must obviously be gtk_list_item_get_type() in both functions. ~~~~~ Hopefully this is related to the following segfault so that both errors can be cleared at the same time: Even if I edit combo.cc by hand to correct the above errors the code: ComboDropDown* Combo::get_list() { return Glib::wrap((GtkList*)(gobj()->list)); } always returns 0.
Maybe this _CLASS_GTKOBJECT(ComboDropDownItem,GtkListItem,GTK_LIST,Gtk::Item,GtkItem) should be this _CLASS_GTKOBJECT(ComboDropDownItem,GtkListItem,GTK_LIST_ITEM,Gtk::Item,GtkItem)
Created attachment 10466 [details] [review] Now correct usage of _CLASS_GTKOBJECT in wrapper ComboDropDownItem and extended combo example working. Shall I try to commit?
That's great. But your cvs write access does not seem to have happened yet, so I have committed it.