Top |
GtkSourceCompressionType | compression-type | Read |
GtkSourceEncoding * | encoding | Read |
GFile * | location | Read / Write / Construct |
GtkSourceNewlineType | newline-type | Read |
gboolean | read-only | Read |
GEnum ├── GtkSourceCompressionType ╰── GtkSourceNewlineType GObject ╰── GtkSourceFile
A GtkSourceFile object is the on-disk representation of a GtkSourceBuffer. With a GtkSourceFile, you can create and configure a GtkSourceFileLoader and GtkSourceFileSaver which take by default the values of the GtkSourceFile properties (except for the file loader which auto-detect some properties). On a successful load or save operation, the GtkSourceFile properties are updated. If an operation fails, the GtkSourceFile properties have still the previous valid values.
GMountOperation * (*GtkSourceMountOperationFactory) (GtkSourceFile *file
,gpointer userdata
);
Type definition for a function that will be called to create a GMountOperation. This is useful for creating a GtkMountOperation.
Since: 3.14
GFile *
gtk_source_file_get_location (GtkSourceFile *file
);
Since: 3.14
void gtk_source_file_set_location (GtkSourceFile *file
,GFile *location
);
Sets the location.
Since: 3.14
const GtkSourceEncoding *
gtk_source_file_get_encoding (GtkSourceFile *file
);
The encoding is initially NULL
. After a successful file loading or saving
operation, the encoding is non-NULL
.
Since: 3.14
GtkSourceNewlineType
gtk_source_file_get_newline_type (GtkSourceFile *file
);
Since: 3.14
GtkSourceCompressionType
gtk_source_file_get_compression_type (GtkSourceFile *file
);
Since: 3.14
void
gtk_source_file_check_file_on_disk (GtkSourceFile *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.
GtkSourceFile 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 gtk_source_file_is_local()
.
Since: 3.18
gboolean
gtk_source_file_is_local (GtkSourceFile *file
);
Returns whether the file is local. If the “location” is NULL
,
returns FALSE
.
Since: 3.18
gboolean
gtk_source_file_is_externally_modified
(GtkSourceFile *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
gtk_source_file_check_file_on_disk()
.
Since: 3.18
gboolean
gtk_source_file_is_deleted (GtkSourceFile *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
gtk_source_file_check_file_on_disk()
.
Since: 3.18
gboolean
gtk_source_file_is_readonly (GtkSourceFile *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
gtk_source_file_check_file_on_disk()
.
Since: 3.18
void gtk_source_file_set_mount_operation_factory (GtkSourceFile *file
,GtkSourceMountOperationFactory callback
,gpointer user_data
,GDestroyNotify notify
);
Sets a GtkSourceMountOperationFactory 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 |
||
callback |
a GtkSourceMountOperationFactory 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: 3.14
#define GTK_SOURCE_NEWLINE_TYPE_DEFAULT GTK_SOURCE_NEWLINE_TYPE_CR_LF
The default newline type on the current OS.
Since: 3.14
“compression-type”
property“compression-type” GtkSourceCompressionType
The compression type.
Owner: GtkSourceFile
Flags: Read
Default value: GTK_SOURCE_COMPRESSION_TYPE_NONE
Since: 3.14
“encoding”
property“encoding” GtkSourceEncoding *
The character encoding, initially NULL
. After a successful file
loading or saving operation, the encoding is non-NULL
.
Owner: GtkSourceFile
Flags: Read
Since: 3.14
“location”
property“location” GFile *
The location.
Owner: GtkSourceFile
Flags: Read / Write / Construct
Since: 3.14
“newline-type”
property“newline-type” GtkSourceNewlineType
The line ending type.
Owner: GtkSourceFile
Flags: Read
Default value: GTK_SOURCE_NEWLINE_TYPE_LF
Since: 3.14