diff options
author | Iain Holmes <iain@src.gnome.org> | 2001-07-10 04:08:30 +0800 |
---|---|---|
committer | Iain Holmes <iain@src.gnome.org> | 2001-07-10 04:08:30 +0800 |
commit | 4138abc3ebb024c3f3b5c3063cca669a60147f6b (patch) | |
tree | a51992a3918155a6a3a57d83756a5e50bdc58e9c | |
parent | 7c4e516f1c74de3ce8c975b8965b086b447f39ef (diff) | |
download | gsoc2013-evolution-4138abc3ebb024c3f3b5c3063cca669a60147f6b.tar gsoc2013-evolution-4138abc3ebb024c3f3b5c3063cca669a60147f6b.tar.gz gsoc2013-evolution-4138abc3ebb024c3f3b5c3063cca669a60147f6b.tar.bz2 gsoc2013-evolution-4138abc3ebb024c3f3b5c3063cca669a60147f6b.tar.lz gsoc2013-evolution-4138abc3ebb024c3f3b5c3063cca669a60147f6b.tar.xz gsoc2013-evolution-4138abc3ebb024c3f3b5c3063cca669a60147f6b.tar.zst gsoc2013-evolution-4138abc3ebb024c3f3b5c3063cca669a60147f6b.zip |
Get a lovely icon from jimmac for the type of weather
svn path=/trunk/; revision=10929
-rw-r--r-- | my-evolution/ChangeLog | 7 | ||||
-rw-r--r-- | my-evolution/e-summary-weather.c | 8 | ||||
-rw-r--r-- | my-evolution/metar.c | 54 | ||||
-rw-r--r-- | my-evolution/metar.h | 1 |
4 files changed, 68 insertions, 2 deletions
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog index deb5c70ba6..5ff8803b45 100644 --- a/my-evolution/ChangeLog +++ b/my-evolution/ChangeLog @@ -1,5 +1,12 @@ 2001-07-09 Iain Holmes <iain@ximian.com> + * e-summary-weather.c (weather_make_html): Get an icon for the weather. + + * metar.[ch] (icon_from_weather): Work out what icon for a specific + weather type. + +2001-07-09 Iain Holmes <iain@ximian.com> + * e-summary-rdf.c (tree_walk): Fix HTML so it doesn't give the big black line diff --git a/my-evolution/e-summary-weather.c b/my-evolution/e-summary-weather.c index 164278fe50..47d077212a 100644 --- a/my-evolution/e-summary-weather.c +++ b/my-evolution/e-summary-weather.c @@ -86,9 +86,13 @@ weather_make_html (Weather *w) GString *string; ESummaryWeatherLocation *location; char *sky, *temp, *cond, *uri, *url, *s; + char *icon_name; - string = g_string_new ("<dd><img align=\"middle\" " - "src=\"es-weather.png\"> <b>"); + icon_name = icon_from_weather (w); + g_print ("icon_name: %s\n", icon_name); + string = g_string_new (""); + g_string_sprintf (string, "<dd><img align=\"middle\" " + "src=\"%s\"> <b>", icon_name); location = g_hash_table_lookup (locations_hash, w->location); if (location == NULL) { url = make_url (w->location, w->location); diff --git a/my-evolution/metar.c b/my-evolution/metar.c index ee99816e00..34ed397a19 100644 --- a/my-evolution/metar.c +++ b/my-evolution/metar.c @@ -611,3 +611,57 @@ metar_tok_cond (gchar *tokp, return TRUE; } + +const char * +icon_from_weather (Weather *w) +{ + ESummaryWeatherConditions cond = w->cond; + ESummaryWeatherSky sky = w->sky; + + switch (cond.phenomenon) { + case PHENOMENON_DRIZZLE: + case PHENOMENON_RAIN: + case PHENOMENON_UNKNOWN_PRECIPITATION: + case PHENOMENON_HAIL: + case PHENOMENON_SMALL_HAIL: + return "myweather-rain.png"; + case PHENOMENON_SNOW: + case PHENOMENON_SNOW_GRAINS: + case PHENOMENON_ICE_PELLETS: + case PHENOMENON_ICE_CRYSTALS: + return "myweather-snow.png"; + case PHENOMENON_TORNADO: + case PHENOMENON_SQUALL: + return "myweather-storm.png"; + 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 "myweather-fog.png"; + default: + break; + } + + switch (sky) { + case SKY_CLEAR: + return "myweather-sun.png"; + case SKY_BROKEN: + case SKY_SCATTERED: + case SKY_FEW: + return "myweather-suncloud.png"; + case SKY_OVERCAST: + return "myweather-clouds.png"; + default: + break; + } + + return "es-weather.png"; +} diff --git a/my-evolution/metar.h b/my-evolution/metar.h index cbbb8f9550..91ec15d2a1 100644 --- a/my-evolution/metar.h +++ b/my-evolution/metar.h @@ -28,6 +28,7 @@ const char *weather_sky_string (Weather *w); char *weather_temp_string (Weather *w); const char *weather_conditions_string (Weather *w); const char *weather_wind_direction_string (Weather *w); +const char *icon_from_weather (Weather *w); void metar_init_re (void); gboolean metar_tok_time (char *token, |