-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRotationToggle.vala
More file actions
29 lines (25 loc) · 959 Bytes
/
RotationToggle.vala
File metadata and controls
29 lines (25 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
* SPDX-License-Identifier: GPL-3.0-or-later
* SPDX-FileCopyrightText: 2023 elementary, Inc. (https://elementary.io)
*/
public class QuickSettings.RotationToggle: SettingsToggle {
public RotationToggle () {
Object (
label: _("Rotation Lock")
);
}
construct {
icon_name = "quick-settings-rotation-locked-symbolic";
settings_uri = "settings://display";
var touchscreen_settings = new Settings ("org.gnome.settings-daemon.peripherals.touchscreen");
touchscreen_settings.bind ("orientation-lock", this, "active", DEFAULT);
bind_property ("active", this, "icon-name", SYNC_CREATE, (binding, srcval, ref targetval) => {
if ((bool) srcval) {
targetval = "quick-settings-rotation-locked-symbolic";
} else {
targetval = "quick-settings-rotation-allowed-symbolic";
}
return true;
});
}
}