Enlightenment CVS committal Author : chaos Project : e17 Module : proto
Dir : e17/proto/entropy/src/plugins Modified Files: action_simple.c etk_list_viewer.c Log Message: * Add 'Open in new window' to 'Open With..' menu - finally, people other than me with realise you *can* have more than one entropy window at once, from the same process. =================================================================== RCS file: /cvs/e/e17/proto/entropy/src/plugins/action_simple.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- action_simple.c 2 Apr 2006 05:47:38 -0000 1.13 +++ action_simple.c 15 Apr 2006 10:07:05 -0000 1.14 @@ -98,30 +98,34 @@ entropy_core *core = ((entropy_gui_component_instance *) requestor)->core; Entropy_Config_Mime_Binding_Action *app; char *uri; - char *pos; entropy_generic_file *file = (entropy_generic_file *) obj; 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 = request; - entropy_core_layout_notify_event ((entropy_gui_component_instance *) + + if (!(eevent->hints & ENTROPY_GUI_EVENT_HINT_WINDOW_NEW)) { + entropy_file_request *request = + entropy_malloc (sizeof (entropy_file_request)); + request->file = file; + + /*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; - } - else if ((uri = entropy_core_descent_for_mime_get (core, file->mime_type)) + return; + } else { + Ecore_Ipc_Server* server = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, IPC_TITLE,0 ,NULL); + if (server) { + printf("Sending message to server!\n"); + ecore_ipc_server_send(server, ENTROPY_IPC_EVENT_LAYOUT_NEW, 0, 0, 0, 0, + file->uri, strlen(file->uri)+1); + } + } + } 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 = @@ -185,7 +189,7 @@ plugin = entropy_malloc(sizeof(Entropy_Plugin_Gui)); - return plugin; + return ENTROPY_PLUGIN(plugin); } =================================================================== RCS file: /cvs/e/e17/proto/entropy/src/plugins/etk_list_viewer.c,v retrieving revision 1.61 retrieving revision 1.62 diff -u -3 -r1.61 -r1.62 --- etk_list_viewer.c 12 Apr 2006 11:47:04 -0000 1.61 +++ etk_list_viewer.c 15 Apr 2006 10:07:05 -0000 1.62 @@ -137,6 +137,36 @@ return menu_item; } +static void +_open_folder_window_cb(Etk_Object* obj, void* data) +{ + entropy_gui_event* gui_event; + entropy_gui_component_instance* instance; + entropy_etk_file_list_viewer* viewer; + Etk_Tree_Row* row; + gui_file* file; + + instance = data; + if (instance) viewer = instance->data; + + if (instance && viewer) { + row = etk_tree_selected_row_get(ETK_TREE(viewer->tree)); + file = ecore_hash_get(etk_list_viewer_row_hash, row); + + if (file) { + printf("New folder handler...\n"); + + gui_event = entropy_malloc (sizeof (entropy_gui_event)); + gui_event->event_type = + entropy_core_gui_event_get (ENTROPY_GUI_EVENT_ACTION_FILE); + gui_event->data = file->file; + gui_event->hints |= ENTROPY_GUI_EVENT_HINT_WINDOW_NEW; + entropy_core_layout_notify_event (instance, gui_event, ENTROPY_EVENT_GLOBAL); + } + } + +} + static void _open_with_item_cb(Etk_Object *obj, void *data) { @@ -196,13 +226,27 @@ viewer->open_with_menu = NULL; } + /*If it's a folder, add an 'Open in new layout..' entry*/ + if (!strcmp(file->file->mime_type, "file/folder")) { + Etk_Widget* w; + + viewer->open_with_menu = etk_menu_new(); + etk_menu_item_submenu_set(ETK_MENU_ITEM(viewer->open_with_menuitem), ETK_MENU(viewer->open_with_menu)); + + w = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, "Open in new window", + ETK_STOCK_EDIT_COPY, ETK_MENU_SHELL(viewer->open_with_menu),NULL); + etk_signal_connect("activated", ETK_OBJECT(w), ETK_CALLBACK(_open_folder_window_cb), instance); + } + if (binding) { Etk_Widget* w; int i=0; - viewer->open_with_menu = etk_menu_new(); - etk_menu_item_submenu_set(ETK_MENU_ITEM(viewer->open_with_menuitem), ETK_MENU(viewer->open_with_menu)); + if (!viewer->open_with_menu) { + viewer->open_with_menu = etk_menu_new(); + etk_menu_item_submenu_set(ETK_MENU_ITEM(viewer->open_with_menuitem), ETK_MENU(viewer->open_with_menu)); + } for (l = binding->actions; l; ) { action = l->data; ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs