+/* Structure for DEM data used in background thread */
+typedef struct {
+ VikDEMLayer *vdl;
+} dem_load_thread_data;
+
+/*
+ * Function for starting the DEM file loading as a background thread
+ */
+static int dem_layer_load_list_thread ( dem_load_thread_data *dltd, gpointer threaddata )
+{
+ int result = 0; // Default to good
+ // Actual Load
+ if ( a_dems_load_list ( &(dltd->vdl->files), threaddata ) ) {
+ // Thread cancelled
+ result = -1;
+ }
+
+ // ATM as each file is processed the screen is not updated (no mechanism exposed to a_dems_load_list)
+ // Thus force draw only at the end, as loading is complete/aborted
+ //gdk_threads_enter();
+ // Test is helpful to prevent Gtk-CRITICAL warnings if the program is exitted whilst loading
+ if ( IS_VIK_LAYER(dltd->vdl) )
+ vik_layer_emit_update ( VIK_LAYER(dltd->vdl), TRUE ); // Yes update from background thread
+ //gdk_threads_leave();
+
+ return result;
+}
+
+static void dem_layer_thread_data_free ( dem_load_thread_data *data )
+{
+ // Simple release
+ g_free ( data );
+}
+
+static void dem_layer_thread_cancel ( dem_load_thread_data *data )
+{
+ // Abort loading
+ // Instead of freeing the list, leave it as partially processed
+ // Thus we can see/use what was done
+}
+