In Gtk 4.16.5 cannot prevent DropDown from preselecting the first item
Steps to reproduce
- Ensure you are using GTK 4.16.5
- Run the attached sample code (Python, sorry. I don't develop for Gtk in C and don't have the development environment set up.)
Current behavior
The first item in a DropDown list is always pre-selected, even if INVALID_LIST_ITEM is selected before showing the DropDown. Please see the discussion in Discourse 25146. This post has sample C code equivalent to the attached Python code but I don't know if that's a complete app. I didn't write it.
Expected outcome
If INVALID_LIST_ITEM is selected, the DropDown label should show '(None)' and there should be no items selected.
Version information
- GTK version: 4.16.5
- Manjaro Linux 6.11
- X11
- Window manager XFCE
- GTK supplied by the distribution (test branch)
Additional information
Post 11 in the Discourse thread indicates that the issue was introduced by the following commits:
which were introduced in GTK 4.16.0. (Thanks to GTK Discourse user Sid for finding these.)
Screenshot of desired behavior (GTK 4.14.5 in Workbench):
Screenshot of current behavior (GTK 4.16.5):
Sample code - Python but self-contained and short: