Action scopes

Actions are always scoped to a particular object on which they operate.

In GTK, actions are typically scoped to either an application or a window, but any widget can have actions associated with it.

Actions scoped to windows should be the actions that specifically impact that window. These are actions like fullscreen and close, or in the case that a window contains a document, save and print.

Actions that impact the application as a whole rather than one specific window are scoped to the application. These are actions like about and preferences.

If a particular action is scoped to a window then it is scoped to a specific window. Another way of saying this: if your application has a fullscreen action that applies to windows and it has three windows, then it will have three fullscreen actions: one for each window.

Having a separate action per-window allows for each window to have a separate state for each instance of the action as well as being able to control the enabled state of the action on a per-window basis.

Actions are added to their relevant scope (application, window or widget) either using the GActionMap interface, or by using gtk_widget_insert_action_group(). Actions that will be the same for all instances of a widget class can be added globally using gtk_widget_class_install_action().