Thunarx.FileInfo

g GObject.GInterface GObject.GInterface Thunarx.FileInfo Thunarx.FileInfo GObject.GInterface->Thunarx.FileInfo

Implementations:

None

Methods

changed ()

get_file_info ()

get_filesystem_info ()

get_location ()

get_mime_type ()

get_name ()

get_parent_uri ()

get_uri ()

get_uri_scheme ()

has_mime_type (mime_type)

is_directory ()

renamed ()

Virtual Methods

do_changed ()

do_get_file_info ()

do_get_filesystem_info ()

do_get_location ()

do_get_mime_type ()

do_get_name ()

do_get_parent_uri ()

do_get_uri ()

do_get_uri_scheme ()

do_has_mime_type (mime_type)

do_is_directory ()

do_renamed ()

Properties

None

Signals

Name

Short Description

changed

Emitted whenever the system notices a change to file_info.

renamed

Emitted when the file_info is renamed to another name.

Fields

None

Class Details

class Thunarx.FileInfo
Bases:

GObject.GInterface

Structure:

Thunarx.FileInfoIface

changed()

Emits the ::changed signal on self. This method should not be invoked by Thunar plugins, instead the file manager itself will use this method to emit ::changed whenever it notices a change on self.

get_file_info()
Returns:

the Gio.FileInfo object associated with self, which MUST be freed using GObject.Object.unref().

Return type:

Gio.FileInfo

Returns the Gio.FileInfo associated with self, which includes additional information about the self as queried from GIO earlier. The caller is responsible to free the returned Gio.FileInfo object using GObject.Object.unref() when no longer needed.

get_filesystem_info()
Returns:

the Gio.FileInfo containing information about the filesystem of self or None if no filesystem information is available. It MUST be released using GObject.Object.unref().

Return type:

Gio.FileInfo

Returns the Gio.FileInfo which includes additional information about the filesystem self resides on. The caller is responsible to free the returned Gio.FileInfo object using GObject.Object.unref() when no longer needed.

get_location()
Returns:

the Gio.File to which self points. It MUST be released using GObject.Object.unref().

Return type:

Gio.File

Returns the Gio.File self points to. The Gio.File is a more powerful tool than just the URI or the path. The caller is responsible to release the returned Gio.File using GObject.Object.unref() when no longer needed.

get_mime_type()
Returns:

the MIME-type for self or None.

Return type:

str

Returns the MIME-type of the file represented by self or None if no MIME-type is known for self.

The caller is responsible to free the returned string using GLib.free() when no longer needed.

get_name()
Returns:

the real name of the file represented by self.

Return type:

str

Returns the real name of the file represented by self in the local file system encoding. You can use GLib.filename_display_name() or similar functions to generate an UTF-8 version of the name, which is suitable for use in the user interface.

The caller is responsible to free the returned string using GLib.free() when no longer needed.

get_parent_uri()
Returns:

the parent URI for self or None.

Return type:

str

Returns the URI to the parent file of self or None if self has no parent. Note that the parent URI may be of a different type than the URI of self. For example, the parent of “file:///” is “computer:///”.

The caller is responsible to free the returned string using GLib.free() when no longer needed.

get_uri()
Returns:

the fully qualified URI of self.

Return type:

str

Returns the escaped, fully qualified URI of the file object represented by self. You may use GLib.filename_from_uri() and similar functions to work with the returned URI.

The caller is responsible to free the returned string using GLib.free() when no longer needed.

get_uri_scheme()
Returns:

the URI scheme for self.

Return type:

str

Returns the URI scheme of the file represented by self. E.g. if self refers to the file “file:///usr/home”, the return value will be “file”.

The caller is responsible to free the returned string using GLib.free() when no longer needed.

has_mime_type(mime_type)
Parameters:

mime_type (str) – a MIME-type (e.g. “text/plain”).

Returns:

True if mime_type is valid for self, else False.

Return type:

bool

Checks whether self is of the given mime_type or whether the MIME-type of self is a subclass of mime_type.

This is the preferred way for most extensions to check whether they support a given file or not, and you should consider using this method rather than Thunarx.FileInfo.get_mime_type(). A simple example would be a menu extension that performs a certain action on text files. In this case you want to check whether a given Thunarx.FileInfo refers to any kind of text file, not only to “text/plain” (e.g. this also includes “text/xml” and “application/x-desktop”).

But you should be aware that this method may take some time to test whether mime_type is valid for self, so don’t call it too often.

is_directory()
Returns:

True if self is a directory.

Return type:

bool

Checks whether self refers to a directory.

renamed()

Emits the ::renamed signal on self. This method should not be invoked by Thunar plugins, instead the file manager will emit this signal whenever the user renamed the self.

The plugins should instead connect to the ::renamed signal and update it’s internal state and it’s user interface after the file manager renamed a file.

do_changed() virtual

Emits the ::changed signal on file_info. This method should not be invoked by Thunar plugins, instead the file manager itself will use this method to emit ::changed whenever it notices a change on file_info.

do_get_file_info() virtual
Returns:

the Gio.FileInfo object associated with file_info, which MUST be freed using GObject.Object.unref().

Return type:

Gio.FileInfo

Returns the Gio.FileInfo associated with file_info, which includes additional information about the file_info as queried from GIO earlier. The caller is responsible to free the returned Gio.FileInfo object using GObject.Object.unref() when no longer needed.

do_get_filesystem_info() virtual
Returns:

the Gio.FileInfo containing information about the filesystem of file_info or None if no filesystem information is available. It MUST be released using GObject.Object.unref().

Return type:

Gio.FileInfo

Returns the Gio.FileInfo which includes additional information about the filesystem file_info resides on. The caller is responsible to free the returned Gio.FileInfo object using GObject.Object.unref() when no longer needed.

do_get_location() virtual
Returns:

the Gio.File to which file_info points. It MUST be released using GObject.Object.unref().

Return type:

Gio.File

Returns the Gio.File file_info points to. The Gio.File is a more powerful tool than just the URI or the path. The caller is responsible to release the returned Gio.File using GObject.Object.unref() when no longer needed.

do_get_mime_type() virtual
Returns:

the MIME-type for file_info or None.

Return type:

str

Returns the MIME-type of the file represented by file_info or None if no MIME-type is known for file_info.

The caller is responsible to free the returned string using GLib.free() when no longer needed.

do_get_name() virtual
Returns:

the real name of the file represented by file_info.

Return type:

str

Returns the real name of the file represented by file_info in the local file system encoding. You can use GLib.filename_display_name() or similar functions to generate an UTF-8 version of the name, which is suitable for use in the user interface.

The caller is responsible to free the returned string using GLib.free() when no longer needed.

do_get_parent_uri() virtual
Returns:

the parent URI for file_info or None.

Return type:

str

Returns the URI to the parent file of file_info or None if file_info has no parent. Note that the parent URI may be of a different type than the URI of file_info. For example, the parent of “file:///” is “computer:///”.

The caller is responsible to free the returned string using GLib.free() when no longer needed.

do_get_uri() virtual
Returns:

the fully qualified URI of file_info.

Return type:

str

Returns the escaped, fully qualified URI of the file object represented by file_info. You may use GLib.filename_from_uri() and similar functions to work with the returned URI.

The caller is responsible to free the returned string using GLib.free() when no longer needed.

do_get_uri_scheme() virtual
Returns:

the URI scheme for file_info.

Return type:

str

Returns the URI scheme of the file represented by file_info. E.g. if file_info refers to the file “file:///usr/home”, the return value will be “file”.

The caller is responsible to free the returned string using GLib.free() when no longer needed.

do_has_mime_type(mime_type) virtual
Parameters:

mime_type (str) – a MIME-type (e.g. “text/plain”).

Returns:

True if mime_type is valid for file_info, else False.

Return type:

bool

Checks whether file_info is of the given mime_type or whether the MIME-type of file_info is a subclass of mime_type.

This is the preferred way for most extensions to check whether they support a given file or not, and you should consider using this method rather than Thunarx.FileInfo.get_mime_type(). A simple example would be a menu extension that performs a certain action on text files. In this case you want to check whether a given Thunarx.FileInfo refers to any kind of text file, not only to “text/plain” (e.g. this also includes “text/xml” and “application/x-desktop”).

But you should be aware that this method may take some time to test whether mime_type is valid for file_info, so don’t call it too often.

do_is_directory() virtual
Returns:

True if file_info is a directory.

Return type:

bool

Checks whether file_info refers to a directory.

do_renamed() virtual

Emits the ::renamed signal on file_info. This method should not be invoked by Thunar plugins, instead the file manager will emit this signal whenever the user renamed the file_info.

The plugins should instead connect to the ::renamed signal and update it’s internal state and it’s user interface after the file manager renamed a file.

Signal Details

Thunarx.FileInfo.signals.changed(file_info)
Signal Name:

changed

Flags:

RUN_FIRST

Parameters:

file_info (Thunarx.FileInfo) – The object which received the signal

Emitted whenever the system notices a change to file_info.

Thunar plugins should use this signal to stay informed about changes to a file_info for which they currently display information (i.e. in a Thunarx.PropertyPage), and update it’s user interface whenever a change is noticed on file_info.

Thunarx.FileInfo.signals.renamed(file_info)
Signal Name:

renamed

Flags:

RUN_FIRST

Parameters:

file_info (Thunarx.FileInfo) – The object which received the signal

Emitted when the file_info is renamed to another name.

For example, within Thunar, #ThunarFolder uses this signal to reregister it’s VFS directory monitor, after the corresponding file was renamed.