summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/testgaction.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/testgaction.c b/tests/testgaction.c
index 3a28d0b465..49635bfd1f 100644
--- a/tests/testgaction.c
+++ b/tests/testgaction.c
@@ -24,8 +24,13 @@ toggle_menu_item (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
+ GVariant *state = g_action_get_state (G_ACTION (action));
gtk_label_set_label (GTK_LABEL (label), "Text set from toggle menu item");
+
+ g_simple_action_set_state (action, g_variant_new_boolean (!g_variant_get_boolean (state)));
+
+ g_variant_unref (state);
}
static void
@@ -39,15 +44,16 @@ submenu_item (GSimpleAction *action,
static void
radio (GSimpleAction *action, GVariant *parameter, gpointer user_data)
{
- GVariant *new_state = g_variant_new_string (g_variant_get_string (parameter, NULL));
char *str;
str = g_strdup_printf ("From Radio menu item %s",
- g_variant_get_string (new_state, NULL));
+ g_variant_get_string (parameter, NULL));
gtk_label_set_label (GTK_LABEL (label), str);
g_free (str);
+
+ g_simple_action_set_state (action, parameter);
}
@@ -57,7 +63,7 @@ static const GActionEntry win_actions[] = {
{ "normal-menu-item", normal_menu_item, NULL, NULL, NULL },
{ "toggle-menu-item", toggle_menu_item, NULL, "true", NULL },
{ "submenu-item", submenu_item, NULL, NULL, NULL },
- { "radio", radio, "s", "1", NULL },
+ { "radio", radio, "s", "'1'", NULL },
};