/*
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*/
import './gio-2.0-ambient.d.ts';
import './gio-2.0-import.d.ts';
/**
* Gio-2.0
*/
import type GObject from '@girs/gobject-2.0';
import type GLib from '@girs/glib-2.0';
/**
* An enumeration for well-known message buses.
*/
export enum BusType {
/**
* An alias for the message bus that activated the process, if any.
*/
STARTER,
/**
* Not a message bus.
*/
NONE,
/**
* The system-wide message bus.
*/
SYSTEM,
/**
* The login session message bus.
*/
SESSION,
}
/**
* Results returned from g_converter_convert().
*/
export enum ConverterResult {
/**
* There was an error during conversion.
*/
ERROR,
/**
* Some data was consumed or produced
*/
CONVERTED,
/**
* The conversion is finished
*/
FINISHED,
/**
* Flushing is finished
*/
FLUSHED,
}
/**
* Enumeration describing different kinds of native credential types.
*/
export enum CredentialsType {
/**
* Indicates an invalid native credential type.
*/
INVALID,
/**
* The native credentials type is a `struct ucred`.
*/
LINUX_UCRED,
/**
* The native credentials type is a `struct cmsgcred`.
*/
FREEBSD_CMSGCRED,
/**
* The native credentials type is a `struct sockpeercred`. Added in 2.30.
*/
OPENBSD_SOCKPEERCRED,
/**
* The native credentials type is a `ucred_t`. Added in 2.40.
*/
SOLARIS_UCRED,
/**
* The native credentials type is a `struct unpcbid`. Added in 2.42.
*/
NETBSD_UNPCBID,
/**
* The native credentials type is a `struct xucred`. Added in 2.66.
*/
APPLE_XUCRED,
/**
* The native credentials type is a PID `DWORD`. Added in 2.72.
*/
WIN32_PID,
}
/**
* Error codes for the %G_DBUS_ERROR error domain.
*/
export enum DBusError {
/**
* A generic error; "something went wrong" - see the error message for
* more.
*/
FAILED,
/**
* There was not enough memory to complete an operation.
*/
NO_MEMORY,
/**
* The bus doesn't know how to launch a service to supply the bus name
* you wanted.
*/
SERVICE_UNKNOWN,
/**
* The bus name you referenced doesn't exist (i.e. no application owns
* it).
*/
NAME_HAS_NO_OWNER,
/**
* No reply to a message expecting one, usually means a timeout occurred.
*/
NO_REPLY,
/**
* Something went wrong reading or writing to a socket, for example.
*/
IO_ERROR,
/**
* A D-Bus bus address was malformed.
*/
BAD_ADDRESS,
/**
* Requested operation isn't supported (like ENOSYS on UNIX).
*/
NOT_SUPPORTED,
/**
* Some limited resource is exhausted.
*/
LIMITS_EXCEEDED,
/**
* Security restrictions don't allow doing what you're trying to do.
*/
ACCESS_DENIED,
/**
* Authentication didn't work.
*/
AUTH_FAILED,
/**
* Unable to connect to server (probably caused by ECONNREFUSED on a
* socket).
*/
NO_SERVER,
/**
* Certain timeout errors, possibly ETIMEDOUT on a socket. Note that
* %G_DBUS_ERROR_NO_REPLY is used for message reply timeouts. Warning:
* this is confusingly-named given that %G_DBUS_ERROR_TIMED_OUT also
* exists. We can't fix it for compatibility reasons so just be
* careful.
*/
TIMEOUT,
/**
* No network access (probably ENETUNREACH on a socket).
*/
NO_NETWORK,
/**
* Can't bind a socket since its address is in use (i.e. EADDRINUSE).
*/
ADDRESS_IN_USE,
/**
* The connection is disconnected and you're trying to use it.
*/
DISCONNECTED,
/**
* Invalid arguments passed to a method call.
*/
INVALID_ARGS,
/**
* Missing file.
*/
FILE_NOT_FOUND,
/**
* Existing file and the operation you're using does not silently overwrite.
*/
FILE_EXISTS,
/**
* Method name you invoked isn't known by the object you invoked it on.
*/
UNKNOWN_METHOD,
/**
* Certain timeout errors, e.g. while starting a service. Warning: this is
* confusingly-named given that %G_DBUS_ERROR_TIMEOUT also exists. We
* can't fix it for compatibility reasons so just be careful.
*/
TIMED_OUT,
/**
* Tried to remove or modify a match rule that didn't exist.
*/
MATCH_RULE_NOT_FOUND,
/**
* The match rule isn't syntactically valid.
*/
MATCH_RULE_INVALID,
/**
* While starting a new process, the exec() call failed.
*/
SPAWN_EXEC_FAILED,
/**
* While starting a new process, the fork() call failed.
*/
SPAWN_FORK_FAILED,
/**
* While starting a new process, the child exited with a status code.
*/
SPAWN_CHILD_EXITED,
/**
* While starting a new process, the child exited on a signal.
*/
SPAWN_CHILD_SIGNALED,
/**
* While starting a new process, something went wrong.
*/
SPAWN_FAILED,
/**
* We failed to setup the environment correctly.
*/
SPAWN_SETUP_FAILED,
/**
* We failed to setup the config parser correctly.
*/
SPAWN_CONFIG_INVALID,
/**
* Bus name was not valid.
*/
SPAWN_SERVICE_INVALID,
/**
* Service file not found in system-services directory.
*/
SPAWN_SERVICE_NOT_FOUND,
/**
* Permissions are incorrect on the setuid helper.
*/
SPAWN_PERMISSIONS_INVALID,
/**
* Service file invalid (Name, User or Exec missing).
*/
SPAWN_FILE_INVALID,
/**
* Tried to get a UNIX process ID and it wasn't available.
*/
SPAWN_NO_MEMORY,
/**
* Tried to get a UNIX process ID and it wasn't available.
*/
UNIX_PROCESS_ID_UNKNOWN,
/**
* A type signature is not valid.
*/
INVALID_SIGNATURE,
/**
* A file contains invalid syntax or is otherwise broken.
*/
INVALID_FILE_CONTENT,
/**
* Asked for SELinux security context and it wasn't available.
*/
SELINUX_SECURITY_CONTEXT_UNKNOWN,
/**
* Asked for ADT audit data and it wasn't available.
*/
ADT_AUDIT_DATA_UNKNOWN,
/**
* There's already an object with the requested object path.
*/
OBJECT_PATH_IN_USE,
/**
* Object you invoked a method on isn't known. Since 2.42
*/
UNKNOWN_OBJECT,
/**
* Interface you invoked a method on isn't known by the object. Since 2.42
*/
UNKNOWN_INTERFACE,
/**
* Property you tried to access isn't known by the object. Since 2.42
*/
UNKNOWN_PROPERTY,
/**
* Property you tried to set is read-only. Since 2.42
*/
PROPERTY_READ_ONLY,
}
/**
* Enumeration used to describe the byte order of a D-Bus message.
*/
export enum DBusMessageByteOrder {
/**
* The byte order is big endian.
*/
BIG_ENDIAN,
/**
* The byte order is little endian.
*/
LITTLE_ENDIAN,
}
/**
* Header fields used in #GDBusMessage.
*/
export enum DBusMessageHeaderField {
/**
* Not a valid header field.
*/
INVALID,
/**
* The object path.
*/
PATH,
/**
* The interface name.
*/
INTERFACE,
/**
* The method or signal name.
*/
MEMBER,
/**
* The name of the error that occurred.
*/
ERROR_NAME,
/**
* The serial number the message is a reply to.
*/
REPLY_SERIAL,
/**
* The name the message is intended for.
*/
DESTINATION,
/**
* Unique name of the sender of the message (filled in by the bus).
*/
SENDER,
/**
* The signature of the message body.
*/
SIGNATURE,
/**
* The number of UNIX file descriptors that accompany the message.
*/
NUM_UNIX_FDS,
}
/**
* Message types used in #GDBusMessage.
*/
export enum DBusMessageType {
/**
* Message is of invalid type.
*/
INVALID,
/**
* Method call.
*/
METHOD_CALL,
/**
* Method reply.
*/
METHOD_RETURN,
/**
* Error reply.
*/
ERROR,
/**
* Signal emission.
*/
SIGNAL,
}
/**
* #GDataStreamByteOrder is used to ensure proper endianness of streaming data sources
* across various machine architectures.
*/
export enum DataStreamByteOrder {
/**
* Selects Big Endian byte order.
*/
BIG_ENDIAN,
/**
* Selects Little Endian byte order.
*/
LITTLE_ENDIAN,
/**
* Selects endianness based on host machine's architecture.
*/
HOST_ENDIAN,
}
/**
* #GDataStreamNewlineType is used when checking for or setting the line endings for a given file.
*/
export enum DataStreamNewlineType {
/**
* Selects "LF" line endings, common on most modern UNIX platforms.
*/
LF,
/**
* Selects "CR" line endings.
*/
CR,
/**
* Selects "CR, LF" line ending, common on Microsoft Windows.
*/
CR_LF,
/**
* Automatically try to handle any line ending type.
*/
ANY,
}
/**
* Enumeration describing how a drive can be started/stopped.
*/
export enum DriveStartStopType {
/**
* Unknown or drive doesn't support
* start/stop.
*/
UNKNOWN,
/**
* The stop method will physically
* shut down the drive and e.g. power down the port the drive is
* attached to.
*/
SHUTDOWN,
/**
* The start/stop methods are used
* for connecting/disconnect to the drive over the network.
*/
NETWORK,
/**
* The start/stop methods will
* assemble/disassemble a virtual drive from several physical
* drives.
*/
MULTIDISK,
/**
* The start/stop methods will
* unlock/lock the disk (for example using the ATA SECURITY
* UNLOCK DEVICE
command)
*/
PASSWORD,
}
/**
* GEmblemOrigin is used to add information about the origin of the emblem
* to #GEmblem.
*/
export enum EmblemOrigin {
/**
* Emblem of unknown origin
*/
UNKNOWN,
/**
* Emblem adds device-specific information
*/
DEVICE,
/**
* Emblem depicts live metadata, such as "readonly"
*/
LIVEMETADATA,
/**
* Emblem comes from a user-defined tag, e.g. set by nautilus (in the future)
*/
TAG,
}
/**
* Used by g_file_set_attributes_from_info() when setting file attributes.
*/
export enum FileAttributeStatus {
/**
* Attribute value is unset (empty).
*/
UNSET,
/**
* Attribute value is set.
*/
SET,
/**
* Indicates an error in setting the value.
*/
ERROR_SETTING,
}
/**
* The data types for file attributes.
*/
export enum FileAttributeType {
/**
* indicates an invalid or uninitialized type.
*/
INVALID,
/**
* a null terminated UTF8 string.
*/
STRING,
/**
* a zero terminated string of non-zero bytes.
*/
BYTE_STRING,
/**
* a boolean value.
*/
BOOLEAN,
/**
* an unsigned 4-byte/32-bit integer.
*/
UINT32,
/**
* a signed 4-byte/32-bit integer.
*/
INT32,
/**
* an unsigned 8-byte/64-bit integer.
*/
UINT64,
/**
* a signed 8-byte/64-bit integer.
*/
INT64,
/**
* a #GObject.
*/
OBJECT,
/**
* a %NULL terminated char **. Since 2.22
*/
STRINGV,
}
/**
* Specifies what type of event a monitor event is.
*/
export enum FileMonitorEvent {
/**
* a file changed.
*/
CHANGED,
/**
* a hint that this was probably the last change in a set of changes.
*/
CHANGES_DONE_HINT,
/**
* a file was deleted.
*/
DELETED,
/**
* a file was created.
*/
CREATED,
/**
* a file attribute was changed.
*/
ATTRIBUTE_CHANGED,
/**
* the file location will soon be unmounted.
*/
PRE_UNMOUNT,
/**
* the file location was unmounted.
*/
UNMOUNTED,
/**
* the file was moved -- only sent if the
* (deprecated) %G_FILE_MONITOR_SEND_MOVED flag is set
*/
MOVED,
/**
* the file was renamed within the
* current directory -- only sent if the %G_FILE_MONITOR_WATCH_MOVES
* flag is set. Since: 2.46.
*/
RENAMED,
/**
* the file was moved into the
* monitored directory from another location -- only sent if the
* %G_FILE_MONITOR_WATCH_MOVES flag is set. Since: 2.46.
*/
MOVED_IN,
/**
* the file was moved out of the
* monitored directory to another location -- only sent if the
* %G_FILE_MONITOR_WATCH_MOVES flag is set. Since: 2.46
*/
MOVED_OUT,
}
/**
* Indicates the file's on-disk type.
*
* On Windows systems a file will never have %G_FILE_TYPE_SYMBOLIC_LINK type;
* use #GFileInfo and %G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK to determine
* whether a file is a symlink or not. This is due to the fact that NTFS does
* not have a single filesystem object type for symbolic links - it has
* files that symlink to files, and directories that symlink to directories.
* #GFileType enumeration cannot precisely represent this important distinction,
* which is why all Windows symlinks will continue to be reported as
* %G_FILE_TYPE_REGULAR or %G_FILE_TYPE_DIRECTORY.
*/
export enum FileType {
/**
* File's type is unknown.
*/
UNKNOWN,
/**
* File handle represents a regular file.
*/
REGULAR,
/**
* File handle represents a directory.
*/
DIRECTORY,
/**
* File handle represents a symbolic link
* (Unix systems).
*/
SYMBOLIC_LINK,
/**
* File is a "special" file, such as a socket, fifo,
* block device, or character device.
*/
SPECIAL,
/**
* File is a shortcut (Windows systems).
*/
SHORTCUT,
/**
* File is a mountable location.
*/
MOUNTABLE,
}
/**
* Indicates a hint from the file system whether files should be
* previewed in a file manager. Returned as the value of the key
* %G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW.
*/
export enum FilesystemPreviewType {
/**
* Only preview files if user has explicitly requested it.
*/
IF_ALWAYS,
/**
* Preview files if user has requested preview of "local" files.
*/
IF_LOCAL,
/**
* Never preview files.
*/
NEVER,
}
/**
* Error codes returned by GIO functions.
*
* Note that this domain may be extended in future GLib releases. In
* general, new error codes either only apply to new APIs, or else
* replace %G_IO_ERROR_FAILED in cases that were not explicitly
* distinguished before. You should therefore avoid writing code like
*
* ```c
* if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_FAILED))
* {
* // Assume that this is EPRINTERONFIRE
* ...
* }
* ```
*
* but should instead treat all unrecognized error codes the same as
* %G_IO_ERROR_FAILED.
*
* See also #GPollableReturn for a cheaper way of returning
* %G_IO_ERROR_WOULD_BLOCK to callers without allocating a #GError.
*/
export enum IOErrorEnum {
/**
* Generic error condition for when an operation fails
* and no more specific #GIOErrorEnum value is defined.
*/
FAILED,
/**
* File not found.
*/
NOT_FOUND,
/**
* File already exists.
*/
EXISTS,
/**
* File is a directory.
*/
IS_DIRECTORY,
/**
* File is not a directory.
*/
NOT_DIRECTORY,
/**
* File is a directory that isn't empty.
*/
NOT_EMPTY,
/**
* File is not a regular file.
*/
NOT_REGULAR_FILE,
/**
* File is not a symbolic link.
*/
NOT_SYMBOLIC_LINK,
/**
* File cannot be mounted.
*/
NOT_MOUNTABLE_FILE,
/**
* Filename is too many characters.
*/
FILENAME_TOO_LONG,
/**
* Filename is invalid or contains invalid characters.
*/
INVALID_FILENAME,
/**
* File contains too many symbolic links.
*/
TOO_MANY_LINKS,
/**
* No space left on drive.
*/
NO_SPACE,
/**
* Invalid argument.
*/
INVALID_ARGUMENT,
/**
* Permission denied.
*/
PERMISSION_DENIED,
/**
* Operation (or one of its parameters) not supported
*/
NOT_SUPPORTED,
/**
* File isn't mounted.
*/
NOT_MOUNTED,
/**
* File is already mounted.
*/
ALREADY_MOUNTED,
/**
* File was closed.
*/
CLOSED,
/**
* Operation was cancelled. See #GCancellable.
*/
CANCELLED,
/**
* Operations are still pending.
*/
PENDING,
/**
* File is read only.
*/
READ_ONLY,
/**
* Backup couldn't be created.
*/
CANT_CREATE_BACKUP,
/**
* File's Entity Tag was incorrect.
*/
WRONG_ETAG,
/**
* Operation timed out.
*/
TIMED_OUT,
/**
* Operation would be recursive.
*/
WOULD_RECURSE,
/**
* File is busy.
*/
BUSY,
/**
* Operation would block.
*/
WOULD_BLOCK,
/**
* Host couldn't be found (remote operations).
*/
HOST_NOT_FOUND,
/**
* Operation would merge files.
*/
WOULD_MERGE,
/**
* Operation failed and a helper program has
* already interacted with the user. Do not display any error dialog.
*/
FAILED_HANDLED,
/**
* The current process has too many files
* open and can't open any more. Duplicate descriptors do count toward
* this limit. Since 2.20
*/
TOO_MANY_OPEN_FILES,
/**
* The object has not been initialized. Since 2.22
*/
NOT_INITIALIZED,
/**
* The requested address is already in use. Since 2.22
*/
ADDRESS_IN_USE,
/**
* Need more input to finish operation. Since 2.24
*/
PARTIAL_INPUT,
/**
* The input data was invalid. Since 2.24
*/
INVALID_DATA,
/**
* A remote object generated an error that
* doesn't correspond to a locally registered #GError error
* domain. Use g_dbus_error_get_remote_error() to extract the D-Bus
* error name and g_dbus_error_strip_remote_error() to fix up the
* message so it matches what was received on the wire. Since 2.26.
*/
DBUS_ERROR,
/**
* Host unreachable. Since 2.26
*/
HOST_UNREACHABLE,
/**
* Network unreachable. Since 2.26
*/
NETWORK_UNREACHABLE,
/**
* Connection refused. Since 2.26
*/
CONNECTION_REFUSED,
/**
* Connection to proxy server failed. Since 2.26
*/
PROXY_FAILED,
/**
* Proxy authentication failed. Since 2.26
*/
PROXY_AUTH_FAILED,
/**
* Proxy server needs authentication. Since 2.26
*/
PROXY_NEED_AUTH,
/**
* Proxy connection is not allowed by ruleset.
* Since 2.26
*/
PROXY_NOT_ALLOWED,
/**
* Broken pipe. Since 2.36
*/
BROKEN_PIPE,
/**
* Connection closed by peer. Note that this
* is the same code as %G_IO_ERROR_BROKEN_PIPE; before 2.44 some
* "connection closed" errors returned %G_IO_ERROR_BROKEN_PIPE, but others
* returned %G_IO_ERROR_FAILED. Now they should all return the same
* value, which has this more logical name. Since 2.44.
*/
CONNECTION_CLOSED,
/**
* Transport endpoint is not connected. Since 2.44
*/
NOT_CONNECTED,
/**
* Message too large. Since 2.48.
*/
MESSAGE_TOO_LARGE,
/**
* No such device found. Since 2.74
*/
NO_SUCH_DEVICE,
}
/**
* Flags for use with g_io_module_scope_new().
*/
export enum IOModuleScopeFlags {
/**
* No module scan flags
*/
NONE,
/**
* When using this scope to load or
* scan modules, automatically block a modules which has the same base
* basename as previously loaded module.
*/
BLOCK_DUPLICATES,
}
/**
* Memory availability warning levels.
*
* Note that because new values might be added, it is recommended that applications check
* #GMemoryMonitorWarningLevel as ranges, for example:
*
* ```c
* if (warning_level > G_MEMORY_MONITOR_WARNING_LEVEL_LOW)
* drop_caches ();
* ```
*
*/
export enum MemoryMonitorWarningLevel {
/**
* Memory on the device is low, processes
* should free up unneeded resources (for example, in-memory caches) so they can
* be used elsewhere.
*/
LOW,
/**
* Same as `G_MEMORY_MONITOR_WARNING_LEVEL_LOW`
* but the device has even less free memory, so processes should try harder to free
* up unneeded resources. If your process does not need to stay running, it is a
* good time for it to quit.
*/
MEDIUM,
/**
* The system will soon start terminating
* processes to reclaim memory, including background processes.
*/
CRITICAL,
}
/**
* #GMountOperationResult is returned as a result when a request for
* information is send by the mounting operation.
*/
export enum MountOperationResult {
/**
* The request was fulfilled and the
* user specified data is now available
*/
HANDLED,
/**
* The user requested the mount operation
* to be aborted
*/
ABORTED,
/**
* The request was unhandled (i.e. not
* implemented)
*/
UNHANDLED,
}
/**
* The host's network connectivity state, as reported by #GNetworkMonitor.
*/
export enum NetworkConnectivity {
/**
* The host is not configured with a
* route to the Internet; it may or may not be connected to a local
* network.
*/
LOCAL,
/**
* The host is connected to a network, but
* does not appear to be able to reach the full Internet, perhaps
* due to upstream network problems.
*/
LIMITED,
/**
* The host is behind a captive portal and
* cannot reach the full Internet.
*/
PORTAL,
/**
* The host is connected to a network, and
* appears to be able to reach the full Internet.
*/
FULL,
}
/**
* Priority levels for #GNotifications.
*/
export enum NotificationPriority {
/**
* the default priority, to be used for the
* majority of notifications (for example email messages, software updates,
* completed download/sync operations)
*/
NORMAL,
/**
* for notifications that do not require
* immediate attention - typically used for contextual background
* information, such as contact birthdays or local weather
*/
LOW,
/**
* for events that require more attention,
* usually because responses are time-sensitive (for example chat and SMS
* messages or alarms)
*/
HIGH,
/**
* for urgent notifications, or notifications
* that require a response in a short space of time (for example phone calls
* or emergency warnings)
*/
URGENT,
}
/**
* #GPasswordSave is used to indicate the lifespan of a saved password.
*
* #Gvfs stores passwords in the Gnome keyring when this flag allows it
* to, and later retrieves it again from there.
*/
export enum PasswordSave {
/**
* never save a password.
*/
NEVER,
/**
* save a password for the session.
*/
FOR_SESSION,
/**
* save a password permanently.
*/
PERMANENTLY,
}
/**
* Return value for various IO operations that signal errors via the
* return value and not necessarily via a #GError.
*
* This enum exists to be able to return errors to callers without having to
* allocate a #GError. Allocating #GErrors can be quite expensive for
* regularly happening errors like %G_IO_ERROR_WOULD_BLOCK.
*
* In case of %G_POLLABLE_RETURN_FAILED a #GError should be set for the
* operation to give details about the error that happened.
*/
export enum PollableReturn {
/**
* Generic error condition for when an operation fails.
*/
FAILED,
/**
* The operation was successfully finished.
*/
OK,
/**
* The operation would block.
*/
WOULD_BLOCK,
}
/**
* An error code used with %G_RESOLVER_ERROR in a #GError returned
* from a #GResolver routine.
*/
export enum ResolverError {
/**
* the requested name/address/service was not
* found
*/
NOT_FOUND,
/**
* the requested information could not
* be looked up due to a network error or similar problem
*/
TEMPORARY_FAILURE,
/**
* unknown error
*/
INTERNAL,
}
/**
* The type of record that g_resolver_lookup_records() or
* g_resolver_lookup_records_async() should retrieve. The records are returned
* as lists of #GVariant tuples. Each record type has different values in
* the variant tuples returned.
*
* %G_RESOLVER_RECORD_SRV records are returned as variants with the signature
* `(qqqs)`, containing a `guint16` with the priority, a `guint16` with the
* weight, a `guint16` with the port, and a string of the hostname.
*
* %G_RESOLVER_RECORD_MX records are returned as variants with the signature
* `(qs)`, representing a `guint16` with the preference, and a string containing
* the mail exchanger hostname.
*
* %G_RESOLVER_RECORD_TXT records are returned as variants with the signature
* `(as)`, representing an array of the strings in the text record. Note: Most TXT
* records only contain a single string, but
* [RFC 1035](https://tools.ietf.org/html/rfc1035#section-3.3.14) does allow a
* record to contain multiple strings. The RFC which defines the interpretation
* of a specific TXT record will likely require concatenation of multiple
* strings if they are present, as with
* [RFC 7208](https://tools.ietf.org/html/rfc7208#section-3.3).
*
* %G_RESOLVER_RECORD_SOA records are returned as variants with the signature
* `(ssuuuuu)`, representing a string containing the primary name server, a
* string containing the administrator, the serial as a `guint32`, the refresh
* interval as a `guint32`, the retry interval as a `guint32`, the expire timeout
* as a `guint32`, and the TTL as a `guint32`.
*
* %G_RESOLVER_RECORD_NS records are returned as variants with the signature
* `(s)`, representing a string of the hostname of the name server.
*/
export enum ResolverRecordType {
/**
* look up DNS SRV records for a domain
*/
SRV,
/**
* look up DNS MX records for a domain
*/
MX,
/**
* look up DNS TXT records for a name
*/
TXT,
/**
* look up DNS SOA records for a zone
*/
SOA,
/**
* look up DNS NS records for a domain
*/
NS,
}
/**
* An error code used with %G_RESOURCE_ERROR in a #GError returned
* from a #GResource routine.
*/
export enum ResourceError {
/**
* no file was found at the requested path
*/
NOT_FOUND,
/**
* unknown error
*/
INTERNAL,
}
/**
* Describes an event occurring on a #GSocketClient. See the
* #GSocketClient::event signal for more details.
*
* Additional values may be added to this type in the future.
*/
export enum SocketClientEvent {
/**
* The client is doing a DNS lookup.
*/
RESOLVING,
/**
* The client has completed a DNS lookup.
*/
RESOLVED,
/**
* The client is connecting to a remote
* host (either a proxy or the destination server).
*/
CONNECTING,
/**
* The client has connected to a remote
* host.
*/
CONNECTED,
/**
* The client is negotiating
* with a proxy to connect to the destination server.
*/
PROXY_NEGOTIATING,
/**
* The client has negotiated
* with the proxy server.
*/
PROXY_NEGOTIATED,
/**
* The client is performing a
* TLS handshake.
*/
TLS_HANDSHAKING,
/**
* The client has performed a
* TLS handshake.
*/
TLS_HANDSHAKED,
/**
* The client is done with a particular
* #GSocketConnectable.
*/
COMPLETE,
}
/**
* The protocol family of a #GSocketAddress. (These values are
* identical to the system defines %AF_INET, %AF_INET6 and %AF_UNIX,
* if available.)
*/
export enum SocketFamily {
/**
* no address family
*/
INVALID,
/**
* the UNIX domain family
*/
UNIX,
/**
* the IPv4 family
*/
IPV4,
/**
* the IPv6 family
*/
IPV6,
}
/**
* Describes an event occurring on a #GSocketListener. See the
* #GSocketListener::event signal for more details.
*
* Additional values may be added to this type in the future.
*/
export enum SocketListenerEvent {
/**
* The listener is about to bind a socket.
*/
BINDING,
/**
* The listener has bound a socket.
*/
BOUND,
/**
* The listener is about to start
* listening on this socket.
*/
LISTENING,
/**
* The listener is now listening on
* this socket.
*/
LISTENED,
}
/**
* A protocol identifier is specified when creating a #GSocket, which is a
* family/type specific identifier, where 0 means the default protocol for
* the particular family/type.
*
* This enum contains a set of commonly available and used protocols. You
* can also pass any other identifiers handled by the platform in order to
* use protocols not listed here.
*/
export enum SocketProtocol {
/**
* The protocol type is unknown
*/
UNKNOWN,
/**
* The default protocol for the family/type
*/
DEFAULT,
/**
* TCP over IP
*/
TCP,
/**
* UDP over IP
*/
UDP,
/**
* SCTP over IP
*/
SCTP,
}
/**
* Flags used when creating a #GSocket. Some protocols may not implement
* all the socket types.
*/
export enum SocketType {
/**
* Type unknown or wrong
*/
INVALID,
/**
* Reliable connection-based byte streams (e.g. TCP).
*/
STREAM,
/**
* Connectionless, unreliable datagram passing.
* (e.g. UDP)
*/
DATAGRAM,
/**
* Reliable connection-based passing of datagrams
* of fixed maximum length (e.g. SCTP).
*/
SEQPACKET,
}
/**
* The client authentication mode for a #GTlsServerConnection.
*/
export enum TlsAuthenticationMode {
/**
* client authentication not required
*/
NONE,
/**
* client authentication is requested
*/
REQUESTED,
/**
* client authentication is required
*/
REQUIRED,
}
/**
* Flags for g_tls_interaction_request_certificate(),
* g_tls_interaction_request_certificate_async(), and
* g_tls_interaction_invoke_request_certificate().
*/
export enum TlsCertificateRequestFlags {
/**
* No flags
*/
NONE,
}
/**
* An error code used with %G_TLS_CHANNEL_BINDING_ERROR in a #GError to
* indicate a TLS channel binding retrieval error.
*/
export enum TlsChannelBindingError {
/**
* Either entire binding
* retrieval facility or specific binding type is not implemented in the
* TLS backend.
*/
NOT_IMPLEMENTED,
/**
* The handshake is not yet
* complete on the connection which is a strong requirement for any existing
* binding type.
*/
INVALID_STATE,
/**
* Handshake is complete but
* binding data is not available. That normally indicates the TLS
* implementation failed to provide the binding data. For example, some
* implementations do not provide a peer certificate for resumed connections.
*/
NOT_AVAILABLE,
/**
* Binding type is not supported
* on the current connection. This error could be triggered when requesting
* `tls-server-end-point` binding data for a certificate which has no hash
* function or uses multiple hash functions.
*/
NOT_SUPPORTED,
/**
* Any other backend error
* preventing binding data retrieval.
*/
GENERAL_ERROR,
}
/**
* The type of TLS channel binding data to retrieve from #GTlsConnection
* or #GDtlsConnection, as documented by RFC 5929 or RFC 9266. The
* [`tls-unique-for-telnet`](https://tools.ietf.org/html/rfc5929#section-5)
* binding type is not currently implemented.
*/
export enum TlsChannelBindingType {
/**
* [`tls-unique`](https://tools.ietf.org/html/rfc5929#section-3) binding
* type
*/
UNIQUE,
/**
* [`tls-server-end-point`](https://tools.ietf.org/html/rfc5929#section-4)
* binding type
*/
SERVER_END_POINT,
/**
* [`tls-exporter`](https://www.rfc-editor.org/rfc/rfc9266.html) binding
* type. Since: 2.74
*/
EXPORTER,
}
/**
* Flags for g_tls_database_lookup_certificate_for_handle(),
* g_tls_database_lookup_certificate_issuer(),
* and g_tls_database_lookup_certificates_issued_by().
*/
export enum TlsDatabaseLookupFlags {
/**
* No lookup flags
*/
NONE,
/**
* Restrict lookup to certificates that have
* a private key.
*/
KEYPAIR,
}
/**
* An error code used with %G_TLS_ERROR in a #GError returned from a
* TLS-related routine.
*/
export enum TlsError {
/**
* No TLS provider is available
*/
UNAVAILABLE,
/**
* Miscellaneous TLS error
*/
MISC,
/**
* The certificate presented could not
* be parsed or failed validation.
*/
BAD_CERTIFICATE,
/**
* The TLS handshake failed because the
* peer does not seem to be a TLS server.
*/
NOT_TLS,
/**
* The TLS handshake failed because the
* peer's certificate was not acceptable.
*/
HANDSHAKE,
/**
* The TLS handshake failed because
* the server requested a client-side certificate, but none was
* provided. See g_tls_connection_set_certificate().
*/
CERTIFICATE_REQUIRED,
/**
* The TLS connection was closed without proper
* notice, which may indicate an attack. See
* g_tls_connection_set_require_close_notify().
*/
EOF,
/**
* The TLS handshake failed
* because the client sent the fallback SCSV, indicating a protocol
* downgrade attack. Since: 2.60
*/
INAPPROPRIATE_FALLBACK,
/**
* The certificate failed
* to load because a password was incorrect. Since: 2.72
*/
BAD_CERTIFICATE_PASSWORD,
}
/**
* #GTlsInteractionResult is returned by various functions in #GTlsInteraction
* when finishing an interaction request.
*/
export enum TlsInteractionResult {
/**
* The interaction was unhandled (i.e. not
* implemented).
*/
UNHANDLED,
/**
* The interaction completed, and resulting data
* is available.
*/
HANDLED,
/**
* The interaction has failed, or was cancelled.
* and the operation should be aborted.
*/
FAILED,
}
/**
* The TLS or DTLS protocol version used by a #GTlsConnection or
* #GDtlsConnection. The integer values of these versions are sequential
* to ensure newer known protocol versions compare greater than older
* known versions. Any known DTLS protocol version will compare greater
* than any SSL or TLS protocol version. The protocol version may be
* %G_TLS_PROTOCOL_VERSION_UNKNOWN if the TLS backend supports a newer
* protocol version that GLib does not yet know about. This means that
* it's possible for an unknown DTLS protocol version to compare less
* than the TLS protocol versions.
*/
export enum TlsProtocolVersion {
/**
* No protocol version or unknown protocol version
*/
UNKNOWN,
/**
* SSL 3.0, which is insecure and should not be used
*/
SSL_3_0,
/**
* TLS 1.0, which is insecure and should not be used
*/
TLS_1_0,
/**
* TLS 1.1, which is insecure and should not be used
*/
TLS_1_1,
/**
* TLS 1.2, defined by [RFC 5246](https://datatracker.ietf.org/doc/html/rfc5246)
*/
TLS_1_2,
/**
* TLS 1.3, defined by [RFC 8446](https://datatracker.ietf.org/doc/html/rfc8446)
*/
TLS_1_3,
/**
* DTLS 1.0, which is insecure and should not be used
*/
DTLS_1_0,
/**
* DTLS 1.2, defined by [RFC 6347](https://datatracker.ietf.org/doc/html/rfc6347)
*/
DTLS_1_2,
}
/**
* When to allow rehandshaking. See
* g_tls_connection_set_rehandshake_mode().
*/
export enum TlsRehandshakeMode {
/**
* Never allow rehandshaking
*/
NEVER,
/**
* Allow safe rehandshaking only
*/
SAFELY,
/**
* Allow unsafe rehandshaking
*/
UNSAFELY,
}
/**
* The type of name used by a #GUnixSocketAddress.
* %G_UNIX_SOCKET_ADDRESS_PATH indicates a traditional unix domain
* socket bound to a filesystem path. %G_UNIX_SOCKET_ADDRESS_ANONYMOUS
* indicates a socket not bound to any name (eg, a client-side socket,
* or a socket created with socketpair()).
*
* For abstract sockets, there are two incompatible ways of naming
* them; the man pages suggest using the entire `struct sockaddr_un`
* as the name, padding the unused parts of the %sun_path field with
* zeroes; this corresponds to %G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED.
* However, many programs instead just use a portion of %sun_path, and
* pass an appropriate smaller length to bind() or connect(). This is
* %G_UNIX_SOCKET_ADDRESS_ABSTRACT.
*/
export enum UnixSocketAddressType {
/**
* invalid
*/
INVALID,
/**
* anonymous
*/
ANONYMOUS,
/**
* a filesystem path
*/
PATH,
/**
* an abstract name
*/
ABSTRACT,
/**
* an abstract name, 0-padded
* to the full length of a unix socket name
*/
ABSTRACT_PADDED,
}
/**
* Used to select the type of data format to use for #GZlibDecompressor
* and #GZlibCompressor.
*/
export enum ZlibCompressorFormat {
/**
* deflate compression with zlib header
*/
ZLIB,
/**
* gzip file format
*/
GZIP,
/**
* deflate compression with no header
*/
RAW,
}
/**
* Flags used when creating a #GAppInfo.
* @bitfield
*/
export enum AppInfoCreateFlags {
/**
* No flags.
*/
NONE,
/**
* Application opens in a terminal window.
*/
NEEDS_TERMINAL,
/**
* Application supports URI arguments.
*/
SUPPORTS_URIS,
/**
* Application supports startup notification. Since 2.26
*/
SUPPORTS_STARTUP_NOTIFICATION,
}
/**
* Flags used to define the behaviour of a #GApplication.
* @bitfield
*/
export enum ApplicationFlags {
/**
* Default. Deprecated in 2.74, use
* %G_APPLICATION_DEFAULT_FLAGS instead
*/
FLAGS_NONE,
/**
* Default flags. Since: 2.74
*/
DEFAULT_FLAGS,
/**
* Run as a service. In this mode, registration
* fails if the service is already running, and the application
* will initially wait up to 10 seconds for an initial activation
* message to arrive.
*/
IS_SERVICE,
/**
* Don't try to become the primary instance.
*/
IS_LAUNCHER,
/**
* This application handles opening files (in
* the primary instance). Note that this flag only affects the default
* implementation of local_command_line(), and has no effect if
* %G_APPLICATION_HANDLES_COMMAND_LINE is given.
* See g_application_run() for details.
*/
HANDLES_OPEN,
/**
* This application handles command line
* arguments (in the primary instance). Note that this flag only affect
* the default implementation of local_command_line().
* See g_application_run() for details.
*/
HANDLES_COMMAND_LINE,
/**
* Send the environment of the
* launching process to the primary instance. Set this flag if your
* application is expected to behave differently depending on certain
* environment variables. For instance, an editor might be expected
* to use the `GIT_COMMITTER_NAME` environment variable
* when editing a git commit message. The environment is available
* to the #GApplication::command-line signal handler, via
* g_application_command_line_getenv().
*/
SEND_ENVIRONMENT,
/**
* Make no attempts to do any of the typical
* single-instance application negotiation, even if the application
* ID is given. The application neither attempts to become the
* owner of the application ID nor does it check if an existing
* owner already exists. Everything occurs in the local process.
* Since: 2.30.
*/
NON_UNIQUE,
/**
* Allow users to override the
* application ID from the command line with `--gapplication-app-id`.
* Since: 2.48
*/
CAN_OVERRIDE_APP_ID,
/**
* Allow another instance to take over
* the bus name. Since: 2.60
*/
ALLOW_REPLACEMENT,
/**
* Take over from another instance. This flag is
* usually set by passing `--gapplication-replace` on the commandline.
* Since: 2.60
*/
REPLACE,
}
/**
* #GAskPasswordFlags are used to request specific information from the
* user, or to notify the user of their choices in an authentication
* situation.
* @bitfield
*/
export enum AskPasswordFlags {
/**
* operation requires a password.
*/
NEED_PASSWORD,
/**
* operation requires a username.
*/
NEED_USERNAME,
/**
* operation requires a domain.
*/
NEED_DOMAIN,
/**
* operation supports saving settings.
*/
SAVING_SUPPORTED,
/**
* operation supports anonymous users.
*/
ANONYMOUS_SUPPORTED,
/**
* operation takes TCRYPT parameters (Since: 2.58)
*/
TCRYPT,
}
/**
* Flags used in g_bus_own_name().
* @bitfield
*/
export enum BusNameOwnerFlags {
/**
* No flags set.
*/
NONE,
/**
* Allow another message bus connection to claim the name.
*/
ALLOW_REPLACEMENT,
/**
* If another message bus connection owns the name and have
* specified %G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT, then take the name from the other connection.
*/
REPLACE,
/**
* If another message bus connection owns the name, immediately
* return an error from g_bus_own_name() rather than entering the waiting queue for that name. (Since 2.54)
*/
DO_NOT_QUEUE,
}
/**
* Flags used in g_bus_watch_name().
* @bitfield
*/
export enum BusNameWatcherFlags {
/**
* No flags set.
*/
NONE,
/**
* If no-one owns the name when
* beginning to watch the name, ask the bus to launch an owner for the
* name.
*/
AUTO_START,
}
/**
* Flags used when calling a g_converter_convert().
* @bitfield
*/
export enum ConverterFlags {
/**
* No flags.
*/
NONE,
/**
* At end of input data
*/
INPUT_AT_END,
/**
* Flush data
*/
FLUSH,
}
/**
* Flags used in g_dbus_connection_call() and similar APIs.
* @bitfield
*/
export enum DBusCallFlags {
/**
* No flags set.
*/
NONE,
/**
* The bus must not launch
* an owner for the destination name in response to this method
* invocation.
*/
NO_AUTO_START,
/**
* the caller is prepared to
* wait for interactive authorization. Since 2.46.
*/
ALLOW_INTERACTIVE_AUTHORIZATION,
}
/**
* Capabilities negotiated with the remote peer.
* @bitfield
*/
export enum DBusCapabilityFlags {
/**
* No flags set.
*/
NONE,
/**
* The connection
* supports exchanging UNIX file descriptors with the remote peer.
*/
UNIX_FD_PASSING,
}
/**
* Flags used when creating a new #GDBusConnection.
* @bitfield
*/
export enum DBusConnectionFlags {
/**
* No flags set.
*/
NONE,
/**
* Perform authentication against server.
*/
AUTHENTICATION_CLIENT,
/**
* Perform authentication against client.
*/
AUTHENTICATION_SERVER,
/**
* When
* authenticating as a server, allow the anonymous authentication
* method.
*/
AUTHENTICATION_ALLOW_ANONYMOUS,
/**
* Pass this flag if connecting to a peer that is a
* message bus. This means that the Hello() method will be invoked as part of the connection setup.
*/
MESSAGE_BUS_CONNECTION,
/**
* If set, processing of D-Bus messages is
* delayed until g_dbus_connection_start_message_processing() is called.
*/
DELAY_MESSAGE_PROCESSING,
/**
* When authenticating
* as a server, require the UID of the peer to be the same as the UID of the server. (Since: 2.68)
*/
AUTHENTICATION_REQUIRE_SAME_USER,
/**
* When authenticating, try to use
* protocols that work across a Linux user namespace boundary, even if this
* reduces interoperability with older D-Bus implementations. This currently
* affects client-side `EXTERNAL` authentication, for which this flag makes
* connections to a server in another user namespace succeed, but causes
* a deadlock when connecting to a GDBus server older than 2.73.3. Since: 2.74
*/
CROSS_NAMESPACE,
}
/**
* Flags describing the behavior of a #GDBusInterfaceSkeleton instance.
* @bitfield
*/
export enum DBusInterfaceSkeletonFlags {
/**
* No flags set.
*/
NONE,
/**
* Each method invocation is handled in
* a thread dedicated to the invocation. This means that the method implementation can use blocking IO
* without blocking any other part of the process. It also means that the method implementation must
* use locking to access data structures used by other threads.
*/
HANDLE_METHOD_INVOCATIONS_IN_THREAD,
}
/**
* Message flags used in #GDBusMessage.
* @bitfield
*/
export enum DBusMessageFlags {
/**
* No flags set.
*/
NONE,
/**
* A reply is not expected.
*/
NO_REPLY_EXPECTED,
/**
* The bus must not launch an
* owner for the destination name in response to this message.
*/
NO_AUTO_START,
/**
* If set on a method
* call, this flag means that the caller is prepared to wait for interactive
* authorization. Since 2.46.
*/
ALLOW_INTERACTIVE_AUTHORIZATION,
}
/**
* Flags used when constructing a #GDBusObjectManagerClient.
* @bitfield
*/
export enum DBusObjectManagerClientFlags {
/**
* No flags set.
*/
NONE,
/**
* If not set and the
* manager is for a well-known name, then request the bus to launch
* an owner for the name if no-one owns the name. This flag can only
* be used in managers for well-known names.
*/
DO_NOT_AUTO_START,
}
/**
* Flags describing the access control of a D-Bus property.
* @bitfield
*/
export enum DBusPropertyInfoFlags {
/**
* No flags set.
*/
NONE,
/**
* Property is readable.
*/
READABLE,
/**
* Property is writable.
*/
WRITABLE,
}
/**
* Flags used when constructing an instance of a #GDBusProxy derived class.
* @bitfield
*/
export enum DBusProxyFlags {
/**
* No flags set.
*/
NONE,
/**
* Don't load properties.
*/
DO_NOT_LOAD_PROPERTIES,
/**
* Don't connect to signals on the remote object.
*/
DO_NOT_CONNECT_SIGNALS,
/**
* If the proxy is for a well-known name,
* do not ask the bus to launch an owner during proxy initialization or a method call.
* This flag is only meaningful in proxies for well-known names.
*/
DO_NOT_AUTO_START,
/**
* If set, the property value for any __invalidated property__ will be (asynchronously) retrieved upon receiving the [`PropertiesChanged`](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties) D-Bus signal and the property will not cause emission of the #GDBusProxy::g-properties-changed signal. When the value is received the #GDBusProxy::g-properties-changed signal is emitted for the property along with the retrieved value. Since 2.32.
*/
GET_INVALIDATED_PROPERTIES,
/**
* If the proxy is for a well-known name,
* do not ask the bus to launch an owner during proxy initialization, but allow it to be
* autostarted by a method call. This flag is only meaningful in proxies for well-known names,
* and only if %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START is not also specified.
*/
DO_NOT_AUTO_START_AT_CONSTRUCTION,
/**
* Don't actually send the AddMatch D-Bus
* call for this signal subscription. This gives you more control
* over which match rules you add (but you must add them manually). (Since: 2.72)
*/
NO_MATCH_RULE,
}
/**
* Flags used when sending #GDBusMessages on a #GDBusConnection.
* @bitfield
*/
export enum DBusSendMessageFlags {
/**
* No flags set.
*/
NONE,
/**
* Do not automatically
* assign a serial number from the #GDBusConnection object when
* sending a message.
*/
PRESERVE_SERIAL,
}
/**
* Flags used when creating a #GDBusServer.
* @bitfield
*/
export enum DBusServerFlags {
/**
* No flags set.
*/
NONE,
/**
* All #GDBusServer::new-connection
* signals will run in separated dedicated threads (see signal for
* details).
*/
RUN_IN_THREAD,
/**
* Allow the anonymous
* authentication method.
*/
AUTHENTICATION_ALLOW_ANONYMOUS,
/**
* Require the UID of the
* peer to be the same as the UID of the server when authenticating. (Since: 2.68)
*/
AUTHENTICATION_REQUIRE_SAME_USER,
}
/**
* Flags used when subscribing to signals via g_dbus_connection_signal_subscribe().
* @bitfield
*/
export enum DBusSignalFlags {
/**
* No flags set.
*/
NONE,
/**
* Don't actually send the AddMatch
* D-Bus call for this signal subscription. This gives you more control
* over which match rules you add (but you must add them manually).
*/
NO_MATCH_RULE,
/**
* Match first arguments that
* contain a bus or interface name with the given namespace.
*/
MATCH_ARG0_NAMESPACE,
/**
* Match first arguments that
* contain an object path that is either equivalent to the given path,
* or one of the paths is a subpath of the other.
*/
MATCH_ARG0_PATH,
}
/**
* Flags passed to g_dbus_connection_register_subtree().
* @bitfield
*/
export enum DBusSubtreeFlags {
/**
* No flags set.
*/
NONE,
/**
* Method calls to objects not in the enumerated range
* will still be dispatched. This is useful if you want
* to dynamically spawn objects in the subtree.
*/
DISPATCH_TO_UNENUMERATED_NODES,
}
/**
* Flags used when starting a drive.
* @bitfield
*/
export enum DriveStartFlags {
/**
* No flags set.
*/
NONE,
}
/**
* Flags specifying the behaviour of an attribute.
* @bitfield
*/
export enum FileAttributeInfoFlags {
/**
* no flags set.
*/
NONE,
/**
* copy the attribute values when the file is copied.
*/
COPY_WITH_FILE,
/**
* copy the attribute values when the file is moved.
*/
COPY_WHEN_MOVED,
}
/**
* Flags used when copying or moving files.
* @bitfield
*/
export enum FileCopyFlags {
/**
* No flags set.
*/
NONE,
/**
* Overwrite any existing files
*/
OVERWRITE,
/**
* Make a backup of any existing files.
*/
BACKUP,
/**
* Don't follow symlinks.
*/
NOFOLLOW_SYMLINKS,
/**
* Copy all file metadata instead of just default set used for copy (see #GFileInfo).
*/
ALL_METADATA,
/**
* Don't use copy and delete fallback if native move not supported.
*/
NO_FALLBACK_FOR_MOVE,
/**
* Leaves target file with default perms, instead of setting the source file perms.
*/
TARGET_DEFAULT_PERMS,
}
/**
* Flags used when an operation may create a file.
* @bitfield
*/
export enum FileCreateFlags {
/**
* No flags set.
*/
NONE,
/**
* Create a file that can only be
* accessed by the current user.
*/
PRIVATE,
/**
* Replace the destination
* as if it didn't exist before. Don't try to keep any old
* permissions, replace instead of following links. This
* is generally useful if you're doing a "copy over"
* rather than a "save new version of" replace operation.
* You can think of it as "unlink destination" before
* writing to it, although the implementation may not
* be exactly like that. This flag can only be used with
* g_file_replace() and its variants, including g_file_replace_contents().
* Since 2.20
*/
REPLACE_DESTINATION,
}
/**
* Flags that can be used with g_file_measure_disk_usage().
* @bitfield
*/
export enum FileMeasureFlags {
/**
* No flags set.
*/
NONE,
/**
* Report any error encountered
* while traversing the directory tree. Normally errors are only
* reported for the toplevel file.
*/
REPORT_ANY_ERROR,
/**
* Tally usage based on apparent file
* sizes. Normally, the block-size is used, if available, as this is a
* more accurate representation of disk space used.
* Compare with `du --apparent-size`.
* Since GLib 2.78. and similarly to `du` since GNU Coreutils 9.2, this will
* ignore the sizes of file types other than regular files and links, as the
* sizes of other file types are not specified in a standard way.
*/
APPARENT_SIZE,
/**
* Do not cross mount point boundaries.
* Compare with `du -x`.
*/
NO_XDEV,
}
/**
* Flags used to set what a #GFileMonitor will watch for.
* @bitfield
*/
export enum FileMonitorFlags {
/**
* No flags set.
*/
NONE,
/**
* Watch for mount events.
*/
WATCH_MOUNTS,
/**
* Pair DELETED and CREATED events caused
* by file renames (moves) and send a single G_FILE_MONITOR_EVENT_MOVED
* event instead (NB: not supported on all backends; the default
* behaviour -without specifying this flag- is to send single DELETED
* and CREATED events). Deprecated since 2.46: use
* %G_FILE_MONITOR_WATCH_MOVES instead.
*/
SEND_MOVED,
/**
* Watch for changes to the file made
* via another hard link. Since 2.36.
*/
WATCH_HARD_LINKS,
/**
* Watch for rename operations on a
* monitored directory. This causes %G_FILE_MONITOR_EVENT_RENAMED,
* %G_FILE_MONITOR_EVENT_MOVED_IN and %G_FILE_MONITOR_EVENT_MOVED_OUT
* events to be emitted when possible. Since: 2.46.
*/
WATCH_MOVES,
}
/**
* Flags used when querying a #GFileInfo.
* @bitfield
*/
export enum FileQueryInfoFlags {
/**
* No flags set.
*/
NONE,
/**
* Don't follow symlinks.
*/
NOFOLLOW_SYMLINKS,
}
/**
* GIOStreamSpliceFlags determine how streams should be spliced.
* @bitfield
*/
export enum IOStreamSpliceFlags {
/**
* Do not close either stream.
*/
NONE,
/**
* Close the first stream after
* the splice.
*/
CLOSE_STREAM1,
/**
* Close the second stream after
* the splice.
*/
CLOSE_STREAM2,
/**
* Wait for both splice operations to finish
* before calling the callback.
*/
WAIT_FOR_BOTH,
}
/**
* Flags used when mounting a mount.
* @bitfield
*/
export enum MountMountFlags {
/**
* No flags set.
*/
NONE,
}
/**
* Flags used when an unmounting a mount.
* @bitfield
*/
export enum MountUnmountFlags {
/**
* No flags set.
*/
NONE,
/**
* Unmount even if there are outstanding
* file operations on the mount.
*/
FORCE,
}
/**
* GOutputStreamSpliceFlags determine how streams should be spliced.
* @bitfield
*/
export enum OutputStreamSpliceFlags {
/**
* Do not close either stream.
*/
NONE,
/**
* Close the source stream after
* the splice.
*/
CLOSE_SOURCE,
/**
* Close the target stream after
* the splice.
*/
CLOSE_TARGET,
}
/**
* Flags to modify lookup behavior.
* @bitfield
*/
export enum ResolverNameLookupFlags {
/**
* default behavior (same as g_resolver_lookup_by_name())
*/
DEFAULT,
/**
* only resolve ipv4 addresses
*/
IPV4_ONLY,
/**
* only resolve ipv6 addresses
*/
IPV6_ONLY,
}
/**
* GResourceFlags give information about a particular file inside a resource
* bundle.
* @bitfield
*/
export enum ResourceFlags {
/**
* No flags set.
*/
NONE,
/**
* The file is compressed.
*/
COMPRESSED,
}
/**
* GResourceLookupFlags determine how resource path lookups are handled.
* @bitfield
*/
export enum ResourceLookupFlags {
/**
* No flags set.
*/
NONE,
}
/**
* Flags used when creating a binding. These flags determine in which
* direction the binding works. The default is to synchronize in both
* directions.
* @bitfield
*/
export enum SettingsBindFlags {
/**
* Equivalent to `G_SETTINGS_BIND_GET|G_SETTINGS_BIND_SET`
*/
DEFAULT,
/**
* Update the #GObject property when the setting changes.
* It is an error to use this flag if the property is not writable.
*/
GET,
/**
* Update the setting when the #GObject property changes.
* It is an error to use this flag if the property is not readable.
*/
SET,
/**
* Do not try to bind a "sensitivity" property to the writability of the setting
*/
NO_SENSITIVITY,
/**
* When set in addition to %G_SETTINGS_BIND_GET, set the #GObject property
* value initially from the setting, but do not listen for changes of the setting
*/
GET_NO_CHANGES,
/**
* When passed to g_settings_bind(), uses a pair of mapping functions that invert
* the boolean value when mapping between the setting and the property. The setting and property must both
* be booleans. You cannot pass this flag to g_settings_bind_with_mapping().
*/
INVERT_BOOLEAN,
}
/**
* Flags used in g_socket_receive_message() and g_socket_send_message().
* The flags listed in the enum are some commonly available flags, but the
* values used for them are the same as on the platform, and any other flags
* are passed in/out as is. So to use a platform specific flag, just include
* the right system header and pass in the flag.
* @bitfield
*/
export enum SocketMsgFlags {
/**
* No flags.
*/
NONE,
/**
* Request to send/receive out of band data.
*/
OOB,
/**
* Read data from the socket without removing it from
* the queue.
*/
PEEK,
/**
* Don't use a gateway to send out the packet,
* only send to hosts on directly connected networks.
*/
DONTROUTE,
}
/**
* Flags to define the behaviour of a #GSubprocess.
*
* Note that the default for stdin is to redirect from `/dev/null`. For
* stdout and stderr the default are for them to inherit the
* corresponding descriptor from the calling process.
*
* Note that it is a programmer error to mix 'incompatible' flags. For
* example, you may not request both %G_SUBPROCESS_FLAGS_STDOUT_PIPE and
* %G_SUBPROCESS_FLAGS_STDOUT_SILENCE.
* @bitfield
*/
export enum SubprocessFlags {
/**
* No flags.
*/
NONE,
/**
* create a pipe for the stdin of the
* spawned process that can be accessed with
* g_subprocess_get_stdin_pipe().
*/
STDIN_PIPE,
/**
* stdin is inherited from the
* calling process.
*/
STDIN_INHERIT,
/**
* create a pipe for the stdout of the
* spawned process that can be accessed with
* g_subprocess_get_stdout_pipe().
*/
STDOUT_PIPE,
/**
* silence the stdout of the spawned
* process (ie: redirect to `/dev/null`).
*/
STDOUT_SILENCE,
/**
* create a pipe for the stderr of the
* spawned process that can be accessed with
* g_subprocess_get_stderr_pipe().
*/
STDERR_PIPE,
/**
* silence the stderr of the spawned
* process (ie: redirect to `/dev/null`).
*/
STDERR_SILENCE,
/**
* merge the stderr of the spawned
* process with whatever the stdout happens to be. This is a good way
* of directing both streams to a common log file, for example.
*/
STDERR_MERGE,
/**
* spawned processes will inherit the
* file descriptors of their parent, unless those descriptors have
* been explicitly marked as close-on-exec. This flag has no effect
* over the "standard" file descriptors (stdin, stdout, stderr).
*/
INHERIT_FDS,
/**
* if path searching is
* needed when spawning the subprocess, use the `PATH` in the launcher
* environment. (Since: 2.72)
*/
SEARCH_PATH_FROM_ENVP,
}
/**
* Flags to define future #GTestDBus behaviour.
* @bitfield
*/
export enum TestDBusFlags {
/**
* No flags.
*/
NONE,
}
/**
* A set of flags describing TLS certification validation. This can be
* used to describe why a particular certificate was rejected (for
* example, in #GTlsConnection::accept-certificate).
*
* GLib guarantees that if certificate verification fails, at least one
* flag will be set, but it does not guarantee that all possible flags
* will be set. Accordingly, you may not safely decide to ignore any
* particular type of error. For example, it would be incorrect to mask
* %G_TLS_CERTIFICATE_EXPIRED if you want to allow expired certificates,
* because this could potentially be the only error flag set even if
* other problems exist with the certificate.
* @bitfield
*/
export enum TlsCertificateFlags {
/**
* No flags set. Since: 2.74
*/
NO_FLAGS,
/**
* The signing certificate authority is
* not known.
*/
UNKNOWN_CA,
/**
* The certificate does not match the
* expected identity of the site that it was retrieved from.
*/
BAD_IDENTITY,
/**
* The certificate's activation time
* is still in the future
*/
NOT_ACTIVATED,
/**
* The certificate has expired
*/
EXPIRED,
/**
* The certificate has been revoked
* according to the #GTlsConnection's certificate revocation list.
*/
REVOKED,
/**
* The certificate's algorithm is
* considered insecure.
*/
INSECURE,
/**
* Some other error occurred validating
* the certificate
*/
GENERIC_ERROR,
/**
* the combination of all of the above
* flags
*/
VALIDATE_ALL,
}
/**
* Flags for g_tls_database_verify_chain().
* @bitfield
*/
export enum TlsDatabaseVerifyFlags {
/**
* No verification flags
*/
NONE,
}
/**
* Various flags for the password.
* @bitfield
*/
export enum TlsPasswordFlags {
/**
* No flags
*/
NONE,
/**
* The password was wrong, and the user should retry.
*/
RETRY,
/**
* Hint to the user that the password has been
* wrong many times, and the user may not have many chances left.
*/
MANY_TRIES,
/**
* Hint to the user that this is the last try to get
* this password right.
*/
FINAL_TRY,
/**
* For PKCS #11, the user PIN is required.
* Since: 2.70.
*/
PKCS11_USER,
/**
* For PKCS #11, the security officer
* PIN is required. Since: 2.70.
*/
PKCS11_SECURITY_OFFICER,
/**
* For PKCS #11, the context-specific
* PIN is required. Since: 2.70.
*/
PKCS11_CONTEXT_SPECIFIC,
}
/**
* The value returned by handlers of the signals generated by
* the `gdbus-codegen` tool to indicate that a method call has been
* handled by an implementation. It is equal to %TRUE, but using
* this macro is sometimes more readable.
*
* In code that needs to be backwards-compatible with older GLib,
* use %TRUE instead, often written like this:
*
*
* ```
* g_dbus_method_invocation_return_error (invocation, ...);
* return TRUE; // handled
* ```
*
*/
export const DBUS_METHOD_INVOCATION_HANDLED: boolean
/**
* The value returned by handlers of the signals generated by
* the `gdbus-codegen` tool to indicate that a method call has not been
* handled by an implementation. It is equal to %FALSE, but using
* this macro is sometimes more readable.
*
* In code that needs to be backwards-compatible with older GLib,
* use %FALSE instead.
*/
export const DBUS_METHOD_INVOCATION_UNHANDLED: boolean
/**
* Extension point for debug control functionality.
* See [Extending GIO][extending-gio].
*/
export const DEBUG_CONTROLLER_EXTENSION_POINT_NAME: string | null
/**
* Extension point for default handler to URI association. See
* [Extending GIO][extending-gio].
*/
export const DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME: string | null
/**
* The string used to obtain a Unix device path with g_drive_get_identifier().
*/
export const DRIVE_IDENTIFIER_KIND_UNIX_DEVICE: string | null
/**
* A key in the "access" namespace for checking deletion privileges.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*
* This attribute will be %TRUE if the user is able to delete the file.
*/
export const FILE_ATTRIBUTE_ACCESS_CAN_DELETE: string | null
/**
* A key in the "access" namespace for getting execution privileges.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*
* This attribute will be %TRUE if the user is able to execute the file.
*/
export const FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE: string | null
/**
* A key in the "access" namespace for getting read privileges.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*
* This attribute will be %TRUE if the user is able to read the file.
*/
export const FILE_ATTRIBUTE_ACCESS_CAN_READ: string | null
/**
* A key in the "access" namespace for checking renaming privileges.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*
* This attribute will be %TRUE if the user is able to rename the file.
*/
export const FILE_ATTRIBUTE_ACCESS_CAN_RENAME: string | null
/**
* A key in the "access" namespace for checking trashing privileges.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*
* This attribute will be %TRUE if the user is able to move the file to
* the trash.
*/
export const FILE_ATTRIBUTE_ACCESS_CAN_TRASH: string | null
/**
* A key in the "access" namespace for getting write privileges.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*
* This attribute will be %TRUE if the user is able to write to the file.
*/
export const FILE_ATTRIBUTE_ACCESS_CAN_WRITE: string | null
/**
* A key in the "dos" namespace for checking if the file's archive flag
* is set.
*
* This attribute is %TRUE if the archive flag is set.
*
* This attribute is only available for DOS file systems.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_DOS_IS_ARCHIVE: string | null
/**
* A key in the "dos" namespace for checking if the file is a NTFS mount point
* (a volume mount or a junction point).
*
* This attribute is %TRUE if file is a reparse point of type
* [IO_REPARSE_TAG_MOUNT_POINT](https://msdn.microsoft.com/en-us/library/dd541667.aspx).
*
* This attribute is only available for DOS file systems.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_DOS_IS_MOUNTPOINT: string | null
/**
* A key in the "dos" namespace for checking if the file's backup flag
* is set.
*
* This attribute is %TRUE if the backup flag is set.
*
* This attribute is only available for DOS file systems.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_DOS_IS_SYSTEM: string | null
/**
* A key in the "dos" namespace for getting the file NTFS reparse tag.
*
* This value is 0 for files that are not reparse points.
*
* See the [Reparse Tags](https://msdn.microsoft.com/en-us/library/dd541667.aspx)
* page for possible reparse tag values.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG: string | null
/**
* A key in the "etag" namespace for getting the value of the file's
* entity tag.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*/
export const FILE_ATTRIBUTE_ETAG_VALUE: string | null
/**
* A key in the "filesystem" namespace for getting the number of bytes
* of free space left on the file system.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64.
*/
export const FILE_ATTRIBUTE_FILESYSTEM_FREE: string | null
/**
* A key in the "filesystem" namespace for checking if the file system
* is read only.
*
* Is set to %TRUE if the file system is read only.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_FILESYSTEM_READONLY: string | null
/**
* A key in the "filesystem" namespace for checking if the file system
* is remote.
*
* Is set to %TRUE if the file system is remote.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_FILESYSTEM_REMOTE: string | null
/**
* A key in the "filesystem" namespace for getting the total size (in
* bytes) of the file system, used in g_file_query_filesystem_info().
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64.
*/
export const FILE_ATTRIBUTE_FILESYSTEM_SIZE: string | null
/**
* A key in the "filesystem" namespace for getting the file system's type.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*/
export const FILE_ATTRIBUTE_FILESYSTEM_TYPE: string | null
/**
* A key in the "filesystem" namespace for getting the number of bytes
* used by data on the file system.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64.
*/
export const FILE_ATTRIBUTE_FILESYSTEM_USED: string | null
/**
* A key in the "filesystem" namespace for hinting a file manager
* application whether it should preview (e.g. thumbnail) files on the
* file system.
*
* The value for this key contain a #GFilesystemPreviewType.
*/
export const FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW: string | null
/**
* A key in the "gvfs" namespace that gets the name of the current
* GVFS backend in use.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*/
export const FILE_ATTRIBUTE_GVFS_BACKEND: string | null
/**
* A key in the "id" namespace for getting a file identifier.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*
* An example use would be during listing files, to avoid recursive
* directory scanning.
*/
export const FILE_ATTRIBUTE_ID_FILE: string | null
/**
* A key in the "id" namespace for getting the file system identifier.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*
* An example use would be during drag and drop to see if the source
* and target are on the same filesystem (default to move) or not (default
* to copy).
*/
export const FILE_ATTRIBUTE_ID_FILESYSTEM: string | null
/**
* A key in the "mountable" namespace for checking if a file (of
* type G_FILE_TYPE_MOUNTABLE) can be ejected.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT: string | null
/**
* A key in the "mountable" namespace for checking if a file (of
* type G_FILE_TYPE_MOUNTABLE) is mountable.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT: string | null
/**
* A key in the "mountable" namespace for checking if a file (of
* type G_FILE_TYPE_MOUNTABLE) can be polled.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_MOUNTABLE_CAN_POLL: string | null
/**
* A key in the "mountable" namespace for checking if a file (of
* type G_FILE_TYPE_MOUNTABLE) can be started.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_MOUNTABLE_CAN_START: string | null
/**
* A key in the "mountable" namespace for checking if a file (of
* type G_FILE_TYPE_MOUNTABLE) can be started degraded.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_MOUNTABLE_CAN_START_DEGRADED: string | null
/**
* A key in the "mountable" namespace for checking if a file (of
* type G_FILE_TYPE_MOUNTABLE) can be stopped.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_MOUNTABLE_CAN_STOP: string | null
/**
* A key in the "mountable" namespace for checking if a file (of
* type G_FILE_TYPE_MOUNTABLE) is unmountable.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT: string | null
/**
* A key in the "mountable" namespace for getting the HAL UDI for the mountable
* file.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*/
export const FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI: string | null
/**
* A key in the "mountable" namespace for checking if a file (of
* type G_FILE_TYPE_MOUNTABLE) is automatically polled for media.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_MOUNTABLE_IS_MEDIA_CHECK_AUTOMATIC: string | null
/**
* A key in the "mountable" namespace for getting the #GDriveStartStopType.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_MOUNTABLE_START_STOP_TYPE: string | null
/**
* A key in the "mountable" namespace for getting the unix device.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE: string | null
/**
* A key in the "mountable" namespace for getting the unix device file.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*/
export const FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE_FILE: string | null
/**
* A key in the "owner" namespace for getting the file owner's group.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*/
export const FILE_ATTRIBUTE_OWNER_GROUP: string | null
/**
* A key in the "owner" namespace for getting the user name of the
* file's owner.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*/
export const FILE_ATTRIBUTE_OWNER_USER: string | null
/**
* A key in the "owner" namespace for getting the real name of the
* user that owns the file.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*/
export const FILE_ATTRIBUTE_OWNER_USER_REAL: string | null
/**
* A key in the "preview" namespace for getting a #GIcon that can be
* used to get preview of the file.
*
* For example, it may be a low resolution thumbnail without metadata.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_OBJECT.
*
* The value for this key should contain a #GIcon.
*/
export const FILE_ATTRIBUTE_PREVIEW_ICON: string | null
/**
* A key in the "recent" namespace for getting time, when the metadata for the
* file in `recent:///` was last changed.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_INT64.
*/
export const FILE_ATTRIBUTE_RECENT_MODIFIED: string | null
/**
* A key in the "selinux" namespace for getting the file's SELinux
* context.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*
* Note that this attribute is only available if GLib has been built
* with SELinux support.
*/
export const FILE_ATTRIBUTE_SELINUX_CONTEXT: string | null
/**
* A key in the "standard" namespace for getting the amount of disk space
* that is consumed by the file (in bytes).
*
* This will generally be larger than the file size (due to block size
* overhead) but can occasionally be smaller (for example, for sparse files).
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64.
*/
export const FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE: string | null
/**
* A key in the "standard" namespace for getting the content type of the file.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*
* The value for this key should contain a valid content type.
*/
export const FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE: string | null
/**
* A key in the "standard" namespace for getting the copy name of the file.
*
* The copy name is an optional version of the name. If available it's always
* in UTF8, and corresponds directly to the original filename (only transcoded to
* UTF8). This is useful if you want to copy the file to another filesystem that
* might have a different encoding. If the filename is not a valid string in the
* encoding selected for the filesystem it is in then the copy name will not be set.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*/
export const FILE_ATTRIBUTE_STANDARD_COPY_NAME: string | null
/**
* A key in the "standard" namespace for getting the description of the file.
*
* The description is a utf8 string that describes the file, generally containing
* the filename, but can also contain further information. Example descriptions
* could be "filename (on hostname)" for a remote file or "filename (in trash)"
* for a file in the trash. This is useful for instance as the window title
* when displaying a directory or for a bookmarks menu.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*/
export const FILE_ATTRIBUTE_STANDARD_DESCRIPTION: string | null
/**
* A key in the "standard" namespace for getting the display name of the file.
*
* A display name is guaranteed to be in UTF-8 and can thus be displayed in
* the UI. It is guaranteed to be set on every file.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*/
export const FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME: string | null
/**
* A key in the "standard" namespace for edit name of the file.
*
* An edit name is similar to the display name, but it is meant to be
* used when you want to rename the file in the UI. The display name
* might contain information you don't want in the new filename (such as
* "(invalid unicode)" if the filename was in an invalid encoding).
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*/
export const FILE_ATTRIBUTE_STANDARD_EDIT_NAME: string | null
/**
* A key in the "standard" namespace for getting the fast content type.
*
* The fast content type isn't as reliable as the regular one, as it
* only uses the filename to guess it, but it is faster to calculate than the
* regular content type.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*/
export const FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE: string | null
/**
* A key in the "standard" namespace for getting the icon for the file.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_OBJECT.
*
* The value for this key should contain a #GIcon.
*/
export const FILE_ATTRIBUTE_STANDARD_ICON: string | null
/**
* A key in the "standard" namespace for checking if a file is a backup file.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_STANDARD_IS_BACKUP: string | null
/**
* A key in the "standard" namespace for checking if a file is hidden.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_STANDARD_IS_HIDDEN: string | null
/**
* A key in the "standard" namespace for checking if the file is a symlink.
* Typically the actual type is something else, if we followed the symlink
* to get the type.
*
* On Windows NTFS mountpoints are considered to be symlinks as well.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_STANDARD_IS_SYMLINK: string | null
/**
* A key in the "standard" namespace for checking if a file is virtual.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL: string | null
/**
* A key in the "standard" namespace for checking if a file is
* volatile. This is meant for opaque, non-POSIX-like backends to
* indicate that the URI is not persistent. Applications should look
* at %G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET for the persistent URI.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_STANDARD_IS_VOLATILE: string | null
/**
* A key in the "standard" namespace for getting the name of the file.
*
* The name is the on-disk filename which may not be in any known encoding,
* and can thus not be generally displayed as is. It is guaranteed to be set on
* every file.
*
* Use %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME if you need to display the
* name in a user interface.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING.
*/
export const FILE_ATTRIBUTE_STANDARD_NAME: string | null
/**
* A key in the "standard" namespace for getting the file's size (in bytes).
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64.
*/
export const FILE_ATTRIBUTE_STANDARD_SIZE: string | null
/**
* A key in the "standard" namespace for setting the sort order of a file.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_INT32.
*
* An example use would be in file managers, which would use this key
* to set the order files are displayed. Files with smaller sort order
* should be sorted first, and files without sort order as if sort order
* was zero.
*/
export const FILE_ATTRIBUTE_STANDARD_SORT_ORDER: string | null
/**
* A key in the "standard" namespace for getting the symbolic icon for the file.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_OBJECT.
*
* The value for this key should contain a #GIcon.
*/
export const FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON: string | null
/**
* A key in the "standard" namespace for getting the symlink target, if the file
* is a symlink.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING.
*/
export const FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET: string | null
/**
* A key in the "standard" namespace for getting the target URI for the file, in
* the case of %G_FILE_TYPE_SHORTCUT or %G_FILE_TYPE_MOUNTABLE files.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*/
export const FILE_ATTRIBUTE_STANDARD_TARGET_URI: string | null
/**
* A key in the "standard" namespace for storing file types.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
*
* The value for this key should contain a #GFileType.
*/
export const FILE_ATTRIBUTE_STANDARD_TYPE: string | null
/**
* A key in the "thumbnail" namespace for checking if thumbnailing failed.
*
* This attribute is %TRUE if thumbnailing failed.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_THUMBNAILING_FAILED: string | null
/**
* A key in the "thumbnail" namespace for checking if thumbnailing failed
* for the large image.
*
* This attribute is %TRUE if thumbnailing failed.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_THUMBNAILING_FAILED_LARGE: string | null
/**
* A key in the "thumbnail" namespace for checking if thumbnailing failed
* for the normal image.
*
* This attribute is %TRUE if thumbnailing failed.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_THUMBNAILING_FAILED_NORMAL: string | null
/**
* A key in the "thumbnail" namespace for checking if thumbnailing failed
* for the x-large image.
*
* This attribute is %TRUE if thumbnailing failed.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_THUMBNAILING_FAILED_XLARGE: string | null
/**
* A key in the "thumbnail" namespace for checking if thumbnailing failed
* for the xx-large image.
*
* This attribute is %TRUE if thumbnailing failed.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_THUMBNAILING_FAILED_XXLARGE: string | null
/**
* A key in the "thumbnail" namespace for checking whether the thumbnail is outdated.
*
* This attribute is %TRUE if the thumbnail is up-to-date with the file it represents,
* and %FALSE if the file has been modified since the thumbnail was generated.
*
* If %G_FILE_ATTRIBUTE_THUMBNAILING_FAILED is %TRUE and this attribute is %FALSE,
* it indicates that thumbnailing may be attempted again and may succeed.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_THUMBNAIL_IS_VALID: string | null
/**
* A key in the "thumbnail" namespace for checking whether the large
* thumbnail is outdated.
*
* This attribute is %TRUE if the large thumbnail is up-to-date with the file
* it represents, and %FALSE if the file has been modified since the thumbnail
* was generated.
*
* If %G_FILE_ATTRIBUTE_THUMBNAILING_FAILED_LARGE is %TRUE and this attribute
* is %FALSE, it indicates that thumbnailing may be attempted again and may
* succeed.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_THUMBNAIL_IS_VALID_LARGE: string | null
/**
* A key in the "thumbnail" namespace for checking whether the normal
* thumbnail is outdated.
*
* This attribute is %TRUE if the normal thumbnail is up-to-date with the file
* it represents, and %FALSE if the file has been modified since the thumbnail
* was generated.
*
* If %G_FILE_ATTRIBUTE_THUMBNAILING_FAILED_NORMAL is %TRUE and this attribute
* is %FALSE, it indicates that thumbnailing may be attempted again and may
* succeed.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_THUMBNAIL_IS_VALID_NORMAL: string | null
/**
* A key in the "thumbnail" namespace for checking whether the x-large
* thumbnail is outdated.
*
* This attribute is %TRUE if the x-large thumbnail is up-to-date with the file
* it represents, and %FALSE if the file has been modified since the thumbnail
* was generated.
*
* If %G_FILE_ATTRIBUTE_THUMBNAILING_FAILED_XLARGE is %TRUE and this attribute
* is %FALSE, it indicates that thumbnailing may be attempted again and may
* succeed.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_THUMBNAIL_IS_VALID_XLARGE: string | null
/**
* A key in the "thumbnail" namespace for checking whether the xx-large
* thumbnail is outdated.
*
* This attribute is %TRUE if the x-large thumbnail is up-to-date with the file
* it represents, and %FALSE if the file has been modified since the thumbnail
* was generated.
*
* If %G_FILE_ATTRIBUTE_THUMBNAILING_FAILED_XXLARGE is %TRUE and this attribute
* is %FALSE, it indicates that thumbnailing may be attempted again and may
* succeed.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_THUMBNAIL_IS_VALID_XXLARGE: string | null
/**
* A key in the "thumbnail" namespace for getting the path to the thumbnail
* image with the biggest size available.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING.
*/
export const FILE_ATTRIBUTE_THUMBNAIL_PATH: string | null
/**
* A key in the "thumbnail" namespace for getting the path to the large
* thumbnail image.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING.
*/
export const FILE_ATTRIBUTE_THUMBNAIL_PATH_LARGE: string | null
/**
* A key in the "thumbnail" namespace for getting the path to the normal
* thumbnail image.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING.
*/
export const FILE_ATTRIBUTE_THUMBNAIL_PATH_NORMAL: string | null
/**
* A key in the "thumbnail" namespace for getting the path to the x-large
* thumbnail image.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING.
*/
export const FILE_ATTRIBUTE_THUMBNAIL_PATH_XLARGE: string | null
/**
* A key in the "thumbnail" namespace for getting the path to the xx-large
* thumbnail image.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING.
*/
export const FILE_ATTRIBUTE_THUMBNAIL_PATH_XXLARGE: string | null
/**
* A key in the "time" namespace for getting the time the file was last
* accessed.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64, and
* contains the time since the file was last accessed, in seconds since the
* UNIX epoch.
*/
export const FILE_ATTRIBUTE_TIME_ACCESS: string | null
/**
* A key in the "time" namespace for getting the nanoseconds of the time
* the file was last accessed. This should be used in conjunction with
* #G_FILE_ATTRIBUTE_TIME_ACCESS. Corresponding #GFileAttributeType is
* %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_TIME_ACCESS_NSEC: string | null
/**
* A key in the "time" namespace for getting the microseconds of the time
* the file was last accessed.
*
* This should be used in conjunction with %G_FILE_ATTRIBUTE_TIME_ACCESS.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_TIME_ACCESS_USEC: string | null
/**
* A key in the "time" namespace for getting the time the file was last
* changed.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64,
* and contains the time since the file was last changed, in seconds since
* the UNIX epoch.
*
* This corresponds to the traditional UNIX ctime.
*/
export const FILE_ATTRIBUTE_TIME_CHANGED: string | null
/**
* A key in the "time" namespace for getting the nanoseconds of the time
* the file was last changed. This should be used in conjunction with
* #G_FILE_ATTRIBUTE_TIME_CHANGED. Corresponding #GFileAttributeType is
* %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_TIME_CHANGED_NSEC: string | null
/**
* A key in the "time" namespace for getting the microseconds of the time
* the file was last changed.
*
* This should be used in conjunction with %G_FILE_ATTRIBUTE_TIME_CHANGED.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_TIME_CHANGED_USEC: string | null
/**
* A key in the "time" namespace for getting the time the file was created.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64,
* and contains the time since the file was created, in seconds since the UNIX
* epoch.
*
* This may correspond to Linux `stx_btime`, FreeBSD `st_birthtim`, NetBSD
* `st_birthtime` or NTFS `ctime`.
*/
export const FILE_ATTRIBUTE_TIME_CREATED: string | null
/**
* A key in the "time" namespace for getting the nanoseconds of the time
* the file was created. This should be used in conjunction with
* #G_FILE_ATTRIBUTE_TIME_CREATED. Corresponding #GFileAttributeType is
* %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_TIME_CREATED_NSEC: string | null
/**
* A key in the "time" namespace for getting the microseconds of the time
* the file was created.
*
* This should be used in conjunction with %G_FILE_ATTRIBUTE_TIME_CREATED.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_TIME_CREATED_USEC: string | null
/**
* A key in the "time" namespace for getting the time the file was last
* modified.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64, and
* contains the time since the file was modified, in seconds since the UNIX
* epoch.
*/
export const FILE_ATTRIBUTE_TIME_MODIFIED: string | null
/**
* A key in the "time" namespace for getting the nanoseconds of the time
* the file was last modified. This should be used in conjunction with
* #G_FILE_ATTRIBUTE_TIME_MODIFIED. Corresponding #GFileAttributeType is
* %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_TIME_MODIFIED_NSEC: string | null
/**
* A key in the "time" namespace for getting the microseconds of the time
* the file was last modified.
*
* This should be used in conjunction with %G_FILE_ATTRIBUTE_TIME_MODIFIED.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_TIME_MODIFIED_USEC: string | null
/**
* A key in the "trash" namespace for getting the deletion date and time
* of a file inside the `trash:///` folder.
*
* The format of the returned string is `YYYY-MM-DDThh:mm:ss`.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
*/
export const FILE_ATTRIBUTE_TRASH_DELETION_DATE: string | null
/**
* A key in the "trash" namespace for getting the number of (toplevel) items
* that are present in the `trash:///` folder.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_TRASH_ITEM_COUNT: string | null
/**
* A key in the "trash" namespace for getting the original path of a file
* inside the `trash:///` folder before it was trashed.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING.
*/
export const FILE_ATTRIBUTE_TRASH_ORIG_PATH: string | null
/**
* A key in the "unix" namespace for getting the number of blocks allocated
* for the file.
*
* This attribute is only available for UNIX file systems.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64.
*/
export const FILE_ATTRIBUTE_UNIX_BLOCKS: string | null
/**
* A key in the "unix" namespace for getting the block size for the file
* system.
*
* This attribute is only available for UNIX file systems.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_UNIX_BLOCK_SIZE: string | null
/**
* A key in the "unix" namespace for getting the device id of the device the
* file is located on (see stat() documentation).
*
* This attribute is only available for UNIX file systems.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_UNIX_DEVICE: string | null
/**
* A key in the "unix" namespace for getting the group ID for the file.
*
* This attribute is only available for UNIX file systems.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_UNIX_GID: string | null
/**
* A key in the "unix" namespace for getting the inode of the file.
*
* This attribute is only available for UNIX file systems.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64.
*/
export const FILE_ATTRIBUTE_UNIX_INODE: string | null
/**
* A key in the "unix" namespace for checking if the file represents a
* UNIX mount point.
*
* This attribute is %TRUE if the file is a UNIX mount point.
*
* Since 2.58, `/` is considered to be a mount point.
*
* This attribute is only available for UNIX file systems.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*/
export const FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT: string | null
/**
* A key in the "unix" namespace for getting the mode of the file
* (e.g. whether the file is a regular file, symlink, etc).
*
* See the documentation for `lstat()`: this attribute is equivalent to
* the `st_mode` member of `struct stat`, and includes both the file type
* and permissions.
*
* This attribute is only available for UNIX file systems.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_UNIX_MODE: string | null
/**
* A key in the "unix" namespace for getting the number of hard links
* for a file.
*
* See the documentation for `lstat()`.
*
* This attribute is only available for UNIX file systems.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_UNIX_NLINK: string | null
/**
* A key in the "unix" namespace for getting the device ID for the file
* (if it is a special file).
*
* See the documentation for `lstat()`.
*
* This attribute is only available for UNIX file systems.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_UNIX_RDEV: string | null
/**
* A key in the "unix" namespace for getting the user ID for the file.
*
* This attribute is only available for UNIX file systems.
*
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
*/
export const FILE_ATTRIBUTE_UNIX_UID: string | null
/**
* Extension point for memory usage monitoring functionality.
* See [Extending GIO][extending-gio].
*/
export const MEMORY_MONITOR_EXTENSION_POINT_NAME: string | null
/**
* The menu item attribute which holds the action name of the item. Action
* names are namespaced with an identifier for the action group in which the
* action resides. For example, "win." for window-specific actions and "app."
* for application-wide actions.
*
* See also g_menu_model_get_item_attribute() and g_menu_item_set_attribute().
*/
export const MENU_ATTRIBUTE_ACTION: string | null
/**
* The menu item attribute that holds the namespace for all action names in
* menus that are linked from this item.
*/
export const MENU_ATTRIBUTE_ACTION_NAMESPACE: string | null
/**
* The menu item attribute which holds the icon of the item.
*
* The icon is stored in the format returned by g_icon_serialize().
*
* This attribute is intended only to represent 'noun' icons such as
* favicons for a webpage, or application icons. It should not be used
* for 'verbs' (ie: stock icons).
*/
export const MENU_ATTRIBUTE_ICON: string | null
/**
* The menu item attribute which holds the label of the item.
*/
export const MENU_ATTRIBUTE_LABEL: string | null
/**
* The menu item attribute which holds the target with which the item's action
* will be activated.
*
* See also g_menu_item_set_action_and_target()
*/
export const MENU_ATTRIBUTE_TARGET: string | null
/**
* The maximum number of entries in a menu section supported by
* g_dbus_connection_export_menu_model().
*
* The exact value of the limit may change in future GLib versions.
*/
export const MENU_EXPORTER_MAX_SECTION_SIZE: number
/**
* The name of the link that associates a menu item with a section. The linked
* menu will usually be shown in place of the menu item, using the item's label
* as a header.
*
* See also g_menu_item_set_link().
*/
export const MENU_LINK_SECTION: string | null
/**
* The name of the link that associates a menu item with a submenu.
*
* See also g_menu_item_set_link().
*/
export const MENU_LINK_SUBMENU: string | null
export const NATIVE_VOLUME_MONITOR_EXTENSION_POINT_NAME: string | null
/**
* Extension point for network status monitoring functionality.
* See [Extending GIO][extending-gio].
*/
export const NETWORK_MONITOR_EXTENSION_POINT_NAME: string | null
/**
* Extension point for power profile usage monitoring functionality.
* See [Extending GIO][extending-gio].
*/
export const POWER_PROFILE_MONITOR_EXTENSION_POINT_NAME: string | null
/**
* Extension point for proxy functionality.
* See [Extending GIO][extending-gio].
*/
export const PROXY_EXTENSION_POINT_NAME: string | null
/**
* Extension point for proxy resolving functionality.
* See [Extending GIO][extending-gio].
*/
export const PROXY_RESOLVER_EXTENSION_POINT_NAME: string | null
/**
* Extension point for #GSettingsBackend functionality.
*/
export const SETTINGS_BACKEND_EXTENSION_POINT_NAME: string | null
/**
* Extension point for TLS functionality via #GTlsBackend.
* See [Extending GIO][extending-gio].
*/
export const TLS_BACKEND_EXTENSION_POINT_NAME: string | null
/**
* The purpose used to verify the client certificate in a TLS connection.
* Used by TLS servers.
*/
export const TLS_DATABASE_PURPOSE_AUTHENTICATE_CLIENT: string | null
/**
* The purpose used to verify the server certificate in a TLS connection. This
* is the most common purpose in use. Used by TLS clients.
*/
export const TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER: string | null
/**
* Extension point for #GVfs functionality.
* See [Extending GIO][extending-gio].
*/
export const VFS_EXTENSION_POINT_NAME: string | null
/**
* The string used to obtain the volume class with g_volume_get_identifier().
*
* Known volume classes include `device`, `network`, and `loop`. Other
* classes may be added in the future.
*
* This is intended to be used by applications to classify #GVolume
* instances into different sections - for example a file manager or
* file chooser can use this information to show `network` volumes under
* a "Network" heading and `device` volumes under a "Devices" heading.
*/
export const VOLUME_IDENTIFIER_KIND_CLASS: string | null
/**
* The string used to obtain a Hal UDI with g_volume_get_identifier().
*/
export const VOLUME_IDENTIFIER_KIND_HAL_UDI: string | null
/**
* The string used to obtain a filesystem label with g_volume_get_identifier().
*/
export const VOLUME_IDENTIFIER_KIND_LABEL: string | null
/**
* The string used to obtain a NFS mount with g_volume_get_identifier().
*/
export const VOLUME_IDENTIFIER_KIND_NFS_MOUNT: string | null
/**
* The string used to obtain a Unix device path with g_volume_get_identifier().
*/
export const VOLUME_IDENTIFIER_KIND_UNIX_DEVICE: string | null
/**
* The string used to obtain a UUID with g_volume_get_identifier().
*/
export const VOLUME_IDENTIFIER_KIND_UUID: string | null
/**
* Extension point for volume monitor functionality.
* See [Extending GIO][extending-gio].
*/
export const VOLUME_MONITOR_EXTENSION_POINT_NAME: string | null
/**
* Checks if `action_name` is valid.
*
* `action_name` is valid if it consists only of alphanumeric characters,
* plus '-' and '.'. The empty string is not a valid action name.
*
* It is an error to call this function with a non-utf8 `action_name`.
* `action_name` must not be %NULL.
* @param action_name a potential action name
* @returns %TRUE if @action_name is valid
*/
export function action_name_is_valid(action_name: string | null): boolean
/**
* Parses a detailed action name into its separate name and target
* components.
*
* Detailed action names can have three formats.
*
* The first format is used to represent an action name with no target
* value and consists of just an action name containing no whitespace
* nor the characters `:`, `(` or `)`. For example: `app.action`.
*
* The second format is used to represent an action with a target value
* that is a non-empty string consisting only of alphanumerics, plus `-`
* and `.`. In that case, the action name and target value are
* separated by a double colon (`::`). For example:
* `app.action::target`.
*
* The third format is used to represent an action with any type of
* target value, including strings. The target value follows the action
* name, surrounded in parens. For example: `app.action(42)`. The
* target value is parsed using g_variant_parse(). If a tuple-typed
* value is desired, it must be specified in the same way, resulting in
* two sets of parens, for example: `app.action((1,2,3))`. A string
* target can be specified this way as well: `app.action('target')`.
* For strings, this third format must be used if target value is
* empty or contains characters other than alphanumerics, `-` and `.`.
*
* If this function returns %TRUE, a non-%NULL value is guaranteed to be returned
* in `action_name` (if a pointer is passed in). A %NULL value may still be
* returned in `target_value,` as the `detailed_name` may not contain a target.
*
* If returned, the #GVariant in `target_value` is guaranteed to not be floating.
* @param detailed_name a detailed action name
* @returns %TRUE if successful, else %FALSE with @error set
*/
export function action_parse_detailed_name(detailed_name: string | null): [ /* returnType */ boolean, /* action_name */ string | null, /* target_value */ GLib.Variant | null ]
/**
* Formats a detailed action name from `action_name` and `target_value`.
*
* It is an error to call this function with an invalid action name.
*
* This function is the opposite of g_action_parse_detailed_name().
* It will produce a string that can be parsed back to the `action_name`
* and `target_value` by that function.
*
* See that function for the types of strings that will be printed by
* this function.
* @param action_name a valid action name
* @param target_value a #GVariant target value, or %NULL
* @returns a detailed format string
*/
export function action_print_detailed_name(action_name: string | null, target_value: GLib.Variant | null): string | null
/**
* Creates a new #GAppInfo from the given information.
*
* Note that for `commandline,` the quoting rules of the Exec key of the
* [freedesktop.org Desktop Entry Specification](http://freedesktop.org/Standards/desktop-entry-spec)
* are applied. For example, if the `commandline` contains
* percent-encoded URIs, the percent-character must be doubled in order to prevent it from
* being swallowed by Exec key unquoting. See the specification for exact quoting rules.
* @param commandline the commandline to use
* @param application_name the application name, or %NULL to use `commandline`
* @param flags flags that can specify details of the created #GAppInfo
* @returns new #GAppInfo for given command.
*/
export function app_info_create_from_commandline(commandline: string, application_name: string | null, flags: AppInfoCreateFlags): AppInfo
/**
* Gets a list of all of the applications currently registered
* on this system.
*
* For desktop files, this includes applications that have
* `NoDisplay=true` set or are excluded from display by means
* of `OnlyShowIn` or `NotShowIn`. See g_app_info_should_show().
* The returned list does not include applications which have
* the `Hidden` key set.
* @returns a newly allocated #GList of references to #GAppInfos.
*/
export function app_info_get_all(): AppInfo[]
/**
* Gets a list of all #GAppInfos for a given content type,
* including the recommended and fallback #GAppInfos. See
* g_app_info_get_recommended_for_type() and
* g_app_info_get_fallback_for_type().
* @param content_type the content type to find a #GAppInfo for
* @returns #GList of #GAppInfos for given @content_type or %NULL on error.
*/
export function app_info_get_all_for_type(content_type: string | null): AppInfo[]
/**
* Gets the default #GAppInfo for a given content type.
* @param content_type the content type to find a #GAppInfo for
* @param must_support_uris if %TRUE, the #GAppInfo is expected to support URIs
* @returns #GAppInfo for given @content_type or %NULL on error.
*/
export function app_info_get_default_for_type(content_type: string | null, must_support_uris: boolean): AppInfo | null
/**
* Asynchronously gets the default #GAppInfo for a given content type.
* @param content_type the content type to find a #GAppInfo for
* @param must_support_uris if %TRUE, the #GAppInfo is expected to support URIs
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is done
*/
export function app_info_get_default_for_type_async(content_type: string | null, must_support_uris: boolean, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of app_info_get_default_for_type_async
/**
* Promisified version of {@link app_info_get_default_for_type_async}
*
* Asynchronously gets the default #GAppInfo for a given content type.
* @param content_type the content type to find a #GAppInfo for
* @param must_support_uris if %TRUE, the #GAppInfo is expected to support URIs
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: #GAppInfo for given @content_type or %NULL on error.
*/
export function app_info_get_default_for_type_async(content_type: string | null, must_support_uris: boolean, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes a default #GAppInfo lookup started by
* g_app_info_get_default_for_type_async().
*
* If no #GAppInfo is found, then `error` will be set to %G_IO_ERROR_NOT_FOUND.
* @param result a #GAsyncResult
* @returns #GAppInfo for given @content_type or %NULL on error.
*/
export function app_info_get_default_for_type_finish(result: AsyncResult): AppInfo
/**
* Gets the default application for handling URIs with
* the given URI scheme. A URI scheme is the initial part
* of the URI, up to but not including the ':', e.g. "http",
* "ftp" or "sip".
* @param uri_scheme a string containing a URI scheme.
* @returns #GAppInfo for given @uri_scheme or %NULL on error.
*/
export function app_info_get_default_for_uri_scheme(uri_scheme: string | null): AppInfo | null
/**
* Asynchronously gets the default application for handling URIs with
* the given URI scheme. A URI scheme is the initial part
* of the URI, up to but not including the ':', e.g. "http",
* "ftp" or "sip".
* @param uri_scheme a string containing a URI scheme.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is done
*/
export function app_info_get_default_for_uri_scheme_async(uri_scheme: string | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of app_info_get_default_for_uri_scheme_async
/**
* Promisified version of {@link app_info_get_default_for_uri_scheme_async}
*
* Asynchronously gets the default application for handling URIs with
* the given URI scheme. A URI scheme is the initial part
* of the URI, up to but not including the ':', e.g. "http",
* "ftp" or "sip".
* @param uri_scheme a string containing a URI scheme.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: #GAppInfo for given @uri_scheme or %NULL on error.
*/
export function app_info_get_default_for_uri_scheme_async(uri_scheme: string | null, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes a default #GAppInfo lookup started by
* g_app_info_get_default_for_uri_scheme_async().
*
* If no #GAppInfo is found, then `error` will be set to %G_IO_ERROR_NOT_FOUND.
* @param result a #GAsyncResult
* @returns #GAppInfo for given @uri_scheme or %NULL on error.
*/
export function app_info_get_default_for_uri_scheme_finish(result: AsyncResult): AppInfo
/**
* Gets a list of fallback #GAppInfos for a given content type, i.e.
* those applications which claim to support the given content type
* by MIME type subclassing and not directly.
* @param content_type the content type to find a #GAppInfo for
* @returns #GList of #GAppInfos for given @content_type or %NULL on error.
*/
export function app_info_get_fallback_for_type(content_type: string | null): AppInfo[]
/**
* Gets a list of recommended #GAppInfos for a given content type, i.e.
* those applications which claim to support the given content type exactly,
* and not by MIME type subclassing.
* Note that the first application of the list is the last used one, i.e.
* the last one for which g_app_info_set_as_last_used_for_type() has been
* called.
* @param content_type the content type to find a #GAppInfo for
* @returns #GList of #GAppInfos for given @content_type or %NULL on error.
*/
export function app_info_get_recommended_for_type(content_type: string | null): AppInfo[]
/**
* Utility function that launches the default application
* registered to handle the specified uri. Synchronous I/O
* is done on the uri to detect the type of the file if
* required.
*
* The D-Bus–activated applications don't have to be started if your application
* terminates too soon after this function. To prevent this, use
* g_app_info_launch_default_for_uri_async() instead.
* @param uri the uri to show
* @param context an optional #GAppLaunchContext
* @returns %TRUE on success, %FALSE on error.
*/
export function app_info_launch_default_for_uri(uri: string | null, context: AppLaunchContext | null): boolean
/**
* Async version of g_app_info_launch_default_for_uri().
*
* This version is useful if you are interested in receiving
* error information in the case where the application is
* sandboxed and the portal may present an application chooser
* dialog to the user.
*
* This is also useful if you want to be sure that the D-Bus–activated
* applications are really started before termination and if you are interested
* in receiving error information from their activation.
* @param uri the uri to show
* @param context an optional #GAppLaunchContext
* @param cancellable a #GCancellable
* @param callback a #GAsyncReadyCallback to call when the request is done
*/
export function app_info_launch_default_for_uri_async(uri: string | null, context: AppLaunchContext | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of app_info_launch_default_for_uri_async
/**
* Promisified version of {@link app_info_launch_default_for_uri_async}
*
* Async version of g_app_info_launch_default_for_uri().
*
* This version is useful if you are interested in receiving
* error information in the case where the application is
* sandboxed and the portal may present an application chooser
* dialog to the user.
*
* This is also useful if you want to be sure that the D-Bus–activated
* applications are really started before termination and if you are interested
* in receiving error information from their activation.
* @param uri the uri to show
* @param context an optional #GAppLaunchContext
* @param cancellable a #GCancellable
* @returns A Promise of: %TRUE if the launch was successful, %FALSE if @error is set
*/
export function app_info_launch_default_for_uri_async(uri: string | null, context: AppLaunchContext | null, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes an asynchronous launch-default-for-uri operation.
* @param result a #GAsyncResult
* @returns %TRUE if the launch was successful, %FALSE if @error is set
*/
export function app_info_launch_default_for_uri_finish(result: AsyncResult): boolean
/**
* Removes all changes to the type associations done by
* g_app_info_set_as_default_for_type(),
* g_app_info_set_as_default_for_extension(),
* g_app_info_add_supports_type() or
* g_app_info_remove_supports_type().
* @param content_type a content type
*/
export function app_info_reset_type_associations(content_type: string | null): void
/**
* Helper function for constructing #GAsyncInitable object. This is
* similar to g_object_newv() but also initializes the object asynchronously.
*
* When the initialization is finished, `callback` will be called. You can
* then call g_async_initable_new_finish() to get the new object and check
* for any errors.
* @param object_type a #GType supporting #GAsyncInitable.
* @param n_parameters the number of parameters in `parameters`
* @param parameters the parameters to use to construct the object
* @param io_priority the [I/O priority][io-priority] of the operation
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback to call when the initialization is finished
*/
export function async_initable_newv_async(object_type: GObject.GType, n_parameters: number, parameters: GObject.Parameter, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Asynchronously connects to the message bus specified by `bus_type`.
*
* When the operation is finished, `callback` will be invoked. You can
* then call g_bus_get_finish() to get the result of the operation.
*
* This is an asynchronous failable function. See g_bus_get_sync() for
* the synchronous version.
* @param bus_type a #GBusType
* @param cancellable a #GCancellable or %NULL
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
export function bus_get(bus_type: BusType, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an operation started with g_bus_get().
*
* The returned object is a singleton, that is, shared with other
* callers of g_bus_get() and g_bus_get_sync() for `bus_type`. In the
* event that you need a private message bus connection, use
* g_dbus_address_get_for_bus_sync() and
* g_dbus_connection_new_for_address() with
* G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT and
* G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION flags.
*
* Note that the returned #GDBusConnection object will (usually) have
* the #GDBusConnection:exit-on-close property set to %TRUE.
* @param res a #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_bus_get()
* @returns a #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
*/
export function bus_get_finish(res: AsyncResult): DBusConnection
/**
* Synchronously connects to the message bus specified by `bus_type`.
* Note that the returned object may shared with other callers,
* e.g. if two separate parts of a process calls this function with
* the same `bus_type,` they will share the same object.
*
* This is a synchronous failable function. See g_bus_get() and
* g_bus_get_finish() for the asynchronous version.
*
* The returned object is a singleton, that is, shared with other
* callers of g_bus_get() and g_bus_get_sync() for `bus_type`. In the
* event that you need a private message bus connection, use
* g_dbus_address_get_for_bus_sync() and
* g_dbus_connection_new_for_address() with
* G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT and
* G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION flags.
*
* Note that the returned #GDBusConnection object will (usually) have
* the #GDBusConnection:exit-on-close property set to %TRUE.
* @param bus_type a #GBusType
* @param cancellable a #GCancellable or %NULL
* @returns a #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
*/
export function bus_get_sync(bus_type: BusType, cancellable: Cancellable | null): DBusConnection
/**
* Version of g_bus_own_name_on_connection() using closures instead of
* callbacks for easier binding in other languages.
* @param connection a #GDBusConnection
* @param name the well-known name to own
* @param flags a set of flags from the #GBusNameOwnerFlags enumeration
* @param name_acquired_closure #GClosure to invoke when `name` is acquired or %NULL
* @param name_lost_closure #GClosure to invoke when `name` is lost or %NULL
* @returns an identifier (never 0) that can be used with g_bus_unown_name() to stop owning the name.
*/
export function bus_own_name_on_connection(connection: DBusConnection, name: string | null, flags: BusNameOwnerFlags, name_acquired_closure: GObject.TClosure | null, name_lost_closure: GObject.TClosure | null): number
/**
* Version of g_bus_own_name() using closures instead of callbacks for
* easier binding in other languages.
* @param bus_type the type of bus to own a name on
* @param name the well-known name to own
* @param flags a set of flags from the #GBusNameOwnerFlags enumeration
* @param bus_acquired_closure #GClosure to invoke when connected to the bus of type `bus_type` or %NULL
* @param name_acquired_closure #GClosure to invoke when `name` is acquired or %NULL
* @param name_lost_closure #GClosure to invoke when `name` is lost or %NULL
* @returns an identifier (never 0) that can be used with g_bus_unown_name() to stop owning the name.
*/
export function bus_own_name(bus_type: BusType, name: string | null, flags: BusNameOwnerFlags, bus_acquired_closure: GObject.TClosure | null, name_acquired_closure: GObject.TClosure | null, name_lost_closure: GObject.TClosure | null): number
/**
* Stops owning a name.
*
* Note that there may still be D-Bus traffic to process (relating to owning
* and unowning the name) in the current thread-default #GMainContext after
* this function has returned. You should continue to iterate the #GMainContext
* until the #GDestroyNotify function passed to g_bus_own_name() is called, in
* order to avoid memory leaks through callbacks queued on the #GMainContext
* after it’s stopped being iterated.
* @param owner_id an identifier obtained from g_bus_own_name()
*/
export function bus_unown_name(owner_id: number): void
/**
* Stops watching a name.
*
* Note that there may still be D-Bus traffic to process (relating to watching
* and unwatching the name) in the current thread-default #GMainContext after
* this function has returned. You should continue to iterate the #GMainContext
* until the #GDestroyNotify function passed to g_bus_watch_name() is called, in
* order to avoid memory leaks through callbacks queued on the #GMainContext
* after it’s stopped being iterated.
* @param watcher_id An identifier obtained from g_bus_watch_name()
*/
export function bus_unwatch_name(watcher_id: number): void
/**
* Version of g_bus_watch_name_on_connection() using closures instead of callbacks for
* easier binding in other languages.
* @param connection A #GDBusConnection.
* @param name The name (well-known or unique) to watch.
* @param flags Flags from the #GBusNameWatcherFlags enumeration.
* @param name_appeared_closure #GClosure to invoke when `name` is known to exist or %NULL.
* @param name_vanished_closure #GClosure to invoke when `name` is known to not exist or %NULL.
* @returns An identifier (never 0) that can be used with g_bus_unwatch_name() to stop watching the name.
*/
export function bus_watch_name_on_connection(connection: DBusConnection, name: string | null, flags: BusNameWatcherFlags, name_appeared_closure: GObject.TClosure | null, name_vanished_closure: GObject.TClosure | null): number
/**
* Version of g_bus_watch_name() using closures instead of callbacks for
* easier binding in other languages.
* @param bus_type The type of bus to watch a name on.
* @param name The name (well-known or unique) to watch.
* @param flags Flags from the #GBusNameWatcherFlags enumeration.
* @param name_appeared_closure #GClosure to invoke when `name` is known to exist or %NULL.
* @param name_vanished_closure #GClosure to invoke when `name` is known to not exist or %NULL.
* @returns An identifier (never 0) that can be used with g_bus_unwatch_name() to stop watching the name.
*/
export function bus_watch_name(bus_type: BusType, name: string | null, flags: BusNameWatcherFlags, name_appeared_closure: GObject.TClosure | null, name_vanished_closure: GObject.TClosure | null): number
/**
* Checks if a content type can be executable. Note that for instance
* things like text files can be executables (i.e. scripts and batch files).
* @param type a content type string
* @returns %TRUE if the file type corresponds to a type that can be executable, %FALSE otherwise.
*/
export function content_type_can_be_executable(type: string | null): boolean
/**
* Compares two content types for equality.
* @param type1 a content type string
* @param type2 a content type string
* @returns %TRUE if the two strings are identical or equivalent, %FALSE otherwise.
*/
export function content_type_equals(type1: string | null, type2: string | null): boolean
/**
* Tries to find a content type based on the mime type name.
* @param mime_type a mime type string
* @returns Newly allocated string with content type or %NULL. Free with g_free()
*/
export function content_type_from_mime_type(mime_type: string | null): string | null
/**
* Gets the human readable description of the content type.
* @param type a content type string
* @returns a short description of the content type @type. Free the returned string with g_free()
*/
export function content_type_get_description(type: string | null): string | null
/**
* Gets the generic icon name for a content type.
*
* See the
* [shared-mime-info](http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec)
* specification for more on the generic icon name.
* @param type a content type string
* @returns the registered generic icon name for the given @type, or %NULL if unknown. Free with g_free()
*/
export function content_type_get_generic_icon_name(type: string | null): string | null
/**
* Gets the icon for a content type.
* @param type a content type string
* @returns #GIcon corresponding to the content type. Free the returned object with g_object_unref()
*/
export function content_type_get_icon(type: string | null): Icon
/**
* Get the list of directories which MIME data is loaded from. See
* g_content_type_set_mime_dirs() for details.
* @returns %NULL-terminated list of directories to load MIME data from, including any `mime/` subdirectory, and with the first directory to try listed first
*/
export function content_type_get_mime_dirs(): string[]
/**
* Gets the mime type for the content type, if one is registered.
* @param type a content type string
* @returns the registered mime type for the given @type, or %NULL if unknown; free with g_free().
*/
export function content_type_get_mime_type(type: string | null): string | null
/**
* Gets the symbolic icon for a content type.
* @param type a content type string
* @returns symbolic #GIcon corresponding to the content type. Free the returned object with g_object_unref()
*/
export function content_type_get_symbolic_icon(type: string | null): Icon
/**
* Guesses the content type based on example data. If the function is
* uncertain, `result_uncertain` will be set to %TRUE. Either `filename`
* or `data` may be %NULL, in which case the guess will be based solely
* on the other argument.
* @param filename a path, or %NULL
* @param data a stream of data, or %NULL
* @returns a string indicating a guessed content type for the given data. Free with g_free()
*/
export function content_type_guess(filename: string | null, data: Uint8Array | null): [ /* returnType */ string | null, /* result_uncertain */ boolean ]
/**
* Tries to guess the type of the tree with root `root,` by
* looking at the files it contains. The result is an array
* of content types, with the best guess coming first.
*
* The types returned all have the form x-content/foo, e.g.
* x-content/audio-cdda (for audio CDs) or x-content/image-dcf
* (for a camera memory card). See the
* [shared-mime-info](http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec)
* specification for more on x-content types.
*
* This function is useful in the implementation of
* g_mount_guess_content_type().
* @param root the root of the tree to guess a type for
* @returns an %NULL-terminated array of zero or more content types. Free with g_strfreev()
*/
export function content_type_guess_for_tree(root: File): string[]
/**
* Determines if `type` is a subset of `supertype`.
* @param type a content type string
* @param supertype a content type string
* @returns %TRUE if @type is a kind of @supertype, %FALSE otherwise.
*/
export function content_type_is_a(type: string | null, supertype: string | null): boolean
/**
* Determines if `type` is a subset of `mime_type`.
* Convenience wrapper around g_content_type_is_a().
* @param type a content type string
* @param mime_type a mime type string
* @returns %TRUE if @type is a kind of @mime_type, %FALSE otherwise.
*/
export function content_type_is_mime_type(type: string | null, mime_type: string | null): boolean
/**
* Checks if the content type is the generic "unknown" type.
* On UNIX this is the "application/octet-stream" mimetype,
* while on win32 it is "*" and on OSX it is a dynamic type
* or octet-stream.
* @param type a content type string
* @returns %TRUE if the type is the unknown type.
*/
export function content_type_is_unknown(type: string | null): boolean
/**
* Set the list of directories used by GIO to load the MIME database.
* If `dirs` is %NULL, the directories used are the default:
*
* - the `mime` subdirectory of the directory in `$XDG_DATA_HOME`
* - the `mime` subdirectory of every directory in `$XDG_DATA_DIRS`
*
* This function is intended to be used when writing tests that depend on
* information stored in the MIME database, in order to control the data.
*
* Typically, in case your tests use %G_TEST_OPTION_ISOLATE_DIRS, but they
* depend on the system’s MIME database, you should call this function
* with `dirs` set to %NULL before calling g_test_init(), for instance:
*
*
* ```c
* // Load MIME data from the system
* g_content_type_set_mime_dirs (NULL);
* // Isolate the environment
* g_test_init (&argc, &argv, G_TEST_OPTION_ISOLATE_DIRS, NULL);
*
* …
*
* return g_test_run ();
* ```
*
* @param dirs %NULL-terminated list of directories to load MIME data from, including any `mime/` subdirectory, and with the first directory to try listed first
*/
export function content_type_set_mime_dirs(dirs: string[] | null): void
/**
* Gets a list of strings containing all the registered content types
* known to the system. The list and its data should be freed using
* `g_list_free_full (list, g_free)`.
* @returns list of the registered content types
*/
export function content_types_get_registered(): string[]
/**
* Escape `string` so it can appear in a D-Bus address as the value
* part of a key-value pair.
*
* For instance, if `string` is `/run/bus-for-:0`,
* this function would return `/run/bus-for-%3A0`,
* which could be used in a D-Bus address like
* `unix:nonce-tcp:host=127.0.0.1,port=42,noncefile=/run/bus-for-%3A0`.
* @param string an unescaped string to be included in a D-Bus address as the value in a key-value pair
* @returns a copy of @string with all non-optionally-escaped bytes escaped
*/
export function dbus_address_escape_value(string: string | null): string | null
/**
* Synchronously looks up the D-Bus address for the well-known message
* bus instance specified by `bus_type`. This may involve using various
* platform specific mechanisms.
*
* The returned address will be in the
* [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
* @param bus_type a #GBusType
* @param cancellable a #GCancellable or %NULL
* @returns a valid D-Bus address string for @bus_type or %NULL if @error is set
*/
export function dbus_address_get_for_bus_sync(bus_type: BusType, cancellable: Cancellable | null): string | null
/**
* Asynchronously connects to an endpoint specified by `address` and
* sets up the connection so it is in a state to run the client-side
* of the D-Bus authentication conversation. `address` must be in the
* [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
*
* When the operation is finished, `callback` will be invoked. You can
* then call g_dbus_address_get_stream_finish() to get the result of
* the operation.
*
* This is an asynchronous failable function. See
* g_dbus_address_get_stream_sync() for the synchronous version.
* @param address A valid D-Bus address.
* @param cancellable A #GCancellable or %NULL.
* @param callback A #GAsyncReadyCallback to call when the request is satisfied.
*/
export function dbus_address_get_stream(address: string | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an operation started with g_dbus_address_get_stream().
*
* A server is not required to set a GUID, so `out_guid` may be set to %NULL
* even on success.
* @param res A #GAsyncResult obtained from the GAsyncReadyCallback passed to g_dbus_address_get_stream().
* @returns A #GIOStream or %NULL if @error is set.
*/
export function dbus_address_get_stream_finish(res: AsyncResult): [ /* returnType */ IOStream, /* out_guid */ string | null ]
/**
* Synchronously connects to an endpoint specified by `address` and
* sets up the connection so it is in a state to run the client-side
* of the D-Bus authentication conversation. `address` must be in the
* [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
*
* A server is not required to set a GUID, so `out_guid` may be set to %NULL
* even on success.
*
* This is a synchronous failable function. See
* g_dbus_address_get_stream() for the asynchronous version.
* @param address A valid D-Bus address.
* @param cancellable A #GCancellable or %NULL.
* @returns A #GIOStream or %NULL if @error is set.
*/
export function dbus_address_get_stream_sync(address: string | null, cancellable: Cancellable | null): [ /* returnType */ IOStream, /* out_guid */ string | null ]
/**
* Looks up the value of an annotation.
*
* The cost of this function is O(n) in number of annotations.
* @param annotations A %NULL-terminated array of annotations or %NULL.
* @param name The name of the annotation to look up.
* @returns The value or %NULL if not found. Do not free, it is owned by @annotations.
*/
export function dbus_annotation_info_lookup(annotations: DBusAnnotationInfo[] | null, name: string | null): string | null
/**
* Creates a D-Bus error name to use for `error`. If `error` matches
* a registered error (cf. g_dbus_error_register_error()), the corresponding
* D-Bus error name will be returned.
*
* Otherwise the a name of the form
* `org.gtk.GDBus.UnmappedGError.Quark._ESCAPED_QUARK_NAME.Code_ERROR_CODE`
* will be used. This allows other GDBus applications to map the error
* on the wire back to a #GError using g_dbus_error_new_for_dbus_error().
*
* This function is typically only used in object mappings to put a
* #GError on the wire. Regular applications should not use it.
* @param error A #GError.
* @returns A D-Bus error name (never %NULL). Free with g_free().
*/
export function dbus_error_encode_gerror(error: GLib.Error): string | null
/**
* Gets the D-Bus error name used for `error,` if any.
*
* This function is guaranteed to return a D-Bus error name for all
* #GErrors returned from functions handling remote method calls
* (e.g. g_dbus_connection_call_finish()) unless
* g_dbus_error_strip_remote_error() has been used on `error`.
* @param error a #GError
* @returns an allocated string or %NULL if the D-Bus error name could not be found. Free with g_free().
*/
export function dbus_error_get_remote_error(error: GLib.Error): string | null
/**
* Checks if `error` represents an error received via D-Bus from a remote peer. If so,
* use g_dbus_error_get_remote_error() to get the name of the error.
* @param error A #GError.
* @returns %TRUE if @error represents an error from a remote peer, %FALSE otherwise.
*/
export function dbus_error_is_remote_error(error: GLib.Error): boolean
/**
* Creates a #GError based on the contents of `dbus_error_name` and
* `dbus_error_message`.
*
* Errors registered with g_dbus_error_register_error() will be looked
* up using `dbus_error_name` and if a match is found, the error domain
* and code is used. Applications can use g_dbus_error_get_remote_error()
* to recover `dbus_error_name`.
*
* If a match against a registered error is not found and the D-Bus
* error name is in a form as returned by g_dbus_error_encode_gerror()
* the error domain and code encoded in the name is used to
* create the #GError. Also, `dbus_error_name` is added to the error message
* such that it can be recovered with g_dbus_error_get_remote_error().
*
* Otherwise, a #GError with the error code %G_IO_ERROR_DBUS_ERROR
* in the %G_IO_ERROR error domain is returned. Also, `dbus_error_name` is
* added to the error message such that it can be recovered with
* g_dbus_error_get_remote_error().
*
* In all three cases, `dbus_error_name` can always be recovered from the
* returned #GError using the g_dbus_error_get_remote_error() function
* (unless g_dbus_error_strip_remote_error() hasn't been used on the returned error).
*
* This function is typically only used in object mappings to prepare
* #GError instances for applications. Regular applications should not use
* it.
* @param dbus_error_name D-Bus error name.
* @param dbus_error_message D-Bus error message.
* @returns An allocated #GError. Free with g_error_free().
*/
export function dbus_error_new_for_dbus_error(dbus_error_name: string | null, dbus_error_message: string | null): GLib.Error
export function dbus_error_quark(): GLib.Quark
/**
* Creates an association to map between `dbus_error_name` and
* #GErrors specified by `error_domain` and `error_code`.
*
* This is typically done in the routine that returns the #GQuark for
* an error domain.
* @param error_domain A #GQuark for an error domain.
* @param error_code An error code.
* @param dbus_error_name A D-Bus error name.
* @returns %TRUE if the association was created, %FALSE if it already exists.
*/
export function dbus_error_register_error(error_domain: GLib.Quark, error_code: number, dbus_error_name: string | null): boolean
/**
* Helper function for associating a #GError error domain with D-Bus error names.
*
* While `quark_volatile` has a `volatile` qualifier, this is a historical
* artifact and the argument passed to it should not be `volatile`.
* @param error_domain_quark_name The error domain name.
* @param quark_volatile A pointer where to store the #GQuark.
* @param entries A pointer to `num_entries` #GDBusErrorEntry struct items.
*/
export function dbus_error_register_error_domain(error_domain_quark_name: string | null, quark_volatile: number, entries: DBusErrorEntry[]): void
/**
* Looks for extra information in the error message used to recover
* the D-Bus error name and strips it if found. If stripped, the
* message field in `error` will correspond exactly to what was
* received on the wire.
*
* This is typically used when presenting errors to the end user.
* @param error A #GError.
* @returns %TRUE if information was stripped, %FALSE otherwise.
*/
export function dbus_error_strip_remote_error(error: GLib.Error): boolean
/**
* Destroys an association previously set up with g_dbus_error_register_error().
* @param error_domain A #GQuark for an error domain.
* @param error_code An error code.
* @param dbus_error_name A D-Bus error name.
* @returns %TRUE if the association was destroyed, %FALSE if it wasn't found.
*/
export function dbus_error_unregister_error(error_domain: GLib.Quark, error_code: number, dbus_error_name: string | null): boolean
/**
* This is a language binding friendly version of g_dbus_escape_object_path_bytestring().
* @param s the string to escape
* @returns an escaped version of @s. Free with g_free().
*/
export function dbus_escape_object_path(s: string | null): string | null
/**
* Escapes `bytes` for use in a D-Bus object path component.
* `bytes` is an array of zero or more nonzero bytes in an
* unspecified encoding, followed by a single zero byte.
*
* The escaping method consists of replacing all non-alphanumeric
* characters (see g_ascii_isalnum()) with their hexadecimal value
* preceded by an underscore (`_`). For example:
* `foo.bar.baz` will become `foo_2ebar_2ebaz`.
*
* This method is appropriate to use when the input is nearly
* a valid object path component but is not when your input
* is far from being a valid object path component.
* Other escaping algorithms are also valid to use with
* D-Bus object paths.
*
* This can be reversed with g_dbus_unescape_object_path().
* @param bytes the string of bytes to escape
* @returns an escaped version of @bytes. Free with g_free().
*/
export function dbus_escape_object_path_bytestring(bytes: Uint8Array): string | null
/**
* Generate a D-Bus GUID that can be used with
* e.g. g_dbus_connection_new().
*
* See the
* [D-Bus specification](https://dbus.freedesktop.org/doc/dbus-specification.html#uuids)
* regarding what strings are valid D-Bus GUIDs. The specification refers to
* these as ‘UUIDs’ whereas GLib (for historical reasons) refers to them as
* ‘GUIDs’. The terms are interchangeable.
*
* Note that D-Bus GUIDs do not follow
* [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122).
* @returns A valid D-Bus GUID. Free with g_free().
*/
export function dbus_generate_guid(): string | null
/**
* Converts a #GValue to a #GVariant of the type indicated by the `type`
* parameter.
*
* The conversion is using the following rules:
*
* - `G_TYPE_STRING`: 's', 'o', 'g' or 'ay'
* - `G_TYPE_STRV`: 'as', 'ao' or 'aay'
* - `G_TYPE_BOOLEAN`: 'b'
* - `G_TYPE_UCHAR`: 'y'
* - `G_TYPE_INT`: 'i', 'n'
* - `G_TYPE_UINT`: 'u', 'q'
* - `G_TYPE_INT64`: 'x'
* - `G_TYPE_UINT64`: 't'
* - `G_TYPE_DOUBLE`: 'd'
* - `G_TYPE_VARIANT`: Any #GVariantType
*
* This can fail if e.g. `gvalue` is of type %G_TYPE_STRING and `type`
* is 'i', i.e. %G_VARIANT_TYPE_INT32. It will also fail for any #GType
* (including e.g. %G_TYPE_OBJECT and %G_TYPE_BOXED derived-types) not
* in the table above.
*
* Note that if `gvalue` is of type %G_TYPE_VARIANT and its value is
* %NULL, the empty #GVariant instance (never %NULL) for `type` is
* returned (e.g. 0 for scalar types, the empty string for string types,
* '/' for object path types, the empty array for any array type and so on).
*
* See the g_dbus_gvariant_to_gvalue() function for how to convert a
* #GVariant to a #GValue.
* @param gvalue A #GValue to convert to a #GVariant
* @param type A #GVariantType
* @returns A #GVariant (never floating) of #GVariantType @type holding the data from @gvalue or an empty #GVariant in case of failure. Free with g_variant_unref().
*/
export function dbus_gvalue_to_gvariant(gvalue: any, type: GLib.VariantType): GLib.Variant
/**
* Converts a #GVariant to a #GValue. If `value` is floating, it is consumed.
*
* The rules specified in the g_dbus_gvalue_to_gvariant() function are
* used - this function is essentially its reverse form. So, a #GVariant
* containing any basic or string array type will be converted to a #GValue
* containing a basic value or string array. Any other #GVariant (handle,
* variant, tuple, dict entry) will be converted to a #GValue containing that
* #GVariant.
*
* The conversion never fails - a valid #GValue is always returned in
* `out_gvalue`.
* @param value A #GVariant.
*/
export function dbus_gvariant_to_gvalue(value: GLib.Variant): /* out_gvalue */ any
/**
* Checks if `string` is a
* [D-Bus address](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
*
* This doesn't check if `string` is actually supported by #GDBusServer
* or #GDBusConnection - use g_dbus_is_supported_address() to do more
* checks.
* @param string A string.
* @returns %TRUE if @string is a valid D-Bus address, %FALSE otherwise.
*/
export function dbus_is_address(string: string | null): boolean
/**
* Check whether `string` is a valid D-Bus error name.
*
* This function returns the same result as g_dbus_is_interface_name(),
* because D-Bus error names are defined to have exactly the
* same syntax as interface names.
* @param string The string to check.
* @returns %TRUE if valid, %FALSE otherwise.
*/
export function dbus_is_error_name(string: string | null): boolean
/**
* Checks if `string` is a D-Bus GUID.
*
* See the documentation for g_dbus_generate_guid() for more information about
* the format of a GUID.
* @param string The string to check.
* @returns %TRUE if @string is a GUID, %FALSE otherwise.
*/
export function dbus_is_guid(string: string | null): boolean
/**
* Checks if `string` is a valid D-Bus interface name.
* @param string The string to check.
* @returns %TRUE if valid, %FALSE otherwise.
*/
export function dbus_is_interface_name(string: string | null): boolean
/**
* Checks if `string` is a valid D-Bus member (e.g. signal or method) name.
* @param string The string to check.
* @returns %TRUE if valid, %FALSE otherwise.
*/
export function dbus_is_member_name(string: string | null): boolean
/**
* Checks if `string` is a valid D-Bus bus name (either unique or well-known).
* @param string The string to check.
* @returns %TRUE if valid, %FALSE otherwise.
*/
export function dbus_is_name(string: string | null): boolean
/**
* Like g_dbus_is_address() but also checks if the library supports the
* transports in `string` and that key/value pairs for each transport
* are valid. See the specification of the
* [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
* @param string A string.
* @returns %TRUE if @string is a valid D-Bus address that is supported by this library, %FALSE if @error is set.
*/
export function dbus_is_supported_address(string: string | null): boolean
/**
* Checks if `string` is a valid D-Bus unique bus name.
* @param string The string to check.
* @returns %TRUE if valid, %FALSE otherwise.
*/
export function dbus_is_unique_name(string: string | null): boolean
/**
* Unescapes an string that was previously escaped with
* g_dbus_escape_object_path(). If the string is in a format that could
* not have been returned by g_dbus_escape_object_path(), this function
* returns %NULL.
*
* Encoding alphanumeric characters which do not need to be
* encoded is not allowed (e.g `_63` is not valid, the string
* should contain `c` instead).
* @param s the string to unescape
* @returns an unescaped version of @s, or %NULL if @s is not a string returned from g_dbus_escape_object_path(). Free with g_free().
*/
export function dbus_unescape_object_path(s: string | null): Uint8Array | null
/**
* Creates a new #GDtlsClientConnection wrapping `base_socket` which is
* assumed to communicate with the server identified by `server_identity`.
* @param base_socket the #GDatagramBased to wrap
* @param server_identity the expected identity of the server
* @returns the new #GDtlsClientConnection, or %NULL on error
*/
export function dtls_client_connection_new(base_socket: DatagramBased, server_identity: SocketConnectable | null): DtlsClientConnection
/**
* Creates a new #GDtlsServerConnection wrapping `base_socket`.
* @param base_socket the #GDatagramBased to wrap
* @param certificate the default server certificate, or %NULL
* @returns the new #GDtlsServerConnection, or %NULL on error
*/
export function dtls_server_connection_new(base_socket: DatagramBased, certificate: TlsCertificate | null): DtlsServerConnection
/**
* Constructs a #GFile from a vector of elements using the correct
* separator for filenames.
*
* Using this function is equivalent to calling g_build_filenamev(),
* followed by g_file_new_for_path() on the result.
* @param args %NULL-terminated array of strings containing the path elements.
* @returns a new #GFile
*/
export function file_new_build_filenamev(args: string[]): File
/**
* Creates a #GFile with the given argument from the command line.
* The value of `arg` can be either a URI, an absolute path or a
* relative path resolved relative to the current working directory.
* This operation never fails, but the returned object might not
* support any I/O operation if `arg` points to a malformed path.
*
* Note that on Windows, this function expects its argument to be in
* UTF-8 -- not the system code page. This means that you
* should not use this function with string from argv as it is passed
* to main(). g_win32_get_command_line() will return a UTF-8 version of
* the commandline. #GApplication also uses UTF-8 but
* g_application_command_line_create_file_for_arg() may be more useful
* for you there. It is also always possible to use this function with
* #GOptionContext arguments of type %G_OPTION_ARG_FILENAME.
* @param arg a command line string
* @returns a new #GFile. Free the returned object with g_object_unref().
*/
export function file_new_for_commandline_arg(arg: string): File
/**
* Creates a #GFile with the given argument from the command line.
*
* This function is similar to g_file_new_for_commandline_arg() except
* that it allows for passing the current working directory as an
* argument instead of using the current working directory of the
* process.
*
* This is useful if the commandline argument was given in a context
* other than the invocation of the current process.
*
* See also g_application_command_line_create_file_for_arg().
* @param arg a command line string
* @param cwd the current working directory of the commandline
* @returns a new #GFile
*/
export function file_new_for_commandline_arg_and_cwd(arg: string, cwd: string): File
/**
* Constructs a #GFile for a given path. This operation never
* fails, but the returned object might not support any I/O
* operation if `path` is malformed.
* @param path a string containing a relative or absolute path. The string must be encoded in the glib filename encoding.
* @returns a new #GFile for the given @path. Free the returned object with g_object_unref().
*/
export function file_new_for_path(path: string): File
/**
* Constructs a #GFile for a given URI. This operation never
* fails, but the returned object might not support any I/O
* operation if `uri` is malformed or if the uri type is
* not supported.
* @param uri a UTF-8 string containing a URI
* @returns a new #GFile for the given @uri. Free the returned object with g_object_unref().
*/
export function file_new_for_uri(uri: string | null): File
/**
* Opens a file in the preferred directory for temporary files (as
* returned by g_get_tmp_dir()) and returns a #GFile and
* #GFileIOStream pointing to it.
*
* `tmpl` should be a string in the GLib file name encoding
* containing a sequence of six 'X' characters, and containing no
* directory components. If it is %NULL, a default template is used.
*
* Unlike the other #GFile constructors, this will return %NULL if
* a temporary file could not be created.
* @param tmpl Template for the file name, as in g_file_open_tmp(), or %NULL for a default template
* @returns a new #GFile. Free the returned object with g_object_unref().
*/
export function file_new_tmp(tmpl: string | null): [ /* returnType */ File, /* iostream */ FileIOStream ]
/**
* Asynchronously opens a file in the preferred directory for temporary files
* (as returned by g_get_tmp_dir()) as g_file_new_tmp().
*
* `tmpl` should be a string in the GLib file name encoding
* containing a sequence of six 'X' characters, and containing no
* directory components. If it is %NULL, a default template is used.
* @param tmpl Template for the file name, as in g_file_open_tmp(), or %NULL for a default template
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is done
*/
export function file_new_tmp_async(tmpl: string | null, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of file_new_tmp_async
/**
* Promisified version of {@link file_new_tmp_async}
*
* Asynchronously opens a file in the preferred directory for temporary files
* (as returned by g_get_tmp_dir()) as g_file_new_tmp().
*
* `tmpl` should be a string in the GLib file name encoding
* containing a sequence of six 'X' characters, and containing no
* directory components. If it is %NULL, a default template is used.
* @param tmpl Template for the file name, as in g_file_open_tmp(), or %NULL for a default template
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: a new #GFile. Free the returned object with g_object_unref().
*/
export function file_new_tmp_async(tmpl: string | null, io_priority: number, cancellable: Cancellable | null): globalThis.Promise* iostream */ FileIOStream>
/**
* Asynchronously creates a directory in the preferred directory for
* temporary files (as returned by g_get_tmp_dir()) as g_dir_make_tmp().
*
* `tmpl` should be a string in the GLib file name encoding
* containing a sequence of six 'X' characters, and containing no
* directory components. If it is %NULL, a default template is used.
* @param tmpl Template for the file name, as in g_dir_make_tmp(), or %NULL for a default template
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is done
*/
export function file_new_tmp_dir_async(tmpl: string | null, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of file_new_tmp_dir_async
/**
* Promisified version of {@link file_new_tmp_dir_async}
*
* Asynchronously creates a directory in the preferred directory for
* temporary files (as returned by g_get_tmp_dir()) as g_dir_make_tmp().
*
* `tmpl` should be a string in the GLib file name encoding
* containing a sequence of six 'X' characters, and containing no
* directory components. If it is %NULL, a default template is used.
* @param tmpl Template for the file name, as in g_dir_make_tmp(), or %NULL for a default template
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: a new #GFile. Free the returned object with g_object_unref().
*/
export function file_new_tmp_dir_async(tmpl: string | null, io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes a temporary directory creation started by
* g_file_new_tmp_dir_async().
* @param result a #GAsyncResult
* @returns a new #GFile. Free the returned object with g_object_unref().
*/
export function file_new_tmp_dir_finish(result: AsyncResult): File
/**
* Finishes a temporary file creation started by g_file_new_tmp_async().
* @param result a #GAsyncResult
* @returns a new #GFile. Free the returned object with g_object_unref().
*/
export function file_new_tmp_finish(result: AsyncResult): [ /* returnType */ File, /* iostream */ FileIOStream ]
/**
* Constructs a #GFile with the given `parse_name` (i.e. something
* given by g_file_get_parse_name()). This operation never fails,
* but the returned object might not support any I/O operation if
* the `parse_name` cannot be parsed.
* @param parse_name a file name or path to be parsed
* @returns a new #GFile.
*/
export function file_parse_name(parse_name: string | null): File
/**
* Deserializes a #GIcon previously serialized using g_icon_serialize().
* @param value a #GVariant created with g_icon_serialize()
* @returns a #GIcon, or %NULL when deserialization fails.
*/
export function icon_deserialize(value: GLib.Variant): Icon | null
/**
* Generate a #GIcon instance from `str`. This function can fail if
* `str` is not valid - see g_icon_to_string() for discussion.
*
* If your application or library provides one or more #GIcon
* implementations you need to ensure that each #GType is registered
* with the type system prior to calling g_icon_new_for_string().
* @param str A string obtained via g_icon_to_string().
* @returns An object implementing the #GIcon interface or %NULL if @error is set.
*/
export function icon_new_for_string(str: string | null): Icon
/**
* Helper function for constructing #GInitable object. This is
* similar to g_object_newv() but also initializes the object
* and returns %NULL, setting an error on failure.
* @param object_type a #GType supporting #GInitable.
* @param parameters the parameters to use to construct the object
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns a newly allocated #GObject, or %NULL on error
*/
export function initable_newv(object_type: GObject.GType, parameters: GObject.Parameter[], cancellable: Cancellable | null): GObject.Object
/**
* Converts errno.h error codes into GIO error codes. The fallback
* value %G_IO_ERROR_FAILED is returned for error codes not currently
* handled (but note that future GLib releases may return a more
* specific value instead).
*
* As %errno is global and may be modified by intermediate function
* calls, you should save its value as soon as the call which sets it
* @param err_no Error number as defined in errno.h.
* @returns #GIOErrorEnum value for the given errno.h error number.
*/
export function io_error_from_errno(err_no: number): IOErrorEnum
/**
* Converts #GFileError error codes into GIO error codes.
* @param file_error a #GFileError.
* @returns #GIOErrorEnum value for the given #GFileError error value.
*/
export function io_error_from_file_error(file_error: GLib.FileError): IOErrorEnum
/**
* Gets the GIO Error Quark.
* @returns a #GQuark.
*/
export function io_error_quark(): GLib.Quark
/**
* Registers `type` as extension for the extension point with name
* `extension_point_name`.
*
* If `type` has already been registered as an extension for this
* extension point, the existing #GIOExtension object is returned.
* @param extension_point_name the name of the extension point
* @param type the #GType to register as extension
* @param extension_name the name for the extension
* @param priority the priority for the extension
* @returns a #GIOExtension object for #GType
*/
export function io_extension_point_implement(extension_point_name: string | null, type: GObject.GType, extension_name: string | null, priority: number): IOExtension
/**
* Looks up an existing extension point.
* @param name the name of the extension point
* @returns the #GIOExtensionPoint, or %NULL if there is no registered extension point with the given name.
*/
export function io_extension_point_lookup(name: string | null): IOExtensionPoint
/**
* Registers an extension point.
* @param name The name of the extension point
* @returns the new #GIOExtensionPoint. This object is owned by GIO and should not be freed.
*/
export function io_extension_point_register(name: string | null): IOExtensionPoint
/**
* Loads all the modules in the specified directory.
*
* If don't require all modules to be initialized (and thus registering
* all gtypes) then you can use g_io_modules_scan_all_in_directory()
* which allows delayed/lazy loading of modules.
* @param dirname pathname for a directory containing modules to load.
* @returns a list of #GIOModules loaded from the directory, All the modules are loaded into memory, if you want to unload them (enabling on-demand loading) you must call g_type_module_unuse() on all the modules. Free the list with g_list_free().
*/
export function io_modules_load_all_in_directory(dirname: string): IOModule[]
/**
* Loads all the modules in the specified directory.
*
* If don't require all modules to be initialized (and thus registering
* all gtypes) then you can use g_io_modules_scan_all_in_directory()
* which allows delayed/lazy loading of modules.
* @param dirname pathname for a directory containing modules to load.
* @param scope a scope to use when scanning the modules.
* @returns a list of #GIOModules loaded from the directory, All the modules are loaded into memory, if you want to unload them (enabling on-demand loading) you must call g_type_module_unuse() on all the modules. Free the list with g_list_free().
*/
export function io_modules_load_all_in_directory_with_scope(dirname: string, scope: IOModuleScope): IOModule[]
/**
* Scans all the modules in the specified directory, ensuring that
* any extension point implemented by a module is registered.
*
* This may not actually load and initialize all the types in each
* module, some modules may be lazily loaded and initialized when
* an extension point it implements is used with e.g.
* g_io_extension_point_get_extensions() or
* g_io_extension_point_get_extension_by_name().
*
* If you need to guarantee that all types are loaded in all the modules,
* use g_io_modules_load_all_in_directory().
* @param dirname pathname for a directory containing modules to scan.
*/
export function io_modules_scan_all_in_directory(dirname: string): void
/**
* Scans all the modules in the specified directory, ensuring that
* any extension point implemented by a module is registered.
*
* This may not actually load and initialize all the types in each
* module, some modules may be lazily loaded and initialized when
* an extension point it implements is used with e.g.
* g_io_extension_point_get_extensions() or
* g_io_extension_point_get_extension_by_name().
*
* If you need to guarantee that all types are loaded in all the modules,
* use g_io_modules_load_all_in_directory().
* @param dirname pathname for a directory containing modules to scan.
* @param scope a scope to use when scanning the modules
*/
export function io_modules_scan_all_in_directory_with_scope(dirname: string, scope: IOModuleScope): void
/**
* Cancels all cancellable I/O jobs.
*
* A job is cancellable if a #GCancellable was passed into
* g_io_scheduler_push_job().
*/
export function io_scheduler_cancel_all_jobs(): void
/**
* Schedules the I/O job to run in another thread.
*
* `notify` will be called on `user_data` after `job_func` has returned,
* regardless whether the job was cancelled or has run to completion.
*
* If `cancellable` is not %NULL, it can be used to cancel the I/O job
* by calling g_cancellable_cancel() or by calling
* g_io_scheduler_cancel_all_jobs().
* @param job_func a #GIOSchedulerJobFunc.
* @param io_priority the [I/O priority][io-priority] of the request.
* @param cancellable optional #GCancellable object, %NULL to ignore.
*/
export function io_scheduler_push_job(job_func: IOSchedulerJobFunc, io_priority: number, cancellable: Cancellable | null): void
/**
* Creates a keyfile-backed #GSettingsBackend.
*
* The filename of the keyfile to use is given by `filename`.
*
* All settings read to or written from the backend must fall under the
* path given in `root_path` (which must start and end with a slash and
* not contain two consecutive slashes). `root_path` may be "/".
*
* If `root_group` is non-%NULL then it specifies the name of the keyfile
* group used for keys that are written directly below `root_path`. For
* example, if `root_path` is "/apps/example/" and `root_group` is
* "toplevel", then settings the key "/apps/example/enabled" to a value
* of %TRUE will cause the following to appear in the keyfile:
*
*
* ```
* [toplevel]
* enabled=true
* ```
*
*
* If `root_group` is %NULL then it is not permitted to store keys
* directly below the `root_path`.
*
* For keys not stored directly below `root_path` (ie: in a sub-path),
* the name of the subpath (with the final slash stripped) is used as
* the name of the keyfile group. To continue the example, if
* "/apps/example/profiles/default/font-size" were set to
* 12 then the following would appear in the keyfile:
*
*
* ```
* [profiles/default]
* font-size=12
* ```
*
*
* The backend will refuse writes (and return writability as being
* %FALSE) for keys outside of `root_path` and, in the event that
* `root_group` is %NULL, also for keys directly under `root_path`.
* Writes will also be refused if the backend detects that it has the
* inability to rewrite the keyfile (ie: the containing directory is not
* writable).
*
* There is no checking done for your key namespace clashing with the
* syntax of the key file format. For example, if you have '[' or ']'
* characters in your path names or '=' in your key names you may be in
* trouble.
*
* The backend reads default values from a keyfile called `defaults` in
* the directory specified by the #GKeyfileSettingsBackend:defaults-dir property,
* and a list of locked keys from a text file with the name `locks` in
* the same location.
* @param filename the filename of the keyfile
* @param root_path the path under which all settings keys appear
* @param root_group the group name corresponding to `root_path,` or %NULL
* @returns a keyfile-backed #GSettingsBackend
*/
export function keyfile_settings_backend_new(filename: string | null, root_path: string | null, root_group: string | null): SettingsBackend
/**
* Gets a reference to the default #GMemoryMonitor for the system.
* @returns a new reference to the default #GMemoryMonitor
*/
export function memory_monitor_dup_default(): MemoryMonitor
/**
* Creates a memory-backed #GSettingsBackend.
*
* This backend allows changes to settings, but does not write them
* to any backing storage, so the next time you run your application,
* the memory backend will start out with the default values again.
* @returns a newly created #GSettingsBackend
*/
export function memory_settings_backend_new(): SettingsBackend
/**
* Gets the default #GNetworkMonitor for the system.
* @returns a #GNetworkMonitor, which will be a dummy object if no network monitor is available
*/
export function network_monitor_get_default(): NetworkMonitor
/**
* Initializes the platform networking libraries (eg, on Windows, this
* calls WSAStartup()). GLib will call this itself if it is needed, so
* you only need to call it if you directly call system networking
* functions (without calling any GLib networking functions first).
*/
export function networking_init(): void
/**
* Creates a readonly #GSettingsBackend.
*
* This backend does not allow changes to settings, so all settings
* will always have their default values.
* @returns a newly created #GSettingsBackend
*/
export function null_settings_backend_new(): SettingsBackend
/**
* Utility method for #GPollableInputStream and #GPollableOutputStream
* implementations. Creates a new #GSource that expects a callback of
* type #GPollableSourceFunc. The new source does not actually do
* anything on its own; use g_source_add_child_source() to add other
* sources to it to cause it to trigger.
* @param pollable_stream the stream associated with the new source
* @returns the new #GSource.
*/
export function pollable_source_new(pollable_stream: GObject.Object): GLib.Source
/**
* Utility method for #GPollableInputStream and #GPollableOutputStream
* implementations. Creates a new #GSource, as with
* g_pollable_source_new(), but also attaching `child_source` (with a
* dummy callback), and `cancellable,` if they are non-%NULL.
* @param pollable_stream the stream associated with the new source
* @param child_source optional child source to attach
* @param cancellable optional #GCancellable to attach
* @returns the new #GSource.
*/
export function pollable_source_new_full(pollable_stream: GObject.Object, child_source: GLib.Source | null, cancellable: Cancellable | null): GLib.Source
/**
* Tries to read from `stream,` as with g_input_stream_read() (if
* `blocking` is %TRUE) or g_pollable_input_stream_read_nonblocking()
* (if `blocking` is %FALSE). This can be used to more easily share
* code between blocking and non-blocking implementations of a method.
*
* If `blocking` is %FALSE, then `stream` must be a
* #GPollableInputStream for which g_pollable_input_stream_can_poll()
* returns %TRUE, or else the behavior is undefined. If `blocking` is
* %TRUE, then `stream` does not need to be a #GPollableInputStream.
* @param stream a #GInputStream
* @param buffer a buffer to read data into
* @param blocking whether to do blocking I/O
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns the number of bytes read, or -1 on error.
*/
export function pollable_stream_read(stream: InputStream, buffer: Uint8Array, blocking: boolean, cancellable: Cancellable | null): number
/**
* Tries to write to `stream,` as with g_output_stream_write() (if
* `blocking` is %TRUE) or g_pollable_output_stream_write_nonblocking()
* (if `blocking` is %FALSE). This can be used to more easily share
* code between blocking and non-blocking implementations of a method.
*
* If `blocking` is %FALSE, then `stream` must be a
* #GPollableOutputStream for which
* g_pollable_output_stream_can_poll() returns %TRUE or else the
* behavior is undefined. If `blocking` is %TRUE, then `stream` does not
* need to be a #GPollableOutputStream.
* @param stream a #GOutputStream.
* @param buffer the buffer containing the data to write.
* @param blocking whether to do blocking I/O
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns the number of bytes written, or -1 on error.
*/
export function pollable_stream_write(stream: OutputStream, buffer: Uint8Array, blocking: boolean, cancellable: Cancellable | null): number
/**
* Tries to write `count` bytes to `stream,` as with
* g_output_stream_write_all(), but using g_pollable_stream_write()
* rather than g_output_stream_write().
*
* On a successful write of `count` bytes, %TRUE is returned, and
* `bytes_written` is set to `count`.
*
* If there is an error during the operation (including
* %G_IO_ERROR_WOULD_BLOCK in the non-blocking case), %FALSE is
* returned and `error` is set to indicate the error status,
* `bytes_written` is updated to contain the number of bytes written
* into the stream before the error occurred.
*
* As with g_pollable_stream_write(), if `blocking` is %FALSE, then
* `stream` must be a #GPollableOutputStream for which
* g_pollable_output_stream_can_poll() returns %TRUE or else the
* behavior is undefined. If `blocking` is %TRUE, then `stream` does not
* need to be a #GPollableOutputStream.
* @param stream a #GOutputStream.
* @param buffer the buffer containing the data to write.
* @param blocking whether to do blocking I/O
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns %TRUE on success, %FALSE if there was an error
*/
export function pollable_stream_write_all(stream: OutputStream, buffer: Uint8Array, blocking: boolean, cancellable: Cancellable | null): [ /* returnType */ boolean, /* bytes_written */ number ]
/**
* Gets a reference to the default #GPowerProfileMonitor for the system.
* @returns a new reference to the default #GPowerProfileMonitor
*/
export function power_profile_monitor_dup_default(): PowerProfileMonitor
/**
* Find the `gio-proxy` extension point for a proxy implementation that supports
* the specified protocol.
* @param protocol the proxy protocol name (e.g. http, socks, etc)
* @returns return a #GProxy or NULL if protocol is not supported.
*/
export function proxy_get_default_for_protocol(protocol: string | null): Proxy | null
/**
* Gets the default #GProxyResolver for the system.
* @returns the default #GProxyResolver, which will be a dummy object if no proxy resolver is available
*/
export function proxy_resolver_get_default(): ProxyResolver
/**
* Gets the #GResolver Error Quark.
* @returns a #GQuark.
*/
export function resolver_error_quark(): GLib.Quark
/**
* Gets the #GResource Error Quark.
* @returns a #GQuark
*/
export function resource_error_quark(): GLib.Quark
/**
* Loads a binary resource bundle and creates a #GResource representation of it, allowing
* you to query it for data.
*
* If you want to use this resource in the global resource namespace you need
* to register it with g_resources_register().
*
* If `filename` is empty or the data in it is corrupt,
* %G_RESOURCE_ERROR_INTERNAL will be returned. If `filename` doesn’t exist, or
* there is an error in reading it, an error from g_mapped_file_new() will be
* returned.
* @param filename the path of a filename to load, in the GLib filename encoding
* @returns a new #GResource, or %NULL on error
*/
export function resource_load(filename: string): Resource
/**
* Returns all the names of children at the specified `path` in the set of
* globally registered resources.
* The return result is a %NULL terminated list of strings which should
* be released with g_strfreev().
*
* `lookup_flags` controls the behaviour of the lookup.
* @param path A pathname inside the resource
* @param lookup_flags A #GResourceLookupFlags
* @returns an array of constant strings
*/
export function resources_enumerate_children(path: string | null, lookup_flags: ResourceLookupFlags): string[]
/**
* Looks for a file at the specified `path` in the set of
* globally registered resources and if found returns information about it.
*
* `lookup_flags` controls the behaviour of the lookup.
* @param path A pathname inside the resource
* @param lookup_flags A #GResourceLookupFlags
* @returns %TRUE if the file was found. %FALSE if there were errors
*/
export function resources_get_info(path: string | null, lookup_flags: ResourceLookupFlags): [ /* returnType */ boolean, /* size */ number, /* flags */ number ]
/**
* Looks for a file at the specified `path` in the set of
* globally registered resources and returns a #GBytes that
* lets you directly access the data in memory.
*
* The data is always followed by a zero byte, so you
* can safely use the data as a C string. However, that byte
* is not included in the size of the GBytes.
*
* For uncompressed resource files this is a pointer directly into
* the resource bundle, which is typically in some readonly data section
* in the program binary. For compressed files we allocate memory on
* the heap and automatically uncompress the data.
*
* `lookup_flags` controls the behaviour of the lookup.
* @param path A pathname inside the resource
* @param lookup_flags A #GResourceLookupFlags
* @returns #GBytes or %NULL on error. Free the returned object with g_bytes_unref()
*/
export function resources_lookup_data(path: string | null, lookup_flags: ResourceLookupFlags): GLib.Bytes
/**
* Looks for a file at the specified `path` in the set of
* globally registered resources and returns a #GInputStream
* that lets you read the data.
*
* `lookup_flags` controls the behaviour of the lookup.
* @param path A pathname inside the resource
* @param lookup_flags A #GResourceLookupFlags
* @returns #GInputStream or %NULL on error. Free the returned object with g_object_unref()
*/
export function resources_open_stream(path: string | null, lookup_flags: ResourceLookupFlags): InputStream
/**
* Registers the resource with the process-global set of resources.
* Once a resource is registered the files in it can be accessed
* with the global resource lookup functions like g_resources_lookup_data().
* @param resource A #GResource
*/
export function resources_register(resource: Resource): void
/**
* Unregisters the resource from the process-global set of resources.
* @param resource A #GResource
*/
export function resources_unregister(resource: Resource): void
/**
* Gets the default system schema source.
*
* This function is not required for normal uses of #GSettings but it
* may be useful to authors of plugin management systems or to those who
* want to introspect the content of schemas.
*
* If no schemas are installed, %NULL will be returned.
*
* The returned source may actually consist of multiple schema sources
* from different directories, depending on which directories were given
* in `XDG_DATA_DIRS` and `GSETTINGS_SCHEMA_DIR`. For this reason, all
* lookups performed against the default source should probably be done
* recursively.
* @returns the default schema source
*/
export function settings_schema_source_get_default(): SettingsSchemaSource | null
/**
* Reports an error in an idle function. Similar to
* g_simple_async_report_error_in_idle(), but takes a #GError rather
* than building a new one.
* @param object a #GObject, or %NULL
* @param callback a #GAsyncReadyCallback.
* @param error the #GError to report
*/
export function simple_async_report_gerror_in_idle(object: GObject.Object | null, callback: AsyncReadyCallback | null, error: GLib.Error): void
/**
* Gets the default #GTlsBackend for the system.
* @returns a #GTlsBackend, which will be a dummy object if no TLS backend is available
*/
export function tls_backend_get_default(): TlsBackend
/**
* Gets the TLS channel binding error quark.
* @returns a #GQuark.
*/
export function tls_channel_binding_error_quark(): GLib.Quark
/**
* Creates a new #GTlsClientConnection wrapping `base_io_stream` (which
* must have pollable input and output streams) which is assumed to
* communicate with the server identified by `server_identity`.
*
* See the documentation for #GTlsConnection:base-io-stream for restrictions
* on when application code can run operations on the `base_io_stream` after
* this function has returned.
* @param base_io_stream the #GIOStream to wrap
* @param server_identity the expected identity of the server
* @returns the new #GTlsClientConnection, or %NULL on error
*/
export function tls_client_connection_new(base_io_stream: IOStream, server_identity: SocketConnectable | null): TlsClientConnection
/**
* Gets the TLS error quark.
* @returns a #GQuark.
*/
export function tls_error_quark(): GLib.Quark
/**
* Creates a new #GTlsFileDatabase which uses anchor certificate authorities
* in `anchors` to verify certificate chains.
*
* The certificates in `anchors` must be PEM encoded.
* @param anchors filename of anchor certificate authorities.
* @returns the new #GTlsFileDatabase, or %NULL on error
*/
export function tls_file_database_new(anchors: string): TlsFileDatabase
/**
* Creates a new #GTlsServerConnection wrapping `base_io_stream` (which
* must have pollable input and output streams).
*
* See the documentation for #GTlsConnection:base-io-stream for restrictions
* on when application code can run operations on the `base_io_stream` after
* this function has returned.
* @param base_io_stream the #GIOStream to wrap
* @param certificate the default server certificate, or %NULL
* @returns the new #GTlsServerConnection, or %NULL on error
*/
export function tls_server_connection_new(base_io_stream: IOStream, certificate: TlsCertificate | null): TlsServerConnection
/**
* Determines if `mount_path` is considered an implementation of the
* OS. This is primarily used for hiding mountable and mounted volumes
* that only are used in the OS and has little to no relevance to the
* casual user.
* @param mount_path a mount path, e.g. `/media/disk` or `/usr`
* @returns %TRUE if @mount_path is considered an implementation detail of the OS.
*/
export function unix_is_mount_path_system_internal(mount_path: string): boolean
/**
* Determines if `device_path` is considered a block device path which is only
* used in implementation of the OS. This is primarily used for hiding
* mounted volumes that are intended as APIs for programs to read, and system
* administrators at a shell; rather than something that should, for example,
* appear in a GUI. For example, the Linux `/proc` filesystem.
*
* The list of device paths considered ‘system’ ones may change over time.
* @param device_path a device path, e.g. `/dev/loop0` or `nfsd`
* @returns %TRUE if @device_path is considered an implementation detail of the OS.
*/
export function unix_is_system_device_path(device_path: string | null): boolean
/**
* Determines if `fs_type` is considered a type of file system which is only
* used in implementation of the OS. This is primarily used for hiding
* mounted volumes that are intended as APIs for programs to read, and system
* administrators at a shell; rather than something that should, for example,
* appear in a GUI. For example, the Linux `/proc` filesystem.
*
* The list of file system types considered ‘system’ ones may change over time.
* @param fs_type a file system type, e.g. `procfs` or `tmpfs`
* @returns %TRUE if @fs_type is considered an implementation detail of the OS.
*/
export function unix_is_system_fs_type(fs_type: string | null): boolean
/**
* Gets a #GUnixMountEntry for a given mount path. If `time_read`
* is set, it will be filled with a unix timestamp for checking
* if the mounts have changed since with g_unix_mounts_changed_since().
*
* If more mounts have the same mount path, the last matching mount
* is returned.
*
* This will return %NULL if there is no mount point at `mount_path`.
* @param mount_path path for a possible unix mount.
* @returns a #GUnixMountEntry.
*/
export function unix_mount_at(mount_path: string): [ /* returnType */ UnixMountEntry | null, /* time_read */ number ]
/**
* Compares two unix mounts.
* @param mount1 first #GUnixMountEntry to compare.
* @param mount2 second #GUnixMountEntry to compare.
* @returns 1, 0 or -1 if @mount1 is greater than, equal to, or less than @mount2, respectively.
*/
export function unix_mount_compare(mount1: UnixMountEntry, mount2: UnixMountEntry): number
/**
* Makes a copy of `mount_entry`.
* @param mount_entry a #GUnixMountEntry.
* @returns a new #GUnixMountEntry
*/
export function unix_mount_copy(mount_entry: UnixMountEntry): UnixMountEntry
/**
* Gets a #GUnixMountEntry for a given file path. If `time_read`
* is set, it will be filled with a unix timestamp for checking
* if the mounts have changed since with g_unix_mounts_changed_since().
*
* If more mounts have the same mount path, the last matching mount
* is returned.
*
* This will return %NULL if looking up the mount entry fails, if
* `file_path` doesn’t exist or there is an I/O error.
* @param file_path file path on some unix mount.
* @returns a #GUnixMountEntry.
*/
export function unix_mount_for(file_path: string): [ /* returnType */ UnixMountEntry | null, /* time_read */ number ]
/**
* Frees a unix mount.
* @param mount_entry a #GUnixMountEntry.
*/
export function unix_mount_free(mount_entry: UnixMountEntry): void
/**
* Gets the device path for a unix mount.
* @param mount_entry a #GUnixMount.
* @returns a string containing the device path.
*/
export function unix_mount_get_device_path(mount_entry: UnixMountEntry): string
/**
* Gets the filesystem type for the unix mount.
* @param mount_entry a #GUnixMount.
* @returns a string containing the file system type.
*/
export function unix_mount_get_fs_type(mount_entry: UnixMountEntry): string | null
/**
* Gets the mount path for a unix mount.
* @param mount_entry input #GUnixMountEntry to get the mount path for.
* @returns the mount path for @mount_entry.
*/
export function unix_mount_get_mount_path(mount_entry: UnixMountEntry): string
/**
* Gets a comma-separated list of mount options for the unix mount. For example,
* `rw,relatime,seclabel,data=ordered`.
*
* This is similar to g_unix_mount_point_get_options(), but it takes
* a #GUnixMountEntry as an argument.
* @param mount_entry a #GUnixMountEntry.
* @returns a string containing the options, or %NULL if not available.
*/
export function unix_mount_get_options(mount_entry: UnixMountEntry): string | null
/**
* Gets the root of the mount within the filesystem. This is useful e.g. for
* mounts created by bind operation, or btrfs subvolumes.
*
* For example, the root path is equal to "/" for mount created by
* "mount /dev/sda1 /mnt/foo" and "/bar" for
* "mount --bind /mnt/foo/bar /mnt/bar".
* @param mount_entry a #GUnixMountEntry.
* @returns a string containing the root, or %NULL if not supported.
*/
export function unix_mount_get_root_path(mount_entry: UnixMountEntry): string | null
/**
* Guesses whether a Unix mount can be ejected.
* @param mount_entry a #GUnixMountEntry
* @returns %TRUE if @mount_entry is deemed to be ejectable.
*/
export function unix_mount_guess_can_eject(mount_entry: UnixMountEntry): boolean
/**
* Guesses the icon of a Unix mount.
* @param mount_entry a #GUnixMountEntry
* @returns a #GIcon
*/
export function unix_mount_guess_icon(mount_entry: UnixMountEntry): Icon
/**
* Guesses the name of a Unix mount.
* The result is a translated string.
* @param mount_entry a #GUnixMountEntry
* @returns A newly allocated string that must be freed with g_free()
*/
export function unix_mount_guess_name(mount_entry: UnixMountEntry): string | null
/**
* Guesses whether a Unix mount should be displayed in the UI.
* @param mount_entry a #GUnixMountEntry
* @returns %TRUE if @mount_entry is deemed to be displayable.
*/
export function unix_mount_guess_should_display(mount_entry: UnixMountEntry): boolean
/**
* Guesses the symbolic icon of a Unix mount.
* @param mount_entry a #GUnixMountEntry
* @returns a #GIcon
*/
export function unix_mount_guess_symbolic_icon(mount_entry: UnixMountEntry): Icon
/**
* Checks if a unix mount is mounted read only.
* @param mount_entry a #GUnixMount.
* @returns %TRUE if @mount_entry is read only.
*/
export function unix_mount_is_readonly(mount_entry: UnixMountEntry): boolean
/**
* Checks if a Unix mount is a system mount. This is the Boolean OR of
* g_unix_is_system_fs_type(), g_unix_is_system_device_path() and
* g_unix_is_mount_path_system_internal() on `mount_entry’`s properties.
*
* The definition of what a ‘system’ mount entry is may change over time as new
* file system types and device paths are ignored.
* @param mount_entry a #GUnixMount.
* @returns %TRUE if the unix mount is for a system path.
*/
export function unix_mount_is_system_internal(mount_entry: UnixMountEntry): boolean
/**
* Gets a #GUnixMountPoint for a given mount path. If `time_read` is set, it
* will be filled with a unix timestamp for checking if the mount points have
* changed since with g_unix_mount_points_changed_since().
*
* If more mount points have the same mount path, the last matching mount point
* is returned.
* @param mount_path path for a possible unix mount point.
* @returns a #GUnixMountPoint, or %NULL if no match is found.
*/
export function unix_mount_point_at(mount_path: string): [ /* returnType */ UnixMountPoint | null, /* time_read */ number ]
/**
* Checks if the unix mount points have changed since a given unix time.
* @param time guint64 to contain a timestamp.
* @returns %TRUE if the mount points have changed since @time.
*/
export function unix_mount_points_changed_since(time: number): boolean
/**
* Gets a #GList of #GUnixMountPoint containing the unix mount points.
* If `time_read` is set, it will be filled with the mount timestamp,
* allowing for checking if the mounts have changed with
* g_unix_mount_points_changed_since().
* @returns a #GList of the UNIX mountpoints.
*/
export function unix_mount_points_get(): [ /* returnType */ UnixMountPoint[], /* time_read */ number ]
/**
* Checks if the unix mounts have changed since a given unix time.
* @param time guint64 to contain a timestamp.
* @returns %TRUE if the mounts have changed since @time.
*/
export function unix_mounts_changed_since(time: number): boolean
/**
* Gets a #GList of #GUnixMountEntry containing the unix mounts.
* If `time_read` is set, it will be filled with the mount
* timestamp, allowing for checking if the mounts have changed
* with g_unix_mounts_changed_since().
* @returns a #GList of the UNIX mounts.
*/
export function unix_mounts_get(): [ /* returnType */ UnixMountEntry[], /* time_read */ number ]
/**
* Type definition for a function that will be called back when an asynchronous
* operation within GIO has been completed. #GAsyncReadyCallback
* callbacks from #GTask are guaranteed to be invoked in a later
* iteration of the
* [thread-default main context][g-main-context-push-thread-default]
* where the #GTask was created. All other users of
* #GAsyncReadyCallback must likewise call it asynchronously in a
* later iteration of the main context.
*
* The asynchronous operation is guaranteed to have held a reference to
* `source_object` from the time when the `*_async()` function was called, until
* after this callback returns.
* @callback
* @param source_object the object the asynchronous operation was started with.
* @param res a #GAsyncResult.
* @param data user data passed to the callback.
*/
export interface AsyncReadyCallback {
(source_object: T, res: AsyncResult, data: any | null): void
}
/**
* Invoked when a connection to a message bus has been obtained.
* @callback
* @param connection The #GDBusConnection to a message bus.
* @param name The name that is requested to be owned.
*/
export interface BusAcquiredCallback {
(connection: DBusConnection, name: string | null): void
}
/**
* Invoked when the name is acquired.
* @callback
* @param connection The #GDBusConnection on which to acquired the name.
* @param name The name being owned.
*/
export interface BusNameAcquiredCallback {
(connection: DBusConnection, name: string | null): void
}
/**
* Invoked when the name being watched is known to have to have an owner.
* @callback
* @param connection The #GDBusConnection the name is being watched on.
* @param name The name being watched.
* @param name_owner Unique name of the owner of the name being watched.
*/
export interface BusNameAppearedCallback {
(connection: DBusConnection, name: string | null, name_owner: string | null): void
}
/**
* Invoked when the name is lost or `connection` has been closed.
* @callback
* @param connection The #GDBusConnection on which to acquire the name or %NULL if the connection was disconnected.
* @param name The name being owned.
*/
export interface BusNameLostCallback {
(connection: DBusConnection, name: string | null): void
}
/**
* Invoked when the name being watched is known not to have to have an owner.
*
* This is also invoked when the #GDBusConnection on which the watch was
* established has been closed. In that case, `connection` will be
* %NULL.
* @callback
* @param connection The #GDBusConnection the name is being watched on, or %NULL.
* @param name The name being watched.
*/
export interface BusNameVanishedCallback {
(connection: DBusConnection, name: string | null): void
}
/**
* This is the function type of the callback used for the #GSource
* returned by g_cancellable_source_new().
* @callback
* @param cancellable the #GCancellable
* @param data data passed in by the user.
* @returns it should return %FALSE if the source should be removed.
*/
export interface CancellableSourceFunc {
(cancellable: Cancellable | null, data: any | null): boolean
}
/**
* The type of the `get_property` function in #GDBusInterfaceVTable.
* @callback
* @param connection A #GDBusConnection.
* @param sender The unique bus name of the remote caller.
* @param object_path The object path that the method was invoked on.
* @param interface_name The D-Bus interface name for the property.
* @param property_name The name of the property to get the value of.
* @param error Return location for error.
* @returns A #GVariant with the value for @property_name or %NULL if @error is set. If the returned #GVariant is floating, it is consumed - otherwise its reference count is decreased by one.
*/
export interface DBusInterfaceGetPropertyFunc {
(connection: DBusConnection, sender: string | null, object_path: string | null, interface_name: string | null, property_name: string | null, error: GLib.Error): GLib.Variant
}
/**
* The type of the `method_call` function in #GDBusInterfaceVTable.
* @callback
* @param connection A #GDBusConnection.
* @param sender The unique bus name of the remote caller.
* @param object_path The object path that the method was invoked on.
* @param interface_name The D-Bus interface name the method was invoked on.
* @param method_name The name of the method that was invoked.
* @param parameters A #GVariant tuple with parameters.
* @param invocation A #GDBusMethodInvocation object that must be used to return a value or error.
*/
export interface DBusInterfaceMethodCallFunc {
(connection: DBusConnection, sender: string | null, object_path: string | null, interface_name: string | null, method_name: string | null, parameters: GLib.Variant, invocation: DBusMethodInvocation): void
}
/**
* The type of the `set_property` function in #GDBusInterfaceVTable.
* @callback
* @param connection A #GDBusConnection.
* @param sender The unique bus name of the remote caller.
* @param object_path The object path that the method was invoked on.
* @param interface_name The D-Bus interface name for the property.
* @param property_name The name of the property to get the value of.
* @param value The value to set the property to.
* @param error Return location for error.
* @returns %TRUE if the property was set to @value, %FALSE if @error is set.
*/
export interface DBusInterfaceSetPropertyFunc {
(connection: DBusConnection, sender: string | null, object_path: string | null, interface_name: string | null, property_name: string | null, value: GLib.Variant, error: GLib.Error): boolean
}
/**
* Signature for function used in g_dbus_connection_add_filter().
*
* A filter function is passed a #GDBusMessage and expected to return
* a #GDBusMessage too. Passive filter functions that don't modify the
* message can simply return the `message` object:
*
* ```
* static GDBusMessage *
* passive_filter (GDBusConnection *connection
* GDBusMessage *message,
* gboolean incoming,
* gpointer user_data)
* {
* // inspect `message`
* return message;
* }
* ```
*
* Filter functions that wants to drop a message can simply return %NULL:
*
* ```
* static GDBusMessage *
* drop_filter (GDBusConnection *connection
* GDBusMessage *message,
* gboolean incoming,
* gpointer user_data)
* {
* if (should_drop_message)
* {
* g_object_unref (message);
* message = NULL;
* }
* return message;
* }
* ```
*
* Finally, a filter function may modify a message by copying it:
*
* ```
* static GDBusMessage *
* modifying_filter (GDBusConnection *connection
* GDBusMessage *message,
* gboolean incoming,
* gpointer user_data)
* {
* GDBusMessage *copy;
* GError *error;
*
* error = NULL;
* copy = g_dbus_message_copy (message, &error);
* // handle `error` being set
* g_object_unref (message);
*
* // modify `copy`
*
* return copy;
* }
* ```
*
* If the returned #GDBusMessage is different from `message` and cannot
* be sent on `connection` (it could use features, such as file
* descriptors, not compatible with `connection)`, then a warning is
* logged to standard error. Applications can
* check this ahead of time using g_dbus_message_to_blob() passing a
* #GDBusCapabilityFlags value obtained from `connection`.
* @callback
* @param connection A #GDBusConnection.
* @param message A locked #GDBusMessage that the filter function takes ownership of.
* @param incoming %TRUE if it is a message received from the other peer, %FALSE if it is a message to be sent to the other peer.
* @returns A #GDBusMessage that will be freed with g_object_unref() or %NULL to drop the message. Passive filter functions can simply return the passed @message object.
*/
export interface DBusMessageFilterFunction {
(connection: DBusConnection, message: DBusMessage, incoming: boolean): DBusMessage | null
}
/**
* Function signature for a function used to determine the #GType to
* use for an interface proxy (if `interface_name` is not %NULL) or
* object proxy (if `interface_name` is %NULL).
*
* This function is called in the
* [thread-default main loop][g-main-context-push-thread-default]
* that `manager` was constructed in.
* @callback
* @param manager A #GDBusObjectManagerClient.
* @param object_path The object path of the remote object.
* @param interface_name The interface name of the remote object or %NULL if a #GDBusObjectProxy #GType is requested.
* @param data data passed in by the user.
* @returns A #GType to use for the remote object. The returned type must be a #GDBusProxy or #GDBusObjectProxy -derived type.
*/
export interface DBusProxyTypeFunc {
(manager: DBusObjectManagerClient, object_path: string | null, interface_name: string | null, data: any | null): GObject.GType
}
/**
* Signature for callback function used in g_dbus_connection_signal_subscribe().
* @callback
* @param connection A #GDBusConnection.
* @param sender_name The unique bus name of the sender of the signal, or %NULL on a peer-to-peer D-Bus connection.
* @param object_path The object path that the signal was emitted on.
* @param interface_name The name of the interface.
* @param signal_name The name of the signal.
* @param parameters A #GVariant tuple with parameters for the signal.
*/
export interface DBusSignalCallback {
(connection: DBusConnection, sender_name: string | null, object_path: string | null, interface_name: string | null, signal_name: string | null, parameters: GLib.Variant): void
}
/**
* The type of the `dispatch` function in #GDBusSubtreeVTable.
*
* Subtrees are flat. `node,` if non-%NULL, is always exactly one
* segment of the object path (ie: it never contains a slash).
* @callback
* @param connection A #GDBusConnection.
* @param sender The unique bus name of the remote caller.
* @param object_path The object path that was registered with g_dbus_connection_register_subtree().
* @param interface_name The D-Bus interface name that the method call or property access is for.
* @param node A node that is a child of `object_path` (relative to `object_path)` or %NULL for the root of the subtree.
* @param out_user_data Return location for user data to pass to functions in the returned #GDBusInterfaceVTable.
* @returns A #GDBusInterfaceVTable or %NULL if you don't want to handle the methods.
*/
export interface DBusSubtreeDispatchFunc {
(connection: DBusConnection, sender: string | null, object_path: string | null, interface_name: string | null, node: string | null, out_user_data: any): DBusInterfaceVTable | null
}
/**
* The type of the `enumerate` function in #GDBusSubtreeVTable.
*
* This function is called when generating introspection data and also
* when preparing to dispatch incoming messages in the event that the
* %G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag is not
* specified (ie: to verify that the object path is valid).
*
* Hierarchies are not supported; the items that you return should not
* contain the `/` character.
*
* The return value will be freed with g_strfreev().
* @callback
* @param connection A #GDBusConnection.
* @param sender The unique bus name of the remote caller.
* @param object_path The object path that was registered with g_dbus_connection_register_subtree().
* @returns A newly allocated array of strings for node names that are children of @object_path.
*/
export interface DBusSubtreeEnumerateFunc {
(connection: DBusConnection, sender: string | null, object_path: string | null): string[]
}
/**
* The type of the `introspect` function in #GDBusSubtreeVTable.
*
* Subtrees are flat. `node,` if non-%NULL, is always exactly one
* segment of the object path (ie: it never contains a slash).
*
* This function should return %NULL to indicate that there is no object
* at this node.
*
* If this function returns non-%NULL, the return value is expected to
* be a %NULL-terminated array of pointers to #GDBusInterfaceInfo
* structures describing the interfaces implemented by `node`. This
* array will have g_dbus_interface_info_unref() called on each item
* before being freed with g_free().
*
* The difference between returning %NULL and an array containing zero
* items is that the standard DBus interfaces will returned to the
* remote introspector in the empty array case, but not in the %NULL
* case.
* @callback
* @param connection A #GDBusConnection.
* @param sender The unique bus name of the remote caller.
* @param object_path The object path that was registered with g_dbus_connection_register_subtree().
* @param node A node that is a child of `object_path` (relative to `object_path)` or %NULL for the root of the subtree.
* @returns A %NULL-terminated array of pointers to #GDBusInterfaceInfo, or %NULL.
*/
export interface DBusSubtreeIntrospectFunc {
(connection: DBusConnection, sender: string | null, object_path: string | null, node: string | null): DBusInterfaceInfo[] | null
}
/**
* This is the function type of the callback used for the #GSource
* returned by g_datagram_based_create_source().
* @callback
* @param datagram_based the #GDatagramBased
* @param condition the current condition at the source fired
* @param data data passed in by the user
* @returns %G_SOURCE_REMOVE if the source should be removed, %G_SOURCE_CONTINUE otherwise
*/
export interface DatagramBasedSourceFunc {
(datagram_based: DatagramBased, condition: GLib.IOCondition, data: any | null): boolean
}
/**
* During invocation, g_desktop_app_info_launch_uris_as_manager() may
* create one or more child processes. This callback is invoked once
* for each, providing the process ID.
* @callback
* @param appinfo a #GDesktopAppInfo
* @param pid Process identifier
*/
export interface DesktopAppLaunchCallback {
(appinfo: DesktopAppInfo, pid: GLib.Pid): void
}
/**
* This callback type is used by g_file_measure_disk_usage() to make
* periodic progress reports when measuring the amount of disk spaced
* used by a directory.
*
* These calls are made on a best-effort basis and not all types of
* #GFile will support them. At the minimum, however, one call will
* always be made immediately.
*
* In the case that there is no support, `reporting` will be set to
* %FALSE (and the other values undefined) and no further calls will be
* made. Otherwise, the `reporting` will be %TRUE and the other values
* all-zeros during the first (immediate) call. In this way, you can
* know which type of progress UI to show without a delay.
*
* For g_file_measure_disk_usage() the callback is made directly. For
* g_file_measure_disk_usage_async() the callback is made via the
* default main context of the calling thread (ie: the same way that the
* final async result would be reported).
*
* `current_size` is in the same units as requested by the operation (see
* %G_FILE_MEASURE_APPARENT_SIZE).
*
* The frequency of the updates is implementation defined, but is
* ideally about once every 200ms.
*
* The last progress callback may or may not be equal to the final
* result. Always check the async result to get the final value.
* @callback
* @param reporting %TRUE if more reports will come
* @param current_size the current cumulative size measurement
* @param num_dirs the number of directories visited so far
* @param num_files the number of non-directory files encountered
* @param data the data passed to the original request for this callback
*/
export interface FileMeasureProgressCallback {
(reporting: boolean, current_size: number, num_dirs: number, num_files: number, data: any | null): void
}
/**
* When doing file operations that may take a while, such as moving
* a file or copying a file, a progress callback is used to pass how
* far along that operation is to the application.
* @callback
* @param current_num_bytes the current number of bytes in the operation.
* @param total_num_bytes the total number of bytes in the operation.
* @param data user data passed to the callback.
*/
export interface FileProgressCallback {
(current_num_bytes: number, total_num_bytes: number, data: any | null): void
}
/**
* When loading the partial contents of a file with g_file_load_partial_contents_async(),
* it may become necessary to determine if any more data from the file should be loaded.
* A #GFileReadMoreCallback function facilitates this by returning %TRUE if more data
* should be read, or %FALSE otherwise.
* @callback
* @param file_contents the data as currently read.
* @param file_size the size of the data currently read.
* @param callback_data data passed to the callback.
* @returns %TRUE if more data should be read back. %FALSE otherwise.
*/
export interface FileReadMoreCallback {
(file_contents: string | null, file_size: number, callback_data: any | null): boolean
}
/**
* I/O Job function.
*
* Long-running jobs should periodically check the `cancellable`
* to see if they have been cancelled.
* @callback
* @param job a #GIOSchedulerJob.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param data data passed to the callback function
* @returns %TRUE if this function should be called again to complete the job, %FALSE if the job is complete (or cancelled)
*/
export interface IOSchedulerJobFunc {
(job: IOSchedulerJob, cancellable: Cancellable | null, data: any | null): boolean
}
/**
* This is the function type of the callback used for the #GSource
* returned by g_pollable_input_stream_create_source() and
* g_pollable_output_stream_create_source().
* @callback
* @param pollable_stream the #GPollableInputStream or #GPollableOutputStream
* @param data data passed in by the user.
* @returns it should return %FALSE if the source should be removed.
*/
export interface PollableSourceFunc {
(pollable_stream: GObject.Object, data: any | null): boolean
}
/**
* Changes the size of the memory block pointed to by `data` to
* `size` bytes.
*
* The function should have the same semantics as realloc().
* @callback
* @param data memory block to reallocate
* @param size size to reallocate `data` to
* @returns a pointer to the reallocated memory
*/
export interface ReallocFunc {
(data: any | null, size: number): any | null
}
/**
* The type for the function that is used to convert from #GSettings to
* an object property. The `value` is already initialized to hold values
* of the appropriate type.
* @callback
* @param value return location for the property value
* @param variant the #GVariant
* @returns %TRUE if the conversion succeeded, %FALSE in case of an error
*/
export interface SettingsBindGetMapping {
(value: any, variant: GLib.Variant): boolean
}
/**
* The type for the function that is used to convert an object property
* value to a #GVariant for storing it in #GSettings.
* @callback
* @param value a #GValue containing the property value to map
* @param expected_type the #GVariantType to create
* @returns a new #GVariant holding the data from @value, or %NULL in case of an error
*/
export interface SettingsBindSetMapping {
(value: any, expected_type: GLib.VariantType): GLib.Variant
}
/**
* The type of the function that is used to convert from a value stored
* in a #GSettings to a value that is useful to the application.
*
* If the value is successfully mapped, the result should be stored at
* `result` and %TRUE returned. If mapping fails (for example, if `value`
* is not in the right format) then %FALSE should be returned.
*
* If `value` is %NULL then it means that the mapping function is being
* given a "last chance" to successfully return a valid value. %TRUE
* must be returned in this case.
* @callback
* @param value the #GVariant to map, or %NULL
* @returns %TRUE if the conversion succeeded, %FALSE in case of an error
*/
export interface SettingsGetMapping {
(value: GLib.Variant): boolean
}
/**
* Simple thread function that runs an asynchronous operation and
* checks for cancellation.
* @callback
* @param res a #GSimpleAsyncResult.
* @param object a #GObject.
* @param cancellable optional #GCancellable object, %NULL to ignore.
*/
export interface SimpleAsyncThreadFunc {
(res: SimpleAsyncResult, object: GObject.Object, cancellable: Cancellable | null): void
}
/**
* This is the function type of the callback used for the #GSource
* returned by g_socket_create_source().
* @callback
* @param socket the #GSocket
* @param condition the current condition at the source fired.
* @param data data passed in by the user.
* @returns it should return %FALSE if the source should be removed.
*/
export interface SocketSourceFunc {
(socket: Socket, condition: GLib.IOCondition, data: any | null): boolean
}
/**
* The prototype for a task function to be run in a thread via
* g_task_run_in_thread() or g_task_run_in_thread_sync().
*
* If the return-on-cancel flag is set on `task,` and `cancellable` gets
* cancelled, then the #GTask will be completed immediately (as though
* g_task_return_error_if_cancelled() had been called), without
* waiting for the task function to complete. However, the task
* function will continue running in its thread in the background. The
* function therefore needs to be careful about how it uses
* externally-visible state in this case. See
* g_task_set_return_on_cancel() for more details.
*
* Other than in that case, `task` will be completed when the
* #GTaskThreadFunc returns, not when it calls a
* `g_task_return_` function.
* @callback
* @param task the #GTask
* @param source_object `task'`s source object
* @param task_data `task'`s task data
* @param cancellable `task'`s #GCancellable, or %NULL
*/
export interface TaskThreadFunc {
(task: Task, source_object: GObject.Object, task_data: any | null, cancellable: Cancellable | null): void
}
/**
* This function type is used by g_vfs_register_uri_scheme() to make it
* possible for a client to associate an URI scheme to a different #GFile
* implementation.
*
* The client should return a reference to the new file that has been
* created for `uri,` or %NULL to continue with the default implementation.
* @callback
* @param vfs a #GVfs
* @param identifier the identifier to look up a #GFile for. This can either be an URI or a parse name as returned by g_file_get_parse_name()
* @returns a #GFile for @identifier.
*/
export interface VfsFileLookupFunc {
(vfs: Vfs, identifier: string | null): File
}
export module Action {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface Action {
// Own properties of Gio-2.0.Gio.Action
/**
* If `action` is currently enabled.
*
* If the action is disabled then calls to g_action_activate() and
* g_action_change_state() have no effect.
*/
readonly enabled: boolean
/**
* The name of the action. This is mostly meaningful for identifying
* the action once it has been added to a #GActionGroup. It is immutable.
*/
readonly name: string | null
/**
* The type of the parameter that must be given when activating the
* action. This is immutable, and may be %NULL if no parameter is needed when
* activating the action.
*/
readonly parameter_type: GLib.VariantType
/**
* The state of the action, or %NULL if the action is stateless.
*/
readonly state: GLib.Variant
/**
* The #GVariantType of the state that the action has, or %NULL if the
* action is stateless. This is immutable.
*/
readonly state_type: GLib.VariantType
// Owm methods of Gio-2.0.Gio.Action
/**
* Activates the action.
*
* `parameter` must be the correct type of parameter for the action (ie:
* the parameter type given at construction time). If the parameter
* type was %NULL then `parameter` must also be %NULL.
*
* If the `parameter` GVariant is floating, it is consumed.
* @param parameter the parameter to the activation
*/
activate(parameter: GLib.Variant | null): void
/**
* Request for the state of `action` to be changed to `value`.
*
* The action must be stateful and `value` must be of the correct type.
* See g_action_get_state_type().
*
* This call merely requests a change. The action may refuse to change
* its state or may change its state to something other than `value`.
* See g_action_get_state_hint().
*
* If the `value` GVariant is floating, it is consumed.
* @param value the new state
*/
change_state(value: GLib.Variant): void
/**
* Checks if `action` is currently enabled.
*
* An action must be enabled in order to be activated or in order to
* have its state changed from outside callers.
* @returns whether the action is enabled
*/
get_enabled(): boolean
/**
* Queries the name of `action`.
* @returns the name of the action
*/
get_name(): string | null
/**
* Queries the type of the parameter that must be given when activating
* `action`.
*
* When activating the action using g_action_activate(), the #GVariant
* given to that function must be of the type returned by this function.
*
* In the case that this function returns %NULL, you must not give any
* #GVariant, but %NULL instead.
* @returns the parameter type
*/
get_parameter_type(): GLib.VariantType | null
/**
* Queries the current state of `action`.
*
* If the action is not stateful then %NULL will be returned. If the
* action is stateful then the type of the return value is the type
* given by g_action_get_state_type().
*
* The return value (if non-%NULL) should be freed with
* g_variant_unref() when it is no longer required.
* @returns the current state of the action
*/
get_state(): GLib.Variant | null
/**
* Requests a hint about the valid range of values for the state of
* `action`.
*
* If %NULL is returned it either means that the action is not stateful
* or that there is no hint about the valid range of values for the
* state of the action.
*
* If a #GVariant array is returned then each item in the array is a
* possible value for the state. If a #GVariant pair (ie: two-tuple) is
* returned then the tuple specifies the inclusive lower and upper bound
* of valid values for the state.
*
* In any case, the information is merely a hint. It may be possible to
* have a state value outside of the hinted range and setting a value
* within the range may fail.
*
* The return value (if non-%NULL) should be freed with
* g_variant_unref() when it is no longer required.
* @returns the state range hint
*/
get_state_hint(): GLib.Variant | null
/**
* Queries the type of the state of `action`.
*
* If the action is stateful (e.g. created with
* g_simple_action_new_stateful()) then this function returns the
* #GVariantType of the state. This is the type of the initial value
* given as the state. All calls to g_action_change_state() must give a
* #GVariant of this type and g_action_get_state() will return a
* #GVariant of the same type.
*
* If the action is not stateful (e.g. created with g_simple_action_new())
* then this function will return %NULL. In that case, g_action_get_state()
* will return %NULL and you must not call g_action_change_state().
* @returns the state type, if the action is stateful
*/
get_state_type(): GLib.VariantType | null
// Own virtual methods of Gio-2.0.Gio.Action
/**
* Activates the action.
*
* `parameter` must be the correct type of parameter for the action (ie:
* the parameter type given at construction time). If the parameter
* type was %NULL then `parameter` must also be %NULL.
*
* If the `parameter` GVariant is floating, it is consumed.
* @virtual
* @param parameter the parameter to the activation
*/
vfunc_activate(parameter: GLib.Variant | null): void
/**
* Request for the state of `action` to be changed to `value`.
*
* The action must be stateful and `value` must be of the correct type.
* See g_action_get_state_type().
*
* This call merely requests a change. The action may refuse to change
* its state or may change its state to something other than `value`.
* See g_action_get_state_hint().
*
* If the `value` GVariant is floating, it is consumed.
* @virtual
* @param value the new state
*/
vfunc_change_state(value: GLib.Variant): void
/**
* Checks if `action` is currently enabled.
*
* An action must be enabled in order to be activated or in order to
* have its state changed from outside callers.
* @virtual
* @returns whether the action is enabled
*/
vfunc_get_enabled(): boolean
/**
* Queries the name of `action`.
* @virtual
* @returns the name of the action
*/
vfunc_get_name(): string | null
/**
* Queries the type of the parameter that must be given when activating
* `action`.
*
* When activating the action using g_action_activate(), the #GVariant
* given to that function must be of the type returned by this function.
*
* In the case that this function returns %NULL, you must not give any
* #GVariant, but %NULL instead.
* @virtual
* @returns the parameter type
*/
vfunc_get_parameter_type(): GLib.VariantType | null
/**
* Queries the current state of `action`.
*
* If the action is not stateful then %NULL will be returned. If the
* action is stateful then the type of the return value is the type
* given by g_action_get_state_type().
*
* The return value (if non-%NULL) should be freed with
* g_variant_unref() when it is no longer required.
* @virtual
* @returns the current state of the action
*/
vfunc_get_state(): GLib.Variant | null
/**
* Requests a hint about the valid range of values for the state of
* `action`.
*
* If %NULL is returned it either means that the action is not stateful
* or that there is no hint about the valid range of values for the
* state of the action.
*
* If a #GVariant array is returned then each item in the array is a
* possible value for the state. If a #GVariant pair (ie: two-tuple) is
* returned then the tuple specifies the inclusive lower and upper bound
* of valid values for the state.
*
* In any case, the information is merely a hint. It may be possible to
* have a state value outside of the hinted range and setting a value
* within the range may fail.
*
* The return value (if non-%NULL) should be freed with
* g_variant_unref() when it is no longer required.
* @virtual
* @returns the state range hint
*/
vfunc_get_state_hint(): GLib.Variant | null
/**
* Queries the type of the state of `action`.
*
* If the action is stateful (e.g. created with
* g_simple_action_new_stateful()) then this function returns the
* #GVariantType of the state. This is the type of the initial value
* given as the state. All calls to g_action_change_state() must give a
* #GVariant of this type and g_action_get_state() will return a
* #GVariant of the same type.
*
* If the action is not stateful (e.g. created with g_simple_action_new())
* then this function will return %NULL. In that case, g_action_get_state()
* will return %NULL and you must not call g_action_change_state().
* @virtual
* @returns the state type, if the action is stateful
*/
vfunc_get_state_type(): GLib.VariantType | null
// Class property signals of Gio-2.0.Gio.Action
connect(sigName: "notify::enabled", callback: (($obj: Action, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::enabled", callback: (($obj: Action, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::enabled", ...args: any[]): void
connect(sigName: "notify::name", callback: (($obj: Action, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::name", callback: (($obj: Action, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::name", ...args: any[]): void
connect(sigName: "notify::parameter-type", callback: (($obj: Action, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::parameter-type", callback: (($obj: Action, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::parameter-type", ...args: any[]): void
connect(sigName: "notify::state", callback: (($obj: Action, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::state", callback: (($obj: Action, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::state", ...args: any[]): void
connect(sigName: "notify::state-type", callback: (($obj: Action, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::state-type", callback: (($obj: Action, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::state-type", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GAction represents a single named action.
*
* The main interface to an action is that it can be activated with
* g_action_activate(). This results in the 'activate' signal being
* emitted. An activation has a #GVariant parameter (which may be
* %NULL). The correct type for the parameter is determined by a static
* parameter type (which is given at construction time).
*
* An action may optionally have a state, in which case the state may be
* set with g_action_change_state(). This call takes a #GVariant. The
* correct type for the state is determined by a static state type
* (which is given at construction time).
*
* The state may have a hint associated with it, specifying its valid
* range.
*
* #GAction is merely the interface to the concept of an action, as
* described above. Various implementations of actions exist, including
* #GSimpleAction.
*
* In all cases, the implementing class is responsible for storing the
* name of the action, the parameter type, the enabled state, the
* optional state type and the state and emitting the appropriate
* signals when these change. The implementor is responsible for filtering
* calls to g_action_activate() and g_action_change_state() for type
* safety and for the state being enabled.
*
* Probably the only useful thing to do with a #GAction is to put it
* inside of a #GSimpleActionGroup.
* @interface
*/
export class Action extends GObject.Object {
// Own properties of Gio-2.0.Gio.Action
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.Action
constructor(config?: Action.ConstructorProperties)
_init(config?: Action.ConstructorProperties): void
/**
* Checks if `action_name` is valid.
*
* `action_name` is valid if it consists only of alphanumeric characters,
* plus '-' and '.'. The empty string is not a valid action name.
*
* It is an error to call this function with a non-utf8 `action_name`.
* `action_name` must not be %NULL.
* @param action_name a potential action name
* @returns %TRUE if @action_name is valid
*/
static name_is_valid(action_name: string | null): boolean
/**
* Parses a detailed action name into its separate name and target
* components.
*
* Detailed action names can have three formats.
*
* The first format is used to represent an action name with no target
* value and consists of just an action name containing no whitespace
* nor the characters `:`, `(` or `)`. For example: `app.action`.
*
* The second format is used to represent an action with a target value
* that is a non-empty string consisting only of alphanumerics, plus `-`
* and `.`. In that case, the action name and target value are
* separated by a double colon (`::`). For example:
* `app.action::target`.
*
* The third format is used to represent an action with any type of
* target value, including strings. The target value follows the action
* name, surrounded in parens. For example: `app.action(42)`. The
* target value is parsed using g_variant_parse(). If a tuple-typed
* value is desired, it must be specified in the same way, resulting in
* two sets of parens, for example: `app.action((1,2,3))`. A string
* target can be specified this way as well: `app.action('target')`.
* For strings, this third format must be used if target value is
* empty or contains characters other than alphanumerics, `-` and `.`.
*
* If this function returns %TRUE, a non-%NULL value is guaranteed to be returned
* in `action_name` (if a pointer is passed in). A %NULL value may still be
* returned in `target_value,` as the `detailed_name` may not contain a target.
*
* If returned, the #GVariant in `target_value` is guaranteed to not be floating.
* @param detailed_name a detailed action name
* @returns %TRUE if successful, else %FALSE with @error set
*/
static parse_detailed_name(detailed_name: string | null): [ /* returnType */ boolean, /* action_name */ string | null, /* target_value */ GLib.Variant | null ]
/**
* Formats a detailed action name from `action_name` and `target_value`.
*
* It is an error to call this function with an invalid action name.
*
* This function is the opposite of g_action_parse_detailed_name().
* It will produce a string that can be parsed back to the `action_name`
* and `target_value` by that function.
*
* See that function for the types of strings that will be printed by
* this function.
* @param action_name a valid action name
* @param target_value a #GVariant target value, or %NULL
* @returns a detailed format string
*/
static print_detailed_name(action_name: string | null, target_value: GLib.Variant | null): string | null
}
export module ActionGroup {
// Signal callback interfaces
/**
* Signal callback interface for `action-added`
*/
export interface ActionAddedSignalCallback {
($obj: ActionGroup, action_name: string | null): void
}
/**
* Signal callback interface for `action-enabled-changed`
*/
export interface ActionEnabledChangedSignalCallback {
($obj: ActionGroup, action_name: string | null, enabled: boolean): void
}
/**
* Signal callback interface for `action-removed`
*/
export interface ActionRemovedSignalCallback {
($obj: ActionGroup, action_name: string | null): void
}
/**
* Signal callback interface for `action-state-changed`
*/
export interface ActionStateChangedSignalCallback {
($obj: ActionGroup, action_name: string | null, value: GLib.Variant): void
}
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface ActionGroup {
// Owm methods of Gio-2.0.Gio.ActionGroup
/**
* Emits the #GActionGroup::action-added signal on `action_group`.
*
* This function should only be called by #GActionGroup implementations.
* @param action_name the name of an action in the group
*/
action_added(action_name: string | null): void
/**
* Emits the #GActionGroup::action-enabled-changed signal on `action_group`.
*
* This function should only be called by #GActionGroup implementations.
* @param action_name the name of an action in the group
* @param enabled whether or not the action is now enabled
*/
action_enabled_changed(action_name: string | null, enabled: boolean): void
/**
* Emits the #GActionGroup::action-removed signal on `action_group`.
*
* This function should only be called by #GActionGroup implementations.
* @param action_name the name of an action in the group
*/
action_removed(action_name: string | null): void
/**
* Emits the #GActionGroup::action-state-changed signal on `action_group`.
*
* This function should only be called by #GActionGroup implementations.
* @param action_name the name of an action in the group
* @param state the new state of the named action
*/
action_state_changed(action_name: string | null, state: GLib.Variant): void
/**
* Activate the named action within `action_group`.
*
* If the action is expecting a parameter, then the correct type of
* parameter must be given as `parameter`. If the action is expecting no
* parameters then `parameter` must be %NULL. See
* g_action_group_get_action_parameter_type().
*
* If the #GActionGroup implementation supports asynchronous remote
* activation over D-Bus, this call may return before the relevant
* D-Bus traffic has been sent, or any replies have been received. In
* order to block on such asynchronous activation calls,
* g_dbus_connection_flush() should be called prior to the code, which
* depends on the result of the action activation. Without flushing
* the D-Bus connection, there is no guarantee that the action would
* have been activated.
*
* The following code which runs in a remote app instance, shows an
* example of a "quit" action being activated on the primary app
* instance over D-Bus. Here g_dbus_connection_flush() is called
* before `exit()`. Without g_dbus_connection_flush(), the "quit" action
* may fail to be activated on the primary instance.
*
*
* ```c
* // call "quit" action on primary instance
* g_action_group_activate_action (G_ACTION_GROUP (app), "quit", NULL);
*
* // make sure the action is activated now
* g_dbus_connection_flush (...);
*
* g_debug ("application has been terminated. exiting.");
*
* exit (0);
* ```
*
* @param action_name the name of the action to activate
* @param parameter parameters to the activation
*/
activate_action(action_name: string | null, parameter: GLib.Variant | null): void
/**
* Request for the state of the named action within `action_group` to be
* changed to `value`.
*
* The action must be stateful and `value` must be of the correct type.
* See g_action_group_get_action_state_type().
*
* This call merely requests a change. The action may refuse to change
* its state or may change its state to something other than `value`.
* See g_action_group_get_action_state_hint().
*
* If the `value` GVariant is floating, it is consumed.
* @param action_name the name of the action to request the change on
* @param value the new state
*/
change_action_state(action_name: string | null, value: GLib.Variant): void
/**
* Checks if the named action within `action_group` is currently enabled.
*
* An action must be enabled in order to be activated or in order to
* have its state changed from outside callers.
* @param action_name the name of the action to query
* @returns whether or not the action is currently enabled
*/
get_action_enabled(action_name: string | null): boolean
/**
* Queries the type of the parameter that must be given when activating
* the named action within `action_group`.
*
* When activating the action using g_action_group_activate_action(),
* the #GVariant given to that function must be of the type returned
* by this function.
*
* In the case that this function returns %NULL, you must not give any
* #GVariant, but %NULL instead.
*
* The parameter type of a particular action will never change but it is
* possible for an action to be removed and for a new action to be added
* with the same name but a different parameter type.
* @param action_name the name of the action to query
* @returns the parameter type
*/
get_action_parameter_type(action_name: string | null): GLib.VariantType | null
/**
* Queries the current state of the named action within `action_group`.
*
* If the action is not stateful then %NULL will be returned. If the
* action is stateful then the type of the return value is the type
* given by g_action_group_get_action_state_type().
*
* The return value (if non-%NULL) should be freed with
* g_variant_unref() when it is no longer required.
* @param action_name the name of the action to query
* @returns the current state of the action
*/
get_action_state(action_name: string | null): GLib.Variant | null
/**
* Requests a hint about the valid range of values for the state of the
* named action within `action_group`.
*
* If %NULL is returned it either means that the action is not stateful
* or that there is no hint about the valid range of values for the
* state of the action.
*
* If a #GVariant array is returned then each item in the array is a
* possible value for the state. If a #GVariant pair (ie: two-tuple) is
* returned then the tuple specifies the inclusive lower and upper bound
* of valid values for the state.
*
* In any case, the information is merely a hint. It may be possible to
* have a state value outside of the hinted range and setting a value
* within the range may fail.
*
* The return value (if non-%NULL) should be freed with
* g_variant_unref() when it is no longer required.
* @param action_name the name of the action to query
* @returns the state range hint
*/
get_action_state_hint(action_name: string | null): GLib.Variant | null
/**
* Queries the type of the state of the named action within
* `action_group`.
*
* If the action is stateful then this function returns the
* #GVariantType of the state. All calls to
* g_action_group_change_action_state() must give a #GVariant of this
* type and g_action_group_get_action_state() will return a #GVariant
* of the same type.
*
* If the action is not stateful then this function will return %NULL.
* In that case, g_action_group_get_action_state() will return %NULL
* and you must not call g_action_group_change_action_state().
*
* The state type of a particular action will never change but it is
* possible for an action to be removed and for a new action to be added
* with the same name but a different state type.
* @param action_name the name of the action to query
* @returns the state type, if the action is stateful
*/
get_action_state_type(action_name: string | null): GLib.VariantType | null
/**
* Checks if the named action exists within `action_group`.
* @param action_name the name of the action to check for
* @returns whether the named action exists
*/
has_action(action_name: string | null): boolean
/**
* Lists the actions contained within `action_group`.
*
* The caller is responsible for freeing the list with g_strfreev() when
* it is no longer required.
* @returns a %NULL-terminated array of the names of the actions in the group
*/
list_actions(): string[]
/**
* Queries all aspects of the named action within an `action_group`.
*
* This function acquires the information available from
* g_action_group_has_action(), g_action_group_get_action_enabled(),
* g_action_group_get_action_parameter_type(),
* g_action_group_get_action_state_type(),
* g_action_group_get_action_state_hint() and
* g_action_group_get_action_state() with a single function call.
*
* This provides two main benefits.
*
* The first is the improvement in efficiency that comes with not having
* to perform repeated lookups of the action in order to discover
* different things about it. The second is that implementing
* #GActionGroup can now be done by only overriding this one virtual
* function.
*
* The interface provides a default implementation of this function that
* calls the individual functions, as required, to fetch the
* information. The interface also provides default implementations of
* those functions that call this function. All implementations,
* therefore, must override either this function or all of the others.
*
* If the action exists, %TRUE is returned and any of the requested
* fields (as indicated by having a non-%NULL reference passed in) are
* filled. If the action doesn't exist, %FALSE is returned and the
* fields may or may not have been modified.
* @param action_name the name of an action in the group
* @returns %TRUE if the action exists, else %FALSE
*/
query_action(action_name: string | null): [ /* returnType */ boolean, /* enabled */ boolean, /* parameter_type */ GLib.VariantType, /* state_type */ GLib.VariantType, /* state_hint */ GLib.Variant, /* state */ GLib.Variant ]
// Own virtual methods of Gio-2.0.Gio.ActionGroup
/**
* Emits the #GActionGroup::action-added signal on `action_group`.
*
* This function should only be called by #GActionGroup implementations.
* @virtual
* @param action_name the name of an action in the group
*/
vfunc_action_added(action_name: string | null): void
/**
* Emits the #GActionGroup::action-enabled-changed signal on `action_group`.
*
* This function should only be called by #GActionGroup implementations.
* @virtual
* @param action_name the name of an action in the group
* @param enabled whether or not the action is now enabled
*/
vfunc_action_enabled_changed(action_name: string | null, enabled: boolean): void
/**
* Emits the #GActionGroup::action-removed signal on `action_group`.
*
* This function should only be called by #GActionGroup implementations.
* @virtual
* @param action_name the name of an action in the group
*/
vfunc_action_removed(action_name: string | null): void
/**
* Emits the #GActionGroup::action-state-changed signal on `action_group`.
*
* This function should only be called by #GActionGroup implementations.
* @virtual
* @param action_name the name of an action in the group
* @param state the new state of the named action
*/
vfunc_action_state_changed(action_name: string | null, state: GLib.Variant): void
/**
* Activate the named action within `action_group`.
*
* If the action is expecting a parameter, then the correct type of
* parameter must be given as `parameter`. If the action is expecting no
* parameters then `parameter` must be %NULL. See
* g_action_group_get_action_parameter_type().
*
* If the #GActionGroup implementation supports asynchronous remote
* activation over D-Bus, this call may return before the relevant
* D-Bus traffic has been sent, or any replies have been received. In
* order to block on such asynchronous activation calls,
* g_dbus_connection_flush() should be called prior to the code, which
* depends on the result of the action activation. Without flushing
* the D-Bus connection, there is no guarantee that the action would
* have been activated.
*
* The following code which runs in a remote app instance, shows an
* example of a "quit" action being activated on the primary app
* instance over D-Bus. Here g_dbus_connection_flush() is called
* before `exit()`. Without g_dbus_connection_flush(), the "quit" action
* may fail to be activated on the primary instance.
*
*
* ```c
* // call "quit" action on primary instance
* g_action_group_activate_action (G_ACTION_GROUP (app), "quit", NULL);
*
* // make sure the action is activated now
* g_dbus_connection_flush (...);
*
* g_debug ("application has been terminated. exiting.");
*
* exit (0);
* ```
*
* @virtual
* @param action_name the name of the action to activate
* @param parameter parameters to the activation
*/
vfunc_activate_action(action_name: string | null, parameter: GLib.Variant | null): void
/**
* Request for the state of the named action within `action_group` to be
* changed to `value`.
*
* The action must be stateful and `value` must be of the correct type.
* See g_action_group_get_action_state_type().
*
* This call merely requests a change. The action may refuse to change
* its state or may change its state to something other than `value`.
* See g_action_group_get_action_state_hint().
*
* If the `value` GVariant is floating, it is consumed.
* @virtual
* @param action_name the name of the action to request the change on
* @param value the new state
*/
vfunc_change_action_state(action_name: string | null, value: GLib.Variant): void
/**
* Checks if the named action within `action_group` is currently enabled.
*
* An action must be enabled in order to be activated or in order to
* have its state changed from outside callers.
* @virtual
* @param action_name the name of the action to query
* @returns whether or not the action is currently enabled
*/
vfunc_get_action_enabled(action_name: string | null): boolean
/**
* Queries the type of the parameter that must be given when activating
* the named action within `action_group`.
*
* When activating the action using g_action_group_activate_action(),
* the #GVariant given to that function must be of the type returned
* by this function.
*
* In the case that this function returns %NULL, you must not give any
* #GVariant, but %NULL instead.
*
* The parameter type of a particular action will never change but it is
* possible for an action to be removed and for a new action to be added
* with the same name but a different parameter type.
* @virtual
* @param action_name the name of the action to query
* @returns the parameter type
*/
vfunc_get_action_parameter_type(action_name: string | null): GLib.VariantType | null
/**
* Queries the current state of the named action within `action_group`.
*
* If the action is not stateful then %NULL will be returned. If the
* action is stateful then the type of the return value is the type
* given by g_action_group_get_action_state_type().
*
* The return value (if non-%NULL) should be freed with
* g_variant_unref() when it is no longer required.
* @virtual
* @param action_name the name of the action to query
* @returns the current state of the action
*/
vfunc_get_action_state(action_name: string | null): GLib.Variant | null
/**
* Requests a hint about the valid range of values for the state of the
* named action within `action_group`.
*
* If %NULL is returned it either means that the action is not stateful
* or that there is no hint about the valid range of values for the
* state of the action.
*
* If a #GVariant array is returned then each item in the array is a
* possible value for the state. If a #GVariant pair (ie: two-tuple) is
* returned then the tuple specifies the inclusive lower and upper bound
* of valid values for the state.
*
* In any case, the information is merely a hint. It may be possible to
* have a state value outside of the hinted range and setting a value
* within the range may fail.
*
* The return value (if non-%NULL) should be freed with
* g_variant_unref() when it is no longer required.
* @virtual
* @param action_name the name of the action to query
* @returns the state range hint
*/
vfunc_get_action_state_hint(action_name: string | null): GLib.Variant | null
/**
* Queries the type of the state of the named action within
* `action_group`.
*
* If the action is stateful then this function returns the
* #GVariantType of the state. All calls to
* g_action_group_change_action_state() must give a #GVariant of this
* type and g_action_group_get_action_state() will return a #GVariant
* of the same type.
*
* If the action is not stateful then this function will return %NULL.
* In that case, g_action_group_get_action_state() will return %NULL
* and you must not call g_action_group_change_action_state().
*
* The state type of a particular action will never change but it is
* possible for an action to be removed and for a new action to be added
* with the same name but a different state type.
* @virtual
* @param action_name the name of the action to query
* @returns the state type, if the action is stateful
*/
vfunc_get_action_state_type(action_name: string | null): GLib.VariantType | null
/**
* Checks if the named action exists within `action_group`.
* @virtual
* @param action_name the name of the action to check for
* @returns whether the named action exists
*/
vfunc_has_action(action_name: string | null): boolean
/**
* Lists the actions contained within `action_group`.
*
* The caller is responsible for freeing the list with g_strfreev() when
* it is no longer required.
* @virtual
* @returns a %NULL-terminated array of the names of the actions in the group
*/
vfunc_list_actions(): string[]
/**
* Queries all aspects of the named action within an `action_group`.
*
* This function acquires the information available from
* g_action_group_has_action(), g_action_group_get_action_enabled(),
* g_action_group_get_action_parameter_type(),
* g_action_group_get_action_state_type(),
* g_action_group_get_action_state_hint() and
* g_action_group_get_action_state() with a single function call.
*
* This provides two main benefits.
*
* The first is the improvement in efficiency that comes with not having
* to perform repeated lookups of the action in order to discover
* different things about it. The second is that implementing
* #GActionGroup can now be done by only overriding this one virtual
* function.
*
* The interface provides a default implementation of this function that
* calls the individual functions, as required, to fetch the
* information. The interface also provides default implementations of
* those functions that call this function. All implementations,
* therefore, must override either this function or all of the others.
*
* If the action exists, %TRUE is returned and any of the requested
* fields (as indicated by having a non-%NULL reference passed in) are
* filled. If the action doesn't exist, %FALSE is returned and the
* fields may or may not have been modified.
* @virtual
* @param action_name the name of an action in the group
* @returns %TRUE if the action exists, else %FALSE
*/
vfunc_query_action(action_name: string | null): [ /* returnType */ boolean, /* enabled */ boolean, /* parameter_type */ GLib.VariantType, /* state_type */ GLib.VariantType, /* state_hint */ GLib.Variant, /* state */ GLib.Variant ]
// Own signals of Gio-2.0.Gio.ActionGroup
connect(sigName: "action-added", callback: ActionGroup.ActionAddedSignalCallback): number
connect_after(sigName: "action-added", callback: ActionGroup.ActionAddedSignalCallback): number
emit(sigName: "action-added", action_name: string | null, ...args: any[]): void
connect(sigName: "action-enabled-changed", callback: ActionGroup.ActionEnabledChangedSignalCallback): number
connect_after(sigName: "action-enabled-changed", callback: ActionGroup.ActionEnabledChangedSignalCallback): number
emit(sigName: "action-enabled-changed", action_name: string | null, enabled: boolean, ...args: any[]): void
connect(sigName: "action-removed", callback: ActionGroup.ActionRemovedSignalCallback): number
connect_after(sigName: "action-removed", callback: ActionGroup.ActionRemovedSignalCallback): number
emit(sigName: "action-removed", action_name: string | null, ...args: any[]): void
connect(sigName: "action-state-changed", callback: ActionGroup.ActionStateChangedSignalCallback): number
connect_after(sigName: "action-state-changed", callback: ActionGroup.ActionStateChangedSignalCallback): number
emit(sigName: "action-state-changed", action_name: string | null, value: GLib.Variant, ...args: any[]): void
// Class property signals of Gio-2.0.Gio.ActionGroup
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GActionGroup represents a group of actions. Actions can be used to
* expose functionality in a structured way, either from one part of a
* program to another, or to the outside world. Action groups are often
* used together with a #GMenuModel that provides additional
* representation data for displaying the actions to the user, e.g. in
* a menu.
*
* The main way to interact with the actions in a GActionGroup is to
* activate them with g_action_group_activate_action(). Activating an
* action may require a #GVariant parameter. The required type of the
* parameter can be inquired with g_action_group_get_action_parameter_type().
* Actions may be disabled, see g_action_group_get_action_enabled().
* Activating a disabled action has no effect.
*
* Actions may optionally have a state in the form of a #GVariant. The
* current state of an action can be inquired with
* g_action_group_get_action_state(). Activating a stateful action may
* change its state, but it is also possible to set the state by calling
* g_action_group_change_action_state().
*
* As typical example, consider a text editing application which has an
* option to change the current font to 'bold'. A good way to represent
* this would be a stateful action, with a boolean state. Activating the
* action would toggle the state.
*
* Each action in the group has a unique name (which is a string). All
* method calls, except g_action_group_list_actions() take the name of
* an action as an argument.
*
* The #GActionGroup API is meant to be the 'public' API to the action
* group. The calls here are exactly the interaction that 'external
* forces' (eg: UI, incoming D-Bus messages, etc.) are supposed to have
* with actions. 'Internal' APIs (ie: ones meant only to be accessed by
* the action group implementation) are found on subclasses. This is
* why you will find - for example - g_action_group_get_action_enabled()
* but not an equivalent set() call.
*
* Signals are emitted on the action group in response to state changes
* on individual actions.
*
* Implementations of #GActionGroup should provide implementations for
* the virtual functions g_action_group_list_actions() and
* g_action_group_query_action(). The other virtual functions should
* not be implemented - their "wrappers" are actually implemented with
* calls to g_action_group_query_action().
* @interface
*/
export class ActionGroup extends GObject.Object {
// Own properties of Gio-2.0.Gio.ActionGroup
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.ActionGroup
constructor(config?: ActionGroup.ConstructorProperties)
_init(config?: ActionGroup.ConstructorProperties): void
}
export module ActionMap {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface ActionMap {
// Owm methods of Gio-2.0.Gio.ActionMap
/**
* Adds an action to the `action_map`.
*
* If the action map already contains an action with the same name
* as `action` then the old action is dropped from the action map.
*
* The action map takes its own reference on `action`.
* @param action a #GAction
*/
add_action(action: Action): void
/**
* A convenience function for creating multiple #GSimpleAction instances
* and adding them to a #GActionMap.
*
* Each action is constructed as per one #GActionEntry.
*
*
* ```c
* static void
* activate_quit (GSimpleAction *simple,
* GVariant *parameter,
* gpointer user_data)
* {
* exit (0);
* }
*
* static void
* activate_print_string (GSimpleAction *simple,
* GVariant *parameter,
* gpointer user_data)
* {
* g_print ("%s\n", g_variant_get_string (parameter, NULL));
* }
*
* static GActionGroup *
* create_action_group (void)
* {
* const GActionEntry entries[] = {
* { "quit", activate_quit },
* { "print-string", activate_print_string, "s" }
* };
* GSimpleActionGroup *group;
*
* group = g_simple_action_group_new ();
* g_action_map_add_action_entries (G_ACTION_MAP (group), entries, G_N_ELEMENTS (entries), NULL);
*
* return G_ACTION_GROUP (group);
* }
* ```
*
* @param entries a pointer to the first item in an array of #GActionEntry structs
* @param user_data the user data for signal connections
*/
add_action_entries(entries: ActionEntry[], user_data: any | null): void
/**
* Looks up the action with the name `action_name` in `action_map`.
*
* If no such action exists, returns %NULL.
* @param action_name the name of an action
* @returns a #GAction, or %NULL
*/
lookup_action(action_name: string | null): Action | null
/**
* Removes the named action from the action map.
*
* If no action of this name is in the map then nothing happens.
* @param action_name the name of the action
*/
remove_action(action_name: string | null): void
/**
* Remove actions from a #GActionMap. This is meant as the reverse of
* g_action_map_add_action_entries().
*
*
*
* ```c
* static const GActionEntry entries[] = {
* { "quit", activate_quit },
* { "print-string", activate_print_string, "s" }
* };
*
* void
* add_actions (GActionMap *map)
* {
* g_action_map_add_action_entries (map, entries, G_N_ELEMENTS (entries), NULL);
* }
*
* void
* remove_actions (GActionMap *map)
* {
* g_action_map_remove_action_entries (map, entries, G_N_ELEMENTS (entries));
* }
* ```
*
* @param entries a pointer to the first item in an array of #GActionEntry structs
*/
remove_action_entries(entries: ActionEntry[]): void
// Own virtual methods of Gio-2.0.Gio.ActionMap
/**
* Adds an action to the `action_map`.
*
* If the action map already contains an action with the same name
* as `action` then the old action is dropped from the action map.
*
* The action map takes its own reference on `action`.
* @virtual
* @param action a #GAction
*/
vfunc_add_action(action: Action): void
/**
* Looks up the action with the name `action_name` in `action_map`.
*
* If no such action exists, returns %NULL.
* @virtual
* @param action_name the name of an action
* @returns a #GAction, or %NULL
*/
vfunc_lookup_action(action_name: string | null): Action | null
/**
* Removes the named action from the action map.
*
* If no action of this name is in the map then nothing happens.
* @virtual
* @param action_name the name of the action
*/
vfunc_remove_action(action_name: string | null): void
// Class property signals of Gio-2.0.Gio.ActionMap
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* The GActionMap interface is implemented by #GActionGroup
* implementations that operate by containing a number of
* named #GAction instances, such as #GSimpleActionGroup.
*
* One useful application of this interface is to map the
* names of actions from various action groups to unique,
* prefixed names (e.g. by prepending "app." or "win.").
* This is the motivation for the 'Map' part of the interface
* name.
* @interface
*/
export class ActionMap extends GObject.Object {
// Own properties of Gio-2.0.Gio.ActionMap
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.ActionMap
constructor(config?: ActionMap.ConstructorProperties)
_init(config?: ActionMap.ConstructorProperties): void
}
export module AppInfo {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface AppInfo {
// Owm methods of Gio-2.0.Gio.AppInfo
/**
* Adds a content type to the application information to indicate the
* application is capable of opening files with the given content type.
* @param content_type a string.
* @returns %TRUE on success, %FALSE on error.
*/
add_supports_type(content_type: string | null): boolean
/**
* Obtains the information whether the #GAppInfo can be deleted.
* See g_app_info_delete().
* @returns %TRUE if @appinfo can be deleted
*/
can_delete(): boolean
/**
* Checks if a supported content type can be removed from an application.
* @returns %TRUE if it is possible to remove supported content types from a given @appinfo, %FALSE if not.
*/
can_remove_supports_type(): boolean
/**
* Tries to delete a #GAppInfo.
*
* On some platforms, there may be a difference between user-defined
* #GAppInfos which can be deleted, and system-wide ones which cannot.
* See g_app_info_can_delete().
* @returns %TRUE if @appinfo has been deleted
*/
delete(): boolean
/**
* Creates a duplicate of a #GAppInfo.
* @returns a duplicate of @appinfo.
*/
dup(): AppInfo
/**
* Checks if two #GAppInfos are equal.
*
* Note that the check *may not* compare each individual
* field, and only does an identity check. In case detecting changes in the
* contents is needed, program code must additionally compare relevant fields.
* @param appinfo2 the second #GAppInfo.
* @returns %TRUE if @appinfo1 is equal to @appinfo2. %FALSE otherwise.
*/
equal(appinfo2: AppInfo): boolean
/**
* Gets the commandline with which the application will be
* started.
* @returns a string containing the @appinfo's commandline, or %NULL if this information is not available
*/
get_commandline(): string | null
/**
* Gets a human-readable description of an installed application.
* @returns a string containing a description of the application @appinfo, or %NULL if none.
*/
get_description(): string | null
/**
* Gets the display name of the application. The display name is often more
* descriptive to the user than the name itself.
* @returns the display name of the application for @appinfo, or the name if no display name is available.
*/
get_display_name(): string | null
/**
* Gets the executable's name for the installed application.
*
* This is intended to be used for debugging or labelling what program is going
* to be run. To launch the executable, use g_app_info_launch() and related
* functions, rather than spawning the return value from this function.
* @returns a string containing the @appinfo's application binaries name
*/
get_executable(): string
/**
* Gets the icon for the application.
* @returns the default #GIcon for @appinfo or %NULL if there is no default icon.
*/
get_icon(): Icon | null
/**
* Gets the ID of an application. An id is a string that
* identifies the application. The exact format of the id is
* platform dependent. For instance, on Unix this is the
* desktop file id from the xdg menu specification.
*
* Note that the returned ID may be %NULL, depending on how
* the `appinfo` has been constructed.
* @returns a string containing the application's ID.
*/
get_id(): string | null
/**
* Gets the installed name of the application.
* @returns the name of the application for @appinfo.
*/
get_name(): string | null
/**
* Retrieves the list of content types that `app_info` claims to support.
* If this information is not provided by the environment, this function
* will return %NULL.
* This function does not take in consideration associations added with
* g_app_info_add_supports_type(), but only those exported directly by
* the application.
* @returns a list of content types.
*/
get_supported_types(): string[]
/**
* Launches the application. Passes `files` to the launched application
* as arguments, using the optional `context` to get information
* about the details of the launcher (like what screen it is on).
* On error, `error` will be set accordingly.
*
* To launch the application without arguments pass a %NULL `files` list.
*
* Note that even if the launch is successful the application launched
* can fail to start if it runs into problems during startup. There is
* no way to detect this.
*
* Some URIs can be changed when passed through a GFile (for instance
* unsupported URIs with strange formats like mailto:), so if you have
* a textual URI you want to pass in as argument, consider using
* g_app_info_launch_uris() instead.
*
* The launched application inherits the environment of the launching
* process, but it can be modified with g_app_launch_context_setenv()
* and g_app_launch_context_unsetenv().
*
* On UNIX, this function sets the `GIO_LAUNCHED_DESKTOP_FILE`
* environment variable with the path of the launched desktop file and
* `GIO_LAUNCHED_DESKTOP_FILE_PID` to the process id of the launched
* process. This can be used to ignore `GIO_LAUNCHED_DESKTOP_FILE`,
* should it be inherited by further processes. The `DISPLAY`,
* `XDG_ACTIVATION_TOKEN` and `DESKTOP_STARTUP_ID` environment
* variables are also set, based on information provided in `context`.
* @param files a #GList of #GFile objects
* @param context a #GAppLaunchContext or %NULL
* @returns %TRUE on successful launch, %FALSE otherwise.
*/
launch(files: File[] | null, context: AppLaunchContext | null): boolean
/**
* Launches the application. This passes the `uris` to the launched application
* as arguments, using the optional `context` to get information
* about the details of the launcher (like what screen it is on).
* On error, `error` will be set accordingly. If the application only supports
* one URI per invocation as part of their command-line, multiple instances
* of the application will be spawned.
*
* To launch the application without arguments pass a %NULL `uris` list.
*
* Note that even if the launch is successful the application launched
* can fail to start if it runs into problems during startup. There is
* no way to detect this.
* @param uris a #GList containing URIs to launch.
* @param context a #GAppLaunchContext or %NULL
* @returns %TRUE on successful launch, %FALSE otherwise.
*/
launch_uris(uris: string[] | null, context: AppLaunchContext | null): boolean
/**
* Async version of g_app_info_launch_uris().
*
* The `callback` is invoked immediately after the application launch, but it
* waits for activation in case of D-Bus–activated applications and also provides
* extended error information for sandboxed applications, see notes for
* g_app_info_launch_default_for_uri_async().
* @param uris a #GList containing URIs to launch.
* @param context a #GAppLaunchContext or %NULL
* @param cancellable a #GCancellable
* @param callback a #GAsyncReadyCallback to call when the request is done
*/
launch_uris_async(uris: string[] | null, context: AppLaunchContext | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of launch_uris_async
/**
* Promisified version of {@link launch_uris_async}
*
* Async version of g_app_info_launch_uris().
*
* The `callback` is invoked immediately after the application launch, but it
* waits for activation in case of D-Bus–activated applications and also provides
* extended error information for sandboxed applications, see notes for
* g_app_info_launch_default_for_uri_async().
* @param uris a #GList containing URIs to launch.
* @param context a #GAppLaunchContext or %NULL
* @param cancellable a #GCancellable
* @returns A Promise of: %TRUE on successful launch, %FALSE otherwise.
*/
launch_uris_async(uris: string[] | null, context: AppLaunchContext | null, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes a g_app_info_launch_uris_async() operation.
* @param result a #GAsyncResult
* @returns %TRUE on successful launch, %FALSE otherwise.
*/
launch_uris_finish(result: AsyncResult): boolean
/**
* Removes a supported type from an application, if possible.
* @param content_type a string.
* @returns %TRUE on success, %FALSE on error.
*/
remove_supports_type(content_type: string | null): boolean
/**
* Sets the application as the default handler for the given file extension.
* @param extension a string containing the file extension (without the dot).
* @returns %TRUE on success, %FALSE on error.
*/
set_as_default_for_extension(extension: string): boolean
/**
* Sets the application as the default handler for a given type.
* @param content_type the content type.
* @returns %TRUE on success, %FALSE on error.
*/
set_as_default_for_type(content_type: string | null): boolean
/**
* Sets the application as the last used application for a given type.
* This will make the application appear as first in the list returned
* by g_app_info_get_recommended_for_type(), regardless of the default
* application for that content type.
* @param content_type the content type.
* @returns %TRUE on success, %FALSE on error.
*/
set_as_last_used_for_type(content_type: string | null): boolean
/**
* Checks if the application info should be shown in menus that
* list available applications.
* @returns %TRUE if the @appinfo should be shown, %FALSE otherwise.
*/
should_show(): boolean
/**
* Checks if the application accepts files as arguments.
* @returns %TRUE if the @appinfo supports files.
*/
supports_files(): boolean
/**
* Checks if the application supports reading files and directories from URIs.
* @returns %TRUE if the @appinfo supports URIs.
*/
supports_uris(): boolean
// Own virtual methods of Gio-2.0.Gio.AppInfo
/**
* Adds a content type to the application information to indicate the
* application is capable of opening files with the given content type.
* @virtual
* @param content_type a string.
* @returns %TRUE on success, %FALSE on error.
*/
vfunc_add_supports_type(content_type: string | null): boolean
/**
* Obtains the information whether the #GAppInfo can be deleted.
* See g_app_info_delete().
* @virtual
* @returns %TRUE if @appinfo can be deleted
*/
vfunc_can_delete(): boolean
/**
* Checks if a supported content type can be removed from an application.
* @virtual
* @returns %TRUE if it is possible to remove supported content types from a given @appinfo, %FALSE if not.
*/
vfunc_can_remove_supports_type(): boolean
/**
* Tries to delete a #GAppInfo.
*
* On some platforms, there may be a difference between user-defined
* #GAppInfos which can be deleted, and system-wide ones which cannot.
* See g_app_info_can_delete().
* @virtual
* @returns %TRUE if @appinfo has been deleted
*/
vfunc_do_delete(): boolean
/**
* Creates a duplicate of a #GAppInfo.
* @virtual
* @returns a duplicate of @appinfo.
*/
vfunc_dup(): AppInfo
/**
* Checks if two #GAppInfos are equal.
*
* Note that the check *may not* compare each individual
* field, and only does an identity check. In case detecting changes in the
* contents is needed, program code must additionally compare relevant fields.
* @virtual
* @param appinfo2 the second #GAppInfo.
* @returns %TRUE if @appinfo1 is equal to @appinfo2. %FALSE otherwise.
*/
vfunc_equal(appinfo2: AppInfo): boolean
/**
* Gets the commandline with which the application will be
* started.
* @virtual
* @returns a string containing the @appinfo's commandline, or %NULL if this information is not available
*/
vfunc_get_commandline(): string | null
/**
* Gets a human-readable description of an installed application.
* @virtual
* @returns a string containing a description of the application @appinfo, or %NULL if none.
*/
vfunc_get_description(): string | null
/**
* Gets the display name of the application. The display name is often more
* descriptive to the user than the name itself.
* @virtual
* @returns the display name of the application for @appinfo, or the name if no display name is available.
*/
vfunc_get_display_name(): string | null
/**
* Gets the executable's name for the installed application.
*
* This is intended to be used for debugging or labelling what program is going
* to be run. To launch the executable, use g_app_info_launch() and related
* functions, rather than spawning the return value from this function.
* @virtual
* @returns a string containing the @appinfo's application binaries name
*/
vfunc_get_executable(): string
/**
* Gets the icon for the application.
* @virtual
* @returns the default #GIcon for @appinfo or %NULL if there is no default icon.
*/
vfunc_get_icon(): Icon | null
/**
* Gets the ID of an application. An id is a string that
* identifies the application. The exact format of the id is
* platform dependent. For instance, on Unix this is the
* desktop file id from the xdg menu specification.
*
* Note that the returned ID may be %NULL, depending on how
* the `appinfo` has been constructed.
* @virtual
* @returns a string containing the application's ID.
*/
vfunc_get_id(): string | null
/**
* Gets the installed name of the application.
* @virtual
* @returns the name of the application for @appinfo.
*/
vfunc_get_name(): string | null
/**
* Retrieves the list of content types that `app_info` claims to support.
* If this information is not provided by the environment, this function
* will return %NULL.
* This function does not take in consideration associations added with
* g_app_info_add_supports_type(), but only those exported directly by
* the application.
* @virtual
* @returns a list of content types.
*/
vfunc_get_supported_types(): string[]
/**
* Launches the application. Passes `files` to the launched application
* as arguments, using the optional `context` to get information
* about the details of the launcher (like what screen it is on).
* On error, `error` will be set accordingly.
*
* To launch the application without arguments pass a %NULL `files` list.
*
* Note that even if the launch is successful the application launched
* can fail to start if it runs into problems during startup. There is
* no way to detect this.
*
* Some URIs can be changed when passed through a GFile (for instance
* unsupported URIs with strange formats like mailto:), so if you have
* a textual URI you want to pass in as argument, consider using
* g_app_info_launch_uris() instead.
*
* The launched application inherits the environment of the launching
* process, but it can be modified with g_app_launch_context_setenv()
* and g_app_launch_context_unsetenv().
*
* On UNIX, this function sets the `GIO_LAUNCHED_DESKTOP_FILE`
* environment variable with the path of the launched desktop file and
* `GIO_LAUNCHED_DESKTOP_FILE_PID` to the process id of the launched
* process. This can be used to ignore `GIO_LAUNCHED_DESKTOP_FILE`,
* should it be inherited by further processes. The `DISPLAY`,
* `XDG_ACTIVATION_TOKEN` and `DESKTOP_STARTUP_ID` environment
* variables are also set, based on information provided in `context`.
* @virtual
* @param files a #GList of #GFile objects
* @param context a #GAppLaunchContext or %NULL
* @returns %TRUE on successful launch, %FALSE otherwise.
*/
vfunc_launch(files: File[] | null, context: AppLaunchContext | null): boolean
/**
* Launches the application. This passes the `uris` to the launched application
* as arguments, using the optional `context` to get information
* about the details of the launcher (like what screen it is on).
* On error, `error` will be set accordingly. If the application only supports
* one URI per invocation as part of their command-line, multiple instances
* of the application will be spawned.
*
* To launch the application without arguments pass a %NULL `uris` list.
*
* Note that even if the launch is successful the application launched
* can fail to start if it runs into problems during startup. There is
* no way to detect this.
* @virtual
* @param uris a #GList containing URIs to launch.
* @param context a #GAppLaunchContext or %NULL
* @returns %TRUE on successful launch, %FALSE otherwise.
*/
vfunc_launch_uris(uris: string[] | null, context: AppLaunchContext | null): boolean
/**
* Async version of g_app_info_launch_uris().
*
* The `callback` is invoked immediately after the application launch, but it
* waits for activation in case of D-Bus–activated applications and also provides
* extended error information for sandboxed applications, see notes for
* g_app_info_launch_default_for_uri_async().
* @virtual
* @param uris a #GList containing URIs to launch.
* @param context a #GAppLaunchContext or %NULL
* @param cancellable a #GCancellable
* @param callback a #GAsyncReadyCallback to call when the request is done
*/
vfunc_launch_uris_async(uris: string[] | null, context: AppLaunchContext | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes a g_app_info_launch_uris_async() operation.
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE on successful launch, %FALSE otherwise.
*/
vfunc_launch_uris_finish(result: AsyncResult): boolean
/**
* Removes a supported type from an application, if possible.
* @virtual
* @param content_type a string.
* @returns %TRUE on success, %FALSE on error.
*/
vfunc_remove_supports_type(content_type: string | null): boolean
/**
* Sets the application as the default handler for the given file extension.
* @virtual
* @param extension a string containing the file extension (without the dot).
* @returns %TRUE on success, %FALSE on error.
*/
vfunc_set_as_default_for_extension(extension: string): boolean
/**
* Sets the application as the default handler for a given type.
* @virtual
* @param content_type the content type.
* @returns %TRUE on success, %FALSE on error.
*/
vfunc_set_as_default_for_type(content_type: string | null): boolean
/**
* Sets the application as the last used application for a given type.
* This will make the application appear as first in the list returned
* by g_app_info_get_recommended_for_type(), regardless of the default
* application for that content type.
* @virtual
* @param content_type the content type.
* @returns %TRUE on success, %FALSE on error.
*/
vfunc_set_as_last_used_for_type(content_type: string | null): boolean
/**
* Checks if the application info should be shown in menus that
* list available applications.
* @virtual
* @returns %TRUE if the @appinfo should be shown, %FALSE otherwise.
*/
vfunc_should_show(): boolean
/**
* Checks if the application accepts files as arguments.
* @virtual
* @returns %TRUE if the @appinfo supports files.
*/
vfunc_supports_files(): boolean
/**
* Checks if the application supports reading files and directories from URIs.
* @virtual
* @returns %TRUE if the @appinfo supports URIs.
*/
vfunc_supports_uris(): boolean
// Class property signals of Gio-2.0.Gio.AppInfo
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GAppInfo and #GAppLaunchContext are used for describing and launching
* applications installed on the system.
*
* As of GLib 2.20, URIs will always be converted to POSIX paths
* (using g_file_get_path()) when using g_app_info_launch() even if
* the application requested an URI and not a POSIX path. For example
* for a desktop-file based application with Exec key `totem
* %U` and a single URI, `sftp://foo/file.avi`, then
* `/home/user/.gvfs/sftp on foo/file.avi` will be passed. This will
* only work if a set of suitable GIO extensions (such as gvfs 2.26
* compiled with FUSE support), is available and operational; if this
* is not the case, the URI will be passed unmodified to the application.
* Some URIs, such as `mailto:`, of course cannot be mapped to a POSIX
* path (in gvfs there's no FUSE mount for it); such URIs will be
* passed unmodified to the application.
*
* Specifically for gvfs 2.26 and later, the POSIX URI will be mapped
* back to the GIO URI in the #GFile constructors (since gvfs
* implements the #GVfs extension point). As such, if the application
* needs to examine the URI, it needs to use g_file_get_uri() or
* similar on #GFile. In other words, an application cannot assume
* that the URI passed to e.g. g_file_new_for_commandline_arg() is
* equal to the result of g_file_get_uri(). The following snippet
* illustrates this:
*
*
* ```
* GFile *f;
* char *uri;
*
* file = g_file_new_for_commandline_arg (uri_from_commandline);
*
* uri = g_file_get_uri (file);
* strcmp (uri, uri_from_commandline) == 0;
* g_free (uri);
*
* if (g_file_has_uri_scheme (file, "cdda"))
* {
* // do something special with uri
* }
* g_object_unref (file);
* ```
*
*
* This code will work when both `cdda://sr0/Track 1.wav` and
* `/home/user/.gvfs/cdda on sr0/Track 1.wav` is passed to the
* application. It should be noted that it's generally not safe
* for applications to rely on the format of a particular URIs.
* Different launcher applications (e.g. file managers) may have
* different ideas of what a given URI means.
* @interface
*/
export class AppInfo extends GObject.Object {
// Own properties of Gio-2.0.Gio.AppInfo
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.AppInfo
constructor(config?: AppInfo.ConstructorProperties)
_init(config?: AppInfo.ConstructorProperties): void
/**
* Creates a new #GAppInfo from the given information.
*
* Note that for `commandline,` the quoting rules of the Exec key of the
* [freedesktop.org Desktop Entry Specification](http://freedesktop.org/Standards/desktop-entry-spec)
* are applied. For example, if the `commandline` contains
* percent-encoded URIs, the percent-character must be doubled in order to prevent it from
* being swallowed by Exec key unquoting. See the specification for exact quoting rules.
* @param commandline the commandline to use
* @param application_name the application name, or %NULL to use `commandline`
* @param flags flags that can specify details of the created #GAppInfo
* @returns new #GAppInfo for given command.
*/
static create_from_commandline(commandline: string, application_name: string | null, flags: AppInfoCreateFlags): AppInfo
/**
* Gets a list of all of the applications currently registered
* on this system.
*
* For desktop files, this includes applications that have
* `NoDisplay=true` set or are excluded from display by means
* of `OnlyShowIn` or `NotShowIn`. See g_app_info_should_show().
* The returned list does not include applications which have
* the `Hidden` key set.
* @returns a newly allocated #GList of references to #GAppInfos.
*/
static get_all(): AppInfo[]
/**
* Gets a list of all #GAppInfos for a given content type,
* including the recommended and fallback #GAppInfos. See
* g_app_info_get_recommended_for_type() and
* g_app_info_get_fallback_for_type().
* @param content_type the content type to find a #GAppInfo for
* @returns #GList of #GAppInfos for given @content_type or %NULL on error.
*/
static get_all_for_type(content_type: string | null): AppInfo[]
/**
* Gets the default #GAppInfo for a given content type.
* @param content_type the content type to find a #GAppInfo for
* @param must_support_uris if %TRUE, the #GAppInfo is expected to support URIs
* @returns #GAppInfo for given @content_type or %NULL on error.
*/
static get_default_for_type(content_type: string | null, must_support_uris: boolean): AppInfo | null
/**
* Asynchronously gets the default #GAppInfo for a given content type.
* @param content_type the content type to find a #GAppInfo for
* @param must_support_uris if %TRUE, the #GAppInfo is expected to support URIs
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is done
*/
static get_default_for_type_async(content_type: string | null, must_support_uris: boolean, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes a default #GAppInfo lookup started by
* g_app_info_get_default_for_type_async().
*
* If no #GAppInfo is found, then `error` will be set to %G_IO_ERROR_NOT_FOUND.
* @param result a #GAsyncResult
* @returns #GAppInfo for given @content_type or %NULL on error.
*/
static get_default_for_type_finish(result: AsyncResult): AppInfo
/**
* Gets the default application for handling URIs with
* the given URI scheme. A URI scheme is the initial part
* of the URI, up to but not including the ':', e.g. "http",
* "ftp" or "sip".
* @param uri_scheme a string containing a URI scheme.
* @returns #GAppInfo for given @uri_scheme or %NULL on error.
*/
static get_default_for_uri_scheme(uri_scheme: string | null): AppInfo | null
/**
* Asynchronously gets the default application for handling URIs with
* the given URI scheme. A URI scheme is the initial part
* of the URI, up to but not including the ':', e.g. "http",
* "ftp" or "sip".
* @param uri_scheme a string containing a URI scheme.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is done
*/
static get_default_for_uri_scheme_async(uri_scheme: string | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes a default #GAppInfo lookup started by
* g_app_info_get_default_for_uri_scheme_async().
*
* If no #GAppInfo is found, then `error` will be set to %G_IO_ERROR_NOT_FOUND.
* @param result a #GAsyncResult
* @returns #GAppInfo for given @uri_scheme or %NULL on error.
*/
static get_default_for_uri_scheme_finish(result: AsyncResult): AppInfo
/**
* Gets a list of fallback #GAppInfos for a given content type, i.e.
* those applications which claim to support the given content type
* by MIME type subclassing and not directly.
* @param content_type the content type to find a #GAppInfo for
* @returns #GList of #GAppInfos for given @content_type or %NULL on error.
*/
static get_fallback_for_type(content_type: string | null): AppInfo[]
/**
* Gets a list of recommended #GAppInfos for a given content type, i.e.
* those applications which claim to support the given content type exactly,
* and not by MIME type subclassing.
* Note that the first application of the list is the last used one, i.e.
* the last one for which g_app_info_set_as_last_used_for_type() has been
* called.
* @param content_type the content type to find a #GAppInfo for
* @returns #GList of #GAppInfos for given @content_type or %NULL on error.
*/
static get_recommended_for_type(content_type: string | null): AppInfo[]
/**
* Utility function that launches the default application
* registered to handle the specified uri. Synchronous I/O
* is done on the uri to detect the type of the file if
* required.
*
* The D-Bus–activated applications don't have to be started if your application
* terminates too soon after this function. To prevent this, use
* g_app_info_launch_default_for_uri_async() instead.
* @param uri the uri to show
* @param context an optional #GAppLaunchContext
* @returns %TRUE on success, %FALSE on error.
*/
static launch_default_for_uri(uri: string | null, context: AppLaunchContext | null): boolean
/**
* Async version of g_app_info_launch_default_for_uri().
*
* This version is useful if you are interested in receiving
* error information in the case where the application is
* sandboxed and the portal may present an application chooser
* dialog to the user.
*
* This is also useful if you want to be sure that the D-Bus–activated
* applications are really started before termination and if you are interested
* in receiving error information from their activation.
* @param uri the uri to show
* @param context an optional #GAppLaunchContext
* @param cancellable a #GCancellable
* @param callback a #GAsyncReadyCallback to call when the request is done
*/
static launch_default_for_uri_async(uri: string | null, context: AppLaunchContext | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous launch-default-for-uri operation.
* @param result a #GAsyncResult
* @returns %TRUE if the launch was successful, %FALSE if @error is set
*/
static launch_default_for_uri_finish(result: AsyncResult): boolean
/**
* Removes all changes to the type associations done by
* g_app_info_set_as_default_for_type(),
* g_app_info_set_as_default_for_extension(),
* g_app_info_add_supports_type() or
* g_app_info_remove_supports_type().
* @param content_type a content type
*/
static reset_type_associations(content_type: string | null): void
}
export module AsyncInitable {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface AsyncInitable {
// Owm methods of Gio-2.0.Gio.AsyncInitable
/**
* Starts asynchronous initialization of the object implementing the
* interface. This must be done before any real use of the object after
* initial construction. If the object also implements #GInitable you can
* optionally call g_initable_init() instead.
*
* This method is intended for language bindings. If writing in C,
* g_async_initable_new_async() should typically be used instead.
*
* When the initialization is finished, `callback` will be called. You can
* then call g_async_initable_init_finish() to get the result of the
* initialization.
*
* Implementations may also support cancellation. If `cancellable` is not
* %NULL, then initialization can be cancelled by triggering the cancellable
* object from another thread. If the operation was cancelled, the error
* %G_IO_ERROR_CANCELLED will be returned. If `cancellable` is not %NULL, and
* the object doesn't support cancellable initialization, the error
* %G_IO_ERROR_NOT_SUPPORTED will be returned.
*
* As with #GInitable, if the object is not initialized, or initialization
* returns with an error, then all operations on the object except
* g_object_ref() and g_object_unref() are considered to be invalid, and
* have undefined behaviour. They will often fail with g_critical() or
* g_warning(), but this must not be relied on.
*
* Callers should not assume that a class which implements #GAsyncInitable can
* be initialized multiple times; for more information, see g_initable_init().
* If a class explicitly supports being initialized multiple times,
* implementation requires yielding all subsequent calls to init_async() on the
* results of the first call.
*
* For classes that also support the #GInitable interface, the default
* implementation of this method will run the g_initable_init() function
* in a thread, so if you want to support asynchronous initialization via
* threads, just implement the #GAsyncInitable interface without overriding
* any interface methods.
* @param io_priority the [I/O priority][io-priority] of the operation
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
init_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of init_async
/**
* Promisified version of {@link init_async}
*
* Starts asynchronous initialization of the object implementing the
* interface. This must be done before any real use of the object after
* initial construction. If the object also implements #GInitable you can
* optionally call g_initable_init() instead.
*
* This method is intended for language bindings. If writing in C,
* g_async_initable_new_async() should typically be used instead.
*
* When the initialization is finished, `callback` will be called. You can
* then call g_async_initable_init_finish() to get the result of the
* initialization.
*
* Implementations may also support cancellation. If `cancellable` is not
* %NULL, then initialization can be cancelled by triggering the cancellable
* object from another thread. If the operation was cancelled, the error
* %G_IO_ERROR_CANCELLED will be returned. If `cancellable` is not %NULL, and
* the object doesn't support cancellable initialization, the error
* %G_IO_ERROR_NOT_SUPPORTED will be returned.
*
* As with #GInitable, if the object is not initialized, or initialization
* returns with an error, then all operations on the object except
* g_object_ref() and g_object_unref() are considered to be invalid, and
* have undefined behaviour. They will often fail with g_critical() or
* g_warning(), but this must not be relied on.
*
* Callers should not assume that a class which implements #GAsyncInitable can
* be initialized multiple times; for more information, see g_initable_init().
* If a class explicitly supports being initialized multiple times,
* implementation requires yielding all subsequent calls to init_async() on the
* results of the first call.
*
* For classes that also support the #GInitable interface, the default
* implementation of this method will run the g_initable_init() function
* in a thread, so if you want to support asynchronous initialization via
* threads, just implement the #GAsyncInitable interface without overriding
* any interface methods.
* @param io_priority the [I/O priority][io-priority] of the operation
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns A Promise of: %TRUE if successful. If an error has occurred, this function will return %FALSE and set @error appropriately if present.
*/
init_async(io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes asynchronous initialization and returns the result.
* See g_async_initable_init_async().
* @param res a #GAsyncResult.
* @returns %TRUE if successful. If an error has occurred, this function will return %FALSE and set @error appropriately if present.
*/
init_finish(res: AsyncResult): boolean
/**
* Finishes the async construction for the various g_async_initable_new
* calls, returning the created object or %NULL on error.
* @param res the #GAsyncResult from the callback
* @returns a newly created #GObject, or %NULL on error. Free with g_object_unref().
*/
new_finish(res: AsyncResult): GObject.Object
// Own virtual methods of Gio-2.0.Gio.AsyncInitable
/**
* Starts asynchronous initialization of the object implementing the
* interface. This must be done before any real use of the object after
* initial construction. If the object also implements #GInitable you can
* optionally call g_initable_init() instead.
*
* This method is intended for language bindings. If writing in C,
* g_async_initable_new_async() should typically be used instead.
*
* When the initialization is finished, `callback` will be called. You can
* then call g_async_initable_init_finish() to get the result of the
* initialization.
*
* Implementations may also support cancellation. If `cancellable` is not
* %NULL, then initialization can be cancelled by triggering the cancellable
* object from another thread. If the operation was cancelled, the error
* %G_IO_ERROR_CANCELLED will be returned. If `cancellable` is not %NULL, and
* the object doesn't support cancellable initialization, the error
* %G_IO_ERROR_NOT_SUPPORTED will be returned.
*
* As with #GInitable, if the object is not initialized, or initialization
* returns with an error, then all operations on the object except
* g_object_ref() and g_object_unref() are considered to be invalid, and
* have undefined behaviour. They will often fail with g_critical() or
* g_warning(), but this must not be relied on.
*
* Callers should not assume that a class which implements #GAsyncInitable can
* be initialized multiple times; for more information, see g_initable_init().
* If a class explicitly supports being initialized multiple times,
* implementation requires yielding all subsequent calls to init_async() on the
* results of the first call.
*
* For classes that also support the #GInitable interface, the default
* implementation of this method will run the g_initable_init() function
* in a thread, so if you want to support asynchronous initialization via
* threads, just implement the #GAsyncInitable interface without overriding
* any interface methods.
* @virtual
* @param io_priority the [I/O priority][io-priority] of the operation
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_init_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes asynchronous initialization and returns the result.
* See g_async_initable_init_async().
* @virtual
* @param res a #GAsyncResult.
* @returns %TRUE if successful. If an error has occurred, this function will return %FALSE and set @error appropriately if present.
*/
vfunc_init_finish(res: AsyncResult): boolean
// Class property signals of Gio-2.0.Gio.AsyncInitable
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* This is the asynchronous version of #GInitable; it behaves the same
* in all ways except that initialization is asynchronous. For more details
* see the descriptions on #GInitable.
*
* A class may implement both the #GInitable and #GAsyncInitable interfaces.
*
* Users of objects implementing this are not intended to use the interface
* method directly; instead it will be used automatically in various ways.
* For C applications you generally just call g_async_initable_new_async()
* directly, or indirectly via a foo_thing_new_async() wrapper. This will call
* g_async_initable_init_async() under the cover, calling back with %NULL and
* a set %GError on failure.
*
* A typical implementation might look something like this:
*
*
* ```c
* enum {
* NOT_INITIALIZED,
* INITIALIZING,
* INITIALIZED
* };
*
* static void
* _foo_ready_cb (Foo *self)
* {
* GList *l;
*
* self->priv->state = INITIALIZED;
*
* for (l = self->priv->init_results; l != NULL; l = l->next)
* {
* GTask *task = l->data;
*
* if (self->priv->success)
* g_task_return_boolean (task, TRUE);
* else
* g_task_return_new_error (task, ...);
* g_object_unref (task);
* }
*
* g_list_free (self->priv->init_results);
* self->priv->init_results = NULL;
* }
*
* static void
* foo_init_async (GAsyncInitable *initable,
* int io_priority,
* GCancellable *cancellable,
* GAsyncReadyCallback callback,
* gpointer user_data)
* {
* Foo *self = FOO (initable);
* GTask *task;
*
* task = g_task_new (initable, cancellable, callback, user_data);
* g_task_set_name (task, G_STRFUNC);
*
* switch (self->priv->state)
* {
* case NOT_INITIALIZED:
* _foo_get_ready (self);
* self->priv->init_results = g_list_append (self->priv->init_results,
* task);
* self->priv->state = INITIALIZING;
* break;
* case INITIALIZING:
* self->priv->init_results = g_list_append (self->priv->init_results,
* task);
* break;
* case INITIALIZED:
* if (!self->priv->success)
* g_task_return_new_error (task, ...);
* else
* g_task_return_boolean (task, TRUE);
* g_object_unref (task);
* break;
* }
* }
*
* static gboolean
* foo_init_finish (GAsyncInitable *initable,
* GAsyncResult *result,
* GError **error)
* {
* g_return_val_if_fail (g_task_is_valid (result, initable), FALSE);
*
* return g_task_propagate_boolean (G_TASK (result), error);
* }
*
* static void
* foo_async_initable_iface_init (gpointer g_iface,
* gpointer data)
* {
* GAsyncInitableIface *iface = g_iface;
*
* iface->init_async = foo_init_async;
* iface->init_finish = foo_init_finish;
* }
* ```
*
* @interface
*/
export class AsyncInitable extends GObject.Object {
// Own properties of Gio-2.0.Gio.AsyncInitable
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.AsyncInitable
constructor(config?: AsyncInitable.ConstructorProperties)
_init(config?: AsyncInitable.ConstructorProperties): void
/**
* Helper function for constructing #GAsyncInitable object. This is
* similar to g_object_newv() but also initializes the object asynchronously.
*
* When the initialization is finished, `callback` will be called. You can
* then call g_async_initable_new_finish() to get the new object and check
* for any errors.
* @param object_type a #GType supporting #GAsyncInitable.
* @param n_parameters the number of parameters in `parameters`
* @param parameters the parameters to use to construct the object
* @param io_priority the [I/O priority][io-priority] of the operation
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback to call when the initialization is finished
*/
static newv_async(object_type: GObject.GType, n_parameters: number, parameters: GObject.Parameter, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
}
export module AsyncResult {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface AsyncResult {
// Owm methods of Gio-2.0.Gio.AsyncResult
/**
* Gets the source object from a #GAsyncResult.
* @returns a new reference to the source object for the @res, or %NULL if there is none.
*/
get_source_object(): GObject.Object | null
/**
* Gets the user data from a #GAsyncResult.
* @returns the user data for @res.
*/
get_user_data(): any | null
/**
* Checks if `res` has the given `source_tag` (generally a function
* pointer indicating the function `res` was created by).
* @param source_tag an application-defined tag
* @returns %TRUE if @res has the indicated @source_tag, %FALSE if not.
*/
is_tagged(source_tag: any | null): boolean
/**
* If `res` is a #GSimpleAsyncResult, this is equivalent to
* g_simple_async_result_propagate_error(). Otherwise it returns
* %FALSE.
*
* This can be used for legacy error handling in async *_finish()
* wrapper functions that traditionally handled #GSimpleAsyncResult
* error returns themselves rather than calling into the virtual method.
* This should not be used in new code; #GAsyncResult errors that are
* set by virtual methods should also be extracted by virtual methods,
* to enable subclasses to chain up correctly.
* @returns %TRUE if @error is has been filled in with an error from @res, %FALSE if not.
*/
legacy_propagate_error(): boolean
// Own virtual methods of Gio-2.0.Gio.AsyncResult
/**
* Gets the source object from a #GAsyncResult.
* @virtual
* @returns a new reference to the source object for the @res, or %NULL if there is none.
*/
vfunc_get_source_object(): GObject.Object | null
/**
* Gets the user data from a #GAsyncResult.
* @virtual
* @returns the user data for @res.
*/
vfunc_get_user_data(): any | null
/**
* Checks if `res` has the given `source_tag` (generally a function
* pointer indicating the function `res` was created by).
* @virtual
* @param source_tag an application-defined tag
* @returns %TRUE if @res has the indicated @source_tag, %FALSE if not.
*/
vfunc_is_tagged(source_tag: any | null): boolean
// Class property signals of Gio-2.0.Gio.AsyncResult
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* Provides a base class for implementing asynchronous function results.
*
* Asynchronous operations are broken up into two separate operations
* which are chained together by a #GAsyncReadyCallback. To begin
* an asynchronous operation, provide a #GAsyncReadyCallback to the
* asynchronous function. This callback will be triggered when the
* operation has completed, and must be run in a later iteration of
* the [thread-default main context][g-main-context-push-thread-default]
* from where the operation was initiated. It will be passed a
* #GAsyncResult instance filled with the details of the operation's
* success or failure, the object the asynchronous function was
* started for and any error codes returned. The asynchronous callback
* function is then expected to call the corresponding "_finish()"
* function, passing the object the function was called for, the
* #GAsyncResult instance, and (optionally) an `error` to grab any
* error conditions that may have occurred.
*
* The "_finish()" function for an operation takes the generic result
* (of type #GAsyncResult) and returns the specific result that the
* operation in question yields (e.g. a #GFileEnumerator for a
* "enumerate children" operation). If the result or error status of the
* operation is not needed, there is no need to call the "_finish()"
* function; GIO will take care of cleaning up the result and error
* information after the #GAsyncReadyCallback returns. You can pass
* %NULL for the #GAsyncReadyCallback if you don't need to take any
* action at all after the operation completes. Applications may also
* take a reference to the #GAsyncResult and call "_finish()" later;
* however, the "_finish()" function may be called at most once.
*
* Example of a typical asynchronous operation flow:
*
* ```c
* void _theoretical_frobnitz_async (Theoretical *t,
* GCancellable *c,
* GAsyncReadyCallback cb,
* gpointer u);
*
* gboolean _theoretical_frobnitz_finish (Theoretical *t,
* GAsyncResult *res,
* GError **e);
*
* static void
* frobnitz_result_func (GObject *source_object,
* GAsyncResult *res,
* gpointer user_data)
* {
* gboolean success = FALSE;
*
* success = _theoretical_frobnitz_finish (source_object, res, NULL);
*
* if (success)
* g_printf ("Hurray!\n");
* else
* g_printf ("Uh oh!\n");
*
* ...
*
* }
*
* int main (int argc, void *argv[])
* {
* ...
*
* _theoretical_frobnitz_async (theoretical_data,
* NULL,
* frobnitz_result_func,
* NULL);
*
* ...
* }
* ```
*
*
* The callback for an asynchronous operation is called only once, and is
* always called, even in the case of a cancelled operation. On cancellation
* the result is a %G_IO_ERROR_CANCELLED error.
*
* ## I/O Priority # {#io-priority}
*
* Many I/O-related asynchronous operations have a priority parameter,
* which is used in certain cases to determine the order in which
* operations are executed. They are not used to determine system-wide
* I/O scheduling. Priorities are integers, with lower numbers indicating
* higher priority. It is recommended to choose priorities between
* %G_PRIORITY_LOW and %G_PRIORITY_HIGH, with %G_PRIORITY_DEFAULT
* as a default.
* @interface
*/
export class AsyncResult extends GObject.Object {
// Own properties of Gio-2.0.Gio.AsyncResult
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.AsyncResult
constructor(config?: AsyncResult.ConstructorProperties)
_init(config?: AsyncResult.ConstructorProperties): void
}
export module Converter {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface Converter {
// Owm methods of Gio-2.0.Gio.Converter
/**
* This is the main operation used when converting data. It is to be called
* multiple times in a loop, and each time it will do some work, i.e.
* producing some output (in `outbuf)` or consuming some input (from `inbuf)` or
* both. If its not possible to do any work an error is returned.
*
* Note that a single call may not consume all input (or any input at all).
* Also a call may produce output even if given no input, due to state stored
* in the converter producing output.
*
* If any data was either produced or consumed, and then an error happens, then
* only the successful conversion is reported and the error is returned on the
* next call.
*
* A full conversion loop involves calling this method repeatedly, each time
* giving it new input and space output space. When there is no more input
* data after the data in `inbuf,` the flag %G_CONVERTER_INPUT_AT_END must be set.
* The loop will be (unless some error happens) returning %G_CONVERTER_CONVERTED
* each time until all data is consumed and all output is produced, then
* %G_CONVERTER_FINISHED is returned instead. Note, that %G_CONVERTER_FINISHED
* may be returned even if %G_CONVERTER_INPUT_AT_END is not set, for instance
* in a decompression converter where the end of data is detectable from the
* data (and there might even be other data after the end of the compressed data).
*
* When some data has successfully been converted `bytes_read` and is set to
* the number of bytes read from `inbuf,` and `bytes_written` is set to indicate
* how many bytes was written to `outbuf`. If there are more data to output
* or consume (i.e. unless the %G_CONVERTER_INPUT_AT_END is specified) then
* %G_CONVERTER_CONVERTED is returned, and if no more data is to be output
* then %G_CONVERTER_FINISHED is returned.
*
* On error %G_CONVERTER_ERROR is returned and `error` is set accordingly.
* Some errors need special handling:
*
* %G_IO_ERROR_NO_SPACE is returned if there is not enough space
* to write the resulting converted data, the application should
* call the function again with a larger `outbuf` to continue.
*
* %G_IO_ERROR_PARTIAL_INPUT is returned if there is not enough
* input to fully determine what the conversion should produce,
* and the %G_CONVERTER_INPUT_AT_END flag is not set. This happens for
* example with an incomplete multibyte sequence when converting text,
* or when a regexp matches up to the end of the input (and may match
* further input). It may also happen when `inbuf_size` is zero and
* there is no more data to produce.
*
* When this happens the application should read more input and then
* call the function again. If further input shows that there is no
* more data call the function again with the same data but with
* the %G_CONVERTER_INPUT_AT_END flag set. This may cause the conversion
* to finish as e.g. in the regexp match case (or, to fail again with
* %G_IO_ERROR_PARTIAL_INPUT in e.g. a charset conversion where the
* input is actually partial).
*
* After g_converter_convert() has returned %G_CONVERTER_FINISHED the
* converter object is in an invalid state where its not allowed
* to call g_converter_convert() anymore. At this time you can only
* free the object or call g_converter_reset() to reset it to the
* initial state.
*
* If the flag %G_CONVERTER_FLUSH is set then conversion is modified
* to try to write out all internal state to the output. The application
* has to call the function multiple times with the flag set, and when
* the available input has been consumed and all internal state has
* been produced then %G_CONVERTER_FLUSHED (or %G_CONVERTER_FINISHED if
* really at the end) is returned instead of %G_CONVERTER_CONVERTED.
* This is somewhat similar to what happens at the end of the input stream,
* but done in the middle of the data.
*
* This has different meanings for different conversions. For instance
* in a compression converter it would mean that we flush all the
* compression state into output such that if you uncompress the
* compressed data you get back all the input data. Doing this may
* make the final file larger due to padding though. Another example
* is a regexp conversion, where if you at the end of the flushed data
* have a match, but there is also a potential longer match. In the
* non-flushed case we would ask for more input, but when flushing we
* treat this as the end of input and do the match.
*
* Flushing is not always possible (like if a charset converter flushes
* at a partial multibyte sequence). Converters are supposed to try
* to produce as much output as possible and then return an error
* (typically %G_IO_ERROR_PARTIAL_INPUT).
* @param inbuf the buffer containing the data to convert.
* @param outbuf a buffer to write converted data in.
* @param flags a #GConverterFlags controlling the conversion details
* @returns a #GConverterResult, %G_CONVERTER_ERROR on error.
*/
convert(inbuf: Uint8Array, outbuf: Uint8Array, flags: ConverterFlags): [ /* returnType */ ConverterResult, /* bytes_read */ number, /* bytes_written */ number ]
/**
* Resets all internal state in the converter, making it behave
* as if it was just created. If the converter has any internal
* state that would produce output then that output is lost.
*/
reset(): void
// Own virtual methods of Gio-2.0.Gio.Converter
/**
* This is the main operation used when converting data. It is to be called
* multiple times in a loop, and each time it will do some work, i.e.
* producing some output (in `outbuf)` or consuming some input (from `inbuf)` or
* both. If its not possible to do any work an error is returned.
*
* Note that a single call may not consume all input (or any input at all).
* Also a call may produce output even if given no input, due to state stored
* in the converter producing output.
*
* If any data was either produced or consumed, and then an error happens, then
* only the successful conversion is reported and the error is returned on the
* next call.
*
* A full conversion loop involves calling this method repeatedly, each time
* giving it new input and space output space. When there is no more input
* data after the data in `inbuf,` the flag %G_CONVERTER_INPUT_AT_END must be set.
* The loop will be (unless some error happens) returning %G_CONVERTER_CONVERTED
* each time until all data is consumed and all output is produced, then
* %G_CONVERTER_FINISHED is returned instead. Note, that %G_CONVERTER_FINISHED
* may be returned even if %G_CONVERTER_INPUT_AT_END is not set, for instance
* in a decompression converter where the end of data is detectable from the
* data (and there might even be other data after the end of the compressed data).
*
* When some data has successfully been converted `bytes_read` and is set to
* the number of bytes read from `inbuf,` and `bytes_written` is set to indicate
* how many bytes was written to `outbuf`. If there are more data to output
* or consume (i.e. unless the %G_CONVERTER_INPUT_AT_END is specified) then
* %G_CONVERTER_CONVERTED is returned, and if no more data is to be output
* then %G_CONVERTER_FINISHED is returned.
*
* On error %G_CONVERTER_ERROR is returned and `error` is set accordingly.
* Some errors need special handling:
*
* %G_IO_ERROR_NO_SPACE is returned if there is not enough space
* to write the resulting converted data, the application should
* call the function again with a larger `outbuf` to continue.
*
* %G_IO_ERROR_PARTIAL_INPUT is returned if there is not enough
* input to fully determine what the conversion should produce,
* and the %G_CONVERTER_INPUT_AT_END flag is not set. This happens for
* example with an incomplete multibyte sequence when converting text,
* or when a regexp matches up to the end of the input (and may match
* further input). It may also happen when `inbuf_size` is zero and
* there is no more data to produce.
*
* When this happens the application should read more input and then
* call the function again. If further input shows that there is no
* more data call the function again with the same data but with
* the %G_CONVERTER_INPUT_AT_END flag set. This may cause the conversion
* to finish as e.g. in the regexp match case (or, to fail again with
* %G_IO_ERROR_PARTIAL_INPUT in e.g. a charset conversion where the
* input is actually partial).
*
* After g_converter_convert() has returned %G_CONVERTER_FINISHED the
* converter object is in an invalid state where its not allowed
* to call g_converter_convert() anymore. At this time you can only
* free the object or call g_converter_reset() to reset it to the
* initial state.
*
* If the flag %G_CONVERTER_FLUSH is set then conversion is modified
* to try to write out all internal state to the output. The application
* has to call the function multiple times with the flag set, and when
* the available input has been consumed and all internal state has
* been produced then %G_CONVERTER_FLUSHED (or %G_CONVERTER_FINISHED if
* really at the end) is returned instead of %G_CONVERTER_CONVERTED.
* This is somewhat similar to what happens at the end of the input stream,
* but done in the middle of the data.
*
* This has different meanings for different conversions. For instance
* in a compression converter it would mean that we flush all the
* compression state into output such that if you uncompress the
* compressed data you get back all the input data. Doing this may
* make the final file larger due to padding though. Another example
* is a regexp conversion, where if you at the end of the flushed data
* have a match, but there is also a potential longer match. In the
* non-flushed case we would ask for more input, but when flushing we
* treat this as the end of input and do the match.
*
* Flushing is not always possible (like if a charset converter flushes
* at a partial multibyte sequence). Converters are supposed to try
* to produce as much output as possible and then return an error
* (typically %G_IO_ERROR_PARTIAL_INPUT).
* @virtual
* @param inbuf the buffer containing the data to convert.
* @param outbuf a buffer to write converted data in.
* @param flags a #GConverterFlags controlling the conversion details
* @returns a #GConverterResult, %G_CONVERTER_ERROR on error.
*/
vfunc_convert(inbuf: Uint8Array | null, outbuf: Uint8Array, flags: ConverterFlags): [ /* returnType */ ConverterResult, /* bytes_read */ number, /* bytes_written */ number ]
/**
* Resets all internal state in the converter, making it behave
* as if it was just created. If the converter has any internal
* state that would produce output then that output is lost.
* @virtual
*/
vfunc_reset(): void
// Class property signals of Gio-2.0.Gio.Converter
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GConverter is implemented by objects that convert
* binary data in various ways. The conversion can be
* stateful and may fail at any place.
*
* Some example conversions are: character set conversion,
* compression, decompression and regular expression
* replace.
* @interface
*/
export class Converter extends GObject.Object {
// Own properties of Gio-2.0.Gio.Converter
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.Converter
constructor(config?: Converter.ConstructorProperties)
_init(config?: Converter.ConstructorProperties): void
}
export module DBusInterface {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface DBusInterface {
// Owm methods of Gio-2.0.Gio.DBusInterface
/**
* Gets the #GDBusObject that `interface_` belongs to, if any.
* @returns A #GDBusObject or %NULL. The returned reference should be freed with g_object_unref().
*/
get_object(): DBusObject | null
/**
* Gets D-Bus introspection information for the D-Bus interface
* implemented by `interface_`.
* @returns A #GDBusInterfaceInfo. Do not free.
*/
get_info(): DBusInterfaceInfo
/**
* Sets the #GDBusObject for `interface_` to `object`.
*
* Note that `interface_` will hold a weak reference to `object`.
* @param object A #GDBusObject or %NULL.
*/
set_object(object: DBusObject | null): void
// Own virtual methods of Gio-2.0.Gio.DBusInterface
/**
* Gets the #GDBusObject that `interface_` belongs to, if any.
* @virtual
* @returns A #GDBusObject or %NULL. The returned reference should be freed with g_object_unref().
*/
vfunc_dup_object(): DBusObject | null
/**
* Gets D-Bus introspection information for the D-Bus interface
* implemented by `interface_`.
* @virtual
* @returns A #GDBusInterfaceInfo. Do not free.
*/
vfunc_get_info(): DBusInterfaceInfo
/**
* Sets the #GDBusObject for `interface_` to `object`.
*
* Note that `interface_` will hold a weak reference to `object`.
* @virtual
* @param object A #GDBusObject or %NULL.
*/
vfunc_set_object(object: DBusObject | null): void
// Class property signals of Gio-2.0.Gio.DBusInterface
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* The #GDBusInterface type is the base type for D-Bus interfaces both
* on the service side (see #GDBusInterfaceSkeleton) and client side
* (see #GDBusProxy).
* @interface
*/
export class DBusInterface extends GObject.Object {
// Own properties of Gio-2.0.Gio.DBusInterface
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DBusInterface
constructor(config?: DBusInterface.ConstructorProperties)
_init(config?: DBusInterface.ConstructorProperties): void
}
export module DBusObject {
// Signal callback interfaces
/**
* Signal callback interface for `interface-added`
*/
export interface InterfaceAddedSignalCallback {
($obj: DBusObject, interface: DBusInterface): void
}
/**
* Signal callback interface for `interface-removed`
*/
export interface InterfaceRemovedSignalCallback {
($obj: DBusObject, interface: DBusInterface): void
}
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface DBusObject {
// Owm methods of Gio-2.0.Gio.DBusObject
/**
* Gets the D-Bus interface with name `interface_name` associated with
* `object,` if any.
* @param interface_name A D-Bus interface name.
* @returns %NULL if not found, otherwise a #GDBusInterface that must be freed with g_object_unref().
*/
get_interface(interface_name: string | null): DBusInterface | null
/**
* Gets the D-Bus interfaces associated with `object`.
* @returns A list of #GDBusInterface instances. The returned list must be freed by g_list_free() after each element has been freed with g_object_unref().
*/
get_interfaces(): DBusInterface[]
/**
* Gets the object path for `object`.
* @returns A string owned by @object. Do not free.
*/
get_object_path(): string | null
// Own virtual methods of Gio-2.0.Gio.DBusObject
/**
* Gets the D-Bus interface with name `interface_name` associated with
* `object,` if any.
* @virtual
* @param interface_name A D-Bus interface name.
* @returns %NULL if not found, otherwise a #GDBusInterface that must be freed with g_object_unref().
*/
vfunc_get_interface(interface_name: string | null): DBusInterface | null
/**
* Gets the D-Bus interfaces associated with `object`.
* @virtual
* @returns A list of #GDBusInterface instances. The returned list must be freed by g_list_free() after each element has been freed with g_object_unref().
*/
vfunc_get_interfaces(): DBusInterface[]
/**
* Gets the object path for `object`.
* @virtual
* @returns A string owned by @object. Do not free.
*/
vfunc_get_object_path(): string | null
vfunc_interface_added(interface_: DBusInterface): void
vfunc_interface_removed(interface_: DBusInterface): void
// Own signals of Gio-2.0.Gio.DBusObject
connect(sigName: "interface-added", callback: DBusObject.InterfaceAddedSignalCallback): number
connect_after(sigName: "interface-added", callback: DBusObject.InterfaceAddedSignalCallback): number
emit(sigName: "interface-added", interface: DBusInterface, ...args: any[]): void
connect(sigName: "interface-removed", callback: DBusObject.InterfaceRemovedSignalCallback): number
connect_after(sigName: "interface-removed", callback: DBusObject.InterfaceRemovedSignalCallback): number
emit(sigName: "interface-removed", interface: DBusInterface, ...args: any[]): void
// Class property signals of Gio-2.0.Gio.DBusObject
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* The #GDBusObject type is the base type for D-Bus objects on both
* the service side (see #GDBusObjectSkeleton) and the client side
* (see #GDBusObjectProxy). It is essentially just a container of
* interfaces.
* @interface
*/
export class DBusObject extends GObject.Object {
// Own properties of Gio-2.0.Gio.DBusObject
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DBusObject
constructor(config?: DBusObject.ConstructorProperties)
_init(config?: DBusObject.ConstructorProperties): void
}
export module DBusObjectManager {
// Signal callback interfaces
/**
* Signal callback interface for `interface-added`
*/
export interface InterfaceAddedSignalCallback {
($obj: DBusObjectManager, object: DBusObject, interface: DBusInterface): void
}
/**
* Signal callback interface for `interface-removed`
*/
export interface InterfaceRemovedSignalCallback {
($obj: DBusObjectManager, object: DBusObject, interface: DBusInterface): void
}
/**
* Signal callback interface for `object-added`
*/
export interface ObjectAddedSignalCallback {
($obj: DBusObjectManager, object: DBusObject): void
}
/**
* Signal callback interface for `object-removed`
*/
export interface ObjectRemovedSignalCallback {
($obj: DBusObjectManager, object: DBusObject): void
}
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface DBusObjectManager {
// Owm methods of Gio-2.0.Gio.DBusObjectManager
/**
* Gets the interface proxy for `interface_name` at `object_path,` if
* any.
* @param object_path Object path to look up.
* @param interface_name D-Bus interface name to look up.
* @returns A #GDBusInterface instance or %NULL. Free with g_object_unref().
*/
get_interface(object_path: string | null, interface_name: string | null): DBusInterface | null
/**
* Gets the #GDBusObject at `object_path,` if any.
* @param object_path Object path to look up.
* @returns A #GDBusObject or %NULL. Free with g_object_unref().
*/
get_object(object_path: string | null): DBusObject | null
/**
* Gets the object path that `manager` is for.
* @returns A string owned by @manager. Do not free.
*/
get_object_path(): string | null
/**
* Gets all #GDBusObject objects known to `manager`.
* @returns A list of #GDBusObject objects. The returned list should be freed with g_list_free() after each element has been freed with g_object_unref().
*/
get_objects(): DBusObject[]
// Own virtual methods of Gio-2.0.Gio.DBusObjectManager
/**
* Gets the interface proxy for `interface_name` at `object_path,` if
* any.
* @virtual
* @param object_path Object path to look up.
* @param interface_name D-Bus interface name to look up.
* @returns A #GDBusInterface instance or %NULL. Free with g_object_unref().
*/
vfunc_get_interface(object_path: string | null, interface_name: string | null): DBusInterface | null
/**
* Gets the #GDBusObject at `object_path,` if any.
* @virtual
* @param object_path Object path to look up.
* @returns A #GDBusObject or %NULL. Free with g_object_unref().
*/
vfunc_get_object(object_path: string | null): DBusObject | null
/**
* Gets the object path that `manager` is for.
* @virtual
* @returns A string owned by @manager. Do not free.
*/
vfunc_get_object_path(): string | null
/**
* Gets all #GDBusObject objects known to `manager`.
* @virtual
* @returns A list of #GDBusObject objects. The returned list should be freed with g_list_free() after each element has been freed with g_object_unref().
*/
vfunc_get_objects(): DBusObject[]
vfunc_interface_added(object: DBusObject, interface_: DBusInterface): void
vfunc_interface_removed(object: DBusObject, interface_: DBusInterface): void
vfunc_object_added(object: DBusObject): void
vfunc_object_removed(object: DBusObject): void
// Own signals of Gio-2.0.Gio.DBusObjectManager
connect(sigName: "interface-added", callback: DBusObjectManager.InterfaceAddedSignalCallback): number
connect_after(sigName: "interface-added", callback: DBusObjectManager.InterfaceAddedSignalCallback): number
emit(sigName: "interface-added", object: DBusObject, interface: DBusInterface, ...args: any[]): void
connect(sigName: "interface-removed", callback: DBusObjectManager.InterfaceRemovedSignalCallback): number
connect_after(sigName: "interface-removed", callback: DBusObjectManager.InterfaceRemovedSignalCallback): number
emit(sigName: "interface-removed", object: DBusObject, interface: DBusInterface, ...args: any[]): void
connect(sigName: "object-added", callback: DBusObjectManager.ObjectAddedSignalCallback): number
connect_after(sigName: "object-added", callback: DBusObjectManager.ObjectAddedSignalCallback): number
emit(sigName: "object-added", object: DBusObject, ...args: any[]): void
connect(sigName: "object-removed", callback: DBusObjectManager.ObjectRemovedSignalCallback): number
connect_after(sigName: "object-removed", callback: DBusObjectManager.ObjectRemovedSignalCallback): number
emit(sigName: "object-removed", object: DBusObject, ...args: any[]): void
// Class property signals of Gio-2.0.Gio.DBusObjectManager
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* The #GDBusObjectManager type is the base type for service- and
* client-side implementations of the standardized
* [org.freedesktop.DBus.ObjectManager](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager)
* interface.
*
* See #GDBusObjectManagerClient for the client-side implementation
* and #GDBusObjectManagerServer for the service-side implementation.
* @interface
*/
export class DBusObjectManager extends GObject.Object {
// Own properties of Gio-2.0.Gio.DBusObjectManager
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DBusObjectManager
constructor(config?: DBusObjectManager.ConstructorProperties)
_init(config?: DBusObjectManager.ConstructorProperties): void
}
export module DatagramBased {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface DatagramBased {
// Owm methods of Gio-2.0.Gio.DatagramBased
/**
* Checks on the readiness of `datagram_based` to perform operations. The
* operations specified in `condition` are checked for and masked against the
* currently-satisfied conditions on `datagram_based`. The result is returned.
*
* %G_IO_IN will be set in the return value if data is available to read with
* g_datagram_based_receive_messages(), or if the connection is closed remotely
* (EOS); and if the datagram_based has not been closed locally using some
* implementation-specific method (such as g_socket_close() or
* g_socket_shutdown() with `shutdown_read` set, if it’s a #GSocket).
*
* If the connection is shut down or closed (by calling g_socket_close() or
* g_socket_shutdown() with `shutdown_read` set, if it’s a #GSocket, for
* example), all calls to this function will return %G_IO_ERROR_CLOSED.
*
* %G_IO_OUT will be set if it is expected that at least one byte can be sent
* using g_datagram_based_send_messages() without blocking. It will not be set
* if the datagram_based has been closed locally.
*
* %G_IO_HUP will be set if the connection has been closed locally.
*
* %G_IO_ERR will be set if there was an asynchronous error in transmitting data
* previously enqueued using g_datagram_based_send_messages().
*
* Note that on Windows, it is possible for an operation to return
* %G_IO_ERROR_WOULD_BLOCK even immediately after
* g_datagram_based_condition_check() has claimed that the #GDatagramBased is
* ready for writing. Rather than calling g_datagram_based_condition_check() and
* then writing to the #GDatagramBased if it succeeds, it is generally better to
* simply try writing right away, and try again later if the initial attempt
* returns %G_IO_ERROR_WOULD_BLOCK.
*
* It is meaningless to specify %G_IO_ERR or %G_IO_HUP in `condition;` these
* conditions will always be set in the output if they are true. Apart from
* these flags, the output is guaranteed to be masked by `condition`.
*
* This call never blocks.
* @param condition a #GIOCondition mask to check
* @returns the #GIOCondition mask of the current state
*/
condition_check(condition: GLib.IOCondition): GLib.IOCondition
/**
* Waits for up to `timeout` microseconds for condition to become true on
* `datagram_based`. If the condition is met, %TRUE is returned.
*
* If `cancellable` is cancelled before the condition is met, or if `timeout` is
* reached before the condition is met, then %FALSE is returned and `error` is
* set appropriately (%G_IO_ERROR_CANCELLED or %G_IO_ERROR_TIMED_OUT).
* @param condition a #GIOCondition mask to wait for
* @param timeout the maximum time (in microseconds) to wait, 0 to not block, or -1 to block indefinitely
* @param cancellable a #GCancellable
* @returns %TRUE if the condition was met, %FALSE otherwise
*/
condition_wait(condition: GLib.IOCondition, timeout: number, cancellable: Cancellable | null): boolean
/**
* Creates a #GSource that can be attached to a #GMainContext to monitor for
* the availability of the specified `condition` on the #GDatagramBased. The
* #GSource keeps a reference to the `datagram_based`.
*
* The callback on the source is of the #GDatagramBasedSourceFunc type.
*
* It is meaningless to specify %G_IO_ERR or %G_IO_HUP in `condition;` these
* conditions will always be reported in the callback if they are true.
*
* If non-%NULL, `cancellable` can be used to cancel the source, which will
* cause the source to trigger, reporting the current condition (which is
* likely 0 unless cancellation happened at the same time as a condition
* change). You can check for this in the callback using
* g_cancellable_is_cancelled().
* @param condition a #GIOCondition mask to monitor
* @param cancellable a #GCancellable
* @returns a newly allocated #GSource
*/
create_source(condition: GLib.IOCondition, cancellable: Cancellable | null): GLib.Source
/**
* Receive one or more data messages from `datagram_based` in one go.
*
* `messages` must point to an array of #GInputMessage structs and
* `num_messages` must be the length of this array. Each #GInputMessage
* contains a pointer to an array of #GInputVector structs describing the
* buffers that the data received in each message will be written to.
*
* `flags` modify how all messages are received. The commonly available
* arguments for this are available in the #GSocketMsgFlags enum, but the
* values there are the same as the system values, and the flags
* are passed in as-is, so you can pass in system-specific flags too. These
* flags affect the overall receive operation. Flags affecting individual
* messages are returned in #GInputMessage.flags.
*
* The other members of #GInputMessage are treated as described in its
* documentation.
*
* If `timeout` is negative the call will block until `num_messages` have been
* received, the connection is closed remotely (EOS), `cancellable` is cancelled,
* or an error occurs.
*
* If `timeout` is 0 the call will return up to `num_messages` without blocking,
* or %G_IO_ERROR_WOULD_BLOCK if no messages are queued in the operating system
* to be received.
*
* If `timeout` is positive the call will block on the same conditions as if
* `timeout` were negative. If the timeout is reached
* before any messages are received, %G_IO_ERROR_TIMED_OUT is returned,
* otherwise it will return the number of messages received before timing out.
* (Note: This is effectively the behaviour of `MSG_WAITFORONE` with
* recvmmsg().)
*
* To be notified when messages are available, wait for the %G_IO_IN condition.
* Note though that you may still receive %G_IO_ERROR_WOULD_BLOCK from
* g_datagram_based_receive_messages() even if you were previously notified of a
* %G_IO_IN condition.
*
* If the remote peer closes the connection, any messages queued in the
* underlying receive buffer will be returned, and subsequent calls to
* g_datagram_based_receive_messages() will return 0 (with no error set).
*
* If the connection is shut down or closed (by calling g_socket_close() or
* g_socket_shutdown() with `shutdown_read` set, if it’s a #GSocket, for
* example), all calls to this function will return %G_IO_ERROR_CLOSED.
*
* On error -1 is returned and `error` is set accordingly. An error will only
* be returned if zero messages could be received; otherwise the number of
* messages successfully received before the error will be returned. If
* `cancellable` is cancelled, %G_IO_ERROR_CANCELLED is returned as with any
* other error.
* @param messages an array of #GInputMessage structs
* @param flags an int containing #GSocketMsgFlags flags for the overall operation
* @param timeout the maximum time (in microseconds) to wait, 0 to not block, or -1 to block indefinitely
* @param cancellable a %GCancellable
* @returns number of messages received, or -1 on error. Note that the number of messages received may be smaller than @num_messages if @timeout is zero or positive, if the peer closed the connection, or if @num_messages was larger than `UIO_MAXIOV` (1024), in which case the caller may re-try to receive the remaining messages.
*/
receive_messages(messages: InputMessage[], flags: number, timeout: number, cancellable: Cancellable | null): number
/**
* Send one or more data messages from `datagram_based` in one go.
*
* `messages` must point to an array of #GOutputMessage structs and
* `num_messages` must be the length of this array. Each #GOutputMessage
* contains an address to send the data to, and a pointer to an array of
* #GOutputVector structs to describe the buffers that the data to be sent
* for each message will be gathered from.
*
* `flags` modify how the message is sent. The commonly available arguments
* for this are available in the #GSocketMsgFlags enum, but the
* values there are the same as the system values, and the flags
* are passed in as-is, so you can pass in system-specific flags too.
*
* The other members of #GOutputMessage are treated as described in its
* documentation.
*
* If `timeout` is negative the call will block until `num_messages` have been
* sent, `cancellable` is cancelled, or an error occurs.
*
* If `timeout` is 0 the call will send up to `num_messages` without blocking,
* or will return %G_IO_ERROR_WOULD_BLOCK if there is no space to send messages.
*
* If `timeout` is positive the call will block on the same conditions as if
* `timeout` were negative. If the timeout is reached before any messages are
* sent, %G_IO_ERROR_TIMED_OUT is returned, otherwise it will return the number
* of messages sent before timing out.
*
* To be notified when messages can be sent, wait for the %G_IO_OUT condition.
* Note though that you may still receive %G_IO_ERROR_WOULD_BLOCK from
* g_datagram_based_send_messages() even if you were previously notified of a
* %G_IO_OUT condition. (On Windows in particular, this is very common due to
* the way the underlying APIs work.)
*
* If the connection is shut down or closed (by calling g_socket_close() or
* g_socket_shutdown() with `shutdown_write` set, if it’s a #GSocket, for
* example), all calls to this function will return %G_IO_ERROR_CLOSED.
*
* On error -1 is returned and `error` is set accordingly. An error will only
* be returned if zero messages could be sent; otherwise the number of messages
* successfully sent before the error will be returned. If `cancellable` is
* cancelled, %G_IO_ERROR_CANCELLED is returned as with any other error.
* @param messages an array of #GOutputMessage structs
* @param flags an int containing #GSocketMsgFlags flags
* @param timeout the maximum time (in microseconds) to wait, 0 to not block, or -1 to block indefinitely
* @param cancellable a %GCancellable
* @returns number of messages sent, or -1 on error. Note that the number of messages sent may be smaller than @num_messages if @timeout is zero or positive, or if @num_messages was larger than `UIO_MAXIOV` (1024), in which case the caller may re-try to send the remaining messages.
*/
send_messages(messages: OutputMessage[], flags: number, timeout: number, cancellable: Cancellable | null): number
// Own virtual methods of Gio-2.0.Gio.DatagramBased
/**
* Checks on the readiness of `datagram_based` to perform operations. The
* operations specified in `condition` are checked for and masked against the
* currently-satisfied conditions on `datagram_based`. The result is returned.
*
* %G_IO_IN will be set in the return value if data is available to read with
* g_datagram_based_receive_messages(), or if the connection is closed remotely
* (EOS); and if the datagram_based has not been closed locally using some
* implementation-specific method (such as g_socket_close() or
* g_socket_shutdown() with `shutdown_read` set, if it’s a #GSocket).
*
* If the connection is shut down or closed (by calling g_socket_close() or
* g_socket_shutdown() with `shutdown_read` set, if it’s a #GSocket, for
* example), all calls to this function will return %G_IO_ERROR_CLOSED.
*
* %G_IO_OUT will be set if it is expected that at least one byte can be sent
* using g_datagram_based_send_messages() without blocking. It will not be set
* if the datagram_based has been closed locally.
*
* %G_IO_HUP will be set if the connection has been closed locally.
*
* %G_IO_ERR will be set if there was an asynchronous error in transmitting data
* previously enqueued using g_datagram_based_send_messages().
*
* Note that on Windows, it is possible for an operation to return
* %G_IO_ERROR_WOULD_BLOCK even immediately after
* g_datagram_based_condition_check() has claimed that the #GDatagramBased is
* ready for writing. Rather than calling g_datagram_based_condition_check() and
* then writing to the #GDatagramBased if it succeeds, it is generally better to
* simply try writing right away, and try again later if the initial attempt
* returns %G_IO_ERROR_WOULD_BLOCK.
*
* It is meaningless to specify %G_IO_ERR or %G_IO_HUP in `condition;` these
* conditions will always be set in the output if they are true. Apart from
* these flags, the output is guaranteed to be masked by `condition`.
*
* This call never blocks.
* @virtual
* @param condition a #GIOCondition mask to check
* @returns the #GIOCondition mask of the current state
*/
vfunc_condition_check(condition: GLib.IOCondition): GLib.IOCondition
/**
* Waits for up to `timeout` microseconds for condition to become true on
* `datagram_based`. If the condition is met, %TRUE is returned.
*
* If `cancellable` is cancelled before the condition is met, or if `timeout` is
* reached before the condition is met, then %FALSE is returned and `error` is
* set appropriately (%G_IO_ERROR_CANCELLED or %G_IO_ERROR_TIMED_OUT).
* @virtual
* @param condition a #GIOCondition mask to wait for
* @param timeout the maximum time (in microseconds) to wait, 0 to not block, or -1 to block indefinitely
* @param cancellable a #GCancellable
* @returns %TRUE if the condition was met, %FALSE otherwise
*/
vfunc_condition_wait(condition: GLib.IOCondition, timeout: number, cancellable: Cancellable | null): boolean
/**
* Creates a #GSource that can be attached to a #GMainContext to monitor for
* the availability of the specified `condition` on the #GDatagramBased. The
* #GSource keeps a reference to the `datagram_based`.
*
* The callback on the source is of the #GDatagramBasedSourceFunc type.
*
* It is meaningless to specify %G_IO_ERR or %G_IO_HUP in `condition;` these
* conditions will always be reported in the callback if they are true.
*
* If non-%NULL, `cancellable` can be used to cancel the source, which will
* cause the source to trigger, reporting the current condition (which is
* likely 0 unless cancellation happened at the same time as a condition
* change). You can check for this in the callback using
* g_cancellable_is_cancelled().
* @virtual
* @param condition a #GIOCondition mask to monitor
* @param cancellable a #GCancellable
* @returns a newly allocated #GSource
*/
vfunc_create_source(condition: GLib.IOCondition, cancellable: Cancellable | null): GLib.Source
/**
* Receive one or more data messages from `datagram_based` in one go.
*
* `messages` must point to an array of #GInputMessage structs and
* `num_messages` must be the length of this array. Each #GInputMessage
* contains a pointer to an array of #GInputVector structs describing the
* buffers that the data received in each message will be written to.
*
* `flags` modify how all messages are received. The commonly available
* arguments for this are available in the #GSocketMsgFlags enum, but the
* values there are the same as the system values, and the flags
* are passed in as-is, so you can pass in system-specific flags too. These
* flags affect the overall receive operation. Flags affecting individual
* messages are returned in #GInputMessage.flags.
*
* The other members of #GInputMessage are treated as described in its
* documentation.
*
* If `timeout` is negative the call will block until `num_messages` have been
* received, the connection is closed remotely (EOS), `cancellable` is cancelled,
* or an error occurs.
*
* If `timeout` is 0 the call will return up to `num_messages` without blocking,
* or %G_IO_ERROR_WOULD_BLOCK if no messages are queued in the operating system
* to be received.
*
* If `timeout` is positive the call will block on the same conditions as if
* `timeout` were negative. If the timeout is reached
* before any messages are received, %G_IO_ERROR_TIMED_OUT is returned,
* otherwise it will return the number of messages received before timing out.
* (Note: This is effectively the behaviour of `MSG_WAITFORONE` with
* recvmmsg().)
*
* To be notified when messages are available, wait for the %G_IO_IN condition.
* Note though that you may still receive %G_IO_ERROR_WOULD_BLOCK from
* g_datagram_based_receive_messages() even if you were previously notified of a
* %G_IO_IN condition.
*
* If the remote peer closes the connection, any messages queued in the
* underlying receive buffer will be returned, and subsequent calls to
* g_datagram_based_receive_messages() will return 0 (with no error set).
*
* If the connection is shut down or closed (by calling g_socket_close() or
* g_socket_shutdown() with `shutdown_read` set, if it’s a #GSocket, for
* example), all calls to this function will return %G_IO_ERROR_CLOSED.
*
* On error -1 is returned and `error` is set accordingly. An error will only
* be returned if zero messages could be received; otherwise the number of
* messages successfully received before the error will be returned. If
* `cancellable` is cancelled, %G_IO_ERROR_CANCELLED is returned as with any
* other error.
* @virtual
* @param messages an array of #GInputMessage structs
* @param flags an int containing #GSocketMsgFlags flags for the overall operation
* @param timeout the maximum time (in microseconds) to wait, 0 to not block, or -1 to block indefinitely
* @param cancellable a %GCancellable
* @returns number of messages received, or -1 on error. Note that the number of messages received may be smaller than @num_messages if @timeout is zero or positive, if the peer closed the connection, or if @num_messages was larger than `UIO_MAXIOV` (1024), in which case the caller may re-try to receive the remaining messages.
*/
vfunc_receive_messages(messages: InputMessage[], flags: number, timeout: number, cancellable: Cancellable | null): number
/**
* Send one or more data messages from `datagram_based` in one go.
*
* `messages` must point to an array of #GOutputMessage structs and
* `num_messages` must be the length of this array. Each #GOutputMessage
* contains an address to send the data to, and a pointer to an array of
* #GOutputVector structs to describe the buffers that the data to be sent
* for each message will be gathered from.
*
* `flags` modify how the message is sent. The commonly available arguments
* for this are available in the #GSocketMsgFlags enum, but the
* values there are the same as the system values, and the flags
* are passed in as-is, so you can pass in system-specific flags too.
*
* The other members of #GOutputMessage are treated as described in its
* documentation.
*
* If `timeout` is negative the call will block until `num_messages` have been
* sent, `cancellable` is cancelled, or an error occurs.
*
* If `timeout` is 0 the call will send up to `num_messages` without blocking,
* or will return %G_IO_ERROR_WOULD_BLOCK if there is no space to send messages.
*
* If `timeout` is positive the call will block on the same conditions as if
* `timeout` were negative. If the timeout is reached before any messages are
* sent, %G_IO_ERROR_TIMED_OUT is returned, otherwise it will return the number
* of messages sent before timing out.
*
* To be notified when messages can be sent, wait for the %G_IO_OUT condition.
* Note though that you may still receive %G_IO_ERROR_WOULD_BLOCK from
* g_datagram_based_send_messages() even if you were previously notified of a
* %G_IO_OUT condition. (On Windows in particular, this is very common due to
* the way the underlying APIs work.)
*
* If the connection is shut down or closed (by calling g_socket_close() or
* g_socket_shutdown() with `shutdown_write` set, if it’s a #GSocket, for
* example), all calls to this function will return %G_IO_ERROR_CLOSED.
*
* On error -1 is returned and `error` is set accordingly. An error will only
* be returned if zero messages could be sent; otherwise the number of messages
* successfully sent before the error will be returned. If `cancellable` is
* cancelled, %G_IO_ERROR_CANCELLED is returned as with any other error.
* @virtual
* @param messages an array of #GOutputMessage structs
* @param flags an int containing #GSocketMsgFlags flags
* @param timeout the maximum time (in microseconds) to wait, 0 to not block, or -1 to block indefinitely
* @param cancellable a %GCancellable
* @returns number of messages sent, or -1 on error. Note that the number of messages sent may be smaller than @num_messages if @timeout is zero or positive, or if @num_messages was larger than `UIO_MAXIOV` (1024), in which case the caller may re-try to send the remaining messages.
*/
vfunc_send_messages(messages: OutputMessage[], flags: number, timeout: number, cancellable: Cancellable | null): number
// Class property signals of Gio-2.0.Gio.DatagramBased
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* A #GDatagramBased is a networking interface for representing datagram-based
* communications. It is a more or less direct mapping of the core parts of the
* BSD socket API in a portable GObject interface. It is implemented by
* #GSocket, which wraps the UNIX socket API on UNIX and winsock2 on Windows.
*
* #GDatagramBased is entirely platform independent, and is intended to be used
* alongside higher-level networking APIs such as #GIOStream.
*
* It uses vectored scatter/gather I/O by default, allowing for many messages
* to be sent or received in a single call. Where possible, implementations of
* the interface should take advantage of vectored I/O to minimise processing
* or system calls. For example, #GSocket uses recvmmsg() and sendmmsg() where
* possible. Callers should take advantage of scatter/gather I/O (the use of
* multiple buffers per message) to avoid unnecessary copying of data to
* assemble or disassemble a message.
*
* Each #GDatagramBased operation has a timeout parameter which may be negative
* for blocking behaviour, zero for non-blocking behaviour, or positive for
* timeout behaviour. A blocking operation blocks until finished or there is an
* error. A non-blocking operation will return immediately with a
* %G_IO_ERROR_WOULD_BLOCK error if it cannot make progress. A timeout operation
* will block until the operation is complete or the timeout expires; if the
* timeout expires it will return what progress it made, or
* %G_IO_ERROR_TIMED_OUT if no progress was made. To know when a call would
* successfully run you can call g_datagram_based_condition_check() or
* g_datagram_based_condition_wait(). You can also use
* g_datagram_based_create_source() and attach it to a #GMainContext to get
* callbacks when I/O is possible.
*
* When running a non-blocking operation applications should always be able to
* handle getting a %G_IO_ERROR_WOULD_BLOCK error even when some other function
* said that I/O was possible. This can easily happen in case of a race
* condition in the application, but it can also happen for other reasons. For
* instance, on Windows a socket is always seen as writable until a write
* returns %G_IO_ERROR_WOULD_BLOCK.
*
* As with #GSocket, #GDatagramBaseds can be either connection oriented (for
* example, SCTP) or connectionless (for example, UDP). #GDatagramBaseds must be
* datagram-based, not stream-based. The interface does not cover connection
* establishment — use methods on the underlying type to establish a connection
* before sending and receiving data through the #GDatagramBased API. For
* connectionless socket types the target/source address is specified or
* received in each I/O operation.
*
* Like most other APIs in GLib, #GDatagramBased is not inherently thread safe.
* To use a #GDatagramBased concurrently from multiple threads, you must
* implement your own locking.
* @interface
*/
export class DatagramBased extends GObject.Object {
// Own properties of Gio-2.0.Gio.DatagramBased
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DatagramBased
constructor(config?: DatagramBased.ConstructorProperties)
_init(config?: DatagramBased.ConstructorProperties): void
}
export module DebugController {
// Constructor properties interface
export interface ConstructorProperties extends Initable.ConstructorProperties, GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.DebugController
/**
* %TRUE if debug output should be exposed (for example by forwarding it to
* the journal), %FALSE otherwise.
*/
debug_enabled?: boolean | null
}
}
export interface DebugController extends Initable {
// Own properties of Gio-2.0.Gio.DebugController
/**
* %TRUE if debug output should be exposed (for example by forwarding it to
* the journal), %FALSE otherwise.
*/
debug_enabled: boolean
// Owm methods of Gio-2.0.Gio.DebugController
/**
* Get the value of #GDebugController:debug-enabled.
* @returns %TRUE if debug output should be exposed, %FALSE otherwise
*/
get_debug_enabled(): boolean
/**
* Set the value of #GDebugController:debug-enabled.
* @param debug_enabled %TRUE if debug output should be exposed, %FALSE otherwise
*/
set_debug_enabled(debug_enabled: boolean): void
// Class property signals of Gio-2.0.Gio.DebugController
connect(sigName: "notify::debug-enabled", callback: (($obj: DebugController, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::debug-enabled", callback: (($obj: DebugController, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::debug-enabled", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GDebugController is an interface to expose control of debugging features and
* debug output.
*
* It is implemented on Linux using #GDebugControllerDBus, which exposes a D-Bus
* interface to allow authenticated peers to control debug features in this
* process.
*
* Whether debug output is enabled is exposed as
* #GDebugController:debug-enabled. This controls g_log_set_debug_enabled() by
* default. Application code may connect to the #GObject::notify signal for it
* to control other parts of its debug infrastructure as necessary.
*
* If your application or service is using the default GLib log writer function,
* creating one of the built-in implementations of #GDebugController should be
* all that’s needed to dynamically enable or disable debug output.
* @interface
*/
export class DebugController extends GObject.Object {
// Own properties of Gio-2.0.Gio.DebugController
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DebugController
constructor(config?: DebugController.ConstructorProperties)
_init(config?: DebugController.ConstructorProperties): void
}
export module DesktopAppInfoLookup {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface DesktopAppInfoLookup {
// Owm methods of Gio-2.0.Gio.DesktopAppInfoLookup
/**
* Gets the default application for launching applications
* using this URI scheme for a particular #GDesktopAppInfoLookup
* implementation.
*
* The #GDesktopAppInfoLookup interface and this function is used
* to implement g_app_info_get_default_for_uri_scheme() backends
* in a GIO module. There is no reason for applications to use it
* directly. Applications should use g_app_info_get_default_for_uri_scheme().
* @param uri_scheme a string containing a URI scheme.
* @returns #GAppInfo for given @uri_scheme or %NULL on error.
*/
get_default_for_uri_scheme(uri_scheme: string | null): AppInfo | null
// Own virtual methods of Gio-2.0.Gio.DesktopAppInfoLookup
/**
* Gets the default application for launching applications
* using this URI scheme for a particular #GDesktopAppInfoLookup
* implementation.
*
* The #GDesktopAppInfoLookup interface and this function is used
* to implement g_app_info_get_default_for_uri_scheme() backends
* in a GIO module. There is no reason for applications to use it
* directly. Applications should use g_app_info_get_default_for_uri_scheme().
* @virtual
* @param uri_scheme a string containing a URI scheme.
* @returns #GAppInfo for given @uri_scheme or %NULL on error.
*/
vfunc_get_default_for_uri_scheme(uri_scheme: string | null): AppInfo | null
// Class property signals of Gio-2.0.Gio.DesktopAppInfoLookup
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GDesktopAppInfoLookup is an opaque data structure and can only be accessed
* using the following functions.
* @interface
*/
export class DesktopAppInfoLookup extends GObject.Object {
// Own properties of Gio-2.0.Gio.DesktopAppInfoLookup
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DesktopAppInfoLookup
constructor(config?: DesktopAppInfoLookup.ConstructorProperties)
_init(config?: DesktopAppInfoLookup.ConstructorProperties): void
}
export module Drive {
// Signal callback interfaces
/**
* Signal callback interface for `changed`
*/
export interface ChangedSignalCallback {
($obj: Drive): void
}
/**
* Signal callback interface for `disconnected`
*/
export interface DisconnectedSignalCallback {
($obj: Drive): void
}
/**
* Signal callback interface for `eject-button`
*/
export interface EjectButtonSignalCallback {
($obj: Drive): void
}
/**
* Signal callback interface for `stop-button`
*/
export interface StopButtonSignalCallback {
($obj: Drive): void
}
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface Drive {
// Owm methods of Gio-2.0.Gio.Drive
/**
* Checks if a drive can be ejected.
* @returns %TRUE if the @drive can be ejected, %FALSE otherwise.
*/
can_eject(): boolean
/**
* Checks if a drive can be polled for media changes.
* @returns %TRUE if the @drive can be polled for media changes, %FALSE otherwise.
*/
can_poll_for_media(): boolean
/**
* Checks if a drive can be started.
* @returns %TRUE if the @drive can be started, %FALSE otherwise.
*/
can_start(): boolean
/**
* Checks if a drive can be started degraded.
* @returns %TRUE if the @drive can be started degraded, %FALSE otherwise.
*/
can_start_degraded(): boolean
/**
* Checks if a drive can be stopped.
* @returns %TRUE if the @drive can be stopped, %FALSE otherwise.
*/
can_stop(): boolean
/**
* Asynchronously ejects a drive.
*
* When the operation is finished, `callback` will be called.
* You can then call g_drive_eject_finish() to obtain the
* result of the operation.
* @param flags flags affecting the unmount if required for eject
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
eject(flags: MountUnmountFlags, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes ejecting a drive.
* @param result a #GAsyncResult.
* @returns %TRUE if the drive has been ejected successfully, %FALSE otherwise.
*/
eject_finish(result: AsyncResult): boolean
/**
* Ejects a drive. This is an asynchronous operation, and is
* finished by calling g_drive_eject_with_operation_finish() with the `drive`
* and #GAsyncResult data returned in the `callback`.
* @param flags flags affecting the unmount if required for eject
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
eject_with_operation(flags: MountUnmountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes ejecting a drive. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
* @param result a #GAsyncResult.
* @returns %TRUE if the drive was successfully ejected. %FALSE otherwise.
*/
eject_with_operation_finish(result: AsyncResult): boolean
/**
* Gets the kinds of identifiers that `drive` has.
* Use g_drive_get_identifier() to obtain the identifiers
* themselves.
* @returns a %NULL-terminated array of strings containing kinds of identifiers. Use g_strfreev() to free.
*/
enumerate_identifiers(): string[]
/**
* Gets the icon for `drive`.
* @returns #GIcon for the @drive. Free the returned object with g_object_unref().
*/
get_icon(): Icon
/**
* Gets the identifier of the given kind for `drive`. The only
* identifier currently available is
* %G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE.
* @param kind the kind of identifier to return
* @returns a newly allocated string containing the requested identifier, or %NULL if the #GDrive doesn't have this kind of identifier.
*/
get_identifier(kind: string | null): string | null
/**
* Gets the name of `drive`.
* @returns a string containing @drive's name. The returned string should be freed when no longer needed.
*/
get_name(): string | null
/**
* Gets the sort key for `drive,` if any.
* @returns Sorting key for @drive or %NULL if no such key is available.
*/
get_sort_key(): string | null
/**
* Gets a hint about how a drive can be started/stopped.
* @returns A value from the #GDriveStartStopType enumeration.
*/
get_start_stop_type(): DriveStartStopType
/**
* Gets the icon for `drive`.
* @returns symbolic #GIcon for the @drive. Free the returned object with g_object_unref().
*/
get_symbolic_icon(): Icon
/**
* Get a list of mountable volumes for `drive`.
*
* The returned list should be freed with g_list_free(), after
* its elements have been unreffed with g_object_unref().
* @returns #GList containing any #GVolume objects on the given @drive.
*/
get_volumes(): Volume[]
/**
* Checks if the `drive` has media. Note that the OS may not be polling
* the drive for media changes; see g_drive_is_media_check_automatic()
* for more details.
* @returns %TRUE if @drive has media, %FALSE otherwise.
*/
has_media(): boolean
/**
* Check if `drive` has any mountable volumes.
* @returns %TRUE if the @drive contains volumes, %FALSE otherwise.
*/
has_volumes(): boolean
/**
* Checks if `drive` is capable of automatically detecting media changes.
* @returns %TRUE if the @drive is capable of automatically detecting media changes, %FALSE otherwise.
*/
is_media_check_automatic(): boolean
/**
* Checks if the `drive` supports removable media.
* @returns %TRUE if @drive supports removable media, %FALSE otherwise.
*/
is_media_removable(): boolean
/**
* Checks if the #GDrive and/or its media is considered removable by the user.
* See g_drive_is_media_removable().
* @returns %TRUE if @drive and/or its media is considered removable, %FALSE otherwise.
*/
is_removable(): boolean
/**
* Asynchronously polls `drive` to see if media has been inserted or removed.
*
* When the operation is finished, `callback` will be called.
* You can then call g_drive_poll_for_media_finish() to obtain the
* result of the operation.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
poll_for_media(cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an operation started with g_drive_poll_for_media() on a drive.
* @param result a #GAsyncResult.
* @returns %TRUE if the drive has been poll_for_mediaed successfully, %FALSE otherwise.
*/
poll_for_media_finish(result: AsyncResult): boolean
/**
* Asynchronously starts a drive.
*
* When the operation is finished, `callback` will be called.
* You can then call g_drive_start_finish() to obtain the
* result of the operation.
* @param flags flags affecting the start operation.
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
start(flags: DriveStartFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes starting a drive.
* @param result a #GAsyncResult.
* @returns %TRUE if the drive has been started successfully, %FALSE otherwise.
*/
start_finish(result: AsyncResult): boolean
/**
* Asynchronously stops a drive.
*
* When the operation is finished, `callback` will be called.
* You can then call g_drive_stop_finish() to obtain the
* result of the operation.
* @param flags flags affecting the unmount if required for stopping.
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
stop(flags: MountUnmountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes stopping a drive.
* @param result a #GAsyncResult.
* @returns %TRUE if the drive has been stopped successfully, %FALSE otherwise.
*/
stop_finish(result: AsyncResult): boolean
// Own virtual methods of Gio-2.0.Gio.Drive
/**
* Checks if a drive can be ejected.
* @virtual
* @returns %TRUE if the @drive can be ejected, %FALSE otherwise.
*/
vfunc_can_eject(): boolean
/**
* Checks if a drive can be polled for media changes.
* @virtual
* @returns %TRUE if the @drive can be polled for media changes, %FALSE otherwise.
*/
vfunc_can_poll_for_media(): boolean
/**
* Checks if a drive can be started.
* @virtual
* @returns %TRUE if the @drive can be started, %FALSE otherwise.
*/
vfunc_can_start(): boolean
/**
* Checks if a drive can be started degraded.
* @virtual
* @returns %TRUE if the @drive can be started degraded, %FALSE otherwise.
*/
vfunc_can_start_degraded(): boolean
/**
* Checks if a drive can be stopped.
* @virtual
* @returns %TRUE if the @drive can be stopped, %FALSE otherwise.
*/
vfunc_can_stop(): boolean
vfunc_changed(): void
vfunc_disconnected(): void
/**
* Asynchronously ejects a drive.
*
* When the operation is finished, `callback` will be called.
* You can then call g_drive_eject_finish() to obtain the
* result of the operation.
* @virtual
* @param flags flags affecting the unmount if required for eject
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
vfunc_eject(flags: MountUnmountFlags, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
vfunc_eject_button(): void
/**
* Finishes ejecting a drive.
* @virtual
* @param result a #GAsyncResult.
* @returns %TRUE if the drive has been ejected successfully, %FALSE otherwise.
*/
vfunc_eject_finish(result: AsyncResult): boolean
/**
* Ejects a drive. This is an asynchronous operation, and is
* finished by calling g_drive_eject_with_operation_finish() with the `drive`
* and #GAsyncResult data returned in the `callback`.
* @virtual
* @param flags flags affecting the unmount if required for eject
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
vfunc_eject_with_operation(flags: MountUnmountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes ejecting a drive. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
* @virtual
* @param result a #GAsyncResult.
* @returns %TRUE if the drive was successfully ejected. %FALSE otherwise.
*/
vfunc_eject_with_operation_finish(result: AsyncResult): boolean
/**
* Gets the kinds of identifiers that `drive` has.
* Use g_drive_get_identifier() to obtain the identifiers
* themselves.
* @virtual
* @returns a %NULL-terminated array of strings containing kinds of identifiers. Use g_strfreev() to free.
*/
vfunc_enumerate_identifiers(): string[]
/**
* Gets the icon for `drive`.
* @virtual
* @returns #GIcon for the @drive. Free the returned object with g_object_unref().
*/
vfunc_get_icon(): Icon
/**
* Gets the identifier of the given kind for `drive`. The only
* identifier currently available is
* %G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE.
* @virtual
* @param kind the kind of identifier to return
* @returns a newly allocated string containing the requested identifier, or %NULL if the #GDrive doesn't have this kind of identifier.
*/
vfunc_get_identifier(kind: string | null): string | null
/**
* Gets the name of `drive`.
* @virtual
* @returns a string containing @drive's name. The returned string should be freed when no longer needed.
*/
vfunc_get_name(): string | null
/**
* Gets the sort key for `drive,` if any.
* @virtual
* @returns Sorting key for @drive or %NULL if no such key is available.
*/
vfunc_get_sort_key(): string | null
/**
* Gets a hint about how a drive can be started/stopped.
* @virtual
* @returns A value from the #GDriveStartStopType enumeration.
*/
vfunc_get_start_stop_type(): DriveStartStopType
/**
* Gets the icon for `drive`.
* @virtual
* @returns symbolic #GIcon for the @drive. Free the returned object with g_object_unref().
*/
vfunc_get_symbolic_icon(): Icon
/**
* Get a list of mountable volumes for `drive`.
*
* The returned list should be freed with g_list_free(), after
* its elements have been unreffed with g_object_unref().
* @virtual
* @returns #GList containing any #GVolume objects on the given @drive.
*/
vfunc_get_volumes(): Volume[]
/**
* Checks if the `drive` has media. Note that the OS may not be polling
* the drive for media changes; see g_drive_is_media_check_automatic()
* for more details.
* @virtual
* @returns %TRUE if @drive has media, %FALSE otherwise.
*/
vfunc_has_media(): boolean
/**
* Check if `drive` has any mountable volumes.
* @virtual
* @returns %TRUE if the @drive contains volumes, %FALSE otherwise.
*/
vfunc_has_volumes(): boolean
/**
* Checks if `drive` is capable of automatically detecting media changes.
* @virtual
* @returns %TRUE if the @drive is capable of automatically detecting media changes, %FALSE otherwise.
*/
vfunc_is_media_check_automatic(): boolean
/**
* Checks if the `drive` supports removable media.
* @virtual
* @returns %TRUE if @drive supports removable media, %FALSE otherwise.
*/
vfunc_is_media_removable(): boolean
/**
* Checks if the #GDrive and/or its media is considered removable by the user.
* See g_drive_is_media_removable().
* @virtual
* @returns %TRUE if @drive and/or its media is considered removable, %FALSE otherwise.
*/
vfunc_is_removable(): boolean
/**
* Asynchronously polls `drive` to see if media has been inserted or removed.
*
* When the operation is finished, `callback` will be called.
* You can then call g_drive_poll_for_media_finish() to obtain the
* result of the operation.
* @virtual
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
vfunc_poll_for_media(cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an operation started with g_drive_poll_for_media() on a drive.
* @virtual
* @param result a #GAsyncResult.
* @returns %TRUE if the drive has been poll_for_mediaed successfully, %FALSE otherwise.
*/
vfunc_poll_for_media_finish(result: AsyncResult): boolean
/**
* Asynchronously starts a drive.
*
* When the operation is finished, `callback` will be called.
* You can then call g_drive_start_finish() to obtain the
* result of the operation.
* @virtual
* @param flags flags affecting the start operation.
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
vfunc_start(flags: DriveStartFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes starting a drive.
* @virtual
* @param result a #GAsyncResult.
* @returns %TRUE if the drive has been started successfully, %FALSE otherwise.
*/
vfunc_start_finish(result: AsyncResult): boolean
/**
* Asynchronously stops a drive.
*
* When the operation is finished, `callback` will be called.
* You can then call g_drive_stop_finish() to obtain the
* result of the operation.
* @virtual
* @param flags flags affecting the unmount if required for stopping.
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
vfunc_stop(flags: MountUnmountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
vfunc_stop_button(): void
/**
* Finishes stopping a drive.
* @virtual
* @param result a #GAsyncResult.
* @returns %TRUE if the drive has been stopped successfully, %FALSE otherwise.
*/
vfunc_stop_finish(result: AsyncResult): boolean
// Own signals of Gio-2.0.Gio.Drive
connect(sigName: "changed", callback: Drive.ChangedSignalCallback): number
connect_after(sigName: "changed", callback: Drive.ChangedSignalCallback): number
emit(sigName: "changed", ...args: any[]): void
connect(sigName: "disconnected", callback: Drive.DisconnectedSignalCallback): number
connect_after(sigName: "disconnected", callback: Drive.DisconnectedSignalCallback): number
emit(sigName: "disconnected", ...args: any[]): void
connect(sigName: "eject-button", callback: Drive.EjectButtonSignalCallback): number
connect_after(sigName: "eject-button", callback: Drive.EjectButtonSignalCallback): number
emit(sigName: "eject-button", ...args: any[]): void
connect(sigName: "stop-button", callback: Drive.StopButtonSignalCallback): number
connect_after(sigName: "stop-button", callback: Drive.StopButtonSignalCallback): number
emit(sigName: "stop-button", ...args: any[]): void
// Class property signals of Gio-2.0.Gio.Drive
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GDrive - this represent a piece of hardware connected to the machine.
* It's generally only created for removable hardware or hardware with
* removable media.
*
* #GDrive is a container class for #GVolume objects that stem from
* the same piece of media. As such, #GDrive abstracts a drive with
* (or without) removable media and provides operations for querying
* whether media is available, determining whether media change is
* automatically detected and ejecting the media.
*
* If the #GDrive reports that media isn't automatically detected, one
* can poll for media; typically one should not do this periodically
* as a poll for media operation is potentially expensive and may
* spin up the drive creating noise.
*
* #GDrive supports starting and stopping drives with authentication
* support for the former. This can be used to support a diverse set
* of use cases including connecting/disconnecting iSCSI devices,
* powering down external disk enclosures and starting/stopping
* multi-disk devices such as RAID devices. Note that the actual
* semantics and side-effects of starting/stopping a #GDrive may vary
* according to implementation. To choose the correct verbs in e.g. a
* file manager, use g_drive_get_start_stop_type().
*
* For porting from GnomeVFS note that there is no equivalent of
* #GDrive in that API.
* @interface
*/
export class Drive extends GObject.Object {
// Own properties of Gio-2.0.Gio.Drive
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.Drive
constructor(config?: Drive.ConstructorProperties)
_init(config?: Drive.ConstructorProperties): void
}
export module DtlsClientConnection {
// Constructor properties interface
export interface ConstructorProperties extends DatagramBased.ConstructorProperties, DtlsConnection.ConstructorProperties, GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.DtlsClientConnection
/**
* A #GSocketConnectable describing the identity of the server that
* is expected on the other end of the connection.
*
* If the %G_TLS_CERTIFICATE_BAD_IDENTITY flag is set in
* #GDtlsClientConnection:validation-flags, this object will be used
* to determine the expected identify of the remote end of the
* connection; if #GDtlsClientConnection:server-identity is not set,
* or does not match the identity presented by the server, then the
* %G_TLS_CERTIFICATE_BAD_IDENTITY validation will fail.
*
* In addition to its use in verifying the server certificate,
* this is also used to give a hint to the server about what
* certificate we expect, which is useful for servers that serve
* virtual hosts.
*/
server_identity?: SocketConnectable | null
/**
* What steps to perform when validating a certificate received from
* a server. Server certificates that fail to validate in any of the
* ways indicated here will be rejected unless the application
* overrides the default via #GDtlsConnection::accept-certificate.
*
* GLib guarantees that if certificate verification fails, at least one
* flag will be set, but it does not guarantee that all possible flags
* will be set. Accordingly, you may not safely decide to ignore any
* particular type of error. For example, it would be incorrect to mask
* %G_TLS_CERTIFICATE_EXPIRED if you want to allow expired certificates,
* because this could potentially be the only error flag set even if
* other problems exist with the certificate. Therefore, there is no
* safe way to use this property. This is not a horrible problem,
* though, because you should not be attempting to ignore validation
* errors anyway. If you really must ignore TLS certificate errors,
* connect to #GDtlsConnection::accept-certificate.
*/
validation_flags?: TlsCertificateFlags | null
}
}
export interface DtlsClientConnection extends DatagramBased, DtlsConnection {
// Own properties of Gio-2.0.Gio.DtlsClientConnection
/**
* A list of the distinguished names of the Certificate Authorities
* that the server will accept client certificates signed by. If the
* server requests a client certificate during the handshake, then
* this property will be set after the handshake completes.
*
* Each item in the list is a #GByteArray which contains the complete
* subject DN of the certificate authority.
*/
readonly accepted_cas: any[]
/**
* A #GSocketConnectable describing the identity of the server that
* is expected on the other end of the connection.
*
* If the %G_TLS_CERTIFICATE_BAD_IDENTITY flag is set in
* #GDtlsClientConnection:validation-flags, this object will be used
* to determine the expected identify of the remote end of the
* connection; if #GDtlsClientConnection:server-identity is not set,
* or does not match the identity presented by the server, then the
* %G_TLS_CERTIFICATE_BAD_IDENTITY validation will fail.
*
* In addition to its use in verifying the server certificate,
* this is also used to give a hint to the server about what
* certificate we expect, which is useful for servers that serve
* virtual hosts.
*/
server_identity: SocketConnectable
/**
* What steps to perform when validating a certificate received from
* a server. Server certificates that fail to validate in any of the
* ways indicated here will be rejected unless the application
* overrides the default via #GDtlsConnection::accept-certificate.
*
* GLib guarantees that if certificate verification fails, at least one
* flag will be set, but it does not guarantee that all possible flags
* will be set. Accordingly, you may not safely decide to ignore any
* particular type of error. For example, it would be incorrect to mask
* %G_TLS_CERTIFICATE_EXPIRED if you want to allow expired certificates,
* because this could potentially be the only error flag set even if
* other problems exist with the certificate. Therefore, there is no
* safe way to use this property. This is not a horrible problem,
* though, because you should not be attempting to ignore validation
* errors anyway. If you really must ignore TLS certificate errors,
* connect to #GDtlsConnection::accept-certificate.
*/
validation_flags: TlsCertificateFlags
// Owm methods of Gio-2.0.Gio.DtlsClientConnection
/**
* Gets the list of distinguished names of the Certificate Authorities
* that the server will accept certificates from. This will be set
* during the TLS handshake if the server requests a certificate.
* Otherwise, it will be %NULL.
*
* Each item in the list is a #GByteArray which contains the complete
* subject DN of the certificate authority.
* @returns the list of CA DNs. You should unref each element with g_byte_array_unref() and then the free the list with g_list_free().
*/
get_accepted_cas(): GLib.List[]
/**
* Gets `conn'`s expected server identity
* @returns a #GSocketConnectable describing the expected server identity, or %NULL if the expected identity is not known.
*/
get_server_identity(): SocketConnectable
/**
* Gets `conn'`s validation flags
*
* This function does not work as originally designed and is impossible
* to use correctly. See #GDtlsClientConnection:validation-flags for more
* information.
* @returns the validation flags
*/
get_validation_flags(): TlsCertificateFlags
/**
* Sets `conn'`s expected server identity, which is used both to tell
* servers on virtual hosts which certificate to present, and also
* to let `conn` know what name to look for in the certificate when
* performing %G_TLS_CERTIFICATE_BAD_IDENTITY validation, if enabled.
* @param identity a #GSocketConnectable describing the expected server identity
*/
set_server_identity(identity: SocketConnectable): void
/**
* Sets `conn'`s validation flags, to override the default set of
* checks performed when validating a server certificate. By default,
* %G_TLS_CERTIFICATE_VALIDATE_ALL is used.
*
* This function does not work as originally designed and is impossible
* to use correctly. See #GDtlsClientConnection:validation-flags for more
* information.
* @param flags the #GTlsCertificateFlags to use
*/
set_validation_flags(flags: TlsCertificateFlags): void
// Class property signals of Gio-2.0.Gio.DtlsClientConnection
connect(sigName: "notify::accepted-cas", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::accepted-cas", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::accepted-cas", ...args: any[]): void
connect(sigName: "notify::server-identity", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::server-identity", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::server-identity", ...args: any[]): void
connect(sigName: "notify::validation-flags", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::validation-flags", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::validation-flags", ...args: any[]): void
connect(sigName: "notify::advertised-protocols", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::advertised-protocols", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::advertised-protocols", ...args: any[]): void
connect(sigName: "notify::base-socket", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::base-socket", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::base-socket", ...args: any[]): void
connect(sigName: "notify::certificate", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::certificate", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::certificate", ...args: any[]): void
connect(sigName: "notify::ciphersuite-name", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::ciphersuite-name", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::ciphersuite-name", ...args: any[]): void
connect(sigName: "notify::database", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::database", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::database", ...args: any[]): void
connect(sigName: "notify::interaction", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::interaction", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::interaction", ...args: any[]): void
connect(sigName: "notify::negotiated-protocol", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::negotiated-protocol", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::negotiated-protocol", ...args: any[]): void
connect(sigName: "notify::peer-certificate", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::peer-certificate", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::peer-certificate", ...args: any[]): void
connect(sigName: "notify::peer-certificate-errors", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::peer-certificate-errors", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::peer-certificate-errors", ...args: any[]): void
connect(sigName: "notify::protocol-version", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::protocol-version", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::protocol-version", ...args: any[]): void
connect(sigName: "notify::rehandshake-mode", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::rehandshake-mode", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::rehandshake-mode", ...args: any[]): void
connect(sigName: "notify::require-close-notify", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::require-close-notify", callback: (($obj: DtlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::require-close-notify", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GDtlsClientConnection is the client-side subclass of
* #GDtlsConnection, representing a client-side DTLS connection.
* @interface
*/
export class DtlsClientConnection extends GObject.Object {
// Own properties of Gio-2.0.Gio.DtlsClientConnection
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DtlsClientConnection
constructor(config?: DtlsClientConnection.ConstructorProperties)
_init(config?: DtlsClientConnection.ConstructorProperties): void
/**
* Creates a new #GDtlsClientConnection wrapping `base_socket` which is
* assumed to communicate with the server identified by `server_identity`.
* @param base_socket the #GDatagramBased to wrap
* @param server_identity the expected identity of the server
* @returns the new #GDtlsClientConnection, or %NULL on error
*/
static new(base_socket: DatagramBased, server_identity: SocketConnectable | null): DtlsClientConnection
}
export module DtlsConnection {
// Signal callback interfaces
/**
* Signal callback interface for `accept-certificate`
*/
export interface AcceptCertificateSignalCallback {
($obj: DtlsConnection, peer_cert: TlsCertificate, errors: TlsCertificateFlags): boolean
}
// Constructor properties interface
export interface ConstructorProperties extends DatagramBased.ConstructorProperties, GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.DtlsConnection
/**
* The list of application-layer protocols that the connection
* advertises that it is willing to speak. See
* g_dtls_connection_set_advertised_protocols().
*/
advertised_protocols?: string[] | null
/**
* The #GDatagramBased that the connection wraps. Note that this may be any
* implementation of #GDatagramBased, not just a #GSocket.
*/
base_socket?: DatagramBased | null
/**
* The connection's certificate; see
* g_dtls_connection_set_certificate().
*/
certificate?: TlsCertificate | null
/**
* The certificate database to use when verifying this TLS connection.
* If no certificate database is set, then the default database will be
* used. See g_tls_backend_get_default_database().
*
* When using a non-default database, #GDtlsConnection must fall back to using
* the #GTlsDatabase to perform certificate verification using
* g_tls_database_verify_chain(), which means certificate verification will
* not be able to make use of TLS session context. This may be less secure.
* For example, if you create your own #GTlsDatabase that just wraps the
* default #GTlsDatabase, you might expect that you have not changed anything,
* but this is not true because you may have altered the behavior of
* #GDtlsConnection by causing it to use g_tls_database_verify_chain(). See the
* documentation of g_tls_database_verify_chain() for more details on specific
* security checks that may not be performed. Accordingly, setting a
* non-default database is discouraged except for specialty applications with
* unusual security requirements.
*/
database?: TlsDatabase | null
/**
* A #GTlsInteraction object to be used when the connection or certificate
* database need to interact with the user. This will be used to prompt the
* user for passwords where necessary.
*/
interaction?: TlsInteraction | null
/**
* The rehandshaking mode. See
* g_dtls_connection_set_rehandshake_mode().
*/
rehandshake_mode?: TlsRehandshakeMode | null
/**
* Whether or not proper TLS close notification is required.
* See g_dtls_connection_set_require_close_notify().
*/
require_close_notify?: boolean | null
}
}
export interface DtlsConnection extends DatagramBased {
// Own properties of Gio-2.0.Gio.DtlsConnection
/**
* The list of application-layer protocols that the connection
* advertises that it is willing to speak. See
* g_dtls_connection_set_advertised_protocols().
*/
advertised_protocols: string[]
/**
* The #GDatagramBased that the connection wraps. Note that this may be any
* implementation of #GDatagramBased, not just a #GSocket.
*/
readonly base_socket: DatagramBased
/**
* The connection's certificate; see
* g_dtls_connection_set_certificate().
*/
certificate: TlsCertificate
/**
* The name of the DTLS ciphersuite in use. See g_dtls_connection_get_ciphersuite_name().
*/
readonly ciphersuite_name: string | null
/**
* The certificate database to use when verifying this TLS connection.
* If no certificate database is set, then the default database will be
* used. See g_tls_backend_get_default_database().
*
* When using a non-default database, #GDtlsConnection must fall back to using
* the #GTlsDatabase to perform certificate verification using
* g_tls_database_verify_chain(), which means certificate verification will
* not be able to make use of TLS session context. This may be less secure.
* For example, if you create your own #GTlsDatabase that just wraps the
* default #GTlsDatabase, you might expect that you have not changed anything,
* but this is not true because you may have altered the behavior of
* #GDtlsConnection by causing it to use g_tls_database_verify_chain(). See the
* documentation of g_tls_database_verify_chain() for more details on specific
* security checks that may not be performed. Accordingly, setting a
* non-default database is discouraged except for specialty applications with
* unusual security requirements.
*/
database: TlsDatabase
/**
* A #GTlsInteraction object to be used when the connection or certificate
* database need to interact with the user. This will be used to prompt the
* user for passwords where necessary.
*/
interaction: TlsInteraction
/**
* The application-layer protocol negotiated during the TLS
* handshake. See g_dtls_connection_get_negotiated_protocol().
*/
readonly negotiated_protocol: string | null
/**
* The connection's peer's certificate, after the TLS handshake has
* completed or failed. Note in particular that this is not yet set
* during the emission of #GDtlsConnection::accept-certificate.
*
* (You can watch for a #GObject::notify signal on this property to
* detect when a handshake has occurred.)
*/
readonly peer_certificate: TlsCertificate
/**
* The errors noticed while verifying
* #GDtlsConnection:peer-certificate. Normally this should be 0, but
* it may not be if #GDtlsClientConnection:validation-flags is not
* %G_TLS_CERTIFICATE_VALIDATE_ALL, or if
* #GDtlsConnection::accept-certificate overrode the default
* behavior.
*
* GLib guarantees that if certificate verification fails, at least
* one error will be set, but it does not guarantee that all possible
* errors will be set. Accordingly, you may not safely decide to
* ignore any particular type of error. For example, it would be
* incorrect to mask %G_TLS_CERTIFICATE_EXPIRED if you want to allow
* expired certificates, because this could potentially be the only
* error flag set even if other problems exist with the certificate.
*/
readonly peer_certificate_errors: TlsCertificateFlags
/**
* The DTLS protocol version in use. See g_dtls_connection_get_protocol_version().
*/
readonly protocol_version: TlsProtocolVersion
/**
* The rehandshaking mode. See
* g_dtls_connection_set_rehandshake_mode().
*/
rehandshake_mode: TlsRehandshakeMode
/**
* Whether or not proper TLS close notification is required.
* See g_dtls_connection_set_require_close_notify().
*/
require_close_notify: boolean
// Owm methods of Gio-2.0.Gio.DtlsConnection
/**
* Close the DTLS connection. This is equivalent to calling
* g_dtls_connection_shutdown() to shut down both sides of the connection.
*
* Closing a #GDtlsConnection waits for all buffered but untransmitted data to
* be sent before it completes. It then sends a `close_notify` DTLS alert to the
* peer and may wait for a `close_notify` to be received from the peer. It does
* not close the underlying #GDtlsConnection:base-socket; that must be closed
* separately.
*
* Once `conn` is closed, all other operations will return %G_IO_ERROR_CLOSED.
* Closing a #GDtlsConnection multiple times will not return an error.
*
* #GDtlsConnections will be automatically closed when the last reference is
* dropped, but you might want to call this function to make sure resources are
* released as early as possible.
*
* If `cancellable` is cancelled, the #GDtlsConnection may be left
* partially-closed and any pending untransmitted data may be lost. Call
* g_dtls_connection_close() again to complete closing the #GDtlsConnection.
* @param cancellable a #GCancellable, or %NULL
* @returns %TRUE on success, %FALSE otherwise
*/
close(cancellable: Cancellable | null): boolean
/**
* Asynchronously close the DTLS connection. See g_dtls_connection_close() for
* more information.
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable a #GCancellable, or %NULL
* @param callback callback to call when the close operation is complete
*/
close_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of close_async
/**
* Promisified version of {@link close_async}
*
* Asynchronously close the DTLS connection. See g_dtls_connection_close() for
* more information.
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable a #GCancellable, or %NULL
* @returns A Promise of: %TRUE on success, %FALSE on failure, in which case @error will be set
*/
close_async(io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finish an asynchronous TLS close operation. See g_dtls_connection_close()
* for more information.
* @param result a #GAsyncResult
* @returns %TRUE on success, %FALSE on failure, in which case @error will be set
*/
close_finish(result: AsyncResult): boolean
/**
* Used by #GDtlsConnection implementations to emit the
* #GDtlsConnection::accept-certificate signal.
* @param peer_cert the peer's #GTlsCertificate
* @param errors the problems with `peer_cert`
* @returns %TRUE if one of the signal handlers has returned %TRUE to accept @peer_cert
*/
emit_accept_certificate(peer_cert: TlsCertificate, errors: TlsCertificateFlags): boolean
/**
* Gets `conn'`s certificate, as set by
* g_dtls_connection_set_certificate().
* @returns @conn's certificate, or %NULL
*/
get_certificate(): TlsCertificate | null
/**
* Query the TLS backend for TLS channel binding data of `type` for `conn`.
*
* This call retrieves TLS channel binding data as specified in RFC
* [5056](https://tools.ietf.org/html/rfc5056), RFC
* [5929](https://tools.ietf.org/html/rfc5929), and related RFCs. The
* binding data is returned in `data`. The `data` is resized by the callee
* using #GByteArray buffer management and will be freed when the `data`
* is destroyed by g_byte_array_unref(). If `data` is %NULL, it will only
* check whether TLS backend is able to fetch the data (e.g. whether `type`
* is supported by the TLS backend). It does not guarantee that the data
* will be available though. That could happen if TLS connection does not
* support `type` or the binding data is not available yet due to additional
* negotiation or input required.
* @param type #GTlsChannelBindingType type of data to fetch
* @returns %TRUE on success, %FALSE otherwise
*/
get_channel_binding_data(type: TlsChannelBindingType): [ /* returnType */ boolean, /* data */ Uint8Array ]
/**
* Returns the name of the current DTLS ciphersuite, or %NULL if the
* connection has not handshaked or has been closed. Beware that the TLS
* backend may use any of multiple different naming conventions, because
* OpenSSL and GnuTLS have their own ciphersuite naming conventions that
* are different from each other and different from the standard, IANA-
* registered ciphersuite names. The ciphersuite name is intended to be
* displayed to the user for informative purposes only, and parsing it
* is not recommended.
* @returns The name of the current DTLS ciphersuite, or %NULL
*/
get_ciphersuite_name(): string | null
/**
* Gets the certificate database that `conn` uses to verify
* peer certificates. See g_dtls_connection_set_database().
* @returns the certificate database that @conn uses or %NULL
*/
get_database(): TlsDatabase | null
/**
* Get the object that will be used to interact with the user. It will be used
* for things like prompting the user for passwords. If %NULL is returned, then
* no user interaction will occur for this connection.
* @returns The interaction object.
*/
get_interaction(): TlsInteraction | null
/**
* Gets the name of the application-layer protocol negotiated during
* the handshake.
*
* If the peer did not use the ALPN extension, or did not advertise a
* protocol that matched one of `conn'`s protocols, or the TLS backend
* does not support ALPN, then this will be %NULL. See
* g_dtls_connection_set_advertised_protocols().
* @returns the negotiated protocol, or %NULL
*/
get_negotiated_protocol(): string | null
/**
* Gets `conn'`s peer's certificate after the handshake has completed
* or failed. (It is not set during the emission of
* #GDtlsConnection::accept-certificate.)
* @returns @conn's peer's certificate, or %NULL
*/
get_peer_certificate(): TlsCertificate | null
/**
* Gets the errors associated with validating `conn'`s peer's
* certificate, after the handshake has completed or failed. (It is
* not set during the emission of #GDtlsConnection::accept-certificate.)
* @returns @conn's peer's certificate errors
*/
get_peer_certificate_errors(): TlsCertificateFlags
/**
* Returns the current DTLS protocol version, which may be
* %G_TLS_PROTOCOL_VERSION_UNKNOWN if the connection has not handshaked, or
* has been closed, or if the TLS backend has implemented a protocol version
* that is not a recognized #GTlsProtocolVersion.
* @returns The current DTLS protocol version
*/
get_protocol_version(): TlsProtocolVersion
/**
* Gets `conn` rehandshaking mode. See
* g_dtls_connection_set_rehandshake_mode() for details.
* @returns %G_TLS_REHANDSHAKE_SAFELY
*/
get_rehandshake_mode(): TlsRehandshakeMode
/**
* Tests whether or not `conn` expects a proper TLS close notification
* when the connection is closed. See
* g_dtls_connection_set_require_close_notify() for details.
* @returns %TRUE if @conn requires a proper TLS close notification.
*/
get_require_close_notify(): boolean
/**
* Attempts a TLS handshake on `conn`.
*
* On the client side, it is never necessary to call this method;
* although the connection needs to perform a handshake after
* connecting, #GDtlsConnection will handle this for you automatically
* when you try to send or receive data on the connection. You can call
* g_dtls_connection_handshake() manually if you want to know whether
* the initial handshake succeeded or failed (as opposed to just
* immediately trying to use `conn` to read or write, in which case,
* if it fails, it may not be possible to tell if it failed before
* or after completing the handshake), but beware that servers may reject
* client authentication after the handshake has completed, so a
* successful handshake does not indicate the connection will be usable.
*
* Likewise, on the server side, although a handshake is necessary at
* the beginning of the communication, you do not need to call this
* function explicitly unless you want clearer error reporting.
*
* Previously, calling g_dtls_connection_handshake() after the initial
* handshake would trigger a rehandshake; however, this usage was
* deprecated in GLib 2.60 because rehandshaking was removed from the
* TLS protocol in TLS 1.3. Since GLib 2.64, calling this function after
* the initial handshake will no longer do anything.
*
* #GDtlsConnection::accept_certificate may be emitted during the
* handshake.
* @param cancellable a #GCancellable, or %NULL
* @returns success or failure
*/
handshake(cancellable: Cancellable | null): boolean
/**
* Asynchronously performs a TLS handshake on `conn`. See
* g_dtls_connection_handshake() for more information.
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable a #GCancellable, or %NULL
* @param callback callback to call when the handshake is complete
*/
handshake_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of handshake_async
/**
* Promisified version of {@link handshake_async}
*
* Asynchronously performs a TLS handshake on `conn`. See
* g_dtls_connection_handshake() for more information.
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable a #GCancellable, or %NULL
* @returns A Promise of: %TRUE on success, %FALSE on failure, in which case @error will be set.
*/
handshake_async(io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finish an asynchronous TLS handshake operation. See
* g_dtls_connection_handshake() for more information.
* @param result a #GAsyncResult.
* @returns %TRUE on success, %FALSE on failure, in which case @error will be set.
*/
handshake_finish(result: AsyncResult): boolean
/**
* Sets the list of application-layer protocols to advertise that the
* caller is willing to speak on this connection. The
* Application-Layer Protocol Negotiation (ALPN) extension will be
* used to negotiate a compatible protocol with the peer; use
* g_dtls_connection_get_negotiated_protocol() to find the negotiated
* protocol after the handshake. Specifying %NULL for the the value
* of `protocols` will disable ALPN negotiation.
*
* See [IANA TLS ALPN Protocol IDs](https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids)
* for a list of registered protocol IDs.
* @param protocols a %NULL-terminated array of ALPN protocol names (eg, "http/1.1", "h2"), or %NULL
*/
set_advertised_protocols(protocols: string[] | null): void
/**
* This sets the certificate that `conn` will present to its peer
* during the TLS handshake. For a #GDtlsServerConnection, it is
* mandatory to set this, and that will normally be done at construct
* time.
*
* For a #GDtlsClientConnection, this is optional. If a handshake fails
* with %G_TLS_ERROR_CERTIFICATE_REQUIRED, that means that the server
* requires a certificate, and if you try connecting again, you should
* call this method first. You can call
* g_dtls_client_connection_get_accepted_cas() on the failed connection
* to get a list of Certificate Authorities that the server will
* accept certificates from.
*
* (It is also possible that a server will allow the connection with
* or without a certificate; in that case, if you don't provide a
* certificate, you can tell that the server requested one by the fact
* that g_dtls_client_connection_get_accepted_cas() will return
* non-%NULL.)
* @param certificate the certificate to use for `conn`
*/
set_certificate(certificate: TlsCertificate): void
/**
* Sets the certificate database that is used to verify peer certificates.
* This is set to the default database by default. See
* g_tls_backend_get_default_database(). If set to %NULL, then
* peer certificate validation will always set the
* %G_TLS_CERTIFICATE_UNKNOWN_CA error (meaning
* #GDtlsConnection::accept-certificate will always be emitted on
* client-side connections, unless that bit is not set in
* #GDtlsClientConnection:validation-flags).
*
* There are nonintuitive security implications when using a non-default
* database. See #GDtlsConnection:database for details.
* @param database a #GTlsDatabase
*/
set_database(database: TlsDatabase | null): void
/**
* Set the object that will be used to interact with the user. It will be used
* for things like prompting the user for passwords.
*
* The `interaction` argument will normally be a derived subclass of
* #GTlsInteraction. %NULL can also be provided if no user interaction
* should occur for this connection.
* @param interaction an interaction object, or %NULL
*/
set_interaction(interaction: TlsInteraction | null): void
/**
* Since GLib 2.64, changing the rehandshake mode is no longer supported
* and will have no effect. With TLS 1.3, rehandshaking has been removed from
* the TLS protocol, replaced by separate post-handshake authentication and
* rekey operations.
* @param mode the rehandshaking mode
*/
set_rehandshake_mode(mode: TlsRehandshakeMode): void
/**
* Sets whether or not `conn` expects a proper TLS close notification
* before the connection is closed. If this is %TRUE (the default),
* then `conn` will expect to receive a TLS close notification from its
* peer before the connection is closed, and will return a
* %G_TLS_ERROR_EOF error if the connection is closed without proper
* notification (since this may indicate a network error, or
* man-in-the-middle attack).
*
* In some protocols, the application will know whether or not the
* connection was closed cleanly based on application-level data
* (because the application-level data includes a length field, or is
* somehow self-delimiting); in this case, the close notify is
* redundant and may be omitted. You
* can use g_dtls_connection_set_require_close_notify() to tell `conn`
* to allow an "unannounced" connection close, in which case the close
* will show up as a 0-length read, as in a non-TLS
* #GDatagramBased, and it is up to the application to check that
* the data has been fully received.
*
* Note that this only affects the behavior when the peer closes the
* connection; when the application calls g_dtls_connection_close_async() on
* `conn` itself, this will send a close notification regardless of the
* setting of this property. If you explicitly want to do an unclean
* close, you can close `conn'`s #GDtlsConnection:base-socket rather
* than closing `conn` itself.
* @param require_close_notify whether or not to require close notification
*/
set_require_close_notify(require_close_notify: boolean): void
/**
* Shut down part or all of a DTLS connection.
*
* If `shutdown_read` is %TRUE then the receiving side of the connection is shut
* down, and further reading is disallowed. Subsequent calls to
* g_datagram_based_receive_messages() will return %G_IO_ERROR_CLOSED.
*
* If `shutdown_write` is %TRUE then the sending side of the connection is shut
* down, and further writing is disallowed. Subsequent calls to
* g_datagram_based_send_messages() will return %G_IO_ERROR_CLOSED.
*
* It is allowed for both `shutdown_read` and `shutdown_write` to be TRUE — this
* is equivalent to calling g_dtls_connection_close().
*
* If `cancellable` is cancelled, the #GDtlsConnection may be left
* partially-closed and any pending untransmitted data may be lost. Call
* g_dtls_connection_shutdown() again to complete closing the #GDtlsConnection.
* @param shutdown_read %TRUE to stop reception of incoming datagrams
* @param shutdown_write %TRUE to stop sending outgoing datagrams
* @param cancellable a #GCancellable, or %NULL
* @returns %TRUE on success, %FALSE otherwise
*/
shutdown(shutdown_read: boolean, shutdown_write: boolean, cancellable: Cancellable | null): boolean
/**
* Asynchronously shut down part or all of the DTLS connection. See
* g_dtls_connection_shutdown() for more information.
* @param shutdown_read %TRUE to stop reception of incoming datagrams
* @param shutdown_write %TRUE to stop sending outgoing datagrams
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable a #GCancellable, or %NULL
* @param callback callback to call when the shutdown operation is complete
*/
shutdown_async(shutdown_read: boolean, shutdown_write: boolean, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of shutdown_async
/**
* Promisified version of {@link shutdown_async}
*
* Asynchronously shut down part or all of the DTLS connection. See
* g_dtls_connection_shutdown() for more information.
* @param shutdown_read %TRUE to stop reception of incoming datagrams
* @param shutdown_write %TRUE to stop sending outgoing datagrams
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable a #GCancellable, or %NULL
* @returns A Promise of: %TRUE on success, %FALSE on failure, in which case @error will be set
*/
shutdown_async(shutdown_read: boolean, shutdown_write: boolean, io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finish an asynchronous TLS shutdown operation. See
* g_dtls_connection_shutdown() for more information.
* @param result a #GAsyncResult
* @returns %TRUE on success, %FALSE on failure, in which case @error will be set
*/
shutdown_finish(result: AsyncResult): boolean
// Own virtual methods of Gio-2.0.Gio.DtlsConnection
vfunc_accept_certificate(peer_cert: TlsCertificate, errors: TlsCertificateFlags): boolean
vfunc_get_binding_data(type: TlsChannelBindingType, data: Uint8Array): boolean
/**
* Gets the name of the application-layer protocol negotiated during
* the handshake.
*
* If the peer did not use the ALPN extension, or did not advertise a
* protocol that matched one of `conn'`s protocols, or the TLS backend
* does not support ALPN, then this will be %NULL. See
* g_dtls_connection_set_advertised_protocols().
* @virtual
* @returns the negotiated protocol, or %NULL
*/
vfunc_get_negotiated_protocol(): string | null
/**
* Attempts a TLS handshake on `conn`.
*
* On the client side, it is never necessary to call this method;
* although the connection needs to perform a handshake after
* connecting, #GDtlsConnection will handle this for you automatically
* when you try to send or receive data on the connection. You can call
* g_dtls_connection_handshake() manually if you want to know whether
* the initial handshake succeeded or failed (as opposed to just
* immediately trying to use `conn` to read or write, in which case,
* if it fails, it may not be possible to tell if it failed before
* or after completing the handshake), but beware that servers may reject
* client authentication after the handshake has completed, so a
* successful handshake does not indicate the connection will be usable.
*
* Likewise, on the server side, although a handshake is necessary at
* the beginning of the communication, you do not need to call this
* function explicitly unless you want clearer error reporting.
*
* Previously, calling g_dtls_connection_handshake() after the initial
* handshake would trigger a rehandshake; however, this usage was
* deprecated in GLib 2.60 because rehandshaking was removed from the
* TLS protocol in TLS 1.3. Since GLib 2.64, calling this function after
* the initial handshake will no longer do anything.
*
* #GDtlsConnection::accept_certificate may be emitted during the
* handshake.
* @virtual
* @param cancellable a #GCancellable, or %NULL
* @returns success or failure
*/
vfunc_handshake(cancellable: Cancellable | null): boolean
/**
* Asynchronously performs a TLS handshake on `conn`. See
* g_dtls_connection_handshake() for more information.
* @virtual
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable a #GCancellable, or %NULL
* @param callback callback to call when the handshake is complete
*/
vfunc_handshake_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finish an asynchronous TLS handshake operation. See
* g_dtls_connection_handshake() for more information.
* @virtual
* @param result a #GAsyncResult.
* @returns %TRUE on success, %FALSE on failure, in which case @error will be set.
*/
vfunc_handshake_finish(result: AsyncResult): boolean
/**
* Sets the list of application-layer protocols to advertise that the
* caller is willing to speak on this connection. The
* Application-Layer Protocol Negotiation (ALPN) extension will be
* used to negotiate a compatible protocol with the peer; use
* g_dtls_connection_get_negotiated_protocol() to find the negotiated
* protocol after the handshake. Specifying %NULL for the the value
* of `protocols` will disable ALPN negotiation.
*
* See [IANA TLS ALPN Protocol IDs](https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids)
* for a list of registered protocol IDs.
* @virtual
* @param protocols a %NULL-terminated array of ALPN protocol names (eg, "http/1.1", "h2"), or %NULL
*/
vfunc_set_advertised_protocols(protocols: string[] | null): void
/**
* Shut down part or all of a DTLS connection.
*
* If `shutdown_read` is %TRUE then the receiving side of the connection is shut
* down, and further reading is disallowed. Subsequent calls to
* g_datagram_based_receive_messages() will return %G_IO_ERROR_CLOSED.
*
* If `shutdown_write` is %TRUE then the sending side of the connection is shut
* down, and further writing is disallowed. Subsequent calls to
* g_datagram_based_send_messages() will return %G_IO_ERROR_CLOSED.
*
* It is allowed for both `shutdown_read` and `shutdown_write` to be TRUE — this
* is equivalent to calling g_dtls_connection_close().
*
* If `cancellable` is cancelled, the #GDtlsConnection may be left
* partially-closed and any pending untransmitted data may be lost. Call
* g_dtls_connection_shutdown() again to complete closing the #GDtlsConnection.
* @virtual
* @param shutdown_read %TRUE to stop reception of incoming datagrams
* @param shutdown_write %TRUE to stop sending outgoing datagrams
* @param cancellable a #GCancellable, or %NULL
* @returns %TRUE on success, %FALSE otherwise
*/
vfunc_shutdown(shutdown_read: boolean, shutdown_write: boolean, cancellable: Cancellable | null): boolean
/**
* Asynchronously shut down part or all of the DTLS connection. See
* g_dtls_connection_shutdown() for more information.
* @virtual
* @param shutdown_read %TRUE to stop reception of incoming datagrams
* @param shutdown_write %TRUE to stop sending outgoing datagrams
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable a #GCancellable, or %NULL
* @param callback callback to call when the shutdown operation is complete
*/
vfunc_shutdown_async(shutdown_read: boolean, shutdown_write: boolean, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finish an asynchronous TLS shutdown operation. See
* g_dtls_connection_shutdown() for more information.
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE on success, %FALSE on failure, in which case @error will be set
*/
vfunc_shutdown_finish(result: AsyncResult): boolean
// Own signals of Gio-2.0.Gio.DtlsConnection
connect(sigName: "accept-certificate", callback: DtlsConnection.AcceptCertificateSignalCallback): number
connect_after(sigName: "accept-certificate", callback: DtlsConnection.AcceptCertificateSignalCallback): number
emit(sigName: "accept-certificate", peer_cert: TlsCertificate, errors: TlsCertificateFlags, ...args: any[]): void
// Class property signals of Gio-2.0.Gio.DtlsConnection
connect(sigName: "notify::advertised-protocols", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::advertised-protocols", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::advertised-protocols", ...args: any[]): void
connect(sigName: "notify::base-socket", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::base-socket", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::base-socket", ...args: any[]): void
connect(sigName: "notify::certificate", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::certificate", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::certificate", ...args: any[]): void
connect(sigName: "notify::ciphersuite-name", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::ciphersuite-name", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::ciphersuite-name", ...args: any[]): void
connect(sigName: "notify::database", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::database", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::database", ...args: any[]): void
connect(sigName: "notify::interaction", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::interaction", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::interaction", ...args: any[]): void
connect(sigName: "notify::negotiated-protocol", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::negotiated-protocol", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::negotiated-protocol", ...args: any[]): void
connect(sigName: "notify::peer-certificate", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::peer-certificate", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::peer-certificate", ...args: any[]): void
connect(sigName: "notify::peer-certificate-errors", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::peer-certificate-errors", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::peer-certificate-errors", ...args: any[]): void
connect(sigName: "notify::protocol-version", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::protocol-version", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::protocol-version", ...args: any[]): void
connect(sigName: "notify::rehandshake-mode", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::rehandshake-mode", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::rehandshake-mode", ...args: any[]): void
connect(sigName: "notify::require-close-notify", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::require-close-notify", callback: (($obj: DtlsConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::require-close-notify", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GDtlsConnection is the base DTLS connection class type, which wraps
* a #GDatagramBased and provides DTLS encryption on top of it. Its
* subclasses, #GDtlsClientConnection and #GDtlsServerConnection,
* implement client-side and server-side DTLS, respectively.
*
* For TLS support, see #GTlsConnection.
*
* As DTLS is datagram based, #GDtlsConnection implements #GDatagramBased,
* presenting a datagram-socket-like API for the encrypted connection. This
* operates over a base datagram connection, which is also a #GDatagramBased
* (#GDtlsConnection:base-socket).
*
* To close a DTLS connection, use g_dtls_connection_close().
*
* Neither #GDtlsServerConnection or #GDtlsClientConnection set the peer address
* on their base #GDatagramBased if it is a #GSocket — it is up to the caller to
* do that if they wish. If they do not, and g_socket_close() is called on the
* base socket, the #GDtlsConnection will not raise a %G_IO_ERROR_NOT_CONNECTED
* error on further I/O.
* @interface
*/
export class DtlsConnection extends GObject.Object {
// Own properties of Gio-2.0.Gio.DtlsConnection
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DtlsConnection
constructor(config?: DtlsConnection.ConstructorProperties)
_init(config?: DtlsConnection.ConstructorProperties): void
}
export module DtlsServerConnection {
// Constructor properties interface
export interface ConstructorProperties extends DatagramBased.ConstructorProperties, DtlsConnection.ConstructorProperties, GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.DtlsServerConnection
/**
* The #GTlsAuthenticationMode for the server. This can be changed
* before calling g_dtls_connection_handshake() if you want to
* rehandshake with a different mode from the initial handshake.
*/
authentication_mode?: TlsAuthenticationMode | null
}
}
export interface DtlsServerConnection extends DatagramBased, DtlsConnection {
// Own properties of Gio-2.0.Gio.DtlsServerConnection
/**
* The #GTlsAuthenticationMode for the server. This can be changed
* before calling g_dtls_connection_handshake() if you want to
* rehandshake with a different mode from the initial handshake.
*/
authentication_mode: TlsAuthenticationMode
// Class property signals of Gio-2.0.Gio.DtlsServerConnection
connect(sigName: "notify::authentication-mode", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::authentication-mode", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::authentication-mode", ...args: any[]): void
connect(sigName: "notify::advertised-protocols", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::advertised-protocols", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::advertised-protocols", ...args: any[]): void
connect(sigName: "notify::base-socket", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::base-socket", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::base-socket", ...args: any[]): void
connect(sigName: "notify::certificate", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::certificate", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::certificate", ...args: any[]): void
connect(sigName: "notify::ciphersuite-name", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::ciphersuite-name", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::ciphersuite-name", ...args: any[]): void
connect(sigName: "notify::database", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::database", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::database", ...args: any[]): void
connect(sigName: "notify::interaction", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::interaction", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::interaction", ...args: any[]): void
connect(sigName: "notify::negotiated-protocol", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::negotiated-protocol", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::negotiated-protocol", ...args: any[]): void
connect(sigName: "notify::peer-certificate", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::peer-certificate", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::peer-certificate", ...args: any[]): void
connect(sigName: "notify::peer-certificate-errors", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::peer-certificate-errors", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::peer-certificate-errors", ...args: any[]): void
connect(sigName: "notify::protocol-version", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::protocol-version", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::protocol-version", ...args: any[]): void
connect(sigName: "notify::rehandshake-mode", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::rehandshake-mode", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::rehandshake-mode", ...args: any[]): void
connect(sigName: "notify::require-close-notify", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::require-close-notify", callback: (($obj: DtlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::require-close-notify", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GDtlsServerConnection is the server-side subclass of #GDtlsConnection,
* representing a server-side DTLS connection.
* @interface
*/
export class DtlsServerConnection extends GObject.Object {
// Own properties of Gio-2.0.Gio.DtlsServerConnection
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DtlsServerConnection
constructor(config?: DtlsServerConnection.ConstructorProperties)
_init(config?: DtlsServerConnection.ConstructorProperties): void
/**
* Creates a new #GDtlsServerConnection wrapping `base_socket`.
* @param base_socket the #GDatagramBased to wrap
* @param certificate the default server certificate, or %NULL
* @returns the new #GDtlsServerConnection, or %NULL on error
*/
static new(base_socket: DatagramBased, certificate: TlsCertificate | null): DtlsServerConnection
}
export module File {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface File {
// Owm methods of Gio-2.0.Gio.File
/**
* Gets an output stream for appending data to the file.
* If the file doesn't already exist it is created.
*
* By default files created are generally readable by everyone,
* but if you pass %G_FILE_CREATE_PRIVATE in `flags` the file
* will be made readable only to the current user, to the level that
* is supported on the target filesystem.
*
* If `cancellable` is not %NULL, then the operation can be cancelled
* by triggering the cancellable object from another thread. If the
* operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
* returned.
*
* Some file systems don't allow all file names, and may return an
* %G_IO_ERROR_INVALID_FILENAME error. If the file is a directory the
* %G_IO_ERROR_IS_DIRECTORY error will be returned. Other errors are
* possible too, and depend on what kind of filesystem the file is on.
* @param flags a set of #GFileCreateFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileOutputStream, or %NULL on error. Free the returned object with g_object_unref().
*/
append_to(flags: FileCreateFlags, cancellable: Cancellable | null): FileOutputStream
/**
* Asynchronously opens `file` for appending.
*
* For more details, see g_file_append_to() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_append_to_finish() to get the result
* of the operation.
* @param flags a set of #GFileCreateFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
append_to_async(flags: FileCreateFlags, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of append_to_async
/**
* Promisified version of {@link append_to_async}
*
* Asynchronously opens `file` for appending.
*
* For more details, see g_file_append_to() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_append_to_finish() to get the result
* of the operation.
* @param flags a set of #GFileCreateFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: a valid #GFileOutputStream or %NULL on error. Free the returned object with g_object_unref().
*/
append_to_async(flags: FileCreateFlags, io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes an asynchronous file append operation started with
* g_file_append_to_async().
* @param res #GAsyncResult
* @returns a valid #GFileOutputStream or %NULL on error. Free the returned object with g_object_unref().
*/
append_to_finish(res: AsyncResult): FileOutputStream
/**
* Prepares the file attribute query string for copying to `file`.
*
* This function prepares an attribute query string to be
* passed to g_file_query_info() to get a list of attributes
* normally copied with the file (see g_file_copy_attributes()
* for the detailed description). This function is used by the
* implementation of g_file_copy_attributes() and is useful
* when one needs to query and set the attributes in two
* stages (e.g., for recursive move of a directory).
* @param flags a set of #GFileCopyFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns an attribute query string for g_file_query_info(), or %NULL if an error occurs.
*/
build_attribute_list_for_copy(flags: FileCopyFlags, cancellable: Cancellable | null): string | null
/**
* Copies the file `source` to the location specified by `destination`.
* Can not handle recursive copies of directories.
*
* If the flag %G_FILE_COPY_OVERWRITE is specified an already
* existing `destination` file is overwritten.
*
* If the flag %G_FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks
* will be copied as symlinks, otherwise the target of the
* `source` symlink will be copied.
*
* If the flag %G_FILE_COPY_ALL_METADATA is specified then all the metadata
* that is possible to copy is copied, not just the default subset (which,
* for instance, does not include the owner, see #GFileInfo).
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* If `progress_callback` is not %NULL, then the operation can be monitored
* by setting this to a #GFileProgressCallback function.
* `progress_callback_data` will be passed to this function. It is guaranteed
* that this callback will be called after all data has been transferred with
* the total number of bytes copied during the operation.
*
* If the `source` file does not exist, then the %G_IO_ERROR_NOT_FOUND error
* is returned, independent on the status of the `destination`.
*
* If %G_FILE_COPY_OVERWRITE is not specified and the target exists, then
* the error %G_IO_ERROR_EXISTS is returned.
*
* If trying to overwrite a file over a directory, the %G_IO_ERROR_IS_DIRECTORY
* error is returned. If trying to overwrite a directory with a directory the
* %G_IO_ERROR_WOULD_MERGE error is returned.
*
* If the source is a directory and the target does not exist, or
* %G_FILE_COPY_OVERWRITE is specified and the target is a file, then the
* %G_IO_ERROR_WOULD_RECURSE error is returned.
*
* If you are interested in copying the #GFile object itself (not the on-disk
* file), see g_file_dup().
* @param destination destination #GFile
* @param flags set of #GFileCopyFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param progress_callback function to callback with progress information, or %NULL if progress information is not needed
* @returns %TRUE on success, %FALSE otherwise.
*/
copy(destination: File, flags: FileCopyFlags, cancellable: Cancellable | null, progress_callback: FileProgressCallback | null): boolean
/**
* Copies the file `source` to the location specified by `destination`
* asynchronously. For details of the behaviour, see g_file_copy().
*
* If `progress_callback` is not %NULL, then that function that will be called
* just like in g_file_copy(). The callback will run in the default main context
* of the thread calling g_file_copy_async() — the same context as `callback` is
* run in.
*
* When the operation is finished, `callback` will be called. You can then call
* g_file_copy_finish() to get the result of the operation.
* @param destination destination #GFile
* @param flags set of #GFileCopyFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param progress_callback function to callback with progress information, or %NULL if progress information is not needed
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
copy_async(destination: File, flags: FileCopyFlags, io_priority: number, cancellable: Cancellable | null, progress_callback: FileProgressCallback | null, callback: AsyncReadyCallback | null): void
// Overloads of copy_async
/**
* Promisified version of {@link copy_async}
*
* Copies the file `source` to the location specified by `destination`
* asynchronously. For details of the behaviour, see g_file_copy().
*
* If `progress_callback` is not %NULL, then that function that will be called
* just like in g_file_copy(). The callback will run in the default main context
* of the thread calling g_file_copy_async() — the same context as `callback` is
* run in.
*
* When the operation is finished, `callback` will be called. You can then call
* g_file_copy_finish() to get the result of the operation.
* @param destination destination #GFile
* @param flags set of #GFileCopyFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param progress_callback function to callback with progress information, or %NULL if progress information is not needed
* @returns A Promise of: a %TRUE on success, %FALSE on error.
*/
copy_async(destination: File, flags: FileCopyFlags, io_priority: number, cancellable: Cancellable | null, progress_callback: FileProgressCallback | null): globalThis.Promise
/**
* Copies the file attributes from `source` to `destination`.
*
* Normally only a subset of the file attributes are copied,
* those that are copies in a normal file copy operation
* (which for instance does not include e.g. owner). However
* if %G_FILE_COPY_ALL_METADATA is specified in `flags,` then
* all the metadata that is possible to copy is copied. This
* is useful when implementing move by copy + delete source.
* @param destination a #GFile to copy attributes to
* @param flags a set of #GFileCopyFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE if the attributes were copied successfully, %FALSE otherwise.
*/
copy_attributes(destination: File, flags: FileCopyFlags, cancellable: Cancellable | null): boolean
/**
* Finishes copying the file started with g_file_copy_async().
* @param res a #GAsyncResult
* @returns a %TRUE on success, %FALSE on error.
*/
copy_finish(res: AsyncResult): boolean
/**
* Creates a new file and returns an output stream for writing to it.
* The file must not already exist.
*
* By default files created are generally readable by everyone,
* but if you pass %G_FILE_CREATE_PRIVATE in `flags` the file
* will be made readable only to the current user, to the level
* that is supported on the target filesystem.
*
* If `cancellable` is not %NULL, then the operation can be cancelled
* by triggering the cancellable object from another thread. If the
* operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
* returned.
*
* If a file or directory with this name already exists the
* %G_IO_ERROR_EXISTS error will be returned. Some file systems don't
* allow all file names, and may return an %G_IO_ERROR_INVALID_FILENAME
* error, and if the name is to long %G_IO_ERROR_FILENAME_TOO_LONG will
* be returned. Other errors are possible too, and depend on what kind
* of filesystem the file is on.
* @param flags a set of #GFileCreateFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileOutputStream for the newly created file, or %NULL on error. Free the returned object with g_object_unref().
*/
create(flags: FileCreateFlags, cancellable: Cancellable | null): FileOutputStream
/**
* Asynchronously creates a new file and returns an output stream
* for writing to it. The file must not already exist.
*
* For more details, see g_file_create() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_create_finish() to get the result
* of the operation.
* @param flags a set of #GFileCreateFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
create_async(flags: FileCreateFlags, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of create_async
/**
* Promisified version of {@link create_async}
*
* Asynchronously creates a new file and returns an output stream
* for writing to it. The file must not already exist.
*
* For more details, see g_file_create() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_create_finish() to get the result
* of the operation.
* @param flags a set of #GFileCreateFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: a #GFileOutputStream or %NULL on error. Free the returned object with g_object_unref().
*/
create_async(flags: FileCreateFlags, io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes an asynchronous file create operation started with
* g_file_create_async().
* @param res a #GAsyncResult
* @returns a #GFileOutputStream or %NULL on error. Free the returned object with g_object_unref().
*/
create_finish(res: AsyncResult): FileOutputStream
/**
* Creates a new file and returns a stream for reading and
* writing to it. The file must not already exist.
*
* By default files created are generally readable by everyone,
* but if you pass %G_FILE_CREATE_PRIVATE in `flags` the file
* will be made readable only to the current user, to the level
* that is supported on the target filesystem.
*
* If `cancellable` is not %NULL, then the operation can be cancelled
* by triggering the cancellable object from another thread. If the
* operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
* returned.
*
* If a file or directory with this name already exists, the
* %G_IO_ERROR_EXISTS error will be returned. Some file systems don't
* allow all file names, and may return an %G_IO_ERROR_INVALID_FILENAME
* error, and if the name is too long, %G_IO_ERROR_FILENAME_TOO_LONG
* will be returned. Other errors are possible too, and depend on what
* kind of filesystem the file is on.
*
* Note that in many non-local file cases read and write streams are
* not supported, so make sure you really need to do read and write
* streaming, rather than just opening for reading or writing.
* @param flags a set of #GFileCreateFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileIOStream for the newly created file, or %NULL on error. Free the returned object with g_object_unref().
*/
create_readwrite(flags: FileCreateFlags, cancellable: Cancellable | null): FileIOStream
/**
* Asynchronously creates a new file and returns a stream
* for reading and writing to it. The file must not already exist.
*
* For more details, see g_file_create_readwrite() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_create_readwrite_finish() to get
* the result of the operation.
* @param flags a set of #GFileCreateFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
create_readwrite_async(flags: FileCreateFlags, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of create_readwrite_async
/**
* Promisified version of {@link create_readwrite_async}
*
* Asynchronously creates a new file and returns a stream
* for reading and writing to it. The file must not already exist.
*
* For more details, see g_file_create_readwrite() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_create_readwrite_finish() to get
* the result of the operation.
* @param flags a set of #GFileCreateFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: a #GFileIOStream or %NULL on error. Free the returned object with g_object_unref().
*/
create_readwrite_async(flags: FileCreateFlags, io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes an asynchronous file create operation started with
* g_file_create_readwrite_async().
* @param res a #GAsyncResult
* @returns a #GFileIOStream or %NULL on error. Free the returned object with g_object_unref().
*/
create_readwrite_finish(res: AsyncResult): FileIOStream
/**
* Deletes a file. If the `file` is a directory, it will only be
* deleted if it is empty. This has the same semantics as g_unlink().
*
* If `file` doesn’t exist, %G_IO_ERROR_NOT_FOUND will be returned. This allows
* for deletion to be implemented avoiding
* [time-of-check to time-of-use races](https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use):
*
* ```
* g_autoptr(GError) local_error = NULL;
* if (!g_file_delete (my_file, my_cancellable, &local_error) &&
* !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
* {
* // deletion failed for some reason other than the file not existing:
* // so report the error
* g_warning ("Failed to delete %s: %s",
* g_file_peek_path (my_file), local_error->message);
* }
* ```
*
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE if the file was deleted. %FALSE otherwise.
*/
delete(cancellable: Cancellable | null): boolean
/**
* Asynchronously delete a file. If the `file` is a directory, it will
* only be deleted if it is empty. This has the same semantics as
* g_unlink().
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
delete_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of delete_async
/**
* Promisified version of {@link delete_async}
*
* Asynchronously delete a file. If the `file` is a directory, it will
* only be deleted if it is empty. This has the same semantics as
* g_unlink().
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: %TRUE if the file was deleted. %FALSE otherwise.
*/
delete_async(io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes deleting a file started with g_file_delete_async().
* @param result a #GAsyncResult
* @returns %TRUE if the file was deleted. %FALSE otherwise.
*/
delete_finish(result: AsyncResult): boolean
/**
* Duplicates a #GFile handle. This operation does not duplicate
* the actual file or directory represented by the #GFile; see
* g_file_copy() if attempting to copy a file.
*
* g_file_dup() is useful when a second handle is needed to the same underlying
* file, for use in a separate thread (#GFile is not thread-safe). For use
* within the same thread, use g_object_ref() to increment the existing object’s
* reference count.
*
* This call does no blocking I/O.
* @returns a new #GFile that is a duplicate of the given #GFile.
*/
dup(): File
/**
* Starts an asynchronous eject on a mountable.
* When this operation has completed, `callback` will be called with
* `user_user` data, and the operation can be finalized with
* g_file_eject_mountable_finish().
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param flags flags affecting the operation
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
eject_mountable(flags: MountUnmountFlags, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous eject operation started by
* g_file_eject_mountable().
* @param result a #GAsyncResult
* @returns %TRUE if the @file was ejected successfully. %FALSE otherwise.
*/
eject_mountable_finish(result: AsyncResult): boolean
/**
* Starts an asynchronous eject on a mountable.
* When this operation has completed, `callback` will be called with
* `user_user` data, and the operation can be finalized with
* g_file_eject_mountable_with_operation_finish().
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param flags flags affecting the operation
* @param mount_operation a #GMountOperation, or %NULL to avoid user interaction
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
eject_mountable_with_operation(flags: MountUnmountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous eject operation started by
* g_file_eject_mountable_with_operation().
* @param result a #GAsyncResult
* @returns %TRUE if the @file was ejected successfully. %FALSE otherwise.
*/
eject_mountable_with_operation_finish(result: AsyncResult): boolean
/**
* Gets the requested information about the files in a directory.
* The result is a #GFileEnumerator object that will give out
* #GFileInfo objects for all the files in the directory.
*
* The `attributes` value is a string that specifies the file
* attributes that should be gathered. It is not an error if
* it's not possible to read a particular requested attribute
* from a file - it just won't be set. `attributes` should
* be a comma-separated list of attributes or attribute wildcards.
* The wildcard "*" means all attributes, and a wildcard like
* "standard::*" means all attributes in the standard namespace.
* An example attribute query be "standard::*,owner::user".
* The standard attributes are available as defines, like
* %G_FILE_ATTRIBUTE_STANDARD_NAME. %G_FILE_ATTRIBUTE_STANDARD_NAME should
* always be specified if you plan to call g_file_enumerator_get_child() or
* g_file_enumerator_iterate() on the returned enumerator.
*
* If `cancellable` is not %NULL, then the operation can be cancelled
* by triggering the cancellable object from another thread. If the
* operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
* returned.
*
* If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will
* be returned. If the file is not a directory, the %G_IO_ERROR_NOT_DIRECTORY
* error will be returned. Other errors are possible too.
* @param attributes an attribute query string
* @param flags a set of #GFileQueryInfoFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A #GFileEnumerator if successful, %NULL on error. Free the returned object with g_object_unref().
*/
enumerate_children(attributes: string | null, flags: FileQueryInfoFlags, cancellable: Cancellable | null): FileEnumerator
/**
* Asynchronously gets the requested information about the files
* in a directory. The result is a #GFileEnumerator object that will
* give out #GFileInfo objects for all the files in the directory.
*
* For more details, see g_file_enumerate_children() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called. You can
* then call g_file_enumerate_children_finish() to get the result of
* the operation.
* @param attributes an attribute query string
* @param flags a set of #GFileQueryInfoFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
enumerate_children_async(attributes: string | null, flags: FileQueryInfoFlags, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of enumerate_children_async
/**
* Promisified version of {@link enumerate_children_async}
*
* Asynchronously gets the requested information about the files
* in a directory. The result is a #GFileEnumerator object that will
* give out #GFileInfo objects for all the files in the directory.
*
* For more details, see g_file_enumerate_children() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called. You can
* then call g_file_enumerate_children_finish() to get the result of
* the operation.
* @param attributes an attribute query string
* @param flags a set of #GFileQueryInfoFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: a #GFileEnumerator or %NULL if an error occurred. Free the returned object with g_object_unref().
*/
enumerate_children_async(attributes: string | null, flags: FileQueryInfoFlags, io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes an async enumerate children operation.
* See g_file_enumerate_children_async().
* @param res a #GAsyncResult
* @returns a #GFileEnumerator or %NULL if an error occurred. Free the returned object with g_object_unref().
*/
enumerate_children_finish(res: AsyncResult): FileEnumerator
/**
* Checks if the two given #GFiles refer to the same file.
*
* Note that two #GFiles that differ can still refer to the same
* file on the filesystem due to various forms of filename
* aliasing.
*
* This call does no blocking I/O.
* @param file2 the second #GFile
* @returns %TRUE if @file1 and @file2 are equal.
*/
equal(file2: File): boolean
/**
* Gets a #GMount for the #GFile.
*
* #GMount is returned only for user interesting locations, see
* #GVolumeMonitor. If the #GFileIface for `file` does not have a #mount,
* `error` will be set to %G_IO_ERROR_NOT_FOUND and %NULL #will be returned.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GMount where the @file is located or %NULL on error. Free the returned object with g_object_unref().
*/
find_enclosing_mount(cancellable: Cancellable | null): Mount
/**
* Asynchronously gets the mount for the file.
*
* For more details, see g_file_find_enclosing_mount() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_find_enclosing_mount_finish() to
* get the result of the operation.
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
find_enclosing_mount_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of find_enclosing_mount_async
/**
* Promisified version of {@link find_enclosing_mount_async}
*
* Asynchronously gets the mount for the file.
*
* For more details, see g_file_find_enclosing_mount() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_find_enclosing_mount_finish() to
* get the result of the operation.
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: #GMount for given @file or %NULL on error. Free the returned object with g_object_unref().
*/
find_enclosing_mount_async(io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes an asynchronous find mount request.
* See g_file_find_enclosing_mount_async().
* @param res a #GAsyncResult
* @returns #GMount for given @file or %NULL on error. Free the returned object with g_object_unref().
*/
find_enclosing_mount_finish(res: AsyncResult): Mount
/**
* Gets the base name (the last component of the path) for a given #GFile.
*
* If called for the top level of a system (such as the filesystem root
* or a uri like sftp://host/) it will return a single directory separator
* (and on Windows, possibly a drive letter).
*
* The base name is a byte string (not UTF-8). It has no defined encoding
* or rules other than it may not contain zero bytes. If you want to use
* filenames in a user interface you should use the display name that you
* can get by requesting the %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME
* attribute with g_file_query_info().
*
* This call does no blocking I/O.
* @returns string containing the #GFile's base name, or %NULL if given #GFile is invalid. The returned string should be freed with g_free() when no longer needed.
*/
get_basename(): string | null
/**
* Gets a child of `file` with basename equal to `name`.
*
* Note that the file with that specific name might not exist, but
* you can still have a #GFile that points to it. You can use this
* for instance to create that file.
*
* This call does no blocking I/O.
* @param name string containing the child's basename
* @returns a #GFile to a child specified by @name. Free the returned object with g_object_unref().
*/
get_child(name: string): File
/**
* Gets the child of `file` for a given `display_name` (i.e. a UTF-8
* version of the name). If this function fails, it returns %NULL
* and `error` will be set. This is very useful when constructing a
* #GFile for a new file and the user entered the filename in the
* user interface, for instance when you select a directory and
* type a filename in the file selector.
*
* This call does no blocking I/O.
* @param display_name string to a possible child
* @returns a #GFile to the specified child, or %NULL if the display name couldn't be converted. Free the returned object with g_object_unref().
*/
get_child_for_display_name(display_name: string | null): File
/**
* Gets the parent directory for the `file`.
* If the `file` represents the root directory of the
* file system, then %NULL will be returned.
*
* This call does no blocking I/O.
* @returns a #GFile structure to the parent of the given #GFile or %NULL if there is no parent. Free the returned object with g_object_unref().
*/
get_parent(): File | null
/**
* Gets the parse name of the `file`.
* A parse name is a UTF-8 string that describes the
* file such that one can get the #GFile back using
* g_file_parse_name().
*
* This is generally used to show the #GFile as a nice
* full-pathname kind of string in a user interface,
* like in a location entry.
*
* For local files with names that can safely be converted
* to UTF-8 the pathname is used, otherwise the IRI is used
* (a form of URI that allows UTF-8 characters unescaped).
*
* This call does no blocking I/O.
* @returns a string containing the #GFile's parse name. The returned string should be freed with g_free() when no longer needed.
*/
get_parse_name(): string | null
/**
* Gets the local pathname for #GFile, if one exists. If non-%NULL, this is
* guaranteed to be an absolute, canonical path. It might contain symlinks.
*
* This call does no blocking I/O.
* @returns string containing the #GFile's path, or %NULL if no such path exists. The returned string should be freed with g_free() when no longer needed.
*/
get_path(): string | null
/**
* Gets the path for `descendant` relative to `parent`.
*
* This call does no blocking I/O.
* @param descendant input #GFile
* @returns string with the relative path from @descendant to @parent, or %NULL if @descendant doesn't have @parent as prefix. The returned string should be freed with g_free() when no longer needed.
*/
get_relative_path(descendant: File): string | null
/**
* Gets the URI for the `file`.
*
* This call does no blocking I/O.
* @returns a string containing the #GFile's URI. If the #GFile was constructed with an invalid URI, an invalid URI is returned. The returned string should be freed with g_free() when no longer needed.
*/
get_uri(): string | null
/**
* Gets the URI scheme for a #GFile.
* RFC 3986 decodes the scheme as:
*
* ```
* URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
* ```
*
* Common schemes include "file", "http", "ftp", etc.
*
* The scheme can be different from the one used to construct the #GFile,
* in that it might be replaced with one that is logically equivalent to the #GFile.
*
* This call does no blocking I/O.
* @returns a string containing the URI scheme for the given #GFile or %NULL if the #GFile was constructed with an invalid URI. The returned string should be freed with g_free() when no longer needed.
*/
get_uri_scheme(): string | null
/**
* Checks if `file` has a parent, and optionally, if it is `parent`.
*
* If `parent` is %NULL then this function returns %TRUE if `file` has any
* parent at all. If `parent` is non-%NULL then %TRUE is only returned
* if `file` is an immediate child of `parent`.
* @param parent the parent to check for, or %NULL
* @returns %TRUE if @file is an immediate child of @parent (or any parent in the case that @parent is %NULL).
*/
has_parent(parent: File | null): boolean
/**
* Checks whether `file` has the prefix specified by `prefix`.
*
* In other words, if the names of initial elements of `file'`s
* pathname match `prefix`. Only full pathname elements are matched,
* so a path like /foo is not considered a prefix of /foobar, only
* of /foo/bar.
*
* A #GFile is not a prefix of itself. If you want to check for
* equality, use g_file_equal().
*
* This call does no I/O, as it works purely on names. As such it can
* sometimes return %FALSE even if `file` is inside a `prefix` (from a
* filesystem point of view), because the prefix of `file` is an alias
* of `prefix`.
* @param prefix input #GFile
* @returns %TRUE if the @file's parent, grandparent, etc is @prefix, %FALSE otherwise.
*/
has_prefix(prefix: File): boolean
/**
* Checks to see if a #GFile has a given URI scheme.
*
* This call does no blocking I/O.
* @param uri_scheme a string containing a URI scheme
* @returns %TRUE if #GFile's backend supports the given URI scheme, %FALSE if URI scheme is %NULL, not supported, or #GFile is invalid.
*/
has_uri_scheme(uri_scheme: string | null): boolean
/**
* Creates a hash value for a #GFile.
*
* This call does no blocking I/O.
* @returns 0 if @file is not a valid #GFile, otherwise an integer that can be used as hash value for the #GFile. This function is intended for easily hashing a #GFile to add to a #GHashTable or similar data structure.
*/
hash(): number
/**
* Checks to see if a file is native to the platform.
*
* A native file is one expressed in the platform-native filename format,
* e.g. "C:\Windows" or "/usr/bin/". This does not mean the file is local,
* as it might be on a locally mounted remote filesystem.
*
* On some systems non-native files may be available using the native
* filesystem via a userspace filesystem (FUSE), in these cases this call
* will return %FALSE, but g_file_get_path() will still return a native path.
*
* This call does no blocking I/O.
* @returns %TRUE if @file is native
*/
is_native(): boolean
/**
* Loads the contents of `file` and returns it as #GBytes.
*
* If `file` is a resource:// based URI, the resulting bytes will reference the
* embedded resource instead of a copy. Otherwise, this is equivalent to calling
* g_file_load_contents() and g_bytes_new_take().
*
* For resources, `etag_out` will be set to %NULL.
*
* The data contained in the resulting #GBytes is always zero-terminated, but
* this is not included in the #GBytes length. The resulting #GBytes should be
* freed with g_bytes_unref() when no longer in use.
* @param cancellable a #GCancellable or %NULL
* @returns a #GBytes or %NULL and @error is set
*/
load_bytes(cancellable: Cancellable | null): [ /* returnType */ GLib.Bytes, /* etag_out */ string | null ]
/**
* Asynchronously loads the contents of `file` as #GBytes.
*
* If `file` is a resource:// based URI, the resulting bytes will reference the
* embedded resource instead of a copy. Otherwise, this is equivalent to calling
* g_file_load_contents_async() and g_bytes_new_take().
*
* `callback` should call g_file_load_bytes_finish() to get the result of this
* asynchronous operation.
*
* See g_file_load_bytes() for more information.
* @param cancellable a #GCancellable or %NULL
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
load_bytes_async(cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of load_bytes_async
/**
* Promisified version of {@link load_bytes_async}
*
* Asynchronously loads the contents of `file` as #GBytes.
*
* If `file` is a resource:// based URI, the resulting bytes will reference the
* embedded resource instead of a copy. Otherwise, this is equivalent to calling
* g_file_load_contents_async() and g_bytes_new_take().
*
* `callback` should call g_file_load_bytes_finish() to get the result of this
* asynchronous operation.
*
* See g_file_load_bytes() for more information.
* @param cancellable a #GCancellable or %NULL
* @returns A Promise of: a #GBytes or %NULL and @error is set
*/
load_bytes_async(cancellable: Cancellable | null): globalThis.Promise* etag_out */ string | null>
/**
* Completes an asynchronous request to g_file_load_bytes_async().
*
* For resources, `etag_out` will be set to %NULL.
*
* The data contained in the resulting #GBytes is always zero-terminated, but
* this is not included in the #GBytes length. The resulting #GBytes should be
* freed with g_bytes_unref() when no longer in use.
*
* See g_file_load_bytes() for more information.
* @param result a #GAsyncResult provided to the callback
* @returns a #GBytes or %NULL and @error is set
*/
load_bytes_finish(result: AsyncResult): [ /* returnType */ GLib.Bytes, /* etag_out */ string | null ]
/**
* Loads the content of the file into memory. The data is always
* zero-terminated, but this is not included in the resultant `length`.
* The returned `contents` should be freed with g_free() when no longer
* needed.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE if the @file's contents were successfully loaded. %FALSE if there were errors.
*/
load_contents(cancellable: Cancellable | null): [ /* returnType */ boolean, /* contents */ Uint8Array, /* etag_out */ string | null ]
/**
* Starts an asynchronous load of the `file'`s contents.
*
* For more details, see g_file_load_contents() which is
* the synchronous version of this call.
*
* When the load operation has completed, `callback` will be called
* with `user` data. To finish the operation, call
* g_file_load_contents_finish() with the #GAsyncResult returned by
* the `callback`.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
load_contents_async(cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of load_contents_async
/**
* Promisified version of {@link load_contents_async}
*
* Starts an asynchronous load of the `file'`s contents.
*
* For more details, see g_file_load_contents() which is
* the synchronous version of this call.
*
* When the load operation has completed, `callback` will be called
* with `user` data. To finish the operation, call
* g_file_load_contents_finish() with the #GAsyncResult returned by
* the `callback`.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: %TRUE if the load was successful. If %FALSE and @error is present, it will be set appropriately.
*/
load_contents_async(cancellable: Cancellable | null): globalThis.Promise<[ /* contents */ Uint8Array, /* etag_out */ string | null ]>
/**
* Finishes an asynchronous load of the `file'`s contents.
* The contents are placed in `contents,` and `length` is set to the
* size of the `contents` string. The `contents` should be freed with
* g_free() when no longer needed. If `etag_out` is present, it will be
* set to the new entity tag for the `file`.
* @param res a #GAsyncResult
* @returns %TRUE if the load was successful. If %FALSE and @error is present, it will be set appropriately.
*/
load_contents_finish(res: AsyncResult): [ /* returnType */ boolean, /* contents */ Uint8Array, /* etag_out */ string | null ]
/**
* Finishes an asynchronous partial load operation that was started
* with g_file_load_partial_contents_async(). The data is always
* zero-terminated, but this is not included in the resultant `length`.
* The returned `contents` should be freed with g_free() when no longer
* needed.
* @param res a #GAsyncResult
* @returns %TRUE if the load was successful. If %FALSE and @error is present, it will be set appropriately.
*/
load_partial_contents_finish(res: AsyncResult): [ /* returnType */ boolean, /* contents */ Uint8Array, /* etag_out */ string | null ]
/**
* Creates a directory. Note that this will only create a child directory
* of the immediate parent directory of the path or URI given by the #GFile.
* To recursively create directories, see g_file_make_directory_with_parents().
* This function will fail if the parent directory does not exist, setting
* `error` to %G_IO_ERROR_NOT_FOUND. If the file system doesn't support
* creating directories, this function will fail, setting `error` to
* %G_IO_ERROR_NOT_SUPPORTED.
*
* For a local #GFile the newly created directory will have the default
* (current) ownership and permissions of the current process.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE on successful creation, %FALSE otherwise.
*/
make_directory(cancellable: Cancellable | null): boolean
/**
* Asynchronously creates a directory.
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
make_directory_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of make_directory_async
/**
* Promisified version of {@link make_directory_async}
*
* Asynchronously creates a directory.
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: %TRUE on successful directory creation, %FALSE otherwise.
*/
make_directory_async(io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes an asynchronous directory creation, started with
* g_file_make_directory_async().
* @param result a #GAsyncResult
* @returns %TRUE on successful directory creation, %FALSE otherwise.
*/
make_directory_finish(result: AsyncResult): boolean
/**
* Creates a directory and any parent directories that may not
* exist similar to 'mkdir -p'. If the file system does not support
* creating directories, this function will fail, setting `error` to
* %G_IO_ERROR_NOT_SUPPORTED. If the directory itself already exists,
* this function will fail setting `error` to %G_IO_ERROR_EXISTS, unlike
* the similar g_mkdir_with_parents().
*
* For a local #GFile the newly created directories will have the default
* (current) ownership and permissions of the current process.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE if all directories have been successfully created, %FALSE otherwise.
*/
make_directory_with_parents(cancellable: Cancellable | null): boolean
/**
* Creates a symbolic link named `file` which contains the string
* `symlink_value`.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param symlink_value a string with the path for the target of the new symlink
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE on the creation of a new symlink, %FALSE otherwise.
*/
make_symbolic_link(symlink_value: string, cancellable: Cancellable | null): boolean
/**
* Asynchronously creates a symbolic link named `file` which contains the
* string `symlink_value`.
* @param symlink_value a string with the path for the target of the new symlink
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
make_symbolic_link_async(symlink_value: string, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of make_symbolic_link_async
/**
* Promisified version of {@link make_symbolic_link_async}
*
* Asynchronously creates a symbolic link named `file` which contains the
* string `symlink_value`.
* @param symlink_value a string with the path for the target of the new symlink
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: %TRUE on successful directory creation, %FALSE otherwise.
*/
make_symbolic_link_async(symlink_value: string, io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes an asynchronous symbolic link creation, started with
* g_file_make_symbolic_link_async().
* @param result a #GAsyncResult
* @returns %TRUE on successful directory creation, %FALSE otherwise.
*/
make_symbolic_link_finish(result: AsyncResult): boolean
/**
* Collects the results from an earlier call to
* g_file_measure_disk_usage_async(). See g_file_measure_disk_usage() for
* more information.
* @param result the #GAsyncResult passed to your #GAsyncReadyCallback
* @returns %TRUE if successful, with the out parameters set. %FALSE otherwise, with @error set.
*/
measure_disk_usage_finish(result: AsyncResult): [ /* returnType */ boolean, /* disk_usage */ number, /* num_dirs */ number, /* num_files */ number ]
/**
* Obtains a file or directory monitor for the given file,
* depending on the type of the file.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param flags a set of #GFileMonitorFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileMonitor for the given @file, or %NULL on error. Free the returned object with g_object_unref().
*/
monitor(flags: FileMonitorFlags, cancellable: Cancellable | null): FileMonitor
/**
* Obtains a directory monitor for the given file.
* This may fail if directory monitoring is not supported.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* It does not make sense for `flags` to contain
* %G_FILE_MONITOR_WATCH_HARD_LINKS, since hard links can not be made to
* directories. It is not possible to monitor all the files in a
* directory for changes made via hard links; if you want to do this then
* you must register individual watches with g_file_monitor().
* @param flags a set of #GFileMonitorFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileMonitor for the given @file, or %NULL on error. Free the returned object with g_object_unref().
*/
monitor_directory(flags: FileMonitorFlags, cancellable: Cancellable | null): FileMonitor
/**
* Obtains a file monitor for the given file. If no file notification
* mechanism exists, then regular polling of the file is used.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* If `flags` contains %G_FILE_MONITOR_WATCH_HARD_LINKS then the monitor
* will also attempt to report changes made to the file via another
* filename (ie, a hard link). Without this flag, you can only rely on
* changes made through the filename contained in `file` to be
* reported. Using this flag may result in an increase in resource
* usage, and may not have any effect depending on the #GFileMonitor
* backend and/or filesystem type.
* @param flags a set of #GFileMonitorFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileMonitor for the given @file, or %NULL on error. Free the returned object with g_object_unref().
*/
monitor_file(flags: FileMonitorFlags, cancellable: Cancellable | null): FileMonitor
/**
* Starts a `mount_operation,` mounting the volume that contains
* the file `location`.
*
* When this operation has completed, `callback` will be called with
* `user_user` data, and the operation can be finalized with
* g_file_mount_enclosing_volume_finish().
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param flags flags affecting the operation
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied, or %NULL
*/
mount_enclosing_volume(flags: MountMountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes a mount operation started by g_file_mount_enclosing_volume().
* @param result a #GAsyncResult
* @returns %TRUE if successful. If an error has occurred, this function will return %FALSE and set @error appropriately if present.
*/
mount_enclosing_volume_finish(result: AsyncResult): boolean
/**
* Mounts a file of type G_FILE_TYPE_MOUNTABLE.
* Using `mount_operation,` you can request callbacks when, for instance,
* passwords are needed during authentication.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_mount_mountable_finish() to get
* the result of the operation.
* @param flags flags affecting the operation
* @param mount_operation a #GMountOperation, or %NULL to avoid user interaction
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
mount_mountable(flags: MountMountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes a mount operation. See g_file_mount_mountable() for details.
*
* Finish an asynchronous mount operation that was started
* with g_file_mount_mountable().
* @param result a #GAsyncResult
* @returns a #GFile or %NULL on error. Free the returned object with g_object_unref().
*/
mount_mountable_finish(result: AsyncResult): File
/**
* Tries to move the file or directory `source` to the location specified
* by `destination`. If native move operations are supported then this is
* used, otherwise a copy + delete fallback is used. The native
* implementation may support moving directories (for instance on moves
* inside the same filesystem), but the fallback code does not.
*
* If the flag %G_FILE_COPY_OVERWRITE is specified an already
* existing `destination` file is overwritten.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* If `progress_callback` is not %NULL, then the operation can be monitored
* by setting this to a #GFileProgressCallback function.
* `progress_callback_data` will be passed to this function. It is
* guaranteed that this callback will be called after all data has been
* transferred with the total number of bytes copied during the operation.
*
* If the `source` file does not exist, then the %G_IO_ERROR_NOT_FOUND
* error is returned, independent on the status of the `destination`.
*
* If %G_FILE_COPY_OVERWRITE is not specified and the target exists,
* then the error %G_IO_ERROR_EXISTS is returned.
*
* If trying to overwrite a file over a directory, the %G_IO_ERROR_IS_DIRECTORY
* error is returned. If trying to overwrite a directory with a directory the
* %G_IO_ERROR_WOULD_MERGE error is returned.
*
* If the source is a directory and the target does not exist, or
* %G_FILE_COPY_OVERWRITE is specified and the target is a file, then
* the %G_IO_ERROR_WOULD_RECURSE error may be returned (if the native
* move operation isn't available).
* @param destination #GFile pointing to the destination location
* @param flags set of #GFileCopyFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param progress_callback #GFileProgressCallback function for updates
* @returns %TRUE on successful move, %FALSE otherwise.
*/
move(destination: File, flags: FileCopyFlags, cancellable: Cancellable | null, progress_callback: FileProgressCallback | null): boolean
/**
* Asynchronously moves a file `source` to the location of `destination`. For details of the behaviour, see g_file_move().
*
* If `progress_callback` is not %NULL, then that function that will be called
* just like in g_file_move(). The callback will run in the default main context
* of the thread calling g_file_move_async() — the same context as `callback` is
* run in.
*
* When the operation is finished, `callback` will be called. You can then call
* g_file_move_finish() to get the result of the operation.
* @param destination #GFile pointing to the destination location
* @param flags set of #GFileCopyFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param progress_callback #GFileProgressCallback function for updates
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
move_async(destination: File, flags: FileCopyFlags, io_priority: number, cancellable: Cancellable | null, progress_callback: FileProgressCallback | null, callback: AsyncReadyCallback | null): void
// Overloads of move_async
/**
* Promisified version of {@link move_async}
*
* Asynchronously moves a file `source` to the location of `destination`. For details of the behaviour, see g_file_move().
*
* If `progress_callback` is not %NULL, then that function that will be called
* just like in g_file_move(). The callback will run in the default main context
* of the thread calling g_file_move_async() — the same context as `callback` is
* run in.
*
* When the operation is finished, `callback` will be called. You can then call
* g_file_move_finish() to get the result of the operation.
* @param destination #GFile pointing to the destination location
* @param flags set of #GFileCopyFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param progress_callback #GFileProgressCallback function for updates
* @returns A Promise of: %TRUE on successful file move, %FALSE otherwise.
*/
move_async(destination: File, flags: FileCopyFlags, io_priority: number, cancellable: Cancellable | null, progress_callback: FileProgressCallback | null): globalThis.Promise
/**
* Finishes an asynchronous file movement, started with
* g_file_move_async().
* @param result a #GAsyncResult
* @returns %TRUE on successful file move, %FALSE otherwise.
*/
move_finish(result: AsyncResult): boolean
/**
* Opens an existing file for reading and writing. The result is
* a #GFileIOStream that can be used to read and write the contents
* of the file.
*
* If `cancellable` is not %NULL, then the operation can be cancelled
* by triggering the cancellable object from another thread. If the
* operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
* returned.
*
* If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will
* be returned. If the file is a directory, the %G_IO_ERROR_IS_DIRECTORY
* error will be returned. Other errors are possible too, and depend on
* what kind of filesystem the file is on. Note that in many non-local
* file cases read and write streams are not supported, so make sure you
* really need to do read and write streaming, rather than just opening
* for reading or writing.
* @param cancellable a #GCancellable
* @returns #GFileIOStream or %NULL on error. Free the returned object with g_object_unref().
*/
open_readwrite(cancellable: Cancellable | null): FileIOStream
/**
* Asynchronously opens `file` for reading and writing.
*
* For more details, see g_file_open_readwrite() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_open_readwrite_finish() to get
* the result of the operation.
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
open_readwrite_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of open_readwrite_async
/**
* Promisified version of {@link open_readwrite_async}
*
* Asynchronously opens `file` for reading and writing.
*
* For more details, see g_file_open_readwrite() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_open_readwrite_finish() to get
* the result of the operation.
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: a #GFileIOStream or %NULL on error. Free the returned object with g_object_unref().
*/
open_readwrite_async(io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes an asynchronous file read operation started with
* g_file_open_readwrite_async().
* @param res a #GAsyncResult
* @returns a #GFileIOStream or %NULL on error. Free the returned object with g_object_unref().
*/
open_readwrite_finish(res: AsyncResult): FileIOStream
/**
* Exactly like g_file_get_path(), but caches the result via
* g_object_set_qdata_full(). This is useful for example in C
* applications which mix `g_file_*` APIs with native ones. It
* also avoids an extra duplicated string when possible, so will be
* generally more efficient.
*
* This call does no blocking I/O.
* @returns string containing the #GFile's path, or %NULL if no such path exists. The returned string is owned by @file.
*/
peek_path(): string | null
/**
* Polls a file of type %G_FILE_TYPE_MOUNTABLE.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_mount_mountable_finish() to get
* the result of the operation.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied, or %NULL
*/
poll_mountable(cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes a poll operation. See g_file_poll_mountable() for details.
*
* Finish an asynchronous poll operation that was polled
* with g_file_poll_mountable().
* @param result a #GAsyncResult
* @returns %TRUE if the operation finished successfully. %FALSE otherwise.
*/
poll_mountable_finish(result: AsyncResult): boolean
/**
* Returns the #GAppInfo that is registered as the default
* application to handle the file specified by `file`.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GAppInfo if the handle was found, %NULL if there were errors. When you are done with it, release it with g_object_unref()
*/
query_default_handler(cancellable: Cancellable | null): AppInfo
/**
* Async version of g_file_query_default_handler().
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is done
*/
query_default_handler_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of query_default_handler_async
/**
* Promisified version of {@link query_default_handler_async}
*
* Async version of g_file_query_default_handler().
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: a #GAppInfo if the handle was found, %NULL if there were errors. When you are done with it, release it with g_object_unref()
*/
query_default_handler_async(io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes a g_file_query_default_handler_async() operation.
* @param result a #GAsyncResult
* @returns a #GAppInfo if the handle was found, %NULL if there were errors. When you are done with it, release it with g_object_unref()
*/
query_default_handler_finish(result: AsyncResult): AppInfo
/**
* Utility function to check if a particular file exists. This is
* implemented using g_file_query_info() and as such does blocking I/O.
*
* Note that in many cases it is [racy to first check for file existence](https://en.wikipedia.org/wiki/Time_of_check_to_time_of_use)
* and then execute something based on the outcome of that, because the
* file might have been created or removed in between the operations. The
* general approach to handling that is to not check, but just do the
* operation and handle the errors as they come.
*
* As an example of race-free checking, take the case of reading a file,
* and if it doesn't exist, creating it. There are two racy versions: read
* it, and on error create it; and: check if it exists, if not create it.
* These can both result in two processes creating the file (with perhaps
* a partially written file as the result). The correct approach is to
* always try to create the file with g_file_create() which will either
* atomically create the file or fail with a %G_IO_ERROR_EXISTS error.
*
* However, in many cases an existence check is useful in a user interface,
* for instance to make a menu item sensitive/insensitive, so that you don't
* have to fool users that something is possible and then just show an error
* dialog. If you do this, you should make sure to also handle the errors
* that can happen due to races when you execute the operation.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE if the file exists (and can be detected without error), %FALSE otherwise (or if cancelled).
*/
query_exists(cancellable: Cancellable | null): boolean
/**
* Utility function to inspect the #GFileType of a file. This is
* implemented using g_file_query_info() and as such does blocking I/O.
*
* The primary use case of this method is to check if a file is
* a regular file, directory, or symlink.
* @param flags a set of #GFileQueryInfoFlags passed to g_file_query_info()
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns The #GFileType of the file and %G_FILE_TYPE_UNKNOWN if the file does not exist
*/
query_file_type(flags: FileQueryInfoFlags, cancellable: Cancellable | null): FileType
/**
* Similar to g_file_query_info(), but obtains information
* about the filesystem the `file` is on, rather than the file itself.
* For instance the amount of space available and the type of
* the filesystem.
*
* The `attributes` value is a string that specifies the attributes
* that should be gathered. It is not an error if it's not possible
* to read a particular requested attribute from a file - it just
* won't be set. `attributes` should be a comma-separated list of
* attributes or attribute wildcards. The wildcard "*" means all
* attributes, and a wildcard like "filesystem::*" means all attributes
* in the filesystem namespace. The standard namespace for filesystem
* attributes is "filesystem". Common attributes of interest are
* %G_FILE_ATTRIBUTE_FILESYSTEM_SIZE (the total size of the filesystem
* in bytes), %G_FILE_ATTRIBUTE_FILESYSTEM_FREE (number of bytes available),
* and %G_FILE_ATTRIBUTE_FILESYSTEM_TYPE (type of the filesystem).
*
* If `cancellable` is not %NULL, then the operation can be cancelled
* by triggering the cancellable object from another thread. If the
* operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
* returned.
*
* If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will
* be returned. Other errors are possible too, and depend on what
* kind of filesystem the file is on.
* @param attributes an attribute query string
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileInfo or %NULL if there was an error. Free the returned object with g_object_unref().
*/
query_filesystem_info(attributes: string | null, cancellable: Cancellable | null): FileInfo
/**
* Asynchronously gets the requested information about the filesystem
* that the specified `file` is on. The result is a #GFileInfo object
* that contains key-value attributes (such as type or size for the
* file).
*
* For more details, see g_file_query_filesystem_info() which is the
* synchronous version of this call.
*
* When the operation is finished, `callback` will be called. You can
* then call g_file_query_info_finish() to get the result of the
* operation.
* @param attributes an attribute query string
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
query_filesystem_info_async(attributes: string | null, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of query_filesystem_info_async
/**
* Promisified version of {@link query_filesystem_info_async}
*
* Asynchronously gets the requested information about the filesystem
* that the specified `file` is on. The result is a #GFileInfo object
* that contains key-value attributes (such as type or size for the
* file).
*
* For more details, see g_file_query_filesystem_info() which is the
* synchronous version of this call.
*
* When the operation is finished, `callback` will be called. You can
* then call g_file_query_info_finish() to get the result of the
* operation.
* @param attributes an attribute query string
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: #GFileInfo for given @file or %NULL on error. Free the returned object with g_object_unref().
*/
query_filesystem_info_async(attributes: string | null, io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes an asynchronous filesystem info query.
* See g_file_query_filesystem_info_async().
* @param res a #GAsyncResult
* @returns #GFileInfo for given @file or %NULL on error. Free the returned object with g_object_unref().
*/
query_filesystem_info_finish(res: AsyncResult): FileInfo
/**
* Gets the requested information about specified `file`.
* The result is a #GFileInfo object that contains key-value
* attributes (such as the type or size of the file).
*
* The `attributes` value is a string that specifies the file
* attributes that should be gathered. It is not an error if
* it's not possible to read a particular requested attribute
* from a file - it just won't be set. `attributes` should be a
* comma-separated list of attributes or attribute wildcards.
* The wildcard "*" means all attributes, and a wildcard like
* "standard::*" means all attributes in the standard namespace.
* An example attribute query be "standard::*,owner::user".
* The standard attributes are available as defines, like
* %G_FILE_ATTRIBUTE_STANDARD_NAME.
*
* If `cancellable` is not %NULL, then the operation can be cancelled
* by triggering the cancellable object from another thread. If the
* operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
* returned.
*
* For symlinks, normally the information about the target of the
* symlink is returned, rather than information about the symlink
* itself. However if you pass %G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS
* in `flags` the information about the symlink itself will be returned.
* Also, for symlinks that point to non-existing files the information
* about the symlink itself will be returned.
*
* If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will be
* returned. Other errors are possible too, and depend on what kind of
* filesystem the file is on.
* @param attributes an attribute query string
* @param flags a set of #GFileQueryInfoFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileInfo for the given @file, or %NULL on error. Free the returned object with g_object_unref().
*/
query_info(attributes: string | null, flags: FileQueryInfoFlags, cancellable: Cancellable | null): FileInfo
/**
* Asynchronously gets the requested information about specified `file`.
* The result is a #GFileInfo object that contains key-value attributes
* (such as type or size for the file).
*
* For more details, see g_file_query_info() which is the synchronous
* version of this call.
*
* When the operation is finished, `callback` will be called. You can
* then call g_file_query_info_finish() to get the result of the operation.
* @param attributes an attribute query string
* @param flags a set of #GFileQueryInfoFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
query_info_async(attributes: string | null, flags: FileQueryInfoFlags, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of query_info_async
/**
* Promisified version of {@link query_info_async}
*
* Asynchronously gets the requested information about specified `file`.
* The result is a #GFileInfo object that contains key-value attributes
* (such as type or size for the file).
*
* For more details, see g_file_query_info() which is the synchronous
* version of this call.
*
* When the operation is finished, `callback` will be called. You can
* then call g_file_query_info_finish() to get the result of the operation.
* @param attributes an attribute query string
* @param flags a set of #GFileQueryInfoFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: #GFileInfo for given @file or %NULL on error. Free the returned object with g_object_unref().
*/
query_info_async(attributes: string | null, flags: FileQueryInfoFlags, io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes an asynchronous file info query.
* See g_file_query_info_async().
* @param res a #GAsyncResult
* @returns #GFileInfo for given @file or %NULL on error. Free the returned object with g_object_unref().
*/
query_info_finish(res: AsyncResult): FileInfo
/**
* Obtain the list of settable attributes for the file.
*
* Returns the type and full attribute name of all the attributes
* that can be set on this file. This doesn't mean setting it will
* always succeed though, you might get an access failure, or some
* specific file may not support a specific attribute.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileAttributeInfoList describing the settable attributes. When you are done with it, release it with g_file_attribute_info_list_unref()
*/
query_settable_attributes(cancellable: Cancellable | null): FileAttributeInfoList
/**
* Obtain the list of attribute namespaces where new attributes
* can be created by a user. An example of this is extended
* attributes (in the "xattr" namespace).
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileAttributeInfoList describing the writable namespaces. When you are done with it, release it with g_file_attribute_info_list_unref()
*/
query_writable_namespaces(cancellable: Cancellable | null): FileAttributeInfoList
/**
* Opens a file for reading. The result is a #GFileInputStream that
* can be used to read the contents of the file.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will be
* returned. If the file is a directory, the %G_IO_ERROR_IS_DIRECTORY
* error will be returned. Other errors are possible too, and depend
* on what kind of filesystem the file is on.
* @param cancellable a #GCancellable
* @returns #GFileInputStream or %NULL on error. Free the returned object with g_object_unref().
*/
read(cancellable: Cancellable | null): FileInputStream
/**
* Asynchronously opens `file` for reading.
*
* For more details, see g_file_read() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_read_finish() to get the result
* of the operation.
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
read_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of read_async
/**
* Promisified version of {@link read_async}
*
* Asynchronously opens `file` for reading.
*
* For more details, see g_file_read() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_read_finish() to get the result
* of the operation.
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: a #GFileInputStream or %NULL on error. Free the returned object with g_object_unref().
*/
read_async(io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes an asynchronous file read operation started with
* g_file_read_async().
* @param res a #GAsyncResult
* @returns a #GFileInputStream or %NULL on error. Free the returned object with g_object_unref().
*/
read_finish(res: AsyncResult): FileInputStream
/**
* Returns an output stream for overwriting the file, possibly
* creating a backup copy of the file first. If the file doesn't exist,
* it will be created.
*
* This will try to replace the file in the safest way possible so
* that any errors during the writing will not affect an already
* existing copy of the file. For instance, for local files it
* may write to a temporary file and then atomically rename over
* the destination when the stream is closed.
*
* By default files created are generally readable by everyone,
* but if you pass %G_FILE_CREATE_PRIVATE in `flags` the file
* will be made readable only to the current user, to the level that
* is supported on the target filesystem.
*
* If `cancellable` is not %NULL, then the operation can be cancelled
* by triggering the cancellable object from another thread. If the
* operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
* returned.
*
* If you pass in a non-%NULL `etag` value and `file` already exists, then
* this value is compared to the current entity tag of the file, and if
* they differ an %G_IO_ERROR_WRONG_ETAG error is returned. This
* generally means that the file has been changed since you last read
* it. You can get the new etag from g_file_output_stream_get_etag()
* after you've finished writing and closed the #GFileOutputStream. When
* you load a new file you can use g_file_input_stream_query_info() to
* get the etag of the file.
*
* If `make_backup` is %TRUE, this function will attempt to make a
* backup of the current file before overwriting it. If this fails
* a %G_IO_ERROR_CANT_CREATE_BACKUP error will be returned. If you
* want to replace anyway, try again with `make_backup` set to %FALSE.
*
* If the file is a directory the %G_IO_ERROR_IS_DIRECTORY error will
* be returned, and if the file is some other form of non-regular file
* then a %G_IO_ERROR_NOT_REGULAR_FILE error will be returned. Some
* file systems don't allow all file names, and may return an
* %G_IO_ERROR_INVALID_FILENAME error, and if the name is to long
* %G_IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors are
* possible too, and depend on what kind of filesystem the file is on.
* @param etag an optional [entity tag][gfile-etag] for the current #GFile, or #NULL to ignore
* @param make_backup %TRUE if a backup should be created
* @param flags a set of #GFileCreateFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileOutputStream or %NULL on error. Free the returned object with g_object_unref().
*/
replace(etag: string | null, make_backup: boolean, flags: FileCreateFlags, cancellable: Cancellable | null): FileOutputStream
/**
* Asynchronously overwrites the file, replacing the contents,
* possibly creating a backup copy of the file first.
*
* For more details, see g_file_replace() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_replace_finish() to get the result
* of the operation.
* @param etag an [entity tag][gfile-etag] for the current #GFile, or %NULL to ignore
* @param make_backup %TRUE if a backup should be created
* @param flags a set of #GFileCreateFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
replace_async(etag: string | null, make_backup: boolean, flags: FileCreateFlags, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of replace_async
/**
* Promisified version of {@link replace_async}
*
* Asynchronously overwrites the file, replacing the contents,
* possibly creating a backup copy of the file first.
*
* For more details, see g_file_replace() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_replace_finish() to get the result
* of the operation.
* @param etag an [entity tag][gfile-etag] for the current #GFile, or %NULL to ignore
* @param make_backup %TRUE if a backup should be created
* @param flags a set of #GFileCreateFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: a #GFileOutputStream, or %NULL on error. Free the returned object with g_object_unref().
*/
replace_async(etag: string | null, make_backup: boolean, flags: FileCreateFlags, io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Replaces the contents of `file` with `contents` of `length` bytes.
*
* If `etag` is specified (not %NULL), any existing file must have that etag,
* or the error %G_IO_ERROR_WRONG_ETAG will be returned.
*
* If `make_backup` is %TRUE, this function will attempt to make a backup
* of `file`. Internally, it uses g_file_replace(), so will try to replace the
* file contents in the safest way possible. For example, atomic renames are
* used when replacing local files’ contents.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* The returned `new_etag` can be used to verify that the file hasn't
* changed the next time it is saved over.
* @param contents a string containing the new contents for `file`
* @param etag the old [entity-tag][gfile-etag] for the document, or %NULL
* @param make_backup %TRUE if a backup should be created
* @param flags a set of #GFileCreateFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE if successful. If an error has occurred, this function will return %FALSE and set @error appropriately if present.
*/
replace_contents(contents: Uint8Array, etag: string | null, make_backup: boolean, flags: FileCreateFlags, cancellable: Cancellable | null): [ /* returnType */ boolean, /* new_etag */ string | null ]
// Has conflict: replace_contents_async(contents: Uint8Array, etag: string | null, make_backup: boolean, flags: FileCreateFlags, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of replace_contents_async
/**
* Promisified version of {@link replace_contents_async}
*
* Starts an asynchronous replacement of `file` with the given
* `contents` of `length` bytes. `etag` will replace the document's
* current entity tag.
*
* When this operation has completed, `callback` will be called with
* `user_user` data, and the operation can be finalized with
* g_file_replace_contents_finish().
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* If `make_backup` is %TRUE, this function will attempt to
* make a backup of `file`.
*
* Note that no copy of `contents` will be made, so it must stay valid
* until `callback` is called. See g_file_replace_contents_bytes_async()
* for a #GBytes version that will automatically hold a reference to the
* contents (without copying) for the duration of the call.
* @param contents string of contents to replace the file with
* @param etag a new [entity tag][gfile-etag] for the `file,` or %NULL
* @param make_backup %TRUE if a backup should be created
* @param flags a set of #GFileCreateFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: %TRUE on success, %FALSE on failure.
*/
replace_contents_async(contents: Uint8Array, etag: string | null, make_backup: boolean, flags: FileCreateFlags, cancellable: Cancellable | null): globalThis.Promise* new_etag */ string | null>
/**
* Same as g_file_replace_contents_async() but takes a #GBytes input instead.
* This function will keep a ref on `contents` until the operation is done.
* Unlike g_file_replace_contents_async() this allows forgetting about the
* content without waiting for the callback.
*
* When this operation has completed, `callback` will be called with
* `user_user` data, and the operation can be finalized with
* g_file_replace_contents_finish().
* @param contents a #GBytes
* @param etag a new [entity tag][gfile-etag] for the `file,` or %NULL
* @param make_backup %TRUE if a backup should be created
* @param flags a set of #GFileCreateFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
replace_contents_bytes_async(contents: GLib.Bytes, etag: string | null, make_backup: boolean, flags: FileCreateFlags, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous replace of the given `file`. See
* g_file_replace_contents_async(). Sets `new_etag` to the new entity
* tag for the document, if present.
* @param res a #GAsyncResult
* @returns %TRUE on success, %FALSE on failure.
*/
replace_contents_finish(res: AsyncResult): [ /* returnType */ boolean, /* new_etag */ string | null ]
/**
* Finishes an asynchronous file replace operation started with
* g_file_replace_async().
* @param res a #GAsyncResult
* @returns a #GFileOutputStream, or %NULL on error. Free the returned object with g_object_unref().
*/
replace_finish(res: AsyncResult): FileOutputStream
/**
* Returns an output stream for overwriting the file in readwrite mode,
* possibly creating a backup copy of the file first. If the file doesn't
* exist, it will be created.
*
* For details about the behaviour, see g_file_replace() which does the
* same thing but returns an output stream only.
*
* Note that in many non-local file cases read and write streams are not
* supported, so make sure you really need to do read and write streaming,
* rather than just opening for reading or writing.
* @param etag an optional [entity tag][gfile-etag] for the current #GFile, or #NULL to ignore
* @param make_backup %TRUE if a backup should be created
* @param flags a set of #GFileCreateFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileIOStream or %NULL on error. Free the returned object with g_object_unref().
*/
replace_readwrite(etag: string | null, make_backup: boolean, flags: FileCreateFlags, cancellable: Cancellable | null): FileIOStream
/**
* Asynchronously overwrites the file in read-write mode,
* replacing the contents, possibly creating a backup copy
* of the file first.
*
* For more details, see g_file_replace_readwrite() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_replace_readwrite_finish() to get
* the result of the operation.
* @param etag an [entity tag][gfile-etag] for the current #GFile, or %NULL to ignore
* @param make_backup %TRUE if a backup should be created
* @param flags a set of #GFileCreateFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
replace_readwrite_async(etag: string | null, make_backup: boolean, flags: FileCreateFlags, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of replace_readwrite_async
/**
* Promisified version of {@link replace_readwrite_async}
*
* Asynchronously overwrites the file in read-write mode,
* replacing the contents, possibly creating a backup copy
* of the file first.
*
* For more details, see g_file_replace_readwrite() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_replace_readwrite_finish() to get
* the result of the operation.
* @param etag an [entity tag][gfile-etag] for the current #GFile, or %NULL to ignore
* @param make_backup %TRUE if a backup should be created
* @param flags a set of #GFileCreateFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: a #GFileIOStream, or %NULL on error. Free the returned object with g_object_unref().
*/
replace_readwrite_async(etag: string | null, make_backup: boolean, flags: FileCreateFlags, io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes an asynchronous file replace operation started with
* g_file_replace_readwrite_async().
* @param res a #GAsyncResult
* @returns a #GFileIOStream, or %NULL on error. Free the returned object with g_object_unref().
*/
replace_readwrite_finish(res: AsyncResult): FileIOStream
/**
* Resolves a relative path for `file` to an absolute path.
*
* This call does no blocking I/O.
*
* If the `relative_path` is an absolute path name, the resolution
* is done absolutely (without taking `file` path as base).
* @param relative_path a given relative path string
* @returns a #GFile for the resolved path.
*/
resolve_relative_path(relative_path: string): File
/**
* Sets an attribute in the file with attribute name `attribute` to `value_p`.
*
* Some attributes can be unset by setting `type` to
* %G_FILE_ATTRIBUTE_TYPE_INVALID and `value_p` to %NULL.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param attribute a string containing the attribute's name
* @param type The type of the attribute
* @param value_p a pointer to the value (or the pointer itself if the type is a pointer type)
* @param flags a set of #GFileQueryInfoFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE if the attribute was set, %FALSE otherwise.
*/
set_attribute(attribute: string | null, type: FileAttributeType, value_p: any | null, flags: FileQueryInfoFlags, cancellable: Cancellable | null): boolean
/**
* Sets `attribute` of type %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING to `value`.
* If `attribute` is of a different type, this operation will fail,
* returning %FALSE.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param attribute a string containing the attribute's name
* @param value a string containing the attribute's new value
* @param flags a #GFileQueryInfoFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE if the @attribute was successfully set to @value in the @file, %FALSE otherwise.
*/
set_attribute_byte_string(attribute: string | null, value: string | null, flags: FileQueryInfoFlags, cancellable: Cancellable | null): boolean
/**
* Sets `attribute` of type %G_FILE_ATTRIBUTE_TYPE_INT32 to `value`.
* If `attribute` is of a different type, this operation will fail.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param attribute a string containing the attribute's name
* @param value a #gint32 containing the attribute's new value
* @param flags a #GFileQueryInfoFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE if the @attribute was successfully set to @value in the @file, %FALSE otherwise.
*/
set_attribute_int32(attribute: string | null, value: number, flags: FileQueryInfoFlags, cancellable: Cancellable | null): boolean
/**
* Sets `attribute` of type %G_FILE_ATTRIBUTE_TYPE_INT64 to `value`.
* If `attribute` is of a different type, this operation will fail.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param attribute a string containing the attribute's name
* @param value a #guint64 containing the attribute's new value
* @param flags a #GFileQueryInfoFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE if the @attribute was successfully set, %FALSE otherwise.
*/
set_attribute_int64(attribute: string | null, value: number, flags: FileQueryInfoFlags, cancellable: Cancellable | null): boolean
/**
* Sets `attribute` of type %G_FILE_ATTRIBUTE_TYPE_STRING to `value`.
* If `attribute` is of a different type, this operation will fail.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param attribute a string containing the attribute's name
* @param value a string containing the attribute's value
* @param flags #GFileQueryInfoFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE if the @attribute was successfully set, %FALSE otherwise.
*/
set_attribute_string(attribute: string | null, value: string | null, flags: FileQueryInfoFlags, cancellable: Cancellable | null): boolean
/**
* Sets `attribute` of type %G_FILE_ATTRIBUTE_TYPE_UINT32 to `value`.
* If `attribute` is of a different type, this operation will fail.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param attribute a string containing the attribute's name
* @param value a #guint32 containing the attribute's new value
* @param flags a #GFileQueryInfoFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE if the @attribute was successfully set to @value in the @file, %FALSE otherwise.
*/
set_attribute_uint32(attribute: string | null, value: number, flags: FileQueryInfoFlags, cancellable: Cancellable | null): boolean
/**
* Sets `attribute` of type %G_FILE_ATTRIBUTE_TYPE_UINT64 to `value`.
* If `attribute` is of a different type, this operation will fail.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param attribute a string containing the attribute's name
* @param value a #guint64 containing the attribute's new value
* @param flags a #GFileQueryInfoFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE if the @attribute was successfully set to @value in the @file, %FALSE otherwise.
*/
set_attribute_uint64(attribute: string | null, value: number, flags: FileQueryInfoFlags, cancellable: Cancellable | null): boolean
/**
* Asynchronously sets the attributes of `file` with `info`.
*
* For more details, see g_file_set_attributes_from_info(),
* which is the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_set_attributes_finish() to get
* the result of the operation.
* @param info a #GFileInfo
* @param flags a #GFileQueryInfoFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
set_attributes_async(info: FileInfo, flags: FileQueryInfoFlags, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of set_attributes_async
/**
* Promisified version of {@link set_attributes_async}
*
* Asynchronously sets the attributes of `file` with `info`.
*
* For more details, see g_file_set_attributes_from_info(),
* which is the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_set_attributes_finish() to get
* the result of the operation.
* @param info a #GFileInfo
* @param flags a #GFileQueryInfoFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: %TRUE if the attributes were set correctly, %FALSE otherwise.
*/
set_attributes_async(info: FileInfo, flags: FileQueryInfoFlags, io_priority: number, cancellable: Cancellable | null): globalThis.Promise* info */ FileInfo>
/**
* Finishes setting an attribute started in g_file_set_attributes_async().
* @param result a #GAsyncResult
* @returns %TRUE if the attributes were set correctly, %FALSE otherwise.
*/
set_attributes_finish(result: AsyncResult): [ /* returnType */ boolean, /* info */ FileInfo ]
/**
* Tries to set all attributes in the #GFileInfo on the target
* values, not stopping on the first error.
*
* If there is any error during this operation then `error` will
* be set to the first error. Error on particular fields are flagged
* by setting the "status" field in the attribute value to
* %G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING, which means you can
* also detect further errors.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param info a #GFileInfo
* @param flags #GFileQueryInfoFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %FALSE if there was any error, %TRUE otherwise.
*/
set_attributes_from_info(info: FileInfo, flags: FileQueryInfoFlags, cancellable: Cancellable | null): boolean
/**
* Renames `file` to the specified display name.
*
* The display name is converted from UTF-8 to the correct encoding
* for the target filesystem if possible and the `file` is renamed to this.
*
* If you want to implement a rename operation in the user interface the
* edit name (%G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME) should be used as the
* initial value in the rename widget, and then the result after editing
* should be passed to g_file_set_display_name().
*
* On success the resulting converted filename is returned.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param display_name a string
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFile specifying what @file was renamed to, or %NULL if there was an error. Free the returned object with g_object_unref().
*/
set_display_name(display_name: string | null, cancellable: Cancellable | null): File
/**
* Asynchronously sets the display name for a given #GFile.
*
* For more details, see g_file_set_display_name() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_set_display_name_finish() to get
* the result of the operation.
* @param display_name a string
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
set_display_name_async(display_name: string | null, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of set_display_name_async
/**
* Promisified version of {@link set_display_name_async}
*
* Asynchronously sets the display name for a given #GFile.
*
* For more details, see g_file_set_display_name() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_set_display_name_finish() to get
* the result of the operation.
* @param display_name a string
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: a #GFile or %NULL on error. Free the returned object with g_object_unref().
*/
set_display_name_async(display_name: string | null, io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes setting a display name started with
* g_file_set_display_name_async().
* @param res a #GAsyncResult
* @returns a #GFile or %NULL on error. Free the returned object with g_object_unref().
*/
set_display_name_finish(res: AsyncResult): File
/**
* Starts a file of type %G_FILE_TYPE_MOUNTABLE.
* Using `start_operation,` you can request callbacks when, for instance,
* passwords are needed during authentication.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_mount_mountable_finish() to get
* the result of the operation.
* @param flags flags affecting the operation
* @param start_operation a #GMountOperation, or %NULL to avoid user interaction
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied, or %NULL
*/
start_mountable(flags: DriveStartFlags, start_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes a start operation. See g_file_start_mountable() for details.
*
* Finish an asynchronous start operation that was started
* with g_file_start_mountable().
* @param result a #GAsyncResult
* @returns %TRUE if the operation finished successfully. %FALSE otherwise.
*/
start_mountable_finish(result: AsyncResult): boolean
/**
* Stops a file of type %G_FILE_TYPE_MOUNTABLE.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_stop_mountable_finish() to get
* the result of the operation.
* @param flags flags affecting the operation
* @param mount_operation a #GMountOperation, or %NULL to avoid user interaction.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied, or %NULL
*/
stop_mountable(flags: MountUnmountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes a stop operation, see g_file_stop_mountable() for details.
*
* Finish an asynchronous stop operation that was started
* with g_file_stop_mountable().
* @param result a #GAsyncResult
* @returns %TRUE if the operation finished successfully. %FALSE otherwise.
*/
stop_mountable_finish(result: AsyncResult): boolean
/**
* Checks if `file` supports
* [thread-default contexts][g-main-context-push-thread-default-context].
* If this returns %FALSE, you cannot perform asynchronous operations on
* `file` in a thread that has a thread-default context.
* @returns Whether or not @file supports thread-default contexts.
*/
supports_thread_contexts(): boolean
/**
* Sends `file` to the "Trashcan", if possible. This is similar to
* deleting it, but the user can recover it before emptying the trashcan.
* Not all file systems support trashing, so this call can return the
* %G_IO_ERROR_NOT_SUPPORTED error. Since GLib 2.66, the `x-gvfs-notrash` unix
* mount option can be used to disable g_file_trash() support for certain
* mounts, the %G_IO_ERROR_NOT_SUPPORTED error will be returned in that case.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE on successful trash, %FALSE otherwise.
*/
trash(cancellable: Cancellable | null): boolean
/**
* Asynchronously sends `file` to the Trash location, if possible.
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
trash_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of trash_async
/**
* Promisified version of {@link trash_async}
*
* Asynchronously sends `file` to the Trash location, if possible.
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A Promise of: %TRUE on successful trash, %FALSE otherwise.
*/
trash_async(io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes an asynchronous file trashing operation, started with
* g_file_trash_async().
* @param result a #GAsyncResult
* @returns %TRUE on successful trash, %FALSE otherwise.
*/
trash_finish(result: AsyncResult): boolean
/**
* Unmounts a file of type G_FILE_TYPE_MOUNTABLE.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_unmount_mountable_finish() to get
* the result of the operation.
* @param flags flags affecting the operation
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
unmount_mountable(flags: MountUnmountFlags, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an unmount operation, see g_file_unmount_mountable() for details.
*
* Finish an asynchronous unmount operation that was started
* with g_file_unmount_mountable().
* @param result a #GAsyncResult
* @returns %TRUE if the operation finished successfully. %FALSE otherwise.
*/
unmount_mountable_finish(result: AsyncResult): boolean
/**
* Unmounts a file of type %G_FILE_TYPE_MOUNTABLE.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_unmount_mountable_finish() to get
* the result of the operation.
* @param flags flags affecting the operation
* @param mount_operation a #GMountOperation, or %NULL to avoid user interaction
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
unmount_mountable_with_operation(flags: MountUnmountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an unmount operation,
* see g_file_unmount_mountable_with_operation() for details.
*
* Finish an asynchronous unmount operation that was started
* with g_file_unmount_mountable_with_operation().
* @param result a #GAsyncResult
* @returns %TRUE if the operation finished successfully. %FALSE otherwise.
*/
unmount_mountable_with_operation_finish(result: AsyncResult): boolean
/**
* Starts an asynchronous replacement of `file` with the given
* `contents` of `length` bytes. `etag` will replace the document's
* current entity tag.
*
* When this operation has completed, `callback` will be called with
* `user_user` data, and the operation can be finalized with
* g_file_replace_contents_finish().
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* If `make_backup` is %TRUE, this function will attempt to
* make a backup of `file`.
*
* Note that no copy of `contents` will be made, so it must stay valid
* until `callback` is called. See g_file_replace_contents_bytes_async()
* for a #GBytes version that will automatically hold a reference to the
* contents (without copying) for the duration of the call.
* @param contents string of contents to replace the file with
* @param etag a new [entity tag][gfile-etag] for the `file,` or %NULL
* @param make_backup %TRUE if a backup should be created
* @param flags a set of #GFileCreateFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
replace_contents_async(contents: Uint8Array, etag: string | null, make_backup: boolean, flags: FileCreateFlags, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Own virtual methods of Gio-2.0.Gio.File
/**
* Gets an output stream for appending data to the file.
* If the file doesn't already exist it is created.
*
* By default files created are generally readable by everyone,
* but if you pass %G_FILE_CREATE_PRIVATE in `flags` the file
* will be made readable only to the current user, to the level that
* is supported on the target filesystem.
*
* If `cancellable` is not %NULL, then the operation can be cancelled
* by triggering the cancellable object from another thread. If the
* operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
* returned.
*
* Some file systems don't allow all file names, and may return an
* %G_IO_ERROR_INVALID_FILENAME error. If the file is a directory the
* %G_IO_ERROR_IS_DIRECTORY error will be returned. Other errors are
* possible too, and depend on what kind of filesystem the file is on.
* @virtual
* @param flags a set of #GFileCreateFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileOutputStream, or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_append_to(flags: FileCreateFlags, cancellable: Cancellable | null): FileOutputStream
/**
* Asynchronously opens `file` for appending.
*
* For more details, see g_file_append_to() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_append_to_finish() to get the result
* of the operation.
* @virtual
* @param flags a set of #GFileCreateFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_append_to_async(flags: FileCreateFlags, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous file append operation started with
* g_file_append_to_async().
* @virtual
* @param res #GAsyncResult
* @returns a valid #GFileOutputStream or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_append_to_finish(res: AsyncResult): FileOutputStream
/**
* Copies the file `source` to the location specified by `destination`.
* Can not handle recursive copies of directories.
*
* If the flag %G_FILE_COPY_OVERWRITE is specified an already
* existing `destination` file is overwritten.
*
* If the flag %G_FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks
* will be copied as symlinks, otherwise the target of the
* `source` symlink will be copied.
*
* If the flag %G_FILE_COPY_ALL_METADATA is specified then all the metadata
* that is possible to copy is copied, not just the default subset (which,
* for instance, does not include the owner, see #GFileInfo).
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* If `progress_callback` is not %NULL, then the operation can be monitored
* by setting this to a #GFileProgressCallback function.
* `progress_callback_data` will be passed to this function. It is guaranteed
* that this callback will be called after all data has been transferred with
* the total number of bytes copied during the operation.
*
* If the `source` file does not exist, then the %G_IO_ERROR_NOT_FOUND error
* is returned, independent on the status of the `destination`.
*
* If %G_FILE_COPY_OVERWRITE is not specified and the target exists, then
* the error %G_IO_ERROR_EXISTS is returned.
*
* If trying to overwrite a file over a directory, the %G_IO_ERROR_IS_DIRECTORY
* error is returned. If trying to overwrite a directory with a directory the
* %G_IO_ERROR_WOULD_MERGE error is returned.
*
* If the source is a directory and the target does not exist, or
* %G_FILE_COPY_OVERWRITE is specified and the target is a file, then the
* %G_IO_ERROR_WOULD_RECURSE error is returned.
*
* If you are interested in copying the #GFile object itself (not the on-disk
* file), see g_file_dup().
* @virtual
* @param destination destination #GFile
* @param flags set of #GFileCopyFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param progress_callback function to callback with progress information, or %NULL if progress information is not needed
* @returns %TRUE on success, %FALSE otherwise.
*/
vfunc_copy(destination: File, flags: FileCopyFlags, cancellable: Cancellable | null, progress_callback: FileProgressCallback | null): boolean
/**
* Copies the file `source` to the location specified by `destination`
* asynchronously. For details of the behaviour, see g_file_copy().
*
* If `progress_callback` is not %NULL, then that function that will be called
* just like in g_file_copy(). The callback will run in the default main context
* of the thread calling g_file_copy_async() — the same context as `callback` is
* run in.
*
* When the operation is finished, `callback` will be called. You can then call
* g_file_copy_finish() to get the result of the operation.
* @virtual
* @param destination destination #GFile
* @param flags set of #GFileCopyFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param progress_callback function to callback with progress information, or %NULL if progress information is not needed
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_copy_async(destination: File, flags: FileCopyFlags, io_priority: number, cancellable: Cancellable | null, progress_callback: FileProgressCallback | null, callback: AsyncReadyCallback | null): void
/**
* Finishes copying the file started with g_file_copy_async().
* @virtual
* @param res a #GAsyncResult
* @returns a %TRUE on success, %FALSE on error.
*/
vfunc_copy_finish(res: AsyncResult): boolean
/**
* Creates a new file and returns an output stream for writing to it.
* The file must not already exist.
*
* By default files created are generally readable by everyone,
* but if you pass %G_FILE_CREATE_PRIVATE in `flags` the file
* will be made readable only to the current user, to the level
* that is supported on the target filesystem.
*
* If `cancellable` is not %NULL, then the operation can be cancelled
* by triggering the cancellable object from another thread. If the
* operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
* returned.
*
* If a file or directory with this name already exists the
* %G_IO_ERROR_EXISTS error will be returned. Some file systems don't
* allow all file names, and may return an %G_IO_ERROR_INVALID_FILENAME
* error, and if the name is to long %G_IO_ERROR_FILENAME_TOO_LONG will
* be returned. Other errors are possible too, and depend on what kind
* of filesystem the file is on.
* @virtual
* @param flags a set of #GFileCreateFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileOutputStream for the newly created file, or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_create(flags: FileCreateFlags, cancellable: Cancellable | null): FileOutputStream
/**
* Asynchronously creates a new file and returns an output stream
* for writing to it. The file must not already exist.
*
* For more details, see g_file_create() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_create_finish() to get the result
* of the operation.
* @virtual
* @param flags a set of #GFileCreateFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_create_async(flags: FileCreateFlags, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous file create operation started with
* g_file_create_async().
* @virtual
* @param res a #GAsyncResult
* @returns a #GFileOutputStream or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_create_finish(res: AsyncResult): FileOutputStream
/**
* Creates a new file and returns a stream for reading and
* writing to it. The file must not already exist.
*
* By default files created are generally readable by everyone,
* but if you pass %G_FILE_CREATE_PRIVATE in `flags` the file
* will be made readable only to the current user, to the level
* that is supported on the target filesystem.
*
* If `cancellable` is not %NULL, then the operation can be cancelled
* by triggering the cancellable object from another thread. If the
* operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
* returned.
*
* If a file or directory with this name already exists, the
* %G_IO_ERROR_EXISTS error will be returned. Some file systems don't
* allow all file names, and may return an %G_IO_ERROR_INVALID_FILENAME
* error, and if the name is too long, %G_IO_ERROR_FILENAME_TOO_LONG
* will be returned. Other errors are possible too, and depend on what
* kind of filesystem the file is on.
*
* Note that in many non-local file cases read and write streams are
* not supported, so make sure you really need to do read and write
* streaming, rather than just opening for reading or writing.
* @virtual
* @param flags a set of #GFileCreateFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileIOStream for the newly created file, or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_create_readwrite(flags: FileCreateFlags, cancellable: Cancellable | null): FileIOStream
/**
* Asynchronously creates a new file and returns a stream
* for reading and writing to it. The file must not already exist.
*
* For more details, see g_file_create_readwrite() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_create_readwrite_finish() to get
* the result of the operation.
* @virtual
* @param flags a set of #GFileCreateFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_create_readwrite_async(flags: FileCreateFlags, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous file create operation started with
* g_file_create_readwrite_async().
* @virtual
* @param res a #GAsyncResult
* @returns a #GFileIOStream or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_create_readwrite_finish(res: AsyncResult): FileIOStream
/**
* Deletes a file. If the `file` is a directory, it will only be
* deleted if it is empty. This has the same semantics as g_unlink().
*
* If `file` doesn’t exist, %G_IO_ERROR_NOT_FOUND will be returned. This allows
* for deletion to be implemented avoiding
* [time-of-check to time-of-use races](https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use):
*
* ```
* g_autoptr(GError) local_error = NULL;
* if (!g_file_delete (my_file, my_cancellable, &local_error) &&
* !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
* {
* // deletion failed for some reason other than the file not existing:
* // so report the error
* g_warning ("Failed to delete %s: %s",
* g_file_peek_path (my_file), local_error->message);
* }
* ```
*
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @virtual
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE if the file was deleted. %FALSE otherwise.
*/
vfunc_delete_file(cancellable: Cancellable | null): boolean
/**
* Asynchronously delete a file. If the `file` is a directory, it will
* only be deleted if it is empty. This has the same semantics as
* g_unlink().
* @virtual
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_delete_file_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes deleting a file started with g_file_delete_async().
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE if the file was deleted. %FALSE otherwise.
*/
vfunc_delete_file_finish(result: AsyncResult): boolean
/**
* Duplicates a #GFile handle. This operation does not duplicate
* the actual file or directory represented by the #GFile; see
* g_file_copy() if attempting to copy a file.
*
* g_file_dup() is useful when a second handle is needed to the same underlying
* file, for use in a separate thread (#GFile is not thread-safe). For use
* within the same thread, use g_object_ref() to increment the existing object’s
* reference count.
*
* This call does no blocking I/O.
* @virtual
* @returns a new #GFile that is a duplicate of the given #GFile.
*/
vfunc_dup(): File
/**
* Starts an asynchronous eject on a mountable.
* When this operation has completed, `callback` will be called with
* `user_user` data, and the operation can be finalized with
* g_file_eject_mountable_finish().
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @virtual
* @param flags flags affecting the operation
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_eject_mountable(flags: MountUnmountFlags, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous eject operation started by
* g_file_eject_mountable().
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE if the @file was ejected successfully. %FALSE otherwise.
*/
vfunc_eject_mountable_finish(result: AsyncResult): boolean
/**
* Starts an asynchronous eject on a mountable.
* When this operation has completed, `callback` will be called with
* `user_user` data, and the operation can be finalized with
* g_file_eject_mountable_with_operation_finish().
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @virtual
* @param flags flags affecting the operation
* @param mount_operation a #GMountOperation, or %NULL to avoid user interaction
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_eject_mountable_with_operation(flags: MountUnmountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous eject operation started by
* g_file_eject_mountable_with_operation().
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE if the @file was ejected successfully. %FALSE otherwise.
*/
vfunc_eject_mountable_with_operation_finish(result: AsyncResult): boolean
/**
* Gets the requested information about the files in a directory.
* The result is a #GFileEnumerator object that will give out
* #GFileInfo objects for all the files in the directory.
*
* The `attributes` value is a string that specifies the file
* attributes that should be gathered. It is not an error if
* it's not possible to read a particular requested attribute
* from a file - it just won't be set. `attributes` should
* be a comma-separated list of attributes or attribute wildcards.
* The wildcard "*" means all attributes, and a wildcard like
* "standard::*" means all attributes in the standard namespace.
* An example attribute query be "standard::*,owner::user".
* The standard attributes are available as defines, like
* %G_FILE_ATTRIBUTE_STANDARD_NAME. %G_FILE_ATTRIBUTE_STANDARD_NAME should
* always be specified if you plan to call g_file_enumerator_get_child() or
* g_file_enumerator_iterate() on the returned enumerator.
*
* If `cancellable` is not %NULL, then the operation can be cancelled
* by triggering the cancellable object from another thread. If the
* operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
* returned.
*
* If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will
* be returned. If the file is not a directory, the %G_IO_ERROR_NOT_DIRECTORY
* error will be returned. Other errors are possible too.
* @virtual
* @param attributes an attribute query string
* @param flags a set of #GFileQueryInfoFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns A #GFileEnumerator if successful, %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_enumerate_children(attributes: string | null, flags: FileQueryInfoFlags, cancellable: Cancellable | null): FileEnumerator
/**
* Asynchronously gets the requested information about the files
* in a directory. The result is a #GFileEnumerator object that will
* give out #GFileInfo objects for all the files in the directory.
*
* For more details, see g_file_enumerate_children() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called. You can
* then call g_file_enumerate_children_finish() to get the result of
* the operation.
* @virtual
* @param attributes an attribute query string
* @param flags a set of #GFileQueryInfoFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_enumerate_children_async(attributes: string | null, flags: FileQueryInfoFlags, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an async enumerate children operation.
* See g_file_enumerate_children_async().
* @virtual
* @param res a #GAsyncResult
* @returns a #GFileEnumerator or %NULL if an error occurred. Free the returned object with g_object_unref().
*/
vfunc_enumerate_children_finish(res: AsyncResult): FileEnumerator
/**
* Checks if the two given #GFiles refer to the same file.
*
* Note that two #GFiles that differ can still refer to the same
* file on the filesystem due to various forms of filename
* aliasing.
*
* This call does no blocking I/O.
* @virtual
* @param file2 the second #GFile
* @returns %TRUE if @file1 and @file2 are equal.
*/
vfunc_equal(file2: File): boolean
/**
* Gets a #GMount for the #GFile.
*
* #GMount is returned only for user interesting locations, see
* #GVolumeMonitor. If the #GFileIface for `file` does not have a #mount,
* `error` will be set to %G_IO_ERROR_NOT_FOUND and %NULL #will be returned.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @virtual
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GMount where the @file is located or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_find_enclosing_mount(cancellable: Cancellable | null): Mount
/**
* Asynchronously gets the mount for the file.
*
* For more details, see g_file_find_enclosing_mount() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_find_enclosing_mount_finish() to
* get the result of the operation.
* @virtual
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_find_enclosing_mount_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous find mount request.
* See g_file_find_enclosing_mount_async().
* @virtual
* @param res a #GAsyncResult
* @returns #GMount for given @file or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_find_enclosing_mount_finish(res: AsyncResult): Mount
/**
* Gets the base name (the last component of the path) for a given #GFile.
*
* If called for the top level of a system (such as the filesystem root
* or a uri like sftp://host/) it will return a single directory separator
* (and on Windows, possibly a drive letter).
*
* The base name is a byte string (not UTF-8). It has no defined encoding
* or rules other than it may not contain zero bytes. If you want to use
* filenames in a user interface you should use the display name that you
* can get by requesting the %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME
* attribute with g_file_query_info().
*
* This call does no blocking I/O.
* @virtual
* @returns string containing the #GFile's base name, or %NULL if given #GFile is invalid. The returned string should be freed with g_free() when no longer needed.
*/
vfunc_get_basename(): string | null
/**
* Gets the child of `file` for a given `display_name` (i.e. a UTF-8
* version of the name). If this function fails, it returns %NULL
* and `error` will be set. This is very useful when constructing a
* #GFile for a new file and the user entered the filename in the
* user interface, for instance when you select a directory and
* type a filename in the file selector.
*
* This call does no blocking I/O.
* @virtual
* @param display_name string to a possible child
* @returns a #GFile to the specified child, or %NULL if the display name couldn't be converted. Free the returned object with g_object_unref().
*/
vfunc_get_child_for_display_name(display_name: string | null): File
/**
* Gets the parent directory for the `file`.
* If the `file` represents the root directory of the
* file system, then %NULL will be returned.
*
* This call does no blocking I/O.
* @virtual
* @returns a #GFile structure to the parent of the given #GFile or %NULL if there is no parent. Free the returned object with g_object_unref().
*/
vfunc_get_parent(): File | null
/**
* Gets the parse name of the `file`.
* A parse name is a UTF-8 string that describes the
* file such that one can get the #GFile back using
* g_file_parse_name().
*
* This is generally used to show the #GFile as a nice
* full-pathname kind of string in a user interface,
* like in a location entry.
*
* For local files with names that can safely be converted
* to UTF-8 the pathname is used, otherwise the IRI is used
* (a form of URI that allows UTF-8 characters unescaped).
*
* This call does no blocking I/O.
* @virtual
* @returns a string containing the #GFile's parse name. The returned string should be freed with g_free() when no longer needed.
*/
vfunc_get_parse_name(): string | null
/**
* Gets the local pathname for #GFile, if one exists. If non-%NULL, this is
* guaranteed to be an absolute, canonical path. It might contain symlinks.
*
* This call does no blocking I/O.
* @virtual
* @returns string containing the #GFile's path, or %NULL if no such path exists. The returned string should be freed with g_free() when no longer needed.
*/
vfunc_get_path(): string | null
/**
* Gets the path for `descendant` relative to `parent`.
*
* This call does no blocking I/O.
* @virtual
* @param descendant input #GFile
* @returns string with the relative path from @descendant to @parent, or %NULL if @descendant doesn't have @parent as prefix. The returned string should be freed with g_free() when no longer needed.
*/
vfunc_get_relative_path(descendant: File): string | null
/**
* Gets the URI for the `file`.
*
* This call does no blocking I/O.
* @virtual
* @returns a string containing the #GFile's URI. If the #GFile was constructed with an invalid URI, an invalid URI is returned. The returned string should be freed with g_free() when no longer needed.
*/
vfunc_get_uri(): string | null
/**
* Gets the URI scheme for a #GFile.
* RFC 3986 decodes the scheme as:
*
* ```
* URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
* ```
*
* Common schemes include "file", "http", "ftp", etc.
*
* The scheme can be different from the one used to construct the #GFile,
* in that it might be replaced with one that is logically equivalent to the #GFile.
*
* This call does no blocking I/O.
* @virtual
* @returns a string containing the URI scheme for the given #GFile or %NULL if the #GFile was constructed with an invalid URI. The returned string should be freed with g_free() when no longer needed.
*/
vfunc_get_uri_scheme(): string | null
/**
* Checks to see if a #GFile has a given URI scheme.
*
* This call does no blocking I/O.
* @virtual
* @param uri_scheme a string containing a URI scheme
* @returns %TRUE if #GFile's backend supports the given URI scheme, %FALSE if URI scheme is %NULL, not supported, or #GFile is invalid.
*/
vfunc_has_uri_scheme(uri_scheme: string | null): boolean
/**
* Creates a hash value for a #GFile.
*
* This call does no blocking I/O.
* @virtual
* @returns 0 if @file is not a valid #GFile, otherwise an integer that can be used as hash value for the #GFile. This function is intended for easily hashing a #GFile to add to a #GHashTable or similar data structure.
*/
vfunc_hash(): number
/**
* Checks to see if a file is native to the platform.
*
* A native file is one expressed in the platform-native filename format,
* e.g. "C:\Windows" or "/usr/bin/". This does not mean the file is local,
* as it might be on a locally mounted remote filesystem.
*
* On some systems non-native files may be available using the native
* filesystem via a userspace filesystem (FUSE), in these cases this call
* will return %FALSE, but g_file_get_path() will still return a native path.
*
* This call does no blocking I/O.
* @virtual
* @returns %TRUE if @file is native
*/
vfunc_is_native(): boolean
/**
* Creates a directory. Note that this will only create a child directory
* of the immediate parent directory of the path or URI given by the #GFile.
* To recursively create directories, see g_file_make_directory_with_parents().
* This function will fail if the parent directory does not exist, setting
* `error` to %G_IO_ERROR_NOT_FOUND. If the file system doesn't support
* creating directories, this function will fail, setting `error` to
* %G_IO_ERROR_NOT_SUPPORTED.
*
* For a local #GFile the newly created directory will have the default
* (current) ownership and permissions of the current process.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @virtual
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE on successful creation, %FALSE otherwise.
*/
vfunc_make_directory(cancellable: Cancellable | null): boolean
/**
* Asynchronously creates a directory.
* @virtual
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_make_directory_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous directory creation, started with
* g_file_make_directory_async().
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE on successful directory creation, %FALSE otherwise.
*/
vfunc_make_directory_finish(result: AsyncResult): boolean
/**
* Creates a symbolic link named `file` which contains the string
* `symlink_value`.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @virtual
* @param symlink_value a string with the path for the target of the new symlink
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE on the creation of a new symlink, %FALSE otherwise.
*/
vfunc_make_symbolic_link(symlink_value: string, cancellable: Cancellable | null): boolean
/**
* Asynchronously creates a symbolic link named `file` which contains the
* string `symlink_value`.
* @virtual
* @param symlink_value a string with the path for the target of the new symlink
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_make_symbolic_link_async(symlink_value: string, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous symbolic link creation, started with
* g_file_make_symbolic_link_async().
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE on successful directory creation, %FALSE otherwise.
*/
vfunc_make_symbolic_link_finish(result: AsyncResult): boolean
/**
* Collects the results from an earlier call to
* g_file_measure_disk_usage_async(). See g_file_measure_disk_usage() for
* more information.
* @virtual
* @param result the #GAsyncResult passed to your #GAsyncReadyCallback
* @returns %TRUE if successful, with the out parameters set. %FALSE otherwise, with @error set.
*/
vfunc_measure_disk_usage_finish(result: AsyncResult): [ /* returnType */ boolean, /* disk_usage */ number, /* num_dirs */ number, /* num_files */ number ]
/**
* Obtains a directory monitor for the given file.
* This may fail if directory monitoring is not supported.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* It does not make sense for `flags` to contain
* %G_FILE_MONITOR_WATCH_HARD_LINKS, since hard links can not be made to
* directories. It is not possible to monitor all the files in a
* directory for changes made via hard links; if you want to do this then
* you must register individual watches with g_file_monitor().
* @virtual
* @param flags a set of #GFileMonitorFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileMonitor for the given @file, or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_monitor_dir(flags: FileMonitorFlags, cancellable: Cancellable | null): FileMonitor
/**
* Obtains a file monitor for the given file. If no file notification
* mechanism exists, then regular polling of the file is used.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* If `flags` contains %G_FILE_MONITOR_WATCH_HARD_LINKS then the monitor
* will also attempt to report changes made to the file via another
* filename (ie, a hard link). Without this flag, you can only rely on
* changes made through the filename contained in `file` to be
* reported. Using this flag may result in an increase in resource
* usage, and may not have any effect depending on the #GFileMonitor
* backend and/or filesystem type.
* @virtual
* @param flags a set of #GFileMonitorFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileMonitor for the given @file, or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_monitor_file(flags: FileMonitorFlags, cancellable: Cancellable | null): FileMonitor
/**
* Starts a `mount_operation,` mounting the volume that contains
* the file `location`.
*
* When this operation has completed, `callback` will be called with
* `user_user` data, and the operation can be finalized with
* g_file_mount_enclosing_volume_finish().
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @virtual
* @param flags flags affecting the operation
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied, or %NULL
*/
vfunc_mount_enclosing_volume(flags: MountMountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes a mount operation started by g_file_mount_enclosing_volume().
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE if successful. If an error has occurred, this function will return %FALSE and set @error appropriately if present.
*/
vfunc_mount_enclosing_volume_finish(result: AsyncResult): boolean
/**
* Mounts a file of type G_FILE_TYPE_MOUNTABLE.
* Using `mount_operation,` you can request callbacks when, for instance,
* passwords are needed during authentication.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_mount_mountable_finish() to get
* the result of the operation.
* @virtual
* @param flags flags affecting the operation
* @param mount_operation a #GMountOperation, or %NULL to avoid user interaction
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_mount_mountable(flags: MountMountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes a mount operation. See g_file_mount_mountable() for details.
*
* Finish an asynchronous mount operation that was started
* with g_file_mount_mountable().
* @virtual
* @param result a #GAsyncResult
* @returns a #GFile or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_mount_mountable_finish(result: AsyncResult): File
/**
* Tries to move the file or directory `source` to the location specified
* by `destination`. If native move operations are supported then this is
* used, otherwise a copy + delete fallback is used. The native
* implementation may support moving directories (for instance on moves
* inside the same filesystem), but the fallback code does not.
*
* If the flag %G_FILE_COPY_OVERWRITE is specified an already
* existing `destination` file is overwritten.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* If `progress_callback` is not %NULL, then the operation can be monitored
* by setting this to a #GFileProgressCallback function.
* `progress_callback_data` will be passed to this function. It is
* guaranteed that this callback will be called after all data has been
* transferred with the total number of bytes copied during the operation.
*
* If the `source` file does not exist, then the %G_IO_ERROR_NOT_FOUND
* error is returned, independent on the status of the `destination`.
*
* If %G_FILE_COPY_OVERWRITE is not specified and the target exists,
* then the error %G_IO_ERROR_EXISTS is returned.
*
* If trying to overwrite a file over a directory, the %G_IO_ERROR_IS_DIRECTORY
* error is returned. If trying to overwrite a directory with a directory the
* %G_IO_ERROR_WOULD_MERGE error is returned.
*
* If the source is a directory and the target does not exist, or
* %G_FILE_COPY_OVERWRITE is specified and the target is a file, then
* the %G_IO_ERROR_WOULD_RECURSE error may be returned (if the native
* move operation isn't available).
* @virtual
* @param destination #GFile pointing to the destination location
* @param flags set of #GFileCopyFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param progress_callback #GFileProgressCallback function for updates
* @returns %TRUE on successful move, %FALSE otherwise.
*/
vfunc_move(destination: File, flags: FileCopyFlags, cancellable: Cancellable | null, progress_callback: FileProgressCallback | null): boolean
/**
* Asynchronously moves a file `source` to the location of `destination`. For details of the behaviour, see g_file_move().
*
* If `progress_callback` is not %NULL, then that function that will be called
* just like in g_file_move(). The callback will run in the default main context
* of the thread calling g_file_move_async() — the same context as `callback` is
* run in.
*
* When the operation is finished, `callback` will be called. You can then call
* g_file_move_finish() to get the result of the operation.
* @virtual
* @param destination #GFile pointing to the destination location
* @param flags set of #GFileCopyFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param progress_callback #GFileProgressCallback function for updates
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_move_async(destination: File, flags: FileCopyFlags, io_priority: number, cancellable: Cancellable | null, progress_callback: FileProgressCallback | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous file movement, started with
* g_file_move_async().
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE on successful file move, %FALSE otherwise.
*/
vfunc_move_finish(result: AsyncResult): boolean
/**
* Opens an existing file for reading and writing. The result is
* a #GFileIOStream that can be used to read and write the contents
* of the file.
*
* If `cancellable` is not %NULL, then the operation can be cancelled
* by triggering the cancellable object from another thread. If the
* operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
* returned.
*
* If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will
* be returned. If the file is a directory, the %G_IO_ERROR_IS_DIRECTORY
* error will be returned. Other errors are possible too, and depend on
* what kind of filesystem the file is on. Note that in many non-local
* file cases read and write streams are not supported, so make sure you
* really need to do read and write streaming, rather than just opening
* for reading or writing.
* @virtual
* @param cancellable a #GCancellable
* @returns #GFileIOStream or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_open_readwrite(cancellable: Cancellable | null): FileIOStream
/**
* Asynchronously opens `file` for reading and writing.
*
* For more details, see g_file_open_readwrite() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_open_readwrite_finish() to get
* the result of the operation.
* @virtual
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_open_readwrite_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous file read operation started with
* g_file_open_readwrite_async().
* @virtual
* @param res a #GAsyncResult
* @returns a #GFileIOStream or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_open_readwrite_finish(res: AsyncResult): FileIOStream
/**
* Polls a file of type %G_FILE_TYPE_MOUNTABLE.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_mount_mountable_finish() to get
* the result of the operation.
* @virtual
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied, or %NULL
*/
vfunc_poll_mountable(cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes a poll operation. See g_file_poll_mountable() for details.
*
* Finish an asynchronous poll operation that was polled
* with g_file_poll_mountable().
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE if the operation finished successfully. %FALSE otherwise.
*/
vfunc_poll_mountable_finish(result: AsyncResult): boolean
/**
* Checks whether `file` has the prefix specified by `prefix`.
*
* In other words, if the names of initial elements of `file'`s
* pathname match `prefix`. Only full pathname elements are matched,
* so a path like /foo is not considered a prefix of /foobar, only
* of /foo/bar.
*
* A #GFile is not a prefix of itself. If you want to check for
* equality, use g_file_equal().
*
* This call does no I/O, as it works purely on names. As such it can
* sometimes return %FALSE even if `file` is inside a `prefix` (from a
* filesystem point of view), because the prefix of `file` is an alias
* of `prefix`.
* @virtual
* @param file input #GFile
* @returns %TRUE if the @file's parent, grandparent, etc is @prefix, %FALSE otherwise.
*/
vfunc_prefix_matches(file: File): boolean
/**
* Similar to g_file_query_info(), but obtains information
* about the filesystem the `file` is on, rather than the file itself.
* For instance the amount of space available and the type of
* the filesystem.
*
* The `attributes` value is a string that specifies the attributes
* that should be gathered. It is not an error if it's not possible
* to read a particular requested attribute from a file - it just
* won't be set. `attributes` should be a comma-separated list of
* attributes or attribute wildcards. The wildcard "*" means all
* attributes, and a wildcard like "filesystem::*" means all attributes
* in the filesystem namespace. The standard namespace for filesystem
* attributes is "filesystem". Common attributes of interest are
* %G_FILE_ATTRIBUTE_FILESYSTEM_SIZE (the total size of the filesystem
* in bytes), %G_FILE_ATTRIBUTE_FILESYSTEM_FREE (number of bytes available),
* and %G_FILE_ATTRIBUTE_FILESYSTEM_TYPE (type of the filesystem).
*
* If `cancellable` is not %NULL, then the operation can be cancelled
* by triggering the cancellable object from another thread. If the
* operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
* returned.
*
* If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will
* be returned. Other errors are possible too, and depend on what
* kind of filesystem the file is on.
* @virtual
* @param attributes an attribute query string
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileInfo or %NULL if there was an error. Free the returned object with g_object_unref().
*/
vfunc_query_filesystem_info(attributes: string | null, cancellable: Cancellable | null): FileInfo
/**
* Asynchronously gets the requested information about the filesystem
* that the specified `file` is on. The result is a #GFileInfo object
* that contains key-value attributes (such as type or size for the
* file).
*
* For more details, see g_file_query_filesystem_info() which is the
* synchronous version of this call.
*
* When the operation is finished, `callback` will be called. You can
* then call g_file_query_info_finish() to get the result of the
* operation.
* @virtual
* @param attributes an attribute query string
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_query_filesystem_info_async(attributes: string | null, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous filesystem info query.
* See g_file_query_filesystem_info_async().
* @virtual
* @param res a #GAsyncResult
* @returns #GFileInfo for given @file or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_query_filesystem_info_finish(res: AsyncResult): FileInfo
/**
* Gets the requested information about specified `file`.
* The result is a #GFileInfo object that contains key-value
* attributes (such as the type or size of the file).
*
* The `attributes` value is a string that specifies the file
* attributes that should be gathered. It is not an error if
* it's not possible to read a particular requested attribute
* from a file - it just won't be set. `attributes` should be a
* comma-separated list of attributes or attribute wildcards.
* The wildcard "*" means all attributes, and a wildcard like
* "standard::*" means all attributes in the standard namespace.
* An example attribute query be "standard::*,owner::user".
* The standard attributes are available as defines, like
* %G_FILE_ATTRIBUTE_STANDARD_NAME.
*
* If `cancellable` is not %NULL, then the operation can be cancelled
* by triggering the cancellable object from another thread. If the
* operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
* returned.
*
* For symlinks, normally the information about the target of the
* symlink is returned, rather than information about the symlink
* itself. However if you pass %G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS
* in `flags` the information about the symlink itself will be returned.
* Also, for symlinks that point to non-existing files the information
* about the symlink itself will be returned.
*
* If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will be
* returned. Other errors are possible too, and depend on what kind of
* filesystem the file is on.
* @virtual
* @param attributes an attribute query string
* @param flags a set of #GFileQueryInfoFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileInfo for the given @file, or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_query_info(attributes: string | null, flags: FileQueryInfoFlags, cancellable: Cancellable | null): FileInfo
/**
* Asynchronously gets the requested information about specified `file`.
* The result is a #GFileInfo object that contains key-value attributes
* (such as type or size for the file).
*
* For more details, see g_file_query_info() which is the synchronous
* version of this call.
*
* When the operation is finished, `callback` will be called. You can
* then call g_file_query_info_finish() to get the result of the operation.
* @virtual
* @param attributes an attribute query string
* @param flags a set of #GFileQueryInfoFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_query_info_async(attributes: string | null, flags: FileQueryInfoFlags, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous file info query.
* See g_file_query_info_async().
* @virtual
* @param res a #GAsyncResult
* @returns #GFileInfo for given @file or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_query_info_finish(res: AsyncResult): FileInfo
/**
* Obtain the list of settable attributes for the file.
*
* Returns the type and full attribute name of all the attributes
* that can be set on this file. This doesn't mean setting it will
* always succeed though, you might get an access failure, or some
* specific file may not support a specific attribute.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @virtual
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileAttributeInfoList describing the settable attributes. When you are done with it, release it with g_file_attribute_info_list_unref()
*/
vfunc_query_settable_attributes(cancellable: Cancellable | null): FileAttributeInfoList
/**
* Obtain the list of attribute namespaces where new attributes
* can be created by a user. An example of this is extended
* attributes (in the "xattr" namespace).
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @virtual
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileAttributeInfoList describing the writable namespaces. When you are done with it, release it with g_file_attribute_info_list_unref()
*/
vfunc_query_writable_namespaces(cancellable: Cancellable | null): FileAttributeInfoList
/**
* Asynchronously opens `file` for reading.
*
* For more details, see g_file_read() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_read_finish() to get the result
* of the operation.
* @virtual
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_read_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous file read operation started with
* g_file_read_async().
* @virtual
* @param res a #GAsyncResult
* @returns a #GFileInputStream or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_read_finish(res: AsyncResult): FileInputStream
/**
* Opens a file for reading. The result is a #GFileInputStream that
* can be used to read the contents of the file.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will be
* returned. If the file is a directory, the %G_IO_ERROR_IS_DIRECTORY
* error will be returned. Other errors are possible too, and depend
* on what kind of filesystem the file is on.
* @virtual
* @param cancellable a #GCancellable
* @returns #GFileInputStream or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_read_fn(cancellable: Cancellable | null): FileInputStream
/**
* Returns an output stream for overwriting the file, possibly
* creating a backup copy of the file first. If the file doesn't exist,
* it will be created.
*
* This will try to replace the file in the safest way possible so
* that any errors during the writing will not affect an already
* existing copy of the file. For instance, for local files it
* may write to a temporary file and then atomically rename over
* the destination when the stream is closed.
*
* By default files created are generally readable by everyone,
* but if you pass %G_FILE_CREATE_PRIVATE in `flags` the file
* will be made readable only to the current user, to the level that
* is supported on the target filesystem.
*
* If `cancellable` is not %NULL, then the operation can be cancelled
* by triggering the cancellable object from another thread. If the
* operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
* returned.
*
* If you pass in a non-%NULL `etag` value and `file` already exists, then
* this value is compared to the current entity tag of the file, and if
* they differ an %G_IO_ERROR_WRONG_ETAG error is returned. This
* generally means that the file has been changed since you last read
* it. You can get the new etag from g_file_output_stream_get_etag()
* after you've finished writing and closed the #GFileOutputStream. When
* you load a new file you can use g_file_input_stream_query_info() to
* get the etag of the file.
*
* If `make_backup` is %TRUE, this function will attempt to make a
* backup of the current file before overwriting it. If this fails
* a %G_IO_ERROR_CANT_CREATE_BACKUP error will be returned. If you
* want to replace anyway, try again with `make_backup` set to %FALSE.
*
* If the file is a directory the %G_IO_ERROR_IS_DIRECTORY error will
* be returned, and if the file is some other form of non-regular file
* then a %G_IO_ERROR_NOT_REGULAR_FILE error will be returned. Some
* file systems don't allow all file names, and may return an
* %G_IO_ERROR_INVALID_FILENAME error, and if the name is to long
* %G_IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors are
* possible too, and depend on what kind of filesystem the file is on.
* @virtual
* @param etag an optional [entity tag][gfile-etag] for the current #GFile, or #NULL to ignore
* @param make_backup %TRUE if a backup should be created
* @param flags a set of #GFileCreateFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileOutputStream or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_replace(etag: string | null, make_backup: boolean, flags: FileCreateFlags, cancellable: Cancellable | null): FileOutputStream
/**
* Asynchronously overwrites the file, replacing the contents,
* possibly creating a backup copy of the file first.
*
* For more details, see g_file_replace() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_replace_finish() to get the result
* of the operation.
* @virtual
* @param etag an [entity tag][gfile-etag] for the current #GFile, or %NULL to ignore
* @param make_backup %TRUE if a backup should be created
* @param flags a set of #GFileCreateFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_replace_async(etag: string | null, make_backup: boolean, flags: FileCreateFlags, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous file replace operation started with
* g_file_replace_async().
* @virtual
* @param res a #GAsyncResult
* @returns a #GFileOutputStream, or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_replace_finish(res: AsyncResult): FileOutputStream
/**
* Returns an output stream for overwriting the file in readwrite mode,
* possibly creating a backup copy of the file first. If the file doesn't
* exist, it will be created.
*
* For details about the behaviour, see g_file_replace() which does the
* same thing but returns an output stream only.
*
* Note that in many non-local file cases read and write streams are not
* supported, so make sure you really need to do read and write streaming,
* rather than just opening for reading or writing.
* @virtual
* @param etag an optional [entity tag][gfile-etag] for the current #GFile, or #NULL to ignore
* @param make_backup %TRUE if a backup should be created
* @param flags a set of #GFileCreateFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFileIOStream or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_replace_readwrite(etag: string | null, make_backup: boolean, flags: FileCreateFlags, cancellable: Cancellable | null): FileIOStream
/**
* Asynchronously overwrites the file in read-write mode,
* replacing the contents, possibly creating a backup copy
* of the file first.
*
* For more details, see g_file_replace_readwrite() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_replace_readwrite_finish() to get
* the result of the operation.
* @virtual
* @param etag an [entity tag][gfile-etag] for the current #GFile, or %NULL to ignore
* @param make_backup %TRUE if a backup should be created
* @param flags a set of #GFileCreateFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_replace_readwrite_async(etag: string | null, make_backup: boolean, flags: FileCreateFlags, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous file replace operation started with
* g_file_replace_readwrite_async().
* @virtual
* @param res a #GAsyncResult
* @returns a #GFileIOStream, or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_replace_readwrite_finish(res: AsyncResult): FileIOStream
/**
* Resolves a relative path for `file` to an absolute path.
*
* This call does no blocking I/O.
*
* If the `relative_path` is an absolute path name, the resolution
* is done absolutely (without taking `file` path as base).
* @virtual
* @param relative_path a given relative path string
* @returns a #GFile for the resolved path.
*/
vfunc_resolve_relative_path(relative_path: string): File
/**
* Sets an attribute in the file with attribute name `attribute` to `value_p`.
*
* Some attributes can be unset by setting `type` to
* %G_FILE_ATTRIBUTE_TYPE_INVALID and `value_p` to %NULL.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @virtual
* @param attribute a string containing the attribute's name
* @param type The type of the attribute
* @param value_p a pointer to the value (or the pointer itself if the type is a pointer type)
* @param flags a set of #GFileQueryInfoFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE if the attribute was set, %FALSE otherwise.
*/
vfunc_set_attribute(attribute: string | null, type: FileAttributeType, value_p: any | null, flags: FileQueryInfoFlags, cancellable: Cancellable | null): boolean
/**
* Asynchronously sets the attributes of `file` with `info`.
*
* For more details, see g_file_set_attributes_from_info(),
* which is the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_set_attributes_finish() to get
* the result of the operation.
* @virtual
* @param info a #GFileInfo
* @param flags a #GFileQueryInfoFlags
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_set_attributes_async(info: FileInfo, flags: FileQueryInfoFlags, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes setting an attribute started in g_file_set_attributes_async().
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE if the attributes were set correctly, %FALSE otherwise.
*/
vfunc_set_attributes_finish(result: AsyncResult): [ /* returnType */ boolean, /* info */ FileInfo ]
/**
* Tries to set all attributes in the #GFileInfo on the target
* values, not stopping on the first error.
*
* If there is any error during this operation then `error` will
* be set to the first error. Error on particular fields are flagged
* by setting the "status" field in the attribute value to
* %G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING, which means you can
* also detect further errors.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @virtual
* @param info a #GFileInfo
* @param flags #GFileQueryInfoFlags
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %FALSE if there was any error, %TRUE otherwise.
*/
vfunc_set_attributes_from_info(info: FileInfo, flags: FileQueryInfoFlags, cancellable: Cancellable | null): boolean
/**
* Renames `file` to the specified display name.
*
* The display name is converted from UTF-8 to the correct encoding
* for the target filesystem if possible and the `file` is renamed to this.
*
* If you want to implement a rename operation in the user interface the
* edit name (%G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME) should be used as the
* initial value in the rename widget, and then the result after editing
* should be passed to g_file_set_display_name().
*
* On success the resulting converted filename is returned.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @virtual
* @param display_name a string
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a #GFile specifying what @file was renamed to, or %NULL if there was an error. Free the returned object with g_object_unref().
*/
vfunc_set_display_name(display_name: string | null, cancellable: Cancellable | null): File
/**
* Asynchronously sets the display name for a given #GFile.
*
* For more details, see g_file_set_display_name() which is
* the synchronous version of this call.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_set_display_name_finish() to get
* the result of the operation.
* @virtual
* @param display_name a string
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_set_display_name_async(display_name: string | null, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes setting a display name started with
* g_file_set_display_name_async().
* @virtual
* @param res a #GAsyncResult
* @returns a #GFile or %NULL on error. Free the returned object with g_object_unref().
*/
vfunc_set_display_name_finish(res: AsyncResult): File
/**
* Starts a file of type %G_FILE_TYPE_MOUNTABLE.
* Using `start_operation,` you can request callbacks when, for instance,
* passwords are needed during authentication.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_mount_mountable_finish() to get
* the result of the operation.
* @virtual
* @param flags flags affecting the operation
* @param start_operation a #GMountOperation, or %NULL to avoid user interaction
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied, or %NULL
*/
vfunc_start_mountable(flags: DriveStartFlags, start_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes a start operation. See g_file_start_mountable() for details.
*
* Finish an asynchronous start operation that was started
* with g_file_start_mountable().
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE if the operation finished successfully. %FALSE otherwise.
*/
vfunc_start_mountable_finish(result: AsyncResult): boolean
/**
* Stops a file of type %G_FILE_TYPE_MOUNTABLE.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_stop_mountable_finish() to get
* the result of the operation.
* @virtual
* @param flags flags affecting the operation
* @param mount_operation a #GMountOperation, or %NULL to avoid user interaction.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied, or %NULL
*/
vfunc_stop_mountable(flags: MountUnmountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes a stop operation, see g_file_stop_mountable() for details.
*
* Finish an asynchronous stop operation that was started
* with g_file_stop_mountable().
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE if the operation finished successfully. %FALSE otherwise.
*/
vfunc_stop_mountable_finish(result: AsyncResult): boolean
/**
* Sends `file` to the "Trashcan", if possible. This is similar to
* deleting it, but the user can recover it before emptying the trashcan.
* Not all file systems support trashing, so this call can return the
* %G_IO_ERROR_NOT_SUPPORTED error. Since GLib 2.66, the `x-gvfs-notrash` unix
* mount option can be used to disable g_file_trash() support for certain
* mounts, the %G_IO_ERROR_NOT_SUPPORTED error will be returned in that case.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @virtual
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns %TRUE on successful trash, %FALSE otherwise.
*/
vfunc_trash(cancellable: Cancellable | null): boolean
/**
* Asynchronously sends `file` to the Trash location, if possible.
* @virtual
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_trash_async(io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous file trashing operation, started with
* g_file_trash_async().
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE on successful trash, %FALSE otherwise.
*/
vfunc_trash_finish(result: AsyncResult): boolean
/**
* Unmounts a file of type G_FILE_TYPE_MOUNTABLE.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_unmount_mountable_finish() to get
* the result of the operation.
* @virtual
* @param flags flags affecting the operation
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_unmount_mountable(flags: MountUnmountFlags, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an unmount operation, see g_file_unmount_mountable() for details.
*
* Finish an asynchronous unmount operation that was started
* with g_file_unmount_mountable().
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE if the operation finished successfully. %FALSE otherwise.
*/
vfunc_unmount_mountable_finish(result: AsyncResult): boolean
/**
* Unmounts a file of type %G_FILE_TYPE_MOUNTABLE.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* When the operation is finished, `callback` will be called.
* You can then call g_file_unmount_mountable_finish() to get
* the result of the operation.
* @virtual
* @param flags flags affecting the operation
* @param mount_operation a #GMountOperation, or %NULL to avoid user interaction
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_unmount_mountable_with_operation(flags: MountUnmountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an unmount operation,
* see g_file_unmount_mountable_with_operation() for details.
*
* Finish an asynchronous unmount operation that was started
* with g_file_unmount_mountable_with_operation().
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE if the operation finished successfully. %FALSE otherwise.
*/
vfunc_unmount_mountable_with_operation_finish(result: AsyncResult): boolean
// Class property signals of Gio-2.0.Gio.File
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GFile is a high level abstraction for manipulating files on a
* virtual file system. #GFiles are lightweight, immutable objects
* that do no I/O upon creation. It is necessary to understand that
* #GFile objects do not represent files, merely an identifier for a
* file. All file content I/O is implemented as streaming operations
* (see #GInputStream and #GOutputStream).
*
* To construct a #GFile, you can use:
* - g_file_new_for_path() if you have a path.
* - g_file_new_for_uri() if you have a URI.
* - g_file_new_for_commandline_arg() for a command line argument.
* - g_file_new_tmp() to create a temporary file from a template.
* - g_file_new_tmp_async() to asynchronously create a temporary file.
* - g_file_new_tmp_dir_async() to asynchronously create a temporary directory.
* - g_file_parse_name() from a UTF-8 string gotten from g_file_get_parse_name().
* - g_file_new_build_filename() or g_file_new_build_filenamev() to create a file from path elements.
*
* One way to think of a #GFile is as an abstraction of a pathname. For
* normal files the system pathname is what is stored internally, but as
* #GFiles are extensible it could also be something else that corresponds
* to a pathname in a userspace implementation of a filesystem.
*
* #GFiles make up hierarchies of directories and files that correspond to
* the files on a filesystem. You can move through the file system with
* #GFile using g_file_get_parent() to get an identifier for the parent
* directory, g_file_get_child() to get a child within a directory,
* g_file_resolve_relative_path() to resolve a relative path between two
* #GFiles. There can be multiple hierarchies, so you may not end up at
* the same root if you repeatedly call g_file_get_parent() on two different
* files.
*
* All #GFiles have a basename (get with g_file_get_basename()). These names
* are byte strings that are used to identify the file on the filesystem
* (relative to its parent directory) and there is no guarantees that they
* have any particular charset encoding or even make any sense at all. If
* you want to use filenames in a user interface you should use the display
* name that you can get by requesting the
* %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with g_file_query_info().
* This is guaranteed to be in UTF-8 and can be used in a user interface.
* But always store the real basename or the #GFile to use to actually
* access the file, because there is no way to go from a display name to
* the actual name.
*
* Using #GFile as an identifier has the same weaknesses as using a path
* in that there may be multiple aliases for the same file. For instance,
* hard or soft links may cause two different #GFiles to refer to the same
* file. Other possible causes for aliases are: case insensitive filesystems,
* short and long names on FAT/NTFS, or bind mounts in Linux. If you want to
* check if two #GFiles point to the same file you can query for the
* %G_FILE_ATTRIBUTE_ID_FILE attribute. Note that #GFile does some trivial
* canonicalization of pathnames passed in, so that trivial differences in
* the path string used at creation (duplicated slashes, slash at end of
* path, "." or ".." path segments, etc) does not create different #GFiles.
*
* Many #GFile operations have both synchronous and asynchronous versions
* to suit your application. Asynchronous versions of synchronous functions
* simply have _async() appended to their function names. The asynchronous
* I/O functions call a #GAsyncReadyCallback which is then used to finalize
* the operation, producing a GAsyncResult which is then passed to the
* function's matching _finish() operation.
*
* It is highly recommended to use asynchronous calls when running within a
* shared main loop, such as in the main thread of an application. This avoids
* I/O operations blocking other sources on the main loop from being dispatched.
* Synchronous I/O operations should be performed from worker threads. See the
* [introduction to asynchronous programming section][async-programming] for
* more.
*
* Some #GFile operations almost always take a noticeable amount of time, and
* so do not have synchronous analogs. Notable cases include:
* - g_file_mount_mountable() to mount a mountable file.
* - g_file_unmount_mountable_with_operation() to unmount a mountable file.
* - g_file_eject_mountable_with_operation() to eject a mountable file.
*
* ## Entity Tags # {#gfile-etag}
*
* One notable feature of #GFiles are entity tags, or "etags" for
* short. Entity tags are somewhat like a more abstract version of the
* traditional mtime, and can be used to quickly determine if the file
* has been modified from the version on the file system. See the
* HTTP 1.1
* [specification](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html)
* for HTTP Etag headers, which are a very similar concept.
* @interface
*/
export class File extends GObject.Object {
// Own properties of Gio-2.0.Gio.File
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.File
constructor(config?: File.ConstructorProperties)
_init(config?: File.ConstructorProperties): void
/**
* Constructs a #GFile from a vector of elements using the correct
* separator for filenames.
*
* Using this function is equivalent to calling g_build_filenamev(),
* followed by g_file_new_for_path() on the result.
* @param args %NULL-terminated array of strings containing the path elements.
* @returns a new #GFile
*/
static new_build_filenamev(args: string[]): File
/**
* Creates a #GFile with the given argument from the command line.
* The value of `arg` can be either a URI, an absolute path or a
* relative path resolved relative to the current working directory.
* This operation never fails, but the returned object might not
* support any I/O operation if `arg` points to a malformed path.
*
* Note that on Windows, this function expects its argument to be in
* UTF-8 -- not the system code page. This means that you
* should not use this function with string from argv as it is passed
* to main(). g_win32_get_command_line() will return a UTF-8 version of
* the commandline. #GApplication also uses UTF-8 but
* g_application_command_line_create_file_for_arg() may be more useful
* for you there. It is also always possible to use this function with
* #GOptionContext arguments of type %G_OPTION_ARG_FILENAME.
* @param arg a command line string
* @returns a new #GFile. Free the returned object with g_object_unref().
*/
static new_for_commandline_arg(arg: string): File
/**
* Creates a #GFile with the given argument from the command line.
*
* This function is similar to g_file_new_for_commandline_arg() except
* that it allows for passing the current working directory as an
* argument instead of using the current working directory of the
* process.
*
* This is useful if the commandline argument was given in a context
* other than the invocation of the current process.
*
* See also g_application_command_line_create_file_for_arg().
* @param arg a command line string
* @param cwd the current working directory of the commandline
* @returns a new #GFile
*/
static new_for_commandline_arg_and_cwd(arg: string, cwd: string): File
/**
* Constructs a #GFile for a given path. This operation never
* fails, but the returned object might not support any I/O
* operation if `path` is malformed.
* @param path a string containing a relative or absolute path. The string must be encoded in the glib filename encoding.
* @returns a new #GFile for the given @path. Free the returned object with g_object_unref().
*/
static new_for_path(path: string): File
/**
* Constructs a #GFile for a given URI. This operation never
* fails, but the returned object might not support any I/O
* operation if `uri` is malformed or if the uri type is
* not supported.
* @param uri a UTF-8 string containing a URI
* @returns a new #GFile for the given @uri. Free the returned object with g_object_unref().
*/
static new_for_uri(uri: string | null): File
/**
* Opens a file in the preferred directory for temporary files (as
* returned by g_get_tmp_dir()) and returns a #GFile and
* #GFileIOStream pointing to it.
*
* `tmpl` should be a string in the GLib file name encoding
* containing a sequence of six 'X' characters, and containing no
* directory components. If it is %NULL, a default template is used.
*
* Unlike the other #GFile constructors, this will return %NULL if
* a temporary file could not be created.
* @param tmpl Template for the file name, as in g_file_open_tmp(), or %NULL for a default template
* @returns a new #GFile. Free the returned object with g_object_unref().
*/
static new_tmp(tmpl: string | null): [ /* returnType */ File, /* iostream */ FileIOStream ]
/**
* Asynchronously opens a file in the preferred directory for temporary files
* (as returned by g_get_tmp_dir()) as g_file_new_tmp().
*
* `tmpl` should be a string in the GLib file name encoding
* containing a sequence of six 'X' characters, and containing no
* directory components. If it is %NULL, a default template is used.
* @param tmpl Template for the file name, as in g_file_open_tmp(), or %NULL for a default template
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is done
*/
static new_tmp_async(tmpl: string | null, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Asynchronously creates a directory in the preferred directory for
* temporary files (as returned by g_get_tmp_dir()) as g_dir_make_tmp().
*
* `tmpl` should be a string in the GLib file name encoding
* containing a sequence of six 'X' characters, and containing no
* directory components. If it is %NULL, a default template is used.
* @param tmpl Template for the file name, as in g_dir_make_tmp(), or %NULL for a default template
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is done
*/
static new_tmp_dir_async(tmpl: string | null, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes a temporary directory creation started by
* g_file_new_tmp_dir_async().
* @param result a #GAsyncResult
* @returns a new #GFile. Free the returned object with g_object_unref().
*/
static new_tmp_dir_finish(result: AsyncResult): File
/**
* Finishes a temporary file creation started by g_file_new_tmp_async().
* @param result a #GAsyncResult
* @returns a new #GFile. Free the returned object with g_object_unref().
*/
static new_tmp_finish(result: AsyncResult): [ /* returnType */ File, /* iostream */ FileIOStream ]
/**
* Constructs a #GFile with the given `parse_name` (i.e. something
* given by g_file_get_parse_name()). This operation never fails,
* but the returned object might not support any I/O operation if
* the `parse_name` cannot be parsed.
* @param parse_name a file name or path to be parsed
* @returns a new #GFile.
*/
static parse_name(parse_name: string | null): File
}
export module FileDescriptorBased {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface FileDescriptorBased {
// Owm methods of Gio-2.0.Gio.FileDescriptorBased
/**
* Gets the underlying file descriptor.
* @returns The file descriptor
*/
get_fd(): number
// Own virtual methods of Gio-2.0.Gio.FileDescriptorBased
/**
* Gets the underlying file descriptor.
* @virtual
* @returns The file descriptor
*/
vfunc_get_fd(): number
// Class property signals of Gio-2.0.Gio.FileDescriptorBased
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GFileDescriptorBased is implemented by streams (implementations of
* #GInputStream or #GOutputStream) that are based on file descriptors.
*
* Note that `` belongs to the UNIX-specific
* GIO interfaces, thus you have to use the `gio-unix-2.0.pc` pkg-config
* file when using it.
* @interface
*/
export class FileDescriptorBased extends GObject.Object {
// Own properties of Gio-2.0.Gio.FileDescriptorBased
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.FileDescriptorBased
constructor(config?: FileDescriptorBased.ConstructorProperties)
_init(config?: FileDescriptorBased.ConstructorProperties): void
}
export module Icon {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface Icon {
// Owm methods of Gio-2.0.Gio.Icon
/**
* Checks if two icons are equal.
* @param icon2 pointer to the second #GIcon.
* @returns %TRUE if @icon1 is equal to @icon2. %FALSE otherwise.
*/
equal(icon2: Icon | null): boolean
/**
* Gets a hash for an icon.
* @returns a #guint containing a hash for the @icon, suitable for use in a #GHashTable or similar data structure.
*/
hash(): number
/**
* Serializes a #GIcon into a #GVariant. An equivalent #GIcon can be retrieved
* back by calling g_icon_deserialize() on the returned value.
* As serialization will avoid using raw icon data when possible, it only
* makes sense to transfer the #GVariant between processes on the same machine,
* (as opposed to over the network), and within the same file system namespace.
* @returns a #GVariant, or %NULL when serialization fails. The #GVariant will not be floating.
*/
serialize(): GLib.Variant | null
/**
* Generates a textual representation of `icon` that can be used for
* serialization such as when passing `icon` to a different process or
* saving it to persistent storage. Use g_icon_new_for_string() to
* get `icon` back from the returned string.
*
* The encoding of the returned string is proprietary to #GIcon except
* in the following two cases
*
* - If `icon` is a #GFileIcon, the returned string is a native path
* (such as `/path/to/my icon.png`) without escaping
* if the #GFile for `icon` is a native file. If the file is not
* native, the returned string is the result of g_file_get_uri()
* (such as `sftp://path/to/my%20icon.png`).
*
* - If `icon` is a #GThemedIcon with exactly one name and no fallbacks,
* the encoding is simply the name (such as `network-server`).
* @returns An allocated NUL-terminated UTF8 string or %NULL if @icon can't be serialized. Use g_free() to free.
*/
to_string(): string | null
// Own virtual methods of Gio-2.0.Gio.Icon
/**
* Checks if two icons are equal.
* @virtual
* @param icon2 pointer to the second #GIcon.
* @returns %TRUE if @icon1 is equal to @icon2. %FALSE otherwise.
*/
vfunc_equal(icon2: Icon | null): boolean
/**
* Gets a hash for an icon.
* @virtual
* @returns a #guint containing a hash for the @icon, suitable for use in a #GHashTable or similar data structure.
*/
vfunc_hash(): number
/**
* Serializes a #GIcon into a #GVariant. An equivalent #GIcon can be retrieved
* back by calling g_icon_deserialize() on the returned value.
* As serialization will avoid using raw icon data when possible, it only
* makes sense to transfer the #GVariant between processes on the same machine,
* (as opposed to over the network), and within the same file system namespace.
* @virtual
* @returns a #GVariant, or %NULL when serialization fails. The #GVariant will not be floating.
*/
vfunc_serialize(): GLib.Variant | null
/**
* Serializes the `icon` into string tokens.
* This is can be invoked when g_icon_new_for_string() is called.
* @virtual
* @returns %TRUE if serialization took place, %FALSE otherwise
*/
vfunc_to_tokens(): [ /* returnType */ boolean, /* tokens */ string[], /* out_version */ number ]
// Class property signals of Gio-2.0.Gio.Icon
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GIcon is a very minimal interface for icons. It provides functions
* for checking the equality of two icons, hashing of icons and
* serializing an icon to and from strings.
*
* #GIcon does not provide the actual pixmap for the icon as this is out
* of GIO's scope, however implementations of #GIcon may contain the name
* of an icon (see #GThemedIcon), or the path to an icon (see #GLoadableIcon).
*
* To obtain a hash of a #GIcon, see g_icon_hash().
*
* To check if two #GIcons are equal, see g_icon_equal().
*
* For serializing a #GIcon, use g_icon_serialize() and
* g_icon_deserialize().
*
* If you want to consume #GIcon (for example, in a toolkit) you must
* be prepared to handle at least the three following cases:
* #GLoadableIcon, #GThemedIcon and #GEmblemedIcon. It may also make
* sense to have fast-paths for other cases (like handling #GdkPixbuf
* directly, for example) but all compliant #GIcon implementations
* outside of GIO must implement #GLoadableIcon.
*
* If your application or library provides one or more #GIcon
* implementations you need to ensure that your new implementation also
* implements #GLoadableIcon. Additionally, you must provide an
* implementation of g_icon_serialize() that gives a result that is
* understood by g_icon_deserialize(), yielding one of the built-in icon
* types.
* @interface
*/
export class Icon extends GObject.Object {
// Own properties of Gio-2.0.Gio.Icon
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.Icon
constructor(config?: Icon.ConstructorProperties)
_init(config?: Icon.ConstructorProperties): void
/**
* Generate a #GIcon instance from `str`. This function can fail if
* `str` is not valid - see g_icon_to_string() for discussion.
*
* If your application or library provides one or more #GIcon
* implementations you need to ensure that each #GType is registered
* with the type system prior to calling g_icon_new_for_string().
* @param str A string obtained via g_icon_to_string().
* @returns An object implementing the #GIcon interface or %NULL if @error is set.
*/
static new_for_string(str: string | null): Icon
/**
* Deserializes a #GIcon previously serialized using g_icon_serialize().
* @param value a #GVariant created with g_icon_serialize()
* @returns a #GIcon, or %NULL when deserialization fails.
*/
static deserialize(value: GLib.Variant): Icon | null
}
export module Initable {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface Initable {
// Owm methods of Gio-2.0.Gio.Initable
/**
* Initializes the object implementing the interface.
*
* This method is intended for language bindings. If writing in C,
* g_initable_new() should typically be used instead.
*
* The object must be initialized before any real use after initial
* construction, either with this function or g_async_initable_init_async().
*
* Implementations may also support cancellation. If `cancellable` is not %NULL,
* then initialization can be cancelled by triggering the cancellable object
* from another thread. If the operation was cancelled, the error
* %G_IO_ERROR_CANCELLED will be returned. If `cancellable` is not %NULL and
* the object doesn't support cancellable initialization the error
* %G_IO_ERROR_NOT_SUPPORTED will be returned.
*
* If the object is not initialized, or initialization returns with an
* error, then all operations on the object except g_object_ref() and
* g_object_unref() are considered to be invalid, and have undefined
* behaviour. See the [introduction][ginitable] for more details.
*
* Callers should not assume that a class which implements #GInitable can be
* initialized multiple times, unless the class explicitly documents itself as
* supporting this. Generally, a class’ implementation of init() can assume
* (and assert) that it will only be called once. Previously, this documentation
* recommended all #GInitable implementations should be idempotent; that
* recommendation was relaxed in GLib 2.54.
*
* If a class explicitly supports being initialized multiple times, it is
* recommended that the method is idempotent: multiple calls with the same
* arguments should return the same results. Only the first call initializes
* the object; further calls return the result of the first call.
*
* One reason why a class might need to support idempotent initialization is if
* it is designed to be used via the singleton pattern, with a
* #GObjectClass.constructor that sometimes returns an existing instance.
* In this pattern, a caller would expect to be able to call g_initable_init()
* on the result of g_object_new(), regardless of whether it is in fact a new
* instance.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns %TRUE if successful. If an error has occurred, this function will return %FALSE and set @error appropriately if present.
*/
init(cancellable: Cancellable | null): boolean
// Own virtual methods of Gio-2.0.Gio.Initable
/**
* Initializes the object implementing the interface.
*
* This method is intended for language bindings. If writing in C,
* g_initable_new() should typically be used instead.
*
* The object must be initialized before any real use after initial
* construction, either with this function or g_async_initable_init_async().
*
* Implementations may also support cancellation. If `cancellable` is not %NULL,
* then initialization can be cancelled by triggering the cancellable object
* from another thread. If the operation was cancelled, the error
* %G_IO_ERROR_CANCELLED will be returned. If `cancellable` is not %NULL and
* the object doesn't support cancellable initialization the error
* %G_IO_ERROR_NOT_SUPPORTED will be returned.
*
* If the object is not initialized, or initialization returns with an
* error, then all operations on the object except g_object_ref() and
* g_object_unref() are considered to be invalid, and have undefined
* behaviour. See the [introduction][ginitable] for more details.
*
* Callers should not assume that a class which implements #GInitable can be
* initialized multiple times, unless the class explicitly documents itself as
* supporting this. Generally, a class’ implementation of init() can assume
* (and assert) that it will only be called once. Previously, this documentation
* recommended all #GInitable implementations should be idempotent; that
* recommendation was relaxed in GLib 2.54.
*
* If a class explicitly supports being initialized multiple times, it is
* recommended that the method is idempotent: multiple calls with the same
* arguments should return the same results. Only the first call initializes
* the object; further calls return the result of the first call.
*
* One reason why a class might need to support idempotent initialization is if
* it is designed to be used via the singleton pattern, with a
* #GObjectClass.constructor that sometimes returns an existing instance.
* In this pattern, a caller would expect to be able to call g_initable_init()
* on the result of g_object_new(), regardless of whether it is in fact a new
* instance.
* @virtual
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns %TRUE if successful. If an error has occurred, this function will return %FALSE and set @error appropriately if present.
*/
vfunc_init(cancellable: Cancellable | null): boolean
// Class property signals of Gio-2.0.Gio.Initable
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GInitable is implemented by objects that can fail during
* initialization. If an object implements this interface then
* it must be initialized as the first thing after construction,
* either via g_initable_init() or g_async_initable_init_async()
* (the latter is only available if it also implements #GAsyncInitable).
*
* If the object is not initialized, or initialization returns with an
* error, then all operations on the object except g_object_ref() and
* g_object_unref() are considered to be invalid, and have undefined
* behaviour. They will often fail with g_critical() or g_warning(), but
* this must not be relied on.
*
* Users of objects implementing this are not intended to use
* the interface method directly, instead it will be used automatically
* in various ways. For C applications you generally just call
* g_initable_new() directly, or indirectly via a foo_thing_new() wrapper.
* This will call g_initable_init() under the cover, returning %NULL and
* setting a #GError on failure (at which point the instance is
* unreferenced).
*
* For bindings in languages where the native constructor supports
* exceptions the binding could check for objects implementing %GInitable
* during normal construction and automatically initialize them, throwing
* an exception on failure.
* @interface
*/
export class Initable extends GObject.Object {
// Own properties of Gio-2.0.Gio.Initable
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.Initable
constructor(config?: Initable.ConstructorProperties)
_init(config?: Initable.ConstructorProperties): void
// Has conflict: static newv(object_type: GObject.GType, parameters: GObject.Parameter[], cancellable: Cancellable | null): GObject.Object
// Overloads of newv
/**
* Creates a new instance of a #GObject subtype and sets its properties.
*
* Construction parameters (see %G_PARAM_CONSTRUCT, %G_PARAM_CONSTRUCT_ONLY)
* which are not explicitly specified are set to their default values.
* @constructor
* @param object_type the type id of the #GObject subtype to instantiate
* @param parameters an array of #GParameter
* @returns a new instance of @object_type
*/
static newv(object_type: GObject.GType, parameters: GObject.Parameter[]): GObject.Object
}
export module ListModel {
// Signal callback interfaces
/**
* Signal callback interface for `items-changed`
*/
export interface ItemsChangedSignalCallback {
($obj: ListModel, position: number, removed: number, added: number): void
}
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface ListModel {
// Owm methods of Gio-2.0.Gio.ListModel
/**
* Gets the type of the items in `list`.
*
* All items returned from g_list_model_get_item() are of the type
* returned by this function, or a subtype, or if the type is an
* interface, they are an implementation of that interface.
*
* The item type of a #GListModel can not change during the life of the
* model.
* @returns the #GType of the items contained in @list.
*/
get_item_type(): GObject.GType
/**
* Gets the number of items in `list`.
*
* Depending on the model implementation, calling this function may be
* less efficient than iterating the list with increasing values for
* `position` until g_list_model_get_item() returns %NULL.
* @returns the number of items in @list.
*/
get_n_items(): number
/**
* Get the item at `position`.
*
* If `position` is greater than the number of items in `list,` %NULL is
* returned.
*
* %NULL is never returned for an index that is smaller than the length
* of the list.
*
* This function is meant to be used by language bindings in place
* of g_list_model_get_item().
*
* See also: g_list_model_get_n_items()
* @param position the position of the item to fetch
* @returns the object at @position.
*/
get_item(position: number): GObject.Object | null
/**
* Emits the #GListModel::items-changed signal on `list`.
*
* This function should only be called by classes implementing
* #GListModel. It has to be called after the internal representation
* of `list` has been updated, because handlers connected to this signal
* might query the new state of the list.
*
* Implementations must only make changes to the model (as visible to
* its consumer) in places that will not cause problems for that
* consumer. For models that are driven directly by a write API (such
* as #GListStore), changes can be reported in response to uses of that
* API. For models that represent remote data, changes should only be
* made from a fresh mainloop dispatch. It is particularly not
* permitted to make changes in response to a call to the #GListModel
* consumer API.
*
* Stated another way: in general, it is assumed that code making a
* series of accesses to the model via the API, without returning to the
* mainloop, and without calling other code, will continue to view the
* same contents of the model.
* @param position the position at which `list` changed
* @param removed the number of items removed
* @param added the number of items added
*/
items_changed(position: number, removed: number, added: number): void
// Own virtual methods of Gio-2.0.Gio.ListModel
/**
* Get the item at `position`. If `position` is greater than the number of
* items in `list,` %NULL is returned.
*
* %NULL is never returned for an index that is smaller than the length
* of the list. See g_list_model_get_n_items().
*
* The same #GObject instance may not appear more than once in a #GListModel.
* @virtual
* @param position the position of the item to fetch
* @returns the object at @position.
*/
vfunc_get_item(position: number): GObject.Object | null
/**
* Gets the type of the items in `list`.
*
* All items returned from g_list_model_get_item() are of the type
* returned by this function, or a subtype, or if the type is an
* interface, they are an implementation of that interface.
*
* The item type of a #GListModel can not change during the life of the
* model.
* @virtual
* @returns the #GType of the items contained in @list.
*/
vfunc_get_item_type(): GObject.GType
/**
* Gets the number of items in `list`.
*
* Depending on the model implementation, calling this function may be
* less efficient than iterating the list with increasing values for
* `position` until g_list_model_get_item() returns %NULL.
* @virtual
* @returns the number of items in @list.
*/
vfunc_get_n_items(): number
// Own signals of Gio-2.0.Gio.ListModel
connect(sigName: "items-changed", callback: ListModel.ItemsChangedSignalCallback): number
connect_after(sigName: "items-changed", callback: ListModel.ItemsChangedSignalCallback): number
emit(sigName: "items-changed", position: number, removed: number, added: number, ...args: any[]): void
// Class property signals of Gio-2.0.Gio.ListModel
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GListModel is an interface that represents a mutable list of
* #GObjects. Its main intention is as a model for various widgets in
* user interfaces, such as list views, but it can also be used as a
* convenient method of returning lists of data, with support for
* updates.
*
* Each object in the list may also report changes in itself via some
* mechanism (normally the #GObject::notify signal). Taken together
* with the #GListModel::items-changed signal, this provides for a list
* that can change its membership, and in which the members can change
* their individual properties.
*
* A good example would be the list of visible wireless network access
* points, where each access point can report dynamic properties such as
* signal strength.
*
* It is important to note that the #GListModel itself does not report
* changes to the individual items. It only reports changes to the list
* membership. If you want to observe changes to the objects themselves
* then you need to connect signals to the objects that you are
* interested in.
*
* All items in a #GListModel are of (or derived from) the same type.
* g_list_model_get_item_type() returns that type. The type may be an
* interface, in which case all objects in the list must implement it.
*
* The semantics are close to that of an array:
* g_list_model_get_n_items() returns the number of items in the list and
* g_list_model_get_item() returns an item at a (0-based) position. In
* order to allow implementations to calculate the list length lazily,
* you can also iterate over items: starting from 0, repeatedly call
* g_list_model_get_item() until it returns %NULL.
*
* An implementation may create objects lazily, but must take care to
* return the same object for a given position until all references to
* it are gone.
*
* On the other side, a consumer is expected only to hold references on
* objects that are currently "user visible", in order to facilitate the
* maximum level of laziness in the implementation of the list and to
* reduce the required number of signal connections at a given time.
*
* This interface is intended only to be used from a single thread. The
* thread in which it is appropriate to use it depends on the particular
* implementation, but typically it will be from the thread that owns
* the [thread-default main context][g-main-context-push-thread-default]
* in effect at the time that the model was created.
*
* Over time, it has established itself as good practice for listmodel
* implementations to provide properties `item-type` and `n-items` to
* ease working with them. While it is not required, it is recommended
* that implementations provide these two properties. They should return
* the values of g_list_model_get_item_type() and g_list_model_get_n_items()
* respectively and be defined as such:
*
* ```c
* properties[PROP_ITEM_TYPE] =
* g_param_spec_gtype ("item-type", "", "", G_TYPE_OBJECT,
* G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* properties[PROP_N_ITEMS] =
* g_param_spec_uint ("n-items", "", "", 0, G_MAXUINT, 0,
* G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
* ```
*
* @interface
*/
export class ListModel extends GObject.Object {
// Own properties of Gio-2.0.Gio.ListModel
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.ListModel
constructor(config?: ListModel.ConstructorProperties)
_init(config?: ListModel.ConstructorProperties): void
}
export module LoadableIcon {
// Constructor properties interface
export interface ConstructorProperties extends Icon.ConstructorProperties, GObject.Object.ConstructorProperties {
}
}
export interface LoadableIcon extends Icon {
// Owm methods of Gio-2.0.Gio.LoadableIcon
/**
* Loads a loadable icon. For the asynchronous version of this function,
* see g_loadable_icon_load_async().
* @param size an integer.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns a #GInputStream to read the icon from.
*/
load(size: number, cancellable: Cancellable | null): [ /* returnType */ InputStream, /* type */ string | null ]
/**
* Loads an icon asynchronously. To finish this function, see
* g_loadable_icon_load_finish(). For the synchronous, blocking
* version of this function, see g_loadable_icon_load().
* @param size an integer.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
load_async(size: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of load_async
/**
* Promisified version of {@link load_async}
*
* Loads an icon asynchronously. To finish this function, see
* g_loadable_icon_load_finish(). For the synchronous, blocking
* version of this function, see g_loadable_icon_load().
* @param size an integer.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns A Promise of: a #GInputStream to read the icon from.
*/
load_async(size: number, cancellable: Cancellable | null): globalThis.Promise* type */ string | null>
/**
* Finishes an asynchronous icon load started in g_loadable_icon_load_async().
* @param res a #GAsyncResult.
* @returns a #GInputStream to read the icon from.
*/
load_finish(res: AsyncResult): [ /* returnType */ InputStream, /* type */ string | null ]
// Own virtual methods of Gio-2.0.Gio.LoadableIcon
/**
* Loads a loadable icon. For the asynchronous version of this function,
* see g_loadable_icon_load_async().
* @virtual
* @param size an integer.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns a #GInputStream to read the icon from.
*/
vfunc_load(size: number, cancellable: Cancellable | null): [ /* returnType */ InputStream, /* type */ string | null ]
/**
* Loads an icon asynchronously. To finish this function, see
* g_loadable_icon_load_finish(). For the synchronous, blocking
* version of this function, see g_loadable_icon_load().
* @virtual
* @param size an integer.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_load_async(size: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous icon load started in g_loadable_icon_load_async().
* @virtual
* @param res a #GAsyncResult.
* @returns a #GInputStream to read the icon from.
*/
vfunc_load_finish(res: AsyncResult): [ /* returnType */ InputStream, /* type */ string | null ]
// Class property signals of Gio-2.0.Gio.LoadableIcon
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* Extends the #GIcon interface and adds the ability to
* load icons from streams.
* @interface
*/
export class LoadableIcon extends GObject.Object {
// Own properties of Gio-2.0.Gio.LoadableIcon
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.LoadableIcon
constructor(config?: LoadableIcon.ConstructorProperties)
_init(config?: LoadableIcon.ConstructorProperties): void
}
export module MemoryMonitor {
// Signal callback interfaces
/**
* Signal callback interface for `low-memory-warning`
*/
export interface LowMemoryWarningSignalCallback {
($obj: MemoryMonitor, level: MemoryMonitorWarningLevel): void
}
// Constructor properties interface
export interface ConstructorProperties extends Initable.ConstructorProperties, GObject.Object.ConstructorProperties {
}
}
export interface MemoryMonitor extends Initable {
// Own virtual methods of Gio-2.0.Gio.MemoryMonitor
vfunc_low_memory_warning(level: MemoryMonitorWarningLevel): void
// Own signals of Gio-2.0.Gio.MemoryMonitor
connect(sigName: "low-memory-warning", callback: MemoryMonitor.LowMemoryWarningSignalCallback): number
connect_after(sigName: "low-memory-warning", callback: MemoryMonitor.LowMemoryWarningSignalCallback): number
emit(sigName: "low-memory-warning", level: MemoryMonitorWarningLevel, ...args: any[]): void
// Class property signals of Gio-2.0.Gio.MemoryMonitor
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GMemoryMonitor will monitor system memory and suggest to the application
* when to free memory so as to leave more room for other applications.
* It is implemented on Linux using the [Low Memory Monitor](https://gitlab.freedesktop.org/hadess/low-memory-monitor/)
* ([API documentation](https://hadess.pages.freedesktop.org/low-memory-monitor/)).
*
* There is also an implementation for use inside Flatpak sandboxes.
*
* Possible actions to take when the signal is received are:
*
* - Free caches
* - Save files that haven't been looked at in a while to disk, ready to be reopened when needed
* - Run a garbage collection cycle
* - Try and compress fragmented allocations
* - Exit on idle if the process has no reason to stay around
* - Call [`malloc_trim(3)`](man:malloc_trim) to return cached heap pages to
* the kernel (if supported by your libc)
*
* Note that some actions may not always improve system performance, and so
* should be profiled for your application. `malloc_trim()`, for example, may
* make future heap allocations slower (due to releasing cached heap pages back
* to the kernel).
*
* See #GMemoryMonitorWarningLevel for details on the various warning levels.
*
*
* ```c
* static void
* warning_cb (GMemoryMonitor *m, GMemoryMonitorWarningLevel level)
* {
* g_debug ("Warning level: %d", level);
* if (warning_level > G_MEMORY_MONITOR_WARNING_LEVEL_LOW)
* drop_caches ();
* }
*
* static GMemoryMonitor *
* monitor_low_memory (void)
* {
* GMemoryMonitor *m;
* m = g_memory_monitor_dup_default ();
* g_signal_connect (G_OBJECT (m), "low-memory-warning",
* G_CALLBACK (warning_cb), NULL);
* return m;
* }
* ```
*
*
* Don't forget to disconnect the #GMemoryMonitor::low-memory-warning
* signal, and unref the #GMemoryMonitor itself when exiting.
* @interface
*/
export class MemoryMonitor extends GObject.Object {
// Own properties of Gio-2.0.Gio.MemoryMonitor
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.MemoryMonitor
constructor(config?: MemoryMonitor.ConstructorProperties)
_init(config?: MemoryMonitor.ConstructorProperties): void
/**
* Gets a reference to the default #GMemoryMonitor for the system.
* @returns a new reference to the default #GMemoryMonitor
*/
static dup_default(): MemoryMonitor
}
export module Mount {
// Signal callback interfaces
/**
* Signal callback interface for `changed`
*/
export interface ChangedSignalCallback {
($obj: Mount): void
}
/**
* Signal callback interface for `pre-unmount`
*/
export interface PreUnmountSignalCallback {
($obj: Mount): void
}
/**
* Signal callback interface for `unmounted`
*/
export interface UnmountedSignalCallback {
($obj: Mount): void
}
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface Mount {
// Owm methods of Gio-2.0.Gio.Mount
/**
* Checks if `mount` can be ejected.
* @returns %TRUE if the @mount can be ejected.
*/
can_eject(): boolean
/**
* Checks if `mount` can be unmounted.
* @returns %TRUE if the @mount can be unmounted.
*/
can_unmount(): boolean
/**
* Ejects a mount. This is an asynchronous operation, and is
* finished by calling g_mount_eject_finish() with the `mount`
* and #GAsyncResult data returned in the `callback`.
* @param flags flags affecting the unmount if required for eject
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
eject(flags: MountUnmountFlags, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes ejecting a mount. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
* @param result a #GAsyncResult.
* @returns %TRUE if the mount was successfully ejected. %FALSE otherwise.
*/
eject_finish(result: AsyncResult): boolean
/**
* Ejects a mount. This is an asynchronous operation, and is
* finished by calling g_mount_eject_with_operation_finish() with the `mount`
* and #GAsyncResult data returned in the `callback`.
* @param flags flags affecting the unmount if required for eject
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
eject_with_operation(flags: MountUnmountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes ejecting a mount. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
* @param result a #GAsyncResult.
* @returns %TRUE if the mount was successfully ejected. %FALSE otherwise.
*/
eject_with_operation_finish(result: AsyncResult): boolean
/**
* Gets the default location of `mount`. The default location of the given
* `mount` is a path that reflects the main entry point for the user (e.g.
* the home directory, or the root of the volume).
* @returns a #GFile. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
get_default_location(): File
/**
* Gets the drive for the `mount`.
*
* This is a convenience method for getting the #GVolume and then
* using that object to get the #GDrive.
* @returns a #GDrive or %NULL if @mount is not associated with a volume or a drive. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
get_drive(): Drive | null
/**
* Gets the icon for `mount`.
* @returns a #GIcon. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
get_icon(): Icon
/**
* Gets the name of `mount`.
* @returns the name for the given @mount. The returned string should be freed with g_free() when no longer needed.
*/
get_name(): string | null
/**
* Gets the root directory on `mount`.
* @returns a #GFile. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
get_root(): File
/**
* Gets the sort key for `mount,` if any.
* @returns Sorting key for @mount or %NULL if no such key is available.
*/
get_sort_key(): string | null
/**
* Gets the symbolic icon for `mount`.
* @returns a #GIcon. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
get_symbolic_icon(): Icon
/**
* Gets the UUID for the `mount`. The reference is typically based on
* the file system UUID for the mount in question and should be
* considered an opaque string. Returns %NULL if there is no UUID
* available.
* @returns the UUID for @mount or %NULL if no UUID can be computed. The returned string should be freed with g_free() when no longer needed.
*/
get_uuid(): string | null
/**
* Gets the volume for the `mount`.
* @returns a #GVolume or %NULL if @mount is not associated with a volume. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
get_volume(): Volume | null
/**
* Tries to guess the type of content stored on `mount`. Returns one or
* more textual identifiers of well-known content types (typically
* prefixed with "x-content/"), e.g. x-content/image-dcf for camera
* memory cards. See the
* [shared-mime-info](http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec)
* specification for more on x-content types.
*
* This is an asynchronous operation (see
* g_mount_guess_content_type_sync() for the synchronous version), and
* is finished by calling g_mount_guess_content_type_finish() with the
* `mount` and #GAsyncResult data returned in the `callback`.
* @param force_rescan Whether to force a rescan of the content. Otherwise a cached result will be used if available
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback
*/
guess_content_type(force_rescan: boolean, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes guessing content types of `mount`. If any errors occurred
* during the operation, `error` will be set to contain the errors and
* %FALSE will be returned. In particular, you may get an
* %G_IO_ERROR_NOT_SUPPORTED if the mount does not support content
* guessing.
* @param result a #GAsyncResult
* @returns a %NULL-terminated array of content types or %NULL on error. Caller should free this array with g_strfreev() when done with it.
*/
guess_content_type_finish(result: AsyncResult): string[]
/**
* Tries to guess the type of content stored on `mount`. Returns one or
* more textual identifiers of well-known content types (typically
* prefixed with "x-content/"), e.g. x-content/image-dcf for camera
* memory cards. See the
* [shared-mime-info](http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec)
* specification for more on x-content types.
*
* This is a synchronous operation and as such may block doing IO;
* see g_mount_guess_content_type() for the asynchronous version.
* @param force_rescan Whether to force a rescan of the content. Otherwise a cached result will be used if available
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a %NULL-terminated array of content types or %NULL on error. Caller should free this array with g_strfreev() when done with it.
*/
guess_content_type_sync(force_rescan: boolean, cancellable: Cancellable | null): string[]
/**
* Determines if `mount` is shadowed. Applications or libraries should
* avoid displaying `mount` in the user interface if it is shadowed.
*
* A mount is said to be shadowed if there exists one or more user
* visible objects (currently #GMount objects) with a root that is
* inside the root of `mount`.
*
* One application of shadow mounts is when exposing a single file
* system that is used to address several logical volumes. In this
* situation, a #GVolumeMonitor implementation would create two
* #GVolume objects (for example, one for the camera functionality of
* the device and one for a SD card reader on the device) with
* activation URIs `gphoto2://[usb:001,002]/store1/`
* and `gphoto2://[usb:001,002]/store2/`. When the
* underlying mount (with root
* `gphoto2://[usb:001,002]/`) is mounted, said
* #GVolumeMonitor implementation would create two #GMount objects
* (each with their root matching the corresponding volume activation
* root) that would shadow the original mount.
*
* The proxy monitor in GVfs 2.26 and later, automatically creates and
* manage shadow mounts (and shadows the underlying mount) if the
* activation root on a #GVolume is set.
* @returns %TRUE if @mount is shadowed.
*/
is_shadowed(): boolean
/**
* Remounts a mount. This is an asynchronous operation, and is
* finished by calling g_mount_remount_finish() with the `mount`
* and #GAsyncResults data returned in the `callback`.
*
* Remounting is useful when some setting affecting the operation
* of the volume has been changed, as these may need a remount to
* take affect. While this is semantically equivalent with unmounting
* and then remounting not all backends might need to actually be
* unmounted.
* @param flags flags affecting the operation
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
remount(flags: MountMountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes remounting a mount. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
* @param result a #GAsyncResult.
* @returns %TRUE if the mount was successfully remounted. %FALSE otherwise.
*/
remount_finish(result: AsyncResult): boolean
/**
* Increments the shadow count on `mount`. Usually used by
* #GVolumeMonitor implementations when creating a shadow mount for
* `mount,` see g_mount_is_shadowed() for more information. The caller
* will need to emit the #GMount::changed signal on `mount` manually.
*/
shadow(): void
/**
* Unmounts a mount. This is an asynchronous operation, and is
* finished by calling g_mount_unmount_finish() with the `mount`
* and #GAsyncResult data returned in the `callback`.
* @param flags flags affecting the operation
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
unmount(flags: MountUnmountFlags, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes unmounting a mount. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
* @param result a #GAsyncResult.
* @returns %TRUE if the mount was successfully unmounted. %FALSE otherwise.
*/
unmount_finish(result: AsyncResult): boolean
/**
* Unmounts a mount. This is an asynchronous operation, and is
* finished by calling g_mount_unmount_with_operation_finish() with the `mount`
* and #GAsyncResult data returned in the `callback`.
* @param flags flags affecting the operation
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
unmount_with_operation(flags: MountUnmountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes unmounting a mount. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
* @param result a #GAsyncResult.
* @returns %TRUE if the mount was successfully unmounted. %FALSE otherwise.
*/
unmount_with_operation_finish(result: AsyncResult): boolean
/**
* Decrements the shadow count on `mount`. Usually used by
* #GVolumeMonitor implementations when destroying a shadow mount for
* `mount,` see g_mount_is_shadowed() for more information. The caller
* will need to emit the #GMount::changed signal on `mount` manually.
*/
unshadow(): void
// Own virtual methods of Gio-2.0.Gio.Mount
/**
* Checks if `mount` can be ejected.
* @virtual
* @returns %TRUE if the @mount can be ejected.
*/
vfunc_can_eject(): boolean
/**
* Checks if `mount` can be unmounted.
* @virtual
* @returns %TRUE if the @mount can be unmounted.
*/
vfunc_can_unmount(): boolean
vfunc_changed(): void
/**
* Ejects a mount. This is an asynchronous operation, and is
* finished by calling g_mount_eject_finish() with the `mount`
* and #GAsyncResult data returned in the `callback`.
* @virtual
* @param flags flags affecting the unmount if required for eject
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
vfunc_eject(flags: MountUnmountFlags, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes ejecting a mount. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
* @virtual
* @param result a #GAsyncResult.
* @returns %TRUE if the mount was successfully ejected. %FALSE otherwise.
*/
vfunc_eject_finish(result: AsyncResult): boolean
/**
* Ejects a mount. This is an asynchronous operation, and is
* finished by calling g_mount_eject_with_operation_finish() with the `mount`
* and #GAsyncResult data returned in the `callback`.
* @virtual
* @param flags flags affecting the unmount if required for eject
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
vfunc_eject_with_operation(flags: MountUnmountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes ejecting a mount. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
* @virtual
* @param result a #GAsyncResult.
* @returns %TRUE if the mount was successfully ejected. %FALSE otherwise.
*/
vfunc_eject_with_operation_finish(result: AsyncResult): boolean
/**
* Gets the default location of `mount`. The default location of the given
* `mount` is a path that reflects the main entry point for the user (e.g.
* the home directory, or the root of the volume).
* @virtual
* @returns a #GFile. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
vfunc_get_default_location(): File
/**
* Gets the drive for the `mount`.
*
* This is a convenience method for getting the #GVolume and then
* using that object to get the #GDrive.
* @virtual
* @returns a #GDrive or %NULL if @mount is not associated with a volume or a drive. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
vfunc_get_drive(): Drive | null
/**
* Gets the icon for `mount`.
* @virtual
* @returns a #GIcon. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
vfunc_get_icon(): Icon
/**
* Gets the name of `mount`.
* @virtual
* @returns the name for the given @mount. The returned string should be freed with g_free() when no longer needed.
*/
vfunc_get_name(): string | null
/**
* Gets the root directory on `mount`.
* @virtual
* @returns a #GFile. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
vfunc_get_root(): File
/**
* Gets the sort key for `mount,` if any.
* @virtual
* @returns Sorting key for @mount or %NULL if no such key is available.
*/
vfunc_get_sort_key(): string | null
/**
* Gets the symbolic icon for `mount`.
* @virtual
* @returns a #GIcon. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
vfunc_get_symbolic_icon(): Icon
/**
* Gets the UUID for the `mount`. The reference is typically based on
* the file system UUID for the mount in question and should be
* considered an opaque string. Returns %NULL if there is no UUID
* available.
* @virtual
* @returns the UUID for @mount or %NULL if no UUID can be computed. The returned string should be freed with g_free() when no longer needed.
*/
vfunc_get_uuid(): string | null
/**
* Gets the volume for the `mount`.
* @virtual
* @returns a #GVolume or %NULL if @mount is not associated with a volume. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
vfunc_get_volume(): Volume | null
/**
* Tries to guess the type of content stored on `mount`. Returns one or
* more textual identifiers of well-known content types (typically
* prefixed with "x-content/"), e.g. x-content/image-dcf for camera
* memory cards. See the
* [shared-mime-info](http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec)
* specification for more on x-content types.
*
* This is an asynchronous operation (see
* g_mount_guess_content_type_sync() for the synchronous version), and
* is finished by calling g_mount_guess_content_type_finish() with the
* `mount` and #GAsyncResult data returned in the `callback`.
* @virtual
* @param force_rescan Whether to force a rescan of the content. Otherwise a cached result will be used if available
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback
*/
vfunc_guess_content_type(force_rescan: boolean, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes guessing content types of `mount`. If any errors occurred
* during the operation, `error` will be set to contain the errors and
* %FALSE will be returned. In particular, you may get an
* %G_IO_ERROR_NOT_SUPPORTED if the mount does not support content
* guessing.
* @virtual
* @param result a #GAsyncResult
* @returns a %NULL-terminated array of content types or %NULL on error. Caller should free this array with g_strfreev() when done with it.
*/
vfunc_guess_content_type_finish(result: AsyncResult): string[]
/**
* Tries to guess the type of content stored on `mount`. Returns one or
* more textual identifiers of well-known content types (typically
* prefixed with "x-content/"), e.g. x-content/image-dcf for camera
* memory cards. See the
* [shared-mime-info](http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec)
* specification for more on x-content types.
*
* This is a synchronous operation and as such may block doing IO;
* see g_mount_guess_content_type() for the asynchronous version.
* @virtual
* @param force_rescan Whether to force a rescan of the content. Otherwise a cached result will be used if available
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns a %NULL-terminated array of content types or %NULL on error. Caller should free this array with g_strfreev() when done with it.
*/
vfunc_guess_content_type_sync(force_rescan: boolean, cancellable: Cancellable | null): string[]
vfunc_pre_unmount(): void
/**
* Remounts a mount. This is an asynchronous operation, and is
* finished by calling g_mount_remount_finish() with the `mount`
* and #GAsyncResults data returned in the `callback`.
*
* Remounting is useful when some setting affecting the operation
* of the volume has been changed, as these may need a remount to
* take affect. While this is semantically equivalent with unmounting
* and then remounting not all backends might need to actually be
* unmounted.
* @virtual
* @param flags flags affecting the operation
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
vfunc_remount(flags: MountMountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes remounting a mount. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
* @virtual
* @param result a #GAsyncResult.
* @returns %TRUE if the mount was successfully remounted. %FALSE otherwise.
*/
vfunc_remount_finish(result: AsyncResult): boolean
/**
* Unmounts a mount. This is an asynchronous operation, and is
* finished by calling g_mount_unmount_finish() with the `mount`
* and #GAsyncResult data returned in the `callback`.
* @virtual
* @param flags flags affecting the operation
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
vfunc_unmount(flags: MountUnmountFlags, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes unmounting a mount. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
* @virtual
* @param result a #GAsyncResult.
* @returns %TRUE if the mount was successfully unmounted. %FALSE otherwise.
*/
vfunc_unmount_finish(result: AsyncResult): boolean
/**
* Unmounts a mount. This is an asynchronous operation, and is
* finished by calling g_mount_unmount_with_operation_finish() with the `mount`
* and #GAsyncResult data returned in the `callback`.
* @virtual
* @param flags flags affecting the operation
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback, or %NULL.
*/
vfunc_unmount_with_operation(flags: MountUnmountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes unmounting a mount. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
* @virtual
* @param result a #GAsyncResult.
* @returns %TRUE if the mount was successfully unmounted. %FALSE otherwise.
*/
vfunc_unmount_with_operation_finish(result: AsyncResult): boolean
vfunc_unmounted(): void
// Own signals of Gio-2.0.Gio.Mount
connect(sigName: "changed", callback: Mount.ChangedSignalCallback): number
connect_after(sigName: "changed", callback: Mount.ChangedSignalCallback): number
emit(sigName: "changed", ...args: any[]): void
connect(sigName: "pre-unmount", callback: Mount.PreUnmountSignalCallback): number
connect_after(sigName: "pre-unmount", callback: Mount.PreUnmountSignalCallback): number
emit(sigName: "pre-unmount", ...args: any[]): void
connect(sigName: "unmounted", callback: Mount.UnmountedSignalCallback): number
connect_after(sigName: "unmounted", callback: Mount.UnmountedSignalCallback): number
emit(sigName: "unmounted", ...args: any[]): void
// Class property signals of Gio-2.0.Gio.Mount
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* The #GMount interface represents user-visible mounts. Note, when
* porting from GnomeVFS, #GMount is the moral equivalent of #GnomeVFSVolume.
*
* #GMount is a "mounted" filesystem that you can access. Mounted is in
* quotes because it's not the same as a unix mount, it might be a gvfs
* mount, but you can still access the files on it if you use GIO. Might or
* might not be related to a volume object.
*
* Unmounting a #GMount instance is an asynchronous operation. For
* more information about asynchronous operations, see #GAsyncResult
* and #GTask. To unmount a #GMount instance, first call
* g_mount_unmount_with_operation() with (at least) the #GMount instance and a
* #GAsyncReadyCallback. The callback will be fired when the
* operation has resolved (either with success or failure), and a
* #GAsyncResult structure will be passed to the callback. That
* callback should then call g_mount_unmount_with_operation_finish() with the #GMount
* and the #GAsyncResult data to see if the operation was completed
* successfully. If an `error` is present when g_mount_unmount_with_operation_finish()
* is called, then it will be filled with any error information.
* @interface
*/
export class Mount extends GObject.Object {
// Own properties of Gio-2.0.Gio.Mount
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.Mount
constructor(config?: Mount.ConstructorProperties)
_init(config?: Mount.ConstructorProperties): void
}
export module NetworkMonitor {
// Signal callback interfaces
/**
* Signal callback interface for `network-changed`
*/
export interface NetworkChangedSignalCallback {
($obj: NetworkMonitor, network_available: boolean): void
}
// Constructor properties interface
export interface ConstructorProperties extends Initable.ConstructorProperties, GObject.Object.ConstructorProperties {
}
}
export interface NetworkMonitor extends Initable {
// Own properties of Gio-2.0.Gio.NetworkMonitor
/**
* More detailed information about the host's network connectivity.
* See g_network_monitor_get_connectivity() and
* #GNetworkConnectivity for more details.
*/
readonly connectivity: NetworkConnectivity
/**
* Whether the network is considered available. That is, whether the
* system has a default route for at least one of IPv4 or IPv6.
*
* Real-world networks are of course much more complicated than
* this; the machine may be connected to a wifi hotspot that
* requires payment before allowing traffic through, or may be
* connected to a functioning router that has lost its own upstream
* connectivity. Some hosts might only be accessible when a VPN is
* active. Other hosts might only be accessible when the VPN is
* not active. Thus, it is best to use g_network_monitor_can_reach()
* or g_network_monitor_can_reach_async() to test for reachability
* on a host-by-host basis. (On the other hand, when the property is
* %FALSE, the application can reasonably expect that no remote
* hosts at all are reachable, and should indicate this to the user
* in its UI.)
*
* See also #GNetworkMonitor::network-changed.
*/
readonly network_available: boolean
/**
* Whether the network is considered metered.
*
* That is, whether the
* system has traffic flowing through the default connection that is
* subject to limitations set by service providers. For example, traffic
* might be billed by the amount of data transmitted, or there might be a
* quota on the amount of traffic per month. This is typical with tethered
* connections (3G and 4G) and in such situations, bandwidth intensive
* applications may wish to avoid network activity where possible if it will
* cost the user money or use up their limited quota. Anything more than a
* few hundreds of kilobytes of data usage per hour should be avoided without
* asking permission from the user.
*
* If more information is required about specific devices then the
* system network management API should be used instead (for example,
* NetworkManager or ConnMan).
*
* If this information is not available then no networks will be
* marked as metered.
*
* See also #GNetworkMonitor:network-available.
*/
readonly network_metered: boolean
// Owm methods of Gio-2.0.Gio.NetworkMonitor
/**
* Attempts to determine whether or not the host pointed to by
* `connectable` can be reached, without actually trying to connect to
* it.
*
* This may return %TRUE even when #GNetworkMonitor:network-available
* is %FALSE, if, for example, `monitor` can determine that
* `connectable` refers to a host on a local network.
*
* If `monitor` believes that an attempt to connect to `connectable`
* will succeed, it will return %TRUE. Otherwise, it will return
* %FALSE and set `error` to an appropriate error (such as
* %G_IO_ERROR_HOST_UNREACHABLE).
*
* Note that although this does not attempt to connect to
* `connectable,` it may still block for a brief period of time (eg,
* trying to do multicast DNS on the local network), so if you do not
* want to block, you should use g_network_monitor_can_reach_async().
* @param connectable a #GSocketConnectable
* @param cancellable a #GCancellable, or %NULL
* @returns %TRUE if @connectable is reachable, %FALSE if not.
*/
can_reach(connectable: SocketConnectable, cancellable: Cancellable | null): boolean
/**
* Asynchronously attempts to determine whether or not the host
* pointed to by `connectable` can be reached, without actually
* trying to connect to it.
*
* For more details, see g_network_monitor_can_reach().
*
* When the operation is finished, `callback` will be called.
* You can then call g_network_monitor_can_reach_finish()
* to get the result of the operation.
* @param connectable a #GSocketConnectable
* @param cancellable a #GCancellable, or %NULL
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
can_reach_async(connectable: SocketConnectable, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of can_reach_async
/**
* Promisified version of {@link can_reach_async}
*
* Asynchronously attempts to determine whether or not the host
* pointed to by `connectable` can be reached, without actually
* trying to connect to it.
*
* For more details, see g_network_monitor_can_reach().
*
* When the operation is finished, `callback` will be called.
* You can then call g_network_monitor_can_reach_finish()
* to get the result of the operation.
* @param connectable a #GSocketConnectable
* @param cancellable a #GCancellable, or %NULL
* @returns A Promise of: %TRUE if network is reachable, %FALSE if not.
*/
can_reach_async(connectable: SocketConnectable, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes an async network connectivity test.
* See g_network_monitor_can_reach_async().
* @param result a #GAsyncResult
* @returns %TRUE if network is reachable, %FALSE if not.
*/
can_reach_finish(result: AsyncResult): boolean
/**
* Gets a more detailed networking state than
* g_network_monitor_get_network_available().
*
* If #GNetworkMonitor:network-available is %FALSE, then the
* connectivity state will be %G_NETWORK_CONNECTIVITY_LOCAL.
*
* If #GNetworkMonitor:network-available is %TRUE, then the
* connectivity state will be %G_NETWORK_CONNECTIVITY_FULL (if there
* is full Internet connectivity), %G_NETWORK_CONNECTIVITY_LIMITED (if
* the host has a default route, but appears to be unable to actually
* reach the full Internet), or %G_NETWORK_CONNECTIVITY_PORTAL (if the
* host is trapped behind a "captive portal" that requires some sort
* of login or acknowledgement before allowing full Internet access).
*
* Note that in the case of %G_NETWORK_CONNECTIVITY_LIMITED and
* %G_NETWORK_CONNECTIVITY_PORTAL, it is possible that some sites are
* reachable but others are not. In this case, applications can
* attempt to connect to remote servers, but should gracefully fall
* back to their "offline" behavior if the connection attempt fails.
* @returns the network connectivity state
*/
get_connectivity(): NetworkConnectivity
/**
* Checks if the network is available. "Available" here means that the
* system has a default route available for at least one of IPv4 or
* IPv6. It does not necessarily imply that the public Internet is
* reachable. See #GNetworkMonitor:network-available for more details.
* @returns whether the network is available
*/
get_network_available(): boolean
/**
* Checks if the network is metered.
* See #GNetworkMonitor:network-metered for more details.
* @returns whether the connection is metered
*/
get_network_metered(): boolean
// Own virtual methods of Gio-2.0.Gio.NetworkMonitor
/**
* Attempts to determine whether or not the host pointed to by
* `connectable` can be reached, without actually trying to connect to
* it.
*
* This may return %TRUE even when #GNetworkMonitor:network-available
* is %FALSE, if, for example, `monitor` can determine that
* `connectable` refers to a host on a local network.
*
* If `monitor` believes that an attempt to connect to `connectable`
* will succeed, it will return %TRUE. Otherwise, it will return
* %FALSE and set `error` to an appropriate error (such as
* %G_IO_ERROR_HOST_UNREACHABLE).
*
* Note that although this does not attempt to connect to
* `connectable,` it may still block for a brief period of time (eg,
* trying to do multicast DNS on the local network), so if you do not
* want to block, you should use g_network_monitor_can_reach_async().
* @virtual
* @param connectable a #GSocketConnectable
* @param cancellable a #GCancellable, or %NULL
* @returns %TRUE if @connectable is reachable, %FALSE if not.
*/
vfunc_can_reach(connectable: SocketConnectable, cancellable: Cancellable | null): boolean
/**
* Asynchronously attempts to determine whether or not the host
* pointed to by `connectable` can be reached, without actually
* trying to connect to it.
*
* For more details, see g_network_monitor_can_reach().
*
* When the operation is finished, `callback` will be called.
* You can then call g_network_monitor_can_reach_finish()
* to get the result of the operation.
* @virtual
* @param connectable a #GSocketConnectable
* @param cancellable a #GCancellable, or %NULL
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_can_reach_async(connectable: SocketConnectable, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an async network connectivity test.
* See g_network_monitor_can_reach_async().
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE if network is reachable, %FALSE if not.
*/
vfunc_can_reach_finish(result: AsyncResult): boolean
vfunc_network_changed(network_available: boolean): void
// Own signals of Gio-2.0.Gio.NetworkMonitor
connect(sigName: "network-changed", callback: NetworkMonitor.NetworkChangedSignalCallback): number
connect_after(sigName: "network-changed", callback: NetworkMonitor.NetworkChangedSignalCallback): number
emit(sigName: "network-changed", network_available: boolean, ...args: any[]): void
// Class property signals of Gio-2.0.Gio.NetworkMonitor
connect(sigName: "notify::connectivity", callback: (($obj: NetworkMonitor, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::connectivity", callback: (($obj: NetworkMonitor, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::connectivity", ...args: any[]): void
connect(sigName: "notify::network-available", callback: (($obj: NetworkMonitor, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::network-available", callback: (($obj: NetworkMonitor, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::network-available", ...args: any[]): void
connect(sigName: "notify::network-metered", callback: (($obj: NetworkMonitor, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::network-metered", callback: (($obj: NetworkMonitor, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::network-metered", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GNetworkMonitor provides an easy-to-use cross-platform API
* for monitoring network connectivity. On Linux, the available
* implementations are based on the kernel's netlink interface and
* on NetworkManager.
*
* There is also an implementation for use inside Flatpak sandboxes.
* @interface
*/
export class NetworkMonitor extends GObject.Object {
// Own properties of Gio-2.0.Gio.NetworkMonitor
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.NetworkMonitor
constructor(config?: NetworkMonitor.ConstructorProperties)
_init(config?: NetworkMonitor.ConstructorProperties): void
/**
* Gets the default #GNetworkMonitor for the system.
* @returns a #GNetworkMonitor, which will be a dummy object if no network monitor is available
*/
static get_default(): NetworkMonitor
}
export module PollableInputStream {
// Constructor properties interface
export interface ConstructorProperties extends InputStream.ConstructorProperties, GObject.Object.ConstructorProperties {
}
}
export interface PollableInputStream extends InputStream {
// Owm methods of Gio-2.0.Gio.PollableInputStream
/**
* Checks if `stream` is actually pollable. Some classes may implement
* #GPollableInputStream but have only certain instances of that class
* be pollable. If this method returns %FALSE, then the behavior of
* other #GPollableInputStream methods is undefined.
*
* For any given stream, the value returned by this method is constant;
* a stream cannot switch from pollable to non-pollable or vice versa.
* @returns %TRUE if @stream is pollable, %FALSE if not.
*/
can_poll(): boolean
/**
* Creates a #GSource that triggers when `stream` can be read, or
* `cancellable` is triggered or an error occurs. The callback on the
* source is of the #GPollableSourceFunc type.
*
* As with g_pollable_input_stream_is_readable(), it is possible that
* the stream may not actually be readable even after the source
* triggers, so you should use g_pollable_input_stream_read_nonblocking()
* rather than g_input_stream_read() from the callback.
*
* The behaviour of this method is undefined if
* g_pollable_input_stream_can_poll() returns %FALSE for `stream`.
* @param cancellable a #GCancellable, or %NULL
* @returns a new #GSource
*/
create_source(cancellable: Cancellable | null): GLib.Source
/**
* Checks if `stream` can be read.
*
* Note that some stream types may not be able to implement this 100%
* reliably, and it is possible that a call to g_input_stream_read()
* after this returns %TRUE would still block. To guarantee
* non-blocking behavior, you should always use
* g_pollable_input_stream_read_nonblocking(), which will return a
* %G_IO_ERROR_WOULD_BLOCK error rather than blocking.
*
* The behaviour of this method is undefined if
* g_pollable_input_stream_can_poll() returns %FALSE for `stream`.
* @returns %TRUE if @stream is readable, %FALSE if not. If an error has occurred on @stream, this will result in g_pollable_input_stream_is_readable() returning %TRUE, and the next attempt to read will return the error.
*/
is_readable(): boolean
/**
* Attempts to read up to `count` bytes from `stream` into `buffer,` as
* with g_input_stream_read(). If `stream` is not currently readable,
* this will immediately return %G_IO_ERROR_WOULD_BLOCK, and you can
* use g_pollable_input_stream_create_source() to create a #GSource
* that will be triggered when `stream` is readable.
*
* Note that since this method never blocks, you cannot actually
* use `cancellable` to cancel it. However, it will return an error
* if `cancellable` has already been cancelled when you call, which
* may happen if you call this method after a source triggers due
* to having been cancelled.
*
* The behaviour of this method is undefined if
* g_pollable_input_stream_can_poll() returns %FALSE for `stream`.
* @param cancellable a #GCancellable, or %NULL
* @returns the number of bytes read, or -1 on error (including %G_IO_ERROR_WOULD_BLOCK).
*/
read_nonblocking(cancellable: Cancellable | null): [ /* returnType */ number, /* buffer */ Uint8Array ]
// Own virtual methods of Gio-2.0.Gio.PollableInputStream
/**
* Checks if `stream` is actually pollable. Some classes may implement
* #GPollableInputStream but have only certain instances of that class
* be pollable. If this method returns %FALSE, then the behavior of
* other #GPollableInputStream methods is undefined.
*
* For any given stream, the value returned by this method is constant;
* a stream cannot switch from pollable to non-pollable or vice versa.
* @virtual
* @returns %TRUE if @stream is pollable, %FALSE if not.
*/
vfunc_can_poll(): boolean
/**
* Creates a #GSource that triggers when `stream` can be read, or
* `cancellable` is triggered or an error occurs. The callback on the
* source is of the #GPollableSourceFunc type.
*
* As with g_pollable_input_stream_is_readable(), it is possible that
* the stream may not actually be readable even after the source
* triggers, so you should use g_pollable_input_stream_read_nonblocking()
* rather than g_input_stream_read() from the callback.
*
* The behaviour of this method is undefined if
* g_pollable_input_stream_can_poll() returns %FALSE for `stream`.
* @virtual
* @param cancellable a #GCancellable, or %NULL
* @returns a new #GSource
*/
vfunc_create_source(cancellable: Cancellable | null): GLib.Source
/**
* Checks if `stream` can be read.
*
* Note that some stream types may not be able to implement this 100%
* reliably, and it is possible that a call to g_input_stream_read()
* after this returns %TRUE would still block. To guarantee
* non-blocking behavior, you should always use
* g_pollable_input_stream_read_nonblocking(), which will return a
* %G_IO_ERROR_WOULD_BLOCK error rather than blocking.
*
* The behaviour of this method is undefined if
* g_pollable_input_stream_can_poll() returns %FALSE for `stream`.
* @virtual
* @returns %TRUE if @stream is readable, %FALSE if not. If an error has occurred on @stream, this will result in g_pollable_input_stream_is_readable() returning %TRUE, and the next attempt to read will return the error.
*/
vfunc_is_readable(): boolean
/**
* Attempts to read up to `count` bytes from `stream` into `buffer,` as
* with g_input_stream_read(). If `stream` is not currently readable,
* this will immediately return %G_IO_ERROR_WOULD_BLOCK, and you can
* use g_pollable_input_stream_create_source() to create a #GSource
* that will be triggered when `stream` is readable.
*
* Note that since this method never blocks, you cannot actually
* use `cancellable` to cancel it. However, it will return an error
* if `cancellable` has already been cancelled when you call, which
* may happen if you call this method after a source triggers due
* to having been cancelled.
*
* The behaviour of this method is undefined if
* g_pollable_input_stream_can_poll() returns %FALSE for `stream`.
* @virtual
* @returns the number of bytes read, or -1 on error (including %G_IO_ERROR_WOULD_BLOCK).
*/
vfunc_read_nonblocking(): [ /* returnType */ number, /* buffer */ Uint8Array | null ]
// Class property signals of Gio-2.0.Gio.PollableInputStream
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GPollableInputStream is implemented by #GInputStreams that
* can be polled for readiness to read. This can be used when
* interfacing with a non-GIO API that expects
* UNIX-file-descriptor-style asynchronous I/O rather than GIO-style.
*
* Some classes may implement #GPollableInputStream but have only certain
* instances of that class be pollable. If g_pollable_input_stream_can_poll()
* returns %FALSE, then the behavior of other #GPollableInputStream methods is
* undefined.
* @interface
*/
export class PollableInputStream extends GObject.Object {
// Own properties of Gio-2.0.Gio.PollableInputStream
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.PollableInputStream
constructor(config?: PollableInputStream.ConstructorProperties)
_init(config?: PollableInputStream.ConstructorProperties): void
}
export module PollableOutputStream {
// Constructor properties interface
export interface ConstructorProperties extends OutputStream.ConstructorProperties, GObject.Object.ConstructorProperties {
}
}
export interface PollableOutputStream extends OutputStream {
// Owm methods of Gio-2.0.Gio.PollableOutputStream
/**
* Checks if `stream` is actually pollable. Some classes may implement
* #GPollableOutputStream but have only certain instances of that
* class be pollable. If this method returns %FALSE, then the behavior
* of other #GPollableOutputStream methods is undefined.
*
* For any given stream, the value returned by this method is constant;
* a stream cannot switch from pollable to non-pollable or vice versa.
* @returns %TRUE if @stream is pollable, %FALSE if not.
*/
can_poll(): boolean
/**
* Creates a #GSource that triggers when `stream` can be written, or
* `cancellable` is triggered or an error occurs. The callback on the
* source is of the #GPollableSourceFunc type.
*
* As with g_pollable_output_stream_is_writable(), it is possible that
* the stream may not actually be writable even after the source
* triggers, so you should use g_pollable_output_stream_write_nonblocking()
* rather than g_output_stream_write() from the callback.
*
* The behaviour of this method is undefined if
* g_pollable_output_stream_can_poll() returns %FALSE for `stream`.
* @param cancellable a #GCancellable, or %NULL
* @returns a new #GSource
*/
create_source(cancellable: Cancellable | null): GLib.Source
/**
* Checks if `stream` can be written.
*
* Note that some stream types may not be able to implement this 100%
* reliably, and it is possible that a call to g_output_stream_write()
* after this returns %TRUE would still block. To guarantee
* non-blocking behavior, you should always use
* g_pollable_output_stream_write_nonblocking(), which will return a
* %G_IO_ERROR_WOULD_BLOCK error rather than blocking.
*
* The behaviour of this method is undefined if
* g_pollable_output_stream_can_poll() returns %FALSE for `stream`.
* @returns %TRUE if @stream is writable, %FALSE if not. If an error has occurred on @stream, this will result in g_pollable_output_stream_is_writable() returning %TRUE, and the next attempt to write will return the error.
*/
is_writable(): boolean
/**
* Attempts to write up to `count` bytes from `buffer` to `stream,` as
* with g_output_stream_write(). If `stream` is not currently writable,
* this will immediately return %G_IO_ERROR_WOULD_BLOCK, and you can
* use g_pollable_output_stream_create_source() to create a #GSource
* that will be triggered when `stream` is writable.
*
* Note that since this method never blocks, you cannot actually
* use `cancellable` to cancel it. However, it will return an error
* if `cancellable` has already been cancelled when you call, which
* may happen if you call this method after a source triggers due
* to having been cancelled.
*
* Also note that if %G_IO_ERROR_WOULD_BLOCK is returned some underlying
* transports like D/TLS require that you re-send the same `buffer` and
* `count` in the next write call.
*
* The behaviour of this method is undefined if
* g_pollable_output_stream_can_poll() returns %FALSE for `stream`.
* @param buffer a buffer to write data from
* @param cancellable a #GCancellable, or %NULL
* @returns the number of bytes written, or -1 on error (including %G_IO_ERROR_WOULD_BLOCK).
*/
write_nonblocking(buffer: Uint8Array, cancellable: Cancellable | null): number
/**
* Attempts to write the bytes contained in the `n_vectors` `vectors` to `stream,`
* as with g_output_stream_writev(). If `stream` is not currently writable,
* this will immediately return %`G_POLLABLE_RETURN_WOULD_BLOCK,` and you can
* use g_pollable_output_stream_create_source() to create a #GSource
* that will be triggered when `stream` is writable. `error` will *not* be
* set in that case.
*
* Note that since this method never blocks, you cannot actually
* use `cancellable` to cancel it. However, it will return an error
* if `cancellable` has already been cancelled when you call, which
* may happen if you call this method after a source triggers due
* to having been cancelled.
*
* Also note that if %G_POLLABLE_RETURN_WOULD_BLOCK is returned some underlying
* transports like D/TLS require that you re-send the same `vectors` and
* `n_vectors` in the next write call.
*
* The behaviour of this method is undefined if
* g_pollable_output_stream_can_poll() returns %FALSE for `stream`.
* @param vectors the buffer containing the #GOutputVectors to write.
* @param cancellable a #GCancellable, or %NULL
* @returns %@G_POLLABLE_RETURN_OK on success, %G_POLLABLE_RETURN_WOULD_BLOCK if the stream is not currently writable (and @error is *not* set), or %G_POLLABLE_RETURN_FAILED if there was an error in which case @error will be set.
*/
writev_nonblocking(vectors: OutputVector[], cancellable: Cancellable | null): [ /* returnType */ PollableReturn, /* bytes_written */ number ]
// Own virtual methods of Gio-2.0.Gio.PollableOutputStream
/**
* Checks if `stream` is actually pollable. Some classes may implement
* #GPollableOutputStream but have only certain instances of that
* class be pollable. If this method returns %FALSE, then the behavior
* of other #GPollableOutputStream methods is undefined.
*
* For any given stream, the value returned by this method is constant;
* a stream cannot switch from pollable to non-pollable or vice versa.
* @virtual
* @returns %TRUE if @stream is pollable, %FALSE if not.
*/
vfunc_can_poll(): boolean
/**
* Creates a #GSource that triggers when `stream` can be written, or
* `cancellable` is triggered or an error occurs. The callback on the
* source is of the #GPollableSourceFunc type.
*
* As with g_pollable_output_stream_is_writable(), it is possible that
* the stream may not actually be writable even after the source
* triggers, so you should use g_pollable_output_stream_write_nonblocking()
* rather than g_output_stream_write() from the callback.
*
* The behaviour of this method is undefined if
* g_pollable_output_stream_can_poll() returns %FALSE for `stream`.
* @virtual
* @param cancellable a #GCancellable, or %NULL
* @returns a new #GSource
*/
vfunc_create_source(cancellable: Cancellable | null): GLib.Source
/**
* Checks if `stream` can be written.
*
* Note that some stream types may not be able to implement this 100%
* reliably, and it is possible that a call to g_output_stream_write()
* after this returns %TRUE would still block. To guarantee
* non-blocking behavior, you should always use
* g_pollable_output_stream_write_nonblocking(), which will return a
* %G_IO_ERROR_WOULD_BLOCK error rather than blocking.
*
* The behaviour of this method is undefined if
* g_pollable_output_stream_can_poll() returns %FALSE for `stream`.
* @virtual
* @returns %TRUE if @stream is writable, %FALSE if not. If an error has occurred on @stream, this will result in g_pollable_output_stream_is_writable() returning %TRUE, and the next attempt to write will return the error.
*/
vfunc_is_writable(): boolean
/**
* Attempts to write up to `count` bytes from `buffer` to `stream,` as
* with g_output_stream_write(). If `stream` is not currently writable,
* this will immediately return %G_IO_ERROR_WOULD_BLOCK, and you can
* use g_pollable_output_stream_create_source() to create a #GSource
* that will be triggered when `stream` is writable.
*
* Note that since this method never blocks, you cannot actually
* use `cancellable` to cancel it. However, it will return an error
* if `cancellable` has already been cancelled when you call, which
* may happen if you call this method after a source triggers due
* to having been cancelled.
*
* Also note that if %G_IO_ERROR_WOULD_BLOCK is returned some underlying
* transports like D/TLS require that you re-send the same `buffer` and
* `count` in the next write call.
*
* The behaviour of this method is undefined if
* g_pollable_output_stream_can_poll() returns %FALSE for `stream`.
* @virtual
* @param buffer a buffer to write data from
* @returns the number of bytes written, or -1 on error (including %G_IO_ERROR_WOULD_BLOCK).
*/
vfunc_write_nonblocking(buffer: Uint8Array | null): number
/**
* Attempts to write the bytes contained in the `n_vectors` `vectors` to `stream,`
* as with g_output_stream_writev(). If `stream` is not currently writable,
* this will immediately return %`G_POLLABLE_RETURN_WOULD_BLOCK,` and you can
* use g_pollable_output_stream_create_source() to create a #GSource
* that will be triggered when `stream` is writable. `error` will *not* be
* set in that case.
*
* Note that since this method never blocks, you cannot actually
* use `cancellable` to cancel it. However, it will return an error
* if `cancellable` has already been cancelled when you call, which
* may happen if you call this method after a source triggers due
* to having been cancelled.
*
* Also note that if %G_POLLABLE_RETURN_WOULD_BLOCK is returned some underlying
* transports like D/TLS require that you re-send the same `vectors` and
* `n_vectors` in the next write call.
*
* The behaviour of this method is undefined if
* g_pollable_output_stream_can_poll() returns %FALSE for `stream`.
* @virtual
* @param vectors the buffer containing the #GOutputVectors to write.
* @returns %@G_POLLABLE_RETURN_OK on success, %G_POLLABLE_RETURN_WOULD_BLOCK if the stream is not currently writable (and @error is *not* set), or %G_POLLABLE_RETURN_FAILED if there was an error in which case @error will be set.
*/
vfunc_writev_nonblocking(vectors: OutputVector[]): [ /* returnType */ PollableReturn, /* bytes_written */ number ]
// Class property signals of Gio-2.0.Gio.PollableOutputStream
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GPollableOutputStream is implemented by #GOutputStreams that
* can be polled for readiness to write. This can be used when
* interfacing with a non-GIO API that expects
* UNIX-file-descriptor-style asynchronous I/O rather than GIO-style.
*
* Some classes may implement #GPollableOutputStream but have only certain
* instances of that class be pollable. If g_pollable_output_stream_can_poll()
* returns %FALSE, then the behavior of other #GPollableOutputStream methods is
* undefined.
* @interface
*/
export class PollableOutputStream extends GObject.Object {
// Own properties of Gio-2.0.Gio.PollableOutputStream
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.PollableOutputStream
constructor(config?: PollableOutputStream.ConstructorProperties)
_init(config?: PollableOutputStream.ConstructorProperties): void
}
export module PowerProfileMonitor {
// Constructor properties interface
export interface ConstructorProperties extends Initable.ConstructorProperties, GObject.Object.ConstructorProperties {
}
}
export interface PowerProfileMonitor extends Initable {
// Own properties of Gio-2.0.Gio.PowerProfileMonitor
/**
* Whether “Power Saver” mode is enabled on the system.
*/
readonly power_saver_enabled: boolean
// Owm methods of Gio-2.0.Gio.PowerProfileMonitor
/**
* Gets whether the system is in “Power Saver” mode.
*
* You are expected to listen to the
* #GPowerProfileMonitor::notify::power-saver-enabled signal to know when the profile has
* changed.
* @returns Whether the system is in “Power Saver” mode.
*/
get_power_saver_enabled(): boolean
// Class property signals of Gio-2.0.Gio.PowerProfileMonitor
connect(sigName: "notify::power-saver-enabled", callback: (($obj: PowerProfileMonitor, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::power-saver-enabled", callback: (($obj: PowerProfileMonitor, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::power-saver-enabled", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GPowerProfileMonitor makes it possible for applications as well as OS components
* to monitor system power profiles and act upon them. It currently only exports
* whether the system is in “Power Saver” mode (known as “Low Power” mode on
* some systems).
*
* When in “Low Power” mode, it is recommended that applications:
* - disable automatic downloads;
* - reduce the rate of refresh from online sources such as calendar or
* email synchronisation;
* - reduce the use of expensive visual effects.
*
* It is also likely that OS components providing services to applications will
* lower their own background activity, for the sake of the system.
*
* There are a variety of tools that exist for power consumption analysis, but those
* usually depend on the OS and hardware used. On Linux, one could use `upower` to
* monitor the battery discharge rate, `powertop` to check on the background activity
* or activity at all), `sysprof` to inspect CPU usage, and `intel_gpu_time` to
* profile GPU usage.
*
* Don't forget to disconnect the #GPowerProfileMonitor::notify::power-saver-enabled
* signal, and unref the #GPowerProfileMonitor itself when exiting.
* @interface
*/
export class PowerProfileMonitor extends GObject.Object {
// Own properties of Gio-2.0.Gio.PowerProfileMonitor
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.PowerProfileMonitor
constructor(config?: PowerProfileMonitor.ConstructorProperties)
_init(config?: PowerProfileMonitor.ConstructorProperties): void
/**
* Gets a reference to the default #GPowerProfileMonitor for the system.
* @returns a new reference to the default #GPowerProfileMonitor
*/
static dup_default(): PowerProfileMonitor
}
export module Proxy {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface Proxy {
// Owm methods of Gio-2.0.Gio.Proxy
/**
* Given `connection` to communicate with a proxy (eg, a
* #GSocketConnection that is connected to the proxy server), this
* does the necessary handshake to connect to `proxy_address,` and if
* required, wraps the #GIOStream to handle proxy payload.
* @param connection a #GIOStream
* @param proxy_address a #GProxyAddress
* @param cancellable a #GCancellable
* @returns a #GIOStream that will replace @connection. This might be the same as @connection, in which case a reference will be added.
*/
connect(connection: IOStream, proxy_address: ProxyAddress, cancellable: Cancellable | null): IOStream
/**
* Asynchronous version of g_proxy_connect().
* @param connection a #GIOStream
* @param proxy_address a #GProxyAddress
* @param cancellable a #GCancellable
* @param callback a #GAsyncReadyCallback
*/
connect_async(connection: IOStream, proxy_address: ProxyAddress, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of connect_async
/**
* Promisified version of {@link connect_async}
*
* Asynchronous version of g_proxy_connect().
* @param connection a #GIOStream
* @param proxy_address a #GProxyAddress
* @param cancellable a #GCancellable
* @returns A Promise of: a #GIOStream.
*/
connect_async(connection: IOStream, proxy_address: ProxyAddress, cancellable: Cancellable | null): globalThis.Promise
/**
* See g_proxy_connect().
* @param result a #GAsyncResult
* @returns a #GIOStream.
*/
connect_finish(result: AsyncResult): IOStream
/**
* Some proxy protocols expect to be passed a hostname, which they
* will resolve to an IP address themselves. Others, like SOCKS4, do
* not allow this. This function will return %FALSE if `proxy` is
* implementing such a protocol. When %FALSE is returned, the caller
* should resolve the destination hostname first, and then pass a
* #GProxyAddress containing the stringified IP address to
* g_proxy_connect() or g_proxy_connect_async().
* @returns %TRUE if hostname resolution is supported.
*/
supports_hostname(): boolean
// Own virtual methods of Gio-2.0.Gio.Proxy
/**
* Given `connection` to communicate with a proxy (eg, a
* #GSocketConnection that is connected to the proxy server), this
* does the necessary handshake to connect to `proxy_address,` and if
* required, wraps the #GIOStream to handle proxy payload.
* @virtual
* @param connection a #GIOStream
* @param proxy_address a #GProxyAddress
* @param cancellable a #GCancellable
* @returns a #GIOStream that will replace @connection. This might be the same as @connection, in which case a reference will be added.
*/
vfunc_connect(connection: IOStream, proxy_address: ProxyAddress, cancellable: Cancellable | null): IOStream
/**
* Asynchronous version of g_proxy_connect().
* @virtual
* @param connection a #GIOStream
* @param proxy_address a #GProxyAddress
* @param cancellable a #GCancellable
* @param callback a #GAsyncReadyCallback
*/
vfunc_connect_async(connection: IOStream, proxy_address: ProxyAddress, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* See g_proxy_connect().
* @virtual
* @param result a #GAsyncResult
* @returns a #GIOStream.
*/
vfunc_connect_finish(result: AsyncResult): IOStream
/**
* Some proxy protocols expect to be passed a hostname, which they
* will resolve to an IP address themselves. Others, like SOCKS4, do
* not allow this. This function will return %FALSE if `proxy` is
* implementing such a protocol. When %FALSE is returned, the caller
* should resolve the destination hostname first, and then pass a
* #GProxyAddress containing the stringified IP address to
* g_proxy_connect() or g_proxy_connect_async().
* @virtual
* @returns %TRUE if hostname resolution is supported.
*/
vfunc_supports_hostname(): boolean
// Class property signals of Gio-2.0.Gio.Proxy
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* A #GProxy handles connecting to a remote host via a given type of
* proxy server. It is implemented by the 'gio-proxy' extension point.
* The extensions are named after their proxy protocol name. As an
* example, a SOCKS5 proxy implementation can be retrieved with the
* name 'socks5' using the function
* g_io_extension_point_get_extension_by_name().
* @interface
*/
export class Proxy extends GObject.Object {
// Own properties of Gio-2.0.Gio.Proxy
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.Proxy
constructor(config?: Proxy.ConstructorProperties)
_init(config?: Proxy.ConstructorProperties): void
/**
* Find the `gio-proxy` extension point for a proxy implementation that supports
* the specified protocol.
* @param protocol the proxy protocol name (e.g. http, socks, etc)
* @returns return a #GProxy or NULL if protocol is not supported.
*/
static get_default_for_protocol(protocol: string | null): Proxy | null
}
export module ProxyResolver {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface ProxyResolver {
// Owm methods of Gio-2.0.Gio.ProxyResolver
/**
* Checks if `resolver` can be used on this system. (This is used
* internally; g_proxy_resolver_get_default() will only return a proxy
* resolver that returns %TRUE for this method.)
* @returns %TRUE if @resolver is supported.
*/
is_supported(): boolean
/**
* Looks into the system proxy configuration to determine what proxy,
* if any, to use to connect to `uri`. The returned proxy URIs are of
* the form `://[user[:password]`]`host[:port]` or
* `direct://`, where could be http, rtsp, socks
* or other proxying protocol.
*
* If you don't know what network protocol is being used on the
* socket, you should use `none` as the URI protocol.
* In this case, the resolver might still return a generic proxy type
* (such as SOCKS), but would not return protocol-specific proxy types
* (such as http).
*
* `direct://` is used when no proxy is needed.
* Direct connection should not be attempted unless it is part of the
* returned array of proxies.
* @param uri a URI representing the destination to connect to
* @param cancellable a #GCancellable, or %NULL
* @returns A NULL-terminated array of proxy URIs. Must be freed with g_strfreev().
*/
lookup(uri: string | null, cancellable: Cancellable | null): string[]
/**
* Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more
* details.
* @param uri a URI representing the destination to connect to
* @param cancellable a #GCancellable, or %NULL
* @param callback callback to call after resolution completes
*/
lookup_async(uri: string | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of lookup_async
/**
* Promisified version of {@link lookup_async}
*
* Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more
* details.
* @param uri a URI representing the destination to connect to
* @param cancellable a #GCancellable, or %NULL
* @returns A Promise of: A NULL-terminated array of proxy URIs. Must be freed with g_strfreev().
*/
lookup_async(uri: string | null, cancellable: Cancellable | null): globalThis.Promise
/**
* Call this function to obtain the array of proxy URIs when
* g_proxy_resolver_lookup_async() is complete. See
* g_proxy_resolver_lookup() for more details.
* @param result the result passed to your #GAsyncReadyCallback
* @returns A NULL-terminated array of proxy URIs. Must be freed with g_strfreev().
*/
lookup_finish(result: AsyncResult): string[]
// Own virtual methods of Gio-2.0.Gio.ProxyResolver
/**
* Checks if `resolver` can be used on this system. (This is used
* internally; g_proxy_resolver_get_default() will only return a proxy
* resolver that returns %TRUE for this method.)
* @virtual
* @returns %TRUE if @resolver is supported.
*/
vfunc_is_supported(): boolean
/**
* Looks into the system proxy configuration to determine what proxy,
* if any, to use to connect to `uri`. The returned proxy URIs are of
* the form `://[user[:password]`]`host[:port]` or
* `direct://`, where could be http, rtsp, socks
* or other proxying protocol.
*
* If you don't know what network protocol is being used on the
* socket, you should use `none` as the URI protocol.
* In this case, the resolver might still return a generic proxy type
* (such as SOCKS), but would not return protocol-specific proxy types
* (such as http).
*
* `direct://` is used when no proxy is needed.
* Direct connection should not be attempted unless it is part of the
* returned array of proxies.
* @virtual
* @param uri a URI representing the destination to connect to
* @param cancellable a #GCancellable, or %NULL
* @returns A NULL-terminated array of proxy URIs. Must be freed with g_strfreev().
*/
vfunc_lookup(uri: string | null, cancellable: Cancellable | null): string[]
/**
* Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more
* details.
* @virtual
* @param uri a URI representing the destination to connect to
* @param cancellable a #GCancellable, or %NULL
* @param callback callback to call after resolution completes
*/
vfunc_lookup_async(uri: string | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Call this function to obtain the array of proxy URIs when
* g_proxy_resolver_lookup_async() is complete. See
* g_proxy_resolver_lookup() for more details.
* @virtual
* @param result the result passed to your #GAsyncReadyCallback
* @returns A NULL-terminated array of proxy URIs. Must be freed with g_strfreev().
*/
vfunc_lookup_finish(result: AsyncResult): string[]
// Class property signals of Gio-2.0.Gio.ProxyResolver
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GProxyResolver provides synchronous and asynchronous network proxy
* resolution. #GProxyResolver is used within #GSocketClient through
* the method g_socket_connectable_proxy_enumerate().
*
* Implementations of #GProxyResolver based on libproxy and GNOME settings can
* be found in glib-networking. GIO comes with an implementation for use inside
* Flatpak portals.
* @interface
*/
export class ProxyResolver extends GObject.Object {
// Own properties of Gio-2.0.Gio.ProxyResolver
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.ProxyResolver
constructor(config?: ProxyResolver.ConstructorProperties)
_init(config?: ProxyResolver.ConstructorProperties): void
/**
* Gets the default #GProxyResolver for the system.
* @returns the default #GProxyResolver, which will be a dummy object if no proxy resolver is available
*/
static get_default(): ProxyResolver
}
export module RemoteActionGroup {
// Constructor properties interface
export interface ConstructorProperties extends ActionGroup.ConstructorProperties, GObject.Object.ConstructorProperties {
}
}
export interface RemoteActionGroup extends ActionGroup {
// Owm methods of Gio-2.0.Gio.RemoteActionGroup
/**
* Activates the remote action.
*
* This is the same as g_action_group_activate_action() except that it
* allows for provision of "platform data" to be sent along with the
* activation request. This typically contains details such as the user
* interaction timestamp or startup notification information.
*
* `platform_data` must be non-%NULL and must have the type
* %G_VARIANT_TYPE_VARDICT. If it is floating, it will be consumed.
* @param action_name the name of the action to activate
* @param parameter the optional parameter to the activation
* @param platform_data the platform data to send
*/
activate_action_full(action_name: string | null, parameter: GLib.Variant | null, platform_data: GLib.Variant): void
/**
* Changes the state of a remote action.
*
* This is the same as g_action_group_change_action_state() except that
* it allows for provision of "platform data" to be sent along with the
* state change request. This typically contains details such as the
* user interaction timestamp or startup notification information.
*
* `platform_data` must be non-%NULL and must have the type
* %G_VARIANT_TYPE_VARDICT. If it is floating, it will be consumed.
* @param action_name the name of the action to change the state of
* @param value the new requested value for the state
* @param platform_data the platform data to send
*/
change_action_state_full(action_name: string | null, value: GLib.Variant, platform_data: GLib.Variant): void
// Own virtual methods of Gio-2.0.Gio.RemoteActionGroup
/**
* Activates the remote action.
*
* This is the same as g_action_group_activate_action() except that it
* allows for provision of "platform data" to be sent along with the
* activation request. This typically contains details such as the user
* interaction timestamp or startup notification information.
*
* `platform_data` must be non-%NULL and must have the type
* %G_VARIANT_TYPE_VARDICT. If it is floating, it will be consumed.
* @virtual
* @param action_name the name of the action to activate
* @param parameter the optional parameter to the activation
* @param platform_data the platform data to send
*/
vfunc_activate_action_full(action_name: string | null, parameter: GLib.Variant | null, platform_data: GLib.Variant): void
/**
* Changes the state of a remote action.
*
* This is the same as g_action_group_change_action_state() except that
* it allows for provision of "platform data" to be sent along with the
* state change request. This typically contains details such as the
* user interaction timestamp or startup notification information.
*
* `platform_data` must be non-%NULL and must have the type
* %G_VARIANT_TYPE_VARDICT. If it is floating, it will be consumed.
* @virtual
* @param action_name the name of the action to change the state of
* @param value the new requested value for the state
* @param platform_data the platform data to send
*/
vfunc_change_action_state_full(action_name: string | null, value: GLib.Variant, platform_data: GLib.Variant): void
// Class property signals of Gio-2.0.Gio.RemoteActionGroup
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* The GRemoteActionGroup interface is implemented by #GActionGroup
* instances that either transmit action invocations to other processes
* or receive action invocations in the local process from other
* processes.
*
* The interface has `_full` variants of the two
* methods on #GActionGroup used to activate actions:
* g_action_group_activate_action() and
* g_action_group_change_action_state(). These variants allow a
* "platform data" #GVariant to be specified: a dictionary providing
* context for the action invocation (for example: timestamps, startup
* notification IDs, etc).
*
* #GDBusActionGroup implements #GRemoteActionGroup. This provides a
* mechanism to send platform data for action invocations over D-Bus.
*
* Additionally, g_dbus_connection_export_action_group() will check if
* the exported #GActionGroup implements #GRemoteActionGroup and use the
* `_full` variants of the calls if available. This
* provides a mechanism by which to receive platform data for action
* invocations that arrive by way of D-Bus.
* @interface
*/
export class RemoteActionGroup extends GObject.Object {
// Own properties of Gio-2.0.Gio.RemoteActionGroup
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.RemoteActionGroup
constructor(config?: RemoteActionGroup.ConstructorProperties)
_init(config?: RemoteActionGroup.ConstructorProperties): void
}
export module Seekable {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface Seekable {
// Owm methods of Gio-2.0.Gio.Seekable
/**
* Tests if the stream supports the #GSeekableIface.
* @returns %TRUE if @seekable can be seeked. %FALSE otherwise.
*/
can_seek(): boolean
/**
* Tests if the length of the stream can be adjusted with
* g_seekable_truncate().
* @returns %TRUE if the stream can be truncated, %FALSE otherwise.
*/
can_truncate(): boolean
/**
* Seeks in the stream by the given `offset,` modified by `type`.
*
* Attempting to seek past the end of the stream will have different
* results depending on if the stream is fixed-sized or resizable. If
* the stream is resizable then seeking past the end and then writing
* will result in zeros filling the empty space. Seeking past the end
* of a resizable stream and reading will result in EOF. Seeking past
* the end of a fixed-sized stream will fail.
*
* Any operation that would result in a negative offset will fail.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @param offset a #goffset.
* @param type a #GSeekType.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns %TRUE if successful. If an error has occurred, this function will return %FALSE and set @error appropriately if present.
*/
seek(offset: number, type: GLib.SeekType, cancellable: Cancellable | null): boolean
/**
* Tells the current position within the stream.
* @returns the (positive or zero) offset from the beginning of the buffer, zero if the target is not seekable.
*/
tell(): number
/**
* Sets the length of the stream to `offset`. If the stream was previously
* larger than `offset,` the extra data is discarded. If the stream was
* previously shorter than `offset,` it is extended with NUL ('\0') bytes.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
* operation was partially finished when the operation was cancelled the
* partial result will be returned, without an error.
* @param offset new length for `seekable,` in bytes.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns %TRUE if successful. If an error has occurred, this function will return %FALSE and set @error appropriately if present.
*/
truncate(offset: number, cancellable: Cancellable | null): boolean
// Own virtual methods of Gio-2.0.Gio.Seekable
/**
* Tests if the stream supports the #GSeekableIface.
* @virtual
* @returns %TRUE if @seekable can be seeked. %FALSE otherwise.
*/
vfunc_can_seek(): boolean
/**
* Tests if the length of the stream can be adjusted with
* g_seekable_truncate().
* @virtual
* @returns %TRUE if the stream can be truncated, %FALSE otherwise.
*/
vfunc_can_truncate(): boolean
/**
* Seeks in the stream by the given `offset,` modified by `type`.
*
* Attempting to seek past the end of the stream will have different
* results depending on if the stream is fixed-sized or resizable. If
* the stream is resizable then seeking past the end and then writing
* will result in zeros filling the empty space. Seeking past the end
* of a resizable stream and reading will result in EOF. Seeking past
* the end of a fixed-sized stream will fail.
*
* Any operation that would result in a negative offset will fail.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* @virtual
* @param offset a #goffset.
* @param type a #GSeekType.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns %TRUE if successful. If an error has occurred, this function will return %FALSE and set @error appropriately if present.
*/
vfunc_seek(offset: number, type: GLib.SeekType, cancellable: Cancellable | null): boolean
/**
* Tells the current position within the stream.
* @virtual
* @returns the (positive or zero) offset from the beginning of the buffer, zero if the target is not seekable.
*/
vfunc_tell(): number
/**
* Sets the length of the stream to `offset`. If the stream was previously
* larger than `offset,` the extra data is discarded. If the stream was
* previously shorter than `offset,` it is extended with NUL ('\0') bytes.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
* operation was partially finished when the operation was cancelled the
* partial result will be returned, without an error.
* @virtual
* @param offset new length for `seekable,` in bytes.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns %TRUE if successful. If an error has occurred, this function will return %FALSE and set @error appropriately if present.
*/
vfunc_truncate_fn(offset: number, cancellable: Cancellable | null): boolean
// Class property signals of Gio-2.0.Gio.Seekable
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GSeekable is implemented by streams (implementations of
* #GInputStream or #GOutputStream) that support seeking.
*
* Seekable streams largely fall into two categories: resizable and
* fixed-size.
*
* #GSeekable on fixed-sized streams is approximately the same as POSIX
* lseek() on a block device (for example: attempting to seek past the
* end of the device is an error). Fixed streams typically cannot be
* truncated.
*
* #GSeekable on resizable streams is approximately the same as POSIX
* lseek() on a normal file. Seeking past the end and writing data will
* usually cause the stream to resize by introducing zero bytes.
* @interface
*/
export class Seekable extends GObject.Object {
// Own properties of Gio-2.0.Gio.Seekable
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.Seekable
constructor(config?: Seekable.ConstructorProperties)
_init(config?: Seekable.ConstructorProperties): void
}
export module SocketConnectable {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface SocketConnectable {
// Owm methods of Gio-2.0.Gio.SocketConnectable
/**
* Creates a #GSocketAddressEnumerator for `connectable`.
* @returns a new #GSocketAddressEnumerator.
*/
enumerate(): SocketAddressEnumerator
/**
* Creates a #GSocketAddressEnumerator for `connectable` that will
* return a #GProxyAddress for each of its addresses that you must connect
* to via a proxy.
*
* If `connectable` does not implement
* g_socket_connectable_proxy_enumerate(), this will fall back to
* calling g_socket_connectable_enumerate().
* @returns a new #GSocketAddressEnumerator.
*/
proxy_enumerate(): SocketAddressEnumerator
/**
* Format a #GSocketConnectable as a string. This is a human-readable format for
* use in debugging output, and is not a stable serialization format. It is not
* suitable for use in user interfaces as it exposes too much information for a
* user.
*
* If the #GSocketConnectable implementation does not support string formatting,
* the implementation’s type name will be returned as a fallback.
* @returns the formatted string
*/
to_string(): string | null
// Own virtual methods of Gio-2.0.Gio.SocketConnectable
/**
* Creates a #GSocketAddressEnumerator for `connectable`.
* @virtual
* @returns a new #GSocketAddressEnumerator.
*/
vfunc_enumerate(): SocketAddressEnumerator
/**
* Creates a #GSocketAddressEnumerator for `connectable` that will
* return a #GProxyAddress for each of its addresses that you must connect
* to via a proxy.
*
* If `connectable` does not implement
* g_socket_connectable_proxy_enumerate(), this will fall back to
* calling g_socket_connectable_enumerate().
* @virtual
* @returns a new #GSocketAddressEnumerator.
*/
vfunc_proxy_enumerate(): SocketAddressEnumerator
/**
* Format a #GSocketConnectable as a string. This is a human-readable format for
* use in debugging output, and is not a stable serialization format. It is not
* suitable for use in user interfaces as it exposes too much information for a
* user.
*
* If the #GSocketConnectable implementation does not support string formatting,
* the implementation’s type name will be returned as a fallback.
* @virtual
* @returns the formatted string
*/
vfunc_to_string(): string | null
// Class property signals of Gio-2.0.Gio.SocketConnectable
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* Objects that describe one or more potential socket endpoints
* implement #GSocketConnectable. Callers can then use
* g_socket_connectable_enumerate() to get a #GSocketAddressEnumerator
* to try out each socket address in turn until one succeeds, as shown
* in the sample code below.
*
*
* ```c
* MyConnectionType *
* connect_to_host (const char *hostname,
* guint16 port,
* GCancellable *cancellable,
* GError **error)
* {
* MyConnection *conn = NULL;
* GSocketConnectable *addr;
* GSocketAddressEnumerator *enumerator;
* GSocketAddress *sockaddr;
* GError *conn_error = NULL;
*
* addr = g_network_address_new (hostname, port);
* enumerator = g_socket_connectable_enumerate (addr);
* g_object_unref (addr);
*
* // Try each sockaddr until we succeed. Record the first connection error,
* // but not any further ones (since they'll probably be basically the same
* // as the first).
* while (!conn && (sockaddr = g_socket_address_enumerator_next (enumerator, cancellable, error))
* {
* conn = connect_to_sockaddr (sockaddr, conn_error ? NULL : &conn_error);
* g_object_unref (sockaddr);
* }
* g_object_unref (enumerator);
*
* if (conn)
* {
* if (conn_error)
* {
* // We couldn't connect to the first address, but we succeeded
* // in connecting to a later address.
* g_error_free (conn_error);
* }
* return conn;
* }
* else if (error)
* {
* /// Either initial lookup failed, or else the caller cancelled us.
* if (conn_error)
* g_error_free (conn_error);
* return NULL;
* }
* else
* {
* g_error_propagate (error, conn_error);
* return NULL;
* }
* }
* ```
*
* @interface
*/
export class SocketConnectable extends GObject.Object {
// Own properties of Gio-2.0.Gio.SocketConnectable
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.SocketConnectable
constructor(config?: SocketConnectable.ConstructorProperties)
_init(config?: SocketConnectable.ConstructorProperties): void
}
export module TlsBackend {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface TlsBackend {
// Owm methods of Gio-2.0.Gio.TlsBackend
/**
* Gets the #GType of `backend'`s #GTlsCertificate implementation.
* @returns the #GType of @backend's #GTlsCertificate implementation.
*/
get_certificate_type(): GObject.GType
/**
* Gets the #GType of `backend'`s #GTlsClientConnection implementation.
* @returns the #GType of @backend's #GTlsClientConnection implementation.
*/
get_client_connection_type(): GObject.GType
/**
* Gets the default #GTlsDatabase used to verify TLS connections.
* @returns the default database, which should be unreffed when done.
*/
get_default_database(): TlsDatabase
/**
* Gets the #GType of `backend’`s #GDtlsClientConnection implementation.
* @returns the #GType of @backend’s #GDtlsClientConnection implementation, or %G_TYPE_INVALID if this backend doesn’t support DTLS.
*/
get_dtls_client_connection_type(): GObject.GType
/**
* Gets the #GType of `backend’`s #GDtlsServerConnection implementation.
* @returns the #GType of @backend’s #GDtlsServerConnection implementation, or %G_TYPE_INVALID if this backend doesn’t support DTLS.
*/
get_dtls_server_connection_type(): GObject.GType
/**
* Gets the #GType of `backend'`s #GTlsFileDatabase implementation.
* @returns the #GType of backend's #GTlsFileDatabase implementation.
*/
get_file_database_type(): GObject.GType
/**
* Gets the #GType of `backend'`s #GTlsServerConnection implementation.
* @returns the #GType of @backend's #GTlsServerConnection implementation.
*/
get_server_connection_type(): GObject.GType
/**
* Set the default #GTlsDatabase used to verify TLS connections
*
* Any subsequent call to g_tls_backend_get_default_database() will return
* the database set in this call. Existing databases and connections are not
* modified.
*
* Setting a %NULL default database will reset to using the system default
* database as if g_tls_backend_set_default_database() had never been called.
* @param database the #GTlsDatabase
*/
set_default_database(database: TlsDatabase | null): void
/**
* Checks if DTLS is supported. DTLS support may not be available even if TLS
* support is available, and vice-versa.
* @returns whether DTLS is supported
*/
supports_dtls(): boolean
/**
* Checks if TLS is supported; if this returns %FALSE for the default
* #GTlsBackend, it means no "real" TLS backend is available.
* @returns whether or not TLS is supported
*/
supports_tls(): boolean
// Own virtual methods of Gio-2.0.Gio.TlsBackend
/**
* Gets the default #GTlsDatabase used to verify TLS connections.
* @virtual
* @returns the default database, which should be unreffed when done.
*/
vfunc_get_default_database(): TlsDatabase
/**
* Checks if DTLS is supported. DTLS support may not be available even if TLS
* support is available, and vice-versa.
* @virtual
* @returns whether DTLS is supported
*/
vfunc_supports_dtls(): boolean
/**
* Checks if TLS is supported; if this returns %FALSE for the default
* #GTlsBackend, it means no "real" TLS backend is available.
* @virtual
* @returns whether or not TLS is supported
*/
vfunc_supports_tls(): boolean
// Class property signals of Gio-2.0.Gio.TlsBackend
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* TLS (Transport Layer Security, aka SSL) and DTLS backend.
* @interface
*/
export class TlsBackend extends GObject.Object {
// Own properties of Gio-2.0.Gio.TlsBackend
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.TlsBackend
constructor(config?: TlsBackend.ConstructorProperties)
_init(config?: TlsBackend.ConstructorProperties): void
/**
* Gets the default #GTlsBackend for the system.
* @returns a #GTlsBackend, which will be a dummy object if no TLS backend is available
*/
static get_default(): TlsBackend
}
export module TlsClientConnection {
// Constructor properties interface
export interface ConstructorProperties extends TlsConnection.ConstructorProperties, GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.TlsClientConnection
/**
* A #GSocketConnectable describing the identity of the server that
* is expected on the other end of the connection.
*
* If the %G_TLS_CERTIFICATE_BAD_IDENTITY flag is set in
* #GTlsClientConnection:validation-flags, this object will be used
* to determine the expected identify of the remote end of the
* connection; if #GTlsClientConnection:server-identity is not set,
* or does not match the identity presented by the server, then the
* %G_TLS_CERTIFICATE_BAD_IDENTITY validation will fail.
*
* In addition to its use in verifying the server certificate,
* this is also used to give a hint to the server about what
* certificate we expect, which is useful for servers that serve
* virtual hosts.
*/
server_identity?: SocketConnectable | null
/**
* SSL 3.0 is no longer supported. See
* g_tls_client_connection_set_use_ssl3() for details.
*/
use_ssl3?: boolean | null
/**
* What steps to perform when validating a certificate received from
* a server. Server certificates that fail to validate in any of the
* ways indicated here will be rejected unless the application
* overrides the default via #GTlsConnection::accept-certificate.
*
* GLib guarantees that if certificate verification fails, at least one
* flag will be set, but it does not guarantee that all possible flags
* will be set. Accordingly, you may not safely decide to ignore any
* particular type of error. For example, it would be incorrect to mask
* %G_TLS_CERTIFICATE_EXPIRED if you want to allow expired certificates,
* because this could potentially be the only error flag set even if
* other problems exist with the certificate. Therefore, there is no
* safe way to use this property. This is not a horrible problem,
* though, because you should not be attempting to ignore validation
* errors anyway. If you really must ignore TLS certificate errors,
* connect to #GTlsConnection::accept-certificate.
*/
validation_flags?: TlsCertificateFlags | null
}
}
export interface TlsClientConnection extends TlsConnection {
// Own properties of Gio-2.0.Gio.TlsClientConnection
/**
* A list of the distinguished names of the Certificate Authorities
* that the server will accept client certificates signed by. If the
* server requests a client certificate during the handshake, then
* this property will be set after the handshake completes.
*
* Each item in the list is a #GByteArray which contains the complete
* subject DN of the certificate authority.
*/
readonly accepted_cas: any[]
/**
* A #GSocketConnectable describing the identity of the server that
* is expected on the other end of the connection.
*
* If the %G_TLS_CERTIFICATE_BAD_IDENTITY flag is set in
* #GTlsClientConnection:validation-flags, this object will be used
* to determine the expected identify of the remote end of the
* connection; if #GTlsClientConnection:server-identity is not set,
* or does not match the identity presented by the server, then the
* %G_TLS_CERTIFICATE_BAD_IDENTITY validation will fail.
*
* In addition to its use in verifying the server certificate,
* this is also used to give a hint to the server about what
* certificate we expect, which is useful for servers that serve
* virtual hosts.
*/
server_identity: SocketConnectable
/**
* SSL 3.0 is no longer supported. See
* g_tls_client_connection_set_use_ssl3() for details.
*/
use_ssl3: boolean
/**
* What steps to perform when validating a certificate received from
* a server. Server certificates that fail to validate in any of the
* ways indicated here will be rejected unless the application
* overrides the default via #GTlsConnection::accept-certificate.
*
* GLib guarantees that if certificate verification fails, at least one
* flag will be set, but it does not guarantee that all possible flags
* will be set. Accordingly, you may not safely decide to ignore any
* particular type of error. For example, it would be incorrect to mask
* %G_TLS_CERTIFICATE_EXPIRED if you want to allow expired certificates,
* because this could potentially be the only error flag set even if
* other problems exist with the certificate. Therefore, there is no
* safe way to use this property. This is not a horrible problem,
* though, because you should not be attempting to ignore validation
* errors anyway. If you really must ignore TLS certificate errors,
* connect to #GTlsConnection::accept-certificate.
*/
validation_flags: TlsCertificateFlags
// Conflicting properties
parent_instance: IOStream & GObject.Object & GObject.Object
// Owm methods of Gio-2.0.Gio.TlsClientConnection
/**
* Possibly copies session state from one connection to another, for use
* in TLS session resumption. This is not normally needed, but may be
* used when the same session needs to be used between different
* endpoints, as is required by some protocols, such as FTP over TLS.
* `source` should have already completed a handshake and, since TLS 1.3,
* it should have been used to read data at least once. `conn` should not
* have completed a handshake.
*
* It is not possible to know whether a call to this function will
* actually do anything. Because session resumption is normally used
* only for performance benefit, the TLS backend might not implement
* this function. Even if implemented, it may not actually succeed in
* allowing `conn` to resume `source'`s TLS session, because the server
* may not have sent a session resumption token to `source,` or it may
* refuse to accept the token from `conn`. There is no way to know
* whether a call to this function is actually successful.
*
* Using this function is not required to benefit from session
* resumption. If the TLS backend supports session resumption, the
* session will be resumed automatically if it is possible to do so
* without weakening the privacy guarantees normally provided by TLS,
* without need to call this function. For example, with TLS 1.3,
* a session ticket will be automatically copied from any
* #GTlsClientConnection that has previously received session tickets
* from the server, provided a ticket is available that has not
* previously been used for session resumption, since session ticket
* reuse would be a privacy weakness. Using this function causes the
* ticket to be copied without regard for privacy considerations.
* @param source a #GTlsClientConnection
*/
copy_session_state(source: TlsClientConnection): void
/**
* Gets the list of distinguished names of the Certificate Authorities
* that the server will accept certificates from. This will be set
* during the TLS handshake if the server requests a certificate.
* Otherwise, it will be %NULL.
*
* Each item in the list is a #GByteArray which contains the complete
* subject DN of the certificate authority.
* @returns the list of CA DNs. You should unref each element with g_byte_array_unref() and then the free the list with g_list_free().
*/
get_accepted_cas(): GLib.List[]
/**
* Gets `conn'`s expected server identity
* @returns a #GSocketConnectable describing the expected server identity, or %NULL if the expected identity is not known.
*/
get_server_identity(): SocketConnectable | null
/**
* SSL 3.0 is no longer supported. See
* g_tls_client_connection_set_use_ssl3() for details.
* @returns %FALSE
*/
get_use_ssl3(): boolean
/**
* Gets `conn'`s validation flags
*
* This function does not work as originally designed and is impossible
* to use correctly. See #GTlsClientConnection:validation-flags for more
* information.
* @returns the validation flags
*/
get_validation_flags(): TlsCertificateFlags
/**
* Sets `conn'`s expected server identity, which is used both to tell
* servers on virtual hosts which certificate to present, and also
* to let `conn` know what name to look for in the certificate when
* performing %G_TLS_CERTIFICATE_BAD_IDENTITY validation, if enabled.
* @param identity a #GSocketConnectable describing the expected server identity
*/
set_server_identity(identity: SocketConnectable): void
/**
* Since GLib 2.42.1, SSL 3.0 is no longer supported.
*
* From GLib 2.42.1 through GLib 2.62, this function could be used to
* force use of TLS 1.0, the lowest-supported TLS protocol version at
* the time. In the past, this was needed to connect to broken TLS
* servers that exhibited protocol version intolerance. Such servers
* are no longer common, and using TLS 1.0 is no longer considered
* acceptable.
*
* Since GLib 2.64, this function does nothing.
* @param use_ssl3 a #gboolean, ignored
*/
set_use_ssl3(use_ssl3: boolean): void
/**
* Sets `conn'`s validation flags, to override the default set of
* checks performed when validating a server certificate. By default,
* %G_TLS_CERTIFICATE_VALIDATE_ALL is used.
*
* This function does not work as originally designed and is impossible
* to use correctly. See #GTlsClientConnection:validation-flags for more
* information.
* @param flags the #GTlsCertificateFlags to use
*/
set_validation_flags(flags: TlsCertificateFlags): void
// Own virtual methods of Gio-2.0.Gio.TlsClientConnection
/**
* Possibly copies session state from one connection to another, for use
* in TLS session resumption. This is not normally needed, but may be
* used when the same session needs to be used between different
* endpoints, as is required by some protocols, such as FTP over TLS.
* `source` should have already completed a handshake and, since TLS 1.3,
* it should have been used to read data at least once. `conn` should not
* have completed a handshake.
*
* It is not possible to know whether a call to this function will
* actually do anything. Because session resumption is normally used
* only for performance benefit, the TLS backend might not implement
* this function. Even if implemented, it may not actually succeed in
* allowing `conn` to resume `source'`s TLS session, because the server
* may not have sent a session resumption token to `source,` or it may
* refuse to accept the token from `conn`. There is no way to know
* whether a call to this function is actually successful.
*
* Using this function is not required to benefit from session
* resumption. If the TLS backend supports session resumption, the
* session will be resumed automatically if it is possible to do so
* without weakening the privacy guarantees normally provided by TLS,
* without need to call this function. For example, with TLS 1.3,
* a session ticket will be automatically copied from any
* #GTlsClientConnection that has previously received session tickets
* from the server, provided a ticket is available that has not
* previously been used for session resumption, since session ticket
* reuse would be a privacy weakness. Using this function causes the
* ticket to be copied without regard for privacy considerations.
* @virtual
* @param source a #GTlsClientConnection
*/
vfunc_copy_session_state(source: TlsClientConnection): void
// Class property signals of Gio-2.0.Gio.TlsClientConnection
connect(sigName: "notify::accepted-cas", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::accepted-cas", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::accepted-cas", ...args: any[]): void
connect(sigName: "notify::server-identity", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::server-identity", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::server-identity", ...args: any[]): void
connect(sigName: "notify::use-ssl3", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::use-ssl3", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::use-ssl3", ...args: any[]): void
connect(sigName: "notify::validation-flags", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::validation-flags", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::validation-flags", ...args: any[]): void
connect(sigName: "notify::advertised-protocols", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::advertised-protocols", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::advertised-protocols", ...args: any[]): void
connect(sigName: "notify::base-io-stream", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::base-io-stream", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::base-io-stream", ...args: any[]): void
connect(sigName: "notify::certificate", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::certificate", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::certificate", ...args: any[]): void
connect(sigName: "notify::ciphersuite-name", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::ciphersuite-name", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::ciphersuite-name", ...args: any[]): void
connect(sigName: "notify::database", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::database", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::database", ...args: any[]): void
connect(sigName: "notify::interaction", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::interaction", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::interaction", ...args: any[]): void
connect(sigName: "notify::negotiated-protocol", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::negotiated-protocol", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::negotiated-protocol", ...args: any[]): void
connect(sigName: "notify::peer-certificate", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::peer-certificate", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::peer-certificate", ...args: any[]): void
connect(sigName: "notify::peer-certificate-errors", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::peer-certificate-errors", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::peer-certificate-errors", ...args: any[]): void
connect(sigName: "notify::protocol-version", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::protocol-version", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::protocol-version", ...args: any[]): void
connect(sigName: "notify::rehandshake-mode", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::rehandshake-mode", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::rehandshake-mode", ...args: any[]): void
connect(sigName: "notify::require-close-notify", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::require-close-notify", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::require-close-notify", ...args: any[]): void
connect(sigName: "notify::use-system-certdb", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::use-system-certdb", callback: (($obj: TlsClientConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::use-system-certdb", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GTlsClientConnection is the client-side subclass of
* #GTlsConnection, representing a client-side TLS connection.
* @interface
*/
export class TlsClientConnection extends GObject.Object {
// Own properties of Gio-2.0.Gio.TlsClientConnection
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.TlsClientConnection
constructor(config?: TlsClientConnection.ConstructorProperties)
_init(config?: TlsClientConnection.ConstructorProperties): void
/**
* Creates a new #GTlsClientConnection wrapping `base_io_stream` (which
* must have pollable input and output streams) which is assumed to
* communicate with the server identified by `server_identity`.
*
* See the documentation for #GTlsConnection:base-io-stream for restrictions
* on when application code can run operations on the `base_io_stream` after
* this function has returned.
* @param base_io_stream the #GIOStream to wrap
* @param server_identity the expected identity of the server
* @returns the new #GTlsClientConnection, or %NULL on error
*/
static new(base_io_stream: IOStream, server_identity: SocketConnectable | null): TlsClientConnection
}
export module TlsFileDatabase {
// Constructor properties interface
export interface ConstructorProperties extends TlsDatabase.ConstructorProperties, GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.TlsFileDatabase
/**
* The path to a file containing PEM encoded certificate authority
* root anchors. The certificates in this file will be treated as
* root authorities for the purpose of verifying other certificates
* via the g_tls_database_verify_chain() operation.
*/
anchors?: string | null
}
}
export interface TlsFileDatabase extends TlsDatabase {
// Own properties of Gio-2.0.Gio.TlsFileDatabase
/**
* The path to a file containing PEM encoded certificate authority
* root anchors. The certificates in this file will be treated as
* root authorities for the purpose of verifying other certificates
* via the g_tls_database_verify_chain() operation.
*/
anchors: string | null
// Class property signals of Gio-2.0.Gio.TlsFileDatabase
connect(sigName: "notify::anchors", callback: (($obj: TlsFileDatabase, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::anchors", callback: (($obj: TlsFileDatabase, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::anchors", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GTlsFileDatabase is implemented by #GTlsDatabase objects which load
* their certificate information from a file. It is an interface which
* TLS library specific subtypes implement.
* @interface
*/
export class TlsFileDatabase extends GObject.Object {
// Own properties of Gio-2.0.Gio.TlsFileDatabase
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.TlsFileDatabase
constructor(config?: TlsFileDatabase.ConstructorProperties)
_init(config?: TlsFileDatabase.ConstructorProperties): void
/**
* Creates a new #GTlsFileDatabase which uses anchor certificate authorities
* in `anchors` to verify certificate chains.
*
* The certificates in `anchors` must be PEM encoded.
* @param anchors filename of anchor certificate authorities.
* @returns the new #GTlsFileDatabase, or %NULL on error
*/
static new(anchors: string): TlsFileDatabase
}
export module TlsServerConnection {
// Constructor properties interface
export interface ConstructorProperties extends TlsConnection.ConstructorProperties, GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.TlsServerConnection
/**
* The #GTlsAuthenticationMode for the server. This can be changed
* before calling g_tls_connection_handshake() if you want to
* rehandshake with a different mode from the initial handshake.
*/
authentication_mode?: TlsAuthenticationMode | null
}
}
export interface TlsServerConnection extends TlsConnection {
// Own properties of Gio-2.0.Gio.TlsServerConnection
/**
* The #GTlsAuthenticationMode for the server. This can be changed
* before calling g_tls_connection_handshake() if you want to
* rehandshake with a different mode from the initial handshake.
*/
authentication_mode: TlsAuthenticationMode
// Conflicting properties
parent_instance: IOStream & GObject.Object & GObject.Object
// Class property signals of Gio-2.0.Gio.TlsServerConnection
connect(sigName: "notify::authentication-mode", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::authentication-mode", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::authentication-mode", ...args: any[]): void
connect(sigName: "notify::advertised-protocols", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::advertised-protocols", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::advertised-protocols", ...args: any[]): void
connect(sigName: "notify::base-io-stream", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::base-io-stream", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::base-io-stream", ...args: any[]): void
connect(sigName: "notify::certificate", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::certificate", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::certificate", ...args: any[]): void
connect(sigName: "notify::ciphersuite-name", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::ciphersuite-name", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::ciphersuite-name", ...args: any[]): void
connect(sigName: "notify::database", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::database", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::database", ...args: any[]): void
connect(sigName: "notify::interaction", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::interaction", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::interaction", ...args: any[]): void
connect(sigName: "notify::negotiated-protocol", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::negotiated-protocol", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::negotiated-protocol", ...args: any[]): void
connect(sigName: "notify::peer-certificate", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::peer-certificate", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::peer-certificate", ...args: any[]): void
connect(sigName: "notify::peer-certificate-errors", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::peer-certificate-errors", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::peer-certificate-errors", ...args: any[]): void
connect(sigName: "notify::protocol-version", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::protocol-version", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::protocol-version", ...args: any[]): void
connect(sigName: "notify::rehandshake-mode", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::rehandshake-mode", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::rehandshake-mode", ...args: any[]): void
connect(sigName: "notify::require-close-notify", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::require-close-notify", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::require-close-notify", ...args: any[]): void
connect(sigName: "notify::use-system-certdb", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::use-system-certdb", callback: (($obj: TlsServerConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::use-system-certdb", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GTlsServerConnection is the server-side subclass of #GTlsConnection,
* representing a server-side TLS connection.
* @interface
*/
export class TlsServerConnection extends GObject.Object {
// Own properties of Gio-2.0.Gio.TlsServerConnection
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.TlsServerConnection
constructor(config?: TlsServerConnection.ConstructorProperties)
_init(config?: TlsServerConnection.ConstructorProperties): void
/**
* Creates a new #GTlsServerConnection wrapping `base_io_stream` (which
* must have pollable input and output streams).
*
* See the documentation for #GTlsConnection:base-io-stream for restrictions
* on when application code can run operations on the `base_io_stream` after
* this function has returned.
* @param base_io_stream the #GIOStream to wrap
* @param certificate the default server certificate, or %NULL
* @returns the new #GTlsServerConnection, or %NULL on error
*/
static new(base_io_stream: IOStream, certificate: TlsCertificate | null): TlsServerConnection
}
export module Volume {
// Signal callback interfaces
/**
* Signal callback interface for `changed`
*/
export interface ChangedSignalCallback {
($obj: Volume): void
}
/**
* Signal callback interface for `removed`
*/
export interface RemovedSignalCallback {
($obj: Volume): void
}
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface Volume {
// Owm methods of Gio-2.0.Gio.Volume
/**
* Checks if a volume can be ejected.
* @returns %TRUE if the @volume can be ejected. %FALSE otherwise
*/
can_eject(): boolean
/**
* Checks if a volume can be mounted.
* @returns %TRUE if the @volume can be mounted. %FALSE otherwise
*/
can_mount(): boolean
/**
* Ejects a volume. This is an asynchronous operation, and is
* finished by calling g_volume_eject_finish() with the `volume`
* and #GAsyncResult returned in the `callback`.
* @param flags flags affecting the unmount if required for eject
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback, or %NULL
*/
eject(flags: MountUnmountFlags, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes ejecting a volume. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
* @param result a #GAsyncResult
* @returns %TRUE, %FALSE if operation failed
*/
eject_finish(result: AsyncResult): boolean
/**
* Ejects a volume. This is an asynchronous operation, and is
* finished by calling g_volume_eject_with_operation_finish() with the `volume`
* and #GAsyncResult data returned in the `callback`.
* @param flags flags affecting the unmount if required for eject
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback, or %NULL
*/
eject_with_operation(flags: MountUnmountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes ejecting a volume. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
* @param result a #GAsyncResult
* @returns %TRUE if the volume was successfully ejected. %FALSE otherwise
*/
eject_with_operation_finish(result: AsyncResult): boolean
/**
* Gets the kinds of [identifiers][volume-identifier] that `volume` has.
* Use g_volume_get_identifier() to obtain the identifiers themselves.
* @returns a %NULL-terminated array of strings containing kinds of identifiers. Use g_strfreev() to free.
*/
enumerate_identifiers(): string[]
/**
* Gets the activation root for a #GVolume if it is known ahead of
* mount time. Returns %NULL otherwise. If not %NULL and if `volume`
* is mounted, then the result of g_mount_get_root() on the
* #GMount object obtained from g_volume_get_mount() will always
* either be equal or a prefix of what this function returns. In
* other words, in code
*
*
* ```c
* GMount *mount;
* GFile *mount_root
* GFile *volume_activation_root;
*
* mount = g_volume_get_mount (volume); // mounted, so never NULL
* mount_root = g_mount_get_root (mount);
* volume_activation_root = g_volume_get_activation_root (volume); // assume not NULL
* ```
*
* then the expression
*
* ```c
* (g_file_has_prefix (volume_activation_root, mount_root) ||
* g_file_equal (volume_activation_root, mount_root))
* ```
*
* will always be %TRUE.
*
* Activation roots are typically used in #GVolumeMonitor
* implementations to find the underlying mount to shadow, see
* g_mount_is_shadowed() for more details.
* @returns the activation root of @volume or %NULL. Use g_object_unref() to free.
*/
get_activation_root(): File | null
/**
* Gets the drive for the `volume`.
* @returns a #GDrive or %NULL if @volume is not associated with a drive. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
get_drive(): Drive | null
/**
* Gets the icon for `volume`.
* @returns a #GIcon. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
get_icon(): Icon
/**
* Gets the identifier of the given kind for `volume`.
* See the [introduction][volume-identifier] for more
* information about volume identifiers.
* @param kind the kind of identifier to return
* @returns a newly allocated string containing the requested identifier, or %NULL if the #GVolume doesn't have this kind of identifier
*/
get_identifier(kind: string | null): string | null
/**
* Gets the mount for the `volume`.
* @returns a #GMount or %NULL if @volume isn't mounted. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
get_mount(): Mount | null
/**
* Gets the name of `volume`.
* @returns the name for the given @volume. The returned string should be freed with g_free() when no longer needed.
*/
get_name(): string | null
/**
* Gets the sort key for `volume,` if any.
* @returns Sorting key for @volume or %NULL if no such key is available
*/
get_sort_key(): string | null
/**
* Gets the symbolic icon for `volume`.
* @returns a #GIcon. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
get_symbolic_icon(): Icon
/**
* Gets the UUID for the `volume`. The reference is typically based on
* the file system UUID for the volume in question and should be
* considered an opaque string. Returns %NULL if there is no UUID
* available.
* @returns the UUID for @volume or %NULL if no UUID can be computed. The returned string should be freed with g_free() when no longer needed.
*/
get_uuid(): string | null
/**
* Mounts a volume. This is an asynchronous operation, and is
* finished by calling g_volume_mount_finish() with the `volume`
* and #GAsyncResult returned in the `callback`.
* @param flags flags affecting the operation
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback, or %NULL
*/
mount(flags: MountMountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes mounting a volume. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
*
* If the mount operation succeeded, g_volume_get_mount() on `volume`
* is guaranteed to return the mount right after calling this
* function; there's no need to listen for the 'mount-added' signal on
* #GVolumeMonitor.
* @param result a #GAsyncResult
* @returns %TRUE, %FALSE if operation failed
*/
mount_finish(result: AsyncResult): boolean
/**
* Returns whether the volume should be automatically mounted.
* @returns %TRUE if the volume should be automatically mounted
*/
should_automount(): boolean
// Own virtual methods of Gio-2.0.Gio.Volume
/**
* Checks if a volume can be ejected.
* @virtual
* @returns %TRUE if the @volume can be ejected. %FALSE otherwise
*/
vfunc_can_eject(): boolean
/**
* Checks if a volume can be mounted.
* @virtual
* @returns %TRUE if the @volume can be mounted. %FALSE otherwise
*/
vfunc_can_mount(): boolean
vfunc_changed(): void
/**
* Ejects a volume. This is an asynchronous operation, and is
* finished by calling g_volume_eject_finish() with the `volume`
* and #GAsyncResult returned in the `callback`.
* @virtual
* @param flags flags affecting the unmount if required for eject
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback, or %NULL
*/
vfunc_eject(flags: MountUnmountFlags, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes ejecting a volume. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE, %FALSE if operation failed
*/
vfunc_eject_finish(result: AsyncResult): boolean
/**
* Ejects a volume. This is an asynchronous operation, and is
* finished by calling g_volume_eject_with_operation_finish() with the `volume`
* and #GAsyncResult data returned in the `callback`.
* @virtual
* @param flags flags affecting the unmount if required for eject
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback, or %NULL
*/
vfunc_eject_with_operation(flags: MountUnmountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes ejecting a volume. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE if the volume was successfully ejected. %FALSE otherwise
*/
vfunc_eject_with_operation_finish(result: AsyncResult): boolean
/**
* Gets the kinds of [identifiers][volume-identifier] that `volume` has.
* Use g_volume_get_identifier() to obtain the identifiers themselves.
* @virtual
* @returns a %NULL-terminated array of strings containing kinds of identifiers. Use g_strfreev() to free.
*/
vfunc_enumerate_identifiers(): string[]
/**
* Gets the activation root for a #GVolume if it is known ahead of
* mount time. Returns %NULL otherwise. If not %NULL and if `volume`
* is mounted, then the result of g_mount_get_root() on the
* #GMount object obtained from g_volume_get_mount() will always
* either be equal or a prefix of what this function returns. In
* other words, in code
*
*
* ```c
* GMount *mount;
* GFile *mount_root
* GFile *volume_activation_root;
*
* mount = g_volume_get_mount (volume); // mounted, so never NULL
* mount_root = g_mount_get_root (mount);
* volume_activation_root = g_volume_get_activation_root (volume); // assume not NULL
* ```
*
* then the expression
*
* ```c
* (g_file_has_prefix (volume_activation_root, mount_root) ||
* g_file_equal (volume_activation_root, mount_root))
* ```
*
* will always be %TRUE.
*
* Activation roots are typically used in #GVolumeMonitor
* implementations to find the underlying mount to shadow, see
* g_mount_is_shadowed() for more details.
* @virtual
* @returns the activation root of @volume or %NULL. Use g_object_unref() to free.
*/
vfunc_get_activation_root(): File | null
/**
* Gets the drive for the `volume`.
* @virtual
* @returns a #GDrive or %NULL if @volume is not associated with a drive. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
vfunc_get_drive(): Drive | null
/**
* Gets the icon for `volume`.
* @virtual
* @returns a #GIcon. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
vfunc_get_icon(): Icon
/**
* Gets the identifier of the given kind for `volume`.
* See the [introduction][volume-identifier] for more
* information about volume identifiers.
* @virtual
* @param kind the kind of identifier to return
* @returns a newly allocated string containing the requested identifier, or %NULL if the #GVolume doesn't have this kind of identifier
*/
vfunc_get_identifier(kind: string | null): string | null
/**
* Gets the mount for the `volume`.
* @virtual
* @returns a #GMount or %NULL if @volume isn't mounted. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
vfunc_get_mount(): Mount | null
/**
* Gets the name of `volume`.
* @virtual
* @returns the name for the given @volume. The returned string should be freed with g_free() when no longer needed.
*/
vfunc_get_name(): string | null
/**
* Gets the sort key for `volume,` if any.
* @virtual
* @returns Sorting key for @volume or %NULL if no such key is available
*/
vfunc_get_sort_key(): string | null
/**
* Gets the symbolic icon for `volume`.
* @virtual
* @returns a #GIcon. The returned object should be unreffed with g_object_unref() when no longer needed.
*/
vfunc_get_symbolic_icon(): Icon
/**
* Gets the UUID for the `volume`. The reference is typically based on
* the file system UUID for the volume in question and should be
* considered an opaque string. Returns %NULL if there is no UUID
* available.
* @virtual
* @returns the UUID for @volume or %NULL if no UUID can be computed. The returned string should be freed with g_free() when no longer needed.
*/
vfunc_get_uuid(): string | null
/**
* Finishes mounting a volume. If any errors occurred during the operation,
* `error` will be set to contain the errors and %FALSE will be returned.
*
* If the mount operation succeeded, g_volume_get_mount() on `volume`
* is guaranteed to return the mount right after calling this
* function; there's no need to listen for the 'mount-added' signal on
* #GVolumeMonitor.
* @virtual
* @param result a #GAsyncResult
* @returns %TRUE, %FALSE if operation failed
*/
vfunc_mount_finish(result: AsyncResult): boolean
/**
* Mounts a volume. This is an asynchronous operation, and is
* finished by calling g_volume_mount_finish() with the `volume`
* and #GAsyncResult returned in the `callback`.
* @virtual
* @param flags flags affecting the operation
* @param mount_operation a #GMountOperation or %NULL to avoid user interaction
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback, or %NULL
*/
vfunc_mount_fn(flags: MountMountFlags, mount_operation: MountOperation | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
vfunc_removed(): void
/**
* Returns whether the volume should be automatically mounted.
* @virtual
* @returns %TRUE if the volume should be automatically mounted
*/
vfunc_should_automount(): boolean
// Own signals of Gio-2.0.Gio.Volume
connect(sigName: "changed", callback: Volume.ChangedSignalCallback): number
connect_after(sigName: "changed", callback: Volume.ChangedSignalCallback): number
emit(sigName: "changed", ...args: any[]): void
connect(sigName: "removed", callback: Volume.RemovedSignalCallback): number
connect_after(sigName: "removed", callback: Volume.RemovedSignalCallback): number
emit(sigName: "removed", ...args: any[]): void
// Class property signals of Gio-2.0.Gio.Volume
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* The #GVolume interface represents user-visible objects that can be
* mounted. Note, when porting from GnomeVFS, #GVolume is the moral
* equivalent of #GnomeVFSDrive.
*
* Mounting a #GVolume instance is an asynchronous operation. For more
* information about asynchronous operations, see #GAsyncResult and
* #GTask. To mount a #GVolume, first call g_volume_mount() with (at
* least) the #GVolume instance, optionally a #GMountOperation object
* and a #GAsyncReadyCallback.
*
* Typically, one will only want to pass %NULL for the
* #GMountOperation if automounting all volumes when a desktop session
* starts since it's not desirable to put up a lot of dialogs asking
* for credentials.
*
* The callback will be fired when the operation has resolved (either
* with success or failure), and a #GAsyncResult instance will be
* passed to the callback. That callback should then call
* g_volume_mount_finish() with the #GVolume instance and the
* #GAsyncResult data to see if the operation was completed
* successfully. If an `error` is present when g_volume_mount_finish()
* is called, then it will be filled with any error information.
*
* ## Volume Identifiers # {#volume-identifier}
*
* It is sometimes necessary to directly access the underlying
* operating system object behind a volume (e.g. for passing a volume
* to an application via the commandline). For this purpose, GIO
* allows to obtain an 'identifier' for the volume. There can be
* different kinds of identifiers, such as Hal UDIs, filesystem labels,
* traditional Unix devices (e.g. `/dev/sda2`), UUIDs. GIO uses predefined
* strings as names for the different kinds of identifiers:
* %G_VOLUME_IDENTIFIER_KIND_UUID, %G_VOLUME_IDENTIFIER_KIND_LABEL, etc.
* Use g_volume_get_identifier() to obtain an identifier for a volume.
*
*
* Note that %G_VOLUME_IDENTIFIER_KIND_HAL_UDI will only be available
* when the gvfs hal volume monitor is in use. Other volume monitors
* will generally be able to provide the %G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE
* identifier, which can be used to obtain a hal device by means of
* libhal_manager_find_device_string_match().
* @interface
*/
export class Volume extends GObject.Object {
// Own properties of Gio-2.0.Gio.Volume
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.Volume
constructor(config?: Volume.ConstructorProperties)
_init(config?: Volume.ConstructorProperties): void
}
// See https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/core/overrides/Gio.js
export const DBus: {
readonly session: DBusConnection;
readonly system: DBusConnection;
get(bus_type: BusType, cancellable?: Cancellable | null, callback?: AsyncReadyCallback | null): void;
get_finish(res: AsyncResult): DBusConnection;
get_sync(bus_type: BusType, cancellable?: Cancellable | null): DBusConnection;
own_name(
bus_type: BusType,
name: string,
flags: BusNameOwnerFlags,
bus_acquired_closure?: GObject.Closure | null,
name_acquired_closure?: GObject.Closure | null,
name_lost_closure?: GObject.Closure | null
): number;
own_name_on_connection(
connection: DBusConnection,
name: string,
flags: BusNameOwnerFlags,
name_acquired_closure?: GObject.Closure | null,
name_lost_closure?: GObject.Closure | null
): number;
unown_name(owner_id: number): void;
watch_name(
bus_type: BusType,
name: string,
flags: BusNameWatcherFlags,
name_appeared_closure?: GObject.Closure | null,
name_vanished_closure?: GObject.Closure | null
): number;
unwatch_name(watcher_id: number): void;
watch_name_on_connection(
connection: DBusConnection,
name: string,
flags: BusNameWatcherFlags,
name_appeared_closure?: GObject.Closure | null,
name_vanished_closure?: GObject.Closure | null
): number;
}
export module DBusExportedObject {
export interface ConstructorProperties {
[key: string]: any;
}
}
// See https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/core/overrides/Gio.js
export class DBusExportedObject {
static $gtype: GObject.GType;
constructor(properties?: Partial, ...args: any[]);
_init(properties?: Partial, ...args: any[]): void;
static wrapJSObject(info: string, obj: any): DBusExportedObject;
get_info(): DBusInterfaceInfo;
get_connection(): DBusConnection;
get_object_path(): string;
unexport_from_connection(connection: DBusConnection): void;
["export"](busConnection: DBusConnection, objectPath: string): void;
unexport(): void;
flush(): void;
emit_signal(name: string, variant: GLib.Variant): void;
emit_property_changed(name: string, variant: GLib.Variant): void;
}
/**
* A convenient helper to create Promise wrappers for asynchronous functions in GJS.
*
* This utility replaces the original function on the class prototype with a Promise-based version,
* allowing the function to be called on any instance of the class, including subclasses.
* Simply pass the class prototype, the "async" function name, and the "finish" function name as arguments.
*
* The function can be used like any other Promise, without the need for a custom wrapper, by leaving out the callback argument.
* The original function will still be available, and can be used by passing the callback.
*
* @param proto - The class prototype that contains the asynchronous function.
* @param asyncFunc - The name of the asynchronous function.
* @param finishFunc - The name of the "finish" function that is used to retrieve the result of the asynchronous function.
*
* @version Gjs 1.54
* @see https://gjs.guide/guides/gjs/asynchronous-programming.html#promisify-helper
*
* @example
* ```js
* import Gio from "gi://Gio?version=2.0";
*
* Gio._promisify(Gio.InputStream.prototype, 'read_bytes_async', 'read_bytes_finish');
*
* try {
* const inputStream = new Gio.UnixInputStream({fd: 0});
* const bytes = await inputStream.read_bytes_async(4096, GLib.PRIORITY_DEFAULT, null);
* } catch (e) {
* logError(e, 'Failed to read bytes');
* }
* ```
*
*/
export function _promisify(proto: any, asyncFunc: string, finishFunc?: string): void;
/** Temporary Gio.File.prototype fix */
export const _LocalFilePrototype: typeof File.prototype;
export module AppInfoMonitor {
// Signal callback interfaces
/**
* Signal callback interface for `changed`
*/
export interface ChangedSignalCallback {
($obj: AppInfoMonitor): void
}
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface AppInfoMonitor {
// Own signals of Gio-2.0.Gio.AppInfoMonitor
connect(sigName: "changed", callback: AppInfoMonitor.ChangedSignalCallback): number
connect_after(sigName: "changed", callback: AppInfoMonitor.ChangedSignalCallback): number
emit(sigName: "changed", ...args: any[]): void
// Class property signals of Gio-2.0.Gio.AppInfoMonitor
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GAppInfoMonitor is a very simple object used for monitoring the app
* info database for changes (newly installed or removed applications).
*
* Call g_app_info_monitor_get() to get a #GAppInfoMonitor and connect
* to the #GAppInfoMonitor::changed signal. The signal will be emitted once when
* the app info database changes, and will not be emitted again until after the
* next call to g_app_info_get_all() or another `g_app_info_*()` function. This
* is because monitoring the app info database for changes is expensive.
*
* The following functions will re-arm the #GAppInfoMonitor::changed signal so
* it can be emitted again:
* - g_app_info_get_all()
* - g_app_info_get_all_for_type()
* - g_app_info_get_default_for_type()
* - g_app_info_get_fallback_for_type()
* - g_app_info_get_recommended_for_type()
* - g_desktop_app_info_get_implementations()
* - g_desktop_app_info_new()
* - g_desktop_app_info_new_from_filename()
* - g_desktop_app_info_new_from_keyfile()
* - g_desktop_app_info_search()
*
* In the usual case, applications should try to make note of the change
* (doing things like invalidating caches) but not act on it. In
* particular, applications should avoid making calls to #GAppInfo APIs
* in response to the change signal, deferring these until the time that
* the updated data is actually required. The exception to this case is when
* application information is actually being displayed on the screen
* (for example, during a search or when the list of all applications is shown).
* The reason for this is that changes to the list of installed
* applications often come in groups (like during system updates) and
* rescanning the list on every change is pointless and expensive.
* @class
*/
export class AppInfoMonitor extends GObject.Object {
// Own properties of Gio-2.0.Gio.AppInfoMonitor
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.AppInfoMonitor
constructor(config?: AppInfoMonitor.ConstructorProperties)
_init(config?: AppInfoMonitor.ConstructorProperties): void
/**
* Gets the #GAppInfoMonitor for the current thread-default main
* context.
*
* The #GAppInfoMonitor will emit a "changed" signal in the
* thread-default main context whenever the list of installed
* applications (as reported by g_app_info_get_all()) may have changed.
*
* The #GAppInfoMonitor::changed signal will only be emitted once until
* g_app_info_get_all() (or another `g_app_info_*()` function) is called. Doing
* so will re-arm the signal ready to notify about the next change.
*
* You must only call g_object_unref() on the return value from under
* the same main context as you created it.
* @returns a reference to a #GAppInfoMonitor
*/
static get(): AppInfoMonitor
}
export module AppLaunchContext {
// Signal callback interfaces
/**
* Signal callback interface for `launch-failed`
*/
export interface LaunchFailedSignalCallback {
($obj: AppLaunchContext, startup_notify_id: string | null): void
}
/**
* Signal callback interface for `launch-started`
*/
export interface LaunchStartedSignalCallback {
($obj: AppLaunchContext, info: AppInfo, platform_data: GLib.Variant | null): void
}
/**
* Signal callback interface for `launched`
*/
export interface LaunchedSignalCallback {
($obj: AppLaunchContext, info: AppInfo, platform_data: GLib.Variant): void
}
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface AppLaunchContext {
// Own fields of Gio-2.0.Gio.AppLaunchContext
parent_instance: GObject.Object
// Owm methods of Gio-2.0.Gio.AppLaunchContext
/**
* Gets the display string for the `context`. This is used to ensure new
* applications are started on the same display as the launching
* application, by setting the `DISPLAY` environment variable.
* @param info a #GAppInfo
* @param files a #GList of #GFile objects
* @returns a display string for the display.
*/
get_display(info: AppInfo, files: File[]): string | null
/**
* Gets the complete environment variable list to be passed to
* the child process when `context` is used to launch an application.
* This is a %NULL-terminated array of strings, where each string has
* the form `KEY=VALUE`.
* @returns the child's environment
*/
get_environment(): string[]
/**
* Initiates startup notification for the application and returns the
* `XDG_ACTIVATION_TOKEN` or `DESKTOP_STARTUP_ID` for the launched operation,
* if supported.
*
* The returned token may be referred to equivalently as an ‘activation token’
* (using Wayland terminology) or a ‘startup sequence ID’ (using X11 terminology).
* The two [are interoperable](https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/x11-interoperation.rst).
*
* Activation tokens are defined in the [XDG Activation Protocol](https://wayland.app/protocols/xdg-activation-v1),
* and startup notification IDs are defined in the
* [freedesktop.org Startup Notification Protocol](http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt).
*
* Support for the XDG Activation Protocol was added in GLib 2.76.
* @param info a #GAppInfo
* @param files a #GList of #GFile objects
* @returns a startup notification ID for the application, or %NULL if not supported.
*/
get_startup_notify_id(info: AppInfo, files: File[]): string | null
/**
* Called when an application has failed to launch, so that it can cancel
* the application startup notification started in g_app_launch_context_get_startup_notify_id().
* @param startup_notify_id the startup notification id that was returned by g_app_launch_context_get_startup_notify_id().
*/
launch_failed(startup_notify_id: string | null): void
/**
* Arranges for `variable` to be set to `value` in the child's
* environment when `context` is used to launch an application.
* @param variable the environment variable to set
* @param value the value for to set the variable to.
*/
setenv(variable: string, value: string): void
/**
* Arranges for `variable` to be unset in the child's environment
* when `context` is used to launch an application.
* @param variable the environment variable to remove
*/
unsetenv(variable: string): void
// Own virtual methods of Gio-2.0.Gio.AppLaunchContext
/**
* Gets the display string for the `context`. This is used to ensure new
* applications are started on the same display as the launching
* application, by setting the `DISPLAY` environment variable.
* @virtual
* @param info a #GAppInfo
* @param files a #GList of #GFile objects
* @returns a display string for the display.
*/
vfunc_get_display(info: AppInfo, files: File[]): string | null
/**
* Initiates startup notification for the application and returns the
* `XDG_ACTIVATION_TOKEN` or `DESKTOP_STARTUP_ID` for the launched operation,
* if supported.
*
* The returned token may be referred to equivalently as an ‘activation token’
* (using Wayland terminology) or a ‘startup sequence ID’ (using X11 terminology).
* The two [are interoperable](https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/x11-interoperation.rst).
*
* Activation tokens are defined in the [XDG Activation Protocol](https://wayland.app/protocols/xdg-activation-v1),
* and startup notification IDs are defined in the
* [freedesktop.org Startup Notification Protocol](http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt).
*
* Support for the XDG Activation Protocol was added in GLib 2.76.
* @virtual
* @param info a #GAppInfo
* @param files a #GList of #GFile objects
* @returns a startup notification ID for the application, or %NULL if not supported.
*/
vfunc_get_startup_notify_id(info: AppInfo, files: File[]): string | null
/**
* Called when an application has failed to launch, so that it can cancel
* the application startup notification started in g_app_launch_context_get_startup_notify_id().
* @virtual
* @param startup_notify_id the startup notification id that was returned by g_app_launch_context_get_startup_notify_id().
*/
vfunc_launch_failed(startup_notify_id: string | null): void
vfunc_launch_started(info: AppInfo, platform_data: GLib.Variant): void
vfunc_launched(info: AppInfo, platform_data: GLib.Variant): void
// Own signals of Gio-2.0.Gio.AppLaunchContext
connect(sigName: "launch-failed", callback: AppLaunchContext.LaunchFailedSignalCallback): number
connect_after(sigName: "launch-failed", callback: AppLaunchContext.LaunchFailedSignalCallback): number
emit(sigName: "launch-failed", startup_notify_id: string | null, ...args: any[]): void
connect(sigName: "launch-started", callback: AppLaunchContext.LaunchStartedSignalCallback): number
connect_after(sigName: "launch-started", callback: AppLaunchContext.LaunchStartedSignalCallback): number
emit(sigName: "launch-started", info: AppInfo, platform_data: GLib.Variant | null, ...args: any[]): void
connect(sigName: "launched", callback: AppLaunchContext.LaunchedSignalCallback): number
connect_after(sigName: "launched", callback: AppLaunchContext.LaunchedSignalCallback): number
emit(sigName: "launched", info: AppInfo, platform_data: GLib.Variant, ...args: any[]): void
// Class property signals of Gio-2.0.Gio.AppLaunchContext
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* Integrating the launch with the launching application. This is used to
* handle for instance startup notification and launching the new application
* on the same screen as the launching window.
* @class
*/
export class AppLaunchContext extends GObject.Object {
// Own properties of Gio-2.0.Gio.AppLaunchContext
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.AppLaunchContext
constructor(config?: AppLaunchContext.ConstructorProperties)
/**
* Creates a new application launch context. This is not normally used,
* instead you instantiate a subclass of this, such as #GdkAppLaunchContext.
* @constructor
* @returns a #GAppLaunchContext.
*/
constructor()
/**
* Creates a new application launch context. This is not normally used,
* instead you instantiate a subclass of this, such as #GdkAppLaunchContext.
* @constructor
* @returns a #GAppLaunchContext.
*/
static new(): AppLaunchContext
_init(config?: AppLaunchContext.ConstructorProperties): void
}
export module Application {
// Signal callback interfaces
/**
* Signal callback interface for `activate`
*/
export interface ActivateSignalCallback {
($obj: Application): void
}
/**
* Signal callback interface for `command-line`
*/
export interface CommandLineSignalCallback {
($obj: Application, command_line: ApplicationCommandLine): number
}
/**
* Signal callback interface for `handle-local-options`
*/
export interface HandleLocalOptionsSignalCallback {
($obj: Application, options: GLib.VariantDict): number
}
/**
* Signal callback interface for `name-lost`
*/
export interface NameLostSignalCallback {
($obj: Application): boolean
}
/**
* Signal callback interface for `open`
*/
export interface OpenSignalCallback {
($obj: Application, files: File[], hint: string | null): void
}
/**
* Signal callback interface for `shutdown`
*/
export interface ShutdownSignalCallback {
($obj: Application): void
}
/**
* Signal callback interface for `startup`
*/
export interface StartupSignalCallback {
($obj: Application): void
}
// Constructor properties interface
export interface ConstructorProperties extends ActionGroup.ConstructorProperties, ActionMap.ConstructorProperties, GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.Application
action_group?: ActionGroup | null
application_id?: string | null
flags?: ApplicationFlags | null
inactivity_timeout?: number | null
resource_base_path?: string | null
}
}
export interface Application extends ActionGroup, ActionMap {
// Own properties of Gio-2.0.Gio.Application
action_group: ActionGroup
application_id: string | null
flags: ApplicationFlags
inactivity_timeout: number
/**
* Whether the application is currently marked as busy through
* g_application_mark_busy() or g_application_bind_busy_property().
*/
readonly is_busy: boolean
readonly is_registered: boolean
readonly is_remote: boolean
resource_base_path: string | null
// Owm methods of Gio-2.0.Gio.Application
/**
* Activates the application.
*
* In essence, this results in the #GApplication::activate signal being
* emitted in the primary instance.
*
* The application must be registered before calling this function.
*/
activate(): void
/**
* Add an option to be handled by `application`.
*
* Calling this function is the equivalent of calling
* g_application_add_main_option_entries() with a single #GOptionEntry
* that has its arg_data member set to %NULL.
*
* The parsed arguments will be packed into a #GVariantDict which
* is passed to #GApplication::handle-local-options. If
* %G_APPLICATION_HANDLES_COMMAND_LINE is set, then it will also
* be sent to the primary instance. See
* g_application_add_main_option_entries() for more details.
*
* See #GOptionEntry for more documentation of the arguments.
* @param long_name the long name of an option used to specify it in a commandline
* @param short_name the short name of an option
* @param flags flags from #GOptionFlags
* @param arg the type of the option, as a #GOptionArg
* @param description the description for the option in `--help` output
* @param arg_description the placeholder to use for the extra argument parsed by the option in `--help` output
*/
add_main_option(long_name: string | null, short_name: number, flags: GLib.OptionFlags, arg: GLib.OptionArg, description: string | null, arg_description: string | null): void
/**
* Adds main option entries to be handled by `application`.
*
* This function is comparable to g_option_context_add_main_entries().
*
* After the commandline arguments are parsed, the
* #GApplication::handle-local-options signal will be emitted. At this
* point, the application can inspect the values pointed to by `arg_data`
* in the given #GOptionEntrys.
*
* Unlike #GOptionContext, #GApplication supports giving a %NULL
* `arg_data` for a non-callback #GOptionEntry. This results in the
* argument in question being packed into a #GVariantDict which is also
* passed to #GApplication::handle-local-options, where it can be
* inspected and modified. If %G_APPLICATION_HANDLES_COMMAND_LINE is
* set, then the resulting dictionary is sent to the primary instance,
* where g_application_command_line_get_options_dict() will return it.
* As it has been passed outside the process at this point, the types of all
* values in the options dict must be checked before being used.
* This "packing" is done according to the type of the argument --
* booleans for normal flags, strings for strings, bytestrings for
* filenames, etc. The packing only occurs if the flag is given (ie: we
* do not pack a "false" #GVariant in the case that a flag is missing).
*
* In general, it is recommended that all commandline arguments are
* parsed locally. The options dictionary should then be used to
* transmit the result of the parsing to the primary instance, where
* g_variant_dict_lookup() can be used. For local options, it is
* possible to either use `arg_data` in the usual way, or to consult (and
* potentially remove) the option from the options dictionary.
*
* This function is new in GLib 2.40. Before then, the only real choice
* was to send all of the commandline arguments (options and all) to the
* primary instance for handling. #GApplication ignored them completely
* on the local side. Calling this function "opts in" to the new
* behaviour, and in particular, means that unrecognised options will be
* treated as errors. Unrecognised options have never been ignored when
* %G_APPLICATION_HANDLES_COMMAND_LINE is unset.
*
* If #GApplication::handle-local-options needs to see the list of
* filenames, then the use of %G_OPTION_REMAINING is recommended. If
* `arg_data` is %NULL then %G_OPTION_REMAINING can be used as a key into
* the options dictionary. If you do use %G_OPTION_REMAINING then you
* need to handle these arguments for yourself because once they are
* consumed, they will no longer be visible to the default handling
* (which treats them as filenames to be opened).
*
* It is important to use the proper GVariant format when retrieving
* the options with g_variant_dict_lookup():
* - for %G_OPTION_ARG_NONE, use `b`
* - for %G_OPTION_ARG_STRING, use `&s`
* - for %G_OPTION_ARG_INT, use `i`
* - for %G_OPTION_ARG_INT64, use `x`
* - for %G_OPTION_ARG_DOUBLE, use `d`
* - for %G_OPTION_ARG_FILENAME, use `^&ay`
* - for %G_OPTION_ARG_STRING_ARRAY, use `^a&s`
* - for %G_OPTION_ARG_FILENAME_ARRAY, use `^a&ay`
* @param entries a %NULL-terminated list of #GOptionEntrys
*/
add_main_option_entries(entries: GLib.OptionEntry[]): void
/**
* Adds a #GOptionGroup to the commandline handling of `application`.
*
* This function is comparable to g_option_context_add_group().
*
* Unlike g_application_add_main_option_entries(), this function does
* not deal with %NULL `arg_data` and never transmits options to the
* primary instance.
*
* The reason for that is because, by the time the options arrive at the
* primary instance, it is typically too late to do anything with them.
* Taking the GTK option group as an example: GTK will already have been
* initialised by the time the #GApplication::command-line handler runs.
* In the case that this is not the first-running instance of the
* application, the existing instance may already have been running for
* a very long time.
*
* This means that the options from #GOptionGroup are only really usable
* in the case that the instance of the application being run is the
* first instance. Passing options like `--display=` or `--gdk-debug=`
* on future runs will have no effect on the existing primary instance.
*
* Calling this function will cause the options in the supplied option
* group to be parsed, but it does not cause you to be "opted in" to the
* new functionality whereby unrecognised options are rejected even if
* %G_APPLICATION_HANDLES_COMMAND_LINE was given.
* @param group a #GOptionGroup
*/
add_option_group(group: GLib.OptionGroup): void
/**
* Marks `application` as busy (see g_application_mark_busy()) while
* `property` on `object` is %TRUE.
*
* The binding holds a reference to `application` while it is active, but
* not to `object`. Instead, the binding is destroyed when `object` is
* finalized.
* @param object a #GObject
* @param property the name of a boolean property of `object`
*/
bind_busy_property(object: GObject.Object, property: string | null): void
/**
* Gets the unique identifier for `application`.
* @returns the identifier for @application, owned by @application
*/
get_application_id(): string | null
/**
* Gets the #GDBusConnection being used by the application, or %NULL.
*
* If #GApplication is using its D-Bus backend then this function will
* return the #GDBusConnection being used for uniqueness and
* communication with the desktop environment and other instances of the
* application.
*
* If #GApplication is not using D-Bus then this function will return
* %NULL. This includes the situation where the D-Bus backend would
* normally be in use but we were unable to connect to the bus.
*
* This function must not be called before the application has been
* registered. See g_application_get_is_registered().
* @returns a #GDBusConnection, or %NULL
*/
get_dbus_connection(): DBusConnection | null
/**
* Gets the D-Bus object path being used by the application, or %NULL.
*
* If #GApplication is using its D-Bus backend then this function will
* return the D-Bus object path that #GApplication is using. If the
* application is the primary instance then there is an object published
* at this path. If the application is not the primary instance then
* the result of this function is undefined.
*
* If #GApplication is not using D-Bus then this function will return
* %NULL. This includes the situation where the D-Bus backend would
* normally be in use but we were unable to connect to the bus.
*
* This function must not be called before the application has been
* registered. See g_application_get_is_registered().
* @returns the object path, or %NULL
*/
get_dbus_object_path(): string | null
/**
* Gets the flags for `application`.
*
* See #GApplicationFlags.
* @returns the flags for @application
*/
get_flags(): ApplicationFlags
/**
* Gets the current inactivity timeout for the application.
*
* This is the amount of time (in milliseconds) after the last call to
* g_application_release() before the application stops running.
* @returns the timeout, in milliseconds
*/
get_inactivity_timeout(): number
/**
* Gets the application's current busy state, as set through
* g_application_mark_busy() or g_application_bind_busy_property().
* @returns %TRUE if @application is currently marked as busy
*/
get_is_busy(): boolean
/**
* Checks if `application` is registered.
*
* An application is registered if g_application_register() has been
* successfully called.
* @returns %TRUE if @application is registered
*/
get_is_registered(): boolean
/**
* Checks if `application` is remote.
*
* If `application` is remote then it means that another instance of
* application already exists (the 'primary' instance). Calls to
* perform actions on `application` will result in the actions being
* performed by the primary instance.
*
* The value of this property cannot be accessed before
* g_application_register() has been called. See
* g_application_get_is_registered().
* @returns %TRUE if @application is remote
*/
get_is_remote(): boolean
/**
* Gets the resource base path of `application`.
*
* See g_application_set_resource_base_path() for more information.
* @returns the base resource path, if one is set
*/
get_resource_base_path(): string | null
/**
* Increases the use count of `application`.
*
* Use this function to indicate that the application has a reason to
* continue to run. For example, g_application_hold() is called by GTK
* when a toplevel window is on the screen.
*
* To cancel the hold, call g_application_release().
*/
hold(): void
/**
* Increases the busy count of `application`.
*
* Use this function to indicate that the application is busy, for instance
* while a long running operation is pending.
*
* The busy state will be exposed to other processes, so a session shell will
* use that information to indicate the state to the user (e.g. with a
* spinner).
*
* To cancel the busy indication, use g_application_unmark_busy().
*
* The application must be registered before calling this function.
*/
mark_busy(): void
/**
* Opens the given files.
*
* In essence, this results in the #GApplication::open signal being emitted
* in the primary instance.
*
* `n_files` must be greater than zero.
*
* `hint` is simply passed through to the ::open signal. It is
* intended to be used by applications that have multiple modes for
* opening files (eg: "view" vs "edit", etc). Unless you have a need
* for this functionality, you should use "".
*
* The application must be registered before calling this function
* and it must have the %G_APPLICATION_HANDLES_OPEN flag set.
* @param files an array of #GFiles to open
* @param hint a hint (or ""), but never %NULL
*/
open(files: File[], hint: string | null): void
/**
* Immediately quits the application.
*
* Upon return to the mainloop, g_application_run() will return,
* calling only the 'shutdown' function before doing so.
*
* The hold count is ignored.
* Take care if your code has called g_application_hold() on the application and
* is therefore still expecting it to exist.
* (Note that you may have called g_application_hold() indirectly, for example
* through gtk_application_add_window().)
*
* The result of calling g_application_run() again after it returns is
* unspecified.
*/
quit(): void
/**
* Attempts registration of the application.
*
* This is the point at which the application discovers if it is the
* primary instance or merely acting as a remote for an already-existing
* primary instance. This is implemented by attempting to acquire the
* application identifier as a unique bus name on the session bus using
* GDBus.
*
* If there is no application ID or if %G_APPLICATION_NON_UNIQUE was
* given, then this process will always become the primary instance.
*
* Due to the internal architecture of GDBus, method calls can be
* dispatched at any time (even if a main loop is not running). For
* this reason, you must ensure that any object paths that you wish to
* register are registered before calling this function.
*
* If the application has already been registered then %TRUE is
* returned with no work performed.
*
* The #GApplication::startup signal is emitted if registration succeeds
* and `application` is the primary instance (including the non-unique
* case).
*
* In the event of an error (such as `cancellable` being cancelled, or a
* failure to connect to the session bus), %FALSE is returned and `error`
* is set appropriately.
*
* Note: the return value of this function is not an indicator that this
* instance is or is not the primary instance of the application. See
* g_application_get_is_remote() for that.
* @param cancellable a #GCancellable, or %NULL
* @returns %TRUE if registration succeeded
*/
register(cancellable: Cancellable | null): boolean
/**
* Decrease the use count of `application`.
*
* When the use count reaches zero, the application will stop running.
*
* Never call this function except to cancel the effect of a previous
* call to g_application_hold().
*/
release(): void
/**
* Runs the application.
*
* This function is intended to be run from main() and its return value
* is intended to be returned by main(). Although you are expected to pass
* the `argc,` `argv` parameters from main() to this function, it is possible
* to pass %NULL if `argv` is not available or commandline handling is not
* required. Note that on Windows, `argc` and `argv` are ignored, and
* g_win32_get_command_line() is called internally (for proper support
* of Unicode commandline arguments).
*
* #GApplication will attempt to parse the commandline arguments. You
* can add commandline flags to the list of recognised options by way of
* g_application_add_main_option_entries(). After this, the
* #GApplication::handle-local-options signal is emitted, from which the
* application can inspect the values of its #GOptionEntrys.
*
* #GApplication::handle-local-options is a good place to handle options
* such as `--version`, where an immediate reply from the local process is
* desired (instead of communicating with an already-running instance).
* A #GApplication::handle-local-options handler can stop further processing
* by returning a non-negative value, which then becomes the exit status of
* the process.
*
* What happens next depends on the flags: if
* %G_APPLICATION_HANDLES_COMMAND_LINE was specified then the remaining
* commandline arguments are sent to the primary instance, where a
* #GApplication::command-line signal is emitted. Otherwise, the
* remaining commandline arguments are assumed to be a list of files.
* If there are no files listed, the application is activated via the
* #GApplication::activate signal. If there are one or more files, and
* %G_APPLICATION_HANDLES_OPEN was specified then the files are opened
* via the #GApplication::open signal.
*
* If you are interested in doing more complicated local handling of the
* commandline then you should implement your own #GApplication subclass
* and override local_command_line(). In this case, you most likely want
* to return %TRUE from your local_command_line() implementation to
* suppress the default handling. See
* [gapplication-example-cmdline2.c][https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-cmdline2.c]
* for an example.
*
* If, after the above is done, the use count of the application is zero
* then the exit status is returned immediately. If the use count is
* non-zero then the default main context is iterated until the use count
* falls to zero, at which point 0 is returned.
*
* If the %G_APPLICATION_IS_SERVICE flag is set, then the service will
* run for as much as 10 seconds with a use count of zero while waiting
* for the message that caused the activation to arrive. After that,
* if the use count falls to zero the application will exit immediately,
* except in the case that g_application_set_inactivity_timeout() is in
* use.
*
* This function sets the prgname (g_set_prgname()), if not already set,
* to the basename of argv[0].
*
* Much like g_main_loop_run(), this function will acquire the main context
* for the duration that the application is running.
*
* Since 2.40, applications that are not explicitly flagged as services
* or launchers (ie: neither %G_APPLICATION_IS_SERVICE or
* %G_APPLICATION_IS_LAUNCHER are given as flags) will check (from the
* default handler for local_command_line) if "--gapplication-service"
* was given in the command line. If this flag is present then normal
* commandline processing is interrupted and the
* %G_APPLICATION_IS_SERVICE flag is set. This provides a "compromise"
* solution whereby running an application directly from the commandline
* will invoke it in the normal way (which can be useful for debugging)
* while still allowing applications to be D-Bus activated in service
* mode. The D-Bus service file should invoke the executable with
* "--gapplication-service" as the sole commandline argument. This
* approach is suitable for use by most graphical applications but
* should not be used from applications like editors that need precise
* control over when processes invoked via the commandline will exit and
* what their exit status will be.
* @param argv the argv from main(), or %NULL
* @returns the exit status
*/
run(argv: string[] | null): number
/**
* Sends a notification on behalf of `application` to the desktop shell.
* There is no guarantee that the notification is displayed immediately,
* or even at all.
*
* Notifications may persist after the application exits. It will be
* D-Bus-activated when the notification or one of its actions is
* activated.
*
* Modifying `notification` after this call has no effect. However, the
* object can be reused for a later call to this function.
*
* `id` may be any string that uniquely identifies the event for the
* application. It does not need to be in any special format. For
* example, "new-message" might be appropriate for a notification about
* new messages.
*
* If a previous notification was sent with the same `id,` it will be
* replaced with `notification` and shown again as if it was a new
* notification. This works even for notifications sent from a previous
* execution of the application, as long as `id` is the same string.
*
* `id` may be %NULL, but it is impossible to replace or withdraw
* notifications without an id.
*
* If `notification` is no longer relevant, it can be withdrawn with
* g_application_withdraw_notification().
* @param id id of the notification, or %NULL
* @param notification the #GNotification to send
*/
send_notification(id: string | null, notification: Notification): void
/**
* This used to be how actions were associated with a #GApplication.
* Now there is #GActionMap for that.
* @param action_group a #GActionGroup, or %NULL
*/
set_action_group(action_group: ActionGroup | null): void
/**
* Sets the unique identifier for `application`.
*
* The application id can only be modified if `application` has not yet
* been registered.
*
* If non-%NULL, the application id must be valid. See
* g_application_id_is_valid().
* @param application_id the identifier for `application`
*/
set_application_id(application_id: string | null): void
/**
* Sets or unsets the default application for the process, as returned
* by g_application_get_default().
*
* This function does not take its own reference on `application`. If
* `application` is destroyed then the default application will revert
* back to %NULL.
*/
set_default(): void
/**
* Sets the flags for `application`.
*
* The flags can only be modified if `application` has not yet been
* registered.
*
* See #GApplicationFlags.
* @param flags the flags for `application`
*/
set_flags(flags: ApplicationFlags): void
/**
* Sets the current inactivity timeout for the application.
*
* This is the amount of time (in milliseconds) after the last call to
* g_application_release() before the application stops running.
*
* This call has no side effects of its own. The value set here is only
* used for next time g_application_release() drops the use count to
* zero. Any timeouts currently in progress are not impacted.
* @param inactivity_timeout the timeout, in milliseconds
*/
set_inactivity_timeout(inactivity_timeout: number): void
/**
* Adds a description to the `application` option context.
*
* See g_option_context_set_description() for more information.
* @param description a string to be shown in `--help` output after the list of options, or %NULL
*/
set_option_context_description(description: string | null): void
/**
* Sets the parameter string to be used by the commandline handling of `application`.
*
* This function registers the argument to be passed to g_option_context_new()
* when the internal #GOptionContext of `application` is created.
*
* See g_option_context_new() for more information about `parameter_string`.
* @param parameter_string a string which is displayed in the first line of `--help` output, after the usage summary `programname [OPTION...]`.
*/
set_option_context_parameter_string(parameter_string: string | null): void
/**
* Adds a summary to the `application` option context.
*
* See g_option_context_set_summary() for more information.
* @param summary a string to be shown in `--help` output before the list of options, or %NULL
*/
set_option_context_summary(summary: string | null): void
/**
* Sets (or unsets) the base resource path of `application`.
*
* The path is used to automatically load various [application
* resources][gresource] such as menu layouts and action descriptions.
* The various types of resources will be found at fixed names relative
* to the given base path.
*
* By default, the resource base path is determined from the application
* ID by prefixing '/' and replacing each '.' with '/'. This is done at
* the time that the #GApplication object is constructed. Changes to
* the application ID after that point will not have an impact on the
* resource base path.
*
* As an example, if the application has an ID of "org.example.app" then
* the default resource base path will be "/org/example/app". If this
* is a #GtkApplication (and you have not manually changed the path)
* then Gtk will then search for the menus of the application at
* "/org/example/app/gtk/menus.ui".
*
* See #GResource for more information about adding resources to your
* application.
*
* You can disable automatic resource loading functionality by setting
* the path to %NULL.
*
* Changing the resource base path once the application is running is
* not recommended. The point at which the resource path is consulted
* for forming paths for various purposes is unspecified. When writing
* a sub-class of #GApplication you should either set the
* #GApplication:resource-base-path property at construction time, or call
* this function during the instance initialization. Alternatively, you
* can call this function in the #GApplicationClass.startup virtual function,
* before chaining up to the parent implementation.
* @param resource_path the resource path to use
*/
set_resource_base_path(resource_path: string | null): void
/**
* Destroys a binding between `property` and the busy state of
* `application` that was previously created with
* g_application_bind_busy_property().
* @param object a #GObject
* @param property the name of a boolean property of `object`
*/
unbind_busy_property(object: GObject.Object, property: string | null): void
/**
* Decreases the busy count of `application`.
*
* When the busy count reaches zero, the new state will be propagated
* to other processes.
*
* This function must only be called to cancel the effect of a previous
* call to g_application_mark_busy().
*/
unmark_busy(): void
/**
* Withdraws a notification that was sent with
* g_application_send_notification().
*
* This call does nothing if a notification with `id` doesn't exist or
* the notification was never sent.
*
* This function works even for notifications sent in previous
* executions of this application, as long `id` is the same as it was for
* the sent notification.
*
* Note that notifications are dismissed when the user clicks on one
* of the buttons in a notification or triggers its default action, so
* there is no need to explicitly withdraw the notification in that case.
* @param id id of a previously sent notification
*/
withdraw_notification(id: string | null): void
// Own virtual methods of Gio-2.0.Gio.Application
/**
* Activates the application.
*
* In essence, this results in the #GApplication::activate signal being
* emitted in the primary instance.
*
* The application must be registered before calling this function.
* @virtual
*/
vfunc_activate(): void
vfunc_add_platform_data(builder: GLib.VariantBuilder): void
vfunc_after_emit(platform_data: GLib.Variant): void
vfunc_before_emit(platform_data: GLib.Variant): void
vfunc_command_line(command_line: ApplicationCommandLine): number
vfunc_dbus_register(connection: DBusConnection, object_path: string | null): boolean
vfunc_dbus_unregister(connection: DBusConnection, object_path: string | null): void
vfunc_handle_local_options(options: GLib.VariantDict): number
/**
* This virtual function is always invoked in the local instance. It
* gets passed a pointer to a %NULL-terminated copy of `argv` and is
* expected to remove arguments that it handled (shifting up remaining
* arguments).
*
* The last argument to local_command_line() is a pointer to the `status`
* variable which can used to set the exit status that is returned from
* g_application_run().
*
* See g_application_run() for more details on #GApplication startup.
* @virtual
* @param arguments_ array of command line arguments
* @returns %TRUE if the commandline has been completely handled
*/
vfunc_local_command_line(arguments_: string[]): [ /* returnType */ boolean, /* arguments_ */ string[], /* exit_status */ number ]
vfunc_name_lost(): boolean
/**
* Opens the given files.
*
* In essence, this results in the #GApplication::open signal being emitted
* in the primary instance.
*
* `n_files` must be greater than zero.
*
* `hint` is simply passed through to the ::open signal. It is
* intended to be used by applications that have multiple modes for
* opening files (eg: "view" vs "edit", etc). Unless you have a need
* for this functionality, you should use "".
*
* The application must be registered before calling this function
* and it must have the %G_APPLICATION_HANDLES_OPEN flag set.
* @virtual
* @param files an array of #GFiles to open
* @param hint a hint (or ""), but never %NULL
*/
vfunc_open(files: File[], hint: string | null): void
vfunc_quit_mainloop(): void
vfunc_run_mainloop(): void
vfunc_shutdown(): void
vfunc_startup(): void
// Own signals of Gio-2.0.Gio.Application
connect(sigName: "activate", callback: Application.ActivateSignalCallback): number
connect_after(sigName: "activate", callback: Application.ActivateSignalCallback): number
emit(sigName: "activate", ...args: any[]): void
connect(sigName: "command-line", callback: Application.CommandLineSignalCallback): number
connect_after(sigName: "command-line", callback: Application.CommandLineSignalCallback): number
emit(sigName: "command-line", command_line: ApplicationCommandLine, ...args: any[]): void
connect(sigName: "handle-local-options", callback: Application.HandleLocalOptionsSignalCallback): number
connect_after(sigName: "handle-local-options", callback: Application.HandleLocalOptionsSignalCallback): number
emit(sigName: "handle-local-options", options: GLib.VariantDict, ...args: any[]): void
connect(sigName: "name-lost", callback: Application.NameLostSignalCallback): number
connect_after(sigName: "name-lost", callback: Application.NameLostSignalCallback): number
emit(sigName: "name-lost", ...args: any[]): void
connect(sigName: "open", callback: Application.OpenSignalCallback): number
connect_after(sigName: "open", callback: Application.OpenSignalCallback): number
emit(sigName: "open", files: File[], hint: string | null, ...args: any[]): void
connect(sigName: "shutdown", callback: Application.ShutdownSignalCallback): number
connect_after(sigName: "shutdown", callback: Application.ShutdownSignalCallback): number
emit(sigName: "shutdown", ...args: any[]): void
connect(sigName: "startup", callback: Application.StartupSignalCallback): number
connect_after(sigName: "startup", callback: Application.StartupSignalCallback): number
emit(sigName: "startup", ...args: any[]): void
// Class property signals of Gio-2.0.Gio.Application
connect(sigName: "notify::action-group", callback: (($obj: Application, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::action-group", callback: (($obj: Application, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::action-group", ...args: any[]): void
connect(sigName: "notify::application-id", callback: (($obj: Application, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::application-id", callback: (($obj: Application, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::application-id", ...args: any[]): void
connect(sigName: "notify::flags", callback: (($obj: Application, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::flags", callback: (($obj: Application, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::flags", ...args: any[]): void
connect(sigName: "notify::inactivity-timeout", callback: (($obj: Application, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::inactivity-timeout", callback: (($obj: Application, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::inactivity-timeout", ...args: any[]): void
connect(sigName: "notify::is-busy", callback: (($obj: Application, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::is-busy", callback: (($obj: Application, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::is-busy", ...args: any[]): void
connect(sigName: "notify::is-registered", callback: (($obj: Application, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::is-registered", callback: (($obj: Application, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::is-registered", ...args: any[]): void
connect(sigName: "notify::is-remote", callback: (($obj: Application, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::is-remote", callback: (($obj: Application, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::is-remote", ...args: any[]): void
connect(sigName: "notify::resource-base-path", callback: (($obj: Application, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::resource-base-path", callback: (($obj: Application, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::resource-base-path", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* A #GApplication is the foundation of an application. It wraps some
* low-level platform-specific services and is intended to act as the
* foundation for higher-level application classes such as
* #GtkApplication or #MxApplication. In general, you should not use
* this class outside of a higher level framework.
*
* GApplication provides convenient life cycle management by maintaining
* a "use count" for the primary application instance. The use count can
* be changed using g_application_hold() and g_application_release(). If
* it drops to zero, the application exits. Higher-level classes such as
* #GtkApplication employ the use count to ensure that the application
* stays alive as long as it has any opened windows.
*
* Another feature that GApplication (optionally) provides is process
* uniqueness. Applications can make use of this functionality by
* providing a unique application ID. If given, only one application
* with this ID can be running at a time per session. The session
* concept is platform-dependent, but corresponds roughly to a graphical
* desktop login. When your application is launched again, its
* arguments are passed through platform communication to the already
* running program. The already running instance of the program is
* called the "primary instance"; for non-unique applications this is
* always the current instance. On Linux, the D-Bus session bus
* is used for communication.
*
* The use of #GApplication differs from some other commonly-used
* uniqueness libraries (such as libunique) in important ways. The
* application is not expected to manually register itself and check
* if it is the primary instance. Instead, the main() function of a
* #GApplication should do very little more than instantiating the
* application instance, possibly connecting signal handlers, then
* calling g_application_run(). All checks for uniqueness are done
* internally. If the application is the primary instance then the
* startup signal is emitted and the mainloop runs. If the application
* is not the primary instance then a signal is sent to the primary
* instance and g_application_run() promptly returns. See the code
* examples below.
*
* If used, the expected form of an application identifier is the
* same as that of a
* [D-Bus well-known bus name](https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus).
* Examples include: `com.example.MyApp`, `org.example.internal_apps.Calculator`,
* `org._7_zip.Archiver`.
* For details on valid application identifiers, see g_application_id_is_valid().
*
* On Linux, the application identifier is claimed as a well-known bus name
* on the user's session bus. This means that the uniqueness of your
* application is scoped to the current session. It also means that your
* application may provide additional services (through registration of other
* object paths) at that bus name. The registration of these object paths
* should be done with the shared GDBus session bus. Note that due to the
* internal architecture of GDBus, method calls can be dispatched at any time
* (even if a main loop is not running). For this reason, you must ensure that
* any object paths that you wish to register are registered before #GApplication
* attempts to acquire the bus name of your application (which happens in
* g_application_register()). Unfortunately, this means that you cannot use
* g_application_get_is_remote() to decide if you want to register object paths.
*
* GApplication also implements the #GActionGroup and #GActionMap
* interfaces and lets you easily export actions by adding them with
* g_action_map_add_action(). When invoking an action by calling
* g_action_group_activate_action() on the application, it is always
* invoked in the primary instance. The actions are also exported on
* the session bus, and GIO provides the #GDBusActionGroup wrapper to
* conveniently access them remotely. GIO provides a #GDBusMenuModel wrapper
* for remote access to exported #GMenuModels.
*
* Note: Due to the fact that actions are exported on the session bus,
* using `maybe` parameters is not supported, since D-Bus does not support
* `maybe` types.
*
* There is a number of different entry points into a GApplication:
*
* - via 'Activate' (i.e. just starting the application)
*
* - via 'Open' (i.e. opening some files)
*
* - by handling a command-line
*
* - via activating an action
*
* The #GApplication::startup signal lets you handle the application
* initialization for all of these in a single place.
*
* Regardless of which of these entry points is used to start the
* application, GApplication passes some ‘platform data’ from the
* launching instance to the primary instance, in the form of a
* #GVariant dictionary mapping strings to variants. To use platform
* data, override the `before_emit` or `after_emit` virtual functions
* in your #GApplication subclass. When dealing with
* #GApplicationCommandLine objects, the platform data is
* directly available via g_application_command_line_get_cwd(),
* g_application_command_line_get_environ() and
* g_application_command_line_get_platform_data().
*
* As the name indicates, the platform data may vary depending on the
* operating system, but it always includes the current directory (key
* "cwd"), and optionally the environment (ie the set of environment
* variables and their values) of the calling process (key "environ").
* The environment is only added to the platform data if the
* %G_APPLICATION_SEND_ENVIRONMENT flag is set. #GApplication subclasses
* can add their own platform data by overriding the `add_platform_data`
* virtual function. For instance, #GtkApplication adds startup notification
* data in this way.
*
* To parse commandline arguments you may handle the
* #GApplication::command-line signal or override the local_command_line()
* vfunc, to parse them in either the primary instance or the local instance,
* respectively.
*
* For an example of opening files with a GApplication, see
* [gapplication-example-open.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-open.c).
*
* For an example of using actions with GApplication, see
* [gapplication-example-actions.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-actions.c).
*
* For an example of using extra D-Bus hooks with GApplication, see
* [gapplication-example-dbushooks.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-dbushooks.c).
* @class
*/
export class Application extends GObject.Object {
// Own properties of Gio-2.0.Gio.Application
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.Application
constructor(config?: Application.ConstructorProperties)
/**
* Creates a new #GApplication instance.
*
* If non-%NULL, the application id must be valid. See
* g_application_id_is_valid().
*
* If no application ID is given then some features of #GApplication
* (most notably application uniqueness) will be disabled.
* @constructor
* @param application_id the application id
* @param flags the application flags
* @returns a new #GApplication instance
*/
constructor(application_id: string | null, flags: ApplicationFlags)
/**
* Creates a new #GApplication instance.
*
* If non-%NULL, the application id must be valid. See
* g_application_id_is_valid().
*
* If no application ID is given then some features of #GApplication
* (most notably application uniqueness) will be disabled.
* @constructor
* @param application_id the application id
* @param flags the application flags
* @returns a new #GApplication instance
*/
static new(application_id: string | null, flags: ApplicationFlags): Application
_init(config?: Application.ConstructorProperties): void
/**
* Returns the default #GApplication instance for this process.
*
* Normally there is only one #GApplication per process and it becomes
* the default when it is created. You can exercise more control over
* this by using g_application_set_default().
*
* If there is no default application then %NULL is returned.
* @returns the default application for this process, or %NULL
*/
static get_default(): Application | null
/**
* Checks if `application_id` is a valid application identifier.
*
* A valid ID is required for calls to g_application_new() and
* g_application_set_application_id().
*
* Application identifiers follow the same format as
* [D-Bus well-known bus names](https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus).
* For convenience, the restrictions on application identifiers are
* reproduced here:
*
* - Application identifiers are composed of 1 or more elements separated by a
* period (`.`) character. All elements must contain at least one character.
*
* - Each element must only contain the ASCII characters `[A-Z][a-z][0-9]_-`,
* with `-` discouraged in new application identifiers. Each element must not
* begin with a digit.
*
* - Application identifiers must contain at least one `.` (period) character
* (and thus at least two elements).
*
* - Application identifiers must not begin with a `.` (period) character.
*
* - Application identifiers must not exceed 255 characters.
*
* Note that the hyphen (`-`) character is allowed in application identifiers,
* but is problematic or not allowed in various specifications and APIs that
* refer to D-Bus, such as
* [Flatpak application IDs](http://docs.flatpak.org/en/latest/introduction.html#identifiers),
* the
* [`DBusActivatable` interface in the Desktop Entry Specification](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#dbus),
* and the convention that an application's "main" interface and object path
* resemble its application identifier and bus name. To avoid situations that
* require special-case handling, it is recommended that new application
* identifiers consistently replace hyphens with underscores.
*
* Like D-Bus interface names, application identifiers should start with the
* reversed DNS domain name of the author of the interface (in lower-case), and
* it is conventional for the rest of the application identifier to consist of
* words run together, with initial capital letters.
*
* As with D-Bus interface names, if the author's DNS domain name contains
* hyphen/minus characters they should be replaced by underscores, and if it
* contains leading digits they should be escaped by prepending an underscore.
* For example, if the owner of 7-zip.org used an application identifier for an
* archiving application, it might be named `org._7_zip.Archiver`.
* @param application_id a potential application identifier
* @returns %TRUE if @application_id is valid
*/
static id_is_valid(application_id: string | null): boolean
}
export module ApplicationCommandLine {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.ApplicationCommandLine
"arguments"?: GLib.Variant | null
options?: GLib.Variant | null
platform_data?: GLib.Variant | null
}
}
export interface ApplicationCommandLine {
// Own properties of Gio-2.0.Gio.ApplicationCommandLine
readonly "arguments": GLib.Variant
readonly is_remote: boolean
readonly options: GLib.Variant
readonly platform_data: GLib.Variant
// Owm methods of Gio-2.0.Gio.ApplicationCommandLine
/**
* Creates a #GFile corresponding to a filename that was given as part
* of the invocation of `cmdline`.
*
* This differs from g_file_new_for_commandline_arg() in that it
* resolves relative pathnames using the current working directory of
* the invoking process rather than the local process.
* @param arg an argument from `cmdline`
* @returns a new #GFile
*/
create_file_for_arg(arg: string): File
/**
* Gets the list of arguments that was passed on the command line.
*
* The strings in the array may contain non-UTF-8 data on UNIX (such as
* filenames or arguments given in the system locale) but are always in
* UTF-8 on Windows.
*
* If you wish to use the return value with #GOptionContext, you must
* use g_option_context_parse_strv().
*
* The return value is %NULL-terminated and should be freed using
* g_strfreev().
* @returns the string array containing the arguments (the argv)
*/
get_arguments(): string[]
/**
* Gets the working directory of the command line invocation.
* The string may contain non-utf8 data.
*
* It is possible that the remote application did not send a working
* directory, so this may be %NULL.
*
* The return value should not be modified or freed and is valid for as
* long as `cmdline` exists.
* @returns the current directory, or %NULL
*/
get_cwd(): string | null
/**
* Gets the contents of the 'environ' variable of the command line
* invocation, as would be returned by g_get_environ(), ie as a
* %NULL-terminated list of strings in the form 'NAME=VALUE'.
* The strings may contain non-utf8 data.
*
* The remote application usually does not send an environment. Use
* %G_APPLICATION_SEND_ENVIRONMENT to affect that. Even with this flag
* set it is possible that the environment is still not available (due
* to invocation messages from other applications).
*
* The return value should not be modified or freed and is valid for as
* long as `cmdline` exists.
*
* See g_application_command_line_getenv() if you are only interested
* in the value of a single environment variable.
* @returns the environment strings, or %NULL if they were not sent
*/
get_environ(): string[]
/**
* Gets the exit status of `cmdline`. See
* g_application_command_line_set_exit_status() for more information.
* @returns the exit status
*/
get_exit_status(): number
/**
* Determines if `cmdline` represents a remote invocation.
* @returns %TRUE if the invocation was remote
*/
get_is_remote(): boolean
/**
* Gets the options that were passed to g_application_command_line().
*
* If you did not override local_command_line() then these are the same
* options that were parsed according to the #GOptionEntrys added to the
* application with g_application_add_main_option_entries() and possibly
* modified from your GApplication::handle-local-options handler.
*
* If no options were sent then an empty dictionary is returned so that
* you don't need to check for %NULL.
*
* The data has been passed via an untrusted external process, so the types of
* all values must be checked before being used.
* @returns a #GVariantDict with the options
*/
get_options_dict(): GLib.VariantDict
/**
* Gets the platform data associated with the invocation of `cmdline`.
*
* This is a #GVariant dictionary containing information about the
* context in which the invocation occurred. It typically contains
* information like the current working directory and the startup
* notification ID.
*
* It comes from an untrusted external process and hence the types of all
* values must be validated before being used.
*
* For local invocation, it will be %NULL.
* @returns the platform data, or %NULL
*/
get_platform_data(): GLib.Variant | null
/**
* Gets the stdin of the invoking process.
*
* The #GInputStream can be used to read data passed to the standard
* input of the invoking process.
* This doesn't work on all platforms. Presently, it is only available
* on UNIX when using a D-Bus daemon capable of passing file descriptors.
* If stdin is not available then %NULL will be returned. In the
* future, support may be expanded to other platforms.
*
* You must only call this function once per commandline invocation.
* @returns a #GInputStream for stdin
*/
get_stdin(): InputStream | null
/**
* Gets the value of a particular environment variable of the command
* line invocation, as would be returned by g_getenv(). The strings may
* contain non-utf8 data.
*
* The remote application usually does not send an environment. Use
* %G_APPLICATION_SEND_ENVIRONMENT to affect that. Even with this flag
* set it is possible that the environment is still not available (due
* to invocation messages from other applications).
*
* The return value should not be modified or freed and is valid for as
* long as `cmdline` exists.
* @param name the environment variable to get
* @returns the value of the variable, or %NULL if unset or unsent
*/
getenv(name: string): string | null
/**
* Sets the exit status that will be used when the invoking process
* exits.
*
* The return value of the #GApplication::command-line signal is
* passed to this function when the handler returns. This is the usual
* way of setting the exit status.
*
* In the event that you want the remote invocation to continue running
* and want to decide on the exit status in the future, you can use this
* call. For the case of a remote invocation, the remote process will
* typically exit when the last reference is dropped on `cmdline`. The
* exit status of the remote process will be equal to the last value
* that was set with this function.
*
* In the case that the commandline invocation is local, the situation
* is slightly more complicated. If the commandline invocation results
* in the mainloop running (ie: because the use-count of the application
* increased to a non-zero value) then the application is considered to
* have been 'successful' in a certain sense, and the exit status is
* always zero. If the application use count is zero, though, the exit
* status of the local #GApplicationCommandLine is used.
* @param exit_status the exit status
*/
set_exit_status(exit_status: number): void
// Own virtual methods of Gio-2.0.Gio.ApplicationCommandLine
/**
* Gets the stdin of the invoking process.
*
* The #GInputStream can be used to read data passed to the standard
* input of the invoking process.
* This doesn't work on all platforms. Presently, it is only available
* on UNIX when using a D-Bus daemon capable of passing file descriptors.
* If stdin is not available then %NULL will be returned. In the
* future, support may be expanded to other platforms.
*
* You must only call this function once per commandline invocation.
* @virtual
* @returns a #GInputStream for stdin
*/
vfunc_get_stdin(): InputStream | null
vfunc_print_literal(message: string | null): void
vfunc_printerr_literal(message: string | null): void
// Class property signals of Gio-2.0.Gio.ApplicationCommandLine
connect(sigName: "notify::arguments", callback: (($obj: ApplicationCommandLine, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::arguments", callback: (($obj: ApplicationCommandLine, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::arguments", ...args: any[]): void
connect(sigName: "notify::is-remote", callback: (($obj: ApplicationCommandLine, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::is-remote", callback: (($obj: ApplicationCommandLine, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::is-remote", ...args: any[]): void
connect(sigName: "notify::options", callback: (($obj: ApplicationCommandLine, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::options", callback: (($obj: ApplicationCommandLine, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::options", ...args: any[]): void
connect(sigName: "notify::platform-data", callback: (($obj: ApplicationCommandLine, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::platform-data", callback: (($obj: ApplicationCommandLine, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::platform-data", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GApplicationCommandLine represents a command-line invocation of
* an application. It is created by #GApplication and emitted
* in the #GApplication::command-line signal and virtual function.
*
* The class contains the list of arguments that the program was invoked
* with. It is also possible to query if the commandline invocation was
* local (ie: the current process is running in direct response to the
* invocation) or remote (ie: some other process forwarded the
* commandline to this process).
*
* The GApplicationCommandLine object can provide the `argc` and `argv`
* parameters for use with the #GOptionContext command-line parsing API,
* with the g_application_command_line_get_arguments() function. See
* [gapplication-example-cmdline3.c][gapplication-example-cmdline3]
* for an example.
*
* The exit status of the originally-invoked process may be set and
* messages can be printed to stdout or stderr of that process. The
* lifecycle of the originally-invoked process is tied to the lifecycle
* of this object (ie: the process exits when the last reference is
* dropped).
*
* The main use for #GApplicationCommandLine (and the
* #GApplication::command-line signal) is 'Emacs server' like use cases:
* You can set the `EDITOR` environment variable to have e.g. git use
* your favourite editor to edit commit messages, and if you already
* have an instance of the editor running, the editing will happen
* in the running instance, instead of opening a new one. An important
* aspect of this use case is that the process that gets started by git
* does not return until the editing is done.
*
* Normally, the commandline is completely handled in the
* #GApplication::command-line handler. The launching instance exits
* once the signal handler in the primary instance has returned, and
* the return value of the signal handler becomes the exit status
* of the launching instance.
*
* ```c
* static int
* command_line (GApplication *application,
* GApplicationCommandLine *cmdline)
* {
* gchar **argv;
* gint argc;
* gint i;
*
* argv = g_application_command_line_get_arguments (cmdline, &argc);
*
* g_application_command_line_print (cmdline,
* "This text is written back\n"
* "to stdout of the caller\n");
*
* for (i = 0; i < argc; i++)
* g_print ("argument %d: %s\n", i, argv[i]);
*
* g_strfreev (argv);
*
* return 0;
* }
* ```
*
* The complete example can be found here:
* [gapplication-example-cmdline.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-cmdline.c)
*
* In more complicated cases, the handling of the commandline can be
* split between the launcher and the primary instance.
*
* ```c
* static gboolean
* test_local_cmdline (GApplication *application,
* gchar ***arguments,
* gint *exit_status)
* {
* gint i, j;
* gchar **argv;
*
* argv = *arguments;
*
* if (argv[0] == NULL)
* {
* *exit_status = 0;
* return FALSE;
* }
*
* i = 1;
* while (argv[i])
* {
* if (g_str_has_prefix (argv[i], "--local-"))
* {
* g_print ("handling argument %s locally\n", argv[i]);
* g_free (argv[i]);
* for (j = i; argv[j]; j++)
* argv[j] = argv[j + 1];
* }
* else
* {
* g_print ("not handling argument %s locally\n", argv[i]);
* i++;
* }
* }
*
* *exit_status = 0;
*
* return FALSE;
* }
*
* static void
* test_application_class_init (TestApplicationClass *class)
* {
* G_APPLICATION_CLASS (class)->local_command_line = test_local_cmdline;
*
* ...
* }
* ```
*
* In this example of split commandline handling, options that start
* with `--local-` are handled locally, all other options are passed
* to the #GApplication::command-line handler which runs in the primary
* instance.
*
* The complete example can be found here:
* [gapplication-example-cmdline2.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-cmdline2.c)
*
* If handling the commandline requires a lot of work, it may
* be better to defer it.
*
* ```c
* static gboolean
* my_cmdline_handler (gpointer data)
* {
* GApplicationCommandLine *cmdline = data;
*
* // do the heavy lifting in an idle
*
* g_application_command_line_set_exit_status (cmdline, 0);
* g_object_unref (cmdline); // this releases the application
*
* return G_SOURCE_REMOVE;
* }
*
* static int
* command_line (GApplication *application,
* GApplicationCommandLine *cmdline)
* {
* // keep the application running until we are done with this commandline
* g_application_hold (application);
*
* g_object_set_data_full (G_OBJECT (cmdline),
* "application", application,
* (GDestroyNotify)g_application_release);
*
* g_object_ref (cmdline);
* g_idle_add (my_cmdline_handler, cmdline);
*
* return 0;
* }
* ```
*
* In this example the commandline is not completely handled before
* the #GApplication::command-line handler returns. Instead, we keep
* a reference to the #GApplicationCommandLine object and handle it
* later (in this example, in an idle). Note that it is necessary to
* hold the application until you are done with the commandline.
*
* The complete example can be found here:
* [gapplication-example-cmdline3.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-cmdline3.c)
* @class
*/
export class ApplicationCommandLine extends GObject.Object {
// Own properties of Gio-2.0.Gio.ApplicationCommandLine
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.ApplicationCommandLine
constructor(config?: ApplicationCommandLine.ConstructorProperties)
_init(config?: ApplicationCommandLine.ConstructorProperties): void
}
export module BufferedInputStream {
// Constructor properties interface
export interface ConstructorProperties extends Seekable.ConstructorProperties, FilterInputStream.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.BufferedInputStream
buffer_size?: number | null
}
}
export interface BufferedInputStream extends Seekable {
// Own properties of Gio-2.0.Gio.BufferedInputStream
buffer_size: number
// Own fields of Gio-2.0.Gio.BufferedInputStream
parent_instance: FilterInputStream & InputStream & GObject.Object & GObject.Object
// Owm methods of Gio-2.0.Gio.BufferedInputStream
/**
* Tries to read `count` bytes from the stream into the buffer.
* Will block during this read.
*
* If `count` is zero, returns zero and does nothing. A value of `count`
* larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
*
* On success, the number of bytes read into the buffer is returned.
* It is not an error if this is not the same as the requested size, as it
* can happen e.g. near the end of a file. Zero is returned on end of file
* (or if `count` is zero), but never otherwise.
*
* If `count` is -1 then the attempted read size is equal to the number of
* bytes that are required to fill the buffer.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
* operation was partially finished when the operation was cancelled the
* partial result will be returned, without an error.
*
* On error -1 is returned and `error` is set accordingly.
*
* For the asynchronous, non-blocking, version of this function, see
* g_buffered_input_stream_fill_async().
* @param count the number of bytes that will be read from the stream
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns the number of bytes read into @stream's buffer, up to @count, or -1 on error.
*/
fill(count: number, cancellable: Cancellable | null): number
/**
* Reads data into `stream'`s buffer asynchronously, up to `count` size.
* `io_priority` can be used to prioritize reads. For the synchronous
* version of this function, see g_buffered_input_stream_fill().
*
* If `count` is -1 then the attempted read size is equal to the number
* of bytes that are required to fill the buffer.
* @param count the number of bytes that will be read from the stream
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object
* @param callback a #GAsyncReadyCallback
*/
fill_async(count: number, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
// Overloads of fill_async
/**
* Promisified version of {@link fill_async}
*
* Reads data into `stream'`s buffer asynchronously, up to `count` size.
* `io_priority` can be used to prioritize reads. For the synchronous
* version of this function, see g_buffered_input_stream_fill().
*
* If `count` is -1 then the attempted read size is equal to the number
* of bytes that are required to fill the buffer.
* @param count the number of bytes that will be read from the stream
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object
* @returns A Promise of: a #gssize of the read stream, or `-1` on an error.
*/
fill_async(count: number, io_priority: number, cancellable: Cancellable | null): globalThis.Promise
/**
* Finishes an asynchronous read.
* @param result a #GAsyncResult
* @returns a #gssize of the read stream, or `-1` on an error.
*/
fill_finish(result: AsyncResult): number
/**
* Gets the size of the available data within the stream.
* @returns size of the available stream.
*/
get_available(): number
/**
* Gets the size of the input buffer.
* @returns the current buffer size.
*/
get_buffer_size(): number
/**
* Peeks in the buffer, copying data of size `count` into `buffer,`
* offset `offset` bytes.
* @param buffer a pointer to an allocated chunk of memory
* @param offset a #gsize
* @returns a #gsize of the number of bytes peeked, or -1 on error.
*/
peek(buffer: Uint8Array, offset: number): number
/**
* Returns the buffer with the currently available bytes. The returned
* buffer must not be modified and will become invalid when reading from
* the stream or filling the buffer.
* @returns read-only buffer
*/
peek_buffer(): Uint8Array
/**
* Tries to read a single byte from the stream or the buffer. Will block
* during this read.
*
* On success, the byte read from the stream is returned. On end of stream
* -1 is returned but it's not an exceptional error and `error` is not set.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
* operation was partially finished when the operation was cancelled the
* partial result will be returned, without an error.
*
* On error -1 is returned and `error` is set accordingly.
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns the byte read from the @stream, or -1 on end of stream or error.
*/
read_byte(cancellable: Cancellable | null): number
/**
* Sets the size of the internal buffer of `stream` to `size,` or to the
* size of the contents of the buffer. The buffer can never be resized
* smaller than its current contents.
* @param size a #gsize
*/
set_buffer_size(size: number): void
// Own virtual methods of Gio-2.0.Gio.BufferedInputStream
/**
* Tries to read `count` bytes from the stream into the buffer.
* Will block during this read.
*
* If `count` is zero, returns zero and does nothing. A value of `count`
* larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
*
* On success, the number of bytes read into the buffer is returned.
* It is not an error if this is not the same as the requested size, as it
* can happen e.g. near the end of a file. Zero is returned on end of file
* (or if `count` is zero), but never otherwise.
*
* If `count` is -1 then the attempted read size is equal to the number of
* bytes that are required to fill the buffer.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
* operation was partially finished when the operation was cancelled the
* partial result will be returned, without an error.
*
* On error -1 is returned and `error` is set accordingly.
*
* For the asynchronous, non-blocking, version of this function, see
* g_buffered_input_stream_fill_async().
* @virtual
* @param count the number of bytes that will be read from the stream
* @param cancellable optional #GCancellable object, %NULL to ignore
* @returns the number of bytes read into @stream's buffer, up to @count, or -1 on error.
*/
vfunc_fill(count: number, cancellable: Cancellable | null): number
/**
* Reads data into `stream'`s buffer asynchronously, up to `count` size.
* `io_priority` can be used to prioritize reads. For the synchronous
* version of this function, see g_buffered_input_stream_fill().
*
* If `count` is -1 then the attempted read size is equal to the number
* of bytes that are required to fill the buffer.
* @virtual
* @param count the number of bytes that will be read from the stream
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object
* @param callback a #GAsyncReadyCallback
*/
vfunc_fill_async(count: number, io_priority: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an asynchronous read.
* @virtual
* @param result a #GAsyncResult
* @returns a #gssize of the read stream, or `-1` on an error.
*/
vfunc_fill_finish(result: AsyncResult): number
// Class property signals of Gio-2.0.Gio.BufferedInputStream
connect(sigName: "notify::buffer-size", callback: (($obj: BufferedInputStream, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::buffer-size", callback: (($obj: BufferedInputStream, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::buffer-size", ...args: any[]): void
connect(sigName: "notify::close-base-stream", callback: (($obj: BufferedInputStream, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::close-base-stream", callback: (($obj: BufferedInputStream, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::close-base-stream", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* Buffered input stream implements #GFilterInputStream and provides
* for buffered reads.
*
* By default, #GBufferedInputStream's buffer size is set at 4 kilobytes.
*
* To create a buffered input stream, use g_buffered_input_stream_new(),
* or g_buffered_input_stream_new_sized() to specify the buffer's size at
* construction.
*
* To get the size of a buffer within a buffered input stream, use
* g_buffered_input_stream_get_buffer_size(). To change the size of a
* buffered input stream's buffer, use
* g_buffered_input_stream_set_buffer_size(). Note that the buffer's size
* cannot be reduced below the size of the data within the buffer.
* @class
*/
export class BufferedInputStream extends FilterInputStream {
// Own properties of Gio-2.0.Gio.BufferedInputStream
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.BufferedInputStream
constructor(config?: BufferedInputStream.ConstructorProperties)
/**
* Creates a new #GInputStream from the given `base_stream,` with
* a buffer set to the default size (4 kilobytes).
* @constructor
* @param base_stream a #GInputStream
* @returns a #GInputStream for the given @base_stream.
*/
constructor(base_stream: InputStream)
/**
* Creates a new #GInputStream from the given `base_stream,` with
* a buffer set to the default size (4 kilobytes).
* @constructor
* @param base_stream a #GInputStream
* @returns a #GInputStream for the given @base_stream.
*/
static new(base_stream: InputStream): BufferedInputStream
/**
* Creates a new #GBufferedInputStream from the given `base_stream,`
* with a buffer set to `size`.
* @constructor
* @param base_stream a #GInputStream
* @param size a #gsize
* @returns a #GInputStream.
*/
static new_sized(base_stream: InputStream, size: number): BufferedInputStream
_init(config?: BufferedInputStream.ConstructorProperties): void
}
export module BufferedOutputStream {
// Constructor properties interface
export interface ConstructorProperties extends Seekable.ConstructorProperties, FilterOutputStream.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.BufferedOutputStream
auto_grow?: boolean | null
buffer_size?: number | null
}
}
export interface BufferedOutputStream extends Seekable {
// Own properties of Gio-2.0.Gio.BufferedOutputStream
auto_grow: boolean
buffer_size: number
// Own fields of Gio-2.0.Gio.BufferedOutputStream
parent_instance: FilterOutputStream & OutputStream & GObject.Object & GObject.Object
priv: BufferedOutputStreamPrivate
// Owm methods of Gio-2.0.Gio.BufferedOutputStream
/**
* Checks if the buffer automatically grows as data is added.
* @returns %TRUE if the @stream's buffer automatically grows, %FALSE otherwise.
*/
get_auto_grow(): boolean
/**
* Gets the size of the buffer in the `stream`.
* @returns the current size of the buffer.
*/
get_buffer_size(): number
/**
* Sets whether or not the `stream'`s buffer should automatically grow.
* If `auto_grow` is true, then each write will just make the buffer
* larger, and you must manually flush the buffer to actually write out
* the data to the underlying stream.
* @param auto_grow a #gboolean.
*/
set_auto_grow(auto_grow: boolean): void
/**
* Sets the size of the internal buffer to `size`.
* @param size a #gsize.
*/
set_buffer_size(size: number): void
// Class property signals of Gio-2.0.Gio.BufferedOutputStream
connect(sigName: "notify::auto-grow", callback: (($obj: BufferedOutputStream, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::auto-grow", callback: (($obj: BufferedOutputStream, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::auto-grow", ...args: any[]): void
connect(sigName: "notify::buffer-size", callback: (($obj: BufferedOutputStream, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::buffer-size", callback: (($obj: BufferedOutputStream, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::buffer-size", ...args: any[]): void
connect(sigName: "notify::close-base-stream", callback: (($obj: BufferedOutputStream, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::close-base-stream", callback: (($obj: BufferedOutputStream, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::close-base-stream", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* Buffered output stream implements #GFilterOutputStream and provides
* for buffered writes.
*
* By default, #GBufferedOutputStream's buffer size is set at 4 kilobytes.
*
* To create a buffered output stream, use g_buffered_output_stream_new(),
* or g_buffered_output_stream_new_sized() to specify the buffer's size
* at construction.
*
* To get the size of a buffer within a buffered input stream, use
* g_buffered_output_stream_get_buffer_size(). To change the size of a
* buffered output stream's buffer, use
* g_buffered_output_stream_set_buffer_size(). Note that the buffer's
* size cannot be reduced below the size of the data within the buffer.
* @class
*/
export class BufferedOutputStream extends FilterOutputStream {
// Own properties of Gio-2.0.Gio.BufferedOutputStream
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.BufferedOutputStream
constructor(config?: BufferedOutputStream.ConstructorProperties)
/**
* Creates a new buffered output stream for a base stream.
* @constructor
* @param base_stream a #GOutputStream.
* @returns a #GOutputStream for the given @base_stream.
*/
constructor(base_stream: OutputStream)
/**
* Creates a new buffered output stream for a base stream.
* @constructor
* @param base_stream a #GOutputStream.
* @returns a #GOutputStream for the given @base_stream.
*/
static new(base_stream: OutputStream): BufferedOutputStream
/**
* Creates a new buffered output stream with a given buffer size.
* @constructor
* @param base_stream a #GOutputStream.
* @param size a #gsize.
* @returns a #GOutputStream with an internal buffer set to @size.
*/
static new_sized(base_stream: OutputStream, size: number): BufferedOutputStream
_init(config?: BufferedOutputStream.ConstructorProperties): void
}
export module BytesIcon {
// Constructor properties interface
export interface ConstructorProperties extends Icon.ConstructorProperties, LoadableIcon.ConstructorProperties, GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.BytesIcon
/**
* The bytes containing the icon.
*/
bytes?: GLib.Bytes | null
}
}
export interface BytesIcon extends Icon, LoadableIcon {
// Own properties of Gio-2.0.Gio.BytesIcon
/**
* The bytes containing the icon.
*/
readonly bytes: GLib.Bytes
// Owm methods of Gio-2.0.Gio.BytesIcon
/**
* Gets the #GBytes associated with the given `icon`.
* @returns a #GBytes.
*/
get_bytes(): GLib.Bytes
// Class property signals of Gio-2.0.Gio.BytesIcon
connect(sigName: "notify::bytes", callback: (($obj: BytesIcon, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::bytes", callback: (($obj: BytesIcon, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::bytes", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GBytesIcon specifies an image held in memory in a common format (usually
* png) to be used as icon.
* @class
*/
export class BytesIcon extends GObject.Object {
// Own properties of Gio-2.0.Gio.BytesIcon
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.BytesIcon
constructor(config?: BytesIcon.ConstructorProperties)
/**
* Creates a new icon for a bytes.
*
* This cannot fail, but loading and interpreting the bytes may fail later on
* (for example, if g_loadable_icon_load() is called) if the image is invalid.
* @constructor
* @param bytes a #GBytes.
* @returns a #GIcon for the given @bytes.
*/
constructor(bytes: GLib.Bytes)
/**
* Creates a new icon for a bytes.
*
* This cannot fail, but loading and interpreting the bytes may fail later on
* (for example, if g_loadable_icon_load() is called) if the image is invalid.
* @constructor
* @param bytes a #GBytes.
* @returns a #GIcon for the given @bytes.
*/
static new(bytes: GLib.Bytes): BytesIcon
_init(config?: BytesIcon.ConstructorProperties): void
}
export module Cancellable {
// Signal callback interfaces
/**
* Signal callback interface for `cancelled`
*/
export interface CancelledSignalCallback {
($obj: Cancellable): void
}
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface Cancellable {
// Own fields of Gio-2.0.Gio.Cancellable
parent_instance: GObject.Object
// Owm methods of Gio-2.0.Gio.Cancellable
/**
* Will set `cancellable` to cancelled, and will emit the
* #GCancellable::cancelled signal. (However, see the warning about
* race conditions in the documentation for that signal if you are
* planning to connect to it.)
*
* This function is thread-safe. In other words, you can safely call
* it from a thread other than the one running the operation that was
* passed the `cancellable`.
*
* If `cancellable` is %NULL, this function returns immediately for convenience.
*
* The convention within GIO is that cancelling an asynchronous
* operation causes it to complete asynchronously. That is, if you
* cancel the operation from the same thread in which it is running,
* then the operation's #GAsyncReadyCallback will not be invoked until
* the application returns to the main loop.
*/
cancel(): void
/**
* Convenience function to connect to the #GCancellable::cancelled
* signal. Also handles the race condition that may happen
* if the cancellable is cancelled right before connecting.
*
* `callback` is called at most once, either directly at the
* time of the connect if `cancellable` is already cancelled,
* or when `cancellable` is cancelled in some thread.
*
* `data_destroy_func` will be called when the handler is
* disconnected, or immediately if the cancellable is already
* cancelled.
*
* See #GCancellable::cancelled for details on how to use this.
*
* Since GLib 2.40, the lock protecting `cancellable` is not held when
* `callback` is invoked. This lifts a restriction in place for
* earlier GLib versions which now makes it easier to write cleanup
* code that unconditionally invokes e.g. g_cancellable_cancel().
* @param callback The #GCallback to connect.
* @returns The id of the signal handler or 0 if @cancellable has already been cancelled.
*/
connect(callback: GObject.Callback): number
/**
* Disconnects a handler from a cancellable instance similar to
* g_signal_handler_disconnect(). Additionally, in the event that a
* signal handler is currently running, this call will block until the
* handler has finished. Calling this function from a
* #GCancellable::cancelled signal handler will therefore result in a
* deadlock.
*
* This avoids a race condition where a thread cancels at the
* same time as the cancellable operation is finished and the
* signal handler is removed. See #GCancellable::cancelled for
* details on how to use this.
*
* If `cancellable` is %NULL or `handler_id` is `0` this function does
* nothing.
* @param handler_id Handler id of the handler to be disconnected, or `0`.
*/
disconnect(handler_id: number): void
/**
* Gets the file descriptor for a cancellable job. This can be used to
* implement cancellable operations on Unix systems. The returned fd will
* turn readable when `cancellable` is cancelled.
*
* You are not supposed to read from the fd yourself, just check for
* readable status. Reading to unset the readable status is done
* with g_cancellable_reset().
*
* After a successful return from this function, you should use
* g_cancellable_release_fd() to free up resources allocated for
* the returned file descriptor.
*
* See also g_cancellable_make_pollfd().
* @returns A valid file descriptor. `-1` if the file descriptor is not supported, or on errors.
*/
get_fd(): number
/**
* Checks if a cancellable job has been cancelled.
* @returns %TRUE if @cancellable is cancelled, FALSE if called with %NULL or if item is not cancelled.
*/
is_cancelled(): boolean
/**
* Creates a #GPollFD corresponding to `cancellable;` this can be passed
* to g_poll() and used to poll for cancellation. This is useful both
* for unix systems without a native poll and for portability to
* windows.
*
* When this function returns %TRUE, you should use
* g_cancellable_release_fd() to free up resources allocated for the
* `pollfd`. After a %FALSE return, do not call g_cancellable_release_fd().
*
* If this function returns %FALSE, either no `cancellable` was given or
* resource limits prevent this function from allocating the necessary
* structures for polling. (On Linux, you will likely have reached
* the maximum number of file descriptors.) The suggested way to handle
* these cases is to ignore the `cancellable`.
*
* You are not supposed to read from the fd yourself, just check for
* readable status. Reading to unset the readable status is done
* with g_cancellable_reset().
* @param pollfd a pointer to a #GPollFD
* @returns %TRUE if @pollfd was successfully initialized, %FALSE on failure to prepare the cancellable.
*/
make_pollfd(pollfd: GLib.PollFD): boolean
/**
* Pops `cancellable` off the cancellable stack (verifying that `cancellable`
* is on the top of the stack).
*/
pop_current(): void
/**
* Pushes `cancellable` onto the cancellable stack. The current
* cancellable can then be received using g_cancellable_get_current().
*
* This is useful when implementing cancellable operations in
* code that does not allow you to pass down the cancellable object.
*
* This is typically called automatically by e.g. #GFile operations,
* so you rarely have to call this yourself.
*/
push_current(): void
/**
* Releases a resources previously allocated by g_cancellable_get_fd()
* or g_cancellable_make_pollfd().
*
* For compatibility reasons with older releases, calling this function
* is not strictly required, the resources will be automatically freed
* when the `cancellable` is finalized. However, the `cancellable` will
* block scarce file descriptors until it is finalized if this function
* is not called. This can cause the application to run out of file
* descriptors when many #GCancellables are used at the same time.
*/
release_fd(): void
/**
* Resets `cancellable` to its uncancelled state.
*
* If cancellable is currently in use by any cancellable operation
* then the behavior of this function is undefined.
*
* Note that it is generally not a good idea to reuse an existing
* cancellable for more operations after it has been cancelled once,
* as this function might tempt you to do. The recommended practice
* is to drop the reference to a cancellable after cancelling it,
* and let it die with the outstanding async operations. You should
* create a fresh cancellable for further async operations.
*/
reset(): void
/**
* If the `cancellable` is cancelled, sets the error to notify
* that the operation was cancelled.
* @returns %TRUE if @cancellable was cancelled, %FALSE if it was not
*/
set_error_if_cancelled(): boolean
/**
* Creates a source that triggers if `cancellable` is cancelled and
* calls its callback of type #GCancellableSourceFunc. This is
* primarily useful for attaching to another (non-cancellable) source
* with g_source_add_child_source() to add cancellability to it.
*
* For convenience, you can call this with a %NULL #GCancellable,
* in which case the source will never trigger.
*
* The new #GSource will hold a reference to the #GCancellable.
* @returns the new #GSource.
*/
source_new(): GLib.Source
// Own virtual methods of Gio-2.0.Gio.Cancellable
vfunc_cancelled(): void
// Own signals of Gio-2.0.Gio.Cancellable
connect(sigName: "cancelled", callback: Cancellable.CancelledSignalCallback): number
connect_after(sigName: "cancelled", callback: Cancellable.CancelledSignalCallback): number
emit(sigName: "cancelled", ...args: any[]): void
// Class property signals of Gio-2.0.Gio.Cancellable
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* GCancellable is a thread-safe operation cancellation stack used
* throughout GIO to allow for cancellation of synchronous and
* asynchronous operations.
* @class
*/
export class Cancellable extends GObject.Object {
// Own properties of Gio-2.0.Gio.Cancellable
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.Cancellable
constructor(config?: Cancellable.ConstructorProperties)
/**
* Creates a new #GCancellable object.
*
* Applications that want to start one or more operations
* that should be cancellable should create a #GCancellable
* and pass it to the operations.
*
* One #GCancellable can be used in multiple consecutive
* operations or in multiple concurrent operations.
* @constructor
* @returns a #GCancellable.
*/
constructor()
/**
* Creates a new #GCancellable object.
*
* Applications that want to start one or more operations
* that should be cancellable should create a #GCancellable
* and pass it to the operations.
*
* One #GCancellable can be used in multiple consecutive
* operations or in multiple concurrent operations.
* @constructor
* @returns a #GCancellable.
*/
static new(): Cancellable
_init(config?: Cancellable.ConstructorProperties): void
/**
* Gets the top cancellable from the stack.
* @returns a #GCancellable from the top of the stack, or %NULL if the stack is empty.
*/
static get_current(): Cancellable | null
}
export module CharsetConverter {
// Constructor properties interface
export interface ConstructorProperties extends Converter.ConstructorProperties, Initable.ConstructorProperties, GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.CharsetConverter
from_charset?: string | null
to_charset?: string | null
use_fallback?: boolean | null
}
}
export interface CharsetConverter extends Converter, Initable {
// Own properties of Gio-2.0.Gio.CharsetConverter
readonly from_charset: string | null
readonly to_charset: string | null
use_fallback: boolean
// Owm methods of Gio-2.0.Gio.CharsetConverter
/**
* Gets the number of fallbacks that `converter` has applied so far.
* @returns the number of fallbacks that @converter has applied
*/
get_num_fallbacks(): number
/**
* Gets the #GCharsetConverter:use-fallback property.
* @returns %TRUE if fallbacks are used by @converter
*/
get_use_fallback(): boolean
/**
* Sets the #GCharsetConverter:use-fallback property.
* @param use_fallback %TRUE to use fallbacks
*/
set_use_fallback(use_fallback: boolean): void
// Class property signals of Gio-2.0.Gio.CharsetConverter
connect(sigName: "notify::from-charset", callback: (($obj: CharsetConverter, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::from-charset", callback: (($obj: CharsetConverter, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::from-charset", ...args: any[]): void
connect(sigName: "notify::to-charset", callback: (($obj: CharsetConverter, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::to-charset", callback: (($obj: CharsetConverter, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::to-charset", ...args: any[]): void
connect(sigName: "notify::use-fallback", callback: (($obj: CharsetConverter, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::use-fallback", callback: (($obj: CharsetConverter, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::use-fallback", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GCharsetConverter is an implementation of #GConverter based on
* GIConv.
* @class
*/
export class CharsetConverter extends GObject.Object {
// Own properties of Gio-2.0.Gio.CharsetConverter
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.CharsetConverter
constructor(config?: CharsetConverter.ConstructorProperties)
/**
* Creates a new #GCharsetConverter.
* @constructor
* @param to_charset destination charset
* @param from_charset source charset
* @returns a new #GCharsetConverter or %NULL on error.
*/
constructor(to_charset: string | null, from_charset: string | null)
/**
* Creates a new #GCharsetConverter.
* @constructor
* @param to_charset destination charset
* @param from_charset source charset
* @returns a new #GCharsetConverter or %NULL on error.
*/
static new(to_charset: string | null, from_charset: string | null): CharsetConverter
_init(config?: CharsetConverter.ConstructorProperties): void
}
export module ConverterInputStream {
// Constructor properties interface
export interface ConstructorProperties extends PollableInputStream.ConstructorProperties, FilterInputStream.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.ConverterInputStream
converter?: Converter | null
}
}
export interface ConverterInputStream extends PollableInputStream {
// Own properties of Gio-2.0.Gio.ConverterInputStream
readonly converter: Converter
// Own fields of Gio-2.0.Gio.ConverterInputStream
parent_instance: FilterInputStream & InputStream & GObject.Object & GObject.Object
// Owm methods of Gio-2.0.Gio.ConverterInputStream
/**
* Gets the #GConverter that is used by `converter_stream`.
* @returns the converter of the converter input stream
*/
get_converter(): Converter
// Class property signals of Gio-2.0.Gio.ConverterInputStream
connect(sigName: "notify::converter", callback: (($obj: ConverterInputStream, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::converter", callback: (($obj: ConverterInputStream, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::converter", ...args: any[]): void
connect(sigName: "notify::close-base-stream", callback: (($obj: ConverterInputStream, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::close-base-stream", callback: (($obj: ConverterInputStream, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::close-base-stream", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* Converter input stream implements #GInputStream and allows
* conversion of data of various types during reading.
*
* As of GLib 2.34, #GConverterInputStream implements
* #GPollableInputStream.
* @class
*/
export class ConverterInputStream extends FilterInputStream {
// Own properties of Gio-2.0.Gio.ConverterInputStream
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.ConverterInputStream
constructor(config?: ConverterInputStream.ConstructorProperties)
/**
* Creates a new converter input stream for the `base_stream`.
* @constructor
* @param base_stream a #GInputStream
* @param converter a #GConverter
* @returns a new #GInputStream.
*/
constructor(base_stream: InputStream, converter: Converter)
/**
* Creates a new converter input stream for the `base_stream`.
* @constructor
* @param base_stream a #GInputStream
* @param converter a #GConverter
* @returns a new #GInputStream.
*/
static new(base_stream: InputStream, converter: Converter): ConverterInputStream
_init(config?: ConverterInputStream.ConstructorProperties): void
}
export module ConverterOutputStream {
// Constructor properties interface
export interface ConstructorProperties extends PollableOutputStream.ConstructorProperties, FilterOutputStream.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.ConverterOutputStream
converter?: Converter | null
}
}
export interface ConverterOutputStream extends PollableOutputStream {
// Own properties of Gio-2.0.Gio.ConverterOutputStream
readonly converter: Converter
// Own fields of Gio-2.0.Gio.ConverterOutputStream
parent_instance: FilterOutputStream & OutputStream & GObject.Object & GObject.Object
// Owm methods of Gio-2.0.Gio.ConverterOutputStream
/**
* Gets the #GConverter that is used by `converter_stream`.
* @returns the converter of the converter output stream
*/
get_converter(): Converter
// Class property signals of Gio-2.0.Gio.ConverterOutputStream
connect(sigName: "notify::converter", callback: (($obj: ConverterOutputStream, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::converter", callback: (($obj: ConverterOutputStream, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::converter", ...args: any[]): void
connect(sigName: "notify::close-base-stream", callback: (($obj: ConverterOutputStream, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::close-base-stream", callback: (($obj: ConverterOutputStream, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::close-base-stream", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* Converter output stream implements #GOutputStream and allows
* conversion of data of various types during reading.
*
* As of GLib 2.34, #GConverterOutputStream implements
* #GPollableOutputStream.
* @class
*/
export class ConverterOutputStream extends FilterOutputStream {
// Own properties of Gio-2.0.Gio.ConverterOutputStream
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.ConverterOutputStream
constructor(config?: ConverterOutputStream.ConstructorProperties)
/**
* Creates a new converter output stream for the `base_stream`.
* @constructor
* @param base_stream a #GOutputStream
* @param converter a #GConverter
* @returns a new #GOutputStream.
*/
constructor(base_stream: OutputStream, converter: Converter)
/**
* Creates a new converter output stream for the `base_stream`.
* @constructor
* @param base_stream a #GOutputStream
* @param converter a #GConverter
* @returns a new #GOutputStream.
*/
static new(base_stream: OutputStream, converter: Converter): ConverterOutputStream
_init(config?: ConverterOutputStream.ConstructorProperties): void
}
export module Credentials {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface Credentials {
// Owm methods of Gio-2.0.Gio.Credentials
/**
* Tries to get the UNIX process identifier from `credentials`. This
* method is only available on UNIX platforms.
*
* This operation can fail if #GCredentials is not supported on the
* OS or if the native credentials type does not contain information
* about the UNIX process ID.
* @returns The UNIX process ID, or `-1` if @error is set.
*/
get_unix_pid(): number
/**
* Tries to get the UNIX user identifier from `credentials`. This
* method is only available on UNIX platforms.
*
* This operation can fail if #GCredentials is not supported on the
* OS or if the native credentials type does not contain information
* about the UNIX user.
* @returns The UNIX user identifier or `-1` if @error is set.
*/
get_unix_user(): number
/**
* Checks if `credentials` and `other_credentials` is the same user.
*
* This operation can fail if #GCredentials is not supported on the
* the OS.
* @param other_credentials A #GCredentials.
* @returns %TRUE if @credentials and @other_credentials has the same user, %FALSE otherwise or if @error is set.
*/
is_same_user(other_credentials: Credentials): boolean
/**
* Copies the native credentials of type `native_type` from `native`
* into `credentials`.
*
* It is a programming error (which will cause a warning to be
* logged) to use this method if there is no #GCredentials support for
* the OS or if `native_type` isn't supported by the OS.
* @param native_type The type of native credentials to set.
* @param native A pointer to native credentials.
*/
set_native(native_type: CredentialsType, native: any): void
/**
* Tries to set the UNIX user identifier on `credentials`. This method
* is only available on UNIX platforms.
*
* This operation can fail if #GCredentials is not supported on the
* OS or if the native credentials type does not contain information
* about the UNIX user. It can also fail if the OS does not allow the
* use of "spoofed" credentials.
* @param uid The UNIX user identifier to set.
* @returns %TRUE if @uid was set, %FALSE if error is set.
*/
set_unix_user(uid: number): boolean
/**
* Creates a human-readable textual representation of `credentials`
* that can be used in logging and debug messages. The format of the
* returned string may change in future GLib release.
* @returns A string that should be freed with g_free().
*/
to_string(): string | null
// Class property signals of Gio-2.0.Gio.Credentials
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* The #GCredentials type is a reference-counted wrapper for native
* credentials. This information is typically used for identifying,
* authenticating and authorizing other processes.
*
* Some operating systems supports looking up the credentials of the
* remote peer of a communication endpoint - see e.g.
* g_socket_get_credentials().
*
* Some operating systems supports securely sending and receiving
* credentials over a Unix Domain Socket, see
* #GUnixCredentialsMessage, g_unix_connection_send_credentials() and
* g_unix_connection_receive_credentials() for details.
*
* On Linux, the native credential type is a `struct ucred` - see the
* unix(7) man page for details. This corresponds to
* %G_CREDENTIALS_TYPE_LINUX_UCRED.
*
* On Apple operating systems (including iOS, tvOS, and macOS),
* the native credential type is a `struct xucred`.
* This corresponds to %G_CREDENTIALS_TYPE_APPLE_XUCRED.
*
* On FreeBSD, Debian GNU/kFreeBSD, and GNU/Hurd, the native
* credential type is a `struct cmsgcred`. This corresponds
* to %G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED.
*
* On NetBSD, the native credential type is a `struct unpcbid`.
* This corresponds to %G_CREDENTIALS_TYPE_NETBSD_UNPCBID.
*
* On OpenBSD, the native credential type is a `struct sockpeercred`.
* This corresponds to %G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED.
*
* On Solaris (including OpenSolaris and its derivatives), the native
* credential type is a `ucred_t`. This corresponds to
* %G_CREDENTIALS_TYPE_SOLARIS_UCRED.
*
* Since GLib 2.72, on Windows, the native credentials may contain the PID of a
* process. This corresponds to %G_CREDENTIALS_TYPE_WIN32_PID.
* @class
*/
export class Credentials extends GObject.Object {
// Own properties of Gio-2.0.Gio.Credentials
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.Credentials
constructor(config?: Credentials.ConstructorProperties)
/**
* Creates a new #GCredentials object with credentials matching the
* the current process.
* @constructor
* @returns A #GCredentials. Free with g_object_unref().
*/
constructor()
/**
* Creates a new #GCredentials object with credentials matching the
* the current process.
* @constructor
* @returns A #GCredentials. Free with g_object_unref().
*/
static new(): Credentials
_init(config?: Credentials.ConstructorProperties): void
}
export module DBusActionGroup {
// Constructor properties interface
export interface ConstructorProperties extends ActionGroup.ConstructorProperties, RemoteActionGroup.ConstructorProperties, GObject.Object.ConstructorProperties {
}
}
export interface DBusActionGroup extends ActionGroup, RemoteActionGroup {
// Class property signals of Gio-2.0.Gio.DBusActionGroup
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GDBusActionGroup is an implementation of the #GActionGroup
* interface that can be used as a proxy for an action group
* that is exported over D-Bus with g_dbus_connection_export_action_group().
* @class
*/
export class DBusActionGroup extends GObject.Object {
// Own properties of Gio-2.0.Gio.DBusActionGroup
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DBusActionGroup
constructor(config?: DBusActionGroup.ConstructorProperties)
_init(config?: DBusActionGroup.ConstructorProperties): void
/**
* Obtains a #GDBusActionGroup for the action group which is exported at
* the given `bus_name` and `object_path`.
*
* The thread default main context is taken at the time of this call.
* All signals on the menu model (and any linked models) are reported
* with respect to this context. All calls on the returned menu model
* (and linked models) must also originate from this same context, with
* the thread default main context unchanged.
*
* This call is non-blocking. The returned action group may or may not
* already be filled in. The correct thing to do is connect the signals
* for the action group to monitor for changes and then to call
* g_action_group_list_actions() to get the initial list.
* @param connection A #GDBusConnection
* @param bus_name the bus name which exports the action group or %NULL if `connection` is not a message bus connection
* @param object_path the object path at which the action group is exported
* @returns a #GDBusActionGroup
*/
static get(connection: DBusConnection, bus_name: string | null, object_path: string | null): DBusActionGroup
}
export module DBusAuthObserver {
// Signal callback interfaces
/**
* Signal callback interface for `allow-mechanism`
*/
export interface AllowMechanismSignalCallback {
($obj: DBusAuthObserver, mechanism: string | null): boolean
}
/**
* Signal callback interface for `authorize-authenticated-peer`
*/
export interface AuthorizeAuthenticatedPeerSignalCallback {
($obj: DBusAuthObserver, stream: IOStream, credentials: Credentials | null): boolean
}
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface DBusAuthObserver {
// Owm methods of Gio-2.0.Gio.DBusAuthObserver
/**
* Emits the #GDBusAuthObserver::allow-mechanism signal on `observer`.
* @param mechanism The name of the mechanism, e.g. `DBUS_COOKIE_SHA1`.
* @returns %TRUE if @mechanism can be used to authenticate the other peer, %FALSE if not.
*/
allow_mechanism(mechanism: string | null): boolean
/**
* Emits the #GDBusAuthObserver::authorize-authenticated-peer signal on `observer`.
* @param stream A #GIOStream for the #GDBusConnection.
* @param credentials Credentials received from the peer or %NULL.
* @returns %TRUE if the peer is authorized, %FALSE if not.
*/
authorize_authenticated_peer(stream: IOStream, credentials: Credentials | null): boolean
// Own signals of Gio-2.0.Gio.DBusAuthObserver
connect(sigName: "allow-mechanism", callback: DBusAuthObserver.AllowMechanismSignalCallback): number
connect_after(sigName: "allow-mechanism", callback: DBusAuthObserver.AllowMechanismSignalCallback): number
emit(sigName: "allow-mechanism", mechanism: string | null, ...args: any[]): void
connect(sigName: "authorize-authenticated-peer", callback: DBusAuthObserver.AuthorizeAuthenticatedPeerSignalCallback): number
connect_after(sigName: "authorize-authenticated-peer", callback: DBusAuthObserver.AuthorizeAuthenticatedPeerSignalCallback): number
emit(sigName: "authorize-authenticated-peer", stream: IOStream, credentials: Credentials | null, ...args: any[]): void
// Class property signals of Gio-2.0.Gio.DBusAuthObserver
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* The #GDBusAuthObserver type provides a mechanism for participating
* in how a #GDBusServer (or a #GDBusConnection) authenticates remote
* peers. Simply instantiate a #GDBusAuthObserver and connect to the
* signals you are interested in. Note that new signals may be added
* in the future
*
* ## Controlling Authentication Mechanisms
*
* By default, a #GDBusServer or server-side #GDBusConnection will allow
* any authentication mechanism to be used. If you only
* want to allow D-Bus connections with the `EXTERNAL` mechanism,
* which makes use of credentials passing and is the recommended
* mechanism for modern Unix platforms such as Linux and the BSD family,
* you would use a signal handler like this:
*
*
* ```c
* static gboolean
* on_allow_mechanism (GDBusAuthObserver *observer,
* const gchar *mechanism,
* gpointer user_data)
* {
* if (g_strcmp0 (mechanism, "EXTERNAL") == 0)
* {
* return TRUE;
* }
*
* return FALSE;
* }
* ```
*
*
* ## Controlling Authorization # {#auth-observer}
*
* By default, a #GDBusServer or server-side #GDBusConnection will accept
* connections from any successfully authenticated user (but not from
* anonymous connections using the `ANONYMOUS` mechanism). If you only
* want to allow D-Bus connections from processes owned by the same uid
* as the server, since GLib 2.68, you should use the
* %G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER flag. It’s equivalent
* to the following signal handler:
*
*
* ```c
* static gboolean
* on_authorize_authenticated_peer (GDBusAuthObserver *observer,
* GIOStream *stream,
* GCredentials *credentials,
* gpointer user_data)
* {
* gboolean authorized;
*
* authorized = FALSE;
* if (credentials != NULL)
* {
* GCredentials *own_credentials;
* own_credentials = g_credentials_new ();
* if (g_credentials_is_same_user (credentials, own_credentials, NULL))
* authorized = TRUE;
* g_object_unref (own_credentials);
* }
*
* return authorized;
* }
* ```
*
* @class
*/
export class DBusAuthObserver extends GObject.Object {
// Own properties of Gio-2.0.Gio.DBusAuthObserver
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DBusAuthObserver
constructor(config?: DBusAuthObserver.ConstructorProperties)
/**
* Creates a new #GDBusAuthObserver object.
* @constructor
* @returns A #GDBusAuthObserver. Free with g_object_unref().
*/
constructor()
/**
* Creates a new #GDBusAuthObserver object.
* @constructor
* @returns A #GDBusAuthObserver. Free with g_object_unref().
*/
static new(): DBusAuthObserver
_init(config?: DBusAuthObserver.ConstructorProperties): void
}
export module DBusConnection {
// Signal callback interfaces
/**
* Signal callback interface for `closed`
*/
export interface ClosedSignalCallback {
($obj: DBusConnection, remote_peer_vanished: boolean, error: GLib.Error | null): void
}
// Constructor properties interface
export interface ConstructorProperties extends AsyncInitable.ConstructorProperties, Initable.ConstructorProperties, GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.DBusConnection
/**
* A D-Bus address specifying potential endpoints that can be used
* when establishing the connection.
*/
address?: string | null
/**
* A #GDBusAuthObserver object to assist in the authentication process or %NULL.
*/
authentication_observer?: DBusAuthObserver | null
/**
* A boolean specifying whether the process will be terminated (by
* calling `raise(SIGTERM)`) if the connection is closed by the
* remote peer.
*
* Note that #GDBusConnection objects returned by g_bus_get_finish()
* and g_bus_get_sync() will (usually) have this property set to %TRUE.
*/
exit_on_close?: boolean | null
/**
* Flags from the #GDBusConnectionFlags enumeration.
*/
flags?: DBusConnectionFlags | null
/**
* The GUID of the peer performing the role of server when
* authenticating.
*
* If you are constructing a #GDBusConnection and pass
* %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER in the
* #GDBusConnection:flags property then you **must** also set this
* property to a valid guid.
*
* If you are constructing a #GDBusConnection and pass
* %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT in the
* #GDBusConnection:flags property you will be able to read the GUID
* of the other peer here after the connection has been successfully
* initialized.
*
* Note that the
* [D-Bus specification](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses)
* uses the term ‘UUID’ to refer to this, whereas GLib consistently uses the
* term ‘GUID’ for historical reasons.
*
* Despite its name, the format of #GDBusConnection:guid does not follow
* [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122) or the Microsoft
* GUID format.
*/
guid?: string | null
/**
* The underlying #GIOStream used for I/O.
*
* If this is passed on construction and is a #GSocketConnection,
* then the corresponding #GSocket will be put into non-blocking mode.
*
* While the #GDBusConnection is active, it will interact with this
* stream from a worker thread, so it is not safe to interact with
* the stream directly.
*/
stream?: IOStream | null
}
}
export interface DBusConnection extends AsyncInitable, Initable {
// Own properties of Gio-2.0.Gio.DBusConnection
/**
* A D-Bus address specifying potential endpoints that can be used
* when establishing the connection.
*/
readonly address: string | null
/**
* A #GDBusAuthObserver object to assist in the authentication process or %NULL.
*/
readonly authentication_observer: DBusAuthObserver
/**
* Flags from the #GDBusCapabilityFlags enumeration
* representing connection features negotiated with the other peer.
*/
readonly capabilities: DBusCapabilityFlags
/**
* A boolean specifying whether the connection has been closed.
*/
readonly closed: boolean
/**
* A boolean specifying whether the process will be terminated (by
* calling `raise(SIGTERM)`) if the connection is closed by the
* remote peer.
*
* Note that #GDBusConnection objects returned by g_bus_get_finish()
* and g_bus_get_sync() will (usually) have this property set to %TRUE.
*/
exit_on_close: boolean
/**
* Flags from the #GDBusConnectionFlags enumeration.
*/
readonly flags: DBusConnectionFlags
/**
* The GUID of the peer performing the role of server when
* authenticating.
*
* If you are constructing a #GDBusConnection and pass
* %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER in the
* #GDBusConnection:flags property then you **must** also set this
* property to a valid guid.
*
* If you are constructing a #GDBusConnection and pass
* %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT in the
* #GDBusConnection:flags property you will be able to read the GUID
* of the other peer here after the connection has been successfully
* initialized.
*
* Note that the
* [D-Bus specification](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses)
* uses the term ‘UUID’ to refer to this, whereas GLib consistently uses the
* term ‘GUID’ for historical reasons.
*
* Despite its name, the format of #GDBusConnection:guid does not follow
* [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122) or the Microsoft
* GUID format.
*/
readonly guid: string | null
/**
* The underlying #GIOStream used for I/O.
*
* If this is passed on construction and is a #GSocketConnection,
* then the corresponding #GSocket will be put into non-blocking mode.
*
* While the #GDBusConnection is active, it will interact with this
* stream from a worker thread, so it is not safe to interact with
* the stream directly.
*/
readonly stream: IOStream
/**
* The unique name as assigned by the message bus or %NULL if the
* connection is not open or not a message bus connection.
*/
readonly unique_name: string | null
// Owm methods of Gio-2.0.Gio.DBusConnection
/**
* Adds a message filter. Filters are handlers that are run on all
* incoming and outgoing messages, prior to standard dispatch. Filters
* are run in the order that they were added. The same handler can be
* added as a filter more than once, in which case it will be run more
* than once. Filters added during a filter callback won't be run on
* the message being processed. Filter functions are allowed to modify
* and even drop messages.
*
* Note that filters are run in a dedicated message handling thread so
* they can't block and, generally, can't do anything but signal a
* worker thread. Also note that filters are rarely needed - use API
* such as g_dbus_connection_send_message_with_reply(),
* g_dbus_connection_signal_subscribe() or g_dbus_connection_call() instead.
*
* If a filter consumes an incoming message the message is not
* dispatched anywhere else - not even the standard dispatch machinery
* (that API such as g_dbus_connection_signal_subscribe() and
* g_dbus_connection_send_message_with_reply() relies on) will see the
* message. Similarly, if a filter consumes an outgoing message, the
* message will not be sent to the other peer.
*
* If `user_data_free_func` is non-%NULL, it will be called (in the
* thread-default main context of the thread you are calling this
* method from) at some point after `user_data` is no longer
* needed. (It is not guaranteed to be called synchronously when the
* filter is removed, and may be called after `connection` has been
* destroyed.)
* @param filter_function a filter function
* @returns a filter identifier that can be used with g_dbus_connection_remove_filter()
*/
add_filter(filter_function: DBusMessageFilterFunction): number
/**
* Asynchronously invokes the `method_name` method on the
* `interface_name` D-Bus interface on the remote object at
* `object_path` owned by `bus_name`.
*
* If `connection` is closed then the operation will fail with
* %G_IO_ERROR_CLOSED. If `cancellable` is canceled, the operation will
* fail with %G_IO_ERROR_CANCELLED. If `parameters` contains a value
* not compatible with the D-Bus protocol, the operation fails with
* %G_IO_ERROR_INVALID_ARGUMENT.
*
* If `reply_type` is non-%NULL then the reply will be checked for having this type and an
* error will be raised if it does not match. Said another way, if you give a `reply_type`
* then any non-%NULL return value will be of this type. Unless it’s
* %G_VARIANT_TYPE_UNIT, the `reply_type` will be a tuple containing one or more
* values.
*
* If the `parameters` #GVariant is floating, it is consumed. This allows
* convenient 'inline' use of g_variant_new(), e.g.:
*
* ```c
* g_dbus_connection_call (connection,
* "org.freedesktop.StringThings",
* "/org/freedesktop/StringThings",
* "org.freedesktop.StringThings",
* "TwoStrings",
* g_variant_new ("(ss)",
* "Thing One",
* "Thing Two"),
* NULL,
* G_DBUS_CALL_FLAGS_NONE,
* -1,
* NULL,
* (GAsyncReadyCallback) two_strings_done,
* NULL);
* ```
*
*
* This is an asynchronous method. When the operation is finished,
* `callback` will be invoked in the
* [thread-default main context][g-main-context-push-thread-default]
* of the thread you are calling this method from. You can then call
* g_dbus_connection_call_finish() to get the result of the operation.
* See g_dbus_connection_call_sync() for the synchronous version of this
* function.
*
* If `callback` is %NULL then the D-Bus method call message will be sent with
* the %G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED flag set.
* @param bus_name a unique or well-known bus name or %NULL if `connection` is not a message bus connection
* @param object_path path of remote object
* @param interface_name D-Bus interface to invoke method on
* @param method_name the name of the method to invoke
* @param parameters a #GVariant tuple with parameters for the method or %NULL if not passing parameters
* @param reply_type the expected type of the reply (which will be a tuple), or %NULL
* @param flags flags from the #GDBusCallFlags enumeration
* @param timeout_msec the timeout in milliseconds, -1 to use the default timeout or %G_MAXINT for no timeout
* @param cancellable a #GCancellable or %NULL
* @param callback a #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't care about the result of the method invocation
*/
call(bus_name: string | null, object_path: string | null, interface_name: string | null, method_name: string | null, parameters: GLib.Variant | null, reply_type: GLib.VariantType | null, flags: DBusCallFlags, timeout_msec: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an operation started with g_dbus_connection_call().
* @param res a #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_call()
* @returns %NULL if @error is set. Otherwise a non-floating #GVariant tuple with return values. Free with g_variant_unref().
*/
call_finish(res: AsyncResult): GLib.Variant
/**
* Synchronously invokes the `method_name` method on the
* `interface_name` D-Bus interface on the remote object at
* `object_path` owned by `bus_name`.
*
* If `connection` is closed then the operation will fail with
* %G_IO_ERROR_CLOSED. If `cancellable` is canceled, the
* operation will fail with %G_IO_ERROR_CANCELLED. If `parameters`
* contains a value not compatible with the D-Bus protocol, the operation
* fails with %G_IO_ERROR_INVALID_ARGUMENT.
*
* If `reply_type` is non-%NULL then the reply will be checked for having
* this type and an error will be raised if it does not match. Said
* another way, if you give a `reply_type` then any non-%NULL return
* value will be of this type.
*
* If the `parameters` #GVariant is floating, it is consumed.
* This allows convenient 'inline' use of g_variant_new(), e.g.:
*
* ```c
* g_dbus_connection_call_sync (connection,
* "org.freedesktop.StringThings",
* "/org/freedesktop/StringThings",
* "org.freedesktop.StringThings",
* "TwoStrings",
* g_variant_new ("(ss)",
* "Thing One",
* "Thing Two"),
* NULL,
* G_DBUS_CALL_FLAGS_NONE,
* -1,
* NULL,
* &error);
* ```
*
*
* The calling thread is blocked until a reply is received. See
* g_dbus_connection_call() for the asynchronous version of
* this method.
* @param bus_name a unique or well-known bus name or %NULL if `connection` is not a message bus connection
* @param object_path path of remote object
* @param interface_name D-Bus interface to invoke method on
* @param method_name the name of the method to invoke
* @param parameters a #GVariant tuple with parameters for the method or %NULL if not passing parameters
* @param reply_type the expected type of the reply, or %NULL
* @param flags flags from the #GDBusCallFlags enumeration
* @param timeout_msec the timeout in milliseconds, -1 to use the default timeout or %G_MAXINT for no timeout
* @param cancellable a #GCancellable or %NULL
* @returns %NULL if @error is set. Otherwise a non-floating #GVariant tuple with return values. Free with g_variant_unref().
*/
call_sync(bus_name: string | null, object_path: string | null, interface_name: string | null, method_name: string | null, parameters: GLib.Variant | null, reply_type: GLib.VariantType | null, flags: DBusCallFlags, timeout_msec: number, cancellable: Cancellable | null): GLib.Variant
/**
* Like g_dbus_connection_call() but also takes a #GUnixFDList object.
*
* The file descriptors normally correspond to %G_VARIANT_TYPE_HANDLE
* values in the body of the message. For example, if a message contains
* two file descriptors, `fd_list` would have length 2, and
* `g_variant_new_handle (0)` and `g_variant_new_handle (1)` would appear
* somewhere in the body of the message (not necessarily in that order!)
* to represent the file descriptors at indexes 0 and 1 respectively.
*
* When designing D-Bus APIs that are intended to be interoperable,
* please note that non-GDBus implementations of D-Bus can usually only
* access file descriptors if they are referenced in this way by a
* value of type %G_VARIANT_TYPE_HANDLE in the body of the message.
*
* This method is only available on UNIX.
* @param bus_name a unique or well-known bus name or %NULL if `connection` is not a message bus connection
* @param object_path path of remote object
* @param interface_name D-Bus interface to invoke method on
* @param method_name the name of the method to invoke
* @param parameters a #GVariant tuple with parameters for the method or %NULL if not passing parameters
* @param reply_type the expected type of the reply, or %NULL
* @param flags flags from the #GDBusCallFlags enumeration
* @param timeout_msec the timeout in milliseconds, -1 to use the default timeout or %G_MAXINT for no timeout
* @param fd_list a #GUnixFDList or %NULL
* @param cancellable a #GCancellable or %NULL
* @param callback a #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't * care about the result of the method invocation
*/
call_with_unix_fd_list(bus_name: string | null, object_path: string | null, interface_name: string | null, method_name: string | null, parameters: GLib.Variant | null, reply_type: GLib.VariantType | null, flags: DBusCallFlags, timeout_msec: number, fd_list: UnixFDList | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an operation started with g_dbus_connection_call_with_unix_fd_list().
*
* The file descriptors normally correspond to %G_VARIANT_TYPE_HANDLE
* values in the body of the message. For example,
* if g_variant_get_handle() returns 5, that is intended to be a reference
* to the file descriptor that can be accessed by
* `g_unix_fd_list_get (*out_fd_list, 5, ...)`.
*
* When designing D-Bus APIs that are intended to be interoperable,
* please note that non-GDBus implementations of D-Bus can usually only
* access file descriptors if they are referenced in this way by a
* value of type %G_VARIANT_TYPE_HANDLE in the body of the message.
* @param res a #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_call_with_unix_fd_list()
* @returns %NULL if @error is set. Otherwise a non-floating #GVariant tuple with return values. Free with g_variant_unref().
*/
call_with_unix_fd_list_finish(res: AsyncResult): [ /* returnType */ GLib.Variant, /* out_fd_list */ UnixFDList ]
/**
* Like g_dbus_connection_call_sync() but also takes and returns #GUnixFDList objects.
* See g_dbus_connection_call_with_unix_fd_list() and
* g_dbus_connection_call_with_unix_fd_list_finish() for more details.
*
* This method is only available on UNIX.
* @param bus_name a unique or well-known bus name or %NULL if `connection` is not a message bus connection
* @param object_path path of remote object
* @param interface_name D-Bus interface to invoke method on
* @param method_name the name of the method to invoke
* @param parameters a #GVariant tuple with parameters for the method or %NULL if not passing parameters
* @param reply_type the expected type of the reply, or %NULL
* @param flags flags from the #GDBusCallFlags enumeration
* @param timeout_msec the timeout in milliseconds, -1 to use the default timeout or %G_MAXINT for no timeout
* @param fd_list a #GUnixFDList or %NULL
* @param cancellable a #GCancellable or %NULL
* @returns %NULL if @error is set. Otherwise a non-floating #GVariant tuple with return values. Free with g_variant_unref().
*/
call_with_unix_fd_list_sync(bus_name: string | null, object_path: string | null, interface_name: string | null, method_name: string | null, parameters: GLib.Variant | null, reply_type: GLib.VariantType | null, flags: DBusCallFlags, timeout_msec: number, fd_list: UnixFDList | null, cancellable: Cancellable | null): [ /* returnType */ GLib.Variant, /* out_fd_list */ UnixFDList ]
/**
* Closes `connection`. Note that this never causes the process to
* exit (this might only happen if the other end of a shared message
* bus connection disconnects, see #GDBusConnection:exit-on-close).
*
* Once the connection is closed, operations such as sending a message
* will return with the error %G_IO_ERROR_CLOSED. Closing a connection
* will not automatically flush the connection so queued messages may
* be lost. Use g_dbus_connection_flush() if you need such guarantees.
*
* If `connection` is already closed, this method fails with
* %G_IO_ERROR_CLOSED.
*
* When `connection` has been closed, the #GDBusConnection::closed
* signal is emitted in the
* [thread-default main context][g-main-context-push-thread-default]
* of the thread that `connection` was constructed in.
*
* This is an asynchronous method. When the operation is finished,
* `callback` will be invoked in the
* [thread-default main context][g-main-context-push-thread-default]
* of the thread you are calling this method from. You can
* then call g_dbus_connection_close_finish() to get the result of the
* operation. See g_dbus_connection_close_sync() for the synchronous
* version.
* @param cancellable a #GCancellable or %NULL
* @param callback a #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't care about the result
*/
close(cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an operation started with g_dbus_connection_close().
* @param res a #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_close()
* @returns %TRUE if the operation succeeded, %FALSE if @error is set
*/
close_finish(res: AsyncResult): boolean
/**
* Synchronously closes `connection`. The calling thread is blocked
* until this is done. See g_dbus_connection_close() for the
* asynchronous version of this method and more details about what it
* does.
* @param cancellable a #GCancellable or %NULL
* @returns %TRUE if the operation succeeded, %FALSE if @error is set
*/
close_sync(cancellable: Cancellable | null): boolean
/**
* Emits a signal.
*
* If the parameters GVariant is floating, it is consumed.
*
* This can only fail if `parameters` is not compatible with the D-Bus protocol
* (%G_IO_ERROR_INVALID_ARGUMENT), or if `connection` has been closed
* (%G_IO_ERROR_CLOSED).
* @param destination_bus_name the unique bus name for the destination for the signal or %NULL to emit to all listeners
* @param object_path path of remote object
* @param interface_name D-Bus interface to emit a signal on
* @param signal_name the name of the signal to emit
* @param parameters a #GVariant tuple with parameters for the signal or %NULL if not passing parameters
* @returns %TRUE unless @error is set
*/
emit_signal(destination_bus_name: string | null, object_path: string | null, interface_name: string | null, signal_name: string | null, parameters: GLib.Variant | null): boolean
/**
* Exports `action_group` on `connection` at `object_path`.
*
* The implemented D-Bus API should be considered private. It is
* subject to change in the future.
*
* A given object path can only have one action group exported on it.
* If this constraint is violated, the export will fail and 0 will be
* returned (with `error` set accordingly).
*
* You can unexport the action group using
* g_dbus_connection_unexport_action_group() with the return value of
* this function.
*
* The thread default main context is taken at the time of this call.
* All incoming action activations and state change requests are
* reported from this context. Any changes on the action group that
* cause it to emit signals must also come from this same context.
* Since incoming action activations and state change requests are
* rather likely to cause changes on the action group, this effectively
* limits a given action group to being exported from only one main
* context.
* @param object_path a D-Bus object path
* @param action_group a #GActionGroup
* @returns the ID of the export (never zero), or 0 in case of failure
*/
export_action_group(object_path: string | null, action_group: ActionGroup): number
/**
* Exports `menu` on `connection` at `object_path`.
*
* The implemented D-Bus API should be considered private.
* It is subject to change in the future.
*
* An object path can only have one menu model exported on it. If this
* constraint is violated, the export will fail and 0 will be
* returned (with `error` set accordingly).
*
* Exporting menus with sections containing more than
* %G_MENU_EXPORTER_MAX_SECTION_SIZE items is not supported and results in
* undefined behavior.
*
* You can unexport the menu model using
* g_dbus_connection_unexport_menu_model() with the return value of
* this function.
* @param object_path a D-Bus object path
* @param menu a #GMenuModel
* @returns the ID of the export (never zero), or 0 in case of failure
*/
export_menu_model(object_path: string | null, menu: MenuModel): number
/**
* Asynchronously flushes `connection,` that is, writes all queued
* outgoing message to the transport and then flushes the transport
* (using g_output_stream_flush_async()). This is useful in programs
* that wants to emit a D-Bus signal and then exit immediately. Without
* flushing the connection, there is no guaranteed that the message has
* been sent to the networking buffers in the OS kernel.
*
* This is an asynchronous method. When the operation is finished,
* `callback` will be invoked in the
* [thread-default main context][g-main-context-push-thread-default]
* of the thread you are calling this method from. You can
* then call g_dbus_connection_flush_finish() to get the result of the
* operation. See g_dbus_connection_flush_sync() for the synchronous
* version.
* @param cancellable a #GCancellable or %NULL
* @param callback a #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't care about the result
*/
flush(cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an operation started with g_dbus_connection_flush().
* @param res a #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_flush()
* @returns %TRUE if the operation succeeded, %FALSE if @error is set
*/
flush_finish(res: AsyncResult): boolean
/**
* Synchronously flushes `connection`. The calling thread is blocked
* until this is done. See g_dbus_connection_flush() for the
* asynchronous version of this method and more details about what it
* does.
* @param cancellable a #GCancellable or %NULL
* @returns %TRUE if the operation succeeded, %FALSE if @error is set
*/
flush_sync(cancellable: Cancellable | null): boolean
/**
* Gets the capabilities negotiated with the remote peer
* @returns zero or more flags from the #GDBusCapabilityFlags enumeration
*/
get_capabilities(): DBusCapabilityFlags
/**
* Gets whether the process is terminated when `connection` is
* closed by the remote peer. See
* #GDBusConnection:exit-on-close for more details.
* @returns whether the process is terminated when @connection is closed by the remote peer
*/
get_exit_on_close(): boolean
/**
* Gets the flags used to construct this connection
* @returns zero or more flags from the #GDBusConnectionFlags enumeration
*/
get_flags(): DBusConnectionFlags
/**
* The GUID of the peer performing the role of server when
* authenticating. See #GDBusConnection:guid for more details.
* @returns The GUID. Do not free this string, it is owned by @connection.
*/
get_guid(): string | null
/**
* Retrieves the last serial number assigned to a #GDBusMessage on
* the current thread. This includes messages sent via both low-level
* API such as g_dbus_connection_send_message() as well as
* high-level API such as g_dbus_connection_emit_signal(),
* g_dbus_connection_call() or g_dbus_proxy_call().
* @returns the last used serial or zero when no message has been sent within the current thread
*/
get_last_serial(): number
/**
* Gets the credentials of the authenticated peer. This will always
* return %NULL unless `connection` acted as a server
* (e.g. %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER was passed)
* when set up and the client passed credentials as part of the
* authentication process.
*
* In a message bus setup, the message bus is always the server and
* each application is a client. So this method will always return
* %NULL for message bus clients.
* @returns a #GCredentials or %NULL if not available. Do not free this object, it is owned by @connection.
*/
get_peer_credentials(): Credentials | null
/**
* Gets the underlying stream used for IO.
*
* While the #GDBusConnection is active, it will interact with this
* stream from a worker thread, so it is not safe to interact with
* the stream directly.
* @returns the stream used for IO
*/
get_stream(): IOStream
/**
* Gets the unique name of `connection` as assigned by the message
* bus. This can also be used to figure out if `connection` is a
* message bus connection.
* @returns the unique name or %NULL if @connection is not a message bus connection. Do not free this string, it is owned by @connection.
*/
get_unique_name(): string | null
/**
* Gets whether `connection` is closed.
* @returns %TRUE if the connection is closed, %FALSE otherwise
*/
is_closed(): boolean
/**
* Version of g_dbus_connection_register_object() using closures instead of a
* #GDBusInterfaceVTable for easier binding in other languages.
* @param object_path The object path to register at.
* @param interface_info Introspection data for the interface.
* @param method_call_closure #GClosure for handling incoming method calls.
* @param get_property_closure #GClosure for getting a property.
* @param set_property_closure #GClosure for setting a property.
* @returns 0 if @error is set, otherwise a registration ID (never 0) that can be used with g_dbus_connection_unregister_object() .
*/
register_object(object_path: string | null, interface_info: DBusInterfaceInfo, method_call_closure: GObject.TClosure | null, get_property_closure: GObject.TClosure | null, set_property_closure: GObject.TClosure | null): number
/**
* Registers a whole subtree of dynamic objects.
*
* The `enumerate` and `introspection` functions in `vtable` are used to
* convey, to remote callers, what nodes exist in the subtree rooted
* by `object_path`.
*
* When handling remote calls into any node in the subtree, first the
* `enumerate` function is used to check if the node exists. If the node exists
* or the %G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag is set
* the `introspection` function is used to check if the node supports the
* requested method. If so, the `dispatch` function is used to determine
* where to dispatch the call. The collected #GDBusInterfaceVTable and
* #gpointer will be used to call into the interface vtable for processing
* the request.
*
* All calls into user-provided code will be invoked in the
* [thread-default main context][g-main-context-push-thread-default]
* of the thread you are calling this method from.
*
* If an existing subtree is already registered at `object_path` or
* then `error` is set to %G_IO_ERROR_EXISTS.
*
* Note that it is valid to register regular objects (using
* g_dbus_connection_register_object()) in a subtree registered with
* g_dbus_connection_register_subtree() - if so, the subtree handler
* is tried as the last resort. One way to think about a subtree
* handler is to consider it a fallback handler for object paths not
* registered via g_dbus_connection_register_object() or other bindings.
*
* Note that `vtable` will be copied so you cannot change it after
* registration.
*
* See this [server][gdbus-subtree-server] for an example of how to use
* this method.
* @param object_path the object path to register the subtree at
* @param vtable a #GDBusSubtreeVTable to enumerate, introspect and dispatch nodes in the subtree
* @param flags flags used to fine tune the behavior of the subtree
* @param user_data data to pass to functions in `vtable`
* @param user_data_free_func function to call when the subtree is unregistered
* @returns 0 if @error is set, otherwise a subtree registration ID (never 0) that can be used with g_dbus_connection_unregister_subtree()
*/
register_subtree(object_path: string | null, vtable: DBusSubtreeVTable, flags: DBusSubtreeFlags, user_data: any | null, user_data_free_func: GLib.DestroyNotify): number
/**
* Removes a filter.
*
* Note that since filters run in a different thread, there is a race
* condition where it is possible that the filter will be running even
* after calling g_dbus_connection_remove_filter(), so you cannot just
* free data that the filter might be using. Instead, you should pass
* a #GDestroyNotify to g_dbus_connection_add_filter(), which will be
* called when it is guaranteed that the data is no longer needed.
* @param filter_id an identifier obtained from g_dbus_connection_add_filter()
*/
remove_filter(filter_id: number): void
/**
* Asynchronously sends `message` to the peer represented by `connection`.
*
* Unless `flags` contain the
* %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number
* will be assigned by `connection` and set on `message` via
* g_dbus_message_set_serial(). If `out_serial` is not %NULL, then the
* serial number used will be written to this location prior to
* submitting the message to the underlying transport. While it has a `volatile`
* qualifier, this is a historical artifact and the argument passed to it should
* not be `volatile`.
*
* If `connection` is closed then the operation will fail with
* %G_IO_ERROR_CLOSED. If `message` is not well-formed,
* the operation fails with %G_IO_ERROR_INVALID_ARGUMENT.
*
* See this [server][gdbus-server] and [client][gdbus-unix-fd-client]
* for an example of how to use this low-level API to send and receive
* UNIX file descriptors.
*
* Note that `message` must be unlocked, unless `flags` contain the
* %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag.
* @param message a #GDBusMessage
* @param flags flags affecting how the message is sent
* @returns %TRUE if the message was well-formed and queued for transmission, %FALSE if @error is set
*/
send_message(message: DBusMessage, flags: DBusSendMessageFlags): [ /* returnType */ boolean, /* out_serial */ number ]
/**
* Asynchronously sends `message` to the peer represented by `connection`.
*
* Unless `flags` contain the
* %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number
* will be assigned by `connection` and set on `message` via
* g_dbus_message_set_serial(). If `out_serial` is not %NULL, then the
* serial number used will be written to this location prior to
* submitting the message to the underlying transport. While it has a `volatile`
* qualifier, this is a historical artifact and the argument passed to it should
* not be `volatile`.
*
* If `connection` is closed then the operation will fail with
* %G_IO_ERROR_CLOSED. If `cancellable` is canceled, the operation will
* fail with %G_IO_ERROR_CANCELLED. If `message` is not well-formed,
* the operation fails with %G_IO_ERROR_INVALID_ARGUMENT.
*
* This is an asynchronous method. When the operation is finished, `callback`
* will be invoked in the
* [thread-default main context][g-main-context-push-thread-default]
* of the thread you are calling this method from. You can then call
* g_dbus_connection_send_message_with_reply_finish() to get the result of the operation.
* See g_dbus_connection_send_message_with_reply_sync() for the synchronous version.
*
* Note that `message` must be unlocked, unless `flags` contain the
* %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag.
*
* See this [server][gdbus-server] and [client][gdbus-unix-fd-client]
* for an example of how to use this low-level API to send and receive
* UNIX file descriptors.
* @param message a #GDBusMessage
* @param flags flags affecting how the message is sent
* @param timeout_msec the timeout in milliseconds, -1 to use the default timeout or %G_MAXINT for no timeout
* @param cancellable a #GCancellable or %NULL
* @param callback a #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't care about the result
*/
send_message_with_reply(message: DBusMessage, flags: DBusSendMessageFlags, timeout_msec: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): /* out_serial */ number
/**
* Finishes an operation started with g_dbus_connection_send_message_with_reply().
*
* Note that `error` is only set if a local in-process error
* occurred. That is to say that the returned #GDBusMessage object may
* be of type %G_DBUS_MESSAGE_TYPE_ERROR. Use
* g_dbus_message_to_gerror() to transcode this to a #GError.
*
* See this [server][gdbus-server] and [client][gdbus-unix-fd-client]
* for an example of how to use this low-level API to send and receive
* UNIX file descriptors.
* @param res a #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_send_message_with_reply()
* @returns a locked #GDBusMessage or %NULL if @error is set
*/
send_message_with_reply_finish(res: AsyncResult): DBusMessage
/**
* Synchronously sends `message` to the peer represented by `connection`
* and blocks the calling thread until a reply is received or the
* timeout is reached. See g_dbus_connection_send_message_with_reply()
* for the asynchronous version of this method.
*
* Unless `flags` contain the
* %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number
* will be assigned by `connection` and set on `message` via
* g_dbus_message_set_serial(). If `out_serial` is not %NULL, then the
* serial number used will be written to this location prior to
* submitting the message to the underlying transport. While it has a `volatile`
* qualifier, this is a historical artifact and the argument passed to it should
* not be `volatile`.
*
* If `connection` is closed then the operation will fail with
* %G_IO_ERROR_CLOSED. If `cancellable` is canceled, the operation will
* fail with %G_IO_ERROR_CANCELLED. If `message` is not well-formed,
* the operation fails with %G_IO_ERROR_INVALID_ARGUMENT.
*
* Note that `error` is only set if a local in-process error
* occurred. That is to say that the returned #GDBusMessage object may
* be of type %G_DBUS_MESSAGE_TYPE_ERROR. Use
* g_dbus_message_to_gerror() to transcode this to a #GError.
*
* See this [server][gdbus-server] and [client][gdbus-unix-fd-client]
* for an example of how to use this low-level API to send and receive
* UNIX file descriptors.
*
* Note that `message` must be unlocked, unless `flags` contain the
* %G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag.
* @param message a #GDBusMessage
* @param flags flags affecting how the message is sent.
* @param timeout_msec the timeout in milliseconds, -1 to use the default timeout or %G_MAXINT for no timeout
* @param cancellable a #GCancellable or %NULL
* @returns a locked #GDBusMessage that is the reply to @message or %NULL if @error is set
*/
send_message_with_reply_sync(message: DBusMessage, flags: DBusSendMessageFlags, timeout_msec: number, cancellable: Cancellable | null): [ /* returnType */ DBusMessage, /* out_serial */ number ]
/**
* Sets whether the process should be terminated when `connection` is
* closed by the remote peer. See #GDBusConnection:exit-on-close for
* more details.
*
* Note that this function should be used with care. Most modern UNIX
* desktops tie the notion of a user session with the session bus, and expect
* all of a user's applications to quit when their bus connection goes away.
* If you are setting `exit_on_close` to %FALSE for the shared session
* bus connection, you should make sure that your application exits
* when the user session ends.
* @param exit_on_close whether the process should be terminated when `connection` is closed by the remote peer
*/
set_exit_on_close(exit_on_close: boolean): void
/**
* Subscribes to signals on `connection` and invokes `callback` whenever
* the signal is received. Note that `callback` will be invoked in the
* [thread-default main context][g-main-context-push-thread-default]
* of the thread you are calling this method from.
*
* If `connection` is not a message bus connection, `sender` must be
* %NULL.
*
* If `sender` is a well-known name note that `callback` is invoked with
* the unique name for the owner of `sender,` not the well-known name
* as one would expect. This is because the message bus rewrites the
* name. As such, to avoid certain race conditions, users should be
* tracking the name owner of the well-known name and use that when
* processing the received signal.
*
* If one of %G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_NAMESPACE or
* %G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH are given, `arg0` is
* interpreted as part of a namespace or path. The first argument
* of a signal is matched against that part as specified by D-Bus.
*
* If `user_data_free_func` is non-%NULL, it will be called (in the
* thread-default main context of the thread you are calling this
* method from) at some point after `user_data` is no longer
* needed. (It is not guaranteed to be called synchronously when the
* signal is unsubscribed from, and may be called after `connection`
* has been destroyed.)
*
* As `callback` is potentially invoked in a different thread from where it’s
* emitted, it’s possible for this to happen after
* g_dbus_connection_signal_unsubscribe() has been called in another thread.
* Due to this, `user_data` should have a strong reference which is freed with
* `user_data_free_func,` rather than pointing to data whose lifecycle is tied
* to the signal subscription. For example, if a #GObject is used to store the
* subscription ID from g_dbus_connection_signal_subscribe(), a strong reference
* to that #GObject must be passed to `user_data,` and g_object_unref() passed to
* `user_data_free_func`. You are responsible for breaking the resulting
* reference count cycle by explicitly unsubscribing from the signal when
* dropping the last external reference to the #GObject. Alternatively, a weak
* reference may be used.
*
* It is guaranteed that if you unsubscribe from a signal using
* g_dbus_connection_signal_unsubscribe() from the same thread which made the
* corresponding g_dbus_connection_signal_subscribe() call, `callback` will not
* be invoked after g_dbus_connection_signal_unsubscribe() returns.
*
* The returned subscription identifier is an opaque value which is guaranteed
* to never be zero.
*
* This function can never fail.
* @param sender sender name to match on (unique or well-known name) or %NULL to listen from all senders
* @param interface_name D-Bus interface name to match on or %NULL to match on all interfaces
* @param member D-Bus signal name to match on or %NULL to match on all signals
* @param object_path object path to match on or %NULL to match on all object paths
* @param arg0 contents of first string argument to match on or %NULL to match on all kinds of arguments
* @param flags #GDBusSignalFlags describing how arg0 is used in subscribing to the signal
* @param callback callback to invoke when there is a signal matching the requested data
* @returns a subscription identifier that can be used with g_dbus_connection_signal_unsubscribe()
*/
signal_subscribe(sender: string | null, interface_name: string | null, member: string | null, object_path: string | null, arg0: string | null, flags: DBusSignalFlags, callback: DBusSignalCallback): number
/**
* Unsubscribes from signals.
*
* Note that there may still be D-Bus traffic to process (relating to this
* signal subscription) in the current thread-default #GMainContext after this
* function has returned. You should continue to iterate the #GMainContext
* until the #GDestroyNotify function passed to
* g_dbus_connection_signal_subscribe() is called, in order to avoid memory
* leaks through callbacks queued on the #GMainContext after it’s stopped being
* iterated.
* Alternatively, any idle source with a priority lower than %G_PRIORITY_DEFAULT
* that was scheduled after unsubscription, also indicates that all resources
* of this subscription are released.
* @param subscription_id a subscription id obtained from g_dbus_connection_signal_subscribe()
*/
signal_unsubscribe(subscription_id: number): void
/**
* If `connection` was created with
* %G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING, this method
* starts processing messages. Does nothing on if `connection` wasn't
* created with this flag or if the method has already been called.
*/
start_message_processing(): void
/**
* Reverses the effect of a previous call to
* g_dbus_connection_export_action_group().
*
* It is an error to call this function with an ID that wasn't returned
* from g_dbus_connection_export_action_group() or to call it with the
* same ID more than once.
* @param export_id the ID from g_dbus_connection_export_action_group()
*/
unexport_action_group(export_id: number): void
/**
* Reverses the effect of a previous call to
* g_dbus_connection_export_menu_model().
*
* It is an error to call this function with an ID that wasn't returned
* from g_dbus_connection_export_menu_model() or to call it with the
* same ID more than once.
* @param export_id the ID from g_dbus_connection_export_menu_model()
*/
unexport_menu_model(export_id: number): void
/**
* Unregisters an object.
* @param registration_id a registration id obtained from g_dbus_connection_register_object()
* @returns %TRUE if the object was unregistered, %FALSE otherwise
*/
unregister_object(registration_id: number): boolean
/**
* Unregisters a subtree.
* @param registration_id a subtree registration id obtained from g_dbus_connection_register_subtree()
* @returns %TRUE if the subtree was unregistered, %FALSE otherwise
*/
unregister_subtree(registration_id: number): boolean
watch_name(name: string, flags: BusNameWatcherFlags, name_appeared_closure: GObject.TClosure | null, name_vanished_closure: GObject.TClosure | null): number
unwatch_name(id: number): void
own_name(name: string, flags: BusNameOwnerFlags, name_acquired_closure: GObject.TClosure | null, name_lost_closure: GObject.TClosure | null): number
unown_name(id: number): void
// Own signals of Gio-2.0.Gio.DBusConnection
connect(sigName: "closed", callback: DBusConnection.ClosedSignalCallback): number
connect_after(sigName: "closed", callback: DBusConnection.ClosedSignalCallback): number
emit(sigName: "closed", remote_peer_vanished: boolean, error: GLib.Error | null, ...args: any[]): void
// Class property signals of Gio-2.0.Gio.DBusConnection
connect(sigName: "notify::address", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::address", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::address", ...args: any[]): void
connect(sigName: "notify::authentication-observer", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::authentication-observer", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::authentication-observer", ...args: any[]): void
connect(sigName: "notify::capabilities", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::capabilities", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::capabilities", ...args: any[]): void
connect(sigName: "notify::closed", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::closed", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::closed", ...args: any[]): void
connect(sigName: "notify::exit-on-close", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::exit-on-close", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::exit-on-close", ...args: any[]): void
connect(sigName: "notify::flags", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::flags", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::flags", ...args: any[]): void
connect(sigName: "notify::guid", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::guid", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::guid", ...args: any[]): void
connect(sigName: "notify::stream", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::stream", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::stream", ...args: any[]): void
connect(sigName: "notify::unique-name", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::unique-name", callback: (($obj: DBusConnection, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::unique-name", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* The #GDBusConnection type is used for D-Bus connections to remote
* peers such as a message buses. It is a low-level API that offers a
* lot of flexibility. For instance, it lets you establish a connection
* over any transport that can by represented as a #GIOStream.
*
* This class is rarely used directly in D-Bus clients. If you are writing
* a D-Bus client, it is often easier to use the g_bus_own_name(),
* g_bus_watch_name() or g_dbus_proxy_new_for_bus() APIs.
*
* As an exception to the usual GLib rule that a particular object must not
* be used by two threads at the same time, #GDBusConnection's methods may be
* called from any thread. This is so that g_bus_get() and g_bus_get_sync()
* can safely return the same #GDBusConnection when called from any thread.
*
* Most of the ways to obtain a #GDBusConnection automatically initialize it
* (i.e. connect to D-Bus): for instance, g_dbus_connection_new() and
* g_bus_get(), and the synchronous versions of those methods, give you an
* initialized connection. Language bindings for GIO should use
* g_initable_new() or g_async_initable_new_async(), which also initialize the
* connection.
*
* If you construct an uninitialized #GDBusConnection, such as via
* g_object_new(), you must initialize it via g_initable_init() or
* g_async_initable_init_async() before using its methods or properties.
* Calling methods or accessing properties on a #GDBusConnection that has not
* completed initialization successfully is considered to be invalid, and leads
* to undefined behaviour. In particular, if initialization fails with a
* #GError, the only valid thing you can do with that #GDBusConnection is to
* free it with g_object_unref().
*
* ## An example D-Bus server # {#gdbus-server}
*
* Here is an example for a D-Bus server:
* [gdbus-example-server.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-example-server.c)
*
* ## An example for exporting a subtree # {#gdbus-subtree-server}
*
* Here is an example for exporting a subtree:
* [gdbus-example-subtree.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-example-subtree.c)
*
* ## An example for file descriptor passing # {#gdbus-unix-fd-client}
*
* Here is an example for passing UNIX file descriptors:
* [gdbus-unix-fd-client.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-example-unix-fd-client.c)
*
* ## An example for exporting a GObject # {#gdbus-export}
*
* Here is an example for exporting a #GObject:
* [gdbus-example-export.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-example-export.c)
* @class
*/
export class DBusConnection extends GObject.Object {
// Own properties of Gio-2.0.Gio.DBusConnection
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DBusConnection
constructor(config?: DBusConnection.ConstructorProperties)
/**
* Finishes an operation started with g_dbus_connection_new().
* @constructor
* @param res a #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_new().
* @returns a #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
*/
static new_finish(res: AsyncResult): DBusConnection
/**
* Finishes an operation started with g_dbus_connection_new_for_address().
* @constructor
* @param res a #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_connection_new()
* @returns a #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
*/
static new_for_address_finish(res: AsyncResult): DBusConnection
/**
* Synchronously connects and sets up a D-Bus client connection for
* exchanging D-Bus messages with an endpoint specified by `address`
* which must be in the
* [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
*
* This constructor can only be used to initiate client-side
* connections - use g_dbus_connection_new_sync() if you need to act
* as the server. In particular, `flags` cannot contain the
* %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER,
* %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS or
* %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER flags.
*
* This is a synchronous failable constructor. See
* g_dbus_connection_new_for_address() for the asynchronous version.
*
* If `observer` is not %NULL it may be used to control the
* authentication process.
* @constructor
* @param address a D-Bus address
* @param flags flags describing how to make the connection
* @param observer a #GDBusAuthObserver or %NULL
* @param cancellable a #GCancellable or %NULL
* @returns a #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
*/
static new_for_address_sync(address: string | null, flags: DBusConnectionFlags, observer: DBusAuthObserver | null, cancellable: Cancellable | null): DBusConnection
/**
* Synchronously sets up a D-Bus connection for exchanging D-Bus messages
* with the end represented by `stream`.
*
* If `stream` is a #GSocketConnection, then the corresponding #GSocket
* will be put into non-blocking mode.
*
* The D-Bus connection will interact with `stream` from a worker thread.
* As a result, the caller should not interact with `stream` after this
* method has been called, except by calling g_object_unref() on it.
*
* If `observer` is not %NULL it may be used to control the
* authentication process.
*
* This is a synchronous failable constructor. See
* g_dbus_connection_new() for the asynchronous version.
* @constructor
* @param stream a #GIOStream
* @param guid the GUID to use if authenticating as a server or %NULL
* @param flags flags describing how to make the connection
* @param observer a #GDBusAuthObserver or %NULL
* @param cancellable a #GCancellable or %NULL
* @returns a #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
*/
static new_sync(stream: IOStream, guid: string | null, flags: DBusConnectionFlags, observer: DBusAuthObserver | null, cancellable: Cancellable | null): DBusConnection
_init(config?: DBusConnection.ConstructorProperties): void
/**
* Asynchronously sets up a D-Bus connection for exchanging D-Bus messages
* with the end represented by `stream`.
*
* If `stream` is a #GSocketConnection, then the corresponding #GSocket
* will be put into non-blocking mode.
*
* The D-Bus connection will interact with `stream` from a worker thread.
* As a result, the caller should not interact with `stream` after this
* method has been called, except by calling g_object_unref() on it.
*
* If `observer` is not %NULL it may be used to control the
* authentication process.
*
* When the operation is finished, `callback` will be invoked. You can
* then call g_dbus_connection_new_finish() to get the result of the
* operation.
*
* This is an asynchronous failable constructor. See
* g_dbus_connection_new_sync() for the synchronous
* version.
* @param stream a #GIOStream
* @param guid the GUID to use if authenticating as a server or %NULL
* @param flags flags describing how to make the connection
* @param observer a #GDBusAuthObserver or %NULL
* @param cancellable a #GCancellable or %NULL
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
static new(stream: IOStream, guid: string | null, flags: DBusConnectionFlags, observer: DBusAuthObserver | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Asynchronously connects and sets up a D-Bus client connection for
* exchanging D-Bus messages with an endpoint specified by `address`
* which must be in the
* [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
*
* This constructor can only be used to initiate client-side
* connections - use g_dbus_connection_new() if you need to act as the
* server. In particular, `flags` cannot contain the
* %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER,
* %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS or
* %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER flags.
*
* When the operation is finished, `callback` will be invoked. You can
* then call g_dbus_connection_new_for_address_finish() to get the result of
* the operation.
*
* If `observer` is not %NULL it may be used to control the
* authentication process.
*
* This is an asynchronous failable constructor. See
* g_dbus_connection_new_for_address_sync() for the synchronous
* version.
* @param address a D-Bus address
* @param flags flags describing how to make the connection
* @param observer a #GDBusAuthObserver or %NULL
* @param cancellable a #GCancellable or %NULL
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
static new_for_address(address: string | null, flags: DBusConnectionFlags, observer: DBusAuthObserver | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
}
export module DBusInterfaceSkeleton {
// Signal callback interfaces
/**
* Signal callback interface for `g-authorize-method`
*/
export interface GAuthorizeMethodSignalCallback {
($obj: DBusInterfaceSkeleton, invocation: DBusMethodInvocation): boolean
}
// Constructor properties interface
export interface ConstructorProperties extends DBusInterface.ConstructorProperties, GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.DBusInterfaceSkeleton
/**
* Flags from the #GDBusInterfaceSkeletonFlags enumeration.
*/
g_flags?: DBusInterfaceSkeletonFlags | null
}
}
export interface DBusInterfaceSkeleton extends DBusInterface {
// Own properties of Gio-2.0.Gio.DBusInterfaceSkeleton
/**
* Flags from the #GDBusInterfaceSkeletonFlags enumeration.
*/
g_flags: DBusInterfaceSkeletonFlags
// Owm methods of Gio-2.0.Gio.DBusInterfaceSkeleton
/**
* Exports `interface_` at `object_path` on `connection`.
*
* This can be called multiple times to export the same `interface_`
* onto multiple connections however the `object_path` provided must be
* the same for all connections.
*
* Use g_dbus_interface_skeleton_unexport() to unexport the object.
* @param connection A #GDBusConnection to export `interface_` on.
* @param object_path The path to export the interface at.
* @returns %TRUE if the interface was exported on @connection, otherwise %FALSE with @error set.
*/
export(connection: DBusConnection, object_path: string | null): boolean
/**
* If `interface_` has outstanding changes, request for these changes to be
* emitted immediately.
*
* For example, an exported D-Bus interface may queue up property
* changes and emit the
* `org.freedesktop.DBus.Properties.PropertiesChanged`
* signal later (e.g. in an idle handler). This technique is useful
* for collapsing multiple property changes into one.
*/
flush(): void
/**
* Gets the first connection that `interface_` is exported on, if any.
* @returns A #GDBusConnection or %NULL if @interface_ is not exported anywhere. Do not free, the object belongs to @interface_.
*/
get_connection(): DBusConnection | null
/**
* Gets a list of the connections that `interface_` is exported on.
* @returns A list of all the connections that @interface_ is exported on. The returned list should be freed with g_list_free() after each element has been freed with g_object_unref().
*/
get_connections(): DBusConnection[]
/**
* Gets the #GDBusInterfaceSkeletonFlags that describes what the behavior
* of `interface_`
* @returns One or more flags from the #GDBusInterfaceSkeletonFlags enumeration.
*/
get_flags(): DBusInterfaceSkeletonFlags
/**
* Gets D-Bus introspection information for the D-Bus interface
* implemented by `interface_`.
* @returns A #GDBusInterfaceInfo (never %NULL). Do not free.
*/
get_info(): DBusInterfaceInfo
/**
* Gets the object path that `interface_` is exported on, if any.
* @returns A string owned by @interface_ or %NULL if @interface_ is not exported anywhere. Do not free, the string belongs to @interface_.
*/
get_object_path(): string | null
/**
* Gets all D-Bus properties for `interface_`.
* @returns A #GVariant of type ['a{sv}'][G-VARIANT-TYPE-VARDICT:CAPS]. Free with g_variant_unref().
*/
get_properties(): GLib.Variant
/**
* Gets the interface vtable for the D-Bus interface implemented by
* `interface_`. The returned function pointers should expect `interface_`
* itself to be passed as `user_data`.
* @returns the vtable of the D-Bus interface implemented by the skeleton
*/
get_vtable(): DBusInterfaceVTable
/**
* Checks if `interface_` is exported on `connection`.
* @param connection A #GDBusConnection.
* @returns %TRUE if @interface_ is exported on @connection, %FALSE otherwise.
*/
has_connection(connection: DBusConnection): boolean
/**
* Sets flags describing what the behavior of `skeleton` should be.
* @param flags Flags from the #GDBusInterfaceSkeletonFlags enumeration.
*/
set_flags(flags: DBusInterfaceSkeletonFlags): void
/**
* Stops exporting `interface_` on all connections it is exported on.
*
* To unexport `interface_` from only a single connection, use
* g_dbus_interface_skeleton_unexport_from_connection()
*/
unexport(): void
/**
* Stops exporting `interface_` on `connection`.
*
* To stop exporting on all connections the interface is exported on,
* use g_dbus_interface_skeleton_unexport().
* @param connection A #GDBusConnection.
*/
unexport_from_connection(connection: DBusConnection): void
// Own virtual methods of Gio-2.0.Gio.DBusInterfaceSkeleton
/**
* If `interface_` has outstanding changes, request for these changes to be
* emitted immediately.
*
* For example, an exported D-Bus interface may queue up property
* changes and emit the
* `org.freedesktop.DBus.Properties.PropertiesChanged`
* signal later (e.g. in an idle handler). This technique is useful
* for collapsing multiple property changes into one.
* @virtual
*/
vfunc_flush(): void
vfunc_g_authorize_method(invocation: DBusMethodInvocation): boolean
/**
* Gets D-Bus introspection information for the D-Bus interface
* implemented by `interface_`.
* @virtual
* @returns A #GDBusInterfaceInfo (never %NULL). Do not free.
*/
vfunc_get_info(): DBusInterfaceInfo
/**
* Gets all D-Bus properties for `interface_`.
* @virtual
* @returns A #GVariant of type ['a{sv}'][G-VARIANT-TYPE-VARDICT:CAPS]. Free with g_variant_unref().
*/
vfunc_get_properties(): GLib.Variant
/**
* Gets the interface vtable for the D-Bus interface implemented by
* `interface_`. The returned function pointers should expect `interface_`
* itself to be passed as `user_data`.
* @virtual
* @returns the vtable of the D-Bus interface implemented by the skeleton
*/
vfunc_get_vtable(): DBusInterfaceVTable
// Own signals of Gio-2.0.Gio.DBusInterfaceSkeleton
connect(sigName: "g-authorize-method", callback: DBusInterfaceSkeleton.GAuthorizeMethodSignalCallback): number
connect_after(sigName: "g-authorize-method", callback: DBusInterfaceSkeleton.GAuthorizeMethodSignalCallback): number
emit(sigName: "g-authorize-method", invocation: DBusMethodInvocation, ...args: any[]): void
// Class property signals of Gio-2.0.Gio.DBusInterfaceSkeleton
connect(sigName: "notify::g-flags", callback: (($obj: DBusInterfaceSkeleton, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::g-flags", callback: (($obj: DBusInterfaceSkeleton, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::g-flags", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* Abstract base class for D-Bus interfaces on the service side.
* @class
*/
export class DBusInterfaceSkeleton extends GObject.Object {
// Own properties of Gio-2.0.Gio.DBusInterfaceSkeleton
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DBusInterfaceSkeleton
constructor(config?: DBusInterfaceSkeleton.ConstructorProperties)
_init(config?: DBusInterfaceSkeleton.ConstructorProperties): void
}
export module DBusMenuModel {
// Constructor properties interface
export interface ConstructorProperties extends MenuModel.ConstructorProperties {
}
}
export interface DBusMenuModel {
// Class property signals of Gio-2.0.Gio.DBusMenuModel
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GDBusMenuModel is an implementation of #GMenuModel that can be used
* as a proxy for a menu model that is exported over D-Bus with
* g_dbus_connection_export_menu_model().
* @class
*/
export class DBusMenuModel extends MenuModel {
// Own properties of Gio-2.0.Gio.DBusMenuModel
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DBusMenuModel
constructor(config?: DBusMenuModel.ConstructorProperties)
_init(config?: DBusMenuModel.ConstructorProperties): void
/**
* Obtains a #GDBusMenuModel for the menu model which is exported
* at the given `bus_name` and `object_path`.
*
* The thread default main context is taken at the time of this call.
* All signals on the menu model (and any linked models) are reported
* with respect to this context. All calls on the returned menu model
* (and linked models) must also originate from this same context, with
* the thread default main context unchanged.
* @param connection a #GDBusConnection
* @param bus_name the bus name which exports the menu model or %NULL if `connection` is not a message bus connection
* @param object_path the object path at which the menu model is exported
* @returns a #GDBusMenuModel object. Free with g_object_unref().
*/
static get(connection: DBusConnection, bus_name: string | null, object_path: string | null): DBusMenuModel
}
export module DBusMessage {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface DBusMessage {
// Own properties of Gio-2.0.Gio.DBusMessage
readonly locked: boolean
// Owm methods of Gio-2.0.Gio.DBusMessage
/**
* Copies `message`. The copy is a deep copy and the returned
* #GDBusMessage is completely identical except that it is guaranteed
* to not be locked.
*
* This operation can fail if e.g. `message` contains file descriptors
* and the per-process or system-wide open files limit is reached.
* @returns A new #GDBusMessage or %NULL if @error is set. Free with g_object_unref().
*/
copy(): DBusMessage
/**
* Convenience to get the first item in the body of `message`.
* @returns The string item or %NULL if the first item in the body of @message is not a string.
*/
get_arg0(): string | null
/**
* Gets the body of a message.
* @returns A #GVariant or %NULL if the body is empty. Do not free, it is owned by @message.
*/
get_body(): GLib.Variant | null
/**
* Gets the byte order of `message`.
* @returns The byte order.
*/
get_byte_order(): DBusMessageByteOrder
/**
* Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.
* @returns The value.
*/
get_destination(): string | null
/**
* Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.
* @returns The value.
*/
get_error_name(): string | null
/**
* Gets the flags for `message`.
* @returns Flags that are set (typically values from the #GDBusMessageFlags enumeration bitwise ORed together).
*/
get_flags(): DBusMessageFlags
/**
* Gets a header field on `message`.
*
* The caller is responsible for checking the type of the returned #GVariant
* matches what is expected.
* @param header_field A 8-bit unsigned integer (typically a value from the #GDBusMessageHeaderField enumeration)
* @returns A #GVariant with the value if the header was found, %NULL otherwise. Do not free, it is owned by @message.
*/
get_header(header_field: DBusMessageHeaderField): GLib.Variant | null
/**
* Gets an array of all header fields on `message` that are set.
* @returns An array of header fields terminated by %G_DBUS_MESSAGE_HEADER_FIELD_INVALID. Each element is a #guchar. Free with g_free().
*/
get_header_fields(): Uint8Array
/**
* Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.
* @returns The value.
*/
get_interface(): string | null
/**
* Checks whether `message` is locked. To monitor changes to this
* value, conncet to the #GObject::notify signal to listen for changes
* on the #GDBusMessage:locked property.
* @returns %TRUE if @message is locked, %FALSE otherwise.
*/
get_locked(): boolean
/**
* Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.
* @returns The value.
*/
get_member(): string | null
/**
* Gets the type of `message`.
* @returns A 8-bit unsigned integer (typically a value from the #GDBusMessageType enumeration).
*/
get_message_type(): DBusMessageType
/**
* Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.
* @returns The value.
*/
get_num_unix_fds(): number
/**
* Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.
* @returns The value.
*/
get_path(): string | null
/**
* Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.
* @returns The value.
*/
get_reply_serial(): number
/**
* Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.
* @returns The value.
*/
get_sender(): string | null
/**
* Gets the serial for `message`.
* @returns A #guint32.
*/
get_serial(): number
/**
* Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.
*
* This will always be non-%NULL, but may be an empty string.
* @returns The value.
*/
get_signature(): string | null
/**
* Gets the UNIX file descriptors associated with `message,` if any.
*
* This method is only available on UNIX.
*
* The file descriptors normally correspond to %G_VARIANT_TYPE_HANDLE
* values in the body of the message. For example,
* if g_variant_get_handle() returns 5, that is intended to be a reference
* to the file descriptor that can be accessed by
* `g_unix_fd_list_get (list, 5, ...)`.
* @returns A #GUnixFDList or %NULL if no file descriptors are associated. Do not free, this object is owned by @message.
*/
get_unix_fd_list(): UnixFDList | null
/**
* If `message` is locked, does nothing. Otherwise locks the message.
*/
lock(): void
/**
* Creates a new #GDBusMessage that is an error reply to `method_call_message`.
* @param error_name A valid D-Bus error name.
* @param error_message The D-Bus error message.
* @returns A #GDBusMessage. Free with g_object_unref().
*/
new_method_error_literal(error_name: string | null, error_message: string | null): DBusMessage
/**
* Creates a new #GDBusMessage that is a reply to `method_call_message`.
* @returns #GDBusMessage. Free with g_object_unref().
*/
new_method_reply(): DBusMessage
/**
* Produces a human-readable multi-line description of `message`.
*
* The contents of the description has no ABI guarantees, the contents
* and formatting is subject to change at any time. Typical output
* looks something like this:
*
* ```
* Flags: none
* Version: 0
* Serial: 4
* Headers:
* path -> objectpath '/org/gtk/GDBus/TestObject'
* interface -> 'org.gtk.GDBus.TestInterface'
* member -> 'GimmeStdout'
* destination -> ':1.146'
* Body: ()
* UNIX File Descriptors:
* (none)
* ```
*
* or
*
* ```
* Flags: no-reply-expected
* Version: 0
* Serial: 477
* Headers:
* reply-serial -> uint32 4
* destination -> ':1.159'
* sender -> ':1.146'
* num-unix-fds -> uint32 1
* Body: ()
* UNIX File Descriptors:
* fd 12: dev=0:10,mode=020620,ino=5,uid=500,gid=5,rdev=136:2,size=0,atime=1273085037,mtime=1273085851,ctime=1272982635
* ```
*
* @param indent Indentation level.
* @returns A string that should be freed with g_free().
*/
print(indent: number): string | null
/**
* Sets the body `message`. As a side-effect the
* %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field is set to the
* type string of `body` (or cleared if `body` is %NULL).
*
* If `body` is floating, `message` assumes ownership of `body`.
* @param body Either %NULL or a #GVariant that is a tuple.
*/
set_body(body: GLib.Variant): void
/**
* Sets the byte order of `message`.
* @param byte_order The byte order.
*/
set_byte_order(byte_order: DBusMessageByteOrder): void
/**
* Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.
* @param value The value to set.
*/
set_destination(value: string | null): void
/**
* Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.
* @param value The value to set.
*/
set_error_name(value: string | null): void
/**
* Sets the flags to set on `message`.
* @param flags Flags for `message` that are set (typically values from the #GDBusMessageFlags enumeration bitwise ORed together).
*/
set_flags(flags: DBusMessageFlags): void
/**
* Sets a header field on `message`.
*
* If `value` is floating, `message` assumes ownership of `value`.
* @param header_field A 8-bit unsigned integer (typically a value from the #GDBusMessageHeaderField enumeration)
* @param value A #GVariant to set the header field or %NULL to clear the header field.
*/
set_header(header_field: DBusMessageHeaderField, value: GLib.Variant | null): void
/**
* Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.
* @param value The value to set.
*/
set_interface(value: string | null): void
/**
* Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.
* @param value The value to set.
*/
set_member(value: string | null): void
/**
* Sets `message` to be of `type`.
* @param type A 8-bit unsigned integer (typically a value from the #GDBusMessageType enumeration).
*/
set_message_type(type: DBusMessageType): void
/**
* Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.
* @param value The value to set.
*/
set_num_unix_fds(value: number): void
/**
* Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.
* @param value The value to set.
*/
set_path(value: string | null): void
/**
* Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.
* @param value The value to set.
*/
set_reply_serial(value: number): void
/**
* Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.
* @param value The value to set.
*/
set_sender(value: string | null): void
/**
* Sets the serial for `message`.
* @param serial A #guint32.
*/
set_serial(serial: number): void
/**
* Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.
* @param value The value to set.
*/
set_signature(value: string | null): void
/**
* Sets the UNIX file descriptors associated with `message`. As a
* side-effect the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header
* field is set to the number of fds in `fd_list` (or cleared if
* `fd_list` is %NULL).
*
* This method is only available on UNIX.
*
* When designing D-Bus APIs that are intended to be interoperable,
* please note that non-GDBus implementations of D-Bus can usually only
* access file descriptors if they are referenced by a value of type
* %G_VARIANT_TYPE_HANDLE in the body of the message.
* @param fd_list A #GUnixFDList or %NULL.
*/
set_unix_fd_list(fd_list: UnixFDList | null): void
/**
* Serializes `message` to a blob. The byte order returned by
* g_dbus_message_get_byte_order() will be used.
* @param capabilities A #GDBusCapabilityFlags describing what protocol features are supported.
* @returns A pointer to a valid binary D-Bus message of @out_size bytes generated by @message or %NULL if @error is set. Free with g_free().
*/
to_blob(capabilities: DBusCapabilityFlags): Uint8Array
/**
* If `message` is not of type %G_DBUS_MESSAGE_TYPE_ERROR does
* nothing and returns %FALSE.
*
* Otherwise this method encodes the error in `message` as a #GError
* using g_dbus_error_set_dbus_error() using the information in the
* %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field of `message` as
* well as the first string item in `message'`s body.
* @returns %TRUE if @error was set, %FALSE otherwise.
*/
to_gerror(): boolean
// Class property signals of Gio-2.0.Gio.DBusMessage
connect(sigName: "notify::locked", callback: (($obj: DBusMessage, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::locked", callback: (($obj: DBusMessage, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::locked", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* A type for representing D-Bus messages that can be sent or received
* on a #GDBusConnection.
* @class
*/
export class DBusMessage extends GObject.Object {
// Own properties of Gio-2.0.Gio.DBusMessage
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DBusMessage
constructor(config?: DBusMessage.ConstructorProperties)
/**
* Creates a new empty #GDBusMessage.
* @constructor
* @returns A #GDBusMessage. Free with g_object_unref().
*/
constructor()
/**
* Creates a new empty #GDBusMessage.
* @constructor
* @returns A #GDBusMessage. Free with g_object_unref().
*/
static new(): DBusMessage
/**
* Creates a new #GDBusMessage from the data stored at `blob`. The byte
* order that the message was in can be retrieved using
* g_dbus_message_get_byte_order().
*
* If the `blob` cannot be parsed, contains invalid fields, or contains invalid
* headers, %G_IO_ERROR_INVALID_ARGUMENT will be returned.
* @constructor
* @param blob A blob representing a binary D-Bus message.
* @param capabilities A #GDBusCapabilityFlags describing what protocol features are supported.
* @returns A new #GDBusMessage or %NULL if @error is set. Free with g_object_unref().
*/
static new_from_blob(blob: Uint8Array, capabilities: DBusCapabilityFlags): DBusMessage
/**
* Creates a new #GDBusMessage for a method call.
* @constructor
* @param name A valid D-Bus name or %NULL.
* @param path A valid object path.
* @param interface_ A valid D-Bus interface name or %NULL.
* @param method A valid method name.
* @returns A #GDBusMessage. Free with g_object_unref().
*/
static new_method_call(name: string | null, path: string | null, interface_: string | null, method: string | null): DBusMessage
/**
* Creates a new #GDBusMessage for a signal emission.
* @constructor
* @param path A valid object path.
* @param interface_ A valid D-Bus interface name.
* @param signal A valid signal name.
* @returns A #GDBusMessage. Free with g_object_unref().
*/
static new_signal(path: string | null, interface_: string | null, signal: string | null): DBusMessage
_init(config?: DBusMessage.ConstructorProperties): void
/**
* Utility function to calculate how many bytes are needed to
* completely deserialize the D-Bus message stored at `blob`.
* @param blob A blob representing a binary D-Bus message.
* @returns Number of bytes needed or -1 if @error is set (e.g. if @blob contains invalid data or not enough data is available to determine the size).
*/
static bytes_needed(blob: Uint8Array): number
}
export module DBusMethodInvocation {
// Constructor properties interface
export interface ConstructorProperties extends GObject.Object.ConstructorProperties {
}
}
export interface DBusMethodInvocation {
// Owm methods of Gio-2.0.Gio.DBusMethodInvocation
/**
* Gets the #GDBusConnection the method was invoked on.
* @returns A #GDBusConnection. Do not free, it is owned by @invocation.
*/
get_connection(): DBusConnection
/**
* Gets the name of the D-Bus interface the method was invoked on.
*
* If this method call is a property Get, Set or GetAll call that has
* been redirected to the method call handler then
* "org.freedesktop.DBus.Properties" will be returned. See
* #GDBusInterfaceVTable for more information.
* @returns A string. Do not free, it is owned by @invocation.
*/
get_interface_name(): string | null
/**
* Gets the #GDBusMessage for the method invocation. This is useful if
* you need to use low-level protocol features, such as UNIX file
* descriptor passing, that cannot be properly expressed in the
* #GVariant API.
*
* See this [server][gdbus-server] and [client][gdbus-unix-fd-client]
* for an example of how to use this low-level API to send and receive
* UNIX file descriptors.
* @returns #GDBusMessage. Do not free, it is owned by @invocation.
*/
get_message(): DBusMessage
/**
* Gets information about the method call, if any.
*
* If this method invocation is a property Get, Set or GetAll call that
* has been redirected to the method call handler then %NULL will be
* returned. See g_dbus_method_invocation_get_property_info() and
* #GDBusInterfaceVTable for more information.
* @returns A #GDBusMethodInfo or %NULL. Do not free, it is owned by @invocation.
*/
get_method_info(): DBusMethodInfo | null
/**
* Gets the name of the method that was invoked.
* @returns A string. Do not free, it is owned by @invocation.
*/
get_method_name(): string | null
/**
* Gets the object path the method was invoked on.
* @returns A string. Do not free, it is owned by @invocation.
*/
get_object_path(): string | null
/**
* Gets the parameters of the method invocation. If there are no input
* parameters then this will return a GVariant with 0 children rather than NULL.
* @returns A #GVariant tuple. Do not unref this because it is owned by @invocation.
*/
get_parameters(): GLib.Variant
/**
* Gets information about the property that this method call is for, if
* any.
*
* This will only be set in the case of an invocation in response to a
* property Get or Set call that has been directed to the method call
* handler for an object on account of its property_get() or
* property_set() vtable pointers being unset.
*
* See #GDBusInterfaceVTable for more information.
*
* If the call was GetAll, %NULL will be returned.
* @returns a #GDBusPropertyInfo or %NULL
*/
get_property_info(): DBusPropertyInfo | null
/**
* Gets the bus name that invoked the method.
* @returns A string. Do not free, it is owned by @invocation.
*/
get_sender(): string | null
/**
* Finishes handling a D-Bus method call by returning an error.
*
* This method will take ownership of `invocation`. See
* #GDBusInterfaceVTable for more information about the ownership of
* `invocation`.
* @param error_name A valid D-Bus error name.
* @param error_message A valid D-Bus error message.
*/
return_dbus_error(error_name: string | null, error_message: string | null): void
/**
* Like g_dbus_method_invocation_return_error() but without printf()-style formatting.
*
* This method will take ownership of `invocation`. See
* #GDBusInterfaceVTable for more information about the ownership of
* `invocation`.
* @param domain A #GQuark for the #GError error domain.
* @param code The error code.
* @param message The error message.
*/
return_error_literal(domain: GLib.Quark, code: number, message: string | null): void
/**
* Like g_dbus_method_invocation_return_error() but takes a #GError
* instead of the error domain, error code and message.
*
* This method will take ownership of `invocation`. See
* #GDBusInterfaceVTable for more information about the ownership of
* `invocation`.
* @param error A #GError.
*/
return_gerror(error: GLib.Error): void
/**
* Finishes handling a D-Bus method call by returning `parameters`.
* If the `parameters` GVariant is floating, it is consumed.
*
* It is an error if `parameters` is not of the right format: it must be a tuple
* containing the out-parameters of the D-Bus method. Even if the method has a
* single out-parameter, it must be contained in a tuple. If the method has no
* out-parameters, `parameters` may be %NULL or an empty tuple.
*
*
* ```c
* GDBusMethodInvocation *invocation = some_invocation;
* g_autofree gchar *result_string = NULL;
* g_autoptr (GError) error = NULL;
*
* result_string = calculate_result (&error);
*
* if (error != NULL)
* g_dbus_method_invocation_return_gerror (invocation, error);
* else
* g_dbus_method_invocation_return_value (invocation,
* g_variant_new ("(s)", result_string));
*
* // Do not free `invocation` here; returning a value does that
* ```
*
*
* This method will take ownership of `invocation`. See
* #GDBusInterfaceVTable for more information about the ownership of
* `invocation`.
*
* Since 2.48, if the method call requested for a reply not to be sent
* then this call will sink `parameters` and free `invocation,` but
* otherwise do nothing (as per the recommendations of the D-Bus
* specification).
* @param parameters A #GVariant tuple with out parameters for the method or %NULL if not passing any parameters.
*/
return_value(parameters: GLib.Variant | null): void
/**
* Like g_dbus_method_invocation_return_value() but also takes a #GUnixFDList.
*
* This method is only available on UNIX.
*
* This method will take ownership of `invocation`. See
* #GDBusInterfaceVTable for more information about the ownership of
* `invocation`.
* @param parameters A #GVariant tuple with out parameters for the method or %NULL if not passing any parameters.
* @param fd_list A #GUnixFDList or %NULL.
*/
return_value_with_unix_fd_list(parameters: GLib.Variant | null, fd_list: UnixFDList | null): void
// Class property signals of Gio-2.0.Gio.DBusMethodInvocation
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* Instances of the #GDBusMethodInvocation class are used when
* handling D-Bus method calls. It provides a way to asynchronously
* return results and errors.
*
* The normal way to obtain a #GDBusMethodInvocation object is to receive
* it as an argument to the handle_method_call() function in a
* #GDBusInterfaceVTable that was passed to g_dbus_connection_register_object().
* @class
*/
export class DBusMethodInvocation extends GObject.Object {
// Own properties of Gio-2.0.Gio.DBusMethodInvocation
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DBusMethodInvocation
constructor(config?: DBusMethodInvocation.ConstructorProperties)
_init(config?: DBusMethodInvocation.ConstructorProperties): void
}
export module DBusObjectManagerClient {
// Signal callback interfaces
/**
* Signal callback interface for `interface-proxy-properties-changed`
*/
export interface InterfaceProxyPropertiesChangedSignalCallback {
($obj: DBusObjectManagerClient, object_proxy: DBusObjectProxy, interface_proxy: DBusProxy, changed_properties: GLib.Variant, invalidated_properties: string[]): void
}
/**
* Signal callback interface for `interface-proxy-signal`
*/
export interface InterfaceProxySignalSignalCallback {
($obj: DBusObjectManagerClient, object_proxy: DBusObjectProxy, interface_proxy: DBusProxy, sender_name: string | null, signal_name: string | null, parameters: GLib.Variant): void
}
// Constructor properties interface
export interface ConstructorProperties extends AsyncInitable.ConstructorProperties, DBusObjectManager.ConstructorProperties, Initable.ConstructorProperties, GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.DBusObjectManagerClient
/**
* If this property is not %G_BUS_TYPE_NONE, then
* #GDBusObjectManagerClient:connection must be %NULL and will be set to the
* #GDBusConnection obtained by calling g_bus_get() with the value
* of this property.
*/
bus_type?: BusType | null
/**
* The #GDBusConnection to use.
*/
connection?: DBusConnection | null
/**
* Flags from the #GDBusObjectManagerClientFlags enumeration.
*/
flags?: DBusObjectManagerClientFlags | null
/**
* A #GDestroyNotify for the #gpointer user_data in #GDBusObjectManagerClient:get-proxy-type-user-data.
*/
get_proxy_type_destroy_notify?: any | null
/**
* The #GDBusProxyTypeFunc to use when determining what #GType to
* use for interface proxies or %NULL.
*/
get_proxy_type_func?: any | null
/**
* The #gpointer user_data to pass to #GDBusObjectManagerClient:get-proxy-type-func.
*/
get_proxy_type_user_data?: any | null
/**
* The well-known name or unique name that the manager is for.
*/
name?: string | null
/**
* The object path the manager is for.
*/
object_path?: string | null
}
}
export interface DBusObjectManagerClient extends AsyncInitable, DBusObjectManager, Initable {
// Own properties of Gio-2.0.Gio.DBusObjectManagerClient
/**
* If this property is not %G_BUS_TYPE_NONE, then
* #GDBusObjectManagerClient:connection must be %NULL and will be set to the
* #GDBusConnection obtained by calling g_bus_get() with the value
* of this property.
*/
readonly bus_type: BusType
/**
* The #GDBusConnection to use.
*/
readonly connection: DBusConnection
/**
* Flags from the #GDBusObjectManagerClientFlags enumeration.
*/
readonly flags: DBusObjectManagerClientFlags
/**
* A #GDestroyNotify for the #gpointer user_data in #GDBusObjectManagerClient:get-proxy-type-user-data.
*/
readonly get_proxy_type_destroy_notify: any
/**
* The #GDBusProxyTypeFunc to use when determining what #GType to
* use for interface proxies or %NULL.
*/
readonly get_proxy_type_func: any
/**
* The #gpointer user_data to pass to #GDBusObjectManagerClient:get-proxy-type-func.
*/
readonly get_proxy_type_user_data: any
/**
* The well-known name or unique name that the manager is for.
*/
readonly name: string | null
/**
* The unique name that owns #GDBusObjectManagerClient:name or %NULL if
* no-one is currently owning the name. Connect to the
* #GObject::notify signal to track changes to this property.
*/
readonly name_owner: string | null
/**
* The object path the manager is for.
*/
readonly object_path: string | null
// Owm methods of Gio-2.0.Gio.DBusObjectManagerClient
/**
* Gets the #GDBusConnection used by `manager`.
* @returns A #GDBusConnection object. Do not free, the object belongs to @manager.
*/
get_connection(): DBusConnection
/**
* Gets the flags that `manager` was constructed with.
* @returns Zero of more flags from the #GDBusObjectManagerClientFlags enumeration.
*/
get_flags(): DBusObjectManagerClientFlags
/**
* Gets the name that `manager` is for, or %NULL if not a message bus
* connection.
* @returns A unique or well-known name. Do not free, the string belongs to @manager.
*/
get_name(): string | null
/**
* The unique name that owns the name that `manager` is for or %NULL if
* no-one currently owns that name. You can connect to the
* #GObject::notify signal to track changes to the
* #GDBusObjectManagerClient:name-owner property.
* @returns The name owner or %NULL if no name owner exists. Free with g_free().
*/
get_name_owner(): string | null
// Own virtual methods of Gio-2.0.Gio.DBusObjectManagerClient
vfunc_interface_proxy_properties_changed(object_proxy: DBusObjectProxy, interface_proxy: DBusProxy, changed_properties: GLib.Variant, invalidated_properties: string | null): void
vfunc_interface_proxy_signal(object_proxy: DBusObjectProxy, interface_proxy: DBusProxy, sender_name: string | null, signal_name: string | null, parameters: GLib.Variant): void
// Own signals of Gio-2.0.Gio.DBusObjectManagerClient
connect(sigName: "interface-proxy-properties-changed", callback: DBusObjectManagerClient.InterfaceProxyPropertiesChangedSignalCallback): number
connect_after(sigName: "interface-proxy-properties-changed", callback: DBusObjectManagerClient.InterfaceProxyPropertiesChangedSignalCallback): number
emit(sigName: "interface-proxy-properties-changed", object_proxy: DBusObjectProxy, interface_proxy: DBusProxy, changed_properties: GLib.Variant, invalidated_properties: string[], ...args: any[]): void
connect(sigName: "interface-proxy-signal", callback: DBusObjectManagerClient.InterfaceProxySignalSignalCallback): number
connect_after(sigName: "interface-proxy-signal", callback: DBusObjectManagerClient.InterfaceProxySignalSignalCallback): number
emit(sigName: "interface-proxy-signal", object_proxy: DBusObjectProxy, interface_proxy: DBusProxy, sender_name: string | null, signal_name: string | null, parameters: GLib.Variant, ...args: any[]): void
// Class property signals of Gio-2.0.Gio.DBusObjectManagerClient
connect(sigName: "notify::bus-type", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::bus-type", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::bus-type", ...args: any[]): void
connect(sigName: "notify::connection", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::connection", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::connection", ...args: any[]): void
connect(sigName: "notify::flags", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::flags", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::flags", ...args: any[]): void
connect(sigName: "notify::get-proxy-type-destroy-notify", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::get-proxy-type-destroy-notify", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::get-proxy-type-destroy-notify", ...args: any[]): void
connect(sigName: "notify::get-proxy-type-func", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::get-proxy-type-func", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::get-proxy-type-func", ...args: any[]): void
connect(sigName: "notify::get-proxy-type-user-data", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::get-proxy-type-user-data", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::get-proxy-type-user-data", ...args: any[]): void
connect(sigName: "notify::name", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::name", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::name", ...args: any[]): void
connect(sigName: "notify::name-owner", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::name-owner", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::name-owner", ...args: any[]): void
connect(sigName: "notify::object-path", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::object-path", callback: (($obj: DBusObjectManagerClient, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::object-path", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GDBusObjectManagerClient is used to create, monitor and delete object
* proxies for remote objects exported by a #GDBusObjectManagerServer (or any
* code implementing the
* [org.freedesktop.DBus.ObjectManager](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager)
* interface).
*
* Once an instance of this type has been created, you can connect to
* the #GDBusObjectManager::object-added and
* #GDBusObjectManager::object-removed signals and inspect the
* #GDBusObjectProxy objects returned by
* g_dbus_object_manager_get_objects().
*
* If the name for a #GDBusObjectManagerClient is not owned by anyone at
* object construction time, the default behavior is to request the
* message bus to launch an owner for the name. This behavior can be
* disabled using the %G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START
* flag. It's also worth noting that this only works if the name of
* interest is activatable in the first place. E.g. in some cases it
* is not possible to launch an owner for the requested name. In this
* case, #GDBusObjectManagerClient object construction still succeeds but
* there will be no object proxies
* (e.g. g_dbus_object_manager_get_objects() returns the empty list) and
* the #GDBusObjectManagerClient:name-owner property is %NULL.
*
* The owner of the requested name can come and go (for example
* consider a system service being restarted) – #GDBusObjectManagerClient
* handles this case too; simply connect to the #GObject::notify
* signal to watch for changes on the #GDBusObjectManagerClient:name-owner
* property. When the name owner vanishes, the behavior is that
* #GDBusObjectManagerClient:name-owner is set to %NULL (this includes
* emission of the #GObject::notify signal) and then
* #GDBusObjectManager::object-removed signals are synthesized
* for all currently existing object proxies. Since
* #GDBusObjectManagerClient:name-owner is %NULL when this happens, you can
* use this information to disambiguate a synthesized signal from a
* genuine signal caused by object removal on the remote
* #GDBusObjectManager. Similarly, when a new name owner appears,
* #GDBusObjectManager::object-added signals are synthesized
* while #GDBusObjectManagerClient:name-owner is still %NULL. Only when all
* object proxies have been added, the #GDBusObjectManagerClient:name-owner
* is set to the new name owner (this includes emission of the
* #GObject::notify signal). Furthermore, you are guaranteed that
* #GDBusObjectManagerClient:name-owner will alternate between a name owner
* (e.g. `:1.42`) and %NULL even in the case where
* the name of interest is atomically replaced
*
* Ultimately, #GDBusObjectManagerClient is used to obtain #GDBusProxy
* instances. All signals (including the
* org.freedesktop.DBus.Properties::PropertiesChanged signal)
* delivered to #GDBusProxy instances are guaranteed to originate
* from the name owner. This guarantee along with the behavior
* described above, means that certain race conditions including the
* "half the proxy is from the old owner and the other half is from
* the new owner" problem cannot happen.
*
* To avoid having the application connect to signals on the returned
* #GDBusObjectProxy and #GDBusProxy objects, the
* #GDBusObject::interface-added,
* #GDBusObject::interface-removed,
* #GDBusProxy::g-properties-changed and
* #GDBusProxy::g-signal signals
* are also emitted on the #GDBusObjectManagerClient instance managing these
* objects. The signals emitted are
* #GDBusObjectManager::interface-added,
* #GDBusObjectManager::interface-removed,
* #GDBusObjectManagerClient::interface-proxy-properties-changed and
* #GDBusObjectManagerClient::interface-proxy-signal.
*
* Note that all callbacks and signals are emitted in the
* [thread-default main context][g-main-context-push-thread-default]
* that the #GDBusObjectManagerClient object was constructed
* in. Additionally, the #GDBusObjectProxy and #GDBusProxy objects
* originating from the #GDBusObjectManagerClient object will be created in
* the same context and, consequently, will deliver signals in the
* same main loop.
* @class
*/
export class DBusObjectManagerClient extends GObject.Object {
// Own properties of Gio-2.0.Gio.DBusObjectManagerClient
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DBusObjectManagerClient
constructor(config?: DBusObjectManagerClient.ConstructorProperties)
/**
* Finishes an operation started with g_dbus_object_manager_client_new().
* @constructor
* @param res A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_object_manager_client_new().
* @returns A #GDBusObjectManagerClient object or %NULL if @error is set. Free with g_object_unref().
*/
static new_finish(res: AsyncResult): DBusObjectManagerClient
/**
* Finishes an operation started with g_dbus_object_manager_client_new_for_bus().
* @constructor
* @param res A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_object_manager_client_new_for_bus().
* @returns A #GDBusObjectManagerClient object or %NULL if @error is set. Free with g_object_unref().
*/
static new_for_bus_finish(res: AsyncResult): DBusObjectManagerClient
/**
* Like g_dbus_object_manager_client_new_sync() but takes a #GBusType instead
* of a #GDBusConnection.
*
* This is a synchronous failable constructor - the calling thread is
* blocked until a reply is received. See g_dbus_object_manager_client_new_for_bus()
* for the asynchronous version.
* @constructor
* @param bus_type A #GBusType.
* @param flags Zero or more flags from the #GDBusObjectManagerClientFlags enumeration.
* @param name The owner of the control object (unique or well-known name).
* @param object_path The object path of the control object.
* @param get_proxy_type_func A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
* @param cancellable A #GCancellable or %NULL
* @returns A #GDBusObjectManagerClient object or %NULL if @error is set. Free with g_object_unref().
*/
static new_for_bus_sync(bus_type: BusType, flags: DBusObjectManagerClientFlags, name: string | null, object_path: string | null, get_proxy_type_func: DBusProxyTypeFunc | null, cancellable: Cancellable | null): DBusObjectManagerClient
/**
* Creates a new #GDBusObjectManagerClient object.
*
* This is a synchronous failable constructor - the calling thread is
* blocked until a reply is received. See g_dbus_object_manager_client_new()
* for the asynchronous version.
* @constructor
* @param connection A #GDBusConnection.
* @param flags Zero or more flags from the #GDBusObjectManagerClientFlags enumeration.
* @param name The owner of the control object (unique or well-known name), or %NULL when not using a message bus connection.
* @param object_path The object path of the control object.
* @param get_proxy_type_func A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
* @param cancellable A #GCancellable or %NULL
* @returns A #GDBusObjectManagerClient object or %NULL if @error is set. Free with g_object_unref().
*/
static new_sync(connection: DBusConnection, flags: DBusObjectManagerClientFlags, name: string | null, object_path: string | null, get_proxy_type_func: DBusProxyTypeFunc | null, cancellable: Cancellable | null): DBusObjectManagerClient
_init(config?: DBusObjectManagerClient.ConstructorProperties): void
/**
* Asynchronously creates a new #GDBusObjectManagerClient object.
*
* This is an asynchronous failable constructor. When the result is
* ready, `callback` will be invoked in the
* [thread-default main context][g-main-context-push-thread-default]
* of the thread you are calling this method from. You can
* then call g_dbus_object_manager_client_new_finish() to get the result. See
* g_dbus_object_manager_client_new_sync() for the synchronous version.
* @param connection A #GDBusConnection.
* @param flags Zero or more flags from the #GDBusObjectManagerClientFlags enumeration.
* @param name The owner of the control object (unique or well-known name).
* @param object_path The object path of the control object.
* @param get_proxy_type_func A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
* @param cancellable A #GCancellable or %NULL
* @param callback A #GAsyncReadyCallback to call when the request is satisfied.
*/
static new(connection: DBusConnection, flags: DBusObjectManagerClientFlags, name: string | null, object_path: string | null, get_proxy_type_func: DBusProxyTypeFunc | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Like g_dbus_object_manager_client_new() but takes a #GBusType instead of a
* #GDBusConnection.
*
* This is an asynchronous failable constructor. When the result is
* ready, `callback` will be invoked in the
* [thread-default main loop][g-main-context-push-thread-default]
* of the thread you are calling this method from. You can
* then call g_dbus_object_manager_client_new_for_bus_finish() to get the result. See
* g_dbus_object_manager_client_new_for_bus_sync() for the synchronous version.
* @param bus_type A #GBusType.
* @param flags Zero or more flags from the #GDBusObjectManagerClientFlags enumeration.
* @param name The owner of the control object (unique or well-known name).
* @param object_path The object path of the control object.
* @param get_proxy_type_func A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
* @param cancellable A #GCancellable or %NULL
* @param callback A #GAsyncReadyCallback to call when the request is satisfied.
*/
static new_for_bus(bus_type: BusType, flags: DBusObjectManagerClientFlags, name: string | null, object_path: string | null, get_proxy_type_func: DBusProxyTypeFunc | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
}
export module DBusObjectManagerServer {
// Constructor properties interface
export interface ConstructorProperties extends DBusObjectManager.ConstructorProperties, GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.DBusObjectManagerServer
/**
* The #GDBusConnection to export objects on.
*/
connection?: DBusConnection | null
/**
* The object path to register the manager object at.
*/
object_path?: string | null
}
}
export interface DBusObjectManagerServer extends DBusObjectManager {
// Own properties of Gio-2.0.Gio.DBusObjectManagerServer
/**
* The #GDBusConnection to export objects on.
*/
connection: DBusConnection
/**
* The object path to register the manager object at.
*/
readonly object_path: string | null
// Owm methods of Gio-2.0.Gio.DBusObjectManagerServer
/**
* Exports `object` on `manager`.
*
* If there is already a #GDBusObject exported at the object path,
* then the old object is removed.
*
* The object path for `object` must be in the hierarchy rooted by the
* object path for `manager`.
*
* Note that `manager` will take a reference on `object` for as long as
* it is exported.
* @param object A #GDBusObjectSkeleton.
*/
export(object: DBusObjectSkeleton): void
/**
* Like g_dbus_object_manager_server_export() but appends a string of
* the form _N (with N being a natural number) to `object'`s object path
* if an object with the given path already exists. As such, the
* #GDBusObjectProxy:g-object-path property of `object` may be modified.
* @param object An object.
*/
export_uniquely(object: DBusObjectSkeleton): void
/**
* Gets the #GDBusConnection used by `manager`.
* @returns A #GDBusConnection object or %NULL if @manager isn't exported on a connection. The returned object should be freed with g_object_unref().
*/
get_connection(): DBusConnection | null
/**
* Returns whether `object` is currently exported on `manager`.
* @param object An object.
* @returns %TRUE if @object is exported
*/
is_exported(object: DBusObjectSkeleton): boolean
/**
* Exports all objects managed by `manager` on `connection`. If
* `connection` is %NULL, stops exporting objects.
* @param connection A #GDBusConnection or %NULL.
*/
set_connection(connection: DBusConnection | null): void
/**
* If `manager` has an object at `path,` removes the object. Otherwise
* does nothing.
*
* Note that `object_path` must be in the hierarchy rooted by the
* object path for `manager`.
* @param object_path An object path.
* @returns %TRUE if object at @object_path was removed, %FALSE otherwise.
*/
unexport(object_path: string | null): boolean
// Class property signals of Gio-2.0.Gio.DBusObjectManagerServer
connect(sigName: "notify::connection", callback: (($obj: DBusObjectManagerServer, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::connection", callback: (($obj: DBusObjectManagerServer, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::connection", ...args: any[]): void
connect(sigName: "notify::object-path", callback: (($obj: DBusObjectManagerServer, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::object-path", callback: (($obj: DBusObjectManagerServer, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::object-path", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GDBusObjectManagerServer is used to export #GDBusObject instances using
* the standardized
* [org.freedesktop.DBus.ObjectManager](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager)
* interface. For example, remote D-Bus clients can get all objects
* and properties in a single call. Additionally, any change in the
* object hierarchy is broadcast using signals. This means that D-Bus
* clients can keep caches up to date by only listening to D-Bus
* signals.
*
* The recommended path to export an object manager at is the path form of the
* well-known name of a D-Bus service, or below. For example, if a D-Bus service
* is available at the well-known name `net.example.ExampleService1`, the object
* manager should typically be exported at `/net/example/ExampleService1`, or
* below (to allow for multiple object managers in a service).
*
* It is supported, but not recommended, to export an object manager at the root
* path, `/`.
*
* See #GDBusObjectManagerClient for the client-side code that is
* intended to be used with #GDBusObjectManagerServer or any D-Bus
* object implementing the org.freedesktop.DBus.ObjectManager
* interface.
* @class
*/
export class DBusObjectManagerServer extends GObject.Object {
// Own properties of Gio-2.0.Gio.DBusObjectManagerServer
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DBusObjectManagerServer
constructor(config?: DBusObjectManagerServer.ConstructorProperties)
/**
* Creates a new #GDBusObjectManagerServer object.
*
* The returned server isn't yet exported on any connection. To do so,
* use g_dbus_object_manager_server_set_connection(). Normally you
* want to export all of your objects before doing so to avoid
* [InterfacesAdded](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager)
* signals being emitted.
* @constructor
* @param object_path The object path to export the manager object at.
* @returns A #GDBusObjectManagerServer object. Free with g_object_unref().
*/
constructor(object_path: string | null)
/**
* Creates a new #GDBusObjectManagerServer object.
*
* The returned server isn't yet exported on any connection. To do so,
* use g_dbus_object_manager_server_set_connection(). Normally you
* want to export all of your objects before doing so to avoid
* [InterfacesAdded](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager)
* signals being emitted.
* @constructor
* @param object_path The object path to export the manager object at.
* @returns A #GDBusObjectManagerServer object. Free with g_object_unref().
*/
static new(object_path: string | null): DBusObjectManagerServer
_init(config?: DBusObjectManagerServer.ConstructorProperties): void
}
export module DBusObjectProxy {
// Constructor properties interface
export interface ConstructorProperties extends DBusObject.ConstructorProperties, GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.DBusObjectProxy
/**
* The connection of the proxy.
*/
g_connection?: DBusConnection | null
/**
* The object path of the proxy.
*/
g_object_path?: string | null
}
}
export interface DBusObjectProxy extends DBusObject {
// Own properties of Gio-2.0.Gio.DBusObjectProxy
/**
* The connection of the proxy.
*/
readonly g_connection: DBusConnection
/**
* The object path of the proxy.
*/
readonly g_object_path: string | null
// Owm methods of Gio-2.0.Gio.DBusObjectProxy
/**
* Gets the connection that `proxy` is for.
* @returns A #GDBusConnection. Do not free, the object is owned by @proxy.
*/
get_connection(): DBusConnection
// Class property signals of Gio-2.0.Gio.DBusObjectProxy
connect(sigName: "notify::g-connection", callback: (($obj: DBusObjectProxy, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::g-connection", callback: (($obj: DBusObjectProxy, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::g-connection", ...args: any[]): void
connect(sigName: "notify::g-object-path", callback: (($obj: DBusObjectProxy, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::g-object-path", callback: (($obj: DBusObjectProxy, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::g-object-path", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* A #GDBusObjectProxy is an object used to represent a remote object
* with one or more D-Bus interfaces. Normally, you don't instantiate
* a #GDBusObjectProxy yourself - typically #GDBusObjectManagerClient
* is used to obtain it.
* @class
*/
export class DBusObjectProxy extends GObject.Object {
// Own properties of Gio-2.0.Gio.DBusObjectProxy
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DBusObjectProxy
constructor(config?: DBusObjectProxy.ConstructorProperties)
/**
* Creates a new #GDBusObjectProxy for the given connection and
* object path.
* @constructor
* @param connection a #GDBusConnection
* @param object_path the object path
* @returns a new #GDBusObjectProxy
*/
constructor(connection: DBusConnection, object_path: string | null)
/**
* Creates a new #GDBusObjectProxy for the given connection and
* object path.
* @constructor
* @param connection a #GDBusConnection
* @param object_path the object path
* @returns a new #GDBusObjectProxy
*/
static new(connection: DBusConnection, object_path: string | null): DBusObjectProxy
_init(config?: DBusObjectProxy.ConstructorProperties): void
}
export module DBusObjectSkeleton {
// Signal callback interfaces
/**
* Signal callback interface for `authorize-method`
*/
export interface AuthorizeMethodSignalCallback {
($obj: DBusObjectSkeleton, interface: DBusInterfaceSkeleton, invocation: DBusMethodInvocation): boolean
}
// Constructor properties interface
export interface ConstructorProperties extends DBusObject.ConstructorProperties, GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.DBusObjectSkeleton
/**
* The object path where the object is exported.
*/
g_object_path?: string | null
}
}
export interface DBusObjectSkeleton extends DBusObject {
// Own properties of Gio-2.0.Gio.DBusObjectSkeleton
/**
* The object path where the object is exported.
*/
g_object_path: string | null
// Owm methods of Gio-2.0.Gio.DBusObjectSkeleton
/**
* Adds `interface_` to `object`.
*
* If `object` already contains a #GDBusInterfaceSkeleton with the same
* interface name, it is removed before `interface_` is added.
*
* Note that `object` takes its own reference on `interface_` and holds
* it until removed.
* @param interface_ A #GDBusInterfaceSkeleton.
*/
add_interface(interface_: DBusInterfaceSkeleton): void
/**
* This method simply calls g_dbus_interface_skeleton_flush() on all
* interfaces belonging to `object`. See that method for when flushing
* is useful.
*/
flush(): void
/**
* Removes `interface_` from `object`.
* @param interface_ A #GDBusInterfaceSkeleton.
*/
remove_interface(interface_: DBusInterfaceSkeleton): void
/**
* Removes the #GDBusInterface with `interface_name` from `object`.
*
* If no D-Bus interface of the given interface exists, this function
* does nothing.
* @param interface_name A D-Bus interface name.
*/
remove_interface_by_name(interface_name: string | null): void
/**
* Sets the object path for `object`.
* @param object_path A valid D-Bus object path.
*/
set_object_path(object_path: string | null): void
// Own virtual methods of Gio-2.0.Gio.DBusObjectSkeleton
vfunc_authorize_method(interface_: DBusInterfaceSkeleton, invocation: DBusMethodInvocation): boolean
// Own signals of Gio-2.0.Gio.DBusObjectSkeleton
connect(sigName: "authorize-method", callback: DBusObjectSkeleton.AuthorizeMethodSignalCallback): number
connect_after(sigName: "authorize-method", callback: DBusObjectSkeleton.AuthorizeMethodSignalCallback): number
emit(sigName: "authorize-method", interface: DBusInterfaceSkeleton, invocation: DBusMethodInvocation, ...args: any[]): void
// Class property signals of Gio-2.0.Gio.DBusObjectSkeleton
connect(sigName: "notify::g-object-path", callback: (($obj: DBusObjectSkeleton, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::g-object-path", callback: (($obj: DBusObjectSkeleton, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::g-object-path", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* A #GDBusObjectSkeleton instance is essentially a group of D-Bus
* interfaces. The set of exported interfaces on the object may be
* dynamic and change at runtime.
*
* This type is intended to be used with #GDBusObjectManager.
* @class
*/
export class DBusObjectSkeleton extends GObject.Object {
// Own properties of Gio-2.0.Gio.DBusObjectSkeleton
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DBusObjectSkeleton
constructor(config?: DBusObjectSkeleton.ConstructorProperties)
/**
* Creates a new #GDBusObjectSkeleton.
* @constructor
* @param object_path An object path.
* @returns A #GDBusObjectSkeleton. Free with g_object_unref().
*/
constructor(object_path: string | null)
/**
* Creates a new #GDBusObjectSkeleton.
* @constructor
* @param object_path An object path.
* @returns A #GDBusObjectSkeleton. Free with g_object_unref().
*/
static new(object_path: string | null): DBusObjectSkeleton
_init(config?: DBusObjectSkeleton.ConstructorProperties): void
}
export module DBusProxy {
// Signal callback interfaces
/**
* Signal callback interface for `g-properties-changed`
*/
export interface GPropertiesChangedSignalCallback {
($obj: DBusProxy, changed_properties: GLib.Variant, invalidated_properties: string[]): void
}
/**
* Signal callback interface for `g-signal`
*/
export interface GSignalSignalCallback {
($obj: DBusProxy, sender_name: string | null, signal_name: string | null, parameters: GLib.Variant): void
}
// Constructor properties interface
export interface ConstructorProperties extends AsyncInitable.ConstructorProperties, DBusInterface.ConstructorProperties, Initable.ConstructorProperties, GObject.Object.ConstructorProperties {
// Own constructor properties of Gio-2.0.Gio.DBusProxy
/**
* If this property is not %G_BUS_TYPE_NONE, then
* #GDBusProxy:g-connection must be %NULL and will be set to the
* #GDBusConnection obtained by calling g_bus_get() with the value
* of this property.
*/
g_bus_type?: BusType | null
/**
* The #GDBusConnection the proxy is for.
*/
g_connection?: DBusConnection | null
/**
* The timeout to use if -1 (specifying default timeout) is passed
* as `timeout_msec` in the g_dbus_proxy_call() and
* g_dbus_proxy_call_sync() functions.
*
* This allows applications to set a proxy-wide timeout for all
* remote method invocations on the proxy. If this property is -1,
* the default timeout (typically 25 seconds) is used. If set to
* %G_MAXINT, then no timeout is used.
*/
g_default_timeout?: number | null
/**
* Flags from the #GDBusProxyFlags enumeration.
*/
g_flags?: DBusProxyFlags | null
/**
* Ensure that interactions with this proxy conform to the given
* interface. This is mainly to ensure that malformed data received
* from the other peer is ignored. The given #GDBusInterfaceInfo is
* said to be the "expected interface".
*
* The checks performed are:
* - When completing a method call, if the type signature of
* the reply message isn't what's expected, the reply is
* discarded and the #GError is set to %G_IO_ERROR_INVALID_ARGUMENT.
*
* - Received signals that have a type signature mismatch are dropped and
* a warning is logged via g_warning().
*
* - Properties received via the initial `GetAll()` call or via the
* `::PropertiesChanged` signal (on the
* [org.freedesktop.DBus.Properties](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties)
* interface) or set using g_dbus_proxy_set_cached_property()
* with a type signature mismatch are ignored and a warning is
* logged via g_warning().
*
* Note that these checks are never done on methods, signals and
* properties that are not referenced in the given
* #GDBusInterfaceInfo, since extending a D-Bus interface on the
* service-side is not considered an ABI break.
*/
g_interface_info?: DBusInterfaceInfo | null
/**
* The D-Bus interface name the proxy is for.
*/
g_interface_name?: string | null
/**
* The well-known or unique name that the proxy is for.
*/
g_name?: string | null
/**
* The object path the proxy is for.
*/
g_object_path?: string | null
}
}
export interface DBusProxy extends AsyncInitable, DBusInterface, Initable {
// Own properties of Gio-2.0.Gio.DBusProxy
/**
* If this property is not %G_BUS_TYPE_NONE, then
* #GDBusProxy:g-connection must be %NULL and will be set to the
* #GDBusConnection obtained by calling g_bus_get() with the value
* of this property.
*/
readonly g_bus_type: BusType
/**
* The #GDBusConnection the proxy is for.
*/
readonly g_connection: DBusConnection
/**
* The timeout to use if -1 (specifying default timeout) is passed
* as `timeout_msec` in the g_dbus_proxy_call() and
* g_dbus_proxy_call_sync() functions.
*
* This allows applications to set a proxy-wide timeout for all
* remote method invocations on the proxy. If this property is -1,
* the default timeout (typically 25 seconds) is used. If set to
* %G_MAXINT, then no timeout is used.
*/
g_default_timeout: number
/**
* Flags from the #GDBusProxyFlags enumeration.
*/
readonly g_flags: DBusProxyFlags
/**
* Ensure that interactions with this proxy conform to the given
* interface. This is mainly to ensure that malformed data received
* from the other peer is ignored. The given #GDBusInterfaceInfo is
* said to be the "expected interface".
*
* The checks performed are:
* - When completing a method call, if the type signature of
* the reply message isn't what's expected, the reply is
* discarded and the #GError is set to %G_IO_ERROR_INVALID_ARGUMENT.
*
* - Received signals that have a type signature mismatch are dropped and
* a warning is logged via g_warning().
*
* - Properties received via the initial `GetAll()` call or via the
* `::PropertiesChanged` signal (on the
* [org.freedesktop.DBus.Properties](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties)
* interface) or set using g_dbus_proxy_set_cached_property()
* with a type signature mismatch are ignored and a warning is
* logged via g_warning().
*
* Note that these checks are never done on methods, signals and
* properties that are not referenced in the given
* #GDBusInterfaceInfo, since extending a D-Bus interface on the
* service-side is not considered an ABI break.
*/
g_interface_info: DBusInterfaceInfo
/**
* The D-Bus interface name the proxy is for.
*/
readonly g_interface_name: string | null
/**
* The well-known or unique name that the proxy is for.
*/
readonly g_name: string | null
/**
* The unique name that owns #GDBusProxy:g-name or %NULL if no-one
* currently owns that name. You may connect to #GObject::notify signal to
* track changes to this property.
*/
readonly g_name_owner: string | null
/**
* The object path the proxy is for.
*/
readonly g_object_path: string | null
// Owm methods of Gio-2.0.Gio.DBusProxy
/**
* Asynchronously invokes the `method_name` method on `proxy`.
*
* If `method_name` contains any dots, then `name` is split into interface and
* method name parts. This allows using `proxy` for invoking methods on
* other interfaces.
*
* If the #GDBusConnection associated with `proxy` is closed then
* the operation will fail with %G_IO_ERROR_CLOSED. If
* `cancellable` is canceled, the operation will fail with
* %G_IO_ERROR_CANCELLED. If `parameters` contains a value not
* compatible with the D-Bus protocol, the operation fails with
* %G_IO_ERROR_INVALID_ARGUMENT.
*
* If the `parameters` #GVariant is floating, it is consumed. This allows
* convenient 'inline' use of g_variant_new(), e.g.:
*
* ```c
* g_dbus_proxy_call (proxy,
* "TwoStrings",
* g_variant_new ("(ss)",
* "Thing One",
* "Thing Two"),
* G_DBUS_CALL_FLAGS_NONE,
* -1,
* NULL,
* (GAsyncReadyCallback) two_strings_done,
* &data);
* ```
*
*
* If `proxy` has an expected interface (see
* #GDBusProxy:g-interface-info) and `method_name` is referenced by it,
* then the return value is checked against the return type.
*
* This is an asynchronous method. When the operation is finished,
* `callback` will be invoked in the
* [thread-default main context][g-main-context-push-thread-default]
* of the thread you are calling this method from.
* You can then call g_dbus_proxy_call_finish() to get the result of
* the operation. See g_dbus_proxy_call_sync() for the synchronous
* version of this method.
*
* If `callback` is %NULL then the D-Bus method call message will be sent with
* the %G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED flag set.
* @param method_name Name of method to invoke.
* @param parameters A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
* @param flags Flags from the #GDBusCallFlags enumeration.
* @param timeout_msec The timeout in milliseconds (with %G_MAXINT meaning "infinite") or -1 to use the proxy default timeout.
* @param cancellable A #GCancellable or %NULL.
* @param callback A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't care about the result of the method invocation.
*/
call(method_name: string | null, parameters: GLib.Variant | null, flags: DBusCallFlags, timeout_msec: number, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an operation started with g_dbus_proxy_call().
* @param res A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_proxy_call().
* @returns %NULL if @error is set. Otherwise a #GVariant tuple with return values. Free with g_variant_unref().
*/
call_finish(res: AsyncResult): GLib.Variant
/**
* Synchronously invokes the `method_name` method on `proxy`.
*
* If `method_name` contains any dots, then `name` is split into interface and
* method name parts. This allows using `proxy` for invoking methods on
* other interfaces.
*
* If the #GDBusConnection associated with `proxy` is disconnected then
* the operation will fail with %G_IO_ERROR_CLOSED. If
* `cancellable` is canceled, the operation will fail with
* %G_IO_ERROR_CANCELLED. If `parameters` contains a value not
* compatible with the D-Bus protocol, the operation fails with
* %G_IO_ERROR_INVALID_ARGUMENT.
*
* If the `parameters` #GVariant is floating, it is consumed. This allows
* convenient 'inline' use of g_variant_new(), e.g.:
*
* ```c
* g_dbus_proxy_call_sync (proxy,
* "TwoStrings",
* g_variant_new ("(ss)",
* "Thing One",
* "Thing Two"),
* G_DBUS_CALL_FLAGS_NONE,
* -1,
* NULL,
* &error);
* ```
*
*
* The calling thread is blocked until a reply is received. See
* g_dbus_proxy_call() for the asynchronous version of this
* method.
*
* If `proxy` has an expected interface (see
* #GDBusProxy:g-interface-info) and `method_name` is referenced by it,
* then the return value is checked against the return type.
* @param method_name Name of method to invoke.
* @param parameters A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
* @param flags Flags from the #GDBusCallFlags enumeration.
* @param timeout_msec The timeout in milliseconds (with %G_MAXINT meaning "infinite") or -1 to use the proxy default timeout.
* @param cancellable A #GCancellable or %NULL.
* @returns %NULL if @error is set. Otherwise a #GVariant tuple with return values. Free with g_variant_unref().
*/
call_sync(method_name: string | null, parameters: GLib.Variant | null, flags: DBusCallFlags, timeout_msec: number, cancellable: Cancellable | null): GLib.Variant
/**
* Like g_dbus_proxy_call() but also takes a #GUnixFDList object.
*
* This method is only available on UNIX.
* @param method_name Name of method to invoke.
* @param parameters A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
* @param flags Flags from the #GDBusCallFlags enumeration.
* @param timeout_msec The timeout in milliseconds (with %G_MAXINT meaning "infinite") or -1 to use the proxy default timeout.
* @param fd_list A #GUnixFDList or %NULL.
* @param cancellable A #GCancellable or %NULL.
* @param callback A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't care about the result of the method invocation.
*/
call_with_unix_fd_list(method_name: string | null, parameters: GLib.Variant | null, flags: DBusCallFlags, timeout_msec: number, fd_list: UnixFDList | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Finishes an operation started with g_dbus_proxy_call_with_unix_fd_list().
* @param res A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_proxy_call_with_unix_fd_list().
* @returns %NULL if @error is set. Otherwise a #GVariant tuple with return values. Free with g_variant_unref().
*/
call_with_unix_fd_list_finish(res: AsyncResult): [ /* returnType */ GLib.Variant, /* out_fd_list */ UnixFDList ]
/**
* Like g_dbus_proxy_call_sync() but also takes and returns #GUnixFDList objects.
*
* This method is only available on UNIX.
* @param method_name Name of method to invoke.
* @param parameters A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
* @param flags Flags from the #GDBusCallFlags enumeration.
* @param timeout_msec The timeout in milliseconds (with %G_MAXINT meaning "infinite") or -1 to use the proxy default timeout.
* @param fd_list A #GUnixFDList or %NULL.
* @param cancellable A #GCancellable or %NULL.
* @returns %NULL if @error is set. Otherwise a #GVariant tuple with return values. Free with g_variant_unref().
*/
call_with_unix_fd_list_sync(method_name: string | null, parameters: GLib.Variant | null, flags: DBusCallFlags, timeout_msec: number, fd_list: UnixFDList | null, cancellable: Cancellable | null): [ /* returnType */ GLib.Variant, /* out_fd_list */ UnixFDList ]
/**
* Looks up the value for a property from the cache. This call does no
* blocking IO.
*
* If `proxy` has an expected interface (see
* #GDBusProxy:g-interface-info) and `property_name` is referenced by
* it, then `value` is checked against the type of the property.
* @param property_name Property name.
* @returns A reference to the #GVariant instance that holds the value for @property_name or %NULL if the value is not in the cache. The returned reference must be freed with g_variant_unref().
*/
get_cached_property(property_name: string | null): GLib.Variant | null
/**
* Gets the names of all cached properties on `proxy`.
* @returns A %NULL-terminated array of strings or %NULL if @proxy has no cached properties. Free the returned array with g_strfreev().
*/
get_cached_property_names(): string[] | null
/**
* Gets the connection `proxy` is for.
* @returns A #GDBusConnection owned by @proxy. Do not free.
*/
get_connection(): DBusConnection
/**
* Gets the timeout to use if -1 (specifying default timeout) is
* passed as `timeout_msec` in the g_dbus_proxy_call() and
* g_dbus_proxy_call_sync() functions.
*
* See the #GDBusProxy:g-default-timeout property for more details.
* @returns Timeout to use for @proxy.
*/
get_default_timeout(): number
/**
* Gets the flags that `proxy` was constructed with.
* @returns Flags from the #GDBusProxyFlags enumeration.
*/
get_flags(): DBusProxyFlags
/**
* Returns the #GDBusInterfaceInfo, if any, specifying the interface
* that `proxy` conforms to. See the #GDBusProxy:g-interface-info
* property for more details.
* @returns A #GDBusInterfaceInfo or %NULL. Do not unref the returned object, it is owned by @proxy.
*/
get_interface_info(): DBusInterfaceInfo | null
/**
* Gets the D-Bus interface name `proxy` is for.
* @returns A string owned by @proxy. Do not free.
*/
get_interface_name(): string | null
/**
* Gets the name that `proxy` was constructed for.
*
* When connected to a message bus, this will usually be non-%NULL.
* However, it may be %NULL for a proxy that communicates using a peer-to-peer
* pattern.
* @returns A string owned by @proxy. Do not free.
*/
get_name(): string | null
/**
* The unique name that owns the name that `proxy` is for or %NULL if
* no-one currently owns that name. You may connect to the
* #GObject::notify signal to track changes to the
* #GDBusProxy:g-name-owner property.
* @returns The name owner or %NULL if no name owner exists. Free with g_free().
*/
get_name_owner(): string | null
/**
* Gets the object path `proxy` is for.
* @returns A string owned by @proxy. Do not free.
*/
get_object_path(): string | null
/**
* If `value` is not %NULL, sets the cached value for the property with
* name `property_name` to the value in `value`.
*
* If `value` is %NULL, then the cached value is removed from the
* property cache.
*
* If `proxy` has an expected interface (see
* #GDBusProxy:g-interface-info) and `property_name` is referenced by
* it, then `value` is checked against the type of the property.
*
* If the `value` #GVariant is floating, it is consumed. This allows
* convenient 'inline' use of g_variant_new(), e.g.
*
* ```c
* g_dbus_proxy_set_cached_property (proxy,
* "SomeProperty",
* g_variant_new ("(si)",
* "A String",
* 42));
* ```
*
*
* Normally you will not need to use this method since `proxy`
* is tracking changes using the
* `org.freedesktop.DBus.Properties.PropertiesChanged`
* D-Bus signal. However, for performance reasons an object may
* decide to not use this signal for some properties and instead
* use a proprietary out-of-band mechanism to transmit changes.
*
* As a concrete example, consider an object with a property
* `ChatroomParticipants` which is an array of strings. Instead of
* transmitting the same (long) array every time the property changes,
* it is more efficient to only transmit the delta using e.g. signals
* `ChatroomParticipantJoined(String name)` and
* `ChatroomParticipantParted(String name)`.
* @param property_name Property name.
* @param value Value for the property or %NULL to remove it from the cache.
*/
set_cached_property(property_name: string | null, value: GLib.Variant | null): void
/**
* Sets the timeout to use if -1 (specifying default timeout) is
* passed as `timeout_msec` in the g_dbus_proxy_call() and
* g_dbus_proxy_call_sync() functions.
*
* See the #GDBusProxy:g-default-timeout property for more details.
* @param timeout_msec Timeout in milliseconds.
*/
set_default_timeout(timeout_msec: number): void
/**
* Ensure that interactions with `proxy` conform to the given
* interface. See the #GDBusProxy:g-interface-info property for more
* details.
* @param info Minimum interface this proxy conforms to or %NULL to unset.
*/
set_interface_info(info: DBusInterfaceInfo | null): void
connectSignal(name: string, callback: (proxy: DBusProxy, name: string, args: T) => boolean | void): number
disconnectSignal(id: number): void
// Own virtual methods of Gio-2.0.Gio.DBusProxy
vfunc_g_properties_changed(changed_properties: GLib.Variant, invalidated_properties: string | null): void
vfunc_g_signal(sender_name: string | null, signal_name: string | null, parameters: GLib.Variant): void
// Own signals of Gio-2.0.Gio.DBusProxy
connect(sigName: "g-properties-changed", callback: DBusProxy.GPropertiesChangedSignalCallback): number
connect_after(sigName: "g-properties-changed", callback: DBusProxy.GPropertiesChangedSignalCallback): number
emit(sigName: "g-properties-changed", changed_properties: GLib.Variant, invalidated_properties: string[], ...args: any[]): void
connect(sigName: "g-signal", callback: DBusProxy.GSignalSignalCallback): number
connect_after(sigName: "g-signal", callback: DBusProxy.GSignalSignalCallback): number
emit(sigName: "g-signal", sender_name: string | null, signal_name: string | null, parameters: GLib.Variant, ...args: any[]): void
// Class property signals of Gio-2.0.Gio.DBusProxy
connect(sigName: "notify::g-bus-type", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::g-bus-type", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::g-bus-type", ...args: any[]): void
connect(sigName: "notify::g-connection", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::g-connection", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::g-connection", ...args: any[]): void
connect(sigName: "notify::g-default-timeout", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::g-default-timeout", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::g-default-timeout", ...args: any[]): void
connect(sigName: "notify::g-flags", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::g-flags", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::g-flags", ...args: any[]): void
connect(sigName: "notify::g-interface-info", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::g-interface-info", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::g-interface-info", ...args: any[]): void
connect(sigName: "notify::g-interface-name", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::g-interface-name", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::g-interface-name", ...args: any[]): void
connect(sigName: "notify::g-name", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::g-name", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::g-name", ...args: any[]): void
connect(sigName: "notify::g-name-owner", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::g-name-owner", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::g-name-owner", ...args: any[]): void
connect(sigName: "notify::g-object-path", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::g-object-path", callback: (($obj: DBusProxy, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify::g-object-path", ...args: any[]): void
connect(sigName: string, callback: (...args: any[]) => void): number
connect_after(sigName: string, callback: (...args: any[]) => void): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
}
/**
* #GDBusProxy is a base class used for proxies to access a D-Bus
* interface on a remote object. A #GDBusProxy can be constructed for
* both well-known and unique names.
*
* By default, #GDBusProxy will cache all properties (and listen to
* changes) of the remote object, and proxy all signals that get
* emitted. This behaviour can be changed by passing suitable
* #GDBusProxyFlags when the proxy is created. If the proxy is for a
* well-known name, the property cache is flushed when the name owner
* vanishes and reloaded when a name owner appears.
*
* The unique name owner of the proxy's name is tracked and can be read from
* #GDBusProxy:g-name-owner. Connect to the #GObject::notify signal to
* get notified of changes. Additionally, only signals and property
* changes emitted from the current name owner are considered and
* calls are always sent to the current name owner. This avoids a
* number of race conditions when the name is lost by one owner and
* claimed by another. However, if no name owner currently exists,
* then calls will be sent to the well-known name which may result in
* the message bus launching an owner (unless
* %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START is set).
*
* If the proxy is for a stateless D-Bus service, where the name owner may
* be started and stopped between calls, the #GDBusProxy:g-name-owner tracking
* of #GDBusProxy will cause the proxy to drop signal and property changes from
* the service after it has restarted for the first time. When interacting
* with a stateless D-Bus service, do not use #GDBusProxy — use direct D-Bus
* method calls and signal connections.
*
* The generic #GDBusProxy::g-properties-changed and
* #GDBusProxy::g-signal signals are not very convenient to work with.
* Therefore, the recommended way of working with proxies is to subclass
* #GDBusProxy, and have more natural properties and signals in your derived
* class. This [example][gdbus-example-gdbus-codegen] shows how this can
* easily be done using the [gdbus-codegen][gdbus-codegen] tool.
*
* A #GDBusProxy instance can be used from multiple threads but note
* that all signals (e.g. #GDBusProxy::g-signal, #GDBusProxy::g-properties-changed
* and #GObject::notify) are emitted in the
* [thread-default main context][g-main-context-push-thread-default]
* of the thread where the instance was constructed.
*
* An example using a proxy for a well-known name can be found in
* [gdbus-example-watch-proxy.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-example-watch-proxy.c)
* @class
*/
export class DBusProxy extends GObject.Object {
// Own properties of Gio-2.0.Gio.DBusProxy
static name: string
static $gtype: GObject.GType
// Constructors of Gio-2.0.Gio.DBusProxy
constructor(config?: DBusProxy.ConstructorProperties)
/**
* Finishes creating a #GDBusProxy.
* @constructor
* @param res A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to g_dbus_proxy_new().
* @returns A #GDBusProxy or %NULL if @error is set. Free with g_object_unref().
*/
static new_finish(res: AsyncResult): DBusProxy
/**
* Finishes creating a #GDBusProxy.
* @constructor
* @param res A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to g_dbus_proxy_new_for_bus().
* @returns A #GDBusProxy or %NULL if @error is set. Free with g_object_unref().
*/
static new_for_bus_finish(res: AsyncResult): DBusProxy
/**
* Like g_dbus_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
*
* #GDBusProxy is used in this [example][gdbus-wellknown-proxy].
* @constructor
* @param bus_type A #GBusType.
* @param flags Flags used when constructing the proxy.
* @param info A #GDBusInterfaceInfo specifying the minimal interface that `proxy` conforms to or %NULL.
* @param name A bus name (well-known or unique).
* @param object_path An object path.
* @param interface_name A D-Bus interface name.
* @param cancellable A #GCancellable or %NULL.
* @returns A #GDBusProxy or %NULL if error is set. Free with g_object_unref().
*/
static new_for_bus_sync(bus_type: BusType, flags: DBusProxyFlags, info: DBusInterfaceInfo | null, name: string | null, object_path: string | null, interface_name: string | null, cancellable: Cancellable | null): DBusProxy
/**
* Creates a proxy for accessing `interface_name` on the remote object
* at `object_path` owned by `name` at `connection` and synchronously
* loads D-Bus properties unless the
* %G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES flag is used.
*
* If the %G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS flag is not set, also sets up
* match rules for signals. Connect to the #GDBusProxy::g-signal signal
* to handle signals from the remote object.
*
* If both %G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES and
* %G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS are set, this constructor is
* guaranteed to return immediately without blocking.
*
* If `name` is a well-known name and the
* %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START and %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION
* flags aren't set and no name owner currently exists, the message bus
* will be requested to launch a name owner for the name.
*
* This is a synchronous failable constructor. See g_dbus_proxy_new()
* and g_dbus_proxy_new_finish() for the asynchronous version.
*
* #GDBusProxy is used in this [example][gdbus-wellknown-proxy].
* @constructor
* @param connection A #GDBusConnection.
* @param flags Flags used when constructing the proxy.
* @param info A #GDBusInterfaceInfo specifying the minimal interface that `proxy` conforms to or %NULL.
* @param name A bus name (well-known or unique) or %NULL if `connection` is not a message bus connection.
* @param object_path An object path.
* @param interface_name A D-Bus interface name.
* @param cancellable A #GCancellable or %NULL.
* @returns A #GDBusProxy or %NULL if error is set. Free with g_object_unref().
*/
static new_sync(connection: DBusConnection, flags: DBusProxyFlags, info: DBusInterfaceInfo | null, name: string | null, object_path: string | null, interface_name: string | null, cancellable: Cancellable | null): DBusProxy
_init(config?: DBusProxy.ConstructorProperties): void
/**
* Creates a proxy for accessing `interface_name` on the remote object
* at `object_path` owned by `name` at `connection` and asynchronously
* loads D-Bus properties unless the
* %G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES flag is used. Connect to
* the #GDBusProxy::g-properties-changed signal to get notified about
* property changes.
*
* If the %G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS flag is not set, also sets up
* match rules for signals. Connect to the #GDBusProxy::g-signal signal
* to handle signals from the remote object.
*
* If both %G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES and
* %G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS are set, this constructor is
* guaranteed to complete immediately without blocking.
*
* If `name` is a well-known name and the
* %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START and %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION
* flags aren't set and no name owner currently exists, the message bus
* will be requested to launch a name owner for the name.
*
* This is a failable asynchronous constructor - when the proxy is
* ready, `callback` will be invoked and you can use
* g_dbus_proxy_new_finish() to get the result.
*
* See g_dbus_proxy_new_sync() and for a synchronous version of this constructor.
*
* #GDBusProxy is used in this [example][gdbus-wellknown-proxy].
* @param connection A #GDBusConnection.
* @param flags Flags used when constructing the proxy.
* @param info A #GDBusInterfaceInfo specifying the minimal interface that `proxy` conforms to or %NULL.
* @param name A bus name (well-known or unique) or %NULL if `connection` is not a message bus connection.
* @param object_path An object path.
* @param interface_name A D-Bus interface name.
* @param cancellable A #GCancellable or %NULL.
* @param callback Callback function to invoke when the proxy is ready.
*/
static new(connection: DBusConnection, flags: DBusProxyFlags, info: DBusInterfaceInfo | null, name: string | null, object_path: string | null, interface_name: string | null, cancellable: Cancellable | null, callback: AsyncReadyCallback | null): void
/**
* Like g_dbus_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
*
* #GDBusProxy is used in this [example][gdbus-wellknown-proxy].
* @param bus_type A #GBusType.
* @param flags Flags used when constructing the proxy.
* @param info A #GDBusInterfaceInfo specifying the minimal interface that `proxy` conforms to or %NULL.
* @param name A bus name (well-known or unique).
* @param object_path An object path.
* @param interface_name A D-Bus interface name.
* @param cancellable A #GCancellable or %NULL.
* @param callback Callback function to invoke when the proxy is ready.
*/
static new_for_bus(bus_type: BusType, flags: DBusProxyFlags, info: DBusInterfaceInfo | null, name: string | null, object_path: string | null, interface_name: string | null, cancellable: Cancellable | null, callback: AsyncReadyCallback