mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
a4f3fa46c6
commit
0f389dd1c9
1 changed files with 13 additions and 7 deletions
|
@ -1398,6 +1398,7 @@ static void upload_dives_divelogs(const gboolean selected)
|
||||||
const gchar *tmpdir = g_get_tmp_dir();
|
const gchar *tmpdir = g_get_tmp_dir();
|
||||||
GtkMessageType type;
|
GtkMessageType type;
|
||||||
char *error = NULL;
|
char *error = NULL;
|
||||||
|
char *parsed = NULL, *endat = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Creating a temporary .DLD file to be eventually uploaded to
|
* 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);
|
zip_close(zip);
|
||||||
if (!divelogde_upload(tempfile, &error)) {
|
if (!divelogde_upload(tempfile, &error)) {
|
||||||
/* error = strdup(_("Communication error with divelogs.de")); */
|
|
||||||
type = GTK_MESSAGE_ERROR;
|
type = GTK_MESSAGE_ERROR;
|
||||||
} else {
|
} else {
|
||||||
/* The upload status XML message should be parsed
|
/* The upload status XML message should be parsed
|
||||||
* properly and displayed in a sensible manner. But just
|
* 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
|
* And at least the dialog is customized to indicate
|
||||||
* error or success.
|
* error or success.
|
||||||
*/
|
*/
|
||||||
|
if (error) {
|
||||||
|
parsed = strstr(error, "<Login>");
|
||||||
|
endat = strstr(error, "</divelogsDataImport>");
|
||||||
|
if (parsed && endat)
|
||||||
|
*endat = '\0';
|
||||||
|
}
|
||||||
if (error && strstr(error, "failed"))
|
if (error && strstr(error, "failed"))
|
||||||
type = GTK_MESSAGE_ERROR;
|
type = GTK_MESSAGE_ERROR;
|
||||||
else
|
else
|
||||||
type = GTK_MESSAGE_INFO;
|
type = GTK_MESSAGE_INFO;
|
||||||
}
|
}
|
||||||
|
if (parsed)
|
||||||
|
divelogs_status_dialog(parsed, type);
|
||||||
if (error) {
|
else if (error)
|
||||||
divelogs_status_dialog(error, type);
|
divelogs_status_dialog(error, type);
|
||||||
free(error);
|
free(error);
|
||||||
}
|
|
||||||
|
|
||||||
g_unlink(tempfile);
|
g_unlink(tempfile);
|
||||||
g_free(tempfile);
|
g_free(tempfile);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue