summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2011-10-03 08:27:36 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2011-10-03 08:34:56 -0700
commitc15f798a85db53dae404a9113266a4d2bc72fbc6 (patch)
tree366ec7354c48324e76b6f58593e03bd039fc78c3 /gtk-gui.c
parent254b851e44a31e2028a2fdddfb4f6989a8e59374 (diff)
downloadsubsurface-c15f798a85db53dae404a9113266a4d2bc72fbc6.tar.gz
Remove the ability to 'Import' .SDA files
We can instead 'Open' these files as they are just bastardized XML files. This gets us back to a more consistent point where 'Import' gets data directly from the dive computer (and hopefully soon we will add the ability to load a dive directly from a uemis SDA to libdivecomputer), and 'Open' loads a file from the filesystem of the computer we are running on (this last sentence phrased so awkwardly as the uemis Zurich SDA is a computer and presents a file system when connected via USB - it just doesn't have the dive data in an accessible format in that file system). As a bonus we get to throw away quite a bit of code (the uemis specific file handling, mini-XML parser with helper functions, the file open dialog in the importer). Yay! Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c42
1 files changed, 2 insertions, 40 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 87cd8bf87..002b80414 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -103,6 +103,8 @@ static void file_open(GtkWidget *w, gpointer data)
filter = gtk_file_filter_new();
gtk_file_filter_add_pattern(filter, "*.xml");
gtk_file_filter_add_pattern(filter, "*.XML");
+ gtk_file_filter_add_pattern(filter, "*.sda");
+ gtk_file_filter_add_pattern(filter, "*.SDA");
gtk_file_filter_add_mime_type(filter, "text/xml");
gtk_file_filter_set_name(filter, "XML file");
gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);
@@ -632,46 +634,6 @@ void run_ui(void)
gtk_main();
}
-/* get the filenames the user selects and call the parsing function
- * on them
- * return 0 if the user cancelled the dialog
- */
-int open_import_file_dialog(char *filterpattern, char *filtertext,
- void(* parse_function)(char *))
-{
- int ret=0;
-
- GtkWidget *dialog;
- GtkFileFilter *filter = gtk_file_filter_new ();
- gtk_file_filter_add_pattern (filter, filterpattern);
- gtk_file_filter_set_name(filter, filtertext);
- dialog = gtk_file_chooser_dialog_new("Open File",
- GTK_WINDOW(main_window),
- GTK_FILE_CHOOSER_ACTION_OPEN,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
- NULL);
- gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE);
- gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter);
-
- if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
- GSList *filenames;
- char *filename;
- filenames = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog));
- while(filenames != NULL) {
- filename = (char *)filenames->data;
- parse_function(filename);
- g_free(filename);
- filenames = g_slist_next(filenames);
- }
- g_slist_free(filenames);
- ret = 1;
- }
- gtk_widget_destroy(dialog);
-
- return ret;
-}
-
static gboolean expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
struct dive *dive = current_dive;