Skip to content

Commit

Permalink
Expose orientation lock setting (#126)
Browse files Browse the repository at this point in the history
* Expose orientation lock setting

* Add orientation lock to xml file
  • Loading branch information
lenemter authored Jan 29, 2024
1 parent 5dddde8 commit 13db442
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
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

0 comments on commit 13db442

Please sign in to comment.