new: Add support for the desc field

This commit is contained in:
ngn 2024-05-05 20:16:29 +03:00
parent ef301854ee
commit beebf28aa4
3 changed files with 22 additions and 9 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-04 22:36+0300\n"
"POT-Creation-Date: 2024-05-05 20:10+0300\n"
"PO-Revision-Date: 2024-05-01 13:34+0300\n"
"Last-Translator: <ngn@ngn.tf>\n"
"Language-Team: Turkish <gnome-turk@gnome.org>\n"
@ -29,36 +29,40 @@ msgstr ""
msgid "Configuration does not have any targets"
msgstr ""
#: src/config.c:92
#: src/config.c:95
msgid "Configuration contains multiple targets with the same name"
msgstr ""
#: src/config.c:119
#: src/config.c:122
#, c-format
msgid "Key %s is unknown"
msgstr ""
#: src/config.c:149
#: src/config.c:154
msgid "Configuration file not found"
msgstr ""
#: src/config.c:164
#: src/config.c:170
msgid "Failed to parse configuration file"
msgstr ""
#: src/config.c:180
#: src/config.c:186
msgid "Configuration details:\n"
msgstr ""
#: src/config.c:181 src/target.c:122
#: src/config.c:187 src/target.c:122
msgid "Name"
msgstr ""
#: src/config.c:182
#: src/config.c:189
msgid "Desc"
msgstr ""
#: src/config.c:190
msgid "Author"
msgstr ""
#: src/config.c:184
#: src/config.c:192
msgid "Keywords"
msgstr ""

View File

@ -81,6 +81,9 @@ int config_handler(void *data, const char *section, const char *key, const char
} else if (MATCH("details", "keywords")) {
clist_from_str(&config->keywords, (char *)value);
return 1;
} else if (MATCH("details", "desc")) {
config->desc = strdup(value);
return 1;
} else if (eq((char *)section, "details")) {
goto UNKNOWN;
return 1;
@ -123,6 +126,7 @@ UNKNOWN:
void config_free(config_t *config) {
free(config->name);
free(config->desc);
free(config->author);
target_t *cur = config->t_first, *prev = NULL;
@ -137,6 +141,7 @@ void config_free(config_t *config) {
clist_free(&config->keywords);
config->name = NULL;
config->desc = NULL;
config->author = NULL;
config->t_first = NULL;
config->t_last = NULL;
@ -152,6 +157,7 @@ bool config_load(config_t *config, char *path) {
}
config->name = NULL;
config->desc = NULL;
config->author = NULL;
config->t_first = NULL;
config->t_last = NULL;
@ -179,6 +185,8 @@ bool config_load(config_t *config, char *path) {
void config_print(config_t *config) {
info(_("Configuration details:\n"));
printf(COLOR_BOLD " %s " COLOR_RESET "=> %s\n", _("Name"), config->name);
if(NULL != config->desc)
printf(COLOR_BOLD " %s " COLOR_RESET "=> %s\n", _("Desc"), config->desc);
printf(COLOR_BOLD " %s " COLOR_RESET "=> %s\n", _("Author"), config->author);
printf(COLOR_BOLD " %s " COLOR_RESET "=> ", _("Keywords"));

View File

@ -10,6 +10,7 @@ typedef struct config {
size_t t_len;
char *name;
char *desc;
char *author;
clist_t keywords;
} config_t;