Top | ![]() |
![]() |
![]() |
![]() |
TeplCompressionType | compression-type | Read |
TeplEncoding * | encoding | Read |
GFile * | location | Read / Write / Construct |
TeplNewlineType | newline-type | Read |
gboolean | read-only | Read |
gchar * | short-name | Read |
TeplFile | |
enum | TeplNewlineType |
#define | TEPL_NEWLINE_TYPE_DEFAULT |
enum | TeplCompressionType |
A TeplFile object is the on-disk representation of a TeplBuffer.
With a TeplFile, you can create and configure a TeplFileLoader and TeplFileSaver which take by default the values of the TeplFile properties (except for the file loader which auto-detect some properties). On a successful load or save operation, the TeplFile properties are updated. If an operation fails, the TeplFile properties have still the previous valid values.
TeplFile is a fork of GtkSourceFile. TeplFileLoader is a new implementation for file loading, but it needs to call private functions of TeplFile in order to update its properties. So it was not possible for TeplFileLoader to use GtkSourceFile. So the whole file loading and saving API of GtkSourceView has been forked; hopefully the new implementation will be folded back to GtkSourceView in a later version.
GMountOperation * (*TeplMountOperationFactory) (TeplFile *file
,gpointer userdata
);
Type definition for a function that will be called to create a GMountOperation. This is useful for creating a GtkMountOperation.
Since: 1.0
TeplFileMetadata *
tepl_file_get_file_metadata (TeplFile *file
);
Since: 1.0
void tepl_file_set_location (TeplFile *file
,GFile *location
);
Sets the location.
Since: 1.0
const gchar *
tepl_file_get_short_name (TeplFile *file
);
Gets the file
short name. If the “location” isn't NULL
,
returns its display-name (see G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME).
Otherwise returns "Untitled File N", with N the Nth untitled file of the
application, starting at 1. When an untitled file is closed, its number is
released and can be used by a later untitled file.
Since: 1.0
const TeplEncoding *
tepl_file_get_encoding (TeplFile *file
);
The encoding is initially NULL
. After a successful file loading or saving
operation, the encoding is non-NULL
.
Since: 1.0
TeplNewlineType
tepl_file_get_newline_type (TeplFile *file
);
Since: 1.0
TeplCompressionType
tepl_file_get_compression_type (TeplFile *file
);
Since: 1.0
void
tepl_file_check_file_on_disk (TeplFile *file
);
Checks synchronously the file on disk, to know whether the file is externally modified, or has been deleted, and whether the file is read-only.
TeplFile doesn't create a GFileMonitor to track those properties, so this function needs to be called instead. Creating lots of GFileMonitor's would take lots of resources.
Since this function is synchronous, it is advised to call it only on local
files. See tepl_file_is_local()
.
Since: 1.0
gboolean
tepl_file_is_local (TeplFile *file
);
Returns whether the file is local. If the “location” is NULL
,
returns FALSE
.
Since: 1.0
gboolean
tepl_file_is_externally_modified (TeplFile *file
);
Returns whether the file is externally modified. If the
“location” is NULL
, returns FALSE
.
To have an up-to-date value, you must first call
tepl_file_check_file_on_disk()
.
Since: 1.0
gboolean
tepl_file_is_deleted (TeplFile *file
);
Returns whether the file has been deleted. If the
“location” is NULL
, returns FALSE
.
To have an up-to-date value, you must first call
tepl_file_check_file_on_disk()
.
Since: 1.0
gboolean
tepl_file_is_readonly (TeplFile *file
);
Returns whether the file is read-only. If the
“location” is NULL
, returns FALSE
.
To have an up-to-date value, you must first call
tepl_file_check_file_on_disk()
.
Since: 1.0
void tepl_file_set_mount_operation_factory (TeplFile *file
,TeplMountOperationFactory callback
,gpointer user_data
,GDestroyNotify notify
);
Sets a TeplMountOperationFactory function that will be called when a GMountOperation must be created. This is useful for creating a GtkMountOperation with the parent GtkWindow.
If a mount operation factory isn't set, g_mount_operation_new()
will be
called.
file |
a TeplFile. |
|
callback |
a TeplMountOperationFactory to call when a GMountOperation is needed. |
[scope notified] |
user_data |
the data to pass to the |
[closure] |
notify |
function to call on |
[nullable] |
Since: 1.0
void
tepl_file_add_uri_to_recent_manager (TeplFile *file
);
If the “location” isn't NULL
, adds its URI to the default
GtkRecentManager with gtk_recent_manager_add_item()
.
Since: 4.0
#define TEPL_NEWLINE_TYPE_DEFAULT TEPL_NEWLINE_TYPE_CR_LF
The default newline type on the current OS.
Since: 1.0
“compression-type”
property“compression-type” TeplCompressionType
The compression type.
Owner: TeplFile
Flags: Read
Default value: TEPL_COMPRESSION_TYPE_NONE
Since: 1.0
“encoding”
property“encoding” TeplEncoding *
The character encoding, initially NULL
. After a successful file
loading or saving operation, the encoding is non-NULL
.
Owner: TeplFile
Flags: Read
Since: 1.0
“location”
property“location” GFile *
The location.
Owner: TeplFile
Flags: Read / Write / Construct
Since: 1.0
“newline-type”
property“newline-type” TeplNewlineType
The line ending type.
Owner: TeplFile
Flags: Read
Default value: TEPL_NEWLINE_TYPE_LF
Since: 1.0
“read-only”
property“read-only” gboolean
Whether the file is read-only or not. The value of this property is not updated automatically (there is no file monitors).
Owner: TeplFile
Flags: Read
Default value: FALSE
Since: 1.0
“short-name”
property“short-name” gchar *
The file short name. See tepl_file_get_short_name()
.
Owner: TeplFile
Flags: Read
Default value: NULL
Since: 1.0