gusev's mkdir/ls patches.
authorCarsten Haitzler <raster@rasterman.com>
Sat, 26 Jul 2008 13:15:57 +0000 (13:15 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Sat, 26 Jul 2008 13:15:57 +0000 (13:15 +0000)
SVN revision: 35229

src/bin/e_fm.c
src/bin/e_fm.h
src/bin/e_fm_main.c
src/bin/e_fm_op.c
src/bin/e_fm_op.h

index fce8295..561f687 100644 (file)
@@ -97,6 +97,7 @@ struct _E_Fm2_Smart_Data
    
    struct {
       char            *buf;
+      Ecore_Timer     *timer;
    } typebuf;
    
    int                 busy_count;
@@ -302,9 +303,13 @@ static void _e_fm2_file_rename_no_cb(void *data);
 static void _e_fm2_file_properties(void *data, E_Menu *m, E_Menu_Item *mi);
 static void _e_fm2_file_properties_delete_cb(void *obj);
 
+static void _e_fm_retry_abort_dialog(int pid, const char *str);
+static void _e_fm_retry_abort_delete_cb(void *obj);
+static void _e_fm_retry_abort_retry_cb(void *data, E_Dialog *dialog);
+static void _e_fm_retry_abort_abort_cb(void *data, E_Dialog *dialog);
+
 static void _e_fm_overwrite_dialog(int pid, const char *str);
 static void _e_fm_overwrite_delete_cb(void *obj);
-static void _e_fm_send_overwrite_response(int id, E_Fm_Op_Type type);
 static void _e_fm_overwrite_no_cb(void *data, E_Dialog *dialog);
 static void _e_fm_overwrite_no_all_cb(void *data, E_Dialog *dialog);
 static void _e_fm_overwrite_yes_cb(void *data, E_Dialog *dialog);
@@ -312,7 +317,6 @@ static void _e_fm_overwrite_yes_all_cb(void *data, E_Dialog *dialog);
 
 static void _e_fm_error_dialog(int pid, const char *str);
 static void _e_fm_error_delete_cb(void *obj);
-static void _e_fm_send_error_response(int id, E_Fm_Op_Type type);
 static void _e_fm_error_retry_cb(void *data, E_Dialog *dialog);
 static void _e_fm_error_abort_cb(void *data, E_Dialog *dialog);
 static void _e_fm_error_ignore_this_cb(void *data, E_Dialog *dialog);
@@ -344,14 +348,15 @@ static void _e_fm2_mouse_1_handler(E_Fm2_Icon *ic, int up, Evas_Modifier *modifi
 
 static void _e_fm2_client_spawn(void);
 static E_Fm2_Client *_e_fm2_client_get(void);
-static void _e_fm2_client_monitor_add(int id, const char *path);
+static int _e_fm2_client_monitor_add(const char *path);
 static void _e_fm2_client_monitor_del(int id, const char *path);
-static void _e_fm2_client_file_del(int id, const char *path);
-static void _e_fm2_client_file_trash(int id, const char *path);
-static void _e_fm2_client_file_mkdir(int id, const char *path, const char *rel, int rel_to, int x, int y, int res_w, int res_h);
-static void _e_fm2_client_file_move(int id, const char *path, const char *dest, const char *rel, int rel_to, int x, int y, int res_w, int res_h);
-static void _e_fm2_client_file_symlink(int id, const char *path, const char *dest, const char *rel, int rel_to, int x, int y, int res_w, int res_h);
-static void _e_fm2_client_file_copy(int id, 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_del(const char *path);
+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_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 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);
@@ -362,7 +367,6 @@ static Evas_List *_e_fm2_list = NULL;
 static Evas_List *_e_fm2_list_remove = NULL;
 static int _e_fm2_list_walking = 0;
 static Evas_List *_e_fm2_client_list = NULL;
-static int _e_fm2_id = 0;
 static Evas_List *_e_fm2_menu_contexts = NULL;
 static Evas_List *_e_fm_file_buffer = NULL; /* Files for copy&paste are saved here. */
 static int _e_fm_file_buffer_cutting = 0;
@@ -447,7 +451,7 @@ _e_fm2_cb_mount_ok(void *data)
    
    sd = evas_object_smart_data_get(data);
    if (!sd) return; // safety
-   _e_fm2_client_monitor_add(sd->id, sd->realpath);
+   sd->id = _e_fm2_client_monitor_add(sd->realpath);
    sd->listing = 1;
    evas_object_smart_callback_call(data, "dir_changed", NULL);
    sd->tmp.iter = 0;
@@ -593,9 +597,12 @@ e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path)
    
    if (!sd->mount || sd->mount->mounted)
      {
-       _e_fm2_client_monitor_add(sd->id, sd->realpath);
+       sd->id = _e_fm2_client_monitor_add(sd->realpath);
        sd->listing = 1;
      }
+
+   /* Clean up typebuf. */
+   _e_fm2_typebuf_hide(obj);
    
    evas_object_smart_callback_call(obj, "dir_changed", NULL);
    sd->tmp.iter = 0;
@@ -716,7 +723,7 @@ e_fm2_refresh(Evas_Object *obj)
      {
        sd->listing = 0;
        _e_fm2_client_monitor_del(sd->id, sd->realpath);
-       _e_fm2_client_monitor_add(sd->id, sd->realpath);
+       sd->id = _e_fm2_client_monitor_add(sd->realpath);
        sd->listing = 1;
      }
    
@@ -1558,94 +1565,96 @@ _e_fm2_client_messages_flush(void)
      }
 }
 
-static void
-_e_fm2_client_monitor_add(int id, const char *path)
+static int
+_e_fm_client_send_new(int minor, void *data, int size)
 {
+   static int id = 0;
    E_Fm2_Client *cl;
-
+   
+   id ++;
    cl = _e_fm2_client_get();
    if (!cl)
      {
-       _e_fm2_client_message_queue(E_IPC_DOMAIN_FM, 1
+       _e_fm2_client_message_queue(E_IPC_DOMAIN_FM, minor
                                    id, 0, 0, 
-                                   (void *)path, strlen(path) + 1);
+                                   data, size);
      }
    else
      {
-       ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, 1
+       ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, minor
                              id, 0, 0, 
-                             (void *)path, strlen(path) + 1);
+                             data, size);
        cl->req++;
      }
+
+   return id;
 }
 
-static void
-_e_fm2_client_monitor_del(int id, const char *path)
+static int
+_e_fm_client_send(int minor, int id, void *data, int size)
 {
    E_Fm2_Client *cl;
    
    cl = _e_fm2_client_get();
    if (!cl)
      {
-       _e_fm2_client_message_queue(E_IPC_DOMAIN_FM, 2,
+       _e_fm2_client_message_queue(E_IPC_DOMAIN_FM, minor, 
                                    id, 0, 0, 
-                                   (void *)path, strlen(path) + 1);
+                                   data, size);
      }
    else
      {
-       ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, 2,
+       ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, minor, 
                              id, 0, 0, 
-                             (void *)path, strlen(path) + 1);
+                             data, size);
        cl->req++;
      }
+
+   return id;
 }
 
-static void
-_e_fm2_client_file_del(int id, const char *path)
+static int
+_e_fm2_client_monitor_add(const char *path)
 {
-   E_Fm2_Client *cl;
-   
-   cl = _e_fm2_client_get();
-   if (!cl)
-     {
-       _e_fm2_client_message_queue(E_IPC_DOMAIN_FM, 3,
-                                   id, 0, 0, 
-                                   (void *)path, strlen(path) + 1);
-     }
-   else
-     {
-       ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, 3,
-                             id, 0, 0, 
-                             (void *)path, strlen(path) + 1);
-       cl->req++;
-     }
+   return _e_fm_client_send_new(E_FM_OP_MONITOR_START, (void *)path, strlen(path) + 1);
 }
 
 static void
-_e_fm2_client_file_trash(int id, const char *path)
+_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, 4,
+       _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, 4,
+       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++;
      }
 }
 
-static void
-_e_fm2_client_file_mkdir(int id, 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_del(const char *path)
+{
+   return _e_fm_client_send_new(E_FM_OP_REMOVE, (void *)path, strlen(path) + 1);
+}
+
+static int
+_e_fm2_client_file_trash(const char *path)
+{
+   return _e_fm_client_send_new(E_FM_OP_TRASH, (void *)path, strlen(path) + 1);
+}
+
+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)
 {
-   E_Fm2_Client *cl;
    char *d;
    int l1, l2, l;
    
@@ -1658,26 +1667,13 @@ _e_fm2_client_file_mkdir(int id, const char *path, const char *rel, int rel_to,
    memcpy(d + l1 + 1 + l2 + 1, &rel_to, sizeof(int));
    memcpy(d + l1 + 1 + l2 + 1 + sizeof(int), &x, sizeof(int));
    memcpy(d + l1 + 1 + l2 + 1 + (2 * sizeof(int)), &y, sizeof(int));
-   cl = _e_fm2_client_get();
-   if (!cl)
-     {
-       _e_fm2_client_message_queue(E_IPC_DOMAIN_FM, 8,
-                                   id, 0, 0, 
-                                   (void *)d, l);
-     }
-   else
-     {
-       ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, 8,
-                             id, 0, 0, 
-                             (void *)d, l);
-       cl->req++;
-     }
+
+   return _e_fm_client_send_new(E_FM_OP_MKDIR, (void *)d, l);
 }
 
-static void
-_e_fm2_client_file_move(int id, 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_move(const char *path, const char *dest, const char *rel, int rel_to, int x, int y, int res_w, int res_h)
 {
-   E_Fm2_Client *cl;
    char *d;
    int l1, l2, l3, l;
    
@@ -1692,20 +1688,7 @@ _e_fm2_client_file_move(int id, const char *path, const char *dest, const char *
    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));
-   cl = _e_fm2_client_get();
-   if (!cl)
-     {
-       _e_fm2_client_message_queue(E_IPC_DOMAIN_FM, 6,
-                                   id, 0, 0, 
-                                   (void *)d, l);
-     }
-   else
-     {
-       ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, 6,
-                             id, 0, 0, 
-                             (void *)d, l);
-       cl->req++;
-     }
+
    if ((x != -9999) && (y != -9999))
      {
        E_Fm2_Custom_File *cf, cf0;
@@ -1724,10 +1707,12 @@ _e_fm2_client_file_move(int id, const char *path, const char *dest, const char *
        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);
 }
 
-static void
-_e_fm2_client_file_symlink(int id, 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_symlink(const char *path, const char *dest, const char *rel, int rel_to, int x, int y, int res_w, int res_h)
 {
    E_Fm2_Client *cl;
    char *d;
@@ -1744,20 +1729,7 @@ _e_fm2_client_file_symlink(int id, const char *path, const char *dest, const cha
    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));
-   cl = _e_fm2_client_get();
-   if (!cl)
-     {
-       _e_fm2_client_message_queue(E_IPC_DOMAIN_FM, 13,
-                                   id, 0, 0, 
-                                   (void *)d, l);
-     }
-   else
-     {
-       ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, 13,
-                             id, 0, 0, 
-                             (void *)d, l);
-       cl->req++;
-     }
+   
    if ((x != -9999) && (y != -9999))
      {
        E_Fm2_Custom_File *cf, cf0;
@@ -1776,12 +1748,13 @@ _e_fm2_client_file_symlink(int id, const char *path, const char *dest, const cha
        e_fm2_custom_file_set(dest, cf);
        e_fm2_custom_file_flush();
      }
+
+   return _e_fm_client_send_new(E_FM_OP_SYMLINK, (void *)d, l);
 }
 
-static void
-_e_fm2_client_file_copy(int id, 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)
 {
-   E_Fm2_Client *cl;
    char *d;
    int l1, l2, l3, l;
    
@@ -1796,20 +1769,7 @@ _e_fm2_client_file_copy(int id, const char *path, const char *dest, const char *
    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));
-   cl = _e_fm2_client_get();
-   if (!cl)
-     {
-       _e_fm2_client_message_queue(E_IPC_DOMAIN_FM, 7,
-                                   id, 0, 0, 
-                                   (void *)d, l);
-     }
-   else
-     {
-       ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, 7,
-                             id, 0, 0, 
-                             (void *)d, l);
-       cl->req++;
-     }
+   
    if ((x != -9999) && (y != -9999))
      {
        E_Fm2_Custom_File *cf, cf0;
@@ -1828,12 +1788,13 @@ _e_fm2_client_file_copy(int id, const char *path, const char *dest, const char *
        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);
 }
 
-EAPI void
+EAPI int
 _e_fm2_client_mount(const char *udi, const char *mountpoint)
 {
-   E_Fm2_Client *cl;
    char *d;
    int l, l1, l2;
    
@@ -1844,23 +1805,11 @@ _e_fm2_client_mount(const char *udi, const char *mountpoint)
    strcpy(d, udi);
    strcpy(d + l1 + 1, mountpoint);
    printf("SEND %s %s\n", udi, mountpoint);
-   cl = _e_fm2_client_get();
-   if (!cl)
-     {
-       _e_fm2_client_message_queue(E_IPC_DOMAIN_FM, 9,
-                                   0, 0, 0, 
-                                   (void *)d, l);
-     }
-   else
-     {
-       ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, 9,
-                             0, 0, 0, 
-                             (void *)d, l);
-       cl->req++;
-     }
+
+   return _e_fm_client_send_new(E_FM_OP_MOUNT, (void *)d, l);
 }
 
-EAPI void
+EAPI int
 _e_fm2_client_unmount(const char *udi)
 {
    E_Fm2_Client *cl;
@@ -1871,21 +1820,11 @@ _e_fm2_client_unmount(const char *udi)
    l = l1 + 1;
    d = alloca(l);
    strcpy(d, udi);
+
    cl = _e_fm2_client_get();
    printf("send UM %s\n", udi);
-   if (!cl)
-     {
-       _e_fm2_client_message_queue(E_IPC_DOMAIN_FM, 10,
-                                   0, 0, 0, 
-                                   (void *)d, l);
-     }
-   else
-     {
-       ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, 10,
-                             0, 0, 0, 
-                             (void *)d, l);
-       cl->req++;
-     }
+   
+   return _e_fm_client_send_new(E_FM_OP_UNMOUNT, (void *)d, l);
 }
 
 static void
@@ -2008,13 +1947,13 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
        sd = evas_object_smart_data_get(obj);
        switch (e->minor)
          {  
-          case 1:/*hello*/
+          case E_FM_OP_HELLO:/*hello*/
             break;
-          case 2:/*req ok*/
+          case E_FM_OP_OK:/*req ok*/
             cl->req--;
             break;
-          case 3:/*file add*/
-          case 5:/*file change*/
+          case E_FM_OP_FILE_ADD:/*file add*/
+          case E_FM_OP_FILE_CHANGE:/*file change*/
               {
                  E_Fm2_Finfo finf;
                                           
@@ -2049,13 +1988,13 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
                    {
                       if (e->response == 0)/*live changes*/
                         {
-                           if (e->minor == 3)/*file add*/
+                           if (e->minor == E_FM_OP_FILE_ADD)/*file add*/
                              {
                                 _e_fm2_live_file_add
                                   (obj, ecore_file_file_get(path),
                                    NULL, 0, &finf);
                              }
-                           else if (e->minor == 5)/*file change*/
+                           else if (e->minor == E_FM_OP_FILE_CHANGE)/*file change*/
                              {
                                 _e_fm2_live_file_changed
                                   (obj, (char *)ecore_file_file_get(path),
@@ -2064,7 +2003,7 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
                         }
                       else/*file add - listing*/
                         {
-                           if (e->minor == 3)/*file add*/
+                           if (e->minor == E_FM_OP_FILE_ADD)/*file add*/
                              {
                                 if (!sd->scan_timer)
                                   {
@@ -2134,7 +2073,7 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
                  free(evdir);
               }
             break;
-          case 4:/*file del*/
+          case E_FM_OP_FILE_DEL:/*file del*/
             path = e->data;
             evdir = ecore_file_dir_get(path);
             if ((sd->id == e->ref_to) && (!strcmp(dir, evdir)))
@@ -2144,7 +2083,7 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
               }
             free(evdir);
             break;
-          case 6:/*mon dir del*/
+          case E_FM_OP_MONITOR_END:/*mon dir del*/
             path = e->data;
             if ((sd->id == e->ref_to) && (!strcmp(dir, path)))
               {
@@ -2176,13 +2115,13 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
      }
    switch (e->minor)
      {
-      case 7:/*mon list sync*/
-       ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, 12,
+      case E_FM_OP_MONITOR_SYNC:/*mon list sync*/
+       ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, E_FM_OP_MONITOR_SYNC,
                              0, 0, e->response, 
                              NULL, 0);
        break;
        
-      case 8:/*storage add*/
+      case E_FM_OP_STORAGE_ADD:/*storage add*/
        if ((e->data) && (e->size > 0))
          {
             E_Storage *s;
@@ -2191,7 +2130,7 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
             if (s) e_fm2_hal_storage_add(s);
          }
        break;
-      case 9:/*storage del*/
+      case E_FM_OP_STORAGE_DEL:/*storage del*/
        if ((e->data) && (e->size > 0))
          {
             char *udi;
@@ -2203,7 +2142,7 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
          }
        break;
        
-      case 10:/*volume add*/
+      case E_FM_OP_VOLUME_ADD:/*volume add*/
        if ((e->data) && (e->size > 0))
          {
             E_Volume *v;
@@ -2212,7 +2151,7 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
             if (v) e_fm2_hal_volume_add(v);
          }
        break;
-      case 11:/*volume del*/
+      case E_FM_OP_VOLUME_DEL:/*volume del*/
        if ((e->data) && (e->size > 0))
          {
             char *udi;
@@ -2224,7 +2163,7 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
          }
        break;
        
-      case 12:/*mount done*/
+      case E_FM_OP_MOUNT_DONE:/*mount done*/
        if ((e->data) && (e->size > 1))
          {
             E_Volume *v;
@@ -2236,7 +2175,7 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
             if (v) e_fm2_hal_mount_add(v, mountpoint);
          }
        break;
-      case 13:/*unmount done*/
+      case E_FM_OP_UNMOUNT_DONE:/*unmount done*/
        if ((e->data) && (e->size > 1))
          {
             E_Volume *v;
@@ -2251,17 +2190,22 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
                  v->mount_point = NULL;
               }
          }
-      case 14:/*error*/
+      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);
        break;
 
-      case 15:/*overwrite*/
+      case E_FM_OP_ERROR_RETRY_ABORT:/*error*/
+       printf("%s:%s(%d) Error from slave #%d: %s\n", __FILE__, __FUNCTION__, __LINE__, e->ref, e->data);
+       _e_fm_retry_abort_dialog(e->ref, e->data);
+       break;
+
+      case E_FM_OP_OVERWRITE:/*overwrite*/
        printf("%s:%s(%d) Overwrite from slave #%d: %s\n", __FILE__, __FUNCTION__, __LINE__, e->ref, e->data);
        _e_fm_overwrite_dialog(e->ref, e->data);
        break;
 
-      case 16:/*progress*/
+      case E_FM_OP_PROGRESS:/*progress*/
          {
             int percent, seconds;
 
@@ -2628,12 +2572,12 @@ _e_fm2_file_paste(void *data, E_Menu *m, E_Menu_Item *mi)
        
        if (_e_fm_file_buffer_copying) 
          {
-            _e_fm2_client_file_copy(sd->id, filepath, buf, "", 0, 
+            _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(sd->id, filepath, buf, "", 0, 
+            _e_fm2_client_file_move(filepath, buf, "", 0, 
                                     -9999, -9999, sd->w, sd->h);
          }
        evas_stringshare_del(filepath);
@@ -4373,6 +4317,24 @@ _e_fm2_typebuf_complete(Evas_Object *obj)
    _e_fm2_typebuf_match(obj);
 }
 
+static int
+_e_fm_typebuf_timer_cb(void *data)
+{
+   Evas_Object *obj = data;
+   E_Fm2_Smart_Data *sd;
+
+   if(!data) return 0;
+   sd = evas_object_smart_data_get(obj);
+   if (!sd) return 0;
+
+   if (!sd->typebuf_visible) return 0;
+
+   _e_fm2_typebuf_hide(obj);
+   sd->typebuf.timer = NULL;
+
+   return 0;
+}
+
 static void
 _e_fm2_typebuf_char_append(Evas_Object *obj, const char *ch)
 {
@@ -4390,6 +4352,13 @@ _e_fm2_typebuf_char_append(Evas_Object *obj, const char *ch)
    sd->typebuf.buf = ts;
    _e_fm2_typebuf_match(obj);
    edje_object_part_text_set(sd->overlay, "e.text.typebuf_label", sd->typebuf.buf);
+
+   if(sd->typebuf.timer) 
+     {
+       ecore_timer_del(sd->typebuf.timer);
+     }
+
+   sd->typebuf.timer = ecore_timer_add(5.0, _e_fm_typebuf_timer_cb, obj);
 }
 
 static void
@@ -4798,7 +4767,7 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
                       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(sd->id, fp, buf, "", 0, x, y, sd->w, sd->h);
+                 _e_fm2_client_file_move(fp, buf, "", 0, x, y, sd->w, sd->h);
                  if (ic->sd == sd)
                    {
                       ic->x = x;
@@ -4809,7 +4778,7 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
               }
             else
               {
-                 _e_fm2_client_file_move(sd->id, fp, buf, "", 0, -9999, -9999, sd->w, sd->h);
+                 _e_fm2_client_file_move(fp, buf, "", 0, -9999, -9999, sd->w, sd->h);
               }
             evas_stringshare_del(fp);
          }
@@ -4842,7 +4811,7 @@ _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(sd->id, fp, buf, "", 0, -9999, -9999, sd->w, sd->h);
+                 _e_fm2_client_file_move(fp, buf, "", 0, -9999, -9999, sd->w, sd->h);
                  evas_stringshare_del(fp);
               }
          }
@@ -4864,12 +4833,12 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
                                 if (sd->config->view.link_drop)
                                   {
                                      printf("ln -s %s %s\n", (char *)fp, buf);
-                                     _e_fm2_client_file_symlink(sd->id, buf, fp, sd->drop_icon->info.file, sd->drop_after, -9999, -9999, sd->h, sd->h);
+                                     _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(sd->id, fp, buf, sd->drop_icon->info.file, sd->drop_after, -9999, -9999, sd->w, sd->h);
+                                     _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);
                              }
@@ -4886,12 +4855,12 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
                                 if (sd->config->view.link_drop)
                                   {
                                      printf("ln -s %s %s\n", (char *)fp, buf);
-                                     _e_fm2_client_file_symlink(sd->id, buf, fp, sd->drop_icon->info.file, sd->drop_after, -9999, -9999, sd->w, sd->h);
+                                     _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(sd->id, fp, buf, sd->drop_icon->info.file, sd->drop_after, -9999, -9999, sd->w, sd->h);
+                                     _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);
                              }
@@ -4908,7 +4877,7 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
                            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(sd->id, fp, buf, "", 0, -9999, -9999, sd->w, sd->h);
+                           _e_fm2_client_file_move(fp, buf, "", 0, -9999, -9999, sd->w, sd->h);
                            evas_stringshare_del(fp);
                         }
                    }
@@ -4924,7 +4893,7 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
                       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(sd->id, fp, buf, "", 0, -9999, -9999, sd->w, sd->h);
+                      _e_fm2_client_file_move(fp, buf, "", 0, -9999, -9999, sd->w, sd->h);
                       evas_stringshare_del(fp);
                    }
               }
@@ -5984,8 +5953,6 @@ _e_fm2_smart_add(Evas_Object *obj)
    sd = E_NEW(E_Fm2_Smart_Data, 1);
    if (!sd) return;
    
-   _e_fm2_id++;
-   sd->id = _e_fm2_id;
    sd->obj = obj;
    sd->clip = evas_object_rectangle_add(evas_object_evas_get(obj));
    evas_object_smart_member_add(sd->clip, obj);
@@ -6305,20 +6272,16 @@ _e_fm2_menu(Evas_Object *obj, unsigned int timestamp)
        
        if (!(sd->icon_menu.flags & E_FM2_MENU_NO_NEW_DIRECTORY))
          {
-            /* FIXME: stat the dir itself - move to e_fm_main */
-            if (ecore_file_can_write(sd->realpath))
-              {
-                 mi = e_menu_item_new(mn);
-                 e_menu_item_separator_set(mi, 1);
-                 
-                 mi = e_menu_item_new(mn);
-                 e_menu_item_label_set(mi, _("New Directory"));
-                 e_menu_item_icon_edje_set(mi,
-                                           e_theme_edje_file_get("base/theme/fileman",
-                                                                 "e/fileman/default/button/new_dir"),
-                                           "e/fileman/default/button/new_dir");
-                 e_menu_item_callback_set(mi, _e_fm2_new_directory, sd);
-              }
+            mi = e_menu_item_new(mn);
+            e_menu_item_separator_set(mi, 1);
+            
+            mi = e_menu_item_new(mn);
+            e_menu_item_label_set(mi, _("New Directory"));
+            e_menu_item_icon_edje_set(mi,
+                  e_theme_edje_file_get("base/theme/fileman",
+                     "e/fileman/default/button/new_dir"),
+                  "e/fileman/default/button/new_dir");
+            e_menu_item_callback_set(mi, _e_fm2_new_directory, sd);
          }
 
        if ((!(sd->icon_menu.flags & E_FM2_MENU_NO_PASTE)) && 
@@ -6937,7 +6900,7 @@ _e_fm2_new_directory_yes_cb(char *text, void *data)
      {
        snprintf(buf, sizeof(buf), "%s/%s", sd->realpath, text);
 
-       _e_fm2_client_file_mkdir(sd->id, buf, "", 0, 0, 0, sd->w, sd->h);
+       _e_fm2_client_file_mkdir(buf, "", 0, 0, 0, sd->w, sd->h);
      }
 }
 
@@ -7000,7 +6963,7 @@ _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(ic->sd->id, oldpath, newpath, "", 0, -9999, -9999, ic->sd->w, ic->sd->h);
+       _e_fm2_client_file_move(oldpath, newpath, "", 0, -9999, -9999, ic->sd->w, ic->sd->h);
      }
 }
 
@@ -7013,6 +6976,60 @@ _e_fm2_file_rename_no_cb(void *data)
    ic->entry_dialog = NULL;
 }
 
+static void _e_fm_retry_abort_dialog(int pid, const char *str)
+{
+   E_Manager *man;
+   E_Container *con;
+   E_Dialog *dialog;
+   int *id;
+   char text[4096 + PATH_MAX];
+   
+   man = e_manager_current_get();
+   if (!man) return;
+   con = e_container_current_get(man);
+   if (!con) return;
+   
+   id = malloc(sizeof(int));
+   *id = pid;
+   
+   dialog = e_dialog_new(con, "E", "_fm_overwrite_dialog");
+   E_OBJECT(dialog)->data = id;
+   e_object_del_attach_func_set(E_OBJECT(dialog), _e_fm_retry_abort_delete_cb);
+   e_dialog_button_add(dialog, _("Retry"), NULL, _e_fm_retry_abort_retry_cb, NULL);
+   e_dialog_button_add(dialog, _("Abort"), NULL, _e_fm_retry_abort_abort_cb, NULL);
+
+   e_dialog_button_focus_num(dialog, 0);
+   e_dialog_title_set(dialog, _("Error"));
+   snprintf(text, sizeof(text), 
+        _("%s"),
+        str);
+   
+   e_dialog_text_set(dialog, text);
+   e_win_centered_set(dialog->win, 1);
+   e_dialog_show(dialog);
+
+}
+
+static void _e_fm_retry_abort_delete_cb(void *obj)
+{
+   int *id = E_OBJECT(obj)->data;
+   free(id);
+}
+
+static void _e_fm_retry_abort_retry_cb(void *data, E_Dialog *dialog)
+{
+   int *id = E_OBJECT(dialog)->data;
+   _e_fm_client_send(E_FM_OP_ERROR_RESPONSE_RETRY, *id, NULL, 0);
+   e_object_del(E_OBJECT(dialog));
+}
+
+static void _e_fm_retry_abort_abort_cb(void *data, E_Dialog *dialog)
+{
+   int *id = E_OBJECT(dialog)->data;
+   _e_fm_client_send(E_FM_OP_ERROR_RESPONSE_ABORT, *id, NULL, 0);
+   e_object_del(E_OBJECT(dialog));
+}
+
 static void
 _e_fm_overwrite_dialog(int pid, const char *str)
 {
@@ -7056,21 +7073,11 @@ _e_fm_overwrite_delete_cb(void *obj)
    free(id);
 }
 
-/* TODO: merge _e_fm_send_overwrite_response() and _e_fm_send_error_response() (???) */
-
-static void
-_e_fm_send_overwrite_response(int id, E_Fm_Op_Type type)
-{
-   ecore_ipc_client_send(_e_fm2_client_get()->cl, E_IPC_DOMAIN_FM, 15,
-        id, 0, 0,
-        &type, sizeof(E_Fm_Op_Type));
-}
-
 static void
 _e_fm_overwrite_no_cb(void *data, E_Dialog *dialog)
 {
    int *id = E_OBJECT(dialog)->data;
-   _e_fm_send_overwrite_response(*id, E_FM_OP_OVERWRITE_RESPONSE_NO);
+   _e_fm_client_send(E_FM_OP_OVERWRITE_RESPONSE_NO, *id, NULL, 0);
    e_object_del(E_OBJECT(dialog));
 }
 
@@ -7078,7 +7085,7 @@ static void
 _e_fm_overwrite_no_all_cb(void *data, E_Dialog *dialog)
 {
    int *id = E_OBJECT(dialog)->data;
-   _e_fm_send_overwrite_response(*id, E_FM_OP_OVERWRITE_RESPONSE_NO_ALL);
+   _e_fm_client_send(E_FM_OP_OVERWRITE_RESPONSE_NO_ALL, *id, NULL, 0);
    e_object_del(E_OBJECT(dialog));
 }
 
@@ -7086,7 +7093,7 @@ static void
 _e_fm_overwrite_yes_cb(void *data, E_Dialog *dialog)
 {
    int *id = E_OBJECT(dialog)->data;
-   _e_fm_send_overwrite_response(*id, E_FM_OP_OVERWRITE_RESPONSE_YES);
+   _e_fm_client_send(E_FM_OP_OVERWRITE_RESPONSE_YES, *id, NULL, 0);
    e_object_del(E_OBJECT(dialog));
 }
 
@@ -7094,7 +7101,7 @@ static void
 _e_fm_overwrite_yes_all_cb(void *data, E_Dialog *dialog)
 {
    int *id = E_OBJECT(dialog)->data;
-   _e_fm_send_overwrite_response(*id, E_FM_OP_OVERWRITE_RESPONSE_YES_ALL);
+   _e_fm_client_send(E_FM_OP_OVERWRITE_RESPONSE_YES_ALL, *id, NULL, 0);
    e_object_del(E_OBJECT(dialog));
 }
 
@@ -7143,18 +7150,10 @@ _e_fm_error_delete_cb(void *obj)
 }
 
 static void
-_e_fm_send_error_response(int id, E_Fm_Op_Type type)
-{
-   ecore_ipc_client_send(_e_fm2_client_get()->cl, E_IPC_DOMAIN_FM, 14,
-        id, 0, 0,
-        &type, sizeof(E_Fm_Op_Type));
-}
-
-static void
 _e_fm_error_retry_cb(void *data, E_Dialog *dialog)
 {
    int *id = E_OBJECT(dialog)->data;
-   _e_fm_send_error_response(*id, E_FM_OP_ERROR_RESPONSE_RETRY);
+   _e_fm_client_send(E_FM_OP_ERROR_RESPONSE_RETRY, *id, NULL, 0);
    e_object_del(E_OBJECT(dialog));
 }
 
@@ -7162,7 +7161,7 @@ static void
 _e_fm_error_abort_cb(void *data, E_Dialog *dialog)
 {
    int *id = E_OBJECT(dialog)->data;
-   _e_fm_send_error_response(*id, E_FM_OP_ERROR_RESPONSE_ABORT);
+   _e_fm_client_send(E_FM_OP_ERROR_RESPONSE_ABORT, *id, NULL, 0);
    e_object_del(E_OBJECT(dialog));
 }
 
@@ -7170,7 +7169,7 @@ static void
 _e_fm_error_ignore_this_cb(void *data, E_Dialog *dialog)
 {
    int *id = E_OBJECT(dialog)->data;
-   _e_fm_send_error_response(*id, E_FM_OP_ERROR_RESPONSE_IGNORE_THIS);
+   _e_fm_client_send(E_FM_OP_ERROR_RESPONSE_IGNORE_THIS, *id, NULL, 0);
    e_object_del(E_OBJECT(dialog));
 }
 
@@ -7178,7 +7177,7 @@ static void
 _e_fm_error_ignore_all_cb(void *data, E_Dialog *dialog)
 {
    int *id = E_OBJECT(dialog)->data;
-   _e_fm_send_error_response(*id, E_FM_OP_ERROR_RESPONSE_IGNORE_ALL);
+   _e_fm_client_send(E_FM_OP_ERROR_RESPONSE_IGNORE_ALL, *id, NULL, 0);
    e_object_del(E_OBJECT(dialog));
 }
 
@@ -7288,7 +7287,7 @@ _e_fm2_file_delete_yes_cb(void *data, E_Dialog *dialog)
             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(ic->sd->id, buf);
+            _e_fm2_client_file_del(buf);
          }
        evas_list_free(sel);
      }
@@ -7297,7 +7296,7 @@ _e_fm2_file_delete_yes_cb(void *data, E_Dialog *dialog)
        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(ic->sd->id, buf);
+       _e_fm2_client_file_del(buf);
      }
    
    evas_object_smart_callback_call(ic->sd->obj, "files_deleted", NULL);
index b03fecb..75a5b62 100644 (file)
@@ -161,8 +161,8 @@ EAPI void        e_fm2_icon_geometry_get(E_Fm2_Icon *ic, int *x, int *y, int *w,
 EAPI void        e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e);
 EAPI void        e_fm2_client_del(Ecore_Ipc_Event_Client_Del *e);
 
-EAPI void        _e_fm2_client_mount(const char *udi, const char *mountpoint);
-EAPI void        _e_fm2_client_unmount(const char *udi);
+EAPI int        _e_fm2_client_mount(const char *udi, const char *mountpoint);
+EAPI int        _e_fm2_client_unmount(const char *udi);
 EAPI void        _e_fm2_file_force_update(const char *path);
     
 #endif
index 4feda83..05f5540 100644 (file)
@@ -60,6 +60,7 @@ typedef struct _E_Dir E_Dir;
 typedef struct _E_Fop E_Fop;
 typedef struct _E_Mod E_Mod;
 typedef struct _E_Fm_Slave E_Fm_Slave;
+typedef struct _E_Fm_Task E_Fm_Task;
 
 struct _E_Dir
 {
@@ -109,16 +110,35 @@ struct _E_Fm_Slave
    int id;
 };
 
+struct _E_Fm_Task
+{
+   int id;
+   E_Fm_Op_Type type;
+   E_Fm_Slave *slave;
+   const char *src;
+   const char *dst;
+   const char *rel;
+   int rel_to;
+   int x,y;
+};
+
 /* local subsystem functions */
 static int _e_ipc_init(void);
 static int _e_ipc_cb_server_add(void *data, int type, void *event);
 static int _e_ipc_cb_server_del(void *data, int type, void *event);
 static int _e_ipc_cb_server_data(void *data, int type, void *event);
 
+static void _e_fm_monitor_start(int id, const char *path);
+static void _e_fm_monitor_start_try(E_Fm_Task *task);
+static void _e_fm_monitor_end(int id, const char *path);
+static E_Fm_Task *_e_fm_task_get(int id);
+static Evas_List *_e_fm_task_node_get(int id);
+static void _e_fm_task_remove(E_Fm_Task *task);
+static void _e_fm_mkdir_try(E_Fm_Task *task);
+static void _e_fm_mkdir(int id, const char *src, const char *rel, int rel_to, int x, int y);
+static void _e_fm_handle_error_response(int id, E_Fm_Op_Type type);
 
-static int _e_client_send_overwrite(int id, const char *data, int size);
-static int _e_client_send_error(int id, const char *data, int size);
-static int _e_client_send_progress(int id, const char *data, int size);
+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 E_Fm_Slave *_e_fm_slave_get(int id);
@@ -130,7 +150,7 @@ static int _e_fm_slave_del_cb(void *data, int type, void *event);
 static void _e_cb_file_monitor(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path);
 static int _e_cb_recent_clean(void *data);
 
-static void _e_file_add_mod(E_Dir *ed, const char *path, int op, int listing);
+static void _e_file_add_mod(E_Dir *ed, const char *path, E_Fm_Op_Type op, int listing);
 static void _e_file_add(E_Dir *ed, const char *path, int listing);
 static void _e_file_del(E_Dir *ed, const char *path);
 static void _e_file_mod(E_Dir *ed, const char *path);
@@ -138,10 +158,7 @@ static void _e_file_mon_dir_del(E_Dir *ed, const char *path);
 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_rm_idler(void *data);
 static int _e_cb_fop_trash_idler(void *data);
-static int _e_cb_fop_mv_idler(void *data);
-static int _e_cb_fop_cp_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_dir_del(E_Dir *ed);
@@ -193,6 +210,7 @@ static Evas_List *_e_fops = NULL;
 static int _e_sync_num = 0;
 
 static Evas_List *_e_fm_slaves = NULL;
+static Evas_List *_e_fm_tasks = NULL;
 #ifdef HAVE_EDBUS
 static E_DBus_Connection *_e_dbus_conn = NULL;
 
@@ -575,7 +593,7 @@ _e_dbus_cb_store_prop(void *data, void *reply_data, DBusError *error)
          {
             ecore_ipc_server_send(_e_ipc_server,
                                   6/*E_IPC_DOMAIN_FM*/,
-                                  8/*storage add*/,
+                                  E_FM_OP_STORAGE_ADD,
                                   0, 0, 0, msg_data, msg_size);
             free(msg_data);
          }
@@ -617,7 +635,7 @@ e_storage_del(const char *udi)
        printf("--STO %s\n", s->udi);
        ecore_ipc_server_send(_e_ipc_server,
                              6/*E_IPC_DOMAIN_FM*/,
-                             9/*storage del*/,
+                             E_FM_OP_STORAGE_DEL,
                              0, 0, 0, s->udi, strlen(s->udi) + 1);
      }
    _e_stores = evas_list_remove(_e_stores, s);
@@ -716,7 +734,7 @@ _e_dbus_cb_vol_prop(void *data, void *reply_data, DBusError *error)
          {
             ecore_ipc_server_send(_e_ipc_server,
                                   6/*E_IPC_DOMAIN_FM*/,
-                                  10/*volume add*/,
+                                  E_FM_OP_VOLUME_ADD,
                                   0, 0, 0, msg_data, msg_size);
             free(msg_data);
          }
@@ -761,12 +779,12 @@ _e_dbus_cb_vol_prop_mount_modified(void *data, void *reply_data, DBusError *erro
        if (v->mounted)
        ecore_ipc_server_send(_e_ipc_server,
                              6/*E_IPC_DOMAIN_FM*/,
-                             12/*mount done*/,
+                             E_FM_OP_MOUNT_DONE,
                              0, 0, 0, buf, size);
        else
        ecore_ipc_server_send(_e_ipc_server,
                              6/*E_IPC_DOMAIN_FM*/,
-                             13/*unmount done*/,
+                             E_FM_OP_UNMOUNT_DONE,
                              0, 0, 0, buf, size);
      }
    return;
@@ -810,7 +828,7 @@ e_volume_del(const char *udi)
        /* FIXME: send event of storage volume (disk) removed */
        ecore_ipc_server_send(_e_ipc_server,
                              6/*E_IPC_DOMAIN_FM*/,
-                             11/*volume del*/,
+                             E_FM_OP_VOLUME_DEL,
                              0, 0, 0, v->udi, strlen(v->udi) + 1);
      }
    _e_vols = evas_list_remove(_e_vols, v);
@@ -852,7 +870,7 @@ _e_dbus_cb_vol_mounted(void *user_data, void *method_return, DBusError *error)
    strcpy(buf + strlen(buf) + 1, v->mount_point);
    ecore_ipc_server_send(_e_ipc_server,
                         6/*E_IPC_DOMAIN_FM*/,
-                        12/*mount done*/,
+                        E_FM_OP_MOUNT_DONE,
                         0, 0, 0, buf, size);
 }
 
@@ -902,7 +920,7 @@ _e_dbus_cb_vol_unmounted(void *user_data, void *method_return, DBusError *error)
    strcpy(buf + strlen(buf) + 1, v->mount_point);
    ecore_ipc_server_send(_e_ipc_server,
                         6/*E_IPC_DOMAIN_FM*/,
-                        13/*unmount done*/,
+                        E_FM_OP_UNMOUNT_DONE,
                         0, 0, 0, buf, size);
 }
 
@@ -953,7 +971,7 @@ _e_ipc_cb_server_add(void *data, int type, void *event)
    e = event;
    ecore_ipc_server_send(e->server, 
                         6/*E_IPC_DOMAIN_FM*/,
-                        1/*hello*/
+                        E_FM_OP_HELLO
                         0, 0, 0, NULL, 0); /* send hello */
    return 1;
 }
@@ -969,194 +987,360 @@ _e_ipc_cb_server_del(void *data, int type, void *event)
    return 1;
 }
 
-static int
-_e_ipc_cb_server_data(void *data, int type, void *event)
+static void
+_e_fm_monitor_start(int id, const char *path)
 {
-   Ecore_Ipc_Event_Server_Data *e;
+   E_Fm_Task *task = malloc(sizeof(E_Fm_Task));
+
+   if(!task) return;
+
+   task->id = id;
+   task->type = E_FM_OP_MONITOR_START;
+   task->slave = NULL;
+   task->src = evas_stringshare_add(path);
+   task->dst = NULL;
+   task->rel = NULL;
+   task->rel_to = 0;
+   task->x = 0;
+   task->y = 0;
+
+   _e_fm_tasks = evas_list_append(_e_fm_tasks, task);
+
+   _e_fm_monitor_start_try(task);
+}
+
+static void
+_e_fm_monitor_start_try(E_Fm_Task *task)
+{
+   E_Dir *ed, *ped = NULL;
    
-   e = event;
-   if (e->major != 6/*E_IPC_DOMAIN_FM*/) return 1;
-   switch (e->minor)
+   DIR *dir;
+   Evas_List *l;
+   
+   /* look for any previous dir entries monitoring this dir */
+   for (l = _e_dirs; l; l = l->next)
      {
-      case 1: /* monitor dir (and implicitly list) */
+       E_Dir *ed;
+       
+       ed = l->data;
+       if ((ed->mon) && (!strcmp(ed->dir, task->src)))
          {
-            E_Dir *ed, *ped = NULL;
-            DIR *dir;
-            Evas_List *l;
-            
-            /* look for any previous dir entries monitoring this dir */
-            for (l = _e_dirs; l; l = l->next)
-              {
-                 E_Dir *ed;
-            
-                 ed = l->data;
-                 if ((ed->mon) && (!strcmp(ed->dir, e->data)))
-                   {
-                      /* found a previous dir - save it in ped */
-                      ped = ed;
-                      break;
-                   }
-              }
-            /* open the dir to list */
-            dir = opendir(e->data);
-            if (!dir)
+            /* found a previous dir - save it in ped */
+            ped = ed;
+            break;
+         }
+     }
+
+   /* open the dir to list */
+   dir = opendir(task->src);
+   if (!dir)
+     {
+       char buf[PATH_MAX + 4096];
+
+       snprintf(buf, sizeof(buf), "Cannot open directory '%s': %s.", task->src, strerror(errno));
+       _e_client_send(task->id, E_FM_OP_ERROR_RETRY_ABORT, buf, strlen(buf) + 1);
+     }
+   else
+     {
+       Evas_List *files = NULL;
+       struct dirent *dp;
+       int dot_order = 0;
+       char buf[4096];
+       FILE *f;
+       
+       /* create a new dir entry */
+       ed = calloc(1, sizeof(E_Dir));
+       ed->id = task->id;
+       ed->dir = evas_stringshare_add(task->src);
+       if (!ped)
+         {
+            /* if no previous monitoring dir exists - this one 
+             * becomes the master monitor enty */
+            ed->mon = ecore_file_monitor_add(ed->dir, _e_cb_file_monitor, ed);
+            ed->mon_ref = 1;
+         }
+       else
+         {
+            /* an existing monitor exists - ref it up */
+            ed->mon_real = ped;
+            ped->mon_ref++;
+         }
+       _e_dirs = evas_list_append(_e_dirs, ed);
+       
+       /* read everything except a .order, . and .. */
+       while ((dp = readdir(dir)))
+         {
+            if ((!strcmp(dp->d_name, ".")) || (!strcmp(dp->d_name, "..")))
+              continue;
+            if (!strcmp(dp->d_name, ".order")) 
               {
-                 E_Dir ted;
-                 
-                 /* we can't open the dir - tell E the dir is deleted as
-                  * we can't look in it */
-                 memset(&ted, 0, sizeof(E_Dir));
-                 ted.id = e->ref;
-                 _e_file_mon_dir_del(&ted, e->data);
+                 dot_order = 1;
+                 continue;
               }
-            else
+            files = evas_list_append(files, strdup(dp->d_name));
+         }
+       closedir(dir);
+       /* if there was a .order - we need to parse it */
+       if (dot_order)
+         {
+            snprintf(buf, sizeof(buf), "%s/.order", task->src);
+            f = fopen(buf, "r");
+            if (f)
               {
-                 Evas_List *files = NULL;
-                 struct dirent *dp;
-                 int dot_order = 0;
-                 char buf[4096];
-                 FILE *f;
-                 
-                 /* create a new dir entry */
-                 ed = calloc(1, sizeof(E_Dir));
-                 ed->id = e->ref;
-                 ed->dir = evas_stringshare_add(e->data);
-                 if (!ped)
-                   {
-                      /* if no previous monitoring dir exists - this one 
-                       * becomes the master monitor enty */
-                      ed->mon = ecore_file_monitor_add(ed->dir, _e_cb_file_monitor, ed);
-                      ed->mon_ref = 1;
-                   }
-                 else
-                   {
-                      /* an existing monitor exists - ref it up */
-                      ed->mon_real = ped;
-                      ped->mon_ref++;
-                   }
-                 _e_dirs = evas_list_append(_e_dirs, ed);
+                 Evas_List *f2 = NULL;
+                 int len;
+                 char *s;
                  
-                 /* read everything except a .order, . and .. */
-                 while ((dp = readdir(dir)))
-                   {
-                      if ((!strcmp(dp->d_name, ".")) || (!strcmp(dp->d_name, "..")))
-                        continue;
-                      if (!strcmp(dp->d_name, ".order")) 
-                        {
-                           dot_order = 1;
-                           continue;
-                        }
-                      files = evas_list_append(files, strdup(dp->d_name));
-                   }
-                 closedir(dir);
-                 /* if there was a .order - we need to parse it */
-                 if (dot_order)
+                 /* inset files in order if the existed in file 
+                  * list before */
+                 while (fgets(buf, sizeof(buf), f))
                    {
-                      snprintf(buf, sizeof(buf), "%s/.order", (char *)e->data);
-                      f = fopen(buf, "r");
-                      if (f)
-                        {
-                           Evas_List *f2 = NULL;
-                           int len;
-                           char *s;
-                           
-                           /* inset files in order if the existed in file 
-                            * list before */
-                           while (fgets(buf, sizeof(buf), f))
-                             {
-                                len = strlen(buf);
-                                if (len > 0) buf[len - 1] = 0;
-                                s = _e_str_list_remove(&files, buf);
-                                if (s) f2 = evas_list_append(f2, s);
-                             }
-                           fclose(f);
-                           /* append whats left */
-                           while (files)
-                             {
-                                f2 = evas_list_append(f2, files->data);
-                                files = evas_list_remove_list(files, files);
-                             }
-                           files = f2;
-                        }
+                      len = strlen(buf);
+                      if (len > 0) buf[len - 1] = 0;
+                      s = _e_str_list_remove(&files, buf);
+                      if (s) f2 = evas_list_append(f2, s);
                    }
-                 ed->fq = files;
-                 /* FIXME: if .order file- load it, sort all items int it
-                  * that are in files then just append whatever is left in
-                  * alphabetical order
-                  */
-                 /* FIXME: maybe one day we can sort files here and handle
-                  * .order file stuff here - but not today
-                  */
-                 /* note that we had a .order at all */
-                 ed->dot_order = dot_order;
-                 if (dot_order)
+                 fclose(f);
+                 /* append whats left */
+                 while (files)
                    {
-                      /* if we did - tell the E about this FIRST - it will
-                       * decide what to do if it first sees a .order or not */
-                      if (!strcmp(e->data, "/"))
-                        snprintf(buf, sizeof(buf), "/.order");
-                      else
-                        snprintf(buf, sizeof(buf), "%s/.order", (char *)e->data);
-                      if (evas_list_count(files) == 1)
-                        _e_file_add(ed, buf, 2);
-                      else
-                        _e_file_add(ed, buf, 1);
+                      f2 = evas_list_append(f2, files->data);
+                      files = evas_list_remove_list(files, files);
                    }
-                 /* send empty file - indicate empty dir */
-                 if (!files) _e_file_add(ed, "", 2);
-                 /* and in an idler - list files, statting them etc. */
-                 ed->idler = ecore_idler_add(_e_cb_file_mon_list_idler, ed);
-                 ed->sync_num = DEF_SYNC_NUM;
+                 files = f2;
               }
          }
-       break;
-      case 2: /* monitor dir end */
+       ed->fq = files;
+       /* FIXME: if .order file- load it, sort all items int it
+        * that are in files then just append whatever is left in
+        * alphabetical order
+        */
+       /* FIXME: maybe one day we can sort files here and handle
+        * .order file stuff here - but not today
+        */
+       /* note that we had a .order at all */
+       ed->dot_order = dot_order;
+       if (dot_order)
          {
-            Evas_List *l;
-            
-            for (l = _e_dirs; l; l = l->next)
+            /* if we did - tell the E about this FIRST - it will
+             * decide what to do if it first sees a .order or not */
+            if (!strcmp(task->src, "/"))
+              snprintf(buf, sizeof(buf), "/.order");
+            else
+              snprintf(buf, sizeof(buf), "%s/.order", task->src);
+            if (evas_list_count(files) == 1)
+              _e_file_add(ed, buf, 2);
+            else
+              _e_file_add(ed, buf, 1);
+         }
+       /* send empty file - indicate empty dir */
+       if (!files) _e_file_add(ed, "", 2);
+       /* and in an idler - list files, statting them etc. */
+       ed->idler = ecore_idler_add(_e_cb_file_mon_list_idler, ed);
+       ed->sync_num = DEF_SYNC_NUM;
+     }
+}
+
+static void
+_e_fm_monitor_end(int id, const char *path)
+{
+   Evas_List *l;
+   E_Fm_Task *task;
+   
+   for (l = _e_dirs; l; l = l->next)
+     {
+       E_Dir *ed;
+       
+       /* look for the dire entry to stop monitoring */
+       ed = l->data;
+       if ((id == ed->id) && (!strcmp(ed->dir, path)))
+         {
+            /* if this is not the real monitoring node - unref the
+             * real one */
+            if (ed->mon_real)
               {
-                 E_Dir *ed;
-            
-                 /* look for the dire entry to stop monitoring */
-                 ed = l->data;
-                 if ((e->ref == ed->id) && (!strcmp(ed->dir, e->data)))
+                 /* unref original monitor node */
+                 ed->mon_real->mon_ref--;
+                 if (ed->mon_real->mon_ref == 0)
                    {
-                      /* if this is not the real monitoring node - unref the
-                       * real one */
-                      if (ed->mon_real)
-                        {
-                           /* unref original monitor node */
-                           ed->mon_real->mon_ref--;
-                           if (ed->mon_real->mon_ref == 0)
-                             {
-                                /* original is at 0 ref - free it */
-                                _e_dir_del(ed->mon_real);
-                                ed->mon_real = NULL;
-                             }
-                           /* free this node */
-                           _e_dir_del(ed);
-                        }
-                      /* this is a core monitoring node - remove ref */
-                      else
-                        {
-                           ed->mon_ref--;
-                           /* we are the last ref - free */
-                           if (ed->mon_ref == 0) _e_dir_del(ed);
-                        }
-                      /* remove from dirs list anyway */
-                      _e_dirs = evas_list_remove_list(_e_dirs, l);
-                      break;
+                      /* original is at 0 ref - free it */
+                      _e_dir_del(ed->mon_real);
+                      ed->mon_real = NULL;
                    }
+                 /* free this node */
+                 _e_dir_del(ed);
+              }
+            /* this is a core monitoring node - remove ref */
+            else
+              {
+                 ed->mon_ref--;
+                 /* we are the last ref - free */
+                 if (ed->mon_ref == 0) _e_dir_del(ed);
               }
+            /* remove from dirs list anyway */
+            _e_dirs = evas_list_remove_list(_e_dirs, l);
+            break;
+         }
+     }  
+
+   task = _e_fm_task_get(id);
+   _e_fm_task_remove(task);
+}
+
+static E_Fm_Task *
+_e_fm_task_get(int id)
+{
+   Evas_List *l = _e_fm_task_node_get(id);
+
+   return (E_Fm_Task *)evas_list_data(l);
+}
+
+static Evas_List *
+_e_fm_task_node_get(int id)
+{
+   Evas_List *l = _e_fm_tasks;
+   E_Fm_Task *task;
+
+   while(l)
+     {
+       task = evas_list_data(l);
+       if(task->id == id)
+         return l;
+
+       l = evas_list_next(l);
+     }
+
+   return NULL;
+}
+
+static void
+_e_fm_task_remove(E_Fm_Task *task)
+{
+   Evas_List *l = _e_fm_task_node_get(task->id);
+
+   switch(task->type)
+     {
+      case E_FM_OP_MONITOR_START:
+          {
+             E_Dir ted;
+             
+             /* we can't open the dir - tell E the dir is deleted as
+              * * we can't look in it */
+             memset(&ted, 0, sizeof(E_Dir));
+             ted.id = task->id;
+             _e_file_mon_dir_del(&ted, task->src);
+          }
+        break;
+      default:
+        break;
+     }
+
+   _e_fm_tasks = evas_list_remove_list(_e_fm_tasks, l);
+
+   if(task->src) evas_stringshare_del(task->src);
+   if(task->dst) evas_stringshare_del(task->dst);
+   if(task->rel) evas_stringshare_del(task->rel);
+
+   free(task);
+}
+
+static void
+_e_fm_mkdir_try(E_Fm_Task *task)
+{
+   char buf[PATH_MAX + 4096];
+
+   if(mkdir(task->src, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) < 0)
+     {
+       snprintf(buf, sizeof(buf), "Cannot make directory '%s': %s.", task->src, strerror(errno));
+       _e_client_send(task->id, E_FM_OP_ERROR_RETRY_ABORT, buf, strlen(buf) + 1);
+     }
+   else
+     {
+       _e_path_fix_order(task->src, task->rel, task->rel_to, task->x, task->y);
+       _e_fm_task_remove(task);
+     }
+}
+
+static void
+_e_fm_mkdir(int id, const char *src, const char *rel, int rel_to, int x, int y)
+{
+   E_Fm_Task *task;
+
+   task = malloc(sizeof(E_Fm_Task));
+
+   task->id = id;
+   task->type = E_FM_OP_MKDIR;
+   task->slave = NULL;
+   task->src = evas_stringshare_add(src);
+   task->dst = NULL;
+   task->rel = evas_stringshare_add(rel);
+   task->x = x;
+   task->y = y;
+
+   _e_fm_tasks = evas_list_append(_e_fm_tasks, task);
+
+   _e_fm_mkdir_try(task);
+}
+
+static void
+_e_fm_handle_error_response(int id, E_Fm_Op_Type type)
+{
+   E_Fm_Task *task = _e_fm_task_get(id);
+   E_Fm_Slave *slave = NULL;
+
+   if(!task)
+     {
+       slave = _e_fm_slave_get(id);
+       if(slave) _e_fm_slave_send(slave, type, NULL, 0);
+       return;
+     }
+
+   if(type == E_FM_OP_ERROR_RESPONSE_ABORT)
+     {
+       _e_fm_task_remove(task);
+     }
+   else if(type == E_FM_OP_ERROR_RESPONSE_RETRY)
+     {
+       switch(task->type)
+         {
+          case E_FM_OP_MKDIR:
+             _e_fm_mkdir_try(task);
+             break;
+
+          case E_FM_OP_MONITOR_START:
+             _e_fm_monitor_start_try(task);
+          default:
+             break;
+         }
+     }
+}
+
+static int
+_e_ipc_cb_server_data(void *data, int type, void *event)
+{
+   Ecore_Ipc_Event_Server_Data *e;
+   
+   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) */
+         {
+            _e_fm_monitor_start(e->ref, e->data);
          }
        break;
-      case 3: /* fop delete file/dir */
+      case E_FM_OP_MONITOR_END: /* monitor dir end */
+         {
+            _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);
          }
        break;
-      case 4: /* fop trash file/dir */
+      case E_FM_OP_TRASH: /* fop trash file/dir */
          {
             E_Fop *fop;
             
@@ -1170,17 +1354,7 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
               }
          }
        break;
-      case 5: /* fop rename file/dir */
-         {
-            const char *src, *dst;
-            
-            src = e->data;
-            dst = src + strlen(src) + 1;
-
-            _e_fm_slave_run(E_FM_OP_MOVE, src, dst, e->ref);
-         }
-       break;
-      case 6: /* fop mv file/dir */
+      case E_FM_OP_MOVE: /* fop mv file/dir */
          {
             const char *src, *dst, *rel;
             int rel_to, x, y;
@@ -1195,7 +1369,7 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
             _e_fm_slave_run(E_FM_OP_MOVE, src, dst, e->ref);
          }
        break;
-      case 7: /* fop cp file/dir */
+      case E_FM_OP_COPY: /* fop cp file/dir */
          {
             const char *src, *dst, *rel;
             int rel_to, x, y;
@@ -1210,7 +1384,7 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
             _e_fm_slave_run(E_FM_OP_COPY, src, dst, e->ref);
          }
        break;
-      case 8: /* fop mkdir */
+      case E_FM_OP_MKDIR: /* fop mkdir */
          {
             const char *src, *rel;
             int rel_to, x, y;
@@ -1220,12 +1394,11 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
             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));
-            ecore_file_mkdir(src);
-            /* FIXME: send back if succeeded or failed - why */
-            _e_path_fix_order(src, rel, rel_to, x, y);
+
+            _e_fm_mkdir(e->ref, src, rel, rel_to, x, y);
          }
        break;
-      case 9: /* mount udi mountpoint */
+      case E_FM_OP_MOUNT: /* mount udi mountpoint */
 #ifdef HAVE_EDBUS
          {
             E_Volume *v;
@@ -1247,7 +1420,7 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
          }
 #endif 
        break;
-      case 10:/* unmount udi */
+      case E_FM_OP_UNMOUNT:/* unmount udi */
 #ifdef HAVE_EDBUS
          {
             E_Volume *v;
@@ -1263,10 +1436,10 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
          }
 #endif 
        break;
-      case 11: /* quit */
+      case E_FM_OP_QUIT: /* quit */
        ecore_main_loop_quit();
        break;
-      case 12: /* mon list sync */
+      case E_FM_OP_MONITOR_SYNC: /* mon list sync */
          {
             Evas_List *l;
             double stime;
@@ -1297,7 +1470,7 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
               }
          }
        break;
-      case 13: /* dop ln -s */
+      case E_FM_OP_SYMLINK: /* dop ln -s */
          {
             const char *src, *dst, *rel;
             int rel_to, x, y;
@@ -1312,18 +1485,20 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
              /* FIXME: send back file add if succeeded */
          }
        break;
-      case 14:/*error response*/
+      case E_FM_OP_ERROR_RESPONSE_IGNORE_THIS:
+      case E_FM_OP_ERROR_RESPONSE_IGNORE_ALL:
+      case E_FM_OP_ERROR_RESPONSE_ABORT:
+      case E_FM_OP_ERROR_RESPONSE_RETRY:
          {
-            E_Fm_Op_Type type = *(E_Fm_Op_Type *)e->data;
-
-            _e_fm_slave_send(_e_fm_slave_get(e->ref), type, NULL, 0);
+            _e_fm_handle_error_response(e->ref, e->minor);
          }
        break;
-      case 15:/*overwrite response*/
+      case E_FM_OP_OVERWRITE_RESPONSE_NO:
+      case E_FM_OP_OVERWRITE_RESPONSE_NO_ALL:
+      case E_FM_OP_OVERWRITE_RESPONSE_YES:
+      case E_FM_OP_OVERWRITE_RESPONSE_YES_ALL:
          {
-            E_Fm_Op_Type type = *(E_Fm_Op_Type *)e->data;
-            
-            _e_fm_slave_send(_e_fm_slave_get(e->ref), type, NULL, 0);
+            _e_fm_slave_send(_e_fm_slave_get(e->ref), e->minor, NULL, 0);
          }
        break;
       default:
@@ -1335,34 +1510,19 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
     * allow for async handling later */
    ecore_ipc_server_send(_e_ipc_server,
                         6/*E_IPC_DOMAIN_FM*/,
-                        2/*req ok*/,
+                        E_FM_OP_OK,
                         0, e->ref, 0, NULL, 0);
    return 1;
 }
 
-static int _e_client_send_overwrite(int id, const char *data, int size)
-{
-   return ecore_ipc_server_send(_e_ipc_server,
-        6/*E_IPC_DOMAIN_FM*/,
-        15/*overwrite*/,
-        id, 0, 0, data, size);
-}
-
-static int _e_client_send_error(int id, const char *data, int size)
+static int _e_client_send(int id, E_Fm_Op_Type type, void *data, int size)
 {
    return ecore_ipc_server_send(_e_ipc_server,
         6/*E_IPC_DOMAIN_FM*/,
-        14/*error*/,
+        type,
         id, 0, 0, data, size);
 }
 
-static int _e_client_send_progress(int id, const char *data, int size)
-{
-   return ecore_ipc_server_send(_e_ipc_server,
-        6/*E_IPC_DOMAIN_FM*/,
-        16/*error*/,
-        id, 0, 0, data, size);
-}
 static int _e_fm_slave_run(E_Fm_Op_Type type, const char *src, const char *dst, int id)
 {
    E_Fm_Slave *slave;
@@ -1453,7 +1613,7 @@ static int _e_fm_slave_data_cb(void *data, int type, void *event)
 
        if (magic != E_FM_OP_MAGIC)
          {
-            //DEBUG("%s:%s(%d) Wrong magic number from slave #%d. ", __FILE__, __FUNCTION__, __LINE__, slave->id);
+            printf("%s:%s(%d) Wrong magic number from slave #%d. ", __FILE__, __FUNCTION__, __LINE__, slave->id);
          }
 
        sdata += 3 * sizeof(int);
@@ -1461,23 +1621,16 @@ static int _e_fm_slave_data_cb(void *data, int type, void *event)
 
        if (id == E_FM_OP_OVERWRITE)
          {
-            response[0] = E_FM_OP_MAGIC;
-            response[1] = E_FM_OP_OVERWRITE_RESPONSE_YES;
-            response[2] = 0;
-            
-            _e_client_send_overwrite(slave->id, (const char *)sdata, size);
-            printf("%s:%s(%d) Overwrite response sent to slave #%d.\n", __FILE__, __FUNCTION__, __LINE__, slave->id);
+            _e_client_send(slave->id, E_FM_OP_OVERWRITE, sdata, size);
+            printf("%s:%s(%d) Overwrite sent to client from slave #%d.\n", __FILE__, __FUNCTION__, __LINE__, slave->id);
          }
        else if (id == E_FM_OP_ERROR)
          {
-            _e_client_send_error(slave->id, (const char *)sdata, size);
-            printf("%s:%s(%d) Error sent to client from slave #%d.\n", __FILE__, __FUNCTION__, __LINE__, slave->id);
+            _e_client_send(slave->id, E_FM_OP_ERROR, sdata, size);
          }
        else if (id == E_FM_OP_PROGRESS)
          {
-            _e_client_send_progress(slave->id, (const char *)sdata, size);
-            printf("%s:%s(%d) Progress sent to client from slave #%d.\n", __FILE__, __FUNCTION__, __LINE__, slave->id);
-
+            _e_client_send(slave->id, E_FM_OP_PROGRESS, sdata, size);
          }
 
        sdata += size;
@@ -1630,7 +1783,7 @@ _e_cb_recent_clean(void *data)
                               
 
 static void
-_e_file_add_mod(E_Dir *ed, const char *path, int op, int listing)
+_e_file_add_mod(E_Dir *ed, const char *path, E_Fm_Op_Type op, int listing)
 {
    struct stat st;
    char *lnk = NULL, *rlnk = NULL;
@@ -1643,7 +1796,7 @@ _e_file_add_mod(E_Dir *ed, const char *path, int op, int listing)
      [sizeof(struct stat) + 1 + 4096 + 4096 + 4096];
 
    /* FIXME: handle BACKOFF */
-   if ((!listing) && (op == 5) && (!ed->cleaning)) /* 5 == mod */
+   if ((!listing) && (op == E_FM_OP_FILE_CHANGE) && (!ed->cleaning)) /* 5 == mod */
      {
        Evas_List *l;
        E_Mod *m;
@@ -1727,7 +1880,7 @@ _e_file_add(E_Dir *ed, const char *path, int listing)
      {
        /* FIXME: handle BACKOFF */
      }
-   _e_file_add_mod(ed, path, 3, listing);/*file add*/
+   _e_file_add_mod(ed, path, E_FM_OP_FILE_ADD, listing);/*file add*/
 }
 
 static void
@@ -1738,7 +1891,7 @@ _e_file_del(E_Dir *ed, const char *path)
      }
    ecore_ipc_server_send(_e_ipc_server,
                         6/*E_IPC_DOMAIN_FM*/,
-                        4/*file del*/,
+                        E_FM_OP_FILE_DEL,
                         0, ed->id, 0, (void *)path, strlen(path) + 1);
 }
 
@@ -1748,7 +1901,7 @@ _e_file_mod(E_Dir *ed, const char *path)
      {
        /* FIXME: handle BACKOFF */
      }
-   _e_file_add_mod(ed, path, 5, 0);/*file change*/
+   _e_file_add_mod(ed, path, E_FM_OP_FILE_CHANGE, 0);/*file change*/
 }
 
 static void
@@ -1756,7 +1909,7 @@ _e_file_mon_dir_del(E_Dir *ed, const char *path)
 {
    ecore_ipc_server_send(_e_ipc_server,
                         6/*E_IPC_DOMAIN_FM*/,
-                        6/*mon dir del*/,
+                        E_FM_OP_MONITOR_END,
                         0, ed->id, 0, (void *)path, strlen(path) + 1);
 }
 
@@ -1769,7 +1922,7 @@ _e_file_mon_list_sync(E_Dir *ed)
    ed->sync_time = ecore_time_get();
    ecore_ipc_server_send(_e_ipc_server,
                         6/*E_IPC_DOMAIN_FM*/,
-                        7/*mon list sync*/,
+                        E_FM_OP_MONITOR_SYNC,
                         0, ed->id, ed->sync, NULL, 0);
 }
 
@@ -1821,101 +1974,6 @@ _e_cb_file_mon_list_idler(void *data)
 }
 
 static int
-_e_cb_fop_rm_idler(void *data)
-{
-   E_Fop *fop;
-   struct Fop_Data {
-      DIR *dir;
-      const char *path;
-   } *fd, *fd2;
-   struct dirent *dp = NULL;
-   char buf[PATH_MAX], *lnk;
-   
-   fop = (E_Fop *)data;
-   if (!fop->data)
-     {
-       snprintf(buf, sizeof(buf), "%s", fop->src);
-       lnk = ecore_file_readlink(buf);
-       if (!lnk)
-         {
-            if (ecore_file_is_dir(buf))
-              {
-                 fd = calloc(1, sizeof(struct Fop_Data));
-                 if (fd)
-                   {
-                      fop->data = evas_list_prepend(fop->data, fd);
-                      fd->path = evas_stringshare_add(fop->src);
-                      fd->dir = opendir(fd->path);
-                   }
-              }
-            else
-              {
-                 ecore_file_unlink(buf); /* FIXME: handle err */
-              }
-         }
-       else
-         {
-            ecore_file_unlink(buf); /* FIXME: handle err */
-            free(lnk);
-         }
-       
-     }
-   fd = evas_list_data(fop->data);
-   if (!fd) goto stop;
-   if (fd->dir) dp = readdir(fd->dir);
-   else
-     {
-       /* FIXME: handle err  - if fd->diir is not a dir */
-     }
-   if (dp)
-     {
-       if (!((!strcmp(dp->d_name, ".")) || (!strcmp(dp->d_name, ".."))))
-         {
-            snprintf(buf, sizeof(buf), "%s/%s", fd->path, dp->d_name);
-            lnk = ecore_file_readlink(buf);
-            if (!lnk)
-              {
-                 if (ecore_file_is_dir(buf))
-                   {
-                      fd2 = calloc(1, sizeof(struct Fop_Data));
-                      if (fd2)
-                        {
-                           fop->data = evas_list_prepend(fop->data, fd2);
-                           fd2->path = evas_stringshare_add(buf);
-                           fd2->dir = opendir(fd2->path);
-                        }
-                   }
-                 else
-                   {
-                      ecore_file_unlink(buf); /* FIXME: handle err */
-                   }
-              }
-            else
-              {
-                 ecore_file_unlink(buf); /* FIXME: handle err */
-                 free(lnk);
-              }
-         }
-     }
-   else
-     {
-       if (fd->dir) closedir(fd->dir);
-       rmdir(fd->path); /* FIXME: handle err */
-       evas_stringshare_del(fd->path);
-       free(fd);
-       fop->data = evas_list_remove(fop->data, fd);
-       if (!fop->data) goto stop;
-     }
-   return 1;
-   stop:
-   evas_stringshare_del(fop->src);
-   free(fop);
-   _e_fops = evas_list_remove(_e_fops, fop);
-   return 0;
-   /* FIXME: send back if succeeded or failed - why */
-}
-
-static int
 _e_cb_fop_trash_idler(void *data)
 {
    E_Fop *fop = NULL;
@@ -1998,249 +2056,6 @@ _e_cb_fop_trash_idler(void *data)
    return 0;
 }
 
-static int
-_e_cb_fop_mv_idler(void *data)
-{
-   E_Fop *fop;
-
-   fop = (E_Fop *)data;
-   if (!fop->data)
-     {
-       if (rename(fop->src, fop->dst) != 0)
-         {
-            printf("rename %s -> %s err\n", fop->src, fop->dst);
-            if (errno == EXDEV)
-              {
-                 printf("copy instead\n");
-                 /* copy it instead - but del after cp */
-                 fop->idler = ecore_idler_add(_e_cb_fop_cp_idler, fop);
-                 fop->del_after = 1;
-                 return 0;
-              }
-            else
-              {
-                 /* FIXME: handle error */
-              }
-         }
-       _e_path_fix_order(fop->dst, fop->rel, fop->rel_to, fop->x, fop->y);
-     }
-   evas_stringshare_del(fop->src);
-   evas_stringshare_del(fop->dst);
-   free(fop);
-   _e_fops = evas_list_remove(_e_fops, fop);
-   return 0;
-   /* FIXME: send back if succeeded or failed - why */
-}
-
-static int
-_e_cb_fop_cp_idler(void *data)
-{
-   E_Fop *fop;
-   struct Fop_Data {
-      DIR *dir;
-      const char *path, *path2;
-   } *fd, *fd2;
-   struct stat st;
-   struct utimbuf ut;
-   struct dirent *dp = NULL;
-   char buf[PATH_MAX], buf2[PATH_MAX], *lnk;
-   
-   fop = (E_Fop *)data;
-   memset(&st, 0, sizeof(struct stat));
-   if (!fop->data)
-     {
-       fd = calloc(1, sizeof(struct Fop_Data));
-       if (fd)
-         {
-            fop->data = evas_list_append(fop->data, fd);
-            fd->path = evas_stringshare_add(fop->src);
-            fd->path2 = evas_stringshare_add(fop->dst);
-            fd->dir = opendir(fd->path);
-            snprintf(buf, sizeof(buf), "%s", fd->path);
-            snprintf(buf2, sizeof(buf2), "%s", fd->path2);
-            lnk = ecore_file_readlink(buf);
-            if (!lnk)
-              {
-                 if (ecore_file_is_dir(buf))
-                   {
-                      if (stat(buf, &st) == 0)
-                        {
-                           /* mkdir at the other end - retain stat info */
-                           if (!ecore_file_mkdir(buf2))
-                             fop->gone_bad = 1;
-                           chmod(buf2, st.st_mode);
-                           chown(buf2, st.st_uid, st.st_gid);
-                           ut.actime = st.st_atime;
-                           ut.modtime = st.st_mtime;
-                           utime(buf2, &ut);
-                        }
-                   }
-                 else
-                   {
-                      if (stat(buf, &st) == 0)
-                        {
-                           if (S_ISFIFO(st.st_mode))
-                             {
-                                /* create fifo at other end */
-                                if (mkfifo(buf2, st.st_mode) != 0)
-                                  fop->gone_bad = 1;
-                             }
-                           else if (S_ISREG(st.st_mode))
-                             {
-                                /* copy file data - retain file mode and stat data */
-                                if (!ecore_file_cp(buf, buf2)) /* FIXME: this should be split up into the fop idler to do in idle time maybe 1 block or page at a time */
-                                  fop->gone_bad = 1;
-                             }
-                           chmod(buf2, st.st_mode);
-                           chown(buf2, st.st_uid, st.st_gid);
-                           ut.actime = st.st_atime;
-                           ut.modtime = st.st_mtime;
-                           utime(buf2, &ut);
-                        }
-                   }
-              }
-            else
-              {
-                 if (stat(buf, &st) == 0)
-                   {
-                      /* duplicate link - retain stat data */
-                      if (symlink(lnk, buf2) != 0)
-                        fop->gone_bad = 1;
-                      chmod(buf2, st.st_mode);
-                      chown(buf2, st.st_uid, st.st_gid);
-                      ut.actime = st.st_atime;
-                      ut.modtime = st.st_mtime;
-                      utime(buf2, &ut);
-                   }
-                 free(lnk);
-              }
-         }
-       _e_path_fix_order(fop->dst, fop->rel, fop->rel_to, fop->x, fop->y);
-     }
-   fd = evas_list_data(evas_list_last(fop->data));
-   if (!fd) goto stop;
-   if (fd->dir) dp = readdir(fd->dir);
-   else
-     {
-       /* FIXME: handle err */
-     }
-   if (dp)
-     {
-       if (!((!strcmp(dp->d_name, ".")) || (!strcmp(dp->d_name, ".."))))
-         {
-            snprintf(buf, sizeof(buf), "%s/%s", fd->path, dp->d_name);
-            snprintf(buf2, sizeof(buf2), "%s/%s", fd->path2, dp->d_name);
-            lnk = ecore_file_readlink(buf);
-            if (!lnk)
-              {
-                 if (ecore_file_is_dir(buf))
-                   {
-                      /* mkdir at the other end - retain stat info */
-                      if (stat(buf, &st) == 0)
-                        {
-                           /* mkdir at the other end - retain stat info */
-                           if (!ecore_file_mkdir(buf2))
-                             fop->gone_bad = 1;
-                           chmod(buf2, st.st_mode);
-                           chown(buf2, st.st_uid, st.st_gid);
-                           ut.actime = st.st_atime;
-                           ut.modtime = st.st_mtime;
-                           utime(buf2, &ut);
-                        }
-                      fd2 = calloc(1, sizeof(struct Fop_Data));
-                      if (fd2)
-                        {
-                           fop->data = evas_list_append(fop->data, fd2);
-                           fd2->path = evas_stringshare_add(buf);
-                           fd2->path2 = evas_stringshare_add(buf2);
-                           fd2->dir = opendir(fd2->path);
-                        }
-                   }
-                 else
-                   {
-                      if (stat(buf, &st) == 0)
-                        {
-                           if (S_ISFIFO(st.st_mode))
-                             {
-                                /* create fifo at other end */
-                                if (mkfifo(buf2, st.st_mode) != 0)
-                                  fop->gone_bad = 1;
-                                /* FIXME: respect del_after flag */
-                             }
-                           else if (S_ISREG(st.st_mode))
-                             {
-                                /* copy file data - retain file mode and stat data */
-                                if (!ecore_file_cp(buf, buf2)) /* FIXME: this should be split up into the fop idler to do in idle time maybe 1 block or page at a time */
-                                  fop->gone_bad = 1;
-                                /* FIXME: respect del_after flag */
-                             }
-                           chmod(buf2, st.st_mode);
-                           chown(buf2, st.st_uid, st.st_gid);
-                           ut.actime = st.st_atime;
-                           ut.modtime = st.st_mtime;
-                           utime(buf2, &ut);
-                           /* respect del_after flag */
-                           if ((!fop->gone_bad) && (fop->del_after))
-                             unlink(buf);
-                        }
-                   }
-              }
-            else
-              {
-                 if (stat(buf, &st) == 0)
-                   {
-                      /* duplicate link - retain stat data */
-                      if (symlink(lnk, buf2) != 0)
-                        fop->gone_bad = 1;
-                      chmod(buf2, st.st_mode);
-                      chown(buf2, st.st_uid, st.st_gid);
-                      ut.actime = st.st_atime;
-                      ut.modtime = st.st_mtime;
-                      utime(buf2, &ut);
-                      /* respect del_after flag */
-                      if ((!fop->gone_bad) && (fop->del_after))
-                        unlink(buf);
-                   }
-                 free(lnk);
-              }
-         }
-     }
-   else
-     {
-       /* respect del_after flag */
-       if ((!fop->gone_bad) && (fop->del_after))
-         unlink(fd->path);
-       if (fd->dir) closedir(fd->dir);
-       evas_stringshare_del(fd->path);
-       evas_stringshare_del(fd->path2);
-       free(fd);
-       fop->data = evas_list_remove(fop->data, fd);
-       if (!fop->data) goto stop;
-       if (fop->gone_bad) goto stop;
-     }
-   return 1;
-   
-   stop:
-   while (fop->data)
-     {
-       fd = evas_list_data(fop->data);
-       if (fd)
-         {
-            if (fd->dir) closedir(fd->dir);
-            evas_stringshare_del(fd->path);
-            evas_stringshare_del(fd->path2);
-            free(fd);
-            fop->data = evas_list_remove(fop->data, fd);
-         }
-     }
-   evas_stringshare_del(fop->src);
-   evas_stringshare_del(fop->dst);
-   free(fop);
-   _e_fops = evas_list_remove(_e_fops, fop);
-   return 0;
-   /* FIXME: send back if succeeded or failed - why */
-}
-
 static char *
 _e_str_list_remove(Evas_List **list, char *str)
 {
index 8f30968..88bd9ba 100644 (file)
@@ -1194,8 +1194,6 @@ _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. 
@@ -1207,7 +1205,9 @@ _e_fm_op_copy_atom(E_Fm_Op_Task * task)
 
         if (_e_fm_op_handle_overwrite(task)) return 1;
        
-       if (S_ISDIR(task->src.st.st_mode))
+        E_FM_OP_DEBUG("Copy: %s --> %s\n", task->src.name, task->dst.name);
+       
+        if (S_ISDIR(task->src.st.st_mode))
          {
              if (_e_fm_op_copy_dir(task)) return 1;
          }
index adabc2b..c6d9045 100644 (file)
@@ -26,7 +26,28 @@ typedef enum _E_Fm_Op_Type
    E_FM_OP_OVERWRITE_RESPONSE_NO_ALL = 13,
    E_FM_OP_OVERWRITE_RESPONSE_YES = 14,
    E_FM_OP_OVERWRITE_RESPONSE_YES_ALL = 15,
-   E_FM_OP_COPY_STAT_INFO = 16
+   E_FM_OP_COPY_STAT_INFO = 16,
+   E_FM_OP_MKDIR,
+   E_FM_OP_TRASH,
+   E_FM_OP_MONITOR_START,
+   E_FM_OP_MONITOR_SYNC,
+   E_FM_OP_MONITOR_END,
+   E_FM_OP_MOUNT,
+   E_FM_OP_UNMOUNT,
+   E_FM_OP_HELLO,
+   E_FM_OP_FILE_ADD,
+   E_FM_OP_FILE_CHANGE,
+   E_FM_OP_FILE_DEL,
+   E_FM_OP_STORAGE_ADD,
+   E_FM_OP_STORAGE_DEL,
+   E_FM_OP_VOLUME_ADD,
+   E_FM_OP_VOLUME_DEL,
+   E_FM_OP_MOUNT_DONE,
+   E_FM_OP_UNMOUNT_DONE,
+   E_FM_OP_QUIT,
+   E_FM_OP_SYMLINK,
+   E_FM_OP_OK,
+   E_FM_OP_ERROR_RETRY_ABORT
 } E_Fm_Op_Type;
 
 #endif