Use bbx prefix for shared code
This commit is contained in:
parent
6cea4e60d6
commit
1578617560
29 changed files with 224 additions and 354 deletions
|
|
@ -95,7 +95,7 @@ static void find_files(const char *path, char ***found, int *num_found) {
|
|||
/* Open directory */
|
||||
DIR *d = opendir(path);
|
||||
if (!d) {
|
||||
bb_log(BB_LOG_LEVEL_WARNING, "Could not read contents of folder %s", path);
|
||||
bbx_log(BBX_LOG_LEVEL_WARNING, "Could not read contents of folder %s", path);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ static void find_files(const char *path, char ***found, int *num_found) {
|
|||
/* Grow output array */
|
||||
char **tmp = realloc(*found, (*num_found + 1) * sizeof(char *));
|
||||
if (!tmp) {
|
||||
bb_log(BB_LOG_LEVEL_ERROR, "Could not reallocate memory for configuration file paths");
|
||||
bbx_log(BBX_LOG_LEVEL_ERROR, "Could not reallocate memory for configuration file paths");
|
||||
break;
|
||||
}
|
||||
*found = tmp;
|
||||
|
|
@ -122,7 +122,7 @@ static void find_files(const char *path, char ***found, int *num_found) {
|
|||
/* Allocate memory for full path */
|
||||
char *found_path = malloc(path_length + name_length + 2); /* +1 for path separator and null terminator, respectively */
|
||||
if (!found_path) {
|
||||
bb_log(BB_LOG_LEVEL_ERROR, "Could not allocate memory for configuration file path");
|
||||
bbx_log(BBX_LOG_LEVEL_ERROR, "Could not allocate memory for configuration file path");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -189,14 +189,14 @@ static int parsing_handler(void* user_data, const char* section, const char* key
|
|||
}
|
||||
} else if (strcmp(section, "theme") == 0) {
|
||||
if (strcmp(key, "default") == 0) {
|
||||
bb_themes_theme_id_t id = bb_themes_find_theme_with_name(value);
|
||||
if (id != BB_THEMES_THEME_NONE) {
|
||||
bbx_themes_theme_id_t id = bbx_themes_find_theme_with_name(value);
|
||||
if (id != BBX_THEMES_THEME_NONE) {
|
||||
opts->theme.default_id = id;
|
||||
return 1;
|
||||
}
|
||||
} else if (strcmp(key, "alternate") == 0) {
|
||||
bb_themes_theme_id_t id = bb_themes_find_theme_with_name(value);
|
||||
if (id != BB_THEMES_THEME_NONE) {
|
||||
bbx_themes_theme_id_t id = bbx_themes_find_theme_with_name(value);
|
||||
if (id != BBX_THEMES_THEME_NONE) {
|
||||
opts->theme.alternate_id = id;
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -231,7 +231,7 @@ static int parsing_handler(void* user_data, const char* section, const char* key
|
|||
}
|
||||
}
|
||||
|
||||
bb_log(BB_LOG_LEVEL_ERROR, "Ignoring invalid config value \"%s\" for key \"%s\" in section \"%s\"", value, key, section);
|
||||
bbx_log(BBX_LOG_LEVEL_ERROR, "Ignoring invalid config value \"%s\" for key \"%s\" in section \"%s\"", value, key, section);
|
||||
return 1; /* Return 1 (true) so that we can use the return value of ini_parse exclusively for file-level errors (e.g. file not found) */
|
||||
}
|
||||
|
||||
|
|
@ -263,8 +263,8 @@ void ul_config_init_opts(ul_config_opts *opts) {
|
|||
opts->keyboard.popovers = true;
|
||||
opts->textarea.obscured = true;
|
||||
opts->textarea.bullet = LV_SYMBOL_BULLET;
|
||||
opts->theme.default_id = BB_THEMES_THEME_BREEZY_DARK;
|
||||
opts->theme.alternate_id = BB_THEMES_THEME_BREEZY_LIGHT;
|
||||
opts->theme.default_id = BBX_THEMES_THEME_BREEZY_DARK;
|
||||
opts->theme.alternate_id = BBX_THEMES_THEME_BREEZY_LIGHT;
|
||||
opts->input.keyboard = true;
|
||||
opts->input.pointer = true;
|
||||
opts->input.touchscreen = true;
|
||||
|
|
@ -297,8 +297,8 @@ void ul_config_parse_files(const char **files, int num_files, ul_config_opts *op
|
|||
}
|
||||
|
||||
void ul_config_parse_file(const char *path, ul_config_opts *opts) {
|
||||
bb_log(BB_LOG_LEVEL_VERBOSE, "Parsing config file %s", path);
|
||||
bbx_log(BBX_LOG_LEVEL_VERBOSE, "Parsing config file %s", path);
|
||||
if (ini_parse(path, parsing_handler, opts) != 0) {
|
||||
bb_log(BB_LOG_LEVEL_ERROR, "Ignoring invalid config file %s", path);
|
||||
bbx_log(BBX_LOG_LEVEL_ERROR, "Ignoring invalid config file %s", path);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue