gnome-shell/js/ui/status/autoRotate.js
Georges Basile Stavracas Neto 2d2172da32 quickSettings: Rename 'label' property to 'title'
We'll soon add a subtitle, so rename the label property to something
that is a bit more semantic.Add a warning when trying to set the old
'label' property.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2619>
2023-02-04 14:50:36 -03:00

46 lines
1.3 KiB
JavaScript

/* exported Indicator */
const {Gio, GObject} = imports.gi;
const SystemActions = imports.misc.systemActions;
const {QuickToggle, SystemIndicator} = imports.ui.quickSettings;
const RotationToggle = GObject.registerClass(
class RotationToggle extends QuickToggle {
_init() {
this._systemActions = new SystemActions.getDefault();
super._init({
title: _('Auto Rotate'),
});
this._systemActions.bind_property('can-lock-orientation',
this, 'visible',
GObject.BindingFlags.DEFAULT |
GObject.BindingFlags.SYNC_CREATE);
this._systemActions.bind_property('orientation-lock-icon',
this, 'icon-name',
GObject.BindingFlags.DEFAULT |
GObject.BindingFlags.SYNC_CREATE);
this._settings = new Gio.Settings({
schema_id: 'org.gnome.settings-daemon.peripherals.touchscreen',
});
this._settings.bind('orientation-lock',
this, 'checked',
Gio.SettingsBindFlags.INVERT_BOOLEAN);
this.connect('clicked',
() => this._systemActions.activateLockOrientation());
}
});
var Indicator = GObject.registerClass(
class Indicator extends SystemIndicator {
_init() {
super._init();
this.quickSettingsItems.push(new RotationToggle());
}
});