mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
Added recognizing of filesystem type and automatically toggle 'on' or 'off' checkbox 'Preserve attributes' in file copy/move dialog
This commit is contained in:
parent
f856eeb0ea
commit
ce129506f6
@ -138,7 +138,7 @@ fi
|
|||||||
|
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_CHECK_HEADERS([unistd.h string.h memory.h grp.h limits.h malloc.h \
|
AC_CHECK_HEADERS([unistd.h string.h memory.h grp.h limits.h malloc.h \
|
||||||
stdlib.h termios.h utime.h fcntl.h pwd.h sys/statfs.h sys/time.h \
|
stdlib.h termios.h utime.h fcntl.h pwd.h sys/statfs.h sys/vfs.h sys/time.h \
|
||||||
sys/timeb.h sys/select.h sys/ioctl.h stropts.h arpa/inet.h \
|
sys/timeb.h sys/select.h sys/ioctl.h stropts.h arpa/inet.h \
|
||||||
security/pam_misc.h sys/socket.h sys/sysmacros.h sys/types.h \
|
security/pam_misc.h sys/socket.h sys/sysmacros.h sys/types.h \
|
||||||
sys/mkdev.h wchar.h wctype.h])
|
sys/mkdev.h wchar.h wctype.h])
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* File management GUI for the text mode edition
|
/* File management GUI for the text mode edition
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003,
|
* Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003,
|
||||||
* 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
* 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* Written by: 1994, 1995 Janne Kukonlehto
|
* Written by: 1994, 1995 Janne Kukonlehto
|
||||||
* 1994, 1995 Fred Leeflang
|
* 1994, 1995 Fred Leeflang
|
||||||
@ -9,6 +9,7 @@
|
|||||||
* 1995, 1996 Jakub Jelinek
|
* 1995, 1996 Jakub Jelinek
|
||||||
* 1997 Norbert Warmuth
|
* 1997 Norbert Warmuth
|
||||||
* 1998 Pavel Machek
|
* 1998 Pavel Machek
|
||||||
|
* 2009 Slava Zanko
|
||||||
*
|
*
|
||||||
* The copy code was based in GNU's cp, and was written by:
|
* The copy code was based in GNU's cp, and was written by:
|
||||||
* Torbjorn Granlund, David MacKenzie, and Jim Meyering.
|
* Torbjorn Granlund, David MacKenzie, and Jim Meyering.
|
||||||
@ -53,6 +54,22 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#if defined (__FreeBSD__)
|
||||||
|
# include <sys/param.h>
|
||||||
|
#endif
|
||||||
|
#if defined(__APPLE__) || defined (__FreeBSD__)
|
||||||
|
# include <sys/mount.h>
|
||||||
|
#elif defined (__NetBSD__)
|
||||||
|
# include <sys/param.h>
|
||||||
|
#else
|
||||||
|
# ifdef HAVE_VFS
|
||||||
|
# include <sys/vfs.h>
|
||||||
|
# else
|
||||||
|
# include <sys/statfs.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
@ -73,6 +90,15 @@
|
|||||||
#include "../src/strescape.h"
|
#include "../src/strescape.h"
|
||||||
|
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
typedef enum {
|
||||||
|
MSDOS_SUPER_MAGIC = 0x4d44,
|
||||||
|
NTFS_SB_MAGIC = 0x5346544e,
|
||||||
|
NTFS_3G_MAGIC = 0x65735546,
|
||||||
|
PROC_SUPER_MAGIC = 0x9fa0,
|
||||||
|
SMB_SUPER_MAGIC = 0x517B,
|
||||||
|
NCP_SUPER_MAGIC = 0x564c,
|
||||||
|
USBDEVICE_SUPER_MAGIC = 0x9fa2
|
||||||
|
} filegui_nonattrs_fs_t;
|
||||||
|
|
||||||
/* Hack: the vfs code should not rely on this */
|
/* Hack: the vfs code should not rely on this */
|
||||||
#define WITH_FULL_PATHS 1
|
#define WITH_FULL_PATHS 1
|
||||||
@ -133,6 +159,29 @@ enum {
|
|||||||
REPLACE_REGET
|
REPLACE_REGET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int
|
||||||
|
filegui__check_attrs_on_fs(const char *fs_path)
|
||||||
|
{
|
||||||
|
struct statfs stfs;
|
||||||
|
|
||||||
|
if (statfs(fs_path, &stfs)!=0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
switch ((filegui_nonattrs_fs_t) stfs.f_type)
|
||||||
|
{
|
||||||
|
case MSDOS_SUPER_MAGIC:
|
||||||
|
case NTFS_SB_MAGIC:
|
||||||
|
case NTFS_3G_MAGIC:
|
||||||
|
case PROC_SUPER_MAGIC:
|
||||||
|
case SMB_SUPER_MAGIC:
|
||||||
|
case NCP_SUPER_MAGIC:
|
||||||
|
case USBDEVICE_SUPER_MAGIC:
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static FileProgressStatus
|
static FileProgressStatus
|
||||||
check_progress_buttons (FileOpContext *ctx)
|
check_progress_buttons (FileOpContext *ctx)
|
||||||
{
|
{
|
||||||
@ -873,6 +922,10 @@ file_mask_dialog (FileOpContext *ctx, FileOperation operation, const char *text,
|
|||||||
|
|
||||||
fmd_init_i18n (FALSE);
|
fmd_init_i18n (FALSE);
|
||||||
|
|
||||||
|
|
||||||
|
/* unselect checkbox if target filesystem don't support attributes */
|
||||||
|
ctx->op_preserve = filegui__check_attrs_on_fs(def_text);
|
||||||
|
|
||||||
/* Set up the result pointers */
|
/* Set up the result pointers */
|
||||||
|
|
||||||
fmd_widgets[FMCB12].result = &ctx->op_preserve;
|
fmd_widgets[FMCB12].result = &ctx->op_preserve;
|
||||||
|
Loading…
Reference in New Issue
Block a user