summaryrefslogtreecommitdiff
path: root/gtk
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
parent0459484caa2efbabd2fc3fd539c80e3aa42c6b60 (diff)
downloadgtk+-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')
-rw-r--r--gtk/gtkcombobox.c5
-rw-r--r--gtk/gtkcomboboxentry.c30
-rw-r--r--gtk/gtkcomboboxentry.h3
3 files changed, 36 insertions, 2 deletions
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 1ae57c59b7..f02031ad81 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -2842,9 +2842,10 @@ gtk_combo_box_get_model (GtkComboBox *combo_box)
*
* Convenience function which constructs a new text combo box, which is a
* #GtkComboBox just displaying strings. If you use this function to create
- * a text combo box, you only want to manipulate it's data source with the
+ * 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() and gtk_combo_box_prepend_text().
+ * gtk_combo_box_insert_text(), gtk_combo_box_prepend_text() and
+ * gtk_combo_box_remove_text().
*
* Return value: A new text combo box.
*
diff --git a/gtk/gtkcomboboxentry.c b/gtk/gtkcomboboxentry.c
index a21e73f823..25625f5125 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;
+}
diff --git a/gtk/gtkcomboboxentry.h b/gtk/gtkcomboboxentry.h
index 9b120427a2..8955426b9e 100644
--- a/gtk/gtkcomboboxentry.h
+++ b/gtk/gtkcomboboxentry.h
@@ -65,6 +65,9 @@ void gtk_combo_box_entry_set_text_column (GtkComboBoxEntry *entry_box,
gint text_column);
gint gtk_combo_box_entry_get_text_column (GtkComboBoxEntry *entry_box);
+/* convenience -- text */
+GtkWidget *gtk_combo_box_entry_new_text (void);
+
G_END_DECLS