mirror of https://github.com/MidnightCommander/mc
move do_cd from src/main.c to src/filemanager/panel.c
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
ede5d55197
commit
d6478b8b41
|
@ -53,7 +53,6 @@
|
|||
#include "src/setup.h" /* use_file_to_check_type */
|
||||
#include "src/execute.h"
|
||||
#include "src/history.h"
|
||||
#include "src/main.h" /* do_cd */
|
||||
|
||||
#include "src/consaver/cons.saver.h"
|
||||
#include "src/viewer/mcviewer.h"
|
||||
|
@ -62,6 +61,7 @@
|
|||
#include "src/selcodepage.h" /* do_set_codepage */
|
||||
#endif
|
||||
|
||||
#include "panel.h" /* do_cd */
|
||||
#include "usermenu.h"
|
||||
|
||||
#include "ext.h"
|
||||
|
|
|
@ -4788,3 +4788,38 @@ panel_deinit (void)
|
|||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
do_cd (const vfs_path_t * new_dir_vpath, enum cd_enum exact)
|
||||
{
|
||||
gboolean res;
|
||||
const vfs_path_t *_new_dir_vpath = new_dir_vpath;
|
||||
|
||||
if (current_panel->is_panelized)
|
||||
{
|
||||
size_t new_vpath_len;
|
||||
|
||||
new_vpath_len = vfs_path_len (new_dir_vpath);
|
||||
if (vfs_path_ncmp (new_dir_vpath, panelized_panel.root_vpath, new_vpath_len) == 0)
|
||||
_new_dir_vpath = panelized_panel.root_vpath;
|
||||
}
|
||||
|
||||
res = do_panel_cd (current_panel, _new_dir_vpath, exact);
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
if (res)
|
||||
{
|
||||
const vfs_path_element_t *path_element;
|
||||
|
||||
path_element = vfs_path_get_by_index (current_panel->cwd_vpath, -1);
|
||||
if (path_element->encoding != NULL)
|
||||
current_panel->codepage = get_codepage_index (path_element->encoding);
|
||||
else
|
||||
current_panel->codepage = SELECT_CHARSET_NO_TRANSLATE;
|
||||
}
|
||||
#endif /* HAVE_CHARSET */
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
|
|
@ -182,6 +182,7 @@ void panel_set_lwd (WPanel * panel, const char *path_str);
|
|||
|
||||
void panel_init (void);
|
||||
void panel_deinit (void);
|
||||
gboolean do_cd (const vfs_path_t * new_dir_vpath, enum cd_enum cd_type);
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
#endif /* MC__PANEL_H */
|
||||
|
|
35
src/main.c
35
src/main.c
|
@ -274,41 +274,6 @@ init_sigchld (void)
|
|||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
do_cd (const vfs_path_t * new_dir_vpath, enum cd_enum exact)
|
||||
{
|
||||
gboolean res;
|
||||
const vfs_path_t *_new_dir_vpath = new_dir_vpath;
|
||||
|
||||
if (current_panel->is_panelized)
|
||||
{
|
||||
size_t new_vpath_len;
|
||||
|
||||
new_vpath_len = vfs_path_len (new_dir_vpath);
|
||||
if (vfs_path_ncmp (new_dir_vpath, panelized_panel.root_vpath, new_vpath_len) == 0)
|
||||
_new_dir_vpath = panelized_panel.root_vpath;
|
||||
}
|
||||
|
||||
res = do_panel_cd (current_panel, _new_dir_vpath, exact);
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
if (res)
|
||||
{
|
||||
const vfs_path_element_t *path_element;
|
||||
|
||||
path_element = vfs_path_get_by_index (current_panel->cwd_vpath, -1);
|
||||
if (path_element->encoding != NULL)
|
||||
current_panel->codepage = get_codepage_index (path_element->encoding);
|
||||
else
|
||||
current_panel->codepage = SELECT_CHARSET_NO_TRANSLATE;
|
||||
}
|
||||
#endif /* HAVE_CHARSET */
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
gboolean
|
||||
do_load_prompt (void)
|
||||
|
|
|
@ -90,7 +90,6 @@ gboolean do_load_prompt (void);
|
|||
int load_prompt (int fd, void *unused);
|
||||
#endif
|
||||
|
||||
gboolean do_cd (const vfs_path_t * new_dir_vpath, enum cd_enum cd_type);
|
||||
void update_xterm_title_path (void);
|
||||
|
||||
void title_path_prepare (char **path, char **login);
|
||||
|
|
|
@ -47,15 +47,6 @@ command_new (int y, int x, int cols)
|
|||
return cmd;
|
||||
}
|
||||
|
||||
int
|
||||
do_cd (const vfs_path_t *new_dir, enum cd_enum exact)
|
||||
{
|
||||
(void) new_dir;
|
||||
(void) exact;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
do_subshell_chdir (const vfs_path_t * vpath, gboolean update_prompt, gboolean reset_prompt)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue