diff options
-rw-r--r-- | dive.h | 1 | ||||
-rw-r--r-- | gtk-gui.c | 8 | ||||
-rw-r--r-- | parse-xml.c | 4 |
3 files changed, 12 insertions, 1 deletions
@@ -195,6 +195,7 @@ static inline struct dive *get_dive(unsigned int nr) extern void parse_xml_init(void); extern void parse_xml_file(const char *filename, GError **error); +extern void set_filename(const char *filename); extern void show_dive_info(struct dive *); extern void flush_dive_info_changes(struct dive *); @@ -651,3 +651,11 @@ void update_progressbar(progressbar_t *progress, double value) { gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress->bar), value); } + + +void set_filename(const char *filename) +{ + if (filename) + existing_filename = strdup(filename); + return; +} diff --git a/parse-xml.c b/parse-xml.c index 22ab8458e..1eb6e95fd 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -1380,7 +1380,9 @@ void parse_xml_file(const char *filename, GError **error) } return; } - + /* we assume that the last (or only) filename passed as argument is a + * great filename to use as default when saving the dives */ + set_filename(filename); reset_all(); dive_start(); traverse(xmlDocGetRootElement(doc)); |