Enlightenment CVS committal

Author  : chaos
Project : e17
Module  : proto

Dir     : e17/proto/entropy/src/plugins


Modified Files:
        etk_structure_viewer.c filesystem.c 


Log Message:
* Take advantage of new evfs multi-file copy.  Immediate precursor to *much* 
improved copy dialog

===================================================================
RCS file: /cvs/e/e17/proto/entropy/src/plugins/etk_structure_viewer.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- etk_structure_viewer.c      10 Jun 2006 02:36:14 -0000      1.26
+++ etk_structure_viewer.c      6 Aug 2006 10:01:10 -0000       1.27
@@ -81,31 +81,40 @@
 
    instance = ecore_hash_get(instance_map_hash, row);
    if (instance) {
+          Ecore_List* files_copy;
+          
           viewer = instance->data;
           e_event = ecore_hash_get(viewer->row_hash, row);
    
-          if(ev->content != ETK_SELECTION_CONTENT_FILES) {
-            printf("Drop wasn't files!\n");
-            return;
-          }
+          if (e_event) {
+                  if(ev->content != ETK_SELECTION_CONTENT_FILES) {
+                    printf("Drop wasn't files!\n");
+                    return;
+                  }
 
-          printf("We received %d files\n", files->num_files);
-          for (i = 0; i < files->num_files; i++)
-            {
-                    entropy_generic_file* file = 
entropy_core_uri_generic_file_retrieve(files->files[i]);
+                  printf("We received %d files\n", files->num_files);
+
+                  files_copy = ecore_list_new();
+                  for (i = 0; i < files->num_files; i++)
+                    {
+                            entropy_generic_file* file = 
entropy_core_uri_generic_file_retrieve(files->files[i]);
+                    
+                            if (!file) {
+                                    entropy_file_listener* listener = 
entropy_malloc(sizeof(entropy_file_listener));
+                                    file = 
entropy_core_parse_uri(files->files[i]);
+                                    listener->file = file;
+                                    listener->count = 1;
+                                    entropy_core_file_cache_add(file->md5, 
listener);
+                            }
+                            printf("File is '%s' ---> %p\n", files->files[i], 
file);
+                            printf("Destination: %s\n", e_event->file->uri);
+
+                            ecore_list_append(files_copy, file);
             
-                    if (!file) {
-                            entropy_file_listener* listener = 
entropy_malloc(sizeof(entropy_file_listener));
-                            file = entropy_core_parse_uri(files->files[i]);
-                            listener->file = file;
-                            listener->count = 1;
-                            entropy_core_file_cache_add(file->md5, listener);
                     }
-                    printf("File is '%s' ---> %p\n", files->files[i], file);
-                    printf("Destination: %s\n", e_event->file->uri);
-
-                    entropy_plugin_filesystem_file_move(file, 
e_event->file->uri, instance);
-            }
+                  entropy_plugin_filesystem_file_copy_multi(files_copy, 
e_event->file->uri, instance);
+                  ecore_list_destroy(files_copy);
+           }
    } else {
           printf("Could not get instance for dropped row!\n");
    }
===================================================================
RCS file: /cvs/e/e17/proto/entropy/src/plugins/filesystem.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -3 -r1.73 -r1.74
--- filesystem.c        20 Jul 2006 17:49:58 -0000      1.73
+++ filesystem.c        6 Aug 2006 10:01:10 -0000       1.74
@@ -27,6 +27,8 @@
 struct stat *filestat_get (entropy_file_request * request);
 Ecore_List *filelist_get (entropy_file_request * request);
 void entropy_filesystem_file_copy (entropy_generic_file * file, char *path_to, 
entropy_gui_component_instance * instance);
+void entropy_filesystem_file_copy_multi (Ecore_List* files, char *path_to, 
entropy_gui_component_instance * instance);
+
 void entropy_filesystem_file_move (entropy_generic_file * file, char *path_to, 
entropy_gui_component_instance * instance);
 
 
@@ -594,6 +596,7 @@
   plugin->file_functions.filestat_get = &filestat_get;
   plugin->file_functions.filelist_get = &filelist_get;
   plugin->file_functions.file_copy = &entropy_filesystem_file_copy;
+  plugin->file_functions.file_copy_multi = &entropy_filesystem_file_copy_multi;
   plugin->file_functions.file_move = &entropy_filesystem_file_move;
 
   plugin->file_functions.file_rename = &entropy_filesystem_file_rename;
@@ -864,7 +867,6 @@
 {
   evfs_file_uri_path *uri_path_from;
   evfs_file_uri_path *uri_path_to;
-  char copy_buffer[PATH_MAX];
   char uri_from[512];
   char uri_to[512];
   long id;
@@ -886,7 +888,6 @@
   //printf("Original uri is: '%s'\n", original);
   //
   /*Track the copy action */
-  snprintf (copy_buffer, PATH_MAX, "%s%s", uri_from, uri_to);
   id = evfs_client_file_copy (con, uri_path_from->files[0], 
uri_path_to->files[0]);
   ecore_hash_set(evfs_dir_requests, (long*)id, instance);
 
@@ -894,13 +895,35 @@
   evfs_cleanup_file_uri_path(uri_path_to);
 }
 
+
+void
+entropy_filesystem_file_copy_multi (Ecore_List* files, char *path_to,
+                             entropy_gui_component_instance * instance)
+{
+  long id;
+  entropy_generic_file* file;
+  Ecore_List* evfs_files;
+
+  evfs_files = ecore_list_new();
+  ecore_list_goto_first(files);
+  while ( (file = ecore_list_next(files)) ) { 
+         printf("Parsing %s for multi copy\n", file->uri);
+         ecore_list_append(evfs_files, evfs_parse_uri_single(file->uri));
+  }
+  
+  /*Track the copy action */
+  id = evfs_client_file_copy_multi (con, evfs_files, 
evfs_parse_uri_single(path_to));
+  ecore_hash_set(evfs_dir_requests, (long*)id, instance);
+
+}
+
+
 void
 entropy_filesystem_file_move (entropy_generic_file * file, char *path_to,
                              entropy_gui_component_instance * instance)
 {
   evfs_file_uri_path *uri_path_from;
   evfs_file_uri_path *uri_path_to;
-  char copy_buffer[PATH_MAX];
   char uri_from[512];
   char uri_to[512];
   long id;
@@ -915,7 +938,6 @@
   uri_path_to = evfs_parse_uri (uri_to);
 
   /*Track the move action */
-  snprintf (copy_buffer, PATH_MAX, "%s%s", uri_from, uri_to);
   id = evfs_client_file_move (con, uri_path_from->files[0], 
uri_path_to->files[0]);
   ecore_hash_set(evfs_dir_requests, (long*)id, instance);
 



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to