[glib/wip/gapplication] application: Add list_actions()
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/gapplication] application: Add list_actions()
- Date: Tue, 18 May 2010 11:13:11 +0000 (UTC)
commit 2a6dd6ffb38435b4a86d76f4b23d78a64853a7bd
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Tue May 18 12:12:21 2010 +0100
application: Add list_actions()
Add a method for retrieving the list of registered actions from a
GApplication.
gio/gapplication.c | 37 +++++++++++++++++++++++++++++++++++++
gio/gapplication.h | 1 +
gio/gio.symbols | 1 +
3 files changed, 39 insertions(+), 0 deletions(-)
---
diff --git a/gio/gapplication.c b/gio/gapplication.c
index 687f799..a03da0f 100644
--- a/gio/gapplication.c
+++ b/gio/gapplication.c
@@ -342,6 +342,43 @@ g_application_invoke_action (GApplication *application,
}
/**
+ * g_application_list_actions:
+ * @application: a #GApplication
+ *
+ * Retrieves the list of action names currently exposed by @application
+ *
+ * Return value: (transfer full): a newly allocation, %NULL-terminated array
+ * of strings containing action names; use g_strfreev() to free the
+ * resources used by the returned array
+ *
+ * Since: 2.26
+ */
+gchar **
+g_application_list_actions (GApplication *application)
+{
+ GApplicationPrivate *priv;
+ GHashTableIter iter;
+ gpointer key;
+ gchar **retval;
+ gint i;
+
+ g_return_val_if_fail (G_IS_APPLICATION (application), NULL);
+
+ priv = application->priv;
+
+ retval = g_new (gchar*, g_hash_table_size (priv->actions));
+
+ i = 0;
+ g_hash_table_iter_init (&iter, priv->actions);
+ while (g_hash_table_iter_next (&iter, &key, NULL))
+ retval[i++] = g_strdup (key);
+
+ retval[i] = NULL;
+
+ return retval;
+}
+
+/**
* g_application_set_action_enabled:
* @application: a #GApplication
* @name: the name of the application
diff --git a/gio/gapplication.h b/gio/gapplication.h
index d02fd2b..3c75d02 100644
--- a/gio/gapplication.h
+++ b/gio/gapplication.h
@@ -142,6 +142,7 @@ void g_application_add_action (GApplication
const char *description);
void g_application_remove_action (GApplication *application,
const char *name);
+gchar ** g_application_list_actions (GApplication *application);
void g_application_set_action_enabled (GApplication *application,
const char *name,
gboolean enabled);
diff --git a/gio/gio.symbols b/gio/gio.symbols
index a759a41..ae78735 100644
--- a/gio/gio.symbols
+++ b/gio/gio.symbols
@@ -38,6 +38,7 @@ g_application_get_action_enabled
g_application_add_action
g_application_remove_action
g_application_invoke_action
+g_application_list_actions
g_application_get_mainloop
g_application_run
g_application_quit
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]