[gnome-shell] Clean up the presentation of errors in the run dialog



commit 912a30c5664f18e416a17c031a26cb89123a05d5
Author: William Jon McCann <jmccann redhat com>
Date:   Thu Jan 27 15:26:58 2011 -0500

    Clean up the presentation of errors in the run dialog
    
    Removes redundant text, better icon, and shows are better error when
    a command isn't found than "No such file or directory".

 data/Makefile.am            |    1 -
 data/theme/dialog-error.svg |  222 -------------------------------------------
 data/theme/gnome-shell.css  |   13 +--
 js/misc/util.js             |   17 ++-
 js/ui/runDialog.js          |   11 +-
 5 files changed, 22 insertions(+), 242 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 4e73e03..62eed7c 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -29,7 +29,6 @@ dist_theme_DATA =				\
 	theme/close.svg				\
 	theme/corner-ripple.png			\
 	theme/dash-placeholder.svg		\
-	theme/dialog-error.svg			\
 	theme/filter-selected.svg		\
 	theme/gnome-shell.css			\
 	theme/mosaic-view-active.svg		\
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index cf6f1eb..d6616aa 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -1080,17 +1080,16 @@ StTooltip StLabel {
     color: white;
 }
 
-.run-dialog-error-icon {
-    background-image: url("dialog-error.svg");
-    width: 36px;
-    height: 36px;
-}
-
 .run-dialog-error-label {
-    font-size: 16px;
+    font-size: 12px;
     color: white;
 }
 
+.run-dialog-error-box {
+    padding-top: 15px;
+    spacing: 5px;
+}
+
 .run-dialog-entry {
     font-size: 14px;
     font-weight: bold;
diff --git a/js/misc/util.js b/js/misc/util.js
index fc515eb..e2ec2c1 100644
--- a/js/misc/util.js
+++ b/js/misc/util.js
@@ -82,12 +82,17 @@ function trySpawn(argv)
                          GLib.SpawnFlags.SEARCH_PATH,
                          null, null);
     } catch (err) {
-        // The exception from gjs contains an error string like:
-        //   Error invoking GLib.spawn_command_line_async: Failed to
-        //   execute child process "foo" (No such file or directory)
-        // We are only interested in the part in the parentheses. (And
-        // we can't pattern match the text, since it gets localized.)
-        err.message = err.message.replace(/.*\((.+)\)/, '$1');
+        if (err.code == GLib.SpawnError.G_SPAWN_ERROR_NOENT) {
+            err.message = _("Command not found");
+        } else {
+            // The exception from gjs contains an error string like:
+            //   Error invoking GLib.spawn_command_line_async: Failed to
+            //   execute child process "foo" (No such file or directory)
+            // We are only interested in the part in the parentheses. (And
+            // we can't pattern match the text, since it gets localized.)
+            err.message = err.message.replace(/.*\((.+)\)/, '$1');
+        }
+
         throw err;
     }
 }
diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js
index 6d07ee2..a86e9bd 100644
--- a/js/ui/runDialog.js
+++ b/js/ui/runDialog.js
@@ -219,20 +219,20 @@ __proto__: ModalDialog.ModalDialog.prototype,
                          this._entryText.grab_key_focus();
                      }));
 
-        this._errorBox = new St.BoxLayout();
+        this._errorBox = new St.BoxLayout({ style_class: 'run-dialog-error-box' });
 
         this.contentLayout.add(this._errorBox, { expand: true });
 
-        let errorIcon = new St.Button({ style_class: 'run-dialog-error-icon' });
+        let errorIcon = new St.Icon({ icon_name: 'dialog-error', icon_size: 24, style_class: 'run-dialog-error-icon' });
 
-        this._errorBox.add(errorIcon);
+        this._errorBox.add(errorIcon, { y_align: St.Align.MIDDLE });
 
         this._commandError = false;
 
         this._errorMessage = new St.Label({ style_class: 'run-dialog-error-label' });
         this._errorMessage.clutter_text.line_wrap = true;
 
-        this._errorBox.add(this._errorMessage, { expand: true });
+        this._errorBox.add(this._errorMessage, { expand: true, y_align: St.Align.MIDDLE });
 
         this._errorBox.hide();
 
@@ -348,8 +348,7 @@ __proto__: ModalDialog.ModalDialog.prototype,
                 } else {
                     this._commandError = true;
 
-                    let errorStr = _("Execution of '%s' failed:").format(command) + '\n' + e.message;
-                    this._errorMessage.set_text(errorStr);
+                    this._errorMessage.set_text(e.message);
 
                     if (!this._errorBox.visible) {
                         let [errorBoxMinHeight, errorBoxNaturalHeight] = this._errorBox.get_preferred_height(-1);



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