Custom renderer for GtkCombo



I have a combo box which displays a list of device names. When the user
has selected a device, I want to know the "real" device name rather than
the human readable form. For example, my combo may show the following
strings:

  Soundcard UART
  Built-in Speaker
  USB MIDI device

These correspond to the following device files:

  /dev/music
  /dev/pcppi0
  /dev/rmidi0

In Java, I would create a utility class that had both the human readable
name and device name as data members. This class would include a
toString() method which returns the human readable form. Then I would
populate a combo with a list of objects that implement this class. The
combo calls toString() on each object to determine its display string.
Later, I can retrieve the selected item, cast it to my utility class
and get the "real" device name. I assume this is part of the MVC
concept.

In GTK+, I cannot determine how to do something similar. GtkCombo uses
the deprecated GtkList (according to the 2.2.1 API reference), and that
the GtkCombo reference mentions a gtk_list_set_item_string() function
that appears undocumented, but sounds like what I need. Will GtkCombo
eventually use the list store? Can I (or should I) be able to do
something similar to my Java technique?

Any advice would be greatly appreciatted!

Chris
--
chris wareham iosystems co uk (work)
chris wareham btopenworld com (home)




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