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 */
.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 {

View File

@ -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);