summaryrefslogtreecommitdiff
path: root/src/sitespec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sitespec.c')
-rw-r--r--src/sitespec.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/sitespec.c b/src/sitespec.c
index fe80ad13..31094981 100644
--- a/src/sitespec.c
+++ b/src/sitespec.c
@@ -37,7 +37,8 @@ struct Impl_SiteParams {
37 iString titanIdentity; /* fingerprint */ 37 iString titanIdentity; /* fingerprint */
38 int dismissWarnings; 38 int dismissWarnings;
39 iStringArray usedIdentities; /* fingerprints; latest ones at the end */ 39 iStringArray usedIdentities; /* fingerprints; latest ones at the end */
40 /* TODO: theme seed, style settings */ 40 iString paletteSeed;
41 /* TODO: style settings */
41}; 42};
42 43
43void init_SiteParams(iSiteParams *d) { 44void init_SiteParams(iSiteParams *d) {
@@ -45,9 +46,11 @@ void init_SiteParams(iSiteParams *d) {
45 init_String(&d->titanIdentity); 46 init_String(&d->titanIdentity);
46 d->dismissWarnings = 0; 47 d->dismissWarnings = 0;
47 init_StringArray(&d->usedIdentities); 48 init_StringArray(&d->usedIdentities);
49 init_String(&d->paletteSeed);
48} 50}
49 51
50void deinit_SiteParams(iSiteParams *d) { 52void deinit_SiteParams(iSiteParams *d) {
53 deinit_String(&d->paletteSeed);
51 deinit_StringArray(&d->usedIdentities); 54 deinit_StringArray(&d->usedIdentities);
52 deinit_String(&d->titanIdentity); 55 deinit_String(&d->titanIdentity);
53} 56}
@@ -149,6 +152,9 @@ static void handleIniKeyValue_SiteSpec_(void *context, const iString *table, con
149 pushBack_StringArray(&d->loadParams->usedIdentities, collectNewRange_String(seg)); 152 pushBack_StringArray(&d->loadParams->usedIdentities, collectNewRange_String(seg));
150 } 153 }
151 } 154 }
155 else if (!cmp_String(key, "paletteSeed") && value->type == string_TomlType) {
156 set_String(&d->loadParams->paletteSeed, value->value.string);
157 }
152} 158}
153 159
154static iBool load_SiteSpec_(iSiteSpec *d) { 160static iBool load_SiteSpec_(iSiteSpec *d) {
@@ -190,6 +196,11 @@ static void save_SiteSpec_(iSiteSpec *d) {
190 "usedIdentities = \"%s\"\n", 196 "usedIdentities = \"%s\"\n",
191 cstrCollect_String(joinCStr_StringArray(&params->usedIdentities, " "))); 197 cstrCollect_String(joinCStr_StringArray(&params->usedIdentities, " ")));
192 } 198 }
199 if (!isEmpty_String(&params->paletteSeed)) {
200 appendCStr_String(buf, "paletteSeed = \"");
201 append_String(buf, collect_String(quote_String(&params->paletteSeed, iFalse)));
202 appendCStr_String(buf, "\"\n");
203 }
193 appendCStr_String(buf, "\n"); 204 appendCStr_String(buf, "\n");
194 write_File(f, utf8_String(buf)); 205 write_File(f, utf8_String(buf));
195 iEndCollect(); 206 iEndCollect();