diff options
| author | Federico Angelilli <code@fedang.net> | 2024-11-24 20:14:59 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2024-11-24 20:14:59 +0100 |
| commit | 21fb9be7b28843d9232803b90137c7251fe9194e (patch) | |
| tree | 3469e073d1ea854f682665945f9be8c3af819fda /src/blocks/date.c | |
| parent | a063bb86e8ab1373aea28f9e9ff375032b1fa475 (diff) | |
Add change function to other blocks
Diffstat (limited to 'src/blocks/date.c')
| -rw-r--r-- | src/blocks/date.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/blocks/date.c b/src/blocks/date.c index cd1adce..cbc6cce 100644 --- a/src/blocks/date.c +++ b/src/blocks/date.c @@ -60,6 +60,20 @@ static int block_date_validate(block_t *block, config_t *config) return errors; } +static config_status_t block_date_change(block_t *block, config_t *config, const char *key, const char *value) +{ + block_date_t *date = (block_date_t *)block; + + if (!strcmp(key, "text")) { + free(date->format); + date->format = strcopy(value); + return CONFIG_SUCCESS; + } + + extern const config_entry_t block_text_entries[]; + return config_read_entry(block_text_entries, block, NULL, "block", block->label, key, value); +} + const block_scheme_t block_date_scheme = { .name = "date", .entries = NULL, @@ -67,4 +81,5 @@ const block_scheme_t block_date_scheme = { .init_fn = block_date_init, .clean_fn = block_date_clean, .validate_fn = block_date_validate, + .change_fn = block_date_change, }; |
