[glib] Add an example of invoking actions
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Add an example of invoking actions
- Date: Mon, 1 Nov 2010 02:05:59 +0000 (UTC)
commit 7887103193de4230a1ccb8dc7100816e523e5b9c
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Oct 31 22:05:20 2010 -0400
Add an example of invoking actions
gio/tests/gapplication-example-actions.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gio/tests/gapplication-example-actions.c b/gio/tests/gapplication-example-actions.c
index 4bb7fc6..3fc55f7 100644
--- a/gio/tests/gapplication-example-actions.c
+++ b/gio/tests/gapplication-example-actions.c
@@ -38,6 +38,7 @@ activate_toggle_action (GAction *action,
b = g_variant_get_boolean (state);
g_variant_unref (state);
g_action_set_state (action, g_variant_new_boolean (!b));
+ g_print ("state change %d -> %d\n", b, !b);
g_application_release (application);
}
@@ -77,6 +78,19 @@ main (int argc, char **argv)
add_actions (app);
+ if (argc > 1 && strcmp (argv[1], "--simple-action") == 0)
+ {
+ g_application_register (app, NULL, NULL);
+ g_action_group_activate_action (G_ACTION_GROUP (app), "simple-action", NULL);
+ exit (0);
+ }
+ else if (argc > 1 && strcmp (argv[1], "--toggle-action") == 0)
+ {
+ g_application_register (app, NULL, NULL);
+ g_action_group_activate_action (G_ACTION_GROUP (app), "toggle-action", NULL);
+ exit (0);
+ }
+
status = g_application_run (app, argc, argv);
g_object_unref (app);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]