Codebase list gnome-maps / 02dd387
mainWindow: Always update adaptive status on construction Don't rely on notify::default-width being triggered on initial size request of the window. Marcus Lundblad 1 year, 6 months ago
1 changed file(s) with 25 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
329329 this._actionBarRight = new HeaderBarRight({ mapView: this._mapView });
330330 this._actionBar.pack_end(this._actionBarRight);
331331
332 // update adaptive status based on initial geometry
333 this._updateAdaptiveMode();
334
332335 this.connect('notify::default-width', () => {
333 let width = this.default_width;
334 if (width < _ADAPTIVE_VIEW_WIDTH) {
335 this.application.adaptive_mode = true;
336 this._headerBarLeft.hide();
337 this._headerBarRight.hide();
338 this._actionBarRevealer.set_reveal_child(true);
339 this._placeEntry.set_margin_start(0);
340 this._placeEntry.set_margin_end(0);
341 } else {
342 this.application.adaptive_mode = false;
343 this._headerBarLeft.show();
344 this._headerBarRight.show();
345 this._actionBarRevealer.set_reveal_child(false);
346 this._placeEntry.set_margin_start(_PLACE_ENTRY_MARGIN);
347 this._placeEntry.set_margin_end(_PLACE_ENTRY_MARGIN);
348 }
349 });
336 this._updateAdaptiveMode();
337 });
338 }
339
340 _updateAdaptiveMode() {
341 let width = this.default_width;
342
343 if (width < _ADAPTIVE_VIEW_WIDTH) {
344 this.application.adaptive_mode = true;
345 this._headerBarLeft.hide();
346 this._headerBarRight.hide();
347 this._actionBarRevealer.set_reveal_child(true);
348 this._placeEntry.set_margin_start(0);
349 this._placeEntry.set_margin_end(0);
350 } else {
351 this.application.adaptive_mode = false;
352 this._headerBarLeft.show();
353 this._headerBarRight.show();
354 this._actionBarRevealer.set_reveal_child(false);
355 this._placeEntry.set_margin_start(_PLACE_ENTRY_MARGIN);
356 this._placeEntry.set_margin_end(_PLACE_ENTRY_MARGIN);
357 }
350358 }
351359
352360 _saveWindowGeometry() {