summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-12-31 16:37:25 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-01-05 22:24:58 +0900
commit6d448760f374638af69590d60bc8f896895240f8 (patch)
tree707ee63022eca8e9d48f4c33f7da7c3067259bfd
parent37a708d92892aeff0e8ce75c365a58d79fab5bbc (diff)
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.c19
-rw-r--r--src/lib/elm_config.h11
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)
2435 eina_stringshare_del(dir); 2435 eina_stringshare_del(dir);
2436} 2436}
2437 2437
2438EAPI Eina_Bool
2439elm_config_profile_exists(const char *profile)
2440{
2441 char buf[PATH_MAX], buf2[PATH_MAX];
2442
2443 if (!profile) return EINA_FALSE;
2444
2445 _elm_config_user_dir_snprintf(buf, sizeof(buf),
2446 "config/%s/base.cfg", profile);
2447 if (ecore_file_exists(buf)) return EINA_TRUE;
2448
2449 snprintf(buf2, sizeof(buf2), "config/%s/base.cfg", profile);
2450 eina_str_join_len(buf, sizeof(buf), '/',
2451 _elm_data_dir, strlen(_elm_data_dir),
2452 buf2, strlen(buf2));
2453 if (ecore_file_exists(buf)) return EINA_TRUE;
2454 return EINA_FALSE;
2455}
2456
2438EAPI void 2457EAPI void
2439elm_config_profile_set(const char *profile) 2458elm_config_profile_set(const char *profile)
2440{ 2459{
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);
141EAPI void elm_config_profile_list_free(Eina_List *l); 141EAPI void elm_config_profile_list_free(Eina_List *l);
142 142
143/** 143/**
144 * Return if a profile of the given name exists
145 *
146 * @return EINA_TRUE if the profile exists, or EINA_FALSE if not
147 * @param profile The profile's name
148 * @ingroup Profile
149 *
150 * @since 1.17
151 */
152EAPI Eina_Bool elm_config_profile_exists(const char *profile);
153
154/**
144 * Set Elementary's profile. 155 * Set Elementary's profile.
145 * 156 *
146 * This sets the global profile that is applied to Elementary 157 * This sets the global profile that is applied to Elementary