aboutsummaryrefslogtreecommitdiff
path: root/libstorycode/presentation.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.me.uk>2019-02-26 21:21:36 +0100
committerThomas White <taw@bitwiz.me.uk>2019-02-26 21:21:36 +0100
commit4904182915c1a02c8ac6fb26397cb12e0aab51b9 (patch)
treea84cf5506c2ddd7426d23008dd47379c2f8da5bf /libstorycode/presentation.c
parent237f336f9bb0d2d34784612d59cf1622a9edd952 (diff)
Skeleton of main program
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);