lib/efreet_private.h
Go to the documentation of this file.
00001 #ifndef EFREET_PRIVATE_H 00002 #define EFREET_PRIVATE_H 00003 00017 #define NEW(x, c) calloc(c, sizeof(x)) 00018 00023 #define FREE(x) do { free(x); x = NULL; } while (0) 00024 00029 #define IF_FREE(x) do { if (x) FREE(x); } while (0) 00030 00035 #define IF_RELEASE(x) do { \ 00036 if (x) { \ 00037 const char *__tmp; __tmp = (x); (x) = NULL; eina_stringshare_del(__tmp); \ 00038 } \ 00039 (x) = NULL; \ 00040 } while (0) 00041 00046 #define IF_FREE_LIST(list, free_cb) do { \ 00047 void *_data; \ 00048 EINA_LIST_FREE(list, _data) \ 00049 free_cb(_data); \ 00050 list = NULL; \ 00051 } while (0) 00052 00057 #define IF_FREE_HASH(x) do { \ 00058 if (x) { \ 00059 Eina_Hash *__tmp; __tmp = (x); (x) = NULL; eina_hash_free(__tmp); \ 00060 } \ 00061 (x) = NULL; \ 00062 } while (0) 00063 00069 extern int _efreet_log_dom_global; 00070 #ifdef EFREET_DEFAULT_LOG_COLOR 00071 #undef EFREET_DEFAULT_LOG_COLOR 00072 #endif 00073 #define EFREET_DEFAULT_LOG_COLOR "\033[36m" 00074 00075 #define EFREET_MODULE_LOG_DOM _efreet_log_dom_global /*default log domain for each module. It can redefined inside each module */ 00076 #ifdef ERROR 00077 #undef ERROR 00078 #endif 00079 #define ERROR(...) EINA_LOG_DOM_ERR(EFREET_MODULE_LOG_DOM, __VA_ARGS__) 00080 #ifdef DEBUG 00081 #undef DEBUG 00082 #endif 00083 #define DEBUG(...) EINA_LOG_DOM_DBG(EFREET_MODULE_LOG_DOM, __VA_ARGS__) 00084 #ifdef INFO 00085 #undef INFO 00086 #endif 00087 #define INFO(...) EINA_LOG_DOM_INFO(EFREET_MODULE_LOG_DOM, __VA_ARGS__) 00088 #ifdef WARN 00089 #undef WARN 00090 #endif 00091 #define WARN(...) EINA_LOG_DOM_WARN(EFREET_MODULE_LOG_DOM, __VA_ARGS__) 00092 00098 #define EFREET_MODULE_LOG_DOM _efreet_log_dom_global /*default log domain for each module. It can redefined inside each module */ 00099 #ifdef ERR 00100 #undef ERR 00101 #endif 00102 #define ERR(...) EINA_LOG_DOM_ERR(EFREET_MODULE_LOG_DOM, __VA_ARGS__) 00103 #ifdef DBG 00104 #undef DBG 00105 #endif 00106 #define DBG(...) EINA_LOG_DOM_DBG(EFREET_MODULE_LOG_DOM, __VA_ARGS__) 00107 #ifdef INF 00108 #undef INF 00109 #endif 00110 #define INF(...) EINA_LOG_DOM_INFO(EFREET_MODULE_LOG_DOM, __VA_ARGS__) 00111 #ifdef WRN 00112 #undef WRN 00113 #endif 00114 #define WRN(...) EINA_LOG_DOM_WARN(EFREET_MODULE_LOG_DOM, __VA_ARGS__) 00115 00116 extern Eina_Hash *efreet_desktop_cache; 00117 #ifdef ICON_CACHE 00118 extern Eina_Hash *efreet_icon_themes; 00119 #endif 00120 00121 #define EFREET_DESKTOP_CACHE_MAJOR 0 00122 #define EFREET_DESKTOP_CACHE_MINOR 1 00123 #define EFREET_DESKTOP_UTILS_CACHE_MAJOR 0 00124 #define EFREET_DESKTOP_UTILS_CACHE_MINOR 1 00125 00126 #ifdef ICON_CACHE 00127 #define EFREET_ICON_CACHE_MAJOR 0 00128 #define EFREET_ICON_CACHE_MINOR 4 00129 00130 typedef struct _Efreet_Cache_Icons Efreet_Cache_Icons; 00131 typedef struct _Efreet_Cache_Directory Efreet_Cache_Directory; 00132 typedef struct _Efreet_Cache_Icon Efreet_Cache_Icon; 00133 typedef struct _Efreet_Cache_Icon_Element Efreet_Cache_Icon_Element; 00134 typedef struct _Efreet_Cache_Fallback_Icon Efreet_Cache_Fallback_Icon; 00135 00136 struct _Efreet_Cache_Icons 00137 { 00138 Eina_Hash *icons; 00139 Eina_Hash *dirs; 00140 }; 00141 00142 struct _Efreet_Cache_Directory 00143 { 00144 long long modified_time; 00145 }; 00146 00147 struct _Efreet_Cache_Icon 00148 { 00149 const char *theme; 00150 00151 Efreet_Cache_Icon_Element **icons; 00152 unsigned int icons_count; 00153 }; 00154 00155 struct _Efreet_Cache_Icon_Element 00156 { 00157 const char **paths; /* possible paths for icon */ 00158 unsigned int paths_count; 00159 00160 unsigned short type; /* size type of icon */ 00161 00162 unsigned short normal; /* The size for this icon */ 00163 unsigned short min; /* The minimum size for this icon */ 00164 unsigned short max; /* The maximum size for this icon */ 00165 }; 00166 00167 struct _Efreet_Cache_Fallback_Icon 00168 { 00169 #if 0 00170 const char *name; 00171 #endif 00172 const char *theme; 00173 #if 0 00174 int context; /* the type of icon */ 00175 #endif 00176 00177 const char **icons; 00178 unsigned int icons_count; 00179 }; 00180 #endif 00181 00182 typedef struct _Efreet_Cache_Version Efreet_Cache_Version; 00183 struct _Efreet_Cache_Version 00184 { 00185 unsigned char major; 00186 unsigned char minor; 00187 }; 00188 00189 int efreet_base_init(void); 00190 void efreet_base_shutdown(void); 00191 00192 int efreet_cache_init(void); 00193 void efreet_cache_shutdown(void); 00194 00195 int efreet_icon_init(void); 00196 void efreet_icon_shutdown(void); 00197 00198 int efreet_menu_init(void); 00199 void efreet_menu_shutdown(void); 00200 EAPI Eina_List *efreet_default_dirs_get(const char *user_dir, 00201 Eina_List *system_dirs, 00202 const char *suffix); 00203 00204 int efreet_ini_init(void); 00205 void efreet_ini_shutdown(void); 00206 00207 int efreet_desktop_init(void); 00208 void efreet_desktop_shutdown(void); 00209 00210 int efreet_util_init(void); 00211 int efreet_util_shutdown(void); 00212 00213 EAPI const char *efreet_home_dir_get(void); 00214 00215 const char *efreet_lang_get(void); 00216 const char *efreet_lang_country_get(void); 00217 const char *efreet_lang_modifier_get(void); 00218 00219 size_t efreet_array_cat(char *buffer, size_t size, const char *strs[]); 00220 00221 const char *efreet_desktop_environment_get(void); 00222 00223 void efreet_util_desktop_cache_reload(void); 00224 EAPI const char *efreet_desktop_util_cache_file(void); 00225 EAPI const char *efreet_desktop_cache_file(void); 00226 EAPI const char *efreet_desktop_cache_dirs(void); 00227 int efreet_desktop_write_cache_dirs_file(void); 00228 00229 void efreet_cache_desktop_update(void); 00230 #ifdef ICON_CACHE 00231 void efreet_cache_icon_update(void); 00232 #endif 00233 void efreet_cache_desktop_free(Efreet_Desktop *desktop); 00234 Efreet_Desktop *efreet_cache_desktop_find(const char *file); 00235 00236 #ifdef ICON_CACHE 00237 EAPI const char *efreet_icon_cache_file(void); 00238 EAPI const char *efreet_icon_theme_cache_file(void); 00239 00240 EAPI void efreet_cache_icon_free(Efreet_Cache_Icon *icon); 00241 EAPI void efreet_cache_icon_fallback_free(Efreet_Cache_Fallback_Icon *icon); 00242 Efreet_Cache_Icon *efreet_cache_icon_find(Efreet_Icon_Theme *theme, const char *icon); 00243 Efreet_Cache_Fallback_Icon *efreet_cache_icon_fallback_find(const char *icon); 00244 Efreet_Icon_Theme *efreet_cache_icon_theme_find(const char *theme); 00245 void efreet_cache_icon_theme_free(Efreet_Icon_Theme *theme); 00246 char **efreet_cache_icon_theme_name_list(int *num); 00247 #endif 00248 00249 EAPI void efreet_hash_free(Eina_Hash *hash, Eina_Free_Cb free_cb); 00250 00251 #define NON_EXISTING (void *)-1 00252 00253 EAPI extern int efreet_cache_update; 00254 00259 #endif