Hello everyone.
Attached patch fixes an problem with handling errors and status
reports in EFM. The problem was that for each file you've selected for
an operation a new instance of enlightenment_fm_op was started. That
lead to the situation when you've had two files with errors and
hitting Ignore All had no effect. And, obviuosly, status reports were
screwed (well, you don't see them now, they are printed to STDOUT).
This is now fixed.
Also, status reports were populated with more data. I fixed an
annoying error that popued up when you unmounted smth. And I hope I
fixed an issue with enlightenment_fm_op tasking 100% CPU sometimes.
Try it out and poke me if you have issues.
--
King regards,
Fedor Gusev.
diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c
index 561f687..838a3bd 100644
--- a/src/bin/e_fm.c
+++ b/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;
@@ -1622,28 +1625,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 +1660,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 +1707,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 +2050,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 +2072,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 +2097,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 +2113,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 +2133,24 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
case E_FM_OP_PROGRESS:/*progress*/
{
int percent, seconds;
-
- if (!e->data || e->size != 2 * sizeof(int)) 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;
+ size_t done, total;
+ char *src = NULL;
+ char *dst = NULL;
+ void *p = e->data;
+
+ if (!e->data) return;
+
+#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 +2473,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 +2494,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;
}
+
+ /* 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, ' ');
- 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);
- }
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
@@ -4689,6 +4632,52 @@ _e_fm2_cb_dnd_leave(void *data, const char *type, void *event)
}
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_fm2_cb_dnd_drop(void *data, const char *type, void *event)
{
E_Fm2_Smart_Data *sd;
@@ -4699,6 +4688,11 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
const char *fp;
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;
@@ -4750,24 +4744,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 +4769,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 +4793,10 @@ _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);
+ _e_fm_client_file_move(args);
+ free(args);
}
else if (sd->drop_icon) /* inot or before/after an icon */
{
@@ -4811,76 +4813,48 @@ _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);
+ _e_fm_client_file_move(args);
+ free(args);
}
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);
+ _e_fm_client_file_move(args);
+ free(args);
}
else
{
@@ -4889,13 +4863,15 @@ _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);
+ _e_fm_client_file_move(args);
+ free(args);
}
}
}
@@ -6953,8 +6929,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 +6942,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 +7251,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,18 +7323,23 @@ _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);
}
diff --git a/src/bin/e_fm_main.c b/src/bin/e_fm_main.c
index 05f5540..07652ea 100644
--- a/src/bin/e_fm_main.c
+++ b/src/bin/e_fm_main.c
@@ -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;
-
- 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))
- {
- FILE *fh;
+ char buffer[PATH_MAX];
+ char order[PATH_MAX];
+
+ 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 *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;
-
- _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');
+ 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);
- return strdup(&buffer[0]);
+ return buffer;
}
diff --git a/src/bin/e_fm_op.c b/src/bin/e_fm_op.c
index 88bd9ba..9ef1b2e 100644
--- a/src/bin/e_fm_op.c
+++ b/src/bin/e_fm_op.c
@@ -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;
+
+ size = 2 * sizeof(int) + 2 * sizeof(size_t) + strlen(ptask->src.name) + 1 + strlen(ptask->dst.name) + 1;
+ data = malloc(3 * sizeof(int) + size);
+
+ if (!data) return;
+ p = data;
- data[0] = E_FM_OP_MAGIC;
- data[1] = E_FM_OP_PROGRESS;
- data[2] = 2*sizeof(int);
- data[3] = percent;
- data[4] = peta;
+#define P(value) memcpy(p, &(value), sizeof(int)); p += sizeof(int)
+ P(magic);
+ P(id);
+ P(size);
+ P(ppercent);
+ P(peta);
+#undef P
- write(STDOUT_FILENO, &data[0], 5*sizeof(int));
+#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;
diff --git a/src/bin/e_fm_op.h b/src/bin/e_fm_op.h
index c6d9045..750b775 100644
--- a/src/bin/e_fm_op.h
+++ b/src/bin/e_fm_op.h
@@ -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
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel