[gtk/matthiasc/for-master: 6/8] gtk-demo: Improve the entry completion demo
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master: 6/8] gtk-demo: Improve the entry completion demo
- Date: Wed, 24 Jun 2020 04:29:42 +0000 (UTC)
commit 2a6a0d74a38936aac4e9e97211144dbaeb4fdc02
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jun 23 22:39:16 2020 -0400
gtk-demo: Improve the entry completion demo
Add more strings.
demos/gtk-demo/entry_completion.c | 48 ++++++++++++++++++++++++++++++---------
1 file changed, 37 insertions(+), 11 deletions(-)
---
diff --git a/demos/gtk-demo/entry_completion.c b/demos/gtk-demo/entry_completion.c
index 11ff063a42..a9949c2fc8 100644
--- a/demos/gtk-demo/entry_completion.c
+++ b/demos/gtk-demo/entry_completion.c
@@ -12,22 +12,48 @@
static GtkTreeModel *
create_completion_model (void)
{
+ const char *strings[] = {
+ "GNOME",
+ "gnominious",
+ "Gnomonic projection",
+ "Gnosophy",
+ "total",
+ "totally",
+ "toto",
+ "tottery",
+ "totterer",
+ "Totten trust",
+ "Tottenham hotspurs",
+ "totipotent",
+ "totipotency",
+ "totemism",
+ "totem pole",
+ "Totara",
+ "totalizer",
+ "totalizator",
+ "totalitarianism",
+ "total parenteral nutrition",
+ "total eclipse",
+ "Totipresence",
+ "Totipalmi",
+ "zombie",
+ "aæx",
+ "aæy",
+ "aæz",
+ NULL
+ };
+ int i;
GtkListStore *store;
GtkTreeIter iter;
store = gtk_list_store_new (1, G_TYPE_STRING);
- /* Append one word */
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, "GNOME", -1);
-
- /* Append another word */
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, "total", -1);
-
- /* And another word */
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, "totally", -1);
+ for (i = 0; strings[i]; i++)
+ {
+ /* Append one word */
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter, 0, strings[i], -1);
+ }
return GTK_TREE_MODEL (store);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]