summaryrefslogtreecommitdiff
path: root/src/ui/documentwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-05-20 14:57:09 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-05-20 14:57:09 +0300
commit5f9685010addd4a0f04c13f889856084381dd1c6 (patch)
treec29aecfd36da1ac0c3608fe9969841643ed5ca95 /src/ui/documentwidget.c
parentb8c07107fa332651cf2281fe8d2f90dfc122b588 (diff)
Added GmTypesetter
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r--src/ui/documentwidget.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 9169ea06..94337f8d 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -1076,7 +1076,7 @@ static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode
1076 } 1076 }
1077 } 1077 }
1078 setBanner_GmDocument(d->doc, useBanner ? bannerType_DocumentWidget_(d) : none_GmDocumentBanner); 1078 setBanner_GmDocument(d->doc, useBanner ? bannerType_DocumentWidget_(d) : none_GmDocumentBanner);
1079 setFormat_GmDocument(d->doc, gemini_GmDocumentFormat); 1079 setFormat_GmDocument(d->doc, gemini_SourceFormat);
1080 translate_Lang(src); 1080 translate_Lang(src);
1081 d->state = ready_RequestState; 1081 d->state = ready_RequestState;
1082 setSource_DocumentWidget(d, src); 1082 setSource_DocumentWidget(d, src);
@@ -1214,7 +1214,7 @@ static void updateDocument_DocumentWidget_(iDocumentWidget *d,
1214 if (isSuccess_GmStatusCode(statusCode)) { 1214 if (isSuccess_GmStatusCode(statusCode)) {
1215 /* Check the MIME type. */ 1215 /* Check the MIME type. */
1216 iRangecc charset = range_CStr("utf-8"); 1216 iRangecc charset = range_CStr("utf-8");
1217 enum iGmDocumentFormat docFormat = undefined_GmDocumentFormat; 1217 enum iSourceFormat docFormat = undefined_SourceFormat;
1218 const iString *mimeStr = collect_String(lower_String(&response->meta)); /* for convenience */ 1218 const iString *mimeStr = collect_String(lower_String(&response->meta)); /* for convenience */
1219 set_String(&d->sourceMime, mimeStr); 1219 set_String(&d->sourceMime, mimeStr);
1220 iRangecc mime = range_String(mimeStr); 1220 iRangecc mime = range_String(mimeStr);
@@ -1223,18 +1223,18 @@ static void updateDocument_DocumentWidget_(iDocumentWidget *d,
1223 iRangecc param = seg; 1223 iRangecc param = seg;
1224 trim_Rangecc(&param); 1224 trim_Rangecc(&param);
1225 if (equal_Rangecc(param, "text/gemini")) { 1225 if (equal_Rangecc(param, "text/gemini")) {
1226 docFormat = gemini_GmDocumentFormat; 1226 docFormat = gemini_SourceFormat;
1227 setRange_String(&d->sourceMime, param); 1227 setRange_String(&d->sourceMime, param);
1228 } 1228 }
1229 else if (startsWith_Rangecc(param, "text/") || 1229 else if (startsWith_Rangecc(param, "text/") ||
1230 equal_Rangecc(param, "application/json")) { 1230 equal_Rangecc(param, "application/json")) {
1231 docFormat = plainText_GmDocumentFormat; 1231 docFormat = plainText_SourceFormat;
1232 setRange_String(&d->sourceMime, param); 1232 setRange_String(&d->sourceMime, param);
1233 } 1233 }
1234 else if (equal_Rangecc(param, "application/zip") || 1234 else if (equal_Rangecc(param, "application/zip") ||
1235 (startsWith_Rangecc(param, "application/") && 1235 (startsWith_Rangecc(param, "application/") &&
1236 endsWithCase_Rangecc(param, "+zip"))) { 1236 endsWithCase_Rangecc(param, "+zip"))) {
1237 docFormat = gemini_GmDocumentFormat; 1237 docFormat = gemini_SourceFormat;
1238 setRange_String(&d->sourceMime, param); 1238 setRange_String(&d->sourceMime, param);
1239 iString *key = collectNew_String(); 1239 iString *key = collectNew_String();
1240 toString_Sym(SDLK_s, KMOD_PRIMARY, key); 1240 toString_Sym(SDLK_s, KMOD_PRIMARY, key);
@@ -1261,7 +1261,7 @@ static void updateDocument_DocumentWidget_(iDocumentWidget *d,
1261 startsWith_Rangecc(param, "audio/")) { 1261 startsWith_Rangecc(param, "audio/")) {
1262 const iBool isAudio = startsWith_Rangecc(param, "audio/"); 1262 const iBool isAudio = startsWith_Rangecc(param, "audio/");
1263 /* Make a simple document with an image or audio player. */ 1263 /* Make a simple document with an image or audio player. */
1264 docFormat = gemini_GmDocumentFormat; 1264 docFormat = gemini_SourceFormat;
1265 setRange_String(&d->sourceMime, param); 1265 setRange_String(&d->sourceMime, param);
1266 const iGmLinkId imgLinkId = 1; /* there's only the one link */ 1266 const iGmLinkId imgLinkId = 1; /* there's only the one link */
1267 /* TODO: Do the image loading in `postProcessRequestContent_DocumentWidget_()` */ 1267 /* TODO: Do the image loading in `postProcessRequestContent_DocumentWidget_()` */
@@ -1306,7 +1306,7 @@ static void updateDocument_DocumentWidget_(iDocumentWidget *d,
1306 } 1306 }
1307 } 1307 }
1308 } 1308 }
1309 if (docFormat == undefined_GmDocumentFormat) { 1309 if (docFormat == undefined_SourceFormat) {
1310 showErrorPage_DocumentWidget_(d, unsupportedMimeType_GmStatusCode, &response->meta); 1310 showErrorPage_DocumentWidget_(d, unsupportedMimeType_GmStatusCode, &response->meta);
1311 deinit_String(&str); 1311 deinit_String(&str);
1312 return; 1312 return;