Enlightenment CVS committal Author : lordchaos Project : e17 Module : proto
Dir : e17/proto/entropy/src/plugins Modified Files: action_simple.c filesystem.c structure_viewer.c Log Message: Big changes: * The tar file browsing support (via evfs) is now in. * I've left a lot of debug statements in, so expect a screenful :) * The tar URI generation code is going to be rewritten later to be more generic, this is just a placeholder * If anyone finds any regressions because of this new URI code, let me know. =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/action_simple.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- action_simple.c 20 Oct 2005 08:45:54 -0000 1.1 +++ action_simple.c 28 Oct 2005 22:33:36 -0000 1.2 @@ -4,6 +4,9 @@ #include <unistd.h> + + + int entropy_plugin_type_get() { return ENTROPY_PLUGIN_ACTION_PROVIDER; } @@ -16,17 +19,47 @@ void gui_event_callback(entropy_notify_event* eevent, void* requestor, void* obj, entropy_gui_component_instance* comp) { char fullname[1024]; entropy_gui_event* gui_event; + entropy_core* core = ((entropy_gui_component_instance*)requestor)->core; char* app; + char* uri; entropy_generic_file* file = (entropy_generic_file*)obj; - if (!strcmp(file->mime_type, "file/folder")) { + if (!strcmp(file->mime_type, "file/folder") && !file->parent) { + entropy_file_request* request = entropy_malloc(sizeof(entropy_file_request)); + request->file = file; + //printf("Action on a folder - change dirs!\n\n"); + /*Send an event to the core*/ gui_event = entropy_malloc(sizeof(entropy_gui_event)); gui_event->event_type = entropy_core_gui_event_get(ENTROPY_GUI_EVENT_FOLDER_CHANGE_CONTENTS); - gui_event->data = file; + gui_event->data = request; + entropy_core_layout_notify_event((entropy_gui_component_instance*)requestor, gui_event, ENTROPY_EVENT_LOCAL); + + return; + } else if ( (uri = entropy_core_descent_for_mime_get(core,file->mime_type)) || file->parent) { + entropy_file_request* request = entropy_malloc(sizeof(entropy_file_request)); + + printf("Requested a list of a descendable object\n"); + /*printf("URI would be: '%s://%s/%s#tar:///'\n", file->uri_base, file->path, file->filename);*/ + + + request->file = file; + if (uri) { + request->drill_down = 1; + } else { + request->drill_down = 0; + } + + //printf("Action on a folder - change dirs!\n\n"); + + + /*Send an event to the core*/ + gui_event = entropy_malloc(sizeof(entropy_gui_event)); + gui_event->event_type = entropy_core_gui_event_get(ENTROPY_GUI_EVENT_FOLDER_CHANGE_CONTENTS); + gui_event->data = request; entropy_core_layout_notify_event((entropy_gui_component_instance*)requestor, gui_event, ENTROPY_EVENT_LOCAL); return; @@ -62,6 +95,7 @@ entropy_core_component_event_register(core, instance, entropy_core_gui_event_get(ENTROPY_GUI_EVENT_ACTION_FILE)); + /*Load config*/ config = entropy_config_int_get("action_simple", "init"); if (!config) { @@ -82,12 +116,6 @@ /*Archives*/ entropy_config_str_set("action_simple", "application/x-gtar", "file-roller"); - - - - - - } return instance; =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/filesystem.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- filesystem.c 27 Oct 2005 12:12:22 -0000 1.5 +++ filesystem.c 28 Oct 2005 22:33:36 -0000 1.6 @@ -186,6 +186,7 @@ entropy_file_listener* listener; entropy_gui_event* gui_event; evfs_filereference* ref; + char* filename; char* folder; char *pos; @@ -204,12 +205,23 @@ while ( (ref= ecore_list_next(data->file_list.list)) ) { - //printf("(%s) Received file type for file: %d\n", ref->path, ref->file_type); + printf("(%s) Received file type for file: %d\n", ref->path, ref->file_type); folder = strdup((char*)ref->path); pos = rindex(folder, '/'); *pos = '\0'; + filename = strdup(pos+1); + + /*If we are the root dir (i.e. we only have one "/", replace it (so we can use it below), + * and assume this filename has length (BAD). */ + if (!strlen(folder)) { + *pos = '/'; + *(pos+1) = '\0'; + } + + printf("Calling folder is '%s'\n", folder); + /*If the calling request is currently NULL, we must go to the hash to retrieve that caller*/ if (!calling_request) { calling_request = ecore_hash_get(evfs_dir_requests, folder); @@ -225,9 +237,7 @@ //printf("Folder name: '%s', filename '%s'\n", folder, pos+1); /*Look for an existing file we have cached*/ - char* md5 = md5_entropy_path_file(folder, pos+1); - - + char* md5 = md5_entropy_path_file(folder, filename); /*Now create, or grab, a file*/ if ( !ecore_hash_get(filesystem_core->file_interest_list, md5) ) { @@ -235,7 +245,7 @@ file = entropy_generic_file_new(); /*For now, just make an entropy_generic_file for this object*/ strncpy(file->path, folder, 255); - strncpy(file->filename, pos+1, strlen(pos+1)+1); + strncpy(file->filename, filename, strlen(filename)+1); file->md5 = strdup(md5); /*Set the file type, if evfs provided it*/ @@ -246,6 +256,14 @@ //printf("Marked this file as a directory\n"); } else { //printf("Didn't mark this file, type %d\n",ref->file_type); + file->filetype = FILE_STANDARD; + } + + if (calling_request && (calling_request->drill_down || calling_request->set_parent)) { + printf("Calling request had a parent...\n"); + printf("File ('%s') parent's name is '%s'\n", file->filename, calling_request->file->filename); + + file->parent = calling_request->file; } /*Mark the file's uri FIXME do this properly*/ @@ -266,6 +284,7 @@ } free(folder); + free(filename); /*Add this file to our list*/ @@ -401,7 +420,7 @@ evfs_file_uri_path* dir_path; entropy_file_listener* listener; - if (!strcmp(request->file->uri_base, "posix")) { + if ( (!strcmp(request->file->uri_base, "posix")) && !request->drill_down && !request->file->parent) { /*If either the path, or the filename, is the root dir, we don't need another slash*/ if (strcmp(request->file->filename, "/") && strcmp(request->file->path, "/")) { snprintf(dire, 256, "%s/%s", request->file->path, request->file->filename); @@ -488,33 +507,93 @@ } else { /*Not a posix call for a dir list - don't use our local optim function */ entropy_file_request* new_request; /*We need to make a copy of the request object because the original will be destroyed*/ + + entropy_generic_file* source_file; char uri[512]; evfs_file_uri_path* path; //printf("*** Requested a '%s' dir list, calling evfs\n", request->file->uri_base); + // + // + /*If the file/location we are requesting has a 'parent' (i.e. it's inside another object), + * we have to grab the parent, not the file itself, as the base*/ + if (request->file->parent) { + source_file = request->file->parent; + } else + source_file = request->file; + // /*First build uri..*/ /*Do we have login information*/ /*TODO - wrap this up in some kind of entropy_generic_file_to_evfs_uri function*/ - if (!request->file->username) { - snprintf(uri, 512, "%s://%s/%s", request->file->uri_base, request->file->path, request->file->filename); + if (!source_file->username) { + snprintf(uri, 512, "%s://%s/%s", source_file->uri_base, source_file->path, source_file->filename); } else { - snprintf(uri, 512, "%s://%s:[EMAIL PROTECTED]/%s", request->file->uri_base, request->file->username, request->file->password, request->file->path, request->file->filename); + snprintf(uri, 512, "%s://%s:[EMAIL PROTECTED]/%s", source_file->uri_base, + source_file->username, source_file->password, + source_file->path, source_file->filename); + } + + /*If it's a drill down request, or the file has a parent */ + if (request->drill_down || request->file->parent) { + char* uri_retrieve; + char uri_build[255]; + + /*The file is a drill down request*/ + + + printf("EVFS says that this file descends through '%s'\n", uri); + + /*If we're a 'drill-down', we're at the root - so request the root*/ + if (request->drill_down) { + uri_retrieve = entropy_core_descent_for_mime_get(request->core,request->file->mime_type); + snprintf(uri_build, 255, "#%s:///", uri_retrieve); + printf("URI build says: '%s'\n", uri_build); + strcat(uri, uri_build); + } else if (request->file->parent) { + printf("Retrieving mime-descend from parent...'%s' for file with name '%s'\n", request->file->parent->mime_type, request->file->parent->filename); + uri_retrieve = entropy_core_descent_for_mime_get(request->core,request->file->parent->mime_type); + + /*Special case handler for the root dir - FIXME*/ + printf("Path: '%s', filename '%s'\n", request->file->path, request->file->filename); + if (!strcmp(request->file->path,"/")) { + snprintf(uri_build, 255, "#%s://%s%s", uri_retrieve, request->file->path, request->file->filename); + } else { + snprintf(uri_build, 255, "#%s://%s/%s", uri_retrieve, request->file->path, request->file->filename); + } + + strcat(uri, uri_build); + } + + + } - //printf("URI: %s\n", uri); + printf("URI: %s\n", uri); path = evfs_parse_uri(uri); evfs_client_dir_list(con, path->files[0]); new_request = entropy_malloc(sizeof(entropy_file_request)); - new_request->file = request->file; + + /*If this request/file has a parent, the new file listing's parent will be + * the same file - not the request file */ + + new_request->file = source_file; + if (request->file->parent) new_request->set_parent = 1; + + new_request->core = request->core; + new_request->drill_down = request->drill_down; new_request->requester = request->requester; new_request->file_type = request->file_type; - ecore_hash_set(evfs_dir_requests, path->files[0]->path, new_request); + if (request->drill_down) { + ecore_hash_set(evfs_dir_requests, "/", new_request); + } else { + ecore_hash_set(evfs_dir_requests, path->files[0]->path, new_request); + } return NULL; } =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/structure_viewer.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- structure_viewer.c 27 Oct 2005 10:23:59 -0000 1.4 +++ structure_viewer.c 28 Oct 2005 22:33:36 -0000 1.5 @@ -83,6 +83,7 @@ //printf (" Got %p\n", row); /*If we don't own this row, forget about doing something - we don't know about this*/ + if (row && !ecore_hash_get(viewer->loaded_dirs, row)) { @@ -104,7 +105,8 @@ ewl_tree_row_expand_set(row, EWL_TREE_NODE_EXPANDED); } else { - //printf ("We don't own this row\n"); + printf ("We don't own this row\n"); + printf("Looked for file '(%s)(%s) (%p)'\n", event_file->path, event_file->filename,event_file); /*printf("---------------------------------------------> This row already has children!!\n");*/ } } @@ -117,15 +119,19 @@ event_file_core* event = (event_file_core*)user_data; entropy_file_structure_viewer* viewer = (entropy_file_structure_viewer*)event->instance->data; entropy_gui_event* gui_event; + entropy_file_request* request = entropy_malloc(sizeof(entropy_file_request)); //printf("Clicked on %s%s\n", event->file->path, event->file->filename); /*-----------*/ /*Send an event to the core*/ + request->file = event->file; + request->drill_down = 0; + gui_event = entropy_malloc(sizeof(entropy_gui_event)); gui_event->event_type = entropy_core_gui_event_get(ENTROPY_GUI_EVENT_FOLDER_CHANGE_CONTENTS); - gui_event->data = event->file; + gui_event->data = request; entropy_core_layout_notify_event(event->instance, gui_event, ENTROPY_EVENT_LOCAL); if (viewer->last_selected_label) { ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs