Commit Graph

33 Commits

Author SHA1 Message Date
Lars Uebernickel
ee718d3526 gapplication: reject actions without names
https://bugzilla.gnome.org/show_bug.cgi?id=756134
2015-11-02 13:52:10 +01:00
Xavier Claessens
74c22150cf docs: fix up docs issues in gio/ 2015-02-05 16:20:43 +01:00
Cosimo Cecchi
be2d9b4f58 GSimpleAction: add g_simple_action_set_state_hint
Currently the only way to set a state hint on an action is through a
subclass; add a g_simple_action_set_state_hint() method so that this
becomes easier for clients that already use GSimpleAction.

https://bugzilla.gnome.org/show_bug.cgi?id=743521
2015-01-26 12:06:24 +00:00
Matthias Clasen
bc6ee788b4 docs: let go of *
Since we are no longer using sgml mode, using /* */ to
escape block comments inside examples does not work anymore.
Switch to using line comments with //
2014-02-14 21:33:36 -05:00
Matthias Clasen
adf892e96a Annotate all examples with their language
The C ones, at least.
2014-02-01 15:11:49 -05:00
Matthias Clasen
17f51583a8 Docs: Convert examples to |[ ]| 2014-01-31 21:56:33 -05:00
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01:00
Ryan Lortie
9e81c07ad6 GSimpleAction: fix mistake in last commit
Some bad copy-paste happening here...
2014-01-18 14:27:26 -05:00
Ryan Lortie
1ec71144fb 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
2014-01-18 14:19:37 -05:00
Matthias Clasen
3872049445 Add includes to all gio docs 2014-01-07 22:55:43 -05:00
Ryan Lortie
83869120bb GSimpleAction: don't allow changing state type
g_object_set() allowed us to bypass the usual checks that the state
doesn't change type and also leaked.

Fix that up by turning the state into a construct property (so that it
always gets set once during construction, even if only to NULL) and
then route the further sets through the C API so that they are subject
to the same checks.

https://bugzilla.gnome.org/show_bug.cgi?id=696424
2013-10-28 18:08:16 -07:00
Christian Persch
1d310cf5db app: Document when floating variants are consumed
Bug #700203.
2013-05-13 13:45:11 +02:00
Ryan Lortie
ab0da3c282 GSimpleAction: fix some whitespace fail 2011-12-20 19:12:56 -05:00
Ryan Lortie
342e2faa29 GSimpleAction: tweak property flags
There's no need for 'enabled' and 'state' to be marked construct-only.
These properties are writable at all times.
2011-12-20 19:12:00 -05:00
Colin Walters
8777b08a5a gsimpleaction: Ensure actions are enabled 2011-12-08 18:05:14 -05:00
Colin Walters
41e5ba86a7 GSimpleAction: Fix to comply with constructor rules
foo_new_*() must be pure wrappers around g_object_new(), otherwise
their functionality is inaccessible to bindings.
2011-12-08 18:05:14 -05:00
Matthias Clasen
c7dc66602a Cosmetics
Reword the title of GSimpleAction in the docs.
2011-11-26 20:12:34 -05:00
Ryan Lortie
09429e2c82 gio static fixups 2011-10-16 21:41:15 -04:00
Damien Lespiau
c8ef5b7d6c simpleaction: Fix documentation of :enabled
An over-zealous sed, most likely, transformed g_action_.*() into
g_simple_action.*().

https://bugzilla.gnome.org/show_bug.cgi?id=658558
2011-09-08 17:07:56 +01:00
Emmanuele Bassi
847a8eb911 gio: Some more build fixes 2011-06-29 18:07:29 +01:00
Emmanuele Bassi
87a542bc96 Fix build
The g_return_val_if_fail() macro takes a return value.
2011-06-29 18:00:53 +01:00
Ryan Lortie
b73e53f577 parameter guards for GSimpleAction constructors 2011-06-29 17:32:21 +01:00
Ryan Lortie
bde41dacf7 GAction: make GObject properties read-only
GAction is a read-only interface (as is visible by the lack of _set() functions
on its API).  The properties on the interface currently force implementors to
support writing of the properties at construct time, however.

Lift that restriction.

Take advantage of this from GSimpleAction by nuking the set_property
function and setting the fields directly in the constructor.
2011-06-29 17:32:21 +01:00
Ryan Lortie
535dcf4f22 Add example for 'change-state' signal
Pulled from the testcase.
2011-06-29 16:20:52 +01:00
Ryan Lortie
9a23ef6c2d Add 'change-state' signal to GSimpleAction
If connected, allows the user to control the result of
g_action_change_state().
2011-06-29 16:20:52 +01:00
Ryan Lortie
695a9a7993 allow NULL state in g_simple_action_new_stateful
as an undocumented feature
2011-06-29 16:20:52 +01:00
Ryan Lortie
5ff65d8695 Make 4 incompatible changes to the GAction API
This commit represents an API break to GAction in the following ways:

  - the 'set_state' entry in the GActionInterface vtable has been
    renamed to 'change_state'.  The number and order of vtable items has
    not otherwise changed.

  - g_action_set_state() has been renamed to g_action_change_state() to
    match the updated vtable entry.

  - the "state" property of the GAction interface has been changed to
    read-only to reflect the fact that g_action_set_state() no longer
    exists.

  - GSimpleActionClass has been hidden.  GSimpleAction can no longer be
    subclassed.

>> Rationale

g_action_set_state() has never been a true setter in the sense that
calling it will update the value of the "state" property.  It has always
been closer to "request 'state' to be changed to this value" with
semantics defined by the implementor of the interface.  This is why the
equivalent method in GActionGroup had its name changed from 'set' to
'change'.  This change makes the two interfaces more consistent and
removes any implication about the effect that calling set_state() should
have on the 'state' property.

>> Impact

This incompatible API break was undertaken only because I strongly
suspect that it will go entirely unnoticed.  If the break actually
affects anybody, then we will accommodate them (possibly going as far as
to revert this commit entirely).

The virtual table change only impacts implementors of GAction.  I
strongly suspect that this is nobody (except for GSimpleAction).

The hiding of GSimpleActionClass only impacts impacts subclasses of
GSimpleAction.  I strongly suspect that none of these exist.

The changing of the property to be read-only only affects people who
were trying to change the state by using GObject properties.  I strongly
suspect that this is nobody at all.

The removal of the g_action_set_state() call is the most dangerous, but
I still suspect that it will impact nobody outside of GLib.  If anybody
is impacted by this change then, at their request, I will reintroduce
the API as a deprecated alias for g_action_change_state().
2011-06-29 11:38:21 +01:00
Claudio Saavedra
3cbd5565ae GSimpleAction: fix typo 2011-06-24 16:04:54 +03:00
Christian Persch
71c7e49058 Use G_SIGNAL_MUST_COLLECT for VARIANT signals
Bug #643624.
2011-04-26 22:58:02 -04:00
Matthias Clasen
eed36d38d1 Various doc tweaks 2010-11-28 23:55:43 -05:00
Matthias Clasen
79790b9278 Brush up the GApplication docs
Also, fix up inclusions, mark properties for translation, etc.
2010-10-23 02:31:16 +02:00
Ryan Lortie
04b58a3e27 Change 'Since:' to 2.28 for action classes 2010-10-19 01:16:46 +02:00
Ryan Lortie
846b0b3466 GAction is now an interface
the new class GSimpleAction is the implementation half
2010-08-30 19:26:37 +02:00