Class File
- All Implemented Interfaces:
Proxy
On-disk representation of a Buffer.
A GtkSourceFile object is the on-disk representation of a Buffer.
With a GtkSourceFile, you can create and configure a FileLoader
and FileSaver 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFile.Builder<B extends File.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classNested classes/interfaces inherited from class GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionFile()Create a new File.File(MemorySegment address) Create a File instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected FileasParent()Return this instance as if it were its parent type.static File.Builder<? extends File.Builder> builder()AFile.Builderobject constructs aFilewith the specified properties.voidChecks synchronously the file on disk, to know whether the file is externally modified, or has been deleted, and whether the file is read-only.The encoding is initiallynull.@Nullable Filestatic MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the File class.booleanReturns whether the file has been deleted.booleanReturns whether the file is externally modified.booleanisLocal()Returns whether the file is local.booleanReturns whether the file is read-only.voidsetLocation(@Nullable File location) Sets the location.voidsetMountOperationFactory(@Nullable MountOperationFactory callback) Sets aMountOperationFactoryfunction that will be called when aMountOperationmust be created.Methods inherited from class GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
File
Create a File instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
File
public File()Create a new File.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
-
checkFileOnDisk
public void checkFileOnDisk()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.
GtkSourceFiledoesn't create aFileMonitorto track those properties, so this function needs to be called instead. Creating lots ofFileMonitor's would take lots of resources.Since this function is synchronous, it is advised to call it only on local files. See
isLocal(). -
getCompressionType
-
getEncoding
The encoding is initiallynull. After a successful file loading or saving operation, the encoding is non-null.- Returns:
- the character encoding.
-
getLocation
-
getNewlineType
-
isDeleted
public boolean isDeleted()Returns whether the file has been deleted. If the
File:locationisnull, returnsfalse.To have an up-to-date value, you must first call
checkFileOnDisk().- Returns:
- whether the file has been deleted.
-
isExternallyModified
public boolean isExternallyModified()Returns whether the file is externally modified. If the
File:locationisnull, returnsfalse.To have an up-to-date value, you must first call
checkFileOnDisk().- Returns:
- whether the file is externally modified.
-
isLocal
public boolean isLocal()Returns whether the file is local. If theFile:locationisnull, returnsfalse.- Returns:
- whether the file is local.
-
isReadonly
public boolean isReadonly()Returns whether the file is read-only. If the
File:locationisnull, returnsfalse.To have an up-to-date value, you must first call
checkFileOnDisk().- Returns:
- whether the file is read-only.
-
setLocation
Sets the location.- Parameters:
location- the newGFile, ornull.
-
setMountOperationFactory
Sets a
MountOperationFactoryfunction that will be called when aMountOperationmust be created.This is useful for creating a
MountOperationwith the parentWindow.If a mount operation factory isn't set,
MountOperation()will be called.- Parameters:
callback- aGtkSourceMountOperationFactoryto call when aGMountOperationis needed.
-
builder
AFile.Builderobject constructs aFilewith the specified properties. Use the variousset...()methods to set properties, and finish construction withFile.Builder.build().- Returns:
- the builder object
-