GSimpleAction: add default activate handler
authorRyan Lortie <desrt@desrt.ca>
Sat, 18 Jan 2014 18:02:47 +0000 (13:02 -0500)
committerRyan Lortie <desrt@desrt.ca>
Sat, 18 Jan 2014 19:19:37 +0000 (14:19 -0500)
commit1ec71144fb8064ffdbdcb56a213cf90a77726f68
treeb4f7314b3354d4ef7f5a1125a94c5662c0255eb1
parent258ac3b25398547c9ae0434c7c049a88d1e309ed
GSimpleAction: add default activate handler

If the action is stateful and the user doesn't have their own activate handler
then do some reasonable things for ourselves.

After a lot of experience using stateful GSimpleAction it turns out that
people almost always end up using it in the same ways:

A boolean-typed stateful action with no parameter is most likely going
to want to be toggled.  Any other type of action that has the parameter
type equal to the state type probably intends for activation to
represent a request to change the state.

This patch implements those two cases.  This will let people stop
writing their own trivial handlers over and over.

https://bugzilla.gnome.org/show_bug.cgi?id=722503
gio/gsimpleaction.c