[gnome-maps/gnome-43] mainWindow: Always update adaptive status on construction
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/gnome-43] mainWindow: Always update adaptive status on construction
- Date: Sun, 2 Oct 2022 21:19:25 +0000 (UTC)
commit 02dd387d4a8306530aa44de2b03cefdb9e2e1453
Author: Marcus Lundblad <ml dfupdate se>
Date: Wed Sep 28 21:05:31 2022 +0200
mainWindow: Always update adaptive status on construction
Don't rely on notify::default-width being triggered on
initial size request of the window.
src/mainWindow.js | 40 ++++++++++++++++++++++++----------------
1 file 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]