summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorHaxk20 <14281-Haxk20@users.noreply.gitlab.gnome.org>2019-07-22 15:13:45 +0000
committerBenjamin Berg <benjamin@sipsolutions.net>2019-08-26 12:01:16 +0000
commitc005e42dbe13e8fd552c6a48015fcc1b58512e05 (patch)
treea67853deac7c43a7d74cc2079c7af296b7ed939f /plugins
parentd50a37563663b5a263157d20047522a904b86e0f (diff)
downloadgnome-settings-daemon-c005e42dbe13e8fd552c6a48015fcc1b58512e05.tar.gz
media-keys: Add support for volume steps in code
Grab the value of the key into a variable and adjust volume steps according to it.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/media-keys/gsd-media-keys-manager.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 4b0af3d5..e59a47e8 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -117,7 +117,7 @@ static const gchar introspection_xml[] =
#define TOUCHPAD_ENABLED_KEY "send-events"
#define HIGH_CONTRAST "HighContrast"
-#define VOLUME_STEP 6 /* percents for one volume button press */
+#define VOLUME_STEP "volume-step"
#define VOLUME_STEP_PRECISE 2
#define MAX_VOLUME 65536.0
@@ -1512,7 +1512,7 @@ do_sound_action (GsdMediaKeysManager *manager,
GsdMediaKeysManagerPrivate *priv = GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE (manager);
GvcMixerStream *stream = NULL;
gboolean old_muted, new_muted;
- guint old_vol, new_vol, norm_vol_step;
+ guint old_vol, new_vol, norm_vol_step, vol_step;
gboolean sound_changed;
/* Find the stream that corresponds to the device, if any */
@@ -1535,11 +1535,13 @@ do_sound_action (GsdMediaKeysManager *manager,
if (stream == NULL)
return;
- if (flags & SOUND_ACTION_FLAG_IS_PRECISE)
+ if (flags & SOUND_ACTION_FLAG_IS_PRECISE) {
norm_vol_step = PA_VOLUME_NORM * VOLUME_STEP_PRECISE / 100;
- else
- norm_vol_step = PA_VOLUME_NORM * VOLUME_STEP / 100;
-
+ }
+ else {
+ vol_step = g_settings_get_int (priv->settings, VOLUME_STEP);
+ norm_vol_step = PA_VOLUME_NORM * vol_step / 100;
+ }
/* FIXME: this is racy */
new_vol = old_vol = gvc_mixer_stream_get_volume (stream);
new_muted = old_muted = gvc_mixer_stream_get_is_muted (stream);