aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2013-09-17 09:59:01 +0200
committerThomas White <taw@bitwiz.org.uk>2013-09-17 09:59:01 +0200
commit057871cbe90d434f9462213f929054302f8da3ab (patch)
treec331931a33ab5b2e866153010fdb87b1ab5df1a0 /src
parent855fc984c58350c8e4214fd611c78ea00579f3cb (diff)
Simplify notes a bit
Diffstat (limited to 'src')
-rw-r--r--src/notes.c23
-rw-r--r--src/presentation.h1
2 files changed, 10 insertions, 14 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);
diff --git a/src/presentation.h b/src/presentation.h
index 84c79b0..ff065a6 100644
--- a/src/presentation.h
+++ b/src/presentation.h
@@ -131,7 +131,6 @@ struct presentation
/* Pointers to the current "editing" and "projection" slides */
struct slide *cur_edit_slide;
struct slide *cur_proj_slide;
- struct slide *cur_notes_slide;
int slideshow_linked;
/* Pointers to the frame currently being edited */