Enlightenment CVS committal

Author  : lordchaos
Project : e17
Module  : apps/evfs

Dir     : e17/apps/evfs/src/bin


Modified Files:
        Makefile.am evfs_main.c evfs_operation.c evfs_server_handle.c 


Log Message:
* Work on evfs_operation for user/server comms on tasks

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/bin/Makefile.am,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- Makefile.am 15 Jan 2006 12:26:40 -0000      1.14
+++ Makefile.am 26 Jan 2006 03:33:47 -0000      1.15
@@ -16,6 +16,7 @@
        $(top_srcdir)/src/common/evfs_event_helper.c \
        $(top_srcdir)/src/common/evfs_common.c \
        evfs_server_handle.c \ 
+       evfs_operation.c \
        $(top_srcdir)/src/common/evfs_vfolder.c
 
 evfscat_SOURCES = \
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/bin/evfs_main.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- evfs_main.c 26 Jan 2006 00:55:33 -0000      1.32
+++ evfs_main.c 26 Jan 2006 03:33:47 -0000      1.33
@@ -311,6 +311,7 @@
        evfs_load_plugins();
        evfs_io_initialise();
        evfs_vfolder_initialise();
+       evfs_operation_initialise();
 
 
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/bin/evfs_operation.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- evfs_operation.c    20 Jan 2006 03:11:42 -0000      1.2
+++ evfs_operation.c    26 Jan 2006 03:33:47 -0000      1.3
@@ -2,6 +2,7 @@
 
 static long evfs_operation_count = 0;
 static int evfs_operation_init = 0;
+static Ecore_Hash* evfs_operation_hash;
 
 void evfs_operation_initialise() 
 {
@@ -9,11 +10,42 @@
                return;
 
        evfs_operation_init = 1;
-
        evfs_operation_count = 0;
+
+       evfs_operation_hash = ecore_hash_new(ecore_direct_hash, 
ecore_direct_compare);
 }
        
 
-evfs_operation* evfs_operation_new
+evfs_operation* evfs_operation_new() 
+{
+       evfs_operation_count++;
+       
+       evfs_operation* op = NEW(evfs_operation);
+       op->id = evfs_operation_count;
+       op->status = EVFS_OPERATION_STATUS_NORMAL;
+
+       ecore_hash_set(evfs_operation_hash, (long*)op->id, op);
+       
+       return op;
+}
+
+void evfs_operation_destroy(evfs_operation* op) 
+{
+       ecore_hash_remove(evfs_operation_hash, (long*)op->id);
+       free(op);
+}
+
+evfs_operation* evfs_operation_get_by_id(long id) 
+{
+       return ecore_hash_get(evfs_operation_hash, (long*)id);
+}
+
+void evfs_operation_status_set(evfs_operation* op, int status) {
+       op->status = status;
+}
+
+void evfs_operation_user_dispatch(evfs_client* client, evfs_operation* op) {
+       printf("stub");
+}
 
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/bin/evfs_server_handle.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- evfs_server_handle.c        18 Jan 2006 10:31:21 -0000      1.35
+++ evfs_server_handle.c        26 Jan 2006 03:33:47 -0000      1.36
@@ -107,7 +107,7 @@
 
        evfs_plugin* plugin = evfs_get_plugin_for_uri(client->server, 
command->file_command.files[0]->plugin_uri);
        if (plugin) {
-               (*plugin->functions->evfs_file_lstat)(command, &file_stat);
+               (*plugin->functions->evfs_file_lstat)(command, &file_stat, 0);
                //printf("ST_MODE: %d\n", file_stat.st_mode);
                
                //printf("Pointer here: %p\n", 
plugin->functions->evfs_file_remove);
@@ -184,7 +184,7 @@
        evfs_plugin* plugin = evfs_get_plugin_for_uri(client->server, 
command->file_command.files[0]->plugin_uri);
        if (plugin) {
                printf("Pointer here: %p\n", plugin->functions->evfs_file_stat);
-               (*(plugin->functions->evfs_file_stat))(command, &file_stat);
+               (*(plugin->functions->evfs_file_stat))(command, &file_stat, 0);
 
                
 
@@ -273,10 +273,19 @@
        long count;
        char destination_file[PATH_MAX];
        long read_write_bytes = 0;
+       
        struct stat file_stat;
+       struct stat dest_stat;
+       
        int progress = 0;
        int last_notify_progress = 0;
        int b_read = 0, b_write= 0;
+       int res;
+       evfs_operation* op;
+
+       /*Make a new evfs_operation, for client communication*/
+       op = evfs_operation_new();
+       
 
        plugin = evfs_get_plugin_for_uri(client->server, 
command->file_command.files[0]->plugin_uri);
        dst_plugin = evfs_get_plugin_for_uri(client->server, 
command->file_command.files[1]->plugin_uri);
@@ -291,15 +300,27 @@
                        plugin->functions->evfs_file_open &&
                        dst_plugin->functions->evfs_file_create 
                      )) {
-                       printf("AHH! Not supported!\n");
+                       printf("AHH! Copy Not supported!\n");
+                       evfs_operation_destroy(op);
                        return;
                }
 
 
                /*Get the source file size*/
-               (*plugin->functions->evfs_file_lstat)(command, &file_stat);
-               printf("Source file size: %d bytes\n", (int)file_stat.st_size);
-               
+               (*plugin->functions->evfs_file_lstat)(command, &file_stat, 0);
+               res = (*dst_plugin->functions->evfs_file_lstat)(command, 
&dest_stat, 1);
+               //printf("Source file size: %d bytes\n", 
(int)file_stat.st_size);
+               //
+               if (res != EVFS_ERROR) {
+                       printf("File overwrite\n");
+                       evfs_operation_status_set(op, 
EVFS_OPERATION_STATUS_USER_WAIT);
+
+                       evfs_operation_user_dispatch(client,op);
+                       while (op->status == EVFS_OPERATION_STATUS_USER_WAIT) {
+                               ecore_main_loop_iterate();
+                               usleep(10);
+                       }
+               }
                
                if (!S_ISDIR(file_stat.st_mode)) {
                        
(*dst_plugin->functions->evfs_file_create)(command->file_command.files[1]);
@@ -321,6 +342,7 @@
                                        b_write = 
(*dst_plugin->functions->evfs_file_write)(command->file_command.files[1], 
bytes, b_read );
                                        //printf("%d  -> %d\n", b_read, 
b_write);
                                }
+                               count+= b_read;
 
 
                
@@ -331,9 +353,6 @@
                                                root_command,progress, 
EVFS_PROGRESS_TYPE_CONTINUE);
                                        last_notify_progress = progress;
                                }
-                       
-
-                               count+= b_read;
 
                                //printf("Bytes to go: %d\n", file_stat.st_size 
- count);
 
@@ -408,6 +427,8 @@
                        command->file_command.files[0]->plugin_uri, 
command->file_command.files[1]->plugin_uri );
        }
 
+       evfs_operation_destroy(op);
+
 }
 
 void evfs_handle_ping_command(evfs_client* client, evfs_command* command) {




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to