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 135875 - combobox doesn't support insensitive items
combobox doesn't support insensitive items
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkComboBox
2.3.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
: 137894 138288 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-03-01 20:56 UTC by Matthias Clasen
Modified: 2011-02-04 16:17 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
patch adding selection_func support (5.28 KB, patch)
2004-03-14 00:04 UTC, Matthias Clasen
none Details | Review
patch making some items in testcombo.c insensitive (2.70 KB, patch)
2004-03-14 00:05 UTC, Matthias Clasen
none Details | Review
new patch which also supports menu mode (6.66 KB, patch)
2004-03-14 00:30 UTC, Matthias Clasen
none Details | Review

Description Matthias Clasen 2004-03-01 20:56:12 UTC
another regression against GtkOptionMenu; I don't think GtkCombo supports
this...

gtk_tree_selection_set_select_function() may be relevant here
Comment 1 Matthias Clasen 2004-03-02 09:58:54 UTC
Hmm, the fact that the treeview is private (and the fact that we want 
to handle menu mode transparently) makes this an api bug. I think we 
need something like:




gboolean (*GtkComboBoxSelectionFunc)(GtkTreeModel *model,


                                     GtkTreePath *path,


                                     gboolean currently_selected,


                                     gpointer data);




void gtk_combo_box_set_select_function (GtkComboBoxSelectionFunc func,


                                        gpointer data,


                                        GtkDestroyNotify destroy);




We have to omit the GtkTreeSelection argument from the corresponding


GtkTreeSelection functionality, since we don't have a tree selection 
object in menu mode.
Comment 2 Matthias Clasen 2004-03-14 00:04:47 UTC
Created attachment 25614 [details] [review]
patch adding selection_func support
Comment 3 Matthias Clasen 2004-03-14 00:05:48 UTC
Created attachment 25615 [details] [review]
patch making some items in testcombo.c insensitive
Comment 4 Matthias Clasen 2004-03-14 00:13:39 UTC
The attached combobox patch adds the outlined support for a
tree_view_selection-like selection function. It is not perfect: when
moving the selection with up/down in the tree view, one still has to
step over insensitive items.
The patch to testcombo.c shows that this is not really a useable API
yet; you basically have to code the "graying out" yourself. We should
probably have a convenience api like 
gtk_combo_box_set_sensitive_column() which would take the index of a
boolean column and set up selection function and cell data function
for the text column automatically.
What the patch currently doesn't cover is setting up the sensitivity
of menuitems in menu mode. That should be a simple loop over all items
before popping up the menu.
Comment 5 Matthias Clasen 2004-03-14 00:30:32 UTC
Created attachment 25617 [details] [review]
new patch which also supports menu mode
Comment 6 Matthias Clasen 2004-04-13 18:10:41 UTC
*** Bug 138288 has been marked as a duplicate of this bug. ***
Comment 7 Sven Neumann 2004-04-18 21:51:15 UTC
I just run into this problem while migrating GIMP to GtkComboBox. Would be nice
to get it fixed as soon as possible (which means 2.6 probably).
Comment 8 Matthias Clasen 2004-04-21 22:41:54 UTC
*** Bug 137894 has been marked as a duplicate of this bug. ***
Comment 9 Matthias Clasen 2004-05-27 03:39:04 UTC
insensitive items are supported now, see testcombo.c for how.
Comment 10 Sven Neumann 2005-02-27 23:04:13 UTC
That's a pretty evil hack, btw. If I call gtk_cell_layout_set_cell_data_func()
on a combo-box, the GtkCellLayout which gets passed to the callback function is
_not_  the combo-box but one the internal widgets which are supposed to be
hidden in the combo :(
Comment 11 Matthias Clasen 2005-02-28 04:02:40 UTC
true, but it would be hard to avoid that. And we don't pass the internal
widgets, just the cell layouts, if that makes any difference...