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 536699 - Add gtk_combo_box_find_text()
Add gtk_combo_box_find_text()
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkComboBox
2.13.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-06-04 22:21 UTC by Claudio Saavedra
Modified: 2018-05-02 14:32 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Claudio Saavedra 2008-06-04 22:21:13 UTC
Given that we have gtk_combo_box_new_text() and friends, that provide with a handy way to create simple combobox, it could be helpful to count with a gtk_combo_box_text_find() function that returns the index of the first occurrence of a text in a combobox create with gtk_combo_box_new_text() or gtk_combo_box_entry_new_text().

It must be noticed that an application developer can't implement this without assuming that the text is stored in the first column of the model. That shouldn't be necessary.

The proposed function is something like:

/**
 * gtk_combo_box_find_text:
 * @combobox: A #GtkComboBox created with gtk_combo_box_new_text()
 * or gtk_combo_box_entry_new_text().
 * @text: A string.
 *
 * Finds the first occurrence of @text in @combo. If @text is not in combo, 
 * it returns -1.
 *
 * Returns: The index for the first occurrence of @text in @combo, or -1.
 **/
gint
gtk_combo_box_find_text (GtkComboBox *combobox, const gchar *text);

If you think this is worth adding I can prepare a patch. I already have an application side implementation.
Comment 1 GNOME Infrastructure Team 2018-05-02 14:32:55 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/294.