diff options
author | Matthias Clasen <maclas@gmx.de> | 2004-07-30 04:58:52 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2004-07-30 04:58:52 +0000 |
commit | 32d874f83ace8644b489a1dbe517e535f07e95fb (patch) | |
tree | 384c2706cc07d665952a7e4b77dcf0d1fce61eb6 /gtk/gtkcomboboxentry.c | |
parent | 15f23d383c347445272e3ae0f91544e0ad9b508f (diff) | |
download | gtk+-32d874f83ace8644b489a1dbe517e535f07e95fb.tar.gz |
Implement this in terms of gtk_combo_box_get_active_iter(), instead of
Fri Jul 30 00:56:31 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_active_changed):
Implement this in terms of gtk_combo_box_get_active_iter(),
instead of gtk_combo_box_get_active().
Diffstat (limited to 'gtk/gtkcomboboxentry.c')
-rw-r--r-- | gtk/gtkcomboboxentry.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/gtk/gtkcomboboxentry.c b/gtk/gtkcomboboxentry.c index 7da2bd9a99..de49626677 100644 --- a/gtk/gtkcomboboxentry.c +++ b/gtk/gtkcomboboxentry.c @@ -193,36 +193,29 @@ static void gtk_combo_box_entry_active_changed (GtkComboBox *combo_box, gpointer user_data) { - gint index; GtkComboBoxEntry *entry_box = GTK_COMBO_BOX_ENTRY (combo_box); + GtkTreeModel *model; + GtkTreeIter iter; + gchar *str = NULL; - index = gtk_combo_box_get_active (combo_box); - - g_signal_handlers_block_by_func (entry_box->priv->entry, - gtk_combo_box_entry_contents_changed, - combo_box); - - if (index >= 0) + if (gtk_combo_box_get_active_iter (combo_box, &iter)) { - gchar *str = NULL; - GtkTreeIter iter; - GtkTreeModel *model; + g_signal_handlers_block_by_func (entry_box->priv->entry, + gtk_combo_box_entry_contents_changed, + combo_box); model = gtk_combo_box_get_model (combo_box); - gtk_tree_model_iter_nth_child (model, &iter, NULL, index); - gtk_tree_model_get (model, &iter, - entry_box->priv->text_column, &str, - -1); - + gtk_tree_model_get (model, &iter, + entry_box->priv->text_column, &str, + -1); gtk_entry_set_text (GTK_ENTRY (entry_box->priv->entry), str); - g_free (str); - } - g_signal_handlers_unblock_by_func (entry_box->priv->entry, - gtk_combo_box_entry_contents_changed, - combo_box); + g_signal_handlers_unblock_by_func (entry_box->priv->entry, + gtk_combo_box_entry_contents_changed, + combo_box); + } } static void |