diff --git a/js/ui/automountManager.js b/js/ui/automountManager.js index 7a22e1d06..a34a28f35 100644 --- a/js/ui/automountManager.js +++ b/js/ui/automountManager.js @@ -98,6 +98,12 @@ AutomountManager.prototype = { this._volumeMonitor.connect('volume-removed', Lang.bind(this, this._onVolumeRemoved)); + this._volumeMonitor.connect('drive-connected', + Lang.bind(this, + this._onDriveConnected)); + this._volumeMonitor.connect('drive-disconnected', + Lang.bind(this, + this._onDriveDisconnected)); Mainloop.idle_add(Lang.bind(this, this._startupMountAll)); }, @@ -123,6 +129,30 @@ AutomountManager.prototype = { return false; }, + _onDriveConnected: function() { + // if we're not in the current ConsoleKit session, + // or screensaver is active, don't play sounds + if (!this.ckListener.sessionActive) + return; + + if (this._ssProxy.screenSaverActive) + return; + + global.play_theme_sound(0, 'device-added-media'); + }, + + _onDriveDisconnected: function() { + // if we're not in the current ConsoleKit session, + // or screensaver is active, don't play sounds + if (!this.ckListener.sessionActive) + return; + + if (this._ssProxy.screenSaverActive) + return; + + global.play_theme_sound(0, 'device-removed-media'); + }, + _onVolumeAdded: function(monitor, volume) { this._checkAndMountVolume(volume); },