[libgweather] Fix for flipping moon icon, linking test_sun_moon
- From: Frank Solensky <fsolensky src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libgweather] Fix for flipping moon icon, linking test_sun_moon
- Date: Sat, 28 Nov 2009 19:59:14 +0000 (UTC)
commit 6269d2ff02fa590c740c0634546dd3f9600b7f3d
Author: Frank Solensky <frank src gnome org>
Date: Sat Nov 28 14:36:07 2009 -0500
Fix for flipping moon icon, linking test_sun_moon
weather_info_get_icon_name: when a moon icon is being returned,
the test to determine if the image needed to be reversed for southern
latitudes had compared radians with degrees.
test_sun_moon: link with the library, not the object files
libgweather/Makefile.am | 3 +--
libgweather/test_sun_moon.c | 7 +++++--
libgweather/weather.c | 14 +++++++++-----
3 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/libgweather/Makefile.am b/libgweather/Makefile.am
index 410e7be..2ab3d77 100644
--- a/libgweather/Makefile.am
+++ b/libgweather/Makefile.am
@@ -115,8 +115,7 @@ test_sun_moon_CFLAGS = \
test_sun_moon_LDADD = \
$(LIBSOUP_LIBS) \
- libgweather_la-weather-sun.o \
- libgweather_la-weather-moon.o
+ libgweather.la
noinst_HEADERS = weather-priv.h gweather-win32.h
noinst_PROGRAMS = test_metar test_locations test_sun_moon
diff --git a/libgweather/test_sun_moon.c b/libgweather/test_sun_moon.c
index f8d8ce7..be65779 100644
--- a/libgweather/test_sun_moon.c
+++ b/libgweather/test_sun_moon.c
@@ -53,6 +53,7 @@ main (int argc, char **argv)
location.longitude = DEGREES_TO_RADIANS(longitude);
location.latlon_valid = TRUE;
info.location = &location;
+ info.valid = TRUE;
if (gtime != NULL) {
// printf(" gtime=%s\n", gtime);
@@ -70,8 +71,10 @@ main (int argc, char **argv)
fabs(latitude), (latitude >= 0. ? 'N' : 'S'),
fabs(longitude), (longitude >= 0. ? 'E' : 'W'),
asctime(gmtime(&info.update)));
- printf("sunrise: %s", (bsun ? ctime(&info.sunrise) : "(invalid)\n"));
- printf("sunset: %s", (bsun ? ctime(&info.sunset) : "(invalid)\n"));
+ printf("sunrise: %s",
+ (info.sunriseValid ? ctime(&info.sunrise) : "(invalid)\n"));
+ printf("sunset: %s",
+ (info.sunsetValid ? ctime(&info.sunset) : "(invalid)\n"));
if (bmoon) {
printf("moonphase: %g\n", info.moonphase);
printf("moonlat: %g\n", info.moonlatitude);
diff --git a/libgweather/weather.c b/libgweather/weather.c
index 0ccc200..dfb3666 100644
--- a/libgweather/weather.c
+++ b/libgweather/weather.c
@@ -1244,11 +1244,12 @@ weather_info_get_icon_name (WeatherInfo *info)
if (phase == MOON_PHASES) {
phase = 0;
} else if (phase > 0 &&
- weather_info_get_location(info)->latitude < moonLat) {
+ (RADIANS_TO_DEGREES(weather_info_get_location(info)->latitude)
+ < moonLat)) {
/*
- * Locations south of the moon's latitude will see the moon in the northern sky.
- * The moon waxes and wanes from left to right so we reference an icon running
- * in the opposite direction.
+ * Locations south of the moon's latitude will see the moon in the
+ * northern sky. The moon waxes and wanes from left to right
+ * so we reference an icon running in the opposite direction.
*/
phase = MOON_PHASES - phase;
}
@@ -1268,7 +1269,10 @@ weather_info_get_icon_name (WeatherInfo *info)
}
static gboolean
-temperature_value (gdouble temp_f, TempUnit to_unit, gdouble *value, TempUnit def_unit)
+temperature_value (gdouble temp_f,
+ TempUnit to_unit,
+ gdouble *value,
+ TempUnit def_unit)
{
gboolean ok = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]