Florian Müllner fec523f83f extensions-app: Use new 'enabled' property
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>
2024-01-03 20:05:05 +00:00

266 lines
12 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="ExtensionRow" parent="AdwActionRow">
<property name="activatable-widget">switch</property>
<binding name="title">
<lookup name="name" type="Extension">
<lookup name="extension" type="ExtensionRow"/>
</lookup>
</binding>
<child type="suffix">
<object class="GtkMenuButton" id="errorButton">
<property name="valign">center</property>
<property name="has-frame">false</property>
<property name="icon-name">dialog-error-symbolic</property>
<binding name="visible">
<lookup name="has-error" type="Extension">
<lookup name="extension" type="ExtensionRow"/>
</lookup>
</binding>
<accessibility>
<property name="label" translatable="yes">Error Details</property>
</accessibility>
<property name="popover">
<object class="GtkPopover" id="errorPopover">
<property name="child">
<object class="AdwClamp">
<property name="maximum-size">300</property>
<property name="tightening-threshold">300</property>
<property name="child">
<object class="GtkLabel" id="errorLabel">
<binding name="label">
<lookup name="error" type="Extension">
<lookup name="extension" type="ExtensionRow"/>
</lookup>
</binding>
<!-- Hack to make the screen reader read the label -->
<property name="selectable"
bind-source="errorPopover"
bind-property="visible"
bind-flags="invert-boolean|sync-create"/>
<property name="wrap">true</property>
</object>
</property>
</object>
</property>
</object>
</property>
</object>
</child>
<child type="suffix">
<object class="GtkMenuButton" id="updatesButton">
<property name="valign">center</property>
<property name="has-frame">false</property>
<property name="icon-name">software-update-available-symbolic</property>
<binding name="visible">
<lookup name="has-update" type="Extension">
<lookup name="extension" type="ExtensionRow"/>
</lookup>
</binding>
<accessibility>
<property name="label" translatable="yes">Updates Details</property>
</accessibility>
<property name="popover">
<object class="GtkPopover" id="updatesPopover">
<property name="child">
<object class="AdwClamp">
<property name="maximum-size">200</property>
<property name="tightening-threshold">200</property>
<property name="child">
<object class="GtkLabel">
<property name="label" translatable="yes">A new version of this extension is ready and will be loaded on next login.</property>
<property name="wrap">true</property>
<!-- Hack to make the screen reader read the label -->
<property name="selectable"
bind-source="updatesPopover"
bind-property="visible"
bind-flags="invert-boolean|sync-create"/>
</object>
</property>
</object>
</property>
</object>
</property>
</object>
</child>
<child type="suffix">
<object class="GtkSwitch" id="switch">
<property name="valign">center</property>
<binding name="active">
<lookup name="enabled" type="Extension">
<lookup name="extension" type="ExtensionRow"/>
</lookup>
</binding>
<binding name="sensitive">
<lookup name="can-change" type="Extension">
<lookup name="extension" type="ExtensionRow"/>
</lookup>
</binding>
</object>
</child>
<child type="suffix">
<object class="GtkMenuButton">
<property name="icon-name">view-more-symbolic</property>
<property name="has-frame">false</property>
<property name="valign">center</property>
<accessibility>
<property name="label" translatable="yes">Extension Details</property>
</accessibility>
<property name="popover">
<object class="GtkPopover" id="detailsPopover">
<style>
<class name="details-popover"/>
</style>
<property name="child">
<object class="AdwClamp">
<property name="maximum-size">300</property>
<property name="tightening-threshold">300</property>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<style>
<class name="information"/>
</style>
<child>
<object class="GtkLabel">
<property name="label"
bind-source="ExtensionRow"
bind-property="title"
bind-flags="sync-create"/>
<property name="xalign">0</property>
<!-- Hack to make the screen reader read the label -->
<property name="selectable"
bind-source="detailsPopover"
bind-property="visible"
bind-flags="invert-boolean|sync-create"/>
<style>
<class name="title-4"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel" id="descriptionLabel">
<property name="xalign">0</property>
<property name="wrap">True</property>
<property name="selectable">true</property>
<binding name="label">
<lookup name="description" type="Extension">
<lookup name="extension" type="ExtensionRow"/>
</lookup>
</binding>
</object>
</child>
<child>
<object class="GtkLabel" id="versionLabel">
<property name="visible">false</property>
<property name="xalign">0</property>
<property name="selectable">true</property>
<binding name="visible">
<lookup name="has-version" type="Extension">
<lookup name="extension" type="ExtensionRow"/>
</lookup>
</binding>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child>
<object class="GtkBox" id="actionsBox">
<style>
<class name="actions"/>
</style>
<child>
<object class="GtkButton" id="websiteButton">
<property name="visible"
bind-source="websiteButton"
bind-property="sensitive"
bind-flags="sync-create"/>
<property name="hexpand">true</property>
<property name="action-name">row.show-url</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkImage">
<property name="icon-name">website-symbolic</property>
<property name="accessible-role">presentation</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="use-underline">true</property>
<property name="label" translatable="yes">_Website</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="prefsButton">
<property name="visible"
bind-source="prefsButton"
bind-property="sensitive"
bind-flags="sync-create"/>
<property name="hexpand">true</property>
<property name="action-name">row.show-prefs</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkImage">
<property name="icon-name">settings-symbolic</property>
<property name="accessible-role">presentation</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="use-underline">true</property>
<property name="label" translatable="yes">_Settings</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="removeButton">
<property name="visible"
bind-source="removeButton"
bind-property="sensitive"
bind-flags="sync-create"/>
<property name="hexpand">true</property>
<property name="action-name">row.uninstall</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkImage">
<property name="icon-name">remove-symbolic</property>
<property name="accessible-role">presentation</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="use-underline">true</property>
<property name="label" translatable="yes">_Remove…</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</property>
</object>
</property>
</object>
</child>
</template>
</interface>