diff options
author | Thomas White <taw@bitwiz.org.uk> | 2016-06-11 23:07:27 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2016-07-04 21:16:27 +0200 |
commit | f2d8a677bc509b05c1ec07a990e497a20db51695 (patch) | |
tree | 3b7cde386cdbed787332c61d9892f88f5b7ba847 | |
parent | 0a5dcb945a9021a417b157fc0daaf0271a76fabf (diff) |
Implement slide deletion
-rw-r--r-- | src/colloquium.c | 4 | ||||
-rw-r--r-- | src/narrative_window.c | 21 |
2 files changed, 22 insertions, 3 deletions
diff --git a/src/colloquium.c b/src/colloquium.c index 436ac86..93f3229 100644 --- a/src/colloquium.c +++ b/src/colloquium.c @@ -242,6 +242,10 @@ static void colloquium_startup(GApplication *app) " <attribute name='label'>Delete frame</attribute>" " <attribute name='action'>win.deleteframe</attribute>" " </item>" + " <item>" + " <attribute name='label'>Delete slide</attribute>" + " <attribute name='action'>win.deleteslide</attribute>" + " </item>" " </section>" " <section>" " <item>" diff --git a/src/narrative_window.c b/src/narrative_window.c index 1c8fc14..5b32c36 100644 --- a/src/narrative_window.c +++ b/src/narrative_window.c @@ -140,9 +140,24 @@ static void open_slidesorter_sig(GSimpleAction *action, GVariant *parameter, } -static void delete_frame_sig(GSimpleAction *action, GVariant *parameter, - gpointer vp) +static void delete_slide_sig(GSimpleAction *action, GVariant *parameter, + gpointer vp) { + SCBlock *ns; + NarrativeWindow *nw = vp; + + /* Get the SCBlock corresponding to the slide */ + ns = sc_editor_get_cursor_bvp(nw->sceditor); + if ( ns == NULL ) { + fprintf(stderr, "Not a slide!\n"); + return; + } + + sc_block_delete(nw->p->scblocks, ns); + + /* Full rerender */ + sc_editor_set_scblock(nw->sceditor, + sc_editor_get_scblock(nw->sceditor)); } @@ -466,7 +481,7 @@ GActionEntry nw_entries[] = { { "save", save_sig, NULL, NULL, NULL }, { "saveas", saveas_sig, NULL, NULL, NULL }, { "sorter", open_slidesorter_sig, NULL, NULL, NULL }, - { "deleteframe", delete_frame_sig, NULL, NULL, NULL }, + { "deleteslide", delete_slide_sig, NULL, NULL, NULL }, { "slide", add_slide_sig, NULL, NULL, NULL }, { "startslideshow", start_slideshow_sig, NULL, NULL, NULL }, { "notes", open_notes_sig, NULL, NULL, NULL }, |