[gtk+] Use new GtkComboBoxEntry in all tests
- From: Christian Dywan <cdywan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Use new GtkComboBoxEntry in all tests
- Date: Mon, 18 Oct 2010 07:17:01 +0000 (UTC)
commit 6db62c66179fbe0f127b37f5c1dac41a22f304cf
Author: Christian Dywan <christian twotoasts de>
Date: Mon Oct 18 09:10:27 2010 +0200
Use new GtkComboBoxEntry in all tests
demos/gtk-demo/combobox.c | 19 ++++---------
tests/testcombo.c | 64 +++++++++++++++++++-------------------------
tests/testgtk.c | 39 +++++++++++----------------
tests/testsocket_common.c | 35 ++++++++++--------------
4 files changed, 64 insertions(+), 93 deletions(-)
---
diff --git a/demos/gtk-demo/combobox.c b/demos/gtk-demo/combobox.c
index ff2111b..79fa323 100644
--- a/demos/gtk-demo/combobox.c
+++ b/demos/gtk-demo/combobox.c
@@ -238,12 +238,12 @@ is_capital_sensitive (GtkCellLayout *cell_layout,
}
static void
-fill_combo_entry (GtkWidget *entry)
+fill_combo_entry (GtkWidget *combo)
{
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry), "One");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry), "Two");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry), "2\302\275");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry), "Three");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "One");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Two");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "2\302\275");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Three");
}
@@ -428,14 +428,7 @@ do_combobox (GtkWidget *do_widget)
gtk_container_set_border_width (GTK_CONTAINER (box), 5);
gtk_container_add (GTK_CONTAINER (frame), box);
- model = (GtkTreeModel *)gtk_list_store_new (1, G_TYPE_STRING);
- combo = g_object_new (GTK_TYPE_COMBO_BOX,
- "has-entry", TRUE,
- "model", model,
- "entry-text-column", 0,
- NULL);
- g_object_unref (model);
-
+ combo = gtk_combo_box_text_new_with_entry ();
fill_combo_entry (combo);
gtk_container_add (GTK_CONTAINER (box), combo);
diff --git a/tests/testcombo.c b/tests/testcombo.c
index 65e5b5e..5afe202 100644
--- a/tests/testcombo.c
+++ b/tests/testcombo.c
@@ -940,57 +940,57 @@ capital_animation (gpointer data)
}
static void
-setup_combo_entry (GtkWidget *entry_box)
+setup_combo_entry (GtkComboBoxText *combo)
{
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"dum de dum");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"la la la");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"la la la dum de dum la la la la la la boom de da la la");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"bloop");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"bleep");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaas");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaas0");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaas1");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaas2");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaas3");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaas4");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaas5");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaas6");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaas7");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaas8");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaas9");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaasa");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaasb");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaasc");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaasd");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaase");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaasf");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaas10");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaas11");
- gtk_combo_box_append_text (GTK_COMBO_BOX (entry_box),
+ gtk_combo_box_text_append_text (combo,
"klaas12");
}
@@ -1054,7 +1054,6 @@ main (int argc, char **argv)
GtkTreePath *path;
GtkTreeIter iter;
GdkColor color;
- GtkListStore *store;
gtk_init (&argc, &argv);
@@ -1306,15 +1305,8 @@ main (int argc, char **argv)
gtk_container_set_border_width (GTK_CONTAINER (boom), 5);
gtk_container_add (GTK_CONTAINER (tmp), boom);
- store = gtk_list_store_new (1, G_TYPE_STRING);
- comboboxtext = g_object_new (GTK_TYPE_COMBO_BOX,
- "has-entry", TRUE,
- "model", store,
- "entry-text-column", 0,
- NULL);
- g_object_unref (store);
-
- setup_combo_entry (comboboxtext);
+ comboboxtext = gtk_combo_box_text_new_with_entry ();
+ setup_combo_entry (GTK_COMBO_BOX_TEXT (comboboxtext));
gtk_container_add (GTK_CONTAINER (boom), comboboxtext);
diff --git a/tests/testgtk.c b/tests/testgtk.c
index c77f6df..49a227e 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -3951,11 +3951,10 @@ create_entry (GtkWidget *widget)
GtkWidget *sensitive_check;
GtkWidget *progress_check;
GtkWidget *entry;
- GtkComboBox *cb;
+ GtkComboBoxText *cb;
GtkWidget *cb_entry;
GtkWidget *button;
GtkWidget *separator;
- GtkListStore *store;
if (!window)
{
@@ -3993,25 +3992,19 @@ create_entry (GtkWidget *widget)
G_CALLBACK (props_clicked),
entry);
- store = gtk_list_store_new (1, G_TYPE_STRING);
- cb = g_object_new (GTK_TYPE_COMBO_BOX,
- "has-entry", TRUE,
- "model", store,
- "entry-text-column", 0,
- NULL);
- g_object_unref (store);
-
- gtk_combo_box_append_text (cb, "item0");
- gtk_combo_box_append_text (cb, "item0");
- gtk_combo_box_append_text (cb, "item1 item1");
- gtk_combo_box_append_text (cb, "item2 item2 item2");
- gtk_combo_box_append_text (cb, "item3 item3 item3 item3");
- gtk_combo_box_append_text (cb, "item4 item4 item4 item4 item4");
- gtk_combo_box_append_text (cb, "item5 item5 item5 item5 item5 item5");
- gtk_combo_box_append_text (cb, "item6 item6 item6 item6 item6");
- gtk_combo_box_append_text (cb, "item7 item7 item7 item7");
- gtk_combo_box_append_text (cb, "item8 item8 item8");
- gtk_combo_box_append_text (cb, "item9 item9");
+ cb = GTK_COMBO_BOX_TEXT (gtk_combo_box_text_new_with_entry ());
+
+ gtk_combo_box_text_append_text (cb, "item0");
+ gtk_combo_box_text_append_text (cb, "item0");
+ gtk_combo_box_text_append_text (cb, "item1 item1");
+ gtk_combo_box_text_append_text (cb, "item2 item2 item2");
+ gtk_combo_box_text_append_text (cb, "item3 item3 item3 item3");
+ gtk_combo_box_text_append_text (cb, "item4 item4 item4 item4 item4");
+ gtk_combo_box_text_append_text (cb, "item5 item5 item5 item5 item5 item5");
+ gtk_combo_box_text_append_text (cb, "item6 item6 item6 item6 item6");
+ gtk_combo_box_text_append_text (cb, "item7 item7 item7 item7");
+ gtk_combo_box_text_append_text (cb, "item8 item8 item8");
+ gtk_combo_box_text_append_text (cb, "item9 item9");
cb_entry = gtk_bin_get_child (GTK_BIN (cb));
gtk_entry_set_text (GTK_ENTRY (cb_entry), "hello world \n\n\n foo");
@@ -5576,7 +5569,7 @@ screen_display_check (GtkWidget *widget, ScreenDisplaySelection *data)
break;
}
if (!found)
- gtk_combo_box_append_text (GTK_COMBO_BOX (data->combo), display_name);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (data->combo), display_name);
new_screen = gdk_display_get_default_screen (display);
}
}
@@ -5646,7 +5639,7 @@ create_display_screen (GtkWidget *widget)
"only one screen on the current display");
gtk_widget_set_sensitive (radio_scr, FALSE);
}
- combo_dpy = gtk_combo_box_text_new ();
+ combo_dpy = gtk_combo_box_text_new_with_entry ();
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_dpy), "diabolo:0.0");
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo_dpy))),
"<hostname>:<X Server Num>.<Screen Num>");
diff --git a/tests/testsocket_common.c b/tests/testsocket_common.c
index ababbf2..0023909 100644
--- a/tests/testsocket_common.c
+++ b/tests/testsocket_common.c
@@ -132,28 +132,21 @@ add_buttons (GtkWidget *widget, GtkWidget *box)
static GtkWidget *
create_combo (void)
{
- GtkComboBox *combo;
+ GtkComboBoxText *combo;
GtkWidget *entry;
- GtkListStore *store;
-
- store = gtk_list_store_new (1, G_TYPE_STRING);
- combo = g_object_new (GTK_TYPE_COMBO_BOX,
- "has-entry", TRUE,
- "model", store,
- "entry-text-column", 0,
- NULL);
- g_object_unref (store);
-
- gtk_combo_box_append_text (combo, "item0");
- gtk_combo_box_append_text (combo, "item1 item1");
- gtk_combo_box_append_text (combo, "item2 item2 item2");
- gtk_combo_box_append_text (combo, "item3 item3 item3 item3");
- gtk_combo_box_append_text (combo, "item4 item4 item4 item4 item4");
- gtk_combo_box_append_text (combo, "item5 item5 item5 item5 item5 item5");
- gtk_combo_box_append_text (combo, "item6 item6 item6 item6 item6");
- gtk_combo_box_append_text (combo, "item7 item7 item7 item7");
- gtk_combo_box_append_text (combo, "item8 item8 item8");
- gtk_combo_box_append_text (combo, "item9 item9");
+
+ combo = GTK_COMBO_BOX_TEXT (gtk_combo_box_text_new_with_entry ());
+
+ gtk_combo_box_text_append_text (combo, "item0");
+ gtk_combo_box_text_append_text (combo, "item1 item1");
+ gtk_combo_box_text_append_text (combo, "item2 item2 item2");
+ gtk_combo_box_text_append_text (combo, "item3 item3 item3 item3");
+ gtk_combo_box_text_append_text (combo, "item4 item4 item4 item4 item4");
+ gtk_combo_box_text_append_text (combo, "item5 item5 item5 item5 item5 item5");
+ gtk_combo_box_text_append_text (combo, "item6 item6 item6 item6 item6");
+ gtk_combo_box_text_append_text (combo, "item7 item7 item7 item7");
+ gtk_combo_box_text_append_text (combo, "item8 item8 item8");
+ gtk_combo_box_text_append_text (combo, "item9 item9");
entry = gtk_bin_get_child (GTK_BIN (combo));
gtk_entry_set_text (GTK_ENTRY (entry), "hello world");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]