shellMountOperation: Move password entry to a grid

This prepares for additional UI elements added for TCRYPT support.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/126
This commit is contained in:
segfault 2019-04-07 23:33:34 +02:00 committed by Florian Müllner
parent 8167f20972
commit af26e2b212
2 changed files with 26 additions and 9 deletions

View File

@ -405,6 +405,11 @@ StScrollBar {
padding-bottom: 8px; padding-bottom: 8px;
} }
.prompt-dialog-grid {
spacing-rows: 15px;
spacing-columns: 1em;
}
/* Polkit Dialog */ /* Polkit Dialog */

View File

@ -289,22 +289,34 @@ var ShellMountPasswordDialog = class extends ModalDialog.ModalDialog {
let content = new Dialog.MessageDialogContent({ icon, title, body }); let content = new Dialog.MessageDialogContent({ icon, title, body });
this.contentLayout.add_actor(content); this.contentLayout.add_actor(content);
this._passwordBox = new St.BoxLayout({ vertical: false, style_class: 'prompt-dialog-password-box' }); let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL });
content.messageBox.add(this._passwordBox); let grid = new St.Widget({ style_class: 'prompt-dialog-grid',
layout_manager: layout });
layout.hookup_style(grid);
this._passwordLabel = new St.Label(({ style_class: 'prompt-dialog-password-label', let rtl = grid.get_text_direction() === Clutter.TextDirection.RTL;
text: _("Password") }));
this._passwordBox.add(this._passwordLabel, { y_fill: false, y_align: St.Align.MIDDLE });
this._passwordLabel = new St.Label({ style_class: 'prompt-dialog-password-label',
text: _("Password"),
y_align: Clutter.ActorAlign.CENTER });
this._passwordEntry = new St.Entry({ style_class: 'prompt-dialog-password-entry', this._passwordEntry = new St.Entry({ style_class: 'prompt-dialog-password-entry',
text: "", can_focus: true,
can_focus: true}); x_expand: true});
ShellEntry.addContextMenu(this._passwordEntry, { isPassword: true });
this._passwordEntry.clutter_text.connect('activate', this._onEntryActivate.bind(this)); this._passwordEntry.clutter_text.connect('activate', this._onEntryActivate.bind(this));
this._passwordEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE this._passwordEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE
this._passwordBox.add(this._passwordEntry, {expand: true }); ShellEntry.addContextMenu(this._passwordEntry, { isPassword: true });
this.setInitialKeyFocus(this._passwordEntry); this.setInitialKeyFocus(this._passwordEntry);
if (rtl) {
layout.attach(this._passwordEntry, 0, 0, 1, 1);
layout.attach(this._passwordLabel, 1, 0, 1, 1);
} else {
layout.attach(this._passwordLabel, 0, 0, 1, 1);
layout.attach(this._passwordEntry, 1, 0, 1, 1);
}
content.messageBox.add(grid);
this._errorMessageLabel = new St.Label({ style_class: 'prompt-dialog-error-label', this._errorMessageLabel = new St.Label({ style_class: 'prompt-dialog-error-label',
text: _("Sorry, that didnt work. Please try again.") }); text: _("Sorry, that didnt work. Please try again.") });
this._errorMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; this._errorMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;