Add struct AgDbSave together with the function ag_db_save_data_free()

This commit is contained in:
Gergely Polonkai 2014-07-21 23:18:18 +02:00
parent f46e35430e
commit 98d08893ef
2 changed files with 52 additions and 0 deletions

View File

@ -459,3 +459,33 @@ ag_db_get(void)
return singleton; return singleton;
} }
void
ag_db_save_data_free(AgDbSave *save_data)
{
if (!save_data) {
return;
}
if (save_data->name) {
g_free(save_data->name);
}
if (save_data->country) {
g_free(save_data->country);
}
if (save_data->city) {
g_free(save_data->city);
}
if (save_data->house_system) {
g_free(save_data->house_system);
}
if (save_data->note) {
g_free(save_data->note);
}
g_free(save_data);
}

View File

@ -29,9 +29,31 @@ struct _AgDbClass {
GObjectClass parent_class; GObjectClass parent_class;
}; };
typedef struct _AgDbSave {
gint db_id;
gchar *name;
gchar *country;
gchar *city;
gdouble longitude;
gdouble latitude;
gdouble altitude;
gint year;
guint month;
guint day;
guint hour;
guint minute;
guint second;
gdouble timezone;
gchar *house_system;
gchar *note;
} AgDbSave;
GType ag_db_get_type(void) G_GNUC_CONST; GType ag_db_get_type(void) G_GNUC_CONST;
AgDb *ag_db_get(void); AgDb *ag_db_get(void);
void ag_db_save_data_free(AgDbSave *save_data);
G_END_DECLS G_END_DECLS
#endif /* __AG_DB_H__ */ #endif /* __AG_DB_H__ */