- add in the -dir-list-append/prepend/remove functions.

SVN revision: 15125
This commit is contained in:
Dan Sinclair 2005-06-04 20:10:49 +00:00 committed by Dan Sinclair
parent 48da4edd29
commit 6b9c338500
5 changed files with 158 additions and 296 deletions

View File

@ -491,277 +491,6 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
e_config->zone_desks_y_count,
E_IPC_OP_DESKS_GET_REPLY);
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
#endif
default:
break;

View File

@ -9,6 +9,7 @@ static Eet_Data_Descriptor *_e_ipc_int_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_double_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_2int_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_str_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_2str_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_str_list_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_str_int_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_str_int_list_edd = NULL;
@ -31,6 +32,10 @@ e_ipc_codec_init(void)
_e_ipc_str_edd = E_CONFIG_DD_NEW("str", E_Ipc_Str);
E_CONFIG_VAL(_e_ipc_str_edd, E_Ipc_Str, str, STR);
_e_ipc_2str_edd = E_CONFIG_DD_NEW("2str", E_Ipc_2Str);
E_CONFIG_VAL(_e_ipc_2str_edd, E_Ipc_2Str, str1, STR);
E_CONFIG_VAL(_e_ipc_2str_edd, E_Ipc_2Str, str2, STR);
_e_ipc_str_list_edd = E_CONFIG_DD_NEW("str_list", E_Ipc_List);
E_CONFIG_LIST(_e_ipc_str_list_edd, E_Ipc_List, list, _e_ipc_str_edd);
@ -59,6 +64,7 @@ e_ipc_codec_shutdown(void)
E_CONFIG_DD_FREE(_e_ipc_double_edd);
E_CONFIG_DD_FREE(_e_ipc_2int_edd);
E_CONFIG_DD_FREE(_e_ipc_str_edd);
E_CONFIG_DD_FREE(_e_ipc_2str_edd);
E_CONFIG_DD_FREE(_e_ipc_str_list_edd);
E_CONFIG_DD_FREE(_e_ipc_str_int_edd);
E_CONFIG_DD_FREE(_e_ipc_str_int_list_edd);
@ -156,6 +162,28 @@ e_ipc_codec_str_enc(char *str, int *size_ret)
return eet_data_descriptor_encode(_e_ipc_str_edd, &dat, size_ret);
}
int
e_ipc_codec_2str_dec(char *data, int bytes, E_Ipc_2Str **dest)
{
E_Ipc_2Str *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_2str_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat;
return 1;
}
void *
e_ipc_codec_2str_enc(char *str1, char *str2, int *size_ret)
{
E_Ipc_2Str dat;
dat.str1 = str1;
dat.str2 = str2;
return eet_data_descriptor_encode(_e_ipc_2str_edd, &dat, size_ret);
}
int
e_ipc_codec_str_list_dec(char *data, int bytes, Evas_List **dest)
{

View File

@ -8,6 +8,7 @@ typedef struct _E_Ipc_Double E_Ipc_Double;
typedef struct _E_Ipc_2Int E_Ipc_2Int;
typedef struct _E_Ipc_List E_Ipc_List;
typedef struct _E_Ipc_Str E_Ipc_Str;
typedef struct _E_Ipc_2Str E_Ipc_2Str;
typedef struct _E_Ipc_Str_Int E_Ipc_Str_Int;
typedef struct _E_Ipc_Str_Int_List E_Ipc_Str_Int_List;
typedef struct _E_Ipc_2Str_Int E_Ipc_2Str_Int;
@ -42,6 +43,11 @@ struct _E_Ipc_Str
char *str;
};
struct _E_Ipc_2Str
{
char *str1, *str2;
};
struct _E_Ipc_Str_Int
{
char *str;
@ -66,6 +72,8 @@ EAPI int e_ipc_codec_2int_dec(char *data, int bytes, int *dest, int *dest2x
EAPI void *e_ipc_codec_2int_enc(int val1, int val2, int *size_ret);
EAPI int e_ipc_codec_str_dec(char *data, int bytes, char **dest);
EAPI void *e_ipc_codec_str_enc(char *str, int *size_ret);
EAPI int e_ipc_codec_2str_dec(char *data, int bytes, E_Ipc_2Str **dest);
EAPI void *e_ipc_codec_2str_enc(char *str1, char *str2, int *size_ret);
EAPI int e_ipc_codec_str_list_dec(char *data, int bytes, Evas_List **dest);
EAPI void *e_ipc_codec_str_list_enc(Evas_List *list, int *size_ret);
EAPI int e_ipc_codec_str_int_dec(char *data, int bytes, E_Ipc_Str_Int **dest);

View File

@ -28,6 +28,20 @@ if (e->data) { \
} \
break;
# define STRING2(__str1, __str2, __2str, HDL) \
case HDL: \
if (e->data) { \
char *__str1 = NULL, *__str2 = NULL; \
E_Ipc_2Str *__2str = NULL; \
__2str = calloc(1, sizeof(E_Ipc_2Str)); \
if (e_ipc_codec_2str_dec(e->data, e->size, &(__2str))) { \
__str1 = __2str->str1; \
__str2 = __2str->str2;
# define END_STRING2(__2str) \
free(__2str); \
} \
} \
break;
# define START_DOUBLE(__dbl, HDL) \
case HDL: \
@ -68,6 +82,16 @@ case HDL: { void *data; int bytes; \
} \
break;
# define REQ_2STRING(__str1, __str2, HDL) \
case HDL: { void *data; int bytes; \
data = e_ipc_codec_2str_enc(__str1, __str2, &bytes); \
if (data) { \
ecore_ipc_server_send(e->server, E_IPC_DOMAIN_REQUEST, HDL, 0, 0, 0, data, bytes); \
free(data); \
} \
} \
break;
# define REQ_DOUBLE(__dbl, HDL) \
case HDL: { void *data; int bytes; \
data = e_ipc_codec_double_enc(__dbl, &bytes); \
@ -630,10 +654,107 @@ break;
END_RESPONSE(r, res); /* FIXME - need a custom free */
}
END_GENERIC();
#endif
#undef HDL
/****************************************************************************/
#define HDL E_IPC_OP_DIRS_APPEND
#if (TYPE == E_REMOTE_OPTIONS)
OP("-dirs-list-append", 1, "Append the directory of type specified by 'OPT2 to the list in 'OPT1'", 0, HDL)
#elif (TYPE == E_REMOTE_OUT)
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_user_path_append(path, s2);
SAVE;
END_STRING2(e_2str)
#elif (TYPE == E_REMOTE_IN)
#elif (TYPE == E_LIB_IN)
#endif
#undef HDL
/****************************************************************************/
#define HDL E_IPC_OP_DIRS_PREPEND
#if (TYPE == E_REMOTE_OPTIONS)
OP("-dirs-list-prepend", 1, "Prepend the directory of type specified by 'OPT2 to the list in 'OPT1'", 0, HDL)
#elif (TYPE == E_REMOTE_OUT)
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_user_path_prepend(path, s2);
SAVE;
END_STRING2(e_2str)
#elif (TYPE == E_REMOTE_IN)
#elif (TYPE == E_LIB_IN)
#endif
#undef HDL
/****************************************************************************/
#define HDL E_IPC_OP_DIRS_REMOVE
#if (TYPE == E_REMOTE_OPTIONS)
OP("-dirs-list-remove", 1, "Remove the directory of type specified by 'OPT2 to the list in 'OPT1'", 0, HDL)
#elif (TYPE == E_REMOTE_OUT)
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_user_path_remove(path, s2);
SAVE;
END_STRING2(e_2str)
#elif (TYPE == E_REMOTE_IN)
#elif (TYPE == E_LIB_IN)
#endif
#undef HDL
/****************************************************************************/
#define HDL E_IPC_OP_FRAMERATE_SET

View File

@ -582,30 +582,6 @@ E_IPC_Opt_Handler handlers[] =
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-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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
OREQ("-menus-fast-move-threshhold-get", "Get the mouse speed (pixels/sec) that is considered a fast move", E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_GET, 1),
ODBL("-menus-click-drag-timeout-set", "Set the time (in seconds) between a mouse press and release that will keep the menu up anyway", E_IPC_OP_MENUS_CLICK_DRAG_TIMEOUT_SET, 0),