Move used planets’ list to used_planets global array
This makes it easier to add new planets. A way should still be found to automatically include related files in the default chart.
This commit is contained in:
parent
655c65de9d
commit
d2f0ab2bc6
146
src/ag-chart.c
146
src/ag-chart.c
@ -12,6 +12,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "astrognome.h"
|
||||
#include "ag-db.h"
|
||||
#include "ag-chart.h"
|
||||
#include "placidus.h"
|
||||
@ -221,145 +222,18 @@ ag_chart_finalize(GObject *gobject)
|
||||
void
|
||||
ag_chart_add_planets(AgChart *chart)
|
||||
{
|
||||
int i;
|
||||
AgChartPrivate *priv = ag_chart_get_instance_private(chart);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_CHARIKLO, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_CHARIKLO)
|
||||
);
|
||||
for (i = 0; i < used_planets_count; i++) {
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), used_planets[i], NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(used_planets[i])
|
||||
);
|
||||
}
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_VESTA, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_VESTA)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_JUNO, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_JUNO)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_PALLAS, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_PALLAS)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_CERES, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_CERES)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_NESSUS, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_NESSUS)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_PHOLUS, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_PHOLUS)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_CHIRON, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_CHIRON)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_MOON_APOGEE, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_MOON_APOGEE)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_MOON_NODE, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_MOON_NODE)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_PLUTO, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_PLUTO)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_NEPTUNE, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_NEPTUNE)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_URANUS, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_URANUS)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_SATURN, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_SATURN)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_JUPITER, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_JUPITER)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_MARS, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_MARS)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_VENUS, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_VENUS)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_MERCURY, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_MERCURY)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_MOON, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_MOON)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_SUN, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_SUN)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_VERTEX, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_VERTEX)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_ASCENDANT, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_ASCENDANT)
|
||||
);
|
||||
|
||||
gswe_moment_add_planet(GSWE_MOMENT(chart), GSWE_PLANET_MC, NULL);
|
||||
priv->planet_list = g_list_prepend(
|
||||
priv->planet_list,
|
||||
GINT_TO_POINTER(GSWE_PLANET_MC)
|
||||
);
|
||||
priv->planet_list = g_list_reverse(priv->planet_list);
|
||||
}
|
||||
|
||||
AgChart *
|
||||
|
@ -27,6 +27,7 @@ GtkFileFilter *filter_hor = NULL;
|
||||
GtkTreeModel *country_list = NULL;
|
||||
GtkTreeModel *city_list = NULL;
|
||||
GHashTable *xinclude_positions;
|
||||
gsize used_planets_count;
|
||||
|
||||
const char *moonStateName[] = {
|
||||
"New Moon",
|
||||
@ -40,6 +41,32 @@ const char *moonStateName[] = {
|
||||
"Dark Moon"
|
||||
};
|
||||
|
||||
const GswePlanet used_planets[] = {
|
||||
GSWE_PLANET_MC,
|
||||
GSWE_PLANET_ASCENDANT,
|
||||
GSWE_PLANET_VERTEX,
|
||||
GSWE_PLANET_SUN,
|
||||
GSWE_PLANET_MOON,
|
||||
GSWE_PLANET_MERCURY,
|
||||
GSWE_PLANET_VENUS,
|
||||
GSWE_PLANET_MARS,
|
||||
GSWE_PLANET_JUPITER,
|
||||
GSWE_PLANET_SATURN,
|
||||
GSWE_PLANET_URANUS,
|
||||
GSWE_PLANET_NEPTUNE,
|
||||
GSWE_PLANET_PLUTO,
|
||||
GSWE_PLANET_MOON_NODE,
|
||||
GSWE_PLANET_MOON_APOGEE,
|
||||
GSWE_PLANET_CHIRON,
|
||||
GSWE_PLANET_PHOLUS,
|
||||
GSWE_PLANET_NESSUS,
|
||||
GSWE_PLANET_CERES,
|
||||
GSWE_PLANET_PALLAS,
|
||||
GSWE_PLANET_JUNO,
|
||||
GSWE_PLANET_VESTA,
|
||||
GSWE_PLANET_CHARIKLO
|
||||
};
|
||||
|
||||
void
|
||||
init_filters(void)
|
||||
{
|
||||
@ -357,6 +384,7 @@ main(int argc, char *argv[])
|
||||
textdomain(GETTEXT_PACKAGE);
|
||||
#endif
|
||||
|
||||
used_planets_count = sizeof(used_planets) / sizeof(GswePlanet);
|
||||
LIBXML_TEST_VERSION;
|
||||
xmlSubstituteEntitiesDefault(1);
|
||||
xmlLoadExtDtdDefaultValue = 1;
|
||||
|
@ -10,11 +10,13 @@ typedef struct {
|
||||
gboolean new_window;
|
||||
} AstrognomeOptions;
|
||||
|
||||
extern GtkFileFilter *filter_all;
|
||||
extern GtkFileFilter *filter_chart;
|
||||
extern GtkFileFilter *filter_hor;
|
||||
extern GtkTreeModel *country_list;
|
||||
extern GtkTreeModel *city_list;
|
||||
extern GtkFileFilter *filter_all;
|
||||
extern GtkFileFilter *filter_chart;
|
||||
extern GtkFileFilter *filter_hor;
|
||||
extern GtkTreeModel *country_list;
|
||||
extern GtkTreeModel *city_list;
|
||||
extern const GswePlanet used_planets[];
|
||||
extern gsize used_planets_count;
|
||||
|
||||
enum {
|
||||
AG_COUNTRY_CODE,
|
||||
|
Loading…
Reference in New Issue
Block a user