Moved GsweSignInfo to its own sources
This commit is contained in:
parent
ebeaf1eb4d
commit
39ddb2ee0e
@ -62,6 +62,7 @@ IGNORE_HFILES = \
|
|||||||
swe-glib-private.h \
|
swe-glib-private.h \
|
||||||
gswe-enumtypes.h \
|
gswe-enumtypes.h \
|
||||||
gswe-moon-phase-data-private.h \
|
gswe-moon-phase-data-private.h \
|
||||||
|
gswe-sign-info-private.h \
|
||||||
gswe-planet-info-private.h \
|
gswe-planet-info-private.h \
|
||||||
gswe-planet-data-private.h \
|
gswe-planet-data-private.h \
|
||||||
gswe-aspect-info-private.h \
|
gswe-aspect-info-private.h \
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
<chapter>
|
<chapter>
|
||||||
<title>SWE-GLib</title>
|
<title>SWE-GLib</title>
|
||||||
<xi:include href="xml/gswe-types.xml"/>
|
<xi:include href="xml/gswe-types.xml"/>
|
||||||
|
<xi:include href="xml/gswe-sign-info.xml" />
|
||||||
<xi:include href="xml/gswe-planet-info.xml" />
|
<xi:include href="xml/gswe-planet-info.xml" />
|
||||||
<xi:include href="xml/gswe-planet-data.xml" />
|
<xi:include href="xml/gswe-planet-data.xml" />
|
||||||
<xi:include href="xml/gswe-moon-phase-data.xml"/>
|
<xi:include href="xml/gswe-moon-phase-data.xml"/>
|
||||||
|
@ -55,6 +55,18 @@ GSWE_TYPE_MOON_PHASE_DATA
|
|||||||
gswe_moon_phase_data_get_type
|
gswe_moon_phase_data_get_type
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<FILE>gswe-sign-info</FILE>
|
||||||
|
GsweSignInfo
|
||||||
|
gswe_sign_info_get_element
|
||||||
|
gswe_sign_info_get_name
|
||||||
|
gswe_sign_info_get_quality
|
||||||
|
gswe_sign_info_get_sign
|
||||||
|
<SUBSECTION Standard>
|
||||||
|
GSWE_TYPE_SIGN_INFO
|
||||||
|
gswe_sign_info_get_type
|
||||||
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
<FILE>gswe-planet-info</FILE>
|
<FILE>gswe-planet-info</FILE>
|
||||||
GswePlanetInfo
|
GswePlanetInfo
|
||||||
@ -189,7 +201,6 @@ GsweElement
|
|||||||
GsweQuality
|
GsweQuality
|
||||||
GsweHouseSystem
|
GsweHouseSystem
|
||||||
GsweMoonPhase
|
GsweMoonPhase
|
||||||
GsweSignInfo
|
|
||||||
GsweHouseSystemInfo
|
GsweHouseSystemInfo
|
||||||
GsweCoordinates
|
GsweCoordinates
|
||||||
GsweHouseData
|
GsweHouseData
|
||||||
@ -203,8 +214,5 @@ gswe_house_data_get_type
|
|||||||
<SECTION>
|
<SECTION>
|
||||||
<FILE>swe-glib</FILE>
|
<FILE>swe-glib</FILE>
|
||||||
gswe_init
|
gswe_init
|
||||||
<SUBSECTION Standard>
|
|
||||||
GSWE_TYPE_SIGN_INFO
|
|
||||||
gswe_sign_info_get_type
|
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
|
@ -7,12 +7,13 @@ INST_H_SRC_FILES = \
|
|||||||
swe-glib.h \
|
swe-glib.h \
|
||||||
gswe-types.h \
|
gswe-types.h \
|
||||||
gswe-moon-phase-data.h \
|
gswe-moon-phase-data.h \
|
||||||
|
gswe-sign-info.h \
|
||||||
|
gswe-planet-info.h \
|
||||||
|
gswe-planet-data.h \
|
||||||
gswe-aspect-info.h \
|
gswe-aspect-info.h \
|
||||||
gswe-aspect-data.h \
|
gswe-aspect-data.h \
|
||||||
gswe-antiscion-axis-info.h \
|
gswe-antiscion-axis-info.h \
|
||||||
gswe-antiscion-data.h \
|
gswe-antiscion-data.h \
|
||||||
gswe-planet-info.h \
|
|
||||||
gswe-planet-data.h \
|
|
||||||
gswe-moment.h \
|
gswe-moment.h \
|
||||||
gswe-timestamp.h \
|
gswe-timestamp.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
@ -26,6 +27,7 @@ libswe_glib_1_0_la_SOURCES = \
|
|||||||
swe-glib.c \
|
swe-glib.c \
|
||||||
gswe-types.c \
|
gswe-types.c \
|
||||||
gswe-moon-phase-data.c \
|
gswe-moon-phase-data.c \
|
||||||
|
gswe-sign-info.c \
|
||||||
gswe-planet-info.c \
|
gswe-planet-info.c \
|
||||||
gswe-planet-data.c \
|
gswe-planet-data.c \
|
||||||
gswe-aspect-info.c \
|
gswe-aspect-info.c \
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
#include "gswe-types.h"
|
#include "gswe-types.h"
|
||||||
|
#include "gswe-sign-info.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -759,7 +759,7 @@ gswe_moment_get_sign_planets(GsweMoment *moment, GsweZodiac sign)
|
|||||||
for (planet = moment->priv->planet_list; planet; planet = g_list_next(planet)) {
|
for (planet = moment->priv->planet_list; planet; planet = g_list_next(planet)) {
|
||||||
GswePlanetData *pd = planet->data;
|
GswePlanetData *pd = planet->data;
|
||||||
|
|
||||||
if (pd->sign->sign_id == sign) {
|
if (pd->sign->sign == sign) {
|
||||||
ret = g_list_prepend(ret, pd);
|
ret = g_list_prepend(ret, pd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1188,7 +1188,7 @@ find_antiscion(gpointer axis_p, GsweAntiscionAxisInfo *antiscion_axis_info, Gswe
|
|||||||
}
|
}
|
||||||
|
|
||||||
planet_orb = fmin(antiscion_data->planet1->planet_info->orb, antiscion_data->planet2->planet_info->orb);
|
planet_orb = fmin(antiscion_data->planet1->planet_info->orb, antiscion_data->planet2->planet_info->orb);
|
||||||
start_point = (antiscion_axis_info->start_sign->sign_id - 1) * 30.0;
|
start_point = (antiscion_axis_info->start_sign->sign - 1) * 30.0;
|
||||||
|
|
||||||
start_point += antiscion_axis_info->sign_offset;
|
start_point += antiscion_axis_info->sign_offset;
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "gswe-types.h"
|
#include "gswe-types.h"
|
||||||
#include "gswe-planet-info.h"
|
#include "gswe-planet-info.h"
|
||||||
|
#include "gswe-sign-info.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
47
src/gswe-sign-info-private.h
Normal file
47
src/gswe-sign-info-private.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/* gswe-sign-info-private.h: Private parts of GsweSignInfo
|
||||||
|
*
|
||||||
|
* Copyright © 2013 Gergely Polonkai
|
||||||
|
*
|
||||||
|
* SWE-GLib is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* SWE-GLib is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifdef __SWE_GLIB_BUILDING__
|
||||||
|
#ifndef __SWE_GLIB_GSWE_SIGN_INFO_PRIVATE_H__
|
||||||
|
#define __SWE_GLIB_GSWE_SIGN_INFO_PRIVATE_H__
|
||||||
|
|
||||||
|
#include "gswe-types.h"
|
||||||
|
|
||||||
|
#include "gswe-sign-info.h"
|
||||||
|
|
||||||
|
struct _GsweSignInfo {
|
||||||
|
/* the identifier for this sign */
|
||||||
|
GsweZodiac sign;
|
||||||
|
|
||||||
|
/* the name of this sign */
|
||||||
|
gchar *name;
|
||||||
|
|
||||||
|
/* the element of the sign */
|
||||||
|
GsweElement element;
|
||||||
|
|
||||||
|
/* the quality of the sign */
|
||||||
|
GsweQuality quality;
|
||||||
|
};
|
||||||
|
|
||||||
|
GsweSignInfo *gswe_sign_info_copy(GsweSignInfo *sign_info);
|
||||||
|
void gswe_sign_info_free(GsweSignInfo *sign_info);
|
||||||
|
|
||||||
|
#endif /* __SWE_GLIB_GSWE_SIGN_INFO_PRIVATE_H__ */
|
||||||
|
#else /* not defined __SWE_GLIB_BUILDING__ */
|
||||||
|
#error __FILE__ "Can not be included, unless building SWE-GLib"
|
||||||
|
#endif /* __SWE_GLIB_BUILDING__ */
|
||||||
|
|
137
src/gswe-sign-info.c
Normal file
137
src/gswe-sign-info.c
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
/* gswe-sign-info.c: Zodiac sign related information
|
||||||
|
*
|
||||||
|
* Copyright © 2013 Gergely Polonkai
|
||||||
|
*
|
||||||
|
* SWE-GLib is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* SWE-GLib is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#include "gswe-types.h"
|
||||||
|
|
||||||
|
#include "gswe-sign-info.h"
|
||||||
|
#include "gswe-sign-info-private.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:gswe-sign-info
|
||||||
|
* @short_description: a structure storing information about a zodiac sign
|
||||||
|
* @title: GsweSignInfo
|
||||||
|
* @stability: Stable
|
||||||
|
* @include: swe-glib.h
|
||||||
|
*
|
||||||
|
* The #GsweSignInfo stores information about a zodiac sign.
|
||||||
|
*/
|
||||||
|
|
||||||
|
G_DEFINE_BOXED_TYPE(GsweSignInfo, gswe_sign_info, (GBoxedCopyFunc)gswe_sign_info_copy, (GBoxedFreeFunc)gswe_sign_info_free);
|
||||||
|
|
||||||
|
GsweSignInfo *
|
||||||
|
gswe_sign_info_copy(GsweSignInfo *sign_info)
|
||||||
|
{
|
||||||
|
GsweSignInfo *ret;
|
||||||
|
|
||||||
|
if (sign_info == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = g_new0(GsweSignInfo, 1);
|
||||||
|
|
||||||
|
ret->sign = sign_info->sign;
|
||||||
|
ret->name = g_strdup(sign_info->name);
|
||||||
|
ret->element = sign_info->element;
|
||||||
|
ret->quality = sign_info->quality;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gswe_sign_info_free(GsweSignInfo *sign_info)
|
||||||
|
{
|
||||||
|
if (sign_info) {
|
||||||
|
if (sign_info->name) {
|
||||||
|
g_free(sign_info->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free(sign_info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gswe_sign_info_get_sign:
|
||||||
|
* @sign_info: (in) (allow-none): a #GsweSignInfo
|
||||||
|
*
|
||||||
|
* Gets the sign ID that is represented by this #GsweSignInfo.
|
||||||
|
*
|
||||||
|
* Returns: the sign ID
|
||||||
|
*/
|
||||||
|
GsweZodiac
|
||||||
|
gswe_sign_info_get_sign(GsweSignInfo *sign_info)
|
||||||
|
{
|
||||||
|
if (sign_info) {
|
||||||
|
return sign_info->sign;
|
||||||
|
} else {
|
||||||
|
return GSWE_SIGN_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gswe_sign_info_get_name:
|
||||||
|
* @sign_info: (in) (allow-none): a #GsweSignInfo
|
||||||
|
*
|
||||||
|
* Gets the name associated with this sign.
|
||||||
|
*
|
||||||
|
* Returns: (transfer none): the name of the zodiac sign
|
||||||
|
*/
|
||||||
|
const gchar *
|
||||||
|
gswe_sign_info_get_name(GsweSignInfo *sign_info)
|
||||||
|
{
|
||||||
|
if (sign_info) {
|
||||||
|
return sign_info->name;
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gswe_sign_info_get_element:
|
||||||
|
* @sign_info: (in) (allow-none): a #GsweSignInfo
|
||||||
|
*
|
||||||
|
* Gets the element this sign belongs to.
|
||||||
|
*
|
||||||
|
* Returns: the element
|
||||||
|
*/
|
||||||
|
GsweElement
|
||||||
|
gswe_sign_info_get_element(GsweSignInfo *sign_info)
|
||||||
|
{
|
||||||
|
if (sign_info) {
|
||||||
|
return sign_info->element;
|
||||||
|
} else {
|
||||||
|
return GSWE_ELEMENT_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gswe_sign_info_get_quality:
|
||||||
|
* @sign_info: (in) (allow-none): a #GsweSignInfo
|
||||||
|
*
|
||||||
|
* Gets the quality this sign belongs to.
|
||||||
|
*
|
||||||
|
* Returns: the quality
|
||||||
|
*/
|
||||||
|
GsweQuality
|
||||||
|
gswe_sign_info_get_quality(GsweSignInfo *sign_info)
|
||||||
|
{
|
||||||
|
if (sign_info) {
|
||||||
|
return sign_info->quality;
|
||||||
|
} else {
|
||||||
|
return GSWE_QUALITY_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
48
src/gswe-sign-info.h
Normal file
48
src/gswe-sign-info.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/* gswe-sign-info.h: Zodiac sign related information
|
||||||
|
*
|
||||||
|
* Copyright © 2013 Gergely Polonkai
|
||||||
|
*
|
||||||
|
* SWE-GLib is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* SWE-GLib is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef __SWE_GLIB_GSWE_SIGN_INFO_H__
|
||||||
|
#define __SWE_GLIB_GSWE_SIGN_INFO_H__
|
||||||
|
|
||||||
|
#include <glib-object.h>
|
||||||
|
|
||||||
|
#include "gswe-types.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GsweSignInfo:
|
||||||
|
*
|
||||||
|
* <structname>GsweSignInfo</structname> is an opaque structure whose members
|
||||||
|
* cannot be accessed directly.
|
||||||
|
*
|
||||||
|
* Since: 1.1
|
||||||
|
*/
|
||||||
|
typedef struct _GsweSignInfo GsweSignInfo;
|
||||||
|
|
||||||
|
GType gswe_sign_info_get_type(void);
|
||||||
|
#define GSWE_TYPE_SIGN_INFO (gswe_sign_info_get_type())
|
||||||
|
|
||||||
|
GsweZodiac gswe_sign_info_get_sign(GsweSignInfo *sign_info);
|
||||||
|
const gchar *gswe_sign_info_get_name(GsweSignInfo *sign_info);
|
||||||
|
GsweElement gswe_sign_info_get_element(GsweSignInfo *sign_info);
|
||||||
|
GsweQuality gswe_sign_info_get_quality(GsweSignInfo *sign_info);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __SWE_GLIB_GSWE_SIGN_INFO_H__ */
|
||||||
|
|
@ -249,22 +249,6 @@ typedef enum {
|
|||||||
GSWE_MOON_PHASE_DARK
|
GSWE_MOON_PHASE_DARK
|
||||||
} GsweMoonPhase;
|
} GsweMoonPhase;
|
||||||
|
|
||||||
/**
|
|
||||||
* GsweSignInfo:
|
|
||||||
* @sign_id: the identifier for this sign
|
|
||||||
* @name: the name of this sign
|
|
||||||
* @element: the element of the sign
|
|
||||||
* @quality: the quality of the sign
|
|
||||||
*
|
|
||||||
* Holds information about zodiac signs known by SWE-GLib.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
GsweZodiac sign_id;
|
|
||||||
gchar *name;
|
|
||||||
GsweElement element;
|
|
||||||
GsweQuality quality;
|
|
||||||
} GsweSignInfo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GsweHouseSystemInfo:
|
* GsweHouseSystemInfo:
|
||||||
* @system: the house system's ID
|
* @system: the house system's ID
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "gswe-timestamp.h"
|
#include "gswe-timestamp.h"
|
||||||
#include "gswe-types.h"
|
#include "gswe-types.h"
|
||||||
#include "gswe-moon-phase-data-private.h"
|
#include "gswe-moon-phase-data-private.h"
|
||||||
|
#include "gswe-sign-info-private.h"
|
||||||
#include "gswe-planet-info-private.h"
|
#include "gswe-planet-info-private.h"
|
||||||
#include "gswe-planet-data-private.h"
|
#include "gswe-planet-data-private.h"
|
||||||
#include "gswe-aspect-info-private.h"
|
#include "gswe-aspect-info-private.h"
|
||||||
|
@ -55,7 +55,7 @@ GsweTimestamp *gswe_full_moon_base_date;
|
|||||||
|
|
||||||
#define ADD_SIGN(ht, v, s, n, e, q) \
|
#define ADD_SIGN(ht, v, s, n, e, q) \
|
||||||
(v) = g_new0(GsweSignInfo, 1); \
|
(v) = g_new0(GsweSignInfo, 1); \
|
||||||
(v)->sign_id = (s); \
|
(v)->sign = (s); \
|
||||||
(v)->name = g_strdup(n); \
|
(v)->name = g_strdup(n); \
|
||||||
(v)->element = (e); \
|
(v)->element = (e); \
|
||||||
(v)->quality = (q); \
|
(v)->quality = (q); \
|
||||||
@ -217,24 +217,3 @@ gswe_init(void)
|
|||||||
gswe_initialized = TRUE;
|
gswe_initialized = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GsweSignInfo *
|
|
||||||
gswe_sign_info_copy(GsweSignInfo *sign_info)
|
|
||||||
{
|
|
||||||
GsweSignInfo *ret = g_new0(GsweSignInfo, 1);
|
|
||||||
|
|
||||||
ret->sign_id = sign_info->sign_id;
|
|
||||||
ret->name = g_strdup(sign_info->name);
|
|
||||||
ret->element = sign_info->element;
|
|
||||||
ret->quality = sign_info->quality;
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gswe_sign_info_free(GsweSignInfo *sign_info)
|
|
||||||
{
|
|
||||||
g_free(sign_info->name);
|
|
||||||
g_free(sign_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
G_DEFINE_BOXED_TYPE(GsweSignInfo, gswe_sign_info, (GBoxedCopyFunc)gswe_sign_info_copy, (GBoxedFreeFunc)gswe_sign_info_free);
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include "gswe-types.h"
|
#include "gswe-types.h"
|
||||||
#include "gswe-moon-phase-data.h"
|
#include "gswe-moon-phase-data.h"
|
||||||
|
#include "gswe-sign-info.h"
|
||||||
#include "gswe-planet-info.h"
|
#include "gswe-planet-info.h"
|
||||||
#include "gswe-planet-data.h"
|
#include "gswe-planet-data.h"
|
||||||
#include "gswe-aspect-info.h"
|
#include "gswe-aspect-info.h"
|
||||||
@ -33,8 +34,5 @@
|
|||||||
|
|
||||||
void gswe_init();
|
void gswe_init();
|
||||||
|
|
||||||
GType gswe_sign_info_get_type(void);
|
|
||||||
#define GSWE_TYPE_SIGN_INFO (gswe_sign_info_get_type())
|
|
||||||
|
|
||||||
#endif /* __SWE_GLIB_H__ */
|
#endif /* __SWE_GLIB_H__ */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user