aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2016-09-21 08:50:59 +0200
committerThomas White <taw@bitwiz.org.uk>2016-09-21 08:50:59 +0200
commit9eae3e61d9bae7d2b650c3dc91aece65163330fc (patch)
treed05ff320ab2fe3d45e030c034b409b96bc2fba00
parent205c1640a1a7023c1f95f1dd1ac4b60456e5bc1b (diff)
Open the demo document on first run
-rw-r--r--Makefile.am2
-rw-r--r--data/demo.sc3
-rw-r--r--src/colloquium.c45
-rw-r--r--src/colloquium.h3
4 files changed, 44 insertions, 9 deletions
diff --git a/Makefile.am b/Makefile.am
index 8a8566e..b7773a3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,7 +29,7 @@ src/default_stylesheet.o: src/default_stylesheet.sty
ld -r -b binary -o src/default_stylesheet.o src/default_stylesheet.sty
colloquiumdir = $(datadir)/colloquium
-colloquium_DATA = data/sky.png data/canvas.png
+colloquium_DATA = data/sky.png data/canvas.png data/demo.sc
EXTRA_DIST += $(colloquium_DATA)
iconsdir = $(datadir)/icons/hicolor/scalable/apps
diff --git a/data/demo.sc b/data/demo.sc
index ee74ed8..aa0a67c 100644
--- a/data/demo.sc
+++ b/data/demo.sc
@@ -29,7 +29,8 @@ To edit a slide, simply double-click on it. Try it on this next slide:
\f[425.5ux85.0u+456.3+513.9]{Close this window when you've finished editing...}\f[915.5ux78.1u+58.0+126.6]{Editing slides works how you expect it to. Add a new text frame by dragging from an empty area. Then simply type into the new frame.}\f[454.3ux139.3u+142.6+295.8]{Click and drag frames to move them, and change their shape and size by dragging the handles at the corners.}\f[0.0ux1.0u+809.1+430.0]{}}
You can add a new slide from the "Insert" menu or using the toolbar at the top of the narrative window. Try it now! Click to place the cursor at the end of this paragraph, then add a new slide.
What is the narrative window for? Well, it's up to you! Here are some suggestions:
-\bp{}Plan your entire presentation word for word. Use it just to help plan a smooth flow for your talk, or even read it out word for word. Deliver your talk precisely as you planned it, no matter how nervous you get.
+\bp{}Use it just to help plan a smooth flow for your talk, reading it through to spot awkward transitions.
+\bp{}Write your talk word for word and read it out like a politician. Deliver your talk precisely as you planned it, no matter how nervous you get.
\bp{}Write bullet-pointed notes to structure your talk.
\bp{}Create a written version of your talk to print out and give to your audience as a handout.
Besides this, Colloquium has some features which will help you when you come to give your presentation. In the "Tools" menu, you'll find the presentation clock and the test card.
diff --git a/src/colloquium.c b/src/colloquium.c
index 6b71954..b3a675e 100644
--- a/src/colloquium.c
+++ b/src/colloquium.c
@@ -27,6 +27,10 @@
#include <gtk/gtk.h>
#include <getopt.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <glib.h>
+#include <glib/gstdio.h>
#include "colloquium.h"
#include "presentation.h"
@@ -36,6 +40,8 @@
struct _colloquium
{
GtkApplication parent_instance;
+ char *mydir;
+ int first_run;
};
@@ -45,11 +51,14 @@ typedef GtkApplicationClass ColloquiumClass;
G_DEFINE_TYPE(Colloquium, colloquium, GTK_TYPE_APPLICATION)
-static void colloquium_activate(GApplication *app)
+static void colloquium_activate(GApplication *papp)
{
- struct presentation *p;
- p = new_presentation();
- narrative_window_new(p, app);
+ Colloquium *app = COLLOQUIUM(papp);
+ if ( !app->first_run ) {
+ struct presentation *p;
+ p = new_presentation();
+ narrative_window_new(p, papp);
+ }
}
@@ -132,11 +141,13 @@ static void colloquium_finalize(GObject *object)
}
-static void colloquium_startup(GApplication *app)
+static void colloquium_startup(GApplication *papp)
{
+ Colloquium *app = COLLOQUIUM(papp);
GtkBuilder *builder;
+ const char *configdir;
- G_APPLICATION_CLASS(colloquium_parent_class)->startup(app);
+ G_APPLICATION_CLASS(colloquium_parent_class)->startup(papp);
g_action_map_add_action_entries(G_ACTION_MAP(app), app_entries,
G_N_ELEMENTS(app_entries), app);
@@ -290,8 +301,25 @@ static void colloquium_startup(GApplication *app)
G_MENU_MODEL(gtk_builder_get_object(builder, "app-menu")));
gtk_application_set_menubar(GTK_APPLICATION(app),
G_MENU_MODEL(gtk_builder_get_object(builder, "menubar")));
-
g_object_unref(builder);
+
+ configdir = g_get_user_config_dir();
+ app->mydir = malloc(strlen(configdir+14));
+ strcpy(app->mydir, configdir);
+ strcat(app->mydir, "/colloquium");
+
+ if ( !g_file_test(app->mydir, G_FILE_TEST_IS_DIR) ) {
+
+ /* Folder not created yet */
+ GFile *file = g_file_new_for_path(DATADIR"/colloquium/demo.sc");
+ g_application_open(G_APPLICATION(app), &file, 1, "");
+ app->first_run = 1;
+ g_object_unref(file);
+
+ if ( g_mkdir(app->mydir, S_IRUSR | S_IWUSR | S_IXUSR) ) {
+ fprintf(stderr, "Failed to create folder\n");
+ }
+ }
}
@@ -330,6 +358,9 @@ static Colloquium *colloquium_new()
"flags", G_APPLICATION_HANDLES_OPEN,
"register-session", TRUE,
NULL);
+
+ app->first_run = 0; /* Will be updated at "startup" if appropriate */
+
return app;
}
diff --git a/src/colloquium.h b/src/colloquium.h
index b927728..a9b9245 100644
--- a/src/colloquium.h
+++ b/src/colloquium.h
@@ -32,5 +32,8 @@
typedef struct _colloquium Colloquium;
+#define COLLOQUIUM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GTK_TYPE_APPLICATION, Colloquium))
+
#endif /* COLLOQUIUM_H */