[gnome-shell] keyring: Fix dialog layout in RTL locales
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] keyring: Fix dialog layout in RTL locales
- Date: Fri, 12 Sep 2014 11:27:47 +0000 (UTC)
commit 1b9318c82f9be357648d10c9a289f42642e781bc
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Sep 12 12:27:14 2014 +0200
keyring: Fix dialog layout in RTL locales
Another case of "StTable used to handle this for us" ...
js/ui/components/keyring.js | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/components/keyring.js b/js/ui/components/keyring.js
index 17b632a..0d99cf0 100644
--- a/js/ui/components/keyring.js
+++ b/js/ui/components/keyring.js
@@ -84,6 +84,7 @@ const KeyringDialog = new Lang.Class({
let table = new St.Widget({ style_class: 'keyring-dialog-control-table',
layout_manager: layout });
layout.hookup_style(table);
+ let rtl = table.get_text_direction() == Clutter.TextDirection.RTL;
let row = 0;
if (this.prompt.password_visible) {
@@ -92,7 +93,6 @@ const KeyringDialog = new Lang.Class({
y_align: Clutter.ActorAlign.CENTER });
label.set_text(_("Password:"));
label.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
- layout.attach(label, 0, row, 1, 1);
this._passwordEntry = new St.Entry({ style_class: 'prompt-dialog-password-entry',
text: '',
can_focus: true,
@@ -100,7 +100,14 @@ const KeyringDialog = new Lang.Class({
this._passwordEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE
ShellEntry.addContextMenu(this._passwordEntry, { isPassword: true });
this._passwordEntry.clutter_text.connect('activate', Lang.bind(this, this._onPasswordActivate));
- layout.attach(this._passwordEntry, 1, row, 1, 1);
+
+ if (rtl) {
+ layout.attach(this._passwordEntry, 0, row, 1, 1);
+ layout.attach(label, 1, row, 1, 1);
+ } else {
+ layout.attach(label, 0, row, 1, 1);
+ layout.attach(this._passwordEntry, 1, row, 1, 1);
+ }
row++;
} else {
this._passwordEntry = null;
@@ -111,7 +118,6 @@ const KeyringDialog = new Lang.Class({
x_align: Clutter.ActorAlign.START,
y_align: Clutter.ActorAlign.CENTER }));
label.set_text(_("Type again:"));
- layout.attach(label, 0, row, 1, 1);
this._confirmEntry = new St.Entry({ style_class: 'prompt-dialog-password-entry',
text: '',
can_focus: true,
@@ -119,7 +125,13 @@ const KeyringDialog = new Lang.Class({
this._confirmEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE
ShellEntry.addContextMenu(this._confirmEntry, { isPassword: true });
this._confirmEntry.clutter_text.connect('activate', Lang.bind(this, this._onConfirmActivate));
- layout.attach(this._confirmEntry, 1, row, 1, 1);
+ if (rtl) {
+ layout.attach(this._confirmEntry, 0, row, 1, 1);
+ layout.attach(label, 1, row, 1, 1);
+ } else {
+ layout.attach(label, 0, row, 1, 1);
+ layout.attach(this._confirmEntry, 1, row, 1, 1);
+ }
row++;
} else {
this._confirmEntry = null;
@@ -132,7 +144,7 @@ const KeyringDialog = new Lang.Class({
let choice = new CheckBox.CheckBox();
this.prompt.bind_property('choice-label', choice.getLabelActor(), 'text',
GObject.BindingFlags.SYNC_CREATE);
this.prompt.bind_property('choice-chosen', choice.actor, 'checked',
GObject.BindingFlags.SYNC_CREATE | GObject.BindingFlags.BIDIRECTIONAL);
- layout.attach(choice.actor, 1, row, 1, 1);
+ layout.attach(choice.actor, rtl ? 0 : 1, row, 1, 1);
row++;
}
@@ -140,7 +152,7 @@ const KeyringDialog = new Lang.Class({
x_align: Clutter.ActorAlign.START });
warning.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
warning.clutter_text.line_wrap = true;
- layout.attach(warning, 1, row, 1, 1);
+ layout.attach(warning, rtl ? 0 : 1, row, 1, 1);
this.prompt.bind_property('warning-visible', warning, 'visible', GObject.BindingFlags.SYNC_CREATE);
this.prompt.bind_property('warning', warning, 'text', GObject.BindingFlags.SYNC_CREATE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]