diff options
author | Matthias Clasen <mclasen@redhat.com> | 2010-10-15 16:16:45 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2010-10-15 16:58:26 -0400 |
commit | 99cfbecf466193f2a132e4476f92723b8c51e4a5 (patch) | |
tree | 476bfa89e5da2dac32aff3c9f3799bc312ae716a /gtk/gtkcomboboxtext.c | |
parent | 8353754c17d33b8e26332c666dc3941c36619c51 (diff) | |
download | gtk+-99cfbecf466193f2a132e4476f92723b8c51e4a5.tar.gz |
Add gtk_combo_box_text_new_with_entry
Also, make use of the configured entry_text_column.
Diffstat (limited to 'gtk/gtkcomboboxtext.c')
-rw-r--r-- | gtk/gtkcomboboxtext.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/gtk/gtkcomboboxtext.c b/gtk/gtkcomboboxtext.c index f1ecb8adb7..d997723a89 100644 --- a/gtk/gtkcomboboxtext.c +++ b/gtk/gtkcomboboxtext.c @@ -63,6 +63,26 @@ gtk_combo_box_text_new (void) return g_object_new (GTK_TYPE_COMBO_BOX_TEXT, NULL); } + +/** + * gtk_combo_box_text_new_with_entry: + * + * Creates a new #GtkComboBoxText, which is a #GtkComboBox just displaying + * strings. The combo box created by this function has an entry. + * + * Return value: a new #GtkComboBoxText + * + * Since: 2.24 + */ +GtkWidget * +gtk_combo_box_text_new_with_entry (void) +{ + return g_object_new (GTK_TYPE_COMBO_BOX_TEXT, + "has-entry", TRUE, + "entry-text-column", 0, + NULL); +} + /** * gtk_combo_box_text_append_text: * @combo_box: A #GtkComboBoxText @@ -120,7 +140,7 @@ gtk_combo_box_text_insert_text (GtkComboBoxText *combo_box, store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box))); g_return_if_fail (GTK_IS_LIST_STORE (store)); - text_column = gtk_combo_box_get_entry_text_column (GTK_COMBO_BOX (combo_box)); + text_column = gtk_combo_box_get_entry_text_column (GTK_COMBO_BOX (combo_box)); column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), text_column); g_return_if_fail (column_type == G_TYPE_STRING); @@ -151,7 +171,7 @@ gtk_combo_box_text_prepend_text (GtkComboBoxText *combo_box, store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box))); g_return_if_fail (GTK_IS_LIST_STORE (store)); - text_column = gtk_combo_box_get_entry_text_column (GTK_COMBO_BOX (combo_box)); + text_column = gtk_combo_box_get_entry_text_column (GTK_COMBO_BOX (combo_box)); column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), text_column); g_return_if_fail (column_type == G_TYPE_STRING); @@ -175,8 +195,6 @@ gtk_combo_box_text_remove (GtkComboBoxText *combo_box, GtkTreeModel *model; GtkListStore *store; GtkTreeIter iter; - gint text_column; - gint column_type; g_return_if_fail (GTK_IS_COMBO_BOX_TEXT (combo_box)); g_return_if_fail (position >= 0); @@ -184,9 +202,6 @@ gtk_combo_box_text_remove (GtkComboBoxText *combo_box, model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box)); store = GTK_LIST_STORE (model); g_return_if_fail (GTK_IS_LIST_STORE (store)); - text_column = gtk_combo_box_get_entry_text_column (GTK_COMBO_BOX (combo_box)); - column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), text_column); - g_return_if_fail (column_type == G_TYPE_STRING); if (gtk_tree_model_iter_nth_child (model, &iter, NULL, position)) gtk_list_store_remove (store, &iter); |