diff options
Diffstat (limited to 'src/prefs.c')
-rw-r--r-- | src/prefs.c | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/src/prefs.c b/src/prefs.c index 088cc7bc..4d079402 100644 --- a/src/prefs.c +++ b/src/prefs.c | |||
@@ -25,6 +25,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
25 | #include <the_Foundation/fileinfo.h> | 25 | #include <the_Foundation/fileinfo.h> |
26 | 26 | ||
27 | void init_Prefs(iPrefs *d) { | 27 | void init_Prefs(iPrefs *d) { |
28 | iForIndices(i, d->strings) { | ||
29 | init_String(&d->strings[i]); | ||
30 | } | ||
28 | d->dialogTab = 0; | 31 | d->dialogTab = 0; |
29 | d->langFrom = 3; /* fr */ | 32 | d->langFrom = 3; /* fr */ |
30 | d->langTo = 2; /* en */ | 33 | d->langTo = 2; /* en */ |
@@ -50,8 +53,11 @@ void init_Prefs(iPrefs *d) { | |||
50 | d->decodeUserVisibleURLs = iTrue; | 53 | d->decodeUserVisibleURLs = iTrue; |
51 | d->maxCacheSize = 10; | 54 | d->maxCacheSize = 10; |
52 | d->maxMemorySize = 200; | 55 | d->maxMemorySize = 200; |
53 | d->font = nunito_TextFont; | 56 | setCStr_String(&d->strings[uiFont_PrefsString], "default"); |
54 | d->headingFont = nunito_TextFont; | 57 | setCStr_String(&d->strings[headingFont_PrefsString], "default"); |
58 | setCStr_String(&d->strings[bodyFont_PrefsString], "default"); | ||
59 | setCStr_String(&d->strings[monospaceFont_PrefsString], "iosevka"); | ||
60 | setCStr_String(&d->strings[monospaceDocumentFont_PrefsString], "iosevka-body"); | ||
55 | d->monospaceGemini = iFalse; | 61 | d->monospaceGemini = iFalse; |
56 | d->monospaceGopher = iFalse; | 62 | d->monospaceGopher = iFalse; |
57 | d->boldLinkDark = iTrue; | 63 | d->boldLinkDark = iTrue; |
@@ -66,37 +72,18 @@ void init_Prefs(iPrefs *d) { | |||
66 | d->docThemeDark = colorfulDark_GmDocumentTheme; | 72 | d->docThemeDark = colorfulDark_GmDocumentTheme; |
67 | d->docThemeLight = white_GmDocumentTheme; | 73 | d->docThemeLight = white_GmDocumentTheme; |
68 | d->saturation = 1.0f; | 74 | d->saturation = 1.0f; |
69 | initCStr_String(&d->uiLanguage, "en"); | 75 | setCStr_String(&d->strings[uiLanguage_PrefsString], "en"); |
70 | init_String(&d->caFile); | ||
71 | init_String(&d->caPath); | ||
72 | init_String(&d->geminiProxy); | ||
73 | init_String(&d->gopherProxy); | ||
74 | init_String(&d->httpProxy); | ||
75 | init_String(&d->downloadDir); | ||
76 | init_String(&d->searchUrl); | ||
77 | init_String(&d->symbolFontPath); | ||
78 | /* TODO: Add some platform-specific common locations? */ | 76 | /* TODO: Add some platform-specific common locations? */ |
79 | if (fileExistsCStr_FileInfo("/etc/ssl/cert.pem")) { /* macOS */ | 77 | if (fileExistsCStr_FileInfo("/etc/ssl/cert.pem")) { /* macOS */ |
80 | setCStr_String(&d->caFile, "/etc/ssl/cert.pem"); | 78 | setCStr_String(&d->strings[caFile_PrefsString], "/etc/ssl/cert.pem"); |
81 | } | 79 | } |
82 | if (fileExistsCStr_FileInfo("/etc/ssl/certs")) { | 80 | if (fileExistsCStr_FileInfo("/etc/ssl/certs")) { |
83 | setCStr_String(&d->caPath, "/etc/ssl/certs"); | 81 | setCStr_String(&d->strings[caPath_PrefsString], "/etc/ssl/certs"); |
84 | } | 82 | } |
85 | /* | ||
86 | #if defined (iPlatformAppleDesktop) | ||
87 | setCStr_String(&d->symbolFontPath, "/System/Library/Fonts/Apple Symbols.ttf"); | ||
88 | #endif | ||
89 | */ | ||
90 | } | 83 | } |
91 | 84 | ||
92 | void deinit_Prefs(iPrefs *d) { | 85 | void deinit_Prefs(iPrefs *d) { |
93 | deinit_String(&d->symbolFontPath); | 86 | iForIndices(i, d->strings) { |
94 | deinit_String(&d->searchUrl); | 87 | deinit_String(&d->strings[i]); |
95 | deinit_String(&d->geminiProxy); | 88 | } |
96 | deinit_String(&d->gopherProxy); | ||
97 | deinit_String(&d->httpProxy); | ||
98 | deinit_String(&d->downloadDir); | ||
99 | deinit_String(&d->caPath); | ||
100 | deinit_String(&d->caFile); | ||
101 | deinit_String(&d->uiLanguage); | ||
102 | } | 89 | } |