Skip to content

Commit

Permalink
Fix merging errors for panel_size_scale_value_changed_cb (home-sweet-…
Browse files Browse the repository at this point in the history
…gnome#1328)

* fix panel_size_scale_value_changed_cb

* fix panel_size_scale_value_changed_cb home-sweet-gnome#2
  • Loading branch information
philippun1 authored May 10, 2021
1 parent a4224f4 commit 781c123
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2303,13 +2303,19 @@ const BuilderScope = GObject.registerClass({
}

panel_size_scale_value_changed_cb(scale) {
// Avoid settings the size consinuosly
// Avoid settings the size continuously
if (this._preferences._panel_size_timeout > 0)
Mainloop.source_remove(this._preferences._panel_size_timeout);
Mainloop.source_remove(this._preferences._panel_size_timeout);

this._preferences._panel_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this._preferences, function() {
const value = scale.get_value();
const monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync');
const monitorsToSetFor = monitorSync ? this.monitors : [this._currentMonitorIndex];
monitorsToSetFor.forEach(monitorIndex => {
PanelSettings.setPanelSize(this._settings, monitorIndex, value);
});

this._preferences._panel_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
this._preferences._settings.set_int('panel-size', scale.get_value());
this._preferences._panel_size_timeout = 0;
this._panel_size_timeout = 0;
return GLib.SOURCE_REMOVE;
}));
}
Expand Down

0 comments on commit 781c123

Please sign in to comment.