From 6ac2b9d58e9105e4e2ab9736d34e7979dffecc6d Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 1 Apr 2018 13:18:38 +0200 Subject: Add menu item to show introductory doc --- src/colloquium.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/colloquium.c b/src/colloquium.c index 26c45f3..f1d754c 100644 --- a/src/colloquium.c +++ b/src/colloquium.c @@ -73,6 +73,21 @@ static void new_sig(GSimpleAction *action, GVariant *parameter, gpointer vp) } +static void open_intro_doc(Colloquium *app) +{ + GFile *file = g_file_new_for_uri("resource:///uk/me/bitwiz/Colloquium/demo.sc"); + g_application_open(G_APPLICATION(app), &file, 1, ""); + g_object_unref(file); +} + + +static void intro_sig(GSimpleAction *action, GVariant *parameter, gpointer vp) +{ + GApplication *app = vp; + open_intro_doc(COLLOQUIUM(app)); +} + + static void about_sig(GSimpleAction *action, GVariant *parameter, gpointer vp) { GtkWidget *window; @@ -208,6 +223,7 @@ GActionEntry app_entries[] = { { "new", new_sig, NULL, NULL, NULL }, { "open", open_sig, NULL, NULL, NULL }, { "about", about_sig, NULL, NULL, NULL }, + { "intro", intro_sig, NULL, NULL, NULL }, { "quit", quit_sig, NULL, NULL, NULL }, }; @@ -351,10 +367,8 @@ static void colloquium_startup(GApplication *papp) if ( !g_file_test(app->mydir, G_FILE_TEST_IS_DIR) ) { /* Folder not created yet */ - GFile *file = g_file_new_for_uri("resource:///uk/me/bitwiz/Colloquium/demo.sc"); - g_application_open(G_APPLICATION(app), &file, 1, ""); + open_intro_doc(app); 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"); -- cgit v1.2.3