diff options
author | Alfonso Sánchez-Beato <alfonso.sanchez-beato@canonical.com> | 2021-09-23 14:45:39 +0200 |
---|---|---|
committer | Ray Strode <halfline@gmail.com> | 2021-09-27 10:03:53 +0000 |
commit | 3fa05404b054b91c06b174b30d8c9d18aadfba17 (patch) | |
tree | c64ce33e71cd8e2e22cf2e4643227471a9ff5c74 | |
parent | a3607d7ad478f01e392a0dd3f865066010b630c9 (diff) |
main: add ThemeDir configuration option
Add a new option called ThemeDir to the configuration file, so a
configurable directory can be used to ship themes. The option applies
only to the theme specified in the same configuration file.
-rw-r--r-- | src/main.c | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -262,14 +262,19 @@ show_messages (state_t *state) } static bool -get_theme_path (const char *splash_string, - char **theme_path) +get_theme_path (const char *splash_string, + const char *configured_theme_dir, + char **theme_path) { const char *paths[] = { PLYMOUTH_RUNTIME_THEME_PATH, + configured_theme_dir, PLYMOUTH_THEME_PATH }; size_t i; for (i = 0; i < PLY_NUMBER_OF_ELEMENTS (paths); ++i) { + if (paths[i] == NULL) + continue; + asprintf (theme_path, "%s/%s/%s.plymouth", paths[i], splash_string, splash_string); @@ -303,8 +308,13 @@ load_settings (state_t *state, splash_string = ply_key_file_get_value (key_file, "Daemon", "Theme"); - if (splash_string != NULL) - get_theme_path (splash_string, theme_path); + if (splash_string != NULL) { + char *configured_theme_dir; + configured_theme_dir = ply_key_file_get_value (key_file, "Daemon", + "ThemeDir"); + get_theme_path (splash_string, configured_theme_dir, theme_path); + free (configured_theme_dir); + } if (isnan (state->splash_delay)) { state->splash_delay = ply_key_file_get_double(key_file, "Daemon", "ShowDelay", NAN); @@ -368,7 +378,7 @@ find_override_splash (state_t *state) if (splash_string != NULL) { ply_trace ("Splash is configured to be '%s'", splash_string); - get_theme_path (splash_string, &state->override_splash_path); + get_theme_path (splash_string, NULL, &state->override_splash_path); free (splash_string); } |