diff --git a/src/modules/fileman/e_fwin.c b/src/modules/fileman/e_fwin.c index 21e5629a7..908a7a1ff 100644 --- a/src/modules/fileman/e_fwin.c +++ b/src/modules/fileman/e_fwin.c @@ -647,6 +647,26 @@ e_fwin_zone_find(E_Zone *zone) return NULL; } +Eina_Bool +e_fwin_show(const char *dev, const char *path) +{ + Eina_List *f; + E_Fwin *fwin; + + EINA_LIST_FOREACH(fwins, f, fwin) + { + char *d, *p; + + e_fm2_path_get(fwin->cur_page->fm_obj, &d, &p); + if ((d) && (!strcmp(dev, d)) && (p) && (!strcmp(path, p))) + { + elm_win_activate(fwin->win); + return EINA_TRUE; + } + } + return EINA_FALSE; +} + /* local subsystem functions */ static void _e_fwin_bg_mouse_down(E_Fwin *fwin, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) diff --git a/src/modules/fileman/e_mod_main.c b/src/modules/fileman/e_mod_main.c index 1e94f79fd..14bf339b3 100644 --- a/src/modules/fileman/e_mod_main.c +++ b/src/modules/fileman/e_mod_main.c @@ -3,6 +3,8 @@ /* actual module specifics */ static void _e_mod_action_fileman_cb(E_Object *obj, const char *params); +static void _e_mod_action_fileman_show_cb(E_Object *obj, + const char *params); static void _e_mod_action_fileman_reset_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED); static void _e_mod_menu_add(void *data, E_Menu *m); static void _e_mod_fileman_config_load(void); @@ -14,6 +16,7 @@ static Eina_Bool _e_mod_zone_add(void *data, static E_Module *conf_module = NULL; static E_Action *act = NULL; static E_Action *act2 = NULL; +static E_Action *act3 = NULL; static E_Int_Menu_Augmentation *maug = NULL; static Ecore_Event_Handler *zone_add_handler = NULL; @@ -58,6 +61,13 @@ e_modapi_init(E_Module *m) act2 = e_action_add("fileman_reset"); if (act2) act2->func.go = _e_mod_action_fileman_reset_cb; + act3 = e_action_add("fileman_show"); + if (act3) + { + act3->func.go = _e_mod_action_fileman_show_cb; + e_action_predef_name_set(N_("Show Dir"), N_("File Manager"), + "fileman_show", NULL, "syntax: /path/to/dir or ~/path/to/dir or favorites or desktop, examples: /boot/grub, ~/downloads", 1); + } maug = e_int_menus_menu_augmentation_add_sorted("main/1", _("Navigate"), _e_mod_menu_add, NULL, NULL, NULL); e_fwin_init(); @@ -118,6 +128,11 @@ e_modapi_shutdown(E_Module *m EINA_UNUSED) e_action_del("fileman_reset"); act2 = NULL; } + if (act3) + { + e_action_del("fileman_show"); + act3 = NULL; + } while ((cfd = e_config_dialog_get("E", "fileman/mime_edit_dialog"))) e_object_del(E_OBJECT(cfd)); while ((cfd = e_config_dialog_get("E", "fileman/file_icons"))) @@ -155,6 +170,12 @@ _e_mod_action_fileman_reset_cb(E_Object *obj EINA_UNUSED, const char *params EIN e_fwin_reload_all(); } +static void +fwin(const char *dev, const char *path) +{ + if (!e_fwin_show(dev, path)) e_fwin_new(dev, path); +} + static void _e_mod_action_fileman_cb(E_Object *obj EINA_UNUSED, const char *params) @@ -183,6 +204,46 @@ _e_mod_action_fileman_cb(E_Object *obj EINA_UNUSED, } } +static void +_e_mod_action_fileman_show_cb(E_Object *obj EINA_UNUSED, + const char *params) +{ + const char *dev = NULL, *path = NULL; + char *p = NULL; + E_Zone *zone = NULL; + + zone = e_zone_current_get(); + if (zone) + { + if (params && params[0] == '/') + { + dev = "/"; + path = params; + } + else if (params && params[0] == '~') + { + dev = "~/"; + path = params + 1; + } + else if (params && strcmp(params, "(none)")) /* avoid matching paths that no longer exist */ + { + p = e_util_shell_env_path_eval(params); + if (p) + { + dev = p; + path = "/"; + } + } + else + { + dev = "favorites"; + path = "/"; + } + } + fwin(dev, path); + free(p); +} + void _e_mod_menu_add(void *data EINA_UNUSED, E_Menu *m) { diff --git a/src/modules/fileman/e_mod_main.h b/src/modules/fileman/e_mod_main.h index 937f48a68..7b01e2f42 100644 --- a/src/modules/fileman/e_mod_main.h +++ b/src/modules/fileman/e_mod_main.h @@ -125,7 +125,8 @@ void e_fwin_zone_new (E_Zone *zone, void *path); void e_fwin_zone_shutdown (E_Zone *zone); void e_fwin_all_unsel (void *data); void e_fwin_reload_all (void); -void *e_fwin_zone_find (E_Zone *zone); +void *e_fwin_zone_find (E_Zone *zone); +Eina_Bool e_fwin_show (const char *dev, const char *path); Eina_Bool e_fwin_nav_init(void); Eina_Bool e_fwin_nav_shutdown(void); diff --git a/src/modules/shot/e_mod_save.c b/src/modules/shot/e_mod_save.c index 68eb12310..daff9dcd9 100644 --- a/src/modules/shot/e_mod_save.c +++ b/src/modules/shot/e_mod_save.c @@ -193,7 +193,7 @@ save_show(void) snprintf(path2, sizeof(path2), "%s/fileman/favorites/shots.desktop", e_user_dir_get()); if (!ecore_file_exists(path2)) ecore_file_cp(path, path2); - a = e_action_find("fileman"); + a = e_action_find("fileman_show"); if (a) { a->func.go(NULL, "$E_HOME_DIR/shots");