![]() |
![]() |
![]() |
Libfm Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Signals |
#define FM_FILE_OPS_JOB_TYPE enum FmFileOpOption; enum FmFileOpType; struct FmFileOpsJob; struct FmFileOpsJobClass; FmFileOpOption fm_file_ops_job_ask_rename (FmFileOpsJob *job
,GFile *src
,GFileInfo *src_inf
,GFile *dest
,GFile **new_dest
); void fm_file_ops_job_emit_cur_file (FmFileOpsJob *job
,const char *cur_file
); void fm_file_ops_job_emit_percent (FmFileOpsJob *job
); void fm_file_ops_job_emit_prepared (FmFileOpsJob *job
); FmPath * fm_file_ops_job_get_dest (FmFileOpsJob *job
); FmFileOpsJob * fm_file_ops_job_new (FmFileOpType type
,FmPathList *files
); void fm_file_ops_job_set_chmod (FmFileOpsJob *job
,mode_t new_mode
,mode_t new_mode_mask
); void fm_file_ops_job_set_chown (FmFileOpsJob *job
,gint uid
,gint gid
); void fm_file_ops_job_set_dest (FmFileOpsJob *job
,FmPath *dest
); void fm_file_ops_job_set_recursive (FmFileOpsJob *job
,gboolean recursive
);
include
: libfm/fm-file-ops-job.h
The FmFileOpsJob can be used to do some file operation such as move, copy, delete, change file attributes, etc.
typedef enum { FM_FILE_OP_CANCEL = 0, FM_FILE_OP_OVERWRITE = 1<<0, FM_FILE_OP_RENAME = 1<<1, FM_FILE_OP_SKIP = 1<<2, FM_FILE_OP_SKIP_ERROR = 1<<3 } FmFileOpOption;
Operation selection on error.
typedef enum { FM_FILE_OP_NONE, FM_FILE_OP_MOVE, FM_FILE_OP_COPY, FM_FILE_OP_TRASH, FM_FILE_OP_UNTRASH, FM_FILE_OP_DELETE, FM_FILE_OP_LINK, FM_FILE_OP_CHANGE_ATTR } FmFileOpType;
Operation for FmFileOpsJob
struct FmFileOpsJobClass { FmJobClass parent_class; void (*prepared)(FmFileOpsJob* job); void (*cur_file)(FmFileOpsJob* job, const char* file); void (*percent)(FmFileOpsJob* job, guint percent); FmFileOpOption (*ask_rename)(FmFileOpsJob* job, FmFileInfo* src, FmFileInfo* dest, char** new_name); };
FmJobClass |
the parent class |
the class closure for the "prepared" signal | |
the class closure for the "cur-file" signal | |
the class closure for the "percent" signal | |
the class closure for the "ask-rename" signal |
FmFileOpOption fm_file_ops_job_ask_rename (FmFileOpsJob *job
,GFile *src
,GFileInfo *src_inf
,GFile *dest
,GFile **new_dest
);
Asks the user in main thread how to resolve conflict if file being copied or moved already exists in destination directory. Ask is done by emitting the "ask-rename" signal.
This API is private to FmFileOpsJob and should not be used outside of libfm implementation.
|
a job which asked |
|
source file descriptor |
|
source file information |
|
destination descriptor |
|
pointer to get new destination |
Returns : |
a decision how to resolve conflict. |
Since 0.1.0
void fm_file_ops_job_emit_cur_file (FmFileOpsJob *job
,const char *cur_file
);
Emits the "cur-file" signal in main thread.
This API is private to FmFileOpsJob and should not be used outside of libfm implementation.
|
the job to emit signal |
|
the data to emit |
Since 0.1.0
void fm_file_ops_job_emit_percent (FmFileOpsJob *job
);
Emits the "percent" signal in main thread.
This API is private to FmFileOpsJob and should not be used outside of libfm implementation.
|
the job to emit signal |
Since 0.1.0
void fm_file_ops_job_emit_prepared (FmFileOpsJob *job
);
Emits the "prepared" signal in main thread.
This API is private to FmFileOpsJob and should not be used outside of libfm implementation.
|
the job to emit signal |
Since 0.1.10
FmPath * fm_file_ops_job_get_dest (FmFileOpsJob *job
);
Retrieves the destination path for operation. If type of operation
in not FM_FILE_OP_MOVE, FM_FILE_OP_COPY, or FM_FILE_OP_LINK then
result of this call is undefined. The returned value is owned by
job
and should be not freed by caller.
|
a job to inspect |
Returns : |
the FmPath which was set by previous call
to fm_file_ops_job_set_dest() . [transfer none]
|
Since 0.1.0
FmFileOpsJob * fm_file_ops_job_new (FmFileOpType type
,FmPathList *files
);
Creates new FmFileOpsJob which can be used in FmJob API.
|
type of file operation the new job will handle |
|
list of source files to perform operation |
Returns : |
a new FmFileOpsJob object. |
Since 0.1.0
void fm_file_ops_job_set_chmod (FmFileOpsJob *job
,mode_t new_mode
,mode_t new_mode_mask
);
Sets that files for file operation FM_FILE_OP_CHANGE_ATTR should have
file mode changed according to new_mode_mask
and new_mode
: bits
that are present only in new_mode_mask
will be set to 0, and bits
that are present in both new_mode_mask
and new_mode
will be set to 1.
This API may be used only before job
is started.
|
a job to set |
|
which bits of file mode should be set |
|
which bits of file mode should be reset |
Since 0.1.0
void fm_file_ops_job_set_chown (FmFileOpsJob *job
,gint uid
,gint gid
);
Sets that files for file operation FM_FILE_OP_CHANGE_ATTR should have
owner or group changed. If uid
>= 0 then job
will try to change
owner of files. If gid
>= 0 then job
will try to change group of
files.
This API may be used only before job
is started.
|
a job to set |
|
user id to set as file owner |
|
group id to set as file group |
Since 0.1.0
void fm_file_ops_job_set_dest (FmFileOpsJob *job
,FmPath *dest
);
Sets destination path for operations FM_FILE_OP_MOVE, FM_FILE_OP_COPY, or FM_FILE_OP_LINK.
This API may be used only before job
is started.
|
a job to set |
|
destination path |
Since 0.1.0
void fm_file_ops_job_set_recursive (FmFileOpsJob *job
,gboolean recursive
);
Sets 'recursive' attribute for file operation according to recursive
.
If recursive
is TRUE
then file operation job
will try to do all
operations recursively.
This API may be used only before job
is started.
|
a job to set |
|
recursion attribute to set |
Since 0.1.0
"ask-rename"
signalgint user_function (FmFileOpsJob *job,
gpointer src,
gpointer dest,
gpointer new_name,
gpointer user_data) : Run Last
The "ask-rename" signal is emitted when file operation
raises a conflict because file with the same name already exists
in the directory dest
. Signal handler should find a decision how
to resolve the situation. If there is more than one handler connected
to the signal then only one of them will receive it.
|
a job object which emitted the signal |
|
(FmFileInfo *) source file |
|
(FmFileInfo *) destination directory |
|
(char **) pointer to receive new name |
|
user data set when the signal handler was connected. |
Returns : |
a FmFileOpOption decision. |
Since 0.1.0
"cur-file"
signalvoid user_function (FmFileOpsJob *job,
gpointer file,
gpointer user_data) : Run First
The "cur-file" signal is emitted when job
is about
to start operation on the file
.
|
a job object which emitted the signal |
|
(const char *) file which is processing |
|
user data set when the signal handler was connected. |
Since 0.1.0
"percent"
signalvoid user_function (FmFileOpsJob *job,
guint percent,
gpointer user_data) : Run First
The "percent" signal is emitted when one more file operation is completed.
|
a job object which emitted the signal |
|
current ratio of completed job size to full job size |
|
user data set when the signal handler was connected. |
Since 0.1.0
"prepared"
signalvoid user_function (FmFileOpsJob *job,
gpointer user_data) : Run First
The "prepared" signal is emitted when preparation
of the file operation is done and job
is ready to start
copying/deleting...
|
a job object which emitted the signal |
|
user data set when the signal handler was connected. |
Since 0.1.10