summaryrefslogtreecommitdiff
path: root/tests/testgtk.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-07-30 20:43:15 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-07-30 20:43:15 +0000
commitfceae3c3bbd541231355662a6d1f0b7f22dd44c0 (patch)
tree5ca12e4c805b5093e3cf1fa7eac83c28f76e487a /tests/testgtk.c
parenteca686f8e0e615f69475a330485c7e23976330a1 (diff)
downloadgtk+-fceae3c3bbd541231355662a6d1f0b7f22dd44c0.tar.gz
Fix bug in the selection mode option menus which were setting the wrong
Tue Jul 30 16:36:53 2002 Owen Taylor <otaylor@redhat.com> * tests/testgtk.c: Fix bug in the selection mode option menus which were setting the wrong values. (#85763, Manuel Op de Coul)
Diffstat (limited to 'tests/testgtk.c')
-rw-r--r--tests/testgtk.c46
1 files changed, 19 insertions, 27 deletions
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 701c68f937..afb4675099 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -5057,6 +5057,19 @@ list_clear (GtkWidget *widget,
gtk_list_clear_items (GTK_LIST (list), 0, -1);
}
+static gchar *selection_mode_items[] =
+{
+ "Single",
+ "Browse",
+ "Multiple"
+};
+
+static const GtkSelectionMode selection_modes[] = {
+ GTK_SELECTION_SINGLE,
+ GTK_SELECTION_BROWSE,
+ GTK_SELECTION_MULTIPLE
+};
+
static GtkWidget *list_omenu;
static void
@@ -5072,7 +5085,7 @@ list_toggle_sel_mode (GtkWidget *widget, gpointer data)
i = gtk_option_menu_get_history (GTK_OPTION_MENU (widget));
- gtk_list_set_selection_mode (list, (GtkSelectionMode) i);
+ gtk_list_set_selection_mode (list, selection_modes[i]);
}
static void
@@ -5080,13 +5093,6 @@ create_list (GtkWidget *widget)
{
static GtkWidget *window = NULL;
- static gchar *items[] =
- {
- "Single",
- "Browse",
- "Multiple"
- };
-
if (!window)
{
GtkWidget *cbox;
@@ -5185,7 +5191,7 @@ create_list (GtkWidget *widget)
label = gtk_label_new ("Selection Mode :");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
- list_omenu = build_option_menu (items, 3, 3,
+ list_omenu = build_option_menu (selection_mode_items, 3, 3,
list_toggle_sel_mode,
list);
gtk_box_pack_start (GTK_BOX (hbox), list_omenu, FALSE, TRUE, 0);
@@ -5542,7 +5548,7 @@ clist_toggle_sel_mode (GtkWidget *widget, gpointer data)
i = gtk_option_menu_get_history (GTK_OPTION_MENU (widget));
- gtk_clist_set_selection_mode (clist, (GtkSelectionMode) i);
+ gtk_clist_set_selection_mode (clist, selection_modes[i]);
}
static void
@@ -5576,13 +5582,6 @@ create_clist (GtkWidget *widget)
"Title 8", "Title 9", "Title 10", "Title 11"
};
- static gchar *items[] =
- {
- "Single",
- "Browse",
- "Multiple",
- };
-
char text[TESTGTK_CLIST_COLUMNS][50];
char *texts[TESTGTK_CLIST_COLUMNS];
@@ -5696,7 +5695,7 @@ create_clist (GtkWidget *widget)
label = gtk_label_new ("Selection Mode :");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
- clist_omenu = build_option_menu (items, 3, 3,
+ clist_omenu = build_option_menu (selection_mode_items, 3, 3,
clist_toggle_sel_mode,
clist);
gtk_box_pack_start (GTK_BOX (hbox), clist_omenu, FALSE, TRUE, 0);
@@ -6250,7 +6249,7 @@ ctree_toggle_sel_mode (GtkWidget *widget, gpointer data)
i = gtk_option_menu_get_history (GTK_OPTION_MENU (widget));
- gtk_clist_set_selection_mode (GTK_CLIST (ctree), (GtkSelectionMode) i);
+ gtk_clist_set_selection_mode (GTK_CLIST (ctree), selection_modes[i]);
after_press (ctree, NULL);
}
@@ -6442,13 +6441,6 @@ void create_ctree (GtkWidget *widget)
"Right"
};
- static gchar *items4[] =
- {
- "Single",
- "Browse",
- "Multiple",
- };
-
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@@ -6661,7 +6653,7 @@ void create_ctree (GtkWidget *widget)
gtk_tooltips_set_tip (tooltips, omenu3, "The tree's justification.",
NULL);
- omenu4 = build_option_menu (items4, 3, 3,
+ omenu4 = build_option_menu (selection_mode_items, 3, 3,
ctree_toggle_sel_mode, ctree);
gtk_box_pack_start (GTK_BOX (hbox), omenu4, FALSE, TRUE, 0);
gtk_tooltips_set_tip (tooltips, omenu4, "The list's selection mode.",