[glib] Add example to docs for using GActionEntry
- From: Javier JardÃn <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Add example to docs for using GActionEntry
- Date: Wed, 29 Jun 2011 15:22:41 +0000 (UTC)
commit 6383b3e7095790372982c6fe68c7e770a6f44a5e
Author: Ryan Lortie <desrt desrt ca>
Date: Wed Jun 29 13:55:59 2011 +0100
Add example to docs for using GActionEntry
gio/gsimpleactiongroup.c | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/gio/gsimpleactiongroup.c b/gio/gsimpleactiongroup.c
index 14c9714..b35982d 100644
--- a/gio/gsimpleactiongroup.c
+++ b/gio/gsimpleactiongroup.c
@@ -402,6 +402,8 @@ g_simple_action_group_remove (GSimpleActionGroup *simple,
* in order to leave some of the later values as %NULL. All values
* after @name are optional. Additional optional fields may be added in
* the future.
+ *
+ * See g_simple_action_group_add_entries() for an example.
**/
/**
@@ -417,6 +419,42 @@ g_simple_action_group_remove (GSimpleActionGroup *simple,
*
* Each action is constructed as per one #GActionEntry.
*
+ * <example>
+ * <title>Using g_simple_action_group_add_entries()</title>
+ * <programlisting>
+ * static void
+ * activate_quit (GSimpleAction *simple,
+ * GVariant *parameter,
+ * gpointer user_data)
+ * {
+ * exit (0);
+ * }
+ *
+ * static void
+ * activate_print_string (GSimpleAction *simple,
+ * GVariant *parameter,
+ * gpointer user_data)
+ * {
+ * g_print ("%s\n", g_variant_get_string (parameter, NULL));
+ * }
+ *
+ * static GActionGroup *
+ * create_action_group (void)
+ * {
+ * const GActionEntry entries[] = {
+ * { "quit", activate_quit },
+ * { "print-string", activate_print_string, "s" }
+ * };
+ * GSimpleActionGroup *group;
+ *
+ * group = g_simple_action_group_new ();
+ * g_simple_action_group_add_entries (group, entries, G_N_ELEMENTS (entries), NULL);
+ *
+ * return G_ACTION_GROUP (group);
+ * }
+ * </programlisting>
+ * </example>
+ *
* Since: 2.30
**/
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]