Browse files

Use the last (or only) filename on command line as default for saving

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
  • Loading branch information...
1 parent 8a8ad3f commit a817f4b547b4193d31154fd0ff7f5190ccae76a5 @dirkhh dirkhh committed Sep 21, 2011
Showing with 12 additions and 1 deletion.
  1. +1 −0 dive.h
  2. +8 −0 gtk-gui.c
  3. +3 −1 parse-xml.c
View
1 dive.h
@@ -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 *);
View
8 gtk-gui.c
@@ -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;
+}
View
4 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));

0 comments on commit a817f4b

Please sign in to comment.