+ return NULL;
+}
+
+static void *pthread_wrapper(void *_data)
+{
+ device_data_t *data = _data;
+ const char *err_string = do_libdivecomputer_import(data);
+ import_thread_done = 1;
+ return (void *)err_string;
+}
+
+static void do_import(device_data_t *data)
+{
+ pthread_t pthread;
+ void *retval;
+
+ if (data->type == DEVICE_TYPE_UEMIS)
+ return uemis_import();
+
+ /* I'm sure there is some better interface for waiting on a thread in a gtk main loop */
+ import_thread_done = 0;
+ pthread_create(&pthread, NULL, pthread_wrapper, data);
+ while (!import_thread_done) {
+ while (gtk_events_pending()) {
+ if (gtk_main_iteration_do(0)) {
+ import_thread_cancelled = 1;
+ break;
+ }
+ }
+ usleep(100000);
+ }
+ if (pthread_join(pthread, &retval) < 0)
+ retval = "Odd pthread error return";
+ if (retval)
+ error(retval, data->name, data->devname);