Enlightenment CVS committal
Author : lordchaos
Project : e17
Module : proto
Dir : e17/proto/entropy/src/plugins
Modified Files:
ewl_icon_local_viewer.c filesystem.c mime.c
Log Message:
* First bits of the entropy file copy progress dialog
===================================================================
RCS file:
/cvsroot/enlightenment/e17/proto/entropy/src/plugins/ewl_icon_local_viewer.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- ewl_icon_local_viewer.c 13 Nov 2005 08:36:51 -0000 1.23
+++ ewl_icon_local_viewer.c 16 Nov 2005 11:48:34 -0000 1.24
@@ -26,13 +26,31 @@
void* requestor;
int count;
int terminate;
-
-
-
-
} event_idle_processor;
+
+/*------------------------------------------------*/
+/*Start file copy progress objects/structures - This should be moved to a
plugin. Action plugin? */
+
+typedef struct entropy_file_progress_window {
+ Ewl_Widget* progress_window;
+ Ewl_Widget* file_from;
+ Ewl_Widget* file_to;
+ Ewl_Widget* progressbar;
+} entropy_file_progress_window;
+
+
+
+
+
+
+
+/*---------------------------------------------*/
+
+
+
+
void gui_event_callback(entropy_notify_event* eevent, void* requestor, void*
ret, void* user_data);
@@ -45,6 +63,9 @@
Ecore_List* current_events; /*A ref to the events we have waiting on
the queue. perhaps we should handle this in the notify queue,
one less thing for plugins to handle */
+
+ entropy_file_progress_window* progress;
+
Ewl_Widget* file_dialog;
Ewl_Widget* file_dialog_parent;
@@ -202,7 +223,6 @@
text = ewl_text_new();
stime = file_stat->stat_obj->st_mtime;
- printf("RET mtime is: %d\n", file_stat->stat_obj->st_mtime);
ewl_text_text_set(EWL_TEXT(text), ctime(&stime));
ewl_container_child_append(EWL_CONTAINER(hbox), text);
ewl_widget_show(text);
@@ -286,7 +306,7 @@
entropy_gui_component_instance* instance =
((entropy_gui_component_instance*)user_data);
entropy_plugin* plugin =
entropy_plugins_type_get_first(instance->core->plugin_list,
ENTROPY_PLUGIN_BACKEND_FILE ,ENTROPY_PLUGIN_SUB_TYPE_ALL);
- void (*copy_func)(entropy_generic_file* source, char* dest_uri);
+ void (*copy_func)(entropy_generic_file* source, char* dest_uri,
entropy_gui_component_instance* requester);
/*Get the func ref*/
@@ -299,7 +319,7 @@
while ( (file = ecore_list_next(selected)) ) {
//printf("File '%s'\n", file->filename);
- (*copy_func)(file,
((entropy_icon_viewer*)instance->data)->current_dir );
+ (*copy_func)(file,
((entropy_icon_viewer*)instance->data)->current_dir, instance );
}
@@ -451,6 +471,7 @@
entropy_gui_component_instance* entropy_plugin_init(entropy_core*
core,entropy_gui_component_instance* layout) {
Ewl_Widget* context;
+ Ewl_Widget* vbox;
entropy_gui_component_instance* instance =
entropy_malloc(sizeof(entropy_gui_component_instance));
entropy_icon_viewer* viewer =
entropy_malloc(sizeof(entropy_icon_viewer));
@@ -465,6 +486,38 @@
instance->gui_object = viewer->iconbox;
ewl_widget_show(EWL_WIDGET(viewer->iconbox));
+
+ /*Initialise the progress window*/
+ viewer->progress = entropy_malloc(sizeof(entropy_file_progress_window));
+ viewer->progress->progress_window = ewl_window_new();
+ ewl_window_title_set(EWL_WINDOW(viewer->progress->progress_window),
"File Copy");
+
ewl_object_custom_size_set(EWL_OBJECT(viewer->progress->progress_window), 400,
150);
+
+ vbox = ewl_vbox_new();
+
ewl_container_child_append(EWL_CONTAINER(viewer->progress->progress_window),
vbox);
+ ewl_widget_show(vbox);
+
+ viewer->progress->file_from = ewl_text_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox),
viewer->progress->file_from);
+ ewl_widget_show(viewer->progress->file_from);
+
+ viewer->progress->file_to = ewl_text_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox),
viewer->progress->file_to);
+ ewl_widget_show(viewer->progress->file_to);
+
+ viewer->progress->progressbar = ewl_progressbar_new();
+ ewl_container_child_append(EWL_CONTAINER(vbox),
viewer->progress->progressbar);
+
ewl_progressbar_range_set(EWL_PROGRESSBAR(viewer->progress->progressbar), 100);
+ ewl_widget_show(viewer->progress->progressbar);
+
+
+
+
+
+
+
+
+
/*Add some context menu items*/
context = ewl_menu_item_new();
ewl_menu_item_text_set(EWL_MENU_ITEM(context), "Copy selection");
@@ -568,6 +621,14 @@
entropy_core_component_event_register(core, instance,
entropy_core_gui_event_get(ENTROPY_GUI_EVENT_FILE_STAT));
entropy_core_component_event_register(core, instance,
entropy_core_gui_event_get(ENTROPY_GUI_EVENT_FILE_STAT_AVAILABLE));
+ /*We want to know about file transfer progress events*/
+ entropy_core_component_event_register(core, instance,
entropy_core_gui_event_get(ENTROPY_GUI_EVENT_FILE_PROGRESS));
+
+
+
+
+
+
return instance;
}
@@ -873,6 +934,23 @@
}
break;
+ case ENTROPY_NOTIFY_FILE_PROGRESS: {
+ entropy_icon_viewer* view = comp->data;
+ entropy_file_progress* progress = ret;
+
+
+ printf("Received a file progress event..\n");
+ if (!VISIBLE(view->progress->progress_window)) {
+ ewl_widget_show(view->progress->progress_window);
+ }
+
+ ewl_text_text_set(EWL_TEXT(view->progress->file_from),
progress->file_from);
+ ewl_text_text_set(EWL_TEXT(view->progress->file_to),
progress->file_to);
+
ewl_progressbar_value_set(EWL_PROGRESSBAR(view->progress->progressbar),
progress->progress);
+
+ }
+ break;
+
} //End switch
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/filesystem.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- filesystem.c 15 Nov 2005 11:40:55 -0000 1.18
+++ filesystem.c 16 Nov 2005 11:48:34 -0000 1.19
@@ -17,6 +17,7 @@
Ecore_Hash* folder_monitor_hash;
Ecore_Hash* stat_request_hash;
+Ecore_Hash* file_copy_hash;
Ecore_Hash* evfs_dir_requests;
entropy_core* filesystem_core; /*A reference to the core*/
@@ -184,12 +185,13 @@
/*Do some freeing*/
entropy_free(file_stat);
entropy_free(file_stat->stat_obj);
+
+ /*No need to free event - notify_event frees it
for us*/
}
break;
-
case EVFS_EV_DIR_LIST: {
Ecore_List* file_list = ecore_list_new();
entropy_file_request* calling_request = NULL;
@@ -321,9 +323,40 @@
}
break;
- case EVFS_EV_FILE_PROGRESS:
- printf("Progress for file '%s' is %f\%\n",
(char*)data->resp_command.file_command.files[0]->path,
data->progress.file_progress);
- break;
+ case EVFS_EV_FILE_PROGRESS: {
+ entropy_gui_event* gui_event;
+ entropy_gui_component_instance* instance = NULL;
+ entropy_file_progress* request =
entropy_malloc(sizeof(entropy_file_progress));
+ char* uri = NULL;
+
+ printf("Progress for file '%s' is %f percent\n",
(char*)data->resp_command.file_command.files[0]->path,
data->progress.file_progress);
+
+ request->file_from =
evfs_filereference_to_string(data->resp_command.file_command.files[0]);
+ request->file_to =
evfs_filereference_to_string(data->resp_command.file_command.files[1]);
+ request->progress = data->progress.file_progress;
+
+ /*Build up the gui_event wrapper*/
+ gui_event = entropy_malloc(sizeof(entropy_gui_event));
+ gui_event->event_type =
entropy_core_gui_event_get(ENTROPY_GUI_EVENT_FILE_PROGRESS);
+ gui_event->data = request;
+
+ /*Find who called us*/
+ uri =
evfs_filereference_to_string(data->resp_command.file_command.files[0]);
+ instance = ecore_hash_get(file_copy_hash, uri);
+
+ if (instance) {
+ entropy_core_layout_notify_event(instance ,
gui_event, ENTROPY_EVENT_LOCAL);
+ } else {
+ printf("Could not get file copy caller for
'%s'\n", uri);
+ free(gui_event);
+ }
+
+ free(uri);
+ free(request->file_from);
+ free(request->file_to);
+ free(request);
+ }
+ break;
default: printf("Received an EVFS message we don't
recognise!\n");
break;
@@ -366,6 +399,7 @@
folder_monitor_hash = ecore_hash_new(ecore_direct_hash,
ecore_direct_compare);
stat_request_hash = ecore_hash_new(ecore_str_hash, ecore_str_compare);
evfs_dir_requests = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+ file_copy_hash = ecore_hash_new(ecore_str_hash, ecore_str_compare);
con = evfs_connect(&callback);
@@ -601,9 +635,10 @@
-void entropy_filesystem_file_copy(entropy_generic_file* file, char* path_to) {
+void entropy_filesystem_file_copy(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* original;
char uri_from[512];
char uri_to[512];
@@ -615,11 +650,23 @@
//printf ("Copying file %s to %s\n", uri_from, uri_to);
-
+
uri_path_from = evfs_parse_uri(uri_from);
uri_path_to = evfs_parse_uri(uri_to);
+
+ //printf("Original uri is: '%s'\n", original);
+ //
+ /*Track the copy action*/
+ original = evfs_filereference_to_string(uri_path_from->files[0]);
+ ecore_hash_set(file_copy_hash, original, instance);
+
+
+
+
evfs_client_file_copy(con, uri_path_from->files[0],
uri_path_to->files[0]);
+
+ //TODO - free the file containers here
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/mime.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- mime.c 29 Oct 2005 02:00:19 -0000 1.5
+++ mime.c 16 Nov 2005 11:48:34 -0000 1.6
@@ -49,6 +49,8 @@
char* ifile;
char* type = NULL; char* pos;
+ int stat_res=0;
+ struct stat st;
if (!filename || strlen(filename) ==0) {
@@ -60,10 +62,9 @@
sprintf(fullname, "%s/%s", path, filename);
- struct stat st;
- stat(fullname, &st);
-
- if (S_ISDIR(st.st_mode)) {
+
+ stat_res = stat(fullname, &st);
+ if (!stat_res && S_ISDIR(st.st_mode)) {
/*printf("It's a folder..\n");*/
entropy_free(ifile);
return "file/folder";
-------------------------------------------------------
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. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs