Enlightenment CVS committal

Author  : lordchaos
Project : e17
Module  : proto

Dir     : e17/proto/entropy/src/plugins


Modified Files:
        Makefile.am action_simple.c ewl_icon_local_viewer.c 
        ewl_mime_dialog.c layout_ewl_simple.c 
Added Files:
        ewl_tip.c 


Log Message:
Whoa! Lots of changes:

* A more complete MIME-type engine.  You can now place 'uris' or 'paths' in 
mime-actions, e.g.: 'evfscat "%u" | mplayer -cache 8192 -" will replace "%u" 
with the fully qualified URI for the file.  This is a bit of a hack right now, 
and needs to be made more generic.
* A bug I'll pretend never happened: Due to an 'operation-order' bug in the 
incremental icon-add code, the icon-viewer would miss 1 file per cycle from the 
icon listing.  Oops
* A few core memory-leak avoidances

===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/Makefile.am,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- Makefile.am 28 Nov 2005 08:34:41 -0000      1.8
+++ Makefile.am 6 Dec 2005 09:56:11 -0000       1.9
@@ -39,7 +39,8 @@
 action_simple_la_LIBADD        = @EWL_LIBS@
 
 
-layout_ewl_simple_la_SOURCES   = ewl_mime_dialog.c layout_ewl_simple.c 
$(top_srcdir)/src/entropy_debug.c
+layout_ewl_simple_la_SOURCES   = ewl_mime_dialog.c layout_ewl_simple.c 
$(top_srcdir)/src/entropy_debug.c \
+                                ewl_tip.c
 layout_ewl_simple_la_CFLAGS    = @EWL_CFLAGS@
 layout_ewl_simple_la_LDFLAGS   = -module -avoid-version
 layout_ewl_simple_la_LIBADD    = @EWL_LIBS@
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/action_simple.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- action_simple.c     24 Nov 2005 04:03:13 -0000      1.6
+++ action_simple.c     6 Dec 2005 09:56:11 -0000       1.7
@@ -22,6 +22,7 @@
        entropy_core* core = ((entropy_gui_component_instance*)requestor)->core;
        entropy_mime_action* app;
        char* uri;
+       char* pos;
 
        entropy_generic_file* file = (entropy_generic_file*)obj;
 
@@ -39,7 +40,9 @@
                
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) {
+       } else if ( (uri = 
entropy_core_descent_for_mime_get(core,file->mime_type)) 
+               || (file->parent && !strcmp(file->mime_type,"file/folder")) ) {
+
                entropy_file_request* request = 
entropy_malloc(sizeof(entropy_file_request));
                
                printf("Requested a list of a descendable object\n");
@@ -65,12 +68,37 @@
                return;
        }
 
+       
+       
+
 
        /*First get the app associated with this mime type*/
        app = entropy_core_mime_hint_get( 
((entropy_generic_file*)obj)->mime_type);
        if (app) {
-               sprintf(fullname, "%s \"%s/%s\"", app->executable, 
+               /*First do a replace*/
+               if ( (pos = strstr(app->executable, "\%u"))) {
+                       bzero(fullname, 1024);
+                       uri = entropy_core_generic_file_uri_create(file, 0);
+               
+                       printf("Action '%s' contains a URI replace 
reference\n", app->executable);
+
+                       /*This is some evil shit - TODO make a proper 
strreplace function*/
+                       strncat(fullname, app->executable, pos-app->executable);
+                       strcat(fullname, uri);
+                       pos += 2;
+                       strcat(fullname, pos);
+
+
+                       printf("'%s'\n", fullname);
+
+                       free(uri);
+               } else {
+                       sprintf(fullname, "%s \"%s/%s\"", app->executable, 
                        ((entropy_generic_file*)obj)->path, 
((entropy_generic_file*)obj)->filename);
+               }
+
+               
+
        
                //printf ("Hit action callback\n");
                //printf("Exe: %s\n", fullname);
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/proto/entropy/src/plugins/ewl_icon_local_viewer.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- ewl_icon_local_viewer.c     4 Dec 2005 16:56:48 -0000       1.34
+++ ewl_icon_local_viewer.c     6 Dec 2005 09:56:11 -0000       1.35
@@ -252,7 +252,7 @@
                        entropy_core_layout_notify_event(  local_file->instance 
, gui_event, ENTROPY_EVENT_GLOBAL); 
 
                } else if (ev->button == 2) {
-
+                       
                }
 
        }
@@ -348,7 +348,7 @@
        ewl_menu_item_text_set(EWL_MENU_ITEM(context), "New Directory");
        ewl_menu_item_image_set(EWL_MENU_ITEM(context), PACKAGE_DATA_DIR 
"/icons/e17_button_detail_new_dir.png");
        ewl_iconbox_context_menu_item_add(EWL_ICONBOX(viewer->iconbox), 
context);
-       ewl_callback_append(context, EWL_CALLBACK_MOUSE_DOWN, 
ewl_iconbox_file_copy_cb, instance);
+       ewl_callback_append(context, EWL_CALLBACK_CLICKED, 
ewl_iconbox_file_copy_cb, instance);
        ewl_widget_show(context);
        
 
@@ -357,7 +357,7 @@
        ewl_menu_item_text_set(EWL_MENU_ITEM(context), "Copy selection");
        ewl_menu_item_image_set(EWL_MENU_ITEM(context), PACKAGE_DATA_DIR 
"/icons/e17_button_detail_copy.png");
        ewl_iconbox_context_menu_item_add(EWL_ICONBOX(viewer->iconbox), 
context);
-       ewl_callback_append(context, EWL_CALLBACK_MOUSE_DOWN, 
ewl_iconbox_file_copy_cb, instance);
+       ewl_callback_append(context, EWL_CALLBACK_CLICKED, 
ewl_iconbox_file_copy_cb, instance);
        ewl_widget_show(context);
 
        /*Add some context menu items*/
@@ -365,7 +365,7 @@
        ewl_menu_item_text_set(EWL_MENU_ITEM(context), "Paste");
        ewl_menu_item_image_set(EWL_MENU_ITEM(context), PACKAGE_DATA_DIR 
"/icons/e17_button_detail_paste.png");
        ewl_iconbox_context_menu_item_add(EWL_ICONBOX(viewer->iconbox), 
context);
-       ewl_callback_append(context, EWL_CALLBACK_MOUSE_DOWN, 
ewl_iconbox_file_paste_cb, instance);
+       ewl_callback_append(context, EWL_CALLBACK_CLICKED, 
ewl_iconbox_file_paste_cb, instance);
        ewl_widget_show(context);
 
        /*Add some context menu items*/
@@ -377,14 +377,14 @@
        context = ewl_menu_item_new();
        ewl_menu_item_text_set(EWL_MENU_ITEM(context), "Set custom folder 
background...");
        ewl_iconbox_context_menu_item_add(EWL_ICONBOX(viewer->iconbox), 
context);
-       ewl_callback_append(context, EWL_CALLBACK_MOUSE_DOWN, 
ewl_iconbox_background_set_cb, instance);
+       ewl_callback_append(context, EWL_CALLBACK_CLICKED, 
ewl_iconbox_background_set_cb, instance);
        ewl_widget_show(context);
 
        /*Add some context menu items*/
        context = ewl_menu_item_new();
        ewl_menu_item_text_set(EWL_MENU_ITEM(context), "Remove current custom 
background");
        ewl_iconbox_context_menu_item_add(EWL_ICONBOX(viewer->iconbox), 
context);
-       ewl_callback_append(context, EWL_CALLBACK_MOUSE_DOWN, 
ewl_iconbox_background_remove_cb, instance);
+       ewl_callback_append(context, EWL_CALLBACK_CLICKED, 
ewl_iconbox_background_remove_cb, instance);
        ewl_widget_show(context);
 
 
@@ -397,7 +397,7 @@
        ewl_menu_item_image_set(EWL_MENU_ITEM(context), PACKAGE_DATA_DIR 
"/icons/e17_button_detail_copy.png");
        ewl_widget_show(context);
        ewl_iconbox_icon_menu_item_add(EWL_ICONBOX(viewer->iconbox), context);
-       ewl_callback_append(context, EWL_CALLBACK_MOUSE_DOWN, 
ewl_iconbox_file_copy_cb, instance);
+       ewl_callback_append(context, EWL_CALLBACK_CLICKED, 
ewl_iconbox_file_copy_cb, instance);
        //
 
        context = ewl_menu_item_new();
@@ -426,7 +426,7 @@
        ewl_menu_item_image_set(EWL_MENU_ITEM(context), PACKAGE_DATA_DIR 
"/icons/e17_button_detail_delete.png");
        ewl_widget_show(context);
        ewl_iconbox_icon_menu_item_add(EWL_ICONBOX(viewer->iconbox), context);
-       ewl_callback_append(context, EWL_CALLBACK_MOUSE_DOWN, 
icon_properties_cb, instance);
+       ewl_callback_append(context, EWL_CALLBACK_CLICKED, icon_properties_cb, 
instance);
        
 
 
@@ -555,7 +555,8 @@
                /*data = file list*/
                
        
-               while ( (file = ecore_list_remove_first(el)) && i < 
ICON_ADD_COUNT) {
+               while (i < ICON_ADD_COUNT && (file = 
ecore_list_remove_first(el))) {
+                       //printf("Adding '%s'\n", file->filename);
                        ewl_icon_local_viewer_add_icon(proc->requestor, file, 
DONT_DO_MIME);
                        ecore_list_append(added_list,file);
 
@@ -598,8 +599,9 @@
                } else { 
                        ewl_iconbox_scrollpane_recalculate(EWL_ICONBOX( 
((entropy_icon_viewer*)comp->data)->iconbox));  
                        view->last_processor = NULL;
-                       goto FREE_AND_LEAVE;
                        //printf("Terminated process thread..\n");
+                       goto FREE_AND_LEAVE;
+                       
                        return 0;
                }
 
@@ -664,6 +666,7 @@
 
                ecore_list_goto_first(ret);
                while ( (event_file = ecore_list_next(ret))) {
+                       //printf("Populating with '%s'\n", 
event_file->filename);
                        ecore_list_append(proc->user_data, event_file); 
                }
 
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/proto/entropy/src/plugins/ewl_mime_dialog.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_mime_dialog.c   26 Nov 2005 11:50:42 -0000      1.2
+++ ewl_mime_dialog.c   6 Dec 2005 09:56:11 -0000       1.3
@@ -8,6 +8,35 @@
 Ewl_Widget* mime_tree;
 Ewl_Widget* entry_type;
 Ewl_Widget* entry_action;
+Ewl_Widget* last_select_text;
+
+void mime_add_dialog_show(char* type, char* exe);
+void mime_row_click_cb(Ewl_Widget *item, void *ev_data, void *user_data);
+void window_dismiss_cb(Ewl_Widget *item, void *ev_data, void *user_data);
+void mime_add_cb(Ewl_Widget *item, void *ev_data, void *user_data);
+void entropy_ewl_mime_add_display_cb(Ewl_Widget *item, void *ev_data, void 
*user_data);
+void entropy_ewl_mime_dialog_display();
+
+
+
+void mime_row_click_cb(Ewl_Widget *item, void *ev_data, void *user_data) {
+       Ewl_Event_Mouse_Down *ev = ev_data;
+       
+       if (last_select_text) {
+               ewl_widget_color_set(last_select_text,0,0,0,255);
+       }
+
+       ewl_widget_color_set(item, 0,0,255,255);
+       last_select_text = item;
+
+       if (ev->clicks > 1&& ev->button == 1) {
+               entropy_core* core = entropy_core_get_core();
+               entropy_mime_action* action = 
ecore_hash_get(core->mime_action_hint, (char*)user_data);
+               mime_add_dialog_show((char*)user_data,action->executable);
+       }
+       
+}
+
 
 void window_dismiss_cb(Ewl_Widget *item, void *ev_data, void *user_data) {
        ewl_widget_destroy(EWL_WIDGET(user_data));
@@ -34,8 +63,7 @@
        
 }
 
-
-void entropy_ewl_mime_add_display_cb(Ewl_Widget *item, void *ev_data, void 
*user_data) {
+void mime_add_dialog_show(char* type, char* exe) {
        Ewl_Widget* layout_box = ewl_vbox_new();
        Ewl_Widget* window = ewl_window_new();
        Ewl_Widget* hbox;
@@ -59,6 +87,7 @@
        ewl_container_child_append(EWL_CONTAINER(hbox), label);
 
        entry_type = ewl_entry_new();
+       if (type) ewl_text_text_set(EWL_TEXT(entry_type), type);
        ewl_container_child_append(EWL_CONTAINER(hbox), entry_type);
        ewl_widget_show(entry_type);
        /*---*/
@@ -74,6 +103,7 @@
        ewl_container_child_append(EWL_CONTAINER(hbox), label);
 
        entry_action = ewl_entry_new();
+       if (exe) ewl_text_text_set(EWL_TEXT(entry_action), exe);        
        ewl_container_child_append(EWL_CONTAINER(hbox), entry_action);
        ewl_widget_show(entry_action);
        /*---*/
@@ -97,11 +127,12 @@
        ewl_container_child_append(EWL_CONTAINER(hbox), button);
        ewl_widget_show(button);
 
-
-       
-       
        ewl_widget_show(window);
-       
+}
+
+
+void entropy_ewl_mime_add_display_cb(Ewl_Widget *item, void *ev_data, void 
*user_data) {
+       mime_add_dialog_show(NULL,NULL);        
 }
 
 
@@ -118,6 +149,8 @@
        entropy_mime_action* action;
        Ecore_List* keys;
 
+       last_select_text = NULL;
+
 
        /*Init the mime tree*/
        mime_tree = ewl_tree_new(2);
@@ -132,12 +165,18 @@
 
        keys = ecore_hash_keys(core->mime_action_hint);
        while ((key = ecore_list_remove_first(keys))) {
+               Ewl_Widget* row;
+               
                entries[0] = key;
                entries[1] = 
((entropy_mime_action*)ecore_hash_get(core->mime_action_hint, key))->executable;
                entries[2] = NULL;
 
-               ewl_tree_text_row_add(EWL_TREE(mime_tree), NULL,entries);
+               row = ewl_tree_text_row_add(EWL_TREE(mime_tree), NULL,entries);
+               ewl_widget_color_set(row,0,0,0,255);
+               ewl_callback_append(row, EWL_CALLBACK_MOUSE_DOWN, 
+                       mime_row_click_cb, key);
        }
+       ecore_list_destroy(keys);
 
 
        hbox = ewl_hbox_new();
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/proto/entropy/src/plugins/layout_ewl_simple.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- layout_ewl_simple.c 26 Nov 2005 11:50:42 -0000      1.17
+++ layout_ewl_simple.c 6 Dec 2005 09:56:11 -0000       1.18
@@ -21,7 +21,6 @@
        Ewl_Widget* tree;
        Ecore_List* current_folder;
 
-       /*Random things*/
 
        /*Tmp*/
        Ewl_Widget* samba_radio;
@@ -36,13 +35,6 @@
 };
 
 
-void filesystem_combo_cb(Ewl_Widget *item, void *ev_data, void *combo) {
-       //printf("Value changed callback\n");
-       //ewl_combo_selected_set(EWL_COMBO(combo), EWL_WIDGET(item));
-       //ewl_menu_item_text_set(EWL_MENU_ITEM(combo), 
ewl_text_text_get(EWL_TEXT(item)));
-}
-
-
 /*TODO/FIXME - This needs a rewrite, to be dynamic, and wizard-based*/
 void location_add_execute_cb(Ewl_Widget *item, void *ev_data, void *user_data) 
{
        entropy_gui_component_instance* instance = user_data;
@@ -105,6 +97,12 @@
 }
 
 
+void entropy_ewl_layout_simple_tooltip_window() {
+       int status = entropy_core_tooltip_status_get();
+
+}
+
+
 void location_add_cb(Ewl_Widget *main_win, void *ev_data, void *user_data) {
        entropy_gui_component_instance* instance = 
(entropy_gui_component_instance*)user_data;
 
@@ -146,7 +144,8 @@
 
        ((entropy_layout_gui*)instance->data)->samba_radio = 
ewl_radiobutton_new();
        
ewl_button_label_set(EWL_BUTTON(((entropy_layout_gui*)instance->data)->samba_radio),
 "Samba");
-       
ewl_radiobutton_chain_set(EWL_RADIOBUTTON(((entropy_layout_gui*)instance->data)->samba_radio),
 EWL_RADIOBUTTON(((entropy_layout_gui*)instance->data)->posix_radio));
+       
ewl_radiobutton_chain_set(EWL_RADIOBUTTON(((entropy_layout_gui*)instance->data)->samba_radio),
 
+               
EWL_RADIOBUTTON(((entropy_layout_gui*)instance->data)->posix_radio));
        ewl_container_child_append(EWL_CONTAINER(vbox2), 
((entropy_layout_gui*)instance->data)->samba_radio);
        ewl_widget_show(((entropy_layout_gui*)instance->data)->samba_radio);
 
@@ -275,7 +274,8 @@
 
        //printf("Setting config..\n");
 
-       sprintf(eg, "Computer;posix:///|Home;posix://%s|Samba Example (Don't 
use!);smb://username:password@/test/machine/folder", 
entropy_core_home_dir_get(core));
+       sprintf(eg, "Computer;posix:///|Home;posix://%s|Samba Example (Don't 
use!);smb://username:password@/test/machine/folder", 
+               entropy_core_home_dir_get(core));
 
        //printf("Setting default config string..\n");
        entropy_config_str_set("layout_ewl_simple", "structure_bar", eg);
@@ -317,7 +317,8 @@
 
 
        /*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(instance->core->plugin_list, 
+               ENTROPY_PLUGIN_GUI_COMPONENT, 
ENTROPY_PLUGIN_GUI_COMPONENT_STRUCTURE_VIEW);
 
        if (structure) {
                Ewl_Widget* children[2];
@@ -404,20 +405,6 @@
 
 
 void
-__resize_homedir(Ewl_Widget *obj, void *ev_data, void *user_data) {
-       int h;
-
-       //ewl_callback_del_type(EWL_WIDGET(obj), EWL_CALLBACK_CONFIGURE);
-
-       h = ewl_object_current_h_get(EWL_OBJECT(obj));
-       //ewl_object_custom_h_set(EWL_WIDGET(user_data), h);
-
-       //ewl_callback_append(EWL_WIDGET(obj), EWL_CALLBACK_CONFIGURE, 
__resize_homedir, EWL_WIDGET(user_data));
-       //printf("\n\n\n\n\nResize called, set to %d\n\n\n\n\n", h);
-}
-
-
-void
 __destroy_main_window(Ewl_Widget *main_win, void *ev_data, void *user_data) {
        entropy_core* core = (entropy_core*)user_data;
        ewl_widget_destroy(main_win);
@@ -596,7 +583,13 @@
        ewl_widget_show(menu);
 
        item = ewl_menu_item_new();
-       ewl_menu_item_text_set(EWL_MENU_ITEM(item), "About...");
+       ewl_menu_item_text_set(EWL_MENU_ITEM(item), "Tip Of The Day..");
+       ewl_container_child_append(EWL_CONTAINER(menu), item);
+       ewl_callback_append(EWL_WIDGET(item), EWL_CALLBACK_CLICKED, 
location_add_cb, layout);
+       ewl_widget_show(item);
+
+       item = ewl_menu_item_new();
+       ewl_menu_item_text_set(EWL_MENU_ITEM(item), "About..");
        ewl_container_child_append(EWL_CONTAINER(menu), item);
        ewl_callback_append(EWL_WIDGET(item), EWL_CALLBACK_CLICKED, 
location_add_cb, layout);
        ewl_widget_show(item);
@@ -624,12 +617,10 @@
 
 
        ewl_callback_append(EWL_WIDGET(add_button), EWL_CALLBACK_CLICKED, 
location_add_cb, layout);
-       /*ewl_widget_show(add_button);*/
        /*--------------------------*/
 
        ewl_container_child_append(EWL_CONTAINER(box), menubar);
        ewl_container_child_append(EWL_CONTAINER(box),paned);
-       //ewl_container_child_append(EWL_CONTAINER(scrollpane), tree);
        ewl_container_child_append(EWL_CONTAINER(paned), tree);
        ewl_paned_active_area_set(EWL_PANED(paned), EWL_POSITION_RIGHT);
        ewl_container_child_append(EWL_CONTAINER(paned), iconbox);
@@ -638,10 +629,7 @@
        /*This is cheating - break OO convention by accessing the internals of 
the struct.. but it doesn't work without this*/
        ewl_object_fill_policy_set(EWL_OBJECT(EWL_PANED(paned)->second), 
EWL_FLAG_FILL_NORMAL);
        ewl_object_fill_policy_set(EWL_OBJECT(EWL_PANED(paned)->first), 
EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_VFILL );
-       //ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_HSHRINK | 
EWL_FLAG_FILL_VFILL);
        ewl_object_fill_policy_set(EWL_OBJECT(paned), EWL_FLAG_FILL_NORMAL);
-       //ewl_object_fill_policy_set(EWL_OBJECT(tree), EWL_FLAG_FILL_FILL | 
EWL_FLAG_FILL_HSHRINK);
-       //ewl_object_fill_policy_set(EWL_OBJECT(scrollpane), 
EWL_FLAG_FILL_NORMAL);
 
 
        if (!(tmp = entropy_config_str_get("layout_ewl_simple", 
"structure_bar"))) {
@@ -655,10 +643,6 @@
        layout_ewl_simple_parse_config(layout, tmp);
        entropy_free(tmp);
 
-
-       /*ewl_tree_node_expand(row);*/
-
-       //printf("Showing widgets..\n");
        ewl_widget_show(box);
        ewl_widget_show(vbox);
        ewl_widget_show(hbox);
@@ -676,6 +660,11 @@
 
        ewl_container_child_resize(EWL_WIDGET(EWL_PANED(paned)->first), 80, 
EWL_ORIENTATION_HORIZONTAL);
 
+
+       /*Tooltip display function*/
+       entropy_ewl_layout_simple_tooltip_window();
+       
+
        layout->gui_object = win;
        return layout;
 }




-------------------------------------------------------
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