summaryrefslogtreecommitdiff
path: root/tests/testmerge.c
diff options
context:
space:
mode:
authorMatthias Clasen <maclas@gmx.de>2003-09-15 19:51:55 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2003-09-15 19:51:55 +0000
commitcaf380c793789e868458e32fbb64a33b5ef1d852 (patch)
treeee65930936942b62c28d6ae7a5de24905059e906 /tests/testmerge.c
parentb14b12f9d2b5ba0b554b7d8ec2a3c90a8cd78d4f (diff)
downloadgtk+-caf380c793789e868458e32fbb64a33b5ef1d852.tar.gz
Add value parameter to allow setting the currently selected group member
2003-09-15 Matthias Clasen <maclas@gmx.de> * gtk/gtkactiongroup.[hc]: (gtk_action_group_add_radio_actions): (gtk_action_group_add_radio_actions_full): Add value parameter to allow setting the currently selected group member before connecting signals. (GtkToggleActionEntry): Separate struct for constructing toggle actions, including a boolean to initialize the action state before connecting signals. (gtk_action_group_add_toggle_actions): (gtk_action_group_add_toggle_actions_full): New functions to construct toggle actions from an array of GtkToggleActionEntries. * demos/gtk-demo/appwindow.c: * tests/testactions.c: * tests/testmerge.c: Adjust to new action group API. * gtk/gtk-sections.txt: Add gtk_action_group_add_toggle_actions[_full].
Diffstat (limited to 'tests/testmerge.c')
-rw-r--r--tests/testmerge.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/testmerge.c b/tests/testmerge.c
index 0d50a39151..4b40f12628 100644
--- a/tests/testmerge.c
+++ b/tests/testmerge.c
@@ -126,10 +126,15 @@ static GtkActionEntry entries[] = {
{ "CopyAction", GTK_STOCK_COPY, NULL, "<control>c", NULL, G_CALLBACK (activate_action) },
{ "PasteAction", GTK_STOCK_PASTE, NULL, "<control>v", NULL, G_CALLBACK (activate_action) },
{ "AboutAction", NULL, "_About", NULL, NULL, G_CALLBACK (activate_action) },
- { "BoldAction", GTK_STOCK_BOLD, "_Bold", "<control>b", NULL, G_CALLBACK (toggle_action), TRUE },
};
static guint n_entries = G_N_ELEMENTS (entries);
+static GtkToggleActionEntry toggle_entries[] = {
+ { "BoldAction", GTK_STOCK_BOLD, "_Bold", "<control>b", NULL, G_CALLBACK (toggle_action),
+ TRUE },
+};
+static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries);
+
enum {
JUSTIFY_LEFT,
JUSTIFY_CENTER,
@@ -442,9 +447,15 @@ main (int argc, char **argv)
gtk_init (&argc, &argv);
action_group = gtk_action_group_new ("TestActions");
- gtk_action_group_add_actions (action_group, entries, n_entries, NULL);
+ gtk_action_group_add_actions (action_group,
+ entries, n_entries,
+ NULL);
+ gtk_action_group_add_toggle_actions (action_group,
+ toggle_entries, n_toggle_entries,
+ NULL);
gtk_action_group_add_radio_actions (action_group,
radio_entries, n_radio_entries,
+ JUSTIFY_LEFT,
G_CALLBACK (radio_action_changed), NULL);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);