Enlightenment CVS committal

Author  : lordchaos
Project : e17
Module  : proto

Dir     : e17/proto/entropy/src/plugins


Modified Files:
        ewl_icon_local_viewer.c layout_ewl_simple.c structure_viewer.c 


Log Message:
* Check in DND code I've been holding back on until ewld_dnd is in

===================================================================
RCS file: 
/cvsroot/enlightenment/e17/proto/entropy/src/plugins/ewl_icon_local_viewer.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- ewl_icon_local_viewer.c     11 Dec 2005 07:09:57 -0000      1.40
+++ ewl_icon_local_viewer.c     22 Dec 2005 04:34:42 -0000      1.41
@@ -110,7 +110,7 @@
        Ecore_List* selected;
        entropy_generic_file* file;
        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);
+       entropy_plugin* plugin = 
entropy_plugins_type_get_first(ENTROPY_PLUGIN_BACKEND_FILE 
,ENTROPY_PLUGIN_SUB_TYPE_ALL);
 
        void (*copy_func)(entropy_generic_file* source, char* dest_uri, 
entropy_gui_component_instance* requester);
 
@@ -258,8 +258,12 @@
                
                
                freeobj = ecore_hash_get( gui_hash, obj);
-               
-               if (freeobj) gui_file_destroy(freeobj);
+               if (freeobj) {
+                       /*Associate this icon with this file in the core, so 
DND works*/
+                       entropy_core_object_file_disassociate(freeobj->icon);
+                       
+                       gui_file_destroy(freeobj);
+               }
 
                /*Tell the core we no longer need this file - it might free it 
now*/
                entropy_core_file_cache_remove_reference(obj->md5);
@@ -303,8 +307,7 @@
                 * reference */
                instance = ecore_list_next(file_list);
 
-               plugin = 
entropy_plugins_type_get_first(instance->core->plugin_list, 
-                       ENTROPY_PLUGIN_BACKEND_FILE 
,ENTROPY_PLUGIN_SUB_TYPE_ALL);
+               plugin = entropy_plugins_type_get_first( 
ENTROPY_PLUGIN_BACKEND_FILE ,ENTROPY_PLUGIN_SUB_TYPE_ALL);
 
                /*Get the func ref*/
                del_func = dlsym(plugin->dl_ref, 
"entropy_filesystem_file_remove");
@@ -607,6 +610,9 @@
                        ecore_hash_set(view->gui_hash, list_item, gui_object);
                        ecore_hash_set(view->icon_hash, icon, gui_object);
 
+                       /*Associate this icon with this file in the core, so 
DND works*/
+                       entropy_core_object_file_associate(icon, list_item);
+
                        if (do_mime == DO_MIME) {
                                char* mime;
                                entropy_plugin* thumb;
@@ -874,7 +880,6 @@
                entropy_file_progress* progress = ret;
                
                                                  
-               printf("Received a file progress event..\n");
                if (!view->progress->progress_window) {
                        printf("Showing progressbar dialog..\n");
 
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/proto/entropy/src/plugins/layout_ewl_simple.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- layout_ewl_simple.c 12 Dec 2005 01:58:27 -0000      1.19
+++ layout_ewl_simple.c 22 Dec 2005 04:34:43 -0000      1.20
@@ -317,8 +317,7 @@
 
 
        /*Now attach an object to it*/
-       structure = entropy_plugins_type_get_first(instance->core->plugin_list, 
-               ENTROPY_PLUGIN_GUI_COMPONENT, 
ENTROPY_PLUGIN_GUI_COMPONENT_STRUCTURE_VIEW);
+       structure = 
entropy_plugins_type_get_first(ENTROPY_PLUGIN_GUI_COMPONENT, 
ENTROPY_PLUGIN_GUI_COMPONENT_STRUCTURE_VIEW);
 
        if (structure) {
                Ewl_Widget* children[2];
@@ -500,7 +499,7 @@
 
        /*---------------------------*/
        /*HACK - get the iconbox - this should be configurable */
-       plugin = entropy_plugins_type_get_first(core->plugin_list,  
ENTROPY_PLUGIN_GUI_COMPONENT, ENTROPY_PLUGIN_GUI_COMPONENT_LOCAL_VIEW);
+       plugin = entropy_plugins_type_get_first(ENTROPY_PLUGIN_GUI_COMPONENT, 
ENTROPY_PLUGIN_GUI_COMPONENT_LOCAL_VIEW);
        if (plugin) {
                //printf("Plugin: %s\n", plugin->filename);
                entropy_plugin_init = dlsym(plugin->dl_ref, 
"entropy_plugin_init");
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/proto/entropy/src/plugins/structure_viewer.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- structure_viewer.c  20 Dec 2005 22:01:20 -0000      1.19
+++ structure_viewer.c  22 Dec 2005 04:34:43 -0000      1.20
@@ -2,6 +2,12 @@
 #include "entropy.h"
 #include "entropy_gui.h"
 #include <dlfcn.h>
+#include <limits.h>
+
+void dnd_leave_callback(Ewl_Widget *main_win, void *ev_data, void *user_data);
+void dnd_enter_callback(Ewl_Widget *main_win, void *ev_data, void *user_data);
+void dnd_drop_callback(Ewl_Widget* w, void* ev_data, void* user_data);
+
 
 
 typedef struct entropy_file_structure_viewer entropy_file_structure_viewer;
@@ -130,7 +136,7 @@
 
 
 void dnd_enter_callback(Ewl_Widget *main_win, void *ev_data, void *user_data) {
-event_file_core* event = (event_file_core*)user_data;
+       event_file_core* event = (event_file_core*)user_data;
        entropy_file_structure_viewer* viewer = 
(entropy_file_structure_viewer*)event->instance->data;
        
 
@@ -138,7 +144,7 @@
        ewl_text_color_apply(EWL_TEXT(event->data), 255, 0, 0, 255, 
ewl_text_length_get(EWL_TEXT(event->data)));
 
        
-       printf("Entered text %p\n", main_win);
+       //printf("Entered text %p\n", main_win);
 }
 
 void dnd_leave_callback(Ewl_Widget *main_win, void *ev_data, void *user_data) {
@@ -149,7 +155,43 @@
        ewl_text_color_apply(EWL_TEXT(event->data), 0, 0, 0, 255, 
ewl_text_length_get(EWL_TEXT(event->data)));
 
        
-       printf("Left text %p\n", main_win);
+       //printf("Left text %p\n", main_win);
+}
+
+void dnd_drop_callback(Ewl_Widget* w, void* ev_data, void* user_data) {
+       Ewl_Widget* widget = ewl_dnd_drag_widget_get();
+       event_file_core* event = (event_file_core*)user_data;
+
+
+       if (widget) {
+               printf("Drop widget: '%s'\n", widget->inheritance);
+               if (ewl_widget_type_is(widget, "icon")) {
+                       char* folder;
+                       Ewl_IconBox* iconbox = 
EWL_ICONBOX_ICON(widget)->icon_box_parent;
+                       Ecore_List* sel_list = 
ewl_iconbox_get_selection(iconbox);
+                       Ewl_IconBox_Icon* icon;
+                       entropy_generic_file* file;
+                       char dest_dir[PATH_MAX];
+
+                       entropy_plugin* plugin = 
+                               
entropy_plugins_type_get_first(ENTROPY_PLUGIN_BACKEND_FILE 
,ENTROPY_PLUGIN_SUB_TYPE_ALL);
+                       void (*copy_func)(entropy_generic_file* source, char* 
dest_uri, entropy_gui_component_instance* requester);
+                       copy_func = dlsym(plugin->dl_ref, 
"entropy_filesystem_file_copy");
+
+                       snprintf(dest_dir, PATH_MAX, "%s://%s/%s", 
event->file->uri_base, event->file->path, event->file->filename);
+                       
+
+                       ecore_list_goto_first(sel_list);
+                       while ( (icon = ecore_list_remove_first(sel_list))) {
+                               if ( (file = 
entropy_core_object_file_association_get(icon))) {
+                                       printf("Filename: '%s' - '%s/%s'\n", 
file->uri_base, file->path, file->filename);
+                                       (*copy_func)(file, dest_dir, 
event->instance);  
+                               }
+                       }
+
+                       //printf("Copy to folder '%s/%s'\n", event->file->path, 
event->file->filename);
+               }
+       }
 }
 
 
@@ -228,6 +270,7 @@
                ewl_callback_append(row, EWL_CALLBACK_CLICKED, 
row_clicked_callback, event);
                ewl_callback_append(row, EWL_CALLBACK_DND_ENTER, 
dnd_enter_callback, event);
                ewl_callback_append(row, EWL_CALLBACK_DND_LEAVE, 
dnd_leave_callback, event);
+               ewl_callback_append(row, EWL_CALLBACK_DND_DROP, 
dnd_drop_callback, event);
 
                //ewl_widget_appearance_set(EWL_WIDGET(row), "entry");
                




-------------------------------------------------------
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://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to