[gnome-shell] runDialog: Better match style of other modal dialogs



commit 0c807bddaf4da593e532ed1718c7296186017bca
Author: Florian MÃllner <fmuellner gnome org>
Date:   Mon Oct 29 17:33:21 2012 +0100

    runDialog: Better match style of other modal dialogs
    
    Update the run dialog to
     - use a proper title
     - use dialog buttons
     - use the standard entry style
    
    https://bugzilla.gnome.org/show_bug.cgi?id=687127

 data/theme/gnome-shell.css |   36 +++++++++++++++---------------------
 js/ui/runDialog.js         |   36 ++++++++++++++++++++----------------
 2 files changed, 35 insertions(+), 37 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 2e4b82d..6c84d59 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -39,7 +39,6 @@ stage {
 /* small */
 .app-well-menu,
 .contact-details-status,
-.run-dialog-label,
 .run-dialog-error-label {
     font-size: 9pt;
 }
@@ -335,8 +334,7 @@ StScrollBar StButton#vhandle:active {
 
 #searchEntry,
 .notification StEntry,
-.login-dialog-prompt-entry,
-.prompt-dialog-password-entry {
+.modal-dialog StEntry {
     color: rgb(64, 64, 64);
     caret-color: rgb(64, 64, 64);
     font-size: 12pt;
@@ -346,6 +344,7 @@ StScrollBar StButton#vhandle:active {
 }
 
 #searchEntry,
+.run-dialog-entry,
 .notification StEntry {
     border: 2px solid rgba(245,245,245,0.2);
     background-gradient-start: rgba(5,5,6,0.1);
@@ -358,8 +357,7 @@ StScrollBar StButton#vhandle:active {
 #searchEntry:focus,
 #searchEntry:hover,
 .notification StEntry:focus,
-.login-dialog-prompt-entry,
-.prompt-dialog-password-entry {
+.modal-dialog StEntry {
     border: 2px solid rgb(136,138,133);
     background-gradient-start: rgb(200,200,200);
     background-gradient-end: white;
@@ -368,8 +366,7 @@ StScrollBar StButton#vhandle:active {
 }
 
 .notification StEntry:focus,
-.prompt-dialog-password-entry:focus,
-.login-dialog-prompt-entry:focus {
+.modal-dialog StEntry:focus {
     border: 2px solid #3465a4;
 }
 
@@ -386,8 +383,7 @@ StScrollBar StButton#vhandle:active {
 }
 
 .notification StEntry,
-.prompt-dialog-password-entry,
-.login-dialog-prompt-entry {
+.modal-dialog StEntry {
     border-radius: 5px;
     padding: 4px 4px;
 }
@@ -1646,25 +1642,23 @@ StScrollBar StButton#vhandle:active {
 
 /* Run Dialog */
 
+.run-dialog-label {
+    font-size: 12pt;
+    font-weight: bold;
+    color: #666666;
+    padding-bottom: .5em;
+}
+
 .run-dialog-error-box {
     padding-top: 15px;
     spacing: 5px;
 }
 
-.run-dialog-entry {
+.modal-dialog .run-dialog-entry {
+    font-size: 9pt;
     font-weight: bold;
     width: 23em;
-    selection-background-color: white;
-    selected-color: black;
-}
-
-.run-dialog {
-    border-radius: 16px;
-
-    padding-right: 21px;
-    padding-left: 21px;
-    padding-bottom: 15px;
-    padding-top: 15px;
+    selection-background-color: #333333;
 }
 
 .lightbox {
diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js
index b28b665..3db85d8 100644
--- a/js/ui/runDialog.js
+++ b/js/ui/runDialog.js
@@ -202,7 +202,7 @@ const RunDialog = new Lang.Class({
 
 
         let label = new St.Label({ style_class: 'run-dialog-label',
-                                   text: _("Please enter a command:") });
+                                   text: _("Enter a Command") });
 
         this.contentLayout.add(label, { y_align: St.Align.START });
 
@@ -236,6 +236,16 @@ const RunDialog = new Lang.Class({
 
         this._errorBox.hide();
 
+        this.setButtons([{ action: Lang.bind(this, this.close),
+                           label: _("Cancel"),
+                           key: Clutter.Escape },
+                         { action: Lang.bind(this,
+                               function() {
+                                   this._activate(false);
+                               }),
+                           label: _("Run"),
+                           isDefault: true }]);
+
         this._pathCompleter = new Gio.FilenameCompleter();
         this._commandCompleter = new CommandCompleter();
         this._group.connect('notify::visible', Lang.bind(this._commandCompleter, this._commandCompleter.update));
@@ -245,21 +255,7 @@ const RunDialog = new Lang.Class({
         this._entryText.connect('key-press-event', Lang.bind(this, function(o, e) {
             let symbol = e.get_key_symbol();
             if (symbol == Clutter.Return || symbol == Clutter.KP_Enter) {
-                this.popModal();
-                if (e.get_state() & Clutter.ModifierType.CONTROL_MASK)
-                    this._run(o.get_text(), true);
-                else
-                    this._run(o.get_text(), false);
-                if (!this._commandError)
-                    this.close();
-                else {
-                    if (!this.pushModal())
-                        this.close();
-                }
-                return true;
-            }
-            if (symbol == Clutter.Escape) {
-                this.close();
+                this._activate(e.get_state() & Clutter.ModifierType.CONTROL_MASK);
                 return true;
             }
             if (symbol == Clutter.slash) {
@@ -294,6 +290,14 @@ const RunDialog = new Lang.Class({
         }));
     },
 
+    _activate: function(inTerminal) {
+        this.popModal();
+        this._run(this._entryText.get_text(), inTerminal);
+        if (!this._commandError ||
+            !this.pushModal())
+            this.close();
+    },
+
     _getCompletion : function(text) {
         if (text.indexOf('/') != -1) {
             return this._pathCompleter.get_completion_suffix(text);



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