automount: emit sounds when a drive is connected/disconnected

https://bugzilla.gnome.org/show_bug.cgi?id=653520
This commit is contained in:
Cosimo Cecchi 2011-06-27 11:51:23 -04:00
parent 0b77ea422a
commit 5133c3e010

View File

@ -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);
},