diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/documentwidget.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 9e8e644e..60e08459 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -666,6 +666,16 @@ static void setSource_DocumentWidget_(iDocumentWidget *d, const iString *source) | |||
666 | refresh_Widget(as_Widget(d)); | 666 | refresh_Widget(as_Widget(d)); |
667 | } | 667 | } |
668 | 668 | ||
669 | static void updateTheme_DocumentWidget_(iDocumentWidget *d) { | ||
670 | if (isEmpty_String(d->titleUser)) { | ||
671 | setThemeSeed_GmDocument(d->doc, | ||
672 | collect_Block(newRange_Block(urlHost_String(d->mod.url)))); | ||
673 | } | ||
674 | else { | ||
675 | setThemeSeed_GmDocument(d->doc, &d->titleUser->chars); | ||
676 | } | ||
677 | } | ||
678 | |||
669 | static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode code, | 679 | static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode code, |
670 | const iString *meta) { | 680 | const iString *meta) { |
671 | iString *src = collectNewCStr_String("# "); | 681 | iString *src = collectNewCStr_String("# "); |
@@ -678,6 +688,9 @@ static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode | |||
678 | case tooManyRedirects_GmStatusCode: | 688 | case tooManyRedirects_GmStatusCode: |
679 | appendFormat_String(src, "\n=> %s\n", cstr_String(meta)); | 689 | appendFormat_String(src, "\n=> %s\n", cstr_String(meta)); |
680 | break; | 690 | break; |
691 | case tlsFailure_GmStatusCode: | ||
692 | appendFormat_String(src, "\n\n>%s\n", cstr_String(meta)); | ||
693 | break; | ||
681 | case failedToOpenFile_GmStatusCode: | 694 | case failedToOpenFile_GmStatusCode: |
682 | case certificateNotValid_GmStatusCode: | 695 | case certificateNotValid_GmStatusCode: |
683 | appendFormat_String(src, "\n\n%s", cstr_String(meta)); | 696 | appendFormat_String(src, "\n\n%s", cstr_String(meta)); |
@@ -702,21 +715,12 @@ static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode | |||
702 | } | 715 | } |
703 | } | 716 | } |
704 | setSource_DocumentWidget_(d, src); | 717 | setSource_DocumentWidget_(d, src); |
718 | updateTheme_DocumentWidget_(d); | ||
705 | init_Anim(&d->scrollY, 0); | 719 | init_Anim(&d->scrollY, 0); |
706 | init_Anim(&d->sideOpacity, 0); | 720 | init_Anim(&d->sideOpacity, 0); |
707 | d->state = ready_RequestState; | 721 | d->state = ready_RequestState; |
708 | } | 722 | } |
709 | 723 | ||
710 | static void updateTheme_DocumentWidget_(iDocumentWidget *d) { | ||
711 | if (isEmpty_String(d->titleUser)) { | ||
712 | setThemeSeed_GmDocument(d->doc, | ||
713 | collect_Block(newRange_Block(urlHost_String(d->mod.url)))); | ||
714 | } | ||
715 | else { | ||
716 | setThemeSeed_GmDocument(d->doc, &d->titleUser->chars); | ||
717 | } | ||
718 | } | ||
719 | |||
720 | static void updateFetchProgress_DocumentWidget_(iDocumentWidget *d) { | 724 | static void updateFetchProgress_DocumentWidget_(iDocumentWidget *d) { |
721 | iLabelWidget *prog = findWidget_App("document.progress"); | 725 | iLabelWidget *prog = findWidget_App("document.progress"); |
722 | const size_t dlSize = d->request ? size_Block(body_GmRequest(d->request)) : 0; | 726 | const size_t dlSize = d->request ? size_Block(body_GmRequest(d->request)) : 0; |