Skip to content
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 @@ -140,6 +140,10 @@
<annotation name="org.freedesktop.Accounts.DefaultValue" value="true"/>
</property>

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

<!-- Prefer dark schedule-->

<property name="PreferDarkSchedule" type="i" access="readwrite">
Expand Down
1 change: 1 addition & 0 deletions src/AccountsService.vala
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public interface SettingsDaemon.AccountsService : Object {

/* Wingpanel */
public abstract bool wingpanel_use_transparency { get; set; }
public abstract bool wingpanel_show_percentage { get; set; }

/* Prefer Dark Schedule (part of interface settings)*/
/* Last coordinates are reused for Night Light settings */
Expand Down
16 changes: 16 additions & 0 deletions src/Backends/InterfaceSettings.vala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ public class SettingsDaemon.Backends.InterfaceSettings : GLib.Object {
private const string PREFER_DARK_SCHEDULE_TO = "prefer-dark-schedule-to";

private const string ORIENTATION_LOCK = "orientation-lock";

private const string USE_TRANSPARENCY = "use-transparency";
private const string SHOW_PERCENTAGE = "show-percentage";

public unowned AccountsService accounts_service { get; construct; }
public unowned DisplayManager.AccountsService display_manager_accounts_service { get; construct; }
Expand All @@ -49,6 +51,7 @@ public class SettingsDaemon.Backends.InterfaceSettings : GLib.Object {
private GLib.Settings settings_daemon_settings;
private GLib.Settings touchscreen_settings;
private GLib.Settings? wingpanel_settings;
private GLib.Settings? wingpanel_power_settings;

public InterfaceSettings (AccountsService accounts_service, DisplayManager.AccountsService display_manager_accounts_service) {
Object (
Expand All @@ -68,6 +71,11 @@ public class SettingsDaemon.Backends.InterfaceSettings : GLib.Object {
wingpanel_settings = new GLib.Settings ("io.elementary.desktop.wingpanel");
}

var wingpanel_power_schema = SettingsSchemaSource.get_default ().lookup ("io.elementary.desktop.wingpanel.power", true);
if (wingpanel_power_schema != null && wingpanel_power_schema.has_key (SHOW_PERCENTAGE)) {
wingpanel_power_settings = new GLib.Settings ("io.elementary.desktop.wingpanel.power");
}

sync_gsettings_to_accountsservice ();

interface_settings.changed.connect ((key) => {
Expand Down Expand Up @@ -110,6 +118,10 @@ public class SettingsDaemon.Backends.InterfaceSettings : GLib.Object {
if (wingpanel_settings != null) {
wingpanel_settings.changed[USE_TRANSPARENCY].connect (sync_gsettings_to_accountsservice);
}

if (wingpanel_power_settings != null) {
wingpanel_power_settings.changed[SHOW_PERCENTAGE].connect (sync_gsettings_to_accountsservice);
}
}

private void sync_gsettings_to_accountsservice () {
Expand Down Expand Up @@ -151,6 +163,10 @@ public class SettingsDaemon.Backends.InterfaceSettings : GLib.Object {
if (wingpanel_settings != null) {
accounts_service.wingpanel_use_transparency = wingpanel_settings.get_boolean (USE_TRANSPARENCY);
}

if (wingpanel_power_settings != null) {
accounts_service.wingpanel_show_percentage = wingpanel_power_settings.get_boolean (SHOW_PERCENTAGE);
}
}

private void sync_background_to_greeter () {
Expand Down