summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2023-05-27 01:08:58 +0200
committerJelle Raaijmakers <jelle@gmta.nl>2023-05-29 13:22:58 +0200
commitf38dcc64b518d3b7ba41d6b2702ec72303934376 (patch)
treee6aed55de93d0bee85d0b30a0ff34a8fc1711132 /Userland
parent8df7b4207888fcba94bfbc4a62c38442dcebb7bd (diff)
downloadserenity-f38dcc64b518d3b7ba41d6b2702ec72303934376.zip
AudioApplet: Store default config value in a single place
The hope is that this can later be used to: - verify that all accesses to the same key use the same default value, - and extract the default values more easily.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applets/Audio/main.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Applets/Audio/main.cpp b/Userland/Applets/Audio/main.cpp
index 8bce27ab30..be5e3070e3 100644
--- a/Userland/Applets/Audio/main.cpp
+++ b/Userland/Applets/Audio/main.cpp
@@ -24,6 +24,8 @@
#include <LibGfx/Palette.h>
#include <LibMain/Main.h>
+static constexpr bool audio_applet_show_percent_default = false;
+
class AudioWidget final : public GUI::Widget {
C_OBJECT_ABSTRACT(AudioWidget)
@@ -53,7 +55,7 @@ private:
AudioWidget(NonnullRefPtr<Audio::ConnectionToServer> audio_client, Array<VolumeBitmapPair, 5> volume_level_bitmaps)
: m_audio_client(move(audio_client))
, m_volume_level_bitmaps(move(volume_level_bitmaps))
- , m_show_percent(Config::read_bool("AudioApplet"sv, "Applet"sv, "ShowPercent"sv, false))
+ , m_show_percent(Config::read_bool("AudioApplet"sv, "Applet"sv, "ShowPercent"sv, audio_applet_show_percent_default))
{
m_audio_volume = static_cast<int>(m_audio_client->get_main_mix_volume() * 100);
m_audio_muted = m_audio_client->is_main_mix_muted();
@@ -246,7 +248,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->show();
// This positioning code depends on the window actually existing.
- static_cast<AudioWidget*>(window->main_widget())->set_audio_widget_size(Config::read_bool("AudioApplet"sv, "Applet"sv, "ShowPercent"sv, false));
+ static_cast<AudioWidget*>(window->main_widget())->set_audio_widget_size(Config::read_bool("AudioApplet"sv, "Applet"sv, "ShowPercent"sv, audio_applet_show_percent_default));
TRY(Core::System::pledge("stdio recvfd sendfd rpath"));