The `state-set` signal is emitted to change the underlying state,
which can have two reasons:
1. the user toggled the switch
2. the extension's `enabled` state changed externally
In the second case, calling enable/disable is pointless at best,
and can mess up the expected state by permanently disabling an
extension that was disabled because of the global kill switch.
Address this by only calling enable/disable if the new state does
not already match the current value of the `enabled` property.
Close https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7305
Fixes: fec523f83f ("extensions-app: Use new 'enabled' property")
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3090>
The switch for enabling/disabling extensions currently bases its
state on the extension's ACTIVE state.
This is problematic in the enabled-but-inactive case, because
activating the switch tries to change the state from off to on,
which leads to enabling an already enabled extension (an obvious
no-op).
The new `enabled` property allows us to do better, and use delayed
state changes where the switch position represents the `enabled`
state, and the trough color whether the extension is ACTIVE.
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7004
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3073>
The ENABLED state means that an extension's `enable()` method
was called successfully.
This usually matches whether an extension *should* be enabled
according to the enabled-extensions/disabled-extensions settings,
but not necessarily: If an extension had an error or does not
support the currently active mode, its actual state is different.
We currently only expose the actual state to external tooling,
but whether an extension should be enabled is relevant as well,
for example to disable a lock-screen only extension from the
regular session.
For that purpose we will expose a separate `enabled` property.
To avoid confusion with the existing states, change the exposed
names to (IN)ACTIVE.
This does not affect the D-Bus API, as the numeric values of
the states remain unchanged.
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7004
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3073>
Most properties that determine the availability of an action are
not expected to change, but now that extensions are represented
as a GObject, we can just generically set up bindings for all
actions instead of explicitly tracking the properties that we
expect to change.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3067>