[gnome-shell/wip/fmuellner/weather-clocks-refresh: 47/48] dateMenu: Show weather location in section header



commit 3cf67b12362bb62694bb601c57decc186e746d1d
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Jan 11 17:42:22 2019 +0100

    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

 data/theme/gnome-shell-sass/_common.scss |  5 +++++
 js/ui/dateMenu.js                        | 19 +++++++++++++++----
 2 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/data/theme/gnome-shell-sass/_common.scss b/data/theme/gnome-shell-sass/_common.scss
index 801792fa3..d952f1427 100644
--- a/data/theme/gnome-shell-sass/_common.scss
+++ b/data/theme/gnome-shell-sass/_common.scss
@@ -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;
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index c87df8de2..0a6f267e7 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -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();
     }
 };


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