Top |
TeplFileTeplFile — On-disk representation of a TeplBuffer |
char * | full-name | Read |
GFile * | location | Read / Write / Construct |
TeplNewlineType | newline-type | Read |
char * | short-name | Read |
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-detects 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.
It is possible to use TeplFile without using TeplFileLoader and TeplFileSaver. TeplFile alone offers several features useful for a text editor.
When using TeplFile alone, TeplFile does the I/O operations (if any) asynchronously.
GMountOperation * (*TeplMountOperationFactory) (TeplFile *file
,gpointer user_data
);
Type definition for a function that will be called to create a GMountOperation. This is useful for creating a GtkMountOperation.
Since: 1.0
void tepl_file_set_location (TeplFile *file
,GFile *location
);
Sets the “location” property.
Since: 1.0
TeplNewlineType
tepl_file_get_newline_type (TeplFile *file
);
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
“full-name”
property “full-name” char *
Convenience property for the full name of a TeplFile.
When the “location” is NULL
, this property has the same
value as the “short-name”.
When the “location” is not NULL
, this property contains the
full path to the location. It uses:
g_file_get_parse_name()
tepl_utils_replace_home_dir_with_tilde()
Owner: TeplFile
Flags: Read
Default value: NULL
“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
“short-name”
property “short-name” char *
The file short name.
When the “location” is NULL
, the default instance of
GflsUnsavedDocumentTitles is used to get a title.
When the “location” is not NULL
, this property contains the
display-name (see G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME). However,
requesting the display-name can take some time (for example for a
remote file with a slow network connection). When the
“location” property is set, the display-name is fetched
asynchronously. When the display-name is available, this property is
notified. In the meantime – after the “location” is set but
before receiving the display-name – a fallback implementation is used
that does no blocking I/O (but it may return a different result
compared to the real display-name).
Owner: TeplFile
Flags: Read
Default value: NULL
Since: 1.0