aboutsummaryrefslogtreecommitdiff
path: root/src/options-gsettings.vala
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2022-02-24 23:21:17 +0100
committerRobert Tari <robert@tari.in>2022-02-25 10:17:22 +0100
commitb7cd72a3516ec69e3d0125a9531806a6d5e27f2e (patch)
tree8fcbcdd1adf92e91b387617c735b595e99057160 /src/options-gsettings.vala
parentcf2029ce4f96c14bf4bf711fd971983201a7be00 (diff)
downloadayatana-indicator-sound-b7cd72a3516ec69e3d0125a9531806a6d5e27f2e.tar.gz
ayatana-indicator-sound-b7cd72a3516ec69e3d0125a9531806a6d5e27f2e.tar.bz2
ayatana-indicator-sound-b7cd72a3516ec69e3d0125a9531806a6d5e27f2e.zip
src/options-gsettings.vala: Use shared settings on Lomiri only
Diffstat (limited to 'src/options-gsettings.vala')
-rw-r--r--src/options-gsettings.vala20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/options-gsettings.vala b/src/options-gsettings.vala
index 6230158..7c83afe 100644
--- a/src/options-gsettings.vala
+++ b/src/options-gsettings.vala
@@ -1,7 +1,7 @@
/*
* -*- Mode:Vala; indent-tabs-mode:t; tab-width:4; encoding:utf8 -*-
* Copyright 2015 Canonical Ltd.
- * Copyright 2021 Robert Tari
+ * Copyright 2021-2022 Robert Tari
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ public class IndicatorSound.OptionsGSettings : Options
private Settings _settings = new Settings ("org.ayatana.indicator.sound");
#if LOMIRI_FEATURES_ENABLED
- private Settings _shared_settings = new Settings ("com.lomiri.sound");
+ private Settings _shared_settings = null;
#endif
/** MAX VOLUME PROPERTY **/
@@ -46,7 +46,11 @@ public class IndicatorSound.OptionsGSettings : Options
_settings.changed[NORMAL_dB_KEY].connect(() => update_max_volume());
_settings.changed[AMP_dB_KEY].connect(() => update_max_volume());
#if LOMIRI_FEATURES_ENABLED
- _shared_settings.changed[ALLOW_AMP_KEY].connect(() => update_max_volume());
+ if (AyatanaCommon.utils_is_lomiri())
+ {
+ _shared_settings = new Settings ("com.lomiri.sound");
+ _shared_settings.changed[ALLOW_AMP_KEY].connect(() => update_max_volume());
+ }
#endif
update_max_volume();
}
@@ -60,19 +64,21 @@ public class IndicatorSound.OptionsGSettings : Options
}
}
private double calculate_max_volume () {
+
+ unowned string decibel_key = NORMAL_dB_KEY;
#if LOMIRI_FEATURES_ENABLED
- unowned string decibel_key = _shared_settings.get_boolean(ALLOW_AMP_KEY)
+ if (AyatanaCommon.utils_is_lomiri())
+ {
+ decibel_key = _shared_settings.get_boolean(ALLOW_AMP_KEY)
? AMP_dB_KEY
: NORMAL_dB_KEY;
-#else
- unowned string decibel_key = NORMAL_dB_KEY;
+ }
#endif
var volume_dB = _settings.get_double(decibel_key);
var volume_sw = PulseAudio.Volume.sw_from_dB (volume_dB);
return VolumeControlPulse.volume_to_double (volume_sw);
}
-
/** LOUD VOLUME **/
private const string LOUD_ENABLED_KEY = "warning-volume-enabled";