From 67dda14da027239109554a1e77e02a2608bdf4d2 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Sat, 14 Sep 2013 01:25:46 +0200 Subject: [PATCH] Started implementing load/save functionality --- data/examples/saved-chart.xml | 20 ++++++++++++++++++ src/Makefile.am | 9 ++++++++- src/ag-chart.c | 28 ++++++++++++++++++++++++++ src/ag-chart.h | 38 +++++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 data/examples/saved-chart.xml create mode 100644 src/ag-chart.c create mode 100644 src/ag-chart.h diff --git a/data/examples/saved-chart.xml b/data/examples/saved-chart.xml new file mode 100644 index 0000000..2e612ea --- /dev/null +++ b/data/examples/saved-chart.xml @@ -0,0 +1,20 @@ + + + + Gergely Polonkai + + Hungary + Budapest + 47.49801 + 19.03991 + + + + diff --git a/src/Makefile.am b/src/Makefile.am index d19f7b2..94a30dc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,6 +11,13 @@ BUILT_SOURCES = \ ag-resources.c \ $(NULL) +astrognome_source_files = \ + ag-app.c \ + ag-window.c \ + ag-chart.c \ + astrognome.c \ + $(NULL) + EXTRA_DIST = \ $(resource_files) \ ag.gresource.xml \ @@ -19,7 +26,7 @@ EXTRA_DIST = \ AM_CPPFLAGS = -DG_LOG_DOMAIN=\"Astrognome\" -DLOCALEDIR=\"$(localedir)\" -DPKGDATADIR=\"$(pkgdatadir)\" bin_PROGRAMS = astrognome -astrognome_SOURCES = ag-app.c ag-window.c astrognome.c $(BUILT_SOURCES) +astrognome_SOURCES = $(astrognome_source_files) $(BUILT_SOURCES) astrognome_LDADD = $(SWE_GLIB_LIBS) $(GTK_LIBS) $(top_builddir)/libgd/libgd.la astrognome_LDFLAGS = -rdynamic astrognome_CFLAGS = $(SWE_GLIB_CFLAGS) $(CFLAGS) $(GTK_CFLAGS) -Wall -I$(top_srcdir)/libgd diff --git a/src/ag-chart.c b/src/ag-chart.c new file mode 100644 index 0000000..9a42b44 --- /dev/null +++ b/src/ag-chart.c @@ -0,0 +1,28 @@ +#include "ag-chart.h" + +struct _AgChartPrivate { + gchar *save_buffer; +}; + +G_DEFINE_TYPE(AgChart, ag_chart, GSWE_TYPE_MOMENT); + +#define GET_PRIVATE(instance) (G_TYPE_INSTANCE_GET_PRIVATE((instance), AG_TYPE_CHART, AgChartPrivate)) + +static void +ag_chart_class_init(AgChartClass *klass) +{ + g_type_class_add_private(klass, sizeof(AgChartPrivate)); +} + +static void +ag_chart_init(AgChart *chart) +{ + chart->priv = GET_PRIVATE(chart); +} + +AgChart * +ag_chart_new(void) +{ + return NULL; +} + diff --git a/src/ag-chart.h b/src/ag-chart.h new file mode 100644 index 0000000..4e4e38b --- /dev/null +++ b/src/ag-chart.h @@ -0,0 +1,38 @@ +#ifndef __AG_CHART_H__ +#define __AG_CHART_H__ + +#include +#include + +G_BEGIN_DECLS + +#define AG_TYPE_CHART (ag_chart_get_type()) +#define AG_CHART(o) (G_TYPE_CHECK_INSTANCE_CAST((o), AG_TYPE_CHART, AgChart)) +#define AG_CHART_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), AG_TYPE_CHART, AgChartClass)) +#define AG_IS_CHART(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), AG_TYPE_CHART)) +#define AG_IS_CHART_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), AG_TYPE_CHART)) +#define AG_CHART_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), AG_TYPE_CHART, AgChartClass)) + +typedef struct _AgChart AgChart; +typedef struct _AgChartClass AgChartClass; +typedef struct _AgChartPrivate AgChartPrivate; + +struct _AgChart { + GsweMoment parent_instance; + AgChartPrivate *priv; +}; + +struct _AgChartClass { + GsweMomentClass parent_class; +}; + +GType ag_chart_get_type(void) G_GNUC_CONST; +AgChart *ag_chart_new(void); + +void ag_chart_load_from_file(const gchar *path, GError **err); +void ag_chart_save_to_file(const gchar *path, GError **err); + +G_END_DECLS + +#endif /* __AG_CHART_H__ */ +