[gtk+/wip/combo: 10/11] Adapt to api changes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/combo: 10/11] Adapt to api changes
- Date: Fri, 26 Dec 2014 05:21:17 +0000 (UTC)
commit 7ac77c801bb79d2abc29aa4d0f16a4943346cf83
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Dec 25 23:52:19 2014 -0500
Adapt to api changes
Also, test the new group apis.
tests/testnewcombo.c | 83 ++++++++++++++++++++++++++-----------------------
1 files changed, 44 insertions(+), 39 deletions(-)
---
diff --git a/tests/testnewcombo.c b/tests/testnewcombo.c
index faf7ff0..121dbdf 100644
--- a/tests/testnewcombo.c
+++ b/tests/testnewcombo.c
@@ -11,13 +11,13 @@ add_one (GtkButton *button, gpointer data)
count++;
id = g_strdup_printf ("%d", count);
- sort = g_strdup_printf ("Value %03d", count);
text = g_strdup_printf ("Value %d", count);
- gtk_combo_add (GTK_COMBO (data), id, sort, text);
+ sort = g_strdup_printf ("Value %03d", count);
+ gtk_combo_add_item (GTK_COMBO (data), id, text, sort, NULL);
gtk_combo_set_active (GTK_COMBO (data), id);
g_free (id);
- g_free (sort);
g_free (text);
+ g_free (sort);
}
static void
@@ -26,7 +26,7 @@ remove_active (GtkButton *button, gpointer data)
const gchar *id;
id = gtk_combo_get_active (GTK_COMBO (data));
- gtk_combo_remove (GTK_COMBO (data), id);
+ gtk_combo_remove_item (GTK_COMBO (data), id);
}
static void
@@ -73,9 +73,9 @@ main (int argc, char *argv[])
combo = gtk_combo_new ();
gtk_widget_set_halign (combo, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (box), combo);
- gtk_combo_add (GTK_COMBO (combo), "1", NULL, "Value 1");
- gtk_combo_add (GTK_COMBO (combo), "2", NULL, "Value 2");
- gtk_combo_add (GTK_COMBO (combo), "3", NULL, "Value 3");
+ gtk_combo_add_item (GTK_COMBO (combo), "1", "Value 1", NULL, NULL);
+ gtk_combo_add_item (GTK_COMBO (combo), "2", "Value 2", NULL, NULL);
+ gtk_combo_add_item (GTK_COMBO (combo), "3", "Value 3", NULL, NULL);
gtk_combo_set_placeholder (GTK_COMBO (combo), "None");
gtk_combo_set_active (GTK_COMBO (combo), "1");
@@ -88,17 +88,17 @@ main (int argc, char *argv[])
combo = gtk_combo_new ();
gtk_widget_set_halign (combo, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (box), combo);
- gtk_combo_add (GTK_COMBO (combo), "1", "Value 01", "Value 1");
- gtk_combo_add (GTK_COMBO (combo), "2", "Value 02", "Value 2");
- gtk_combo_add (GTK_COMBO (combo), "3", "Value 03", "Value 3");
- gtk_combo_add (GTK_COMBO (combo), "4", "Value 04", "Value 4");
- gtk_combo_add (GTK_COMBO (combo), "5", "Value 05", "Value 5");
- gtk_combo_add (GTK_COMBO (combo), "6", "Value 06", "Value 6");
- gtk_combo_add (GTK_COMBO (combo), "7", "Value 07", "Value 7");
- gtk_combo_add (GTK_COMBO (combo), "8", "Value 08", "Value 8");
- gtk_combo_add (GTK_COMBO (combo), "9", "Value 09", "Value 9");
- gtk_combo_add (GTK_COMBO (combo), "10", "Value 10", "Value 10");
- gtk_combo_add (GTK_COMBO (combo), "11", "Value 11", "Value 11");
+ gtk_combo_add_item (GTK_COMBO (combo), "1", "Value 1", "Value 01", NULL);
+ gtk_combo_add_item (GTK_COMBO (combo), "2", "Value 2", "Value 02", NULL);
+ gtk_combo_add_item (GTK_COMBO (combo), "3", "Value 3", "Value 03", NULL);
+ gtk_combo_add_item (GTK_COMBO (combo), "4", "Value 4", "Value 04", NULL);
+ gtk_combo_add_item (GTK_COMBO (combo), "5", "Value 5", "Value 05", NULL);
+ gtk_combo_add_item (GTK_COMBO (combo), "6", "Value 6", "Value 06", NULL);
+ gtk_combo_add_item (GTK_COMBO (combo), "7", "Value 7", "Value 07", NULL);
+ gtk_combo_add_item (GTK_COMBO (combo), "8", "Value 8", "Value 08", NULL);
+ gtk_combo_add_item (GTK_COMBO (combo), "9", "Value 9", "Value 09", NULL);
+ gtk_combo_add_item (GTK_COMBO (combo), "10", "Value 10", "Value 10", NULL);
+ gtk_combo_add_item (GTK_COMBO (combo), "11", "Value 11", "Value 11", NULL);
gtk_combo_set_placeholder (GTK_COMBO (combo), "None");
gtk_combo_set_active (GTK_COMBO (combo), "1");
@@ -111,9 +111,9 @@ main (int argc, char *argv[])
combo = gtk_combo_new ();
gtk_widget_set_halign (combo, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (box), combo);
- gtk_combo_add (GTK_COMBO (combo), "1", NULL, "Value 1");
- gtk_combo_add (GTK_COMBO (combo), "2", NULL, "Value 2");
- gtk_combo_add (GTK_COMBO (combo), "3", NULL, "Value 3");
+ gtk_combo_add_item (GTK_COMBO (combo), "1", "Value 1", NULL, NULL);
+ gtk_combo_add_item (GTK_COMBO (combo), "2", "Value 2", NULL, NULL);
+ gtk_combo_add_item (GTK_COMBO (combo), "3", "Value 3", NULL, NULL);
gtk_combo_set_placeholder (GTK_COMBO (combo), "None");
gtk_combo_set_allow_custom (GTK_COMBO (combo), TRUE);
gtk_combo_set_active (GTK_COMBO (combo), "1");
@@ -127,25 +127,30 @@ main (int argc, char *argv[])
combo = gtk_combo_new ();
gtk_widget_set_halign (combo, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (box), combo);
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 1", "1", "Value 001", "Value 1");
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 1", "2", "Value 002", "Value 2");
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 1", "3", "Value 003", "Value 3");
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 1", "4", "Value 004", "Value 4");
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 2", "5", "Value 005", "Value 5");
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 2", "6", "Value 006", "Value 6");
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 2", "7", "Value 007", "Value 7");
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 2", "8", "Value 008", "Value 8");
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 3", "9", "Value 009", "Value 9");
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 3", "10", "Value 010", "Value 10");
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 3", "11", "Value 011", "Value 11");
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 3", "12", "Value 012", "Value 12");
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 3", "13", "Value 013", "Value 13");
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 3", "14", "Value 014", "Value 14");
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 3", "15", "Value 015", "Value 15");
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 3", "16", "Value 016", "Value 16");
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 3", "17", "Value 017", "Value 17");
- gtk_combo_add_with_group (GTK_COMBO (combo), "Group 3", "18", "Value 018", "Value 18");
+ gtk_combo_add_group (GTK_COMBO (combo), "Group 3", "G 3", "Group 3");
+ gtk_combo_add_item (GTK_COMBO (combo), "1", "Value 1", "Value 01", "Group 1");
+ gtk_combo_add_item (GTK_COMBO (combo), "2", "Value 2", "Value 02", "Group 1");
+ gtk_combo_add_item (GTK_COMBO (combo), "3", "Value 3", "Value 03", "Group 1");
+ gtk_combo_add_item (GTK_COMBO (combo), "4", "Value 4", "Value 04", "Group 1");
+ gtk_combo_add_item (GTK_COMBO (combo), "5", "Value 5", "Value 05", "Group 2");
+ gtk_combo_add_item (GTK_COMBO (combo), "6", "Value 6", "Value 06", "Group 2");
+ gtk_combo_add_item (GTK_COMBO (combo), "7", "Value 7", "Value 07", "Group 2");
+ gtk_combo_add_item (GTK_COMBO (combo), "8", "Value 8", "Value 08", "Group 2");
+ gtk_combo_add_item (GTK_COMBO (combo), "9", "Value 9", "Value 09", "Group 3");
+ gtk_combo_add_item (GTK_COMBO (combo), "10", "Value 10", "Value 10", "Group 3");
+ gtk_combo_add_item (GTK_COMBO (combo), "11", "Value 11", "Value 11", "Group 3");
+ gtk_combo_add_item (GTK_COMBO (combo), "12", "Value 12", "Value 12", "Group 3");
+ gtk_combo_add_item (GTK_COMBO (combo), "13", "Value 13", "Value 13", "Group 3");
+ gtk_combo_add_item (GTK_COMBO (combo), "14", "Value 14", "Value 14", "Group 3");
+ gtk_combo_add_item (GTK_COMBO (combo), "15", "Value 15", NULL, "Group 3");
+ gtk_combo_add_item (GTK_COMBO (combo), "16", "Value 16", NULL, "Group 3");
+ gtk_combo_add_item (GTK_COMBO (combo), "17", "Value 17", NULL, "Group 3");
+ gtk_combo_add_item (GTK_COMBO (combo), "18", "Value 18", NULL, "Group 3");
gtk_combo_set_active (GTK_COMBO (combo), "7");
+ button = gtk_button_new_with_label ("Remove active");
+ gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
+ g_signal_connect (button, "clicked", G_CALLBACK (remove_active), combo);
+ gtk_container_add (GTK_CONTAINER (box), button);
gtk_container_add (GTK_CONTAINER (box), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]