aboutsummaryrefslogtreecommitdiff
path: root/libstorycode/presentation.c
diff options
context:
space:
mode:
Diffstat (limited to 'libstorycode/presentation.c')
-rw-r--r--libstorycode/presentation.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/libstorycode/presentation.c b/libstorycode/presentation.c
index 6a4d019..6eb7a50 100644
--- a/libstorycode/presentation.c
+++ b/libstorycode/presentation.c
@@ -29,11 +29,14 @@
#include <string.h>
#include <assert.h>
#include <stdio.h>
+#include <gio/gio.h>
#include "presentation.h"
#include "stylesheet.h"
#include "slide.h"
#include "narrative.h"
+#include "imagestore.h"
+#include "storycode.h"
struct _presentation
{
@@ -59,6 +62,35 @@ Presentation *presentation_new()
}
+Presentation *presentation_load(GFile *file)
+{
+ GBytes *bytes;
+ const char *text;
+ size_t len;
+ Presentation *p;
+ ImageStore *is;
+
+ bytes = g_file_load_bytes(file, NULL, NULL, NULL);
+ if ( bytes == NULL ) return NULL;
+
+ text = g_bytes_get_data(bytes, &len);
+ p = storycode_parse_presentation(text);
+ g_bytes_unref(bytes);
+ if ( p == NULL ) return NULL;
+
+ is = imagestore_new(".");
+ imagestore_set_parent(is, g_file_get_parent(file));
+ return p;
+}
+
+
+int presentation_save(Presentation *p, GFile *file)
+{
+ /* FIXME: Implementation */
+ return 1;
+}
+
+
void presentation_free(Presentation *p)
{
free(p);