From 09cd15a1e02469a045dd7e28f8e1b936ae30fd56 Mon Sep 17 00:00:00 2001 From: Boris Faure Date: Sat, 17 Oct 2020 23:33:04 +0200 Subject: [PATCH] theme: make config_theme_path_default_get() private --- src/bin/main.c | 3 +-- src/bin/termio.c | 3 +-- src/bin/theme.c | 18 ++++++++---------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/bin/main.c b/src/bin/main.c index a9924663..3e9fe7eb 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -1024,8 +1024,7 @@ elm_main(int argc, char **argv) } } - elm_theme_overlay_add(NULL, - config_theme_path_default_get(instance.config)); + elm_theme_overlay_add(NULL, theme_path_get("default")); elm_theme_overlay_add(NULL, config_theme_path_get(instance.config)); if ((!single) && (instance.config->multi_instance)) diff --git a/src/bin/termio.c b/src/bin/termio.c index 0e7d2308..ea30598d 100644 --- a/src/bin/termio.c +++ b/src/bin/termio.c @@ -2286,8 +2286,7 @@ _block_edje_activate(Evas_Object *obj, Termblock *blk) else if (!strcmp(blk->path, "THEME")) { ok = edje_object_file_set(blk->obj, - config_theme_path_default_get - (sd->config), + config_theme_path_get(sd->config), blk->link); } else diff --git a/src/bin/theme.c b/src/bin/theme.c index 9d1533fa..c401226a 100644 --- a/src/bin/theme.c +++ b/src/bin/theme.c @@ -16,13 +16,14 @@ theme_path_get(const char *name) static char path1[PATH_MAX] = ""; static char path2[PATH_MAX] = ""; - /* use the newer file */ + /* use the file from home if available */ struct stat s2; snprintf(path2, sizeof(path2) - 1, "%s/terminology/themes/%s", efreet_config_home_get(), name); - if (stat(path2, &s2) == 0) return path2; + if (stat(path2, &s2) == 0) + return path2; snprintf(path1, sizeof(path1) - 1, "%s/themes/%s", elm_app_data_dir_get(), name); return path1; @@ -40,14 +41,11 @@ config_theme_path_get(const Config *config) return theme_path_get(config->theme); } -const char * -config_theme_path_default_get(const Config *config) +static const char * +_theme_path_default_get(void) { static char path[PATH_MAX] = ""; - EINA_SAFETY_ON_NULL_RETURN_VAL(config, NULL); - EINA_SAFETY_ON_NULL_RETURN_VAL(config->theme, NULL); - if (path[0]) return path; snprintf(path, sizeof(path), "%s/themes/default.edj", @@ -76,7 +74,7 @@ theme_apply(Evas_Object *edje, const Config *config, const char *group) config_theme_path_get(config), group, errmsg); } - if (edje_object_file_set(edje, config_theme_path_default_get(config), group)) + if (edje_object_file_set(edje, _theme_path_default_get(), group)) goto done; errmsg = edje_load_error_str(edje_object_load_error_get(edje)); @@ -112,7 +110,7 @@ theme_apply_elm(Evas_Object *layout, const Config *config, const char *group) INF(_("Could not find theme: file=%s group=%s error='%s', trying default theme"), config_theme_path_get(config), group, errmsg); - if (elm_layout_file_set(layout, config_theme_path_default_get(config), group)) + if (elm_layout_file_set(layout, _theme_path_default_get(), group)) goto done; errmsg = edje_load_error_str(edje_object_load_error_get(edje)); @@ -133,7 +131,7 @@ theme_apply_default(Evas_Object *edje, const Config *config, const char *group) EINA_SAFETY_ON_NULL_RETURN_VAL(config, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(group, EINA_FALSE); - if (edje_object_file_set(edje, config_theme_path_default_get(config), group)) + if (edje_object_file_set(edje, _theme_path_default_get(), group)) return EINA_TRUE; errmsg = edje_load_error_str(edje_object_load_error_get(edje));