]> git.street.me.uk Git - andy/viking.git/blobdiff - src/datasource_url.c
Trap some errors reported by gpsbabel
[andy/viking.git] / src / datasource_url.c
index 4d66773361af4348efc6de7651e2f674828561f5..c5c548f5efc822b531cce42435770213f396dfe1 100644 (file)
@@ -25,6 +25,7 @@
 #include "viking.h"
 #include "acquire.h"
 #include "babel.h"
+#include "ui_util.h"
 
 // Initially was just going to be a URL and always in GPX format
 // But might as well specify the file type as per datasource_file.c
@@ -40,7 +41,7 @@ static int last_type = -1;
 
 static gpointer datasource_url_init ( acq_vik_t *avt );
 static void datasource_url_add_setup_widgets ( GtkWidget *dialog, VikViewport *vvp, gpointer user_data );
-static void datasource_url_get_process_options ( datasource_url_widgets_t *widgets, ProcessOptions *po, DownloadMapOptions *download_options, const gchar *not_used2, const gchar *not_used3 );
+static void datasource_url_get_process_options ( datasource_url_widgets_t *widgets, ProcessOptions *po, DownloadFileOptions *download_options, const gchar *not_used2, const gchar *not_used3 );
 static void datasource_url_cleanup ( gpointer data );
 
 VikDataSourceInterface vik_datasource_url_interface = {
@@ -98,7 +99,9 @@ static void datasource_url_add_setup_widgets ( GtkWidget *dialog, VikViewport *v
 {
        datasource_url_widgets_t *widgets = (datasource_url_widgets_t *)user_data;
        GtkWidget *label = gtk_label_new (_("URL:"));
-       widgets->url = gtk_entry_new ( );
+       widgets->url = ui_entry_new ( NULL, GTK_ENTRY_ICON_SECONDARY );
+       // 'ok' when press return in the entry
+       g_signal_connect_swapped ( widgets->url, "activate", G_CALLBACK(a_dialog_response_accept), dialog );
 
        GtkWidget *type_label = gtk_label_new (_("File type:"));
 
@@ -139,7 +142,7 @@ static void datasource_url_add_setup_widgets ( GtkWidget *dialog, VikViewport *v
        gtk_widget_show_all(dialog);
 }
 
-static void datasource_url_get_process_options ( datasource_url_widgets_t *widgets, ProcessOptions *po, DownloadMapOptions *download_options, const gchar *not_used2, const gchar *not_used3 )
+static void datasource_url_get_process_options ( datasource_url_widgets_t *widgets, ProcessOptions *po, DownloadFileOptions *download_options, const gchar *not_used2, const gchar *not_used3 )
 {
        // Retrieve the user entered value
        const gchar *value = gtk_entry_get_text ( GTK_ENTRY(widgets->url) );
@@ -152,7 +155,10 @@ static void datasource_url_get_process_options ( datasource_url_widgets_t *widge
                po->input_file_type = g_strdup ( ((BabelFile*)g_list_nth_data (a_babel_file_list, last_type))->name );
 
        po->url = g_strdup ( value );
-       download_options = NULL;
+
+       // Support .zip + bzip2 files directly
+       download_options->convert_file = a_try_decompress_file;
+       download_options->follow_location = 5;
 }
 
 static void datasource_url_cleanup ( gpointer data )