Updating branch refs/heads/master
         to 477b0fbffbe2b4a904712564e7f1de18c0543c2f (commit)
       from 22d07eca6de609a5c1f062787431806456f1233f (commit)

commit 477b0fbffbe2b4a904712564e7f1de18c0543c2f
Author: Harald Judt <h.j...@gmx.at>
Date:   Wed Jul 4 18:15:36 2012 +0200

    Unit conversion: Convert atmospheric pressure.
    
    When imperial system is selected, convert atmospheric pressure from
    hPa into psi.

 panel-plugin/weather-data.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/panel-plugin/weather-data.c b/panel-plugin/weather-data.c
index a162c59..162ec66 100644
--- a/panel-plugin/weather-data.c
+++ b/panel-plugin/weather-data.c
@@ -68,7 +68,12 @@ get_data (xml_time *timeslice, units unit, datas type)
                        val = (val - 32.0) * 5.0 / 9.0;
                return g_strdup_printf ("%.1f", val);
        case PRESSURE:
-               return LOCALE_DOUBLE(loc->pressure_value, "%.1f");
+               if (unit == METRIC)
+                       return LOCALE_DOUBLE(loc->pressure_value, "%.1f");
+               val = g_ascii_strtod(loc->pressure_value, NULL);
+               if (unit == IMPERIAL)
+                       val *= 0.01450378911491;
+               return g_strdup_printf("%.1f", val);
        case WIND_SPEED:
                val = g_ascii_strtod(loc->wind_speed_mps, NULL);
                if (unit == IMPERIAL)
@@ -118,7 +123,7 @@ get_unit (xml_time *timeslice, units unit, datas type)
        case TEMPERATURE:
                return (unit == IMPERIAL) ? _("°F") : _("°C");
        case PRESSURE:
-               return (loc->pressure_unit) ? loc->pressure_unit : "";
+               return (unit == IMPERIAL) ? _("psi") : _("hPa");
        case WIND_SPEED:
                return (unit == IMPERIAL) ? _("mph") : _("km/h");
        case WIND_DIRECTION_DEG:
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to