diff options
-rw-r--r-- | data/CMakeLists.txt | 21 | ||||
-rw-r--r-- | data/indicator-sound.conf.in | 8 | ||||
-rw-r--r-- | data/indicator-sound.desktop.in | 4 | ||||
-rw-r--r-- | data/indicator-sound.upstart.desktop.in | 9 | ||||
-rw-r--r-- | debian/changelog | 25 | ||||
-rw-r--r-- | debian/indicator-sound-crashdb.conf | 6 | ||||
-rwxr-xr-x | debian/rules | 7 | ||||
-rw-r--r-- | debian/source_indicator-sound.py | 16 | ||||
-rw-r--r-- | src/service.vala | 33 | ||||
-rw-r--r-- | src/sound-menu.vala | 11 | ||||
-rw-r--r-- | src/volume-control.vala | 16 |
11 files changed, 145 insertions, 11 deletions
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 565e652..80046f7 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -57,6 +57,27 @@ install( ) ########################### +# Upstart XDG Autostart Override +########################### + +set( + INDICATOR_SOUND_UPSTART_XDG_AUTOSTART + "${CMAKE_CURRENT_BINARY_DIR}/indicator-sound.upstart.desktop" +) + +configure_file( + "indicator-sound.upstart.desktop.in" + ${INDICATOR_SOUND_UPSTART_XDG_AUTOSTART} + @ONLY +) + +install( + FILES "${INDICATOR_SOUND_UPSTART_XDG_AUTOSTART}" + DESTINATION "${CMAKE_INSTALL_DATADIR}/upstart/xdg/autostart" + RENAME "indicator-sound.desktop" +) + +########################### # GSettings ########################### diff --git a/data/indicator-sound.conf.in b/data/indicator-sound.conf.in index a5f4b4d..4912b61 100644 --- a/data/indicator-sound.conf.in +++ b/data/indicator-sound.conf.in @@ -1,11 +1,9 @@ -description "Indicator Sound Backend" +description "Indicator Sound Service" -# Want to move to indicator-services-[start|end], but that's not all -# there yet. Use the signals that exist today for now. - -start on indicators-loaded or indicator-services-start +start on indicator-services-start stop on desktop-end or indicator-services-end respawn +respawn limit 2 10 exec @CMAKE_INSTALL_FULL_LIBEXECDIR@/indicator-sound/indicator-sound-service diff --git a/data/indicator-sound.desktop.in b/data/indicator-sound.desktop.in index aeb6440..b471893 100644 --- a/data/indicator-sound.desktop.in +++ b/data/indicator-sound.desktop.in @@ -2,8 +2,8 @@ Type=Application Name=Indicator Sound Exec=@CMAKE_INSTALL_FULL_LIBEXECDIR@/indicator-sound/indicator-sound-service -NotShowIn=Unity; +OnlyShowIn=Unity;XFCE;GNOME; NoDisplay=true StartupNotify=false Terminal=false - +AutostartCondition=GNOME3 unless-session gnome diff --git a/data/indicator-sound.upstart.desktop.in b/data/indicator-sound.upstart.desktop.in new file mode 100644 index 0000000..37dfc7d --- /dev/null +++ b/data/indicator-sound.upstart.desktop.in @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Application +Name=Indicator Sound +Exec=@CMAKE_INSTALL_FULL_LIBEXECDIR@/indicator-sound/indicator-sound-service +OnlyShowIn=Unity;XFCE; +NoDisplay=true +StartupNotify=false +Terminal=false +Hidden=true diff --git a/debian/changelog b/debian/changelog index bc53fe2..d878559 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,28 @@ +indicator-sound (12.10.2+14.04.20140320-0ubuntu1) trusty; urgency=low + + [ Lars Uebernickel ] + * Scale volume in notifications when allow-amplified-volume is set + (LP: #1293163) + * Use audio-volume-mute-blocking-panel instead of *-blocked-panel + + -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Thu, 20 Mar 2014 08:58:30 +0000 + +indicator-sound (12.10.2+14.04.20140318-0ubuntu1) trusty; urgency=low + + [ Lars Uebernickel ] + * Show a red icon in the panel when a sound is playing while mute is + on (LP: #1291530) + + -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 18 Mar 2014 10:01:01 +0000 + +indicator-sound (12.10.2+14.04.20140313-0ubuntu1) trusty; urgency=low + + [ Lars Uebernickel ] + * Don't show player sections on the greeter and lock screen (LP: + #1280378) + + -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Thu, 13 Mar 2014 15:33:11 +0000 + indicator-sound (12.10.2+14.04.20140311.1-0ubuntu1) trusty; urgency=low [ Lars Uebernickel ] diff --git a/debian/indicator-sound-crashdb.conf b/debian/indicator-sound-crashdb.conf new file mode 100644 index 0000000..42e04f7 --- /dev/null +++ b/debian/indicator-sound-crashdb.conf @@ -0,0 +1,6 @@ + +indicator_sound = { + 'impl': 'launchpad', + 'project': 'indicator-sound', + 'bug_pattern_base': None, +} diff --git a/debian/rules b/debian/rules index 9a276dc..6df5436 100755 --- a/debian/rules +++ b/debian/rules @@ -5,3 +5,10 @@ export DPKG_GENSYMBOLS_CHECK_LEVEL=4 %: dh $@ --parallel --fail-missing --with translations +override_dh_install: + mkdir -p debian/indicator-sound/usr/share/apport/package-hooks/ + install -m 644 debian/source_indicator-sound.py debian/indicator-sound/usr/share/apport/package-hooks/ + mkdir -p debian/indicator-sound/etc/apport/crashdb.conf.d/ + install -m 644 debian/indicator-sound-crashdb.conf debian/indicator-sound/etc/apport/crashdb.conf.d/ + dh_install --fail-missing + diff --git a/debian/source_indicator-sound.py b/debian/source_indicator-sound.py new file mode 100644 index 0000000..90e8f4f --- /dev/null +++ b/debian/source_indicator-sound.py @@ -0,0 +1,16 @@ +import os.path +from apport.hookutils import * + +def attach_command_output(report, command_list, key): + log = command_output(command_list) + if not log or log[:5] == "Error": + return + report[key] = log + +def add_info(report): + if not apport.packaging.is_distro_package(report['Package'].split()[0]): + report['ThirdParty'] = 'True' + report['CrashDB'] = 'indicator_sound' + + if not 'StackTrace' in report: + attach_command_output(report, ['gdbus', 'call', '--session', '--dest', 'com.canonical.indicator.sound', '--object-path', '/com/canonical/indicator/sound', '--method', 'org.gtk.Actions.DescribeAll'], 'ActionStates') diff --git a/src/service.vala b/src/service.vala index 2b21275..d4a5bc6 100644 --- a/src/service.vala +++ b/src/service.vala @@ -38,7 +38,7 @@ public class IndicatorSound.Service: Object { this.actions.add_action (this.create_mic_volume_action ()); this.menus = new HashTable<string, SoundMenu> (str_hash, str_equal); - this.menus.insert ("desktop_greeter", new SoundMenu (null, SoundMenu.DisplayFlags.SHOW_MUTE)); + this.menus.insert ("desktop_greeter", new SoundMenu (null, SoundMenu.DisplayFlags.SHOW_MUTE | SoundMenu.DisplayFlags.HIDE_PLAYERS)); this.menus.insert ("desktop", new SoundMenu ("indicator.desktop-settings", SoundMenu.DisplayFlags.SHOW_MUTE)); this.menus.insert ("phone", new SoundMenu ("indicator.phone-settings", SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS)); @@ -113,6 +113,8 @@ public class IndicatorSound.Service: Object { VolumeControl volume_control; MediaPlayerList players; uint player_action_update_id; + bool mute_blocks_sound; + uint sound_was_blocked_timeout_id; Notify.Notification notification; bool syncing_preferred_players = false; @@ -141,7 +143,7 @@ public class IndicatorSound.Service: Object { icon = "notification-audio-volume-high"; this.notification.update ("indicator-sound", "", icon); - this.notification.set_hint_int32 ("value", ((int32) (100 * v)).clamp (-1, 101)); + this.notification.set_hint_int32 ("value", ((int32) (100 * v / this.max_volume)).clamp (-1, 101)); try { this.notification.show (); } @@ -186,7 +188,7 @@ public class IndicatorSound.Service: Object { double volume = this.volume_control.get_volume (); string icon; if (this.volume_control.mute) - icon = "audio-volume-muted-panel"; + icon = this.mute_blocks_sound ? "audio-volume-muted-blocking-panel" : "audio-volume-muted-panel"; else if (volume <= 0.0) icon = "audio-volume-low-zero-panel"; else if (volume <= 0.3) @@ -229,6 +231,31 @@ public class IndicatorSound.Service: Object { this.update_root_icon (); }); + this.volume_control.notify["is-playing"].connect( () => { + if (!this.volume_control.mute) { + this.mute_blocks_sound = false; + return; + } + + if (this.volume_control.is_playing) { + this.mute_blocks_sound = true; + } + else if (this.mute_blocks_sound) { + /* Continue to show the blocking icon five seconds after a player has tried to play something */ + if (this.sound_was_blocked_timeout_id > 0) + Source.remove (this.sound_was_blocked_timeout_id); + + this.sound_was_blocked_timeout_id = Timeout.add_seconds (5, () => { + this.mute_blocks_sound = false; + this.sound_was_blocked_timeout_id = 0; + this.update_root_icon (); + return false; + }); + } + + this.update_root_icon (); + }); + return mute_action; } diff --git a/src/sound-menu.vala b/src/sound-menu.vala index 480e1cf..3fdfc36 100644 --- a/src/sound-menu.vala +++ b/src/sound-menu.vala @@ -22,7 +22,8 @@ class SoundMenu: Object public enum DisplayFlags { NONE = 0, SHOW_MUTE = 1, - HIDE_INACTIVE_PLAYERS = 2 + HIDE_INACTIVE_PLAYERS = 2, + HIDE_PLAYERS = 4 } public SoundMenu (string? settings_action, DisplayFlags flags) { @@ -55,6 +56,7 @@ class SoundMenu: Object this.root = new Menu (); root.append_item (root_item); + this.hide_players = (flags & DisplayFlags.HIDE_PLAYERS) != 0; this.hide_inactive = (flags & DisplayFlags.HIDE_INACTIVE_PLAYERS) != 0; this.notify_handlers = new HashTable<MediaPlayer, ulong> (direct_hash, direct_equal); } @@ -119,6 +121,7 @@ class SoundMenu: Object bool mic_volume_shown; bool settings_shown = false; bool hide_inactive; + bool hide_players = false; HashTable<MediaPlayer, ulong> notify_handlers; /* returns the position in this.menu of the section that's associated with @player */ @@ -137,6 +140,9 @@ class SoundMenu: Object } void insert_player_section (MediaPlayer player) { + if (this.hide_players) + return; + var section = new Menu (); Icon icon; @@ -166,6 +172,9 @@ class SoundMenu: Object } void remove_player_section (MediaPlayer player) { + if (this.hide_players) + return; + int index = this.find_player_section (player); if (index >= 0) this.menu.remove (index); diff --git a/src/volume-control.vala b/src/volume-control.vala index 97d980c..4347ce5 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -39,6 +39,7 @@ public class VolumeControl : Object private PulseAudio.Context context; private bool _mute = true; + private bool _is_playing = false; private double _volume = 0.0; private double _mic_volume = 0.0; @@ -114,6 +115,13 @@ public class VolumeControl : Object this.notify_property ("mute"); } + var playing = (i.state == PulseAudio.SinkState.RUNNING); + if (_is_playing != playing) + { + _is_playing = playing; + this.notify_property ("is-playing"); + } + if (_volume != volume_to_double (i.volume.values[0])) { _volume = volume_to_double (i.volume.values[0]); @@ -263,6 +271,14 @@ public class VolumeControl : Object } } + public bool is_playing + { + get + { + return this._is_playing; + } + } + /* Volume operations */ private static PulseAudio.Volume double_to_volume (double vol) { |