mirror of https://github.com/MidnightCommander/mc
changed interface of function mc_setctl() for handle vfs_path_t object as parameter
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
9177b954df
commit
031e994cba
|
@ -376,14 +376,12 @@ mc_ctl (int handle, int ctlop, void *arg)
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
mc_setctl (const char *path, int ctlop, void *arg)
|
mc_setctl (const vfs_path_t * vpath, int ctlop, void *arg)
|
||||||
{
|
{
|
||||||
int result = -1;
|
int result = -1;
|
||||||
|
|
||||||
vfs_path_t *vpath;
|
|
||||||
vfs_path_element_t *path_element;
|
vfs_path_element_t *path_element;
|
||||||
|
|
||||||
vpath = vfs_path_from_str (path);
|
|
||||||
if (vpath == NULL)
|
if (vpath == NULL)
|
||||||
vfs_die ("You don't want to pass NULL to mc_setctl.");
|
vfs_die ("You don't want to pass NULL to mc_setctl.");
|
||||||
|
|
||||||
|
@ -393,7 +391,6 @@ mc_setctl (const char *path, int ctlop, void *arg)
|
||||||
path_element->class->setctl != NULL ? path_element->class->setctl (vpath,
|
path_element->class->setctl != NULL ? path_element->class->setctl (vpath,
|
||||||
ctlop, arg) : 0;
|
ctlop, arg) : 0;
|
||||||
|
|
||||||
vfs_path_free (vpath);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,7 @@ int mc_chown (const char *path, uid_t owner, gid_t group);
|
||||||
int mc_chdir (const vfs_path_t * vpath);
|
int mc_chdir (const vfs_path_t * vpath);
|
||||||
int mc_unlink (const char *path);
|
int mc_unlink (const char *path);
|
||||||
int mc_ctl (int fd, int ctlop, void *arg);
|
int mc_ctl (int fd, int ctlop, void *arg);
|
||||||
int mc_setctl (const char *path, int ctlop, void *arg);
|
int mc_setctl (const vfs_path_t * vpath, int ctlop, void *arg);
|
||||||
int mc_open (const char *filename, int flags, ...);
|
int mc_open (const char *filename, int flags, ...);
|
||||||
char *mc_get_current_wd (char *buffer, size_t bufsize);
|
char *mc_get_current_wd (char *buffer, size_t bufsize);
|
||||||
char *mc_getlocalcopy (const char *pathname);
|
char *mc_getlocalcopy (const char *pathname);
|
||||||
|
|
|
@ -429,11 +429,16 @@ mc_setup_by_args (int argc, char *argv[])
|
||||||
|
|
||||||
if (mc_args__netfs_logfile != NULL)
|
if (mc_args__netfs_logfile != NULL)
|
||||||
{
|
{
|
||||||
|
vfs_path_t *vpath;
|
||||||
#ifdef ENABLE_VFS_FTP
|
#ifdef ENABLE_VFS_FTP
|
||||||
mc_setctl ("ftp://", VFS_SETCTL_LOGFILE, (void *) mc_args__netfs_logfile);
|
vpath = vfs_path_from_str ("ftp://");
|
||||||
|
mc_setctl (vpath, VFS_SETCTL_LOGFILE, (void *) mc_args__netfs_logfile);
|
||||||
|
vfs_path_free (vpath);
|
||||||
#endif /* ENABLE_VFS_FTP */
|
#endif /* ENABLE_VFS_FTP */
|
||||||
#ifdef ENABLE_VFS_SMB
|
#ifdef ENABLE_VFS_SMB
|
||||||
mc_setctl ("smb://", VFS_SETCTL_LOGFILE, (void *) mc_args__netfs_logfile);
|
vpath = vfs_path_from_str ("smb://");
|
||||||
|
mc_setctl (vpath, VFS_SETCTL_LOGFILE, (void *) mc_args__netfs_logfile);
|
||||||
|
vfs_path_free (vpath);
|
||||||
#endif /* ENABLE_VFS_SMB */
|
#endif /* ENABLE_VFS_SMB */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2576,6 +2576,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||||
#define source_with_path source
|
#define source_with_path source
|
||||||
#endif /* !WITH_FULL_PATHS */
|
#endif /* !WITH_FULL_PATHS */
|
||||||
char *dest = NULL;
|
char *dest = NULL;
|
||||||
|
vfs_path_t *dest_vpath = NULL;
|
||||||
char *temp = NULL;
|
char *temp = NULL;
|
||||||
char *save_cwd = NULL, *save_dest = NULL;
|
char *save_cwd = NULL, *save_dest = NULL;
|
||||||
struct stat src_stat;
|
struct stat src_stat;
|
||||||
|
@ -2584,6 +2585,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||||
FileProgressStatus value;
|
FileProgressStatus value;
|
||||||
FileOpContext *ctx;
|
FileOpContext *ctx;
|
||||||
FileOpTotalContext *tctx;
|
FileOpTotalContext *tctx;
|
||||||
|
vfs_path_t *tmp_vpath;
|
||||||
|
|
||||||
gboolean do_bg = FALSE; /* do background operation? */
|
gboolean do_bg = FALSE; /* do background operation? */
|
||||||
|
|
||||||
|
@ -2691,6 +2693,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||||
ret_val = FALSE;
|
ret_val = FALSE;
|
||||||
goto ret_fast;
|
goto ret_fast;
|
||||||
}
|
}
|
||||||
|
dest_vpath = vfs_path_from_str (dest);
|
||||||
}
|
}
|
||||||
else if (confirm_delete)
|
else if (confirm_delete)
|
||||||
{
|
{
|
||||||
|
@ -2760,8 +2763,13 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||||
/* If we are the parent */
|
/* If we are the parent */
|
||||||
if (v == 1)
|
if (v == 1)
|
||||||
{
|
{
|
||||||
mc_setctl (panel->cwd, VFS_SETCTL_FORGET, NULL);
|
tmp_vpath = vfs_path_from_str (panel->cwd);
|
||||||
mc_setctl (dest, VFS_SETCTL_FORGET, NULL);
|
mc_setctl (tmp_vpath, VFS_SETCTL_FORGET, NULL);
|
||||||
|
vfs_path_free (tmp_vpath);
|
||||||
|
|
||||||
|
mc_setctl (dest_vpath, VFS_SETCTL_FORGET, NULL);
|
||||||
|
vfs_path_free (dest_vpath);
|
||||||
|
g_free (dest);
|
||||||
/* file_op_context_destroy (ctx); */
|
/* file_op_context_destroy (ctx); */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2772,11 +2780,13 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||||
/* We do not want to trash cache every time file is
|
/* We do not want to trash cache every time file is
|
||||||
created/touched. However, this will make our cache contain
|
created/touched. However, this will make our cache contain
|
||||||
invalid data. */
|
invalid data. */
|
||||||
if ((dest != NULL) && (mc_setctl (dest, VFS_SETCTL_STALE_DATA, (void *) 1)))
|
if ((dest != NULL) && (mc_setctl (dest_vpath, VFS_SETCTL_STALE_DATA, (void *) 1)))
|
||||||
save_dest = g_strdup (dest);
|
save_dest = g_strdup (dest);
|
||||||
|
|
||||||
if ((panel->cwd[0] != '\0') && (mc_setctl (panel->cwd, VFS_SETCTL_STALE_DATA, (void *) 1)))
|
tmp_vpath = vfs_path_from_str (panel->cwd);
|
||||||
|
if ((panel->cwd[0] != '\0') && (mc_setctl (tmp_vpath, VFS_SETCTL_STALE_DATA, (void *) 1)))
|
||||||
save_cwd = g_strdup (panel->cwd);
|
save_cwd = g_strdup (panel->cwd);
|
||||||
|
vfs_path_free (tmp_vpath);
|
||||||
|
|
||||||
/* Now, let's do the job */
|
/* Now, let's do the job */
|
||||||
|
|
||||||
|
@ -2832,7 +2842,9 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||||
g_free (temp);
|
g_free (temp);
|
||||||
g_free (repl_dest);
|
g_free (repl_dest);
|
||||||
g_free (dest);
|
g_free (dest);
|
||||||
|
vfs_path_free (dest_vpath);
|
||||||
dest = temp2;
|
dest = temp2;
|
||||||
|
dest_vpath = vfs_path_from_str (dest);
|
||||||
|
|
||||||
switch (operation)
|
switch (operation)
|
||||||
{
|
{
|
||||||
|
@ -2878,10 +2890,8 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||||
{
|
{
|
||||||
int dst_result;
|
int dst_result;
|
||||||
struct stat dst_stat;
|
struct stat dst_stat;
|
||||||
vfs_path_t *vpath = vfs_path_from_str (dest);
|
|
||||||
|
|
||||||
dst_result = mc_stat (vpath, &dst_stat);
|
dst_result = mc_stat (dest_vpath, &dst_stat);
|
||||||
vfs_path_free (vpath);
|
|
||||||
|
|
||||||
if ((dst_result != 0) || S_ISDIR (dst_stat.st_mode))
|
if ((dst_result != 0) || S_ISDIR (dst_stat.st_mode))
|
||||||
break;
|
break;
|
||||||
|
@ -3000,13 +3010,17 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||||
/* Clean up */
|
/* Clean up */
|
||||||
if (save_cwd != NULL)
|
if (save_cwd != NULL)
|
||||||
{
|
{
|
||||||
mc_setctl (save_cwd, VFS_SETCTL_STALE_DATA, NULL);
|
tmp_vpath = vfs_path_from_str (save_cwd);
|
||||||
|
mc_setctl (tmp_vpath, VFS_SETCTL_STALE_DATA, NULL);
|
||||||
|
vfs_path_free (tmp_vpath);
|
||||||
g_free (save_cwd);
|
g_free (save_cwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (save_dest != NULL)
|
if (save_dest != NULL)
|
||||||
{
|
{
|
||||||
mc_setctl (save_dest, VFS_SETCTL_STALE_DATA, NULL);
|
tmp_vpath = vfs_path_from_str (save_dest);
|
||||||
|
mc_setctl (tmp_vpath, VFS_SETCTL_STALE_DATA, NULL);
|
||||||
|
vfs_path_free (tmp_vpath);
|
||||||
g_free (save_dest);
|
g_free (save_dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3016,6 +3030,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||||
g_free (source_with_path);
|
g_free (source_with_path);
|
||||||
#endif /* WITH_FULL_PATHS */
|
#endif /* WITH_FULL_PATHS */
|
||||||
g_free (dest);
|
g_free (dest);
|
||||||
|
vfs_path_free (dest_vpath);
|
||||||
g_free (ctx->dest_mask);
|
g_free (ctx->dest_mask);
|
||||||
ctx->dest_mask = NULL;
|
ctx->dest_mask = NULL;
|
||||||
|
|
||||||
|
|
|
@ -2432,14 +2432,12 @@ do_enter_on_file_entry (file_entry * fe)
|
||||||
|
|
||||||
if (!vfs_current_is_local ())
|
if (!vfs_current_is_local ())
|
||||||
{
|
{
|
||||||
char *tmp, *tmp_curr_dir;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
vfs_path_t *tmp_vpath;
|
||||||
|
|
||||||
tmp_curr_dir = vfs_get_current_dir ();
|
tmp_vpath = vfs_path_append_new (vfs_get_raw_current_dir (), fe->fname, NULL);
|
||||||
tmp = concat_dir_and_file (tmp_curr_dir, fe->fname);
|
ret = mc_setctl (tmp_vpath, VFS_SETCTL_RUN, NULL);
|
||||||
g_free (tmp_curr_dir);
|
vfs_path_free (tmp_vpath);
|
||||||
ret = mc_setctl (tmp, VFS_SETCTL_RUN, NULL);
|
|
||||||
g_free (tmp);
|
|
||||||
/* We took action only if the dialog was shown or the execution
|
/* We took action only if the dialog was shown or the execution
|
||||||
* was successful */
|
* was successful */
|
||||||
return confirm_execute || (ret == 0);
|
return confirm_execute || (ret == 0);
|
||||||
|
@ -3576,8 +3574,12 @@ update_one_panel_widget (WPanel * panel, panel_update_flags_t flags, const char
|
||||||
|
|
||||||
if ((flags & UP_RELOAD) != 0)
|
if ((flags & UP_RELOAD) != 0)
|
||||||
{
|
{
|
||||||
|
vfs_path_t *tmp_vpath;
|
||||||
|
|
||||||
|
tmp_vpath = vfs_path_from_str (panel->cwd);
|
||||||
panel->is_panelized = FALSE;
|
panel->is_panelized = FALSE;
|
||||||
mc_setctl (panel->cwd, VFS_SETCTL_FLUSH, 0);
|
mc_setctl (tmp_vpath, VFS_SETCTL_FLUSH, 0);
|
||||||
|
vfs_path_free (tmp_vpath);
|
||||||
memset (&(panel->dir_stat), 0, sizeof (panel->dir_stat));
|
memset (&(panel->dir_stat), 0, sizeof (panel->dir_stat));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue