From c8583fcea3e25de7164f63cce7e7eb93cce4b059 Mon Sep 17 00:00:00 2001 From: Salvador Cuñat Date: Fri, 20 Mar 2015 00:14:07 +0100 Subject: Improve error management MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Show error messages in main window, instead of stdout. Use translated strings. Remove redundant error message. Signed-off-by: Salvador Cuñat Signed-off-by: Dirk Hohndel --- datatrak.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'datatrak.c') diff --git a/datatrak.c b/datatrak.c index 573796cfe..7357b053f 100644 --- a/datatrak.c +++ b/datatrak.c @@ -140,7 +140,7 @@ static dtrakheader read_file_header(FILE *archivo) fread(lector, 1, headerbytes, archivo); if (two_bytes_to_int(lector[0], lector[1]) != 0xA100) { - puts("Error: the file does not appear to be a DATATRAK divelog"); + report_error(translate("gettextFromC", "Error: the file does not appear to be a DATATRAK divelog")); return fileheader; } fileheader.header = (lector[0] << 8) + lector[1]; @@ -652,7 +652,7 @@ void datatrak_import(const char *file, struct dive_table *table) int i = 0; if ((archivo = subsurface_fopen(file, "rb")) == NULL) { - puts("Error: couldn't open the file"); + report_error(translate("gettextFromC", "Error: couldn't open the file %s"), file); return; } @@ -660,14 +660,11 @@ void datatrak_import(const char *file, struct dive_table *table) * Verify fileheader, get number of dives in datatrak divelog */ *fileheader = read_file_header(archivo); - - if (fileheader->header == 0) - puts("Error: not a DATATRAK/WLOG file\n"); while (i < fileheader->divesNum) { struct dive *ptdive = alloc_dive(); *ptdive = dt_dive_parser(archivo, ptdive); if (!ptdive) - puts("Error: no dive\n"); + report_error(translate("gettextFromC", "Error: no dive")); i++; record_dive(ptdive); } -- cgit v1.2.3-70-g09d2