1 /* vim: set sw=4 ts=4 sts=4 et: */
2 #ifndef EFREET_PRIVATE_H
3 #define EFREET_PRIVATE_H
6 * @file efreet_private.h
7 * @brief Contains methods and defines that are private to the Efreet
9 * @addtogroup Efreet_Private Efreet_Private: Private methods and defines
22 #include <sys/types.h>
34 #include <Ecore_File.h>
35 #include <Ecore_Str.h>
37 #include "efreet_xml.h"
38 #include "efreet_ini.h"
42 * Allocate and zero out c structures of type x
44 #define NEW(x, c) calloc(c, sizeof(x))
48 * Free x and set to NULL
50 #define FREE(x) do { free(x); x = NULL; } while (0)
54 * If x is set, free x and set to NULL
56 #define IF_FREE(x) do { if (x) FREE(x); } while (0)
60 * If x is set, eina_stringshare_del x and set to NULL
62 #define IF_RELEASE(x) do { \
64 const char *__tmp; __tmp = (x); (x) = NULL; eina_stringshare_del(__tmp); \
70 * @def IF_FREE_LIST(x)
71 * If x is a valid pointer destroy x and set to NULL
73 #define IF_FREE_LIST(x) do { \
74 x = eina_list_free(x); \
78 * @def IF_FREE_DLIST(x)
79 * If x is a valid pointer destroy x and set to NULL
81 #define IF_FREE_DLIST(x) do { \
83 Ecore_DList *__tmp; __tmp = (x); (x) = NULL; ecore_dlist_destroy(__tmp); \
89 * @def IF_FREE_HASH(x)
90 * If x is a valid pointer destroy x and set to NULL
92 #define IF_FREE_HASH(x) do { \
94 Eina_Hash *__tmp; __tmp = (x); (x) = NULL; eina_hash_free(__tmp); \
102 * Convenience define to set the maximim path length
104 #define PATH_MAX 4096
109 * The different types of commands in an Exec entry
111 enum Efreet_Desktop_Command_Flag
113 EFREET_DESKTOP_EXEC_FLAG_FULLPATH = 0x0001,
114 EFREET_DESKTOP_EXEC_FLAG_URI = 0x0002,
115 EFREET_DESKTOP_EXEC_FLAG_DIR = 0x0004,
116 EFREET_DESKTOP_EXEC_FLAG_FILE = 0x0008
121 * Efreet_Desktop_Command_Flag
123 typedef enum Efreet_Desktop_Command_Flag Efreet_Desktop_Command_Flag;
127 * Efreet_Desktop_Command
129 typedef struct Efreet_Desktop_Command Efreet_Desktop_Command;
133 * Holds information on a desktop Exec command entry
135 struct Efreet_Desktop_Command
137 Efreet_Desktop *desktop;
140 Efreet_Desktop_Command_Flag flags;
142 Efreet_Desktop_Command_Cb cb_command;
143 Efreet_Desktop_Progress_Cb cb_progress;
146 Eina_List *files; /**< list of Efreet_Desktop_Command_File */
151 * Efreet_Desktop_Command_File
153 typedef struct Efreet_Desktop_Command_File Efreet_Desktop_Command_File;
157 * Stores information on a file passed to the desktop Exec command
159 struct Efreet_Desktop_Command_File
161 Efreet_Desktop_Command *command;
170 int efreet_base_init(void);
171 void efreet_base_shutdown(void);
173 int efreet_icon_init(void);
174 void efreet_icon_shutdown(void);
176 int efreet_menu_init(void);
177 void efreet_menu_shutdown(void);
178 Eina_List *efreet_default_dirs_get(const char *user_dir,
179 Eina_List *system_dirs,
182 int efreet_ini_init(void);
183 int efreet_ini_shutdown(void);
185 int efreet_desktop_init(void);
186 int efreet_desktop_shutdown(void);
188 const char *efreet_home_dir_get(void);
190 EAPI const char *efreet_lang_get(void);
191 EAPI const char *efreet_lang_country_get(void);
192 EAPI const char *efreet_lang_modifier_get(void);
194 size_t efreet_array_cat(char *buffer, size_t size, const char *strs[]);
196 const char *efreet_desktop_environment_get(void);
198 #define NON_EXISTING (void *)-1
200 void efreet_cache_clear(void);
201 const char *efreet_icon_hash_get(const char *theme_name, const char *icon, int size);
202 void efreet_icon_hash_put(const char *theme_name, const char *icon, int size, const char *file);