From ea91278738120bc37034dc5c33e30fab9a7f153a Mon Sep 17 00:00:00 2001 From: "Gergely POLONKAI (W00d5t0ck)" Date: Mon, 16 Sep 2013 09:23:46 +0200 Subject: [PATCH] Made GsweSignInfo a boxed type --- src/swe-glib.c | 22 ++++++++++++++++++++++ src/swe-glib.h | 3 +++ 2 files changed, 25 insertions(+) diff --git a/src/swe-glib.c b/src/swe-glib.c index b87b03d..dd5b740 100644 --- a/src/swe-glib.c +++ b/src/swe-glib.c @@ -235,3 +235,25 @@ gswe_planet_info_free(GswePlanetInfo *planet_info) } G_DEFINE_BOXED_TYPE(GswePlanetInfo, gswe_planet_info, (GBoxedCopyFunc)gswe_planet_info_copy, (GBoxedFreeFunc)gswe_planet_info_free); + +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); diff --git a/src/swe-glib.h b/src/swe-glib.h index 872c6be..b5d8598 100644 --- a/src/swe-glib.h +++ b/src/swe-glib.h @@ -36,5 +36,8 @@ void gswe_init(); GType gswe_planet_info_get_type(void); #define GSWE_TYPE_PLANET_INFO (gswe_planet_info_get_type()) +GType gswe_sign_info_get_type(void); +#define GSWE_TYPE_SIGN_INFO (gswe_sign_info_get_type()) + #endif /* __SWE_GLIB_H__ */