Skip to main content

Module gaction

Module gaction 

Source
Expand description

Driving GTK app.* / win.* GActions over the org.gtk.Actions session-bus interface — for menu/dialog items absent from the AT-SPI tree. Driving GTK applications through their exported org.gtk.Actions D-Bus interface — a surface distinct from AT-SPI.

GTK4/libadwaita lazily-realized menu surfaces (GtkPopoverMenu items — primary/context/tab menus —, AdwTabOverview, and some dialog bodies) never enter the GetChildren snapshot tree or Cache.GetItems, so there is no client-side AT-SPI handle to read or activate them. Their only effective role is “fire a GAction”.

GApplication and GtkApplicationWindow export their action groups over the org.gtk.Actions interface on the application’s own well-known bus name on the session bus — a different bus and addressing model than the a11y bus crate::atspi talks to. This module connects to that surface and invokes app.* / win.* actions so a test can drive a GAction-only item and observe the side effect (e.g. via crate::Session::wait_for_stdout_line).

§Addressing

The session bus is shared (parallel sessions are disambiguated by unique GApplication id), so the app is located by matching the spawned process PID to the owner of a well-known bus name — the GApplication owns its id as a name whose owning-connection PID is the app’s. The object path is then derived the way GLib does (g_application_id_get_default_dbus_object_path): "/" + appid with . mapped to / and - to _. App actions export at that base path; each GtkApplicationWindow’s actions export at <base>/window/<N>.

This is a test affordance, not a general locator: firing an action needs out-of-band knowledge of the action name (an app-internal contract that org.gtk.Actions.DescribeAll does not map to visible labels).

Structs§

GtkActionsTarget
A live session-bus connection plus the discovered application address. Cached on the crate::Session after the first GAction call.
GtkApplicationAddress
A GTK application’s exported org.gtk.Actions location on the session bus.

Functions§

activate
Activate action (app.* / win.*, optionally …::target) on the discovered application. app.* targets the base path; win.* targets the first window path that exposes the action.
connect_session_bus
Connect to the session bus at dbus_address — the same bus the app was spawned against, where it exports org.gtk.Actions.
discover_application
Locate the GApplication owned by app_pid on conn and return its org.gtk.Actions address. Scans well-known bus names, matching each owner’s PID (served by the bus daemon, so fast and unhangable) against the spawned app’s, then confirms the candidate actually answers org.gtk.Actions.List at its derived base path.
list_all
List the prefixed names of every action the app exposes: app.* from the base path and win.* from each window action group.