language: Add not-swapped flag for signals

This is needed because GtkBuilder defaults to swapped when you specify
the object attribute.
This commit is contained in:
James Westman 2024-12-09 20:29:08 -06:00
parent 9b9fab832b
commit a6d57cebec
10 changed files with 72 additions and 8 deletions

View file

@ -91,7 +91,7 @@ Signal Handlers
.. rst-class:: grammar-block
Signal = <name::ref:`IDENT<Syntax IDENT>`> ('::' <detail::ref:`IDENT<Syntax IDENT>`>)? '=>' '$' <handler::ref:`IDENT<Syntax IDENT>`> '(' <object::ref:`IDENT<Syntax IDENT>`>? ')' (SignalFlag)* ';'
SignalFlag = 'after' | 'swapped'
SignalFlag = 'after' | 'swapped' | 'not-swapped'
Signals are one way to respond to user input (another is `actions <https://docs.gtk.org/gtk4/actions.html>`_, which use the `action-name property <https://docs.gtk.org/gtk4/property.Actionable.action-name.html>`_).
@ -99,6 +99,8 @@ Signals provide a handle for your code to listen to events in the UI. The handle
Optionally, you can provide an object ID to use when connecting the signal.
The ``swapped`` flag is used to swap the order of the object and userdata arguments in C applications. If an object argument is specified, then this is the default behavior, so the ``not-swapped`` flag can be used to prevent the swap.
Example
~~~~~~~
@ -108,7 +110,6 @@ Example
clicked => $on_button_clicked();
}
.. _Syntax Child:
Children