From 82e2f5558177a2378ba4316b4477693af98946a6 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 9 Nov 2004 19:25:55 +0000 Subject: [PATCH] Add a real "Add many" button. 2004-11-09 Matthias Clasen * tests/testiconview.c: Add a real "Add many" button. --- ChangeLog | 2 ++ ChangeLog.pre-2-10 | 2 ++ ChangeLog.pre-2-6 | 2 ++ ChangeLog.pre-2-8 | 2 ++ tests/testiconview.c | 25 +++++++++++++++++++++---- 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index bca495a51..e18d898f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2004-11-09 Matthias Clasen + * tests/testiconview.c: Add a real "Add many" button. + * gtk/gtkaction.[hc]: * gtk/gtkactiongroup.[hc]: Make return types G_CONST_RETURN instead of const. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index bca495a51..e18d898f0 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,7 @@ 2004-11-09 Matthias Clasen + * tests/testiconview.c: Add a real "Add many" button. + * gtk/gtkaction.[hc]: * gtk/gtkactiongroup.[hc]: Make return types G_CONST_RETURN instead of const. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index bca495a51..e18d898f0 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,7 @@ 2004-11-09 Matthias Clasen + * tests/testiconview.c: Add a real "Add many" button. + * gtk/gtkaction.[hc]: * gtk/gtkactiongroup.[hc]: Make return types G_CONST_RETURN instead of const. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index bca495a51..e18d898f0 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,7 @@ 2004-11-09 Matthias Clasen + * tests/testiconview.c: Add a real "Add many" button. + * gtk/gtkaction.[hc]: * gtk/gtkactiongroup.[hc]: Make return types G_CONST_RETURN instead of const. diff --git a/tests/testiconview.c b/tests/testiconview.c index dac725aa2..69fd6a873 100644 --- a/tests/testiconview.c +++ b/tests/testiconview.c @@ -22,8 +22,9 @@ #include #include "prop-editor.h" -#define NUMBER_OF_ITEMS 10 -#define MANY_ITEMS 10000 +#define NUMBER_OF_ITEMS 10 +#define SOME_ITEMS 100 +#define MANY_ITEMS 10000 static void fill_model (GtkTreeModel *model) @@ -103,7 +104,7 @@ foreach_selected_remove (GtkWidget *button, GtkIconView *icon_list) static void -add_many (GtkWidget *button, GtkIconView *icon_list) +add_n_items (GtkIconView *icon_list, gint n) { static gint count = NUMBER_OF_ITEMS; @@ -117,7 +118,7 @@ add_many (GtkWidget *button, GtkIconView *icon_list) pixbuf = gdk_pixbuf_new_from_file ("gnome-textfile.png", NULL); - for (i = 0; i < MANY_ITEMS; i++) + for (i = 0; i < n; i++) { str = g_strdup_printf ("Icon %d", count); str2 = g_strdup_printf ("Icon %d", count); @@ -134,6 +135,18 @@ add_many (GtkWidget *button, GtkIconView *icon_list) } } +static void +add_some (GtkWidget *button, GtkIconView *icon_list) +{ + add_n_items (icon_list, SOME_ITEMS); +} + +static void +add_many (GtkWidget *button, GtkIconView *icon_list) +{ + add_n_items (icon_list, MANY_ITEMS); +} + static void select_all (GtkWidget *button, GtkIconView *icon_list) { @@ -308,6 +321,10 @@ main (gint argc, gchar **argv) gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START); gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0); + button = gtk_button_new_with_label ("Add some"); + g_signal_connect (button, "clicked", G_CALLBACK (add_some), icon_list); + gtk_box_pack_start_defaults (GTK_BOX (bbox), button); + button = gtk_button_new_with_label ("Add many"); g_signal_connect (button, "clicked", G_CALLBACK (add_many), icon_list); gtk_box_pack_start_defaults (GTK_BOX (bbox), button); -- 2.43.2