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

Proposed by Didier Roche-Tolomelli
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 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-Tolomelli

Changed Forwarded to simpy Bug

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

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

723. By Didier Roche-Tolomelli

Better wording

724. By Didier Roche-Tolomelli

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-Tolomelli

Rephase description in changelog and patch

726. By Didier Roche-Tolomelli

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

727. By Didier Roche-Tolomelli

Protect by detecting if gsettings schema is here

Revision history for this message
Amr Ibrahim (amribrahim1987) wrote :

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

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

Subscribers

People subscribed via source and target branches