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 604868 - Having toplevel items duplicated as leaves in GtkComboBox should be configurable
Having toplevel items duplicated as leaves in GtkComboBox should be configurable
Status: RESOLVED NOTABUG
Product: gtk+
Classification: Platform
Component: Widget: GtkComboBox
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2009-12-17 23:46 UTC by Tadej Borovšak
Modified: 2009-12-19 10:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch that adds "duplicate-toplevels" property (6.10 KB, text/plain)
2009-12-17 23:46 UTC, Tadej Borovšak
Details

Description Tadej Borovšak 2009-12-17 23:46:07 UTC
Created attachment 149948 [details]
Patch that adds "duplicate-toplevels" property

When GtkTreeView serves as a model for combo box, toplevel items are always duplicated as leaves in order to make them selectable. This behavior should probably be made optional, since in many situations selecting toplevel item is not desirable.

For example, I help maintaining slideshow application that uses combo box to list available transitions. Similar transitions are grouped into families and in combo box, family name is toplevel item with real transitions listed as subitems. Having family name selectable in this case makes no sense and in code we actually monitor if user selected family name and automatically change active selection from family name to first transition in this family.

I would propose addition of new property that would enable developers to control when toplevel items are also displayed in submenu. Adding this property would not affect existing applications that depend on this behavior, since removal of duplicate toplevel item would require developer's intervention.

I attached a patch against latest git master that adds this simple property (I named it "duplicate-toplevels" for the time being).

Tadej
Comment 1 Matthias Clasen 2009-12-19 02:39:39 UTC
Look at the combobox example in gtk-demo for an example of how to do this.
Comment 2 Tadej Borovšak 2009-12-19 10:29:44 UTC
Hello all.

Sorry for not doing my homework before reporting bug.

Tadej