summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-08 22:02:14 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-08 22:02:58 +0300
commit496122b446d2084f6117e2b8704d7c9ec6706422 (patch)
treeb379efe7f6a2ed530ec9a9bc982e7f48cbd3a29a /src/app.c
parent7b98d7af353c31706d5d6b20ff7d65272f8b7445 (diff)
Handling "about:home"; GmRequest decoupling
GmRequest is given a pointer to the GmCerts to use. Also, timeouts are handled via a posted command so they get processed in the main thread.
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/app.c b/src/app.c
index e88abe20..fa7311c6 100644
--- a/src/app.c
+++ b/src/app.c
@@ -56,7 +56,6 @@ struct Impl_App {
56 iSortedArray tickers; 56 iSortedArray tickers;
57 iBool pendingRefresh; 57 iBool pendingRefresh;
58 iGmCerts * certs; 58 iGmCerts * certs;
59// iHistory * history;
60 iVisited * visited; 59 iVisited * visited;
61 /* Preferences: */ 60 /* Preferences: */
62 iBool retainWindowSize; 61 iBool retainWindowSize;
@@ -185,6 +184,10 @@ const iString *execPath_App(void) {
185 return executablePath_CommandLine(&app_.args); 184 return executablePath_CommandLine(&app_.args);
186} 185}
187 186
187const iString *dataDir_App(void) {
188 return collect_String(cleanedCStr_Path(dataDir_App_));
189}
190
188void processEvents_App(enum iAppEventMode eventMode) { 191void processEvents_App(enum iAppEventMode eventMode) {
189 iApp *d = &app_; 192 iApp *d = &app_;
190 SDL_Event ev; 193 SDL_Event ev;
@@ -423,12 +426,7 @@ iBool handleCommand_App(const char *cmd) {
423 SDL_SetWindowPosition(d->window->win, pos.x, pos.y); 426 SDL_SetWindowPosition(d->window->win, pos.x, pos.y);
424 } 427 }
425 else if (equal_Command(cmd, "navigate.home")) { 428 else if (equal_Command(cmd, "navigate.home")) {
426 iString *homePath = newCStr_String(dataDir_App_); 429 postCommand_App("open url:about:home");
427 clean_Path(homePath);
428 append_Path(homePath, &iStringLiteral("home.gmi"));
429 prependCStr_String(homePath, "file://");
430 postCommandf_App("open url:%s", cstr_String(homePath));
431 delete_String(homePath);
432 return iTrue; 430 return iTrue;
433 } 431 }
434 else if (equal_Command(cmd, "font.setfactor")) { 432 else if (equal_Command(cmd, "font.setfactor")) {