[gnome-weather/wip/egg-flow-box: 1/4] [WIP] World: include the temperature in the weather summary
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-weather/wip/egg-flow-box: 1/4] [WIP] World: include the temperature in the weather summary
- Date: Sat, 8 Jun 2013 17:19:25 +0000 (UTC)
commit e2b41d6600d0f1e4dd15d229465113b5797c0d56
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Wed Mar 20 17:30:51 2013 +0100
[WIP] World: include the temperature in the weather summary
src/util.js | 12 ++++++++++--
src/world.js | 2 +-
2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/util.js b/src/util.js
index d7642a1..e72fc2e 100644
--- a/src/util.js
+++ b/src/util.js
@@ -106,9 +106,17 @@ function loadIcon(iconName, size) {
Gtk.IconLookupFlags.GENERIC_FALLBACK);
}
-function getWeatherConditions(info) {
+function getWeatherConditions(info, includeTemperature) {
let conditions = info.get_conditions();
if (conditions == '-') // Not significant
conditions = info.get_sky();
- return conditions;
+
+ if (includeTemperature) {
+ let temp = info.get_temp_summary();
+ // Translators, this is a combination of weather
+ // conditions and a temperature, such as "Cloudy, 57 °F"
+ return _("%s, %s").format(conditions, temp);
+ } else {
+ return conditions;
+ }
}
diff --git a/src/world.js b/src/world.js
index 3185587..7359e40 100644
--- a/src/world.js
+++ b/src/world.js
@@ -73,7 +73,7 @@ const WorldModel = new Lang.Class({
let iter;
info.connect('updated', Lang.bind(this, function(info) {
let icon = Util.loadIcon(info.get_symbolic_icon_name(), ICON_SIZE);
- let secondary_text = Util.getWeatherConditions(info);
+ let secondary_text = Util.getWeatherConditions(info, true);
this.set(iter,
[Columns.ICON, Columns.SECONDARY_TEXT],
[icon, secondary_text]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]