dateMenu: Refresh world clocks section

Update the section styling to accentuate the most relevant information,
and include the timezone.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/262
This commit is contained in:
Florian Müllner 2018-12-13 17:44:28 +01:00 committed by Florian Müllner
parent 3cf67b1236
commit 40e624444c
2 changed files with 30 additions and 7 deletions

View File

@ -930,14 +930,28 @@ StScrollBar {
.world-clocks-grid, .world-clocks-grid,
.weather-grid { .weather-grid {
spacing-rows: 0.4em; spacing-rows: 0.4em;
spacing-columns: 0.8em;
} }
.weather-box { .weather-box {
spacing: 0.4em; spacing: 0.4em;
} }
.weather-grid { .world-clocks-city {
spacing-columns: 0.8em; font-weight: bold;
font-size: 0.9em;
}
.world-clocks-time {
color: darken($fg_color,20%);
font-feature-settings: "tnum";
font-size: 1.2em;
}
.world-clocks-timezone {
color: darken($fg_color,40%);
font-feature-settings: "tnum";
font-size: 0.9em;
} }
.weather-forecast-icon { .weather-forecast-icon {

View File

@ -156,18 +156,27 @@ var WorldClocksSection = class WorldClocksSection {
let label = new St.Label({ style_class: 'world-clocks-city', let label = new St.Label({ style_class: 'world-clocks-city',
text: name, text: name,
x_align: Clutter.ActorAlign.START, x_align: Clutter.ActorAlign.START,
y_align: Clutter.ActorAlign.CENTER,
x_expand: true }); x_expand: true });
let time = new St.Label({ style_class: 'world-clocks-time', let time = new St.Label({ style_class: 'world-clocks-time' });
x_align: Clutter.ActorAlign.END,
x_expand: true }); let offset = l.get_timezone().get_offset() / 60.;
let fmt = (Math.trunc(offset) == offset) ? '%s%.0f' : '%s%.1f';
let prefix = (offset >= 0) ? '+' : '-';
let tz = new St.Label({ style_class: 'world-clocks-timezone',
text: fmt.format(prefix, Math.abs(offset)),
x_align: Clutter.ActorAlign.END,
y_align: Clutter.ActorAlign.CENTER });
if (this._grid.text_direction == Clutter.TextDirection.RTL) { if (this._grid.text_direction == Clutter.TextDirection.RTL) {
layout.attach(time, 0, i + 1, 1, 1); layout.attach(tz, 0, i + 1, 1, 1);
layout.attach(label, 1, i + 1, 1, 1); layout.attach(time, 1, i + 1, 1, 1);
layout.attach(label, 2, i + 1, 1, 1);
} else { } else {
layout.attach(label, 0, i + 1, 1, 1); layout.attach(label, 0, i + 1, 1, 1);
layout.attach(time, 1, i + 1, 1, 1); layout.attach(time, 1, i + 1, 1, 1);
layout.attach(tz, 2, i + 1, 1, 1);
} }
this._locations[i].actor = time; this._locations[i].actor = time;