]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Use the last (or only) filename on command line as default for saving
authorDirk Hohndel <dirk@hohndel.org>
Wed, 21 Sep 2011 04:50:26 +0000 (21:50 -0700)
committerDirk Hohndel <dirk@hohndel.org>
Wed, 21 Sep 2011 18:35:20 +0000 (11:35 -0700)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
dive.h
gtk-gui.c
parse-xml.c

diff --git a/dive.h b/dive.h
index 85fdabf5d5f2d8ecda15f6c279022467693c649a..9cdfd61b0b77b290d6041e1187378b1284f6f918 100644 (file)
--- a/dive.h
+++ b/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 *);
index 1a3838e67f59ccdbe10fa612f4c02d949266c09e..3994387acdf5f42f632451152e48b42671c4dde0 100644 (file)
--- a/gtk-gui.c
+++ b/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;
+}
index 22ab8458e1f5871d932d4d5666c5df7ccc1a94dc..1eb6e95fdd1007aff73d326c7d6b073c7fe36f36 100644 (file)
@@ -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));