After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 90474 - Combo API is incomplete
Combo API is incomplete
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: general
2.0
Other other
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2002-08-11 15:13 UTC by Martin Schulze
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Promised patch... (9.75 KB, patch)
2002-08-11 15:14 UTC, Martin Schulze
none Details | Review
Now correct usage of _CLASS_GTKOBJECT in wrapper ComboDropDownItem and extended combo example working. Shall I try to commit? (12.56 KB, patch)
2002-08-13 20:22 UTC, Martin Schulze
none Details | Review

Description Martin Schulze 2002-08-11 15:13:46 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*.
Comment 1 Martin Schulze 2002-08-11 15:14:21 UTC
Created attachment 10414 [details] [review]
Promised patch...
Comment 2 Murray Cumming 2002-08-11 18:57:34 UTC
Martin, do you have cvs write access? If not, do you want it?
Comment 3 Martin Schulze 2002-08-11 20:10:11 UTC
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 :)
Comment 4 Murray Cumming 2002-08-12 08:05:45 UTC
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.
Comment 5 Martin Schulze 2002-08-12 20:42:54 UTC
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.
Comment 6 Murray Cumming 2002-08-13 09:08:09 UTC
Maybe this
_CLASS_GTKOBJECT(ComboDropDownItem,GtkListItem,GTK_LIST,Gtk::Item,GtkItem)
should be this
_CLASS_GTKOBJECT(ComboDropDownItem,GtkListItem,GTK_LIST_ITEM,Gtk::Item,GtkItem)
Comment 7 Martin Schulze 2002-08-13 20:22:34 UTC
Created attachment 10466 [details] [review]
Now correct usage of _CLASS_GTKOBJECT in wrapper ComboDropDownItem and extended combo example working. Shall I try to commit?
Comment 8 Murray Cumming 2002-08-14 08:15:08 UTC
That's great. But your cvs write access does not seem to have happened
yet, so I have committed it.