[gnome-shell/hotplug: 20/21] automount: emit sounds when a drive is connected/disconnected



commit 6dc53b8868af34abd0f6ce9d1e41cbc13efbaff6
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Jun 27 11:51:23 2011 -0400

    automount: emit sounds when a drive is connected/disconnected

 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 ea75ae8..89941df 100644
--- a/js/ui/automountManager.js
+++ b/js/ui/automountManager.js
@@ -161,6 +161,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));
     },
 
     _screenSaverActiveChanged: function(object, isActive) {
@@ -196,6 +202,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]