From a6a8a827ff3c6133f229b0c444b42d4e690fef76 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 2 Mar 2017 22:41:55 +0100 Subject: Substitute style sheet when there was no stylesheet before --- src/narrative_window.c | 6 +++--- src/presentation.c | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/narrative_window.c b/src/narrative_window.c index d53002a..73b9677 100644 --- a/src/narrative_window.c +++ b/src/narrative_window.c @@ -273,14 +273,14 @@ static gint load_ss_response_sig(GtkWidget *d, gint response, SCBlock **stylesheets; + /* Substitute the style sheet */ + replace_stylesheet(nw->p, ss); + stylesheets = get_ss_list(nw->p); sc_editor_set_stylesheets(nw->sceditor, stylesheets); free(stylesheets); - /* Substitute the style sheet */ - replace_stylesheet(nw->p, ss); - /* Full rerender, first block may have * changed */ sc_editor_set_scblock(nw->sceditor, diff --git a/src/presentation.c b/src/presentation.c index 55219e2..efdf694 100644 --- a/src/presentation.c +++ b/src/presentation.c @@ -360,6 +360,12 @@ int replace_stylesheet(struct presentation *p, SCBlock *ss) /* Create style sheet from union of old and new, * preferring items from the new one */ + /* If there was no stylesheet before, add a dummy one */ + if ( p->stylesheet == NULL ) { + p->stylesheet = sc_block_append_end(p->scblocks, + "stylesheet", NULL, NULL); + } + /* Cut the old stylesheet out of the presentation, * and put in the new one */ sc_block_substitute(&p->scblocks, p->stylesheet, ss); -- cgit v1.2.3