Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose orientation lock setting #126

Merged
merged 6 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions data/io.elementary.SettingsDaemon.AccountsService.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@
<annotation name="org.freedesktop.Accounts.DefaultValue" value="Roboto Mono 10"/>
</property>

<property name="OrientationLock" type="s" access="readwrite">
<annotation name="org.freedesktop.Accounts.DefaultValue" value="false"/>
</property>

<property name="NightLightEnabled" type="b" access="readwrite">
<annotation name="org.freedesktop.Accounts.DefaultValue" value="false"/>
</property>
Expand Down
1 change: 1 addition & 0 deletions src/AccountsService.vala
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public interface SettingsDaemon.AccountsService : Object {
public abstract string document_font_name { owned get; set; }
public abstract string font_name { owned get; set; }
public abstract string monospace_font_name { owned get; set; }
public abstract bool orientation_lock { get; set; }

/* Night Light */
public struct Coordinates {
Expand Down
8 changes: 8 additions & 0 deletions src/Backends/InterfaceSettings.vala
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ public class SettingsDaemon.Backends.InterfaceSettings : GLib.Object {
private const string FONT_NAME = "font-name";
private const string MONOSPACE_FONT_NAME = "monospace-font-name";

private const string ORIENTATION_LOCK = "orientation-lock";

public unowned AccountsService accounts_service { get; construct; }
public unowned DisplayManager.AccountsService display_manager_accounts_service { get; construct; }

private GLib.Settings interface_settings;
private GLib.Settings background_settings;
private GLib.Settings touchscreen_settings;

public InterfaceSettings (AccountsService accounts_service, DisplayManager.AccountsService display_manager_accounts_service) {
Object (
Expand All @@ -49,6 +52,7 @@ public class SettingsDaemon.Backends.InterfaceSettings : GLib.Object {
construct {
interface_settings = new GLib.Settings ("org.gnome.desktop.interface");
background_settings = new GLib.Settings ("org.gnome.desktop.background");
touchscreen_settings = new GLib.Settings ("org.gnome.settings-daemon.peripherals.touchscreen");

sync_gsettings_to_accountsservice ();

Expand Down Expand Up @@ -77,6 +81,8 @@ public class SettingsDaemon.Backends.InterfaceSettings : GLib.Object {
sync_background_to_greeter ();
}
});

touchscreen_settings.changed.connect (sync_gsettings_to_accountsservice);
}

private void sync_gsettings_to_accountsservice () {
Expand All @@ -93,6 +99,8 @@ public class SettingsDaemon.Backends.InterfaceSettings : GLib.Object {
accounts_service.document_font_name = interface_settings.get_string (DOCUMENT_FONT_NAME);
accounts_service.font_name = interface_settings.get_string (FONT_NAME);
accounts_service.monospace_font_name = interface_settings.get_string (MONOSPACE_FONT_NAME);

accounts_service.orientation_lock = touchscreen_settings.get_boolean (ORIENTATION_LOCK);
}

private void sync_background_to_greeter () {
Expand Down