|
void | gnc_cbwe_set_by_string (GtkComboBox *cbwe, const gchar *text) |
|
void | gnc_cbwe_add_completion (GtkComboBox *cbwe) |
|
void | gnc_cbwe_require_list_item (GtkComboBox *cbwe) |
|
The API in this file is designed to provide support functions that wrap the base gtk functions and make them easier to use.
void gnc_cbwe_set_by_string |
( |
GtkComboBox * |
cbwe, |
|
|
const gchar * |
text |
|
) |
| |
Find an entry in the GtkComboBox by its text value, and set the widget to that value. This function also records the index of that text value for use when the user leaves the widget.
- Parameters
-
cbwe | A pointer to a GtkComboBox with entry widget. |
text | The entry text to find in the model of the combo box entry. |
Definition at line 41 of file gnc-gtk-utils.c.
47 gint column, index, id;
50 model = gtk_combo_box_get_model(GTK_COMBO_BOX(cbwe));
51 if (!gtk_tree_model_get_iter_first(model, &iter))
54 gtk_combo_box_set_active(GTK_COMBO_BOX(cbwe), -1);
58 column = gtk_combo_box_get_entry_text_column(cbwe);
61 gtk_tree_model_get(model, &iter, column, &tree_string, -1);
62 match = g_utf8_collate(text, tree_string) == 0;
68 id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cbwe), CHANGED_ID));
69 g_signal_handler_block(cbwe,
id);
70 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(cbwe), &iter);
71 g_signal_handler_unblock(cbwe,
id);
73 index = gtk_combo_box_get_active(GTK_COMBO_BOX(cbwe));
74 g_object_set_data(G_OBJECT(cbwe), LAST_INDEX, GINT_TO_POINTER(index));
77 while (gtk_tree_model_iter_next(model, &iter));