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



commit 2a5351486a23dff4cf3ef782a1ce65daed52fe95
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 4d54c8a..d064388 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]