Started implementing load/save functionality
This commit is contained in:
		
							
								
								
									
										20
									
								
								data/examples/saved-chart.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								data/examples/saved-chart.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<chartinfo>
 | 
			
		||||
    <data>
 | 
			
		||||
        <name>Gergely Polonkai</name>
 | 
			
		||||
        <place>
 | 
			
		||||
            <country>Hungary</country>
 | 
			
		||||
            <city>Budapest</city>
 | 
			
		||||
            <longitude>47.49801</longitude>
 | 
			
		||||
            <latitude>19.03991</latitude>
 | 
			
		||||
        </place>
 | 
			
		||||
        <time>
 | 
			
		||||
            <year>1983</year>
 | 
			
		||||
            <month>3</month>
 | 
			
		||||
            <day>7</day>
 | 
			
		||||
            <hour>11</hour>
 | 
			
		||||
            <minute>54</minute>
 | 
			
		||||
            <second>45</second>
 | 
			
		||||
        </time>
 | 
			
		||||
    </data>
 | 
			
		||||
</chartinfo>
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										28
									
								
								src/ag-chart.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								src/ag-chart.c
									
									
									
									
									
										Normal file
									
								
							@@ -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										38
									
								
								src/ag-chart.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								src/ag-chart.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
#ifndef __AG_CHART_H__
 | 
			
		||||
#define __AG_CHART_H__
 | 
			
		||||
 | 
			
		||||
#include <glib-object.h>
 | 
			
		||||
#include <swe-glib.h>
 | 
			
		||||
 | 
			
		||||
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__ */
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user