libgweather r255 - in trunk: . libgweather



Author: danw
Date: Wed Jun 18 17:46:52 2008
New Revision: 255
URL: http://svn.gnome.org/viewvc/libgweather?rev=255&view=rev

Log:
	* libgweather/*.[ch]: code cleanup. Try to standardize on a single
	style. (No functional changes.)


Modified:
   trunk/ChangeLog
   trunk/libgweather/gweather-gconf.c
   trunk/libgweather/gweather-gconf.h
   trunk/libgweather/gweather-prefs.c
   trunk/libgweather/gweather-prefs.h
   trunk/libgweather/gweather-xml.c
   trunk/libgweather/gweather-xml.h
   trunk/libgweather/test_metar.c
   trunk/libgweather/weather-bom.c
   trunk/libgweather/weather-iwin.c
   trunk/libgweather/weather-met.c
   trunk/libgweather/weather-metar.c
   trunk/libgweather/weather-priv.h
   trunk/libgweather/weather-sun.c
   trunk/libgweather/weather-wx.c
   trunk/libgweather/weather.c
   trunk/libgweather/weather.h

Modified: trunk/libgweather/gweather-gconf.c
==============================================================================
--- trunk/libgweather/gweather-gconf.c	(original)
+++ trunk/libgweather/gweather-gconf.c	Wed Jun 18 17:46:52 2008
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  * gweather-gconf.c: GConf interaction methods for gweather.
  *
@@ -34,118 +35,118 @@
 
 struct _GWeatherGConf
 {
-	GConfClient *gconf;
-	char *prefix;
+    GConfClient *gconf;
+    char *prefix;
 };
 
 
 GWeatherGConf *
-gweather_gconf_new(const char *prefix)
+gweather_gconf_new (const char *prefix)
 {
-	GWeatherGConf *ctx = g_new0(GWeatherGConf, 1);
-	ctx->gconf = gconf_client_get_default();
-	ctx->prefix = g_strdup(prefix);
+    GWeatherGConf *ctx = g_new0 (GWeatherGConf, 1);
+    ctx->gconf = gconf_client_get_default ();
+    ctx->prefix = g_strdup (prefix);
 
-	return ctx;
+    return ctx;
 }
 
 
 void
-gweather_gconf_free(GWeatherGConf *ctx)
+gweather_gconf_free (GWeatherGConf *ctx)
 {
-	g_object_unref(ctx->gconf);
-	g_free(ctx->prefix);
-	g_free(ctx);
+    g_object_unref (ctx->gconf);
+    g_free (ctx->prefix);
+    g_free (ctx);
 }
 
 
 GConfClient *
-gweather_gconf_get_client(GWeatherGConf *ctx)
+gweather_gconf_get_client (GWeatherGConf *ctx)
 {
-	return ctx->gconf;
+    return ctx->gconf;
 }
 
 
 gchar *
 gweather_gconf_get_full_key (GWeatherGConf *ctx,
-			     const gchar     *key)
+			     const gchar   *key)
 {
-	return g_strdup_printf ("%s/%s", ctx->prefix, key);
+    return g_strdup_printf ("%s/%s", ctx->prefix, key);
 }
 
 void
-gweather_gconf_set_bool (GWeatherGConf *ctx,
-			 const gchar     *key,
-			 gboolean         the_bool,
-			 GError         **opt_error)
-{
-	gchar *full_key = gweather_gconf_get_full_key (ctx, key);
-	gconf_client_set_bool (ctx->gconf, full_key, the_bool, opt_error);
-	g_free (full_key);
+gweather_gconf_set_bool (GWeatherGConf  *ctx,
+			 const gchar    *key,
+			 gboolean        the_bool,
+			 GError        **opt_error)
+{
+    gchar *full_key = gweather_gconf_get_full_key (ctx, key);
+    gconf_client_set_bool (ctx->gconf, full_key, the_bool, opt_error);
+    g_free (full_key);
 }
 
 void
-gweather_gconf_set_int (GWeatherGConf *ctx,
-			const gchar     *key,
-			gint             the_int,
-			GError         **opt_error)
-{
-	gchar *full_key = gweather_gconf_get_full_key (ctx, key);
-	gconf_client_set_int (ctx->gconf, full_key, the_int, opt_error);
-	g_free (full_key);
+gweather_gconf_set_int (GWeatherGConf  *ctx,
+			const gchar    *key,
+			gint            the_int,
+			GError        **opt_error)
+{
+    gchar *full_key = gweather_gconf_get_full_key (ctx, key);
+    gconf_client_set_int (ctx->gconf, full_key, the_int, opt_error);
+    g_free (full_key);
 }
 
 void
-gweather_gconf_set_string (GWeatherGConf *ctx,
-			   const gchar     *key,
-			   const gchar     *the_string,
-			   GError         **opt_error)
-{
-	gchar *full_key = gweather_gconf_get_full_key (ctx, key);
-	gconf_client_set_string (ctx->gconf, full_key, the_string, opt_error);
-	g_free (full_key);
+gweather_gconf_set_string (GWeatherGConf  *ctx,
+			   const gchar    *key,
+			   const gchar    *the_string,
+			   GError        **opt_error)
+{
+    gchar *full_key = gweather_gconf_get_full_key (ctx, key);
+    gconf_client_set_string (ctx->gconf, full_key, the_string, opt_error);
+    g_free (full_key);
 }
 
 gboolean
-gweather_gconf_get_bool (GWeatherGConf *ctx,
-			 const gchar     *key,
-			 GError         **opt_error)
-{
-	gchar *full_key = gweather_gconf_get_full_key (ctx, key);
-	gboolean ret = gconf_client_get_bool (ctx->gconf, full_key, opt_error);
-	g_free (full_key);
-	return ret;
+gweather_gconf_get_bool (GWeatherGConf  *ctx,
+			 const gchar    *key,
+			 GError        **opt_error)
+{
+    gchar *full_key = gweather_gconf_get_full_key (ctx, key);
+    gboolean ret = gconf_client_get_bool (ctx->gconf, full_key, opt_error);
+    g_free (full_key);
+    return ret;
 }
 
 gint
-gweather_gconf_get_int (GWeatherGConf *ctx,
-			const gchar     *key,
-			GError         **opt_error)
-{
-	gchar *full_key = gweather_gconf_get_full_key (ctx, key);
-	gint ret = gconf_client_get_int (ctx->gconf, full_key, opt_error);
-	g_free (full_key);
-	return ret;
+gweather_gconf_get_int (GWeatherGConf  *ctx,
+			const gchar    *key,
+			GError        **opt_error)
+{
+    gchar *full_key = gweather_gconf_get_full_key (ctx, key);
+    gint ret = gconf_client_get_int (ctx->gconf, full_key, opt_error);
+    g_free (full_key);
+    return ret;
 }
 
 gchar *
-gweather_gconf_get_string (GWeatherGConf *ctx,
-			   const gchar     *key,
-			   GError         **opt_error)
-{
-	gchar *full_key = gweather_gconf_get_full_key (ctx, key);
-	gchar *ret = gconf_client_get_string (ctx->gconf, full_key, opt_error);
-	g_free (full_key);
-	return ret;
+gweather_gconf_get_string (GWeatherGConf  *ctx,
+			   const gchar    *key,
+			   GError        **opt_error)
+{
+    gchar *full_key = gweather_gconf_get_full_key (ctx, key);
+    gchar *ret = gconf_client_get_string (ctx->gconf, full_key, opt_error);
+    g_free (full_key);
+    return ret;
 }
 
 
 WeatherLocation *
-gweather_gconf_get_location(GWeatherGConf *ctx)
+gweather_gconf_get_location (GWeatherGConf *ctx)
 {
     WeatherLocation *location;
     gchar *name, *code, *zone, *radar, *coordinates;
-    
+
     name = gweather_gconf_get_string (ctx, "location4", NULL);
     if (!name)
     {
@@ -167,7 +168,7 @@
     }
 
     code = gweather_gconf_get_string (ctx, "location1", NULL);
-    if (!code) 
+    if (!code)
     {
         /* TRANSLATOR: Change this to the code of your default location that
 	 * corresponds to the DEFAULT_LOCATION name you put above. This is
@@ -206,7 +207,7 @@
             zone = g_strdup ("PAZ021");
     }
 
-    radar = gweather_gconf_get_string(ctx, "location3", NULL);
+    radar = gweather_gconf_get_string (ctx, "location3", NULL);
     if (!radar)
     {
         /* TRANSLATOR: Change this to the radar of your default location that
@@ -244,18 +245,18 @@
 	 */
 	if (strcmp ("DEFAULT_COORDINATES", _("DEFAULT_COORDINATES")))
 	    coordinates = g_strdup (_("DEFAULT_COORDINATES"));
-	else 
+	else
 	    coordinates = g_strdup ("40-32N 080-13W");
     }
-    
+
     location = weather_location_new (name, code, zone, radar, coordinates,
 				     NULL, NULL);
-    
+
     g_free (name);
     g_free (code);
     g_free (zone);
     g_free (radar);
     g_free (coordinates);
-    
+
     return location;
 }

Modified: trunk/libgweather/gweather-gconf.h
==============================================================================
--- trunk/libgweather/gweather-gconf.h	(original)
+++ trunk/libgweather/gweather-gconf.h	Wed Jun 18 17:46:52 2008
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  * gweather-gconf.h: GConf interaction methods for gweather.
  *

Modified: trunk/libgweather/gweather-prefs.c
==============================================================================
--- trunk/libgweather/gweather-prefs.c	(original)
+++ trunk/libgweather/gweather-prefs.c	Wed Jun 18 17:46:52 2008
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  *  Papadimitriou Spiros <spapadim+ cs cmu edu>
  *
@@ -23,80 +24,80 @@
 
 static GConfEnumStringPair temp_unit_enum_map [] = {
     { TEMP_UNIT_DEFAULT,    N_("Default") },
-	/* translators: Kelvin */
+    /* translators: Kelvin */
     { TEMP_UNIT_KELVIN,     N_("K")       },
-	/* translators: Celsius */
+    /* translators: Celsius */
     { TEMP_UNIT_CENTIGRADE, N_("C")       },
-	/* translators: Fahrenheit */
+    /* translators: Fahrenheit */
     { TEMP_UNIT_FAHRENHEIT, N_("F")       },
     { 0, NULL }
-};	
+};
 
 static GConfEnumStringPair speed_unit_enum_map [] = {
     { SPEED_UNIT_DEFAULT, N_("Default")        },
-	/* translators: meters per second */
+    /* translators: meters per second */
     { SPEED_UNIT_MS,      N_("m/s")            },
-	/* translators: kilometers per hour */
+    /* translators: kilometers per hour */
     { SPEED_UNIT_KPH,     N_("km/h")           },
-	/* translators: miles per hour */
+    /* translators: miles per hour */
     { SPEED_UNIT_MPH,     N_("mph")            },
-	/* translators: knots (speed unit) */
+    /* translators: knots (speed unit) */
     { SPEED_UNIT_KNOTS,   N_("knots")          },
-	/* translators: wind speed */
+    /* translators: wind speed */
     { SPEED_UNIT_BFT,     N_("Beaufort scale") },
     { 0, NULL }
 };
 
 static GConfEnumStringPair pressure_unit_enum_map [] = {
     { PRESSURE_UNIT_DEFAULT, N_("Default") },
-	/* translators: kilopascals */
+    /* translators: kilopascals */
     { PRESSURE_UNIT_KPA,     N_("kPa")     },
-	/* translators: hectopascals */
+    /* translators: hectopascals */
     { PRESSURE_UNIT_HPA,     N_("hPa")     },
-	/* translators: millibars */
+    /* translators: millibars */
     { PRESSURE_UNIT_MB,      N_("mb")      },
-	/* translators: millimeters of mercury */
+    /* translators: millimeters of mercury */
     { PRESSURE_UNIT_MM_HG,   N_("mmHg")    },
-	/* translators: inches of mercury */
+    /* translators: inches of mercury */
     { PRESSURE_UNIT_INCH_HG, N_("inHg")    },
-	/* translators: atmosphere */
+    /* translators: atmosphere */
     { PRESSURE_UNIT_ATM,     N_("atm")     },
     { 0, NULL }
 };
 
 static GConfEnumStringPair distance_unit_enum_map [] = {
     { DISTANCE_UNIT_DEFAULT, N_("Default") },
-	/* translators: meters */
+    /* translators: meters */
     { DISTANCE_UNIT_METERS,  N_("m")       },
-	/* translators: kilometers */
+    /* translators: kilometers */
     { DISTANCE_UNIT_KM,      N_("km")      },
-	/* translators: miles */
+    /* translators: miles */
     { DISTANCE_UNIT_MILES,   N_("mi")      },
     { 0, NULL }
 };
 
 
-static void parse_temp_string (const gchar *gconf_str, GWeatherPrefs *prefs)
+static void
+parse_temp_string (const gchar *gconf_str, GWeatherPrefs *prefs)
 {
     gint value = 0;
 #ifdef HAVE__NL_MEASUREMENT_MEASUREMENT
     char *imperial = NULL;
 #endif
 
-    prefs->temperature_unit = TEMP_UNIT_INVALID;	
+    prefs->temperature_unit = TEMP_UNIT_INVALID;
     prefs->use_temperature_default = TRUE;
-	
+
     if ( gconf_str && gconf_string_to_enum (temp_unit_enum_map, gconf_str, &value) ) {
         prefs->temperature_unit = value;
-		
-		if ((prefs->temperature_unit == TEMP_UNIT_DEFAULT) &&
-		    (gconf_string_to_enum (temp_unit_enum_map, _("DEFAULT_TEMP_UNIT"), &value)) ) {
-              prefs->temperature_unit = value;
-		} else {
+
+	if ((prefs->temperature_unit == TEMP_UNIT_DEFAULT) &&
+	    (gconf_string_to_enum (temp_unit_enum_map, _("DEFAULT_TEMP_UNIT"), &value)) ) {
+	    prefs->temperature_unit = value;
+	} else {
             prefs->use_temperature_default = FALSE;
         }
-    }	
-    else {
+    } else {
         /* TRANSLATOR: This is the default unit to use for temperature measurements. */
         /* Valid values are: "K" (Kelvin), "C" (Celsius) and "F" (Fahrenheit) */
         if (gconf_string_to_enum (temp_unit_enum_map, _("DEFAULT_TEMP_UNIT"), &value) ) {
@@ -105,7 +106,7 @@
     }
     if (!prefs->temperature_unit || prefs->temperature_unit == TEMP_UNIT_DEFAULT ) {
 #ifdef HAVE__NL_MEASUREMENT_MEASUREMENT
-        imperial = nl_langinfo(_NL_MEASUREMENT_MEASUREMENT);
+        imperial = nl_langinfo (_NL_MEASUREMENT_MEASUREMENT);
         if ( imperial && imperial[0] == 2 )  {
             /* imperial */
             prefs->temperature_unit = TEMP_UNIT_FAHRENHEIT;
@@ -115,25 +116,26 @@
     }
 }
 
-static void parse_speed_string (const gchar *gconf_str, GWeatherPrefs *prefs)
+static void
+parse_speed_string (const gchar *gconf_str, GWeatherPrefs *prefs)
 {
     gint value = 0;
 #ifdef HAVE__NL_MEASUREMENT_MEASUREMENT
     char *imperial = NULL;
 #endif
-	
+
     prefs->speed_unit = SPEED_UNIT_INVALID;
     prefs->use_speed_default = TRUE;
-	
-    if ( gconf_str && gconf_string_to_enum (speed_unit_enum_map, gconf_str, &value) ) {
+
+    if (gconf_str && gconf_string_to_enum (speed_unit_enum_map, gconf_str, &value) ) {
         prefs->speed_unit = value;
-		if ((prefs->speed_unit == SPEED_UNIT_DEFAULT) &&
-			(gconf_string_to_enum (speed_unit_enum_map, _("DEFAULT_SPEED_UNIT"), &value)) ) {
-              prefs->speed_unit = value;
-		} else {
+	if ((prefs->speed_unit == SPEED_UNIT_DEFAULT) &&
+	    (gconf_string_to_enum (speed_unit_enum_map, _("DEFAULT_SPEED_UNIT"), &value)) ) {
+	    prefs->speed_unit = value;
+	} else {
             prefs->use_speed_default = FALSE;
         }
-    }	
+    }
     else {
         /* TRANSLATOR: This is the default unit to use for wind speed. */
         /* Valid values are: "m/s" (meters per second), "km/h" (kilometers per hour), */
@@ -142,10 +144,10 @@
             prefs->speed_unit = value;
         }
     }
-    if ( (!prefs->speed_unit) || prefs->speed_unit == SPEED_UNIT_DEFAULT ) {
+    if ((!prefs->speed_unit) || prefs->speed_unit == SPEED_UNIT_DEFAULT) {
 #ifdef HAVE__NL_MEASUREMENT_MEASUREMENT
-        imperial = nl_langinfo(_NL_MEASUREMENT_MEASUREMENT);
-        if ( imperial && imperial[0] == 2 )  {
+        imperial = nl_langinfo (_NL_MEASUREMENT_MEASUREMENT);
+        if (imperial && imperial[0] == 2)  {
             /* imperial */
             prefs->speed_unit = SPEED_UNIT_KNOTS;
         } else
@@ -155,26 +157,27 @@
 }
 
 
-static void parse_pressure_string (const gchar *gconf_str, GWeatherPrefs *prefs)
+static void
+parse_pressure_string (const gchar *gconf_str, GWeatherPrefs *prefs)
 {
     gint value = 0;
 #ifdef _NL_MEASUREMENT_MEASUREMENT
     char *imperial = NULL;
 #endif
-	
+
     prefs->pressure_unit = PRESSURE_UNIT_INVALID;
     prefs->use_pressure_default = TRUE;
-	
+
     if ( gconf_str && gconf_string_to_enum (pressure_unit_enum_map, gconf_str, &value) ) {
         prefs->pressure_unit = value;
 
         if ((prefs->pressure_unit == PRESSURE_UNIT_DEFAULT) &&
-			(gconf_string_to_enum (pressure_unit_enum_map, _("DEFAULT_PRESSURE_UNIT"), &value)) ) {
-              prefs->pressure_unit = value;
-		} else {
+	    (gconf_string_to_enum (pressure_unit_enum_map, _("DEFAULT_PRESSURE_UNIT"), &value)) ) {
+	    prefs->pressure_unit = value;
+	} else {
             prefs->use_pressure_default = FALSE;
         }
-    }	
+    }
     else {
         /* TRANSLATOR: This is the default unit to use for atmospheric pressure. */
         /* Valid values are: "kPa" (kiloPascals), "hPa" (hectoPascals),
@@ -186,35 +189,36 @@
     }
     if ( (!prefs->pressure_unit) || prefs->pressure_unit == PRESSURE_UNIT_DEFAULT ) {
 #ifdef _NL_MEASUREMENT_MEASUREMENT
-        imperial = nl_langinfo(_NL_MEASUREMENT_MEASUREMENT);
-        if ( imperial && imperial[0] == 2 )  {
+        imperial = nl_langinfo (_NL_MEASUREMENT_MEASUREMENT);
+        if (imperial && imperial[0] == 2)  {
             /* imperial */
             prefs->pressure_unit = PRESSURE_UNIT_INCH_HG;
         } else
 #endif
             prefs->pressure_unit = PRESSURE_UNIT_HPA;
-    }	
+    }
 }
 
-static void parse_distance_string (const gchar *gconf_str, GWeatherPrefs *prefs)
+static void
+parse_distance_string (const gchar *gconf_str, GWeatherPrefs *prefs)
 {
     gint value = 0;
 #ifdef _NL_MEASUREMENT_MEASUREMENT
     char *imperial = NULL;
 #endif
-	
+
     prefs->distance_unit = DISTANCE_UNIT_INVALID;
     prefs->use_distance_default = TRUE;
-    if ( gconf_str && gconf_string_to_enum (distance_unit_enum_map, gconf_str, &value) ) {
+    if (gconf_str && gconf_string_to_enum (distance_unit_enum_map, gconf_str, &value)) {
         prefs->distance_unit = value;
 
-		if ((prefs->distance_unit == DISTANCE_UNIT_DEFAULT) &&
-			(gconf_string_to_enum (distance_unit_enum_map, _("DEFAULT_DISTANCE_UNIT"), &value)) ) {
-              prefs->distance_unit = value;
-		} else {
+	if ((prefs->distance_unit == DISTANCE_UNIT_DEFAULT) &&
+	    (gconf_string_to_enum (distance_unit_enum_map, _("DEFAULT_DISTANCE_UNIT"), &value)) ) {
+	    prefs->distance_unit = value;
+	} else {
             prefs->use_distance_default = FALSE;
         }
-    }	
+    }
     else {
         /* TRANSLATOR: This is the default unit to use for visibility distance. */
         /* Valid values are: "m" (meters), "km" (kilometers) and "mi" (miles)   */
@@ -223,10 +227,10 @@
         }
     }
 
-	if ((!prefs->distance_unit) || prefs->distance_unit == DISTANCE_UNIT_DEFAULT ) {
+    if ((!prefs->distance_unit) || prefs->distance_unit == DISTANCE_UNIT_DEFAULT) {
 #ifdef _NL_MEASUREMENT_MEASUREMENT
-        imperial = nl_langinfo(_NL_MEASUREMENT_MEASUREMENT);
-        if ( imperial && imperial[0] == 2 )  {
+        imperial = nl_langinfo (_NL_MEASUREMENT_MEASUREMENT);
+        if (imperial && imperial[0] == 2)  {
             /* imperial */
             prefs->distance_unit = DISTANCE_UNIT_MILES;
         } else
@@ -235,47 +239,52 @@
     }
 
     return;
-}	
+}
 
-const char *gweather_prefs_temp_enum_to_string (TempUnit temp)
+const char *
+gweather_prefs_temp_enum_to_string (TempUnit temp)
 {
-	return gconf_enum_to_string(temp_unit_enum_map, temp);
+    return gconf_enum_to_string (temp_unit_enum_map, temp);
 }
 
-const char *gweather_prefs_speed_enum_to_string (SpeedUnit speed)
+const char *
+gweather_prefs_speed_enum_to_string (SpeedUnit speed)
 {
-	return gconf_enum_to_string(speed_unit_enum_map, speed);
+    return gconf_enum_to_string (speed_unit_enum_map, speed);
 }
 
-const char *gweather_prefs_pressure_enum_to_string (PressureUnit pressure)
+const char *
+gweather_prefs_pressure_enum_to_string (PressureUnit pressure)
 {
-	return gconf_enum_to_string(pressure_unit_enum_map, pressure);
+    return gconf_enum_to_string (pressure_unit_enum_map, pressure);
 }
 
-const char *gweather_prefs_distance_enum_to_string (DistanceUnit distance)
+const char *
+gweather_prefs_distance_enum_to_string (DistanceUnit distance)
 {
-	return gconf_enum_to_string(distance_unit_enum_map, distance);
+    return gconf_enum_to_string (distance_unit_enum_map, distance);
 }
 
 
-void gweather_prefs_load (GWeatherPrefs *prefs, GWeatherGConf *ctx)
+void
+gweather_prefs_load (GWeatherPrefs *prefs, GWeatherGConf *ctx)
 {
     GError *error = NULL;
     gchar  *gconf_str = NULL;
 
     if (prefs->location) {
-       weather_location_free(prefs->location);
+	weather_location_free (prefs->location);
     }
-    prefs->location = gweather_gconf_get_location(ctx);
+    prefs->location = gweather_gconf_get_location (ctx);
 
     /* Assume we use unit defaults */
     prefs->use_temperature_default = TRUE;
     prefs->use_speed_default = TRUE;
     prefs->use_pressure_default = TRUE;
     prefs->use_distance_default = TRUE;
-	
-    prefs->update_interval = 
-    	gweather_gconf_get_int(ctx, "auto_update_interval", &error);
+
+    prefs->update_interval =
+    	gweather_gconf_get_int (ctx, "auto_update_interval", &error);
     if (error) {
 	g_print ("%s \n", error->message);
 	g_error_free (error);
@@ -283,57 +292,57 @@
     }
     prefs->update_interval = MAX (prefs->update_interval, 60);
     prefs->update_enabled =
-    	gweather_gconf_get_bool(ctx, "auto_update", NULL);
+    	gweather_gconf_get_bool (ctx, "auto_update", NULL);
     prefs->detailed =
-    	gweather_gconf_get_bool(ctx, "enable_detailed_forecast", NULL);
+    	gweather_gconf_get_bool (ctx, "enable_detailed_forecast", NULL);
     prefs->radar_enabled =
-    	gweather_gconf_get_bool(ctx, "enable_radar_map", NULL);
-    prefs->use_custom_radar_url = 
-    	gweather_gconf_get_bool(ctx, "use_custom_radar_url", NULL);
+    	gweather_gconf_get_bool (ctx, "enable_radar_map", NULL);
+    prefs->use_custom_radar_url =
+    	gweather_gconf_get_bool (ctx, "use_custom_radar_url", NULL);
 
     if (prefs->radar) {
-        g_free(prefs->radar);
+        g_free (prefs->radar);
         prefs->radar = NULL;
     }
     prefs->radar = gweather_gconf_get_string (ctx, "radar", NULL);
-    
+
     gconf_str = gweather_gconf_get_string (ctx, GCONF_TEMP_UNIT, NULL);
-    parse_temp_string(gconf_str, prefs);
+    parse_temp_string (gconf_str, prefs);
     g_free (gconf_str);
-    
+
     gconf_str = gweather_gconf_get_string (ctx, GCONF_SPEED_UNIT, NULL);
-    parse_speed_string(gconf_str, prefs);
+    parse_speed_string (gconf_str, prefs);
     g_free (gconf_str);
-			
+
     gconf_str = gweather_gconf_get_string (ctx, GCONF_PRESSURE_UNIT, NULL);
-    parse_pressure_string(gconf_str, prefs);
+    parse_pressure_string (gconf_str, prefs);
     g_free (gconf_str);
 
     gconf_str = gweather_gconf_get_string (ctx, GCONF_DISTANCE_UNIT, NULL);
-    parse_distance_string(gconf_str, prefs);
+    parse_distance_string (gconf_str, prefs);
     g_free (gconf_str);
-	
+
     return;
 }
 
 TempUnit
 gweather_prefs_parse_temperature (const char *str, gboolean *is_default)
 {
-	GWeatherPrefs prefs;
+    GWeatherPrefs prefs;
 
-	parse_temp_string (str, &prefs);
-	*is_default = prefs.use_temperature_default;
-	return prefs.temperature_unit;
+    parse_temp_string (str, &prefs);
+    *is_default = prefs.use_temperature_default;
+    return prefs.temperature_unit;
 }
 
 SpeedUnit
 gweather_prefs_parse_speed (const char *str, gboolean *is_default)
 {
-	GWeatherPrefs prefs;
+    GWeatherPrefs prefs;
 
-	parse_speed_string (str, &prefs);
-	*is_default = prefs.use_speed_default;
-	return prefs.speed_unit;
+    parse_speed_string (str, &prefs);
+    *is_default = prefs.use_speed_default;
+    return prefs.speed_unit;
 }
 
 static const char *

Modified: trunk/libgweather/gweather-prefs.h
==============================================================================
--- trunk/libgweather/gweather-prefs.h	(original)
+++ trunk/libgweather/gweather-prefs.h	Wed Jun 18 17:46:52 2008
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  *  Papadimitriou Spiros <spapadim+ cs cmu edu>
  *
@@ -36,7 +37,7 @@
     gboolean radar_enabled;
     gboolean use_custom_radar_url;
     gchar *radar;
-	
+
     TempUnit     temperature_unit;
     gboolean     use_temperature_default;
     SpeedUnit    speed_unit;
@@ -55,9 +56,9 @@
 const char *	gweather_prefs_pressure_enum_to_string	(PressureUnit pressure);
 const char *	gweather_prefs_distance_enum_to_string	(DistanceUnit distance);
 
-TempUnit        gweather_prefs_parse_temperature        (const char *str, 
+TempUnit        gweather_prefs_parse_temperature        (const char *str,
                                                          gboolean   *is_default);
-SpeedUnit       gweather_prefs_parse_speed              (const char *str, 
+SpeedUnit       gweather_prefs_parse_speed              (const char *str,
                                                          gboolean   *is_default);
 
 const char *	gweather_prefs_get_temp_display_name		(TempUnit temp);

Modified: trunk/libgweather/gweather-xml.c
==============================================================================
--- trunk/libgweather/gweather-xml.c	(original)
+++ trunk/libgweather/gweather-xml.c	Wed Jun 18 17:46:52 2008
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /* gweather-xml.c - Locations.xml parsing code
  *
  * Copyright (C) 2005 Ryan Lortie, 2004 Gareth Owen
@@ -18,12 +19,12 @@
  */
 
 
-/* There is very little error checking in the parsing code below, it relies 
+/* There is very little error checking in the parsing code below, it relies
  * heavily on the locations file being in the correct format.  If you have
  * <name> elements within a parent element, they must come first and be
  * grouped together.
- * The format is as follows: 
- * 
+ * The format is as follows:
+ *
  * <gweather format="1.0">
  * <region>
  *  <name>Name of the region</name>
@@ -74,122 +75,119 @@
 #include "gweather-xml.h"
 
 static gint
-gweather_xml_location_sort_func( GtkTreeModel *model, GtkTreeIter *a,
-                                 GtkTreeIter *b, gpointer user_data )
+gweather_xml_location_sort_func (GtkTreeModel *model, GtkTreeIter *a,
+                                 GtkTreeIter *b, gpointer user_data)
 {
     gint res;
     gchar *name_a, *name_b;
     gchar *fold_a, *fold_b;
-        
+
     gtk_tree_model_get (model, a, GWEATHER_XML_COL_LOC, &name_a, -1);
     gtk_tree_model_get (model, b, GWEATHER_XML_COL_LOC, &name_b, -1);
-        
-    fold_a = g_utf8_casefold(name_a, -1);
-    fold_b = g_utf8_casefold(name_b, -1);
-        
-    res = g_utf8_collate(fold_a, fold_b);
-    
-    g_free(name_a);
-    g_free(name_b);
-    g_free(fold_a);
-    g_free(fold_b);
-    
-    return res;
-}
- 
-static char*
-gweather_xml_get_value( xmlTextReaderPtr xml )
-{
-  char* value;
 
-  /* check for null node */
-  if ( xmlTextReaderIsEmptyElement( xml ) )
-    return NULL;
-    
-  /* the next "node" is the text node containing the value we want to get */
-  if( xmlTextReaderRead( xml ) != 1 )
-    return NULL;
-
-  value = (char *) xmlTextReaderValue( xml );
-
-  /* move on to the end of this node */
-  while( xmlTextReaderNodeType( xml ) != XML_READER_TYPE_END_ELEMENT )
-    if( xmlTextReaderRead( xml ) != 1 )
-    {
-      xmlFree( value );
-      return NULL;
-    }
+    fold_a = g_utf8_casefold (name_a, -1);
+    fold_b = g_utf8_casefold (name_b, -1);
+
+    res = g_utf8_collate (fold_a, fold_b);
 
-  /* consume the end element too */
-  if( xmlTextReaderRead( xml ) != 1 )
-  {
-    xmlFree( value );
-    return NULL;
-  }
-    
-  return value;
+    g_free (name_a);
+    g_free (name_b);
+    g_free (fold_a);
+    g_free (fold_b);
+
+    return res;
 }
 
 static char *
-gweather_xml_parse_name( xmlTextReaderPtr xml )
+gweather_xml_get_value (xmlTextReaderPtr xml)
 {
-  const char * const *locales;
-  const char *this_language;
-  int best_match = INT_MAX;
-  char *lang, *tagname;
-  gboolean keep_going;
-  char *name = NULL;
-  int i;
-
-  locales = g_get_language_names();
-
-  do
-  {
-    /* First let's get the language */
-    lang = (char *) xmlTextReaderXmlLang( xml );
+    char* value;
 
-    if( lang == NULL )
-      this_language = "C";
-    else
-      this_language = lang;
+    /* check for null node */
+    if (xmlTextReaderIsEmptyElement (xml))
+	return NULL;
+
+    /* the next "node" is the text node containing the value we want to get */
+    if (xmlTextReaderRead (xml) != 1)
+	return NULL;
+
+    value = (char *) xmlTextReaderValue (xml);
+
+    /* move on to the end of this node */
+    while (xmlTextReaderNodeType (xml) != XML_READER_TYPE_END_ELEMENT) {
+	if (xmlTextReaderRead (xml) != 1) {
+	    xmlFree (value);
+	    return NULL;
+	}
+    }
 
-    /* the next "node" is text node containing the actual name */
-    if( xmlTextReaderRead( xml ) != 1 )
-    {
-      xmlFree( lang );
-      return NULL;
+    /* consume the end element too */
+    if (xmlTextReaderRead (xml) != 1) {
+	xmlFree (value);
+	return NULL;
     }
 
-    for( i = 0; locales[i] && i < best_match; i++ )
-      if( !strcmp( locales[i], this_language ) )
-      {
-        /* if we've already encounted a less accurate
-           translation, then free it */
-        xmlFree( name );
-
-        name = (char *) xmlTextReaderValue( xml );
-        best_match = i;
-
-        break;
-      }
-
-    xmlFree( lang );
-
-    while( xmlTextReaderNodeType( xml ) != XML_READER_TYPE_ELEMENT )
-      if( xmlTextReaderRead( xml ) != 1 )
-      {
-        xmlFree( name );
-        return NULL;
-      }
-
-    /* if the next tag is another <name> then keep going */
-    tagname = (char *) xmlTextReaderName( xml );
-    keep_going = !strcmp( tagname, "name" );
-    xmlFree( tagname );
+    return value;
+}
+
+static char *
+gweather_xml_parse_name (xmlTextReaderPtr xml)
+{
+    const char * const *locales;
+    const char *this_language;
+    int best_match = INT_MAX;
+    char *lang, *tagname;
+    gboolean keep_going;
+    char *name = NULL;
+    int i;
+
+    locales = g_get_language_names ();
+
+    do {
+	/* First let's get the language */
+	lang = (char *) xmlTextReaderXmlLang (xml);
+
+	if (lang == NULL)
+	    this_language = "C";
+	else
+	    this_language = lang;
+
+	/* the next "node" is text node containing the actual name */
+	if (xmlTextReaderRead (xml) != 1) {
+	    xmlFree (lang);
+	    return NULL;
+	}
+
+	for (i = 0; locales[i] && i < best_match; i++) {
+	    if (!strcmp (locales[i], this_language)) {
+		/* if we've already encounted a less accurate
+		   translation, then free it */
+		xmlFree (name);
+
+		name = (char *) xmlTextReaderValue (xml);
+		best_match = i;
+
+		break;
+	    }
+	}
+
+	xmlFree (lang);
+
+	while (xmlTextReaderNodeType (xml) != XML_READER_TYPE_ELEMENT) {
+	    if (xmlTextReaderRead (xml) != 1) {
+		xmlFree (name);
+		return NULL;
+	    }
+
+	    /* if the next tag is another <name> then keep going */
+	    tagname = (char *) xmlTextReaderName (xml);
+	    keep_going = !strcmp (tagname, "name");
+	    xmlFree (tagname);
+	}
 
-  } while( keep_going );
+    } while (keep_going);
 
-  return name;
+    return name;
 }
 
 static gboolean
@@ -199,281 +197,253 @@
                          const char *dflt_country_code,
 			 const char *dflt_tz_hint, const char *cityname)
 {
-  char *name, *code, *zone, *radar, *coordinates;
-  char *country_code, *tz_hint;
-  char **city, *nocity = NULL;
-  GtkTreeIter iter, *self;
-  gboolean is_location;
-  char *tagname;
-  gboolean ret = FALSE;
-  int tagtype;
-
-  if( (tagname = (char *) xmlTextReaderName( xml )) == NULL )
-    return FALSE;
-
-  if( !strcmp( tagname, "city" ) )
-    city = &name;
-  else
-    city = &nocity;
-
-  is_location = !strcmp( tagname, "location" );
-
-  /* if we're processing the top-level, then don't create a new iter */
-  if( !strcmp( tagname, "gweather" ) )
-    self = NULL;
-  else
-  {
-    self = &iter;
-    /* insert this node into the tree */
-    gtk_tree_store_append( store, self, parent );
-  }
-
-  xmlFree( tagname );
-
-  coordinates = NULL;
-  radar = NULL;
-  zone = NULL;
-  code = NULL;
-  name = NULL;
-
-  country_code = dflt_country_code ? (char *) xmlStrdup( (xmlChar *) dflt_country_code ) : NULL;
-  tz_hint = dflt_tz_hint ? (char *) xmlStrdup( (xmlChar *) dflt_tz_hint ) : NULL;
-
-  /* absorb the start tag */
-  if( xmlTextReaderRead( xml ) != 1 )
-    goto error_out;
-
-  /* start parsing the actual contents of the node */
-  while( (tagtype = xmlTextReaderNodeType( xml )) !=
-         XML_READER_TYPE_END_ELEMENT )
-  {
-
-    /* skip non-element types */
-    if( tagtype != XML_READER_TYPE_ELEMENT )
-    {
-      if( xmlTextReaderRead( xml ) != 1 )
-        goto error_out;
+    char *name, *code, *zone, *radar, *coordinates;
+    char *country_code, *tz_hint;
+    char **city, *nocity = NULL;
+    GtkTreeIter iter, *self;
+    gboolean is_location;
+    char *tagname;
+    gboolean ret = FALSE;
+    int tagtype;
 
-      continue;
-    }
-    
-    tagname = (char *) xmlTextReaderName( xml );
-
-    if( !strcmp( tagname, "region" ) || !strcmp( tagname, "country" ) ||
-        !strcmp( tagname, "state" ) || !strcmp( tagname, "city" ) ||
-        !strcmp( tagname, "location" ) )
-    {
-      /* recursively handle sub-sections */
-      if( !gweather_xml_parse_node( xml, store, self, 
-				    radar, zone, country_code, tz_hint,
-				    *city ) )
-        goto error_out;
-    }
-    else if ( !strcmp( tagname, "name" ) )
-    {
-      xmlFree( name );
-      if( (name = gweather_xml_parse_name( xml )) == NULL )
-        goto error_out;
-    }
-    else if ( !strcmp( tagname, "iso-code" ) )
-    {
-      xmlFree( country_code );
-      if( (country_code = gweather_xml_get_value( xml )) == NULL )
-        goto error_out;
-    }
-    else if ( !strcmp( tagname, "tz-hint" ) )
-    {
-      xmlFree( tz_hint );
-      if( (tz_hint = gweather_xml_get_value( xml )) == NULL )
-        goto error_out;
-    }
-    else if ( !strcmp( tagname, "code" ) )
-    {
-      xmlFree( code );
-      if( (code = gweather_xml_get_value( xml )) == NULL )
-        goto error_out;
-    }
-    else if ( !strcmp( tagname, "zone" ) )
-    {
-      xmlFree( zone );
-      if( (zone = gweather_xml_get_value( xml )) == NULL )
-        goto error_out;
-    }
-    else if ( !strcmp( tagname, "radar" ) )
-    {
-      xmlFree( radar );
-      if( (radar = gweather_xml_get_value( xml )) == NULL )
-        goto error_out;
-    }
-    else if ( !strcmp( tagname, "coordinates" ) )
-    {
-      xmlFree( coordinates );
-      if( (coordinates = gweather_xml_get_value( xml )) == NULL )
-        goto error_out;
-    }
-    else /* some strange tag */
-    {
-      /* skip past it */
-      char *junk;
-      junk = gweather_xml_get_value( xml );
-      if( junk )
-	xmlFree( junk );
-    }
-
-    xmlFree( tagname );
-  }
+    if ((tagname = (char *) xmlTextReaderName (xml)) == NULL)
+	return FALSE;
 
-  if( self )
-    gtk_tree_store_set( store, self, GWEATHER_XML_COL_LOC, name, -1 );
+    if (!strcmp (tagname, "city"))
+	city = &name;
+    else
+	city = &nocity;
 
-  /* if this is an actual location, setup the WeatherLocation for it */
-  if( is_location )
-  {
-    WeatherLocation *new_loc;
-
-    if( cityname == NULL )
-      cityname = name;
-
-    if( radar != NULL )
-      dflt_radar = radar;
-
-    if( zone != NULL )
-      dflt_zone = zone;
-
-    new_loc =  weather_location_new( cityname, code, dflt_zone,
-                                     dflt_radar, coordinates,
-				     country_code, tz_hint );
-
-    gtk_tree_store_set( store, &iter, GWEATHER_XML_COL_POINTER, new_loc, -1 );
-  }
-  /* if this is not a location and there's no child, then it's useless */
-  else if ( !gtk_tree_model_iter_has_child( GTK_TREE_MODEL (store), &iter ) )
-  {
-    gtk_tree_store_remove( store, &iter );
-  }
-
-  /* if this is a city with only one location, then we merge the location and
-   * the city */
-  if (*city)
-  {
-    int n_children;
-
-    n_children = gtk_tree_model_iter_n_children( GTK_TREE_MODEL (store),
-                                                 &iter );
-    if ( n_children == 1 )
-    {
-      GtkTreeIter child;
-      WeatherLocation *loc;
-
-      gtk_tree_model_iter_children( GTK_TREE_MODEL (store), &child, &iter );
-      gtk_tree_model_get( GTK_TREE_MODEL (store), &child,
-                          GWEATHER_XML_COL_POINTER, &loc, -1 );
-      gtk_tree_store_remove( store, &child );
-      gtk_tree_store_set( store, &iter, GWEATHER_XML_COL_POINTER, loc, -1 );
-    }
-  }
+    is_location = !strcmp (tagname, "location");
 
-  /* absorb the end tag.  in the case of processing a <gweather> then 'self'
-     is NULL.  In this case, we let this fail since we might be at EOF */
-  if( xmlTextReaderRead( xml ) == 1 || !self )
-    ret = TRUE;
+    /* if we're processing the top-level, then don't create a new iter */
+    if (!strcmp (tagname, "gweather"))
+	self = NULL;
+    else {
+	self = &iter;
+	/* insert this node into the tree */
+	gtk_tree_store_append (store, self, parent);
+    }
+
+    xmlFree (tagname);
+
+    coordinates = NULL;
+    radar = NULL;
+    zone = NULL;
+    code = NULL;
+    name = NULL;
+
+    country_code = dflt_country_code ? (char *) xmlStrdup ((xmlChar *) dflt_country_code) : NULL;
+    tz_hint = dflt_tz_hint ? (char *) xmlStrdup ((xmlChar *) dflt_tz_hint) : NULL;
+
+    /* absorb the start tag */
+    if (xmlTextReaderRead (xml) != 1)
+	goto error_out;
+
+    /* start parsing the actual contents of the node */
+    while ((tagtype = xmlTextReaderNodeType (xml)) !=
+	   XML_READER_TYPE_END_ELEMENT) {
+	/* skip non-element types */
+	if (tagtype != XML_READER_TYPE_ELEMENT) {
+	    if (xmlTextReaderRead (xml) != 1)
+		goto error_out;
+
+	    continue;
+	}
+
+	tagname = (char *) xmlTextReaderName (xml);
+
+	if (!strcmp (tagname, "region") || !strcmp (tagname, "country") ||
+	    !strcmp (tagname, "state") || !strcmp (tagname, "city") ||
+	    !strcmp (tagname, "location")) {
+	    /* recursively handle sub-sections */
+	    if (!gweather_xml_parse_node (xml, store, self,
+					  radar, zone, country_code, tz_hint,
+					  *city))
+		goto error_out;
+	} else if (!strcmp (tagname, "name")) {
+	    xmlFree (name);
+	    if ((name = gweather_xml_parse_name (xml)) == NULL)
+		goto error_out;
+	} else if (!strcmp (tagname, "iso-code")) {
+	    xmlFree (country_code);
+	    if ((country_code = gweather_xml_get_value (xml)) == NULL)
+		goto error_out;
+	} else if (!strcmp (tagname, "tz-hint")) {
+	    xmlFree (tz_hint);
+	    if ((tz_hint = gweather_xml_get_value (xml)) == NULL)
+		goto error_out;
+	} else if (!strcmp (tagname, "code")) {
+	    xmlFree (code);
+	    if ((code = gweather_xml_get_value (xml)) == NULL)
+		goto error_out;
+	} else if (!strcmp (tagname, "zone")) {
+	    xmlFree (zone);
+	    if ((zone = gweather_xml_get_value (xml)) == NULL)
+		goto error_out;
+	} else if (!strcmp (tagname, "radar")) {
+	    xmlFree (radar);
+	    if ((radar = gweather_xml_get_value (xml)) == NULL)
+		goto error_out;
+	} else if (!strcmp (tagname, "coordinates")) {
+	    xmlFree (coordinates);
+	    if ((coordinates = gweather_xml_get_value (xml)) == NULL)
+		goto error_out;
+	} else /* some strange tag */ {
+	    /* skip past it */
+	    char *junk;
+	    junk = gweather_xml_get_value (xml);
+	    if (junk)
+		xmlFree (junk);
+	}
+
+	xmlFree (tagname);
+    }
+
+    if (self)
+	gtk_tree_store_set (store, self, GWEATHER_XML_COL_LOC, name, -1);
+
+    /* if this is an actual location, setup the WeatherLocation for it */
+    if (is_location) {
+	WeatherLocation *new_loc;
+
+	if (cityname == NULL)
+	    cityname = name;
+
+	if (radar != NULL)
+	    dflt_radar = radar;
+
+	if (zone != NULL)
+	    dflt_zone = zone;
+
+	new_loc =  weather_location_new (cityname, code, dflt_zone,
+					 dflt_radar, coordinates,
+					 country_code, tz_hint);
+
+	gtk_tree_store_set (store, &iter, GWEATHER_XML_COL_POINTER, new_loc, -1);
+    }
+    /* if this is not a location and there's no child, then it's useless */
+    else if (!gtk_tree_model_iter_has_child (GTK_TREE_MODEL (store), &iter)) {
+	gtk_tree_store_remove (store, &iter);
+    }
+
+    /* if this is a city with only one location, then we merge the location and
+     * the city */
+    if (*city) {
+	int n_children;
+
+	n_children = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store),
+						     &iter);
+	if (n_children == 1) {
+	    GtkTreeIter child;
+	    WeatherLocation *loc;
+
+	    gtk_tree_model_iter_children (GTK_TREE_MODEL (store), &child, &iter);
+	    gtk_tree_model_get (GTK_TREE_MODEL (store), &child,
+				GWEATHER_XML_COL_POINTER, &loc, -1);
+	    gtk_tree_store_remove (store, &child);
+	    gtk_tree_store_set (store, &iter, GWEATHER_XML_COL_POINTER, loc, -1);
+	}
+    }
+
+    /* absorb the end tag.  in the case of processing a <gweather> then 'self'
+       is NULL.  In this case, we let this fail since we might be at EOF */
+    if (xmlTextReaderRead (xml) == 1 || !self)
+	ret = TRUE;
 
 error_out:
-  xmlFree( name );
-  xmlFree( code );
-  xmlFree( zone );
-  xmlFree( radar );
-  xmlFree( coordinates );
-  xmlFree( country_code );
-  xmlFree( tz_hint );
+    xmlFree (name);
+    xmlFree (code);
+    xmlFree (zone);
+    xmlFree (radar);
+    xmlFree (coordinates);
+    xmlFree (country_code);
+    xmlFree (tz_hint);
 
-  return ret;
+    return ret;
 }
 
 GtkTreeModel *
-gweather_xml_load_locations( void )
+gweather_xml_load_locations (void)
 {
-  const char * const *languages;
-  int i;
-  char *filename;
-  char *tagname, *format;
-  GtkTreeSortable *sortable;
-  GtkTreeStore *store = NULL;
-  xmlTextReaderPtr xml;
-  int keep_going;
-
-  /* First try to load a locale-specific XML. It's much faster. */
-  languages = g_get_language_names ();
-  filename = NULL;
-
-  for (i = 0; languages[i] != NULL; i++)
-    {
-      filename = g_strdup_printf ("%s/Locations.%s.xml",
-                                  GWEATHER_XML_LOCATION_DIR, languages[i]);
-
-      if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
-        break;
-
-      g_free (filename);
-      filename = NULL;
-    }
-
-  /* Fallback on the file containing either all translations, or only
-   * the english names (depending on the configure flags). Note that it's
-   * also the file that is advertised in our pkg-config file, so it's
-   * part of the API. */
-  if (!filename)
-    filename = g_strdup (GWEATHER_XML_LOCATION_DIR"/Locations.xml");
-
-  /* Open the xml file containing the different locations */
-  xml = xmlNewTextReaderFilename (filename);
-  g_free (filename);
-
-  if( xml == NULL )
-    return NULL;
-
-  /* fast forward to the first element */
-  do
-  {
-    /* if we encounter a problem here, exit right away */
-    if( xmlTextReaderRead( xml ) != 1 )
-      goto error_out;
-  } while( xmlTextReaderNodeType( xml ) != XML_READER_TYPE_ELEMENT );
-
-  /* check the name and format */
-  tagname = (char *) xmlTextReaderName( xml );
-  keep_going = tagname && !strcmp( tagname, "gweather" );
-  xmlFree( tagname );
-
-  if( !keep_going )
-    goto error_out;
-
-  format = (char *) xmlTextReaderGetAttribute( xml, (xmlChar *) "format" );
-  keep_going = format && !strcmp( format, "1.0" );
-  xmlFree( format );
-
-  if( !keep_going )
-    goto error_out;
-
-  store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
-
-  if (!gweather_xml_parse_node( xml, store, NULL, NULL, NULL, NULL, NULL, NULL ))
-  {
-    g_object_unref( store );
-    store = NULL;
-    goto error_out;
-  }
-
-  /* Sort the tree */
-  sortable = GTK_TREE_SORTABLE( store );
-  gtk_tree_sortable_set_default_sort_func( sortable,
-                                           &gweather_xml_location_sort_func,
-                                           NULL, NULL);
-  gtk_tree_sortable_set_sort_column_id( sortable, 
-					GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
-                                        GTK_SORT_ASCENDING );
+    const char * const *languages;
+    int i;
+    char *filename;
+    char *tagname, *format;
+    GtkTreeSortable *sortable;
+    GtkTreeStore *store = NULL;
+    xmlTextReaderPtr xml;
+    int keep_going;
+
+    /* First try to load a locale-specific XML. It's much faster. */
+    languages = g_get_language_names ();
+    filename = NULL;
+
+    for (i = 0; languages[i] != NULL; i++) {
+	filename = g_strdup_printf ("%s/Locations.%s.xml",
+				    GWEATHER_XML_LOCATION_DIR, languages[i]);
+
+	if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
+	    break;
+
+	g_free (filename);
+	filename = NULL;
+    }
+
+    /* Fallback on the file containing either all translations, or only
+     * the english names (depending on the configure flags). Note that it's
+     * also the file that is advertised in our pkg-config file, so it's
+     * part of the API. */
+    if (!filename)
+	filename = g_strdup (GWEATHER_XML_LOCATION_DIR "/Locations.xml");
+
+    /* Open the xml file containing the different locations */
+    xml = xmlNewTextReaderFilename (filename);
+    g_free (filename);
+
+    if (xml == NULL)
+	return NULL;
+
+    /* fast forward to the first element */
+    do {
+	/* if we encounter a problem here, exit right away */
+	if (xmlTextReaderRead (xml) != 1)
+	    goto error_out;
+    } while (xmlTextReaderNodeType (xml) != XML_READER_TYPE_ELEMENT);
+
+    /* check the name and format */
+    tagname = (char *) xmlTextReaderName (xml);
+    keep_going = tagname && !strcmp (tagname, "gweather");
+    xmlFree (tagname);
+
+    if (!keep_going)
+	goto error_out;
+
+    format = (char *) xmlTextReaderGetAttribute (xml, (xmlChar *) "format");
+    keep_going = format && !strcmp (format, "1.0");
+    xmlFree (format);
+
+    if (!keep_going)
+	goto error_out;
+
+    store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
+
+    if (!gweather_xml_parse_node (xml, store, NULL, NULL, NULL, NULL, NULL, NULL)) {
+	g_object_unref (store);
+	store = NULL;
+	goto error_out;
+    }
+
+    /* Sort the tree */
+    sortable = GTK_TREE_SORTABLE (store);
+    gtk_tree_sortable_set_default_sort_func (sortable,
+					     &gweather_xml_location_sort_func,
+					     NULL, NULL);
+    gtk_tree_sortable_set_sort_column_id (sortable,
+					  GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
+					  GTK_SORT_ASCENDING);
 error_out:
-  xmlFreeTextReader( xml );
+    xmlFreeTextReader (xml);
 
-  return (GtkTreeModel *)store;
+    return (GtkTreeModel *)store;
 }

Modified: trunk/libgweather/gweather-xml.h
==============================================================================
--- trunk/libgweather/gweather-xml.h	(original)
+++ trunk/libgweather/gweather-xml.h	Wed Jun 18 17:46:52 2008
@@ -1,4 +1,5 @@
-/* gweather-xml.h 
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* gweather-xml.h
  *
  * Copyright (C) 2004 Gareth Owen
  *
@@ -28,8 +29,8 @@
     GWEATHER_XML_COL_LOC = 0,
     GWEATHER_XML_COL_POINTER,
     GWEATHER_XML_NUM_COLUMNS
-}; 
+};
 
-GtkTreeModel *gweather_xml_load_locations( void );
+GtkTreeModel *gweather_xml_load_locations (void);
 
 #endif /* __GWEATHER_XML_H__ */

Modified: trunk/libgweather/test_metar.c
==============================================================================
--- trunk/libgweather/test_metar.c	(original)
+++ trunk/libgweather/test_metar.c	Wed Jun 18 17:46:52 2008
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /* $Id: test_metar.c 9270 2006-01-15 10:15:19Z davyd $ */
 
 /*
@@ -17,63 +18,59 @@
 int
 main (int argc, char **argv)
 {
-  FILE*  stream = stdin;
-  gchar* filename = NULL;
-  GOptionEntry entries[] =
-  {
-    { "file", 'f', 0, G_OPTION_ARG_FILENAME, &filename,
-      "file constaining metar observations", NULL },
-    { NULL }
-  };
-  GOptionContext* context;
-  GError* error = NULL;
-  char buf[BUFLEN];
-  int len;
-  WeatherInfo info;
-
-
-  context = g_option_context_new ("- test libgweather metar parser");
-  g_option_context_add_main_entries (context, entries, NULL);
-  g_option_context_parse (context, &argc, &argv, &error);
-
-  if (error) {
-    perror(error->message);
-    return error->code;
-  }
-  if (filename) {
-    stream = fopen(filename, "r");
-    if (!stream) {
-      perror("fopen");
-      return -1;
+    FILE*  stream = stdin;
+    gchar* filename = NULL;
+    GOptionEntry entries[] = {
+	{ "file", 'f', 0, G_OPTION_ARG_FILENAME, &filename,
+	  "file constaining metar observations", NULL },
+	{ NULL }
+    };
+    GOptionContext* context;
+    GError* error = NULL;
+    char buf[BUFLEN];
+    int len;
+    WeatherInfo info;
+
+    context = g_option_context_new ("- test libgweather metar parser");
+    g_option_context_add_main_entries (context, entries, NULL);
+    g_option_context_parse (context, &argc, &argv, &error);
+
+    if (error) {
+	perror (error->message);
+	return error->code;
     }
-  }
-  else
-  {
-    fprintf (stderr, "Enter a METAR string...\n");
-  }
-
-  while (fgets(buf, sizeof(buf), stream)) {
-      len = strlen(buf);
-      if (buf[len - 1] == '\n') {
-	  buf[--len] = '\0';
-      }
-      printf("\n%s\n", buf);
-
-      memset (&info, 0, sizeof(info));
-      info.valid = 1;
-      metar_parse(buf, &info);
-      printf("Returned info:\n");
-      printf("  update:   %s", ctime(&info.update));
-      printf("  sky:      %s\n", weather_info_get_sky(&info));
-      printf("  cond:     %s\n", weather_info_get_conditions(&info));
-      printf("  temp:     %g F\n", info.temp);
-      printf("  dewp:     %g F\n", info.dew);
-      printf("  winddir:  %s\n", weather_wind_direction_string(info.wind));
-      printf("  windsp:   %d knots\n", info.windspeed);
-      printf("  pressure: %g\" Hg\n", info.pressure);
-      printf("  vis:      %g miles\n", info.visibility);
-
-      // TODO: retrieve location's lat/lon to display sunrise/set times
-  }
-  return 0;
+    if (filename) {
+	stream = fopen (filename, "r");
+	if (!stream) {
+	    perror ("fopen");
+	    return -1;
+	}
+    } else {
+	fprintf (stderr, "Enter a METAR string...\n");
+    }
+
+    while (fgets (buf, sizeof (buf), stream)) {
+	len = strlen (buf);
+	if (buf[len - 1] == '\n') {
+	    buf[--len] = '\0';
+	}
+	printf ("\n%s\n", buf);
+
+	memset (&info, 0, sizeof (info));
+	info.valid = 1;
+	metar_parse (buf, &info);
+	printf ("Returned info:\n");
+	printf ("  update:   %s", ctime (&info.update));
+	printf ("  sky:      %s\n", weather_info_get_sky (&info));
+	printf ("  cond:     %s\n", weather_info_get_conditions (&info));
+	printf ("  temp:     %g F\n", info.temp);
+	printf ("  dewp:     %g F\n", info.dew);
+	printf ("  winddir:  %s\n", weather_wind_direction_string (info.wind));
+	printf ("  windsp:   %d knots\n", info.windspeed);
+	printf ("  pressure: %g\" Hg\n", info.pressure);
+	printf ("  vis:      %g miles\n", info.visibility);
+
+	// TODO: retrieve location's lat/lon to display sunrise/set times
+    }
+    return 0;
 }

Modified: trunk/libgweather/weather-bom.c
==============================================================================
--- trunk/libgweather/weather-bom.c	(original)
+++ trunk/libgweather/weather-bom.c	Wed Jun 18 17:46:52 2008
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /* $Id: weather-bom.c 9804 2006-08-07 14:05:56Z davyd $ */
 
 /*
@@ -19,108 +20,108 @@
 #include <libgweather/weather.h>
 #include "weather-priv.h"
 
-static gchar *bom_parse (gchar *meto)
-{ 
+static gchar *
+bom_parse (gchar *meto)
+{
     gchar *p, *rp;
 
     g_return_val_if_fail (meto != NULL, NULL);
 
-    p = strstr(meto, "<pre>");
+    p = strstr (meto, "<pre>");
     g_return_val_if_fail (p != NULL, NULL);
 
-    rp = strstr(p, "</pre>");
+    rp = strstr (p, "</pre>");
     g_return_val_if_fail (rp !=NULL, NULL);
-    
+
     p += 5; /* skip the <pre> */
 
-    return g_strndup(p, rp-p);
+    return g_strndup (p, rp-p);
 }
 
-static void bom_finish_read(GnomeVFSAsyncHandle *handle, GnomeVFSResult result, 
-			    gpointer buffer, GnomeVFSFileSize requested, 
-			    GnomeVFSFileSize body_len, gpointer data)
+static void
+bom_finish_read (GnomeVFSAsyncHandle *handle, GnomeVFSResult result,
+		 gpointer buffer, GnomeVFSFileSize requested,
+		 GnomeVFSFileSize body_len, gpointer data)
 {
     WeatherInfo *info = (WeatherInfo *)data;
     gchar *body, *forecast, *temp;
 
-    g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->bom_handle);
+    g_return_if_fail (info != NULL);
+    g_return_if_fail (handle == info->bom_handle);
 
     info->forecast = NULL;
     body = (gchar *)buffer;
     body[body_len] = '\0';
-	
+
     if (info->bom_buffer == NULL)
-        info->bom_buffer = g_strdup(body);
-    else
-    {
-        temp = g_strdup(info->bom_buffer);
-	g_free(info->bom_buffer);
-	info->bom_buffer = g_strdup_printf("%s%s", temp, body);
-	g_free(temp);
+        info->bom_buffer = g_strdup (body);
+    else {
+        temp = g_strdup (info->bom_buffer);
+	g_free (info->bom_buffer);
+	info->bom_buffer = g_strdup_printf ("%s%s", temp, body);
+	g_free (temp);
     }
-	
-    if (result == GNOME_VFS_ERROR_EOF)
-    {
-	forecast = bom_parse(info->bom_buffer);
+
+    if (result == GNOME_VFS_ERROR_EOF) {
+	forecast = bom_parse (info->bom_buffer);
         info->forecast = forecast;
-    }
-    else if (result != GNOME_VFS_OK) {
+    } else if (result != GNOME_VFS_OK) {
 	info->bom_handle = NULL;
 	requests_done_check (info);
-        g_warning("Failed to get BOM data.\n");
+        g_warning ("Failed to get BOM data.\n");
     } else {
-	gnome_vfs_async_read(handle, body, DATA_SIZE - 1, bom_finish_read, info);
-
+	gnome_vfs_async_read (handle, body, DATA_SIZE - 1, bom_finish_read, info);
 	return;
     }
-    
-    request_done(info->bom_handle, info);
+
+    request_done (info->bom_handle, info);
     g_free (buffer);
     return;
 }
 
-static void bom_finish_open (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
+static void
+bom_finish_open (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
 {
     WeatherInfo *info = (WeatherInfo *)data;
     WeatherLocation *loc;
     gchar *body;
 
-    g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->bom_handle);
+    g_return_if_fail (info != NULL);
+    g_return_if_fail (handle == info->bom_handle);
 
-    body = g_malloc0(DATA_SIZE);
+    body = g_malloc0 (DATA_SIZE);
 
     info->bom_buffer = NULL;
     if (info->forecast)
-    	g_free (info->forecast);	
+    	g_free (info->forecast);
     info->forecast = NULL;
     loc = info->location;
-    g_return_if_fail(loc != NULL);
+    g_return_if_fail (loc != NULL);
 
     if (result != GNOME_VFS_OK) {
-        g_warning("Failed to get BOM forecast data.\n");
+        g_warning ("Failed to get BOM forecast data.\n");
         info->bom_handle = NULL;
         requests_done_check (info);
         g_free (body);
     } else {
-    	gnome_vfs_async_read(handle, body, DATA_SIZE - 1, bom_finish_read, info);
+    	gnome_vfs_async_read (handle, body, DATA_SIZE - 1, bom_finish_read, info);
     }
     return;
 }
 
-void bom_start_open (WeatherInfo *info)
+void
+bom_start_open (WeatherInfo *info)
 {
     gchar *url;
     WeatherLocation *loc;
     loc = info->location;
-  
-    url = g_strdup_printf("http://www.bom.gov.au/cgi-bin/wrap_fwo.pl?%s.txt";,
-			  loc->zone+1);
-
-    gnome_vfs_async_open(&info->bom_handle, url, GNOME_VFS_OPEN_READ, 
-    			 0, bom_finish_open, info);
-    g_free(url);
+
+    url = g_strdup_printf ("http://www.bom.gov.au/cgi-bin/wrap_fwo.pl?%s.txt";,
+			   loc->zone + 1);
+
+    gnome_vfs_async_open (&info->bom_handle, url, GNOME_VFS_OPEN_READ,
+			  0, bom_finish_open, info);
+    g_free (url);
 
     return;
-}	
+}

Modified: trunk/libgweather/weather-iwin.c
==============================================================================
--- trunk/libgweather/weather-iwin.c	(original)
+++ trunk/libgweather/weather-iwin.c	Wed Jun 18 17:46:52 2008
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /* $Id: weather-iwin.c 10523 2007-11-16 08:03:22Z callum $ */
 
 /*
@@ -17,35 +18,28 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/types.h>
-#include <regex.h>
 #include <glib/gi18n-lib.h>
 
 #define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
 #include <libgweather/weather.h>
 #include "weather-priv.h"
 
-#define IWIN_RE_STR "([A-Z][A-Z]Z(([0-9]{3}>[0-9]{3}-)|([0-9]{3}-))+)+([0-9]{6}-)?"
-
 /**
- * Unused. Are these functions useful?
- */
-
-/**
- *  Human's don't deal well with .MONDAY...SUNNY AND BLAH BLAH.TUESDAY...THEN THIS AND THAT.WEDNESDAY...RAINY BLAH BLAH.
+ *  Humans don't deal well with .MONDAY...SUNNY AND BLAH BLAH.TUESDAY...THEN THIS AND THAT.WEDNESDAY...RAINY BLAH BLAH.
  *  This function makes it easier to read.
  */
-static gchar* formatWeatherMsg (gchar* forecast) {
-
-    gchar* ptr = forecast;
-    gchar* startLine = NULL;
+static gchar *
+formatWeatherMsg (gchar *forecast)
+{
+    gchar *ptr = forecast;
+    gchar *startLine = NULL;
 
     while (0 != *ptr) {
         if (ptr[0] == '\n' && ptr[1] == '.') {
   	    /* This removes the preamble by shifting the relevant data
 	     * down to the start of the buffer. */
             if (NULL == startLine) {
-                memmove(forecast, ptr, strlen(ptr) + 1);
+                memmove (forecast, ptr, strlen (ptr) + 1);
                 ptr = forecast;
                 ptr[0] = ' ';
             }
@@ -53,7 +47,7 @@
             ptr += 2;
             startLine = ptr;
         } else if (ptr[0] == '.' && ptr[1] == '.' && ptr[2] == '.' && NULL != startLine) {
-            memmove(startLine + 2, startLine, (ptr - startLine) * sizeof(gchar));
+            memmove (startLine + 2, startLine, (ptr - startLine) * sizeof (gchar));
             startLine[0] = ' ';
             startLine[1] = '\n';
             ptr[2] = '\n';
@@ -71,135 +65,122 @@
     return forecast;
 }
 
-
-static void iwin_finish_read(GnomeVFSAsyncHandle *handle, GnomeVFSResult result, 
-			     gpointer buffer, GnomeVFSFileSize requested, 
-			     GnomeVFSFileSize body_len, gpointer data)
+static void
+iwin_finish_read (GnomeVFSAsyncHandle *handle, GnomeVFSResult result,
+		  gpointer buffer, GnomeVFSFileSize requested,
+		  GnomeVFSFileSize body_len, gpointer data)
 {
     WeatherInfo *info = (WeatherInfo *)data;
     gchar *body, *temp;
-    
-    g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->iwin_handle);
+
+    g_return_if_fail (info != NULL);
+    g_return_if_fail (handle == info->iwin_handle);
 
     info->forecast = NULL;
     body = (gchar *)buffer;
     body[body_len] = '\0';
 
     if (info->iwin_buffer == NULL)
-	info->iwin_buffer = g_strdup(body);
-    else
-    {
-	temp = g_strdup(info->iwin_buffer);
-	g_free(info->iwin_buffer);
-	info->iwin_buffer = g_strdup_printf("%s%s", temp, body);
-	g_free(temp);
-    }
-	
-    if (result == GNOME_VFS_ERROR_EOF)
-    {
-        info->forecast = formatWeatherMsg(g_strdup (info->iwin_buffer));
-    }
-    else if (result != GNOME_VFS_OK) {
-	g_print("%s", gnome_vfs_result_to_string(result));
-        g_warning("Failed to get IWIN data.\n");
+	info->iwin_buffer = g_strdup (body);
+    else {
+	temp = g_strdup (info->iwin_buffer);
+	g_free (info->iwin_buffer);
+	info->iwin_buffer = g_strdup_printf ("%s%s", temp, body);
+	g_free (temp);
+    }
+
+    if (result == GNOME_VFS_ERROR_EOF) {
+        info->forecast = formatWeatherMsg (g_strdup (info->iwin_buffer));
+    } else if (result != GNOME_VFS_OK) {
+	g_print ("%s", gnome_vfs_result_to_string (result));
+        g_warning ("Failed to get IWIN data.\n");
     } else {
-        gnome_vfs_async_read(handle, body, DATA_SIZE - 1, iwin_finish_read, info);
+        gnome_vfs_async_read (handle, body, DATA_SIZE - 1, iwin_finish_read, info);
         return;
     }
-    
-    request_done(info->iwin_handle, info);
+
+    request_done (info->iwin_handle, info);
     g_free (buffer);
     return;
 }
 
-static void iwin_finish_open (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
+static void
+iwin_finish_open (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
 {
     WeatherInfo *info = (WeatherInfo *)data;
     WeatherLocation *loc;
     gchar *body;
 
-    g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->iwin_handle);
+    g_return_if_fail (info != NULL);
+    g_return_if_fail (handle == info->iwin_handle);
 
-    body = g_malloc0(DATA_SIZE);
+    body = g_malloc0 (DATA_SIZE);
 
     if (info->iwin_buffer)
     	g_free (info->iwin_buffer);
-    info->iwin_buffer = NULL;	
+    info->iwin_buffer = NULL;
     if (info->forecast)
-    g_free (info->forecast);
+	g_free (info->forecast);
     info->forecast = NULL;
     loc = info->location;
     if (loc == NULL) {
-	    g_warning (_("WeatherInfo missing location"));
-	    request_done(info->iwin_handle, info);
-	    info->iwin_handle = NULL;
-	    requests_done_check(info);
-	    g_free (body);
-	    return;
+	g_warning (_("WeatherInfo missing location"));
+	request_done (info->iwin_handle, info);
+	info->iwin_handle = NULL;
+	requests_done_check (info);
+	g_free (body);
+	return;
     }
 
     if (result != GNOME_VFS_OK) {
         /* forecast data is not really interesting anyway ;) */
-	  g_warning("Failed to get IWIN forecast data.\n"); 
+	g_warning ("Failed to get IWIN forecast data.\n");
         info->iwin_handle = NULL;
         requests_done_check (info);
         g_free (body);
     } else {
-        gnome_vfs_async_read(handle, body, DATA_SIZE - 1, iwin_finish_read, info);
+        gnome_vfs_async_read (handle, body, DATA_SIZE - 1, iwin_finish_read, info);
     }
     return;
 }
 
 /* Get forecast into newly alloc'ed string */
-void iwin_start_open (WeatherInfo *info)
+void
+iwin_start_open (WeatherInfo *info)
 {
     gchar *url, *state, *zone;
     WeatherLocation *loc;
 
-    g_return_if_fail(info != NULL);
+    g_return_if_fail (info != NULL);
     loc = info->location;
-    g_return_if_fail(loc != NULL);
+    g_return_if_fail (loc != NULL);
 
     if (loc->zone[0] == '-')
         return;
-        
-    if (loc->zone[0] == ':')	/* Met Office Region Names */
-    {
+
+    if (loc->zone[0] == ':') {
+	/* Met Office Region Names */
     	metoffice_start_open (info);
     	return;
-    }
-    if (loc->zone[0] == '@')    /* Australian BOM forecasts */
-    {
+    } else if (loc->zone[0] == '@') {
+	/* Australian BOM forecasts */
     	bom_start_open (info);
     	return;
     }
-    
-#if 0
-    if (info->forecast_type == FORECAST_ZONE)
-        url = g_strdup_printf("http://iwin.nws.noaa.gov/iwin/%s/zone.html";,
-			loc->zone);
-    else
-        url = g_strdup_printf("http://iwin.nws.noaa.gov/iwin/%s/state.html";,
-			loc->zone);
-#endif
-    
+
     /* The zone for Pittsburgh (for example) is given as PAZ021 in the locations
     ** file (the PA stands for the state pennsylvania). The url used wants the state
     ** as pa, and the zone as lower case paz021.
     */
     zone = g_ascii_strdown (loc->zone, -1);
     state = g_strndup (zone, 2);
-    
+
     url = g_strdup_printf ("http://weather.noaa.gov/pub/data/forecasts/zone/%s/%s.txt";,
-        		   state, zone); 
-    g_free (zone);   
+        		   state, zone);
+    g_free (zone);
     g_free (state);
 
-    gnome_vfs_async_open(&info->iwin_handle, url, GNOME_VFS_OPEN_READ, 
-    			 0, iwin_finish_open, info);
-    g_free(url);
-
+    gnome_vfs_async_open (&info->iwin_handle, url, GNOME_VFS_OPEN_READ,
+			  0, iwin_finish_open, info);
+    g_free (url);
 }
-

Modified: trunk/libgweather/weather-met.c
==============================================================================
--- trunk/libgweather/weather-met.c	(original)
+++ trunk/libgweather/weather-met.c	Wed Jun 18 17:46:52 2008
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /* $Id: weather-met.c 10124 2007-01-05 14:02:46Z kmaraas $ */
 
 /*
@@ -23,140 +24,132 @@
 #include <libgweather/weather.h>
 #include "weather-priv.h"
 
-static char *met_reprocess(char *x, int len)
+static char *
+met_reprocess (char *x, int len)
 {
-	char *p = x;
-	char *o;
-	int spacing = 0;
-	static gchar *buf;
-	static gint buflen = 0;
-	gchar *lastspace = NULL;
-	int count = 0;
-	
-	if(buflen < len)
-	{
-		if(buf)
-			g_free(buf);
-		buf=g_malloc(len + 1);
-		buflen=len;
+    char *p = x;
+    char *o;
+    int spacing = 0;
+    static gchar *buf;
+    static gint buflen = 0;
+    gchar *lastspace = NULL;
+    int count = 0;
+
+    if (buflen < len)
+    {
+	if (buf)
+	    g_free (buf);
+	buf = g_malloc (len + 1);
+	buflen = len;
+    }
+
+    o = buf;
+    x += len;       /* End mark */
+
+    while (*p && p < x) {
+	if (isspace (*p)) {
+	    if (!spacing) {
+		spacing = 1;
+		lastspace = o;
+		count++;
+		*o++ = ' ';
+	    }
+	    p++;
+	    continue;
 	}
-		
-	o=buf;
-	x += len;       /* End mark */
-
-	while(*p && p < x)
-	{
-		if(isspace(*p))
-		{
-			if(!spacing)
-			{
-				spacing = 1;
-				lastspace = o;
-				count++;
-				*o++ = ' ';
-			}
-			p++;
-			continue;
-		}
-		spacing = 0;
-		if(count > 75 && lastspace)
-		{
-			count = o - lastspace - 1;
-			*lastspace = '\n';
-			lastspace = NULL;
-		}
-
-		if(*p=='&')
-		{
-			if(strncasecmp(p, "&amp;", 5)==0)
-			{
-				*o++='&';
-				count++;
-				p+=5;
-				continue;
-			}
-			if(strncasecmp(p, "&lt;", 4)==0)
-			{
-				*o++='<';
-				count++;
-				p+=4;
-				continue;
-			}
-			if(strncasecmp(p, "&gt;", 4)==0)
-			{
-				*o++='>';
-				count++;
-				p+=4;
-				continue;
-			}
-		}
-		if(*p=='<')
-		{
-			if(strncasecmp(p, "<BR>", 4)==0)
-			{
-				*o++='\n';
-				count = 0;
-			}
-			if(strncasecmp(p, "<B>", 3)==0)
-			{
-				*o++='\n';
-				*o++='\n';
-				count = 0;
-			}
-			p++;
-			while(*p && *p != '>')
-				p++;
-			if(*p)
-				p++;
-			continue;
-		}
-		*o++=*p++;
+	spacing = 0;
+	if (count > 75 && lastspace) {
+	    count = o - lastspace - 1;
+	    *lastspace = '\n';
+	    lastspace = NULL;
+	}
+
+	if (*p == '&') {
+	    if (strncasecmp (p, "&amp;", 5) == 0) {
+		*o++ = '&';
+		count++;
+		p += 5;
+		continue;
+	    }
+	    if (strncasecmp (p, "&lt;", 4) == 0) {
+		*o++ = '<';
 		count++;
+		p += 4;
+		continue;
+	    }
+	    if (strncasecmp (p, "&gt;", 4) == 0) {
+		*o++ = '>';
+		count++;
+		p += 4;
+		continue;
+	    }
+	}
+	if (*p == '<') {
+	    if (strncasecmp (p, "<BR>", 4) == 0) {
+		*o++ = '\n';
+		count = 0;
+	    }
+	    if (strncasecmp (p, "<B>", 3) == 0) {
+		*o++ = '\n';
+		*o++ = '\n';
+		count = 0;
+	    }
+	    p++;
+	    while (*p && *p != '>')
+		p++;
+	    if (*p)
+		p++;
+	    continue;
 	}
-	*o=0;
-	return buf;
+	*o++ = *p++;
+	count++;
+    }
+    *o = 0;
+    return buf;
 }
 
 
 /*
  * Parse the metoffice forecast info.
- * For gnome 3.0 we want to just embed an HTML bonobo component and 
- * be done with this ;) 
+ * For gnome 3.0 we want to just embed an HTML bonobo component and
+ * be done with this ;)
  */
 
-static gchar *met_parse (gchar *meto)
-{ 
+static gchar *
+met_parse (gchar *meto)
+{
     gchar *p;
     gchar *rp;
-    gchar *r = g_strdup("Met Office Forecast\n");
-    gchar *t;    
+    gchar *r = g_strdup ("Met Office Forecast\n");
+    gchar *t;
 
     g_return_val_if_fail (meto != NULL, r);
 
-    p = strstr(meto, "Summary: </b>");
+    p = strstr (meto, "Summary: </b>");
     g_return_val_if_fail (p != NULL, r);
 
-    rp = strstr(p, "Text issued at:");
+    rp = strstr (p, "Text issued at:");
     g_return_val_if_fail (rp != NULL, r);
 
     p += 13;
     /* p to rp is the text block we want but in HTML malformat */
-    t = g_strconcat(r, met_reprocess(p, rp-p), NULL);
-    g_free(r);
+    t = g_strconcat (r, met_reprocess (p, rp - p), NULL);
+    g_free (r);
 
     return t;
 }
 
-static void met_finish_read(GnomeVFSAsyncHandle *handle, GnomeVFSResult result, 
-			    gpointer buffer, GnomeVFSFileSize requested, 
-			    GnomeVFSFileSize body_len, gpointer data)
+static void
+met_finish_read (GnomeVFSAsyncHandle *handle, GnomeVFSResult result,
+		 gpointer buffer, GnomeVFSFileSize requested,
+		 GnomeVFSFileSize body_len, gpointer data)
 {
     WeatherInfo *info = (WeatherInfo *)data;
     WeatherLocation *loc;
     gchar *body, *forecast, *temp;
 
-    g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->met_handle);
+    g_return_if_fail (info != NULL);
+    g_return_if_fail (handle == info->met_handle);
 
     info->forecast = NULL;
     loc = info->location;
@@ -164,76 +157,72 @@
     body[body_len] = '\0';
 
     if (info->met_buffer == NULL)
-        info->met_buffer = g_strdup(body);
-    else
-    {
-        temp = g_strdup(info->met_buffer);
-	g_free(info->met_buffer);
-	info->met_buffer = g_strdup_printf("%s%s", temp, body);
-	g_free(temp);
+        info->met_buffer = g_strdup (body);
+    else {
+        temp = g_strdup (info->met_buffer);
+	g_free (info->met_buffer);
+	info->met_buffer = g_strdup_printf ("%s%s", temp, body);
+	g_free (temp);
     }
-	
-    if (result == GNOME_VFS_ERROR_EOF)
-    {
-	forecast = met_parse(info->met_buffer);
+
+    if (result == GNOME_VFS_ERROR_EOF) {
+	forecast = met_parse (info->met_buffer);
         info->forecast = forecast;
-    }
-    else if (result != GNOME_VFS_OK) {
-	g_print("%s", gnome_vfs_result_to_string(result));
+    } else if (result != GNOME_VFS_OK) {
+	g_print ("%s", gnome_vfs_result_to_string (result));
 	info->met_handle = NULL;
 	requests_done_check (info);
-        g_warning("Failed to get Met Office data.\n");
+        g_warning ("Failed to get Met Office data.\n");
     } else {
-        gnome_vfs_async_read(handle, body, DATA_SIZE - 1, met_finish_read, info);
+        gnome_vfs_async_read (handle, body, DATA_SIZE - 1, met_finish_read, info);
         return;
     }
-    
-    request_done(info->met_handle, info);
+
+    request_done (info->met_handle, info);
     g_free (buffer);
     return;
 }
 
-static void met_finish_open (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
+static void
+met_finish_open (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
 {
     WeatherInfo *info = (WeatherInfo *)data;
     WeatherLocation *loc;
     gchar *body;
 
-    g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->met_handle);
+    g_return_if_fail (info != NULL);
+    g_return_if_fail (handle == info->met_handle);
 
-    body = g_malloc0(DATA_SIZE);
+    body = g_malloc0 (DATA_SIZE);
 
     info->met_buffer = NULL;
     if (info->forecast)
-    	g_free (info->forecast);	
+    	g_free (info->forecast);
     info->forecast = NULL;
     loc = info->location;
-    g_return_if_fail(loc != NULL);
+    g_return_if_fail (loc != NULL);
 
     if (result != GNOME_VFS_OK) {
-        g_warning("Failed to get Met Office forecast data.\n");
+        g_warning ("Failed to get Met Office forecast data.\n");
         info->met_handle = NULL;
         requests_done_check (info);
         g_free (body);
     } else {
-    	gnome_vfs_async_read(handle, body, DATA_SIZE - 1, met_finish_read, info);
+    	gnome_vfs_async_read (handle, body, DATA_SIZE - 1, met_finish_read, info);
     }
     return;
 }
 
-void metoffice_start_open (WeatherInfo *info)
+void
+metoffice_start_open (WeatherInfo *info)
 {
     gchar *url;
     WeatherLocation *loc;
     loc = info->location;
-  
-    url = g_strdup_printf("http://www.metoffice.gov.uk/weather/europe/uk/%s.html";, loc->zone+1);
 
-    gnome_vfs_async_open(&info->met_handle, url, GNOME_VFS_OPEN_READ, 
-    			 0, met_finish_open, info);
-    g_free(url);
-
-    return;
-}	
+    url = g_strdup_printf ("http://www.metoffice.gov.uk/weather/europe/uk/%s.html";, loc->zone + 1);
 
+    gnome_vfs_async_open (&info->met_handle, url, GNOME_VFS_OPEN_READ,
+			  0, met_finish_open, info);
+    g_free (url);
+}

Modified: trunk/libgweather/weather-metar.c
==============================================================================
--- trunk/libgweather/weather-metar.c	(original)
+++ trunk/libgweather/weather-metar.c	Wed Jun 18 17:46:52 2008
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /* $Id: weather-metar.c 10286 2007-07-12 08:52:56Z callum $ */
 
 /*
@@ -29,23 +30,23 @@
 #include "weather-priv.h"
 
 
-enum
-{
-	TIME_RE,
-	WIND_RE,
-	VIS_RE,
-	COND_RE,
-	CLOUD_RE,
-	TEMP_RE,
-	PRES_RE,
-	
-	RE_NUM
+enum {
+    TIME_RE,
+    WIND_RE,
+    VIS_RE,
+    COND_RE,
+    CLOUD_RE,
+    TEMP_RE,
+    PRES_RE,
+
+    RE_NUM
 };
 
 /* Return time of weather report as secs since epoch UTC */
-static time_t make_time (gint utcDate, gint utcHour, gint utcMin)
+static time_t
+make_time (gint utcDate, gint utcHour, gint utcMin)
 {
-    const time_t now = time(NULL);
+    const time_t now = time (NULL);
     struct tm tm;
 
     localtime_r (&now, &tm);
@@ -66,42 +67,44 @@
 
     /* mktime() assumes value is local, not UTC.  Use tm_gmtoff to compensate */
 #ifdef HAVE_TM_TM_GMOFF
-   return tm.tm_gmtoff + mktime(&tm);
+    return tm.tm_gmtoff + mktime (&tm);
 #elif defined HAVE_TIMEZONE
-   return timezone + mktime(&tm);
+    return timezone + mktime (&tm);
 #endif
 }
 
-static void metar_tok_time (gchar *tokp, WeatherInfo *info)
+static void
+metar_tok_time (gchar *tokp, WeatherInfo *info)
 {
     gint day, hr, min;
 
-    sscanf(tokp, "%2u%2u%2u", &day, &hr, &min);
-    info->update = make_time(day, hr, min);
+    sscanf (tokp, "%2u%2u%2u", &day, &hr, &min);
+    info->update = make_time (day, hr, min);
 }
 
-static void metar_tok_wind (gchar *tokp, WeatherInfo *info)
+static void
+metar_tok_wind (gchar *tokp, WeatherInfo *info)
 {
     gchar sdir[4], sspd[4], sgust[4];
     gint dir, spd = -1;
     gchar *gustp;
     size_t glen;
-    
-    strncpy(sdir, tokp, 3);
+
+    strncpy (sdir, tokp, 3);
     sdir[3] = 0;
-    dir = (!strcmp(sdir, "VRB")) ? -1 : atoi(sdir);
+    dir = (!strcmp (sdir, "VRB")) ? -1 : atoi (sdir);
 
-    memset(sspd, 0, sizeof(sspd));
-    glen = strspn(tokp+3, CONST_DIGITS);
-    strncpy(sspd, tokp+3, glen);
-    spd = atoi(sspd);
+    memset (sspd, 0, sizeof (sspd));
+    glen = strspn (tokp + 3, CONST_DIGITS);
+    strncpy (sspd, tokp + 3, glen);
+    spd = atoi (sspd);
     tokp += glen + 3;
 
-    gustp = strchr(tokp, 'G');
+    gustp = strchr (tokp, 'G');
     if (gustp) {
-        memset(sgust, 0, sizeof(sgust));
-	glen = strspn(gustp+1, CONST_DIGITS);
-        strncpy(sgust, gustp+1, glen);
+        memset (sgust, 0, sizeof (sgust));
+	glen = strspn (gustp + 1, CONST_DIGITS);
+        strncpy (sgust, gustp + 1, glen);
     }
 
     if ((349 <= dir) || (dir <= 11))
@@ -136,232 +139,236 @@
         info->wind = WIND_NW;
     else if ((327 <= dir) && (dir <= 348))
         info->wind = WIND_NNW;
-    
+
     info->windspeed = (WeatherWindSpeed)spd;
 }
 
-static void metar_tok_vis (gchar *tokp, WeatherInfo *info)
+static void
+metar_tok_vis (gchar *tokp, WeatherInfo *info)
 {
     gchar *pfrac, *pend, *psp;
     gchar sval[6];
     gint num, den, val;
-    
-    memset(sval, 0, sizeof(sval));
 
-    if (!strcmp(tokp,"CAVOK")) {
+    memset (sval, 0, sizeof (sval));
+
+    if (!strcmp (tokp,"CAVOK")) {
         // "Ceiling And Visibility OK": visibility >= 10 KM
-        info->visibility=10000. / VISIBILITY_SM_TO_M(1.);
+        info->visibility=10000. / VISIBILITY_SM_TO_M (1.);
         info->sky = SKY_CLEAR;
-    }
-    else if (0 != (pend = strstr(tokp, "SM"))) {
+    } else if (0 != (pend = strstr (tokp, "SM"))) {
         // US observation: field ends with "SM"
-        pfrac = strchr(tokp, '/');
+        pfrac = strchr (tokp, '/');
         if (pfrac) {
 	    if (*tokp == 'M') {
 	        info->visibility = 0.001;
 	    } else {
-	        num = (*(pfrac-1) - '0');
-		strncpy(sval, pfrac + 1, pend - pfrac - 1);
-		den = atoi(sval);
+	        num = (*(pfrac - 1) - '0');
+		strncpy (sval, pfrac + 1, pend - pfrac - 1);
+		den = atoi (sval);
 		info->visibility =
 		    ((WeatherVisibility)num / ((WeatherVisibility)den));
 
-		psp = strchr(tokp, ' ');
+		psp = strchr (tokp, ' ');
 		if (psp) {
 		    *psp = '\0';
-		    val = atoi(tokp);
+		    val = atoi (tokp);
 		    info->visibility += (WeatherVisibility)val;
 		}
 	    }
 	} else {
-	    strncpy(sval, tokp, pend - tokp);
-            val = atoi(sval);
+	    strncpy (sval, tokp, pend - tokp);
+            val = atoi (sval);
             info->visibility = (WeatherVisibility)val;
 	}
     } else {
         // International observation: NNNN(DD NNNNDD)?
         // For now: use only the minimum visibility and ignore its direction
-        strncpy (sval, tokp, strspn(tokp, CONST_DIGITS));
-	val = atoi(sval);
-	info->visibility = (WeatherVisibility)val / VISIBILITY_SM_TO_M(1.);
+        strncpy (sval, tokp, strspn (tokp, CONST_DIGITS));
+	val = atoi (sval);
+	info->visibility = (WeatherVisibility)val / VISIBILITY_SM_TO_M (1.);
     }
 }
 
-static void metar_tok_cloud (gchar *tokp, WeatherInfo *info)
+static void
+metar_tok_cloud (gchar *tokp, WeatherInfo *info)
 {
     gchar stype[4], salt[4];
 
-    strncpy(stype, tokp, 3);
+    strncpy (stype, tokp, 3);
     stype[3] = 0;
-    if (strlen(tokp) == 6) {
-        strncpy(salt, tokp+3, 3);
+    if (strlen (tokp) == 6) {
+        strncpy (salt, tokp + 3, 3);
         salt[3] = 0;
     }
 
-    if (!strcmp(stype, "CLR")) {
+    if (!strcmp (stype, "CLR")) {
         info->sky = SKY_CLEAR;
-    } else if (!strcmp(stype, "SKC")) {
+    } else if (!strcmp (stype, "SKC")) {
         info->sky = SKY_CLEAR;
-    } else if (!strcmp(stype, "NSC")) {
+    } else if (!strcmp (stype, "NSC")) {
         info->sky = SKY_CLEAR;
-    } else if (!strcmp(stype, "BKN")) {
+    } else if (!strcmp (stype, "BKN")) {
         info->sky = SKY_BROKEN;
-    } else if (!strcmp(stype, "SCT")) {
+    } else if (!strcmp (stype, "SCT")) {
         info->sky = SKY_SCATTERED;
-    } else if (!strcmp(stype, "FEW")) {
+    } else if (!strcmp (stype, "FEW")) {
         info->sky = SKY_FEW;
-    } else if (!strcmp(stype, "OVC")) {
+    } else if (!strcmp (stype, "OVC")) {
         info->sky = SKY_OVERCAST;
     }
 }
 
-static void metar_tok_pres (gchar *tokp, WeatherInfo *info)
+static void
+metar_tok_pres (gchar *tokp, WeatherInfo *info)
 {
     if (*tokp == 'A') {
         gchar sintg[3], sfract[3];
         gint intg, fract;
 
-        strncpy(sintg, tokp+1, 2);
+        strncpy (sintg, tokp + 1, 2);
         sintg[2] = 0;
-        intg = atoi(sintg);
+        intg = atoi (sintg);
 
-        strncpy(sfract, tokp+3, 2);
+        strncpy (sfract, tokp + 3, 2);
         sfract[2] = 0;
-        fract = atoi(sfract);
+        fract = atoi (sfract);
 
         info->pressure = (WeatherPressure)intg + (((WeatherPressure)fract)/100.0);
     } else {  /* *tokp == 'Q' */
         gchar spres[5];
         gint pres;
 
-        strncpy(spres, tokp+1, 4);
+        strncpy (spres, tokp + 1, 4);
         spres[4] = 0;
-        pres = atoi(spres);
+        pres = atoi (spres);
 
-        info->pressure = PRESSURE_MBAR_TO_INCH((WeatherPressure)pres);
+        info->pressure = PRESSURE_MBAR_TO_INCH ((WeatherPressure)pres);
     }
 }
 
-static void metar_tok_temp (gchar *tokp, WeatherInfo *info)
+static void
+metar_tok_temp (gchar *tokp, WeatherInfo *info)
 {
     gchar *ptemp, *pdew, *psep;
 
-    psep = strchr(tokp, '/');
+    psep = strchr (tokp, '/');
     *psep = 0;
     ptemp = tokp;
     pdew = psep + 1;
 
-    info->temp = (*ptemp == 'M') ? TEMP_C_TO_F(-atoi(ptemp+1))
-                                 : TEMP_C_TO_F(atoi(ptemp));
+    info->temp = (*ptemp == 'M') ? TEMP_C_TO_F (-atoi (ptemp + 1))
+	: TEMP_C_TO_F (atoi (ptemp));
     if (*pdew) {
-      info->dew = (*pdew == 'M') ? TEMP_C_TO_F(-atoi(pdew+1))
-      	                         : TEMP_C_TO_F(atoi(pdew));
+	info->dew = (*pdew == 'M') ? TEMP_C_TO_F (-atoi (pdew + 1))
+	    : TEMP_C_TO_F (atoi (pdew));
     } else {
-      info->dew = -1000.0;
+	info->dew = -1000.0;
     }
 }
 
-static void metar_tok_cond (gchar *tokp, WeatherInfo *info)
+static void
+metar_tok_cond (gchar *tokp, WeatherInfo *info)
 {
     gchar squal[3], sphen[4];
     gchar *pphen;
 
-    if ((strlen(tokp) > 3) && ((*tokp == '+') || (*tokp == '-')))
+    if ((strlen (tokp) > 3) && ((*tokp == '+') || (*tokp == '-')))
         ++tokp;   /* FIX */
 
     if ((*tokp == '+') || (*tokp == '-'))
         pphen = tokp + 1;
-    else if (strlen(tokp) < 4)
+    else if (strlen (tokp) < 4)
         pphen = tokp;
     else
         pphen = tokp + 2;
 
-    memset(squal, 0, sizeof(squal));
-    strncpy(squal, tokp, pphen - tokp);
+    memset (squal, 0, sizeof (squal));
+    strncpy (squal, tokp, pphen - tokp);
     squal[pphen - tokp] = 0;
 
-    memset(sphen, 0, sizeof(sphen));
-    strncpy(sphen, pphen, sizeof(sphen));
-    sphen[sizeof(sphen)-1] = '\0';
+    memset (sphen, 0, sizeof (sphen));
+    strncpy (sphen, pphen, sizeof (sphen));
+    sphen[sizeof (sphen)-1] = '\0';
 
     /* Defaults */
     info->cond.qualifier = QUALIFIER_NONE;
     info->cond.phenomenon = PHENOMENON_NONE;
     info->cond.significant = FALSE;
 
-    if (!strcmp(squal, "")) {
+    if (!strcmp (squal, "")) {
         info->cond.qualifier = QUALIFIER_MODERATE;
-    } else if (!strcmp(squal, "-")) {
+    } else if (!strcmp (squal, "-")) {
         info->cond.qualifier = QUALIFIER_LIGHT;
-    } else if (!strcmp(squal, "+")) {
+    } else if (!strcmp (squal, "+")) {
         info->cond.qualifier = QUALIFIER_HEAVY;
-    } else if (!strcmp(squal, "VC")) {
+    } else if (!strcmp (squal, "VC")) {
         info->cond.qualifier = QUALIFIER_VICINITY;
-    } else if (!strcmp(squal, "MI")) {
+    } else if (!strcmp (squal, "MI")) {
         info->cond.qualifier = QUALIFIER_SHALLOW;
-    } else if (!strcmp(squal, "BC")) {
+    } else if (!strcmp (squal, "BC")) {
         info->cond.qualifier = QUALIFIER_PATCHES;
-    } else if (!strcmp(squal, "PR")) {
+    } else if (!strcmp (squal, "PR")) {
         info->cond.qualifier = QUALIFIER_PARTIAL;
-    } else if (!strcmp(squal, "TS")) {
+    } else if (!strcmp (squal, "TS")) {
         info->cond.qualifier = QUALIFIER_THUNDERSTORM;
-    } else if (!strcmp(squal, "BL")) {
+    } else if (!strcmp (squal, "BL")) {
         info->cond.qualifier = QUALIFIER_BLOWING;
-    } else if (!strcmp(squal, "SH")) {
+    } else if (!strcmp (squal, "SH")) {
         info->cond.qualifier = QUALIFIER_SHOWERS;
-    } else if (!strcmp(squal, "DR")) {
+    } else if (!strcmp (squal, "DR")) {
         info->cond.qualifier = QUALIFIER_DRIFTING;
-    } else if (!strcmp(squal, "FZ")) {
+    } else if (!strcmp (squal, "FZ")) {
         info->cond.qualifier = QUALIFIER_FREEZING;
     } else {
         return;
     }
 
-    if (!strcmp(sphen, "DZ")) {
+    if (!strcmp (sphen, "DZ")) {
         info->cond.phenomenon = PHENOMENON_DRIZZLE;
-    } else if (!strcmp(sphen, "RA")) {
+    } else if (!strcmp (sphen, "RA")) {
         info->cond.phenomenon = PHENOMENON_RAIN;
-    } else if (!strcmp(sphen, "SN")) {
+    } else if (!strcmp (sphen, "SN")) {
         info->cond.phenomenon = PHENOMENON_SNOW;
-    } else if (!strcmp(sphen, "SG")) {
+    } else if (!strcmp (sphen, "SG")) {
         info->cond.phenomenon = PHENOMENON_SNOW_GRAINS;
-    } else if (!strcmp(sphen, "IC")) {
+    } else if (!strcmp (sphen, "IC")) {
         info->cond.phenomenon = PHENOMENON_ICE_CRYSTALS;
-    } else if (!strcmp(sphen, "PE")) {
+    } else if (!strcmp (sphen, "PE")) {
         info->cond.phenomenon = PHENOMENON_ICE_PELLETS;
-    } else if (!strcmp(sphen, "GR")) {
+    } else if (!strcmp (sphen, "GR")) {
         info->cond.phenomenon = PHENOMENON_HAIL;
-    } else if (!strcmp(sphen, "GS")) {
+    } else if (!strcmp (sphen, "GS")) {
         info->cond.phenomenon = PHENOMENON_SMALL_HAIL;
-    } else if (!strcmp(sphen, "UP")) {
+    } else if (!strcmp (sphen, "UP")) {
         info->cond.phenomenon = PHENOMENON_UNKNOWN_PRECIPITATION;
-    } else if (!strcmp(sphen, "BR")) {
+    } else if (!strcmp (sphen, "BR")) {
         info->cond.phenomenon = PHENOMENON_MIST;
-    } else if (!strcmp(sphen, "FG")) {
+    } else if (!strcmp (sphen, "FG")) {
         info->cond.phenomenon = PHENOMENON_FOG;
-    } else if (!strcmp(sphen, "FU")) {
+    } else if (!strcmp (sphen, "FU")) {
         info->cond.phenomenon = PHENOMENON_SMOKE;
-    } else if (!strcmp(sphen, "VA")) {
+    } else if (!strcmp (sphen, "VA")) {
         info->cond.phenomenon = PHENOMENON_VOLCANIC_ASH;
-    } else if (!strcmp(sphen, "SA")) {
+    } else if (!strcmp (sphen, "SA")) {
         info->cond.phenomenon = PHENOMENON_SAND;
-    } else if (!strcmp(sphen, "HZ")) {
+    } else if (!strcmp (sphen, "HZ")) {
         info->cond.phenomenon = PHENOMENON_HAZE;
-    } else if (!strcmp(sphen, "PY")) {
+    } else if (!strcmp (sphen, "PY")) {
         info->cond.phenomenon = PHENOMENON_SPRAY;
-    } else if (!strcmp(sphen, "DU")) {
+    } else if (!strcmp (sphen, "DU")) {
         info->cond.phenomenon = PHENOMENON_DUST;
-    } else if (!strcmp(sphen, "SQ")) {
+    } else if (!strcmp (sphen, "SQ")) {
         info->cond.phenomenon = PHENOMENON_SQUALL;
-    } else if (!strcmp(sphen, "SS")) {
+    } else if (!strcmp (sphen, "SS")) {
         info->cond.phenomenon = PHENOMENON_SANDSTORM;
-    } else if (!strcmp(sphen, "DS")) {
+    } else if (!strcmp (sphen, "DS")) {
         info->cond.phenomenon = PHENOMENON_DUSTSTORM;
-    } else if (!strcmp(sphen, "PO")) {
+    } else if (!strcmp (sphen, "PO")) {
         info->cond.phenomenon = PHENOMENON_DUST_WHIRLS;
-    } else if (!strcmp(sphen, "+FC")) {
+    } else if (!strcmp (sphen, "+FC")) {
         info->cond.phenomenon = PHENOMENON_TORNADO;
-    } else if (!strcmp(sphen, "FC")) {
+    } else if (!strcmp (sphen, "FC")) {
         info->cond.phenomenon = PHENOMENON_FUNNEL_CLOUD;
     } else {
         return;
@@ -374,8 +381,8 @@
 #define TIME_RE_STR  "([0-9]{6})Z"
 #define WIND_RE_STR  "(([0-9]{3})|VRB)([0-9]?[0-9]{2})(G[0-9]?[0-9]{2})?KT"
 #define VIS_RE_STR   "((([0-9]?[0-9])|(M?([12] )?([1357]/1?[0-9])))SM)|" \
-                     "([0-9]{4}(N|NE|E|SE|S|SW|W|NW( [0-9]{4}(N|NE|E|SE|S|SW|W|NW))?)?)|" \
-                     "CAVOK"
+    "([0-9]{4}(N|NE|E|SE|S|SW|W|NW( [0-9]{4}(N|NE|E|SE|S|SW|W|NW))?)?)|" \
+    "CAVOK"
 #define COND_RE_STR  "(-|\\+)?(VC|MI|BC|PR|TS|BL|SH|DR|FZ)?(DZ|RA|SN|SG|IC|PE|GR|GS|UP|BR|FG|FU|VA|SA|HZ|PY|DU|SQ|SS|DS|PO|\\+?FC)"
 #define CLOUD_RE_STR "((CLR|BKN|SCT|FEW|OVC|SKC|NSC)([0-9]{3}|///)?(CB|TCU|///)?)"
 #define TEMP_RE_STR  "(M?[0-9][0-9])/(M?(//|[0-9][0-9])?)"
@@ -389,22 +396,23 @@
 #define RE_SUFFIX ")( |$)"
 
 static regex_t metar_re[RE_NUM];
-static void (*metar_f[RE_NUM])(gchar *tokp, WeatherInfo *info);
+static void (*metar_f[RE_NUM]) (gchar *tokp, WeatherInfo *info);
 
-static void metar_init_re (void)
+static void
+metar_init_re (void)
 {
     static gboolean initialized = FALSE;
     if (initialized)
         return;
     initialized = TRUE;
 
-    regcomp(&metar_re[TIME_RE], RE_PREFIX TIME_RE_STR RE_SUFFIX, REG_EXTENDED);
-    regcomp(&metar_re[WIND_RE], RE_PREFIX WIND_RE_STR RE_SUFFIX, REG_EXTENDED);
-    regcomp(&metar_re[VIS_RE], RE_PREFIX VIS_RE_STR RE_SUFFIX, REG_EXTENDED);
-    regcomp(&metar_re[COND_RE], RE_PREFIX COND_RE_STR RE_SUFFIX, REG_EXTENDED);
-    regcomp(&metar_re[CLOUD_RE], RE_PREFIX CLOUD_RE_STR RE_SUFFIX, REG_EXTENDED);
-    regcomp(&metar_re[TEMP_RE], RE_PREFIX TEMP_RE_STR RE_SUFFIX, REG_EXTENDED);
-    regcomp(&metar_re[PRES_RE], RE_PREFIX PRES_RE_STR RE_SUFFIX, REG_EXTENDED);
+    regcomp (&metar_re[TIME_RE], RE_PREFIX TIME_RE_STR RE_SUFFIX, REG_EXTENDED);
+    regcomp (&metar_re[WIND_RE], RE_PREFIX WIND_RE_STR RE_SUFFIX, REG_EXTENDED);
+    regcomp (&metar_re[VIS_RE], RE_PREFIX VIS_RE_STR RE_SUFFIX, REG_EXTENDED);
+    regcomp (&metar_re[COND_RE], RE_PREFIX COND_RE_STR RE_SUFFIX, REG_EXTENDED);
+    regcomp (&metar_re[CLOUD_RE], RE_PREFIX CLOUD_RE_STR RE_SUFFIX, REG_EXTENDED);
+    regcomp (&metar_re[TEMP_RE], RE_PREFIX TEMP_RE_STR RE_SUFFIX, REG_EXTENDED);
+    regcomp (&metar_re[PRES_RE], RE_PREFIX PRES_RE_STR RE_SUFFIX, REG_EXTENDED);
 
     metar_f[TIME_RE] = metar_tok_time;
     metar_f[WIND_RE] = metar_tok_wind;
@@ -415,7 +423,8 @@
     metar_f[PRES_RE] = metar_tok_pres;
 }
 
-gboolean metar_parse (gchar *metar, WeatherInfo *info)
+gboolean
+metar_parse (gchar *metar, WeatherInfo *info)
 {
     gchar *p;
     //gchar *rmk;
@@ -423,31 +432,31 @@
     regmatch_t rm, rm2;
     gchar *tokp;
 
-    g_return_val_if_fail(info != NULL, FALSE);
-    g_return_val_if_fail(metar != NULL, FALSE);
+    g_return_val_if_fail (info != NULL, FALSE);
+    g_return_val_if_fail (metar != NULL, FALSE);
 
-    metar_init_re();
+    metar_init_re ();
 
     /*
      * Force parsing to end at "RMK" field.  This prevents a subtle
      * problem when info within the remark happens to match an earlier state
      * and, as a result, throws off all the remaining expression
      */
-    if (0 != (p = strstr(metar, " RMK "))) {
+    if (0 != (p = strstr (metar, " RMK "))) {
         *p = '\0';
-	//rmk = p+5;   // uncomment this if RMK data becomes useful
+	//rmk = p + 5;   // uncomment this if RMK data becomes useful
     }
-    
+
     p = metar;
     i = TIME_RE;
     while (*p) {
 
         i2 = RE_NUM;
-	rm2.rm_so = strlen(p);
+	rm2.rm_so = strlen (p);
 	rm2.rm_eo = rm2.rm_so;
 
         for (i = 0; i < RE_NUM && rm2.rm_so > 0; i++) {
-	    if (0 == regexec(&metar_re[i], p, 1, &rm, 0)
+	    if (0 == regexec (&metar_re[i], p, 1, &rm, 0)
 		&& rm.rm_so < rm2.rm_so)
 	    {
 	        i2 = i;
@@ -455,27 +464,28 @@
 		   (the regular expressions include those characters to
 		   only get matches limited to whole words). */
 		if (p[rm.rm_so] == ' ') rm.rm_so++;
-		if (p[rm.rm_eo-1] == ' ') rm.rm_eo--;
+		if (p[rm.rm_eo - 1] == ' ') rm.rm_eo--;
 	        rm2.rm_so = rm.rm_so;
 		rm2.rm_eo = rm.rm_eo;
 	    }
 	}
 
 	if (i2 != RE_NUM) {
-		tokp = g_strndup(p+rm2.rm_so, rm2.rm_eo-rm2.rm_so);
-		metar_f[i2](tokp, info);
-	        g_free (tokp);
+	    tokp = g_strndup (p + rm2.rm_so, rm2.rm_eo - rm2.rm_so);
+	    metar_f[i2] (tokp, info);
+	    g_free (tokp);
 	}
 
 	p += rm2.rm_eo;
-	p += strspn(p, " ");
+	p += strspn (p, " ");
     }
     return TRUE;
 }
 
-static void metar_finish_read(GnomeVFSAsyncHandle *handle, GnomeVFSResult result, 
-			      gpointer buffer, GnomeVFSFileSize requested, 
-			      GnomeVFSFileSize body_len, gpointer data)
+static void
+metar_finish_read (GnomeVFSAsyncHandle *handle, GnomeVFSResult result,
+		   gpointer buffer, GnomeVFSFileSize requested,
+		   GnomeVFSFileSize body_len, gpointer data)
 {
     WeatherInfo *info = (WeatherInfo *)data;
     WeatherLocation *loc;
@@ -483,109 +493,106 @@
     gboolean success = FALSE;
     gchar *searchkey;
 
-    g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->metar_handle);
-	
+    g_return_if_fail (info != NULL);
+    g_return_if_fail (handle == info->metar_handle);
+
     loc = info->location;
     body = (gchar *)buffer;
 
     body[body_len] = '\0';
 
     if (info->metar_buffer == NULL)
-    	info->metar_buffer = g_strdup(body);
-    else
-    {
-	temp = g_strdup(info->metar_buffer);
-	g_free(info->metar_buffer);
-	info->metar_buffer = g_strdup_printf("%s%s", temp, body);
-	g_free(temp);
-    }
-		
-    if (result == GNOME_VFS_ERROR_EOF)
-    {
+    	info->metar_buffer = g_strdup (body);
+    else {
+	temp = g_strdup (info->metar_buffer);
+	g_free (info->metar_buffer);
+	info->metar_buffer = g_strdup_printf ("%s%s", temp, body);
+	g_free (temp);
+    }
 
-        searchkey = g_strdup_printf("\n%s", loc->code);
+    if (result == GNOME_VFS_ERROR_EOF) {
+        searchkey = g_strdup_printf ("\n%s", loc->code);
 
-        metar = strstr(info->metar_buffer, searchkey);
+        metar = strstr (info->metar_buffer, searchkey);
         g_free (searchkey);
         if (metar == NULL) {
             success = FALSE;
         } else {
             metar += WEATHER_LOCATION_CODE_LEN + 2;
-            eoln = strchr(metar, '\n');
+            eoln = strchr (metar, '\n');
 	    if (eoln != NULL)
-		    *eoln = 0;
-            success = metar_parse(metar, info);
+		*eoln = 0;
+            success = metar_parse (metar, info);
 	    if (eoln != NULL)
-		    *eoln = '\n';
+		*eoln = '\n';
         }
 
         info->valid = success;
-    }
-    else if (result != GNOME_VFS_OK) {
-	g_print("%s", gnome_vfs_result_to_string(result));
-        g_warning(_("Failed to get METAR data.\n"));
+    } else if (result != GNOME_VFS_OK) {
+	g_print ("%s", gnome_vfs_result_to_string (result));
+        g_warning (_("Failed to get METAR data.\n"));
     } else {
-	 gnome_vfs_async_read(handle, body, DATA_SIZE - 1, metar_finish_read, info);
-	 return;      
+	gnome_vfs_async_read (handle, body, DATA_SIZE - 1, metar_finish_read, info);
+	return;
     }
-    
-    request_done(info->metar_handle, info);
+
+    request_done (info->metar_handle, info);
     g_free (buffer);
     return;
 }
 
-static void metar_finish_open (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
+static void
+metar_finish_open (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
 {
     WeatherInfo *info = (WeatherInfo *)data;
     WeatherLocation *loc;
     gchar *body;
 
-    g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->metar_handle);
+    g_return_if_fail (info != NULL);
+    g_return_if_fail (handle == info->metar_handle);
+
+    body = g_malloc0 (DATA_SIZE);
 
-    body = g_malloc0(DATA_SIZE);
-    
     if (info->metar_buffer)
     	g_free (info->metar_buffer);
     info->metar_buffer = NULL;
     loc = info->location;
     if (loc == NULL) {
-	    g_warning (_("WeatherInfo missing location"));
-	    request_done(info->metar_handle, info);
-	    requests_done_check(info);
-	    g_free (body);
-	    return;
+	g_warning (_("WeatherInfo missing location"));
+	request_done (info->metar_handle, info);
+	requests_done_check (info);
+	g_free (body);
+	return;
     }
 
     if (result != GNOME_VFS_OK) {
-        g_warning(_("Failed to get METAR data.\n"));
+        g_warning (_("Failed to get METAR data.\n"));
         info->metar_handle = NULL;
-	requests_done_check(info); 
+	requests_done_check (info);
 	g_free (body);
     } else {
-        gnome_vfs_async_read(handle, body, DATA_SIZE - 1, metar_finish_read, info);
+        gnome_vfs_async_read (handle, body, DATA_SIZE - 1, metar_finish_read, info);
     }
     return;
 }
 
 /* Read current conditions and fill in info structure */
-void metar_start_open (WeatherInfo *info)
+void
+metar_start_open (WeatherInfo *info)
 {
     gchar *url;
     WeatherLocation *loc;
 
-    g_return_if_fail(info != NULL);
+    g_return_if_fail (info != NULL);
     info->valid = FALSE;
     loc = info->location;
     if (loc == NULL) {
-	    g_warning (_("WeatherInfo missing location"));
-	    return;
+	g_warning (_("WeatherInfo missing location"));
+	return;
     }
 
-    url = g_strdup_printf("http://weather.noaa.gov/cgi-bin/mgetmetar.pl?cccc=%s";, loc->code);
-    gnome_vfs_async_open(&info->metar_handle, url, GNOME_VFS_OPEN_READ, 
-    		         0, metar_finish_open, info);
-    g_free(url);
-
+    url = g_strdup_printf ("http://weather.noaa.gov/cgi-bin/mgetmetar.pl?cccc=%s";, loc->code);
+    gnome_vfs_async_open (&info->metar_handle, url, GNOME_VFS_OPEN_READ,
+			  0, metar_finish_open, info);
+    g_free (url);
 }

Modified: trunk/libgweather/weather-priv.h
==============================================================================
--- trunk/libgweather/weather-priv.h	(original)
+++ trunk/libgweather/weather-priv.h	Wed Jun 18 17:46:52 2008
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  *  Papadimitriou Spiros <spapadim+ cs cmu edu>
  *
@@ -42,53 +43,53 @@
 typedef enum _WeatherSky WeatherSky;
 
 enum _WeatherConditionPhenomenon {
-   PHENOMENON_NONE,
+    PHENOMENON_NONE,
 
-   PHENOMENON_DRIZZLE,
-   PHENOMENON_RAIN,
-   PHENOMENON_SNOW,
-   PHENOMENON_SNOW_GRAINS,
-   PHENOMENON_ICE_CRYSTALS,
-   PHENOMENON_ICE_PELLETS,
-   PHENOMENON_HAIL,
-   PHENOMENON_SMALL_HAIL,
-   PHENOMENON_UNKNOWN_PRECIPITATION,
-
-   PHENOMENON_MIST,
-   PHENOMENON_FOG,
-   PHENOMENON_SMOKE,
-   PHENOMENON_VOLCANIC_ASH,
-   PHENOMENON_SAND,
-   PHENOMENON_HAZE,
-   PHENOMENON_SPRAY,
-   PHENOMENON_DUST,
-
-   PHENOMENON_SQUALL,
-   PHENOMENON_SANDSTORM,
-   PHENOMENON_DUSTSTORM,
-   PHENOMENON_FUNNEL_CLOUD,
-   PHENOMENON_TORNADO,
-   PHENOMENON_DUST_WHIRLS
+    PHENOMENON_DRIZZLE,
+    PHENOMENON_RAIN,
+    PHENOMENON_SNOW,
+    PHENOMENON_SNOW_GRAINS,
+    PHENOMENON_ICE_CRYSTALS,
+    PHENOMENON_ICE_PELLETS,
+    PHENOMENON_HAIL,
+    PHENOMENON_SMALL_HAIL,
+    PHENOMENON_UNKNOWN_PRECIPITATION,
+
+    PHENOMENON_MIST,
+    PHENOMENON_FOG,
+    PHENOMENON_SMOKE,
+    PHENOMENON_VOLCANIC_ASH,
+    PHENOMENON_SAND,
+    PHENOMENON_HAZE,
+    PHENOMENON_SPRAY,
+    PHENOMENON_DUST,
+
+    PHENOMENON_SQUALL,
+    PHENOMENON_SANDSTORM,
+    PHENOMENON_DUSTSTORM,
+    PHENOMENON_FUNNEL_CLOUD,
+    PHENOMENON_TORNADO,
+    PHENOMENON_DUST_WHIRLS
 };
 
 typedef enum _WeatherConditionPhenomenon WeatherConditionPhenomenon;
 
 enum _WeatherConditionQualifier {
-   QUALIFIER_NONE,
+    QUALIFIER_NONE,
 
-   QUALIFIER_VICINITY,
+    QUALIFIER_VICINITY,
 
-   QUALIFIER_LIGHT,
-   QUALIFIER_MODERATE,
-   QUALIFIER_HEAVY,
-   QUALIFIER_SHALLOW,
-   QUALIFIER_PATCHES,
-   QUALIFIER_PARTIAL,
-   QUALIFIER_THUNDERSTORM,
-   QUALIFIER_BLOWING,
-   QUALIFIER_SHOWERS,
-   QUALIFIER_DRIFTING,
-   QUALIFIER_FREEZING
+    QUALIFIER_LIGHT,
+    QUALIFIER_MODERATE,
+    QUALIFIER_HEAVY,
+    QUALIFIER_SHALLOW,
+    QUALIFIER_PATCHES,
+    QUALIFIER_PARTIAL,
+    QUALIFIER_THUNDERSTORM,
+    QUALIFIER_BLOWING,
+    QUALIFIER_SHOWERS,
+    QUALIFIER_DRIFTING,
+    QUALIFIER_FREEZING
 };
 
 typedef enum _WeatherConditionQualifier WeatherConditionQualifier;
@@ -168,7 +169,7 @@
 /* Units conversions and names */
 
 #define TEMP_F_TO_C(f)			(((f) - 32.0) * 0.555556)
-#define TEMP_F_TO_K(f)			(TEMP_F_TO_C(f) + 273.15)
+#define TEMP_F_TO_K(f)			(TEMP_F_TO_C (f) + 273.15)
 #define TEMP_C_TO_F(c)			(((c) * 1.8) + 32.0)
 
 #define WINDSPEED_KNOTS_TO_KPH(knots)	((knots) * 1.851965)
@@ -180,14 +181,14 @@
 #define PRESSURE_INCH_TO_KPA(inch)	((inch) * 3.386)
 #define PRESSURE_INCH_TO_HPA(inch)	((inch) * 33.86)
 #define PRESSURE_INCH_TO_MM(inch)	((inch) * 25.40005)
-#define PRESSURE_INCH_TO_MB(inch)	(PRESSURE_INCH_TO_HPA(inch))
+#define PRESSURE_INCH_TO_MB(inch)	(PRESSURE_INCH_TO_HPA (inch))
 #define PRESSURE_INCH_TO_ATM(inch)	((inch) * 0.033421052)
 #define PRESSURE_MBAR_TO_INCH(mbar)	((mbar) * 0.029533373)
 
 #define VISIBILITY_SM_TO_KM(sm)		((sm) * 1.609344)
-#define VISIBILITY_SM_TO_M(sm)		(VISIBILITY_SM_TO_KM(sm) * 1000)
+#define VISIBILITY_SM_TO_M(sm)		(VISIBILITY_SM_TO_KM (sm) * 1000)
 
-#define DEGREES_TO_RADIANS(deg)		((fmod(deg,360.) / 180.) * M_PI)
+#define DEGREES_TO_RADIANS(deg)		((fmod (deg,360.) / 180.) * M_PI)
 #define RADIANS_TO_DEGREES(rad)		((rad) * 180. / M_PI)
 #define RADIANS_TO_HOURS(rad)		((rad) * 12. / M_PI)
 

Modified: trunk/libgweather/weather-sun.c
==============================================================================
--- trunk/libgweather/weather-sun.c	(original)
+++ trunk/libgweather/weather-sun.c	Wed Jun 18 17:46:52 2008
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /* $Id: weather-sun.c 10286 2007-07-12 08:52:56Z callum $ */
 
 /*
@@ -27,11 +28,10 @@
 #define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
 #include "weather-priv.h"
 
-#define EPOCH_TO_J2000(t)       (t-946728000)
+#define EPOCH_TO_J2000(t)       (t - 946728000)
 #define MEAN_ECLIPTIC_LONGITUDE 280.46435
 #define PERIGEE_LONGITUDE       282.94719
 #define ECCENTRICITY            0.01671002
-#define MEAN_ECLIPTIC_OBLIQUITY 
 #define SOL_PROGRESSION         (360./365.242191)
 
 /*
@@ -39,63 +39,67 @@
  * expressed as right ascension (hours) and declination (radians)
  * Assume ecliptic latitude is 0.0
  */
-static void ecl2equ (gdouble time, gdouble eclipLon,
-		     gdouble *ra, gdouble *decl)
-{
-    gdouble jc = EPOCH_TO_J2000(time) / (36525. * 86400.);
-    gdouble mEclipObliq = DEGREES_TO_RADIANS(23.439291667
-					     - .013004166 * jc
-					     - 1.666667e-7 * jc * jc
-					     + 5.027777e-7 * jc * jc * jc);
-    *ra = RADIANS_TO_HOURS(atan2 ( sin(eclipLon) * cos(mEclipObliq), cos(eclipLon)));
+static void
+ecl2equ (gdouble time, gdouble eclipLon,
+	 gdouble *ra, gdouble *decl)
+{
+    gdouble jc = EPOCH_TO_J2000 (time) / (36525. * 86400.);
+    gdouble mEclipObliq = DEGREES_TO_RADIANS (23.439291667
+					      - .013004166 * jc
+					      - 1.666667e-7 * jc * jc
+					      + 5.027777e-7 * jc * jc * jc);
+    *ra = RADIANS_TO_HOURS (atan2 (sin (eclipLon) * cos (mEclipObliq),
+				   cos (eclipLon)));
     if (*ra < 0.)
         *ra += 24.;
-    *decl = asin ( sin(mEclipObliq) * sin(eclipLon) );
+    *decl = asin (sin (mEclipObliq) * sin (eclipLon));
 }
 
 /*
  * Calculate rising and setting times of an object
  * based on it equitorial coordinates
  */
-static void gstObsv (gdouble ra, gdouble decl,
-		     gdouble obsLat, gdouble obsLon,
-		     gdouble *rise, gdouble *set)
+static void
+gstObsv (gdouble ra, gdouble decl,
+	 gdouble obsLat, gdouble obsLon,
+	 gdouble *rise, gdouble *set)
 {
-    double a = acos(-tan(obsLat) * tan(decl));
+    double a = acos (-tan (obsLat) * tan (decl));
     double b;
 
-    if (isnan(a) != 0) {
+    if (isnan (a) != 0) {
 	*set = *rise = a;
 	return;
     }
-    a = RADIANS_TO_HOURS(a);
+    a = RADIANS_TO_HOURS (a);
     b = 24. - a + ra;
     a += ra;
-    a -= RADIANS_TO_HOURS(obsLon);
-    b -= RADIANS_TO_HOURS(obsLon);
-    if ((a = fmod(a, 24.)) < 0)
-      a += 24.;
-    if ((b = fmod(b, 24.)) < 0)
-      b += 24.;
+    a -= RADIANS_TO_HOURS (obsLon);
+    b -= RADIANS_TO_HOURS (obsLon);
+    if ((a = fmod (a, 24.)) < 0)
+	a += 24.;
+    if ((b = fmod (b, 24.)) < 0)
+	b += 24.;
 
     *set = a;
     *rise = b;
 }
 
 
-static gdouble t0(time_t date)
+static gdouble
+t0 (time_t date)
 {
-    register gdouble t = ((gdouble)(EPOCH_TO_J2000(date) / 86400)) / 36525.0;
-    gdouble t0 = fmod( 6.697374558 + 2400.051366 * t + 2.5862e-5 * t * t, 24.);
+    gdouble t = ((gdouble)(EPOCH_TO_J2000 (date) / 86400)) / 36525.0;
+    gdouble t0 = fmod (6.697374558 + 2400.051366 * t + 2.5862e-5 * t * t, 24.);
     if (t0 < 0.)
         t0 += 24.;
     return t0;
 }
 
 
-
-static gboolean calc_sun2 (time_t t, gdouble obsLat, gdouble obsLon,
-	  time_t *rise, time_t *set)
+static gboolean
+calc_sun2 (time_t t, gdouble obsLat, gdouble obsLon,
+	   time_t *rise, time_t *set)
 {
     time_t gm_midn;
     time_t lcl_midn;
@@ -107,43 +111,41 @@
 
     /* Approximate preceding local midnight at observer's longitude */
     gm_midn = t - (t % 86400);
-    gm_hoff = floor((RADIANS_TO_DEGREES(obsLon) + 7.5) / 15.);
+    gm_hoff = floor ((RADIANS_TO_DEGREES (obsLon) + 7.5) / 15.);
     lcl_midn = gm_midn - 3600. * gm_hoff;
     if (t - lcl_midn >= 86400)
         lcl_midn += 86400;
     else if (lcl_midn > t)
         lcl_midn -= 86400;
-    
-    /* 
+
+    /*
      * Ecliptic longitude of the sun at midnight local time
      * Start with an estimate based on a fixed daily rate
      */
-    ndays = EPOCH_TO_J2000(lcl_midn) / 86400.;
-    meanAnom = DEGREES_TO_RADIANS(ndays * SOL_PROGRESSION
-					  + MEAN_ECLIPTIC_LONGITUDE - PERIGEE_LONGITUDE);
-    
+    ndays = EPOCH_TO_J2000 (lcl_midn) / 86400.;
+    meanAnom = DEGREES_TO_RADIANS (ndays * SOL_PROGRESSION
+				   + MEAN_ECLIPTIC_LONGITUDE - PERIGEE_LONGITUDE);
+
     /*
      * Approximate solution of Kepler's equation:
      * Find E which satisfies  E - e sin(E) = M (mean anomaly)
      */
     eccenAnom = meanAnom;
-    
-    while (1e-12 < fabs( delta = eccenAnom - ECCENTRICITY * sin(eccenAnom) - meanAnom))
-    {
-	eccenAnom -= delta / (1.- ECCENTRICITY * cos(eccenAnom));
-    }
+
+    while (1e-12 < fabs (delta = eccenAnom - ECCENTRICITY * sin (eccenAnom) - meanAnom))
+	eccenAnom -= delta / (1. - ECCENTRICITY * cos (eccenAnom));
 
     /* Sun's longitude on the ecliptic */
-    lambda = fmod( DEGREES_TO_RADIANS ( PERIGEE_LONGITUDE )
-		   + 2. * atan( sqrt((1.+ECCENTRICITY)/(1.-ECCENTRICITY))
-				* tan ( eccenAnom / 2. ) ),
+    lambda = fmod (DEGREES_TO_RADIANS (PERIGEE_LONGITUDE)
+		   + 2. * atan (sqrt ((1. + ECCENTRICITY) / (1. - ECCENTRICITY))
+				* tan (eccenAnom / 2.)),
 		   2. * M_PI);
-    
+
     /* Calculate equitorial coordinates of sun at previous and next local midnights */
 
     ecl2equ (lcl_midn, lambda, &ra1, &decl1);
-    ecl2equ (lcl_midn + 86400., lambda + DEGREES_TO_RADIANS(SOL_PROGRESSION), &ra2, &decl2);
-    
+    ecl2equ (lcl_midn + 86400., lambda + DEGREES_TO_RADIANS (SOL_PROGRESSION), &ra2, &decl2);
+
     /* Convert to rise and set times assuming the earth were to stay in its position
      * in its orbit around the sun.  This will soon be followed by interpolating
      * between the two
@@ -151,20 +153,18 @@
 
     gstObsv (ra1, decl1, obsLat, obsLon - (gm_hoff * M_PI / 12.), &rise1, &set1);
     gstObsv (ra2, decl2, obsLat, obsLon - (gm_hoff * M_PI / 12.), &rise2, &set2);
-    
+
     /* TODO: include calculations for regions near the poles. */
-    if (isnan(rise1) || isnan(rise2))
+    if (isnan (rise1) || isnan (rise2))
         return FALSE;
 
-    if (rise2 < rise1) {
+    if (rise2 < rise1)
         rise2 += 24.;
-    }
-    if (set2 < set1) {
+    if (set2 < set1)
         set2 += 24.;
-    }    
 
-    tt = t0(lcl_midn);
-    t00 = tt - (gm_hoff + RADIANS_TO_HOURS(obsLon)) * 1.002737909;
+    tt = t0 (lcl_midn);
+    t00 = tt - (gm_hoff + RADIANS_TO_HOURS (obsLon)) * 1.002737909;
 
     if (t00 < 0.)
 	t00 += 24.;
@@ -177,7 +177,7 @@
         set1  += 24.;
         set2  += 24.;
     }
-    
+
     /*
      * Interpolate between the two
      */
@@ -185,35 +185,35 @@
     set1 = (24.07 * set1 - t00 * (set2 - set1)) / (24.07 + set1 - set2);
 
     decl2 = (decl1 + decl2) / 2.;
-    x = DEGREES_TO_RADIANS(0.830725);
-    u = acos ( sin(obsLat) / cos(decl2) );
-    dt =  RADIANS_TO_HOURS ( asin ( sin(x) / sin(u) )
-				     / cos(decl2) );
-    
+    x = DEGREES_TO_RADIANS (0.830725);
+    u = acos ( sin (obsLat) / cos (decl2) );
+    dt =  RADIANS_TO_HOURS (asin (sin (x) / sin (u)) / cos (decl2));
+
     rise1 = (rise1 - dt - tt) * 0.9972695661;
     set1  = (set1 + dt - tt) * 0.9972695661;
     if (rise1 < 0.)
-      rise1 += 24;
+	rise1 += 24;
     else if (rise1 >= 24.)
-      rise1 -= 24.;
+	rise1 -= 24.;
     if (set1 < 0.)
-      set1 += 24;
+	set1 += 24;
     else if (set1 >= 24.)
-      set1 -= 24.;
-    
+	set1 -= 24.;
+
     *rise = (rise1 * 3600.) + lcl_midn;
     *set = (set1 * 3600.) + lcl_midn;
     return TRUE;
 }
 
 
-gboolean calc_sun (WeatherInfo *info)
+gboolean
+calc_sun (WeatherInfo *info)
 {
-  time_t now = time (NULL);
+    time_t now = time (NULL);
 
-  return info->location->latlon_valid
-    && calc_sun2(now, info->location->latitude, info->location->longitude,
-	   &info->sunrise, &info->sunset);
+    return info->location->latlon_valid
+	&& calc_sun2 (now, info->location->latitude, info->location->longitude,
+		      &info->sunrise, &info->sunset);
 }
 
 
@@ -223,26 +223,27 @@
  *  - next sunrise, when icon changes to daytime version
  *  - next sunset, when icon changes to nighttime version
  */
-gint weather_info_next_sun_event(WeatherInfo *info)
+gint
+weather_info_next_sun_event (WeatherInfo *info)
 {
-  time_t    now = time(NULL);
-  struct tm ltm;
-  time_t    nxtEvent;
-
-  if (!calc_sun(info))
-    return -1;
-
-  /* Determine when the next local midnight occurs */
-  (void) localtime_r (&now, &ltm);
-  ltm.tm_sec = 0;
-  ltm.tm_min = 0;
-  ltm.tm_hour = 0;
-  ltm.tm_mday++;
-  nxtEvent = mktime(&ltm);
-
-  if (info->sunset > now && info->sunset < nxtEvent)
-    nxtEvent = info->sunset;
-  if (info->sunrise > now && info->sunrise < nxtEvent)
-    nxtEvent = info->sunrise;
-  return (gint)(nxtEvent - now);
+    time_t    now = time (NULL);
+    struct tm ltm;
+    time_t    nxtEvent;
+
+    if (!calc_sun (info))
+	return -1;
+
+    /* Determine when the next local midnight occurs */
+    (void) localtime_r (&now, &ltm);
+    ltm.tm_sec = 0;
+    ltm.tm_min = 0;
+    ltm.tm_hour = 0;
+    ltm.tm_mday++;
+    nxtEvent = mktime (&ltm);
+
+    if (info->sunset > now && info->sunset < nxtEvent)
+	nxtEvent = info->sunset;
+    if (info->sunrise > now && info->sunrise < nxtEvent)
+	nxtEvent = info->sunrise;
+    return (gint)(nxtEvent - now);
 }

Modified: trunk/libgweather/weather-wx.c
==============================================================================
--- trunk/libgweather/weather-wx.c	(original)
+++ trunk/libgweather/weather-wx.c	Wed Jun 18 17:46:52 2008
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /* $Id: weather-wx.c 9147 2005-12-12 00:22:17Z philipl $ */
 
 /*
@@ -20,14 +21,15 @@
 #include <libgweather/weather.h>
 #include "weather-priv.h"
 
-static void wx_finish_read(GnomeVFSAsyncHandle *handle, GnomeVFSResult result, 
-			   gpointer buffer, GnomeVFSFileSize requested, 
-			   GnomeVFSFileSize body_len, gpointer data)
+static void
+wx_finish_read (GnomeVFSAsyncHandle *handle, GnomeVFSResult result,
+		gpointer buffer, GnomeVFSFileSize requested,
+		GnomeVFSFileSize body_len, gpointer data)
 {
     WeatherInfo *info = (WeatherInfo *)data;
 
-    g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->wx_handle);
+    g_return_if_fail (info != NULL);
+    g_return_if_fail (handle == info->wx_handle);
 
     info->radar = NULL;
 
@@ -38,92 +40,84 @@
             g_print ("%s \n", error->message);
             g_error_free (error);
         }
-        gnome_vfs_async_read(handle, buffer, DATA_SIZE - 1, wx_finish_read, info);
+        gnome_vfs_async_read (handle, buffer, DATA_SIZE - 1, wx_finish_read, info);
         return;
-    }
-    else if (result == GNOME_VFS_ERROR_EOF)
-    {
+    } else if (result == GNOME_VFS_ERROR_EOF) {
         GdkPixbufAnimation *animation;
-    	
+
         gdk_pixbuf_loader_close (info->radar_loader, NULL);
         animation = gdk_pixbuf_loader_get_animation (info->radar_loader);
-	if (animation != NULL)
-	{
+	if (animation != NULL) {
             if (info->radar)
                 g_object_unref (info->radar);
 	    info->radar = animation;
 	    g_object_ref (info->radar);
         }
 	g_object_unref (G_OBJECT (info->radar_loader));
-        
-    }
-    else
-    {
-        g_print("%s", gnome_vfs_result_to_string(result));
-        g_warning(_("Failed to get METAR data.\n"));
+
+    } else {
+        g_print ("%s", gnome_vfs_result_to_string (result));
+        g_warning (_("Failed to get METAR data.\n"));
         info->wx_handle = NULL;
         requests_done_check (info);
-	if(info->radar_loader)  g_object_unref (G_OBJECT (info->radar_loader));
+	if (info->radar_loader)
+	    g_object_unref (G_OBJECT (info->radar_loader));
     }
-    
-    request_done(info->wx_handle, info);
-    g_free (buffer);    
-    return;
+
+    request_done (info->wx_handle, info);
+    g_free (buffer);
 }
 
-static void wx_finish_open (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
+static void
+wx_finish_open (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
 {
     WeatherInfo *info = (WeatherInfo *)data;
     WeatherLocation *loc;
     gchar *body;
 
-    g_return_if_fail(info != NULL);
-    g_return_if_fail(handle == info->wx_handle);
+    g_return_if_fail (info != NULL);
+    g_return_if_fail (handle == info->wx_handle);
 
-    body = g_malloc0(DATA_SIZE);
+    body = g_malloc0 (DATA_SIZE);
 
     info->radar_buffer = NULL;
     info->radar = NULL;
     loc = info->location;
-    g_return_if_fail(loc != NULL);
+    g_return_if_fail (loc != NULL);
 
     if (result != GNOME_VFS_OK) {
-        g_warning("Failed to get radar map image.\n");
+        g_warning ("Failed to get radar map image.\n");
         info->wx_handle = NULL;
         requests_done_check (info);
         g_free (body);
-    } else {
-        gnome_vfs_async_read(handle, body, DATA_SIZE -1, wx_finish_read, info); 
-    	
-    }
-     return;
+    } else
+        gnome_vfs_async_read (handle, body, DATA_SIZE -1, wx_finish_read, info);
+    return;
 }
 
 /* Get radar map and into newly allocated pixmap */
-void wx_start_open (WeatherInfo *info)
+void
+wx_start_open (WeatherInfo *info)
 {
     gchar *url;
     WeatherLocation *loc;
-    
-    g_return_if_fail(info != NULL);
+
+    g_return_if_fail (info != NULL);
     info->radar = NULL;
     info->radar_loader = gdk_pixbuf_loader_new ();
     loc = info->location;
-    g_return_if_fail(loc != NULL);
+    g_return_if_fail (loc != NULL);
 
-    
     if (info->radar_url)
     	url = g_strdup (info->radar_url);
     else {
-    	 if (loc->radar[0] == '-') return;
-	 url = g_strdup_printf ("http://image.weather.com/web/radar/us_%s_closeradar_medium_usen.jpg";, loc->radar);
+	if (loc->radar[0] == '-')
+	    return;
+	url = g_strdup_printf ("http://image.weather.com/web/radar/us_%s_closeradar_medium_usen.jpg";, loc->radar);
     }
- 
-    gnome_vfs_async_open(&info->wx_handle, url, GNOME_VFS_OPEN_READ, 
+
+    gnome_vfs_async_open (&info->wx_handle, url, GNOME_VFS_OPEN_READ,
     			 0, wx_finish_open, info);
-    				 
-    g_free(url);
 
-    return;
+    g_free (url);
 }
-

Modified: trunk/libgweather/weather.c
==============================================================================
--- trunk/libgweather/weather.c	(original)
+++ trunk/libgweather/weather.c	Wed Jun 18 17:46:52 2008
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /* $Id: weather.c 10520 2007-11-14 21:49:57Z ryanl $ */
 
 /*
@@ -42,8 +43,7 @@
 #include <libgweather/weather.h>
 #include "weather-priv.h"
 
-void
-close_cb (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data);
+static void close_cb (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data);
 
 
 /*
@@ -51,16 +51,17 @@
  * DD:degrees (to 3 digits), MM:minutes, SS:seconds H:hemisphere (NESW)
  * Return value is positive for N,E; negative for S,W.
  */
-static gdouble dmsh2rad (const gchar *latlon)
+static gdouble
+dmsh2rad (const gchar *latlon)
 {
     char *p1, *p2;
     int deg, min, sec, dir;
     gdouble value;
-    
+
     if (latlon == NULL)
 	return DBL_MAX;
-    p1 = strchr(latlon, '-');
-    p2 = strrchr(latlon, '-');
+    p1 = strchr (latlon, '-');
+    p2 = strrchr (latlon, '-');
     if (p1 == NULL || p1 == latlon) {
         return DBL_MAX;
     } else if (p1 == p2) {
@@ -75,7 +76,7 @@
 	return DBL_MAX;
     value = (gdouble)((deg * 60 + min) * 60 + sec) * M_PI / 648000.;
 
-    dir = toupper(latlon[strlen(latlon) - 1]);
+    dir = toupper (latlon[strlen (latlon) - 1]);
     if (dir == 'W' || dir == 'S')
 	value = -value;
     else if (dir != 'E' && dir != 'N' && (value != 0.0 || dir != '0'))
@@ -83,30 +84,31 @@
     return value;
 }
 
-WeatherLocation *weather_location_new (const gchar *name, const gchar *code,
-				       const gchar *zone, const gchar *radar,
-                                       const gchar *coordinates,
-				       const gchar *country_code,
-				       const gchar *tz_hint)
+WeatherLocation *
+weather_location_new (const gchar *name, const gchar *code,
+		      const gchar *zone, const gchar *radar,
+		      const gchar *coordinates,
+		      const gchar *country_code,
+		      const gchar *tz_hint)
 {
     WeatherLocation *location;
 
-    location = g_new(WeatherLocation, 1);
+    location = g_new (WeatherLocation, 1);
 
     /* name and metar code must be set */
-    location->name = g_strdup(name);
-    location->code = g_strdup(code);
+    location->name = g_strdup (name);
+    location->code = g_strdup (code);
 
-    if (zone) {    
-        location->zone = g_strdup(zone);
+    if (zone) {
+        location->zone = g_strdup (zone);
     } else {
-        location->zone = g_strdup("------");
+        location->zone = g_strdup ("------");
     }
 
     if (radar) {
-        location->radar = g_strdup(radar);
+        location->radar = g_strdup (radar);
     } else {
-        location->radar = g_strdup("---");
+        location->radar = g_strdup ("---");
     }
 
     if (location->zone[0] == '-') {
@@ -124,7 +126,7 @@
 
 	if (g_strv_length (pieces) == 2)
 	{
-            location->coordinates = g_strdup(coordinates);
+            location->coordinates = g_strdup (coordinates);
             location->latitude = dmsh2rad (pieces[0]);
 	    location->longitude = dmsh2rad (pieces[1]);
 	}
@@ -134,7 +136,7 @@
 
     if (!location->coordinates)
     {
-        location->coordinates = g_strdup("---");
+        location->coordinates = g_strdup ("---");
         location->latitude = DBL_MAX;
         location->longitude = DBL_MAX;
     }
@@ -143,11 +145,12 @@
 
     location->country_code = g_strdup (country_code);
     location->tz_hint = g_strdup (tz_hint);
-    
+
     return location;
 }
 
-WeatherLocation *weather_location_clone (const WeatherLocation *location)
+WeatherLocation *
+weather_location_clone (const WeatherLocation *location)
 {
     WeatherLocation *clone;
 
@@ -161,7 +164,8 @@
     return clone;
 }
 
-void weather_location_free (WeatherLocation *location)
+void
+weather_location_free (WeatherLocation *location)
 {
     if (location) {
         g_free (location->name);
@@ -171,17 +175,18 @@
         g_free (location->coordinates);
         g_free (location->country_code);
         g_free (location->tz_hint);
-    
+
         g_free (location);
     }
 }
 
-gboolean weather_location_equal (const WeatherLocation *location1, const WeatherLocation *location2)
+gboolean
+weather_location_equal (const WeatherLocation *location1, const WeatherLocation *location2)
 {
     if (!location1->code || !location2->code)
         return 1;
-    return ( (strcmp(location1->code, location2->code) == 0) &&
-             (strcmp(location1->name, location2->name) == 0) );    
+    return ((strcmp (location1->code, location2->code) == 0) &&
+	    (strcmp (location1->name, location2->name) == 0));
 }
 
 static const gchar *wind_direction_str[] = {
@@ -192,14 +197,15 @@
     N_("West"), N_("West - Northwest"), N_("Northwest"), N_("North - Northwest")
 };
 
-const gchar *weather_wind_direction_string (WeatherWindDirection wind)
+const gchar *
+weather_wind_direction_string (WeatherWindDirection wind)
 {
-        if (wind < 0)
-	        return _("Unknown");
-	if (wind >= (sizeof (wind_direction_str) / sizeof (char *)))
-		return _("Invalid");
+    if (wind < 0)
+	return _("Unknown");
+    if (wind >= (sizeof (wind_direction_str) / sizeof (char *)))
+	return _("Invalid");
 
-	return _(wind_direction_str[(int)wind]);
+    return _(wind_direction_str[(int)wind]);
 }
 
 static const gchar *sky_str[] = {
@@ -210,13 +216,14 @@
     N_("Overcast")
 };
 
-const gchar *weather_sky_string (WeatherSky sky)
+const gchar *
+weather_sky_string (WeatherSky sky)
 {
-	if (sky < 0 ||
-	    sky >= (sizeof (sky_str) / sizeof (char *)))
-		return _("Invalid");
+    if (sky < 0 ||
+	sky >= (sizeof (sky_str) / sizeof (char *)))
+	return _("Invalid");
 
-	return _(sky_str[(int)sky]);
+    return _(sky_str[(int)sky]);
 }
 
 
@@ -246,141 +253,146 @@
 /* TRANSLATOR: If you want to know what "blowing" "shallow" "partial"
  * etc means, you can go to http://www.weather.com/glossary/ and
  * http://www.crh.noaa.gov/arx/wx.tbl.php */
-/* NONE          */ {"??",                        "??",                                "??",                      "??",                         "??",                      "??",                        "??",                           "??",                        N_("Thunderstorm"),             "??",                        "??",                           "??",                         "??"                         },
-/* DRIZZLE       */ {N_("Drizzle"),               "??",                                N_("Light drizzle"),       N_("Moderate drizzle"),       N_("Heavy drizzle"),       "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         N_("Freezing drizzle")       },
-/* RAIN          */ {N_("Rain"),                  "??",                                N_("Light rain"),          N_("Moderate rain"),          N_("Heavy rain"),          "??",                        "??",                           "??",                        N_("Thunderstorm"),             "??",                        N_("Rain showers"),             "??",                         N_("Freezing rain")          },
-/* SNOW          */ {N_("Snow"),                  "??",                                N_("Light snow"),          N_("Moderate snow"),          N_("Heavy snow"),          "??",                        "??",                           "??",                        N_("Snowstorm"),                N_("Blowing snowfall"),      N_("Snow showers"),             N_("Drifting snow"),          "??"                         },
-/* SNOW_GRAINS   */ {N_("Snow grains"),           "??",                                N_("Light snow grains"),   N_("Moderate snow grains"),   N_("Heavy snow grains"),   "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
-/* ICE_CRYSTALS  */ {N_("Ice crystals"),          "??",                                "??",                      N_("Ice crystals"),           "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
-/* ICE_PELLETS   */ {N_("Ice pellets"),           "??",                                N_("Few ice pellets"),     N_("Moderate ice pellets"),   N_("Heavy ice pellets"),   "??",                        "??",                           "??",                        N_("Ice pellet storm"),         "??",                        N_("Showers of ice pellets"),   "??",                         "??"                         },
-/* HAIL          */ {N_("Hail"),                  "??",                                "??",                      N_("Hail"),                   "??",                      "??",                        "??",                           "??",                        N_("Hailstorm"),                "??",                        N_("Hail showers"),             "??",                         "??",                        },
-/* SMALL_HAIL    */ {N_("Small hail"),            "??",                                "??",                      N_("Small hail"),             "??",                      "??",                        "??",                           "??",                        N_("Small hailstorm"),          "??",                        N_("Showers of small hail"),    "??",                         "??"                         },
-/* PRECIPITATION */ {N_("Unknown precipitation"), "??",                                "??",                      "??",                         "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
-/* MIST          */ {N_("Mist"),                  "??",                                "??",                      N_("Mist"),                   "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
-/* FOG           */ {N_("Fog"),                   N_("Fog in the vicinity") ,          "??",                      N_("Fog"),                    "??",                      N_("Shallow fog"),           N_("Patches of fog"),           N_("Partial fog"),           "??",                           "??",                        "??",                           "??",                         N_("Freezing fog")           },
-/* SMOKE         */ {N_("Smoke"),                 "??",                                "??",                      N_("Smoke"),                  "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
-/* VOLCANIC_ASH  */ {N_("Volcanic ash"),          "??",                                "??",                      N_("Volcanic ash"),           "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
-/* SAND          */ {N_("Sand"),                  "??",                                "??",                      N_("Sand"),                   "??",                      "??",                        "??",                           "??",                        "??",                           N_("Blowing sand"),          "",                             N_("Drifting sand"),          "??"                         },
-/* HAZE          */ {N_("Haze"),                  "??",                                "??",                      N_("Haze"),                   "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
-/* SPRAY         */ {"??",                        "??",                                "??",                      "??",                         "??",                      "??",                        "??",                           "??",                        "??",                           N_("Blowing sprays"),        "??",                           "??",                         "??"                         },
-/* DUST          */ {N_("Dust"),                  "??",                                "??",                      N_("Dust"),                   "??",                      "??",                        "??",                           "??",                        "??",                           N_("Blowing dust"),          "??",                           N_("Drifting dust"),          "??"                         },
-/* SQUALL        */ {N_("Squall"),                "??",                                "??",                      N_("Squall"),                 "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
-/* SANDSTORM     */ {N_("Sandstorm"),             N_("Sandstorm in the vicinity") ,    "??",                      N_("Sandstorm"),              N_("Heavy sandstorm"),     "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
-/* DUSTSTORM     */ {N_("Duststorm"),             N_("Duststorm in the vicinity") ,    "??",                      N_("Duststorm"),              N_("Heavy duststorm"),     "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
-/* FUNNEL_CLOUD  */ {N_("Funnel cloud"),          "??",                                "??",                      "??",                         "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
-/* TORNADO       */ {N_("Tornado"),               "??",                                "??",                      "??",                         "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
-/* DUST_WHIRLS   */ {N_("Dust whirls"),           N_("Dust whirls in the vicinity") ,  "??",                      N_("Dust whirls"),            "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         }
+    /* NONE          */ {"??",                        "??",                                "??",                      "??",                         "??",                      "??",                        "??",                           "??",                        N_("Thunderstorm"),             "??",                        "??",                           "??",                         "??"                         },
+    /* DRIZZLE       */ {N_("Drizzle"),               "??",                                N_("Light drizzle"),       N_("Moderate drizzle"),       N_("Heavy drizzle"),       "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         N_("Freezing drizzle")       },
+    /* RAIN          */ {N_("Rain"),                  "??",                                N_("Light rain"),          N_("Moderate rain"),          N_("Heavy rain"),          "??",                        "??",                           "??",                        N_("Thunderstorm"),             "??",                        N_("Rain showers"),             "??",                         N_("Freezing rain")          },
+    /* SNOW          */ {N_("Snow"),                  "??",                                N_("Light snow"),          N_("Moderate snow"),          N_("Heavy snow"),          "??",                        "??",                           "??",                        N_("Snowstorm"),                N_("Blowing snowfall"),      N_("Snow showers"),             N_("Drifting snow"),          "??"                         },
+    /* SNOW_GRAINS   */ {N_("Snow grains"),           "??",                                N_("Light snow grains"),   N_("Moderate snow grains"),   N_("Heavy snow grains"),   "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
+    /* ICE_CRYSTALS  */ {N_("Ice crystals"),          "??",                                "??",                      N_("Ice crystals"),           "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
+    /* ICE_PELLETS   */ {N_("Ice pellets"),           "??",                                N_("Few ice pellets"),     N_("Moderate ice pellets"),   N_("Heavy ice pellets"),   "??",                        "??",                           "??",                        N_("Ice pellet storm"),         "??",                        N_("Showers of ice pellets"),   "??",                         "??"                         },
+    /* HAIL          */ {N_("Hail"),                  "??",                                "??",                      N_("Hail"),                   "??",                      "??",                        "??",                           "??",                        N_("Hailstorm"),                "??",                        N_("Hail showers"),             "??",                         "??",                        },
+    /* SMALL_HAIL    */ {N_("Small hail"),            "??",                                "??",                      N_("Small hail"),             "??",                      "??",                        "??",                           "??",                        N_("Small hailstorm"),          "??",                        N_("Showers of small hail"),    "??",                         "??"                         },
+    /* PRECIPITATION */ {N_("Unknown precipitation"), "??",                                "??",                      "??",                         "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
+    /* MIST          */ {N_("Mist"),                  "??",                                "??",                      N_("Mist"),                   "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
+    /* FOG           */ {N_("Fog"),                   N_("Fog in the vicinity") ,          "??",                      N_("Fog"),                    "??",                      N_("Shallow fog"),           N_("Patches of fog"),           N_("Partial fog"),           "??",                           "??",                        "??",                           "??",                         N_("Freezing fog")           },
+    /* SMOKE         */ {N_("Smoke"),                 "??",                                "??",                      N_("Smoke"),                  "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
+    /* VOLCANIC_ASH  */ {N_("Volcanic ash"),          "??",                                "??",                      N_("Volcanic ash"),           "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
+    /* SAND          */ {N_("Sand"),                  "??",                                "??",                      N_("Sand"),                   "??",                      "??",                        "??",                           "??",                        "??",                           N_("Blowing sand"),          "",                             N_("Drifting sand"),          "??"                         },
+    /* HAZE          */ {N_("Haze"),                  "??",                                "??",                      N_("Haze"),                   "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
+    /* SPRAY         */ {"??",                        "??",                                "??",                      "??",                         "??",                      "??",                        "??",                           "??",                        "??",                           N_("Blowing sprays"),        "??",                           "??",                         "??"                         },
+    /* DUST          */ {N_("Dust"),                  "??",                                "??",                      N_("Dust"),                   "??",                      "??",                        "??",                           "??",                        "??",                           N_("Blowing dust"),          "??",                           N_("Drifting dust"),          "??"                         },
+    /* SQUALL        */ {N_("Squall"),                "??",                                "??",                      N_("Squall"),                 "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
+    /* SANDSTORM     */ {N_("Sandstorm"),             N_("Sandstorm in the vicinity") ,    "??",                      N_("Sandstorm"),              N_("Heavy sandstorm"),     "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
+    /* DUSTSTORM     */ {N_("Duststorm"),             N_("Duststorm in the vicinity") ,    "??",                      N_("Duststorm"),              N_("Heavy duststorm"),     "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
+    /* FUNNEL_CLOUD  */ {N_("Funnel cloud"),          "??",                                "??",                      "??",                         "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
+    /* TORNADO       */ {N_("Tornado"),               "??",                                "??",                      "??",                         "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         },
+    /* DUST_WHIRLS   */ {N_("Dust whirls"),           N_("Dust whirls in the vicinity") ,  "??",                      N_("Dust whirls"),            "??",                      "??",                        "??",                           "??",                        "??",                           "??",                        "??",                           "??",                         "??"                         }
 };
 
-const gchar *weather_conditions_string (WeatherConditions cond)
+const gchar *
+weather_conditions_string (WeatherConditions cond)
 {
     const gchar *str;
 
     if (!cond.significant) {
-	    return "-";
+	return "-";
     } else {
-	    if (cond.phenomenon >= 0 &&
-		cond.phenomenon < 24 &&
-		cond.qualifier >= 0 &&
-		cond.qualifier < 13)
-		    str = _(conditions_str[(int)cond.phenomenon][(int)cond.qualifier]);
-	    else
-		    str = _("Invalid");
-	    return (strlen(str) > 0) ? str : "-";
+	if (cond.phenomenon >= 0 &&
+	    cond.phenomenon < 24 &&
+	    cond.qualifier >= 0 &&
+	    cond.qualifier < 13)
+	    str = _(conditions_str[(int)cond.phenomenon][(int)cond.qualifier]);
+	else
+	    str = _("Invalid");
+	return (strlen (str) > 0) ? str : "-";
     }
 }
 
 /* Locals turned global to facilitate asynchronous HTTP requests */
 
 
-gboolean requests_init (WeatherInfo *info)
+gboolean
+requests_init (WeatherInfo *info)
 {
     if (info->requests_pending)
         return FALSE;
 
-    /*g_assert(!metar_handle && !iwin_handle && !wx_handle && !met_handle);*/
+    /*g_assert (!metar_handle && !iwin_handle && !wx_handle && !met_handle);*/
 
     info->requests_pending = TRUE;
-    	
+
     return TRUE;
 }
 
-void request_done (GnomeVFSAsyncHandle *handle, WeatherInfo *info)
+void
+request_done (GnomeVFSAsyncHandle *handle, WeatherInfo *info)
 {
     if (!handle)
     	return;
 
-    gnome_vfs_async_close(handle, close_cb, info);
+    gnome_vfs_async_close (handle, close_cb, info);
 
-    info->sunValid = info->valid && calc_sun(info);
+    info->sunValid = info->valid && calc_sun (info);
     return;
 }
 
-void requests_done_check (WeatherInfo *info)
+void
+requests_done_check (WeatherInfo *info)
 {
-    g_return_if_fail(info->requests_pending);
+    g_return_if_fail (info->requests_pending);
 
-    if (!info->metar_handle && !info->iwin_handle && 
+    if (!info->metar_handle && !info->iwin_handle &&
         !info->wx_handle && !info->met_handle &&
 	!info->bom_handle) {
         info->requests_pending = FALSE;
-        info->finish_cb(info, info->cb_data);
+        info->finish_cb (info, info->cb_data);
     }
 }
 
-void
+static void
 close_cb (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
 {
-	WeatherInfo *info = (WeatherInfo *)data;
+    WeatherInfo *info = (WeatherInfo *)data;
+
+    g_return_if_fail (info != NULL);
+
+    if (result != GNOME_VFS_OK)
+	g_warning ("Error closing GnomeVFSAsyncHandle.\n");
 
-	g_return_if_fail (info != NULL);
+    if (handle == info->metar_handle)
+	info->metar_handle = NULL;
+    if (handle == info->iwin_handle)
+	info->iwin_handle = NULL;
+    if (handle == info->wx_handle)
+	info->wx_handle = NULL;
+    if (handle == info->met_handle)
+	info->met_handle = NULL;
+    if (handle == info->bom_handle)
+	info->bom_handle = NULL;
 
-	if (result != GNOME_VFS_OK)
-		g_warning("Error closing GnomeVFSAsyncHandle.\n");
-	
-	if (handle == info->metar_handle)
-		info->metar_handle = NULL;
-	if (handle == info->iwin_handle)
-		info->iwin_handle = NULL;
-	if (handle == info->wx_handle)
-		info->wx_handle = NULL;
-	if (handle == info->met_handle)
-		info->met_handle = NULL;
-	if (handle == info->bom_handle)
-	        info->bom_handle = NULL;
- 	
-	requests_done_check(info);
-		
-	return;
+    requests_done_check (info);
+
+    return;
 }
 
 /* Relative humidity computation - thanks to <Olof Oberg modopaper modogroup com> */
 
 
-static inline gdouble calc_humidity(gdouble temp, gdouble dewp)
+static inline gdouble
+calc_humidity (gdouble temp, gdouble dewp)
 {
     gdouble esat, esurf;
 
     if (temp > -500.0 && dewp > -500.0) {
-      temp = TEMP_F_TO_C(temp);
-      dewp = TEMP_F_TO_C(dewp);
+	temp = TEMP_F_TO_C (temp);
+	dewp = TEMP_F_TO_C (dewp);
 
-      esat = 6.11 * pow(10.0, (7.5 * temp) / (237.7 + temp));
-      esurf = 6.11 * pow(10.0, (7.5 * dewp) / (237.7 + dewp));
+	esat = 6.11 * pow (10.0, (7.5 * temp) / (237.7 + temp));
+	esurf = 6.11 * pow (10.0, (7.5 * dewp) / (237.7 + dewp));
     } else {
-      esurf = -1.0;
-      esat = 1.0;
+	esurf = -1.0;
+	esat = 1.0;
     }
     return ((esurf/esat) * 100.0);
 }
 
-static inline gdouble calc_apparent (WeatherInfo *info)
+static inline gdouble
+calc_apparent (WeatherInfo *info)
 {
     gdouble temp = info->temp;
-    gdouble wind = WINDSPEED_KNOTS_TO_MPH(info->windspeed);
+    gdouble wind = WINDSPEED_KNOTS_TO_MPH (info->windspeed);
     gdouble apparent = -1000.;
 
-
     /*
      * Wind chill calculations as of 01-Nov-2001
      * http://www.nws.noaa.gov/om/windchill/index.shtml
@@ -389,7 +401,7 @@
      */
     if (temp <= 50.0) {
         if (wind > 3.0) {
-	    gdouble v = pow(wind, 0.16);
+	    gdouble v = pow (wind, 0.16);
 	    apparent = 35.74 + 0.6215 * temp - 35.75 * v + 0.4275 * temp * v;
 	} else if (wind >= 0.) {
 	    apparent = temp;
@@ -401,7 +413,7 @@
      */
     else if (temp >= 80.0) {
         if (info->temp >= -500. && info->dew >= -500.) {
-	    gdouble humidity = calc_humidity(info->temp, info->dew);
+	    gdouble humidity = calc_humidity (info->temp, info->dew);
 	    gdouble t2 = temp * temp;
 	    gdouble h2 = humidity * humidity;
 
@@ -413,41 +425,40 @@
 	     */
 	    gdouble t3 = t2 * temp;
 	    gdouble h3 = h2 * temp;
-	
+
 	    apparent = 16.923
-	          + 0.185212 * temp
-	          + 5.37941 * humidity
-	          - 0.100254 * temp * humidity
-	          + 9.41695e-3 * t2
-	          + 7.28898e-3 * h2
-	          + 3.45372e-4 * t2 * humidity
-	          - 8.14971e-4 * temp * h2
-	          + 1.02102e-5 * t2 * h2
-	          - 3.8646e-5 * t3
-	          + 2.91583e-5 * h3
-	          + 1.42721e-6 * t3 * humidity
-	          + 1.97483e-7 * temp * h3
-	          - 2.18429e-8 * t3 * h2
-	          + 8.43296e-10 * t2 * h3
-	          - 4.81975e-11 * t3 * h3;
+		+ 0.185212 * temp
+		+ 5.37941 * humidity
+		- 0.100254 * temp * humidity
+		+ 9.41695e-3 * t2
+		+ 7.28898e-3 * h2
+		+ 3.45372e-4 * t2 * humidity
+		- 8.14971e-4 * temp * h2
+		+ 1.02102e-5 * t2 * h2
+		- 3.8646e-5 * t3
+		+ 2.91583e-5 * h3
+		+ 1.42721e-6 * t3 * humidity
+		+ 1.97483e-7 * temp * h3
+		- 2.18429e-8 * t3 * h2
+		+ 8.43296e-10 * t2 * h3
+		- 4.81975e-11 * t3 * h3;
 #else
 	    /*
 	     * An often cited alternative: values are within 5 degrees for
 	     * most ranges between 10% and 70% humidity and to 110 degrees.
 	     */
 	    apparent = - 42.379
-	           +  2.04901523 * temp
-	           + 10.14333127 * humidity
-	           -  0.22475541 * temp * humidity
-	           -  6.83783e-3 * t2
-	           -  5.481717e-2 * h2
-	           +  1.22874e-3 * t2 * humidity
-	           +  8.5282e-4 * temp * h2
-	           -  1.99e-6 * t2 * h2;
+		+  2.04901523 * temp
+		+ 10.14333127 * humidity
+		-  0.22475541 * temp * humidity
+		-  6.83783e-3 * t2
+		-  5.481717e-2 * h2
+		+  1.22874e-3 * t2 * humidity
+		+  8.5282e-4 * temp * h2
+		-  1.99e-6 * t2 * h2;
 #endif
 	}
-    }
-    else {
+    } else {
         apparent = temp;
     }
 
@@ -462,13 +473,13 @@
 		    WeatherInfoFunc cb,
 		    gpointer data)
 {
-    g_return_val_if_fail(((info == NULL) && (location != NULL)) || \
-                         ((info != NULL) && (location == NULL)), NULL);
-    g_return_val_if_fail(prefs != NULL, NULL);
+    g_return_val_if_fail (((info == NULL) && (location != NULL)) || \
+			  ((info != NULL) && (location == NULL)), NULL);
+    g_return_val_if_fail (prefs != NULL, NULL);
 
     /* FIXME: i'm not sure this works as intended anymore */
     if (!info) {
-    	info = g_new0(WeatherInfo, 1);
+    	info = g_new0 (WeatherInfo, 1);
         info->metar_handle = NULL;
     	info->iwin_handle = NULL;
     	info->wx_handle = NULL;
@@ -477,9 +488,9 @@
     	info->requests_pending = FALSE;
     	info->metar_buffer = NULL;
         info->iwin_buffer = NULL;
-		info->met_buffer = NULL;
-		info->bom_buffer = NULL;
-    	info->location = weather_location_clone(location);
+	info->met_buffer = NULL;
+	info->bom_buffer = NULL;
+    	info->location = weather_location_clone (location);
     } else {
         location = info->location;
 	if (info->forecast)
@@ -493,7 +504,7 @@
     }
 
     /* Update in progress */
-    if (!requests_init(info)) {
+    if (!requests_init (info)) {
         return NULL;
     }
 
@@ -524,7 +535,7 @@
     info->forecast = NULL;
     info->radar = NULL;
     info->radar_url = prefs->radar && prefs->radar_custom_url ?
-    		      g_strdup (prefs->radar_custom_url) : NULL;
+	g_strdup (prefs->radar_custom_url) : NULL;
     info->metar_handle = NULL;
     info->iwin_handle = NULL;
     info->wx_handle = NULL;
@@ -534,94 +545,97 @@
     info->finish_cb = cb;
     info->cb_data = data;
 
-    metar_start_open(info);
-    iwin_start_open(info);
+    metar_start_open (info);
+    iwin_start_open (info);
 
     if (prefs->radar)
-        wx_start_open(info);
+        wx_start_open (info);
 
     return info;
 }
 
-void weather_info_abort (WeatherInfo *info)
+void
+weather_info_abort (WeatherInfo *info)
 {
     if (info->metar_handle) {
-       gnome_vfs_async_cancel(info->metar_handle);
-       info->metar_handle = NULL;
+	gnome_vfs_async_cancel (info->metar_handle);
+	info->metar_handle = NULL;
     }
 
     if (info->iwin_handle) {
-       gnome_vfs_async_cancel(info->iwin_handle);
-       info->iwin_handle = NULL;
+	gnome_vfs_async_cancel (info->iwin_handle);
+	info->iwin_handle = NULL;
     }
 
     if (info->wx_handle) {
-       gnome_vfs_async_cancel(info->wx_handle);
-       info->wx_handle = NULL;
+	gnome_vfs_async_cancel (info->wx_handle);
+	info->wx_handle = NULL;
     }
 
     if (info->met_handle) {
-       gnome_vfs_async_cancel(info->met_handle);
-       info->met_handle = NULL;
+	gnome_vfs_async_cancel (info->met_handle);
+	info->met_handle = NULL;
     }
 
     if (info->bom_handle) {
-       gnome_vfs_async_cancel(info->bom_handle);
-       info->bom_handle = NULL;
+	gnome_vfs_async_cancel (info->bom_handle);
+	info->bom_handle = NULL;
     }
 
     info->requests_pending = FALSE;
 }
 
-WeatherInfo *weather_info_clone (const WeatherInfo *info)
+WeatherInfo *
+weather_info_clone (const WeatherInfo *info)
 {
     WeatherInfo *clone;
-    
-    g_return_val_if_fail(info != NULL, NULL);
 
-    clone = g_new(WeatherInfo, 1);
+    g_return_val_if_fail (info != NULL, NULL);
+
+    clone = g_new (WeatherInfo, 1);
 
 
     /* move everything */
-    g_memmove(clone, info, sizeof(WeatherInfo));
+    g_memmove (clone, info, sizeof (WeatherInfo));
 
 
     /* special moves */
-    clone->location = weather_location_clone(info->location);
+    clone->location = weather_location_clone (info->location);
     /* This handles null correctly */
-    clone->forecast = g_strdup(info->forecast);
-    clone->radar_url = g_strdup (info->radar_url); 
+    clone->forecast = g_strdup (info->forecast);
+    clone->radar_url = g_strdup (info->radar_url);
 
     clone->radar = info->radar;
     if (clone->radar != NULL)
-	    g_object_ref (clone->radar);
+	g_object_ref (clone->radar);
 
     return clone;
 }
 
-void weather_info_free (WeatherInfo *info)
+void
+weather_info_free (WeatherInfo *info)
 {
     if (!info)
         return;
 
     weather_info_abort (info);
 
-    weather_location_free(info->location);
+    weather_location_free (info->location);
     info->location = NULL;
 
-    g_free(info->forecast);
+    g_free (info->forecast);
     info->forecast = NULL;
 
     if (info->radar != NULL) {
         g_object_unref (info->radar);
         info->radar = NULL;
     }
-	
-	if (info->iwin_buffer)
-	    g_free (info->iwin_buffer);
 
-	if (info->metar_buffer)	
-	    g_free (info->metar_buffer);
+    if (info->iwin_buffer)
+	g_free (info->iwin_buffer);
+
+    if (info->metar_buffer)
+	g_free (info->metar_buffer);
 
     if (info->met_buffer)
         g_free (info->met_buffer);
@@ -629,34 +643,38 @@
     if (info->bom_buffer)
         g_free (info->bom_buffer);
 
-    g_free(info);
+    g_free (info);
 }
 
-gboolean weather_info_is_valid (WeatherInfo *info)
+gboolean
+weather_info_is_valid (WeatherInfo *info)
 {
-   g_return_val_if_fail(info != NULL, FALSE);
-   return info->valid;
+    g_return_val_if_fail (info != NULL, FALSE);
+    return info->valid;
 }
 
-const WeatherLocation *weather_info_get_location (WeatherInfo *info)
+const WeatherLocation *
+weather_info_get_location (WeatherInfo *info)
 {
-   g_return_val_if_fail(info != NULL, NULL);
-   return info->location;
+    g_return_val_if_fail (info != NULL, NULL);
+    return info->location;
 }
 
-const gchar *weather_info_get_location_name (WeatherInfo *info)
+const gchar *
+weather_info_get_location_name (WeatherInfo *info)
 {
-    g_return_val_if_fail(info != NULL, NULL);
-    g_return_val_if_fail(info->location != NULL, NULL);
+    g_return_val_if_fail (info != NULL, NULL);
+    g_return_val_if_fail (info->location != NULL, NULL);
     return info->location->name;
 }
 
-const gchar *weather_info_get_update (WeatherInfo *info)
+const gchar *
+weather_info_get_update (WeatherInfo *info)
 {
     static gchar buf[200];
     char *utf8, *timeformat;
 
-    g_return_val_if_fail(info != NULL, NULL);
+    g_return_val_if_fail (info != NULL, NULL);
 
     if (!info->valid)
         return "-";
@@ -668,12 +686,12 @@
 	 *             see `man 3 strftime` for more details
 	 */
 	timeformat = g_locale_from_utf8 (_("%a, %b %d / %H:%M"), -1,
-			NULL, NULL, NULL);
+					 NULL, NULL, NULL);
 	if (!timeformat) {
-		strcpy (buf, "???");
+	    strcpy (buf, "???");
 	}
-	else if (strftime(buf, sizeof(buf), timeformat, &tm) <= 0) {
-		strcpy (buf, "???");
+	else if (strftime (buf, sizeof (buf), timeformat, &tm) <= 0) {
+	    strcpy (buf, "???");
 	}
 	g_free (timeformat);
 
@@ -682,89 +700,94 @@
 	strcpy (buf, utf8);
 	g_free (utf8);
     } else {
-        strncpy(buf, _("Unknown observation time"), sizeof (buf));
-	buf[sizeof(buf)-1] = '\0';
+        strncpy (buf, _("Unknown observation time"), sizeof (buf));
+	buf[sizeof (buf)-1] = '\0';
     }
 
     return buf;
 }
 
-const gchar *weather_info_get_sky (WeatherInfo *info)
+const gchar *
+weather_info_get_sky (WeatherInfo *info)
 {
-    g_return_val_if_fail(info != NULL, NULL);
+    g_return_val_if_fail (info != NULL, NULL);
     if (!info->valid)
         return "-";
     if (info->sky < 0)
 	return _("Unknown");
-    return weather_sky_string(info->sky);
+    return weather_sky_string (info->sky);
 }
 
-const gchar *weather_info_get_conditions (WeatherInfo *info)
+const gchar *
+weather_info_get_conditions (WeatherInfo *info)
 {
-    g_return_val_if_fail(info != NULL, NULL);
+    g_return_val_if_fail (info != NULL, NULL);
     if (!info->valid)
         return "-";
-    return weather_conditions_string(info->cond);
+    return weather_conditions_string (info->cond);
 }
 
-static const gchar *temperature_string (gfloat far, TempUnit to_unit, gboolean round)
+static const gchar *
+temperature_string (gfloat far, TempUnit to_unit, gboolean round)
 {
-	static gchar buf[100];
+    static gchar buf[100];
 
     switch (to_unit) {
-        case TEMP_UNIT_FAHRENHEIT:
-			if (!round) {
-                /* TRANSLATOR: This is the temperature in degrees Fahrenheit (\342\204\211 is the "DEGREE FAHRENHEIT" symbol) */
-                g_snprintf(buf, sizeof (buf), _("%.1f \342\204\211"), far);
-            } else {
-                /* TRANSLATOR: This is the temperature in degrees Fahrenheit (\342\204\211 is the "DEGREE FAHRENHEIT" symbol) */
-                g_snprintf(buf, sizeof (buf), _("%d \342\204\211"), (int)floor(far + 0.5));
-            }
-            break;
-        case TEMP_UNIT_CENTIGRADE:
-            if (!round) {
-                /* TRANSLATOR: This is the temperature in degrees Celsius (\342\204\203 is the "DEGREE CELSIUS" symbol) */
-                g_snprintf (buf, sizeof (buf), _("%.1f \342\204\203"), TEMP_F_TO_C(far));
-            } else {
-                /* TRANSLATOR: This is the temperature in degrees Celsius (\342\204\203 is the "DEGREE CELSIUS" symbol) */
-                g_snprintf (buf, sizeof (buf), _("%d \342\204\203"), (int)floor(TEMP_F_TO_C(far) + 0.5));
-            }
-            break;
-        case TEMP_UNIT_KELVIN:
-            if (!round) {
-                /* TRANSLATOR: This is the temperature in kelvin */
-                g_snprintf (buf, sizeof (buf), _("%.1f K"), TEMP_F_TO_K(far));
-            } else {
-                /* TRANSLATOR: This is the temperature in kelvin */
-                g_snprintf (buf, sizeof (buf), _("%d K"), (int)floor(TEMP_F_TO_K(far)));
-            } 
-            break;
-
-        case TEMP_UNIT_INVALID:
-        case TEMP_UNIT_DEFAULT:
-        default:
-            g_warning("Conversion to illegal temperature unit: %d", to_unit);
-            return (_("Unknown"));
+    case TEMP_UNIT_FAHRENHEIT:
+	if (!round) {
+	    /* TRANSLATOR: This is the temperature in degrees Fahrenheit (\342\204\211 is the "DEGREE FAHRENHEIT" symbol) */
+	    g_snprintf (buf, sizeof (buf), _("%.1f \342\204\211"), far);
+	} else {
+	    /* TRANSLATOR: This is the temperature in degrees Fahrenheit (\342\204\211 is the "DEGREE FAHRENHEIT" symbol) */
+	    g_snprintf (buf, sizeof (buf), _("%d \342\204\211"), (int)floor (far + 0.5));
+	}
+	break;
+    case TEMP_UNIT_CENTIGRADE:
+	if (!round) {
+	    /* TRANSLATOR: This is the temperature in degrees Celsius (\342\204\203 is the "DEGREE CELSIUS" symbol) */
+	    g_snprintf (buf, sizeof (buf), _("%.1f \342\204\203"), TEMP_F_TO_C (far));
+	} else {
+	    /* TRANSLATOR: This is the temperature in degrees Celsius (\342\204\203 is the "DEGREE CELSIUS" symbol) */
+	    g_snprintf (buf, sizeof (buf), _("%d \342\204\203"), (int)floor (TEMP_F_TO_C (far) + 0.5));
+	}
+	break;
+    case TEMP_UNIT_KELVIN:
+	if (!round) {
+	    /* TRANSLATOR: This is the temperature in kelvin */
+	    g_snprintf (buf, sizeof (buf), _("%.1f K"), TEMP_F_TO_K (far));
+	} else {
+	    /* TRANSLATOR: This is the temperature in kelvin */
+	    g_snprintf (buf, sizeof (buf), _("%d K"), (int)floor (TEMP_F_TO_K (far)));
+	}
+	break;
+
+    case TEMP_UNIT_INVALID:
+    case TEMP_UNIT_DEFAULT:
+    default:
+	g_warning ("Conversion to illegal temperature unit: %d", to_unit);
+	return _("Unknown");
     }
 
     return buf;
 }
 
-const gchar *weather_info_get_temp (WeatherInfo *info)
+const gchar *
+weather_info_get_temp (WeatherInfo *info)
 {
-    g_return_val_if_fail(info != NULL, NULL);
+    g_return_val_if_fail (info != NULL, NULL);
 
     if (!info->valid)
         return "-";
     if (info->temp < -500.0)
         return _("Unknown");
-    
+
     return temperature_string (info->temp, info->temperature_unit, FALSE);
 }
 
-const gchar *weather_info_get_dew (WeatherInfo *info)
+const gchar *
+weather_info_get_dew (WeatherInfo *info)
 {
-    g_return_val_if_fail(info != NULL, NULL);
+    g_return_val_if_fail (info != NULL, NULL);
 
     if (!info->valid)
         return "-";
@@ -774,178 +797,196 @@
     return temperature_string (info->dew, info->temperature_unit, FALSE);
 }
 
-const gchar *weather_info_get_humidity (WeatherInfo *info)
+const gchar *
+weather_info_get_humidity (WeatherInfo *info)
 {
     static gchar buf[20];
     gdouble humidity;
-    g_return_val_if_fail(info != NULL, NULL);
+
+    g_return_val_if_fail (info != NULL, NULL);
+
     if (!info->valid)
         return "-";
 
-    humidity = calc_humidity(info->temp, info->dew);
+    humidity = calc_humidity (info->temp, info->dew);
     if (humidity < 0.0)
         return _("Unknown");
 
     /* TRANSLATOR: This is the humidity in percent */
-    g_snprintf(buf, sizeof (buf), _("%.f%%"), humidity);
+    g_snprintf (buf, sizeof (buf), _("%.f%%"), humidity);
     return buf;
 }
 
-const gchar *weather_info_get_apparent (WeatherInfo *info)
+const gchar *
+weather_info_get_apparent (WeatherInfo *info)
 {
     gdouble apparent;
-    g_return_val_if_fail(info != NULL, NULL);
+
+    g_return_val_if_fail (info != NULL, NULL);
     if (!info->valid)
         return "-";
 
-    apparent = calc_apparent(info);
+    apparent = calc_apparent (info);
     if (apparent < -500.0)
         return _("Unknown");
-    
+
     return temperature_string (apparent, info->temperature_unit, FALSE);
 }
 
-static const gchar *windspeed_string (gfloat knots, SpeedUnit to_unit)
+static const gchar *
+windspeed_string (gfloat knots, SpeedUnit to_unit)
 {
     static gchar buf[100];
 
     switch (to_unit) {
-        case SPEED_UNIT_KNOTS:
-            /* TRANSLATOR: This is the wind speed in knots */
-            g_snprintf(buf, sizeof (buf), _("%0.1f knots"), knots);
-            break;
-        case SPEED_UNIT_MPH:
-            /* TRANSLATOR: This is the wind speed in miles per hour */
-            g_snprintf(buf, sizeof (buf), _("%.1f mph"), WINDSPEED_KNOTS_TO_MPH(knots));
-            break;
-        case SPEED_UNIT_KPH:
-            /* TRANSLATOR: This is the wind speed in kilometers per hour */
-            g_snprintf(buf, sizeof (buf), _("%.1f km/h"), WINDSPEED_KNOTS_TO_KPH(knots));
-            break;
-        case SPEED_UNIT_MS:
-            /* TRANSLATOR: This is the wind speed in meters per second */
-            g_snprintf(buf, sizeof (buf), _("%.1f m/s"), WINDSPEED_KNOTS_TO_MS(knots));
-            break;
-	case SPEED_UNIT_BFT:
-	    /* TRANSLATOR: This is the wind speed as a Beaufort force factor
-	     * (commonly used in nautical wind estimation).
-	     */
-	    g_snprintf (buf, sizeof (buf), _("Beaufort force %.1f"),
-				    WINDSPEED_KNOTS_TO_BFT (knots));
-	    break;
-        case SPEED_UNIT_INVALID:
-        case SPEED_UNIT_DEFAULT:
-        default:
-            g_warning("Conversion to illegal speed unit: %d", to_unit);
-            return _("Unknown");
+    case SPEED_UNIT_KNOTS:
+	/* TRANSLATOR: This is the wind speed in knots */
+	g_snprintf (buf, sizeof (buf), _("%0.1f knots"), knots);
+	break;
+    case SPEED_UNIT_MPH:
+	/* TRANSLATOR: This is the wind speed in miles per hour */
+	g_snprintf (buf, sizeof (buf), _("%.1f mph"), WINDSPEED_KNOTS_TO_MPH (knots));
+	break;
+    case SPEED_UNIT_KPH:
+	/* TRANSLATOR: This is the wind speed in kilometers per hour */
+	g_snprintf (buf, sizeof (buf), _("%.1f km/h"), WINDSPEED_KNOTS_TO_KPH (knots));
+	break;
+    case SPEED_UNIT_MS:
+	/* TRANSLATOR: This is the wind speed in meters per second */
+	g_snprintf (buf, sizeof (buf), _("%.1f m/s"), WINDSPEED_KNOTS_TO_MS (knots));
+	break;
+    case SPEED_UNIT_BFT:
+	/* TRANSLATOR: This is the wind speed as a Beaufort force factor
+	 * (commonly used in nautical wind estimation).
+	 */
+	g_snprintf (buf, sizeof (buf), _("Beaufort force %.1f"),
+		    WINDSPEED_KNOTS_TO_BFT (knots));
+	break;
+    case SPEED_UNIT_INVALID:
+    case SPEED_UNIT_DEFAULT:
+    default:
+	g_warning ("Conversion to illegal speed unit: %d", to_unit);
+	return _("Unknown");
     }
 
     return buf;
 }
-const gchar *weather_info_get_wind (WeatherInfo *info)
+
+const gchar *
+weather_info_get_wind (WeatherInfo *info)
 {
     static gchar buf[200];
-    g_return_val_if_fail(info != NULL, NULL);
+
+    g_return_val_if_fail (info != NULL, NULL);
+
     if (!info->valid)
         return "-";
     if (info->windspeed < 0.0 || info->wind < 0)
         return _("Unknown");
     if (info->windspeed == 0.00) {
-        strncpy(buf, _("Calm"), sizeof(buf));
-	buf[sizeof(buf)-1] = '\0';
-    } else
+        strncpy (buf, _("Calm"), sizeof (buf));
+	buf[sizeof (buf)-1] = '\0';
+    } else {
         /* TRANSLATOR: This is 'wind direction' / 'wind speed' */
-        g_snprintf(buf, sizeof(buf), _("%s / %s"),
-		   weather_wind_direction_string(info->wind),
-		   windspeed_string(info->windspeed, info->speed_unit));
+        g_snprintf (buf, sizeof (buf), _("%s / %s"),
+		    weather_wind_direction_string (info->wind),
+		    windspeed_string (info->windspeed, info->speed_unit));
+    }
     return buf;
 }
 
-const gchar *weather_info_get_pressure (WeatherInfo *info)
+const gchar *
+weather_info_get_pressure (WeatherInfo *info)
 {
     static gchar buf[100];
-    g_return_val_if_fail(info != NULL, NULL);
+
+    g_return_val_if_fail (info != NULL, NULL);
+
     if (!info->valid)
         return "-";
     if (info->pressure < 0.0)
         return _("Unknown");
 
     switch (info->pressure_unit) {
-        case PRESSURE_UNIT_INCH_HG:
-            /* TRANSLATOR: This is pressure in inches of mercury */
-            g_snprintf (buf, sizeof (buf), _("%.2f inHg"), info->pressure);
-            break;
-        case PRESSURE_UNIT_MM_HG:
-            /* TRANSLATOR: This is pressure in millimeters of mercury */
-            g_snprintf (buf, sizeof (buf), _("%.1f mmHg"), PRESSURE_INCH_TO_MM(info->pressure));
-            break;
-        case PRESSURE_UNIT_KPA:
-            /* TRANSLATOR: This is pressure in kiloPascals */
-            g_snprintf (buf, sizeof (buf), _("%.2f kPa"), PRESSURE_INCH_TO_KPA(info->pressure));
-            break;
-        case PRESSURE_UNIT_HPA:
-            /* TRANSLATOR: This is pressure in hectoPascals */
-            g_snprintf (buf, sizeof (buf), _("%.2f hPa"), PRESSURE_INCH_TO_HPA(info->pressure));
-            break;
-        case PRESSURE_UNIT_MB:
-            /* TRANSLATOR: This is pressure in millibars */
-            g_snprintf (buf, sizeof (buf), _("%.2f mb"), PRESSURE_INCH_TO_MB(info->pressure));
-            break;
-        case PRESSURE_UNIT_ATM:
-            /* TRANSLATOR: This is pressure in atmospheres */
-            g_snprintf (buf, sizeof (buf), _("%.3f atm"), PRESSURE_INCH_TO_ATM(info->pressure));
-            break;
-
-        case PRESSURE_UNIT_INVALID:
-        case PRESSURE_UNIT_DEFAULT:
-        default:
-            g_warning("Conversion to illegal pressure unit: %d", info->pressure_unit);
-            return _("Unknown");
+    case PRESSURE_UNIT_INCH_HG:
+	/* TRANSLATOR: This is pressure in inches of mercury */
+	g_snprintf (buf, sizeof (buf), _("%.2f inHg"), info->pressure);
+	break;
+    case PRESSURE_UNIT_MM_HG:
+	/* TRANSLATOR: This is pressure in millimeters of mercury */
+	g_snprintf (buf, sizeof (buf), _("%.1f mmHg"), PRESSURE_INCH_TO_MM (info->pressure));
+	break;
+    case PRESSURE_UNIT_KPA:
+	/* TRANSLATOR: This is pressure in kiloPascals */
+	g_snprintf (buf, sizeof (buf), _("%.2f kPa"), PRESSURE_INCH_TO_KPA (info->pressure));
+	break;
+    case PRESSURE_UNIT_HPA:
+	/* TRANSLATOR: This is pressure in hectoPascals */
+	g_snprintf (buf, sizeof (buf), _("%.2f hPa"), PRESSURE_INCH_TO_HPA (info->pressure));
+	break;
+    case PRESSURE_UNIT_MB:
+	/* TRANSLATOR: This is pressure in millibars */
+	g_snprintf (buf, sizeof (buf), _("%.2f mb"), PRESSURE_INCH_TO_MB (info->pressure));
+	break;
+    case PRESSURE_UNIT_ATM:
+	/* TRANSLATOR: This is pressure in atmospheres */
+	g_snprintf (buf, sizeof (buf), _("%.3f atm"), PRESSURE_INCH_TO_ATM (info->pressure));
+	break;
+
+    case PRESSURE_UNIT_INVALID:
+    case PRESSURE_UNIT_DEFAULT:
+    default:
+	g_warning ("Conversion to illegal pressure unit: %d", info->pressure_unit);
+	return _("Unknown");
     }
 
     return buf;
 }
 
-const gchar *weather_info_get_visibility (WeatherInfo *info)
+const gchar *
+weather_info_get_visibility (WeatherInfo *info)
 {
     static gchar buf[100];
-    g_return_val_if_fail(info != NULL, NULL);
+
+    g_return_val_if_fail (info != NULL, NULL);
+
     if (!info->valid)
         return "-";
     if (info->visibility < 0.0)
         return _("Unknown");
 
     switch (info->distance_unit) {
-        case DISTANCE_UNIT_MILES:
-            /* TRANSLATOR: This is the visibility in miles */
-            g_snprintf(buf, sizeof (buf), _("%.1f miles"), info->visibility);
-            break;
-        case DISTANCE_UNIT_KM:
-            /* TRANSLATOR: This is the visibility in kilometers */
-            g_snprintf(buf, sizeof (buf), _("%.1f km"), VISIBILITY_SM_TO_KM(info->visibility));
-            break;
-        case DISTANCE_UNIT_METERS:
-            /* TRANSLATOR: This is the visibility in meters */
-            g_snprintf(buf, sizeof (buf), _("%.0fm"), VISIBILITY_SM_TO_M(info->visibility));
-            break;
-
-        case DISTANCE_UNIT_INVALID:
-        case DISTANCE_UNIT_DEFAULT:
-        default:
-            g_warning("Conversion to illegal visibility unit: %d", info->pressure_unit);
-            return _("Unknown");
+    case DISTANCE_UNIT_MILES:
+	/* TRANSLATOR: This is the visibility in miles */
+	g_snprintf (buf, sizeof (buf), _("%.1f miles"), info->visibility);
+	break;
+    case DISTANCE_UNIT_KM:
+	/* TRANSLATOR: This is the visibility in kilometers */
+	g_snprintf (buf, sizeof (buf), _("%.1f km"), VISIBILITY_SM_TO_KM (info->visibility));
+	break;
+    case DISTANCE_UNIT_METERS:
+	/* TRANSLATOR: This is the visibility in meters */
+	g_snprintf (buf, sizeof (buf), _("%.0fm"), VISIBILITY_SM_TO_M (info->visibility));
+	break;
+
+    case DISTANCE_UNIT_INVALID:
+    case DISTANCE_UNIT_DEFAULT:
+    default:
+	g_warning ("Conversion to illegal visibility unit: %d", info->pressure_unit);
+	return _("Unknown");
     }
 
     return buf;
 }
 
-const gchar *weather_info_get_sunrise (WeatherInfo *info)
+const gchar *
+weather_info_get_sunrise (WeatherInfo *info)
 {
     static gchar buf[200];
     struct tm tm;
-    
-    g_return_val_if_fail(info && info->location, NULL);
-    
+
+    g_return_val_if_fail (info && info->location, NULL);
+
     if (!info->location->latlon_valid)
         return "-";
     if (!info->valid)
@@ -953,19 +994,20 @@
     if (!calc_sun (info))
         return "-";
 
-    localtime_r(&info->sunrise, &tm);
-    if (strftime(buf, sizeof(buf), _("%H:%M"), &tm) <= 0)
+    localtime_r (&info->sunrise, &tm);
+    if (strftime (buf, sizeof (buf), _("%H:%M"), &tm) <= 0)
         return "-";
     return buf;
 }
 
-const gchar *weather_info_get_sunset (WeatherInfo *info)
+const gchar *
+weather_info_get_sunset (WeatherInfo *info)
 {
     static gchar buf[200];
     struct tm tm;
-    
-    g_return_val_if_fail(info && info->location, NULL);
-    
+
+    g_return_val_if_fail (info && info->location, NULL);
+
     if (!info->location->latlon_valid)
         return "-";
     if (!info->valid)
@@ -973,44 +1015,50 @@
     if (!calc_sun (info))
         return "-";
 
-    localtime_r(&info->sunset, &tm);
-    if (strftime(buf, sizeof(buf), _("%H:%M"), &tm) <= 0)
+    localtime_r (&info->sunset, &tm);
+    if (strftime (buf, sizeof (buf), _("%H:%M"), &tm) <= 0)
         return "-";
     return buf;
 }
 
-const gchar *weather_info_get_forecast (WeatherInfo *info)
+const gchar *
+weather_info_get_forecast (WeatherInfo *info)
 {
-    g_return_val_if_fail(info != NULL, NULL);
+    g_return_val_if_fail (info != NULL, NULL);
     return info->forecast;
 }
 
-GdkPixbufAnimation *weather_info_get_radar (WeatherInfo *info)
+GdkPixbufAnimation *
+weather_info_get_radar (WeatherInfo *info)
 {
-    g_return_val_if_fail(info != NULL, NULL);
+    g_return_val_if_fail (info != NULL, NULL);
     return info->radar;
 }
 
-const gchar *weather_info_get_temp_summary (WeatherInfo *info)
+const gchar *
+weather_info_get_temp_summary (WeatherInfo *info)
 {
     if (!info)
         return NULL;
     if (!info->valid || info->temp < -500.0)
         return "--";
-          
+
     return temperature_string (info->temp, info->temperature_unit, TRUE);
-    
+
 }
 
-gchar *weather_info_get_weather_summary (WeatherInfo *info)
+gchar *
+weather_info_get_weather_summary (WeatherInfo *info)
 {
     const gchar *buf;
-    g_return_val_if_fail(info != NULL, NULL);
+
+    g_return_val_if_fail (info != NULL, NULL);
+
     if (!info->valid)
-      return g_strdup (_("Retrieval failed"));
-    buf = weather_info_get_conditions(info);
-    if (!strcmp(buf, "-"))
-        buf = weather_info_get_sky(info);
+	return g_strdup (_("Retrieval failed"));
+    buf = weather_info_get_conditions (info);
+    if (!strcmp (buf, "-"))
+        buf = weather_info_get_sky (info);
     return g_strdup_printf ("%s: %s", weather_info_get_location_name (info), buf);
 }
 
@@ -1029,44 +1077,44 @@
     sky = info->sky;
 
     if (cond.significant) {
-       if (cond.phenomenon != PHENOMENON_NONE &&
-           cond.qualifier == QUALIFIER_THUNDERSTORM)
+	if (cond.phenomenon != PHENOMENON_NONE &&
+	    cond.qualifier == QUALIFIER_THUNDERSTORM)
             return "weather-storm";
 
         switch (cond.phenomenon) {
-            case PHENOMENON_NONE:
-                break;
+	case PHENOMENON_NONE:
+	    break;
 
-            case PHENOMENON_DRIZZLE:
-            case PHENOMENON_RAIN:
-            case PHENOMENON_UNKNOWN_PRECIPITATION:
-            case PHENOMENON_HAIL:
-            case PHENOMENON_SMALL_HAIL:
-                return "weather-showers";
-
-            case PHENOMENON_SNOW:
-            case PHENOMENON_SNOW_GRAINS:
-            case PHENOMENON_ICE_PELLETS:
-            case PHENOMENON_ICE_CRYSTALS:
-                return "weather-snow";
-
-            case PHENOMENON_TORNADO:
-            case PHENOMENON_SQUALL:
-                return "weather-storm";
-
-            case PHENOMENON_MIST:
-            case PHENOMENON_FOG:
-            case PHENOMENON_SMOKE:
-            case PHENOMENON_VOLCANIC_ASH:
-            case PHENOMENON_SAND:
-            case PHENOMENON_HAZE:
-            case PHENOMENON_SPRAY:
-            case PHENOMENON_DUST:
-            case PHENOMENON_SANDSTORM:
-            case PHENOMENON_DUSTSTORM:
-            case PHENOMENON_FUNNEL_CLOUD:
-            case PHENOMENON_DUST_WHIRLS:
-                return "weather-fog";
+	case PHENOMENON_DRIZZLE:
+	case PHENOMENON_RAIN:
+	case PHENOMENON_UNKNOWN_PRECIPITATION:
+	case PHENOMENON_HAIL:
+	case PHENOMENON_SMALL_HAIL:
+	    return "weather-showers";
+
+	case PHENOMENON_SNOW:
+	case PHENOMENON_SNOW_GRAINS:
+	case PHENOMENON_ICE_PELLETS:
+	case PHENOMENON_ICE_CRYSTALS:
+	    return "weather-snow";
+
+	case PHENOMENON_TORNADO:
+	case PHENOMENON_SQUALL:
+	    return "weather-storm";
+
+	case PHENOMENON_MIST:
+	case PHENOMENON_FOG:
+	case PHENOMENON_SMOKE:
+	case PHENOMENON_VOLCANIC_ASH:
+	case PHENOMENON_SAND:
+	case PHENOMENON_HAZE:
+	case PHENOMENON_SPRAY:
+	case PHENOMENON_DUST:
+	case PHENOMENON_SANDSTORM:
+	case PHENOMENON_DUSTSTORM:
+	case PHENOMENON_FUNNEL_CLOUD:
+	case PHENOMENON_DUST_WHIRLS:
+	    return "weather-fog";
         }
     }
 
@@ -1076,23 +1124,23 @@
                 current_time < info->sunset));
 
     switch (sky) {
-        case SKY_INVALID:
-        case SKY_CLEAR:
-            if (daytime)
-                return "weather-clear";
-            else
-                return "weather-clear-night";
-
-        case SKY_BROKEN:
-        case SKY_SCATTERED:
-        case SKY_FEW:
-            if (daytime)
-                return "weather-few-clouds";
-            else
-                return "weather-few-clouds-night";
+    case SKY_INVALID:
+    case SKY_CLEAR:
+	if (daytime)
+	    return "weather-clear";
+	else
+	    return "weather-clear-night";
+
+    case SKY_BROKEN:
+    case SKY_SCATTERED:
+    case SKY_FEW:
+	if (daytime)
+	    return "weather-few-clouds";
+	else
+	    return "weather-few-clouds-night";
 
-        case SKY_OVERCAST:
-            return "weather-overcast";
+    case SKY_OVERCAST:
+	return "weather-overcast";
     }
 
     return NULL;

Modified: trunk/libgweather/weather.h
==============================================================================
--- trunk/libgweather/weather.h	(original)
+++ trunk/libgweather/weather.h	Wed Jun 18 17:46:52 2008
@@ -1,3 +1,5 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+
 #ifndef __WEATHER_H_
 #define __WEATHER_H_
 
@@ -130,8 +132,8 @@
 							 const WeatherPrefs *prefs,
 							 WeatherInfoFunc cb,
 							 gpointer data);
-#define	weather_info_new(location, prefs, cb, data) _weather_info_fill(NULL, (location), (prefs), (cb), (data))
-#define	weather_info_update(info, prefs, cb, data) _weather_info_fill((info), NULL, (prefs), (cb), (data))
+#define	weather_info_new(location, prefs, cb, data) _weather_info_fill (NULL, (location), (prefs), (cb), (data))
+#define	weather_info_update(info, prefs, cb, data) _weather_info_fill ((info), NULL, (prefs), (cb), (data))
 
 void			weather_info_abort		(WeatherInfo *info);
 WeatherInfo *		weather_info_clone		(const WeatherInfo *info);



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