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
This commit is contained in:
Florian Müllner 2012-10-29 17:33:21 +01:00
parent a0470bfc66
commit 0c807bddaf
2 changed files with 35 additions and 37 deletions

View File

@ -39,7 +39,6 @@ stage {
/* small */ /* small */
.app-well-menu, .app-well-menu,
.contact-details-status, .contact-details-status,
.run-dialog-label,
.run-dialog-error-label { .run-dialog-error-label {
font-size: 9pt; font-size: 9pt;
} }
@ -335,8 +334,7 @@ StScrollBar StButton#vhandle:active {
#searchEntry, #searchEntry,
.notification StEntry, .notification StEntry,
.login-dialog-prompt-entry, .modal-dialog StEntry {
.prompt-dialog-password-entry {
color: rgb(64, 64, 64); color: rgb(64, 64, 64);
caret-color: rgb(64, 64, 64); caret-color: rgb(64, 64, 64);
font-size: 12pt; font-size: 12pt;
@ -346,6 +344,7 @@ StScrollBar StButton#vhandle:active {
} }
#searchEntry, #searchEntry,
.run-dialog-entry,
.notification StEntry { .notification StEntry {
border: 2px solid rgba(245,245,245,0.2); border: 2px solid rgba(245,245,245,0.2);
background-gradient-start: rgba(5,5,6,0.1); background-gradient-start: rgba(5,5,6,0.1);
@ -358,8 +357,7 @@ StScrollBar StButton#vhandle:active {
#searchEntry:focus, #searchEntry:focus,
#searchEntry:hover, #searchEntry:hover,
.notification StEntry:focus, .notification StEntry:focus,
.login-dialog-prompt-entry, .modal-dialog StEntry {
.prompt-dialog-password-entry {
border: 2px solid rgb(136,138,133); border: 2px solid rgb(136,138,133);
background-gradient-start: rgb(200,200,200); background-gradient-start: rgb(200,200,200);
background-gradient-end: white; background-gradient-end: white;
@ -368,8 +366,7 @@ StScrollBar StButton#vhandle:active {
} }
.notification StEntry:focus, .notification StEntry:focus,
.prompt-dialog-password-entry:focus, .modal-dialog StEntry:focus {
.login-dialog-prompt-entry:focus {
border: 2px solid #3465a4; border: 2px solid #3465a4;
} }
@ -386,8 +383,7 @@ StScrollBar StButton#vhandle:active {
} }
.notification StEntry, .notification StEntry,
.prompt-dialog-password-entry, .modal-dialog StEntry {
.login-dialog-prompt-entry {
border-radius: 5px; border-radius: 5px;
padding: 4px 4px; padding: 4px 4px;
} }
@ -1646,25 +1642,23 @@ StScrollBar StButton#vhandle:active {
/* Run Dialog */ /* Run Dialog */
.run-dialog-label {
font-size: 12pt;
font-weight: bold;
color: #666666;
padding-bottom: .5em;
}
.run-dialog-error-box { .run-dialog-error-box {
padding-top: 15px; padding-top: 15px;
spacing: 5px; spacing: 5px;
} }
.run-dialog-entry { .modal-dialog .run-dialog-entry {
font-size: 9pt;
font-weight: bold; font-weight: bold;
width: 23em; width: 23em;
selection-background-color: white; selection-background-color: #333333;
selected-color: black;
}
.run-dialog {
border-radius: 16px;
padding-right: 21px;
padding-left: 21px;
padding-bottom: 15px;
padding-top: 15px;
} }
.lightbox { .lightbox {

View File

@ -202,7 +202,7 @@ const RunDialog = new Lang.Class({
let label = new St.Label({ style_class: 'run-dialog-label', 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 }); this.contentLayout.add(label, { y_align: St.Align.START });
@ -236,6 +236,16 @@ const RunDialog = new Lang.Class({
this._errorBox.hide(); 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._pathCompleter = new Gio.FilenameCompleter();
this._commandCompleter = new CommandCompleter(); this._commandCompleter = new CommandCompleter();
this._group.connect('notify::visible', Lang.bind(this._commandCompleter, this._commandCompleter.update)); 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) { this._entryText.connect('key-press-event', Lang.bind(this, function(o, e) {
let symbol = e.get_key_symbol(); let symbol = e.get_key_symbol();
if (symbol == Clutter.Return || symbol == Clutter.KP_Enter) { if (symbol == Clutter.Return || symbol == Clutter.KP_Enter) {
this.popModal(); this._activate(e.get_state() & Clutter.ModifierType.CONTROL_MASK);
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();
return true; return true;
} }
if (symbol == Clutter.slash) { 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) { _getCompletion : function(text) {
if (text.indexOf('/') != -1) { if (text.indexOf('/') != -1) {
return this._pathCompleter.get_completion_suffix(text); return this._pathCompleter.get_completion_suffix(text);