Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal dialog cleanups #12531

Merged
merged 3 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/ui/cinnamonEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class CapsLockWarning extends St.Label {
() => this._sync(true));
} else {
this._keymap.disconnect(this._stateChangedId);
this.stateChangedId = 0;
this._stateChangedId = 0;
}

this._sync(false);
Expand Down
25 changes: 17 additions & 8 deletions js/ui/modalDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ var State = {
*/
var ModalDialog = GObject.registerClass({
Properties: {
'state': GObject.ParamSpec.int('state', 'Dialog state', 'state',
GObject.ParamFlags.READABLE,
Math.min(...Object.values(State)),
Math.max(...Object.values(State)),
State.CLOSED)
'state': GObject.ParamSpec.int(
'state', 'Dialog state', 'state',
GObject.ParamFlags.READABLE,
Math.min(...Object.values(State)),
Math.max(...Object.values(State)),
State.CLOSED)
},
Signals: { 'opened': {}, 'closed': {} }
}, class ModalDialog extends St.Widget {
Expand All @@ -74,12 +75,16 @@ var ModalDialog = GObject.registerClass({
accessible_role: Atk.Role.DIALOG,
});

params = Params.parse(params, { cinnamonReactive: false,
styleClass: null });
params = Params.parse(params, {
cinnamonReactive: false,
styleClass: null,
destroyOnClose: true,
});

this._state = State.CLOSED;
this._hasModal = false;
this._cinnamonReactive = params.cinnamonReactive;
this._destroyOnClose = params.destroyOnClose;

Main.uiGroup.add_actor(this);

Expand Down Expand Up @@ -255,6 +260,9 @@ var ModalDialog = GObject.registerClass({
this._setState(State.CLOSED);
this.hide();
this.emit('closed');

if (this._destroyOnClose)
this.destroy();
}
});
}
Expand Down Expand Up @@ -386,7 +394,8 @@ class ConfirmDialog extends ModalDialog {
this.setButtons([
{
label: _("No"),
action: this.destroy.bind(this)
action: this.destroy.bind(this),
key: Clutter.KEY_Escape,
},
{
label: _("Yes"),
Expand Down
5 changes: 4 additions & 1 deletion js/ui/runDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ function completeCommand(text) {
var RunDialog = GObject.registerClass(
class RunDialog extends ModalDialog.ModalDialog {
_init() {
super._init({ styleClass: 'run-dialog'});
super._init({
styleClass: 'run-dialog',
destroyOnClose: false,
});

this._lockdownSettings = new Gio.Settings({ schema_id: LOCKDOWN_SCHEMA });
this._terminalSettings = new Gio.Settings({ schema_id: TERMINAL_SCHEMA });
Expand Down
Loading