[gnome-shell/hotplug: 12/13] automount: emit sounds when a drive is connected/disconnected
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/hotplug: 12/13] automount: emit sounds when a drive is connected/disconnected
- Date: Wed, 13 Jul 2011 13:59:12 +0000 (UTC)
commit 4515ccd36f5848826c6e0028d8382b75a0892751
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Jun 27 11:51:23 2011 -0400
automount: emit sounds when a drive is connected/disconnected
https://bugzilla.gnome.org/show_bug.cgi?id=653520
js/ui/automountManager.js | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/automountManager.js b/js/ui/automountManager.js
index 7a22e1d..a34a28f 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);
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]