[gnome-shell/wip/fmuellner/weather-clocks-refresh: 3/3] dateMenu: Refresh world clocks section



commit eaa6d9ff2ece4b4b7b38b297c27affd7d302a067
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Dec 13 17:44:28 2018 +0100

    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

 data/theme/gnome-shell-sass/_common.scss | 18 ++++++++++++++++--
 js/ui/dateMenu.js                        | 19 ++++++++++++++-----
 2 files changed, 30 insertions(+), 7 deletions(-)
---
diff --git a/data/theme/gnome-shell-sass/_common.scss b/data/theme/gnome-shell-sass/_common.scss
index 4d5da090c..a479b9e89 100644
--- a/data/theme/gnome-shell-sass/_common.scss
+++ b/data/theme/gnome-shell-sass/_common.scss
@@ -930,14 +930,28 @@ StScrollBar {
     .world-clocks-grid,
     .weather-grid {
       spacing-rows: 0.4em;
+      spacing-columns: 0.8em;
     }
 
     .weather-box {
       spacing: 0.4em;
     }
 
-    .weather-grid {
-      spacing-columns: 0.8em;
+    .world-clocks-city {
+      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 {
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index dd73310af..bd42e217d 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -162,18 +162,27 @@ var WorldClocksSection = new Lang.Class({
             let label = new St.Label({ style_class: 'world-clocks-city',
                                        text: name,
                                        x_align: Clutter.ActorAlign.START,
+                                       y_align: Clutter.ActorAlign.CENTER,
                                        x_expand: true });
 
-            let time = new St.Label({ style_class: 'world-clocks-time',
-                                      x_align: Clutter.ActorAlign.END,
-                                      x_expand: true });
+            let time = new St.Label({ style_class: 'world-clocks-time' });
+
+            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, offset),
+                                    x_align: Clutter.ActorAlign.END,
+                                    y_align: Clutter.ActorAlign.CENTER });
 
             if (this._grid.text_direction == Clutter.TextDirection.RTL) {
-                layout.attach(time, 0, i + 1, 1, 1);
-                layout.attach(label, 1, i + 1, 1, 1);
+                layout.attach(tz, 0, i + 1, 1, 1);
+                layout.attach(time, 1, i + 1, 1, 1);
+                layout.attach(label, 2, i + 1, 1, 1);
             } else {
                 layout.attach(label, 0, 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]