diff options
Diffstat (limited to 'src/app.c')
-rw-r--r-- | src/app.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -227,6 +227,7 @@ static iString *serializePrefs_App_(const iApp *d) { | |||
227 | appendFormat_String(str, "proxy.gopher address:%s\n", cstr_String(&d->prefs.gopherProxy)); | 227 | appendFormat_String(str, "proxy.gopher address:%s\n", cstr_String(&d->prefs.gopherProxy)); |
228 | appendFormat_String(str, "proxy.http address:%s\n", cstr_String(&d->prefs.httpProxy)); | 228 | appendFormat_String(str, "proxy.http address:%s\n", cstr_String(&d->prefs.httpProxy)); |
229 | appendFormat_String(str, "downloads path:%s\n", cstr_String(&d->prefs.downloadDir)); | 229 | appendFormat_String(str, "downloads path:%s\n", cstr_String(&d->prefs.downloadDir)); |
230 | appendFormat_String(str, "searchurl address:%s\n", cstr_String(&d->prefs.searchUrl)); | ||
230 | return str; | 231 | return str; |
231 | } | 232 | } |
232 | 233 | ||
@@ -937,6 +938,8 @@ static iBool handlePrefsCommands_(iWidget *d, const char *cmd) { | |||
937 | isSelected_Widget(findChild_Widget(d, "prefs.ostheme"))); | 938 | isSelected_Widget(findChild_Widget(d, "prefs.ostheme"))); |
938 | postCommandf_App("decodeurls arg:%d", | 939 | postCommandf_App("decodeurls arg:%d", |
939 | isSelected_Widget(findChild_Widget(d, "prefs.decodeurls"))); | 940 | isSelected_Widget(findChild_Widget(d, "prefs.decodeurls"))); |
941 | postCommandf_App("searchurl address:%s", | ||
942 | cstr_String(text_InputWidget(findChild_Widget(d, "prefs.searchurl")))); | ||
940 | postCommandf_App("cachesize.set arg:%d", | 943 | postCommandf_App("cachesize.set arg:%d", |
941 | toInt_String(text_InputWidget(findChild_Widget(d, "prefs.cachesize")))); | 944 | toInt_String(text_InputWidget(findChild_Widget(d, "prefs.cachesize")))); |
942 | postCommandf_App("proxy.gemini address:%s", | 945 | postCommandf_App("proxy.gemini address:%s", |
@@ -1122,6 +1125,15 @@ iBool willUseProxy_App(const iRangecc scheme) { | |||
1122 | return schemeProxy_App(scheme) != NULL; | 1125 | return schemeProxy_App(scheme) != NULL; |
1123 | } | 1126 | } |
1124 | 1127 | ||
1128 | const iString *searchQueryUrl_App(const iString *queryStringUnescaped) { | ||
1129 | iApp *d = &app_; | ||
1130 | if (isEmpty_String(&d->prefs.searchUrl)) { | ||
1131 | return collectNew_String(); | ||
1132 | } | ||
1133 | const iString *escaped = urlEncode_String(queryStringUnescaped); | ||
1134 | return collectNewFormat_String("%s?%s", cstr_String(&d->prefs.searchUrl), cstr_String(escaped)); | ||
1135 | } | ||
1136 | |||
1125 | iBool handleCommand_App(const char *cmd) { | 1137 | iBool handleCommand_App(const char *cmd) { |
1126 | iApp *d = &app_; | 1138 | iApp *d = &app_; |
1127 | if (equal_Command(cmd, "config.error")) { | 1139 | if (equal_Command(cmd, "config.error")) { |
@@ -1292,6 +1304,10 @@ iBool handleCommand_App(const char *cmd) { | |||
1292 | } | 1304 | } |
1293 | return iTrue; | 1305 | return iTrue; |
1294 | } | 1306 | } |
1307 | else if (equal_Command(cmd, "searchurl")) { | ||
1308 | setCStr_String(&d->prefs.searchUrl, suffixPtr_Command(cmd, "address")); | ||
1309 | return iTrue; | ||
1310 | } | ||
1295 | else if (equal_Command(cmd, "proxy.gemini")) { | 1311 | else if (equal_Command(cmd, "proxy.gemini")) { |
1296 | setCStr_String(&d->prefs.geminiProxy, suffixPtr_Command(cmd, "address")); | 1312 | setCStr_String(&d->prefs.geminiProxy, suffixPtr_Command(cmd, "address")); |
1297 | return iTrue; | 1313 | return iTrue; |
@@ -1474,6 +1490,7 @@ iBool handleCommand_App(const char *cmd) { | |||
1474 | setText_InputWidget(findChild_Widget(dlg, "prefs.cachesize"), | 1490 | setText_InputWidget(findChild_Widget(dlg, "prefs.cachesize"), |
1475 | collectNewFormat_String("%d", d->prefs.maxCacheSize)); | 1491 | collectNewFormat_String("%d", d->prefs.maxCacheSize)); |
1476 | setToggle_Widget(findChild_Widget(dlg, "prefs.decodeurls"), d->prefs.decodeUserVisibleURLs); | 1492 | setToggle_Widget(findChild_Widget(dlg, "prefs.decodeurls"), d->prefs.decodeUserVisibleURLs); |
1493 | setText_InputWidget(findChild_Widget(dlg, "prefs.searchurl"), &d->prefs.searchUrl); | ||
1477 | setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gemini"), &d->prefs.geminiProxy); | 1494 | setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gemini"), &d->prefs.geminiProxy); |
1478 | setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gopher"), &d->prefs.gopherProxy); | 1495 | setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gopher"), &d->prefs.gopherProxy); |
1479 | setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.http"), &d->prefs.httpProxy); | 1496 | setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.http"), &d->prefs.httpProxy); |