diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gmdocument.c | 9 | ||||
-rw-r--r-- | src/gmdocument.h | 1 | ||||
-rw-r--r-- | src/gmutil.c | 2 | ||||
-rw-r--r-- | src/ui/documentwidget.c | 3 |
4 files changed, 13 insertions, 2 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c index b8de304f..50733252 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -63,6 +63,7 @@ struct Impl_GmDocument { | |||
63 | iString url; /* for resolving relative links */ | 63 | iString url; /* for resolving relative links */ |
64 | iString localHost; | 64 | iString localHost; |
65 | int forceBreakWidth; /* force breaks on very long preformatted lines */ | 65 | int forceBreakWidth; /* force breaks on very long preformatted lines */ |
66 | iBool siteBannerEnabled; | ||
66 | iInt2 size; | 67 | iInt2 size; |
67 | iArray layout; /* contents of source, laid out in document space */ | 68 | iArray layout; /* contents of source, laid out in document space */ |
68 | iPtrArray links; | 69 | iPtrArray links; |
@@ -295,7 +296,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
295 | iRangecc preAltText = iNullRange; | 296 | iRangecc preAltText = iNullRange; |
296 | int preFont = preformatted_FontId; | 297 | int preFont = preformatted_FontId; |
297 | iBool enableIndents = iFalse; | 298 | iBool enableIndents = iFalse; |
298 | iBool addSiteBanner = iTrue; | 299 | iBool addSiteBanner = d->siteBannerEnabled; |
299 | enum iGmLineType prevType = text_GmLineType; | 300 | enum iGmLineType prevType = text_GmLineType; |
300 | if (d->format == plainText_GmDocumentFormat) { | 301 | if (d->format == plainText_GmDocumentFormat) { |
301 | isPreformat = iTrue; | 302 | isPreformat = iTrue; |
@@ -592,6 +593,7 @@ void init_GmDocument(iGmDocument *d) { | |||
592 | init_String(&d->source); | 593 | init_String(&d->source); |
593 | init_String(&d->url); | 594 | init_String(&d->url); |
594 | init_String(&d->localHost); | 595 | init_String(&d->localHost); |
596 | d->siteBannerEnabled = iTrue; | ||
595 | d->size = zero_I2(); | 597 | d->size = zero_I2(); |
596 | init_Array(&d->layout, sizeof(iGmRun)); | 598 | init_Array(&d->layout, sizeof(iGmRun)); |
597 | init_PtrArray(&d->links); | 599 | init_PtrArray(&d->links); |
@@ -632,6 +634,7 @@ void reset_GmDocument(iGmDocument *d) { | |||
632 | clear_String(&d->url); | 634 | clear_String(&d->url); |
633 | clear_String(&d->localHost); | 635 | clear_String(&d->localHost); |
634 | d->themeSeed = 0; | 636 | d->themeSeed = 0; |
637 | d->siteBannerEnabled = iTrue; | ||
635 | } | 638 | } |
636 | 639 | ||
637 | static void setDerivedThemeColors_(enum iGmDocumentTheme theme) { | 640 | static void setDerivedThemeColors_(enum iGmDocumentTheme theme) { |
@@ -1055,6 +1058,10 @@ void setFormat_GmDocument(iGmDocument *d, enum iGmDocumentFormat format) { | |||
1055 | d->format = format; | 1058 | d->format = format; |
1056 | } | 1059 | } |
1057 | 1060 | ||
1061 | void setSiteBannerEnabled_GmDocument(iGmDocument *d, iBool siteBannerEnabled) { | ||
1062 | d->siteBannerEnabled = siteBannerEnabled; | ||
1063 | } | ||
1064 | |||
1058 | void setWidth_GmDocument(iGmDocument *d, int width, int forceBreakWidth) { | 1065 | void setWidth_GmDocument(iGmDocument *d, int width, int forceBreakWidth) { |
1059 | d->forceBreakWidth = forceBreakWidth; | 1066 | d->forceBreakWidth = forceBreakWidth; |
1060 | d->size.x = width; | 1067 | d->size.x = width; |
diff --git a/src/gmdocument.h b/src/gmdocument.h index f27446ab..84af3c98 100644 --- a/src/gmdocument.h +++ b/src/gmdocument.h | |||
@@ -107,6 +107,7 @@ enum iGmDocumentFormat { | |||
107 | 107 | ||
108 | void setThemeSeed_GmDocument (iGmDocument *, const iBlock *seed); | 108 | void setThemeSeed_GmDocument (iGmDocument *, const iBlock *seed); |
109 | void setFormat_GmDocument (iGmDocument *, enum iGmDocumentFormat format); | 109 | void setFormat_GmDocument (iGmDocument *, enum iGmDocumentFormat format); |
110 | void setSiteBannerEnabled_GmDocument(iGmDocument *, iBool siteBannerEnabled); | ||
110 | void setWidth_GmDocument (iGmDocument *, int width, int forceBreakWidth); | 111 | void setWidth_GmDocument (iGmDocument *, int width, int forceBreakWidth); |
111 | void redoLayout_GmDocument (iGmDocument *); | 112 | void redoLayout_GmDocument (iGmDocument *); |
112 | void setUrl_GmDocument (iGmDocument *, const iString *url); | 113 | void setUrl_GmDocument (iGmDocument *, const iString *url); |
diff --git a/src/gmutil.c b/src/gmutil.c index 5f09a176..4b144097 100644 --- a/src/gmutil.c +++ b/src/gmutil.c | |||
@@ -240,7 +240,7 @@ static const struct { | |||
240 | { tlsFailure_GmStatusCode, | 240 | { tlsFailure_GmStatusCode, |
241 | { 0x1f5a7, /* networked computers */ | 241 | { 0x1f5a7, /* networked computers */ |
242 | "Network/TLS Failure", | 242 | "Network/TLS Failure", |
243 | "We could not communicate with the requested host." } }, | 243 | "Failed to communicate with the host. Here is the error message:" } }, |
244 | { temporaryFailure_GmStatusCode, | 244 | { temporaryFailure_GmStatusCode, |
245 | { 0x1f50c, /* electric plug */ | 245 | { 0x1f50c, /* electric plug */ |
246 | "Temporary Failure", | 246 | "Temporary Failure", |
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 60e08459..3f08e678 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -682,6 +682,7 @@ static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode | |||
682 | const iGmError *msg = get_GmError(code); | 682 | const iGmError *msg = get_GmError(code); |
683 | appendChar_String(src, msg->icon ? msg->icon : 0x2327); /* X in a box */ | 683 | appendChar_String(src, msg->icon ? msg->icon : 0x2327); /* X in a box */ |
684 | appendFormat_String(src, " %s\n%s", msg->title, msg->info); | 684 | appendFormat_String(src, " %s\n%s", msg->title, msg->info); |
685 | iBool useBanner = iTrue; | ||
685 | if (meta) { | 686 | if (meta) { |
686 | switch (code) { | 687 | switch (code) { |
687 | case nonGeminiRedirect_GmStatusCode: | 688 | case nonGeminiRedirect_GmStatusCode: |
@@ -689,6 +690,7 @@ static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode | |||
689 | appendFormat_String(src, "\n=> %s\n", cstr_String(meta)); | 690 | appendFormat_String(src, "\n=> %s\n", cstr_String(meta)); |
690 | break; | 691 | break; |
691 | case tlsFailure_GmStatusCode: | 692 | case tlsFailure_GmStatusCode: |
693 | useBanner = iFalse; /* valid data wasn't received from host */ | ||
692 | appendFormat_String(src, "\n\n>%s\n", cstr_String(meta)); | 694 | appendFormat_String(src, "\n\n>%s\n", cstr_String(meta)); |
693 | break; | 695 | break; |
694 | case failedToOpenFile_GmStatusCode: | 696 | case failedToOpenFile_GmStatusCode: |
@@ -714,6 +716,7 @@ static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode | |||
714 | break; | 716 | break; |
715 | } | 717 | } |
716 | } | 718 | } |
719 | setSiteBannerEnabled_GmDocument(d->doc, useBanner); | ||
717 | setSource_DocumentWidget_(d, src); | 720 | setSource_DocumentWidget_(d, src); |
718 | updateTheme_DocumentWidget_(d); | 721 | updateTheme_DocumentWidget_(d); |
719 | init_Anim(&d->scrollY, 0); | 722 | init_Anim(&d->scrollY, 0); |