2007-02-03 05:05:30 -08:00
|
|
|
#ifndef EFREET_PRIVATE_H
|
|
|
|
#define EFREET_PRIVATE_H
|
|
|
|
|
2012-06-24 11:26:12 -07:00
|
|
|
#ifdef ENABLE_NLS
|
|
|
|
# include <libintl.h>
|
|
|
|
# define _(str) dgettext(PACKAGE, str)
|
|
|
|
#else
|
|
|
|
# define _(str) (str)
|
|
|
|
#endif
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
/**
|
|
|
|
* @file efreet_private.h
|
|
|
|
* @brief Contains methods and defines that are private to the Efreet
|
|
|
|
* implementaion
|
|
|
|
* @addtogroup Efreet_Private Efreet_Private: Private methods and defines
|
2012-12-29 15:04:40 -08:00
|
|
|
* @ingroup Efreet
|
2007-02-03 05:05:30 -08:00
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @def NEW(x, c)
|
|
|
|
* Allocate and zero out c structures of type x
|
|
|
|
*/
|
|
|
|
#define NEW(x, c) calloc(c, sizeof(x))
|
|
|
|
|
|
|
|
/**
|
2007-09-06 09:15:10 -07:00
|
|
|
* @def FREE(x)
|
2007-02-03 05:05:30 -08:00
|
|
|
* Free x and set to NULL
|
|
|
|
*/
|
2007-06-22 02:45:09 -07:00
|
|
|
#define FREE(x) do { free(x); x = NULL; } while (0)
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/**
|
2007-09-06 09:15:10 -07:00
|
|
|
* @def IF_FREE(x)
|
|
|
|
* If x is set, free x and set to NULL
|
2007-02-03 05:05:30 -08:00
|
|
|
*/
|
2007-06-22 02:45:09 -07:00
|
|
|
#define IF_FREE(x) do { if (x) FREE(x); } while (0)
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @def IF_RELEASE(x)
|
2008-10-15 07:48:03 -07:00
|
|
|
* If x is set, eina_stringshare_del x and set to NULL
|
2007-02-03 05:05:30 -08:00
|
|
|
*/
|
2012-10-09 10:55:34 -07:00
|
|
|
#define IF_RELEASE(x) eina_stringshare_replace(&(x), NULL)
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/**
|
2007-09-06 09:15:10 -07:00
|
|
|
* @def IF_FREE_LIST(x)
|
2007-02-03 05:05:30 -08:00
|
|
|
* If x is a valid pointer destroy x and set to NULL
|
|
|
|
*/
|
2012-10-09 10:55:34 -07:00
|
|
|
#define IF_FREE_LIST(list, free_cb) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
void *_data; \
|
|
|
|
EINA_LIST_FREE(list, _data) \
|
|
|
|
free_cb(_data); \
|
|
|
|
} \
|
|
|
|
while (0)
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
/**
|
2007-09-06 09:15:10 -07:00
|
|
|
* @def IF_FREE_HASH(x)
|
2007-02-03 05:05:30 -08:00
|
|
|
* If x is a valid pointer destroy x and set to NULL
|
|
|
|
*/
|
2007-06-22 02:45:09 -07:00
|
|
|
#define IF_FREE_HASH(x) do { \
|
|
|
|
if (x) { \
|
2008-12-17 07:33:43 -08:00
|
|
|
Eina_Hash *__tmp; __tmp = (x); (x) = NULL; eina_hash_free(__tmp); \
|
2007-06-22 02:45:09 -07:00
|
|
|
} \
|
|
|
|
(x) = NULL; \
|
|
|
|
} while (0)
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2011-02-10 06:25:44 -08:00
|
|
|
/**
|
|
|
|
* @def IF_FREE_HASH_CB(x, cb)
|
|
|
|
* If x is a valid pointer destroy x with cb and set to NULL
|
|
|
|
*/
|
|
|
|
#define IF_FREE_HASH_CB(x, cb) do { \
|
|
|
|
if (x) { \
|
|
|
|
Eina_Hash *__tmp; __tmp = (x); (x) = NULL; efreet_hash_free(__tmp, cb); \
|
|
|
|
} \
|
|
|
|
(x) = NULL; \
|
|
|
|
} while (0)
|
|
|
|
|
2009-09-21 09:36:29 -07:00
|
|
|
#ifdef EFREET_DEFAULT_LOG_COLOR
|
|
|
|
#undef EFREET_DEFAULT_LOG_COLOR
|
|
|
|
#endif
|
|
|
|
#define EFREET_DEFAULT_LOG_COLOR "\033[36m"
|
|
|
|
|
2011-02-05 11:05:55 -08:00
|
|
|
#ifndef EFREET_MODULE_LOG_DOM
|
|
|
|
#error "Need to define a log domain"
|
|
|
|
#endif
|
2009-09-21 09:36:29 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* macros that are used all around the code for message processing
|
|
|
|
* four macros are defined ERR, WRN, DGB, INF.
|
|
|
|
* EFREET_MODULE_LOG_DOM should be defined individually for each module
|
|
|
|
*/
|
2013-12-25 19:22:05 -08:00
|
|
|
#ifdef CRI
|
|
|
|
#undef CRI
|
2012-10-09 13:12:02 -07:00
|
|
|
#endif
|
2013-12-25 19:22:05 -08:00
|
|
|
#define CRI(...) EINA_LOG_DOM_CRIT(EFREET_MODULE_LOG_DOM, __VA_ARGS__)
|
2009-09-21 09:36:29 -07:00
|
|
|
#ifdef ERR
|
|
|
|
#undef ERR
|
|
|
|
#endif
|
|
|
|
#define ERR(...) EINA_LOG_DOM_ERR(EFREET_MODULE_LOG_DOM, __VA_ARGS__)
|
|
|
|
#ifdef DBG
|
|
|
|
#undef DBG
|
|
|
|
#endif
|
|
|
|
#define DBG(...) EINA_LOG_DOM_DBG(EFREET_MODULE_LOG_DOM, __VA_ARGS__)
|
|
|
|
#ifdef INF
|
|
|
|
#undef INF
|
|
|
|
#endif
|
|
|
|
#define INF(...) EINA_LOG_DOM_INFO(EFREET_MODULE_LOG_DOM, __VA_ARGS__)
|
|
|
|
#ifdef WRN
|
|
|
|
#undef WRN
|
|
|
|
#endif
|
|
|
|
#define WRN(...) EINA_LOG_DOM_WARN(EFREET_MODULE_LOG_DOM, __VA_ARGS__)
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-12-02 00:34:07 -08:00
|
|
|
typedef struct _Efreet_Cache_Icon Efreet_Cache_Icon;
|
|
|
|
typedef struct _Efreet_Cache_Icon_Element Efreet_Cache_Icon_Element;
|
|
|
|
typedef struct _Efreet_Cache_Fallback_Icon Efreet_Cache_Fallback_Icon;
|
2010-11-26 06:56:23 -08:00
|
|
|
|
|
|
|
struct _Efreet_Cache_Icon
|
2010-11-15 13:07:22 -08:00
|
|
|
{
|
2010-11-27 12:36:39 -08:00
|
|
|
const char *theme;
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2010-11-27 12:36:39 -08:00
|
|
|
Efreet_Cache_Icon_Element **icons;
|
|
|
|
unsigned int icons_count;
|
2010-11-26 06:56:23 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Efreet_Cache_Icon_Element
|
|
|
|
{
|
2010-11-27 12:36:39 -08:00
|
|
|
const char **paths; /* possible paths for icon */
|
|
|
|
unsigned int paths_count;
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2010-11-27 12:36:39 -08:00
|
|
|
unsigned short type; /* size type of icon */
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2010-11-27 12:36:39 -08:00
|
|
|
unsigned short normal; /* The size for this icon */
|
|
|
|
unsigned short min; /* The minimum size for this icon */
|
|
|
|
unsigned short max; /* The maximum size for this icon */
|
2010-11-26 06:56:23 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Efreet_Cache_Fallback_Icon
|
|
|
|
{
|
2010-11-27 12:36:39 -08:00
|
|
|
const char *theme;
|
|
|
|
const char **icons;
|
|
|
|
unsigned int icons_count;
|
2010-11-15 13:07:22 -08:00
|
|
|
};
|
|
|
|
|
2010-12-02 02:47:34 -08:00
|
|
|
typedef struct _Efreet_Cache_Version Efreet_Cache_Version;
|
|
|
|
struct _Efreet_Cache_Version
|
|
|
|
{
|
|
|
|
unsigned char major;
|
|
|
|
unsigned char minor;
|
|
|
|
};
|
|
|
|
|
2011-01-31 03:32:34 -08:00
|
|
|
typedef struct _Efreet_Cache_Hash Efreet_Cache_Hash;
|
|
|
|
struct _Efreet_Cache_Hash
|
|
|
|
{
|
|
|
|
Eina_Hash *hash;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _Efreet_Cache_Array_String Efreet_Cache_Array_String;
|
|
|
|
struct _Efreet_Cache_Array_String
|
|
|
|
{
|
|
|
|
const char **array;
|
|
|
|
unsigned int array_count;
|
|
|
|
};
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
int efreet_base_init(void);
|
|
|
|
void efreet_base_shutdown(void);
|
|
|
|
|
2010-11-15 13:07:22 -08:00
|
|
|
int efreet_cache_init(void);
|
2010-11-22 12:47:14 -08:00
|
|
|
void efreet_cache_shutdown(void);
|
2010-11-15 13:07:22 -08:00
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
int efreet_icon_init(void);
|
|
|
|
void efreet_icon_shutdown(void);
|
|
|
|
|
|
|
|
int efreet_menu_init(void);
|
|
|
|
void efreet_menu_shutdown(void);
|
2010-03-01 10:16:32 -08:00
|
|
|
EAPI Eina_List *efreet_default_dirs_get(const char *user_dir,
|
|
|
|
Eina_List *system_dirs,
|
|
|
|
const char *suffix);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
int efreet_ini_init(void);
|
2009-10-09 23:19:13 -07:00
|
|
|
void efreet_ini_shutdown(void);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
int efreet_desktop_init(void);
|
2009-10-09 23:19:13 -07:00
|
|
|
void efreet_desktop_shutdown(void);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2010-03-27 12:57:47 -07:00
|
|
|
int efreet_util_init(void);
|
|
|
|
int efreet_util_shutdown(void);
|
|
|
|
|
2011-02-10 06:23:31 -08:00
|
|
|
const char *efreet_home_dir_get(void);
|
2012-06-25 10:12:35 -07:00
|
|
|
void efreet_dirs_reset(void);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
2013-01-04 12:27:49 -08:00
|
|
|
EAPI const char *efreet_lang_get(void);
|
|
|
|
EAPI const char *efreet_lang_country_get(void);
|
|
|
|
EAPI const char *efreet_lang_modifier_get(void);
|
2012-11-26 08:07:55 -08:00
|
|
|
EAPI const char *efreet_language_get(void);
|
2007-02-03 05:05:30 -08:00
|
|
|
|
|
|
|
size_t efreet_array_cat(char *buffer, size_t size, const char *strs[]);
|
|
|
|
|
2012-08-08 12:39:55 -07:00
|
|
|
void efreet_cache_desktop_close(void);
|
2012-11-01 18:46:44 -07:00
|
|
|
void efreet_cache_desktop_build(void);
|
2010-03-01 10:16:32 -08:00
|
|
|
|
2011-02-10 06:24:40 -08:00
|
|
|
Efreet_Desktop *efreet_cache_desktop_find(const char *file);
|
|
|
|
void efreet_cache_desktop_free(Efreet_Desktop *desktop);
|
2011-02-10 06:25:23 -08:00
|
|
|
void efreet_cache_desktop_add(Efreet_Desktop *desktop);
|
2012-11-01 18:46:44 -07:00
|
|
|
void efreet_cache_icon_exts_add(Eina_List *exts);
|
|
|
|
void efreet_cache_icon_dirs_add(Eina_List *dirs);
|
2011-02-10 06:25:23 -08:00
|
|
|
Efreet_Cache_Array_String *efreet_cache_desktop_dirs(void);
|
2010-11-15 13:07:22 -08:00
|
|
|
|
2010-11-16 13:50:53 -08:00
|
|
|
Efreet_Cache_Icon *efreet_cache_icon_find(Efreet_Icon_Theme *theme, const char *icon);
|
2010-11-26 06:56:23 -08:00
|
|
|
Efreet_Cache_Fallback_Icon *efreet_cache_icon_fallback_find(const char *icon);
|
2010-12-09 00:56:56 -08:00
|
|
|
Efreet_Icon_Theme *efreet_cache_icon_theme_find(const char *theme);
|
2011-02-09 09:09:16 -08:00
|
|
|
Eina_List *efreet_cache_icon_theme_list(void);
|
2011-02-10 06:24:40 -08:00
|
|
|
|
|
|
|
Efreet_Cache_Hash *efreet_cache_util_hash_string(const char *key);
|
|
|
|
Efreet_Cache_Hash *efreet_cache_util_hash_array_string(const char *key);
|
|
|
|
Efreet_Cache_Array_String *efreet_cache_util_names(const char *key);
|
2010-11-15 13:07:22 -08:00
|
|
|
|
2011-08-18 23:50:50 -07:00
|
|
|
EAPI void efreet_cache_array_string_free(Efreet_Cache_Array_String *array);
|
|
|
|
|
2010-12-08 13:39:43 -08:00
|
|
|
EAPI void efreet_hash_free(Eina_Hash *hash, Eina_Free_Cb free_cb);
|
2011-02-07 13:33:33 -08:00
|
|
|
EAPI void efreet_setowner(const char *path);
|
|
|
|
EAPI void efreet_fsetowner(int fd);
|
2010-12-08 13:39:43 -08:00
|
|
|
|
2010-03-28 11:54:25 -07:00
|
|
|
EAPI extern int efreet_cache_update;
|
|
|
|
|
2007-02-03 05:05:30 -08:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endif
|