diff --git a/src/bin/config.c b/src/bin/config.c index b270b24f..8be96c21 100644 --- a/src/bin/config.c +++ b/src/bin/config.c @@ -5,7 +5,7 @@ #include "config.h" #include "main.h" #include "col.h" -#include "utils.h" +#include "theme.h" #define CONF_VER 25 #define CONFIG_KEY "config" @@ -899,29 +899,3 @@ config_del(Config *config) free(config); } -const char * -config_theme_path_get(const Config *config) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(config, NULL); - EINA_SAFETY_ON_NULL_RETURN_VAL(config->theme, NULL); - - if (strchr(config->theme, '/')) - return config->theme; - - return theme_path_get(config->theme); -} - -const char * -config_theme_path_default_get(const Config *config) -{ - 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", - elm_app_data_dir_get()); - return path; -} diff --git a/src/bin/gravatar.c b/src/bin/gravatar.c index fbcf57a4..1aee690a 100644 --- a/src/bin/gravatar.c +++ b/src/bin/gravatar.c @@ -7,7 +7,7 @@ #include "termio.h" #include "media.h" #include "md5.h" -#include "utils.h" +#include "theme.h" /* specific log domain to help debug the gravatar module */ int _gravatar_log_dom = -1; diff --git a/src/bin/main.c b/src/bin/main.c index 8c3d5fb2..917e50b8 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -13,7 +13,7 @@ #include "config.h" #include "controls.h" #include "media.h" -#include "utils.h" +#include "theme.h" #include "ipc.h" #include "sel.h" #include "miniview.h" diff --git a/src/bin/media.c b/src/bin/media.c index 3004077e..84e8bb73 100644 --- a/src/bin/media.c +++ b/src/bin/media.c @@ -8,7 +8,7 @@ #include #include "media.h" #include "config.h" -#include "utils.h" +#include "theme.h" #include "termiolink.h" typedef struct _Media Media; diff --git a/src/bin/meson.build b/src/bin/meson.build index ef8158de..f2d38992 100644 --- a/src/bin/meson.build +++ b/src/bin/meson.build @@ -34,7 +34,7 @@ terminology_sources = ['private.h', 'md5.c', 'md5.h', 'utf8.c', 'utf8.h', 'win.c', 'win.h', - 'utils.c', 'utils.h', + 'theme.c', 'theme.h', 'extns.c', 'extns.h', 'gravatar.c', 'gravatar.h', 'tty_keys.h', @@ -59,8 +59,8 @@ tyfuzz_sources = ['termptyesc.c', 'termptyesc.h', 'config.c', 'config.h', 'col.c', 'col.h', 'sb.c', 'sb.h', + 'theme.h', 'utf8.c', 'utf8.h', - 'utils.c', 'utils.h', 'tytest_common.c', 'tytest_common.h', 'tyfuzz.c'] tytest_sources = ['termptyesc.c', 'termptyesc.h', @@ -76,7 +76,7 @@ tytest_sources = ['termptyesc.c', 'termptyesc.h', 'col.c', 'col.h', 'sb.c', 'sb.h', 'utf8.c', 'utf8.h', - 'utils.c', 'utils.h', + 'theme.h', 'md5.c', 'md5.h', 'unit_tests.h', 'tytest_common.c', 'tytest_common.h', diff --git a/src/bin/miniview.c b/src/bin/miniview.c index 6d5f4f75..4ac49d1e 100644 --- a/src/bin/miniview.c +++ b/src/bin/miniview.c @@ -10,7 +10,7 @@ #include "termio.h" #include "termiointernals.h" #include "miniview.h" -#include "utils.h" +#include "theme.h" #include "main.h" #include "backlog.h" diff --git a/src/bin/options_behavior.c b/src/bin/options_behavior.c index cd52a332..8d91f658 100644 --- a/src/bin/options_behavior.c +++ b/src/bin/options_behavior.c @@ -11,7 +11,7 @@ #include "options.h" #include "options_behavior.h" #include "main.h" -#include "utils.h" +#include "theme.h" typedef struct _Behavior_Ctx { Config *config; diff --git a/src/bin/options_elm.c b/src/bin/options_elm.c index eba1c0c5..0ff1d097 100644 --- a/src/bin/options_elm.c +++ b/src/bin/options_elm.c @@ -3,7 +3,7 @@ #include #include "options.h" #include "options_elm.h" -#include "utils.h" +#include "theme.h" static char *_elementary_config = NULL; static void diff --git a/src/bin/options_font.c b/src/bin/options_font.c index 696c3ef9..58f0716d 100644 --- a/src/bin/options_font.c +++ b/src/bin/options_font.c @@ -6,7 +6,7 @@ #include "termio.h" #include "options.h" #include "options_font.h" -#include "utils.h" +#include "theme.h" #define TEST_STRING "oislOIS.015!|," #define FONT_MIN 5 diff --git a/src/bin/options_keys.c b/src/bin/options_keys.c index 47f088f8..673f75b5 100644 --- a/src/bin/options_keys.c +++ b/src/bin/options_keys.c @@ -7,7 +7,7 @@ #include "options.h" #include "options_keys.h" #include "keyin.h" -#include "utils.h" +#include "theme.h" typedef struct _Keys_Ctx { Config *config; diff --git a/src/bin/options_theme.c b/src/bin/options_theme.c index 32ced928..2fa02d4f 100644 --- a/src/bin/options_theme.c +++ b/src/bin/options_theme.c @@ -8,7 +8,7 @@ #include "options.h" #include "options_theme.h" #include "options_themepv.h" -#include "utils.h" +#include "theme.h" #include "main.h" typedef struct _Theme_Ctx diff --git a/src/bin/options_themepv.c b/src/bin/options_themepv.c index e84e2cbd..58618a1e 100644 --- a/src/bin/options_themepv.c +++ b/src/bin/options_themepv.c @@ -6,7 +6,7 @@ #include "termpty.h" #include "options.h" #include "options_themepv.h" -#include "utils.h" +#include "theme.h" #include "main.h" #include "col.h" diff --git a/src/bin/sel.c b/src/bin/sel.c index 46a04701..da54a8f4 100644 --- a/src/bin/sel.c +++ b/src/bin/sel.c @@ -5,7 +5,7 @@ #include #include "sel.h" #include "config.h" -#include "utils.h" +#include "theme.h" #include "win.h" #include "term_container.h" diff --git a/src/bin/termcmd.c b/src/bin/termcmd.c index e038bfcb..70ff9390 100644 --- a/src/bin/termcmd.c +++ b/src/bin/termcmd.c @@ -7,7 +7,7 @@ #include "config.h" #include "controls.h" #include "media.h" -#include "utils.h" +#include "theme.h" #include "termcmd.h" static Eina_Bool diff --git a/src/bin/termio.c b/src/bin/termio.c index 64c4f57d..b07fda31 100644 --- a/src/bin/termio.c +++ b/src/bin/termio.c @@ -14,7 +14,7 @@ #include "col.h" #include "keyin.h" #include "config.h" -#include "utils.h" +#include "theme.h" #include "media.h" #include "miniview.h" #include "gravatar.h" diff --git a/src/bin/termiolink.c b/src/bin/termiolink.c index d9bc3845..69f2f358 100644 --- a/src/bin/termiolink.c +++ b/src/bin/termiolink.c @@ -11,7 +11,7 @@ #include "termio.h" #include "sb.h" #include "utf8.h" -#include "utils.h" +#include "theme.h" #else #include #include diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c index a196f411..7197956d 100644 --- a/src/bin/termptyesc.c +++ b/src/bin/termptyesc.c @@ -9,7 +9,7 @@ #include "termptyesc.h" #include "termptyops.h" #include "termptyext.h" -#include "utils.h" +#include "theme.h" #if defined(BINARY_TYTEST) #include "tytest.h" #endif diff --git a/src/bin/utils.c b/src/bin/theme.c similarity index 88% rename from src/bin/utils.c rename to src/bin/theme.c index e0d38966..0f9e4f28 100644 --- a/src/bin/utils.c +++ b/src/bin/theme.c @@ -1,5 +1,6 @@ #include "private.h" -#include "utils.h" +#include "theme.h" +#include "config.h" #include #include @@ -25,6 +26,33 @@ theme_path_get(const char *name) return path1; } +const char * +config_theme_path_get(const Config *config) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(config, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(config->theme, NULL); + + if (strchr(config->theme, '/')) + return config->theme; + + return theme_path_get(config->theme); +} + +const char * +config_theme_path_default_get(const Config *config) +{ + 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", + elm_app_data_dir_get()); + return path; +} + Eina_Bool theme_apply(Evas_Object *edje, const Config *config, const char *group) { diff --git a/src/bin/utils.h b/src/bin/theme.h similarity index 100% rename from src/bin/utils.h rename to src/bin/theme.h diff --git a/src/bin/tytest_common.c b/src/bin/tytest_common.c index 6cbfa91b..fa4e1cb7 100644 --- a/src/bin/tytest_common.c +++ b/src/bin/tytest_common.c @@ -306,6 +306,12 @@ termio_color_class_set(Evas_Object *termio EINA_UNUSED, const char *key, return -1; } +Eina_Bool +homedir_get(char *buf, size_t size) +{ + return eina_strlcpy(buf, "/home/foo", size) < size; +} + void termio_reset_main_colors(Evas_Object *termio EINA_UNUSED) { diff --git a/src/bin/win.c b/src/bin/win.c index f1368b4a..235eaa8e 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -13,7 +13,7 @@ #include "gravatar.h" #include "media.h" #include "termio.h" -#include "utils.h" +#include "theme.h" #include "sel.h" #include "controls.h" #include "keyin.h"