diff options
-rw-r--r-- | data/app-menu.ui | 4 | ||||
-rw-r--r-- | data/menu-bar.ui | 4 | ||||
-rw-r--r-- | src/colloquium.c | 20 |
3 files changed, 25 insertions, 3 deletions
diff --git a/data/app-menu.ui b/data/app-menu.ui index 33165ac..e948aae 100644 --- a/data/app-menu.ui +++ b/data/app-menu.ui @@ -23,6 +23,10 @@ <attribute name='action'>app.about</attribute> </item> <item> + <attribute name='label'>Basic introduction</attribute> + <attribute name='action'>app.intro</attribute> + </item> + <item> <attribute name='label'>_Quit</attribute> <attribute name='action'>app.quit</attribute> <attribute name='accel'><Primary>q</attribute> diff --git a/data/menu-bar.ui b/data/menu-bar.ui index d5f164f..175868b 100644 --- a/data/menu-bar.ui +++ b/data/menu-bar.ui @@ -157,6 +157,10 @@ <attribute name='label'>About</attribute> <attribute name='action'>app.about</attribute> </item> + <item> + <attribute name='label'>Basic introduction</attribute> + <attribute name='action'>app.intro</attribute> + </item> </section> </submenu> 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"); |