Merge lp:~dylanmccall/ubuntu/natty/gnome-settings-daemon/fix-748805 into lp:ubuntu/natty/gnome-settings-daemon

Proposed by Dylan McCall
Status: Work in progress
Proposed branch: lp:~dylanmccall/ubuntu/natty/gnome-settings-daemon/fix-748805
Merge into: lp:ubuntu/natty/gnome-settings-daemon
Diff against target: 204 lines (+41/-28)
2 files modified
debian/changelog (+8/-0)
debian/patches/16_use_synchronous_notifications.patch (+33/-28)
To merge this branch: bzr merge lp:~dylanmccall/ubuntu/natty/gnome-settings-daemon/fix-748805
Reviewer Review Type Date Requested Status
Chris Coulson (community) Needs Information
Ubuntu branches Pending
Review via email: mp+56096@code.launchpad.net

Description of the change

This is a fix for bug #748805. It replaces the code to select an icon for the volume change notification bubble. My replacement uses the same approach as indicator-sound, to resolve consistency issues between these two.

In the same vein, I added support for the notification-audio-volume-off icon, which was available (and is used by indicator-sound's notifications) but it wasn't used here.

To post a comment you must log in.
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

From the bug you said "I decided to change our patch for gnome-settings-daemon, since the existing stuff was a little complex and it wouldn't look pretty inside indicator-sound. (I assume the settings daemon patch inherits that complexity from the original overlay, which had a fancy fading effect)".

Note that this complexity in the code exists to make it easily portable to other applications (we copy and paste the exact same code in gnome-power-manager for example. Even though gnome-power-manager uses a different number of icons, we're able to do this because the thresholds were spaced out in a linear fashion). However, this change actually makes virtually all of gsd-osd-notification.{c/h} pretty pointless now, so you could probably strip most of it out. With the spacing between the icon thresholds being completely uneven, it makes it virtually impossible for this code to be portable anymore.

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

With this change, when pressing the volume-down key, doesn't gnome-settings-daemon skip the "notification-audio-volume-off" icon still at zero volume?

review: Needs Information
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Just to clarify, if you press the volume down key whilst current volume < volume step, gnome-settings-daemon sets "muted" internally in addition to setting the new volume to zero. This means that the following code should never evaluate to true when muted == FALSE:

 } else if (value == 0) {
            s = 1;

...which means that you should never see "notification-audio-volume-off", so it will still be out of sync with the sound indicator.

Note, I've not actually tried your patch out yet, so apologies if I'm wrong. But, that's what I think will happen based on my initial review.

To fix this, I think you'd need to also change do_sound_action() so that it only sets muted if the volume down key is pressed AND the current volume is already zero. Does that makes sense?

Revision history for this message
Dylan McCall (dylanmccall) wrote :

Ah, thanks for the information! Good to know that about the icon selection code. Do you think this belongs more in the indicators, then? (/me wonders if the power indicator does the same thing…)

The volume == 0 case occurs when we turn the volume to 0, then unmute :)
(Actually I could have sworn seeing it increase the volume a little in that case, but I may have been imagining it; it's doing what I describe right now, anyway).

I do like the idea about the muting behaviour, though, but that's another file to patch. Maybe we should bring it up upstream…

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Remember that the current upstream code is in sync with the volume applet in gnome-media, so they don't really have this problem. It's only a problem for us because our sound indicator defines the thresholds differently

Revision history for this message
Dylan McCall (dylanmccall) wrote :

Looks like the mute on zero volume stuff is discussed and patched at bug #332081.

Right now, (I have been dogfooding this for a few days), something higher up tells the notification code that it is muted, even though it isn't. Thanks especially to the proximity between the notification and indicator-sound, this gives us something that looks plain wrong: a big, red Muted icon right next to an icon that (correctly) says the volume is actually not muted; just turned down to zero.

So, I think that should still be fixed in the name of consistency (maybe it can go upstream…), but should I propose the alternative change for icon selection over at indicator-sound instead? I'm happy to do that :)

Unmerged revisions

129. By Dylan McCall

* debian/patches/16_use_synchronous_notifications.patch:
  - Choose icons the same way as indicator-sound (LP: #748805)
  - Use notification-audio-volume-off icon

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 2011-03-31 18:03:24 +0000
3+++ debian/changelog 2011-04-04 02:29:23 +0000
4@@ -1,3 +1,11 @@
5+gnome-settings-daemon (2.32.1-0ubuntu13) UNRELEASED; urgency=low
6+
7+ * debian/patches/16_use_synchronous_notifications.patch:
8+ - Choose icons the same way as indicator-sound (LP: #748805)
9+ - Use notification-audio-volume-off icon
10+
11+ -- Dylan McCall <dylanmccall@ubuntu.com> Sat, 02 Apr 2011 22:02:04 -0700
12+
13 gnome-settings-daemon (2.32.1-0ubuntu12) natty; urgency=low
14
15 * debian/patches/93_wait_for_xsettings.patch:
16
17=== modified file 'debian/patches/16_use_synchronous_notifications.patch'
18--- debian/patches/16_use_synchronous_notifications.patch 2010-06-10 12:49:47 +0000
19+++ debian/patches/16_use_synchronous_notifications.patch 2011-04-04 02:29:23 +0000
20@@ -1,11 +1,11 @@
21 Description: Use synchronous notifications when they are supported
22 Author: ?
23
24-Index: gnome-settings-daemon-2.30.0/plugins/common/gsd-osd-notification.c
25+Index: gnome-settings-daemon-2.32.1/plugins/common/gsd-osd-notification.c
26 ===================================================================
27 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
28-+++ gnome-settings-daemon-2.30.0/plugins/common/gsd-osd-notification.c 2010-04-23 17:05:08.862133020 +0100
29-@@ -0,0 +1,296 @@
30++++ gnome-settings-daemon-2.32.1/plugins/common/gsd-osd-notification.c 2011-04-02 21:48:36.418675531 -0700
31+@@ -0,0 +1,300 @@
32 +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*- */
33 +/*
34 + * gsd-osd-notification.c
35@@ -58,13 +58,17 @@
36 +static const char*
37 +_calculate_icon (GsdOsdNotification *notifier, guint value, gboolean muted)
38 +{
39-+ guint s;
40++ guint s = 2;
41 +
42-+ s = (notifier->priv->icon_array_size -1) * value / 100 + 1;
43-+ s = MAX (s, 1);
44-+ s = MIN (s, notifier->priv->icon_array_size -1);
45-+ if (value <= 0)
46-+ s = 0;
47++ if (value < 30 && value > 0) {
48++ s = 2;
49++ } else if (value < 70 && value >= 30) {
50++ s = 3;
51++ } else if (value >= 70) {
52++ s = 4;
53++ } else if (value == 0) {
54++ s = 1;
55++ }
56 +
57 + return muted ? notifier->priv->icon_names[0] : notifier->priv->icon_names[s];
58 +}
59@@ -302,10 +306,10 @@
60 +
61 + g_type_class_add_private (klass, sizeof (GsdOsdNotificationPrivate));
62 +}
63-Index: gnome-settings-daemon-2.30.0/plugins/common/gsd-osd-notification.h
64+Index: gnome-settings-daemon-2.32.1/plugins/common/gsd-osd-notification.h
65 ===================================================================
66 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
67-+++ gnome-settings-daemon-2.30.0/plugins/common/gsd-osd-notification.h 2010-04-23 17:05:08.862133020 +0100
68++++ gnome-settings-daemon-2.32.1/plugins/common/gsd-osd-notification.h 2011-04-02 21:22:40.306959188 -0700
69 @@ -0,0 +1,75 @@
70 +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*- */
71 +/*
72@@ -382,10 +386,10 @@
73 +G_END_DECLS
74 +
75 +#endif /* _GSD_OSD_NOTIFICATION_H_ */
76-Index: gnome-settings-daemon-2.30.0/plugins/media-keys/gsd-media-keys-manager.c
77+Index: gnome-settings-daemon-2.32.1/plugins/media-keys/gsd-media-keys-manager.c
78 ===================================================================
79---- gnome-settings-daemon-2.30.0.orig/plugins/media-keys/gsd-media-keys-manager.c 2010-03-29 09:15:04.000000000 +0100
80-+++ gnome-settings-daemon-2.30.0/plugins/media-keys/gsd-media-keys-manager.c 2010-04-23 17:05:08.862133020 +0100
81+--- gnome-settings-daemon-2.32.1.orig/plugins/media-keys/gsd-media-keys-manager.c 2011-04-02 21:22:27.974898039 -0700
82++++ gnome-settings-daemon-2.32.1/plugins/media-keys/gsd-media-keys-manager.c 2011-04-02 21:22:40.310959209 -0700
83 @@ -49,6 +49,7 @@
84 #include "eggaccelerators.h"
85 #include "acme.h"
86@@ -402,12 +406,13 @@
87
88 /* Multihead stuff */
89 GdkScreen *current_screen;
90-@@ -108,6 +110,13 @@
91+@@ -108,6 +110,14 @@
92
93 static gpointer manager_object = NULL;
94
95 +static const char *volume_icons[] = {
96 + "notification-audio-volume-muted",
97++ "notification-audio-volume-off",
98 + "notification-audio-volume-low",
99 + "notification-audio-volume-medium",
100 + "notification-audio-volume-high",
101@@ -416,7 +421,7 @@
102
103 static void
104 init_screens (GsdMediaKeysManager *manager)
105-@@ -612,11 +621,13 @@
106+@@ -612,11 +622,13 @@
107 }
108
109 /* Show the dialogue */
110@@ -435,7 +440,7 @@
111
112 /* Clean up the drive selection and exit if no suitable
113 * drives are found */
114-@@ -641,23 +652,44 @@
115+@@ -641,23 +653,44 @@
116 GConfClient *client = manager->priv->conf_client;
117 gboolean state = gconf_client_get_bool (client, TOUCHPAD_ENABLED_KEY, NULL);
118
119@@ -486,7 +491,7 @@
120 vol = CLAMP (vol, 0, 100);
121
122 dialog_init (manager);
123-@@ -668,12 +700,18 @@
124+@@ -668,12 +701,18 @@
125 GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME);
126 dialog_show (manager);
127
128@@ -511,7 +516,7 @@
129 }
130
131 static void
132-@@ -683,6 +721,7 @@
133+@@ -683,6 +722,7 @@
134 gboolean muted;
135 guint vol, norm_vol_step;
136 int vol_step;
137@@ -519,7 +524,7 @@
138 gboolean sound_changed;
139
140 if (manager->priv->stream == NULL)
141-@@ -722,7 +761,10 @@
142+@@ -722,7 +762,10 @@
143 if (gvc_mixer_stream_set_volume (manager->priv->stream, vol) != FALSE) {
144 gvc_mixer_stream_push_volume (manager->priv->stream);
145 sound_changed = TRUE;
146@@ -530,7 +535,7 @@
147 }
148 break;
149 case VOLUME_UP_KEY:
150-@@ -750,12 +792,14 @@
151+@@ -750,12 +793,14 @@
152 gvc_mixer_stream_push_volume (manager->priv->stream);
153 sound_changed = TRUE;
154 }
155@@ -546,7 +551,7 @@
156 }
157
158 static void
159-@@ -900,8 +944,11 @@
160+@@ -900,8 +945,11 @@
161
162 static gboolean
163 do_multimedia_player_action (GsdMediaKeysManager *manager,
164@@ -558,7 +563,7 @@
165 return gsd_media_player_key_pressed (manager, key);
166 }
167
168-@@ -972,19 +1019,19 @@
169+@@ -972,19 +1020,19 @@
170 execute (manager, "gcalctool", FALSE, FALSE);
171 break;
172 case PLAY_KEY:
173@@ -583,7 +588,7 @@
174 break;
175 default:
176 g_assert_not_reached ();
177-@@ -1121,6 +1168,8 @@
178+@@ -1121,6 +1169,8 @@
179
180 gvc_mixer_control_open (manager->priv->volume);
181
182@@ -592,7 +597,7 @@
183 gnome_settings_profile_end ("gvc_mixer_control_new");
184 #endif /* HAVE_PULSE */
185 g_idle_add ((GSourceFunc) start_media_keys_idle_cb, manager);
186-@@ -1218,6 +1267,9 @@
187+@@ -1218,6 +1268,9 @@
188 }
189 g_list_free (priv->media_players);
190 priv->media_players = NULL;
191@@ -602,10 +607,10 @@
192 }
193
194 static void
195-Index: gnome-settings-daemon-2.30.0/plugins/common/Makefile.am
196+Index: gnome-settings-daemon-2.32.1/plugins/common/Makefile.am
197 ===================================================================
198---- gnome-settings-daemon-2.30.0.orig/plugins/common/Makefile.am 2010-03-10 11:59:38.000000000 +0000
199-+++ gnome-settings-daemon-2.30.0/plugins/common/Makefile.am 2010-04-23 17:10:43.209632216 +0100
200+--- gnome-settings-daemon-2.32.1.orig/plugins/common/Makefile.am 2011-04-02 21:22:28.002898184 -0700
201++++ gnome-settings-daemon-2.32.1/plugins/common/Makefile.am 2011-04-02 21:22:40.310959209 -0700
202 @@ -7,17 +7,21 @@
203 gsd-keygrab.c \
204 gsd-keygrab.h \

Subscribers

People subscribed via source and target branches

to all changes: