diff options
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 41ca1d7f..448398b1 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1195,6 +1195,7 @@ static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode | |||
1195 | // iBool useBanner = iTrue; | 1195 | // iBool useBanner = iTrue; |
1196 | destroy_Widget(d->footerButtons); | 1196 | destroy_Widget(d->footerButtons); |
1197 | d->footerButtons = NULL; | 1197 | d->footerButtons = NULL; |
1198 | const iString *serverErrorMsg = NULL; | ||
1198 | if (meta) { | 1199 | if (meta) { |
1199 | switch (code) { | 1200 | switch (code) { |
1200 | case schemeChangeRedirect_GmStatusCode: | 1201 | case schemeChangeRedirect_GmStatusCode: |
@@ -1253,12 +1254,13 @@ static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode | |||
1253 | "document.save" }); | 1254 | "document.save" }); |
1254 | makeFooterButtons_DocumentWidget_(d, data_Array(&items), size_Array(&items)); | 1255 | makeFooterButtons_DocumentWidget_(d, data_Array(&items), size_Array(&items)); |
1255 | deinit_Array(&items); | 1256 | deinit_Array(&items); |
1257 | serverErrorMsg = collectNewFormat_String("%s (%s)", msg->title, cstr_String(meta)); | ||
1256 | break; | 1258 | break; |
1257 | } | 1259 | } |
1258 | default: | 1260 | default: |
1259 | // if (!isEmpty_String(meta)) { | 1261 | if (!isEmpty_String(meta)) { |
1260 | // appendFormat_String(src, "\n\n${error.server.msg}\n> %s", cstr_String(meta)); | 1262 | serverErrorMsg = meta; |
1261 | // } | 1263 | } |
1262 | break; | 1264 | break; |
1263 | } | 1265 | } |
1264 | } | 1266 | } |
@@ -1276,7 +1278,7 @@ static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode | |||
1276 | replaceDocument_DocumentWidget_(d, errorDoc); | 1278 | replaceDocument_DocumentWidget_(d, errorDoc); |
1277 | iRelease(errorDoc); | 1279 | iRelease(errorDoc); |
1278 | clear_Banner(d->banner); | 1280 | clear_Banner(d->banner); |
1279 | add_Banner(d->banner, error_BannerType, code, meta, NULL); | 1281 | add_Banner(d->banner, error_BannerType, code, serverErrorMsg, NULL); |
1280 | d->state = ready_RequestState; | 1282 | d->state = ready_RequestState; |
1281 | setSource_DocumentWidget(d, src); | 1283 | setSource_DocumentWidget(d, src); |
1282 | updateTheme_DocumentWidget_(d); | 1284 | updateTheme_DocumentWidget_(d); |
@@ -2080,6 +2082,13 @@ static void inputQueryValidator_(iInputWidget *input, void *context) { | |||
2080 | arrange_Widget(findChild_Widget(dlg, "dialogbuttons")); | 2082 | arrange_Widget(findChild_Widget(dlg, "dialogbuttons")); |
2081 | } | 2083 | } |
2082 | 2084 | ||
2085 | static const char *humanReadableStatusCode_(enum iGmStatusCode code) { | ||
2086 | if (code <= 0) { | ||
2087 | return ""; | ||
2088 | } | ||
2089 | return format_CStr("%d ", code); | ||
2090 | } | ||
2091 | |||
2083 | static void checkResponse_DocumentWidget_(iDocumentWidget *d) { | 2092 | static void checkResponse_DocumentWidget_(iDocumentWidget *d) { |
2084 | if (!d->request) { | 2093 | if (!d->request) { |
2085 | return; | 2094 | return; |
@@ -2104,8 +2113,8 @@ static void checkResponse_DocumentWidget_(iDocumentWidget *d) { | |||
2104 | init_Anim(&d->sideOpacity, 0); | 2113 | init_Anim(&d->sideOpacity, 0); |
2105 | init_Anim(&d->altTextOpacity, 0); | 2114 | init_Anim(&d->altTextOpacity, 0); |
2106 | format_String(&d->sourceHeader, | 2115 | format_String(&d->sourceHeader, |
2107 | "%d %s", | 2116 | "%s%s", |
2108 | statusCode, | 2117 | humanReadableStatusCode_(statusCode), |
2109 | isEmpty_String(&resp->meta) && !isSuccess_GmStatusCode(statusCode) | 2118 | isEmpty_String(&resp->meta) && !isSuccess_GmStatusCode(statusCode) |
2110 | ? get_GmError(statusCode)->title | 2119 | ? get_GmError(statusCode)->title |
2111 | : cstr_String(&resp->meta)); | 2120 | : cstr_String(&resp->meta)); |
@@ -3029,8 +3038,8 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
3029 | if (!isSuccess_GmStatusCode(status_GmRequest(d->request))) { | 3038 | if (!isSuccess_GmStatusCode(status_GmRequest(d->request))) { |
3030 | /* TODO: Why is this here? Can it be removed? */ | 3039 | /* TODO: Why is this here? Can it be removed? */ |
3031 | format_String(&d->sourceHeader, | 3040 | format_String(&d->sourceHeader, |
3032 | "%d %s", | 3041 | "%s%s", |
3033 | status_GmRequest(d->request), | 3042 | humanReadableStatusCode_(status_GmRequest(d->request)), |
3034 | cstr_String(meta_GmRequest(d->request))); | 3043 | cstr_String(meta_GmRequest(d->request))); |
3035 | } | 3044 | } |
3036 | updateFetchProgress_DocumentWidget_(d); | 3045 | updateFetchProgress_DocumentWidget_(d); |