1 #ifndef EFREET_PRIVATE_H
2 #define EFREET_PRIVATE_H
6 # define _(str) dgettext(PACKAGE, str)
12 * @file efreet_private.h
13 * @brief Contains methods and defines that are private to the Efreet
15 * @addtogroup Efreet_Private Efreet_Private: Private methods and defines
22 * Allocate and zero out c structures of type x
24 #define NEW(x, c) calloc(c, sizeof(x))
28 * Free x and set to NULL
30 #define FREE(x) do { free(x); x = NULL; } while (0)
34 * If x is set, free x and set to NULL
36 #define IF_FREE(x) do { if (x) FREE(x); } while (0)
40 * If x is set, eina_stringshare_del x and set to NULL
42 #define IF_RELEASE(x) do { \
44 const char *__tmp; __tmp = (x); (x) = NULL; eina_stringshare_del(__tmp); \
50 * @def IF_FREE_LIST(x)
51 * If x is a valid pointer destroy x and set to NULL
53 #define IF_FREE_LIST(list, free_cb) do { \
55 EINA_LIST_FREE(list, _data) \
61 * @def IF_FREE_HASH(x)
62 * If x is a valid pointer destroy x and set to NULL
64 #define IF_FREE_HASH(x) do { \
66 Eina_Hash *__tmp; __tmp = (x); (x) = NULL; eina_hash_free(__tmp); \
72 * @def IF_FREE_HASH_CB(x, cb)
73 * If x is a valid pointer destroy x with cb and set to NULL
75 #define IF_FREE_HASH_CB(x, cb) do { \
77 Eina_Hash *__tmp; __tmp = (x); (x) = NULL; efreet_hash_free(__tmp, cb); \
82 #ifdef EFREET_DEFAULT_LOG_COLOR
83 #undef EFREET_DEFAULT_LOG_COLOR
85 #define EFREET_DEFAULT_LOG_COLOR "\033[36m"
87 #ifndef EFREET_MODULE_LOG_DOM
88 #error "Need to define a log domain"
92 * macros that are used all around the code for message processing
93 * four macros are defined ERR, WRN, DGB, INF.
94 * EFREET_MODULE_LOG_DOM should be defined individually for each module
99 #define ERR(...) EINA_LOG_DOM_ERR(EFREET_MODULE_LOG_DOM, __VA_ARGS__)
103 #define DBG(...) EINA_LOG_DOM_DBG(EFREET_MODULE_LOG_DOM, __VA_ARGS__)
107 #define INF(...) EINA_LOG_DOM_INFO(EFREET_MODULE_LOG_DOM, __VA_ARGS__)
111 #define WRN(...) EINA_LOG_DOM_WARN(EFREET_MODULE_LOG_DOM, __VA_ARGS__)
113 typedef struct _Efreet_Cache_Icon Efreet_Cache_Icon;
114 typedef struct _Efreet_Cache_Icon_Element Efreet_Cache_Icon_Element;
115 typedef struct _Efreet_Cache_Fallback_Icon Efreet_Cache_Fallback_Icon;
117 struct _Efreet_Cache_Icon
121 Efreet_Cache_Icon_Element **icons;
122 unsigned int icons_count;
125 struct _Efreet_Cache_Icon_Element
127 const char **paths; /* possible paths for icon */
128 unsigned int paths_count;
130 unsigned short type; /* size type of icon */
132 unsigned short normal; /* The size for this icon */
133 unsigned short min; /* The minimum size for this icon */
134 unsigned short max; /* The maximum size for this icon */
137 struct _Efreet_Cache_Fallback_Icon
141 unsigned int icons_count;
144 typedef struct _Efreet_Cache_Version Efreet_Cache_Version;
145 struct _Efreet_Cache_Version
151 typedef struct _Efreet_Cache_Hash Efreet_Cache_Hash;
152 struct _Efreet_Cache_Hash
157 typedef struct _Efreet_Cache_Array_String Efreet_Cache_Array_String;
158 struct _Efreet_Cache_Array_String
161 unsigned int array_count;
164 int efreet_base_init(void);
165 void efreet_base_shutdown(void);
167 int efreet_cache_init(void);
168 void efreet_cache_shutdown(void);
170 int efreet_icon_init(void);
171 void efreet_icon_shutdown(void);
173 int efreet_menu_init(void);
174 void efreet_menu_shutdown(void);
175 EAPI Eina_List *efreet_default_dirs_get(const char *user_dir,
176 Eina_List *system_dirs,
179 int efreet_ini_init(void);
180 void efreet_ini_shutdown(void);
182 int efreet_desktop_init(void);
183 void efreet_desktop_shutdown(void);
185 int efreet_util_init(void);
186 int efreet_util_shutdown(void);
188 const char *efreet_home_dir_get(void);
189 void efreet_dirs_reset(void);
191 const char *efreet_lang_get(void);
192 const char *efreet_lang_country_get(void);
193 const char *efreet_lang_modifier_get(void);
195 size_t efreet_array_cat(char *buffer, size_t size, const char *strs[]);
197 const char *efreet_desktop_environment_get(void);
199 void efreet_cache_desktop_update(void);
200 void efreet_cache_icon_update(void);
202 Efreet_Desktop *efreet_cache_desktop_find(const char *file);
203 void efreet_cache_desktop_free(Efreet_Desktop *desktop);
204 void efreet_cache_desktop_add(Efreet_Desktop *desktop);
205 Efreet_Cache_Array_String *efreet_cache_desktop_dirs(void);
206 void efreet_cache_desktop_reset(void);
208 Efreet_Cache_Icon *efreet_cache_icon_find(Efreet_Icon_Theme *theme, const char *icon);
209 Efreet_Cache_Fallback_Icon *efreet_cache_icon_fallback_find(const char *icon);
210 Efreet_Icon_Theme *efreet_cache_icon_theme_find(const char *theme);
211 Eina_List *efreet_cache_icon_theme_list(void);
213 Efreet_Cache_Hash *efreet_cache_util_hash_string(const char *key);
214 Efreet_Cache_Hash *efreet_cache_util_hash_array_string(const char *key);
215 Efreet_Cache_Array_String *efreet_cache_util_names(const char *key);
217 EAPI void efreet_cache_array_string_free(Efreet_Cache_Array_String *array);
219 EAPI void efreet_hash_free(Eina_Hash *hash, Eina_Free_Cb free_cb);
220 EAPI void efreet_setowner(const char *path);
221 EAPI void efreet_fsetowner(int fd);
223 EAPI extern int efreet_cache_update;