}
Eina_List *
-_elm_config_profiles_list(void)
+_elm_config_profiles_list(Eina_Bool hide_profiles)
{
Eina_File_Direct_Info *info;
Eina_List *flist = NULL;
len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "config");
file_it = eina_file_stat_ls(buf);
- if (!file_it)
- goto sys;
+ if (!file_it) goto sys;
buf[len] = '/';
len++;
EINA_ITERATOR_FOREACH(file_it, info)
{
- if (info->name_length >= len)
- continue;
+ if (info->name_length >= len) continue;
+ if ((hide_profiles) && (info->path[info->name_start] == '.')) continue;
if (info->type == EINA_FILE_DIR)
{
flist =
eina_list_sorted_insert(flist, _sort_files_cb,
- eina_stringshare_add(info->path +
- info->name_start));
+ eina_stringshare_add
+ (info->path + info->name_start));
}
}
sizeof("config") - 1);
file_it = eina_file_stat_ls(buf);
- if (!file_it)
- goto list_free;
+ if (!file_it) goto list_free;
buf[len] = '/';
len++;
len = sizeof(buf) - len;
EINA_ITERATOR_FOREACH(file_it, info)
{
- if (info->name_length >= len)
- continue;
+ if (info->name_length >= len) continue;
+ if ((hide_profiles) && (info->path[info->name_start] == '.')) continue;
switch (info->type)
{
case EINA_FILE_DIR:
- {
- const Eina_List *l;
- const char *tmp;
-
- EINA_LIST_FOREACH(flist, l, tmp)
- if (!strcmp(info->path + info->name_start, tmp))
- break;
+ {
+ const Eina_List *l;
+ const char *tmp;
- if (!l)
- flist =
- eina_list_sorted_insert(flist, _sort_files_cb,
- eina_stringshare_add(info->path +
- info->name_start));
- }
+ EINA_LIST_FOREACH(flist, l, tmp)
+ {
+ if (!strcmp(info->path + info->name_start, tmp)) break;
+ }
+ if (!l)
+ flist = eina_list_sorted_insert(flist, _sort_files_cb,
+ eina_stringshare_add
+ (info->path +
+ info->name_start));
+ }
break;
default:
return flist;
list_free:
- EINA_LIST_FREE(flist, dir)
- eina_stringshare_del(dir);
-
+ EINA_LIST_FREE(flist, dir) eina_stringshare_del(dir);
return NULL;
}
}
Eina_Bool
-_elm_config_save(void)
+_elm_config_save(const char *profile)
{
char buf[4096], buf2[4096];
int ok = 0, ret;
}
len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/%s",
- _elm_profile);
+ profile ? profile : _elm_profile);
if (len + 1 >= sizeof(buf))
return EINA_FALSE;
return EINA_FALSE;
}
- if (!_elm_config_profile_save())
- return EINA_FALSE;
+ if (!profile)
+ {
+ if (!_elm_config_profile_save())
+ return EINA_FALSE;
+ }
buf[len] = '/';
len++;
_elm_config->config_version = ELM_CONFIG_VERSION;
/* after updating user config, we must save */
_config_free(tcfg);
- _elm_config_save();
+ _elm_config_save(NULL);
}
static void
EAPI Eina_Bool
elm_config_save(void)
{
- return _elm_config_save();
+ return _elm_config_save(NULL);
}
EAPI void
EAPI Eina_List *
elm_config_profile_list_get(void)
{
- return _elm_config_profiles_list();
+ return _elm_config_profiles_list(EINA_TRUE);
+}
+
+EAPI Eina_List *
+elm_config_profile_list_full_get(void)
+{
+ return _elm_config_profiles_list(EINA_FALSE);
}
EAPI void
_elm_config_profile_set(profile);
}
+EAPI void
+elm_config_profile_save(const char *profile)
+{
+ EINA_SAFETY_ON_NULL_RETURN(profile);
+ _elm_config_save(profile);
+}
+
+
EAPI const char *
elm_config_engine_get(void)
{
}
ecore_file_unlink(buf2);
+ elm_config_save();
return;
err:
EAPI Eina_List *elm_config_profile_list_get(void);
/**
+ * Get Elementary's list of available profiles including hidden ones.
+ *
+ * This gets a full list of profiles even with hidden names that should not
+ * be user-visible.
+ *
+ * @return The profiles list. List node data are the profile name
+ * strings.
+ * @ingroup Profile
+ *
+ * @note One must free this list, after usage, with the function
+ * elm_config_profile_list_free().
+ * @since 1.17
+ */
+EAPI Eina_List *elm_config_profile_list_full_get(void);
+
+/**
* Free Elementary's list of available profiles.
*
* @param l The profiles list, as returned by elm_config_profile_list_get().
EAPI void elm_config_profile_set(const char *profile);
/**
+ * Take the current config and write it out to the named profile
+ *
+ * This will take the current in-memory config and write it out to the named
+ * profile specified by @p profile. This will not change profile for the
+ * application or make other processes switch profile.
+ *
+ * @param profile The profile's name
+ * @ingroup Profile
+ *
+ * @since 1.17
+ */
+EAPI void elm_config_profile_save(const char *profile);
+
+/**
* @}
*/
void _elm_config_sub_init(void);
void _elm_config_shutdown(void);
void _elm_config_sub_shutdown(void);
-Eina_Bool _elm_config_save(void);
+Eina_Bool _elm_config_save(const char *profile);
void _elm_config_reload(void);
size_t _elm_config_user_dir_snprintf(char *dst, size_t size,
const char *fmt, ...)
const char *_elm_config_current_profile_get(void);
const char *_elm_config_profile_dir_get(const char *prof,
Eina_Bool is_user);
-Eina_List *_elm_config_profiles_list(void);
+Eina_List *_elm_config_profiles_list(Eina_Bool hide_profiles);
void _elm_config_all_update(void);
void _elm_config_profile_set(const char *profile);