Moved some more to handlers from libe - added E_LIB_IN where needed

need a bunch more macros to support these things, may need to split up some that already exist...


SVN revision: 15058
This commit is contained in:
handyande 2005-06-02 17:05:44 +00:00 committed by handyande
parent 2005381bbd
commit de09622e6f
2 changed files with 52 additions and 83 deletions

View File

@ -25,6 +25,13 @@ if (e->data) { \
} \
break;
# define RESPONSE(__res, __store, HDL) \
__store *__res = calloc(1, sizeof(__store)); \
if (e->data) {
#define END_RESPONSE(__res, __type) \
} \
ecore_event_add(__type, __res, NULL, NULL);
# define SAVE e_config_save_queue()
# define REQ_STRING(__str, HDL) \
@ -147,6 +154,8 @@ break;
* ...
* E_REMOTE_IN
* ...
* E_LIB_IN
* ...
*/
#if 0
@ -253,6 +262,34 @@ break;
STRING_INT_LIST(v, HDL);
printf("REPLY: \"%s\" ENABLED %i\n", v->str, v->val);
END_STRING_INT_LIST(v);
#elif (TYPE == E_LIB_IN)
GENERIC(HDL);
Evas_List *dat = NULL;
if (e_ipc_codec_str_int_list_dec(e->data, e->size, &dat)) {
RESPONSE(r, E_Response_Module_List, HDL);
/* FIXME - this is a mess, needs to be merged into macros... */
int count = evas_list_count(dat);
r->modules = malloc(sizeof(E_Response_Module_Data *) * count);
r->count = count;
count = 0;
Evas_List *l;
for (l = dat; l; l = l->next) {
E_Response_Module_Data *md;
E_Ipc_Str_Int *v;
v = l->data;
md = malloc(sizeof(E_Response_Module_Data));
md->name = v->str;
md->enabled = v->val;
r->modules[count] = md;
count ++;
}
END_RESPONSE(r, E_RESPONSE_MODULE_LIST); /* FIXME - need a custom free */
}
END_GENERIC();
#endif
#undef HDL
@ -305,6 +342,12 @@ break;
STRING(s, HDL);
printf("REPLY: \"%s\"\n", s);
END_STRING(s);
#elif (TYPE == E_LIB_IN)
STRING(s, HDL);
RESPONSE(r, E_Response_Background_Get, HDL);
r->file = strdup(s);
END_RESPONSE(r, E_RESPONSE_BACKGROUND_GET);
END_STRING(s);
#endif
#undef HDL

View File

@ -313,27 +313,9 @@ _e_cb_server_data(void *data __UNUSED__, int type, void *event)
switch (e->minor)
{
case E_IPC_OP_BG_GET_REPLY:
{
E_Response_Background_Get *res;
char *str = NULL;
res = calloc(1, sizeof(E_Response_Background_Get));
if (e->data)
{
e_ipc_codec_str_dec(e->data, e->size, &str);
res->file = str;
}
ecore_event_add(E_RESPONSE_BACKGROUND_GET, res, NULL, NULL);
}
break;
// FIXME: if we were to use the e_handlers.h then it will need library
// stuff, i.e. E_LIB_IN which creates the replies and sends the event...
//
//#define TYPE E_REMOTE_IN
//#include "e_ipc_handlers.h"
//#undef TYPE
#define TYPE E_LIB_IN
#include "e_ipc_handlers.h"
#undef TYPE
default:
break;
@ -348,49 +330,7 @@ _e_cb_server_data(void *data __UNUSED__, int type, void *event)
type = E_IPC_OP_MODULE_LIST;
switch (e->minor)
{
case E_IPC_OP_MODULE_LIST_REPLY:
if (e->data)
{
E_Response_Module_List *res;
int count = 0;
char *p;
res = calloc(1, sizeof(E_Response_Module_List));
p = e->data;
while (p < (char *)(e->data + e->size))
{
p += strlen(p) + 1 + 1;
count ++;
}
res->modules = malloc(sizeof(E_Response_Module_Data *) * count);
res->count = count;
count = 0;
p = e->data;
while (p < (char *)(e->data + e->size))
{
E_Response_Module_Data *md;
md = malloc(sizeof(E_Response_Module_Data));
md->name = p;
p += strlen(md->name);
if (p < (char *)(e->data + e->size))
{
p++;
if (p < (char *)(e->data + e->size))
{
md->enabled = *p;
p++;
}
}
res->modules[count] = md;
count ++;
}
ecore_event_add(E_RESPONSE_MODULE_LIST, res,
_e_cb_module_list_free, NULL);
}
break;
*
case E_IPC_OP_MODULE_DIRS_LIST_REPLY:
if (e->data)
{
@ -422,22 +362,8 @@ _e_cb_server_data(void *data __UNUSED__, int type, void *event)
_e_cb_module_dir_list_free, NULL);
}
break;
*
case E_IPC_OP_BG_GET_REPLY:
{
E_Response_Background_Get *res;
char *str = NULL;
res = calloc(1, sizeof(E_Response_Background_Get));
if (e->data)
{
e_codec_str_dec(e->data, e->size, &str);
res->file = str;
}
ecore_event_add(E_RESPONSE_BACKGROUND_GET, res, NULL, NULL);
}
break;
* case E_IPC_OP_BG_DIRS_LIST_REPLY:
case E_IPC_OP_BG_DIRS_LIST_REPLY:
if (e->data)
{
E_Response_Background_Dirs_List *res;
@ -468,8 +394,8 @@ _e_cb_server_data(void *data __UNUSED__, int type, void *event)
_e_cb_bg_dir_list_free, NULL);
}
break;
*
* case E_IPC_OP_THEME_DIRS_LIST_REPLY:
case E_IPC_OP_THEME_DIRS_LIST_REPLY:
if (e->data)
{
E_Response_Theme_Dirs_List *res;
@ -500,7 +426,7 @@ _e_cb_server_data(void *data __UNUSED__, int type, void *event)
_e_cb_theme_dir_list_free, NULL);
}
break;
*
default:
break;
}