summaryrefslogtreecommitdiff
path: root/gtk/gtkcomboboxentry.c
diff options
context:
space:
mode:
authorMatthias Clasen <maclas@gmx.de>2004-02-26 21:40:09 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-02-26 21:40:09 +0000
commit1637a9c55b9f4eb3c3e842b8baeb1de4dbf6d62a (patch)
treeffd7df0b5cfa8b6b3ac1b67ce8e57370f35ac146 /gtk/gtkcomboboxentry.c
parent0459484caa2efbabd2fc3fd539c80e3aa42c6b60 (diff)
downloadgdk-pixbuf-1637a9c55b9f4eb3c3e842b8baeb1de4dbf6d62a.tar.gz
New convenience API to construct simple text combos, implemented by Damon
Thu Feb 26 22:20:44 2004 Matthias Clasen <maclas@gmx.de> * gtk/gtkcomboboxentry.h: * gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new_text): New convenience API to construct simple text combos, implemented by Damon Chaplin. * tests/testcombo.c: Use gtk_combo_box_entry_new_text.
Diffstat (limited to 'gtk/gtkcomboboxentry.c')
-rw-r--r--gtk/gtkcomboboxentry.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gtk/gtkcomboboxentry.c b/gtk/gtkcomboboxentry.c
index a21e73f82..25625f512 100644
--- a/gtk/gtkcomboboxentry.c
+++ b/gtk/gtkcomboboxentry.c
@@ -337,3 +337,33 @@ gtk_combo_box_entry_mnemonic_activate (GtkWidget *widget,
return TRUE;
}
+
+
+/* convenience API for simple text combos */
+
+/**
+ * gtk_combo_box_entry_new_text:
+ *
+ * Convenience function which constructs a new editable text combo box, which
+ * is a #GtkComboBoxEntry just displaying strings. If you use this function to
+ * create a text combo box, you should only manipulate its data source with
+ * the following convenience functions: gtk_combo_box_append_text(),
+ * gtk_combo_box_insert_text(), gtk_combo_box_prepend_text() and
+ * gtk_combo_box_remove_text().
+ *
+ * Return value: A new text #GtkComboBoxEntry.
+ *
+ * Since: 2.4
+ */
+GtkWidget *
+gtk_combo_box_entry_new_text (void)
+{
+ GtkWidget *entry_box;
+ GtkListStore *store;
+
+ store = gtk_list_store_new (1, G_TYPE_STRING);
+
+ entry_box = gtk_combo_box_entry_new_with_model (GTK_TREE_MODEL (store), 0);
+
+ return entry_box;
+}