summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorGravatar Nathan Samson <nathansamson@gmail.com>2011-09-05 21:23:38 +0200
committerGravatar Nathan Samson <nathansamson@gmail.com>2011-09-05 22:15:14 +0200
commit65ef1bae20e9c908745115d0d82b7232dc5d1b26 (patch)
treee10191b11e40090a87e661c31ee0e4c515f2a9a6 /main.c
parent21204926dfda996c47b4d638e30fb0b1f9968c63 (diff)
downloadsubsurface-65ef1bae20e9c908745115d0d82b7232dc5d1b26.tar.gz
Make it possible to load multiple files at once.
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/main.c b/main.c
index 83794ca06..a0bc5b7b6 100644
--- 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);
}