? docs/C/gweather-C.omf.out
? docs/de/gweather-de.omf.out
? docs/es/gweather-es.omf.out
? docs/fr/gweather-fr.omf.out
? docs/it/gweather-it.omf.out
? docs/ja/gweather-ja.omf.out
? docs/ko/gweather-ko.omf.out
? docs/sv/gweather-sv.omf.out
? docs/zh_CN/gweather-zh_CN.omf.out
? docs/zh_TW/gweather-zh_TW.omf.out
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-applets/gweather/ChangeLog,v
retrieving revision 1.176
diff -u -r1.176 ChangeLog
--- ChangeLog	31 Oct 2003 15:52:29 -0000	1.176
+++ ChangeLog	21 Nov 2003 04:37:45 -0000
@@ -1,3 +1,8 @@
+2003-11-16  Behdad Esfahbod
+
+	* weather.c: Handled unknown values for almost all the fields in info
+	  structure.
+
 2003-10-31  Muktha  <muktha.narayan@wipro.com>
 
 	* gweather-pref.c: Fix critical warnings when opening prefs window.
Index: weather.c
===================================================================
RCS file: /cvs/gnome/gnome-applets/gweather/weather.c,v
retrieving revision 1.63
diff -u -r1.63 weather.c
--- weather.c	16 Jul 2003 19:21:40 -0000	1.63
+++ weather.c	21 Nov 2003 04:37:46 -0000
@@ -138,8 +138,9 @@
 
 const gchar *weather_wind_direction_string (WeatherWindDirection wind)
 {
-	if (wind < 0 ||
-	    wind >= (sizeof (wind_direction_str) / sizeof (char *)))
+        if (wind < 0)
+	        return _("Unknown");
+	if (wind >= (sizeof (wind_direction_str) / sizeof (char *)))
 		return _("Invalid");
 
 	return _(wind_direction_str[(int)wind]);
@@ -1545,18 +1546,20 @@
     }
 
     /* Defaults (just in case...) */
+    /* Well, no just in case anymore.  We may actually fail to fetch some
+     * fields. */
     info->units = UNITS_IMPERIAL;
     info->update = 0;
-    info->sky = SKY_CLEAR;
+    info->sky = -1;
     info->cond.significant = FALSE;
     info->cond.phenomenon = PHENOMENON_NONE;
     info->cond.qualifier = QUALIFIER_NONE;
-    info->temp = 0;
-    info->dew = 0;
-    info->humidity = 0;
-    info->wind = WIND_VARIABLE;
-    info->windspeed = 0;
-    info->pressure = 0.0;
+    info->temp = -1000.0;
+    info->dew = -1000.0;
+    info->humidity = -1;
+    info->wind = -1;
+    info->windspeed = -1;
+    info->pressure = -1.0;
     info->visibility = -1.0;
     info->forecast = NULL;
     info->radar = NULL;
@@ -1631,17 +1634,17 @@
     info->location = weather_location_config_read(applet);
     info->units = (WeatherUnits)0;
     info->update = (WeatherUpdate)0;
-    info->sky = (WeatherSky)0;
+    info->sky = -1;
     info->cond.significant = FALSE;
     info->cond.phenomenon = (WeatherConditionPhenomenon)0;
     info->cond.qualifier = (WeatherConditionQualifier)0;
-    info->temp = 0;
-    info->dew = 0;
-    info->humidity = 0;
-    info->wind = (WeatherWindDirection)0;
-    info->windspeed = 0;
-    info->pressure = 0;
-    info->visibility = 0;
+    info->temp = -1000.0;
+    info->dew = -1000.0;
+    info->humidity = -1;
+    info->wind = -1;
+    info->windspeed = -1;
+    info->pressure = -1.0;
+    info->visibility = -1.0;
     info->forecast = g_strdup ("None");
     info->radar = NULL;  /* FIX */
     info->requests_pending = FALSE;
@@ -1791,6 +1794,8 @@
     g_return_val_if_fail(info != NULL, NULL);
     if (!info->valid)
         return "-";
+    if (info->sky < 0)
+	return "Unknown";
     return weather_sky_string(info->sky);
 }
 
@@ -1808,6 +1813,8 @@
     g_return_val_if_fail(info != NULL, NULL);
     if (!info->valid)
         return "-";
+    if (info->temp < -500.0)
+        return _("Unknown");
     g_snprintf(buf, sizeof (buf), "%.1f%s", info->temp, TEMP_UNIT_STR(info->units));
     return buf;
 }
@@ -1818,6 +1825,8 @@
     g_return_val_if_fail(info != NULL, NULL);
     if (!info->valid)
         return "-";
+    if (info->dew < -500.0)
+        return _("Unknown");
     g_snprintf(buf, sizeof (buf), "%.1f%s", info->dew, TEMP_UNIT_STR(info->units));
     return buf;
 }
@@ -1828,6 +1837,8 @@
     g_return_val_if_fail(info != NULL, NULL);
     if (!info->valid)
         return "-";
+    if (info->humidity < 0.0)
+        return _("Unknown");
     g_snprintf(buf, sizeof (buf), "%d%%", info->humidity);
     return buf;
 }
@@ -1838,6 +1849,8 @@
     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';
@@ -1854,6 +1867,8 @@
     g_return_val_if_fail(info != NULL, NULL);
     if (!info->valid)
         return "-";
+    if (info->pressure < 0.0)
+        return _("Unknown");
     g_snprintf(buf, sizeof (buf), "%.2f %s", info->pressure, PRESSURE_UNIT_STR(info->units));
     return buf;
 }
@@ -1889,7 +1904,7 @@
     
     if (!info)
         return NULL;
-    if (!info->valid)
+    if (!info->valid || info->temp < -500.0)
         return "--";
     
     if (!info->applet)
@@ -1899,7 +1914,8 @@
     else                                                                    
       degree = "F";
       
-   g_snprintf(buf, sizeof (buf), "%d\302\260%s", (int)(info->temp + 0.5), degree);
+   g_snprintf(buf, sizeof (buf), "%d\302\260%s",
+	      (int)(info->temp + (info->temp > 0 ? 0.5 : -0.5)), degree);
     
     return buf;
 }
@@ -2077,7 +2093,7 @@
                     idx = PIX_FOG;
                     break;
                 default:
-                    g_assert_not_reached();
+	            idx = PIX_UNKNOWN;
                 }
         } else {
             switch (sky) {
@@ -2093,7 +2109,7 @@
                 idx = PIX_CLOUD;
                 break;
             default:
-                g_assert_not_reached();
+	        idx = PIX_UNKNOWN;
             }
         }
     }
