shorne's patch

SVN revision: 14861
This commit is contained in:
Carsten Haitzler 2005-05-20 03:09:44 +00:00
parent fc01054161
commit 242e7b4744
14 changed files with 1081 additions and 196 deletions

View File

@ -94,6 +94,8 @@ extern EAPI E_Path *path_fonts;
extern EAPI E_Path *path_themes; extern EAPI E_Path *path_themes;
extern EAPI E_Path *path_icons; extern EAPI E_Path *path_icons;
extern EAPI E_Path *path_init; extern EAPI E_Path *path_init;
extern EAPI E_Path *path_modules;
extern EAPI E_Path *path_backgrounds;
extern EAPI int restart; extern EAPI int restart;
#endif #endif

View File

@ -31,11 +31,19 @@ static E_Config_DD *_e_config_font_default_edd = NULL;
static E_Config_DD *_e_config_theme_edd = NULL; static E_Config_DD *_e_config_theme_edd = NULL;
static E_Config_DD *_e_config_bindings_mouse_edd = NULL; static E_Config_DD *_e_config_bindings_mouse_edd = NULL;
static E_Config_DD *_e_config_bindings_key_edd = NULL; static E_Config_DD *_e_config_bindings_key_edd = NULL;
static E_Config_DD *_e_config_path_append_edd = NULL;
/* externally accessible functions */ /* externally accessible functions */
int int
e_config_init(void) e_config_init(void)
{ {
_e_config_path_append_edd = E_CONFIG_DD_NEW("E_Path_Dir", E_Path_Dir);
#undef T
#undef D
#define T E_Path_Dir
#define D _e_config_path_append_edd
E_CONFIG_VAL(D, T, dir, STR);
_e_config_theme_edd = E_CONFIG_DD_NEW("E_Config_Theme", E_Config_Theme); _e_config_theme_edd = E_CONFIG_DD_NEW("E_Config_Theme", E_Config_Theme);
#undef T #undef T
#undef D #undef D
@ -123,6 +131,14 @@ e_config_init(void)
E_CONFIG_LIST(D, T, themes, _e_config_theme_edd); /**/ E_CONFIG_LIST(D, T, themes, _e_config_theme_edd); /**/
E_CONFIG_LIST(D, T, mouse_bindings, _e_config_bindings_mouse_edd); /**/ E_CONFIG_LIST(D, T, mouse_bindings, _e_config_bindings_mouse_edd); /**/
E_CONFIG_LIST(D, T, key_bindings, _e_config_bindings_key_edd); /**/ E_CONFIG_LIST(D, T, key_bindings, _e_config_bindings_key_edd); /**/
E_CONFIG_LIST(D, T, path_append_data, _e_config_path_append_edd); /**/
E_CONFIG_LIST(D, T, path_append_images, _e_config_path_append_edd); /**/
E_CONFIG_LIST(D, T, path_append_fonts, _e_config_path_append_edd); /**/
E_CONFIG_LIST(D, T, path_append_themes, _e_config_path_append_edd); /**/
E_CONFIG_LIST(D, T, path_append_init, _e_config_path_append_edd); /**/
E_CONFIG_LIST(D, T, path_append_icons, _e_config_path_append_edd); /**/
E_CONFIG_LIST(D, T, path_append_modules, _e_config_path_append_edd); /**/
E_CONFIG_LIST(D, T, path_append_backgrounds, _e_config_path_append_edd); /**/
e_config = e_config_domain_load("e", _e_config_edd); e_config = e_config_domain_load("e", _e_config_edd);
if (e_config) if (e_config)
@ -866,7 +882,71 @@ _e_config_free(void)
E_FREE(eb->params); E_FREE(eb->params);
E_FREE(eb); E_FREE(eb);
} }
while (e_config->path_append_data)
{
E_Path_Dir *epd;
epd = e_config->path_append_data->data;
e_config->path_append_data = evas_list_remove_list(e_config->path_append_data, e_config->path_append_data);
E_FREE(epd->dir);
E_FREE(epd);
}
while (e_config->path_append_images)
{
E_Path_Dir *epd;
epd = e_config->path_append_images->data;
e_config->path_append_images = evas_list_remove_list(e_config->path_append_images, e_config->path_append_images);
E_FREE(epd->dir);
E_FREE(epd);
}
while (e_config->path_append_fonts)
{
E_Path_Dir *epd;
epd = e_config->path_append_fonts->data;
e_config->path_append_fonts = evas_list_remove_list(e_config->path_append_fonts, e_config->path_append_fonts);
E_FREE(epd->dir);
E_FREE(epd);
}
while (e_config->path_append_themes)
{
E_Path_Dir *epd;
epd = e_config->path_append_themes->data;
e_config->path_append_themes = evas_list_remove_list(e_config->path_append_themes, e_config->path_append_themes);
E_FREE(epd->dir);
E_FREE(epd);
}
while (e_config->path_append_init)
{
E_Path_Dir *epd;
epd = e_config->path_append_init->data;
e_config->path_append_init = evas_list_remove_list(e_config->path_append_init, e_config->path_append_init);
E_FREE(epd->dir);
E_FREE(epd);
}
while (e_config->path_append_icons)
{
E_Path_Dir *epd;
epd = e_config->path_append_icons->data;
e_config->path_append_icons = evas_list_remove_list(e_config->path_append_icons, e_config->path_append_icons);
E_FREE(epd->dir);
E_FREE(epd);
}
while (e_config->path_append_modules)
{
E_Path_Dir *epd;
epd = e_config->path_append_modules->data;
e_config->path_append_modules = evas_list_remove_list(e_config->path_append_modules, e_config->path_append_modules);
E_FREE(epd->dir);
E_FREE(epd);
}
while (e_config->path_append_backgrounds)
{
E_Path_Dir *epd;
epd = e_config->path_append_backgrounds->data;
e_config->path_append_backgrounds = evas_list_remove_list(e_config->path_append_backgrounds, e_config->path_append_backgrounds);
E_FREE(epd->dir);
E_FREE(epd);
}
E_FREE(e_config->desktop_default_background); E_FREE(e_config->desktop_default_background);
E_FREE(e_config->language); E_FREE(e_config->language);
E_FREE(e_config); E_FREE(e_config);

View File

@ -46,7 +46,7 @@ typedef Eet_Data_Descriptor E_Config_DD;
* defaults for e to work - started at 100 when we introduced this config * defaults for e to work - started at 100 when we introduced this config
* versioning feature * versioning feature
*/ */
#define E_CONFIG_FILE_VERSION 103 #define E_CONFIG_FILE_VERSION 104
#define E_EVAS_ENGINE_DEFAULT 0 #define E_EVAS_ENGINE_DEFAULT 0
#define E_EVAS_ENGINE_SOFTWARE_X11 1 #define E_EVAS_ENGINE_SOFTWARE_X11 1
@ -85,6 +85,15 @@ struct _E_Config
Evas_List *themes; Evas_List *themes;
Evas_List *mouse_bindings; Evas_List *mouse_bindings;
Evas_List *key_bindings; Evas_List *key_bindings;
Evas_List *path_append_data;
Evas_List *path_append_images;
Evas_List *path_append_fonts;
Evas_List *path_append_themes;
Evas_List *path_append_init;
Evas_List *path_append_icons;
Evas_List *path_append_modules;
Evas_List *path_append_backgrounds;
}; };
struct _E_Config_Module struct _E_Config_Module

View File

@ -83,12 +83,19 @@ e_font_apply(void)
Evas_List * Evas_List *
e_font_available_list(void) e_font_available_list(void)
{ {
Evas_List *available; Evas_List *dir_list;
Evas_List *next;
Evas_List *available;
dir_list = e_path_dir_list_get(path_fonts);
available = NULL; available = NULL;
/* use e_path for this */ for ( next = dir_list; next; next = next->next)
available = _e_font_font_dir_available_get(available, "~/.e/e/fonts"); {
available = _e_font_font_dir_available_get(available, PACKAGE_DATA_DIR "/data/fonts"); E_Path_Dir *epd = next->data;
available = _e_font_font_dir_available_get(available, epd->dir);
}
e_path_dir_list_free(dir_list);
return available; return available;
} }

View File

@ -7,7 +7,6 @@ static int _e_ipc_cb_client_data(void *data, int type, void *event);
static void _e_ipc_reply_double_send(Ecore_Ipc_Client *client, double val, int opcode); static void _e_ipc_reply_double_send(Ecore_Ipc_Client *client, double val, int opcode);
static void _e_ipc_reply_int_send(Ecore_Ipc_Client *client, int val, int opcode); static void _e_ipc_reply_int_send(Ecore_Ipc_Client *client, int val, int opcode);
static void _e_ipc_reply_2int_send(Ecore_Ipc_Client *client, int val1, int val2, int opcode); static void _e_ipc_reply_2int_send(Ecore_Ipc_Client *client, int val1, int val2, int opcode);
static char *_e_ipc_path_str_get(char **paths, int *bytes);
static char *_e_ipc_str_list_get(Evas_List *strs, int *bytes); static char *_e_ipc_str_list_get(Evas_List *strs, int *bytes);
static char *_e_ipc_simple_str_dec(char *data, int bytes); static char *_e_ipc_simple_str_dec(char *data, int bytes);
static char **_e_ipc_multi_str_dec(char *data, int bytes, int str_count); static char **_e_ipc_multi_str_dec(char *data, int bytes, int str_count);
@ -27,6 +26,7 @@ ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_mouse_binding_dec);
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_key_binding_list_enc); ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_key_binding_list_enc);
ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_key_binding_enc); ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_key_binding_enc);
ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_key_binding_dec); ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_key_binding_dec);
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_path_list_enc);
/* local subsystem globals */ /* local subsystem globals */
static Ecore_Ipc_Server *_e_ipc_server = NULL; static Ecore_Ipc_Server *_e_ipc_server = NULL;
@ -180,26 +180,6 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
free(data); free(data);
} }
break; break;
case E_IPC_OP_MODULE_DIRS_LIST:
{
char *dirs[] = {
PACKAGE_LIB_DIR"/enlightenment/modules",
PACKAGE_LIB_DIR"/enlightenment/modules_extra",
"~/.e/e/modules",
NULL
};
char *data;
int bytes = 0;
data = _e_ipc_path_str_get(dirs, &bytes);
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_MODULE_DIRS_LIST_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
free(data);
}
break;
case E_IPC_OP_BG_SET: case E_IPC_OP_BG_SET:
{ {
char *file; char *file;
@ -390,26 +370,6 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
} }
break; break;
case E_IPC_OP_BG_DIRS_LIST:
{
char *dirs[] = {
PACKAGE_DATA_DIR"/data/themes",
"~/.e/e/backgrounds",
"~/.e/e/themes",
NULL
};
char *data;
int bytes = 0;
data = _e_ipc_path_str_get(dirs, &bytes);
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_BG_DIRS_LIST_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
free(data);
}
break;
case E_IPC_OP_RESTART: case E_IPC_OP_RESTART:
{ {
restart = 1; restart = 1;
@ -775,6 +735,431 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
e_config->zone_desks_y_count, e_config->zone_desks_y_count,
E_IPC_OP_DESKS_GET_REPLY); E_IPC_OP_DESKS_GET_REPLY);
break; break;
/* Module PATH IPC */
case E_IPC_OP_MODULE_DIRS_LIST:
{
Evas_List *dir_list;
char *data;
int bytes = 0;
dir_list = e_path_dir_list_get(path_modules);
data = _e_ipc_path_list_enc(dir_list, &bytes);
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_MODULE_DIRS_LIST_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
e_path_dir_list_free(dir_list);
free(data);
break;
}
case E_IPC_OP_MODULE_DIRS_APPEND:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_append(path_modules, dir);
free(dir);
e_config_save_queue();
break;
}
case E_IPC_OP_MODULE_DIRS_PREPEND:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_prepend(path_modules, dir);
free(dir);
e_config_save_queue();
break;
}
case E_IPC_OP_MODULE_DIRS_REMOVE:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_remove(path_modules, dir);
free(dir);
e_config_save_queue();
break;
}
/* Theme PATH IPC */
case E_IPC_OP_THEME_DIRS_LIST:
{
Evas_List *dir_list;
char *data;
int bytes = 0;
dir_list = e_path_dir_list_get(path_themes);
data = _e_ipc_path_list_enc(dir_list, &bytes);
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_THEME_DIRS_LIST_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
e_path_dir_list_free(dir_list);
free(data);
break;
}
case E_IPC_OP_THEME_DIRS_APPEND:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_append(path_themes, dir);
free(dir);
e_config_save_queue();
break;
}
case E_IPC_OP_THEME_DIRS_PREPEND:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_prepend(path_themes, dir);
free(dir);
e_config_save_queue();
break;
}
case E_IPC_OP_THEME_DIRS_REMOVE:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_remove(path_themes, dir);
free(dir);
e_config_save_queue();
break;
}
/* Font Path IPC */
case E_IPC_OP_FONT_DIRS_LIST:
{
Evas_List *dir_list;
char *data;
int bytes = 0;
dir_list = e_path_dir_list_get(path_fonts);
data = _e_ipc_path_list_enc(dir_list, &bytes);
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_FONT_DIRS_LIST_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
e_path_dir_list_free(dir_list);
free(data);
break;
}
case E_IPC_OP_FONT_DIRS_APPEND:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_append(path_fonts, dir);
free(dir);
e_config_save_queue();
break;
}
case E_IPC_OP_FONT_DIRS_PREPEND:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_prepend(path_fonts, dir);
free(dir);
e_config_save_queue();
break;
}
case E_IPC_OP_FONT_DIRS_REMOVE:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_remove(path_fonts, dir);
free(dir);
e_config_save_queue();
break;
}
/* data Path IPC */
case E_IPC_OP_DATA_DIRS_LIST:
{
Evas_List *dir_list;
char *data;
int bytes = 0;
dir_list = e_path_dir_list_get(path_data);
data = _e_ipc_path_list_enc(dir_list, &bytes);
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_DATA_DIRS_LIST_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
e_path_dir_list_free(dir_list);
free(data);
break;
}
case E_IPC_OP_DATA_DIRS_APPEND:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_append(path_data, dir);
free(dir);
e_config_save_queue();
break;
}
case E_IPC_OP_DATA_DIRS_PREPEND:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_prepend(path_data, dir);
free(dir);
e_config_save_queue();
break;
}
case E_IPC_OP_DATA_DIRS_REMOVE:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_remove(path_data, dir);
free(dir);
e_config_save_queue();
break;
}
/* Images Path IPC */
case E_IPC_OP_IMAGE_DIRS_LIST:
{
Evas_List *dir_list;
char *data;
int bytes = 0;
dir_list = e_path_dir_list_get(path_images);
data = _e_ipc_path_list_enc(dir_list, &bytes);
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_IMAGE_DIRS_LIST_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
e_path_dir_list_free(dir_list);
free(data);
break;
}
case E_IPC_OP_IMAGE_DIRS_APPEND:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_append(path_images, dir);
free(dir);
e_config_save_queue();
break;
}
case E_IPC_OP_IMAGE_DIRS_PREPEND:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_prepend(path_images, dir);
free(dir);
e_config_save_queue();
break;
}
case E_IPC_OP_IMAGE_DIRS_REMOVE:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_remove(path_images, dir);
free(dir);
e_config_save_queue();
break;
}
/* Init Path IPC */
case E_IPC_OP_INIT_DIRS_LIST:
{
Evas_List *dir_list;
char *data;
int bytes = 0;
dir_list = e_path_dir_list_get(path_init);
data = _e_ipc_path_list_enc(dir_list, &bytes);
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_INIT_DIRS_LIST_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
e_path_dir_list_free(dir_list);
free(data);
break;
}
case E_IPC_OP_INIT_DIRS_APPEND:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_append(path_init, dir);
free(dir);
e_config_save_queue();
break;
}
case E_IPC_OP_INIT_DIRS_PREPEND:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_prepend(path_init, dir);
free(dir);
e_config_save_queue();
break;
}
case E_IPC_OP_INIT_DIRS_REMOVE:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_remove(path_init, dir);
free(dir);
e_config_save_queue();
break;
}
/* Icon Path IPC */
case E_IPC_OP_ICON_DIRS_LIST:
{
Evas_List *dir_list;
char *data;
int bytes = 0;
dir_list = e_path_dir_list_get(path_icons);
data = _e_ipc_path_list_enc(dir_list, &bytes);
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_ICON_DIRS_LIST_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
e_path_dir_list_free(dir_list);
free(data);
break;
}
case E_IPC_OP_ICON_DIRS_APPEND:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_append(path_icons, dir);
free(dir);
e_config_save_queue();
break;
}
case E_IPC_OP_ICON_DIRS_PREPEND:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_prepend(path_icons, dir);
free(dir);
e_config_save_queue();
break;
}
case E_IPC_OP_ICON_DIRS_REMOVE:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_remove(path_icons, dir);
free(dir);
e_config_save_queue();
break;
}
/* Icon Path IPC */
case E_IPC_OP_BG_DIRS_LIST:
{
Evas_List *dir_list;
char *data;
int bytes = 0;
dir_list = e_path_dir_list_get(path_backgrounds);
data = _e_ipc_path_list_enc(dir_list, &bytes);
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_BG_DIRS_LIST_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
e_path_dir_list_free(dir_list);
free(data);
break;
}
case E_IPC_OP_BG_DIRS_APPEND:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_append(path_backgrounds, dir);
free(dir);
e_config_save_queue();
break;
}
case E_IPC_OP_BG_DIRS_PREPEND:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_prepend(path_backgrounds, dir);
free(dir);
e_config_save_queue();
break;
}
case E_IPC_OP_BG_DIRS_REMOVE:
{
char * dir;
dir = _e_ipc_simple_str_dec(e->data, e->size);
e_path_user_path_remove(path_backgrounds, dir);
free(dir);
e_config_save_queue();
break;
}
default: default:
break; break;
} }
@ -838,39 +1223,6 @@ _e_ipc_reply_2int_send(Ecore_Ipc_Client *client, int val1, int val2, int opcode)
} }
} }
/*
* FIXME: This dosen't handle the case where one of the paths is of the
* form: ~moo/bar/baz need to figure out the correct path to the
* specified users homedir
*/
static char *
_e_ipc_path_str_get(char **paths, int *bytes)
{
char *data = NULL, **cur, *home;
int pos = 0;
char tmp[PATH_MAX];
*bytes = 0;
home = e_user_homedir_get();
for (cur = paths; *cur != NULL; cur++)
{
char *p;
p = *cur;
if (*p == '~') snprintf(tmp, PATH_MAX, "%s%s", home, ++p);
else snprintf(tmp, PATH_MAX, "%s", p);
*bytes += strlen(tmp) + 1;
data = realloc(data, *bytes);
memcpy(data + pos, tmp, strlen(tmp));
pos = *bytes;
data[pos - 1] = 0;
}
free(home);
return data;
}
/** /**
* Encode a list of strings into a flattened data block that looks like * Encode a list of strings into a flattened data block that looks like
* <str>0<str>0... (ie string chars - nul byte in between until the end) * <str>0<str>0... (ie string chars - nul byte in between until the end)
@ -1126,3 +1478,13 @@ ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_key_binding_dec)
ECORE_IPC_DEC_STRUCT_FOOT(); ECORE_IPC_DEC_STRUCT_FOOT();
} }
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_path_list_enc)
{
ECORE_IPC_ENC_EVAS_LIST_HEAD_START(E_Path_Dir);
ECORE_IPC_CNTS(dir);
ECORE_IPC_ENC_EVAS_LIST_HEAD_FINISH();
int l1;
ECORE_IPC_SLEN(l1, dir);
ECORE_IPC_PUTS(dir, l1);
ECORE_IPC_ENC_EVAS_LIST_FOOT();
}

View File

@ -22,13 +22,10 @@ typedef enum _E_Ipc_Op
E_IPC_OP_MODULE_DISABLE, E_IPC_OP_MODULE_DISABLE,
E_IPC_OP_MODULE_LIST, E_IPC_OP_MODULE_LIST,
E_IPC_OP_MODULE_LIST_REPLY, E_IPC_OP_MODULE_LIST_REPLY,
E_IPC_OP_MODULE_DIRS_LIST,
E_IPC_OP_MODULE_DIRS_LIST_REPLY,
E_IPC_OP_BG_SET, E_IPC_OP_BG_SET,
E_IPC_OP_BG_GET, E_IPC_OP_BG_GET,
E_IPC_OP_BG_GET_REPLY, E_IPC_OP_BG_GET_REPLY,
E_IPC_OP_BG_DIRS_LIST,
E_IPC_OP_BG_DIRS_LIST_REPLY,
E_IPC_OP_FONT_AVAILABLE_LIST, E_IPC_OP_FONT_AVAILABLE_LIST,
E_IPC_OP_FONT_AVAILABLE_LIST_REPLY, E_IPC_OP_FONT_AVAILABLE_LIST_REPLY,
E_IPC_OP_FONT_APPLY, E_IPC_OP_FONT_APPLY,
@ -92,14 +89,69 @@ typedef enum _E_Ipc_Op
E_IPC_OP_EDGE_FLIP_TIMEOUT_SET, E_IPC_OP_EDGE_FLIP_TIMEOUT_SET,
E_IPC_OP_EDGE_FLIP_TIMEOUT_GET, E_IPC_OP_EDGE_FLIP_TIMEOUT_GET,
E_IPC_OP_EDGE_FLIP_TIMEOUT_GET_REPLY, E_IPC_OP_EDGE_FLIP_TIMEOUT_GET_REPLY,
/* Module PATH IPC */
E_IPC_OP_MODULE_DIRS_LIST,
E_IPC_OP_MODULE_DIRS_LIST_REPLY,
E_IPC_OP_MODULE_DIRS_APPEND,
E_IPC_OP_MODULE_DIRS_PREPEND,
E_IPC_OP_MODULE_DIRS_REMOVE,
/* Theme PATH IPC */
E_IPC_OP_THEME_DIRS_LIST,
E_IPC_OP_THEME_DIRS_LIST_REPLY,
E_IPC_OP_THEME_DIRS_APPEND,
E_IPC_OP_THEME_DIRS_PREPEND,
E_IPC_OP_THEME_DIRS_REMOVE,
/* Font Path IPC */
E_IPC_OP_FONT_DIRS_LIST,
E_IPC_OP_FONT_DIRS_LIST_REPLY,
E_IPC_OP_FONT_DIRS_APPEND,
E_IPC_OP_FONT_DIRS_PREPEND,
E_IPC_OP_FONT_DIRS_REMOVE,
/* data Path IPC */
E_IPC_OP_DATA_DIRS_LIST,
E_IPC_OP_DATA_DIRS_LIST_REPLY,
E_IPC_OP_DATA_DIRS_APPEND,
E_IPC_OP_DATA_DIRS_PREPEND,
E_IPC_OP_DATA_DIRS_REMOVE,
/* Images Path IPC */
E_IPC_OP_IMAGE_DIRS_LIST,
E_IPC_OP_IMAGE_DIRS_LIST_REPLY,
E_IPC_OP_IMAGE_DIRS_APPEND,
E_IPC_OP_IMAGE_DIRS_PREPEND,
E_IPC_OP_IMAGE_DIRS_REMOVE,
/* Init Path IPC */
E_IPC_OP_INIT_DIRS_LIST,
E_IPC_OP_INIT_DIRS_LIST_REPLY,
E_IPC_OP_INIT_DIRS_APPEND,
E_IPC_OP_INIT_DIRS_PREPEND,
E_IPC_OP_INIT_DIRS_REMOVE,
/* Icon Path IPC */
E_IPC_OP_ICON_DIRS_LIST,
E_IPC_OP_ICON_DIRS_LIST_REPLY,
E_IPC_OP_ICON_DIRS_APPEND,
E_IPC_OP_ICON_DIRS_PREPEND,
E_IPC_OP_ICON_DIRS_REMOVE,
/* Background Path IPC */
E_IPC_OP_BG_DIRS_LIST,
E_IPC_OP_BG_DIRS_LIST_REPLY,
E_IPC_OP_BG_DIRS_APPEND,
E_IPC_OP_BG_DIRS_PREPEND,
E_IPC_OP_BG_DIRS_REMOVE,
E_IPC_OP_DESKS_SET, E_IPC_OP_DESKS_SET,
E_IPC_OP_DESKS_GET, E_IPC_OP_DESKS_GET,
E_IPC_OP_DESKS_GET_REPLY, E_IPC_OP_DESKS_GET_REPLY,
E_IPC_OP_LAST E_IPC_OP_LAST
/* FIXME: add ipc: */ /* FIXME: add ipc: */
/* get list of actions */ /* get list of actions */
/* get list of paths */
/* add/del extra paths */
} E_Ipc_Op; } E_Ipc_Op;
#else #else

View File

@ -33,6 +33,8 @@ E_Path *path_fonts = NULL;
E_Path *path_themes = NULL; E_Path *path_themes = NULL;
E_Path *path_init = NULL; E_Path *path_init = NULL;
E_Path *path_icons = NULL; E_Path *path_icons = NULL;
E_Path *path_modules = NULL;
E_Path *path_backgrounds = NULL;
int restart = 0; int restart = 0;
int good = 0; int good = 0;
int evil = 0; int evil = 0;
@ -284,6 +286,13 @@ main(int argc, char **argv)
_e_main_shutdown(-1); _e_main_shutdown(-1);
} }
_e_main_shutdown_push(_e_main_dirs_shutdown); _e_main_shutdown_push(_e_main_dirs_shutdown);
/* init config system */
if (!e_config_init())
{
e_error_message_show(_("Enlightenment cannot set up its config system."));
_e_main_shutdown(-1);
}
_e_main_shutdown_push(e_config_shutdown);
/* setup paths for finding things */ /* setup paths for finding things */
if (!_e_main_path_init()) if (!_e_main_path_init())
{ {
@ -292,13 +301,6 @@ main(int argc, char **argv)
_e_main_shutdown(-1); _e_main_shutdown(-1);
} }
_e_main_shutdown_push(_e_main_path_shutdown); _e_main_shutdown_push(_e_main_path_shutdown);
/* init config system */
if (!e_config_init())
{
e_error_message_show(_("Enlightenment cannot set up its config system."));
_e_main_shutdown(-1);
}
_e_main_shutdown_push(e_config_shutdown);
/* init actions system */ /* init actions system */
if (!e_actions_init()) if (!e_actions_init())
{ {
@ -683,53 +685,93 @@ _e_main_screens_shutdown(void)
static int static int
_e_main_path_init(void) _e_main_path_init(void)
{ {
/* setup data paths */
path_data = e_path_new(); path_data = e_path_new();
if (!path_data) if (!path_data)
{ {
e_error_message_show("Cannot allocate path for path_data\n"); e_error_message_show("Cannot allocate path for path_data\n");
return 0; return 0;
} }
e_path_path_append(path_data, PACKAGE_DATA_DIR"/data"); e_path_default_path_append(path_data, PACKAGE_DATA_DIR"/data");
e_path_user_path_set(path_data, &(e_config->path_append_data));
/* setup image paths */
path_images = e_path_new(); path_images = e_path_new();
if (!path_images) if (!path_images)
{ {
e_error_message_show("Cannot allocate path for path_images\n"); e_error_message_show("Cannot allocate path for path_images\n");
return 0; return 0;
} }
e_path_path_append(path_images, "~/.e/e/images"); e_path_default_path_append(path_images, "~/.e/e/images");
e_path_path_append(path_images, PACKAGE_DATA_DIR"/data/images"); e_path_default_path_append(path_images, PACKAGE_DATA_DIR"/data/images");
e_path_user_path_set(path_images, &(e_config->path_append_images));
/* setup font paths */
path_fonts = e_path_new(); path_fonts = e_path_new();
if (!path_fonts) if (!path_fonts)
{ {
e_error_message_show("Cannot allocate path for path_fonts\n"); e_error_message_show("Cannot allocate path for path_fonts\n");
return 0; return 0;
} }
e_path_path_append(path_fonts, "~/.e/e/fonts"); e_path_default_path_append(path_fonts, "~/.e/e/fonts");
e_path_path_append(path_fonts, PACKAGE_DATA_DIR"/data/fonts"); e_path_default_path_append(path_fonts, PACKAGE_DATA_DIR"/data/fonts");
e_path_user_path_set(path_fonts, &(e_config->path_append_fonts));
/* setup theme paths */
path_themes = e_path_new(); path_themes = e_path_new();
if (!path_themes) if (!path_themes)
{ {
e_error_message_show("Cannot allocate path for path_themes\n"); e_error_message_show("Cannot allocate path for path_themes\n");
return 0; return 0;
} }
e_path_path_append(path_themes, "~/.e/e/themes"); e_path_default_path_append(path_themes, "~/.e/e/themes");
e_path_path_append(path_themes, PACKAGE_DATA_DIR"/data/themes"); e_path_default_path_append(path_themes, PACKAGE_DATA_DIR"/data/themes");
e_path_user_path_set(path_themes, &(e_config->path_append_themes));
/* setup icon paths */
path_icons = e_path_new(); path_icons = e_path_new();
if (!path_icons) if (!path_icons)
{ {
e_error_message_show("Cannot allocate path for path_icons\n"); e_error_message_show("Cannot allocate path for path_icons\n");
return 0; return 0;
} }
e_path_path_append(path_icons, "~/.e/e/icons"); e_path_default_path_append(path_icons, "~/.e/e/icons");
e_path_path_append(path_icons, PACKAGE_DATA_DIR"/data/icons"); e_path_default_path_append(path_icons, PACKAGE_DATA_DIR"/data/icons");
e_path_user_path_set(path_icons, &(e_config->path_append_icons));
/* setup init paths */
path_init = e_path_new(); path_init = e_path_new();
if (!path_init) if (!path_init)
{ {
e_error_message_show("Cannot allocate path for path_init\n"); e_error_message_show("Cannot allocate path for path_init\n");
return 0; return 0;
} }
e_path_path_append(path_init, "~/.e/e/init"); e_path_default_path_append(path_init, "~/.e/e/init");
e_path_path_append(path_init, PACKAGE_DATA_DIR"/data/init"); e_path_default_path_append(path_init, PACKAGE_DATA_DIR"/data/init");
e_path_user_path_set(path_init, &(e_config->path_append_init));
/* setup module paths */
path_modules = e_path_new();
if (!path_modules)
{
e_error_message_show("Cannot allocate path for path_modules\n");
return 0;
}
e_path_default_path_append(path_modules, "~/.e/e/modules");
e_path_default_path_append(path_modules, PACKAGE_LIB_DIR"/enlightenment/modules");
e_path_default_path_append(path_modules, PACKAGE_LIB_DIR"/enlightenment/modules_extra");
e_path_user_path_set(path_modules, &(e_config->path_append_modules));
/* setup background paths */
path_backgrounds = e_path_new();
if (!path_backgrounds)
{
e_error_message_show("Cannot allocate path for path_backgrounds\n");
return 0;
}
e_path_default_path_append(path_backgrounds, "~/.e/e/backgrounds");
e_path_user_path_set(path_backgrounds, &(e_config->path_append_backgrounds));
return 1; return 1;
} }
@ -766,6 +808,16 @@ _e_main_path_shutdown(void)
e_object_del(E_OBJECT(path_init)); e_object_del(E_OBJECT(path_init));
path_init = NULL; path_init = NULL;
} }
if (path_modules)
{
e_object_del(E_OBJECT(path_modules));
path_modules = NULL;
}
if (path_backgrounds)
{
e_object_del(E_OBJECT(path_backgrounds));
path_backgrounds = NULL;
}
return 1; return 1;
} }

View File

@ -106,6 +106,8 @@ e_manager_manage_windows(E_Manager *man)
Ecore_X_Window *windows; Ecore_X_Window *windows;
int wnum; int wnum;
/* a manager is designated for each root. lets get all the windows in
the managers root */
windows = ecore_x_window_children_get(man->root, &wnum); windows = ecore_x_window_children_get(man->root, &wnum);
if (windows) if (windows)
{ {

View File

@ -410,7 +410,7 @@ e_menu_item_num_get(E_Menu_Item *mi)
} }
void void
e_menu_item_icon_file_set(E_Menu_Item *mi, char *icon) e_menu_item_icon_file_set(E_Menu_Item *mi, const char *icon)
{ {
E_OBJECT_CHECK(mi); E_OBJECT_CHECK(mi);
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE); E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
@ -427,7 +427,7 @@ e_menu_item_icon_file_set(E_Menu_Item *mi, char *icon)
} }
void void
e_menu_item_icon_edje_set(E_Menu_Item *mi, char *icon, char *key) e_menu_item_icon_edje_set(E_Menu_Item *mi, const char *icon, const char *key)
{ {
E_OBJECT_CHECK(mi); E_OBJECT_CHECK(mi);
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE); E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
@ -446,7 +446,7 @@ e_menu_item_icon_edje_set(E_Menu_Item *mi, char *icon, char *key)
} }
void void
e_menu_item_label_set(E_Menu_Item *mi, char *label) e_menu_item_label_set(E_Menu_Item *mi, const char *label)
{ {
E_OBJECT_CHECK(mi); E_OBJECT_CHECK(mi);
E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE); E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);

View File

@ -146,9 +146,9 @@ EAPI E_Menu *e_menu_root_get(E_Menu *m);
EAPI E_Menu_Item *e_menu_item_new(E_Menu *m); EAPI E_Menu_Item *e_menu_item_new(E_Menu *m);
EAPI E_Menu_Item *e_menu_item_nth(E_Menu *m, int n); EAPI E_Menu_Item *e_menu_item_nth(E_Menu *m, int n);
EAPI int e_menu_item_num_get(E_Menu_Item *mi); EAPI int e_menu_item_num_get(E_Menu_Item *mi);
EAPI void e_menu_item_icon_file_set(E_Menu_Item *mi, char *icon); EAPI void e_menu_item_icon_file_set(E_Menu_Item *mi, const char *icon);
EAPI void e_menu_item_icon_edje_set(E_Menu_Item *mi, char *icon, char *key); EAPI void e_menu_item_icon_edje_set(E_Menu_Item *mi, const char *icon, const char *key);
EAPI void e_menu_item_label_set(E_Menu_Item *mi, char *label); EAPI void e_menu_item_label_set(E_Menu_Item *mi, const char *label);
EAPI void e_menu_item_submenu_set(E_Menu_Item *mi, E_Menu *sub); EAPI void e_menu_item_submenu_set(E_Menu_Item *mi, E_Menu *sub);
EAPI void e_menu_item_separator_set(E_Menu_Item *mi, int sep); EAPI void e_menu_item_separator_set(E_Menu_Item *mi, int sep);
EAPI void e_menu_item_check_set(E_Menu_Item *mi, int chk); EAPI void e_menu_item_check_set(E_Menu_Item *mi, int chk);

View File

@ -26,7 +26,6 @@ static void _e_module_control_menu_enabled(void *data, E_Menu *m, E_Menu_Item *m
/* local subsystem globals */ /* local subsystem globals */
static Evas_List *_e_modules = NULL; static Evas_List *_e_modules = NULL;
static E_Path *_e_path_modules = NULL;
static E_Module_Api _e_module_api = static E_Module_Api _e_module_api =
{ {
@ -39,12 +38,6 @@ e_module_init(void)
{ {
Evas_List *pl = NULL, *l; Evas_List *pl = NULL, *l;
_e_path_modules = e_path_new();
if (!_e_path_modules) return 0;
e_path_path_append(_e_path_modules, "~/.e/e/modules");
e_path_path_append(_e_path_modules, PACKAGE_LIB_DIR"/enlightenment/modules");
e_path_path_append(_e_path_modules, PACKAGE_LIB_DIR"/enlightenment/modules_extra");
for (l = e_config->modules; l;) for (l = e_config->modules; l;)
{ {
E_Config_Module *em; E_Config_Module *em;
@ -80,8 +73,6 @@ e_module_shutdown(void)
l = l->next; l = l->next;
e_object_del(E_OBJECT(tmp->data)); e_object_del(E_OBJECT(tmp->data));
} }
e_object_del(E_OBJECT(_e_path_modules));
_e_path_modules = NULL;
return 1; return 1;
} }
@ -100,7 +91,7 @@ e_module_new(char *name)
if (name[0] != '/') if (name[0] != '/')
{ {
snprintf(buf, sizeof(buf), "%s/%s/module.so", name, MODULE_ARCH); snprintf(buf, sizeof(buf), "%s/%s/module.so", name, MODULE_ARCH);
modpath = e_path_find(_e_path_modules, buf); modpath = e_path_find(path_modules, buf);
} }
else else
modpath = name; modpath = name;

View File

@ -22,13 +22,14 @@ e_path_new(void)
} }
void void
e_path_path_append(E_Path *ep, const char *path) e_path_default_path_append(E_Path *ep, const char *path)
{ {
E_OBJECT_CHECK(ep); E_OBJECT_CHECK(ep);
E_OBJECT_TYPE_CHECK(ep, E_PATH_TYPE); E_OBJECT_TYPE_CHECK(ep, E_PATH_TYPE);
if (!path) return; if (!path) return;
if (path[0] == '~') if (path[0] == '~')
{ {
E_Path_Dir *epd;
char *new_path; char *new_path;
char *home_dir; char *home_dir;
int len1, len2; int len1, len2;
@ -43,24 +44,52 @@ e_path_path_append(E_Path *ep, const char *path)
free(home_dir); free(home_dir);
return; return;
} }
epd = malloc(sizeof(E_Path_Dir));
if (!epd)
{
free(home_dir);
free(new_path);
return;
}
epd->dir = new_path;
strcpy(new_path, home_dir); strcpy(new_path, home_dir);
strcat(new_path, path + 1); strcat(new_path, path + 1);
free(home_dir); free(home_dir);
ep->dir_list = evas_list_append(ep->dir_list, new_path); ep->default_dir_list = evas_list_append(ep->default_dir_list, epd);
} }
else else
ep->dir_list = evas_list_append(ep->dir_list, strdup(path)); {
E_Path_Dir *epd;
epd = malloc(sizeof(E_Path_Dir));
if (!epd)
return;
epd->dir = strdup(path);
ep->default_dir_list = evas_list_append(ep->default_dir_list, epd);
}
_e_path_cache_free(ep); _e_path_cache_free(ep);
} }
void void
e_path_path_prepend(E_Path *ep, const char *path) e_path_user_path_set(E_Path *ep, Evas_List **user_dir_list)
{
E_OBJECT_CHECK(ep);
E_OBJECT_TYPE_CHECK(ep, E_PATH_TYPE);
ep->user_dir_list = user_dir_list;
_e_path_cache_free(ep);
}
void
e_path_user_path_append(E_Path *ep, const char *path)
{ {
E_OBJECT_CHECK(ep); E_OBJECT_CHECK(ep);
E_OBJECT_TYPE_CHECK(ep, E_PATH_TYPE); E_OBJECT_TYPE_CHECK(ep, E_PATH_TYPE);
if (!path) return; if (!path) return;
if (path[0] == '~') if (path[0] == '~')
{ {
E_Path_Dir *epd;
char *new_path; char *new_path;
char *home_dir; char *home_dir;
int len1, len2; int len1, len2;
@ -75,18 +104,83 @@ e_path_path_prepend(E_Path *ep, const char *path)
free(home_dir); free(home_dir);
return; return;
} }
epd = malloc(sizeof(E_Path_Dir));
if (!epd)
{
free(home_dir);
free(new_path);
return;
}
epd->dir = new_path;
strcpy(new_path, home_dir); strcpy(new_path, home_dir);
strcat(new_path, path + 1); strcat(new_path, path + 1);
free(home_dir); free(home_dir);
ep->dir_list = evas_list_prepend(ep->dir_list, new_path); *(ep->user_dir_list) = evas_list_append(*(ep->user_dir_list), epd);
} }
else else
ep->dir_list = evas_list_prepend(ep->dir_list, strdup(path)); {
E_Path_Dir *epd;
epd = malloc(sizeof(E_Path_Dir));
if (!epd)
return;
epd->dir = strdup(path);
*(ep->user_dir_list) = evas_list_append(*(ep->user_dir_list), epd);
}
_e_path_cache_free(ep); _e_path_cache_free(ep);
} }
void void
e_path_path_remove(E_Path *ep, const char *path) e_path_user_path_prepend(E_Path *ep, const char *path)
{
E_OBJECT_CHECK(ep);
E_OBJECT_TYPE_CHECK(ep, E_PATH_TYPE);
if (!path) return;
if (path[0] == '~')
{
E_Path_Dir *epd;
char *new_path;
char *home_dir;
int len1, len2;
home_dir = e_user_homedir_get();
if (!home_dir) return;
len1 = strlen(home_dir);
len2 = strlen(path);
new_path = malloc(len1 + len2 + 1);
if (!new_path)
{
free(home_dir);
return;
}
epd = malloc(sizeof(E_Path_Dir));
if (!epd)
{
free(home_dir);
free(new_path);
return;
}
epd->dir = new_path;
strcpy(new_path, home_dir);
strcat(new_path, path + 1);
free(home_dir);
*(ep->user_dir_list) = evas_list_prepend(*(ep->user_dir_list), epd);
}
else
{
E_Path_Dir *epd;
epd = malloc(sizeof(E_Path_Dir));
if (!epd)
return;
epd->dir = strdup(path);
*(ep->user_dir_list) = evas_list_prepend(*(ep->user_dir_list), epd);
}
_e_path_cache_free(ep);
}
void
e_path_user_path_remove(E_Path *ep, const char *path)
{ {
Evas_List *l; Evas_List *l;
@ -112,16 +206,19 @@ e_path_path_remove(E_Path *ep, const char *path)
strcpy(new_path, home_dir); strcpy(new_path, home_dir);
strcat(new_path, path + 1); strcat(new_path, path + 1);
free(home_dir); free(home_dir);
for (l = ep->dir_list; l; l = l->next) for (l = *(ep->user_dir_list); l; l = l->next)
{ {
char *p; E_Path_Dir *epd;
p = l->data; epd = l->data;
if (p) if (epd->dir)
{ {
if (!strcmp(p, new_path)) if (!strcmp(epd->dir, new_path))
{ {
ep->dir_list = evas_list_prepend(ep->dir_list, l->data); *(ep->user_dir_list) = evas_list_remove_list(
*(ep->user_dir_list), l);
free(epd->dir);
free(epd);
free(new_path); free(new_path);
_e_path_cache_free(ep); _e_path_cache_free(ep);
return; return;
@ -132,16 +229,18 @@ e_path_path_remove(E_Path *ep, const char *path)
} }
else else
{ {
for (l = ep->dir_list; l; l = l->next) for (l = *(ep->user_dir_list); l; l = l->next)
{ {
char *p; E_Path_Dir *epd;
epd = l->data;
p = l->data; if (epd->dir)
if (p)
{ {
if (!strcmp(p, path)) if (!strcmp(epd->dir, path))
{ {
ep->dir_list = evas_list_prepend(ep->dir_list, l->data); *(ep->user_dir_list) = evas_list_remove_list(
*(ep->user_dir_list), l);
free(epd->dir);
free(epd);
_e_path_cache_free(ep); _e_path_cache_free(ep);
return; return;
} }
@ -158,6 +257,7 @@ e_path_find(E_Path *ep, const char *file)
E_OBJECT_CHECK_RETURN(ep, NULL); E_OBJECT_CHECK_RETURN(ep, NULL);
E_OBJECT_TYPE_CHECK_RETURN(ep, E_PATH_TYPE, NULL); E_OBJECT_TYPE_CHECK_RETURN(ep, E_PATH_TYPE, NULL);
if (!file) return NULL; if (!file) return NULL;
_e_path_buf[0] = 0; _e_path_buf[0] = 0;
str = evas_hash_find(ep->hash, file); str = evas_hash_find(ep->hash, file);
@ -166,14 +266,40 @@ e_path_find(E_Path *ep, const char *file)
strcpy(_e_path_buf, str); strcpy(_e_path_buf, str);
return _e_path_buf; return _e_path_buf;
} }
for (l = ep->dir_list; l; l = l->next) /* Look in the default dir list */
for (l = ep->default_dir_list; l; l = l->next)
{ {
char *p, *rp; E_Path_Dir *epd;
char *rp;
p = l->data; epd = l->data;
if (p) if (epd->dir)
{ {
snprintf(_e_path_buf, sizeof(_e_path_buf), "%s/%s", p, file); snprintf(_e_path_buf, sizeof(_e_path_buf), "%s/%s", epd->dir, file);
rp = ecore_file_realpath(_e_path_buf);
if ((rp) && (rp[0] != 0))
{
strncpy(_e_path_buf, rp, sizeof(_e_path_buf) - 1);
_e_path_buf[sizeof(_e_path_buf) - 1] = 0;
free(rp);
if (evas_hash_size(ep->hash) >= 512)
_e_path_cache_free(ep);
ep->hash = evas_hash_add(ep->hash, file, strdup(_e_path_buf));
return _e_path_buf;
}
if (rp) free(rp);
}
}
/* Look in the users dir list */
for (l = *(ep->user_dir_list); l; l = l->next)
{
E_Path_Dir *epd;
char *rp;
epd = l->data;
if (epd->dir)
{
snprintf(_e_path_buf, sizeof(_e_path_buf), "%s/%s", epd->dir, file);
rp = ecore_file_realpath(_e_path_buf); rp = ecore_file_realpath(_e_path_buf);
if ((rp) && (rp[0] != 0)) if ((rp) && (rp[0] != 0))
{ {
@ -195,16 +321,63 @@ void
e_path_evas_append(E_Path *ep, Evas *evas) e_path_evas_append(E_Path *ep, Evas *evas)
{ {
Evas_List *l; Evas_List *l;
Evas_List *dir_list;
E_OBJECT_CHECK(ep); E_OBJECT_CHECK(ep);
E_OBJECT_TYPE_CHECK(ep, E_PATH_TYPE); E_OBJECT_TYPE_CHECK(ep, E_PATH_TYPE);
if (!evas) return; if (!evas) return;
for (l = ep->dir_list; l; l = l->next)
dir_list = e_path_dir_list_get(ep);
for (l = dir_list; l; l = l->next)
{ {
char *p; E_Path_Dir *epd;
p = l->data; epd = l->data;
if (p) evas_font_path_append(evas, p); if (epd->dir) evas_font_path_append(evas, epd->dir);
}
}
/* compine default_list and and user_list int and easy to use list */
Evas_List *
e_path_dir_list_get(E_Path *ep)
{
Evas_List *dir_list;
Evas_List *l;
E_Path_Dir *new_epd;
E_Path_Dir *epd;
dir_list = NULL;
for (l = ep->default_dir_list; l; l = l->next)
{
epd = l->data;
new_epd = malloc(sizeof(E_Path_Dir));
new_epd->dir = strdup(epd->dir);
dir_list = evas_list_append(dir_list, new_epd);
}
for (l = *(ep->user_dir_list); l; l = l->next)
{
epd = l->data;
new_epd = malloc(sizeof(E_Path_Dir));
new_epd->dir = strdup(epd->dir);
dir_list = evas_list_append(dir_list, new_epd);
}
return dir_list;
}
void
e_path_dir_list_free(Evas_List *dir_list)
{
E_Path_Dir *epd;
while (dir_list)
{
epd = dir_list->data;
dir_list = evas_list_remove_list(dir_list, dir_list);
free(epd->dir);
free(epd);
} }
} }
@ -213,10 +386,14 @@ static void
_e_path_free(E_Path *ep) _e_path_free(E_Path *ep)
{ {
_e_path_cache_free(ep); _e_path_cache_free(ep);
while (ep->dir_list) while (ep->default_dir_list)
{ {
free(ep->dir_list->data); E_Path_Dir *epd;
ep->dir_list = evas_list_remove_list(ep->dir_list, ep->dir_list); epd = ep->default_dir_list->data;
free(epd->dir);
free(epd);
ep->default_dir_list = evas_list_remove_list(ep->default_dir_list,
ep->default_dir_list);
} }
free(ep); free(ep);
} }
@ -227,6 +404,7 @@ _e_path_cache_free(E_Path *ep)
if (!ep->hash) return; if (!ep->hash) return;
evas_hash_foreach(ep->hash, _e_path_cache_free_cb, NULL); evas_hash_foreach(ep->hash, _e_path_cache_free_cb, NULL);
evas_hash_free(ep->hash); evas_hash_free(ep->hash);
ep->hash = NULL;
} }
static Evas_Bool static Evas_Bool

View File

@ -4,28 +4,44 @@
#ifdef E_TYPEDEFS #ifdef E_TYPEDEFS
typedef struct _E_Path E_Path; typedef struct _E_Path E_Path;
typedef struct _E_Path_Dir E_Path_Dir;
#else #else
#ifndef E_PATH_H #ifndef E_PATH_H
#define E_PATH_H #define E_PATH_H
#define E_PATH_TYPE 0xE0b0100c #define E_PATH_TYPE 0xE0b0100c
struct _E_Path_Dir
{
char * dir;
};
struct _E_Path struct _E_Path
{ {
E_Object e_obj_inherit; E_Object e_obj_inherit;
Evas_Hash *hash; Evas_Hash *hash;
Evas_List *dir_list; Evas_List *default_dir_list;
/* keep track of the associated e_config path */
Evas_List **user_dir_list;
}; };
/* init and setup */
EAPI E_Path *e_path_new(void); EAPI E_Path *e_path_new(void);
EAPI void e_path_path_append(E_Path *ep, const char *path); EAPI void e_path_user_path_set(E_Path *ep, Evas_List **user_dir_list);
EAPI void e_path_path_prepend(E_Path *ep, const char *path); EAPI void e_path_inherit_path_set(E_Path *ep, E_Path *path_inherit);
EAPI void e_path_path_remove(E_Path *ep, const char *path); /* append a hardcoded path */
EAPI char *e_path_find(E_Path *ep, const char *file); /* for conveience this doesnt return a malloc'd string. it's a static buffer, so a new call will replace this buffer, but thsi means there is no need to free the return */ EAPI void e_path_default_path_append(E_Path *ep, const char *path);
/* e_config path manipulation */
EAPI void e_path_user_path_append(E_Path *ep, const char *path);
EAPI void e_path_user_path_prepend(E_Path *ep, const char *path);
EAPI void e_path_user_path_remove(E_Path *ep, const char *path);
EAPI char *e_path_find(E_Path *ep, const char *file); /* for conveience this doesnt return a malloc'd string. it's a static buffer, so a new call will replace this buffer, but thsi means there is no need to free the return */
EAPI void e_path_evas_append(E_Path *ep, Evas *evas); EAPI void e_path_evas_append(E_Path *ep, Evas *evas);
EAPI Evas_List *e_path_dir_list_get(E_Path *ep);
EAPI void e_path_dir_list_free(Evas_List *dir_list);
#endif #endif
#endif #endif

View File

@ -42,6 +42,7 @@ ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_mouse_binding_dec);
ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_key_binding_list_dec); ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_key_binding_list_dec);
ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_key_binding_enc); ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_key_binding_enc);
ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_key_binding_dec); ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_key_binding_dec);
ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_path_list_dec);
/* local subsystem globals */ /* local subsystem globals */
static Ecore_Ipc_Server *_e_ipc_server = NULL; static Ecore_Ipc_Server *_e_ipc_server = NULL;
@ -262,10 +263,8 @@ E_IPC_Opt_Handler handlers[] =
OSTR("-module-enable", "Enable module OPT1 if not enabled", E_IPC_OP_MODULE_ENABLE, 0), OSTR("-module-enable", "Enable module OPT1 if not enabled", E_IPC_OP_MODULE_ENABLE, 0),
OSTR("-module-disable", "Disable module OPT1 if not disabled", E_IPC_OP_MODULE_DISABLE, 0), OSTR("-module-disable", "Disable module OPT1 if not disabled", E_IPC_OP_MODULE_DISABLE, 0),
OREQ("-module-list", "List all loaded modules and their states", E_IPC_OP_MODULE_LIST, 1), OREQ("-module-list", "List all loaded modules and their states", E_IPC_OP_MODULE_LIST, 1),
OREQ("-module-dirs-list", "List all modules directories", E_IPC_OP_MODULE_DIRS_LIST, 1), OSTR("-bg-set", "Set the background edje file to be OPT1", E_IPC_OP_BG_SET, 0),
OSTR("-bg-set", "Set the background edje file to be OPT1", E_IPC_OP_BG_SET, 0),
OREQ("-bg-get", "Get the background edje file", E_IPC_OP_BG_GET, 1), OREQ("-bg-get", "Get the background edje file", E_IPC_OP_BG_GET, 1),
OREQ("-bg-dirs-list", "Get the background directories", E_IPC_OP_BG_DIRS_LIST, 1),
OSTR("-font-fallback-remove", "Remove OPT1 from the fontset", E_IPC_OP_FONT_FALLBACK_REMOVE, 0), OSTR("-font-fallback-remove", "Remove OPT1 from the fontset", E_IPC_OP_FONT_FALLBACK_REMOVE, 0),
OSTR("-font-fallback-prepend", "Prepend OPT1 to the fontset", E_IPC_OP_FONT_FALLBACK_PREPEND, 0), OSTR("-font-fallback-prepend", "Prepend OPT1 to the fontset", E_IPC_OP_FONT_FALLBACK_PREPEND, 0),
OSTR("-font-fallback-append", "Append OPT1 to the fontset", E_IPC_OP_FONT_FALLBACK_APPEND, 0), OSTR("-font-fallback-append", "Append OPT1 to the fontset", E_IPC_OP_FONT_FALLBACK_APPEND, 0),
@ -288,6 +287,39 @@ E_IPC_Opt_Handler handlers[] =
OREQ("-binding-key-list", "List all key bindings", E_IPC_OP_BINDING_KEY_LIST, 1), OREQ("-binding-key-list", "List all key bindings", E_IPC_OP_BINDING_KEY_LIST, 1),
OFNC("-binding-key-add", "Add an existing key binding. OPT1 = Context, OPT2 = key, OPT3 = modifiers, OPT4 = any modifier ok, OPT5 = action, OPT6 = action parameters", 6, _e_opt_binding_key_add, 0), OFNC("-binding-key-add", "Add an existing key binding. OPT1 = Context, OPT2 = key, OPT3 = modifiers, OPT4 = any modifier ok, OPT5 = action, OPT6 = action parameters", 6, _e_opt_binding_key_add, 0),
OFNC("-binding-key-del", "Delete an existing key binding. OPT1 = Context, OPT2 = key, OPT3 = modifiers, OPT4 = any modifier ok, OPT5 = action, OPT6 = action parameters", 6, _e_opt_binding_key_del, 0), OFNC("-binding-key-del", "Delete an existing key binding. OPT1 = Context, OPT2 = key, OPT3 = modifiers, OPT4 = any modifier ok, OPT5 = action, OPT6 = action parameters", 6, _e_opt_binding_key_del, 0),
OREQ("-module-dirs-list", "List all module directories", E_IPC_OP_MODULE_DIRS_LIST, 1),
OSTR("-module-dirs-append", "Append OPT1 to the user module path", E_IPC_OP_MODULE_DIRS_APPEND, 0),
OSTR("-module-dirs-prepend", "Prepend OPT1 to the user module path", E_IPC_OP_MODULE_DIRS_PREPEND, 0),
OSTR("-module-dirs-remove", "Remove OPT1 from the user module path", E_IPC_OP_MODULE_DIRS_REMOVE, 0),
OREQ("-data-dirs-list", "List all data directories", E_IPC_OP_DATA_DIRS_LIST, 1),
OSTR("-data-dirs-append", "Append OPT1 to the user data path", E_IPC_OP_DATA_DIRS_APPEND, 0),
OSTR("-data-dirs-prepend", "Prepend OPT1 to the user data path", E_IPC_OP_DATA_DIRS_PREPEND, 0),
OSTR("-data-dirs-remove", "Remove OPT1 from the user data path", E_IPC_OP_DATA_DIRS_REMOVE, 0),
OREQ("-font-dirs-list", "List all font directories", E_IPC_OP_FONT_DIRS_LIST, 1),
OSTR("-font-dirs-append", "Append OPT1 to the user font path", E_IPC_OP_FONT_DIRS_APPEND, 0),
OSTR("-font-dirs-prepend", "Prepend OPT1 to the user font path", E_IPC_OP_FONT_DIRS_PREPEND, 0),
OSTR("-font-dirs-remove", "Remove OPT1 from the user font path", E_IPC_OP_FONT_DIRS_REMOVE, 0),
OREQ("-theme-dirs-list", "List all theme directories", E_IPC_OP_THEME_DIRS_LIST, 1),
OSTR("-theme-dirs-append", "Append OPT1 to the user theme path", E_IPC_OP_THEME_DIRS_APPEND, 0),
OSTR("-theme-dirs-prepend", "Prepend OPT1 to the user theme path", E_IPC_OP_THEME_DIRS_PREPEND, 0),
OSTR("-theme-dirs-remove", "Remove OPT1 from the user theme path", E_IPC_OP_THEME_DIRS_REMOVE, 0),
OREQ("-init-dirs-list", "List all init directories", E_IPC_OP_INIT_DIRS_LIST, 1),
OSTR("-init-dirs-append", "Append OPT1 to the user init path", E_IPC_OP_INIT_DIRS_APPEND, 0),
OSTR("-init-dirs-prepend", "Prepend OPT1 to the user init path", E_IPC_OP_INIT_DIRS_PREPEND, 0),
OSTR("-init-dirs-remove", "Remove OPT1 from the user init path", E_IPC_OP_INIT_DIRS_REMOVE, 0),
OREQ("-icon-dirs-list", "List all icon directories", E_IPC_OP_ICON_DIRS_LIST, 1),
OSTR("-icon-dirs-append", "Append OPT1 to the user icon path", E_IPC_OP_ICON_DIRS_APPEND, 0),
OSTR("-icon-dirs-prepend", "Prepend OPT1 to the user icon path", E_IPC_OP_ICON_DIRS_PREPEND, 0),
OSTR("-icon-dirs-remove", "Remove OPT1 from the user icon path", E_IPC_OP_ICON_DIRS_REMOVE, 0),
OREQ("-image-dirs-list", "List all image directories", E_IPC_OP_IMAGE_DIRS_LIST, 1),
OSTR("-image-dirs-append", "Append OPT1 to the user image path", E_IPC_OP_IMAGE_DIRS_APPEND, 0),
OSTR("-image-dirs-prepend", "Prepend OPT1 to the user image path", E_IPC_OP_IMAGE_DIRS_PREPEND, 0),
OSTR("-image-dirs-remove", "Remove OPT1 from the user image path", E_IPC_OP_IMAGE_DIRS_REMOVE, 0),
OREQ("-bg-dirs-list", "List all background directories", E_IPC_OP_BG_DIRS_LIST, 1),
OSTR("-bg-dirs-append", "Append OPT1 to the user background path", E_IPC_OP_BG_DIRS_APPEND, 0),
OSTR("-bg-dirs-prepend", "Prepend OPT1 to the user background path", E_IPC_OP_BG_DIRS_PREPEND, 0),
OSTR("-bg-dirs-remove", "Remove OPT1 from the user background path", E_IPC_OP_BG_DIRS_REMOVE, 0),
OFNC("-binding-key-del", "Delete an existing key binding. OPT1 = Context, OPT2 = key, OPT3 = modifiers, OPT4 = any modifier ok, OPT5 = action, OPT6 = action parameters", 6, _e_opt_binding_key_del, 0),
ODBL("-menus-scroll-speed-set", "Set the scroll speed of menus (pixels/sec)", E_IPC_OP_MENUS_SCROLL_SPEED_SET, 0), ODBL("-menus-scroll-speed-set", "Set the scroll speed of menus (pixels/sec)", E_IPC_OP_MENUS_SCROLL_SPEED_SET, 0),
OREQ("-menus-scroll-speed-get", "Get the scroll speed of menus (pixels/sec)", E_IPC_OP_MENUS_SCROLL_SPEED_GET, 1), OREQ("-menus-scroll-speed-get", "Get the scroll speed of menus (pixels/sec)", E_IPC_OP_MENUS_SCROLL_SPEED_GET, 1),
ODBL("-menus-fast-move-threshhold-set", "Set the mouse speed in pixels per second that is considered a 'fast move'", E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_SET, 0), ODBL("-menus-fast-move-threshhold-set", "Set the mouse speed in pixels per second that is considered a 'fast move'", E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_SET, 0),
@ -600,7 +632,7 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
E_Module *m; E_Module *m;
modules = _e_ipc_module_list_dec(e->data, e->size); modules = _e_ipc_module_list_dec(e->data, e->size);
while(modules) while (modules)
{ {
m = modules->data; m = modules->data;
printf("REPLY: MODULE NAME=\"%s\" ENABLED=%i\n", printf("REPLY: MODULE NAME=\"%s\" ENABLED=%i\n",
@ -612,44 +644,12 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
else else
printf("REPLY: MODULE NONE\n"); printf("REPLY: MODULE NONE\n");
break; break;
case E_IPC_OP_MODULE_DIRS_LIST_REPLY:
if (e->data)
{
char *p;
p = e->data;
while (p < (char *)(e->data + e->size))
{
char *dir;
dir = p;
printf("REPLY: MODULE DIR=%s\n", dir);
p += strlen(dir) + 1;
}
}
break;
case E_IPC_OP_BG_GET_REPLY: case E_IPC_OP_BG_GET_REPLY:
if (e->data) if (e->data)
{ {
printf("REPLY: %s\n", (char *)e->data); printf("REPLY: %s\n", (char *)e->data);
} }
break; break;
case E_IPC_OP_BG_DIRS_LIST_REPLY:
if (e->data)
{
char *p;
p = e->data;
while (p < (char *)(e->data + e->size))
{
char *dir;
dir = p;
printf("REPLY: BG DIR=%s\n", dir);
p += strlen(dir) + 1;
}
}
break;
case E_IPC_OP_FONT_FALLBACK_LIST_REPLY: case E_IPC_OP_FONT_FALLBACK_LIST_REPLY:
if (e->data) if (e->data)
{ {
@ -790,6 +790,134 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
else else
printf("REPLY: AVAILABLE NONE\n"); printf("REPLY: AVAILABLE NONE\n");
break; break;
case E_IPC_OP_DATA_DIRS_LIST_REPLY:
if (e->data)
{
Evas_List *dirs;
E_Path_Dir *dir;
dirs = _e_ipc_path_list_dec(e->data, e->size);
while (dirs)
{
dir = dirs->data;
printf("REPLY: DATA DIR=\"%s\"\n", dir->dir);
dirs = evas_list_remove_list(dirs, dirs);
E_FREE(dir);
}
}
break;
case E_IPC_OP_IMAGE_DIRS_LIST_REPLY:
if (e->data)
{
Evas_List *dirs;
E_Path_Dir *dir;
dirs = _e_ipc_path_list_dec(e->data, e->size);
while (dirs)
{
dir = dirs->data;
printf("REPLY: IMAGE DIR=\"%s\"\n", dir->dir);
dirs = evas_list_remove_list(dirs, dirs);
E_FREE(dir);
}
}
break;
case E_IPC_OP_FONT_DIRS_LIST_REPLY:
if (e->data)
{
Evas_List *dirs;
E_Path_Dir *dir;
dirs = _e_ipc_path_list_dec(e->data, e->size);
while (dirs)
{
dir = dirs->data;
printf("REPLY: FONT DIR=\"%s\"\n", dir->dir);
dirs = evas_list_remove_list(dirs, dirs);
E_FREE(dir);
}
}
break;
case E_IPC_OP_THEME_DIRS_LIST_REPLY:
if (e->data)
{
Evas_List *dirs;
E_Path_Dir *dir;
dirs = _e_ipc_path_list_dec(e->data, e->size);
while (dirs)
{
dir = dirs->data;
printf("REPLY: THEME DIR=\"%s\"\n", dir->dir);
dirs = evas_list_remove_list(dirs, dirs);
E_FREE(dir);
}
}
break;
case E_IPC_OP_INIT_DIRS_LIST_REPLY:
if (e->data)
{
Evas_List *dirs;
E_Path_Dir *dir;
dirs = _e_ipc_path_list_dec(e->data, e->size);
while (dirs)
{
dir = dirs->data;
printf("REPLY: INIT DIR=\"%s\"\n", dir->dir);
dirs = evas_list_remove_list(dirs, dirs);
E_FREE(dir);
}
}
break;
case E_IPC_OP_ICON_DIRS_LIST_REPLY:
if (e->data)
{
Evas_List *dirs;
E_Path_Dir *dir;
dirs = _e_ipc_path_list_dec(e->data, e->size);
while (dirs)
{
dir = dirs->data;
printf("REPLY: ICON DIR=\"%s\"\n", dir->dir);
dirs = evas_list_remove_list(dirs, dirs);
E_FREE(dir);
}
}
break;
case E_IPC_OP_MODULE_DIRS_LIST_REPLY:
if (e->data)
{
Evas_List *dirs;
E_Path_Dir *dir;
dirs = _e_ipc_path_list_dec(e->data, e->size);
while (dirs)
{
dir = dirs->data;
printf("REPLY: MODULE DIR=\"%s\"\n", dir->dir);
dirs = evas_list_remove_list(dirs, dirs);
E_FREE(dir);
}
}
break;
case E_IPC_OP_BG_DIRS_LIST_REPLY:
if (e->data)
{
Evas_List *dirs;
E_Path_Dir *dir;
dirs = _e_ipc_path_list_dec(e->data, e->size);
while (dirs)
{
dir = dirs->data;
printf("REPLY: BACKGROUND DIR=\"%s\"\n", dir->dir);
dirs = evas_list_remove_list(dirs, dirs);
E_FREE(dir);
}
}
break;
case E_IPC_OP_MENUS_SCROLL_SPEED_GET_REPLY: case E_IPC_OP_MENUS_SCROLL_SPEED_GET_REPLY:
if (e->data) if (e->data)
{ {
@ -1149,3 +1277,9 @@ ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_key_binding_dec)
ECORE_IPC_GET8(any_mod); ECORE_IPC_GET8(any_mod);
ECORE_IPC_DEC_STRUCT_FOOT(); ECORE_IPC_DEC_STRUCT_FOOT();
} }
ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_path_list_dec)
{
ECORE_IPC_DEC_EVAS_LIST_HEAD(E_Path_Dir);
ECORE_IPC_GETS(dir);
ECORE_IPC_DEC_EVAS_LIST_FOOT();
}