[gnome-shell] autorun: use GError.matches() to fix some FIXMEs



commit f7c0f826d4e1054f7cb0bc12379b8de0c4c75791
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Jun 20 16:35:29 2012 -0400

    autorun: use GError.matches() to fix some FIXMEs
    
    Discard FAILED_HANDLED errors, now that we can detect them from JS.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=674962

 js/ui/automountManager.js |    4 +++-
 js/ui/autorunManager.js   |   24 +++++++++---------------
 2 files changed, 12 insertions(+), 16 deletions(-)
---
diff --git a/js/ui/automountManager.js b/js/ui/automountManager.js
index d6cc3b7..12ba99c 100644
--- a/js/ui/automountManager.js
+++ b/js/ui/automountManager.js
@@ -268,7 +268,9 @@ const AutomountManager = new Lang.Class({
             if (e.message.indexOf('No key available with this passphrase') != -1) {
                 this._reaskPassword(volume);
             } else {
-                log('Unable to mount volume ' + volume.get_name() + ': ' + e.toString());
+                if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED))
+                    log('Unable to mount volume ' + volume.get_name() + ': ' + e.toString());
+
                 this._closeOperation(volume);
             }
         }
diff --git a/js/ui/autorunManager.js b/js/ui/autorunManager.js
index be4eba2..099573b 100644
--- a/js/ui/autorunManager.js
+++ b/js/ui/autorunManager.js
@@ -226,11 +226,9 @@ const AutorunManager = new Lang.Class({
         try {
             mount.unmount_with_operation_finish(res);
         } catch (e) {
-            // FIXME: we need to ignore G_IO_ERROR_FAILED_HANDLED errors here
-            // but we can't access the error code from JS.
-            // See https://bugzilla.gnome.org/show_bug.cgi?id=591480
-            log('Unable to eject the mount ' + mount.get_name() 
-                + ': ' + e.toString());
+            if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED))
+                log('Unable to eject the mount ' + mount.get_name() 
+                    + ': ' + e.toString());
         }
     },
 
@@ -238,11 +236,9 @@ const AutorunManager = new Lang.Class({
         try {
             source.eject_with_operation_finish(res);
         } catch (e) {
-            // FIXME: we need to ignore G_IO_ERROR_FAILED_HANDLED errors here
-            // but we can't access the error code from JS.
-            // See https://bugzilla.gnome.org/show_bug.cgi?id=591480
-            log('Unable to eject the drive ' + source.get_name() 
-                + ': ' + e.toString());
+            if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED))
+                log('Unable to eject the drive ' + source.get_name()
+                    + ': ' + e.toString());
         }
     },
 
@@ -250,11 +246,9 @@ const AutorunManager = new Lang.Class({
         try {
             drive.stop_finish(res);
         } catch (e) {
-            // FIXME: we need to ignore G_IO_ERROR_FAILED_HANDLED errors here
-            // but we can't access the error code from JS.
-            // See https://bugzilla.gnome.org/show_bug.cgi?id=591480
-            log('Unable to stop the drive ' + drive.get_name() 
-                + ': ' + e.toString());
+            if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED))
+                log('Unable to stop the drive ' + drive.get_name() 
+                    + ': ' + e.toString());
         }
     },
 });



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]