From b0ba22a06879697efa7c429b9df8e13feaa02480 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 2 May 2012 12:49:03 -0700 Subject: Show dive import error messages in the import dialog .. not in the main window. And leave the import dialog open, so that you can either try doing it again, or cancel. This makes it much easier to re-try a failed dive import, and actually makes the failure more obvious too. Todo: - make the "Ok" button change to "Retry" when an error happens - try to see if we can catch the actual status update messages from libdivecomputer and show them too in the import dialog. Right now they are printed out to stderr by the library. Signed-off-by: Linus Torvalds --- libdivecomputer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libdivecomputer.c') diff --git a/libdivecomputer.c b/libdivecomputer.c index 14f794e8c..4495b1716 100644 --- a/libdivecomputer.c +++ b/libdivecomputer.c @@ -18,7 +18,7 @@ #define NOT_FROG #endif -static void error(const char *fmt, ...) +static GError *error(const char *fmt, ...) { va_list args; GError *error; @@ -28,8 +28,7 @@ static void error(const char *fmt, ...) g_quark_from_string("subsurface"), DIVE_ERROR_PARSE, fmt, args); va_end(args); - report_error(error); - g_error_free(error); + return error; } static parser_status_t create_parser(device_data_t *devdata, parser_t **parser) @@ -512,7 +511,7 @@ static void *pthread_wrapper(void *_data) return (void *)err_string; } -void do_import(device_data_t *data) +GError *do_import(device_data_t *data) { pthread_t pthread; void *retval; @@ -527,7 +526,8 @@ void do_import(device_data_t *data) if (pthread_join(pthread, &retval) < 0) retval = "Odd pthread error return"; if (retval) - error(retval, data->name, data->devname); + return error(retval, data->name, data->devname); + return NULL; } /* -- cgit v1.2.3-70-g09d2