Skip to content

Commit

Permalink
pref/positionsize: use #private properties
Browse files Browse the repository at this point in the history
  • Loading branch information
amezin committed Feb 2, 2025
1 parent 9f851f9 commit a1bb8ea
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions ddterm/pref/positionsize.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export const PositionSizeWidget = GObject.registerClass({
),
},
}, class PrefsPositionSize extends Gtk.Grid {
#monitors = null;
#monitors_handler;

constructor(params) {
super(params);

Expand Down Expand Up @@ -71,21 +74,21 @@ export const PositionSizeWidget = GObject.registerClass({
}

get monitors() {
return this._monitors;
return this.#monitors;
}

set monitors(value) {
const prev_count = this._monitors?.get_n_items() ?? 0;
const prev_count = this.#monitors?.get_n_items() ?? 0;

this._monitors?.disconnect(this._monitors_handler);
this.#monitors?.disconnect(this.#monitors_handler);

this._monitors = value;
this._monitors_handler = value?.connect('items-changed', this.update_monitors.bind(this));
this.#monitors = value;
this.#monitors_handler = value?.connect('items-changed', this.#update_monitors.bind(this));

this.update_monitors(value, 0, prev_count, value?.get_n_items() ?? 0);
this.#update_monitors(value, 0, prev_count, value?.get_n_items() ?? 0);
}

update_monitors(model, position, removed, added) {
#update_monitors(model, position, removed, added) {
this.monitor_combo.freeze_notify();

try {
Expand Down

0 comments on commit a1bb8ea

Please sign in to comment.