forked from enlightenment/enlightenment
- move duplicate code in e_ipc_handlers into a macro
- stop warnings in e_main.c. Is there a better way to fix this? SVN revision: 15145
This commit is contained in:
parent
56580219b4
commit
86b795d18d
|
@ -220,6 +220,26 @@ break;
|
|||
#define DECODE(__dec) \
|
||||
if (__dec(e->data, e->size, &dat))
|
||||
|
||||
# define E_PATH_GET(__path, __str) \
|
||||
E_Path *__path = NULL; \
|
||||
if (!strcmp(__str, "data")) \
|
||||
__path = path_data; \
|
||||
else if (!strcmp(__str, "images")) \
|
||||
__path = path_images; \
|
||||
else if (!strcmp(__str, "fonts")) \
|
||||
__path = path_fonts; \
|
||||
else if (!strcmp(__str, "themes")) \
|
||||
__path = path_themes; \
|
||||
else if (!strcmp(__str, "init")) \
|
||||
__path = path_init; \
|
||||
else if (!strcmp(__str, "icons")) \
|
||||
__path = path_icons; \
|
||||
else if (!strcmp(__str, "modules")) \
|
||||
__path = path_modules; \
|
||||
else if (!strcmp(__str, "backgrounds")) \
|
||||
__path = path_backgrounds;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -665,23 +685,7 @@ break;
|
|||
REQ_2STRING(params[0], params[1], HDL);
|
||||
#elif (TYPE == E_WM_IN)
|
||||
STRING2(s1, s2, e_2str, HDL);
|
||||
E_Path *path = NULL;
|
||||
if (!strcmp(s1, "data"))
|
||||
path = path_data;
|
||||
else if (!strcmp(s1, "images"))
|
||||
path = path_images;
|
||||
else if (!strcmp(s1, "fonts"))
|
||||
path = path_fonts;
|
||||
else if (!strcmp(s1, "themes"))
|
||||
path = path_themes;
|
||||
else if (!strcmp(s1, "init"))
|
||||
path = path_init;
|
||||
else if (!strcmp(s1, "icons"))
|
||||
path = path_icons;
|
||||
else if (!strcmp(s1, "modules"))
|
||||
path = path_modules;
|
||||
else if (!strcmp(s1, "backgrounds"))
|
||||
path = path_backgrounds;
|
||||
E_PATH_GET(path, s1)
|
||||
e_path_user_path_append(path, s2);
|
||||
SAVE;
|
||||
END_STRING2(e_2str)
|
||||
|
@ -698,23 +702,7 @@ break;
|
|||
REQ_2STRING(params[0], params[1], HDL);
|
||||
#elif (TYPE == E_WM_IN)
|
||||
STRING2(s1, s2, e_2str, HDL);
|
||||
E_Path *path = NULL;
|
||||
if (!strcmp(s1, "data"))
|
||||
path = path_data;
|
||||
else if (!strcmp(s1, "images"))
|
||||
path = path_images;
|
||||
else if (!strcmp(s1, "fonts"))
|
||||
path = path_fonts;
|
||||
else if (!strcmp(s1, "themes"))
|
||||
path = path_themes;
|
||||
else if (!strcmp(s1, "init"))
|
||||
path = path_init;
|
||||
else if (!strcmp(s1, "icons"))
|
||||
path = path_icons;
|
||||
else if (!strcmp(s1, "modules"))
|
||||
path = path_modules;
|
||||
else if (!strcmp(s1, "backgrounds"))
|
||||
path = path_backgrounds;
|
||||
E_PATH_GET(path, s1)
|
||||
e_path_user_path_prepend(path, s2);
|
||||
SAVE;
|
||||
END_STRING2(e_2str)
|
||||
|
@ -731,23 +719,7 @@ break;
|
|||
REQ_2STRING(params[0], params[1], HDL);
|
||||
#elif (TYPE == E_WM_IN)
|
||||
STRING2(s1, s2, e_2str, HDL);
|
||||
E_Path *path = NULL;
|
||||
if (!strcmp(s1, "data"))
|
||||
path = path_data;
|
||||
else if (!strcmp(s1, "images"))
|
||||
path = path_images;
|
||||
else if (!strcmp(s1, "fonts"))
|
||||
path = path_fonts;
|
||||
else if (!strcmp(s1, "themes"))
|
||||
path = path_themes;
|
||||
else if (!strcmp(s1, "init"))
|
||||
path = path_init;
|
||||
else if (!strcmp(s1, "icons"))
|
||||
path = path_icons;
|
||||
else if (!strcmp(s1, "modules"))
|
||||
path = path_modules;
|
||||
else if (!strcmp(s1, "backgrounds"))
|
||||
path = path_backgrounds;
|
||||
E_PATH_GET(path, s1)
|
||||
e_path_user_path_remove(path, s2);
|
||||
SAVE;
|
||||
END_STRING2(e_2str)
|
||||
|
|
|
@ -44,7 +44,7 @@ Opt opts[] = {
|
|||
|
||||
static int _e_ipc_init(const char *display);
|
||||
static void _e_ipc_shutdown(void);
|
||||
static E_Ipc_Op _e_ipc_call_find(char *name);
|
||||
static E_Ipc_Op _e_ipc_call_find(const char *name);
|
||||
static void _e_ipc_call(E_Ipc_Op opcode, char **params);
|
||||
static int _e_cb_server_data(void *data, int type, void *event);
|
||||
|
||||
|
@ -188,25 +188,32 @@ e_lib_quit(void)
|
|||
void
|
||||
e_lib_module_enabled_set(const char *module, int enable)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
if (!module)
|
||||
return;
|
||||
|
||||
tmp = strdup(module);
|
||||
if (enable)
|
||||
_e_ipc_call(E_IPC_OP_MODULE_ENABLE, &module);
|
||||
_e_ipc_call(E_IPC_OP_MODULE_ENABLE, &tmp);
|
||||
else
|
||||
_e_ipc_call(E_IPC_OP_MODULE_DISABLE, &module);
|
||||
_e_ipc_call(E_IPC_OP_MODULE_DISABLE, &tmp);
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
void
|
||||
e_lib_module_load_set(const char *module, int load)
|
||||
{
|
||||
char *tmp;
|
||||
if (!module)
|
||||
return;
|
||||
|
||||
tmp = strdup(module);
|
||||
if (load)
|
||||
_e_ipc_call(E_IPC_OP_MODULE_LOAD, &module);
|
||||
_e_ipc_call(E_IPC_OP_MODULE_LOAD, &tmp);
|
||||
else
|
||||
_e_ipc_call(E_IPC_OP_MODULE_UNLOAD, &module);
|
||||
_e_ipc_call(E_IPC_OP_MODULE_UNLOAD, &tmp);
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -218,10 +225,13 @@ e_lib_module_list(void)
|
|||
void
|
||||
e_lib_background_set(const char *bgfile)
|
||||
{
|
||||
char *tmp;
|
||||
if (!bgfile)
|
||||
return;
|
||||
|
||||
_e_ipc_call(E_IPC_OP_BG_SET, &bgfile);
|
||||
tmp = strdup(bgfile);
|
||||
_e_ipc_call(E_IPC_OP_BG_SET, &tmp);
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -316,7 +326,7 @@ _e_ipc_shutdown(void)
|
|||
}
|
||||
|
||||
static E_Ipc_Op
|
||||
_e_ipc_call_find(char *name)
|
||||
_e_ipc_call_find(const char *name)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
|
Loading…
Reference in New Issue