From 4f7e11e25f1f0eaec86fa113fc976fdf10927b49 Mon Sep 17 00:00:00 2001 From: Adrien Plazas Date: Fri, 22 Jul 2022 09:09:39 +0200 Subject: [PATCH] window: Make the seach view headerbar flat This separates the seach and city views a bit more so they don't share the same headerbar with two completely different contents, making the code of the main headerbar simpler at the cost of having an extra headerbar. More importantly, this makes the search view's headerbar flat and gives it no title, so it completely blends with this views pretty blue background. --- data/window.ui | 137 +++++++++++++++++++++++----------------------- src/app/window.js | 8 +-- 2 files changed, 71 insertions(+), 74 deletions(-) diff --git a/data/window.ui b/data/window.ui index ca10ff16..4401ea13 100644 --- a/data/window.ui +++ b/data/window.ui @@ -26,75 +26,14 @@ 760 520 - - vertical + + crossfade - - strict - - - crossfade - - - center - Refresh - win.refresh - view-refresh-symbolic - - - - - - - - crossfade - - - search - - - end - center - true - 5 - Select Location - - - - - - - - city - - - Weather - - - - - - - - - center - primary-menu - open-menu-symbolic - - - - - - - - crossfade + - - search + - + mark-location-symbolic Welcome to Weather! @@ -107,20 +46,78 @@ Search for a city or country + + + + + start + + + + + + + center + primary-menu + open-menu-symbolic + + - + + + - - + + vertical + + + strict + + + crossfade + + + center + Refresh + win.refresh + view-refresh-symbolic + + + + + + + Weather + + + + + center + primary-menu + open-menu-symbolic + + + + + + + + + + + + diff --git a/src/app/window.js b/src/app/window.js index 4439f6e4..c4421996 100644 --- a/src/app/window.js +++ b/src/app/window.js @@ -32,7 +32,7 @@ const Page = { export const MainWindow = GObject.registerClass({ Template: 'resource:///org/gnome/Weather/window.ui', InternalChildren: ['header', 'refreshRevealer', 'refresh', 'forecastStackSwitcher', 'stack', - 'titleStack', 'searchButton', 'searchView', 'forecastStackSwitcherBar'] + 'searchButton', 'searchView', 'searchViewStatus', 'forecastStackSwitcherBar', 'cityBox', 'cityBin'] }, class MainWindow extends Adw.ApplicationWindow { constructor(params) { super(params); @@ -58,7 +58,7 @@ export const MainWindow = GObject.registerClass({ this._model = this.application.model; - this._searchView.icon_name = pkg.name; + this._searchViewStatus.icon_name = pkg.name; this._worldView = new WorldContentView(this.application, this, { align: Gtk.Align.CENTER, @@ -70,7 +70,7 @@ export const MainWindow = GObject.registerClass({ this._cityView = new City.WeatherView(this.application, this, { hexpand: true, vexpand: true }); - this._stack.add_named(this._cityView, 'city'); + this._cityBin.set_child(this._cityView); this._forecastStackSwitcher.stack = this._cityView.getForecastStack(); this._forecastStackSwitcherBar.stack = this._cityView.getForecastStack(); @@ -142,7 +142,7 @@ export const MainWindow = GObject.registerClass({ this.currentInfo = info; this._cityView.info = info; - this._stack.set_visible_child(this._cityView); + this._stack.set_visible_child(this._cityBox); this._goToPage(Page.CITY); } -- GitLab