diff options
author | Thomas White <taw@bitwiz.org.uk> | 2013-09-17 09:59:01 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2013-09-17 09:59:01 +0200 |
commit | 057871cbe90d434f9462213f929054302f8da3ab (patch) | |
tree | c331931a33ab5b2e866153010fdb87b1ab5df1a0 /src/notes.c | |
parent | 855fc984c58350c8e4214fd611c78ea00579f3cb (diff) |
Simplify notes a bit
Diffstat (limited to 'src/notes.c')
-rw-r--r-- | src/notes.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/notes.c b/src/notes.c index f5d9408..650c401 100644 --- a/src/notes.c +++ b/src/notes.c @@ -37,6 +37,8 @@ struct notes { GtkWidget *window; GtkWidget *v; + + struct slide *slide; }; @@ -57,11 +59,12 @@ static void update_notes(struct presentation *p) } -static void grab_notes(struct notes *n, struct slide *s) +void grab_current_notes(struct presentation *p) { gchar *text; GtkTextBuffer *tb; GtkTextIter i1, i2; + struct notes *n = p->notes; if ( n == NULL ) return; @@ -70,28 +73,22 @@ static void grab_notes(struct notes *n, struct slide *s) gtk_text_buffer_get_end_iter(tb, &i2); text = gtk_text_buffer_get_text(tb, &i1, &i2, TRUE); - free(s->notes); - s->notes = text; -} - - -void grab_current_notes(struct presentation *p) -{ - grab_notes(p->notes, p->cur_notes_slide); + free(n->slide->notes); + n->slide->notes = text; } void notify_notes_slide_changed(struct presentation *p, struct slide *np) { - grab_notes(p->notes, p->cur_notes_slide); - p->cur_notes_slide = np; + grab_current_notes(p); + p->notes->slide = np; update_notes(p); } static gint close_notes_sig(GtkWidget *w, struct presentation *p) { - grab_notes(p->notes, p->cur_notes_slide); + grab_current_notes(p); p->notes = NULL; return FALSE; } @@ -125,7 +122,7 @@ void open_notes(struct presentation *p) if ( n == NULL ) return; p->notes = n; - p->cur_notes_slide = p->cur_edit_slide; + p->notes->slide = p->cur_edit_slide; n->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(n->window), 800, 256); |