diff options
author | Sebastian Dransfeld <sd@tango.flipp.net> | 2012-10-21 04:53:18 +0000 |
---|---|---|
committer | Sebastian Dransfeld <sd@tango.flipp.net> | 2012-10-21 04:53:18 +0000 |
commit | 199bef6051fd5e35ded4b45e1f5319ad36cd1a6b (patch) | |
tree | 98d37a2969144aff99e7c727cb20f678dc9d25e9 /legacy | |
parent | 878bfd2616728368debf671db3d73187c0b99594 (diff) |
efreet: move common function to base
SVN revision: 78293
Diffstat (limited to 'legacy')
-rw-r--r-- | legacy/efreet/src/lib/efreet_base.c | 35 | ||||
-rw-r--r-- | legacy/efreet/src/lib/efreet_menu.c | 35 |
2 files changed, 35 insertions, 35 deletions
diff --git a/legacy/efreet/src/lib/efreet_base.c b/legacy/efreet/src/lib/efreet_base.c index 6acf42fc4b..d996a6b738 100644 --- a/legacy/efreet/src/lib/efreet_base.c +++ b/legacy/efreet/src/lib/efreet_base.c | |||
@@ -308,6 +308,41 @@ efreet_hostname_get(void) | |||
308 | return hostname; | 308 | return hostname; |
309 | } | 309 | } |
310 | 310 | ||
311 | /** | ||
312 | * @internal | ||
313 | * @param user_dir The user directory to work with | ||
314 | * @param system_dirs The system directories to work with | ||
315 | * @param suffix The path suffix to add | ||
316 | * @return Returns the list of directories | ||
317 | * @brief Creates the list of directories based on the user | ||
318 | * dir, system dirs and given suffix. | ||
319 | * | ||
320 | * Needs EAPI because of helper binaries | ||
321 | */ | ||
322 | EAPI Eina_List * | ||
323 | efreet_default_dirs_get(const char *user_dir, Eina_List *system_dirs, | ||
324 | const char *suffix) | ||
325 | { | ||
326 | const char *xdg_dir; | ||
327 | char dir[PATH_MAX]; | ||
328 | Eina_List *list = NULL; | ||
329 | Eina_List *l; | ||
330 | |||
331 | EINA_SAFETY_ON_NULL_RETURN_VAL(user_dir, NULL); | ||
332 | EINA_SAFETY_ON_NULL_RETURN_VAL(suffix, NULL); | ||
333 | |||
334 | snprintf(dir, sizeof(dir), "%s/%s", user_dir, suffix); | ||
335 | list = eina_list_append(list, eina_stringshare_add(dir)); | ||
336 | |||
337 | EINA_LIST_FOREACH(system_dirs, l, xdg_dir) | ||
338 | { | ||
339 | snprintf(dir, sizeof(dir), "%s/%s", xdg_dir, suffix); | ||
340 | list = eina_list_append(list, eina_stringshare_add(dir)); | ||
341 | } | ||
342 | |||
343 | return list; | ||
344 | } | ||
345 | |||
311 | void | 346 | void |
312 | efreet_dirs_reset(void) | 347 | efreet_dirs_reset(void) |
313 | { | 348 | { |
diff --git a/legacy/efreet/src/lib/efreet_menu.c b/legacy/efreet/src/lib/efreet_menu.c index 8cefea8ab9..fe6ebee007 100644 --- a/legacy/efreet/src/lib/efreet_menu.c +++ b/legacy/efreet/src/lib/efreet_menu.c | |||
@@ -854,41 +854,6 @@ efreet_menu_dump(Efreet_Menu *menu, const char *indent) | |||
854 | 854 | ||
855 | /** | 855 | /** |
856 | * @internal | 856 | * @internal |
857 | * @param user_dir The user directory to work with | ||
858 | * @param system_dirs The system directories to work with | ||
859 | * @param suffix The path suffix to add | ||
860 | * @return Returns the list of directories | ||
861 | * @brief Creates the list of directories based on the user | ||
862 | * dir, system dirs and given suffix. | ||
863 | * | ||
864 | * Needs EAPI because of helper binaries | ||
865 | */ | ||
866 | EAPI Eina_List * | ||
867 | efreet_default_dirs_get(const char *user_dir, Eina_List *system_dirs, | ||
868 | const char *suffix) | ||
869 | { | ||
870 | const char *xdg_dir; | ||
871 | char dir[PATH_MAX]; | ||
872 | Eina_List *list = NULL; | ||
873 | Eina_List *l; | ||
874 | |||
875 | EINA_SAFETY_ON_NULL_RETURN_VAL(user_dir, NULL); | ||
876 | EINA_SAFETY_ON_NULL_RETURN_VAL(suffix, NULL); | ||
877 | |||
878 | snprintf(dir, sizeof(dir), "%s/%s", user_dir, suffix); | ||
879 | list = eina_list_append(list, eina_stringshare_add(dir)); | ||
880 | |||
881 | EINA_LIST_FOREACH(system_dirs, l, xdg_dir) | ||
882 | { | ||
883 | snprintf(dir, sizeof(dir), "%s/%s", xdg_dir, suffix); | ||
884 | list = eina_list_append(list, eina_stringshare_add(dir)); | ||
885 | } | ||
886 | |||
887 | return list; | ||
888 | } | ||
889 | |||
890 | /** | ||
891 | * @internal | ||
892 | * @return Returns a new Efreet_Menu_Internal struct | 857 | * @return Returns a new Efreet_Menu_Internal struct |
893 | * @brief Allocates and initializes a new Efreet_Menu_Internal structure | 858 | * @brief Allocates and initializes a new Efreet_Menu_Internal structure |
894 | */ | 859 | */ |