]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Make it possible to load multiple files at once.
authorNathan Samson <nathansamson@gmail.com>
Mon, 5 Sep 2011 19:23:38 +0000 (21:23 +0200)
committerNathan Samson <nathansamson@gmail.com>
Mon, 5 Sep 2011 20:15:14 +0000 (22:15 +0200)
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
main.c

diff --git a/main.c b/main.c
index 83794ca06697269dc65dbb758ce88408e611a9be..a0bc5b7b67a6a0eb7d75265ccf80b180751f10f6 100644 (file)
--- a/main.c
+++ b/main.c
@@ -96,12 +96,20 @@ static void file_open(GtkWidget *w, gpointer data)
                GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
                NULL);
+       gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE);
 
        if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
+               GSList *filenames;
                char *filename;
-               filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
-               parse_xml_file(filename);
-               g_free(filename);
+               filenames = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog));
+               
+               while(filenames != NULL) {
+                       filename = (char *)filenames->data;
+                       parse_xml_file(filename);
+                       g_free(filename);
+                       filenames = g_slist_next(filenames);
+               }
+               g_slist_free(filenames);
                report_dives();
                dive_list_update_dives(dive_list);
        }