[glib] Add 'change_state' callback to GActionEntry
- From: Javier JardÃn <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Add 'change_state' callback to GActionEntry
- Date: Wed, 29 Jun 2011 15:23:01 +0000 (UTC)
commit 276750aa7aba853535a9f751429ef51aa9dcc924
Author: Ryan Lortie <desrt desrt ca>
Date: Wed Jun 29 16:04:09 2011 +0100
Add 'change_state' callback to GActionEntry
gio/gsimpleactiongroup.c | 6 ++++++
gio/gsimpleactiongroup.h | 6 +++++-
2 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/gio/gsimpleactiongroup.c b/gio/gsimpleactiongroup.c
index b35982d..46619d3 100644
--- a/gio/gsimpleactiongroup.c
+++ b/gio/gsimpleactiongroup.c
@@ -393,6 +393,8 @@ g_simple_action_group_remove (GSimpleActionGroup *simple,
* format. The state is parsed with no extra type information,
* so type tags must be added to the string if they are
* necessary.
+ * @change_state: the callback to connect to the "change-state" signal
+ * of the action
*
* This struct defines a single action. It is for use with
* g_simple_action_group_add_entries().
@@ -523,6 +525,10 @@ g_simple_action_group_add_entries (GSimpleActionGroup *simple,
g_signal_connect (action, "activate",
G_CALLBACK (entry->activate), user_data);
+ if (entry->change_state != NULL)
+ g_signal_connect (action, "change-state",
+ G_CALLBACK (entry->change_state), user_data);
+
g_simple_action_group_insert (simple, G_ACTION (action));
g_object_unref (action);
}
diff --git a/gio/gsimpleactiongroup.h b/gio/gsimpleactiongroup.h
index 8486808..710cd59 100644
--- a/gio/gsimpleactiongroup.h
+++ b/gio/gsimpleactiongroup.h
@@ -96,8 +96,12 @@ struct _GActionEntry
const gchar *state;
+ void (* change_state) (GSimpleAction *action,
+ GVariant *value,
+ gpointer user_data);
+
/*< private >*/
- gsize padding[4];
+ gsize padding[3];
};
void g_simple_action_group_add_entries (GSimpleActionGroup *simple,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]