diff options
Diffstat (limited to 'desktop/system_colour.c')
-rw-r--r-- | desktop/system_colour.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/desktop/system_colour.c b/desktop/system_colour.c index 4ef170981..178c03536 100644 --- a/desktop/system_colour.c +++ b/desktop/system_colour.c @@ -21,45 +21,47 @@ * */ +#include <string.h> + +#include "utils/config.h" #include "utils/utils.h" #include "utils/log.h" #include "css/utils.h" -#include "desktop/gui.h" +#include "desktop/system_colour.h" #include "utils/nsoption.h" - #define colour_list_len ((NSOPTION_SYS_COLOUR_END - NSOPTION_SYS_COLOUR_START) + 1) static lwc_string *colour_list[colour_list_len]; -static lwc_string **gui_system_colour_pw = NULL; +static lwc_string **ns_system_colour_pw = NULL; -bool gui_system_colour_init(void) +nserror ns_system_colour_init(void) { unsigned int ccount; - if (gui_system_colour_pw != NULL) - return false; + if (ns_system_colour_pw != NULL) + return NSERROR_INIT_FAILED; /* Intern colour strings */ for (ccount = 0; ccount < colour_list_len; ccount++) { struct nsoption_s *opt; opt = &nsoptions[ccount + NSOPTION_SYS_COLOUR_START]; - if (lwc_intern_string(opt->key + SLEN("sys_colour_"), - opt->key_len - SLEN("sys_colour_"), + if (lwc_intern_string(opt->key + SLEN("sys_colour_"), + opt->key_len - SLEN("sys_colour_"), &(colour_list[ccount])) != lwc_error_ok) { - return false; + return NSERROR_NOMEM; } } - gui_system_colour_pw = colour_list; - - return true; + ns_system_colour_pw = colour_list; + + return NSERROR_OK; } -void gui_system_colour_finalize(void) +void ns_system_colour_finalize(void) { unsigned int ccount; @@ -68,7 +70,7 @@ void gui_system_colour_finalize(void) } } -colour gui_system_colour_char(const char *name) +colour ns_system_colour_char(const char *name) { colour ret = 0; unsigned int ccount; @@ -83,19 +85,19 @@ colour gui_system_colour_char(const char *name) return ret; } -css_error gui_system_colour(void *pw, lwc_string *name, css_color *colour) +css_error ns_system_colour(void *pw, lwc_string *name, css_color *colour) { unsigned int ccount; bool match; for (ccount = 0; ccount < colour_list_len; ccount++) { - if (lwc_string_caseless_isequal(name, + if (lwc_string_caseless_isequal(name, colour_list[ccount], &match) == lwc_error_ok && match) { *colour = ns_color_to_nscss(nsoptions[ccount + NSOPTION_SYS_COLOUR_START].value.c); return CSS_OK; } - } + } return CSS_INVALID; } |