aboutsummaryrefslogtreecommitdiff
path: root/src/narrative_window.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2016-04-24 13:49:44 +0200
committerThomas White <taw@bitwiz.org.uk>2016-04-24 13:49:44 +0200
commitd8aca50e2ba6bfec052da5ab406899fa00fb607e (patch)
treec0ceb602ac1324b7b5430746b368d19e423c7a42 /src/narrative_window.c
parentf48bebb3c4ad6941941ec889ce8b1c5f15c9a1c1 (diff)
Fixes for creating a new presentation
Diffstat (limited to 'src/narrative_window.c')
-rw-r--r--src/narrative_window.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/narrative_window.c b/src/narrative_window.c
index 2c79185..6d4d21a 100644
--- a/src/narrative_window.c
+++ b/src/narrative_window.c
@@ -345,6 +345,13 @@ static void scroll_down(NarrativeWindow *nw)
}
+static gboolean destroy_sig(GtkWidget *da, NarrativeWindow *nw)
+{
+ g_application_release(nw->app);
+ return FALSE;
+}
+
+
static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event,
NarrativeWindow *nw)
{
@@ -489,6 +496,11 @@ NarrativeWindow *narrative_window_new(struct presentation *p, GApplication *app)
stylesheets[0] = narrative_stylesheet();
stylesheets[1] = NULL;
}
+
+ if ( nw->p->scblocks == NULL ) {
+ nw->p->scblocks = sc_parse("");
+ }
+
nw->sceditor = sc_editor_new(nw->p->scblocks, stylesheets, p->lang);
cbl = sc_callback_list_new();
sc_callback_list_add_callback(cbl, "sthumb", create_thumbnail,
@@ -567,11 +579,15 @@ NarrativeWindow *narrative_window_new(struct presentation *p, GApplication *app)
G_CALLBACK(button_press_sig), nw);
g_signal_connect(G_OBJECT(nw->sceditor), "key-press-event",
G_CALLBACK(key_press_sig), nw);
+ g_signal_connect(G_OBJECT(nw->window), "destroy",
+ G_CALLBACK(destroy_sig), nw);
gtk_window_set_default_size(GTK_WINDOW(nw->window), 768, 768);
gtk_box_pack_start(GTK_BOX(vbox), scroll, TRUE, TRUE, 0);
gtk_widget_show_all(nw->window);
+ nw->app = app;
+ g_application_hold(app);
return nw;
}