diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2015-12-31 16:37:25 +0900 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2016-01-05 22:24:58 +0900 |
commit | 6d448760f374638af69590d60bc8f896895240f8 (patch) | |
tree | 707ee63022eca8e9d48f4c33f7da7c3067259bfd | |
parent | 37a708d92892aeff0e8ce75c365a58d79fab5bbc (diff) | |
download | elementary-6d448760f374638af69590d60bc8f896895240f8.tar.gz |
elm config - add function to check if profile exists
this adds a method to see if a profile exists.
elm_config_profile_exists().
@feature
-rw-r--r-- | src/lib/elm_config.c | 19 | ||||
-rw-r--r-- | src/lib/elm_config.h | 11 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c index e15e8fea8..00723514d 100644 --- a/src/lib/elm_config.c +++ b/src/lib/elm_config.c @@ -2435,6 +2435,25 @@ elm_config_profile_list_free(Eina_List *l) eina_stringshare_del(dir); } +EAPI Eina_Bool +elm_config_profile_exists(const char *profile) +{ + char buf[PATH_MAX], buf2[PATH_MAX]; + + if (!profile) return EINA_FALSE; + + _elm_config_user_dir_snprintf(buf, sizeof(buf), + "config/%s/base.cfg", profile); + if (ecore_file_exists(buf)) return EINA_TRUE; + + snprintf(buf2, sizeof(buf2), "config/%s/base.cfg", profile); + eina_str_join_len(buf, sizeof(buf), '/', + _elm_data_dir, strlen(_elm_data_dir), + buf2, strlen(buf2)); + if (ecore_file_exists(buf)) return EINA_TRUE; + return EINA_FALSE; +} + EAPI void elm_config_profile_set(const char *profile) { diff --git a/src/lib/elm_config.h b/src/lib/elm_config.h index 12c2ff460..1d106153b 100644 --- a/src/lib/elm_config.h +++ b/src/lib/elm_config.h @@ -141,6 +141,17 @@ EAPI Eina_List *elm_config_profile_list_full_get(void); EAPI void elm_config_profile_list_free(Eina_List *l); /** + * Return if a profile of the given name exists + * + * @return EINA_TRUE if the profile exists, or EINA_FALSE if not + * @param profile The profile's name + * @ingroup Profile + * + * @since 1.17 + */ +EAPI Eina_Bool elm_config_profile_exists(const char *profile); + +/** * Set Elementary's profile. * * This sets the global profile that is applied to Elementary |