Use new GtkComboBoxEntry in all tests

(cherry picked from commit 6db62c6617)
This commit is contained in:
Matthias Clasen 2010-10-18 08:17:50 -04:00
parent 883835d17b
commit 5e94e36f9a
4 changed files with 79 additions and 98 deletions

View File

@ -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);

View File

@ -907,57 +907,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");
}
@ -1021,7 +1021,6 @@ main (int argc, char **argv)
GtkTreePath *path;
GtkTreeIter iter;
GdkColor color;
GtkListStore *store;
gtk_init (&argc, &argv);
@ -1273,15 +1272,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);

View File

@ -6094,11 +6094,10 @@ create_list (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)
{
@ -6176,25 +6175,19 @@ create_list (GtkWidget *widget)
G_CALLBACK (list_add),
list);
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);
cb = GTK_COMBO_BOX_TEXT (gtk_combo_box_text_new_with_entry ());
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");
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");
@ -8398,15 +8391,25 @@ screen_display_check (GtkWidget *widget, ScreenDisplaySelection *data)
NULL);
}
else
{
if (!g_list_find_custom (data->valid_display_list,
display_name,
display_name_cmp))
data->valid_display_list = g_list_append (data->valid_display_list,
display_name);
new_screen = gdk_display_get_default_screen (display);
}
{
GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (data->combo));
gint i = 0;
GtkTreeIter iter;
gboolean found = FALSE;
while (gtk_tree_model_iter_nth_child (model, &iter, NULL, i++))
{
gchar *name;
gtk_tree_model_get (model, &iter, 0, &name, -1);
found = !g_ascii_strcasecmp (display_name, name);
g_free (name);
if (found)
break;
}
if (!found)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (data->combo), display_name);
new_screen = gdk_display_get_default_screen (display);
}
}
else
{
@ -8476,7 +8479,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>");

View File

@ -145,28 +145,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);
combo = GTK_COMBO_BOX_TEXT (gtk_combo_box_text_new_with_entry ());
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");
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");