From 86774e7b05a0e07eac9e25e96e61cca939293059 Mon Sep 17 00:00:00 2001 From: Marco Melorio Date: Mon, 26 Jun 2023 19:43:03 +0200 Subject: [PATCH 1/3] window: Port away from deprecated AdwViewSwitcherTitle I just followed https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/migrating-to-breakpoints.html#replace-adwviewswitchertitle. --- data/window.ui | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/data/window.ui b/data/window.ui index c963a582..699fc74c 100644 --- a/data/window.ui +++ b/data/window.ui @@ -23,8 +23,11 @@ -- GitLab From 6fd3c4a0684e5203f04d223399eb424b364adfde Mon Sep 17 00:00:00 2001 From: Marco Melorio Date: Mon, 26 Jun 2023 22:28:52 +0200 Subject: [PATCH 2/3] window: Use breakpoint for the compact card style The .small css class of AdwClamp has been deprecated. --- data/style.css | 4 +++- data/window.ui | 1 + src/app/window.js | 21 ++++++++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/data/style.css b/data/style.css index 6277dc38..a7a9c313 100644 --- a/data/style.css +++ b/data/style.css @@ -37,6 +37,8 @@ .forecast-card { transition: border-radius 100ms ease-out; border-radius: 6px; + margin-left: 12px; + margin-right: 12px; } .forecast-card separator { @@ -49,7 +51,7 @@ margin-right: 18px; } -#weather-page .small .forecast-card { +window.compact .forecast-card { margin-left: 0; margin-right: 0; border-radius: 0; diff --git a/data/window.ui b/data/window.ui index 699fc74c..b9e84ea9 100644 --- a/data/window.ui +++ b/data/window.ui @@ -114,6 +114,7 @@ max-width: 400sp True + True diff --git a/src/app/window.js b/src/app/window.js index 2506d602..e903a277 100644 --- a/src/app/window.js +++ b/src/app/window.js @@ -33,8 +33,13 @@ const Page = { export const MainWindow = GObject.registerClass({ Template: 'resource:///org/gnome/Weather/window.ui', InternalChildren: ['header', 'refreshRevealer', 'refresh', 'forecastStackSwitcher', 'stack', - 'searchButton', 'searchView', 'searchViewStatus', 'forecastStackSwitcherBar', 'cityBox', 'cityBin'] + 'searchButton', 'searchView', 'searchViewStatus', 'forecastStackSwitcherBar', 'cityBox', 'cityBin'], + Properties: { + 'compact': GObject.ParamSpec.boolean('compact', null, null, GObject.ParamFlags.READWRITE), + }, }, class MainWindow extends Adw.ApplicationWindow { + #compact = false; + constructor(params) { super(params); @@ -93,6 +98,20 @@ export const MainWindow = GObject.registerClass({ this.connect('close-request', () => this._saveWindowGeometry()); } + set compact(compact) { + if (compact) { + this.add_css_class('compact'); + } else { + this.remove_css_class('compact'); + } + + this.#compact = compact; + } + + get compact() { + return this.#compact; + } + vfunc_unroot() { this._cityView.unparent(); this._cityView = null; -- GitLab From 7c9cb272370affb731cf55970d57c66c3f97733c Mon Sep 17 00:00:00 2001 From: Marco Melorio Date: Mon, 26 Jun 2023 22:55:30 +0200 Subject: [PATCH 3/3] weather-widget: Make the city button shrink This way the window will not be cut off with long city names. --- data/weather-widget.ui | 1 + 1 file changed, 1 insertion(+) diff --git a/data/weather-widget.ui b/data/weather-widget.ui index f2d4c79d..e81a5687 100644 --- a/data/weather-widget.ui +++ b/data/weather-widget.ui @@ -34,6 +34,7 @@ start start True + True places-label -- GitLab