dateMenu: Show weather location in section header

It is useful information, in particular when the location is set
automatically via geoclue.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/262
This commit is contained in:
Florian Müllner 2019-01-11 17:42:22 +01:00 committed by Florian Müllner
parent 5dedb97fcc
commit 3cf67b1236
2 changed files with 20 additions and 4 deletions

View File

@ -922,6 +922,11 @@ StScrollBar {
font-weight: bold;
}
.weather-header.location {
font-weight: normal;
font-size: 0.9em;
}
.world-clocks-grid,
.weather-grid {
spacing-rows: 0.4em;

View File

@ -218,9 +218,16 @@ var WeatherSection = class WeatherSection {
this.actor.child = box;
box.add_child(new St.Label({ style_class: 'weather-header',
x_align: Clutter.ActorAlign.START,
text: _("Weather") }));
let titleBox = new St.BoxLayout();
titleBox.add_child(new St.Label({ style_class: 'weather-header',
x_align: Clutter.ActorAlign.START,
x_expand: true,
text: _("Weather") }));
box.add_child(titleBox);
this._titleLocation = new St.Label({ style_class: 'weather-header location',
x_align: Clutter.ActorAlign.END });
titleBox.add_child(this._titleLocation);
let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL });
this._forecastGrid = new St.Widget({ style_class: 'weather-grid',
@ -302,12 +309,14 @@ var WeatherSection = class WeatherSection {
return;
}
let info = this._weatherClient.info;
this._titleLocation.text = info.get_location().get_name();
if (this._weatherClient.loading) {
this._setStatusLabel(_("Loading…"));
return;
}
let info = this._weatherClient.info;
if (info.is_valid()) {
this._addForecasts();
return;
@ -325,6 +334,8 @@ var WeatherSection = class WeatherSection {
if (!this.actor.visible)
return;
this._titleLocation.visible = this._weatherClient.hasLocation;
this._updateForecasts();
}
};