GnomeAutoar.Extractor

g GObject.Object GObject.Object GnomeAutoar.Extractor GnomeAutoar.Extractor GObject.Object->GnomeAutoar.Extractor

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (source_file, output_file)

class

quark ()

get_completed_files ()

get_completed_size ()

get_delete_after_extraction ()

get_notify_interval ()

get_output_file ()

get_output_is_dest ()

get_source_file ()

get_total_files ()

get_total_size ()

set_delete_after_extraction (delete_after_extraction)

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 written

completed-size

int

r

Bytes written to disk

delete-after-extraction

bool

r/w/c

Whether the source archive is deleted after a successful extraction

notify-interval

int

r/w/c

Minimal time interval between progress signal

output-file

Gio.File

r/w/co

The Gio.File of the directory where the files will be extracted

output-is-dest

bool

r/w/c

Whether GnomeAutoar.Extractor :output-file is used as destination

source-file

Gio.File

r/w/co

The Gio.File of the source archive that will be extracted

total-files

int

r

Number of files in the archive

total-size

int

r

Total size of the extracted files

Signals

Inherited:

GObject.Object (1)

Name

Short Description

cancelled

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

completed

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

conflict

decide-destination

error

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

progress

This signal is used to report progress of extraction.

request-passphrase

This signal is emitted when the archive extracting job needs a passphrase.

scanned

This signal is emitted when GnomeAutoar.Extractor finish scanning filename entries in the source archive.

Fields

Inherited:

GObject.Object (1)

Class Details

class GnomeAutoar.Extractor(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

GnomeAutoar.ExtractorClass

classmethod new(source_file, output_file)
Parameters:
Returns:

a new GnomeAutoar.Extractor object

Return type:

GnomeAutoar.Extractor

Create a new GnomeAutoar.Extractor object.

classmethod quark()
Returns:

a #GQuark.

Return type:

int

Gets the GnomeAutoar.Extractor Error Quark.

get_completed_files()
Returns:

number of files has been written to disk

Return type:

int

Gets the number of files has been written to disk.

get_completed_size()
Returns:

size in bytes has been written

Return type:

int

Gets the size in bytes has been written to disk.

get_delete_after_extraction()
Returns:

True if the source archive will be deleted after a succesful extraction

Return type:

bool

Whether the source archive will be deleted after a successful extraction.

get_notify_interval()
Returns:

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

Return type:

int

See GnomeAutoar.Extractor.set_notify_interval().

get_output_file()
Returns:

a Gio.File

Return type:

Gio.File

Gets the Gio.File object which represents the output directory of extracted file or directory, or the extracted file or directory itself if you set GnomeAutoar.Extractor :output-is-dest on the returned object.

get_output_is_dest()
Returns:

True if GnomeAutoar.Extractor :output-file is the destination for extracted files

Return type:

bool

See GnomeAutoar.Extractor.set_output_is_dest().

get_source_file()
Returns:

a Gio.File

Return type:

Gio.File

Gets the Gio.File object which represents the source archive that will be extracted for this object.

get_total_files()
Returns:

total number of extracted files

Return type:

int

Gets the total number of files will be written when the operation is completed.

get_total_size()
Returns:

total size of extracted files in bytes

Return type:

int

Gets the size in bytes will be written when the operation is completed.

set_delete_after_extraction(delete_after_extraction)
Parameters:

delete_after_extraction (bool) – True if the source archive should be deleted after a successful extraction

By default GnomeAutoar.Extractor :delete-after-extraction is set to False so the source archive will not be automatically deleted if extraction succeeds.

set_notify_interval(notify_interval)
Parameters:

notify_interval (int) – the minimal interval in microseconds

Sets the minimal interval between emission of GnomeAutoar.Extractor ::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 GnomeAutoar.Extractor :output-file is the destination for extracted files

By default GnomeAutoar.Extractor :output-is-dest is set to False, which means only one file or directory will be created in GnomeAutoar.Extractor :output-file. The destination is internally determined by analyzing the contents of the archive. If this is not wanted, GnomeAutoar.Extractor :output-is-dest can be set to True, which will make GnomeAutoar.Extractor :output-file the destination for extracted files. In any case, the destination will be notified via GnomeAutoar.Extractor ::decide-destination, when it is possible to set a new destination.

GnomeAutoar.Extractor will attempt to create the destination regardless to whether its path was internally decided or not.

This function should only be called before calling GnomeAutoar.Extractor.start() or GnomeAutoar.Extractor.start_async().

set_passphrase(passphrase)
Parameters:

passphrase (str) – a string with the passphrase to use

Sets a passphrase to use if the file to decompress is passphrase-protected.

start(cancellable)
Parameters:

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

Runs the archive extracting 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 extracting work. You should connect to GnomeAutoar.Extractor ::cancelled, GnomeAutoar.Extractor ::error, and GnomeAutoar.Extractor ::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.Extractor.signals.cancelled(extractor)
Signal Name:

cancelled

Flags:

RUN_LAST

Parameters:

extractor (GnomeAutoar.Extractor) – The object which received the signal

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

GnomeAutoar.Extractor.signals.completed(extractor)
Signal Name:

completed

Flags:

RUN_LAST

Parameters:

extractor (GnomeAutoar.Extractor) – The object which received the signal

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

GnomeAutoar.Extractor.signals.conflict(extractor, file, new_file)
Signal Name:

conflict

Flags:

RUN_LAST

Parameters:
Returns:

the GnomeAutoar.ConflictAction to be performed by GnomeAutoar.Extractor

This signal is used to report and offer the possibility to solve name conflicts when extracting files. If it is not handled, the file will be skipped.

Return type:

int

GnomeAutoar.Extractor.signals.decide_destination(extractor, destination, files)
Signal Name:

decide-destination

Flags:

RUN_LAST

Parameters:
  • extractor (GnomeAutoar.Extractor) – The object which received the signal

  • destination (Gio.File) – a Gio.File for the location where files will be extracted

  • files (object or None) – the list of Gio.File objects to be extracted. All have destination as their common prefix

Returns:

Gio.File for location that will overwrite destination, or None if this is not wanted

This signal is emitted when the path of the destination is determined. It is useful for solving name conflicts or for setting a new destination, based on the contents of the archive.

Return type:

GObject.Object

GnomeAutoar.Extractor.signals.error(extractor, 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_EXTRACTOR_ERROR, %G_IO_ERROR, and %AUTOAR_LIBARCHIVE_ERROR, which represent error occurs in GnomeAutoar.Extractor, GIO, and libarchive, respectively. The GLib.Error is owned by GnomeAutoar.Extractor and should not be freed.

GnomeAutoar.Extractor.signals.progress(extractor, completed_size, completed_files)
Signal Name:

progress

Flags:

RUN_LAST

Parameters:
  • extractor (GnomeAutoar.Extractor) – The object which received the signal

  • completed_size (int) – bytes has been written to disk

  • completed_files (int) – number of files have been written to disk

This signal is used to report progress of extraction.

GnomeAutoar.Extractor.signals.request_passphrase(extractor)
Signal Name:

request-passphrase

Flags:

RUN_LAST

Parameters:

extractor (GnomeAutoar.Extractor) – The object which received the signal

Return type:

str

This signal is emitted when the archive extracting job needs a passphrase.

GnomeAutoar.Extractor.signals.scanned(extractor, files)
Signal Name:

scanned

Flags:

RUN_LAST

Parameters:
  • extractor (GnomeAutoar.Extractor) – The object which received the signal

  • files (int) – the number of files will be extracted from the source archive

This signal is emitted when GnomeAutoar.Extractor finish scanning filename entries in the source archive.

Property Details

GnomeAutoar.Extractor.props.completed_files
Name:

completed-files

Type:

int

Default Value:

0

Flags:

READABLE

Number of files has been written

GnomeAutoar.Extractor.props.completed_size
Name:

completed-size

Type:

int

Default Value:

0

Flags:

READABLE

Bytes written to disk

GnomeAutoar.Extractor.props.delete_after_extraction
Name:

delete-after-extraction

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

Whether the source archive is deleted after a successful extraction

GnomeAutoar.Extractor.props.notify_interval
Name:

notify-interval

Type:

int

Default Value:

100000

Flags:

READABLE, WRITABLE, CONSTRUCT

Minimal time interval between progress signal

GnomeAutoar.Extractor.props.output_file
Name:

output-file

Type:

Gio.File

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The Gio.File of the directory where the files will be extracted

GnomeAutoar.Extractor.props.output_is_dest
Name:

output-is-dest

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

Whether GnomeAutoar.Extractor :output-file is used as destination

GnomeAutoar.Extractor.props.source_file
Name:

source-file

Type:

Gio.File

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The Gio.File of the source archive that will be extracted

GnomeAutoar.Extractor.props.total_files
Name:

total-files

Type:

int

Default Value:

0

Flags:

READABLE

Number of files in the archive

GnomeAutoar.Extractor.props.total_size
Name:

total-size

Type:

int

Default Value:

0

Flags:

READABLE

Total size of the extracted files