subsurface/libdivecomputer.h
Dirk Hohndel a8d413551e Allow the user to cancel a dive computer download
The code pretended to support this for libdivecomputer based downloads,
but it had never been hooked up when the native Uemis downloader was
implemented. When I finally decided to close that feature gap I realized
that the original code was, shall we say, "aspirational" or "completely
bogus" and therefore never worked.

So instead of just hooking up the code for the Uemis downloader I instead
implemented this correctly for the first time for both libdivecomputer and
the native Uemis downloader.

In order not to have to mess with multithreaded Gtk development I simply
opted for a helper function that fires on a 100ms timeout and have it end
the dialog without a response. This way we can run the dialog while
waiting for the download to finish, still update the progress bar and
respond in a useful manner to the user clicking cancel.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-20 11:42:01 -08:00

26 lines
632 B
C

#ifndef LIBDIVECOMPUTER_H
#define LIBDIVECOMPUTER_H
/* libdivecomputer */
#include <libdivecomputer/device.h>
#include <libdivecomputer/parser.h>
/* handling uemis Zurich SDA files */
#include "uemis.h"
/* don't forget to include the UI toolkit specific display-XXX.h first
to get the definition of progressbar_t */
typedef struct device_data_t {
dc_descriptor_t *descriptor;
const char *vendor, *product, *devname;
dc_device_t *device;
dc_context_t *context;
progressbar_t progress;
int preexisting;
gboolean force_download;
GtkDialog *dialog;
} device_data_t;
extern GError *do_import(device_data_t *data);
#endif