forked from enlightenment/enlightenment
Patches from ptomaine.
* Fix for URI escpaing. * Add the ability for EFM to recognize different drop actions from other FMs. The reverse soon to come :) * Add option to disable HAL device icons on the desktop. * Performing an operation on multiple files will now be done in a single slave process instead of many. More to come before and after GSOC :) If you see him in the channel, give him a high five because he's finally helped pull EFM out of the crapper :P SVN revision: 35432
This commit is contained in:
parent
99fc29f7aa
commit
e177bb663f
|
@ -587,6 +587,8 @@ e_config_init(void)
|
|||
E_CONFIG_VAL(D, T, thumbscroll_momentum_threshhold, DOUBLE);
|
||||
E_CONFIG_VAL(D, T, thumbscroll_friction, DOUBLE);
|
||||
|
||||
E_CONFIG_VAL(D, T, hal_desktop, INT);
|
||||
|
||||
e_config = e_config_domain_load("e", _e_config_edd);
|
||||
if (e_config)
|
||||
{
|
||||
|
@ -763,6 +765,7 @@ e_config_init(void)
|
|||
e_config->display_res_hz = 0;
|
||||
e_config->display_res_rotation = 0;
|
||||
|
||||
e_config->hal_desktop = 1;
|
||||
{
|
||||
E_Config_Module *em;
|
||||
|
||||
|
|
|
@ -286,6 +286,8 @@ struct _E_Config
|
|||
int thumbscroll_threshhold;
|
||||
double thumbscroll_momentum_threshhold;
|
||||
double thumbscroll_friction;
|
||||
|
||||
int hal_desktop;
|
||||
};
|
||||
|
||||
struct _E_Config_Module
|
||||
|
|
|
@ -19,10 +19,11 @@ static void _e_drag_show(E_Drag *drag);
|
|||
static void _e_drag_hide(E_Drag *drag);
|
||||
static void _e_drag_move(E_Drag *drag, int x, int y);
|
||||
static void _e_drag_coords_update(E_Drop_Handler *h, int *dx, int *dy, int *dw, int *dh);
|
||||
static Ecore_X_Window _e_drag_win_get(E_Drop_Handler *h, int xdnd);
|
||||
static int _e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win, int xdnd);
|
||||
static void _e_drag_win_show(E_Drop_Handler *h);
|
||||
static void _e_drag_win_hide(E_Drop_Handler *h);
|
||||
static void _e_drag_update(Ecore_X_Window root, int x, int y);
|
||||
static int _e_drag_update(Ecore_X_Window root, int x, int y, Ecore_X_Atom action);
|
||||
static void _e_drag_end(Ecore_X_Window root, int x, int y);
|
||||
static void _e_drag_xdnd_end(Ecore_X_Window root, int x, int y);
|
||||
static void _e_drag_free(E_Drag *drag);
|
||||
|
@ -62,6 +63,9 @@ static E_Drag *_drag_current = NULL;
|
|||
|
||||
static XDnd *_xdnd = NULL;
|
||||
|
||||
static Evas_Hash *_drop_handlers_responsives;
|
||||
static Ecore_X_Atom _action;
|
||||
|
||||
/* externally accessible functions */
|
||||
|
||||
EAPI int
|
||||
|
@ -98,6 +102,8 @@ e_dnd_init(void)
|
|||
_event_handlers = evas_list_append(_event_handlers,
|
||||
ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY,
|
||||
_e_dnd_cb_event_dnd_selection, NULL));
|
||||
|
||||
_action = ECORE_X_ATOM_XDND_ACTION_PRIVATE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -128,6 +134,8 @@ e_dnd_shutdown(void)
|
|||
evas_list_free(_drop_handlers);
|
||||
_drop_handlers = NULL;
|
||||
|
||||
evas_hash_free(_drop_handlers_responsives);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -491,6 +499,36 @@ e_drag_idler_before(void)
|
|||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_drop_handler_responsive_set(E_Drop_Handler *handler)
|
||||
{
|
||||
Ecore_X_Window hwin = _e_drag_win_get(handler, 1);
|
||||
const char *wid = e_util_winid_str_get(hwin);
|
||||
|
||||
_drop_handlers_responsives = evas_hash_add(_drop_handlers_responsives, wid, (void *)handler);
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_drop_handler_responsive_get(E_Drop_Handler *handler)
|
||||
{
|
||||
Ecore_X_Window hwin = _e_drag_win_get(handler, 1);
|
||||
const char *wid = e_util_winid_str_get(hwin);
|
||||
|
||||
return evas_hash_find(_drop_handlers_responsives, wid) == (void *)handler;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_drop_handler_action_set(Ecore_X_Atom action)
|
||||
{
|
||||
_action = action;
|
||||
}
|
||||
|
||||
EAPI Ecore_X_Atom
|
||||
e_drop_handler_action_get()
|
||||
{
|
||||
return _action;
|
||||
}
|
||||
|
||||
/* local subsystem functions */
|
||||
|
||||
static void
|
||||
|
@ -574,8 +612,8 @@ _e_drag_coords_update(E_Drop_Handler *h, int *dx, int *dy, int *dw, int *dh)
|
|||
*dy += py;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win, int xdnd)
|
||||
static Ecore_X_Window
|
||||
_e_drag_win_get(E_Drop_Handler *h, int xdnd)
|
||||
{
|
||||
Ecore_X_Window hwin = 0;
|
||||
|
||||
|
@ -608,6 +646,15 @@ _e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win, int xdnd)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return hwin;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win, int xdnd)
|
||||
{
|
||||
Ecore_X_Window hwin = _e_drag_win_get(h, xdnd);
|
||||
|
||||
if (win == hwin) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -660,8 +707,8 @@ _e_drag_win_hide(E_Drop_Handler *h)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_drag_update(Ecore_X_Window root, int x, int y)
|
||||
static int
|
||||
_e_drag_update(Ecore_X_Window root, int x, int y, Ecore_X_Atom action)
|
||||
{
|
||||
Evas_List *l;
|
||||
E_Event_Dnd_Enter enter_ev;
|
||||
|
@ -669,6 +716,7 @@ _e_drag_update(Ecore_X_Window root, int x, int y)
|
|||
E_Event_Dnd_Leave leave_ev;
|
||||
int dx, dy, dw, dh;
|
||||
Ecore_X_Window win, ignore_win[2];
|
||||
int responsive = 0;
|
||||
|
||||
// double t1 = ecore_time_get(); ////
|
||||
if (_drag_current)
|
||||
|
@ -702,12 +750,16 @@ _e_drag_update(Ecore_X_Window root, int x, int y)
|
|||
enter_ev.x = x - dx;
|
||||
enter_ev.y = y - dy;
|
||||
enter_ev.data = NULL;
|
||||
enter_ev.action = action;
|
||||
move_ev.x = x - dx;
|
||||
move_ev.y = y - dy;
|
||||
move_ev.action = action;
|
||||
leave_ev.x = x - dx;
|
||||
leave_ev.y = y - dy;
|
||||
if (E_INSIDE(x, y, dx, dy, dw, dh) && _e_drag_win_matches(h, win, 0))
|
||||
{
|
||||
if(e_drop_handler_responsive_get(h)) responsive = 1;
|
||||
|
||||
if (!h->entered)
|
||||
{
|
||||
_e_drag_win_show(h);
|
||||
|
@ -750,12 +802,16 @@ _e_drag_update(Ecore_X_Window root, int x, int y)
|
|||
_e_drag_coords_update(h, &dx, &dy, &dw, &dh);
|
||||
enter_ev.x = x - dx;
|
||||
enter_ev.y = y - dy;
|
||||
enter_ev.action = action;
|
||||
move_ev.x = x - dx;
|
||||
move_ev.y = y - dy;
|
||||
move_ev.action = action;
|
||||
leave_ev.x = x - dx;
|
||||
leave_ev.y = y - dy;
|
||||
if (E_INSIDE(x, y, dx, dy, dw, dh) && _e_drag_win_matches(h, win, 1))
|
||||
{
|
||||
if(e_drop_handler_responsive_get(h)) responsive = 1;
|
||||
|
||||
if (!h->entered)
|
||||
{
|
||||
if (h->cb.enter)
|
||||
|
@ -776,6 +832,10 @@ _e_drag_update(Ecore_X_Window root, int x, int y)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(action == ECORE_X_ATOM_ATOM) responsive = 0;
|
||||
|
||||
return responsive;
|
||||
// double t2 = ecore_time_get() - t1; ////
|
||||
// printf("DND UPDATE %3.7f\n", t2); ////
|
||||
}
|
||||
|
@ -1009,7 +1069,7 @@ _e_dnd_cb_mouse_move(void *data, int type, void *event)
|
|||
ev = event;
|
||||
if (ev->win != _drag_win) return 1;
|
||||
|
||||
_e_drag_update(_drag_win_root, ev->x, ev->y);
|
||||
_e_drag_update(_drag_win_root, ev->x, ev->y, ECORE_X_ATOM_ATOM);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1133,10 +1193,13 @@ _e_dnd_cb_event_dnd_position(void *data, int type, void *event)
|
|||
{
|
||||
Ecore_X_Event_Xdnd_Position *ev;
|
||||
Ecore_X_Rectangle rect;
|
||||
Ecore_X_Action action;
|
||||
const char *id;
|
||||
const char *description = NULL;
|
||||
Evas_List *l;
|
||||
|
||||
int active;
|
||||
int responsive;
|
||||
|
||||
ev = event;
|
||||
// double t1 = ecore_time_get(); ////
|
||||
|
@ -1153,6 +1216,8 @@ _e_dnd_cb_event_dnd_position(void *data, int type, void *event)
|
|||
rect.width = 0;
|
||||
rect.height = 0;
|
||||
|
||||
action = ev->action;
|
||||
|
||||
active = 0;
|
||||
for (l = _drop_handlers; l; l = l->next)
|
||||
{
|
||||
|
@ -1171,8 +1236,15 @@ _e_dnd_cb_event_dnd_position(void *data, int type, void *event)
|
|||
}
|
||||
else
|
||||
{
|
||||
_e_drag_update(ev->win, ev->position.x, ev->position.y);
|
||||
ecore_x_dnd_send_status(1, 0, rect, ECORE_X_DND_ACTION_PRIVATE);
|
||||
responsive = _e_drag_update(ev->win, ev->position.x, ev->position.y, ev->action);
|
||||
if(responsive)
|
||||
{
|
||||
ecore_x_dnd_send_status(1, 0, rect, _action);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecore_x_dnd_send_status(1, 0, rect, ECORE_X_ATOM_XDND_ACTION_PRIVATE);
|
||||
}
|
||||
}
|
||||
// double t2 = ecore_time_get() - t1; ////
|
||||
// printf("DND POS EV 2 %3.7f\n", t2); ////
|
||||
|
|
|
@ -84,11 +84,13 @@ struct _E_Event_Dnd_Enter
|
|||
{
|
||||
void *data;
|
||||
int x, y;
|
||||
Ecore_X_Atom action;
|
||||
};
|
||||
|
||||
struct _E_Event_Dnd_Move
|
||||
{
|
||||
int x, y;
|
||||
Ecore_X_Atom action;
|
||||
};
|
||||
|
||||
struct _E_Event_Dnd_Leave
|
||||
|
@ -135,6 +137,10 @@ EAPI void e_drop_handler_geometry_set(E_Drop_Handler *handler, int x, int y, int
|
|||
EAPI int e_drop_inside(E_Drop_Handler *handler, int x, int y);
|
||||
EAPI void e_drop_handler_del(E_Drop_Handler *handler);
|
||||
EAPI int e_drop_xdnd_register_set(Ecore_X_Window win, int reg);
|
||||
EAPI void e_drop_handler_responsive_set(E_Drop_Handler *handler);
|
||||
EAPI int e_drop_handler_responsive_get(E_Drop_Handler *handler);
|
||||
EAPI void e_drop_handler_action_set(Ecore_X_Atom action);
|
||||
EAPI Ecore_X_Atom e_drop_handler_action_get();
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
549
src/bin/e_fm.c
549
src/bin/e_fm.c
|
@ -350,17 +350,20 @@ static void _e_fm2_client_spawn(void);
|
|||
static E_Fm2_Client *_e_fm2_client_get(void);
|
||||
static int _e_fm2_client_monitor_add(const char *path);
|
||||
static void _e_fm2_client_monitor_del(int id, const char *path);
|
||||
static int _e_fm2_client_file_del(const char *path);
|
||||
static int _e_fm_client_file_del(const char *args);
|
||||
static int _e_fm2_client_file_trash(const char *path);
|
||||
static int _e_fm2_client_file_mkdir(const char *path, const char *rel, int rel_to, int x, int y, int res_w, int res_h);
|
||||
static int _e_fm2_client_file_move(const char *path, const char *dest, const char *rel, int rel_to, int x, int y, int res_w, int res_h);
|
||||
static int _e_fm_client_file_move(const char *args);
|
||||
static int _e_fm2_client_file_symlink(const char *path, const char *dest, const char *rel, int rel_to, int x, int y, int res_w, int res_h);
|
||||
static int _e_fm2_client_file_copy(const char *path, const char *dest, const char *rel, int rel_to, int x, int y, int res_w, int res_h);
|
||||
static int _e_fm_client_file_copy(const char *args);
|
||||
|
||||
static void _e_fm2_sel_rect_update(void *data);
|
||||
static inline void _e_fm2_context_menu_append(Evas_Object *obj, const char *path, Evas_List *l, E_Menu *mn, E_Fm2_Icon *ic);
|
||||
static int _e_fm2_context_list_sort(void *data1, void *data2);
|
||||
|
||||
static char *_e_fm_string_append_char(char *str, size_t *size, size_t *len, char c);
|
||||
static char *_e_fm_string_append_quoted(char *str, size_t *size, size_t *len, const char *src);
|
||||
|
||||
static char *_e_fm2_meta_path = NULL;
|
||||
static Evas_Smart *_e_fm2_smart = NULL;
|
||||
static Evas_List *_e_fm2_list = NULL;
|
||||
|
@ -982,6 +985,7 @@ e_fm2_window_object_set(Evas_Object *obj, E_Object *eobj)
|
|||
_e_fm2_cb_dnd_leave,
|
||||
_e_fm2_cb_dnd_drop,
|
||||
drop, 3, sd->x, sd->y, sd->w, sd->h);
|
||||
e_drop_handler_responsive_set(sd->drop_handler);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -1622,28 +1626,13 @@ _e_fm2_client_monitor_add(const char *path)
|
|||
static void
|
||||
_e_fm2_client_monitor_del(int id, const char *path)
|
||||
{
|
||||
E_Fm2_Client *cl;
|
||||
|
||||
cl = _e_fm2_client_get();
|
||||
if (!cl)
|
||||
{
|
||||
_e_fm2_client_message_queue(E_IPC_DOMAIN_FM, E_FM_OP_MONITOR_END,
|
||||
id, 0, 0,
|
||||
(void *)path, strlen(path) + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, E_FM_OP_MONITOR_END,
|
||||
id, 0, 0,
|
||||
(void *)path, strlen(path) + 1);
|
||||
cl->req++;
|
||||
}
|
||||
_e_fm_client_send(E_FM_OP_MONITOR_END, id, (void *)path, strlen(path) + 1);
|
||||
}
|
||||
|
||||
static int
|
||||
_e_fm2_client_file_del(const char *path)
|
||||
_e_fm_client_file_del(const char *files)
|
||||
{
|
||||
return _e_fm_client_send_new(E_FM_OP_REMOVE, (void *)path, strlen(path) + 1);
|
||||
return _e_fm_client_send_new(E_FM_OP_REMOVE, (void *)files, strlen(files) + 1);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1672,43 +1661,9 @@ _e_fm2_client_file_mkdir(const char *path, const char *rel, int rel_to, int x, i
|
|||
}
|
||||
|
||||
static int
|
||||
_e_fm2_client_file_move(const char *path, const char *dest, const char *rel, int rel_to, int x, int y, int res_w, int res_h)
|
||||
_e_fm_client_file_move(const char *args)
|
||||
{
|
||||
char *d;
|
||||
int l1, l2, l3, l;
|
||||
|
||||
l1 = strlen(path);
|
||||
l2 = strlen(dest);
|
||||
l3 = strlen(rel);
|
||||
l = l1 + 1 + l2 + 1 + l3 + 1 + (sizeof(int) * 3);
|
||||
d = alloca(l);
|
||||
strcpy(d, path);
|
||||
strcpy(d + l1 + 1, dest);
|
||||
strcpy(d + l1 + 1 + l2 + 1, rel);
|
||||
memcpy(d + l1 + 1 + l2 + 1 + l3 + 1, &rel_to, sizeof(int));
|
||||
memcpy(d + l1 + 1 + l2 + 1 + l3 + 1 + sizeof(int), &x, sizeof(int));
|
||||
memcpy(d + l1 + 1 + l2 + 1 + l3 + 1 + (2 * sizeof(int)), &y, sizeof(int));
|
||||
|
||||
if ((x != -9999) && (y != -9999))
|
||||
{
|
||||
E_Fm2_Custom_File *cf, cf0;
|
||||
|
||||
cf = e_fm2_custom_file_get(dest);
|
||||
if (!cf)
|
||||
{
|
||||
memset(&cf0, 0, sizeof(E_Fm2_Custom_File));
|
||||
cf = &cf0;
|
||||
}
|
||||
cf->geom.x = x;
|
||||
cf->geom.y = y;
|
||||
cf->geom.res_w = res_w;
|
||||
cf->geom.res_h = res_h;
|
||||
cf->geom.valid = 1;
|
||||
e_fm2_custom_file_set(dest, cf);
|
||||
e_fm2_custom_file_flush();
|
||||
}
|
||||
|
||||
return _e_fm_client_send_new(E_FM_OP_MOVE, (void *)d, l);
|
||||
return _e_fm_client_send_new(E_FM_OP_MOVE, (void *)args, strlen(args) + 1);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1753,43 +1708,9 @@ _e_fm2_client_file_symlink(const char *path, const char *dest, const char *rel,
|
|||
}
|
||||
|
||||
static int
|
||||
_e_fm2_client_file_copy(const char *path, const char *dest, const char *rel, int rel_to, int x, int y, int res_w, int res_h)
|
||||
_e_fm_client_file_copy(const char *args)
|
||||
{
|
||||
char *d;
|
||||
int l1, l2, l3, l;
|
||||
|
||||
l1 = strlen(path);
|
||||
l2 = strlen(dest);
|
||||
l3 = strlen(rel);
|
||||
l = l1 + 1 + l2 + 1 + l3 + 1 + (sizeof(int) * 3);
|
||||
d = alloca(l);
|
||||
strcpy(d, path);
|
||||
strcpy(d + l1 + 1, dest);
|
||||
strcpy(d + l1 + 1 + l2 + 1, rel);
|
||||
memcpy(d + l1 + 1 + l2 + 1 + l3 + 1, &rel_to, sizeof(int));
|
||||
memcpy(d + l1 + 1 + l2 + 1 + l3 + 1 + sizeof(int), &x, sizeof(int));
|
||||
memcpy(d + l1 + 1 + l2 + 1 + l3 + 1 + (2 * sizeof(int)), &y, sizeof(int));
|
||||
|
||||
if ((x != -9999) && (y != -9999))
|
||||
{
|
||||
E_Fm2_Custom_File *cf, cf0;
|
||||
|
||||
cf = e_fm2_custom_file_get(dest);
|
||||
if (!cf)
|
||||
{
|
||||
memset(&cf0, 0, sizeof(E_Fm2_Custom_File));
|
||||
cf = &cf0;
|
||||
}
|
||||
cf->geom.x = x;
|
||||
cf->geom.y = y;
|
||||
cf->geom.res_w = res_w;
|
||||
cf->geom.res_h = res_h;
|
||||
cf->geom.valid = 1;
|
||||
e_fm2_custom_file_set(dest, cf);
|
||||
e_fm2_custom_file_flush();
|
||||
}
|
||||
|
||||
return _e_fm_client_send_new(E_FM_OP_COPY, (void *)d, l);
|
||||
return _e_fm_client_send_new(E_FM_OP_COPY, (void *)args, strlen(args) + 1);
|
||||
}
|
||||
|
||||
EAPI int
|
||||
|
@ -2130,6 +2051,7 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
|
|||
if (s) e_fm2_hal_storage_add(s);
|
||||
}
|
||||
break;
|
||||
|
||||
case E_FM_OP_STORAGE_DEL:/*storage del*/
|
||||
if ((e->data) && (e->size > 0))
|
||||
{
|
||||
|
@ -2151,6 +2073,7 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
|
|||
if (v) e_fm2_hal_volume_add(v);
|
||||
}
|
||||
break;
|
||||
|
||||
case E_FM_OP_VOLUME_DEL:/*volume del*/
|
||||
if ((e->data) && (e->size > 0))
|
||||
{
|
||||
|
@ -2175,6 +2098,7 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
|
|||
if (v) e_fm2_hal_mount_add(v, mountpoint);
|
||||
}
|
||||
break;
|
||||
|
||||
case E_FM_OP_UNMOUNT_DONE:/*unmount done*/
|
||||
if ((e->data) && (e->size > 1))
|
||||
{
|
||||
|
@ -2190,6 +2114,8 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
|
|||
v->mount_point = NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case E_FM_OP_ERROR:/*error*/
|
||||
printf("%s:%s(%d) Error from slave #%d: %s\n", __FILE__, __FUNCTION__, __LINE__, e->ref, e->data);
|
||||
_e_fm_error_dialog(e->ref, e->data);
|
||||
|
@ -2208,14 +2134,24 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
|
|||
case E_FM_OP_PROGRESS:/*progress*/
|
||||
{
|
||||
int percent, seconds;
|
||||
size_t done, total;
|
||||
char *src = NULL;
|
||||
char *dst = NULL;
|
||||
void *p = e->data;
|
||||
|
||||
if (!e->data || e->size != 2 * sizeof(int)) return;
|
||||
if (!e->data) return;
|
||||
|
||||
percent = *(int *)e->data;
|
||||
seconds = *(int *)(e->data + sizeof(int));
|
||||
printf("%s:%s(%d) Progress from slave #%d: %d%% done, %d seconds left.\n", __FILE__, __FUNCTION__, __LINE__, e->ref, percent, seconds);
|
||||
break;
|
||||
#define UP(value, type) (value) = *(type *)p; p += sizeof(type)
|
||||
UP(percent, int);
|
||||
UP(seconds, int);
|
||||
UP(done, size_t);
|
||||
UP(total, size_t);
|
||||
#undef UP
|
||||
src = p;
|
||||
dst = p + strlen(src) + 1;
|
||||
printf("%s:%s(%d) Progress from slave #%d:\n\t%d%% done,\n\t%d seconds left,\n\t%lu done,\n\t%lu total,\n\tsrc = %s,\n\tdst = %s.\n", __FILE__, __FUNCTION__, __LINE__, e->ref, percent, seconds, done, total, src, dst);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -2538,20 +2474,20 @@ _e_fm2_file_paste(void *data, E_Menu *m, E_Menu_Item *mi)
|
|||
E_Fm2_Smart_Data *sd;
|
||||
Evas_List *paths;
|
||||
const char *dirpath;
|
||||
const char *filepath;
|
||||
size_t length = 0;
|
||||
size_t size = 0;
|
||||
char *args = NULL;
|
||||
|
||||
sd = data;
|
||||
if (!sd) return;
|
||||
|
||||
/* Convert URI list to a list of real paths. */
|
||||
paths = _e_fm2_uri_path_list_get(_e_fm_file_buffer);
|
||||
|
||||
dirpath = e_fm2_real_path_get(sd->obj);
|
||||
while (paths)
|
||||
{
|
||||
char *filepath;
|
||||
const char *filename;
|
||||
char buf[PATH_MAX];
|
||||
int protect = 0;
|
||||
|
||||
/* Get file's full path. */
|
||||
filepath = evas_list_data(paths);
|
||||
if (!filepath)
|
||||
{
|
||||
|
@ -2559,30 +2495,38 @@ _e_fm2_file_paste(void *data, E_Menu *m, E_Menu_Item *mi)
|
|||
continue;
|
||||
}
|
||||
|
||||
filename = ecore_file_file_get(filepath);
|
||||
snprintf(buf, sizeof(buf), "%s/%s", dirpath, filename);
|
||||
protect = e_filereg_file_protected(filepath);
|
||||
|
||||
if (protect)
|
||||
/* Check if file is protected. */
|
||||
if (e_filereg_file_protected(filepath))
|
||||
{
|
||||
evas_stringshare_del(filepath);
|
||||
paths = evas_list_remove_list(paths, paths);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_e_fm_file_buffer_copying)
|
||||
{
|
||||
_e_fm2_client_file_copy(filepath, buf, "", 0,
|
||||
-9999, -9999, sd->w, sd->h);
|
||||
}
|
||||
else if (_e_fm_file_buffer_cutting)
|
||||
{
|
||||
_e_fm2_client_file_move(filepath, buf, "", 0,
|
||||
-9999, -9999, sd->w, sd->h);
|
||||
}
|
||||
/* Put filepath into a string of args.
|
||||
* If there are more files, put an additional space.
|
||||
*/
|
||||
args = _e_fm_string_append_quoted(args, &size, &length, filepath);
|
||||
args = _e_fm_string_append_char(args, &size, &length, ' ');
|
||||
|
||||
evas_stringshare_del(filepath);
|
||||
paths = evas_list_remove_list(paths, paths);
|
||||
}
|
||||
|
||||
/* Add destination to the arguments. */
|
||||
args = _e_fm_string_append_quoted(args, &size, &length, sd->realpath);
|
||||
|
||||
/* Roll the operation! */
|
||||
if(_e_fm_file_buffer_copying)
|
||||
{
|
||||
_e_fm_client_file_copy(args);
|
||||
}
|
||||
else
|
||||
{
|
||||
_e_fm_client_file_move(args);
|
||||
}
|
||||
|
||||
free(args);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3229,7 +3173,7 @@ _e_fm2_uri_escape(const char *path)
|
|||
dest[i] = *p;
|
||||
else
|
||||
{
|
||||
snprintf(&(dest[i]), 4, "%%%02X", *p);
|
||||
snprintf(&(dest[i]), 4, "%%%02X", (unsigned char)*p);
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
|
@ -4560,6 +4504,7 @@ _e_fm2_cb_dnd_enter(void *data, const char *type, void *event)
|
|||
if (strcmp(type, "text/uri-list")) return;
|
||||
ev = (E_Event_Dnd_Enter *)event;
|
||||
printf("DND IN %i %i\n", ev->x, ev->y);
|
||||
e_drop_handler_action_set(ev->action);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -4575,6 +4520,7 @@ _e_fm2_cb_dnd_move(void *data, const char *type, void *event)
|
|||
if (strcmp(type, "text/uri-list")) return;
|
||||
ev = (E_Event_Dnd_Move *)event;
|
||||
printf("DND MOVE %i %i\n", ev->x, ev->y);
|
||||
e_drop_handler_action_set(ev->action);
|
||||
for (l = sd->icons; l; l = l->next) /* FIXME: should only walk regions and skip non-visible ones */
|
||||
{
|
||||
ic = l->data;
|
||||
|
@ -4688,6 +4634,151 @@ _e_fm2_cb_dnd_leave(void *data, const char *type, void *event)
|
|||
_e_fm2_dnd_drop_all_hide(sd->obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_file_reorder(const char *file, const char *dst, const char *relative, int after)
|
||||
{
|
||||
unsigned int length = strlen(file) + 1 + strlen(dst) + 1 + strlen(relative) + 1 + sizeof(after);
|
||||
void *data, *p;
|
||||
|
||||
data = alloca(length);
|
||||
if(!data) return;
|
||||
|
||||
p = data;
|
||||
|
||||
#define P(s) memcpy(p, s, strlen(s) + 1); p += strlen(s) + 1
|
||||
P(file);
|
||||
P(dst);
|
||||
P(relative);
|
||||
#undef P
|
||||
|
||||
memcpy(p, &after, sizeof(int));
|
||||
|
||||
_e_fm_client_send_new(E_FM_OP_REORDER, data, length);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_icon_save_position(const char *file, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
|
||||
{
|
||||
E_Fm2_Custom_File *cf, new;
|
||||
|
||||
if(!file) return;
|
||||
|
||||
cf = e_fm2_custom_file_get(file);
|
||||
if(!cf)
|
||||
{
|
||||
memset(&new, 0, sizeof(E_Fm2_Custom_File));
|
||||
cf = &new;
|
||||
}
|
||||
|
||||
cf->geom.x = x;
|
||||
cf->geom.y = y;
|
||||
cf->geom.res_w = w;
|
||||
cf->geom.res_h = h;
|
||||
|
||||
cf->geom.valid = 1;
|
||||
e_fm2_custom_file_set(file, cf);
|
||||
e_fm2_custom_file_flush();
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_drop_menu_copy_cb(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
char *args = data;
|
||||
|
||||
if(!data) return;
|
||||
|
||||
_e_fm_client_file_copy(args);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_drop_menu_move_cb(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
char *args = data;
|
||||
|
||||
if(!data) return;
|
||||
|
||||
_e_fm_client_file_move(args);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_drop_menu_abort_cb(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
char *args = data;
|
||||
|
||||
if(!data) return;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_drop_menu_post_cb(void *data, E_Menu *m)
|
||||
{
|
||||
char *args = data;
|
||||
|
||||
if(!data) return;
|
||||
|
||||
free(args);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_drop_menu(char *args)
|
||||
{
|
||||
E_Menu *menu = e_menu_new();
|
||||
E_Menu_Item *item = NULL;
|
||||
E_Manager *man = NULL;
|
||||
E_Container *con = NULL;
|
||||
E_Zone *zone = NULL;
|
||||
int x, y;
|
||||
|
||||
if(!menu) return;
|
||||
|
||||
item = e_menu_item_new(menu);
|
||||
e_menu_item_label_set(item, _("Copy"));
|
||||
e_menu_item_callback_set(item, _e_fm_drop_menu_copy_cb, args);
|
||||
e_menu_item_icon_edje_set(item,
|
||||
e_theme_edje_file_get("base/theme/fileman",
|
||||
"e/fileman/default/button/copy"),
|
||||
"e/fileman/default/button/copy");
|
||||
|
||||
item = e_menu_item_new(menu);
|
||||
e_menu_item_label_set(item, _("Move"));
|
||||
e_menu_item_callback_set(item, _e_fm_drop_menu_move_cb, args);
|
||||
e_menu_item_icon_edje_set(item,
|
||||
e_theme_edje_file_get("base/theme/fileman",
|
||||
"e/fileman/default/button/move"),
|
||||
"e/fileman/default/button/move");
|
||||
|
||||
item = e_menu_item_new(menu);
|
||||
e_menu_item_label_set(item, _("Abort"));
|
||||
e_menu_item_callback_set(item, _e_fm_drop_menu_abort_cb, args);
|
||||
e_menu_item_icon_edje_set(item,
|
||||
e_theme_edje_file_get("base/theme/fileman",
|
||||
"e/fileman/default/button/abort"),
|
||||
"e/fileman/default/button/abort");
|
||||
|
||||
man = e_manager_current_get();
|
||||
if (!man)
|
||||
{
|
||||
e_object_del(E_OBJECT(menu));
|
||||
return;
|
||||
}
|
||||
con = e_container_current_get(man);
|
||||
if (!con)
|
||||
{
|
||||
e_object_del(E_OBJECT(menu));
|
||||
return;
|
||||
}
|
||||
ecore_x_pointer_xy_get(con->win, &x, &y);
|
||||
zone = e_util_zone_current_get(man);
|
||||
if (!zone)
|
||||
{
|
||||
e_object_del(E_OBJECT(menu));
|
||||
return;
|
||||
}
|
||||
e_menu_post_deactivate_callback_set(menu, _e_fm_drop_menu_post_cb, args);
|
||||
e_menu_activate_mouse(menu, zone,
|
||||
x, y, 1, 1,
|
||||
E_MENU_POP_DIRECTION_DOWN, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
|
||||
{
|
||||
|
@ -4700,6 +4791,11 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
|
|||
Evas_Coord dx, dy, ox, oy, x, y;
|
||||
int adjust_icons = 0;
|
||||
|
||||
char dirpath[PATH_MAX];
|
||||
char *args = NULL;
|
||||
size_t size = 0;
|
||||
size_t length = 0;
|
||||
|
||||
sd = data;
|
||||
if (!type) return;
|
||||
if (strcmp(type, "text/uri-list")) return;
|
||||
|
@ -4750,24 +4846,24 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
|
|||
ic = il->data;
|
||||
fp = ll->data;
|
||||
if (!fp) continue;
|
||||
snprintf(buf, sizeof(buf), "%s/%s",
|
||||
sd->realpath, ecore_file_file_get(fp));
|
||||
printf("mv %s %s\n", (char *)fp, buf);
|
||||
|
||||
if ((ic) && (sd->config->view.mode == E_FM2_VIEW_MODE_CUSTOM_ICONS))
|
||||
{
|
||||
/* dnd doesnt tell me all the co-ords of the icons being dragged so i can't place them accurately.
|
||||
* need to fix this. ev->data probably needs to become more compelx than a list of url's
|
||||
*/
|
||||
x = ev->x + (ic->x - ox) - ic->drag.x + sd->pos.x;
|
||||
y = ev->y + (ic->y - oy) - ic->drag.y + sd->pos.y;//ic->y - oy - dy + ev->y + sd->pos.y;
|
||||
y = ev->y + (ic->y - oy) - ic->drag.y + sd->pos.y;
|
||||
|
||||
if (x < 0) x = 0;
|
||||
if (y < 0) y = 0;
|
||||
|
||||
if (sd->config->view.fit_custom_pos)
|
||||
{
|
||||
if ((x + ic->w) > sd->w) x = (sd->w - ic->w);
|
||||
if ((y + ic->h) > sd->h) y = (sd->h - ic->h);
|
||||
}
|
||||
_e_fm2_client_file_move(fp, buf, "", 0, x, y, sd->w, sd->h);
|
||||
|
||||
if (ic->sd == sd)
|
||||
{
|
||||
ic->x = x;
|
||||
|
@ -4775,11 +4871,15 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
|
|||
ic->saved_pos = 1;
|
||||
adjust_icons = 1;
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/%s",
|
||||
sd->realpath, ecore_file_file_get(fp));
|
||||
_e_fm_icon_save_position(buf, x, y, sd->w, sd->h);
|
||||
}
|
||||
else
|
||||
{
|
||||
_e_fm2_client_file_move(fp, buf, "", 0, -9999, -9999, sd->w, sd->h);
|
||||
}
|
||||
|
||||
args = _e_fm_string_append_quoted(args, &size, &length, fp);
|
||||
args = _e_fm_string_append_char(args, &size, &length, ' ');
|
||||
|
||||
evas_stringshare_del(fp);
|
||||
}
|
||||
if (adjust_icons)
|
||||
|
@ -4795,6 +4895,8 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
|
|||
_e_fm2_obj_icons_place(sd);
|
||||
evas_object_smart_callback_call(sd->obj, "changed", NULL);
|
||||
}
|
||||
|
||||
args = _e_fm_string_append_quoted(args, &size, &length, sd->realpath);
|
||||
}
|
||||
else if (sd->drop_icon) /* inot or before/after an icon */
|
||||
{
|
||||
|
@ -4811,76 +4913,44 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
|
|||
snprintf(buf, sizeof(buf), "%s/%s/%s",
|
||||
sd->realpath, sd->drop_icon->info.file, ecore_file_file_get(fp));
|
||||
printf("mv %s %s\n", (char *)fp, buf);
|
||||
_e_fm2_client_file_move(fp, buf, "", 0, -9999, -9999, sd->w, sd->h);
|
||||
|
||||
args = _e_fm_string_append_quoted(args, &size, &length, fp);
|
||||
args = _e_fm_string_append_char(args, &size, &length, ' ');
|
||||
|
||||
evas_stringshare_del(fp);
|
||||
}
|
||||
|
||||
snprintf(dirpath, sizeof(dirpath), "%s/%s", sd->realpath, sd->drop_icon->info.file);
|
||||
args = _e_fm_string_append_quoted(args, &size, &length, dirpath);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sd->config->view.mode == E_FM2_VIEW_MODE_LIST) /* list */
|
||||
if (sd->config->view.mode == E_FM2_VIEW_MODE_LIST && sd->order_file) /* list */
|
||||
{
|
||||
if (sd->order_file) /* there is an order file */
|
||||
for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next)
|
||||
{
|
||||
if (sd->drop_after)
|
||||
ic = il->data;
|
||||
fp = ll->data;
|
||||
if (!fp) continue;
|
||||
snprintf(buf, sizeof(buf), "%s/%s",
|
||||
sd->realpath, ecore_file_file_get(fp));
|
||||
if (sd->config->view.link_drop)
|
||||
{
|
||||
for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next)
|
||||
{
|
||||
ic = il->data;
|
||||
fp = ll->data;
|
||||
if (!fp) continue;
|
||||
snprintf(buf, sizeof(buf), "%s/%s",
|
||||
sd->realpath, ecore_file_file_get(fp));
|
||||
if (sd->config->view.link_drop)
|
||||
{
|
||||
printf("ln -s %s %s\n", (char *)fp, buf);
|
||||
_e_fm2_client_file_symlink(buf, fp, sd->drop_icon->info.file, sd->drop_after, -9999, -9999, sd->h, sd->h);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("mv %s %s\n", (char *)fp, buf);
|
||||
_e_fm2_client_file_move(fp, buf, sd->drop_icon->info.file, sd->drop_after, -9999, -9999, sd->w, sd->h);
|
||||
}
|
||||
evas_stringshare_del(fp);
|
||||
}
|
||||
printf("ln -s %s %s\n", (char *)fp, buf);
|
||||
_e_fm2_client_file_symlink(buf, fp, sd->drop_icon->info.file, sd->drop_after, -9999, -9999, sd->h, sd->h);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next)
|
||||
{
|
||||
ic = il->data;
|
||||
fp = ll->data;
|
||||
if (!fp) continue;
|
||||
snprintf(buf, sizeof(buf), "%s/%s",
|
||||
sd->realpath, ecore_file_file_get(fp));
|
||||
if (sd->config->view.link_drop)
|
||||
{
|
||||
printf("ln -s %s %s\n", (char *)fp, buf);
|
||||
_e_fm2_client_file_symlink(buf, fp, sd->drop_icon->info.file, sd->drop_after, -9999, -9999, sd->w, sd->h);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("mv %s %s\n", (char *)fp, buf);
|
||||
_e_fm2_client_file_move(fp, buf, sd->drop_icon->info.file, sd->drop_after, -9999, -9999, sd->w, sd->h);
|
||||
}
|
||||
evas_stringshare_del(fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* no order file */
|
||||
{
|
||||
for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next)
|
||||
{
|
||||
ic = il->data;
|
||||
fp = ll->data;
|
||||
if (!fp) continue;
|
||||
/* move the file into the subdir */
|
||||
snprintf(buf, sizeof(buf), "%s/%s",
|
||||
sd->realpath, ecore_file_file_get(fp));
|
||||
printf("mv %s %s\n", (char *)fp, buf);
|
||||
_e_fm2_client_file_move(fp, buf, "", 0, -9999, -9999, sd->w, sd->h);
|
||||
evas_stringshare_del(fp);
|
||||
args = _e_fm_string_append_quoted(args, &size, &length, fp);
|
||||
args = _e_fm_string_append_char(args, &size, &length, ' ');
|
||||
}
|
||||
|
||||
_e_fm_file_reorder(ecore_file_file_get(fp), sd->realpath, sd->drop_icon->info.file, sd->drop_after);
|
||||
|
||||
evas_stringshare_del(fp);
|
||||
}
|
||||
|
||||
args = _e_fm_string_append_quoted(args, &size, &length, sd->realpath);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4889,17 +4959,32 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
|
|||
ic = il->data;
|
||||
fp = ll->data;
|
||||
if (!fp) continue;
|
||||
/* move the file into the subdir */
|
||||
snprintf(buf, sizeof(buf), "%s/%s",
|
||||
sd->realpath, ecore_file_file_get(fp));
|
||||
printf("mv %s %s\n", (char *)fp, buf);
|
||||
_e_fm2_client_file_move(fp, buf, "", 0, -9999, -9999, sd->w, sd->h);
|
||||
|
||||
args = _e_fm_string_append_quoted(args, &size, &length, fp);
|
||||
args = _e_fm_string_append_char(args, &size, &length, ' ');
|
||||
|
||||
evas_stringshare_del(fp);
|
||||
}
|
||||
args = _e_fm_string_append_quoted(args, &size, &length, sd->realpath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_COPY)
|
||||
{
|
||||
_e_fm_client_file_copy(args);
|
||||
free(args);
|
||||
}
|
||||
else if(e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_MOVE)
|
||||
{
|
||||
_e_fm_client_file_move(args);
|
||||
free(args);
|
||||
}
|
||||
else if(e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_ASK)
|
||||
{
|
||||
_e_fm_drop_menu(args);
|
||||
}
|
||||
|
||||
_e_fm2_dnd_drop_hide(sd->obj);
|
||||
_e_fm2_dnd_drop_all_hide(sd->obj);
|
||||
_e_fm2_list_walking++;
|
||||
|
@ -6953,8 +7038,11 @@ static void
|
|||
_e_fm2_file_rename_yes_cb(char *text, void *data)
|
||||
{
|
||||
E_Fm2_Icon *ic;
|
||||
char newpath[4096];
|
||||
char oldpath[4096];
|
||||
char oldpath[PATH_MAX];
|
||||
char newpath[PATH_MAX];
|
||||
char *args = NULL;
|
||||
size_t size = 0;
|
||||
size_t length = 0;
|
||||
|
||||
ic = data;
|
||||
ic->entry_dialog = NULL;
|
||||
|
@ -6963,7 +7051,13 @@ _e_fm2_file_rename_yes_cb(char *text, void *data)
|
|||
snprintf(oldpath, sizeof(oldpath), "%s/%s", ic->sd->realpath, ic->info.file);
|
||||
snprintf(newpath, sizeof(newpath), "%s/%s", ic->sd->realpath, text);
|
||||
if (e_filereg_file_protected(oldpath)) return;
|
||||
_e_fm2_client_file_move(oldpath, newpath, "", 0, -9999, -9999, ic->sd->w, ic->sd->h);
|
||||
|
||||
args = _e_fm_string_append_quoted(args, &size, &length, oldpath);
|
||||
args = _e_fm_string_append_char(args, &size, &length, ' ');
|
||||
args = _e_fm_string_append_quoted(args, &size, &length, newpath);
|
||||
|
||||
_e_fm_client_file_move(args);
|
||||
free(args);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7266,11 +7360,63 @@ _e_fm2_file_delete_delete_cb(void *obj)
|
|||
ic->dialog = NULL;
|
||||
}
|
||||
|
||||
static char *
|
||||
_e_fm_string_append_char(char *str, size_t *size, size_t *len, char c)
|
||||
{
|
||||
if(str == NULL)
|
||||
{
|
||||
str = malloc(4096);
|
||||
str[0] = '\x00';
|
||||
*size = 4096;
|
||||
*len = 0;
|
||||
}
|
||||
|
||||
if(*len >= *size - 1)
|
||||
{
|
||||
*size += 1024;
|
||||
str = realloc(str, *size);
|
||||
}
|
||||
|
||||
str[(*len)++] = c;
|
||||
str[*len] = '\x00';
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
_e_fm_string_append_quoted(char *str, size_t *size, size_t *len, const char *src)
|
||||
{
|
||||
str = _e_fm_string_append_char(str, size, len, '\'');
|
||||
|
||||
while (*src)
|
||||
{
|
||||
if (*src == '\'')
|
||||
{
|
||||
str = _e_fm_string_append_char(str, size, len, '\'');
|
||||
str = _e_fm_string_append_char(str, size, len, '\\');
|
||||
str = _e_fm_string_append_char(str, size, len, '\'');
|
||||
str = _e_fm_string_append_char(str, size, len, '\'');
|
||||
}
|
||||
else
|
||||
str = _e_fm_string_append_char(str, size, len, *src);
|
||||
|
||||
src++;
|
||||
}
|
||||
|
||||
str = _e_fm_string_append_char(str, size, len, '\'');
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm2_file_delete_yes_cb(void *data, E_Dialog *dialog)
|
||||
{
|
||||
E_Fm2_Icon *ic;
|
||||
char buf[4096];
|
||||
char buf[PATH_MAX];
|
||||
char *files = NULL;
|
||||
size_t size = 0;
|
||||
size_t len = 0;
|
||||
Evas_List *sel, *l;
|
||||
E_Fm2_Icon_Info *ici;
|
||||
|
||||
|
@ -7286,19 +7432,24 @@ _e_fm2_file_delete_yes_cb(void *data, E_Dialog *dialog)
|
|||
ici = l->data;
|
||||
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ici->file);
|
||||
if (e_filereg_file_protected(buf)) continue;
|
||||
printf("rm -rf %s\n", buf);
|
||||
_e_fm2_client_file_del(buf);
|
||||
|
||||
files = _e_fm_string_append_quoted(files, &size, &len, buf);
|
||||
if(l->next) files = _e_fm_string_append_char(files, &size, &len, ' ');
|
||||
}
|
||||
|
||||
evas_list_free(sel);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file);
|
||||
if (e_filereg_file_protected(buf)) return;
|
||||
printf("rm -rf %s\n", buf);
|
||||
_e_fm2_client_file_del(buf);
|
||||
files = _e_fm_string_append_quoted(files, &size, &len, buf);
|
||||
}
|
||||
|
||||
_e_fm_client_file_del(files);
|
||||
|
||||
free(files);
|
||||
|
||||
evas_object_smart_callback_call(ic->sd->obj, "files_deleted", NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ _e_fm2_volume_write(E_Volume *v)
|
|||
if (!v->storage) return;
|
||||
id = ecore_file_file_get(v->storage->udi);
|
||||
printf("vol write %s\n", id);
|
||||
snprintf(buf, sizeof(buf), "%s/.e/e/fileman/favorites/|%s_%d.desktop",
|
||||
snprintf(buf, sizeof(buf) - 1, "%s/.e/e/fileman/favorites/|%s_%d.desktop",
|
||||
e_user_homedir_get(), id, v->partition_number);
|
||||
|
||||
f = fopen(buf, "w");
|
||||
|
@ -292,13 +292,17 @@ _e_fm2_volume_write(E_Volume *v)
|
|||
v->udi);
|
||||
fclose(f);
|
||||
|
||||
snprintf(buf2, sizeof(buf2), "%s/Desktop/|%s_%d.desktop",
|
||||
e_user_homedir_get(), id, v->partition_number);
|
||||
ecore_file_symlink(buf, buf2);
|
||||
if(e_config->hal_desktop)
|
||||
{
|
||||
snprintf(buf2, sizeof(buf2) - 1, "%s/Desktop/|%s_%d.desktop",
|
||||
e_user_homedir_get(), id, v->partition_number);
|
||||
ecore_file_symlink(buf, buf2);
|
||||
}
|
||||
|
||||
/* FIXME: manipulate icon directly */
|
||||
_e_fm2_file_force_update(buf);
|
||||
_e_fm2_file_force_update(buf2);
|
||||
//_e_fm2_file_force_update(buf2);
|
||||
e_config;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,10 +323,14 @@ _e_fm2_volume_erase(E_Volume *v)
|
|||
e_user_homedir_get(), id, v->partition_number);
|
||||
ecore_file_unlink(buf);
|
||||
_e_fm2_file_force_update(buf);
|
||||
snprintf(buf, sizeof(buf) - 1, "%s/.e/e/fileman/favorites/|%s_%d.desktop",
|
||||
e_user_homedir_get(), id, v->partition_number);
|
||||
ecore_file_unlink(buf);
|
||||
_e_fm2_file_force_update(buf);
|
||||
|
||||
if(e_config->hal_desktop)
|
||||
{
|
||||
snprintf(buf, sizeof(buf) - 1, "%s/.e/e/fileman/favorites/|%s_%d.desktop",
|
||||
e_user_homedir_get(), id, v->partition_number);
|
||||
ecore_file_unlink(buf);
|
||||
_e_fm2_file_force_update(buf);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI E_Volume *
|
||||
|
@ -488,3 +496,62 @@ _e_fm2_hal_mount_timeout(E_Fm2_Mount *m)
|
|||
return 0;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_fm2_hal_show_desktop_icons(void)
|
||||
{
|
||||
Evas_List *l;
|
||||
E_Volume *v;
|
||||
char buf[PATH_MAX] = {0};
|
||||
char buf2[PATH_MAX] = {0};
|
||||
const char *id;
|
||||
|
||||
for(l = _e_vols; l; l = evas_list_next(l))
|
||||
{
|
||||
v = evas_list_data(l);
|
||||
|
||||
if(!v) continue;
|
||||
if (!v->storage) continue;
|
||||
|
||||
id = ecore_file_file_get(v->storage->udi);
|
||||
|
||||
snprintf(buf, sizeof(buf) - 1, "%s/.e/e/fileman/favorites/|%s_%d.desktop",
|
||||
e_user_homedir_get(), id, v->partition_number);
|
||||
|
||||
snprintf(buf2, sizeof(buf2) - 1, "%s/Desktop/|%s_%d.desktop",
|
||||
e_user_homedir_get(), id, v->partition_number);
|
||||
|
||||
if(ecore_file_exists(buf) && !ecore_file_exists(buf2))
|
||||
{
|
||||
ecore_file_symlink(buf, buf2);
|
||||
_e_fm2_file_force_update(buf2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_fm2_hal_hide_desktop_icons(void)
|
||||
{
|
||||
Evas_List *l;
|
||||
E_Volume *v;
|
||||
char buf[PATH_MAX] = {0};
|
||||
const char *id;
|
||||
|
||||
for(l = _e_vols; l; l = evas_list_next(l))
|
||||
{
|
||||
v = evas_list_data(l);
|
||||
|
||||
if(!v) continue;
|
||||
if (!v->storage) continue;
|
||||
|
||||
id = ecore_file_file_get(v->storage->udi);
|
||||
|
||||
snprintf(buf, sizeof(buf) - 1, "%s/Desktop/|%s_%d.desktop",
|
||||
e_user_homedir_get(), id, v->partition_number);
|
||||
|
||||
if(ecore_file_exists(buf))
|
||||
{
|
||||
ecore_file_unlink(buf);
|
||||
_e_fm2_file_force_update(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,4 +25,7 @@ EAPI E_Fm2_Mount *e_fm2_hal_mount(E_Volume *v,
|
|||
void *data);
|
||||
EAPI void e_fm2_hal_unmount(E_Fm2_Mount *m);
|
||||
|
||||
EAPI void e_fm2_hal_show_desktop_icons(void);
|
||||
EAPI void e_fm2_hal_hide_desktop_icons(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -140,7 +140,7 @@ static void _e_fm_handle_error_response(int id, E_Fm_Op_Type type);
|
|||
|
||||
static int _e_client_send(int id, E_Fm_Op_Type type, void *data, int size);
|
||||
|
||||
static int _e_fm_slave_run(E_Fm_Op_Type type, const char *src, const char *dst, int id);
|
||||
static int _e_fm_slave_run(E_Fm_Op_Type type, const char *args, int id);
|
||||
static E_Fm_Slave *_e_fm_slave_get(int id);
|
||||
static int _e_fm_slave_send(E_Fm_Slave *slave, E_Fm_Op_Type type, void *data, int size);
|
||||
static int _e_fm_slave_data_cb(void *data, int type, void *event);
|
||||
|
@ -160,10 +160,10 @@ static void _e_file_mon_list_sync(E_Dir *ed);
|
|||
static int _e_cb_file_mon_list_idler(void *data);
|
||||
static int _e_cb_fop_trash_idler(void *data);
|
||||
static char *_e_str_list_remove(Evas_List **list, char *str);
|
||||
static void _e_path_fix_order(const char *path, const char *rel, int rel_to, int x, int y);
|
||||
static void _e_fm_reorder(const char *file, const char *dst, const char *relative, int after);
|
||||
static void _e_dir_del(E_Dir *ed);
|
||||
|
||||
static const char *_e_prepare_command(E_Fm_Op_Type type, const char *src, const char *dst);
|
||||
static const char *_e_prepare_command(E_Fm_Op_Type type, const char *args);
|
||||
|
||||
#ifdef HAVE_EDBUS
|
||||
|
||||
|
@ -1256,7 +1256,7 @@ _e_fm_mkdir_try(E_Fm_Task *task)
|
|||
}
|
||||
else
|
||||
{
|
||||
_e_path_fix_order(task->src, task->rel, task->rel_to, task->x, task->y);
|
||||
_e_fm_reorder(ecore_file_file_get(task->src), ecore_file_dir_get(task->src), task->rel, task->rel_to);
|
||||
_e_fm_task_remove(task);
|
||||
}
|
||||
}
|
||||
|
@ -1315,6 +1315,7 @@ _e_fm_handle_error_response(int id, E_Fm_Op_Type type)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
_e_ipc_cb_server_data(void *data, int type, void *event)
|
||||
{
|
||||
|
@ -1322,7 +1323,6 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
|
|||
|
||||
e = event;
|
||||
if (e->major != 6/*E_IPC_DOMAIN_FM*/) return 1;
|
||||
printf("EFM: %d\n", e->minor);
|
||||
switch (e->minor)
|
||||
{
|
||||
case E_FM_OP_MONITOR_START: /* monitor dir (and implicitly list) */
|
||||
|
@ -1332,12 +1332,13 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
|
|||
break;
|
||||
case E_FM_OP_MONITOR_END: /* monitor dir end */
|
||||
{
|
||||
printf("End listing directory: %s\n", e->data);
|
||||
_e_fm_monitor_end(e->ref, e->data);
|
||||
}
|
||||
break;
|
||||
case E_FM_OP_REMOVE: /* fop delete file/dir */
|
||||
{
|
||||
_e_fm_slave_run(E_FM_OP_REMOVE, (const char *)e->data, NULL, e->ref);
|
||||
_e_fm_slave_run(E_FM_OP_REMOVE, (const char *)e->data, e->ref);
|
||||
}
|
||||
break;
|
||||
case E_FM_OP_TRASH: /* fop trash file/dir */
|
||||
|
@ -1356,32 +1357,12 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
|
|||
break;
|
||||
case E_FM_OP_MOVE: /* fop mv file/dir */
|
||||
{
|
||||
const char *src, *dst, *rel;
|
||||
int rel_to, x, y;
|
||||
|
||||
src = e->data;
|
||||
dst = src + strlen(src) + 1;
|
||||
rel = dst + strlen(dst) + 1;
|
||||
memcpy(&rel_to, rel + strlen(rel) + 1, sizeof(int));
|
||||
memcpy(&x, rel + strlen(rel) + 1 + sizeof(int), sizeof(int));
|
||||
memcpy(&y, rel + strlen(rel) + 1 + sizeof(int), sizeof(int));
|
||||
|
||||
_e_fm_slave_run(E_FM_OP_MOVE, src, dst, e->ref);
|
||||
_e_fm_slave_run(E_FM_OP_MOVE, (const char *)e->data, e->ref);
|
||||
}
|
||||
break;
|
||||
case E_FM_OP_COPY: /* fop cp file/dir */
|
||||
{
|
||||
const char *src, *dst, *rel;
|
||||
int rel_to, x, y;
|
||||
|
||||
src = e->data;
|
||||
dst = src + strlen(src) + 1;
|
||||
rel = dst + strlen(dst) + 1;
|
||||
memcpy(&rel_to, rel + strlen(rel) + 1, sizeof(int));
|
||||
memcpy(&x, rel + strlen(rel) + 1 + sizeof(int), sizeof(int));
|
||||
memcpy(&y, rel + strlen(rel) + 1 + sizeof(int), sizeof(int));
|
||||
|
||||
_e_fm_slave_run(E_FM_OP_COPY, src, dst, e->ref);
|
||||
_e_fm_slave_run(E_FM_OP_COPY, (const char *)e->data, e->ref);
|
||||
}
|
||||
break;
|
||||
case E_FM_OP_MKDIR: /* fop mkdir */
|
||||
|
@ -1501,6 +1482,26 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
|
|||
_e_fm_slave_send(_e_fm_slave_get(e->ref), e->minor, NULL, 0);
|
||||
}
|
||||
break;
|
||||
case E_FM_OP_REORDER:
|
||||
{
|
||||
const char *file, *dst, *relative;
|
||||
int after;
|
||||
void *p = e->data;
|
||||
|
||||
file = p;
|
||||
p += strlen(file) + 1;
|
||||
|
||||
dst = p;
|
||||
p += strlen(dst) + 1;
|
||||
|
||||
relative = p;
|
||||
p += strlen(relative) + 1;
|
||||
|
||||
after = *(int *)p;
|
||||
|
||||
_e_fm_reorder(file, dst, relative, after);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1523,7 +1524,7 @@ static int _e_client_send(int id, E_Fm_Op_Type type, void *data, int size)
|
|||
id, 0, 0, data, size);
|
||||
}
|
||||
|
||||
static int _e_fm_slave_run(E_Fm_Op_Type type, const char *src, const char *dst, int id)
|
||||
static int _e_fm_slave_run(E_Fm_Op_Type type, const char *args, int id)
|
||||
{
|
||||
E_Fm_Slave *slave;
|
||||
const char *command;
|
||||
|
@ -1533,7 +1534,7 @@ static int _e_fm_slave_run(E_Fm_Op_Type type, const char *src, const char *dst,
|
|||
|
||||
if (!slave) return 0;
|
||||
|
||||
command = evas_stringshare_add(_e_prepare_command(type, src, dst));
|
||||
command = evas_stringshare_add(_e_prepare_command(type, args));
|
||||
|
||||
slave->id = id;
|
||||
slave->exe = ecore_exe_pipe_run(command, ECORE_EXE_PIPE_WRITE | ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR, slave );
|
||||
|
@ -2076,43 +2077,40 @@ _e_str_list_remove(Evas_List **list, char *str)
|
|||
}
|
||||
|
||||
static void
|
||||
_e_path_fix_order(const char *path, const char *rel, int rel_to, int x, int y)
|
||||
_e_fm_reorder(const char *file, const char *dst, const char *relative, int after)
|
||||
{
|
||||
char *d, buf[PATH_MAX];
|
||||
const char *f;
|
||||
char buffer[PATH_MAX];
|
||||
char order[PATH_MAX];
|
||||
|
||||
if (!path) return;
|
||||
if (!rel[0]) return;
|
||||
f = ecore_file_file_get(path);
|
||||
if (!f) return;
|
||||
if (!strcmp(f, rel)) return;
|
||||
d = ecore_file_dir_get(path);
|
||||
if (!d) return;
|
||||
snprintf(buf, sizeof(buf), "%s/.order", d);
|
||||
if (ecore_file_exists(buf))
|
||||
if(!file || !dst || !relative) return;
|
||||
if(after != 0 && after != 1 && after != 2) return;
|
||||
printf("%s:%s(%d) Reorder:\n\tfile = %s\n\tdst = %s\n\trelative = %s\n\tafter = %d\n", __FILE__, __FUNCTION__, __LINE__, file, dst, relative, after);
|
||||
|
||||
snprintf(order, sizeof(order), "%s/.order", dst);
|
||||
if(ecore_file_exists(order))
|
||||
{
|
||||
FILE *fh;
|
||||
FILE *forder;
|
||||
Evas_List *files = NULL, *l;
|
||||
|
||||
fh = fopen(buf, "r");
|
||||
if (fh)
|
||||
forder = fopen(order, "r");
|
||||
if (forder)
|
||||
{
|
||||
int len;
|
||||
|
||||
/* inset files in order if the existed in file
|
||||
* list before */
|
||||
while (fgets(buf, sizeof(buf), fh))
|
||||
while (fgets(buffer, sizeof(buffer), forder))
|
||||
{
|
||||
len = strlen(buf);
|
||||
if (len > 0) buf[len - 1] = 0;
|
||||
files = evas_list_append(files, strdup(buf));
|
||||
len = strlen(buffer);
|
||||
if (len > 0) buffer[len - 1] = 0;
|
||||
files = evas_list_append(files, strdup(buffer));
|
||||
}
|
||||
fclose(fh);
|
||||
fclose(forder);
|
||||
}
|
||||
/* remove dest file from .order - if there */
|
||||
for (l = files; l; l = l->next)
|
||||
{
|
||||
if (!strcmp(l->data, f))
|
||||
if (!strcmp(l->data, file))
|
||||
{
|
||||
free(l->data);
|
||||
files = evas_list_remove_list(files, l);
|
||||
|
@ -2122,38 +2120,37 @@ _e_path_fix_order(const char *path, const char *rel, int rel_to, int x, int y)
|
|||
/* now insert dest into list or replace entry */
|
||||
for (l = files; l; l = l->next)
|
||||
{
|
||||
if (!strcmp(l->data, rel))
|
||||
if (!strcmp(l->data, relative))
|
||||
{
|
||||
if (rel_to == 2) /* replace */
|
||||
if (after == 2) /* replace */
|
||||
{
|
||||
free(l->data);
|
||||
l->data = strdup(f);
|
||||
l->data = strdup(file);
|
||||
}
|
||||
else if (rel_to == 0) /* before */
|
||||
else if (after == 0) /* before */
|
||||
{
|
||||
files = evas_list_prepend_relative_list(files, strdup(f), l);
|
||||
files = evas_list_prepend_relative_list(files, strdup(file), l);
|
||||
}
|
||||
else if (rel_to == 1) /* after */
|
||||
else if (after == 1) /* after */
|
||||
{
|
||||
files = evas_list_append_relative_list(files, strdup(f), l);
|
||||
files = evas_list_append_relative_list(files, strdup(file), l);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%s/.order", d);
|
||||
fh = fopen(buf, "w");
|
||||
if (fh)
|
||||
|
||||
forder = fopen(order, "w");
|
||||
if (forder)
|
||||
{
|
||||
while (files)
|
||||
{
|
||||
fprintf(fh, "%s\n", (char *)files->data);
|
||||
fprintf(forder, "%s\n", (char *)files->data);
|
||||
free(files->data);
|
||||
files = evas_list_remove_list(files, files);
|
||||
}
|
||||
fclose(fh);
|
||||
fclose(forder);
|
||||
}
|
||||
}
|
||||
free(d);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2180,40 +2177,10 @@ _e_dir_del(E_Dir *ed)
|
|||
free(ed);
|
||||
}
|
||||
|
||||
static void _e_append_char(char **str, int *size, int c)
|
||||
static const char *_e_prepare_command(E_Fm_Op_Type type, const char *args)
|
||||
{
|
||||
**str = c;
|
||||
(*str) ++;
|
||||
*size++;
|
||||
}
|
||||
|
||||
static void _e_append_quoted(char **str, int *size, const char *src)
|
||||
{
|
||||
while (*src)
|
||||
{
|
||||
if (*src == '\'')
|
||||
{
|
||||
_e_append_char(str, size, '\'');
|
||||
_e_append_char(str, size, '\\');
|
||||
_e_append_char(str, size, '\'');
|
||||
_e_append_char(str, size, '\'');
|
||||
}
|
||||
else
|
||||
_e_append_char(str, size, *src);
|
||||
|
||||
src++;
|
||||
}
|
||||
}
|
||||
/* Returns a string like
|
||||
* /usr/bin/englightement_op cp 'src' 'dst'
|
||||
* ready to pass to ecore_exe_pipe_run()
|
||||
*/
|
||||
|
||||
static const char *_e_prepare_command(E_Fm_Op_Type type, const char *src, const char *dst)
|
||||
{
|
||||
char buffer[PATH_MAX* 3 + 512];
|
||||
int length = 0;
|
||||
char *buf = &buffer[0];
|
||||
char *buffer;
|
||||
unsigned int length = 0;
|
||||
char command[3];
|
||||
|
||||
if (type == E_FM_OP_MOVE)
|
||||
|
@ -2223,21 +2190,9 @@ static const char *_e_prepare_command(E_Fm_Op_Type type, const char *src, const
|
|||
else
|
||||
strcpy(command, "cp");
|
||||
|
||||
length = snprintf(buf, sizeof(buffer), "%s/enlightenment_fm_op %s \'", e_prefix_bin_get(), command);
|
||||
buf += length;
|
||||
length = 256 + strlen(e_prefix_bin_get()) + strlen(args);
|
||||
buffer = malloc(length);
|
||||
length = snprintf(buffer, length, "%s/enlightenment_fm_op %s %s", e_prefix_bin_get(), command, args);
|
||||
|
||||
_e_append_quoted(&buf, &length, src);
|
||||
_e_append_char(&buf, &length, '\'');
|
||||
|
||||
if (dst)
|
||||
{
|
||||
_e_append_char(&buf, &length, ' ');
|
||||
_e_append_char(&buf, &length, '\'');
|
||||
_e_append_quoted(&buf, &length, dst);
|
||||
_e_append_char(&buf, &length, '\'');
|
||||
}
|
||||
|
||||
_e_append_char(&buf, &length, '\x00');
|
||||
|
||||
return strdup(&buffer[0]);
|
||||
return buffer;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,8 @@ static void _e_fm_op_task_free(void *t);
|
|||
|
||||
static void _e_fm_op_remove_link_task(E_Fm_Op_Task *task);
|
||||
static int _e_fm_op_stdin_data(void *data, Ecore_Fd_Handler * fd_handler);
|
||||
|
||||
static void _e_fm_op_set_up_idlers();
|
||||
static void _e_fm_op_delete_idler(int *mark);
|
||||
static int _e_fm_op_idler_handle_error(int *mark, Evas_List **queue, Evas_List **node, E_Fm_Op_Task *task);
|
||||
|
||||
static int _e_fm_op_work_idler(void *data);
|
||||
|
@ -42,7 +43,7 @@ static int _e_fm_op_scan_idler(void *data);
|
|||
|
||||
static void _e_fm_op_send_error(E_Fm_Op_Task * task, E_Fm_Op_Type type, const char *fmt, ...);
|
||||
static void _e_fm_op_rollback(E_Fm_Op_Task * task);
|
||||
static void _e_fm_op_update_progress(long long _plus_e_fm_op_done, long long _plus_e_fm_op_total);
|
||||
static void _e_fm_op_update_progress(E_Fm_Op_Task *task, long long _plus_e_fm_op_done, long long _plus_e_fm_op_total);
|
||||
static void _e_fm_op_copy_stat_info(E_Fm_Op_Task *task);
|
||||
static int _e_fm_op_handle_overwrite(E_Fm_Op_Task *task);
|
||||
|
||||
|
@ -154,7 +155,7 @@ main(int argc, char **argv)
|
|||
{
|
||||
if (argc < 4)
|
||||
{
|
||||
return 0;
|
||||
goto quit;
|
||||
}
|
||||
|
||||
if (type == E_FM_OP_MOVE)
|
||||
|
@ -163,9 +164,9 @@ main(int argc, char **argv)
|
|||
_e_fm_op_separator = _e_fm_op_work_queue;
|
||||
}
|
||||
|
||||
if (argc > 4 && ecore_file_is_dir(argv[last]))
|
||||
if (argc >= 4 && ecore_file_is_dir(argv[last]))
|
||||
{
|
||||
if (argv[last][strlen(argv[last] - 1)] == '/') byte = "";
|
||||
if (argv[last][strlen(argv[last]) - 1] == '/') byte = "";
|
||||
|
||||
while (i < last)
|
||||
{
|
||||
|
@ -185,7 +186,7 @@ main(int argc, char **argv)
|
|||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (argc == 4)
|
||||
{
|
||||
if (type == E_FM_OP_MOVE && rename(argv[2], argv[3]) == 0)
|
||||
goto quit;
|
||||
|
@ -197,6 +198,10 @@ main(int argc, char **argv)
|
|||
|
||||
_e_fm_op_scan_queue = evas_list_append(_e_fm_op_scan_queue, task);
|
||||
}
|
||||
else
|
||||
{
|
||||
goto quit;
|
||||
}
|
||||
}
|
||||
else if (type == E_FM_OP_REMOVE)
|
||||
{
|
||||
|
@ -217,8 +222,7 @@ main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
_e_fm_op_scan_idler_p = ecore_idler_add(_e_fm_op_scan_idler, NULL);
|
||||
_e_fm_op_work_idler_p = ecore_idler_add(_e_fm_op_work_idler, NULL);
|
||||
_e_fm_op_set_up_idlers();
|
||||
|
||||
ecore_main_loop_begin();
|
||||
|
||||
|
@ -406,6 +410,7 @@ _e_fm_op_stdin_data(void *data, Ecore_Fd_Handler * fd_handler)
|
|||
case E_FM_OP_ERROR_RESPONSE_IGNORE_ALL:
|
||||
case E_FM_OP_ERROR_RESPONSE_RETRY:
|
||||
_e_fm_op_error_response = identity;
|
||||
_e_fm_op_set_up_idlers();
|
||||
break;
|
||||
|
||||
case E_FM_OP_OVERWRITE_RESPONSE_NO:
|
||||
|
@ -413,6 +418,7 @@ _e_fm_op_stdin_data(void *data, Ecore_Fd_Handler * fd_handler)
|
|||
case E_FM_OP_OVERWRITE_RESPONSE_YES:
|
||||
case E_FM_OP_OVERWRITE_RESPONSE_YES_ALL:
|
||||
_e_fm_op_overwrite_response = identity;
|
||||
_e_fm_op_set_up_idlers();
|
||||
E_FM_OP_DEBUG("Overwrite response set.\n");
|
||||
break;
|
||||
}
|
||||
|
@ -429,6 +435,15 @@ _e_fm_op_stdin_data(void *data, Ecore_Fd_Handler * fd_handler)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void _e_fm_op_set_up_idlers()
|
||||
{
|
||||
if(!_e_fm_op_scan_idler_p)
|
||||
_e_fm_op_scan_idler_p = ecore_idler_add(_e_fm_op_scan_idler, NULL);
|
||||
|
||||
if(!_e_fm_op_work_idler_p)
|
||||
_e_fm_op_work_idler_p = ecore_idler_add(_e_fm_op_work_idler, NULL);
|
||||
}
|
||||
|
||||
#define _E_FM_OP_ERROR_SEND_SCAN(_task, _e_fm_op_error_type, _fmt, ...)\
|
||||
do\
|
||||
{\
|
||||
|
@ -449,6 +464,20 @@ _e_fm_op_stdin_data(void *data, Ecore_Fd_Handler * fd_handler)
|
|||
}\
|
||||
while (0)
|
||||
|
||||
static void _e_fm_op_delete_idler(int *mark)
|
||||
{
|
||||
if(mark == &_e_fm_op_work_error)
|
||||
{
|
||||
ecore_idler_del(_e_fm_op_work_idler_p);
|
||||
_e_fm_op_work_idler_p = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecore_idler_del(_e_fm_op_scan_idler_p);
|
||||
_e_fm_op_scan_idler_p = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Code to deal with overwrites and errors in idlers.
|
||||
* Basically, it checks if we got a response.
|
||||
* Returns 1 if we did; otherwise checks it and does what needs to be done.
|
||||
|
@ -466,6 +495,9 @@ static int _e_fm_op_idler_handle_error(int *mark, Evas_List **queue, Evas_List *
|
|||
}
|
||||
else
|
||||
{
|
||||
/* No response yet. */
|
||||
/* So, delete this idler. It'll be added back when response is there. */
|
||||
_e_fm_op_delete_idler(mark);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -474,6 +506,8 @@ static int _e_fm_op_idler_handle_error(int *mark, Evas_List **queue, Evas_List *
|
|||
if (_e_fm_op_error_response == E_FM_OP_NONE)
|
||||
{
|
||||
/* No response yet. */
|
||||
/* So, delete this idler. It'll be added back when response is there. */
|
||||
_e_fm_op_delete_idler(mark);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
|
@ -605,7 +639,6 @@ _e_fm_op_work_idler(void *data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -828,9 +861,9 @@ _e_fm_op_rollback(E_Fm_Op_Task * task)
|
|||
}
|
||||
|
||||
if (task->type == E_FM_OP_COPY)
|
||||
_e_fm_op_update_progress(-task->dst.done, -task->src.st.st_size);
|
||||
_e_fm_op_update_progress(task, -task->dst.done, -task->src.st.st_size);
|
||||
else
|
||||
_e_fm_op_update_progress(-REMOVECHUNKSIZE, -REMOVECHUNKSIZE);
|
||||
_e_fm_op_update_progress(task, -REMOVECHUNKSIZE, -REMOVECHUNKSIZE);
|
||||
}
|
||||
|
||||
/* Updates progress.
|
||||
|
@ -844,7 +877,7 @@ _e_fm_op_rollback(E_Fm_Op_Task * task)
|
|||
*/
|
||||
|
||||
static void
|
||||
_e_fm_op_update_progress(long long _plus_e_fm_op_done, long long _plus_e_fm_op_total)
|
||||
_e_fm_op_update_progress(E_Fm_Op_Task *task, long long _plus_e_fm_op_done, long long _plus_e_fm_op_total)
|
||||
{
|
||||
static int ppercent = -1;
|
||||
int percent;
|
||||
|
@ -854,7 +887,13 @@ _e_fm_op_update_progress(long long _plus_e_fm_op_done, long long _plus_e_fm_op_t
|
|||
double eta = 0;
|
||||
static int peta = -1;
|
||||
|
||||
int data[5];
|
||||
static E_Fm_Op_Task *ptask = NULL;
|
||||
|
||||
void *data;
|
||||
void *p;
|
||||
int magic = E_FM_OP_MAGIC;
|
||||
int id = E_FM_OP_PROGRESS;
|
||||
int size = 0;
|
||||
|
||||
_e_fm_op_done += _plus_e_fm_op_done;
|
||||
_e_fm_op_total += _plus_e_fm_op_total;
|
||||
|
@ -876,21 +915,42 @@ _e_fm_op_update_progress(long long _plus_e_fm_op_done, long long _plus_e_fm_op_t
|
|||
eta = (int) (eta + 0.5);
|
||||
}
|
||||
|
||||
if (percent != ppercent || eta != peta)
|
||||
if (percent != ppercent || eta != peta || (task && task != ptask))
|
||||
{
|
||||
ppercent = percent;
|
||||
peta = eta;
|
||||
ptask = task;
|
||||
|
||||
data[0] = E_FM_OP_MAGIC;
|
||||
data[1] = E_FM_OP_PROGRESS;
|
||||
data[2] = 2*sizeof(int);
|
||||
data[3] = percent;
|
||||
data[4] = peta;
|
||||
size = 2 * sizeof(int) + 2 * sizeof(size_t) + strlen(ptask->src.name) + 1 + strlen(ptask->dst.name) + 1;
|
||||
data = malloc(3 * sizeof(int) + size);
|
||||
|
||||
write(STDOUT_FILENO, &data[0], 5*sizeof(int));
|
||||
if (!data) return;
|
||||
p = data;
|
||||
|
||||
#define P(value) memcpy(p, &(value), sizeof(int)); p += sizeof(int)
|
||||
P(magic);
|
||||
P(id);
|
||||
P(size);
|
||||
P(ppercent);
|
||||
P(peta);
|
||||
#undef P
|
||||
|
||||
#define P(value) memcpy(p, &(value), sizeof(size_t)); p += sizeof(size_t)
|
||||
P(ptask->dst.done);
|
||||
P(ptask->src.st.st_size);
|
||||
#undef P
|
||||
|
||||
#define P(value) memcpy(p, value, strlen(value) + 1); p += strlen(value) + 1
|
||||
P(ptask->src.name);
|
||||
P(ptask->dst.name);
|
||||
#undef P
|
||||
|
||||
write(STDOUT_FILENO, data, 3 * sizeof(int) + size);
|
||||
|
||||
E_FM_OP_DEBUG("Time left: %d at %e\n", peta, ctime - stime);
|
||||
E_FM_OP_DEBUG("Progress %d. \n", percent);
|
||||
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1000,7 +1060,7 @@ _e_fm_op_copy_dir(E_Fm_Op_Task * task)
|
|||
}
|
||||
|
||||
task->dst.done += task->src.st.st_size;
|
||||
_e_fm_op_update_progress(task->src.st.st_size, 0);
|
||||
_e_fm_op_update_progress(task, task->src.st.st_size, 0);
|
||||
|
||||
/* Finish with this task. */
|
||||
task->finished = 1;
|
||||
|
@ -1033,7 +1093,7 @@ _e_fm_op_copy_link(E_Fm_Op_Task *task)
|
|||
}
|
||||
|
||||
task->dst.done += task->src.st.st_size;
|
||||
_e_fm_op_update_progress(task->src.st.st_size, 0);
|
||||
_e_fm_op_update_progress(task, task->src.st.st_size, 0);
|
||||
|
||||
_e_fm_op_copy_stat_info(task);
|
||||
|
||||
|
@ -1063,7 +1123,7 @@ _e_fm_op_copy_fifo(E_Fm_Op_Task *task)
|
|||
_e_fm_op_copy_stat_info(task);
|
||||
|
||||
task->dst.done += task->src.st.st_size;
|
||||
_e_fm_op_update_progress(task->src.st.st_size, 0);
|
||||
_e_fm_op_update_progress(task, task->src.st.st_size, 0);
|
||||
|
||||
task->finished = 1;
|
||||
|
||||
|
@ -1142,7 +1202,7 @@ _e_fm_op_copy_chunk(E_Fm_Op_Task *task)
|
|||
|
||||
task->finished = 1;
|
||||
|
||||
_e_fm_op_update_progress(0, 0);
|
||||
_e_fm_op_update_progress(task, 0, 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1155,7 +1215,7 @@ _e_fm_op_copy_chunk(E_Fm_Op_Task *task)
|
|||
}
|
||||
|
||||
task->dst.done += dread;
|
||||
_e_fm_op_update_progress(dwrite, 0);
|
||||
_e_fm_op_update_progress(task, dwrite, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1194,6 +1254,8 @@ _e_fm_op_copy_atom(E_Fm_Op_Task * task)
|
|||
|
||||
if (!data || !data->to || !data->from) /* Did not touch the files yet. */
|
||||
{
|
||||
E_FM_OP_DEBUG("Copy: %s --> %s\n", task->src.name, task->dst.name);
|
||||
|
||||
if (_e_fm_op_abort)
|
||||
{
|
||||
/* We're marked for abortion. Don't do anything.
|
||||
|
@ -1205,9 +1267,7 @@ _e_fm_op_copy_atom(E_Fm_Op_Task * task)
|
|||
|
||||
if (_e_fm_op_handle_overwrite(task)) return 1;
|
||||
|
||||
E_FM_OP_DEBUG("Copy: %s --> %s\n", task->src.name, task->dst.name);
|
||||
|
||||
if (S_ISDIR(task->src.st.st_mode))
|
||||
if (S_ISDIR(task->src.st.st_mode))
|
||||
{
|
||||
if (_e_fm_op_copy_dir(task)) return 1;
|
||||
}
|
||||
|
@ -1248,7 +1308,7 @@ _e_fm_op_scan_atom(E_Fm_Op_Task * task)
|
|||
|
||||
if (task->type == E_FM_OP_COPY)
|
||||
{
|
||||
_e_fm_op_update_progress(0, task->src.st.st_size);
|
||||
_e_fm_op_update_progress(NULL, 0, task->src.st.st_size);
|
||||
|
||||
ctask = _e_fm_op_task_new();
|
||||
ctask->src.name = evas_stringshare_add(task->src.name);
|
||||
|
@ -1261,7 +1321,7 @@ _e_fm_op_scan_atom(E_Fm_Op_Task * task)
|
|||
}
|
||||
else if (task->type == E_FM_OP_COPY_STAT_INFO)
|
||||
{
|
||||
_e_fm_op_update_progress(0, REMOVECHUNKSIZE);
|
||||
_e_fm_op_update_progress(NULL, 0, REMOVECHUNKSIZE);
|
||||
|
||||
ctask = _e_fm_op_task_new();
|
||||
ctask->src.name = evas_stringshare_add(task->src.name);
|
||||
|
@ -1274,7 +1334,7 @@ _e_fm_op_scan_atom(E_Fm_Op_Task * task)
|
|||
}
|
||||
else if (task->type == E_FM_OP_REMOVE)
|
||||
{
|
||||
_e_fm_op_update_progress(0, REMOVECHUNKSIZE);
|
||||
_e_fm_op_update_progress(NULL, 0, REMOVECHUNKSIZE);
|
||||
|
||||
rtask = _e_fm_op_task_new();
|
||||
rtask->src.name = evas_stringshare_add(task->src.name);
|
||||
|
@ -1289,7 +1349,7 @@ _e_fm_op_scan_atom(E_Fm_Op_Task * task)
|
|||
else if (task->type == E_FM_OP_MOVE)
|
||||
{
|
||||
/* Copy task. */
|
||||
_e_fm_op_update_progress(0, task->src.st.st_size);
|
||||
_e_fm_op_update_progress(NULL, 0, task->src.st.st_size);
|
||||
ctask = _e_fm_op_task_new();
|
||||
|
||||
ctask->src.name = evas_stringshare_add(task->src.name);
|
||||
|
@ -1301,7 +1361,7 @@ _e_fm_op_scan_atom(E_Fm_Op_Task * task)
|
|||
_e_fm_op_work_queue = evas_list_prepend(_e_fm_op_work_queue, ctask);
|
||||
|
||||
/* Remove task. */
|
||||
_e_fm_op_update_progress(0, REMOVECHUNKSIZE);
|
||||
_e_fm_op_update_progress(NULL, 0, REMOVECHUNKSIZE);
|
||||
rtask = _e_fm_op_task_new();
|
||||
|
||||
rtask->src.name = evas_stringshare_add(task->src.name);
|
||||
|
@ -1337,7 +1397,7 @@ _e_fm_op_copy_stat_info_atom(E_Fm_Op_Task * task)
|
|||
task->finished = 1;
|
||||
task->dst.done += REMOVECHUNKSIZE;
|
||||
|
||||
_e_fm_op_update_progress(REMOVECHUNKSIZE, 0);
|
||||
_e_fm_op_update_progress(task, REMOVECHUNKSIZE, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1376,7 +1436,7 @@ _e_fm_op_remove_atom(E_Fm_Op_Task * task)
|
|||
}
|
||||
|
||||
task->dst.done += REMOVECHUNKSIZE;
|
||||
_e_fm_op_update_progress(REMOVECHUNKSIZE, 0);
|
||||
_e_fm_op_update_progress(task, REMOVECHUNKSIZE, 0);
|
||||
|
||||
task->finished = 1;
|
||||
|
||||
|
|
|
@ -47,7 +47,8 @@ typedef enum _E_Fm_Op_Type
|
|||
E_FM_OP_QUIT,
|
||||
E_FM_OP_SYMLINK,
|
||||
E_FM_OP_OK,
|
||||
E_FM_OP_ERROR_RETRY_ABORT
|
||||
E_FM_OP_ERROR_RETRY_ABORT,
|
||||
E_FM_OP_REORDER
|
||||
} E_Fm_Op_Type;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -58,6 +58,11 @@ struct _E_Config_Dialog_Data
|
|||
int fixed;
|
||||
} theme;
|
||||
|
||||
struct
|
||||
{
|
||||
int desktop;
|
||||
} hal;
|
||||
|
||||
E_Config_Dialog *cfd;
|
||||
};
|
||||
|
||||
|
@ -110,6 +115,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
|
|||
cfdata->icon.icon.h = fileman_config->icon.icon.h;
|
||||
cfdata->icon.extension.show = fileman_config->icon.extension.show;
|
||||
cfdata->list.sort.dirs.first = fileman_config->list.sort.dirs.first;
|
||||
cfdata->hal.desktop = e_config->hal_desktop;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -137,6 +143,16 @@ _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
|||
fileman_config->list.sort.dirs.first = cfdata->list.sort.dirs.first;
|
||||
fileman_config->list.sort.dirs.last = !(cfdata->list.sort.dirs.first);
|
||||
|
||||
e_config->hal_desktop = cfdata->hal.desktop;
|
||||
if(e_config->hal_desktop)
|
||||
{
|
||||
e_fm2_hal_show_desktop_icons();
|
||||
}
|
||||
else
|
||||
{
|
||||
e_fm2_hal_hide_desktop_icons();
|
||||
}
|
||||
|
||||
e_config_save_queue();
|
||||
|
||||
/* FIXME: reload/refresh existing fm's */
|
||||
|
@ -197,6 +213,8 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
ob = e_widget_check_add(evas, _("Show Toolbar"),
|
||||
&(cfdata->view.show_toolbar));
|
||||
e_widget_list_object_append(o, ob, 1, 1, 0.5);
|
||||
|
||||
ob = e_widget_check_add(evas, _("Show HAL icons on desktop"),
|
||||
&(cfdata->hal.desktop));
|
||||
e_widget_list_object_append(o, ob, 1, 1, 0.5);
|
||||
return o;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue