aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/colloquium.c4
-rw-r--r--src/narrative_window.c16
-rw-r--r--src/presentation.c2
-rw-r--r--src/sc_editor.c6
-rw-r--r--src/sc_parse.c1
5 files changed, 28 insertions, 1 deletions
diff --git a/src/colloquium.c b/src/colloquium.c
index ab3aa1a..52c831a 100644
--- a/src/colloquium.c
+++ b/src/colloquium.c
@@ -47,7 +47,9 @@ G_DEFINE_TYPE(Colloquium, colloquium, GTK_TYPE_APPLICATION)
static void colloquium_activate(GApplication *app)
{
- printf("activate!\n");
+ struct presentation *p;
+ p = new_presentation();
+ narrative_window_new(p, app);
}
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;
}
diff --git a/src/presentation.c b/src/presentation.c
index 816f854..2d8efa6 100644
--- a/src/presentation.c
+++ b/src/presentation.c
@@ -109,6 +109,8 @@ struct presentation *new_presentation()
new->filename = NULL;
new->titlebar = get_titlebar_string(new);
+ new->scblocks = NULL;
+
new->slide_width = 1024.0;
new->slide_height = 768.0;
diff --git a/src/sc_editor.c b/src/sc_editor.c
index 625067f..251b154 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -814,6 +814,12 @@ static void check_paragraph(struct frame *fr, PangoContext *pc,
if ( fr->n_paras > 0 ) return;
Paragraph *para = last_open_para(fr);
+ if ( scblocks == NULL ) {
+ /* We have no SCBlocks at all! Better create one... */
+ scblocks = sc_parse("");
+ fr->scblocks = scblocks;
+ }
+
/* We are creating the first paragraph. It uses the last SCBlock
* in the chain */
while ( sc_block_next(scblocks) != NULL ) {
diff --git a/src/sc_parse.c b/src/sc_parse.c
index c8eea6f..8265a13 100644
--- a/src/sc_parse.c
+++ b/src/sc_parse.c
@@ -296,6 +296,7 @@ static void recursive_show_sc_blocks(const char *prefix, const SCBlock *bl)
void show_sc_block(const SCBlock *bl, const char *prefix)
{
printf("%s (%p) ", prefix, bl);
+ if ( bl == NULL ) return;
if ( bl->name != NULL ) printf("\\%s ", bl->name);
if ( bl->options != NULL ) printf("[%s] ", bl->options);
if ( bl->contents != NULL ) printf("{%s} ", bl->contents);