Add struct AgDbSave together with the function ag_db_save_data_free()
This commit is contained in:
		
							
								
								
									
										30
									
								
								src/ag-db.c
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								src/ag-db.c
									
									
									
									
									
								
							| @@ -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); | ||||||
|  | } | ||||||
|   | |||||||
							
								
								
									
										22
									
								
								src/ag-db.h
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								src/ag-db.h
									
									
									
									
									
								
							| @@ -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__ */ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user