From bee81035f4a7104379eda366ce29d552f9a1a09e Mon Sep 17 00:00:00 2001 From: Neroth Date: Mon, 29 Oct 2012 21:02:56 +0100 Subject: [PATCH] Add kPa unit --- src/extension.js | 14 ++++++++++---- ...g.gnome.shell.extensions.weather.gschema.xml.in | 9 +++++---- src/weather-settings.js.in | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/extension.js b/src/extension.js index 9744758..c3db99a 100644 --- a/src/extension.js +++ b/src/extension.js @@ -90,10 +90,11 @@ const WeatherPressureUnits = { inHg: 1, bar: 2, Pa: 3, - atm: 4, - at: 5, - Torr: 6, - psi: 7 + kPa: 4, + atm: 5, + at: 6, + Torr: 7, + psi: 8 } const WeatherPosition = { @@ -1099,6 +1100,11 @@ const WeatherMenuButton = new Lang.Class({ pressure_unit = "Pa"; break; + case WeatherPressureUnits.kPa: + pressure = Math.round(this.toPascal(pressure,temperature)/1000); + pressure_unit = "kPa"; + break; + case WeatherPressureUnits.atm: pressure = Math.round((this.toPascal(pressure,temperature)*0.00000986923267)*100000)/100000; pressure_unit = "atm"; diff --git a/src/org.gnome.shell.extensions.weather.gschema.xml.in b/src/org.gnome.shell.extensions.weather.gschema.xml.in index 26cc84b..a78cd3e 100644 --- a/src/org.gnome.shell.extensions.weather.gschema.xml.in +++ b/src/org.gnome.shell.extensions.weather.gschema.xml.in @@ -14,10 +14,11 @@ - - - - + + + + + diff --git a/src/weather-settings.js.in b/src/weather-settings.js.in index 75c3ebf..0d0df9b 100644 --- a/src/weather-settings.js.in +++ b/src/weather-settings.js.in @@ -695,7 +695,7 @@ WeatherSetting.prototype = this.addLabel(_("Wind Speed Unit")); this.addComboBox(["km/h","mph","m/s","kn","ft/s","Beaufort"],"wind_speed_unit"); this.addLabel(_("Pressure Unit")); - this.addComboBox(["hPa","inHg","bar","Pa","atm","at","Torr","psi"],"pressure_unit"); + this.addComboBox(["hPa","inHg","bar","Pa","kPa","atm","at","Torr","psi"],"pressure_unit"); this.addLabel(_("Position in Panel")); this.addComboBox([_("Center"),_("Right"),_("Left")],"position_in_panel"); this.addLabel(_("Wind Direction by Arrows"));