[gnome-weather/gnome-3-8] window: use header subtitle for the country name



commit 828d4b3caf55bcbd6c730b02f3d7878efc12638f
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Mar 7 10:36:08 2013 -0500

    window: use header subtitle for the country name
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695367

 src/window.js |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/src/window.js b/src/window.js
index 12607a7..9346486 100644
--- a/src/window.js
+++ b/src/window.js
@@ -22,22 +22,6 @@ const World = imports.world;
 const Gettext = imports.gettext;
 const Tweener = imports.tweener.tweener;
 
-function makeTitle(location) {
-    let city = location;
-    if (location.get_level() == GWeather.LocationLevel.WEATHER_STATION)
-        city = location.get_parent();
-
-    let country = city.get_parent();
-    while (country &&
-           country.get_level() > GWeather.LocationLevel.COUNTRY)
-        country = country.get_parent();
-
-    if (country)
-        return _("%s, %s").format(city.get_name(), country.get_name());
-    else
-        return city.get_name();
-}
-
 const Page = {
     WORLD: 0,
     CITY: 1
@@ -223,9 +207,22 @@ const MainWindow = new Lang.Class({
 
     _getTitle: function() {
         if (this._currentPage == Page.WORLD)
-            return '';
-
-        return makeTitle(this._cityView.info.location);
+            return ['', null];
+
+        let location = this._cityView.info.location;
+        let city = location;
+        if (location.get_level() == GWeather.LocationLevel.WEATHER_STATION)
+            city = location.get_parent();
+
+        let country = city.get_parent();
+        while (country &&
+               country.get_level() > GWeather.LocationLevel.COUNTRY)
+            country = country.get_parent();
+
+        if (country)
+            return [city.get_name(), country.get_name()];
+        else
+            return [city.get_name(), null];
     },
 
     _goToPage: function(page) {
@@ -242,7 +239,10 @@ const MainWindow = new Lang.Class({
         }
 
         this._currentPage = page;
-        this._header.title = this._getTitle();
+
+        let [title, subtitle] = this._getTitle();
+        this._header.title = title;
+        this._header.subtitle = subtitle;
     },
 
     _itemActivated: function(view, id, path) {


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