From 512897cfd36025e0cc7ea77ea3ea66a8ad10bf19 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Sun, 17 Aug 2014 09:36:30 +0200 Subject: [PATCH] Create a DEFAULT_ALTITUDE macro It is set to 280.0, which is roughly the average altitude of dry land --- configure.ac | 1 + src/ag-chart.c | 3 ++- src/ag-db.c | 3 +-- src/ag-window.c | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 7a9ce88..aef683b 100644 --- a/configure.ac +++ b/configure.ac @@ -18,6 +18,7 @@ AC_PATH_PROGS(UNZIP, [unzip]) have_geonames_perl_modules=no AX_PROG_PERL_MODULES([XML::Writer IO::File], [have_geonames_perl_modules=yes], AC_MSG_WARN([XML::Writer and IO::File perl modules are required if you want to regenerate geodata.xml!])) AC_SUBST([have_geonames_perl_modules]) +AC_DEFINE([DEFAULT_ALTITUDE], [280.0], [Set this to the default altitude value, which is used if there is no value in geodata.xml]) IT_PROG_INTLTOOL([0.35.0]) GETTEXT_PACKAGE=astrognome AC_SUBST(GETTEXT_PACKAGE) diff --git a/src/ag-chart.c b/src/ag-chart.c index cad1283..f9279e4 100644 --- a/src/ag-chart.c +++ b/src/ag-chart.c @@ -11,6 +11,7 @@ #include #include +#include "config.h" #include "ag-db.h" #include "ag-chart.h" #include "placidus.h" @@ -1262,7 +1263,7 @@ AgChart *ag_chart_load_from_placidus_file(GFile *file, chart = ag_chart_new_full( timestamp, - real_long, real_lat, 280.0, + real_long, real_lat, DEFAULT_ALTITUDE, GSWE_HOUSE_SYSTEM_PLACIDUS ); diff --git a/src/ag-db.c b/src/ag-db.c index 2e28d93..afa4ac3 100644 --- a/src/ag-db.c +++ b/src/ag-db.c @@ -955,8 +955,7 @@ ag_db_get_chart_data_by_id(AgDb *db, guint row_id, GError **err) attributes = gda_data_model_get_attributes_at(result, COLUMN_ALTITUDE, 0); if (attributes | GDA_VALUE_ATTR_IS_NULL) { - /* TODO: this value should be macroified */ - save_data->altitude = 280.0; + save_data->altitude = DEFAULT_ALTITUDE; } else { save_data->altitude = g_value_get_double(value); } diff --git a/src/ag-window.c b/src/ag-window.c index a2fa189..2f8f90a 100644 --- a/src/ag-window.c +++ b/src/ag-window.c @@ -10,6 +10,7 @@ #include +#include "config.h" #include "ag-app.h" #include "ag-window.h" #include "ag-chart.h" @@ -574,7 +575,7 @@ ag_window_recalculate_chart(AgWindow *window, gboolean set_everything) } // TODO: So as this… - edit_data->altitude = 280.0; + edit_data->altitude = DEFAULT_ALTITUDE; edit_data->year = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(priv->year) );