GnomeAutoar.Compressor

g GObject.Object GObject.Object GnomeAutoar.Compressor GnomeAutoar.Compressor GObject.Object->GnomeAutoar.Compressor

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (source_files, output_file, format, filter, create_top_level_directory)

class

quark ()

get_completed_files ()

get_completed_size ()

get_create_top_level_directory ()

get_files ()

get_filter ()

get_format ()

get_notify_interval ()

get_output_file ()

get_output_is_dest ()

get_size ()

get_source_files ()

set_notify_interval (notify_interval)

set_output_is_dest (output_is_dest)

set_passphrase (passphrase)

start (cancellable)

start_async (cancellable)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

completed-files

int

r

Number of files has been read

completed-size

int

r

Bytes has read from disk

create-top-level-directory

bool

r/w/c

Whether to create a top level directory

files

int

r

Number of files will be compressed

notify-interval

int

r/w/c

Minimal time interval between progress signal

output-file

Gio.File

r/w/co

Output directory (Gio.File) of created archive

output-is-dest

bool

r/w/c

Whether output file is used as destination

size

int

r

Total bytes will be read from disk

source-files

int

r/w/co

The list of GFiles to be archived

Signals

Inherited:

GObject.Object (1)

Name

Short Description

cancelled

This signal is emitted after archive creating job is cancelled by the Gio.Cancellable.

completed

This signal is emitted after the archive creating job is successfully completed.

decide-dest

This signal is emitted when the location of the new archive is determined.

error

This signal is emitted when error occurs and all jobs should be terminated.

progress

This signal is used to report progress of creating archives.

Fields

Inherited:

GObject.Object (1)

Class Details

class GnomeAutoar.Compressor(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

GnomeAutoar.CompressorClass

classmethod new(source_files, output_file, format, filter, create_top_level_directory)
Parameters:
Returns:

a new GnomeAutoar.Compressor object

Return type:

GnomeAutoar.Compressor

Create a new GnomeAutoar.Compressor object.

classmethod quark()
Returns:

a #GQuark.

Return type:

int

Gets the GnomeAutoar.Compressor Error Quark.

get_completed_files()
Returns:

number of files has been read

Return type:

int

Gets the number of files has been read

get_completed_size()
Returns:

file size in bytes has been read

Return type:

int

Gets the size in bytes has been read from the source files and directories.

get_create_top_level_directory()
Returns:

whether a top level directory will be created

Return type:

bool

Gets whether a top level directory will be created in the new archive.

get_files()
Returns:

total number of files

Return type:

int

Gets the number of files will be read when the operation is completed. This value is currently unset, so calling this function is useless.

get_filter()
Returns:

the compression filter

Return type:

GnomeAutoar.Filter

Gets the compression filter

get_format()
Returns:

the compression format

Return type:

GnomeAutoar.Format

Gets the compression format

get_notify_interval()
Returns:

the minimal interval in microseconds between the emission of the GnomeAutoar.Compressor ::progress signal.

Return type:

int

See GnomeAutoar.Compressor.set_notify_interval().

get_output_file()
Returns:

a Gio.File

Return type:

Gio.File

If #AutoarCompressor:output_is_dest is False, gets the directory which contains the new archive. Otherwise, gets the the new archive. See GnomeAutoar.Compressor.set_output_is_dest().

get_output_is_dest()
Returns:

True if GnomeAutoar.Compressor :output is the location of the new archive.

Return type:

bool

See GnomeAutoar.Compressor.set_output_is_dest().

get_size()
Returns:

total file size in bytes

Return type:

int

Gets the size in bytes will be read when the operation is completed. This value is currently unset, so calling this function is useless.

get_source_files()
Returns:

a GLib.List with the source files

Return type:

[Gio.File]

Gets the list of source files.

set_notify_interval(notify_interval)
Parameters:

notify_interval (int) – the minimal interval in microseconds

Sets the minimal interval between emission of GnomeAutoar.Compressor ::progress signal. This prevent too frequent signal emission, which may cause performance impact. If you do not want this feature, you can set the interval to 0, so you will receive every progress update.

set_output_is_dest(output_is_dest)
Parameters:

output_is_dest (bool) – True if the location of the new archive has been already decided

By default GnomeAutoar.Compressor :output-is-dest is set to False, which means the new archive will be created as a regular file under GnomeAutoar.Compressor :output directory. The name of the new archive will be automatically generated and you will be notified via GnomeAutoar.Compressor ::decide-dest when the name is decided. If you have already decided the location of the new archive, and you do not want GnomeAutoar.Compressor to decide it for you, you can set GnomeAutoar.Compressor :output-is-dest to True. GnomeAutoar.Compressor will use GnomeAutoar.Compressor :output as the location of the new archive, and it will neither check whether the file exists nor create the necessary directories for you. This function should only be called before calling GnomeAutoar.Compressor.start() or GnomeAutoar.Compressor.start_async().

set_passphrase(passphrase)
Parameters:

passphrase (str) – the archive passphrase

Sets the archive passphrase. It works only with %ARCHIVE_FORMAT_ZIP.

start(cancellable)
Parameters:

cancellable (Gio.Cancellable or None) – optional Gio.Cancellable object, or None to ignore

Runs the archive creating work. All callbacks will be called in the same thread as the caller of this functions.

start_async(cancellable)
Parameters:

cancellable (Gio.Cancellable or None) – optional Gio.Cancellable object, or None to ignore

Asynchronously runs the archive creating work. You should connect to GnomeAutoar.Compressor ::cancelled, GnomeAutoar.Compressor ::error, and GnomeAutoar.Compressor ::completed signal to get notification when the work is terminated. All callbacks will be called in the main thread, so you can safely manipulate GTK+ widgets in the callbacks.

Signal Details

GnomeAutoar.Compressor.signals.cancelled(compressor)
Signal Name:

cancelled

Flags:

RUN_LAST

Parameters:

compressor (GnomeAutoar.Compressor) – The object which received the signal

This signal is emitted after archive creating job is cancelled by the Gio.Cancellable.

GnomeAutoar.Compressor.signals.completed(compressor)
Signal Name:

completed

Flags:

RUN_LAST

Parameters:

compressor (GnomeAutoar.Compressor) – The object which received the signal

This signal is emitted after the archive creating job is successfully completed.

GnomeAutoar.Compressor.signals.decide_dest(compressor, destination)
Signal Name:

decide-dest

Flags:

RUN_LAST

Parameters:

This signal is emitted when the location of the new archive is determined.

GnomeAutoar.Compressor.signals.error(compressor, error)
Signal Name:

error

Flags:

RUN_LAST

Parameters:

This signal is emitted when error occurs and all jobs should be terminated. Possible error domains are %AUTOAR_COMPRESSOR_ERROR, %G_IO_ERROR, and %AUTOAR_LIBARCHIVE_ERROR, which represent error occurs in GnomeAutoar.Compressor, GIO, and libarchive, respectively. The GLib.Error is owned by GnomeAutoar.Compressor and should not be freed.

GnomeAutoar.Compressor.signals.progress(compressor, completed_size, completed_files)
Signal Name:

progress

Flags:

RUN_LAST

Parameters:
  • compressor (GnomeAutoar.Compressor) – The object which received the signal

  • completed_size (int) – bytes has been read from source files and directories

  • completed_files (int) – number of files and directories has been read

This signal is used to report progress of creating archives. The value of completed_size and completed_files are the same as the #AutoarCompressor:completed_size and #AutoarCompressor:completed_files properties, respectively.

Property Details

GnomeAutoar.Compressor.props.completed_files
Name:

completed-files

Type:

int

Default Value:

0

Flags:

READABLE

Number of files has been read

GnomeAutoar.Compressor.props.completed_size
Name:

completed-size

Type:

int

Default Value:

0

Flags:

READABLE

Bytes has read from disk

GnomeAutoar.Compressor.props.create_top_level_directory
Name:

create-top-level-directory

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

Whether to create a top level directory

GnomeAutoar.Compressor.props.files
Name:

files

Type:

int

Default Value:

0

Flags:

READABLE

Number of files will be compressed

GnomeAutoar.Compressor.props.notify_interval
Name:

notify-interval

Type:

int

Default Value:

100000

Flags:

READABLE, WRITABLE, CONSTRUCT

Minimal time interval between progress signal

GnomeAutoar.Compressor.props.output_file
Name:

output-file

Type:

Gio.File

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Output directory (Gio.File) of created archive

GnomeAutoar.Compressor.props.output_is_dest
Name:

output-is-dest

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

Whether output file is used as destination

GnomeAutoar.Compressor.props.size
Name:

size

Type:

int

Default Value:

0

Flags:

READABLE

Total bytes will be read from disk

GnomeAutoar.Compressor.props.source_files
Name:

source-files

Type:

int

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The list of GFiles to be archived