2014-07-20 21:13:56 +00:00
|
|
|
#ifndef __AG_DB_H__
|
|
|
|
#define __AG_DB_H__
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
2014-07-21 21:33:28 +00:00
|
|
|
#include <gtk/gtk.h>
|
2014-07-20 21:13:56 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
#define AG_TYPE_DB (ag_db_get_type())
|
|
|
|
#define AG_DB(o) (G_TYPE_CHECK_INSTANCE_CAST((o), \
|
|
|
|
AG_TYPE_DB, \
|
|
|
|
AgDb))
|
|
|
|
#define AG_DB_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), \
|
|
|
|
AG_TYPE_DB, \
|
|
|
|
AgDbClass))
|
|
|
|
#define AG_IS_DB(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), AG_TYPE_DB))
|
|
|
|
#define AG_IS_DB_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), AG_TYPE_DB))
|
|
|
|
#define AG_DB_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), \
|
|
|
|
AG_TYPE_DB, \
|
|
|
|
AgDbClass))
|
|
|
|
|
|
|
|
typedef struct _AgDb AgDb;
|
|
|
|
typedef struct _AgDbClass AgDbClass;
|
|
|
|
|
|
|
|
struct _AgDb {
|
|
|
|
GObject parent_instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _AgDbClass {
|
|
|
|
GObjectClass parent_class;
|
|
|
|
};
|
|
|
|
|
2014-07-21 21:18:18 +00:00
|
|
|
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;
|
|
|
|
|
2014-07-30 22:19:09 +00:00
|
|
|
typedef enum {
|
2014-08-01 23:37:11 +00:00
|
|
|
AG_DB_ERROR_NO_CHART,
|
|
|
|
AG_DB_ERROR_DATABASE_ERROR,
|
2014-07-30 22:19:09 +00:00
|
|
|
} AgDbError;
|
|
|
|
|
2014-07-20 21:13:56 +00:00
|
|
|
GType ag_db_get_type(void) G_GNUC_CONST;
|
2014-07-21 21:18:18 +00:00
|
|
|
|
2014-07-20 21:13:56 +00:00
|
|
|
AgDb *ag_db_get(void);
|
|
|
|
|
2014-07-21 21:18:18 +00:00
|
|
|
void ag_db_save_data_free(AgDbSave *save_data);
|
|
|
|
|
2014-07-21 21:33:28 +00:00
|
|
|
gboolean ag_db_save_chart(AgDb *db,
|
|
|
|
AgDbSave *save_data,
|
|
|
|
GError **err);
|
|
|
|
|
2014-07-22 10:25:00 +00:00
|
|
|
GList *ag_db_get_chart_list(AgDb *db, GError **err);
|
|
|
|
|
2014-07-30 22:33:54 +00:00
|
|
|
AgDbSave *ag_db_get_chart_data_by_id(AgDb *db, guint row_id, GError **err);
|
|
|
|
|
2014-08-10 22:58:56 +00:00
|
|
|
gboolean ag_db_delete_chart(AgDb *db, gint row_id, GError **err);
|
|
|
|
|
2014-08-05 21:45:16 +00:00
|
|
|
gboolean ag_db_save_identical(const AgDbSave *a,
|
|
|
|
const AgDbSave *b,
|
|
|
|
gboolean chart_only);
|
2014-07-31 16:11:32 +00:00
|
|
|
|
2014-07-30 22:19:09 +00:00
|
|
|
#define AG_DB_ERROR (ag_db_error_quark())
|
|
|
|
GQuark ag_db_error_quark(void);
|
|
|
|
|
2014-07-20 21:13:56 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __AG_DB_H__ */
|