Skip to content

Commit 98700ed

Browse files
committed
cinnamonMountOperation.js: Use StEntry's busy indicator, add setting
for 'remember' checkbox default state.
1 parent 2371c10 commit 98700ed

2 files changed

Lines changed: 25 additions & 24 deletions

File tree

data/org.cinnamon.gschema.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,15 @@
611611
<default>""</default>
612612
<summary>Stores the position of the hoverclick window so it can be restored there later - format is x::y</summary>
613613
</key>
614+
<key name="remember-mount-password" type="b">
615+
<default>false</default>
616+
<summary>Whether to remember password for mounting encrypted or remote filesystems</summary>
617+
<description>
618+
When an encrypted device or remote filesystem is mounted, a password
619+
dialog may include a "Remember Password" checkbox. This key stores the
620+
default state of that checkbox.
621+
</description>
622+
</key>
614623
</schema>
615624

616625
<schema id="org.cinnamon.theme" path="/org/cinnamon/theme/"

js/ui/cinnamonMountOperation.js

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
const { Clutter, Gio, GLib, GObject, Pango, Cinnamon, St } = imports.gi;
55

6-
// const Animation = imports.ui.animation;
76
const CheckBox = imports.ui.checkBox;
87
const Dialog = imports.ui.dialog;
98
const Main = imports.ui.main;
@@ -15,7 +14,6 @@ const CinnamonEntry = imports.ui.cinnamonEntry;
1514
const Util = imports.misc.util;
1615

1716
var LIST_ITEM_ICON_SIZE = 48;
18-
var WORK_SPINNER_ICON_SIZE = 16;
1917

2018
const REMEMBER_MOUNT_PASSWORD_KEY = 'remember-mount-password';
2119

@@ -379,17 +377,10 @@ var CinnamonMountPasswordDialog = GObject.registerClass({
379377
this.setInitialKeyFocus(this._passwordEntry);
380378
CinnamonEntry.addContextMenu(this._passwordEntry);
381379

382-
// this._workSpinner = new Animation.Spinner(WORK_SPINNER_ICON_SIZE, {
383-
// animate: true,
384-
// });
385-
386-
if (rtl) {
387-
// passwordGridLayout.attach(this._workSpinner, 0, curGridRow, 1, 1);
380+
if (rtl)
388381
passwordGridLayout.attach(this._passwordEntry, 1, curGridRow, 1, 1);
389-
} else {
382+
else
390383
passwordGridLayout.attach(this._passwordEntry, 0, curGridRow, 1, 1);
391-
// passwordGridLayout.attach(this._workSpinner, 1, curGridRow, 1, 1);
392-
}
393384
curGridRow += 1;
394385

395386
let warningBox = new St.BoxLayout({ vertical: true });
@@ -409,14 +400,14 @@ var CinnamonMountPasswordDialog = GObject.registerClass({
409400

410401
content.add_child(passwordGrid);
411402

412-
// if (flags & Gio.AskPasswordFlags.SAVING_SUPPORTED) {
413-
// this._rememberChoice = new CheckBox.CheckBox(_("Remember Password"));
414-
// // this._rememberChoice.checked =
415-
// // global.settings.get_boolean(REMEMBER_MOUNT_PASSWORD_KEY);
416-
// content.add_child(this._rememberChoice);
417-
// } else {
418-
// this._rememberChoice = null;
419-
// }
403+
if (flags & Gio.AskPasswordFlags.SAVING_SUPPORTED) {
404+
this._rememberChoice = new CheckBox.CheckBox(_("Remember Password"));
405+
this._rememberChoice.checked =
406+
global.settings.get_boolean(REMEMBER_MOUNT_PASSWORD_KEY);
407+
content.add_child(this._rememberChoice);
408+
} else {
409+
this._rememberChoice = null;
410+
}
420411

421412
this.contentLayout.add_child(content);
422413

@@ -452,15 +443,16 @@ var CinnamonMountPasswordDialog = GObject.registerClass({
452443
}
453444

454445
reaskPassword() {
455-
// this._workSpinner.stop();
446+
this._passwordEntry.end_busy();
456447
this._passwordEntry.set_text('');
457-
this._errorMessageLabel.text = _('Sorry, that didn’t work. Please try again.');
448+
this._errorMessageLabel.text = _('Please try again');
458449
this._errorMessageLabel.opacity = 255;
459450

460451
Util.wiggle(this._passwordEntry);
461452
}
462453

463454
_onCancelButton() {
455+
this._passwordEntry.end_busy();
464456
this.emit('response', -1, '', false, false, false, 0);
465457
}
466458

@@ -483,10 +475,10 @@ var CinnamonMountPasswordDialog = GObject.registerClass({
483475
this._errorMessageLabel.opacity = 0;
484476
}
485477

486-
// global.settings.set_boolean(REMEMBER_MOUNT_PASSWORD_KEY,
487-
// this._rememberChoice && this._rememberChoice.checked);
478+
global.settings.set_boolean(REMEMBER_MOUNT_PASSWORD_KEY,
479+
this._rememberChoice && this._rememberChoice.checked);
488480

489-
// this._workSpinner.play();
481+
this._passwordEntry.start_busy();
490482
this.emit('response', 1,
491483
this._passwordEntry.get_text(),
492484
this._rememberChoice &&

0 commit comments

Comments
 (0)