summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@dfupdate.se>2022-09-28 21:05:31 +0200
committerMarcus Lundblad <ml@dfupdate.se>2022-10-02 22:31:43 +0200
commit983e18eba16c1160d524ae4ac8f59f4b45767fd9 (patch)
treeb050acdcc486ad95b895b42c5cba4850057fe9de
parent24d6fe9d131166210282e226eb3e257d17fa2883 (diff)
downloadgnome-maps-983e18eba16c1160d524ae4ac8f59f4b45767fd9.tar.gz
mainWindow: Always update adaptive status on construction
Don't rely on notify::default-width being triggered on initial size request of the window.
-rw-r--r--src/mainWindow.js40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 7e6ec6a7..a3489504 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -330,26 +330,34 @@ export class MainWindow extends Gtk.ApplicationWindow {
this._actionBarRight = new HeaderBarRight({ mapView: this._mapView });
this._actionBar.pack_end(this._actionBarRight);
+ // update adaptive status based on initial geometry
+ this._updateAdaptiveMode();
+
this.connect('notify::default-width', () => {
- let width = this.default_width;
- if (width < _ADAPTIVE_VIEW_WIDTH) {
- this.application.adaptive_mode = true;
- this._headerBarLeft.hide();
- this._headerBarRight.hide();
- this._actionBarRevealer.set_reveal_child(true);
- this._placeEntry.set_margin_start(0);
- this._placeEntry.set_margin_end(0);
- } else {
- this.application.adaptive_mode = false;
- this._headerBarLeft.show();
- this._headerBarRight.show();
- this._actionBarRevealer.set_reveal_child(false);
- this._placeEntry.set_margin_start(_PLACE_ENTRY_MARGIN);
- this._placeEntry.set_margin_end(_PLACE_ENTRY_MARGIN);
- }
+ this._updateAdaptiveMode();
});
}
+ _updateAdaptiveMode() {
+ let width = this.default_width;
+
+ if (width < _ADAPTIVE_VIEW_WIDTH) {
+ this.application.adaptive_mode = true;
+ this._headerBarLeft.hide();
+ this._headerBarRight.hide();
+ this._actionBarRevealer.set_reveal_child(true);
+ this._placeEntry.set_margin_start(0);
+ this._placeEntry.set_margin_end(0);
+ } else {
+ this.application.adaptive_mode = false;
+ this._headerBarLeft.show();
+ this._headerBarRight.show();
+ this._actionBarRevealer.set_reveal_child(false);
+ this._placeEntry.set_margin_start(_PLACE_ENTRY_MARGIN);
+ this._placeEntry.set_margin_end(_PLACE_ENTRY_MARGIN);
+ }
+ }
+
_saveWindowGeometry() {
if (this.maximized)
return;