mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-06-02 02:40:07 +02:00
Add 'change_state' callback to GActionEntry
This commit is contained in:
parent
535dcf4f22
commit
276750aa7a
@ -393,6 +393,8 @@ g_simple_action_group_remove (GSimpleActionGroup *simple,
|
|||||||
* format. The state is parsed with no extra type information,
|
* format. The state is parsed with no extra type information,
|
||||||
* so type tags must be added to the string if they are
|
* so type tags must be added to the string if they are
|
||||||
* necessary.
|
* 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
|
* This struct defines a single action. It is for use with
|
||||||
* g_simple_action_group_add_entries().
|
* g_simple_action_group_add_entries().
|
||||||
@ -523,6 +525,10 @@ g_simple_action_group_add_entries (GSimpleActionGroup *simple,
|
|||||||
g_signal_connect (action, "activate",
|
g_signal_connect (action, "activate",
|
||||||
G_CALLBACK (entry->activate), user_data);
|
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_simple_action_group_insert (simple, G_ACTION (action));
|
||||||
g_object_unref (action);
|
g_object_unref (action);
|
||||||
}
|
}
|
||||||
|
@ -96,8 +96,12 @@ struct _GActionEntry
|
|||||||
|
|
||||||
const gchar *state;
|
const gchar *state;
|
||||||
|
|
||||||
|
void (* change_state) (GSimpleAction *action,
|
||||||
|
GVariant *value,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
gsize padding[4];
|
gsize padding[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
void g_simple_action_group_add_entries (GSimpleActionGroup *simple,
|
void g_simple_action_group_add_entries (GSimpleActionGroup *simple,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user