aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-05-30 15:47:40 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-05-30 15:56:44 +0200
commitf5fac5463a010e384bcfd29dc7e55895b1afdeff (patch)
treedb717811c0bc763aacc839d9431ec0f56d742a8a
parenta8d412c7be67532d1c9ce18f538eb8e5fa5ac12e (diff)
downloadexperiment-player-f5fac5463a010e384bcfd29dc7e55895b1afdeff.tar.gz
allow empty filename when loading a format file into the transcript widget
this resets any active formats
-rw-r--r--lib/gtk-experiment-widgets/gtk-experiment-transcript-formats.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/gtk-experiment-widgets/gtk-experiment-transcript-formats.c b/lib/gtk-experiment-widgets/gtk-experiment-transcript-formats.c
index 2c6c22d..2bbe761 100644
--- a/lib/gtk-experiment-widgets/gtk-experiment-transcript-formats.c
+++ b/lib/gtk-experiment-widgets/gtk-experiment-transcript-formats.c
@@ -139,12 +139,15 @@ gtk_experiment_transcript_load_formats(GtkExperimentTranscript *trans,
FILE *file;
gchar buf[255];
- if ((file = g_fopen(filename, "r")) == NULL)
- return TRUE;
-
gtk_experiment_transcript_free_formats(trans->priv->formats);
trans->priv->formats = NULL;
+ if (filename == NULL || !*filename)
+ goto redraw;
+
+ if ((file = g_fopen(filename, "r")) == NULL)
+ return TRUE;
+
while (fgets((char *)buf, sizeof(buf)-1, file) != NULL) {
GtkExperimentTranscriptFormat *fmt;
@@ -171,6 +174,7 @@ gtk_experiment_transcript_load_formats(GtkExperimentTranscript *trans,
fclose(file);
+redraw:
gtk_experiment_transcript_text_layer_redraw(trans);
return FALSE;
}