Merge lp:~didrocks/gnome-control-center/sound-above-100 into lp:~ubuntu-desktop/gnome-control-center/ubuntu

Proposed by Didier Roche on 2017-07-26
Status: Merged
Merged at revision: 722
Proposed branch: lp:~didrocks/gnome-control-center/sound-above-100
Merge into: lp:~ubuntu-desktop/gnome-control-center/ubuntu
Diff against target: 190 lines (+161/-0) (has conflicts)
3 files modified
debian/changelog (+17/-0)
debian/patches/70_allow_sound_above_100.patch (+143/-0)
debian/patches/series (+1/-0)
Text conflict in debian/changelog
To merge this branch: bzr merge lp:~didrocks/gnome-control-center/sound-above-100
Reviewer Review Type Date Requested Status
Sebastien Bacher 2017-07-26 Pending
Review via email: mp+328065@code.launchpad.net

Description of the change

  * Add patch to expose settings allowing setting volume above 100%:
    - debian/patches/70_allow_sound_above_100.patch, adapt the patch from
      unity-control-center to only add a slightely reshaped UI (use of
      gtk switch and rephrasing). (LP: #1706524)

To post a comment you must log in.
722. By Didier Roche on 2017-07-26

Changed Forwarded to simpy Bug

Didier Roche (didrocks) wrote :

Pinging seb on that one as he did g-s-d review

723. By Didier Roche on 2017-08-04

Better wording

724. By Didier Roche on 2017-08-04

Only show the above 100% volume option if:
1. you are in an ubuntu session
2. the selected output supports amplified volume. If so:
   present the settings to google that on and off. It will enable
   GNOME Shell and media keys to set the sound above 100%. If not
   enabled, volume and sliders are all capped to 100%.

725. By Didier Roche on 2017-08-04

Rephase description in changelog and patch

726. By Didier Roche on 2017-08-04

Make it dependent on XDG_CURRENT_DESKTOP (which is what we are going
to use on other places).

727. By Didier Roche on 2017-08-10

Protect by detecting if gsettings schema is here

Amr Ibrahim (amribrahim1987) wrote :

There are typos in the code. See the inlined comments.

Didier Roche (didrocks) wrote :

We don't change old changelogs, the rest is applied,thanks!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2017-08-10 02:54:31 +0000
3+++ debian/changelog 2017-08-10 11:39:11 +0000
4@@ -1,9 +1,26 @@
5+<<<<<<< TREE
6 gnome-control-center (1:3.24.3-0ubuntu2) artful; urgency=medium
7
8 * No-change rebuild against latest libgtop2
9
10 -- Jeremy Bicha <jbicha@ubuntu.com> Wed, 09 Aug 2017 22:54:23 -0400
11
12+=======
13+gnome-control-center (1:3.24.3-0ubuntu2) UNRELEASED; urgency=medium
14+
15+ * Add patch to expose settings allowing setting volume above 100%:
16+ - debian/patches/70_allow_sound_above_100.patch, adapt the patch from
17+ unity-control-center to only add a slightely reshaped UI (use of
18+ gtk switch and rephrasing). Only show the above 100% volume option if:
19+ 1. you are in an ubuntu session
20+ 2. the selected output supports amplified volume. If so:
21+ present the settings to google that on and off. It will enable
22+ GNOME Shell and media keys to set the sound above 100%. If not
23+ enabled, volume and sliders are all capped to 100%. (LP: #1706524)
24+
25+ -- Didier Roche <didrocks@ubuntu.com> Mon, 24 Jul 2017 16:06:44 +0200
26+
27+>>>>>>> MERGE-SOURCE
28 gnome-control-center (1:3.24.3-0ubuntu1) artful; urgency=medium
29
30 * New upstream release
31
32=== added file 'debian/patches/70_allow_sound_above_100.patch'
33--- debian/patches/70_allow_sound_above_100.patch 1970-01-01 00:00:00 +0000
34+++ debian/patches/70_allow_sound_above_100.patch 2017-08-10 11:39:11 +0000
35@@ -0,0 +1,143 @@
36+Description: Allow volume to bet set above 100%.
37+ Some systems have low maximum volume set (like x220), allow, from an option
38+ in gnome-control-center to set it above that 100% limit from g-s-d
39+ (keyboard) and gnome-shell.
40+ Only show the above 100% volume option if:
41+ 1. you are in an ubuntu session
42+ 2. the selected output supports amplified volume. If so:
43+ present the settings to google that on and off. It will enable
44+ GNOME Shell and media keys to set the sound above 100%. If not
45+ enabled, volume and sliders are all capped to 100%. (LP: #1706524)
46+ Modified from original patch in unity-control-center from Lars Uebernickel.
47+Origin: ubuntu
48+Bug-Ubuntu: https://launchpad.net/bugs/1706524
49+Bug: https://bugzilla.gnome.org/show_bug.cgi?id=710424
50+
51+Index: gnome-control-center-3.24.3/panels/sound/gvc-mixer-dialog.c
52+===================================================================
53+--- gnome-control-center-3.24.3.orig/panels/sound/gvc-mixer-dialog.c
54++++ gnome-control-center-3.24.3/panels/sound/gvc-mixer-dialog.c
55+@@ -48,6 +48,9 @@
56+
57+ #define GVC_MIXER_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_MIXER_DIALOG, GvcMixerDialogPrivate))
58+
59++#define AMPLIFIED_SETTINGS "com.ubuntu.sound"
60++#define AMPLIFIED_KEY "allow-amplified-volume"
61++
62+ struct GvcMixerDialogPrivate
63+ {
64+ GvcMixerControl *mixer_control;
65+@@ -77,6 +80,8 @@ struct GvcMixerDialogPrivate
66+ GtkWidget *audible_bell_button;
67+ GtkWidget *test_dialog;
68+ GtkSizeGroup *size_group;
69++ GtkWidget *amplified_volume_box;
70++ GSettings *ubuntu_sound_settings;
71+
72+ gdouble last_input_peak;
73+ guint num_apps;
74+@@ -188,8 +193,14 @@ update_output_settings (GvcMixerDialog
75+
76+ gvc_channel_bar_set_base_volume (GVC_CHANNEL_BAR (dialog->priv->output_bar),
77+ gvc_mixer_stream_get_base_volume (stream));
78++
79++ gboolean can_amplify = gvc_mixer_stream_get_can_decibel (stream);
80++ if (dialog->priv->ubuntu_sound_settings != NULL && can_amplify) {
81++ gtk_widget_set_sensitive(dialog->priv->amplified_volume_box, can_amplify);
82++ can_amplify = g_settings_get_boolean(dialog->priv->ubuntu_sound_settings, AMPLIFIED_KEY);
83++ }
84+ gvc_channel_bar_set_is_amplified (GVC_CHANNEL_BAR (dialog->priv->output_bar),
85+- gvc_mixer_stream_get_can_decibel (stream));
86++ can_amplify);
87+
88+ /* Update the adjustment in case the previous bar wasn't decibel
89+ * capable, and we clipped it */
90+@@ -1595,6 +1606,37 @@ on_test_speakers_clicked (GvcComboBox *w
91+ gtk_widget_destroy (d);
92+ }
93+
94++static void
95++on_amplify_changed (GSettings *settings,
96++ const char *key,
97++ GvcMixerDialog *self)
98++{
99++ GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self->priv->output_treeview));
100++ GtkTreeModel *model;
101++ GtkTreeIter iter;
102++ gboolean active;
103++ guint id;
104++ GvcMixerUIDevice *output;
105++
106++ if (gtk_tree_selection_get_selected (selection, &model, &iter) == FALSE) {
107++ g_debug ("Could not get default output from selection");
108++ return;
109++ }
110++
111++ gtk_tree_model_get (model, &iter,
112++ ID_COLUMN, &id,
113++ ACTIVE_COLUMN, &active,
114++ -1);
115++ if (!active)
116++ return;
117++
118++ output = gvc_mixer_control_lookup_output_id (self->priv->mixer_control, id);
119++
120++ // refresh our output bar UI
121++ update_output_settings(self, output);
122++}
123++
124++
125+ static GObject *
126+ gvc_mixer_dialog_constructor (GType type,
127+ guint n_construct_properties,
128+@@ -1608,6 +1650,8 @@ gvc_mixer_dialog_constructor (GType
129+ GtkWidget *box;
130+ GtkWidget *sbox;
131+ GtkWidget *ebox;
132++ GtkWidget *amplified_volume_box;
133++ GtkWidget *allow_amplify_switch;
134+ GSList *streams;
135+ GSList *l;
136+ GvcMixerStream *stream;
137+@@ -1633,6 +1677,23 @@ gvc_mixer_dialog_constructor (GType
138+ gtk_box_pack_start (GTK_BOX (self->priv->output_stream_box),
139+ self->priv->output_bar, TRUE, TRUE, 12);
140+
141++ if (self->priv->ubuntu_sound_settings != NULL) {
142++ self->priv->amplified_volume_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
143++ gtk_box_pack_start (GTK_BOX (main_vbox), self->priv->amplified_volume_box, FALSE, FALSE, 12);
144++ label = gtk_label_new (_("Allow louder than 100%"));
145++ allow_amplify_switch = gtk_switch_new ();
146++ gtk_box_pack_start (GTK_BOX (self->priv->amplified_volume_box), label, FALSE, FALSE, 12);
147++ g_settings_bind (self->priv->ubuntu_sound_settings, AMPLIFIED_KEY,
148++ allow_amplify_switch, "active", G_SETTINGS_BIND_DEFAULT);
149++ gtk_box_pack_start (GTK_BOX (self->priv->amplified_volume_box), allow_amplify_switch, FALSE, FALSE, 0);
150++
151++ self->priv->output_stream_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
152++ gtk_widget_set_margin_top (self->priv->output_stream_box, 12);
153++
154++ g_signal_connect (self->priv->ubuntu_sound_settings, "changed::" AMPLIFIED_KEY,
155++ G_CALLBACK (on_amplify_changed), self);
156++ }
157++
158+ self->priv->notebook = gtk_notebook_new ();
159+ gtk_box_pack_start (GTK_BOX (main_vbox),
160+ self->priv->notebook,
161+@@ -1905,6 +1966,17 @@ gvc_mixer_dialog_init (GvcMixerDialog *d
162+ dialog->priv = GVC_MIXER_DIALOG_GET_PRIVATE (dialog);
163+ dialog->priv->bars = g_hash_table_new (NULL, NULL);
164+ dialog->priv->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
165++ if (strstr (g_getenv("XDG_CURRENT_DESKTOP"), "ubuntu") != NULL) {
166++ GSettingsSchema *schema;
167++ schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default(),
168++ AMPLIFIED_SETTINGS, TRUE);
169++
170++ if (schema != NULL)
171++ {
172++ dialog->priv->ubuntu_sound_settings = g_settings_new_full (schema, NULL, NULL);
173++ g_settings_schema_unref (schema);
174++ }
175++ }
176+ }
177+
178+ static void
179
180=== modified file 'debian/patches/series'
181--- debian/patches/series 2017-04-22 18:55:19 +0000
182+++ debian/patches/series 2017-08-10 11:39:11 +0000
183@@ -4,6 +4,7 @@
184 08_lowercase_user_names.patch
185 52_region_language.patch
186 64_restore_terminal_keyboard_shortcut.patch
187+70_allow_sound_above_100.patch
188 92_ubuntu_system_proxy.patch
189 99_add_lock-on-suspend.patch
190 ubuntu_external_panels.patch

Subscribers

People subscribed via source and target branches