aboutsummaryrefslogtreecommitdiffstats
path: root/divelist-gtk.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-12 08:09:50 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-12 08:09:50 -0700
commit0f389dd1c9fcb5eb43705b12adceb108cb40da15 (patch)
treeea4679f918f041ab66215a3007d74f23c989eb38 /divelist-gtk.c
parenta4f3fa46c6ee98b67cad4b6f90689df480aac72a (diff)
downloadsubsurface-0f389dd1c9fcb5eb43705b12adceb108cb40da15.tar.gz
Improve the dialog after successful divelogs.de upload
This is still not really "normal person" readable. But at least somewhat better than what we had before. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist-gtk.c')
-rw-r--r--divelist-gtk.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/divelist-gtk.c b/divelist-gtk.c
index c2ae5fed5..e7194d87e 100644
--- a/divelist-gtk.c
+++ b/divelist-gtk.c
@@ -1398,6 +1398,7 @@ static void upload_dives_divelogs(const gboolean selected)
const gchar *tmpdir = g_get_tmp_dir();
GtkMessageType type;
char *error = NULL;
+ char *parsed = NULL, *endat = NULL;
/*
* Creating a temporary .DLD file to be eventually uploaded to
@@ -1469,26 +1470,31 @@ static void upload_dives_divelogs(const gboolean selected)
}
zip_close(zip);
if (!divelogde_upload(tempfile, &error)) {
- /* error = strdup(_("Communication error with divelogs.de")); */
type = GTK_MESSAGE_ERROR;
} else {
/* The upload status XML message should be parsed
* properly and displayed in a sensible manner. But just
- * displaying the raw message is better than nothing.
+ * displaying the information part of the raw message is
+ * better than nothing.
* And at least the dialog is customized to indicate
* error or success.
*/
+ if (error) {
+ parsed = strstr(error, "<Login>");
+ endat = strstr(error, "</divelogsDataImport>");
+ if (parsed && endat)
+ *endat = '\0';
+ }
if (error && strstr(error, "failed"))
type = GTK_MESSAGE_ERROR;
else
type = GTK_MESSAGE_INFO;
}
-
-
- if (error) {
+ if (parsed)
+ divelogs_status_dialog(parsed, type);
+ else if (error)
divelogs_status_dialog(error, type);
- free(error);
- }
+ free(error);
g_unlink(tempfile);
g_free(tempfile);