Merge lp:~ted/indicator-sound/upstart-job into lp:indicator-sound/13.10

Proposed by Ted Gould
Status: Superseded
Proposed branch: lp:~ted/indicator-sound/upstart-job
Merge into: lp:indicator-sound/13.10
Diff against target: 450 lines (+182/-62) (has conflicts)
10 files modified
.bzrignore (+1/-1)
data/CMakeLists.txt (+37/-17)
data/com.canonical.indicator.sound (+7/-0)
data/indicator-sound.conf.in (+11/-0)
data/indicator-sound.desktop.in (+9/-0)
data/indicator-sound.service.in (+0/-3)
debian/changelog (+7/-0)
src/service.vala (+11/-13)
src/sound-menu.vala (+70/-13)
src/volume-control.vala (+29/-15)
Text conflict in src/sound-menu.vala
To merge this branch: bzr merge lp:~ted/indicator-sound/upstart-job
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Charles Kerr (community) Needs Fixing
Review via email: mp+174442@code.launchpad.net

This proposal has been superseded by a proposal from 2013-10-29.

Commit message

Switch from D-Bus activation to Upstart User Session

Description of the change

Switching around the config files.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

Needs to be synced with pete's cmake changes.

Ted, why didn't you do that when you submitted this MP in mid-July? ;-)

review: Needs Fixing
lp:~ted/indicator-sound/upstart-job updated
356. By Ted Gould

Merge Trunk

Revision history for this message
Ted Gould (ted) wrote :

On Tue, 2013-08-27 at 14:42 +0000, Charles Kerr wrote:

> Needs to be synced with pete's cmake changes.
>
> Ted, why didn't you do that when you submitted this MP in mid-July? ;-)

Sorry forgot to push the last version ;-) Fixed.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~ted/indicator-sound/upstart-job updated
357. By Ted Gould

Dropping debugging for system-wide support

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~ted/indicator-sound/upstart-job updated
358. By Ted Gould

Merge trunk

359. By Ted Gould

Adding an XDG Autostart file

360. By Ted Gould

Forgot a var

Unmerged revisions

360. By Ted Gould

Forgot a var

359. By Ted Gould

Adding an XDG Autostart file

358. By Ted Gould

Merge trunk

357. By Ted Gould

Dropping debugging for system-wide support

356. By Ted Gould

Merge Trunk

355. By Ted Gould

Fixing directory

354. By Ted Gould

Switch from being dbus activated to being an upstart job

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2013-08-16 03:58:55 +0000
3+++ .bzrignore 2013-10-29 00:52:35 +0000
4@@ -1,7 +1,7 @@
5 /po/POTFILES
6 /po/stamp-it
7
8-/data/indicator-sound.service
9+/data/indicator-sound.conf
10
11 /src/indicator-sound-service
12 /src/indicator_sound_service_vala.stamp
13
14=== modified file 'data/CMakeLists.txt'
15--- data/CMakeLists.txt 2013-08-16 03:13:41 +0000
16+++ data/CMakeLists.txt 2013-10-29 00:52:35 +0000
17@@ -17,23 +17,43 @@
18 )
19
20 ###########################
21-# Dbus Service
22-###########################
23-
24-set(
25- INDICATOR_SOUND_SERVICE
26- "${CMAKE_CURRENT_BINARY_DIR}/indicator-sound.service"
27-)
28-
29-configure_file(
30- "indicator-sound.service.in"
31- ${INDICATOR_SOUND_SERVICE}
32- @ONLY
33-)
34-
35-install(
36- FILES "${INDICATOR_SOUND_SERVICE}"
37- DESTINATION "${CMAKE_INSTALL_DATADIR}/dbus-1/services/"
38+# Upstart Job
39+###########################
40+
41+set(
42+ INDICATOR_SOUND_CONF
43+ "${CMAKE_CURRENT_BINARY_DIR}/indicator-sound.conf"
44+)
45+
46+configure_file(
47+ "indicator-sound.conf.in"
48+ ${INDICATOR_SOUND_CONF}
49+ @ONLY
50+)
51+
52+install(
53+ FILES "${INDICATOR_SOUND_CONF}"
54+ DESTINATION "${CMAKE_INSTALL_DATADIR}/upstart/sessions/"
55+)
56+
57+###########################
58+# XDG Autostart
59+###########################
60+
61+set(
62+ INDICATOR_SOUND_XDG_AUTOSTART
63+ "${CMAKE_CURRENT_BINARY_DIR}/indicator-sound.desktop"
64+)
65+
66+configure_file(
67+ "indicator-sound.desktop.in"
68+ ${INDICATOR_SOUND_CONF}
69+ @ONLY
70+)
71+
72+install(
73+ FILES "${INDICATOR_SOUND_XDG_AUTOSTART}"
74+ DESTINATION "/etc/xdg/autostart"
75 )
76
77 ###########################
78
79=== modified file 'data/com.canonical.indicator.sound'
80--- data/com.canonical.indicator.sound 2013-10-02 19:14:14 +0000
81+++ data/com.canonical.indicator.sound 2013-10-29 00:52:35 +0000
82@@ -11,3 +11,10 @@
83
84 [desktop_greeter]
85 ObjectPath=/com/canonical/indicator/sound/desktop_greeter
86+
87+[ubiquity]
88+ObjectPath=/com/canonical/indicator/sound/desktop_greeter
89+
90+[phone_greeter]
91+ObjectPath=/com/canonical/indicator/sound/desktop_greeter
92+
93
94=== added file 'data/indicator-sound.conf.in'
95--- data/indicator-sound.conf.in 1970-01-01 00:00:00 +0000
96+++ data/indicator-sound.conf.in 2013-10-29 00:52:35 +0000
97@@ -0,0 +1,11 @@
98+description "Indicator Sound Backend"
99+
100+# Want to move to indicator-services-[start|end], but that's not all
101+# there yet. Use the signals that exist today for now.
102+
103+start on indicators-loaded or indicator-services-start
104+stop on desktop-end or indicator-services-end
105+
106+respawn
107+
108+exec @CMAKE_INSTALL_FULL_LIBEXECDIR@/indicator-sound/indicator-sound-service
109
110=== added file 'data/indicator-sound.desktop.in'
111--- data/indicator-sound.desktop.in 1970-01-01 00:00:00 +0000
112+++ data/indicator-sound.desktop.in 2013-10-29 00:52:35 +0000
113@@ -0,0 +1,9 @@
114+[Desktop Entry]
115+Type=Application
116+Name=Indicator Sound
117+Exec=@CMAKE_INSTALL_FULL_LIBEXECDIR@/indicator-sound/indicator-sound-service
118+NotShowIn=Unity;
119+NoDisplay=true
120+StartupNotify=false
121+Terminal=false
122+
123
124=== removed file 'data/indicator-sound.service.in'
125--- data/indicator-sound.service.in 2013-08-16 03:58:55 +0000
126+++ data/indicator-sound.service.in 1970-01-01 00:00:00 +0000
127@@ -1,3 +0,0 @@
128-[D-BUS Service]
129-Name=com.canonical.indicator.sound
130-Exec=@CMAKE_INSTALL_FULL_LIBEXECDIR@/indicator-sound/indicator-sound-service
131
132=== modified file 'debian/changelog'
133--- debian/changelog 2013-10-11 04:27:51 +0000
134+++ debian/changelog 2013-10-29 00:52:35 +0000
135@@ -1,3 +1,10 @@
136+indicator-sound (12.10.2+13.10.20131011-0ubuntu2) UNRELEASED; urgency=low
137+
138+ * Define "ubiquity" indicator profile, reusing the greeter object. (LP:
139+ #1241539)
140+
141+ -- Dmitrijs Ledkovs <xnox@ubuntu.com> Fri, 18 Oct 2013 13:10:03 +0100
142+
143 indicator-sound (12.10.2+13.10.20131011-0ubuntu1) saucy; urgency=low
144
145 [ Lars Uebernickel ]
146
147=== modified file 'src/service.vala'
148--- src/service.vala 2013-10-09 13:01:14 +0000
149+++ src/service.vala 2013-10-29 00:52:35 +0000
150@@ -34,9 +34,9 @@
151 this.actions.add_action (this.create_mic_volume_action ());
152
153 this.menus = new HashTable<string, SoundMenu> (str_hash, str_equal);
154- this.menus.insert ("desktop_greeter", new SoundMenu (true, null));
155- this.menus.insert ("desktop", new SoundMenu (true, "indicator.desktop-settings"));
156- this.menus.insert ("phone", new SoundMenu (false, "indicator.phone-settings"));
157+ this.menus.insert ("desktop_greeter", new SoundMenu (null, SoundMenu.DisplayFlags.SHOW_MUTE));
158+ this.menus.insert ("desktop", new SoundMenu ("indicator.desktop-settings", SoundMenu.DisplayFlags.SHOW_MUTE));
159+ this.menus.insert ("phone", new SoundMenu ("indicator.phone-settings", SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS));
160
161 this.menus.@foreach ( (profile, menu) => {
162 this.volume_control.bind_property ("active-mic", menu, "show-mic-volume", BindingFlags.SYNC_CREATE);
163@@ -120,9 +120,7 @@
164 void activate_desktop_settings (SimpleAction action, Variant? param) {
165 var env = Environment.get_variable ("DESKTOP_SESSION");
166 string cmd;
167- if (env == "unity")
168- cmd = "gnome-control-center sound-nua";
169- else if (env == "xubuntu" || env == "ubuntustudio")
170+ if (env == "xubuntu" || env == "ubuntustudio")
171 cmd = "pavucontrol";
172 else
173 cmd = "gnome-control-center sound";
174@@ -177,10 +175,10 @@
175 }
176
177 Action create_mute_action () {
178- var mute_action = new SimpleAction.stateful ("mute", null, this.volume_control.mute);
179+ var mute_action = new SimpleAction.stateful ("mute", null, new Variant.boolean (this.volume_control.mute));
180
181 mute_action.activate.connect ( (action, param) => {
182- action.change_state (!action.get_state ().get_boolean ());
183+ action.change_state (new Variant.boolean (!action.get_state ().get_boolean ()));
184 });
185
186 mute_action.change_state.connect ( (action, val) => {
187@@ -188,7 +186,7 @@
188 });
189
190 this.volume_control.notify["mute"].connect ( () => {
191- mute_action.set_state (this.volume_control.mute);
192+ mute_action.set_state (new Variant.boolean (this.volume_control.mute));
193 this.update_root_icon ();
194 });
195
196@@ -197,13 +195,13 @@
197
198 void volume_changed (double volume) {
199 var volume_action = this.actions.lookup_action ("volume") as SimpleAction;
200- volume_action.set_state (volume);
201+ volume_action.set_state (new Variant.double (volume));
202
203 this.update_root_icon ();
204 }
205
206 Action create_volume_action () {
207- var volume_action = new SimpleAction.stateful ("volume", VariantType.INT32, this.volume_control.get_volume ());
208+ var volume_action = new SimpleAction.stateful ("volume", VariantType.INT32, new Variant.double (this.volume_control.get_volume ()));
209
210 volume_action.change_state.connect ( (action, val) => {
211 volume_control.set_volume (val.get_double ());
212@@ -223,14 +221,14 @@
213 }
214
215 Action create_mic_volume_action () {
216- var volume_action = new SimpleAction.stateful ("mic-volume", null, this.volume_control.get_mic_volume ());
217+ var volume_action = new SimpleAction.stateful ("mic-volume", null, new Variant.double (this.volume_control.get_mic_volume ()));
218
219 volume_action.change_state.connect ( (action, val) => {
220 volume_control.set_mic_volume (val.get_double ());
221 });
222
223 this.volume_control.mic_volume_changed.connect ( (volume) => {
224- volume_action.set_state (volume);
225+ volume_action.set_state (new Variant.double (volume));
226 });
227
228 this.volume_control.bind_property ("ready", volume_action, "enabled", BindingFlags.SYNC_CREATE);
229
230=== modified file 'src/sound-menu.vala'
231--- src/sound-menu.vala 2013-10-28 23:54:31 +0000
232+++ src/sound-menu.vala 2013-10-29 00:52:35 +0000
233@@ -22,14 +22,20 @@
234
235 class SoundMenu: Object
236 {
237- public SoundMenu (bool show_mute, string? settings_action) {
238+ public enum DisplayFlags {
239+ NONE = 0,
240+ SHOW_MUTE = 1,
241+ HIDE_INACTIVE_PLAYERS = 2
242+ }
243+
244+ public SoundMenu (string? settings_action, DisplayFlags flags) {
245 /* A sound menu always has at least two sections: the volume section (this.volume_section)
246 * at the start of the menu, and the settings section at the end. Between those two,
247 * it has a dynamic amount of player sections, one for each registered player.
248 */
249
250 this.volume_section = new Menu ();
251- if (show_mute)
252+ if ((flags & DisplayFlags.SHOW_MUTE) != 0)
253 volume_section.append (_("Mute"), "indicator.mute");
254 volume_section.append_item (this.create_slider_menu_item ("indicator.volume(0)", 0.0, 1.0, 0.01,
255 "audio-volume-low-zero-panel",
256@@ -51,6 +57,9 @@
257
258 this.root = new Menu ();
259 root.append_item (root_item);
260+
261+ this.hide_inactive = (flags & DisplayFlags.HIDE_INACTIVE_PLAYERS) != 0;
262+ this.notify_handlers = new HashTable<MediaPlayer, ulong> (direct_hash, direct_equal);
263 }
264
265 public void export (DBusConnection connection, string object_path) {
266@@ -81,6 +90,7 @@
267 }
268
269 public void add_player (MediaPlayer player) {
270+<<<<<<< TREE
271 /* Add new players to the end of the player sections, just before the settings */
272 var player_item = new MenuItem (player.name, "indicator." + player.id);
273 player_item.set_attribute ("x-canonical-type", "s", "com.canonical.unity.media-player");
274@@ -99,22 +109,32 @@
275 var section = new Menu ();
276 section.append_item (player_item);
277 section.append_item (playback_item);
278+=======
279+ if (this.notify_handlers.contains (player))
280+ return;
281+
282+ if (player.is_running || !this.hide_inactive)
283+ this.insert_player_section (player);
284+ this.update_playlists (player);
285+
286+ var handler_id = player.notify["is-running"].connect ( () => {
287+ if (this.hide_inactive) {
288+ if (player.is_running)
289+ this.insert_player_section (player);
290+ else
291+ this.remove_player_section (player);
292+ }
293+ this.update_playlists (player);
294+ });
295+ this.notify_handlers.insert (player, handler_id);
296+>>>>>>> MERGE-SOURCE
297
298 player.playlists_changed.connect (this.update_playlists);
299- player.notify["is-running"].connect ( () => this.update_playlists (player) );
300- update_playlists (player);
301-
302- if (settings_shown) {
303- this.menu.insert_section (this.menu.get_n_items () -1, null, section);
304- } else {
305- this.menu.append_section (null, section);
306- }
307 }
308
309 public void remove_player (MediaPlayer player) {
310- int index = this.find_player_section (player);
311- if (index >= 0)
312- this.menu.remove (index);
313+ this.remove_player_section (player);
314+ this.notify_handlers.remove (player);
315 }
316
317 Menu root;
318@@ -122,6 +142,8 @@
319 Menu volume_section;
320 bool mic_volume_shown;
321 bool settings_shown = false;
322+ bool hide_inactive;
323+ HashTable<MediaPlayer, ulong> notify_handlers;
324
325 /* returns the position in this.menu of the section that's associated with @player */
326 int find_player_section (MediaPlayer player) {
327@@ -138,6 +160,41 @@
328 return -1;
329 }
330
331+ void insert_player_section (MediaPlayer player) {
332+ var section = new Menu ();
333+ Icon icon;
334+
335+ icon = player.icon;
336+ if (icon == null)
337+ icon = new ThemedIcon.with_default_fallbacks ("application-default-icon");
338+
339+ var player_item = new MenuItem (player.name, "indicator." + player.id);
340+ player_item.set_attribute ("x-canonical-type", "s", "com.canonical.unity.media-player");
341+ if (icon != null)
342+ player_item.set_attribute_value ("icon", g_icon_serialize (icon));
343+ section.append_item (player_item);
344+
345+ var playback_item = new MenuItem (null, null);
346+ playback_item.set_attribute ("x-canonical-type", "s", "com.canonical.unity.playback-item");
347+ playback_item.set_attribute ("x-canonical-play-action", "s", "indicator.play." + player.id);
348+ playback_item.set_attribute ("x-canonical-next-action", "s", "indicator.next." + player.id);
349+ playback_item.set_attribute ("x-canonical-previous-action", "s", "indicator.previous." + player.id);
350+ section.append_item (playback_item);
351+
352+ /* Add new players to the end of the player sections, just before the settings */
353+ if (settings_shown) {
354+ this.menu.insert_section (this.menu.get_n_items () -1, null, section);
355+ } else {
356+ this.menu.append_section (null, section);
357+ }
358+ }
359+
360+ void remove_player_section (MediaPlayer player) {
361+ int index = this.find_player_section (player);
362+ if (index >= 0)
363+ this.menu.remove (index);
364+ }
365+
366 void update_playlists (MediaPlayer player) {
367 int index = find_player_section (player);
368 if (index < 0)
369
370=== modified file 'src/volume-control.vala'
371--- src/volume-control.vala 2013-10-28 23:49:19 +0000
372+++ src/volume-control.vala 2013-10-29 00:52:35 +0000
373@@ -128,12 +128,14 @@
374 context.get_server_info (server_info_cb_for_props);
375 }
376
377+ private void update_source_get_server_info_cb (PulseAudio.Context c, PulseAudio.ServerInfo? i) {
378+ if (i != null)
379+ context.get_source_info_by_name (i.default_source_name, source_info_cb);
380+ }
381+
382 private void update_source ()
383 {
384- context.get_server_info ( (c, i) => {
385- if (i != null)
386- context.get_source_info_by_name (i.default_source_name, source_info_cb);
387- });
388+ context.get_server_info (update_source_get_server_info_cb);
389 }
390
391 private void source_output_info_cb (Context c, SourceOutputInfo? i, int eol)
392@@ -199,15 +201,25 @@
393 warning( "pa_context_connect() failed: %s\n", PulseAudio.strerror(context.errno()));
394 }
395
396+ void sink_info_list_callback_set_mute (PulseAudio.Context context, PulseAudio.SinkInfo? sink, int eol) {
397+ if (sink != null)
398+ context.set_sink_mute_by_index (sink.index, true, null);
399+ }
400+
401+ void sink_info_list_callback_unset_mute (PulseAudio.Context context, PulseAudio.SinkInfo? sink, int eol) {
402+ if (sink != null)
403+ context.set_sink_mute_by_index (sink.index, false, null);
404+ }
405+
406 /* Mute operations */
407 public void set_mute (bool mute)
408 {
409 return_if_fail (context.get_state () == Context.State.READY);
410
411- context.get_sink_info_list ((context, sink, eol) => {
412- if (sink != null)
413- context.set_sink_mute_by_index (sink.index, mute, null);
414- });
415+ if (mute)
416+ context.get_sink_info_list (sink_info_list_callback_set_mute);
417+ else
418+ context.get_sink_info_list (sink_info_list_callback_unset_mute);
419 }
420
421 public void toggle_mute ()
422@@ -277,19 +289,21 @@
423 mic_volume_changed (_mic_volume);
424 }
425
426+ void set_mic_volume_get_server_info_cb (PulseAudio.Context c, PulseAudio.ServerInfo? i) {
427+ if (i != null) {
428+ unowned CVolume cvol = CVolume ();
429+ cvol = vol_set (cvol, 1, double_to_volume (_mic_volume));
430+ c.set_source_volume_by_name (i.default_source_name, cvol, set_mic_volume_success_cb);
431+ }
432+ }
433+
434 public void set_mic_volume (double volume)
435 {
436 return_if_fail (context.get_state () == Context.State.READY);
437
438 _mic_volume = volume;
439
440- context.get_server_info ( (c, i) => {
441- if (i != null) {
442- unowned CVolume cvol = CVolume ();
443- cvol = vol_set (cvol, 1, double_to_volume (_mic_volume));
444- c.set_source_volume_by_name (i.default_source_name, cvol, set_mic_volume_success_cb);
445- }
446- });
447+ context.get_server_info (set_mic_volume_get_server_info_cb);
448 }
449
450 public double get_volume ()

Subscribers

People subscribed via source and target branches