gio

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2026 License: MIT Imports: 7 Imported by: 3

Documentation

Overview

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT

Index

Constants

View Source
const (
	// 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
	// ]|
	DBUS_METHOD_INVOCATION_HANDLED bool = true
	// 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.
	DBUS_METHOD_INVOCATION_UNHANDLED bool = false
)
View Source
const (
	// 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.
	FILE_ATTRIBUTE_ACCESS_CAN_DELETE string = "access::can-delete"
	// 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.
	FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE string = "access::can-execute"
	// 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.
	FILE_ATTRIBUTE_ACCESS_CAN_READ string = "access::can-read"
	// 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.
	FILE_ATTRIBUTE_ACCESS_CAN_RENAME string = "access::can-rename"
	// 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.
	FILE_ATTRIBUTE_ACCESS_CAN_TRASH string = "access::can-trash"
	// 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.
	FILE_ATTRIBUTE_ACCESS_CAN_WRITE string = "access::can-write"
	// 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.
	FILE_ATTRIBUTE_DOS_IS_ARCHIVE string = "dos::is-archive"
	// 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.
	FILE_ATTRIBUTE_DOS_IS_MOUNTPOINT string = "dos::is-mountpoint"
	// 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.
	FILE_ATTRIBUTE_DOS_IS_SYSTEM string = "dos::is-system"
	// 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.
	FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG string = "dos::reparse-point-tag"
	// A key in the "etag" namespace for getting the value of the file's
	// entity tag.
	//
	// Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
	FILE_ATTRIBUTE_ETAG_VALUE string = "etag::value"
	// 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.
	FILE_ATTRIBUTE_FILESYSTEM_FREE string = "filesystem::free"
	// 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.
	FILE_ATTRIBUTE_FILESYSTEM_READONLY string = "filesystem::readonly"
	// 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.
	FILE_ATTRIBUTE_FILESYSTEM_REMOTE string = "filesystem::remote"
	// 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.
	FILE_ATTRIBUTE_FILESYSTEM_SIZE string = "filesystem::size"
	// A key in the "filesystem" namespace for getting the file system's type.
	//
	// Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
	FILE_ATTRIBUTE_FILESYSTEM_TYPE string = "filesystem::type"
	// 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.
	FILE_ATTRIBUTE_FILESYSTEM_USED string = "filesystem::used"
	// 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.
	FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW string = "filesystem::use-preview"
	// 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.
	FILE_ATTRIBUTE_GVFS_BACKEND string = "gvfs::backend"
	// 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.
	//
	// For local files on Linux, this is a combination of the file’s device number
	// and inode, so is invariant with respect to hard linking. The format used by
	// other VFS implementations may vary, and some VFS backends may not set it.
	//
	// For simply seeing if two [iface@Gio.File] instances refer to the same path
	// on disk, see [method@Gio.File.equal].
	FILE_ATTRIBUTE_ID_FILE string = "id::file"
	// 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).
	FILE_ATTRIBUTE_ID_FILESYSTEM string = "id::filesystem"
	// 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.
	FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT string = "mountable::can-eject"
	// 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.
	FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT string = "mountable::can-mount"
	// 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.
	FILE_ATTRIBUTE_MOUNTABLE_CAN_POLL string = "mountable::can-poll"
	// 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.
	FILE_ATTRIBUTE_MOUNTABLE_CAN_START string = "mountable::can-start"
	// 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.
	FILE_ATTRIBUTE_MOUNTABLE_CAN_START_DEGRADED string = "mountable::can-start-degraded"
	// 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.
	FILE_ATTRIBUTE_MOUNTABLE_CAN_STOP string = "mountable::can-stop"
	// 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.
	FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT string = "mountable::can-unmount"
	// A key in the "mountable" namespace for getting the HAL UDI for the mountable
	// file.
	//
	// Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
	FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI string = "mountable::hal-udi"
	// 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.
	FILE_ATTRIBUTE_MOUNTABLE_IS_MEDIA_CHECK_AUTOMATIC string = "mountable::is-media-check-automatic"
	// A key in the "mountable" namespace for getting the #GDriveStartStopType.
	//
	// Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
	FILE_ATTRIBUTE_MOUNTABLE_START_STOP_TYPE string = "mountable::start-stop-type"
	// A key in the "mountable" namespace for getting the unix device.
	//
	// Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32.
	FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE string = "mountable::unix-device"
	// A key in the "mountable" namespace for getting the unix device file.
	//
	// Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
	FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE_FILE string = "mountable::unix-device-file"
	// A key in the "owner" namespace for getting the file owner's group.
	//
	// Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
	FILE_ATTRIBUTE_OWNER_GROUP string = "owner::group"
	// A key in the "owner" namespace for getting the user name of the
	// file's owner.
	//
	// Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING.
	FILE_ATTRIBUTE_OWNER_USER string = "owner::user"
	// 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.
	FILE_ATTRIBUTE_OWNER_USER_REAL string = "owner::user-real"
	// 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.
	FILE_ATTRIBUTE_PREVIEW_ICON string = "preview::icon"
	// 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.
	FILE_ATTRIBUTE_RECENT_MODIFIED string = "recent::modified"
	// 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.
	FILE_ATTRIBUTE_SELINUX_CONTEXT string = "selinux::context"
	// 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.
	FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE string = "standard::allocated-size"
	// 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.
	FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE string = "standard::content-type"
	// 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.
	FILE_ATTRIBUTE_STANDARD_COPY_NAME string = "standard::copy-name"
	// 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.
	FILE_ATTRIBUTE_STANDARD_DESCRIPTION string = "standard::description"
	// 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.
	FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME string = "standard::display-name"
	// 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.
	FILE_ATTRIBUTE_STANDARD_EDIT_NAME string = "standard::edit-name"
	// 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.
	FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE string = "standard::fast-content-type"
	// 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.
	FILE_ATTRIBUTE_STANDARD_ICON string = "standard::icon"
	// A key in the "standard" namespace for checking if a file is a backup file.
	//
	// The exact semantics of what constitutes a backup file are backend-specific.
	// For local files, a file is considered a backup if its name ends with `~`
	// and it is a regular file. This follows the POSIX convention used by text
	// editors such as Emacs.
	//
	// Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
	FILE_ATTRIBUTE_STANDARD_IS_BACKUP string = "standard::is-backup"
	// A key in the "standard" namespace for checking if a file is hidden.
	//
	// Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
	FILE_ATTRIBUTE_STANDARD_IS_HIDDEN string = "standard::is-hidden"
	// 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.
	FILE_ATTRIBUTE_STANDARD_IS_SYMLINK string = "standard::is-symlink"
	// A key in the "standard" namespace for checking if a file is virtual.
	//
	// Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
	FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL string = "standard::is-virtual"
	// 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.
	FILE_ATTRIBUTE_STANDARD_IS_VOLATILE string = "standard::is-volatile"
	// 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.
	FILE_ATTRIBUTE_STANDARD_NAME string = "standard::name"
	// A key in the "standard" namespace for getting the file's size (in bytes).
	//
	// Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64.
	FILE_ATTRIBUTE_STANDARD_SIZE string = "standard::size"
	// 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.
	FILE_ATTRIBUTE_STANDARD_SORT_ORDER string = "standard::sort-order"
	// 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.
	FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON string = "standard::symbolic-icon"
	// 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.
	FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET string = "standard::symlink-target"
	// 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.
	FILE_ATTRIBUTE_STANDARD_TARGET_URI string = "standard::target-uri"
	// 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.
	FILE_ATTRIBUTE_STANDARD_TYPE string = "standard::type"
	// 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.
	FILE_ATTRIBUTE_THUMBNAILING_FAILED string = "thumbnail::failed"
	// 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.
	FILE_ATTRIBUTE_THUMBNAILING_FAILED_LARGE string = "thumbnail::failed-large"
	// 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.
	FILE_ATTRIBUTE_THUMBNAILING_FAILED_NORMAL string = "thumbnail::failed-normal"
	// 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.
	FILE_ATTRIBUTE_THUMBNAILING_FAILED_XLARGE string = "thumbnail::failed-xlarge"
	// 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.
	FILE_ATTRIBUTE_THUMBNAILING_FAILED_XXLARGE string = "thumbnail::failed-xxlarge"
	// 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.
	FILE_ATTRIBUTE_THUMBNAIL_IS_VALID string = "thumbnail::is-valid"
	// 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.
	FILE_ATTRIBUTE_THUMBNAIL_IS_VALID_LARGE string = "thumbnail::is-valid-large"
	// 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.
	FILE_ATTRIBUTE_THUMBNAIL_IS_VALID_NORMAL string = "thumbnail::is-valid-normal"
	// 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.
	FILE_ATTRIBUTE_THUMBNAIL_IS_VALID_XLARGE string = "thumbnail::is-valid-xlarge"
	// 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.
	FILE_ATTRIBUTE_THUMBNAIL_IS_VALID_XXLARGE string = "thumbnail::is-valid-xxlarge"
	// 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.
	FILE_ATTRIBUTE_THUMBNAIL_PATH string = "thumbnail::path"
	// A key in the "thumbnail" namespace for getting the path to the large
	// thumbnail image.
	//
	// Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING.
	FILE_ATTRIBUTE_THUMBNAIL_PATH_LARGE string = "thumbnail::path-large"
	// A key in the "thumbnail" namespace for getting the path to the normal
	// thumbnail image.
	//
	// Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING.
	FILE_ATTRIBUTE_THUMBNAIL_PATH_NORMAL string = "thumbnail::path-normal"
	// 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.
	FILE_ATTRIBUTE_THUMBNAIL_PATH_XLARGE string = "thumbnail::path-xlarge"
	// 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.
	FILE_ATTRIBUTE_THUMBNAIL_PATH_XXLARGE string = "thumbnail::path-xxlarge"
	// 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.
	FILE_ATTRIBUTE_TIME_ACCESS string = "time::access"
	// 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.
	FILE_ATTRIBUTE_TIME_ACCESS_NSEC string = "time::access-nsec"
	// 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.
	FILE_ATTRIBUTE_TIME_ACCESS_USEC string = "time::access-usec"
	// 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.
	FILE_ATTRIBUTE_TIME_CHANGED string = "time::changed"
	// 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.
	FILE_ATTRIBUTE_TIME_CHANGED_NSEC string = "time::changed-nsec"
	// 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.
	FILE_ATTRIBUTE_TIME_CHANGED_USEC string = "time::changed-usec"
	// 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`.
	FILE_ATTRIBUTE_TIME_CREATED string = "time::created"
	// 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.
	FILE_ATTRIBUTE_TIME_CREATED_NSEC string = "time::created-nsec"
	// 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.
	FILE_ATTRIBUTE_TIME_CREATED_USEC string = "time::created-usec"
	// 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.
	FILE_ATTRIBUTE_TIME_MODIFIED string = "time::modified"
	// 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.
	FILE_ATTRIBUTE_TIME_MODIFIED_NSEC string = "time::modified-nsec"
	// 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.
	FILE_ATTRIBUTE_TIME_MODIFIED_USEC string = "time::modified-usec"
	// 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.
	FILE_ATTRIBUTE_TRASH_DELETION_DATE string = "trash::deletion-date"
	// 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.
	FILE_ATTRIBUTE_TRASH_ITEM_COUNT string = "trash::item-count"
	// 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.
	FILE_ATTRIBUTE_TRASH_ORIG_PATH string = "trash::orig-path"
	// 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.
	FILE_ATTRIBUTE_UNIX_BLOCKS string = "unix::blocks"
	// 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.
	FILE_ATTRIBUTE_UNIX_BLOCK_SIZE string = "unix::block-size"
	// 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.
	FILE_ATTRIBUTE_UNIX_DEVICE string = "unix::device"
	// 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.
	FILE_ATTRIBUTE_UNIX_GID string = "unix::gid"
	// 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.
	FILE_ATTRIBUTE_UNIX_INODE string = "unix::inode"
	// 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.
	FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT string = "unix::is-mountpoint"
	// 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.
	FILE_ATTRIBUTE_UNIX_MODE string = "unix::mode"
	// 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.
	FILE_ATTRIBUTE_UNIX_NLINK string = "unix::nlink"
	// 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.
	FILE_ATTRIBUTE_UNIX_RDEV string = "unix::rdev"
	// 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.
	FILE_ATTRIBUTE_UNIX_UID string = "unix::uid"
)
View Source
const (
	// 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().
	MENU_ATTRIBUTE_ACTION string = "action"
	// The menu item attribute that holds the namespace for all action names in
	// menus that are linked from this item.
	MENU_ATTRIBUTE_ACTION_NAMESPACE string = "action-namespace"
	// 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).
	MENU_ATTRIBUTE_ICON string = "icon"
	// The menu item attribute which holds the label of the item.
	MENU_ATTRIBUTE_LABEL string = "label"
	// 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()
	MENU_ATTRIBUTE_TARGET string = "target"
	// 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().
	MENU_LINK_SECTION string = "section"
	// The name of the link that associates a menu item with a submenu.
	//
	// See also g_menu_item_set_link().
	MENU_LINK_SUBMENU string = "submenu"
)
View Source
const (
	// The purpose used to verify the client certificate in a TLS connection.
	// Used by TLS servers.
	TLS_DATABASE_PURPOSE_AUTHENTICATE_CLIENT string = "1.3.6.1.5.5.7.3.2"
	// The purpose used to verify the server certificate in a TLS connection. This
	// is the most common purpose in use. Used by TLS clients.
	TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER string = "1.3.6.1.5.5.7.3.1"
)
View Source
const (
	// 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.
	VOLUME_IDENTIFIER_KIND_CLASS string = "class"
	// The string used to obtain a Hal UDI with g_volume_get_identifier().
	VOLUME_IDENTIFIER_KIND_HAL_UDI string = "hal-udi"
	// The string used to obtain a filesystem label with g_volume_get_identifier().
	VOLUME_IDENTIFIER_KIND_LABEL string = "label"
	// The string used to obtain a NFS mount with g_volume_get_identifier().
	VOLUME_IDENTIFIER_KIND_NFS_MOUNT string = "nfs-mount"
	// The string used to obtain a Unix device path with g_volume_get_identifier().
	VOLUME_IDENTIFIER_KIND_UNIX_DEVICE string = "unix-device"
	// The string used to obtain a UUID with g_volume_get_identifier().
	VOLUME_IDENTIFIER_KIND_UUID string = "uuid"
)
View Source
const (
	// Extension point for debug control functionality.
	// See [Extending GIO](overview.html#extending-gio).
	DEBUG_CONTROLLER_EXTENSION_POINT_NAME string = "gio-debug-controller"
)
View Source
const (
	// The string used to obtain a Unix device path with g_drive_get_identifier().
	DRIVE_IDENTIFIER_KIND_UNIX_DEVICE string = "unix-device"
)
View Source
const (
	// Extension point for memory usage monitoring functionality.
	// See [Extending GIO](overview.html#extending-gio).
	MEMORY_MONITOR_EXTENSION_POINT_NAME string = "gio-memory-monitor"
)
View Source
const (
	// 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.
	MENU_EXPORTER_MAX_SECTION_SIZE int = 1000
)
View Source
const (
	NATIVE_VOLUME_MONITOR_EXTENSION_POINT_NAME string = "gio-native-volume-monitor"
)
View Source
const (
	// Extension point for network status monitoring functionality.
	// See [Extending GIO](overview.html#extending-gio).
	NETWORK_MONITOR_EXTENSION_POINT_NAME string = "gio-network-monitor"
)
View Source
const (
	// Extension point for power profile usage monitoring functionality.
	// See [Extending GIO](overview.html#extending-gio).
	POWER_PROFILE_MONITOR_EXTENSION_POINT_NAME string = "gio-power-profile-monitor"
)
View Source
const (
	// Extension point for proxy functionality.
	// See [Extending GIO](overview.html#extending-gio).
	PROXY_EXTENSION_POINT_NAME string = "gio-proxy"
)
View Source
const (
	// Extension point for proxy resolving functionality.
	// See [Extending GIO](overview.html#extending-gio).
	PROXY_RESOLVER_EXTENSION_POINT_NAME string = "gio-proxy-resolver"
)
View Source
const (
	// Extension point for #GSettingsBackend functionality.
	SETTINGS_BACKEND_EXTENSION_POINT_NAME string = "gsettings-backend"
)
View Source
const (
	// Extension point for TLS functionality via #GTlsBackend.
	// See [Extending GIO](overview.html#extending-gio).
	TLS_BACKEND_EXTENSION_POINT_NAME string = "gio-tls-backend"
)
View Source
const (
	// Extension point for #GVfs functionality.
	// See [Extending GIO](overview.html#extending-gio).
	VFS_EXTENSION_POINT_NAME string = "gio-vfs"
)
View Source
const (
	// Extension point for volume monitor functionality.
	// See [Extending GIO](overview.html#extending-gio).
	VOLUME_MONITOR_EXTENSION_POINT_NAME string = "gio-volume-monitor"
)

Variables

View Source
var (
	XGActionActivate         func(uintptr, *glib.Variant)
	XGActionChangeState      func(uintptr, *glib.Variant)
	XGActionGetEnabled       func(uintptr) bool
	XGActionGetName          func(uintptr) string
	XGActionGetParameterType func(uintptr) uintptr
	XGActionGetState         func(uintptr) uintptr
	XGActionGetStateHint     func(uintptr) uintptr
	XGActionGetStateType     func(uintptr) uintptr
)
View Source
var (
	XGActionGroupActionAdded            func(uintptr, string)
	XGActionGroupActionEnabledChanged   func(uintptr, string, bool)
	XGActionGroupActionRemoved          func(uintptr, string)
	XGActionGroupActionStateChanged     func(uintptr, string, *glib.Variant)
	XGActionGroupActivateAction         func(uintptr, string, *glib.Variant)
	XGActionGroupChangeActionState      func(uintptr, string, *glib.Variant)
	XGActionGroupGetActionEnabled       func(uintptr, string) bool
	XGActionGroupGetActionParameterType func(uintptr, string) uintptr
	XGActionGroupGetActionState         func(uintptr, string) uintptr
	XGActionGroupGetActionStateHint     func(uintptr, string) uintptr
	XGActionGroupGetActionStateType     func(uintptr, string) uintptr
	XGActionGroupHasAction              func(uintptr, string) bool
	XGActionGroupListActions            func(uintptr) []string
	XGActionGroupQueryAction            func(uintptr, string, *bool, **glib.VariantType, **glib.VariantType, **glib.Variant, **glib.Variant) bool
)
View Source
var (
	XGActionMapAddAction           func(uintptr, uintptr)
	XGActionMapAddActionEntries    func(uintptr, []ActionEntry, int, uintptr)
	XGActionMapLookupAction        func(uintptr, string) uintptr
	XGActionMapRemoveAction        func(uintptr, string)
	XGActionMapRemoveActionEntries func(uintptr, []ActionEntry, int)
)
View Source
var (
	XGAppInfoAddSupportsType          func(uintptr, string, **glib.Error) bool
	XGAppInfoCanDelete                func(uintptr) bool
	XGAppInfoCanRemoveSupportsType    func(uintptr) bool
	XGAppInfoDelete                   func(uintptr) bool
	XGAppInfoDup                      func(uintptr) uintptr
	XGAppInfoEqual                    func(uintptr, uintptr) bool
	XGAppInfoGetCommandline           func(uintptr) string
	XGAppInfoGetDescription           func(uintptr) string
	XGAppInfoGetDisplayName           func(uintptr) string
	XGAppInfoGetExecutable            func(uintptr) string
	XGAppInfoGetIcon                  func(uintptr) uintptr
	XGAppInfoGetId                    func(uintptr) string
	XGAppInfoGetName                  func(uintptr) string
	XGAppInfoGetSupportedTypes        func(uintptr) []string
	XGAppInfoLaunch                   func(uintptr, *glib.List, uintptr, **glib.Error) bool
	XGAppInfoLaunchUris               func(uintptr, *glib.List, uintptr, **glib.Error) bool
	XGAppInfoLaunchUrisAsync          func(uintptr, *glib.List, uintptr, uintptr, uintptr, uintptr)
	XGAppInfoLaunchUrisFinish         func(uintptr, uintptr, **glib.Error) bool
	XGAppInfoRemoveSupportsType       func(uintptr, string, **glib.Error) bool
	XGAppInfoSetAsDefaultForExtension func(uintptr, string, **glib.Error) bool
	XGAppInfoSetAsDefaultForType      func(uintptr, string, **glib.Error) bool
	XGAppInfoSetAsLastUsedForType     func(uintptr, string, **glib.Error) bool
	XGAppInfoShouldShow               func(uintptr) bool
	XGAppInfoSupportsFiles            func(uintptr) bool
	XGAppInfoSupportsUris             func(uintptr) bool
)
View Source
var (
	XGAsyncInitableInitAsync  func(uintptr, int, uintptr, uintptr, uintptr)
	XGAsyncInitableInitFinish func(uintptr, uintptr, **glib.Error) bool
	XGAsyncInitableNewFinish  func(uintptr, uintptr, **glib.Error) uintptr
)
View Source
var (
	XGAsyncResultGetSourceObject      func(uintptr) uintptr
	XGAsyncResultGetUserData          func(uintptr) uintptr
	XGAsyncResultIsTagged             func(uintptr, uintptr) bool
	XGAsyncResultLegacyPropagateError func(uintptr, **glib.Error) bool
)
View Source
var (
	XGConverterConvert      func(uintptr, []byte, uint, []byte, uint, ConverterFlags, *uint, *uint, **glib.Error) ConverterResult
	XGConverterConvertBytes func(uintptr, *glib.Bytes, **glib.Error) uintptr
	XGConverterReset        func(uintptr)
)
View Source
var (
	XGDatagramBasedConditionCheck  func(uintptr, glib.IOCondition) glib.IOCondition
	XGDatagramBasedConditionWait   func(uintptr, glib.IOCondition, int64, uintptr, **glib.Error) bool
	XGDatagramBasedCreateSource    func(uintptr, glib.IOCondition, uintptr) uintptr
	XGDatagramBasedReceiveMessages func(uintptr, []InputMessage, uint, int, int64, uintptr, **glib.Error) int
	XGDatagramBasedSendMessages    func(uintptr, []OutputMessage, uint, int, int64, uintptr, **glib.Error) int
)
View Source
var (
	XGDbusInterfaceDupObject func(uintptr) uintptr
	XGDbusInterfaceGetInfo   func(uintptr) uintptr
	XGDbusInterfaceGetObject func(uintptr) uintptr
	XGDbusInterfaceSetObject func(uintptr, uintptr)
)
View Source
var (
	XGDbusObjectGetInterface  func(uintptr, string) uintptr
	XGDbusObjectGetInterfaces func(uintptr) uintptr
	XGDbusObjectGetObjectPath func(uintptr) string
)
View Source
var (
	XGDbusObjectManagerGetInterface  func(uintptr, string, string) uintptr
	XGDbusObjectManagerGetObject     func(uintptr, string) uintptr
	XGDbusObjectManagerGetObjectPath func(uintptr) string
	XGDbusObjectManagerGetObjects    func(uintptr) uintptr
)
View Source
var (
	XGDebugControllerGetDebugEnabled func(uintptr) bool
	XGDebugControllerSetDebugEnabled func(uintptr, bool)
)
View Source
var (
	XGDriveCanEject                 func(uintptr) bool
	XGDriveCanPollForMedia          func(uintptr) bool
	XGDriveCanStart                 func(uintptr) bool
	XGDriveCanStartDegraded         func(uintptr) bool
	XGDriveCanStop                  func(uintptr) bool
	XGDriveEject                    func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr)
	XGDriveEjectFinish              func(uintptr, uintptr, **glib.Error) bool
	XGDriveEjectWithOperation       func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr, uintptr)
	XGDriveEjectWithOperationFinish func(uintptr, uintptr, **glib.Error) bool
	XGDriveEnumerateIdentifiers     func(uintptr) []string
	XGDriveGetIcon                  func(uintptr) uintptr
	XGDriveGetIdentifier            func(uintptr, string) string
	XGDriveGetName                  func(uintptr) string
	XGDriveGetSortKey               func(uintptr) string
	XGDriveGetStartStopType         func(uintptr) DriveStartStopType
	XGDriveGetSymbolicIcon          func(uintptr) uintptr
	XGDriveGetVolumes               func(uintptr) uintptr
	XGDriveHasMedia                 func(uintptr) bool
	XGDriveHasVolumes               func(uintptr) bool
	XGDriveIsMediaCheckAutomatic    func(uintptr) bool
	XGDriveIsMediaRemovable         func(uintptr) bool
	XGDriveIsRemovable              func(uintptr) bool
	XGDrivePollForMedia             func(uintptr, uintptr, uintptr, uintptr)
	XGDrivePollForMediaFinish       func(uintptr, uintptr, **glib.Error) bool
	XGDriveStart                    func(uintptr, DriveStartFlags, uintptr, uintptr, uintptr, uintptr)
	XGDriveStartFinish              func(uintptr, uintptr, **glib.Error) bool
	XGDriveStop                     func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr, uintptr)
	XGDriveStopFinish               func(uintptr, uintptr, **glib.Error) bool
)
View Source
var (
	XGDtlsClientConnectionGetAcceptedCas     func(uintptr) uintptr
	XGDtlsClientConnectionGetServerIdentity  func(uintptr) uintptr
	XGDtlsClientConnectionGetValidationFlags func(uintptr) TlsCertificateFlags
	XGDtlsClientConnectionSetServerIdentity  func(uintptr, uintptr)
	XGDtlsClientConnectionSetValidationFlags func(uintptr, TlsCertificateFlags)
)
View Source
var (
	XGDtlsConnectionClose                    func(uintptr, uintptr, **glib.Error) bool
	XGDtlsConnectionCloseAsync               func(uintptr, int, uintptr, uintptr, uintptr)
	XGDtlsConnectionCloseFinish              func(uintptr, uintptr, **glib.Error) bool
	XGDtlsConnectionEmitAcceptCertificate    func(uintptr, uintptr, TlsCertificateFlags) bool
	XGDtlsConnectionGetCertificate           func(uintptr) uintptr
	XGDtlsConnectionGetChannelBindingData    func(uintptr, TlsChannelBindingType, *[]byte, **glib.Error) bool
	XGDtlsConnectionGetCiphersuiteName       func(uintptr) string
	XGDtlsConnectionGetDatabase              func(uintptr) uintptr
	XGDtlsConnectionGetInteraction           func(uintptr) uintptr
	XGDtlsConnectionGetNegotiatedProtocol    func(uintptr) string
	XGDtlsConnectionGetPeerCertificate       func(uintptr) uintptr
	XGDtlsConnectionGetPeerCertificateErrors func(uintptr) TlsCertificateFlags
	XGDtlsConnectionGetProtocolVersion       func(uintptr) TlsProtocolVersion
	XGDtlsConnectionGetRehandshakeMode       func(uintptr) TlsRehandshakeMode
	XGDtlsConnectionGetRequireCloseNotify    func(uintptr) bool
	XGDtlsConnectionHandshake                func(uintptr, uintptr, **glib.Error) bool
	XGDtlsConnectionHandshakeAsync           func(uintptr, int, uintptr, uintptr, uintptr)
	XGDtlsConnectionHandshakeFinish          func(uintptr, uintptr, **glib.Error) bool
	XGDtlsConnectionSetAdvertisedProtocols   func(uintptr, []string)
	XGDtlsConnectionSetCertificate           func(uintptr, uintptr)
	XGDtlsConnectionSetDatabase              func(uintptr, uintptr)
	XGDtlsConnectionSetInteraction           func(uintptr, uintptr)
	XGDtlsConnectionSetRehandshakeMode       func(uintptr, TlsRehandshakeMode)
	XGDtlsConnectionSetRequireCloseNotify    func(uintptr, bool)
	XGDtlsConnectionShutdown                 func(uintptr, bool, bool, uintptr, **glib.Error) bool
	XGDtlsConnectionShutdownAsync            func(uintptr, bool, bool, int, uintptr, uintptr, uintptr)
	XGDtlsConnectionShutdownFinish           func(uintptr, uintptr, **glib.Error) bool
)
View Source
var (
	XGFileAppendTo                            func(uintptr, FileCreateFlags, uintptr, **glib.Error) uintptr
	XGFileAppendToAsync                       func(uintptr, FileCreateFlags, int, uintptr, uintptr, uintptr)
	XGFileAppendToFinish                      func(uintptr, uintptr, **glib.Error) uintptr
	XGFileBuildAttributeListForCopy           func(uintptr, FileCopyFlags, uintptr, **glib.Error) string
	XGFileCopy                                func(uintptr, uintptr, FileCopyFlags, uintptr, uintptr, uintptr, **glib.Error) bool
	XGFileCopyAsync                           func(uintptr, uintptr, FileCopyFlags, int, uintptr, uintptr, uintptr, uintptr, uintptr)
	XGFileCopyAsyncWithClosures               func(uintptr, uintptr, FileCopyFlags, int, uintptr, *gobject.Closure, *gobject.Closure)
	XGFileCopyAttributes                      func(uintptr, uintptr, FileCopyFlags, uintptr, **glib.Error) bool
	XGFileCopyFinish                          func(uintptr, uintptr, **glib.Error) bool
	XGFileCreate                              func(uintptr, FileCreateFlags, uintptr, **glib.Error) uintptr
	XGFileCreateAsync                         func(uintptr, FileCreateFlags, int, uintptr, uintptr, uintptr)
	XGFileCreateFinish                        func(uintptr, uintptr, **glib.Error) uintptr
	XGFileCreateReadwrite                     func(uintptr, FileCreateFlags, uintptr, **glib.Error) uintptr
	XGFileCreateReadwriteAsync                func(uintptr, FileCreateFlags, int, uintptr, uintptr, uintptr)
	XGFileCreateReadwriteFinish               func(uintptr, uintptr, **glib.Error) uintptr
	XGFileDelete                              func(uintptr, uintptr, **glib.Error) bool
	XGFileDeleteAsync                         func(uintptr, int, uintptr, uintptr, uintptr)
	XGFileDeleteFinish                        func(uintptr, uintptr, **glib.Error) bool
	XGFileDup                                 func(uintptr) uintptr
	XGFileEjectMountable                      func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr)
	XGFileEjectMountableFinish                func(uintptr, uintptr, **glib.Error) bool
	XGFileEjectMountableWithOperation         func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr, uintptr)
	XGFileEjectMountableWithOperationFinish   func(uintptr, uintptr, **glib.Error) bool
	XGFileEnumerateChildren                   func(uintptr, string, FileQueryInfoFlags, uintptr, **glib.Error) uintptr
	XGFileEnumerateChildrenAsync              func(uintptr, string, FileQueryInfoFlags, int, uintptr, uintptr, uintptr)
	XGFileEnumerateChildrenFinish             func(uintptr, uintptr, **glib.Error) uintptr
	XGFileEqual                               func(uintptr, uintptr) bool
	XGFileFindEnclosingMount                  func(uintptr, uintptr, **glib.Error) uintptr
	XGFileFindEnclosingMountAsync             func(uintptr, int, uintptr, uintptr, uintptr)
	XGFileFindEnclosingMountFinish            func(uintptr, uintptr, **glib.Error) uintptr
	XGFileGetBasename                         func(uintptr) string
	XGFileGetChild                            func(uintptr, string) uintptr
	XGFileGetChildForDisplayName              func(uintptr, string, **glib.Error) uintptr
	XGFileGetParent                           func(uintptr) uintptr
	XGFileGetParseName                        func(uintptr) string
	XGFileGetPath                             func(uintptr) string
	XGFileGetRelativePath                     func(uintptr, uintptr) string
	XGFileGetUri                              func(uintptr) string
	XGFileGetUriScheme                        func(uintptr) string
	XGFileHasParent                           func(uintptr, uintptr) bool
	XGFileHasPrefix                           func(uintptr, uintptr) bool
	XGFileHasUriScheme                        func(uintptr, string) bool
	XGFileHash                                func(uintptr) uint
	XGFileIsNative                            func(uintptr) bool
	XGFileLoadBytes                           func(uintptr, uintptr, *string, **glib.Error) uintptr
	XGFileLoadBytesAsync                      func(uintptr, uintptr, uintptr, uintptr)
	XGFileLoadBytesFinish                     func(uintptr, uintptr, *string, **glib.Error) uintptr
	XGFileLoadContents                        func(uintptr, uintptr, *[]string, *uint, *string, **glib.Error) bool
	XGFileLoadContentsAsync                   func(uintptr, uintptr, uintptr, uintptr)
	XGFileLoadContentsFinish                  func(uintptr, uintptr, *[]string, *uint, *string, **glib.Error) bool
	XGFileLoadPartialContentsAsync            func(uintptr, uintptr, uintptr, uintptr, uintptr)
	XGFileLoadPartialContentsFinish           func(uintptr, uintptr, *[]string, *uint, *string, **glib.Error) bool
	XGFileMakeDirectory                       func(uintptr, uintptr, **glib.Error) bool
	XGFileMakeDirectoryAsync                  func(uintptr, int, uintptr, uintptr, uintptr)
	XGFileMakeDirectoryFinish                 func(uintptr, uintptr, **glib.Error) bool
	XGFileMakeDirectoryWithParents            func(uintptr, uintptr, **glib.Error) bool
	XGFileMakeSymbolicLink                    func(uintptr, string, uintptr, **glib.Error) bool
	XGFileMakeSymbolicLinkAsync               func(uintptr, string, int, uintptr, uintptr, uintptr)
	XGFileMakeSymbolicLinkFinish              func(uintptr, uintptr, **glib.Error) bool
	XGFileMeasureDiskUsage                    func(uintptr, FileMeasureFlags, uintptr, uintptr, uintptr, *uint64, *uint64, *uint64, **glib.Error) bool
	XGFileMeasureDiskUsageAsync               func(uintptr, FileMeasureFlags, int, uintptr, uintptr, uintptr, uintptr, uintptr)
	XGFileMeasureDiskUsageFinish              func(uintptr, uintptr, *uint64, *uint64, *uint64, **glib.Error) bool
	XGFileMonitor                             func(uintptr, FileMonitorFlags, uintptr, **glib.Error) uintptr
	XGFileMonitorDirectory                    func(uintptr, FileMonitorFlags, uintptr, **glib.Error) uintptr
	XGFileMonitorFile                         func(uintptr, FileMonitorFlags, uintptr, **glib.Error) uintptr
	XGFileMountEnclosingVolume                func(uintptr, MountMountFlags, uintptr, uintptr, uintptr, uintptr)
	XGFileMountEnclosingVolumeFinish          func(uintptr, uintptr, **glib.Error) bool
	XGFileMountMountable                      func(uintptr, MountMountFlags, uintptr, uintptr, uintptr, uintptr)
	XGFileMountMountableFinish                func(uintptr, uintptr, **glib.Error) uintptr
	XGFileMove                                func(uintptr, uintptr, FileCopyFlags, uintptr, uintptr, uintptr, **glib.Error) bool
	XGFileMoveAsync                           func(uintptr, uintptr, FileCopyFlags, int, uintptr, uintptr, uintptr, uintptr, uintptr)
	XGFileMoveAsyncWithClosures               func(uintptr, uintptr, FileCopyFlags, int, uintptr, *gobject.Closure, *gobject.Closure)
	XGFileMoveFinish                          func(uintptr, uintptr, **glib.Error) bool
	XGFileOpenReadwrite                       func(uintptr, uintptr, **glib.Error) uintptr
	XGFileOpenReadwriteAsync                  func(uintptr, int, uintptr, uintptr, uintptr)
	XGFileOpenReadwriteFinish                 func(uintptr, uintptr, **glib.Error) uintptr
	XGFilePeekPath                            func(uintptr) string
	XGFilePollMountable                       func(uintptr, uintptr, uintptr, uintptr)
	XGFilePollMountableFinish                 func(uintptr, uintptr, **glib.Error) bool
	XGFileQueryDefaultHandler                 func(uintptr, uintptr, **glib.Error) uintptr
	XGFileQueryDefaultHandlerAsync            func(uintptr, int, uintptr, uintptr, uintptr)
	XGFileQueryDefaultHandlerFinish           func(uintptr, uintptr, **glib.Error) uintptr
	XGFileQueryExists                         func(uintptr, uintptr) bool
	XGFileQueryFileType                       func(uintptr, FileQueryInfoFlags, uintptr) FileType
	XGFileQueryFilesystemInfo                 func(uintptr, string, uintptr, **glib.Error) uintptr
	XGFileQueryFilesystemInfoAsync            func(uintptr, string, int, uintptr, uintptr, uintptr)
	XGFileQueryFilesystemInfoFinish           func(uintptr, uintptr, **glib.Error) uintptr
	XGFileQueryInfo                           func(uintptr, string, FileQueryInfoFlags, uintptr, **glib.Error) uintptr
	XGFileQueryInfoAsync                      func(uintptr, string, FileQueryInfoFlags, int, uintptr, uintptr, uintptr)
	XGFileQueryInfoFinish                     func(uintptr, uintptr, **glib.Error) uintptr
	XGFileQuerySettableAttributes             func(uintptr, uintptr, **glib.Error) uintptr
	XGFileQueryWritableNamespaces             func(uintptr, uintptr, **glib.Error) uintptr
	XGFileRead                                func(uintptr, uintptr, **glib.Error) uintptr
	XGFileReadAsync                           func(uintptr, int, uintptr, uintptr, uintptr)
	XGFileReadFinish                          func(uintptr, uintptr, **glib.Error) uintptr
	XGFileReplace                             func(uintptr, uintptr, bool, FileCreateFlags, uintptr, **glib.Error) uintptr
	XGFileReplaceAsync                        func(uintptr, uintptr, bool, FileCreateFlags, int, uintptr, uintptr, uintptr)
	XGFileReplaceContents                     func(uintptr, string, uint, uintptr, bool, FileCreateFlags, *string, uintptr, **glib.Error) bool
	XGFileReplaceContentsAsync                func(uintptr, string, uint, uintptr, bool, FileCreateFlags, uintptr, uintptr, uintptr)
	XGFileReplaceContentsBytesAsync           func(uintptr, *glib.Bytes, uintptr, bool, FileCreateFlags, uintptr, uintptr, uintptr)
	XGFileReplaceContentsFinish               func(uintptr, uintptr, *string, **glib.Error) bool
	XGFileReplaceFinish                       func(uintptr, uintptr, **glib.Error) uintptr
	XGFileReplaceReadwrite                    func(uintptr, uintptr, bool, FileCreateFlags, uintptr, **glib.Error) uintptr
	XGFileReplaceReadwriteAsync               func(uintptr, uintptr, bool, FileCreateFlags, int, uintptr, uintptr, uintptr)
	XGFileReplaceReadwriteFinish              func(uintptr, uintptr, **glib.Error) uintptr
	XGFileResolveRelativePath                 func(uintptr, string) uintptr
	XGFileSetAttribute                        func(uintptr, string, FileAttributeType, uintptr, FileQueryInfoFlags, uintptr, **glib.Error) bool
	XGFileSetAttributeByteString              func(uintptr, string, string, FileQueryInfoFlags, uintptr, **glib.Error) bool
	XGFileSetAttributeInt32                   func(uintptr, string, int32, FileQueryInfoFlags, uintptr, **glib.Error) bool
	XGFileSetAttributeInt64                   func(uintptr, string, int64, FileQueryInfoFlags, uintptr, **glib.Error) bool
	XGFileSetAttributeString                  func(uintptr, string, string, FileQueryInfoFlags, uintptr, **glib.Error) bool
	XGFileSetAttributeUint32                  func(uintptr, string, uint32, FileQueryInfoFlags, uintptr, **glib.Error) bool
	XGFileSetAttributeUint64                  func(uintptr, string, uint64, FileQueryInfoFlags, uintptr, **glib.Error) bool
	XGFileSetAttributesAsync                  func(uintptr, uintptr, FileQueryInfoFlags, int, uintptr, uintptr, uintptr)
	XGFileSetAttributesFinish                 func(uintptr, uintptr, **FileInfo, **glib.Error) bool
	XGFileSetAttributesFromInfo               func(uintptr, uintptr, FileQueryInfoFlags, uintptr, **glib.Error) bool
	XGFileSetDisplayName                      func(uintptr, string, uintptr, **glib.Error) uintptr
	XGFileSetDisplayNameAsync                 func(uintptr, string, int, uintptr, uintptr, uintptr)
	XGFileSetDisplayNameFinish                func(uintptr, uintptr, **glib.Error) uintptr
	XGFileStartMountable                      func(uintptr, DriveStartFlags, uintptr, uintptr, uintptr, uintptr)
	XGFileStartMountableFinish                func(uintptr, uintptr, **glib.Error) bool
	XGFileStopMountable                       func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr, uintptr)
	XGFileStopMountableFinish                 func(uintptr, uintptr, **glib.Error) bool
	XGFileSupportsThreadContexts              func(uintptr) bool
	XGFileTrash                               func(uintptr, uintptr, **glib.Error) bool
	XGFileTrashAsync                          func(uintptr, int, uintptr, uintptr, uintptr)
	XGFileTrashFinish                         func(uintptr, uintptr, **glib.Error) bool
	XGFileUnmountMountable                    func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr)
	XGFileUnmountMountableFinish              func(uintptr, uintptr, **glib.Error) bool
	XGFileUnmountMountableWithOperation       func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr, uintptr)
	XGFileUnmountMountableWithOperationFinish func(uintptr, uintptr, **glib.Error) bool
)
View Source
var (
	XGIconEqual     func(uintptr, uintptr) bool
	XGIconHash      func(uintptr) uint
	XGIconSerialize func(uintptr) uintptr
	XGIconToString  func(uintptr) string
)
View Source
var (
	XGListModelGetItem      func(uintptr, uint) uintptr
	XGListModelGetItemType  func(uintptr) types.GType
	XGListModelGetNItems    func(uintptr) uint
	XGListModelGetObject    func(uintptr, uint) uintptr
	XGListModelItemsChanged func(uintptr, uint, uint, uint)
)
View Source
var (
	XGLoadableIconLoad       func(uintptr, int, *string, uintptr, **glib.Error) uintptr
	XGLoadableIconLoadAsync  func(uintptr, int, uintptr, uintptr, uintptr)
	XGLoadableIconLoadFinish func(uintptr, uintptr, *string, **glib.Error) uintptr
)
View Source
var (
	XGMountCanEject                   func(uintptr) bool
	XGMountCanUnmount                 func(uintptr) bool
	XGMountEject                      func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr)
	XGMountEjectFinish                func(uintptr, uintptr, **glib.Error) bool
	XGMountEjectWithOperation         func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr, uintptr)
	XGMountEjectWithOperationFinish   func(uintptr, uintptr, **glib.Error) bool
	XGMountGetDefaultLocation         func(uintptr) uintptr
	XGMountGetDrive                   func(uintptr) uintptr
	XGMountGetIcon                    func(uintptr) uintptr
	XGMountGetName                    func(uintptr) string
	XGMountGetRoot                    func(uintptr) uintptr
	XGMountGetSortKey                 func(uintptr) string
	XGMountGetSymbolicIcon            func(uintptr) uintptr
	XGMountGetUuid                    func(uintptr) string
	XGMountGetVolume                  func(uintptr) uintptr
	XGMountGuessContentType           func(uintptr, bool, uintptr, uintptr, uintptr)
	XGMountGuessContentTypeFinish     func(uintptr, uintptr, **glib.Error) []string
	XGMountGuessContentTypeSync       func(uintptr, bool, uintptr, **glib.Error) []string
	XGMountIsShadowed                 func(uintptr) bool
	XGMountRemount                    func(uintptr, MountMountFlags, uintptr, uintptr, uintptr, uintptr)
	XGMountRemountFinish              func(uintptr, uintptr, **glib.Error) bool
	XGMountShadow                     func(uintptr)
	XGMountUnmount                    func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr)
	XGMountUnmountFinish              func(uintptr, uintptr, **glib.Error) bool
	XGMountUnmountWithOperation       func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr, uintptr)
	XGMountUnmountWithOperationFinish func(uintptr, uintptr, **glib.Error) bool
	XGMountUnshadow                   func(uintptr)
)
View Source
var (
	XGNetworkMonitorCanReach            func(uintptr, uintptr, uintptr, **glib.Error) bool
	XGNetworkMonitorCanReachAsync       func(uintptr, uintptr, uintptr, uintptr, uintptr)
	XGNetworkMonitorCanReachFinish      func(uintptr, uintptr, **glib.Error) bool
	XGNetworkMonitorGetConnectivity     func(uintptr) NetworkConnectivity
	XGNetworkMonitorGetNetworkAvailable func(uintptr) bool
	XGNetworkMonitorGetNetworkMetered   func(uintptr) bool
)
View Source
var (
	XGPollableInputStreamCanPoll         func(uintptr) bool
	XGPollableInputStreamCreateSource    func(uintptr, uintptr) uintptr
	XGPollableInputStreamIsReadable      func(uintptr) bool
	XGPollableInputStreamReadNonblocking func(uintptr, *[]byte, uint, uintptr, **glib.Error) int
)
View Source
var (
	XGPollableOutputStreamCanPoll           func(uintptr) bool
	XGPollableOutputStreamCreateSource      func(uintptr, uintptr) uintptr
	XGPollableOutputStreamIsWritable        func(uintptr) bool
	XGPollableOutputStreamWriteNonblocking  func(uintptr, []byte, uint, uintptr, **glib.Error) int
	XGPollableOutputStreamWritevNonblocking func(uintptr, []OutputVector, uint, *uint, uintptr, **glib.Error) PollableReturn
)
View Source
var (
	XGProxyConnect          func(uintptr, uintptr, uintptr, uintptr, **glib.Error) uintptr
	XGProxyConnectAsync     func(uintptr, uintptr, uintptr, uintptr, uintptr, uintptr)
	XGProxyConnectFinish    func(uintptr, uintptr, **glib.Error) uintptr
	XGProxySupportsHostname func(uintptr) bool
)
View Source
var (
	XGProxyResolverIsSupported  func(uintptr) bool
	XGProxyResolverLookup       func(uintptr, string, uintptr, **glib.Error) []string
	XGProxyResolverLookupAsync  func(uintptr, string, uintptr, uintptr, uintptr)
	XGProxyResolverLookupFinish func(uintptr, uintptr, **glib.Error) []string
)
View Source
var (
	XGRemoteActionGroupActivateActionFull    func(uintptr, string, *glib.Variant, *glib.Variant)
	XGRemoteActionGroupChangeActionStateFull func(uintptr, string, *glib.Variant, *glib.Variant)
)
View Source
var (
	XGSeekableCanSeek     func(uintptr) bool
	XGSeekableCanTruncate func(uintptr) bool
	XGSeekableSeek        func(uintptr, int64, glib.SeekType, uintptr, **glib.Error) bool
	XGSeekableTell        func(uintptr) int64
	XGSeekableTruncate    func(uintptr, int64, uintptr, **glib.Error) bool
)
View Source
var (
	XGSocketConnectableEnumerate      func(uintptr) uintptr
	XGSocketConnectableProxyEnumerate func(uintptr) uintptr
	XGSocketConnectableToString       func(uintptr) string
)
View Source
var (
	XGTlsBackendGetCertificateType          func(uintptr) types.GType
	XGTlsBackendGetClientConnectionType     func(uintptr) types.GType
	XGTlsBackendGetDefaultDatabase          func(uintptr) uintptr
	XGTlsBackendGetDtlsClientConnectionType func(uintptr) types.GType
	XGTlsBackendGetDtlsServerConnectionType func(uintptr) types.GType
	XGTlsBackendGetFileDatabaseType         func(uintptr) types.GType
	XGTlsBackendGetServerConnectionType     func(uintptr) types.GType
	XGTlsBackendSetDefaultDatabase          func(uintptr, uintptr)
	XGTlsBackendSupportsDtls                func(uintptr) bool
	XGTlsBackendSupportsTls                 func(uintptr) bool
)
View Source
var (
	XGTlsClientConnectionCopySessionState   func(uintptr, uintptr)
	XGTlsClientConnectionGetAcceptedCas     func(uintptr) uintptr
	XGTlsClientConnectionGetServerIdentity  func(uintptr) uintptr
	XGTlsClientConnectionGetUseSsl3         func(uintptr) bool
	XGTlsClientConnectionGetValidationFlags func(uintptr) TlsCertificateFlags
	XGTlsClientConnectionSetServerIdentity  func(uintptr, uintptr)
	XGTlsClientConnectionSetUseSsl3         func(uintptr, bool)
	XGTlsClientConnectionSetValidationFlags func(uintptr, TlsCertificateFlags)
)
View Source
var (
	XGVolumeCanEject                 func(uintptr) bool
	XGVolumeCanMount                 func(uintptr) bool
	XGVolumeEject                    func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr)
	XGVolumeEjectFinish              func(uintptr, uintptr, **glib.Error) bool
	XGVolumeEjectWithOperation       func(uintptr, MountUnmountFlags, uintptr, uintptr, uintptr, uintptr)
	XGVolumeEjectWithOperationFinish func(uintptr, uintptr, **glib.Error) bool
	XGVolumeEnumerateIdentifiers     func(uintptr) []string
	XGVolumeGetActivationRoot        func(uintptr) uintptr
	XGVolumeGetDrive                 func(uintptr) uintptr
	XGVolumeGetIcon                  func(uintptr) uintptr
	XGVolumeGetIdentifier            func(uintptr, string) string
	XGVolumeGetMount                 func(uintptr) uintptr
	XGVolumeGetName                  func(uintptr) string
	XGVolumeGetSortKey               func(uintptr) string
	XGVolumeGetSymbolicIcon          func(uintptr) uintptr
	XGVolumeGetUuid                  func(uintptr) string
	XGVolumeMount                    func(uintptr, MountMountFlags, uintptr, uintptr, uintptr, uintptr)
	XGVolumeMountFinish              func(uintptr, uintptr, **glib.Error) bool
	XGVolumeShouldAutomount          func(uintptr) bool
)
View Source
var XGInitableInit func(uintptr, uintptr, **glib.Error) bool
View Source
var XGPowerProfileMonitorGetPowerSaverEnabled func(uintptr) bool

Functions

func ActionGLibType

func ActionGLibType() types.GType

func ActionGroupGLibType

func ActionGroupGLibType() types.GType

func ActionMapGLibType

func ActionMapGLibType() types.GType

func ActionNameIsValid

func ActionNameIsValid(ActionNameVar string) bool

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-UTF-8 @action_name. @action_name must not be `NULL`.

func ActionParseDetailedName

func ActionParseDetailedName(DetailedNameVar string, ActionNameVar *string, TargetValueVar **glib.Variant) (bool, error)

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 [func@GLib.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 [type@GLib.Variant] in @target_value is guaranteed to not be floating.

func ActionPrintDetailedName

func ActionPrintDetailedName(ActionNameVar string, TargetValueVar *glib.Variant) string

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 [func@Gio.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.

func AppInfoCreateFlagsGLibType

func AppInfoCreateFlagsGLibType() types.GType

func AppInfoGLibType

func AppInfoGLibType() types.GType

func AppInfoGetAll

func AppInfoGetAll() *glib.List

Gets a list of all of the applications currently registered on this system.

For desktop files, this includes applications that have [`NoDisplay=true`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-nodisplay) set or are excluded from display by means of [`OnlyShowIn`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-onlyshowin) or [`NotShowIn`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-notshowin). See [method@Gio.AppInfo.should_show].

The returned list does not include applications which have the [`Hidden` key](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-hidden) set.

func AppInfoGetAllForType

func AppInfoGetAllForType(ContentTypeVar string) *glib.List

Gets a list of all [iface@Gio.AppInfo]s for a given content type, including the recommended and fallback [iface@Gio.AppInfo]s. See [func@Gio.AppInfo.get_recommended_for_type] and [func@Gio.AppInfo.get_fallback_for_type].

func AppInfoGetDefaultForTypeAsync

func AppInfoGetDefaultForTypeAsync(ContentTypeVar string, MustSupportUrisVar bool, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously gets the default [iface@Gio.AppInfo] for a given content type.

func AppInfoGetDefaultForUriSchemeAsync

func AppInfoGetDefaultForUriSchemeAsync(UriSchemeVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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`.

func AppInfoGetFallbackForType

func AppInfoGetFallbackForType(ContentTypeVar string) *glib.List

Gets a list of fallback [iface@Gio.AppInfo]s for a given content type, i.e. those applications which claim to support the given content type by MIME type subclassing and not directly.

func AppInfoGetRecommendedForType

func AppInfoGetRecommendedForType(ContentTypeVar string) *glib.List

Gets a list of recommended [iface@Gio.AppInfo]s 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 [method@Gio.AppInfo.set_as_last_used_for_type] has been called.

func AppInfoLaunchDefaultForUri

func AppInfoLaunchDefaultForUri(UriVar string, ContextVar *AppLaunchContext) (bool, error)

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 [func@Gio.AppInfo.launch_default_for_uri_async] instead.

func AppInfoLaunchDefaultForUriAsync

func AppInfoLaunchDefaultForUriAsync(UriVar string, ContextVar *AppLaunchContext, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Async version of [func@Gio.AppInfo.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.

func AppInfoLaunchDefaultForUriFinish

func AppInfoLaunchDefaultForUriFinish(ResultVar AsyncResult) (bool, error)

Finishes an asynchronous launch-default-for-uri operation.

func AppInfoMonitorGLibType

func AppInfoMonitorGLibType() types.GType

func AppInfoResetTypeAssociations

func AppInfoResetTypeAssociations(ContentTypeVar string)

Removes all changes to the type associations done by [method@Gio.AppInfo.set_as_default_for_type], [method@Gio.AppInfo.set_as_default_for_extension], [method@Gio.AppInfo.add_supports_type] or [method@Gio.AppInfo.remove_supports_type].

func AppLaunchContextGLibType

func AppLaunchContextGLibType() types.GType

func ApplicationCommandLineGLibType

func ApplicationCommandLineGLibType() types.GType

func ApplicationFlagsGLibType

func ApplicationFlagsGLibType() types.GType

func ApplicationGLibType

func ApplicationGLibType() types.GType

func ApplicationIdIsValid

func ApplicationIdIsValid(ApplicationIdVar string) bool

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`.

func AskPasswordFlagsGLibType

func AskPasswordFlagsGLibType() types.GType

func AsyncInitableGLibType

func AsyncInitableGLibType() types.GType

func AsyncInitableNewvAsync

func AsyncInitableNewvAsync(ObjectTypeVar types.GType, NParametersVar uint, ParametersVar *gobject.Parameter, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func AsyncResultGLibType

func AsyncResultGLibType() types.GType

func BufferedInputStreamGLibType

func BufferedInputStreamGLibType() types.GType

func BufferedOutputStreamGLibType

func BufferedOutputStreamGLibType() types.GType

func BusGet

func BusGet(BusTypeVar BusType, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func BusNameOwnerFlagsGLibType

func BusNameOwnerFlagsGLibType() types.GType

func BusNameWatcherFlagsGLibType

func BusNameWatcherFlagsGLibType() types.GType

func BusOwnName

func BusOwnName(BusTypeVar BusType, NameVar string, FlagsVar BusNameOwnerFlags, BusAcquiredHandlerVar *BusAcquiredCallback, NameAcquiredHandlerVar *BusNameAcquiredCallback, NameLostHandlerVar *BusNameLostCallback, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) uint

Requests ownership of @name on the bus specified by @bus_type.

It asynchronously calls @name_acquired_handler and @name_lost_handler when the name is acquired and lost, respectively.

Callbacks will be invoked in the thread-default main context (see [method@GLib.MainContext.push_thread_default]) of the thread you are calling this function from.

You are guaranteed that one of the @name_acquired_handler and @name_lost_handler callbacks will be invoked after calling this function — there are three possible cases:

  • @name_lost_handler with a `NULL` connection (if a connection to the bus can’t be made).
  • @bus_acquired_handler then @name_lost_handler (if the name can’t be obtained).
  • @bus_acquired_handler then @name_acquired_handler (if the name was obtained).

When you are done owning the name, call [func@Gio.bus_unown_name] with the owner ID this function returns.

If the name is acquired or lost (for example another application could acquire the name if you allow replacement or the application currently owning the name exits), the handlers are also invoked. If the [class@Gio.DBusConnection] that is used for attempting to own the name closes, then @name_lost_handler is invoked since it is no longer possible for other processes to access the process.

You cannot use [func@Gio.bus_own_name] several times for the same name (unless interleaved with calls to [func@Gio.bus_unown_name]) — only the first call will work.

Another guarantee is that invocations of @name_acquired_handler and @name_lost_handler are guaranteed to alternate; that is, if @name_acquired_handler is invoked then you are guaranteed that the next time one of the handlers is invoked, it will be @name_lost_handler. The reverse is also true.

If you plan on exporting objects (using, for example, [method@Gio.DBusConnection.register_object]), note that it is generally too late to export the objects in @name_acquired_handler. Instead, you can do this in @bus_acquired_handler since you are guaranteed that this will run before @name is requested from the bus.

This behavior makes it very simple to write applications that want to [own names](dbus-name-owning.html#d-bus-name-owning) and export objects. Simply register objects to be exported in @bus_acquired_handler and unregister the objects (if any) in @name_lost_handler.

func BusOwnNameOnConnection

func BusOwnNameOnConnection(ConnectionVar *DBusConnection, NameVar string, FlagsVar BusNameOwnerFlags, NameAcquiredHandlerVar *BusNameAcquiredCallback, NameLostHandlerVar *BusNameLostCallback, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) uint

Like [func@Gio.bus_own_name] but takes a [class@Gio.DBusConnection] instead of a [enum@Gio.BusType].

func BusOwnNameOnConnectionWithClosures

func BusOwnNameOnConnectionWithClosures(ConnectionVar *DBusConnection, NameVar string, FlagsVar BusNameOwnerFlags, NameAcquiredClosureVar *gobject.Closure, NameLostClosureVar *gobject.Closure) uint

Version of [func@Gio.bus_own_name_on_connection] using closures instead of callbacks for easier binding in other languages.

func BusOwnNameWithClosures

func BusOwnNameWithClosures(BusTypeVar BusType, NameVar string, FlagsVar BusNameOwnerFlags, BusAcquiredClosureVar *gobject.Closure, NameAcquiredClosureVar *gobject.Closure, NameLostClosureVar *gobject.Closure) uint

Version of [func@Gio.bus_own_name using closures instead of callbacks for easier binding in other languages.

func BusTypeGLibType

func BusTypeGLibType() types.GType

func BusUnownName

func BusUnownName(OwnerIdVar uint)

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 [struct@GLib.MainContext] after this function has returned. You should continue to iterate the [struct@GLib.MainContext] until the [callback@GLib.DestroyNotify] function passed to [func@Gio.bus_own_name] is called, in order to avoid memory leaks through callbacks queued on the [struct@GLib.MainContext] after it’s stopped being iterated.

func BusUnwatchName

func BusUnwatchName(WatcherIdVar uint)

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.

func BusWatchName

func BusWatchName(BusTypeVar BusType, NameVar string, FlagsVar BusNameWatcherFlags, NameAppearedHandlerVar *BusNameAppearedCallback, NameVanishedHandlerVar *BusNameVanishedCallback, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) uint

Starts watching @name on the bus specified by @bus_type and calls @name_appeared_handler and @name_vanished_handler when the name is known to have an owner respectively known to lose its owner. Callbacks will be invoked in the thread-default main context (see [method@GLib.MainContext.push_thread_default]) of the thread you are calling this function from.

You are guaranteed that one of the handlers will be invoked after calling this function. When you are done watching the name, just call g_bus_unwatch_name() with the watcher id this function returns.

If the name vanishes or appears (for example the application owning the name could restart), the handlers are also invoked. If the #GDBusConnection that is used for watching the name disconnects, then @name_vanished_handler is invoked since it is no longer possible to access the name.

Another guarantee is that invocations of @name_appeared_handler and @name_vanished_handler are guaranteed to alternate; that is, if @name_appeared_handler is invoked then you are guaranteed that the next time one of the handlers is invoked, it will be @name_vanished_handler. The reverse is also true.

This behavior makes it very simple to write applications that want to take action when a certain [name exists](dbus-name-watching.html#d-bus-name-watching). Basically, the application should create object proxies in @name_appeared_handler and destroy them again (if any) in @name_vanished_handler.

func BusWatchNameOnConnection

func BusWatchNameOnConnection(ConnectionVar *DBusConnection, NameVar string, FlagsVar BusNameWatcherFlags, NameAppearedHandlerVar *BusNameAppearedCallback, NameVanishedHandlerVar *BusNameVanishedCallback, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) uint

Like g_bus_watch_name() but takes a #GDBusConnection instead of a #GBusType.

func BusWatchNameOnConnectionWithClosures

func BusWatchNameOnConnectionWithClosures(ConnectionVar *DBusConnection, NameVar string, FlagsVar BusNameWatcherFlags, NameAppearedClosureVar *gobject.Closure, NameVanishedClosureVar *gobject.Closure) uint

Version of g_bus_watch_name_on_connection() using closures instead of callbacks for easier binding in other languages.

func BusWatchNameWithClosures

func BusWatchNameWithClosures(BusTypeVar BusType, NameVar string, FlagsVar BusNameWatcherFlags, NameAppearedClosureVar *gobject.Closure, NameVanishedClosureVar *gobject.Closure) uint

Version of g_bus_watch_name() using closures instead of callbacks for easier binding in other languages.

func BytesIconGLibType

func BytesIconGLibType() types.GType

func CancellableGLibType

func CancellableGLibType() types.GType

func CharsetConverterGLibType

func CharsetConverterGLibType() types.GType

func ContentTypeCanBeExecutable

func ContentTypeCanBeExecutable(TypeVar string) bool

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).

func ContentTypeEquals

func ContentTypeEquals(Type1Var string, Type2Var string) bool

Compares two content types for equality.

func ContentTypeFromMimeType

func ContentTypeFromMimeType(MimeTypeVar string) string

Tries to find a content type based on the mime type name.

func ContentTypeGetDescription

func ContentTypeGetDescription(TypeVar string) string

Gets the human readable description of the content type.

func ContentTypeGetGenericIconName

func ContentTypeGetGenericIconName(TypeVar string) string

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.

func ContentTypeGetMimeDirs

func ContentTypeGetMimeDirs() []string

Get the list of directories which MIME data is loaded from. See g_content_type_set_mime_dirs() for details.

func ContentTypeGetMimeType

func ContentTypeGetMimeType(TypeVar string) string

Gets the mime type for the content type, if one is registered.

func ContentTypeGuess

func ContentTypeGuess(FilenameVar *string, DataVar []byte, DataSizeVar uint, ResultUncertainVar *bool) string

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.

func ContentTypeGuessForTree

func ContentTypeGuessForTree(RootVar File) []string

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().

func ContentTypeIsA

func ContentTypeIsA(TypeVar string, SupertypeVar string) bool

Determines if @type is a subset of @supertype.

func ContentTypeIsMimeType

func ContentTypeIsMimeType(TypeVar string, MimeTypeVar string) bool

Determines if @type is a subset of @mime_type. Convenience wrapper around g_content_type_is_a().

func ContentTypeIsUnknown

func ContentTypeIsUnknown(TypeVar string) bool

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.

func ContentTypeSetMimeDirs

func ContentTypeSetMimeDirs(DirsVar []string)

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:

|[<!-- language="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 ();

]|

func ContentTypesGetRegistered

func ContentTypesGetRegistered() *glib.List

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)`.

func ConverterFlagsGLibType

func ConverterFlagsGLibType() types.GType

func ConverterGLibType

func ConverterGLibType() types.GType

func ConverterInputStreamGLibType

func ConverterInputStreamGLibType() types.GType

func ConverterOutputStreamGLibType

func ConverterOutputStreamGLibType() types.GType

func ConverterResultGLibType

func ConverterResultGLibType() types.GType

func CredentialsGLibType

func CredentialsGLibType() types.GType

func CredentialsTypeGLibType

func CredentialsTypeGLibType() types.GType

func DBusActionGroupGLibType

func DBusActionGroupGLibType() types.GType

func DBusAnnotationInfoGLibType

func DBusAnnotationInfoGLibType() types.GType

func DBusArgInfoGLibType

func DBusArgInfoGLibType() types.GType

func DBusAuthObserverGLibType

func DBusAuthObserverGLibType() types.GType

func DBusCallFlagsGLibType

func DBusCallFlagsGLibType() types.GType

func DBusCapabilityFlagsGLibType

func DBusCapabilityFlagsGLibType() types.GType

func DBusConnectionFlagsGLibType

func DBusConnectionFlagsGLibType() types.GType

func DBusConnectionGLibType

func DBusConnectionGLibType() types.GType

func DBusConnectionNew

func DBusConnectionNew(StreamVar *IOStream, GuidVar *string, FlagsVar DBusConnectionFlags, ObserverVar *DBusAuthObserver, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func DBusConnectionNewForAddress

func DBusConnectionNewForAddress(AddressVar string, FlagsVar DBusConnectionFlags, ObserverVar *DBusAuthObserver, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func DBusErrorGLibType

func DBusErrorGLibType() types.GType

func DBusInterfaceGLibType

func DBusInterfaceGLibType() types.GType

func DBusInterfaceInfoGLibType

func DBusInterfaceInfoGLibType() types.GType

func DBusInterfaceSkeletonFlagsGLibType

func DBusInterfaceSkeletonFlagsGLibType() types.GType

func DBusInterfaceSkeletonGLibType

func DBusInterfaceSkeletonGLibType() types.GType

func DBusMenuModelGLibType

func DBusMenuModelGLibType() types.GType

func DBusMessageByteOrderGLibType

func DBusMessageByteOrderGLibType() types.GType

func DBusMessageBytesNeeded

func DBusMessageBytesNeeded(BlobVar []byte, BlobLenVar uint) (int, error)

Utility function to calculate how many bytes are needed to completely deserialize the D-Bus message stored at @blob.

func DBusMessageFlagsGLibType

func DBusMessageFlagsGLibType() types.GType

func DBusMessageGLibType

func DBusMessageGLibType() types.GType

func DBusMessageHeaderFieldGLibType

func DBusMessageHeaderFieldGLibType() types.GType

func DBusMessageTypeGLibType

func DBusMessageTypeGLibType() types.GType

func DBusMethodInfoGLibType

func DBusMethodInfoGLibType() types.GType

func DBusMethodInvocationGLibType

func DBusMethodInvocationGLibType() types.GType

func DBusNodeInfoGLibType

func DBusNodeInfoGLibType() types.GType

func DBusObjectGLibType

func DBusObjectGLibType() types.GType

func DBusObjectManagerClientFlagsGLibType

func DBusObjectManagerClientFlagsGLibType() types.GType

func DBusObjectManagerClientGLibType

func DBusObjectManagerClientGLibType() types.GType

func DBusObjectManagerClientNew

func DBusObjectManagerClientNew(ConnectionVar *DBusConnection, FlagsVar DBusObjectManagerClientFlags, NameVar string, ObjectPathVar string, GetProxyTypeFuncVar *DBusProxyTypeFunc, GetProxyTypeUserDataVar uintptr, GetProxyTypeDestroyNotifyVar *glib.DestroyNotify, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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 (see [method@GLib.MainContext.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.

func DBusObjectManagerClientNewForBus

func DBusObjectManagerClientNewForBus(BusTypeVar BusType, FlagsVar DBusObjectManagerClientFlags, NameVar string, ObjectPathVar string, GetProxyTypeFuncVar *DBusProxyTypeFunc, GetProxyTypeUserDataVar uintptr, GetProxyTypeDestroyNotifyVar *glib.DestroyNotify, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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 context (see [method@GLib.MainContext.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.

func DBusObjectManagerGLibType

func DBusObjectManagerGLibType() types.GType

func DBusObjectManagerServerGLibType

func DBusObjectManagerServerGLibType() types.GType

func DBusObjectProxyGLibType

func DBusObjectProxyGLibType() types.GType

func DBusObjectSkeletonGLibType

func DBusObjectSkeletonGLibType() types.GType

func DBusPropertyInfoFlagsGLibType

func DBusPropertyInfoFlagsGLibType() types.GType

func DBusPropertyInfoGLibType

func DBusPropertyInfoGLibType() types.GType

func DBusProxyFlagsGLibType

func DBusProxyFlagsGLibType() types.GType

func DBusProxyGLibType

func DBusProxyGLibType() types.GType

func DBusProxyNew

func DBusProxyNew(ConnectionVar *DBusConnection, FlagsVar DBusProxyFlags, InfoVar *DBusInterfaceInfo, NameVar *string, ObjectPathVar string, InterfaceNameVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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][class@Gio.DBusProxy#a-watch-proxy-example].

func DBusProxyNewForBus

func DBusProxyNewForBus(BusTypeVar BusType, FlagsVar DBusProxyFlags, InfoVar *DBusInterfaceInfo, NameVar string, ObjectPathVar string, InterfaceNameVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Like g_dbus_proxy_new() but takes a #GBusType instead of a #GDBusConnection.

#GDBusProxy is used in this [example][class@Gio.DBusProxy#a-watch-proxy-example].

func DBusSendMessageFlagsGLibType

func DBusSendMessageFlagsGLibType() types.GType

func DBusServerFlagsGLibType

func DBusServerFlagsGLibType() types.GType

func DBusServerGLibType

func DBusServerGLibType() types.GType

func DBusSignalFlagsGLibType

func DBusSignalFlagsGLibType() types.GType

func DBusSignalInfoGLibType

func DBusSignalInfoGLibType() types.GType

func DBusSubtreeFlagsGLibType

func DBusSubtreeFlagsGLibType() types.GType

func DataInputStreamGLibType

func DataInputStreamGLibType() types.GType

func DataOutputStreamGLibType

func DataOutputStreamGLibType() types.GType

func DataStreamByteOrderGLibType

func DataStreamByteOrderGLibType() types.GType

func DataStreamNewlineTypeGLibType

func DataStreamNewlineTypeGLibType() types.GType

func DatagramBasedGLibType

func DatagramBasedGLibType() types.GType

func DbusAddressEscapeValue

func DbusAddressEscapeValue(StringVar string) 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`.

func DbusAddressGetForBusSync

func DbusAddressGetForBusSync(BusTypeVar BusType, CancellableVar *Cancellable) (string, error)

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).

func DbusAddressGetStream

func DbusAddressGetStream(AddressVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func DbusAnnotationInfoLookup

func DbusAnnotationInfoLookup(AnnotationsVar uintptr, NameVar string) string

Looks up the value of an annotation.

The cost of this function is O(n) in number of annotations.

func DbusErrorEncodeGerror

func DbusErrorEncodeGerror(ErrorVar *glib.Error) string

Creates a D-Bus error name to use for @error.

If @error matches a registered error (see [func@Gio.DBusError.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 [type@GLib.Error] using [func@Gio.DBusError.new_for_dbus_error].

This function is typically only used in object mappings to put a [type@GLib.Error] on the wire. Regular applications should not use it.

func DbusErrorGetRemoteError

func DbusErrorGetRemoteError(ErrorVar *glib.Error) string

Gets the D-Bus error name used for @error, if any.

This function is guaranteed to return a D-Bus error name for all [type@GLib.Error]s returned from functions handling remote method calls (for example, [method@Gio.DBusConnection.call_finish]) unless [func@Gio.DBusError.strip_remote_error] has already been used on @error.

func DbusErrorIsRemoteError

func DbusErrorIsRemoteError(ErrorVar *glib.Error) bool

Checks if @error represents an error received via D-Bus from a remote peer.

If so, use [func@Gio.DBusError.get_remote_error] to get the name of the error.

func DbusErrorNewForDbusError

func DbusErrorNewForDbusError(DbusErrorNameVar string, DbusErrorMessageVar string) *glib.Error

Creates a [type@GLib.Error] based on the contents of @dbus_error_name and @dbus_error_message.

Errors registered with [func@Gio.DBusError.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 [func@Gio.DBusError.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 [func@Gio.DBusError.encode_gerror] the error domain and code encoded in the name is used to create the [type@GLib.Error]. Also, @dbus_error_name is added to the error message such that it can be recovered with [func@Gio.DBusError.get_remote_error].

Otherwise, a [type@GLib.Error] with the error code [error@Gio.IOErrorEnum.DBUS_ERROR] in the [error@Gio.IOErrorEnum] error domain is returned. Also, @dbus_error_name is added to the error message such that it can be recovered with [func@Gio.DBusError.get_remote_error].

In all three cases, @dbus_error_name can always be recovered from the returned [type@GLib.Error] using the [func@Gio.DBusError.get_remote_error] function (unless [func@Gio.DBusError.strip_remote_error] hasn’t been used on the returned error).

This function is typically only used in object mappings to prepare [type@GLib.Error] instances for applications. Regular applications should not use it.

func DbusErrorQuark

func DbusErrorQuark() glib.Quark

func DbusErrorRegisterError

func DbusErrorRegisterError(ErrorDomainVar glib.Quark, ErrorCodeVar int, DbusErrorNameVar string) bool

Creates an association mapping between @dbus_error_name and [type@GLib.Error]s specified by @error_domain and @error_code.

This is typically done in the function that returns the [type@GLib.Quark] for an error domain.

func DbusErrorRegisterErrorDomain

func DbusErrorRegisterErrorDomain(ErrorDomainQuarkNameVar string, QuarkVolatileVar *uint, EntriesVar []DBusErrorEntry, NumEntriesVar uint)

Helper function for associating a [type@GLib.Error] 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`.

func DbusErrorStripRemoteError

func DbusErrorStripRemoteError(ErrorVar *glib.Error) bool

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.

func DbusErrorUnregisterError

func DbusErrorUnregisterError(ErrorDomainVar glib.Quark, ErrorCodeVar int, DbusErrorNameVar string) bool

Destroys an association previously set up with [func@Gio.DBusError.register_error].

func DbusEscapeObjectPath

func DbusEscapeObjectPath(SVar string) string

This is a language binding friendly version of g_dbus_escape_object_path_bytestring().

func DbusEscapeObjectPathBytestring

func DbusEscapeObjectPathBytestring(BytesVar []byte) string

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().

func DbusGenerateGuid

func DbusGenerateGuid() string

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).

func DbusGvalueToGvariant

func DbusGvalueToGvariant(GvalueVar *gobject.Value, TypeVar *glib.VariantType) *glib.Variant

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.

func DbusGvariantToGvalue

func DbusGvariantToGvalue(ValueVar *glib.Variant, OutGvalueVar *gobject.Value)

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.

func DbusIsAddress

func DbusIsAddress(StringVar string) bool

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.

func DbusIsErrorName

func DbusIsErrorName(StringVar string) bool

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.

func DbusIsGuid

func DbusIsGuid(StringVar string) bool

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.

func DbusIsInterfaceName

func DbusIsInterfaceName(StringVar string) bool

Checks if @string is a valid D-Bus interface name.

func DbusIsMemberName

func DbusIsMemberName(StringVar string) bool

Checks if @string is a valid D-Bus member (e.g. signal or method) name.

func DbusIsName

func DbusIsName(StringVar string) bool

Checks if @string is a valid D-Bus bus name (either unique or well-known).

func DbusIsSupportedAddress

func DbusIsSupportedAddress(StringVar string) (bool, error)

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).

func DbusIsUniqueName

func DbusIsUniqueName(StringVar string) bool

Checks if @string is a valid D-Bus unique bus name.

func DbusUnescapeObjectPath

func DbusUnescapeObjectPath(SVar string) uintptr

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).

func DebugControllerDBusGLibType

func DebugControllerDBusGLibType() types.GType

func DebugControllerGLibType

func DebugControllerGLibType() types.GType

func DriveGLibType

func DriveGLibType() types.GType

func DriveStartFlagsGLibType

func DriveStartFlagsGLibType() types.GType

func DriveStartStopTypeGLibType

func DriveStartStopTypeGLibType() types.GType

func DtlsClientConnectionGLibType

func DtlsClientConnectionGLibType() types.GType

func DtlsConnectionGLibType

func DtlsConnectionGLibType() types.GType

func DtlsServerConnectionGLibType

func DtlsServerConnectionGLibType() types.GType

func EcnCodePointGLibType added in v0.5.0

func EcnCodePointGLibType() types.GType

func EmblemGLibType

func EmblemGLibType() types.GType

func EmblemOriginGLibType

func EmblemOriginGLibType() types.GType

func EmblemedIconGLibType

func EmblemedIconGLibType() types.GType

func FileAttributeInfoFlagsGLibType

func FileAttributeInfoFlagsGLibType() types.GType

func FileAttributeInfoListGLibType

func FileAttributeInfoListGLibType() types.GType

func FileAttributeMatcherGLibType

func FileAttributeMatcherGLibType() types.GType

func FileAttributeStatusGLibType

func FileAttributeStatusGLibType() types.GType

func FileAttributeTypeGLibType

func FileAttributeTypeGLibType() types.GType

func FileCopyFlagsGLibType

func FileCopyFlagsGLibType() types.GType

func FileCreateFlagsGLibType

func FileCreateFlagsGLibType() types.GType

func FileEnumeratorGLibType

func FileEnumeratorGLibType() types.GType

func FileGLibType

func FileGLibType() types.GType

func FileIOStreamGLibType

func FileIOStreamGLibType() types.GType

func FileIconGLibType

func FileIconGLibType() types.GType

func FileInfoGLibType

func FileInfoGLibType() types.GType

func FileInputStreamGLibType

func FileInputStreamGLibType() types.GType

func FileMeasureFlagsGLibType

func FileMeasureFlagsGLibType() types.GType

func FileMonitorEventGLibType

func FileMonitorEventGLibType() types.GType

func FileMonitorFlagsGLibType

func FileMonitorFlagsGLibType() types.GType

func FileMonitorGLibType

func FileMonitorGLibType() types.GType

func FileNewTmpAsync

func FileNewTmpAsync(TmplVar *string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func FileNewTmpDirAsync

func FileNewTmpDirAsync(TmplVar *string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func FileOutputStreamGLibType

func FileOutputStreamGLibType() types.GType

func FileQueryInfoFlagsGLibType

func FileQueryInfoFlagsGLibType() types.GType

func FileTypeGLibType

func FileTypeGLibType() types.GType

func FilenameCompleterGLibType

func FilenameCompleterGLibType() types.GType

func FilesystemPreviewTypeGLibType

func FilesystemPreviewTypeGLibType() types.GType

func FilterInputStreamGLibType

func FilterInputStreamGLibType() types.GType

func FilterOutputStreamGLibType

func FilterOutputStreamGLibType() types.GType

func IOErrorEnumGLibType

func IOErrorEnumGLibType() types.GType

func IOModuleGLibType

func IOModuleGLibType() types.GType

func IOModuleQuery

func IOModuleQuery() []string

Optional API for GIO modules to implement.

Should return a list of all the extension points that may be implemented in this module.

This method will not be called in normal use, however it may be called when probing existing modules and recording which extension points that this model is used for. This means we won't have to load and initialize this module unless its needed.

If this function is not implemented by the module the module will always be loaded, initialized and then unloaded on application startup so that it can register its extension points during init.

Note that a module need not actually implement all the extension points that g_io_module_query() returns, since the exact list of extension may depend on runtime issues. However all extension points actually implemented must be returned by g_io_module_query() (if defined).

When installing a module that implements g_io_module_query() you must run gio-querymodules in order to build the cache files required for lazy loading.

Since 2.56, this function should be named `g_io_<modulename>_query`, where `modulename` is the plugin’s filename with the `lib` or `libgio` prefix and everything after the first dot removed, and with `-` replaced with `_` throughout. For example, `libgiognutls-helper.so` becomes `gnutls_helper`. Using the new symbol names avoids name clashes when building modules statically. The old symbol names continue to be supported, but cannot be used for static builds.

func IOModuleScopeFlagsGLibType

func IOModuleScopeFlagsGLibType() types.GType

func IOStreamGLibType

func IOStreamGLibType() types.GType

func IOStreamSpliceFinish

func IOStreamSpliceFinish(ResultVar AsyncResult) (bool, error)

Finishes an asynchronous io stream splice operation.

func IOStreamSpliceFlagsGLibType

func IOStreamSpliceFlagsGLibType() types.GType

func IPTosMessageGLibType added in v0.5.0

func IPTosMessageGLibType() types.GType

func IPv6TclassMessageGLibType added in v0.5.0

func IPv6TclassMessageGLibType() types.GType

func IconGLibType

func IconGLibType() types.GType

func InetAddressGLibType

func InetAddressGLibType() types.GType

func InetAddressMaskGLibType

func InetAddressMaskGLibType() types.GType

func InetSocketAddressGLibType

func InetSocketAddressGLibType() types.GType

func InitableGLibType

func InitableGLibType() types.GType

func InitableNewv

func InitableNewv(ObjectTypeVar types.GType, NParametersVar uint, ParametersVar []gobject.Parameter, CancellableVar *Cancellable) (*gobject.Object, error)

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.

func InputStreamGLibType

func InputStreamGLibType() types.GType

func IoErrorQuark

func IoErrorQuark() glib.Quark

Gets the GIO Error Quark.

func IoModulesLoadAllInDirectory

func IoModulesLoadAllInDirectory(DirnameVar string) *glib.List

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.

func IoModulesLoadAllInDirectoryWithScope

func IoModulesLoadAllInDirectoryWithScope(DirnameVar string, ScopeVar *IOModuleScope) *glib.List

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.

func IoModulesScanAllInDirectory

func IoModulesScanAllInDirectory(DirnameVar string)

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().

func IoModulesScanAllInDirectoryWithScope

func IoModulesScanAllInDirectoryWithScope(DirnameVar string, ScopeVar *IOModuleScope)

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().

func IoSchedulerCancelAllJobs

func IoSchedulerCancelAllJobs()

Cancels all cancellable I/O jobs.

A job is cancellable if a #GCancellable was passed into g_io_scheduler_push_job().

func IoSchedulerPushJob

func IoSchedulerPushJob(JobFuncVar *IOSchedulerJobFunc, UserDataVar uintptr, NotifyVar *glib.DestroyNotify, IoPriorityVar int, CancellableVar *Cancellable)

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().

func ListModelGLibType

func ListModelGLibType() types.GType

func ListStoreGLibType

func ListStoreGLibType() types.GType

func LoadableIconGLibType

func LoadableIconGLibType() types.GType

func MemoryInputStreamGLibType

func MemoryInputStreamGLibType() types.GType

func MemoryMonitorGLibType

func MemoryMonitorGLibType() types.GType

func MemoryMonitorWarningLevelGLibType

func MemoryMonitorWarningLevelGLibType() types.GType

func MemoryOutputStreamGLibType

func MemoryOutputStreamGLibType() types.GType
func MenuAttributeIterGLibType() types.GType
func MenuGLibType() types.GType
func MenuItemGLibType() types.GType
func MenuLinkIterGLibType() types.GType
func MenuModelGLibType() types.GType

func MountGLibType

func MountGLibType() types.GType

func MountMountFlagsGLibType

func MountMountFlagsGLibType() types.GType

func MountOperationGLibType

func MountOperationGLibType() types.GType

func MountOperationResultGLibType

func MountOperationResultGLibType() types.GType

func MountUnmountFlagsGLibType

func MountUnmountFlagsGLibType() types.GType

func NativeSocketAddressGLibType

func NativeSocketAddressGLibType() types.GType

func NativeVolumeMonitorGLibType

func NativeVolumeMonitorGLibType() types.GType

func NetworkAddressGLibType

func NetworkAddressGLibType() types.GType

func NetworkConnectivityGLibType

func NetworkConnectivityGLibType() types.GType

func NetworkMonitorGLibType

func NetworkMonitorGLibType() types.GType

func NetworkServiceGLibType

func NetworkServiceGLibType() types.GType

func NetworkingInit

func NetworkingInit()

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).

func NotificationGLibType

func NotificationGLibType() types.GType

func NotificationPriorityGLibType

func NotificationPriorityGLibType() types.GType

func OutputStreamGLibType

func OutputStreamGLibType() types.GType

func OutputStreamSpliceFlagsGLibType

func OutputStreamSpliceFlagsGLibType() types.GType

func PasswordSaveGLibType

func PasswordSaveGLibType() types.GType

func PermissionGLibType

func PermissionGLibType() types.GType

func PollableInputStreamGLibType

func PollableInputStreamGLibType() types.GType

func PollableOutputStreamGLibType

func PollableOutputStreamGLibType() types.GType

func PollableReturnGLibType

func PollableReturnGLibType() types.GType

func PollableSourceNew

func PollableSourceNew(PollableStreamVar *gobject.Object) *glib.Source

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.

func PollableSourceNewFull

func PollableSourceNewFull(PollableStreamVar *gobject.Object, ChildSourceVar *glib.Source, CancellableVar *Cancellable) *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.

func PollableStreamRead

func PollableStreamRead(StreamVar *InputStream, BufferVar []byte, CountVar uint, BlockingVar bool, CancellableVar *Cancellable) (int, error)

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.

func PollableStreamWrite

func PollableStreamWrite(StreamVar *OutputStream, BufferVar []byte, CountVar uint, BlockingVar bool, CancellableVar *Cancellable) (int, error)

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.

func PollableStreamWriteAll

func PollableStreamWriteAll(StreamVar *OutputStream, BufferVar []byte, CountVar uint, BlockingVar bool, BytesWrittenVar *uint, CancellableVar *Cancellable) (bool, error)

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.

func PowerProfileMonitorGLibType

func PowerProfileMonitorGLibType() types.GType

func PropertyActionGLibType

func PropertyActionGLibType() types.GType

func ProxyAddressEnumeratorGLibType

func ProxyAddressEnumeratorGLibType() types.GType

func ProxyAddressGLibType

func ProxyAddressGLibType() types.GType

func ProxyGLibType

func ProxyGLibType() types.GType

func ProxyResolverGLibType

func ProxyResolverGLibType() types.GType

func RemoteActionGroupGLibType

func RemoteActionGroupGLibType() types.GType

func ResolverErrorGLibType

func ResolverErrorGLibType() types.GType

func ResolverErrorQuark

func ResolverErrorQuark() glib.Quark

Gets the #GResolver Error Quark.

func ResolverFreeAddresses

func ResolverFreeAddresses(AddressesVar *glib.List)

Frees @addresses (which should be the return value from g_resolver_lookup_by_name() or g_resolver_lookup_by_name_finish()). (This is a convenience method; you can also simply free the results by hand.)

func ResolverFreeTargets

func ResolverFreeTargets(TargetsVar *glib.List)

Frees @targets (which should be the return value from g_resolver_lookup_service() or g_resolver_lookup_service_finish()). (This is a convenience method; you can also simply free the results by hand.)

func ResolverGLibType

func ResolverGLibType() types.GType

func ResolverNameLookupFlagsGLibType

func ResolverNameLookupFlagsGLibType() types.GType

func ResolverRecordTypeGLibType

func ResolverRecordTypeGLibType() types.GType

func ResourceErrorGLibType

func ResourceErrorGLibType() types.GType

func ResourceErrorQuark

func ResourceErrorQuark() glib.Quark

Gets the [struct@Gio.Resource] Error Quark.

func ResourceFlagsGLibType

func ResourceFlagsGLibType() types.GType

func ResourceGLibType

func ResourceGLibType() types.GType

func ResourceLookupFlagsGLibType

func ResourceLookupFlagsGLibType() types.GType

func ResourcesEnumerateChildren

func ResourcesEnumerateChildren(PathVar string, LookupFlagsVar ResourceLookupFlags) ([]string, error)

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 [func@GLib.strfreev].

@lookup_flags controls the behaviour of the lookup.

func ResourcesGetInfo

func ResourcesGetInfo(PathVar string, LookupFlagsVar ResourceLookupFlags, SizeVar *uint, FlagsVar *uint32) (bool, error)

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.

func ResourcesHasChildren

func ResourcesHasChildren(PathVar string) bool

Returns whether the specified @path in the set of globally registered resources has children.

func ResourcesLookupData

func ResourcesLookupData(PathVar string, LookupFlagsVar ResourceLookupFlags) (*glib.Bytes, error)

Looks for a file at the specified @path in the set of globally registered resources and returns a [struct@GLib.Bytes] 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 [struct@GLib.Bytes].

For uncompressed resource files this is a pointer directly into the resource bundle, which is typically in some read-only 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.

func ResourcesRegister

func ResourcesRegister(ResourceVar *Resource)

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 [func@Gio.resources_lookup_data].

func ResourcesUnregister

func ResourcesUnregister(ResourceVar *Resource)

Unregisters the resource from the process-global set of resources.

func SeekableGLibType

func SeekableGLibType() types.GType

func SettingsBackendFlattenTree

func SettingsBackendFlattenTree(TreeVar *glib.Tree, PathVar *string, KeysVar *[]string, ValuesVar *uintptr)

Calculate the longest common prefix of all keys in a tree and write out an array of the key names relative to that prefix and, optionally, the value to store at each of those keys.

You must free the value returned in @path, @keys and @values using g_free(). You should not attempt to free or unref the contents of @keys or @values.

func SettingsBackendGLibType

func SettingsBackendGLibType() types.GType

func SettingsBindFlagsGLibType

func SettingsBindFlagsGLibType() types.GType

func SettingsGLibType

func SettingsGLibType() types.GType

func SettingsListRelocatableSchemas

func SettingsListRelocatableSchemas() []string

Deprecated.

func SettingsListSchemas

func SettingsListSchemas() []string

Deprecated.

func SettingsSchemaGLibType

func SettingsSchemaGLibType() types.GType

func SettingsSchemaKeyGLibType

func SettingsSchemaKeyGLibType() types.GType

func SettingsSchemaSourceGLibType

func SettingsSchemaSourceGLibType() types.GType

func SettingsSync

func SettingsSync()

Ensures that all pending operations are complete for the default backend.

Writes made to a [class@Gio.Settings] are handled asynchronously. For this reason, it is very unlikely that the changes have it to disk by the time [method@Gio.Settings.set] returns.

This call will block until all of the writes have made it to the backend. Since the main loop is not running, no change notifications will be dispatched during this call (but some may be queued by the time the call is done).

func SettingsUnbind

func SettingsUnbind(ObjectVar *gobject.Object, PropertyVar string)

Removes an existing binding for @property on @object.

Note that bindings are automatically removed when the object is finalized, so it is rarely necessary to call this function.

func SimpleActionGLibType

func SimpleActionGLibType() types.GType

func SimpleActionGroupGLibType

func SimpleActionGroupGLibType() types.GType

func SimpleAsyncReportErrorInIdle

func SimpleAsyncReportErrorInIdle(ObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, UserDataVar uintptr, DomainVar glib.Quark, CodeVar int, FormatVar string, varArgs ...interface{})

Reports an error in an asynchronous function in an idle function by directly setting the contents of the #GAsyncResult with the given error information.

func SimpleAsyncReportGerrorInIdle

func SimpleAsyncReportGerrorInIdle(ObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, UserDataVar uintptr, ErrorVar *glib.Error)

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.

func SimpleAsyncReportTakeGerrorInIdle

func SimpleAsyncReportTakeGerrorInIdle(ObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, UserDataVar uintptr, ErrorVar *glib.Error)

Reports an error in an idle function. Similar to g_simple_async_report_gerror_in_idle(), but takes over the caller's ownership of @error, so the caller does not have to free it any more.

func SimpleAsyncResultGLibType

func SimpleAsyncResultGLibType() types.GType

func SimpleAsyncResultIsValid

func SimpleAsyncResultIsValid(ResultVar AsyncResult, SourceVar *gobject.Object, SourceTagVar uintptr) bool

Ensures that the data passed to the _finish function of an async operation is consistent. Three checks are performed.

First, @result is checked to ensure that it is really a #GSimpleAsyncResult. Second, @source is checked to ensure that it matches the source object of @result. Third, @source_tag is checked to ensure that it is equal to the @source_tag argument given to g_simple_async_result_new() (which, by convention, is a pointer to the _async function corresponding to the _finish function from which this function is called). (Alternatively, if either @source_tag or @result's source tag is %NULL, then the source tag check is skipped.)

func SimpleIOStreamGLibType

func SimpleIOStreamGLibType() types.GType

func SimplePermissionGLibType

func SimplePermissionGLibType() types.GType

func SimpleProxyResolverGLibType

func SimpleProxyResolverGLibType() types.GType

func SocketAddressEnumeratorGLibType

func SocketAddressEnumeratorGLibType() types.GType

func SocketAddressGLibType

func SocketAddressGLibType() types.GType

func SocketClientEventGLibType

func SocketClientEventGLibType() types.GType

func SocketClientGLibType

func SocketClientGLibType() types.GType

func SocketConnectableGLibType

func SocketConnectableGLibType() types.GType

func SocketConnectionFactoryLookupType

func SocketConnectionFactoryLookupType(FamilyVar SocketFamily, TypeVar SocketType, ProtocolIdVar int) types.GType

Looks up the #GType to be used when creating socket connections on sockets with the specified @family, @type and @protocol_id.

If no type is registered, the #GSocketConnection base type is returned.

func SocketConnectionFactoryRegisterType

func SocketConnectionFactoryRegisterType(GTypeVar types.GType, FamilyVar SocketFamily, TypeVar SocketType, ProtocolVar int)

Looks up the #GType to be used when creating socket connections on sockets with the specified @family, @type and @protocol.

If no type is registered, the #GSocketConnection base type is returned.

func SocketConnectionGLibType

func SocketConnectionGLibType() types.GType

func SocketControlMessageGLibType

func SocketControlMessageGLibType() types.GType

func SocketFamilyGLibType

func SocketFamilyGLibType() types.GType

func SocketGLibType

func SocketGLibType() types.GType

func SocketListenerEventGLibType

func SocketListenerEventGLibType() types.GType

func SocketListenerGLibType

func SocketListenerGLibType() types.GType

func SocketMsgFlagsGLibType

func SocketMsgFlagsGLibType() types.GType

func SocketProtocolGLibType

func SocketProtocolGLibType() types.GType

func SocketServiceGLibType

func SocketServiceGLibType() types.GType

func SocketTypeGLibType

func SocketTypeGLibType() types.GType

func SrvTargetGLibType

func SrvTargetGLibType() types.GType

func SrvTargetListSort

func SrvTargetListSort(TargetsVar *glib.List) *glib.List

Sorts @targets in place according to the algorithm in RFC 2782.

func SubprocessFlagsGLibType

func SubprocessFlagsGLibType() types.GType

func SubprocessGLibType

func SubprocessGLibType() types.GType

func SubprocessLauncherGLibType

func SubprocessLauncherGLibType() types.GType

func TaskGLibType

func TaskGLibType() types.GType

func TaskIsValid

func TaskIsValid(ResultVar AsyncResult, SourceObjectVar *gobject.Object) bool

Checks that @result is a #GTask, and that @source_object is its source object (or that @source_object is %NULL and @result has no source object). This can be used in g_return_if_fail() checks.

func TaskReportError

func TaskReportError(SourceObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, CallbackDataVar uintptr, SourceTagVar uintptr, ErrorVar *glib.Error)

Creates a #GTask and then immediately calls g_task_return_error() on it. Use this in the wrapper function of an asynchronous method when you want to avoid even calling the virtual method. You can then use g_async_result_is_tagged() in the finish method wrapper to check if the result there is tagged as having been created by the wrapper method, and deal with it appropriately if so.

See also g_task_report_new_error().

func TaskReportNewError

func TaskReportNewError(SourceObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, CallbackDataVar uintptr, SourceTagVar uintptr, DomainVar glib.Quark, CodeVar int, FormatVar string, varArgs ...interface{})

Creates a #GTask and then immediately calls g_task_return_new_error() on it. Use this in the wrapper function of an asynchronous method when you want to avoid even calling the virtual method. You can then use g_async_result_is_tagged() in the finish method wrapper to check if the result there is tagged as having been created by the wrapper method, and deal with it appropriately if so.

See also g_task_report_error().

func TcpConnectionGLibType

func TcpConnectionGLibType() types.GType

func TcpWrapperConnectionGLibType

func TcpWrapperConnectionGLibType() types.GType

func TestDBusFlagsGLibType

func TestDBusFlagsGLibType() types.GType

func TestDBusGLibType

func TestDBusGLibType() types.GType

func TestDBusUnset

func TestDBusUnset()

Unset DISPLAY and DBUS_SESSION_BUS_ADDRESS env variables to ensure the test won't use user's session bus.

This is useful for unit tests that want to verify behaviour when no session bus is running. It is not necessary to call this if unit test already calls g_test_dbus_up() before acquiring the session bus.

func ThemedIconGLibType

func ThemedIconGLibType() types.GType

func ThreadedResolverGLibType

func ThreadedResolverGLibType() types.GType

func ThreadedSocketServiceGLibType

func ThreadedSocketServiceGLibType() types.GType

func TlsAuthenticationModeGLibType

func TlsAuthenticationModeGLibType() types.GType

func TlsBackendGLibType

func TlsBackendGLibType() types.GType

func TlsCertificateFlagsGLibType

func TlsCertificateFlagsGLibType() types.GType

func TlsCertificateGLibType

func TlsCertificateGLibType() types.GType

func TlsCertificateListNewFromFile

func TlsCertificateListNewFromFile(FileVar string) (*glib.List, error)

Creates one or more #GTlsCertificates from the PEM-encoded data in @file. If @file cannot be read or parsed, the function will return %NULL and set @error. If @file does not contain any PEM-encoded certificates, this will return an empty list and not set @error.

func TlsCertificateRequestFlagsGLibType

func TlsCertificateRequestFlagsGLibType() types.GType

func TlsChannelBindingErrorGLibType

func TlsChannelBindingErrorGLibType() types.GType

func TlsChannelBindingErrorQuark

func TlsChannelBindingErrorQuark() glib.Quark

Gets the TLS channel binding error quark.

func TlsChannelBindingTypeGLibType

func TlsChannelBindingTypeGLibType() types.GType

func TlsClientConnectionGLibType

func TlsClientConnectionGLibType() types.GType

func TlsConnectionGLibType

func TlsConnectionGLibType() types.GType

func TlsDatabaseGLibType

func TlsDatabaseGLibType() types.GType

func TlsDatabaseLookupFlagsGLibType

func TlsDatabaseLookupFlagsGLibType() types.GType

func TlsDatabaseVerifyFlagsGLibType

func TlsDatabaseVerifyFlagsGLibType() types.GType

func TlsErrorGLibType

func TlsErrorGLibType() types.GType

func TlsErrorQuark

func TlsErrorQuark() glib.Quark

Gets the TLS error quark.

func TlsFileDatabaseGLibType

func TlsFileDatabaseGLibType() types.GType

func TlsInteractionGLibType

func TlsInteractionGLibType() types.GType

func TlsInteractionResultGLibType

func TlsInteractionResultGLibType() types.GType

func TlsPasswordFlagsGLibType

func TlsPasswordFlagsGLibType() types.GType

func TlsPasswordGLibType

func TlsPasswordGLibType() types.GType

func TlsProtocolVersionGLibType

func TlsProtocolVersionGLibType() types.GType

func TlsRehandshakeModeGLibType

func TlsRehandshakeModeGLibType() types.GType

func TlsServerConnectionGLibType

func TlsServerConnectionGLibType() types.GType

func UnixConnectionGLibType

func UnixConnectionGLibType() types.GType

func UnixCredentialsMessageGLibType

func UnixCredentialsMessageGLibType() types.GType

func UnixCredentialsMessageIsSupported

func UnixCredentialsMessageIsSupported() bool

Checks if passing #GCredentials on a #GSocket is supported on this platform.

func UnixFDListGLibType

func UnixFDListGLibType() types.GType

func UnixSocketAddressAbstractNamesSupported

func UnixSocketAddressAbstractNamesSupported() bool

Checks if abstract UNIX domain socket names are supported.

func UnixSocketAddressGLibType

func UnixSocketAddressGLibType() types.GType

func UnixSocketAddressTypeGLibType

func UnixSocketAddressTypeGLibType() types.GType

func VfsGLibType

func VfsGLibType() types.GType

func VolumeGLibType

func VolumeGLibType() types.GType

func VolumeMonitorGLibType

func VolumeMonitorGLibType() types.GType

func ZlibCompressorFormatGLibType

func ZlibCompressorFormatGLibType() types.GType

func ZlibCompressorGLibType

func ZlibCompressorGLibType() types.GType

func ZlibDecompressorGLibType

func ZlibDecompressorGLibType() types.GType

Types

type Action

type Action interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	Activate(ParameterVar *glib.Variant)
	ChangeState(ValueVar *glib.Variant)
	GetEnabled() bool
	GetName() string
	GetParameterType() *glib.VariantType
	GetState() *glib.Variant
	GetStateHint() *glib.Variant
	GetStateType() *glib.VariantType
}

`GAction` represents a single named action.

The main interface to an action is that it can be activated with [method@Gio.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 [method@Gio.Action.change_state]. This call takes a [type@GLib.Variant]. 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 [class@Gio.SimpleAction].

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 [method@Gio.Action.activate] and [method@Gio.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 [class@Gio.SimpleActionGroup].

type ActionBase

type ActionBase struct {
	Ptr uintptr
}

func (*ActionBase) Activate

func (x *ActionBase) Activate(ParameterVar *glib.Variant)

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 [type@GLib.Variant] is floating, it is consumed.

func (*ActionBase) ChangeState

func (x *ActionBase) ChangeState(ValueVar *glib.Variant)

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 [method@Gio.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 [method@Gio.Action.get_state_hint].

If the @value [type@GLib.Variant] is floating, it is consumed.

func (*ActionBase) GetEnabled

func (x *ActionBase) GetEnabled() bool

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.

func (*ActionBase) GetName

func (x *ActionBase) GetName() string

Queries the name of @action.

func (*ActionBase) GetParameterType

func (x *ActionBase) GetParameterType() *glib.VariantType

Queries the type of the parameter that must be given when activating @action.

When activating the action using [method@Gio.Action.activate], the [type@GLib.Variant] 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 [type@GLib.Variant], but `NULL` instead.

func (*ActionBase) GetPropertyEnabled

func (x *ActionBase) GetPropertyEnabled() bool

GetPropertyEnabled gets the "enabled" property. If @action is currently enabled.

If the action is disabled then calls to [method@Gio.Action.activate] and [method@Gio.Action.change_state] have no effect.

func (*ActionBase) GetPropertyName

func (x *ActionBase) GetPropertyName() string

GetPropertyName gets the "name" property. The name of the action. This is mostly meaningful for identifying the action once it has been added to a [type@Gio.ActionGroup]. It is immutable.

func (*ActionBase) GetPropertyParameterType

func (x *ActionBase) GetPropertyParameterType() uintptr

GetPropertyParameterType gets the "parameter-type" property. 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.

func (*ActionBase) GetPropertyState

func (x *ActionBase) GetPropertyState() uintptr

GetPropertyState gets the "state" property. The state of the action, or `NULL` if the action is stateless.

func (*ActionBase) GetPropertyStateType

func (x *ActionBase) GetPropertyStateType() uintptr

GetPropertyStateType gets the "state-type" property. The [type@GLib.VariantType] of the state that the action has, or `NULL` if the action is stateless. This is immutable.

func (*ActionBase) GetState

func (x *ActionBase) GetState() *glib.Variant

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 [method@Gio.Action.get_state_type].

The return value (if non-`NULL`) should be freed with [method@GLib.Variant.unref] when it is no longer required.

func (*ActionBase) GetStateHint

func (x *ActionBase) GetStateHint() *glib.Variant

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 [type@GLib.Variant] array is returned then each item in the array is a possible value for the state. If a [type@GLib.Variant] 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 [method@GLib.Variant.unref] when it is no longer required.

func (*ActionBase) GetStateType

func (x *ActionBase) GetStateType() *glib.VariantType

Queries the type of the state of @action.

If the action is stateful (e.g. created with [ctor@Gio.SimpleAction.new_stateful]) then this function returns the [type@GLib.VariantType] of the state. This is the type of the initial value given as the state. All calls to [method@Gio.Action.change_state] must give a [type@GLib.Variant] of this type and [method@Gio.Action.get_state] will return a [type@GLib.Variant] of the same type.

If the action is not stateful (e.g. created with [ctor@Gio.SimpleAction.new]) then this function will return `NULL`. In that case, [method@Gio.Action.get_state] will return `NULL` and you must not call [method@Gio.Action.change_state].

func (*ActionBase) GoPointer

func (x *ActionBase) GoPointer() uintptr

func (*ActionBase) SetGoPointer

func (x *ActionBase) SetGoPointer(ptr uintptr)

type ActionEntry

type ActionEntry struct {
	Name uintptr

	ParameterType uintptr

	State uintptr

	Padding [3]uint
	// contains filtered or unexported fields
}

This struct defines a single action. It is for use with [method@Gio.ActionMap.add_action_entries].

The order of the items in the structure are intended to reflect frequency of use. It is permissible to use an incomplete initialiser in order to leave some of the later values as `NULL`. All values after @name are optional. Additional optional fields may be added in the future.

See [method@Gio.ActionMap.add_action_entries] for an example.

func (*ActionEntry) GetActivate

func (x *ActionEntry) GetActivate() func(*SimpleAction, *glib.Variant, uintptr)

GetActivate gets the "activate" callback function. the callback to connect to the "activate" signal of the action.

Since GLib 2.40, this can be `NULL` for stateful actions, in which case
the default handler is used. For boolean-stated actions with no
parameter, this is a toggle. For other state types (and parameter type
equal to the state type) this will be a function that just calls
@change_state (which you should provide).

func (*ActionEntry) GetChangeState

func (x *ActionEntry) GetChangeState() func(*SimpleAction, *glib.Variant, uintptr)

GetChangeState gets the "change_state" callback function. the callback to connect to the "change-state" signal of the

action.  All stateful actions should provide a handler here; stateless
actions should not.

func (*ActionEntry) GoPointer

func (x *ActionEntry) GoPointer() uintptr

func (*ActionEntry) OverrideActivate

func (x *ActionEntry) OverrideActivate(cb func(*SimpleAction, *glib.Variant, uintptr))

OverrideActivate sets the "activate" callback function. the callback to connect to the "activate" signal of the action.

Since GLib 2.40, this can be `NULL` for stateful actions, in which case
the default handler is used. For boolean-stated actions with no
parameter, this is a toggle. For other state types (and parameter type
equal to the state type) this will be a function that just calls
@change_state (which you should provide).

func (*ActionEntry) OverrideChangeState

func (x *ActionEntry) OverrideChangeState(cb func(*SimpleAction, *glib.Variant, uintptr))

OverrideChangeState sets the "change_state" callback function. the callback to connect to the "change-state" signal of the

action.  All stateful actions should provide a handler here; stateless
actions should not.

type ActionGroup

type ActionGroup interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	ActionAdded(ActionNameVar string)
	ActionEnabledChanged(ActionNameVar string, EnabledVar bool)
	ActionRemoved(ActionNameVar string)
	ActionStateChanged(ActionNameVar string, StateVar *glib.Variant)
	ActivateAction(ActionNameVar string, ParameterVar *glib.Variant)
	ChangeActionState(ActionNameVar string, ValueVar *glib.Variant)
	GetActionEnabled(ActionNameVar string) bool
	GetActionParameterType(ActionNameVar string) *glib.VariantType
	GetActionState(ActionNameVar string) *glib.Variant
	GetActionStateHint(ActionNameVar string) *glib.Variant
	GetActionStateType(ActionNameVar string) *glib.VariantType
	HasAction(ActionNameVar string) bool
	ListActions() []string
	QueryAction(ActionNameVar string, EnabledVar *bool, ParameterTypeVar **glib.VariantType, StateTypeVar **glib.VariantType, StateHintVar **glib.Variant, StateVar **glib.Variant) bool
}

`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 [type@Gio.MenuModel] 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 [method@Gio.ActionGroup.activate_action]. Activating an action may require a [type@GLib.Variant] parameter. The required type of the parameter can be inquired with [method@Gio.ActionGroup.get_action_parameter_type]. Actions may be disabled, see [method@Gio.ActionGroup.get_action_enabled]. Activating a disabled action has no effect.

Actions may optionally have a state in the form of a [type@GLib.Variant]. The current state of an action can be inquired with [method@Gio.ActionGroup.get_action_state]. Activating a stateful action may change its state, but it is also possible to set the state by calling [method@Gio.ActionGroup.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 [method@Gio.ActionGroup.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 – [method@Gio.ActionGroup.get_action_enabled] but not an equivalent `set_action_enabled()` method.

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 [method@Gio.ActionGroup.list_actions] and [method@Gio.ActionGroup.query_action]. The other virtual functions should not be implemented — their ‘wrappers’ are actually implemented with calls to [method@Gio.ActionGroup.query_action].

type ActionGroupBase

type ActionGroupBase struct {
	Ptr uintptr
}

func (*ActionGroupBase) ActionAdded

func (x *ActionGroupBase) ActionAdded(ActionNameVar string)

Emits the [signal@Gio.ActionGroup::action-added] signal on @action_group.

This function should only be called by [type@Gio.ActionGroup] implementations.

func (*ActionGroupBase) ActionEnabledChanged

func (x *ActionGroupBase) ActionEnabledChanged(ActionNameVar string, EnabledVar bool)

Emits the [signal@Gio.ActionGroup::action-enabled-changed] signal on @action_group.

This function should only be called by [type@Gio.ActionGroup] implementations.

func (*ActionGroupBase) ActionRemoved

func (x *ActionGroupBase) ActionRemoved(ActionNameVar string)

Emits the [signal@Gio.ActionGroup::action-removed] signal on @action_group.

This function should only be called by [type@Gio.ActionGroup] implementations.

func (*ActionGroupBase) ActionStateChanged

func (x *ActionGroupBase) ActionStateChanged(ActionNameVar string, StateVar *glib.Variant)

Emits the [signal@Gio.ActionGroup::action-state-changed] signal on @action_group.

This function should only be called by [type@Gio.ActionGroup] implementations.

func (*ActionGroupBase) ActivateAction

func (x *ActionGroupBase) ActivateAction(ActionNameVar string, ParameterVar *glib.Variant)

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 [method@Gio.ActionGroup.get_action_parameter_type].

If the [type@Gio.ActionGroup] 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, [method@Gio.DBusConnection.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 [method@Gio.DBusConnection.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); ```

func (*ActionGroupBase) ChangeActionState

func (x *ActionGroupBase) ChangeActionState(ActionNameVar string, ValueVar *glib.Variant)

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 [method@Gio.ActionGroup.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 [method@Gio.ActionGroup.get_action_state_hint].

If the @value GVariant is floating, it is consumed.

func (*ActionGroupBase) GetActionEnabled

func (x *ActionGroupBase) GetActionEnabled(ActionNameVar string) bool

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.

func (*ActionGroupBase) GetActionParameterType

func (x *ActionGroupBase) GetActionParameterType(ActionNameVar string) *glib.VariantType

Queries the type of the parameter that must be given when activating the named action within @action_group.

When activating the action using [method@Gio.ActionGroup.activate_action], the [type@GLib.Variant] 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 [type@GLib.Variant], 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.

func (*ActionGroupBase) GetActionState

func (x *ActionGroupBase) GetActionState(ActionNameVar string) *glib.Variant

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 [method@Gio.ActionGroup.get_action_state_type].

The return value (if non-`NULL`) should be freed with [method@GLib.Variant.unref] when it is no longer required.

func (*ActionGroupBase) GetActionStateHint

func (x *ActionGroupBase) GetActionStateHint(ActionNameVar string) *glib.Variant

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 [type@GLib.Variant] array is returned then each item in the array is a possible value for the state. If a [type@GLib.Variant] 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 [method@GLib.Variant.unref] when it is no longer required.

func (*ActionGroupBase) GetActionStateType

func (x *ActionGroupBase) GetActionStateType(ActionNameVar string) *glib.VariantType

Queries the type of the state of the named action within @action_group.

If the action is stateful then this function returns the [type@GLib.VariantType] of the state. All calls to [method@Gio.ActionGroup.change_action_state] must give a [type@GLib.Variant] of this type and [method@Gio.ActionGroup.get_action_state] will return a [type@GLib.Variant] of the same type.

If the action is not stateful then this function will return `NULL`. In that case, [method@Gio.ActionGroup.get_action_state] will return `NULL` and you must not call [method@Gio.ActionGroup.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.

func (*ActionGroupBase) GoPointer

func (x *ActionGroupBase) GoPointer() uintptr

func (*ActionGroupBase) HasAction

func (x *ActionGroupBase) HasAction(ActionNameVar string) bool

Checks if the named action exists within @action_group.

func (*ActionGroupBase) ListActions

func (x *ActionGroupBase) ListActions() []string

Lists the actions contained within @action_group.

The caller is responsible for freeing the list with [func@GLib.strfreev] when it is no longer required.

func (*ActionGroupBase) QueryAction

func (x *ActionGroupBase) QueryAction(ActionNameVar string, EnabledVar *bool, ParameterTypeVar **glib.VariantType, StateTypeVar **glib.VariantType, StateHintVar **glib.Variant, StateVar **glib.Variant) bool

Queries all aspects of the named action within an @action_group.

This function acquires the information available from [method@Gio.ActionGroup.has_action], [method@Gio.ActionGroup.get_action_enabled], [method@Gio.ActionGroup.get_action_parameter_type], [method@Gio.ActionGroup.get_action_state_type], [method@Gio.ActionGroup.get_action_state_hint] and [method@Gio.ActionGroup.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 [type@Gio.ActionGroup] 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.

func (*ActionGroupBase) SetGoPointer

func (x *ActionGroupBase) SetGoPointer(ptr uintptr)

type ActionGroupInterface

type ActionGroupInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

The virtual function table for [type@Gio.ActionGroup].

func (*ActionGroupInterface) GetActionAdded

func (x *ActionGroupInterface) GetActionAdded() func(ActionGroup, string)

GetActionAdded gets the "action_added" callback function. the class closure for the [signal@Gio.ActionGroup::action-added] signal

func (*ActionGroupInterface) GetActionEnabledChanged

func (x *ActionGroupInterface) GetActionEnabledChanged() func(ActionGroup, string, bool)

GetActionEnabledChanged gets the "action_enabled_changed" callback function. the class closure for the [signal@Gio.ActionGroup::action-enabled-changed] signal

func (*ActionGroupInterface) GetActionRemoved

func (x *ActionGroupInterface) GetActionRemoved() func(ActionGroup, string)

GetActionRemoved gets the "action_removed" callback function. the class closure for the [signal@Gio.ActionGroup::action-removed] signal

func (*ActionGroupInterface) GetActionStateChanged

func (x *ActionGroupInterface) GetActionStateChanged() func(ActionGroup, string, *glib.Variant)

GetActionStateChanged gets the "action_state_changed" callback function. the class closure for the [signal@Gio.ActionGroup::action-enabled-changed] signal

func (*ActionGroupInterface) GetActivateAction

func (x *ActionGroupInterface) GetActivateAction() func(ActionGroup, string, *glib.Variant)

GetActivateAction gets the "activate_action" callback function. the virtual function pointer for [method@Gio.ActionGroup.activate_action]

func (*ActionGroupInterface) GetChangeActionState

func (x *ActionGroupInterface) GetChangeActionState() func(ActionGroup, string, *glib.Variant)

GetChangeActionState gets the "change_action_state" callback function. the virtual function pointer for [method@Gio.ActionGroup.change_action_state]

func (*ActionGroupInterface) GetGetActionEnabled

func (x *ActionGroupInterface) GetGetActionEnabled() func(ActionGroup, string) bool

GetGetActionEnabled gets the "get_action_enabled" callback function. the virtual function pointer for [method@Gio.ActionGroup.get_action_enabled]

func (*ActionGroupInterface) GetGetActionParameterType

func (x *ActionGroupInterface) GetGetActionParameterType() func(ActionGroup, string) *glib.VariantType

GetGetActionParameterType gets the "get_action_parameter_type" callback function. the virtual function pointer for [method@Gio.ActionGroup.get_action_parameter_type]

func (*ActionGroupInterface) GetGetActionState

func (x *ActionGroupInterface) GetGetActionState() func(ActionGroup, string) *glib.Variant

GetGetActionState gets the "get_action_state" callback function. the virtual function pointer for [method@Gio.ActionGroup.get_action_state]

func (*ActionGroupInterface) GetGetActionStateHint

func (x *ActionGroupInterface) GetGetActionStateHint() func(ActionGroup, string) *glib.Variant

GetGetActionStateHint gets the "get_action_state_hint" callback function. the virtual function pointer for [method@Gio.ActionGroup.get_action_state_hint]

func (*ActionGroupInterface) GetGetActionStateType

func (x *ActionGroupInterface) GetGetActionStateType() func(ActionGroup, string) *glib.VariantType

GetGetActionStateType gets the "get_action_state_type" callback function. the virtual function pointer for [method@Gio.ActionGroup.get_action_state_type]

func (*ActionGroupInterface) GetHasAction

func (x *ActionGroupInterface) GetHasAction() func(ActionGroup, string) bool

GetHasAction gets the "has_action" callback function. the virtual function pointer for [method@Gio.ActionGroup.has_action]

func (*ActionGroupInterface) GetListActions

func (x *ActionGroupInterface) GetListActions() func(ActionGroup) []string

GetListActions gets the "list_actions" callback function. the virtual function pointer for [method@Gio.ActionGroup.list_actions]

func (*ActionGroupInterface) GetQueryAction

GetQueryAction gets the "query_action" callback function. the virtual function pointer for [method@Gio.ActionGroup.query_action]

func (*ActionGroupInterface) GoPointer

func (x *ActionGroupInterface) GoPointer() uintptr

func (*ActionGroupInterface) OverrideActionAdded

func (x *ActionGroupInterface) OverrideActionAdded(cb func(ActionGroup, string))

OverrideActionAdded sets the "action_added" callback function. the class closure for the [signal@Gio.ActionGroup::action-added] signal

func (*ActionGroupInterface) OverrideActionEnabledChanged

func (x *ActionGroupInterface) OverrideActionEnabledChanged(cb func(ActionGroup, string, bool))

OverrideActionEnabledChanged sets the "action_enabled_changed" callback function. the class closure for the [signal@Gio.ActionGroup::action-enabled-changed] signal

func (*ActionGroupInterface) OverrideActionRemoved

func (x *ActionGroupInterface) OverrideActionRemoved(cb func(ActionGroup, string))

OverrideActionRemoved sets the "action_removed" callback function. the class closure for the [signal@Gio.ActionGroup::action-removed] signal

func (*ActionGroupInterface) OverrideActionStateChanged

func (x *ActionGroupInterface) OverrideActionStateChanged(cb func(ActionGroup, string, *glib.Variant))

OverrideActionStateChanged sets the "action_state_changed" callback function. the class closure for the [signal@Gio.ActionGroup::action-enabled-changed] signal

func (*ActionGroupInterface) OverrideActivateAction

func (x *ActionGroupInterface) OverrideActivateAction(cb func(ActionGroup, string, *glib.Variant))

OverrideActivateAction sets the "activate_action" callback function. the virtual function pointer for [method@Gio.ActionGroup.activate_action]

func (*ActionGroupInterface) OverrideChangeActionState

func (x *ActionGroupInterface) OverrideChangeActionState(cb func(ActionGroup, string, *glib.Variant))

OverrideChangeActionState sets the "change_action_state" callback function. the virtual function pointer for [method@Gio.ActionGroup.change_action_state]

func (*ActionGroupInterface) OverrideGetActionEnabled

func (x *ActionGroupInterface) OverrideGetActionEnabled(cb func(ActionGroup, string) bool)

OverrideGetActionEnabled sets the "get_action_enabled" callback function. the virtual function pointer for [method@Gio.ActionGroup.get_action_enabled]

func (*ActionGroupInterface) OverrideGetActionParameterType

func (x *ActionGroupInterface) OverrideGetActionParameterType(cb func(ActionGroup, string) *glib.VariantType)

OverrideGetActionParameterType sets the "get_action_parameter_type" callback function. the virtual function pointer for [method@Gio.ActionGroup.get_action_parameter_type]

func (*ActionGroupInterface) OverrideGetActionState

func (x *ActionGroupInterface) OverrideGetActionState(cb func(ActionGroup, string) *glib.Variant)

OverrideGetActionState sets the "get_action_state" callback function. the virtual function pointer for [method@Gio.ActionGroup.get_action_state]

func (*ActionGroupInterface) OverrideGetActionStateHint

func (x *ActionGroupInterface) OverrideGetActionStateHint(cb func(ActionGroup, string) *glib.Variant)

OverrideGetActionStateHint sets the "get_action_state_hint" callback function. the virtual function pointer for [method@Gio.ActionGroup.get_action_state_hint]

func (*ActionGroupInterface) OverrideGetActionStateType

func (x *ActionGroupInterface) OverrideGetActionStateType(cb func(ActionGroup, string) *glib.VariantType)

OverrideGetActionStateType sets the "get_action_state_type" callback function. the virtual function pointer for [method@Gio.ActionGroup.get_action_state_type]

func (*ActionGroupInterface) OverrideHasAction

func (x *ActionGroupInterface) OverrideHasAction(cb func(ActionGroup, string) bool)

OverrideHasAction sets the "has_action" callback function. the virtual function pointer for [method@Gio.ActionGroup.has_action]

func (*ActionGroupInterface) OverrideListActions

func (x *ActionGroupInterface) OverrideListActions(cb func(ActionGroup) []string)

OverrideListActions sets the "list_actions" callback function. the virtual function pointer for [method@Gio.ActionGroup.list_actions]

func (*ActionGroupInterface) OverrideQueryAction

func (x *ActionGroupInterface) OverrideQueryAction(cb func(ActionGroup, string, *bool, **glib.VariantType, **glib.VariantType, **glib.Variant, **glib.Variant) bool)

OverrideQueryAction sets the "query_action" callback function. the virtual function pointer for [method@Gio.ActionGroup.query_action]

type ActionInterface

type ActionInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

The virtual function table for [type@Gio.Action].

func (*ActionInterface) GetActivate

func (x *ActionInterface) GetActivate() func(Action, *glib.Variant)

GetActivate gets the "activate" callback function. the virtual function pointer for [method@Gio.Action.activate]. Note that [type@Gio.Action] does not have an

'activate' signal but that implementations of it may have one.

func (*ActionInterface) GetChangeState

func (x *ActionInterface) GetChangeState() func(Action, *glib.Variant)

GetChangeState gets the "change_state" callback function. the virtual function pointer for [method@Gio.Action.change_state]

func (*ActionInterface) GetGetEnabled

func (x *ActionInterface) GetGetEnabled() func(Action) bool

GetGetEnabled gets the "get_enabled" callback function. the virtual function pointer for [method@Gio.Action.get_enabled]

func (*ActionInterface) GetGetName

func (x *ActionInterface) GetGetName() func(Action) string

GetGetName gets the "get_name" callback function. the virtual function pointer for [method@Gio.Action.get_name]

func (*ActionInterface) GetGetParameterType

func (x *ActionInterface) GetGetParameterType() func(Action) *glib.VariantType

GetGetParameterType gets the "get_parameter_type" callback function. the virtual function pointer for [method@Gio.Action.get_parameter_type]

func (*ActionInterface) GetGetState

func (x *ActionInterface) GetGetState() func(Action) *glib.Variant

GetGetState gets the "get_state" callback function. the virtual function pointer for [method@Gio.Action.get_state]

func (*ActionInterface) GetGetStateHint

func (x *ActionInterface) GetGetStateHint() func(Action) *glib.Variant

GetGetStateHint gets the "get_state_hint" callback function. the virtual function pointer for [method@Gio.Action.get_state_hint]

func (*ActionInterface) GetGetStateType

func (x *ActionInterface) GetGetStateType() func(Action) *glib.VariantType

GetGetStateType gets the "get_state_type" callback function. the virtual function pointer for [method@Gio.Action.get_state_type]

func (*ActionInterface) GoPointer

func (x *ActionInterface) GoPointer() uintptr

func (*ActionInterface) OverrideActivate

func (x *ActionInterface) OverrideActivate(cb func(Action, *glib.Variant))

OverrideActivate sets the "activate" callback function. the virtual function pointer for [method@Gio.Action.activate]. Note that [type@Gio.Action] does not have an

'activate' signal but that implementations of it may have one.

func (*ActionInterface) OverrideChangeState

func (x *ActionInterface) OverrideChangeState(cb func(Action, *glib.Variant))

OverrideChangeState sets the "change_state" callback function. the virtual function pointer for [method@Gio.Action.change_state]

func (*ActionInterface) OverrideGetEnabled

func (x *ActionInterface) OverrideGetEnabled(cb func(Action) bool)

OverrideGetEnabled sets the "get_enabled" callback function. the virtual function pointer for [method@Gio.Action.get_enabled]

func (*ActionInterface) OverrideGetName

func (x *ActionInterface) OverrideGetName(cb func(Action) string)

OverrideGetName sets the "get_name" callback function. the virtual function pointer for [method@Gio.Action.get_name]

func (*ActionInterface) OverrideGetParameterType

func (x *ActionInterface) OverrideGetParameterType(cb func(Action) *glib.VariantType)

OverrideGetParameterType sets the "get_parameter_type" callback function. the virtual function pointer for [method@Gio.Action.get_parameter_type]

func (*ActionInterface) OverrideGetState

func (x *ActionInterface) OverrideGetState(cb func(Action) *glib.Variant)

OverrideGetState sets the "get_state" callback function. the virtual function pointer for [method@Gio.Action.get_state]

func (*ActionInterface) OverrideGetStateHint

func (x *ActionInterface) OverrideGetStateHint(cb func(Action) *glib.Variant)

OverrideGetStateHint sets the "get_state_hint" callback function. the virtual function pointer for [method@Gio.Action.get_state_hint]

func (*ActionInterface) OverrideGetStateType

func (x *ActionInterface) OverrideGetStateType(cb func(Action) *glib.VariantType)

OverrideGetStateType sets the "get_state_type" callback function. the virtual function pointer for [method@Gio.Action.get_state_type]

type ActionMap

type ActionMap interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	AddAction(ActionVar Action)
	AddActionEntries(EntriesVar []ActionEntry, NEntriesVar int, UserDataVar uintptr)
	LookupAction(ActionNameVar string) *ActionBase
	RemoveAction(ActionNameVar string)
	RemoveActionEntries(EntriesVar []ActionEntry, NEntriesVar int)
}

`GActionMap` is an interface for action containers.

The `GActionMap` interface is implemented by [iface@Gio.ActionGroup] implementations that operate by containing a number of named [iface@Gio.Action] instances, such as [class@Gio.SimpleActionGroup].

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.

type ActionMapBase

type ActionMapBase struct {
	Ptr uintptr
}

func (*ActionMapBase) AddAction

func (x *ActionMapBase) AddAction(ActionVar Action)

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.

func (*ActionMapBase) AddActionEntries

func (x *ActionMapBase) AddActionEntries(EntriesVar []ActionEntry, NEntriesVar int, UserDataVar uintptr)

A convenience function for creating multiple [class@Gio.SimpleAction] instances and adding them to a [iface@Gio.ActionMap].

Each action is constructed as per one [struct@Gio.ActionEntry].

```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);
}

```

func (*ActionMapBase) GoPointer

func (x *ActionMapBase) GoPointer() uintptr

func (*ActionMapBase) LookupAction

func (x *ActionMapBase) LookupAction(ActionNameVar string) *ActionBase

Looks up the action with the name @action_name in @action_map.

If no such action exists, returns `NULL`.

func (*ActionMapBase) RemoveAction

func (x *ActionMapBase) RemoveAction(ActionNameVar string)

Removes the named action from the action map.

If no action of this name is in the map then nothing happens.

func (*ActionMapBase) RemoveActionEntries

func (x *ActionMapBase) RemoveActionEntries(EntriesVar []ActionEntry, NEntriesVar int)

Remove actions from a [iface@Gio.ActionMap]. This is meant as the reverse of [method@Gio.ActionMap.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));
}

```

func (*ActionMapBase) SetGoPointer

func (x *ActionMapBase) SetGoPointer(ptr uintptr)

type ActionMapInterface

type ActionMapInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

The virtual function table for [iface@Gio.ActionMap].

func (*ActionMapInterface) GetAddAction

func (x *ActionMapInterface) GetAddAction() func(ActionMap, Action)

GetAddAction gets the "add_action" callback function. the virtual function pointer for

[method@Gio.ActionMap.add_action]

func (*ActionMapInterface) GetLookupAction

func (x *ActionMapInterface) GetLookupAction() func(ActionMap, string) *ActionBase

GetLookupAction gets the "lookup_action" callback function. the virtual function pointer for

[method@Gio.ActionMap.lookup_action]

func (*ActionMapInterface) GetRemoveAction

func (x *ActionMapInterface) GetRemoveAction() func(ActionMap, string)

GetRemoveAction gets the "remove_action" callback function. the virtual function pointer for

[method@Gio.ActionMap.remove_action]

func (*ActionMapInterface) GoPointer

func (x *ActionMapInterface) GoPointer() uintptr

func (*ActionMapInterface) OverrideAddAction

func (x *ActionMapInterface) OverrideAddAction(cb func(ActionMap, Action))

OverrideAddAction sets the "add_action" callback function. the virtual function pointer for

[method@Gio.ActionMap.add_action]

func (*ActionMapInterface) OverrideLookupAction

func (x *ActionMapInterface) OverrideLookupAction(cb func(ActionMap, string) *ActionBase)

OverrideLookupAction sets the "lookup_action" callback function. the virtual function pointer for

[method@Gio.ActionMap.lookup_action]

func (*ActionMapInterface) OverrideRemoveAction

func (x *ActionMapInterface) OverrideRemoveAction(cb func(ActionMap, string))

OverrideRemoveAction sets the "remove_action" callback function. the virtual function pointer for

[method@Gio.ActionMap.remove_action]

type AppInfo

type AppInfo interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	AddSupportsType(ContentTypeVar string) (bool, error)
	CanDelete() bool
	CanRemoveSupportsType() bool
	Delete() bool
	Dup() *AppInfoBase
	Equal(Appinfo2Var AppInfo) bool
	GetCommandline() string
	GetDescription() string
	GetDisplayName() string
	GetExecutable() string
	GetIcon() *IconBase
	GetId() string
	GetName() string
	GetSupportedTypes() []string
	Launch(FilesVar *glib.List, ContextVar *AppLaunchContext) (bool, error)
	LaunchUris(UrisVar *glib.List, ContextVar *AppLaunchContext) (bool, error)
	LaunchUrisAsync(UrisVar *glib.List, ContextVar *AppLaunchContext, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	LaunchUrisFinish(ResultVar AsyncResult) (bool, error)
	RemoveSupportsType(ContentTypeVar string) (bool, error)
	SetAsDefaultForExtension(ExtensionVar string) (bool, error)
	SetAsDefaultForType(ContentTypeVar string) (bool, error)
	SetAsLastUsedForType(ContentTypeVar string) (bool, error)
	ShouldShow() bool
	SupportsFiles() bool
	SupportsUris() bool
}

Information about an installed application and methods to launch it (with file arguments).

`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 [method@Gio.File.get_path]) when using [method@Gio.AppInfo.launch] even if the application requested an URI and not a POSIX path. For example for a desktop-file based application with the following Exec key:

``` Exec=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 [iface@Gio.File] constructors (since GVfs implements the GVfs extension point). As such, if the application needs to examine the URI, it needs to use [method@Gio.File.get_uri] or similar on [iface@Gio.File]. In other words, an application cannot assume that the URI passed to e.g. [func@Gio.File.new_for_commandline_arg] is equal to the result of [method@Gio.File.get_uri]. The following snippet illustrates this:

```c 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.

type AppInfoBase

type AppInfoBase struct {
	Ptr uintptr
}

func AppInfoCreateFromCommandline

func AppInfoCreateFromCommandline(CommandlineVar string, ApplicationNameVar *string, FlagsVar AppInfoCreateFlags) (*AppInfoBase, error)

Creates a new [iface@Gio.AppInfo] 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](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s07.html) for exact quoting rules.

func AppInfoGetDefaultForType

func AppInfoGetDefaultForType(ContentTypeVar string, MustSupportUrisVar bool) *AppInfoBase

Gets the default [iface@Gio.AppInfo] for a given content type.

func AppInfoGetDefaultForTypeFinish

func AppInfoGetDefaultForTypeFinish(ResultVar AsyncResult) (*AppInfoBase, error)

Finishes a default [iface@Gio.AppInfo] lookup started by [func@Gio.AppInfo.get_default_for_type_async].

If no #[iface@Gio.AppInfo] is found, then @error will be set to [error@Gio.IOErrorEnum.NOT_FOUND].

func AppInfoGetDefaultForUriScheme

func AppInfoGetDefaultForUriScheme(UriSchemeVar string) *AppInfoBase

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 `:`. For example, `http`, `ftp` or `sip`.

func AppInfoGetDefaultForUriSchemeFinish

func AppInfoGetDefaultForUriSchemeFinish(ResultVar AsyncResult) (*AppInfoBase, error)

Finishes a default [iface@Gio.AppInfo] lookup started by [func@Gio.AppInfo.get_default_for_uri_scheme_async].

If no [iface@Gio.AppInfo] is found, then @error will be set to [error@Gio.IOErrorEnum.NOT_FOUND].

func (*AppInfoBase) AddSupportsType

func (x *AppInfoBase) AddSupportsType(ContentTypeVar string) (bool, error)

Adds a content type to the application information to indicate the application is capable of opening files with the given content type.

func (*AppInfoBase) CanDelete

func (x *AppInfoBase) CanDelete() bool

Obtains the information whether the [iface@Gio.AppInfo] can be deleted. See [method@Gio.AppInfo.delete].

func (*AppInfoBase) CanRemoveSupportsType

func (x *AppInfoBase) CanRemoveSupportsType() bool

Checks if a supported content type can be removed from an application.

func (*AppInfoBase) Delete

func (x *AppInfoBase) Delete() bool

Tries to delete a [iface@Gio.AppInfo].

On some platforms, there may be a difference between user-defined [iface@Gio.AppInfo]s which can be deleted, and system-wide ones which cannot. See [method@Gio.AppInfo.can_delete].

func (*AppInfoBase) Dup

func (x *AppInfoBase) Dup() *AppInfoBase

Creates a duplicate of a [iface@Gio.AppInfo].

func (*AppInfoBase) Equal

func (x *AppInfoBase) Equal(Appinfo2Var AppInfo) bool

Checks if two [iface@Gio.AppInfo]s 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.

func (*AppInfoBase) GetCommandline

func (x *AppInfoBase) GetCommandline() string

Gets the commandline with which the application will be started.

func (*AppInfoBase) GetDescription

func (x *AppInfoBase) GetDescription() string

Gets a human-readable description of an installed application.

func (*AppInfoBase) GetDisplayName

func (x *AppInfoBase) GetDisplayName() string

Gets the display name of the application. The display name is often more descriptive to the user than the name itself.

func (*AppInfoBase) GetExecutable

func (x *AppInfoBase) GetExecutable() string

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 [method@Gio.AppInfo.launch] and related functions, rather than spawning the return value from this function.

func (*AppInfoBase) GetIcon

func (x *AppInfoBase) GetIcon() *IconBase

Gets the icon for the application.

func (*AppInfoBase) GetId

func (x *AppInfoBase) GetId() string

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.

func (*AppInfoBase) GetName

func (x *AppInfoBase) GetName() string

Gets the installed name of the application.

func (*AppInfoBase) GetSupportedTypes

func (x *AppInfoBase) GetSupportedTypes() []string

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 [method@Gio.AppInfo.add_supports_type], but only those exported directly by the application.

func (*AppInfoBase) GoPointer

func (x *AppInfoBase) GoPointer() uintptr

func (*AppInfoBase) Launch

func (x *AppInfoBase) Launch(FilesVar *glib.List, ContextVar *AppLaunchContext) (bool, error)

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 [method@Gio.AppInfo.launch_uris] instead.

The launched application inherits the environment of the launching process, but it can be modified with [method@Gio.AppLaunchContext.setenv] and [method@Gio.AppLaunchContext.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.

func (*AppInfoBase) LaunchUris

func (x *AppInfoBase) LaunchUris(UrisVar *glib.List, ContextVar *AppLaunchContext) (bool, error)

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.

func (*AppInfoBase) LaunchUrisAsync

func (x *AppInfoBase) LaunchUrisAsync(UrisVar *glib.List, ContextVar *AppLaunchContext, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Async version of [method@Gio.AppInfo.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 [func@Gio.AppInfo.launch_default_for_uri_async].

func (*AppInfoBase) LaunchUrisFinish

func (x *AppInfoBase) LaunchUrisFinish(ResultVar AsyncResult) (bool, error)

Finishes a [method@Gio.AppInfo.launch_uris_async] operation.

func (*AppInfoBase) RemoveSupportsType

func (x *AppInfoBase) RemoveSupportsType(ContentTypeVar string) (bool, error)

Removes a supported type from an application, if possible.

func (*AppInfoBase) SetAsDefaultForExtension

func (x *AppInfoBase) SetAsDefaultForExtension(ExtensionVar string) (bool, error)

Sets the application as the default handler for the given file extension.

func (*AppInfoBase) SetAsDefaultForType

func (x *AppInfoBase) SetAsDefaultForType(ContentTypeVar string) (bool, error)

Sets the application as the default handler for a given type.

func (*AppInfoBase) SetAsLastUsedForType

func (x *AppInfoBase) SetAsLastUsedForType(ContentTypeVar string) (bool, error)

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 [func@Gio.AppInfo.get_recommended_for_type], regardless of the default application for that content type.

func (*AppInfoBase) SetGoPointer

func (x *AppInfoBase) SetGoPointer(ptr uintptr)

func (*AppInfoBase) ShouldShow

func (x *AppInfoBase) ShouldShow() bool

Checks if the application info should be shown in menus that list available applications.

func (*AppInfoBase) SupportsFiles

func (x *AppInfoBase) SupportsFiles() bool

Checks if the application accepts files as arguments.

func (*AppInfoBase) SupportsUris

func (x *AppInfoBase) SupportsUris() bool

Checks if the application supports reading files and directories from URIs.

type AppInfoCreateFlags

type AppInfoCreateFlags int

Flags used when creating a #GAppInfo.

const (

	// No flags.
	GAppInfoCreateNoneValue AppInfoCreateFlags = 0
	// Application opens in a terminal window.
	GAppInfoCreateNeedsTerminalValue AppInfoCreateFlags = 1
	// Application supports URI arguments.
	GAppInfoCreateSupportsUrisValue AppInfoCreateFlags = 2
	// Application supports startup notification. Since 2.26
	GAppInfoCreateSupportsStartupNotificationValue AppInfoCreateFlags = 4
)

type AppInfoIface

type AppInfoIface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

Application Information interface, for operating system portability.

func (*AppInfoIface) GetAddSupportsType

func (x *AppInfoIface) GetAddSupportsType() func(AppInfo, string) bool

GetAddSupportsType gets the "add_supports_type" callback function. Adds to the [iface@Gio.AppInfo] information about

supported file types.

func (*AppInfoIface) GetCanDelete

func (x *AppInfoIface) GetCanDelete() func(AppInfo) bool

GetCanDelete gets the "can_delete" callback function. Checks if a [iface@Gio.AppInfo] can be deleted. (Since 2.20)

func (*AppInfoIface) GetCanRemoveSupportsType

func (x *AppInfoIface) GetCanRemoveSupportsType() func(AppInfo) bool

GetCanRemoveSupportsType gets the "can_remove_supports_type" callback function. Checks for support for removing supported file

types from a [iface@Gio.AppInfo].

func (*AppInfoIface) GetDoDelete

func (x *AppInfoIface) GetDoDelete() func(AppInfo) bool

GetDoDelete gets the "do_delete" callback function. Deletes a [iface@Gio.AppInfo]. (Since 2.20)

func (*AppInfoIface) GetDup

func (x *AppInfoIface) GetDup() func(AppInfo) *AppInfoBase

GetDup gets the "dup" callback function. Copies a [iface@Gio.AppInfo].

func (*AppInfoIface) GetEqual

func (x *AppInfoIface) GetEqual() func(AppInfo, AppInfo) bool

GetEqual gets the "equal" callback function. Checks two [iface@Gio.AppInfo]s for equality.

func (*AppInfoIface) GetGetCommandline

func (x *AppInfoIface) GetGetCommandline() func(AppInfo) string

GetGetCommandline gets the "get_commandline" callback function. Gets the commandline for the [iface@Gio.AppInfo].

(Since 2.20)

func (*AppInfoIface) GetGetDescription

func (x *AppInfoIface) GetGetDescription() func(AppInfo) string

GetGetDescription gets the "get_description" callback function. Gets a short description for the application described by

the [iface@Gio.AppInfo].

func (*AppInfoIface) GetGetDisplayName

func (x *AppInfoIface) GetGetDisplayName() func(AppInfo) string

GetGetDisplayName gets the "get_display_name" callback function. Gets the display name for the [iface@Gio.AppInfo].

(Since 2.24)

func (*AppInfoIface) GetGetExecutable

func (x *AppInfoIface) GetGetExecutable() func(AppInfo) string

GetGetExecutable gets the "get_executable" callback function. Gets the executable name for the [iface@Gio.AppInfo].

func (*AppInfoIface) GetGetIcon

func (x *AppInfoIface) GetGetIcon() func(AppInfo) *IconBase

GetGetIcon gets the "get_icon" callback function. Gets the [iface@Gio.Icon] for the [iface@Gio.AppInfo].

func (*AppInfoIface) GetGetId

func (x *AppInfoIface) GetGetId() func(AppInfo) string

GetGetId gets the "get_id" callback function. Gets a string identifier for a [iface@Gio.AppInfo].

func (*AppInfoIface) GetGetName

func (x *AppInfoIface) GetGetName() func(AppInfo) string

GetGetName gets the "get_name" callback function. Gets the name of the application for a [iface@Gio.AppInfo].

func (*AppInfoIface) GetGetSupportedTypes

func (x *AppInfoIface) GetGetSupportedTypes() func(AppInfo) []string

GetGetSupportedTypes gets the "get_supported_types" callback function. Retrieves the list of content types that @app_info

claims to support.

func (*AppInfoIface) GetLaunch

func (x *AppInfoIface) GetLaunch() func(AppInfo, *glib.List, *AppLaunchContext) bool

GetLaunch gets the "launch" callback function. Launches an application specified by the [iface@Gio.AppInfo].

func (*AppInfoIface) GetLaunchUris

func (x *AppInfoIface) GetLaunchUris() func(AppInfo, *glib.List, *AppLaunchContext) bool

GetLaunchUris gets the "launch_uris" callback function. Launches an application with a list of URIs.

func (*AppInfoIface) GetLaunchUrisAsync

func (x *AppInfoIface) GetLaunchUrisAsync() func(AppInfo, *glib.List, *AppLaunchContext, *Cancellable, *AsyncReadyCallback, uintptr)

GetLaunchUrisAsync gets the "launch_uris_async" callback function. Asynchronously launches an application with a list of

URIs. (Since: 2.60)

func (*AppInfoIface) GetLaunchUrisFinish

func (x *AppInfoIface) GetLaunchUrisFinish() func(AppInfo, AsyncResult) bool

GetLaunchUrisFinish gets the "launch_uris_finish" callback function. Finishes an operation started with @launch_uris_async.

(Since: 2.60)

func (*AppInfoIface) GetRemoveSupportsType

func (x *AppInfoIface) GetRemoveSupportsType() func(AppInfo, string) bool

GetRemoveSupportsType gets the "remove_supports_type" callback function. Removes a supported application type from a

[iface@Gio.AppInfo].

func (*AppInfoIface) GetSetAsDefaultForExtension

func (x *AppInfoIface) GetSetAsDefaultForExtension() func(AppInfo, string) bool

GetSetAsDefaultForExtension gets the "set_as_default_for_extension" callback function. Sets an application as default for a given

file extension.

func (*AppInfoIface) GetSetAsDefaultForType

func (x *AppInfoIface) GetSetAsDefaultForType() func(AppInfo, string) bool

GetSetAsDefaultForType gets the "set_as_default_for_type" callback function. Sets an application as default for a given content

type.

func (*AppInfoIface) GetSetAsLastUsedForType

func (x *AppInfoIface) GetSetAsLastUsedForType() func(AppInfo, string) bool

GetSetAsLastUsedForType gets the "set_as_last_used_for_type" callback function. Sets the application as the last used. See

[method@Gio.AppInfo.set_as_last_used_for_type].

func (*AppInfoIface) GetShouldShow

func (x *AppInfoIface) GetShouldShow() func(AppInfo) bool

GetShouldShow gets the "should_show" callback function. Returns whether an application should be shown (e.g. when

getting a list of installed applications).
[FreeDesktop.Org Startup Notification Specification](http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt).

func (*AppInfoIface) GetSupportsFiles

func (x *AppInfoIface) GetSupportsFiles() func(AppInfo) bool

GetSupportsFiles gets the "supports_files" callback function. Indicates whether the application specified accepts

filename arguments.

func (*AppInfoIface) GetSupportsUris

func (x *AppInfoIface) GetSupportsUris() func(AppInfo) bool

GetSupportsUris gets the "supports_uris" callback function. Indicates whether the application specified supports

launching URIs.

func (*AppInfoIface) GoPointer

func (x *AppInfoIface) GoPointer() uintptr

func (*AppInfoIface) OverrideAddSupportsType

func (x *AppInfoIface) OverrideAddSupportsType(cb func(AppInfo, string) bool)

OverrideAddSupportsType sets the "add_supports_type" callback function. Adds to the [iface@Gio.AppInfo] information about

supported file types.

func (*AppInfoIface) OverrideCanDelete

func (x *AppInfoIface) OverrideCanDelete(cb func(AppInfo) bool)

OverrideCanDelete sets the "can_delete" callback function. Checks if a [iface@Gio.AppInfo] can be deleted. (Since 2.20)

func (*AppInfoIface) OverrideCanRemoveSupportsType

func (x *AppInfoIface) OverrideCanRemoveSupportsType(cb func(AppInfo) bool)

OverrideCanRemoveSupportsType sets the "can_remove_supports_type" callback function. Checks for support for removing supported file

types from a [iface@Gio.AppInfo].

func (*AppInfoIface) OverrideDoDelete

func (x *AppInfoIface) OverrideDoDelete(cb func(AppInfo) bool)

OverrideDoDelete sets the "do_delete" callback function. Deletes a [iface@Gio.AppInfo]. (Since 2.20)

func (*AppInfoIface) OverrideDup

func (x *AppInfoIface) OverrideDup(cb func(AppInfo) *AppInfoBase)

OverrideDup sets the "dup" callback function. Copies a [iface@Gio.AppInfo].

func (*AppInfoIface) OverrideEqual

func (x *AppInfoIface) OverrideEqual(cb func(AppInfo, AppInfo) bool)

OverrideEqual sets the "equal" callback function. Checks two [iface@Gio.AppInfo]s for equality.

func (*AppInfoIface) OverrideGetCommandline

func (x *AppInfoIface) OverrideGetCommandline(cb func(AppInfo) string)

OverrideGetCommandline sets the "get_commandline" callback function. Gets the commandline for the [iface@Gio.AppInfo].

(Since 2.20)

func (*AppInfoIface) OverrideGetDescription

func (x *AppInfoIface) OverrideGetDescription(cb func(AppInfo) string)

OverrideGetDescription sets the "get_description" callback function. Gets a short description for the application described by

the [iface@Gio.AppInfo].

func (*AppInfoIface) OverrideGetDisplayName

func (x *AppInfoIface) OverrideGetDisplayName(cb func(AppInfo) string)

OverrideGetDisplayName sets the "get_display_name" callback function. Gets the display name for the [iface@Gio.AppInfo].

(Since 2.24)

func (*AppInfoIface) OverrideGetExecutable

func (x *AppInfoIface) OverrideGetExecutable(cb func(AppInfo) string)

OverrideGetExecutable sets the "get_executable" callback function. Gets the executable name for the [iface@Gio.AppInfo].

func (*AppInfoIface) OverrideGetIcon

func (x *AppInfoIface) OverrideGetIcon(cb func(AppInfo) *IconBase)

OverrideGetIcon sets the "get_icon" callback function. Gets the [iface@Gio.Icon] for the [iface@Gio.AppInfo].

func (*AppInfoIface) OverrideGetId

func (x *AppInfoIface) OverrideGetId(cb func(AppInfo) string)

OverrideGetId sets the "get_id" callback function. Gets a string identifier for a [iface@Gio.AppInfo].

func (*AppInfoIface) OverrideGetName

func (x *AppInfoIface) OverrideGetName(cb func(AppInfo) string)

OverrideGetName sets the "get_name" callback function. Gets the name of the application for a [iface@Gio.AppInfo].

func (*AppInfoIface) OverrideGetSupportedTypes

func (x *AppInfoIface) OverrideGetSupportedTypes(cb func(AppInfo) []string)

OverrideGetSupportedTypes sets the "get_supported_types" callback function. Retrieves the list of content types that @app_info

claims to support.

func (*AppInfoIface) OverrideLaunch

func (x *AppInfoIface) OverrideLaunch(cb func(AppInfo, *glib.List, *AppLaunchContext) bool)

OverrideLaunch sets the "launch" callback function. Launches an application specified by the [iface@Gio.AppInfo].

func (*AppInfoIface) OverrideLaunchUris

func (x *AppInfoIface) OverrideLaunchUris(cb func(AppInfo, *glib.List, *AppLaunchContext) bool)

OverrideLaunchUris sets the "launch_uris" callback function. Launches an application with a list of URIs.

func (*AppInfoIface) OverrideLaunchUrisAsync

func (x *AppInfoIface) OverrideLaunchUrisAsync(cb func(AppInfo, *glib.List, *AppLaunchContext, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideLaunchUrisAsync sets the "launch_uris_async" callback function. Asynchronously launches an application with a list of

URIs. (Since: 2.60)

func (*AppInfoIface) OverrideLaunchUrisFinish

func (x *AppInfoIface) OverrideLaunchUrisFinish(cb func(AppInfo, AsyncResult) bool)

OverrideLaunchUrisFinish sets the "launch_uris_finish" callback function. Finishes an operation started with @launch_uris_async.

(Since: 2.60)

func (*AppInfoIface) OverrideRemoveSupportsType

func (x *AppInfoIface) OverrideRemoveSupportsType(cb func(AppInfo, string) bool)

OverrideRemoveSupportsType sets the "remove_supports_type" callback function. Removes a supported application type from a

[iface@Gio.AppInfo].

func (*AppInfoIface) OverrideSetAsDefaultForExtension

func (x *AppInfoIface) OverrideSetAsDefaultForExtension(cb func(AppInfo, string) bool)

OverrideSetAsDefaultForExtension sets the "set_as_default_for_extension" callback function. Sets an application as default for a given

file extension.

func (*AppInfoIface) OverrideSetAsDefaultForType

func (x *AppInfoIface) OverrideSetAsDefaultForType(cb func(AppInfo, string) bool)

OverrideSetAsDefaultForType sets the "set_as_default_for_type" callback function. Sets an application as default for a given content

type.

func (*AppInfoIface) OverrideSetAsLastUsedForType

func (x *AppInfoIface) OverrideSetAsLastUsedForType(cb func(AppInfo, string) bool)

OverrideSetAsLastUsedForType sets the "set_as_last_used_for_type" callback function. Sets the application as the last used. See

[method@Gio.AppInfo.set_as_last_used_for_type].

func (*AppInfoIface) OverrideShouldShow

func (x *AppInfoIface) OverrideShouldShow(cb func(AppInfo) bool)

OverrideShouldShow sets the "should_show" callback function. Returns whether an application should be shown (e.g. when

getting a list of installed applications).
[FreeDesktop.Org Startup Notification Specification](http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt).

func (*AppInfoIface) OverrideSupportsFiles

func (x *AppInfoIface) OverrideSupportsFiles(cb func(AppInfo) bool)

OverrideSupportsFiles sets the "supports_files" callback function. Indicates whether the application specified accepts

filename arguments.

func (*AppInfoIface) OverrideSupportsUris

func (x *AppInfoIface) OverrideSupportsUris(cb func(AppInfo) bool)

OverrideSupportsUris sets the "supports_uris" callback function. Indicates whether the application specified supports

launching URIs.

type AppInfoMonitor

type AppInfoMonitor struct {
	gobject.Object
}

`GAppInfoMonitor` monitors application information for changes.

`GAppInfoMonitor` is a very simple object used for monitoring the app info database for changes (newly installed or removed applications).

Call [func@Gio.AppInfoMonitor.get] to get a `GAppInfoMonitor` and connect to the [signal@Gio.AppInfoMonitor::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 [func@Gio.AppInfo.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 [signal@Gio.AppInfoMonitor::changed] signal so it can be emitted again:

  • [func@Gio.AppInfo.get_all]
  • [func@Gio.AppInfo.get_all_for_type]
  • [func@Gio.AppInfo.get_default_for_type]
  • [func@Gio.AppInfo.get_fallback_for_type]
  • [func@Gio.AppInfo.get_recommended_for_type]
  • [`g_desktop_app_info_get_implementations()`](../gio-unix/type_func.DesktopAppInfo.get_implementation.html)
  • [`g_desktop_app_info_new()`](../gio-unix/ctor.DesktopAppInfo.new.html)
  • [`g_desktop_app_info_new_from_filename()`](../gio-unix/ctor.DesktopAppInfo.new_from_filename.html)
  • [`g_desktop_app_info_new_from_keyfile()`](../gio-unix/ctor.DesktopAppInfo.new_from_keyfile.html)
  • [`g_desktop_app_info_search()`](../gio-unix/type_func.DesktopAppInfo.search.html)

The latter functions are available if using [`GDesktopAppInfo`](../gio-unix/class.DesktopAppInfo.html) from `gio-unix-2.0.pc` (GIR namespace `GioUnix-2.0`).

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.

func AppInfoMonitorGet

func AppInfoMonitorGet() *AppInfoMonitor

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.

func AppInfoMonitorNewFromInternalPtr

func AppInfoMonitorNewFromInternalPtr(ptr uintptr) *AppInfoMonitor

func (*AppInfoMonitor) ConnectChanged

func (x *AppInfoMonitor) ConnectChanged(cb *func(AppInfoMonitor)) uint

Signal emitted when the app info database changes, when applications are installed or removed.

func (*AppInfoMonitor) GoPointer

func (c *AppInfoMonitor) GoPointer() uintptr

func (*AppInfoMonitor) SetGoPointer

func (c *AppInfoMonitor) SetGoPointer(ptr uintptr)

type AppLaunchContext

type AppLaunchContext struct {
	gobject.Object
}

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.

func AppLaunchContextNewFromInternalPtr

func AppLaunchContextNewFromInternalPtr(ptr uintptr) *AppLaunchContext

func NewAppLaunchContext

func NewAppLaunchContext() *AppLaunchContext

Creates a new application launch context. This is not normally used, instead you instantiate a subclass of this, such as [`GdkAppLaunchContext`](https://docs.gtk.org/gdk4/class.AppLaunchContext.html).

func (*AppLaunchContext) ConnectLaunchFailed

func (x *AppLaunchContext) ConnectLaunchFailed(cb *func(AppLaunchContext, string)) uint

The [signal@Gio.AppLaunchContext::launch-failed] signal is emitted when a [iface@Gio.AppInfo] launch fails. The startup notification id is provided, so that the launcher can cancel the startup notification.

Because a launch operation may involve spawning multiple instances of the target application, you should expect this signal to be emitted multiple times, one for each spawned instance.

func (*AppLaunchContext) ConnectLaunchStarted

func (x *AppLaunchContext) ConnectLaunchStarted(cb *func(AppLaunchContext, uintptr, uintptr)) uint

The [signal@Gio.AppLaunchContext::launch-started] signal is emitted when a [iface@Gio.AppInfo] is about to be launched. If non-null the @platform_data is an GVariant dictionary mapping strings to variants (ie `a{sv}`), which contains additional, platform-specific data about this launch. On UNIX, at least the `startup-notification-id` keys will be present.

The value of the `startup-notification-id` key (type `s`) is a startup notification ID corresponding to the format from the [startup-notification specification](https://specifications.freedesktop.org/startup-notification-spec/startup-notification-0.1.txt). It allows tracking the progress of the launchee through startup.

It is guaranteed that this signal is followed by either a [signal@Gio.AppLaunchContext::launched] or [signal@Gio.AppLaunchContext::launch-failed] signal.

Because a launch operation may involve spawning multiple instances of the target application, you should expect this signal to be emitted multiple times, one for each spawned instance.

func (*AppLaunchContext) ConnectLaunched

func (x *AppLaunchContext) ConnectLaunched(cb *func(AppLaunchContext, uintptr, uintptr)) uint

The [signal@Gio.AppLaunchContext::launched] signal is emitted when a [iface@Gio.AppInfo] is successfully launched.

Because a launch operation may involve spawning multiple instances of the target application, you should expect this signal to be emitted multiple times, one time for each spawned instance.

The @platform_data is an GVariant dictionary mapping strings to variants (ie `a{sv}`), which contains additional, platform-specific data about this launch. On UNIX, at least the `pid` and `startup-notification-id` keys will be present.

Since 2.72 the `pid` may be 0 if the process id wasn’t known (for example if the process was launched via D-Bus). The `pid` may not be set at all in subsequent releases.

On Windows, `pid` is guaranteed to be valid only for the duration of the [signal@Gio.AppLaunchContext::launched] signal emission; after the signal is emitted, GLib will call [func@GLib.spawn_close_pid]. If you need to keep the [alias@GLib.Pid] after the signal has been emitted, then you can duplicate `pid` using `DuplicateHandle()`.

func (*AppLaunchContext) GetDisplay

func (x *AppLaunchContext) GetDisplay(InfoVar AppInfo, FilesVar *glib.List) string

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.

func (*AppLaunchContext) GetEnvironment

func (x *AppLaunchContext) GetEnvironment() []string

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`.

func (*AppLaunchContext) GetStartupNotifyId

func (x *AppLaunchContext) GetStartupNotifyId(InfoVar AppInfo, FilesVar *glib.List) 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. Since GLib 2.82 @info and @files can be `NULL`. If that’s not supported by the backend, the returned token will be `NULL`.

func (*AppLaunchContext) GoPointer

func (c *AppLaunchContext) GoPointer() uintptr

func (*AppLaunchContext) LaunchFailed

func (x *AppLaunchContext) LaunchFailed(StartupNotifyIdVar string)

Called when an application has failed to launch, so that it can cancel the application startup notification started in [method@Gio.AppLaunchContext.get_startup_notify_id].

func (*AppLaunchContext) SetGoPointer

func (c *AppLaunchContext) SetGoPointer(ptr uintptr)

func (*AppLaunchContext) Setenv

func (x *AppLaunchContext) Setenv(VariableVar string, ValueVar string)

Arranges for @variable to be set to @value in the child’s environment when @context is used to launch an application.

func (*AppLaunchContext) Unsetenv

func (x *AppLaunchContext) Unsetenv(VariableVar string)

Arranges for @variable to be unset in the child’s environment when @context is used to launch an application.

type AppLaunchContextClass

type AppLaunchContextClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*AppLaunchContextClass) GetGReserved1

func (x *AppLaunchContextClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*AppLaunchContextClass) GetGReserved2

func (x *AppLaunchContextClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*AppLaunchContextClass) GetGReserved3

func (x *AppLaunchContextClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*AppLaunchContextClass) GetGetDisplay

func (x *AppLaunchContextClass) GetGetDisplay() func(*AppLaunchContext, AppInfo, *glib.List) string

GetGetDisplay gets the "get_display" callback function.

func (*AppLaunchContextClass) GetGetStartupNotifyId

func (x *AppLaunchContextClass) GetGetStartupNotifyId() func(*AppLaunchContext, AppInfo, *glib.List) string

GetGetStartupNotifyId gets the "get_startup_notify_id" callback function.

func (*AppLaunchContextClass) GetLaunchFailed

func (x *AppLaunchContextClass) GetLaunchFailed() func(*AppLaunchContext, string)

GetLaunchFailed gets the "launch_failed" callback function.

func (*AppLaunchContextClass) GetLaunchStarted

func (x *AppLaunchContextClass) GetLaunchStarted() func(*AppLaunchContext, AppInfo, *glib.Variant)

GetLaunchStarted gets the "launch_started" callback function.

func (*AppLaunchContextClass) GetLaunched

func (x *AppLaunchContextClass) GetLaunched() func(*AppLaunchContext, AppInfo, *glib.Variant)

GetLaunched gets the "launched" callback function.

func (*AppLaunchContextClass) GoPointer

func (x *AppLaunchContextClass) GoPointer() uintptr

func (*AppLaunchContextClass) OverrideGReserved1

func (x *AppLaunchContextClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*AppLaunchContextClass) OverrideGReserved2

func (x *AppLaunchContextClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*AppLaunchContextClass) OverrideGReserved3

func (x *AppLaunchContextClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*AppLaunchContextClass) OverrideGetDisplay

func (x *AppLaunchContextClass) OverrideGetDisplay(cb func(*AppLaunchContext, AppInfo, *glib.List) string)

OverrideGetDisplay sets the "get_display" callback function.

func (*AppLaunchContextClass) OverrideGetStartupNotifyId

func (x *AppLaunchContextClass) OverrideGetStartupNotifyId(cb func(*AppLaunchContext, AppInfo, *glib.List) string)

OverrideGetStartupNotifyId sets the "get_startup_notify_id" callback function.

func (*AppLaunchContextClass) OverrideLaunchFailed

func (x *AppLaunchContextClass) OverrideLaunchFailed(cb func(*AppLaunchContext, string))

OverrideLaunchFailed sets the "launch_failed" callback function.

func (*AppLaunchContextClass) OverrideLaunchStarted

func (x *AppLaunchContextClass) OverrideLaunchStarted(cb func(*AppLaunchContext, AppInfo, *glib.Variant))

OverrideLaunchStarted sets the "launch_started" callback function.

func (*AppLaunchContextClass) OverrideLaunched

func (x *AppLaunchContextClass) OverrideLaunched(cb func(*AppLaunchContext, AppInfo, *glib.Variant))

OverrideLaunched sets the "launched" callback function.

type AppLaunchContextPrivate

type AppLaunchContextPrivate struct {
	// contains filtered or unexported fields
}

func (*AppLaunchContextPrivate) GoPointer

func (x *AppLaunchContextPrivate) GoPointer() uintptr

type Application

type Application struct {
	gobject.Object
}

`GApplication` is the core class for application support.

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 [method@Gio.Application.hold] and [method@Gio.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 [method@Gio.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 [method@Gio.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 [func@Gio.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 [method@Gio.Application.register]). Unfortunately, this means that you cannot use [property@Gio.Application:is-remote] to decide if you want to register object paths.

`GApplication` also implements the [iface@Gio.ActionGroup] and [iface@Gio.ActionMap] interfaces and lets you easily export actions by adding them with [method@Gio.ActionMap.add_action]. When invoking an action by calling [method@Gio.ActionGroup.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 [class@Gio.DBusActionGroup] wrapper to conveniently access them remotely. GIO provides a [class@Gio.DBusMenuModel] wrapper for remote access to exported [class@Gio.MenuModel]s.

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 [signal@Gio.Application::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 [struct@GLib.Variant] dictionary mapping strings to variants. To use platform data, override the [vfunc@Gio.Application.before_emit] or [vfunc@Gio.Application.after_emit] virtual functions in your `GApplication` subclass. When dealing with [class@Gio.ApplicationCommandLine] objects, the platform data is directly available via [method@Gio.ApplicationCommandLine.get_cwd], [method@Gio.ApplicationCommandLine.get_environ] and [method@Gio.ApplicationCommandLine.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 [vfunc@Gio.Application.add_platform_data] virtual function. For instance, `GtkApplication` adds startup notification data in this way.

To parse commandline arguments you may handle the [signal@Gio.Application::command-line] signal or override the [vfunc@Gio.Application.local_command_line] virtual function, 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).

func ApplicationGetDefault

func ApplicationGetDefault() *Application

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.

func ApplicationNewFromInternalPtr

func ApplicationNewFromInternalPtr(ptr uintptr) *Application

func NewApplication

func NewApplication(ApplicationIdVar *string, FlagsVar ApplicationFlags) *Application

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.

func (*Application) ActionAdded

func (x *Application) ActionAdded(ActionNameVar string)

Emits the [signal@Gio.ActionGroup::action-added] signal on @action_group.

This function should only be called by [type@Gio.ActionGroup] implementations.

func (*Application) ActionEnabledChanged

func (x *Application) ActionEnabledChanged(ActionNameVar string, EnabledVar bool)

Emits the [signal@Gio.ActionGroup::action-enabled-changed] signal on @action_group.

This function should only be called by [type@Gio.ActionGroup] implementations.

func (*Application) ActionRemoved

func (x *Application) ActionRemoved(ActionNameVar string)

Emits the [signal@Gio.ActionGroup::action-removed] signal on @action_group.

This function should only be called by [type@Gio.ActionGroup] implementations.

func (*Application) ActionStateChanged

func (x *Application) ActionStateChanged(ActionNameVar string, StateVar *glib.Variant)

Emits the [signal@Gio.ActionGroup::action-state-changed] signal on @action_group.

This function should only be called by [type@Gio.ActionGroup] implementations.

func (*Application) Activate

func (x *Application) Activate()

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.

func (*Application) ActivateAction

func (x *Application) ActivateAction(ActionNameVar string, ParameterVar *glib.Variant)

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 [method@Gio.ActionGroup.get_action_parameter_type].

If the [type@Gio.ActionGroup] 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, [method@Gio.DBusConnection.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 [method@Gio.DBusConnection.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); ```

func (*Application) AddAction

func (x *Application) AddAction(ActionVar Action)

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.

func (*Application) AddActionEntries

func (x *Application) AddActionEntries(EntriesVar []ActionEntry, NEntriesVar int, UserDataVar uintptr)

A convenience function for creating multiple [class@Gio.SimpleAction] instances and adding them to a [iface@Gio.ActionMap].

Each action is constructed as per one [struct@Gio.ActionEntry].

```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);
}

```

func (*Application) AddMainOption

func (x *Application) AddMainOption(LongNameVar string, ShortNameVar byte, FlagsVar glib.OptionFlags, ArgVar glib.OptionArg, DescriptionVar string, ArgDescriptionVar *string)

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.

func (*Application) AddMainOptionEntries

func (x *Application) AddMainOptionEntries(EntriesVar []glib.OptionEntry)

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 unrecognized options will be treated as errors. Unrecognized 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`

func (*Application) AddOptionGroup

func (x *Application) AddOptionGroup(GroupVar *glib.OptionGroup)

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 unrecognized options are rejected even if %G_APPLICATION_HANDLES_COMMAND_LINE was given.

func (*Application) BindBusyProperty

func (x *Application) BindBusyProperty(ObjectVar *gobject.Object, PropertyVar string)

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.

func (*Application) ChangeActionState

func (x *Application) ChangeActionState(ActionNameVar string, ValueVar *glib.Variant)

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 [method@Gio.ActionGroup.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 [method@Gio.ActionGroup.get_action_state_hint].

If the @value GVariant is floating, it is consumed.

func (*Application) ConnectActivate

func (x *Application) ConnectActivate(cb *func(Application)) uint

The ::activate signal is emitted on the primary instance when an activation occurs. See g_application_activate().

func (*Application) ConnectCommandLine

func (x *Application) ConnectCommandLine(cb *func(Application, uintptr) int) uint

The ::command-line signal is emitted on the primary instance when a commandline is not handled locally. See g_application_run() and the #GApplicationCommandLine documentation for more information.

func (*Application) ConnectHandleLocalOptions

func (x *Application) ConnectHandleLocalOptions(cb *func(Application, uintptr) int) uint

The ::handle-local-options signal is emitted on the local instance after the parsing of the commandline options has occurred.

You can add options to be recognised during commandline option parsing using g_application_add_main_option_entries() and g_application_add_option_group().

Signal handlers can inspect @options (along with values pointed to from the @arg_data of an installed #GOptionEntrys) in order to decide to perform certain actions, including direct local handling (which may be useful for options like --version).

In the event that the application is marked %G_APPLICATION_HANDLES_COMMAND_LINE the "normal processing" will send the @options dictionary to the primary instance where it can be read with g_application_command_line_get_options_dict(). The signal handler can modify the dictionary before returning, and the modified dictionary will be sent.

In the event that %G_APPLICATION_HANDLES_COMMAND_LINE is not set, "normal processing" will treat the remaining uncollected command line arguments as filenames or URIs. If there are no arguments, the application is activated by g_application_activate(). One or more arguments results in a call to g_application_open().

If you want to handle the local commandline arguments for yourself by converting them to calls to g_application_open() or g_action_group_activate_action() then you must be sure to register the application first. You should probably not call g_application_activate() for yourself, however: just return -1 and allow the default handler to do it for you. This will ensure that the `--gapplication-service` switch works properly (i.e. no activation in that case).

Note that this signal is emitted from the default implementation of local_command_line(). If you override that function and don't chain up then this signal will never be emitted.

You can override local_command_line() if you need more powerful capabilities than what is provided here, but this should not normally be required.

func (*Application) ConnectNameLost

func (x *Application) ConnectNameLost(cb *func(Application) bool) uint

The ::name-lost signal is emitted only on the registered primary instance when a new instance has taken over. This can only happen if the application is using the %G_APPLICATION_ALLOW_REPLACEMENT flag.

The default handler for this signal calls g_application_quit().

func (*Application) ConnectOpen

func (x *Application) ConnectOpen(cb *func(Application, uintptr, int, string)) uint

The ::open signal is emitted on the primary instance when there are files to open. See g_application_open() for more information.

func (*Application) ConnectShutdown

func (x *Application) ConnectShutdown(cb *func(Application)) uint

The ::shutdown signal is emitted only on the registered primary instance immediately after the main loop terminates.

func (*Application) ConnectStartup

func (x *Application) ConnectStartup(cb *func(Application)) uint

The ::startup signal is emitted on the primary instance immediately after registration. See g_application_register().

func (*Application) GetActionEnabled

func (x *Application) GetActionEnabled(ActionNameVar string) bool

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.

func (*Application) GetActionParameterType

func (x *Application) GetActionParameterType(ActionNameVar string) *glib.VariantType

Queries the type of the parameter that must be given when activating the named action within @action_group.

When activating the action using [method@Gio.ActionGroup.activate_action], the [type@GLib.Variant] 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 [type@GLib.Variant], 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.

func (*Application) GetActionState

func (x *Application) GetActionState(ActionNameVar string) *glib.Variant

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 [method@Gio.ActionGroup.get_action_state_type].

The return value (if non-`NULL`) should be freed with [method@GLib.Variant.unref] when it is no longer required.

func (*Application) GetActionStateHint

func (x *Application) GetActionStateHint(ActionNameVar string) *glib.Variant

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 [type@GLib.Variant] array is returned then each item in the array is a possible value for the state. If a [type@GLib.Variant] 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 [method@GLib.Variant.unref] when it is no longer required.

func (*Application) GetActionStateType

func (x *Application) GetActionStateType(ActionNameVar string) *glib.VariantType

Queries the type of the state of the named action within @action_group.

If the action is stateful then this function returns the [type@GLib.VariantType] of the state. All calls to [method@Gio.ActionGroup.change_action_state] must give a [type@GLib.Variant] of this type and [method@Gio.ActionGroup.get_action_state] will return a [type@GLib.Variant] of the same type.

If the action is not stateful then this function will return `NULL`. In that case, [method@Gio.ActionGroup.get_action_state] will return `NULL` and you must not call [method@Gio.ActionGroup.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.

func (*Application) GetApplicationId

func (x *Application) GetApplicationId() string

Gets the unique identifier for @application.

func (*Application) GetDbusConnection

func (x *Application) GetDbusConnection() *DBusConnection

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().

func (*Application) GetDbusObjectPath

func (x *Application) GetDbusObjectPath() string

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().

func (*Application) GetFlags

func (x *Application) GetFlags() ApplicationFlags

Gets the flags for @application.

See #GApplicationFlags.

func (*Application) GetInactivityTimeout

func (x *Application) GetInactivityTimeout() uint

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.

func (*Application) GetIsBusy

func (x *Application) GetIsBusy() bool

Gets the application's current busy state, as set through g_application_mark_busy() or g_application_bind_busy_property().

func (*Application) GetIsRegistered

func (x *Application) GetIsRegistered() bool

Checks if @application is registered.

An application is registered if g_application_register() has been successfully called.

func (*Application) GetIsRemote

func (x *Application) GetIsRemote() bool

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().

func (*Application) GetPropertyApplicationId

func (x *Application) GetPropertyApplicationId() string

GetPropertyApplicationId gets the "application-id" property. The unique identifier for the application.

func (*Application) GetPropertyInactivityTimeout

func (x *Application) GetPropertyInactivityTimeout() uint

GetPropertyInactivityTimeout gets the "inactivity-timeout" property. Time (in milliseconds) to stay alive after becoming idle.

func (*Application) GetPropertyIsBusy

func (x *Application) GetPropertyIsBusy() bool

GetPropertyIsBusy gets the "is-busy" property. Whether the application is currently marked as busy through g_application_mark_busy() or g_application_bind_busy_property().

func (*Application) GetPropertyIsRegistered

func (x *Application) GetPropertyIsRegistered() bool

GetPropertyIsRegistered gets the "is-registered" property. Whether [method@Gio.Application.register] has been called.

func (*Application) GetPropertyIsRemote

func (x *Application) GetPropertyIsRemote() bool

GetPropertyIsRemote gets the "is-remote" property. Whether this application instance is remote.

func (*Application) GetPropertyResourceBasePath

func (x *Application) GetPropertyResourceBasePath() string

GetPropertyResourceBasePath gets the "resource-base-path" property. The base resource path for the application.

func (*Application) GetPropertyVersion

func (x *Application) GetPropertyVersion() string

GetPropertyVersion gets the "version" property. The human-readable version number of the application.

func (*Application) GetResourceBasePath

func (x *Application) GetResourceBasePath() string

Gets the resource base path of @application.

See g_application_set_resource_base_path() for more information.

func (*Application) GetVersion

func (x *Application) GetVersion() string

Gets the version of @application.

func (*Application) GoPointer

func (c *Application) GoPointer() uintptr

func (*Application) HasAction

func (x *Application) HasAction(ActionNameVar string) bool

Checks if the named action exists within @action_group.

func (*Application) Hold

func (x *Application) Hold()

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().

func (*Application) ListActions

func (x *Application) ListActions() []string

Lists the actions contained within @action_group.

The caller is responsible for freeing the list with [func@GLib.strfreev] when it is no longer required.

func (*Application) LookupAction

func (x *Application) LookupAction(ActionNameVar string) *ActionBase

Looks up the action with the name @action_name in @action_map.

If no such action exists, returns `NULL`.

func (*Application) MarkBusy

func (x *Application) MarkBusy()

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.

func (*Application) Open

func (x *Application) Open(FilesVar uintptr, NFilesVar int, HintVar string)

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.

func (*Application) QueryAction

func (x *Application) QueryAction(ActionNameVar string, EnabledVar *bool, ParameterTypeVar **glib.VariantType, StateTypeVar **glib.VariantType, StateHintVar **glib.Variant, StateVar **glib.Variant) bool

Queries all aspects of the named action within an @action_group.

This function acquires the information available from [method@Gio.ActionGroup.has_action], [method@Gio.ActionGroup.get_action_enabled], [method@Gio.ActionGroup.get_action_parameter_type], [method@Gio.ActionGroup.get_action_state_type], [method@Gio.ActionGroup.get_action_state_hint] and [method@Gio.ActionGroup.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 [type@Gio.ActionGroup] 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.

func (*Application) Quit

func (x *Application) Quit()

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.

func (*Application) Register

func (x *Application) Register(CancellableVar *Cancellable) (bool, error)

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.

func (*Application) Release

func (x *Application) Release()

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().

func (*Application) RemoveAction

func (x *Application) RemoveAction(ActionNameVar string)

Removes the named action from the action map.

If no action of this name is in the map then nothing happens.

func (*Application) RemoveActionEntries

func (x *Application) RemoveActionEntries(EntriesVar []ActionEntry, NEntriesVar int)

Remove actions from a [iface@Gio.ActionMap]. This is meant as the reverse of [method@Gio.ActionMap.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));
}

```

func (*Application) Run

func (x *Application) Run(ArgcVar int, ArgvVar []string) int

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.

func (*Application) SendNotification

func (x *Application) SendNotification(IdVar *string, NotificationVar *Notification)

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 [method@Gio.Application.withdraw_notification].

It is an error to call this function if @application has no application ID.

func (*Application) SetActionGroup

func (x *Application) SetActionGroup(ActionGroupVar ActionGroup)

This used to be how actions were associated with a #GApplication. Now there is #GActionMap for that.

func (*Application) SetApplicationId

func (x *Application) SetApplicationId(ApplicationIdVar *string)

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().

func (*Application) SetDefault

func (x *Application) SetDefault()

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.

func (*Application) SetFlags

func (x *Application) SetFlags(FlagsVar ApplicationFlags)

Sets the flags for @application.

The flags can only be modified if @application has not yet been registered.

See #GApplicationFlags.

func (*Application) SetGoPointer

func (c *Application) SetGoPointer(ptr uintptr)

func (*Application) SetInactivityTimeout

func (x *Application) SetInactivityTimeout(InactivityTimeoutVar uint)

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.

func (*Application) SetOptionContextDescription

func (x *Application) SetOptionContextDescription(DescriptionVar *string)

Adds a description to the @application option context.

See g_option_context_set_description() for more information.

func (*Application) SetOptionContextParameterString

func (x *Application) SetOptionContextParameterString(ParameterStringVar *string)

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.

func (*Application) SetOptionContextSummary

func (x *Application) SetOptionContextSummary(SummaryVar *string)

Adds a summary to the @application option context.

See g_option_context_set_summary() for more information.

func (*Application) SetPropertyApplicationId

func (x *Application) SetPropertyApplicationId(value string)

SetPropertyApplicationId sets the "application-id" property. The unique identifier for the application.

func (*Application) SetPropertyInactivityTimeout

func (x *Application) SetPropertyInactivityTimeout(value uint)

SetPropertyInactivityTimeout sets the "inactivity-timeout" property. Time (in milliseconds) to stay alive after becoming idle.

func (*Application) SetPropertyResourceBasePath

func (x *Application) SetPropertyResourceBasePath(value string)

SetPropertyResourceBasePath sets the "resource-base-path" property. The base resource path for the application.

func (*Application) SetPropertyVersion

func (x *Application) SetPropertyVersion(value string)

SetPropertyVersion sets the "version" property. The human-readable version number of the application.

func (*Application) SetResourceBasePath

func (x *Application) SetResourceBasePath(ResourcePathVar *string)

Sets (or unsets) the base resource path of @application.

The path is used to automatically load various [application resources][struct@Gio.Resource] 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.

func (*Application) SetVersion

func (x *Application) SetVersion(VersionVar string)

Sets the version number of @application. This will be used to implement a `--version` command line argument

The application version can only be modified if @application has not yet been registered.

func (*Application) UnbindBusyProperty

func (x *Application) UnbindBusyProperty(ObjectVar *gobject.Object, PropertyVar string)

Destroys a binding between @property and the busy state of @application that was previously created with g_application_bind_busy_property().

func (*Application) UnmarkBusy

func (x *Application) UnmarkBusy()

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().

func (*Application) WithdrawNotification

func (x *Application) WithdrawNotification(IdVar string)

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.

type ApplicationClass

type ApplicationClass struct {
	ParentClass gobject.ObjectClass

	Padding [7]uintptr
	// contains filtered or unexported fields
}

Virtual function table for #GApplication.

func (*ApplicationClass) GetActivate

func (x *ApplicationClass) GetActivate() func(*Application)

GetActivate gets the "activate" callback function. invoked on the primary instance when an activation occurs

func (*ApplicationClass) GetAddPlatformData

func (x *ApplicationClass) GetAddPlatformData() func(*Application, *glib.VariantBuilder)

GetAddPlatformData gets the "add_platform_data" callback function. invoked (locally) to add 'platform data' to be sent to

the primary instance when activating, opening or invoking actions. Must chain up

func (*ApplicationClass) GetAfterEmit

func (x *ApplicationClass) GetAfterEmit() func(*Application, *glib.Variant)

GetAfterEmit gets the "after_emit" callback function. invoked on the primary instance after 'activate', 'open',

'command-line' or any action invocation, gets the 'platform data' from
the calling instance. Must chain up

func (*ApplicationClass) GetBeforeEmit

func (x *ApplicationClass) GetBeforeEmit() func(*Application, *glib.Variant)

GetBeforeEmit gets the "before_emit" callback function. invoked on the primary instance before 'activate', 'open',

'command-line' or any action invocation, gets the 'platform data' from
the calling instance. Must chain up

func (*ApplicationClass) GetCommandLine

func (x *ApplicationClass) GetCommandLine() func(*Application, *ApplicationCommandLine) int

GetCommandLine gets the "command_line" callback function. invoked on the primary instance when a command-line is

not handled locally

func (*ApplicationClass) GetDbusRegister

func (x *ApplicationClass) GetDbusRegister() func(*Application, *DBusConnection, string) bool

GetDbusRegister gets the "dbus_register" callback function. invoked locally during registration, if the application is

using its D-Bus backend. You can use this to export extra objects on the
bus, that need to exist before the application tries to own the bus name.
The function is passed the #GDBusConnection to to session bus, and the
object path that #GApplication will use to export its D-Bus API.
If this function returns %TRUE, registration will proceed; otherwise
registration will abort. Since: 2.34

func (*ApplicationClass) GetDbusUnregister

func (x *ApplicationClass) GetDbusUnregister() func(*Application, *DBusConnection, string)

GetDbusUnregister gets the "dbus_unregister" callback function. invoked locally during unregistration, if the application

is using its D-Bus backend. Use this to undo anything done by
the @dbus_register vfunc. Since: 2.34

func (*ApplicationClass) GetHandleLocalOptions

func (x *ApplicationClass) GetHandleLocalOptions() func(*Application, *glib.VariantDict) int

GetHandleLocalOptions gets the "handle_local_options" callback function. invoked locally after the parsing of the commandline

options has occurred. Since: 2.40

func (*ApplicationClass) GetLocalCommandLine

func (x *ApplicationClass) GetLocalCommandLine() func(*Application, *[]string, *int) bool

GetLocalCommandLine gets the "local_command_line" callback function. invoked (locally). The virtual function has the chance

to inspect (and possibly replace) command line arguments. See
g_application_run() for more information. Also see the
#GApplication::handle-local-options signal, which is a simpler
alternative to handling some commandline options locally

func (*ApplicationClass) GetNameLost

func (x *ApplicationClass) GetNameLost() func(*Application) bool

GetNameLost gets the "name_lost" callback function. invoked when another instance is taking over the name. Since: 2.60

func (*ApplicationClass) GetOpen

func (x *ApplicationClass) GetOpen() func(*Application, uintptr, int, string)

GetOpen gets the "open" callback function. invoked on the primary instance when there are files to open

func (*ApplicationClass) GetQuitMainloop

func (x *ApplicationClass) GetQuitMainloop() func(*Application)

GetQuitMainloop gets the "quit_mainloop" callback function. Used to be invoked on the primary instance when the use

count of the application drops to zero (and after any inactivity
timeout, if requested). Not used anymore since 2.32

func (*ApplicationClass) GetRunMainloop

func (x *ApplicationClass) GetRunMainloop() func(*Application)

GetRunMainloop gets the "run_mainloop" callback function. Used to be invoked on the primary instance from

g_application_run() if the use-count is non-zero. Since 2.32,
GApplication is iterating the main context directly and is not
using @run_mainloop anymore

func (*ApplicationClass) GetShutdown

func (x *ApplicationClass) GetShutdown() func(*Application)

GetShutdown gets the "shutdown" callback function. invoked only on the registered primary instance immediately

after the main loop terminates

func (*ApplicationClass) GetStartup

func (x *ApplicationClass) GetStartup() func(*Application)

GetStartup gets the "startup" callback function. invoked on the primary instance immediately after registration

func (*ApplicationClass) GoPointer

func (x *ApplicationClass) GoPointer() uintptr

func (*ApplicationClass) OverrideActivate

func (x *ApplicationClass) OverrideActivate(cb func(*Application))

OverrideActivate sets the "activate" callback function. invoked on the primary instance when an activation occurs

func (*ApplicationClass) OverrideAddPlatformData

func (x *ApplicationClass) OverrideAddPlatformData(cb func(*Application, *glib.VariantBuilder))

OverrideAddPlatformData sets the "add_platform_data" callback function. invoked (locally) to add 'platform data' to be sent to

the primary instance when activating, opening or invoking actions. Must chain up

func (*ApplicationClass) OverrideAfterEmit

func (x *ApplicationClass) OverrideAfterEmit(cb func(*Application, *glib.Variant))

OverrideAfterEmit sets the "after_emit" callback function. invoked on the primary instance after 'activate', 'open',

'command-line' or any action invocation, gets the 'platform data' from
the calling instance. Must chain up

func (*ApplicationClass) OverrideBeforeEmit

func (x *ApplicationClass) OverrideBeforeEmit(cb func(*Application, *glib.Variant))

OverrideBeforeEmit sets the "before_emit" callback function. invoked on the primary instance before 'activate', 'open',

'command-line' or any action invocation, gets the 'platform data' from
the calling instance. Must chain up

func (*ApplicationClass) OverrideCommandLine

func (x *ApplicationClass) OverrideCommandLine(cb func(*Application, *ApplicationCommandLine) int)

OverrideCommandLine sets the "command_line" callback function. invoked on the primary instance when a command-line is

not handled locally

func (*ApplicationClass) OverrideDbusRegister

func (x *ApplicationClass) OverrideDbusRegister(cb func(*Application, *DBusConnection, string) bool)

OverrideDbusRegister sets the "dbus_register" callback function. invoked locally during registration, if the application is

using its D-Bus backend. You can use this to export extra objects on the
bus, that need to exist before the application tries to own the bus name.
The function is passed the #GDBusConnection to to session bus, and the
object path that #GApplication will use to export its D-Bus API.
If this function returns %TRUE, registration will proceed; otherwise
registration will abort. Since: 2.34

func (*ApplicationClass) OverrideDbusUnregister

func (x *ApplicationClass) OverrideDbusUnregister(cb func(*Application, *DBusConnection, string))

OverrideDbusUnregister sets the "dbus_unregister" callback function. invoked locally during unregistration, if the application

is using its D-Bus backend. Use this to undo anything done by
the @dbus_register vfunc. Since: 2.34

func (*ApplicationClass) OverrideHandleLocalOptions

func (x *ApplicationClass) OverrideHandleLocalOptions(cb func(*Application, *glib.VariantDict) int)

OverrideHandleLocalOptions sets the "handle_local_options" callback function. invoked locally after the parsing of the commandline

options has occurred. Since: 2.40

func (*ApplicationClass) OverrideLocalCommandLine

func (x *ApplicationClass) OverrideLocalCommandLine(cb func(*Application, *[]string, *int) bool)

OverrideLocalCommandLine sets the "local_command_line" callback function. invoked (locally). The virtual function has the chance

to inspect (and possibly replace) command line arguments. See
g_application_run() for more information. Also see the
#GApplication::handle-local-options signal, which is a simpler
alternative to handling some commandline options locally

func (*ApplicationClass) OverrideNameLost

func (x *ApplicationClass) OverrideNameLost(cb func(*Application) bool)

OverrideNameLost sets the "name_lost" callback function. invoked when another instance is taking over the name. Since: 2.60

func (*ApplicationClass) OverrideOpen

func (x *ApplicationClass) OverrideOpen(cb func(*Application, uintptr, int, string))

OverrideOpen sets the "open" callback function. invoked on the primary instance when there are files to open

func (*ApplicationClass) OverrideQuitMainloop

func (x *ApplicationClass) OverrideQuitMainloop(cb func(*Application))

OverrideQuitMainloop sets the "quit_mainloop" callback function. Used to be invoked on the primary instance when the use

count of the application drops to zero (and after any inactivity
timeout, if requested). Not used anymore since 2.32

func (*ApplicationClass) OverrideRunMainloop

func (x *ApplicationClass) OverrideRunMainloop(cb func(*Application))

OverrideRunMainloop sets the "run_mainloop" callback function. Used to be invoked on the primary instance from

g_application_run() if the use-count is non-zero. Since 2.32,
GApplication is iterating the main context directly and is not
using @run_mainloop anymore

func (*ApplicationClass) OverrideShutdown

func (x *ApplicationClass) OverrideShutdown(cb func(*Application))

OverrideShutdown sets the "shutdown" callback function. invoked only on the registered primary instance immediately

after the main loop terminates

func (*ApplicationClass) OverrideStartup

func (x *ApplicationClass) OverrideStartup(cb func(*Application))

OverrideStartup sets the "startup" callback function. invoked on the primary instance immediately after registration

type ApplicationCommandLine

type ApplicationCommandLine struct {
	gobject.Object
}

`GApplicationCommandLine` represents a command-line invocation of an application.

It is created by [class@Gio.Application] and emitted in the [signal@Gio.Application::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 [struct@GLib.OptionContext] command-line parsing API, with the [method@Gio.ApplicationCommandLine.get_arguments] function. See [gapplication-example-cmdline3.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-cmdline3.c) 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.

For remote invocation, the originally-invoked process exits when [method@Gio.ApplicationCommandLine.done] method is called. This method is also automatically called when the object is disposed.

The main use for `GApplicationCommandLine` (and the [signal@Gio.Application::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 [signal@Gio.Application::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 [signal@Gio.Application::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 [signal@Gio.Application::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)

func ApplicationCommandLineNewFromInternalPtr

func ApplicationCommandLineNewFromInternalPtr(ptr uintptr) *ApplicationCommandLine

func (*ApplicationCommandLine) CreateFileForArg

func (x *ApplicationCommandLine) CreateFileForArg(ArgVar string) *FileBase

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.

func (*ApplicationCommandLine) Done

func (x *ApplicationCommandLine) Done()

Signals that command line processing is completed.

For remote invocation, it causes the invoking process to terminate.

For local invocation, it does nothing.

This method should be called in the [signal@Gio.Application::command-line] handler, after the exit status is set and all messages are printed.

After this call, g_application_command_line_set_exit_status() has no effect. Subsequent calls to this method are no-ops.

This method is automatically called when the #GApplicationCommandLine object is disposed — so you can omit the call in non-garbage collected languages.

func (*ApplicationCommandLine) GetArguments

func (x *ApplicationCommandLine) GetArguments(ArgcVar *int) []string

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().

func (*ApplicationCommandLine) GetCwd

func (x *ApplicationCommandLine) GetCwd() 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.

func (*ApplicationCommandLine) GetEnviron

func (x *ApplicationCommandLine) GetEnviron() []string

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.

func (*ApplicationCommandLine) GetExitStatus

func (x *ApplicationCommandLine) GetExitStatus() int

Gets the exit status of @cmdline. See g_application_command_line_set_exit_status() for more information.

func (*ApplicationCommandLine) GetIsRemote

func (x *ApplicationCommandLine) GetIsRemote() bool

Determines if @cmdline represents a remote invocation.

func (*ApplicationCommandLine) GetOptionsDict

func (x *ApplicationCommandLine) GetOptionsDict() *glib.VariantDict

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.

func (*ApplicationCommandLine) GetPlatformData

func (x *ApplicationCommandLine) GetPlatformData() *glib.Variant

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.

func (*ApplicationCommandLine) GetPropertyIsRemote

func (x *ApplicationCommandLine) GetPropertyIsRemote() bool

GetPropertyIsRemote gets the "is-remote" property. Whether this is a remote commandline.

func (*ApplicationCommandLine) GetStdin

func (x *ApplicationCommandLine) GetStdin() *InputStream

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.

func (*ApplicationCommandLine) Getenv

func (x *ApplicationCommandLine) Getenv(NameVar string) string

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.

func (*ApplicationCommandLine) GoPointer

func (c *ApplicationCommandLine) GoPointer() uintptr

func (*ApplicationCommandLine) Print

func (x *ApplicationCommandLine) Print(FormatVar string, varArgs ...interface{})

Formats a message and prints it using the stdout print handler in the invoking process.

If @cmdline is a local invocation then this is exactly equivalent to g_print(). If @cmdline is remote then this is equivalent to calling g_print() in the invoking process.

func (*ApplicationCommandLine) PrintLiteral

func (x *ApplicationCommandLine) PrintLiteral(MessageVar string)

Prints a message using the stdout print handler in the invoking process.

Unlike g_application_command_line_print(), @message is not a `printf()`-style format string. Use this function if @message contains text you don't have control over, that could include `printf()` escape sequences.

func (*ApplicationCommandLine) Printerr

func (x *ApplicationCommandLine) Printerr(FormatVar string, varArgs ...interface{})

Formats a message and prints it using the stderr print handler in the invoking process.

If @cmdline is a local invocation then this is exactly equivalent to g_printerr(). If @cmdline is remote then this is equivalent to calling g_printerr() in the invoking process.

func (*ApplicationCommandLine) PrinterrLiteral

func (x *ApplicationCommandLine) PrinterrLiteral(MessageVar string)

Prints a message using the stderr print handler in the invoking process.

Unlike g_application_command_line_printerr(), @message is not a `printf()`-style format string. Use this function if @message contains text you don't have control over, that could include `printf()` escape sequences.

func (*ApplicationCommandLine) SetExitStatus

func (x *ApplicationCommandLine) SetExitStatus(ExitStatusVar int)

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.

This method is a no-op if g_application_command_line_done() has been called.

func (*ApplicationCommandLine) SetGoPointer

func (c *ApplicationCommandLine) SetGoPointer(ptr uintptr)

func (*ApplicationCommandLine) SetPropertyArguments

func (x *ApplicationCommandLine) SetPropertyArguments(value uintptr)

SetPropertyArguments sets the "arguments" property. The commandline that caused this [signal@Gio.Application::command-line] signal emission.

func (*ApplicationCommandLine) SetPropertyOptions

func (x *ApplicationCommandLine) SetPropertyOptions(value uintptr)

SetPropertyOptions sets the "options" property. The options sent along with the commandline.

func (*ApplicationCommandLine) SetPropertyPlatformData

func (x *ApplicationCommandLine) SetPropertyPlatformData(value uintptr)

SetPropertyPlatformData sets the "platform-data" property. Platform-specific data for the commandline.

type ApplicationCommandLineClass

type ApplicationCommandLineClass struct {
	ParentClass gobject.ObjectClass

	Padding [10]uintptr
	// contains filtered or unexported fields
}

The #GApplicationCommandLineClass-struct contains private data only.

func (*ApplicationCommandLineClass) GetDone

GetDone gets the "done" callback function.

func (*ApplicationCommandLineClass) GetGetStdin

GetGetStdin gets the "get_stdin" callback function.

func (*ApplicationCommandLineClass) GetPrintLiteral

func (x *ApplicationCommandLineClass) GetPrintLiteral() func(*ApplicationCommandLine, string)

GetPrintLiteral gets the "print_literal" callback function.

func (*ApplicationCommandLineClass) GetPrinterrLiteral

func (x *ApplicationCommandLineClass) GetPrinterrLiteral() func(*ApplicationCommandLine, string)

GetPrinterrLiteral gets the "printerr_literal" callback function.

func (*ApplicationCommandLineClass) GoPointer

func (x *ApplicationCommandLineClass) GoPointer() uintptr

func (*ApplicationCommandLineClass) OverrideDone

func (x *ApplicationCommandLineClass) OverrideDone(cb func(*ApplicationCommandLine))

OverrideDone sets the "done" callback function.

func (*ApplicationCommandLineClass) OverrideGetStdin

func (x *ApplicationCommandLineClass) OverrideGetStdin(cb func(*ApplicationCommandLine) *InputStream)

OverrideGetStdin sets the "get_stdin" callback function.

func (*ApplicationCommandLineClass) OverridePrintLiteral

func (x *ApplicationCommandLineClass) OverridePrintLiteral(cb func(*ApplicationCommandLine, string))

OverridePrintLiteral sets the "print_literal" callback function.

func (*ApplicationCommandLineClass) OverridePrinterrLiteral

func (x *ApplicationCommandLineClass) OverridePrinterrLiteral(cb func(*ApplicationCommandLine, string))

OverridePrinterrLiteral sets the "printerr_literal" callback function.

type ApplicationCommandLinePrivate

type ApplicationCommandLinePrivate struct {
	// contains filtered or unexported fields
}

func (*ApplicationCommandLinePrivate) GoPointer

func (x *ApplicationCommandLinePrivate) GoPointer() uintptr

type ApplicationFlags

type ApplicationFlags int

Flags used to define the behaviour of a #GApplication.

const (

	// Default flags.
	GApplicationFlagsNoneValue ApplicationFlags = 0
	// Default flags.
	GApplicationDefaultFlagsValue ApplicationFlags = 0
	// 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.
	GApplicationIsServiceValue ApplicationFlags = 1
	// Don't try to become the primary instance.
	GApplicationIsLauncherValue ApplicationFlags = 2
	// 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.
	GApplicationHandlesOpenValue ApplicationFlags = 4
	// 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.
	GApplicationHandlesCommandLineValue ApplicationFlags = 8
	// 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().
	GApplicationSendEnvironmentValue ApplicationFlags = 16
	// 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.
	GApplicationNonUniqueValue ApplicationFlags = 32
	// Allow users to override the
	//     application ID from the command line with `--gapplication-app-id`.
	//     Since: 2.48
	GApplicationCanOverrideAppIdValue ApplicationFlags = 64
	// Allow another instance to take over
	//     the bus name. Since: 2.60
	GApplicationAllowReplacementValue ApplicationFlags = 128
	// Take over from another instance. This flag is
	//     usually set by passing `--gapplication-replace` on the commandline.
	//     Since: 2.60
	GApplicationReplaceValue ApplicationFlags = 256
)

type ApplicationPrivate

type ApplicationPrivate struct {
	// contains filtered or unexported fields
}

func (*ApplicationPrivate) GoPointer

func (x *ApplicationPrivate) GoPointer() uintptr

type AskPasswordFlags

type AskPasswordFlags int

#GAskPasswordFlags are used to request specific information from the user, or to notify the user of their choices in an authentication situation.

const (

	// operation requires a password.
	GAskPasswordNeedPasswordValue AskPasswordFlags = 1
	// operation requires a username.
	GAskPasswordNeedUsernameValue AskPasswordFlags = 2
	// operation requires a domain.
	GAskPasswordNeedDomainValue AskPasswordFlags = 4
	// operation supports saving settings.
	GAskPasswordSavingSupportedValue AskPasswordFlags = 8
	// operation supports anonymous users.
	GAskPasswordAnonymousSupportedValue AskPasswordFlags = 16
	// operation takes TCRYPT parameters (Since: 2.58)
	GAskPasswordTcryptValue AskPasswordFlags = 32
)

type AsyncInitable

type AsyncInitable interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	InitAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	InitFinish(ResVar AsyncResult) (bool, error)
	NewFinish(ResVar AsyncResult) (*gobject.Object, error)
}

`GAsyncInitable` is an interface for asynchronously initializable objects.

This is the asynchronous version of [iface@Gio.Initable]; 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 [func@Gio.AsyncInitable.new_async] directly, or indirectly via a foo_thing_new_async() wrapper. This will call [method@Gio.AsyncInitable.init_async] under the covers, 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;
}

```

type AsyncInitableBase

type AsyncInitableBase struct {
	Ptr uintptr
}

func (*AsyncInitableBase) GoPointer

func (x *AsyncInitableBase) GoPointer() uintptr

func (*AsyncInitableBase) InitAsync

func (x *AsyncInitableBase) InitAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*AsyncInitableBase) InitFinish

func (x *AsyncInitableBase) InitFinish(ResVar AsyncResult) (bool, error)

Finishes asynchronous initialization and returns the result. See g_async_initable_init_async().

func (*AsyncInitableBase) NewFinish

func (x *AsyncInitableBase) NewFinish(ResVar AsyncResult) (*gobject.Object, error)

Finishes the async construction for the various g_async_initable_new calls, returning the created object or %NULL on error.

func (*AsyncInitableBase) SetGoPointer

func (x *AsyncInitableBase) SetGoPointer(ptr uintptr)

type AsyncInitableIface

type AsyncInitableIface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

Provides an interface for asynchronous initializing object such that initialization may fail.

func (*AsyncInitableIface) GetInitAsync

GetInitAsync gets the "init_async" callback function. Starts initialization of the object.

func (*AsyncInitableIface) GetInitFinish

func (x *AsyncInitableIface) GetInitFinish() func(AsyncInitable, AsyncResult) bool

GetInitFinish gets the "init_finish" callback function. Finishes initialization of the object.

func (*AsyncInitableIface) GoPointer

func (x *AsyncInitableIface) GoPointer() uintptr

func (*AsyncInitableIface) OverrideInitAsync

func (x *AsyncInitableIface) OverrideInitAsync(cb func(AsyncInitable, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideInitAsync sets the "init_async" callback function. Starts initialization of the object.

func (*AsyncInitableIface) OverrideInitFinish

func (x *AsyncInitableIface) OverrideInitFinish(cb func(AsyncInitable, AsyncResult) bool)

OverrideInitFinish sets the "init_finish" callback function. Finishes initialization of the object.

type AsyncReadyCallback

type AsyncReadyCallback func(uintptr, uintptr, uintptr)

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 (see [method@GLib.MainContext.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.

type AsyncResult

type AsyncResult interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	GetSourceObject() *gobject.Object
	GetUserData() uintptr
	IsTagged(SourceTagVar uintptr) bool
	LegacyPropagateError() (bool, error)
}

`GAsyncResult` 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 (see [method@GLib.MainContext.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 [class@Gio.FileEnumerator] 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

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.

type AsyncResultBase

type AsyncResultBase struct {
	Ptr uintptr
}

func (*AsyncResultBase) GetSourceObject

func (x *AsyncResultBase) GetSourceObject() *gobject.Object

Gets the source object from a [iface@Gio.AsyncResult].

func (*AsyncResultBase) GetUserData

func (x *AsyncResultBase) GetUserData() uintptr

Gets the user data from a [iface@Gio.AsyncResult].

func (*AsyncResultBase) GoPointer

func (x *AsyncResultBase) GoPointer() uintptr

func (*AsyncResultBase) IsTagged

func (x *AsyncResultBase) IsTagged(SourceTagVar uintptr) bool

Checks if @res has the given @source_tag (generally a function pointer indicating the function @res was created by).

func (*AsyncResultBase) LegacyPropagateError

func (x *AsyncResultBase) LegacyPropagateError() (bool, error)

If @res is a [class@Gio.SimpleAsyncResult], this is equivalent to [method@Gio.SimpleAsyncResult.propagate_error]. Otherwise it returns `FALSE`.

This can be used for legacy error handling in async `*_finish()` wrapper functions that traditionally handled [class@Gio.SimpleAsyncResult] error returns themselves rather than calling into the virtual method. This should not be used in new code; [iface@Gio.AsyncResult] errors that are set by virtual methods should also be extracted by virtual methods, to enable subclasses to chain up correctly.

func (*AsyncResultBase) SetGoPointer

func (x *AsyncResultBase) SetGoPointer(ptr uintptr)

type AsyncResultIface

type AsyncResultIface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

Interface definition for [iface@Gio.AsyncResult].

func (*AsyncResultIface) GetGetSourceObject

func (x *AsyncResultIface) GetGetSourceObject() func(AsyncResult) *gobject.Object

GetGetSourceObject gets the "get_source_object" callback function. Gets the source object that issued the asynchronous operation.

func (*AsyncResultIface) GetGetUserData

func (x *AsyncResultIface) GetGetUserData() func(AsyncResult) uintptr

GetGetUserData gets the "get_user_data" callback function. Gets the user data passed to the callback.

func (*AsyncResultIface) GetIsTagged

func (x *AsyncResultIface) GetIsTagged() func(AsyncResult, uintptr) bool

GetIsTagged gets the "is_tagged" callback function. Checks if a result is tagged with a particular source.

func (*AsyncResultIface) GoPointer

func (x *AsyncResultIface) GoPointer() uintptr

func (*AsyncResultIface) OverrideGetSourceObject

func (x *AsyncResultIface) OverrideGetSourceObject(cb func(AsyncResult) *gobject.Object)

OverrideGetSourceObject sets the "get_source_object" callback function. Gets the source object that issued the asynchronous operation.

func (*AsyncResultIface) OverrideGetUserData

func (x *AsyncResultIface) OverrideGetUserData(cb func(AsyncResult) uintptr)

OverrideGetUserData sets the "get_user_data" callback function. Gets the user data passed to the callback.

func (*AsyncResultIface) OverrideIsTagged

func (x *AsyncResultIface) OverrideIsTagged(cb func(AsyncResult, uintptr) bool)

OverrideIsTagged sets the "is_tagged" callback function. Checks if a result is tagged with a particular source.

type BufferedInputStream

type BufferedInputStream struct {
	FilterInputStream
}

Buffered input stream implements [class@Gio.FilterInputStream] and provides for buffered reads.

By default, `GBufferedInputStream`'s buffer size is set at 4 kilobytes.

To create a buffered input stream, use [ctor@Gio.BufferedInputStream.new], or [ctor@Gio.BufferedInputStream.new_sized] to specify the buffer's size at construction.

To get the size of a buffer within a buffered input stream, use [method@Gio.BufferedInputStream.get_buffer_size]. To change the size of a buffered input stream's buffer, use [method@Gio.BufferedInputStream.set_buffer_size]. Note that the buffer's size cannot be reduced below the size of the data within the buffer.

func BufferedInputStreamNewFromInternalPtr

func BufferedInputStreamNewFromInternalPtr(ptr uintptr) *BufferedInputStream

func NewBufferedInputStream

func NewBufferedInputStream(BaseStreamVar *InputStream) *BufferedInputStream

Creates a new [class@Gio.InputStream] from the given @base_stream, with a buffer set to the default size (4 kilobytes).

func NewBufferedInputStreamSized

func NewBufferedInputStreamSized(BaseStreamVar *InputStream, SizeVar uint) *BufferedInputStream

Creates a new [class@Gio.BufferedInputStream] from the given @base_stream, with a buffer set to @size.

func (*BufferedInputStream) CanSeek

func (x *BufferedInputStream) CanSeek() bool

Tests if the stream supports the #GSeekableIface.

func (*BufferedInputStream) CanTruncate

func (x *BufferedInputStream) CanTruncate() bool

Tests if the length of the stream can be adjusted with g_seekable_truncate().

func (*BufferedInputStream) Fill

func (x *BufferedInputStream) Fill(CountVar int, CancellableVar *Cancellable) (int, error)

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 [error@Gio.IOErrorEnum.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 [error@Gio.IOErrorEnum.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 [method@Gio.BufferedInputStream.fill_async].

func (*BufferedInputStream) FillAsync

func (x *BufferedInputStream) FillAsync(CountVar int, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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 [method@Gio.BufferedInputStream.fill].

If @count is `-1` then the attempted read size is equal to the number of bytes that are required to fill the buffer.

func (*BufferedInputStream) FillFinish

func (x *BufferedInputStream) FillFinish(ResultVar AsyncResult) (int, error)

Finishes an asynchronous read.

func (*BufferedInputStream) GetAvailable

func (x *BufferedInputStream) GetAvailable() uint

Gets the size of the available data within the stream.

func (*BufferedInputStream) GetBufferSize

func (x *BufferedInputStream) GetBufferSize() uint

Gets the size of the input buffer.

func (*BufferedInputStream) GetPropertyBufferSize

func (x *BufferedInputStream) GetPropertyBufferSize() uint

GetPropertyBufferSize gets the "buffer-size" property. The size of the backend buffer, in bytes.

func (*BufferedInputStream) GoPointer

func (c *BufferedInputStream) GoPointer() uintptr

func (*BufferedInputStream) Peek

func (x *BufferedInputStream) Peek(BufferVar []byte, OffsetVar uint, CountVar uint) uint

Peeks in the buffered input, copying @count bytes of data from @offset bytes in the buffered input into @buffer.

func (*BufferedInputStream) PeekBuffer

func (x *BufferedInputStream) PeekBuffer(CountVar *uint) uintptr

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.

func (*BufferedInputStream) ReadByte

func (x *BufferedInputStream) ReadByte(CancellableVar *Cancellable) (int, error)

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 [error@Gio.IOErrorEnum.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.

func (*BufferedInputStream) Seek

func (x *BufferedInputStream) Seek(OffsetVar int64, TypeVar glib.SeekType, CancellableVar *Cancellable) (bool, error)

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.

func (*BufferedInputStream) SetBufferSize

func (x *BufferedInputStream) SetBufferSize(SizeVar uint)

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.

func (*BufferedInputStream) SetGoPointer

func (c *BufferedInputStream) SetGoPointer(ptr uintptr)

func (*BufferedInputStream) SetPropertyBufferSize

func (x *BufferedInputStream) SetPropertyBufferSize(value uint)

SetPropertyBufferSize sets the "buffer-size" property. The size of the backend buffer, in bytes.

func (*BufferedInputStream) Tell

func (x *BufferedInputStream) Tell() int64

Tells the current position within the stream.

func (*BufferedInputStream) Truncate

func (x *BufferedInputStream) Truncate(OffsetVar int64, CancellableVar *Cancellable) (bool, error)

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.

type BufferedInputStreamClass

type BufferedInputStreamClass struct {
	ParentClass FilterInputStreamClass
	// contains filtered or unexported fields
}

func (*BufferedInputStreamClass) GetFill

GetFill gets the "fill" callback function.

func (*BufferedInputStreamClass) GetFillAsync

GetFillAsync gets the "fill_async" callback function.

func (*BufferedInputStreamClass) GetFillFinish

func (x *BufferedInputStreamClass) GetFillFinish() func(*BufferedInputStream, AsyncResult) int

GetFillFinish gets the "fill_finish" callback function.

func (*BufferedInputStreamClass) GetGReserved1

func (x *BufferedInputStreamClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*BufferedInputStreamClass) GetGReserved2

func (x *BufferedInputStreamClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*BufferedInputStreamClass) GetGReserved3

func (x *BufferedInputStreamClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*BufferedInputStreamClass) GetGReserved4

func (x *BufferedInputStreamClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*BufferedInputStreamClass) GetGReserved5

func (x *BufferedInputStreamClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*BufferedInputStreamClass) GoPointer

func (x *BufferedInputStreamClass) GoPointer() uintptr

func (*BufferedInputStreamClass) OverrideFill

func (x *BufferedInputStreamClass) OverrideFill(cb func(*BufferedInputStream, int, *Cancellable) int)

OverrideFill sets the "fill" callback function.

func (*BufferedInputStreamClass) OverrideFillAsync

OverrideFillAsync sets the "fill_async" callback function.

func (*BufferedInputStreamClass) OverrideFillFinish

func (x *BufferedInputStreamClass) OverrideFillFinish(cb func(*BufferedInputStream, AsyncResult) int)

OverrideFillFinish sets the "fill_finish" callback function.

func (*BufferedInputStreamClass) OverrideGReserved1

func (x *BufferedInputStreamClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*BufferedInputStreamClass) OverrideGReserved2

func (x *BufferedInputStreamClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*BufferedInputStreamClass) OverrideGReserved3

func (x *BufferedInputStreamClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*BufferedInputStreamClass) OverrideGReserved4

func (x *BufferedInputStreamClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*BufferedInputStreamClass) OverrideGReserved5

func (x *BufferedInputStreamClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

type BufferedInputStreamPrivate

type BufferedInputStreamPrivate struct {
	// contains filtered or unexported fields
}

func (*BufferedInputStreamPrivate) GoPointer

func (x *BufferedInputStreamPrivate) GoPointer() uintptr

type BufferedOutputStream

type BufferedOutputStream struct {
	FilterOutputStream
}

Buffered output stream implements [class@Gio.FilterOutputStream] and provides for buffered writes.

By default, `GBufferedOutputStream`'s buffer size is set at 4 kilobytes.

To create a buffered output stream, use [ctor@Gio.BufferedOutputStream.new], or [ctor@Gio.BufferedOutputStream.new_sized] to specify the buffer's size at construction.

To get the size of a buffer within a buffered input stream, use [method@Gio.BufferedOutputStream.get_buffer_size]. To change the size of a buffered output stream's buffer, use [method@Gio.BufferedOutputStream.set_buffer_size]. Note that the buffer's size cannot be reduced below the size of the data within the buffer.

func BufferedOutputStreamNewFromInternalPtr

func BufferedOutputStreamNewFromInternalPtr(ptr uintptr) *BufferedOutputStream

func NewBufferedOutputStream

func NewBufferedOutputStream(BaseStreamVar *OutputStream) *BufferedOutputStream

Creates a new buffered output stream for a base stream.

func NewBufferedOutputStreamSized

func NewBufferedOutputStreamSized(BaseStreamVar *OutputStream, SizeVar uint) *BufferedOutputStream

Creates a new buffered output stream with a given buffer size.

func (*BufferedOutputStream) CanSeek

func (x *BufferedOutputStream) CanSeek() bool

Tests if the stream supports the #GSeekableIface.

func (*BufferedOutputStream) CanTruncate

func (x *BufferedOutputStream) CanTruncate() bool

Tests if the length of the stream can be adjusted with g_seekable_truncate().

func (*BufferedOutputStream) GetAutoGrow

func (x *BufferedOutputStream) GetAutoGrow() bool

Checks if the buffer automatically grows as data is added.

func (*BufferedOutputStream) GetBufferSize

func (x *BufferedOutputStream) GetBufferSize() uint

Gets the size of the buffer in the @stream.

func (*BufferedOutputStream) GetPropertyAutoGrow

func (x *BufferedOutputStream) GetPropertyAutoGrow() bool

GetPropertyAutoGrow gets the "auto-grow" property. Whether the buffer should automatically grow.

func (*BufferedOutputStream) GetPropertyBufferSize

func (x *BufferedOutputStream) GetPropertyBufferSize() uint

GetPropertyBufferSize gets the "buffer-size" property. The size of the backend buffer, in bytes.

func (*BufferedOutputStream) GoPointer

func (c *BufferedOutputStream) GoPointer() uintptr

func (*BufferedOutputStream) Seek

func (x *BufferedOutputStream) Seek(OffsetVar int64, TypeVar glib.SeekType, CancellableVar *Cancellable) (bool, error)

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.

func (*BufferedOutputStream) SetAutoGrow

func (x *BufferedOutputStream) SetAutoGrow(AutoGrowVar bool)

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.

func (*BufferedOutputStream) SetBufferSize

func (x *BufferedOutputStream) SetBufferSize(SizeVar uint)

Sets the size of the internal buffer to @size.

func (*BufferedOutputStream) SetGoPointer

func (c *BufferedOutputStream) SetGoPointer(ptr uintptr)

func (*BufferedOutputStream) SetPropertyAutoGrow

func (x *BufferedOutputStream) SetPropertyAutoGrow(value bool)

SetPropertyAutoGrow sets the "auto-grow" property. Whether the buffer should automatically grow.

func (*BufferedOutputStream) SetPropertyBufferSize

func (x *BufferedOutputStream) SetPropertyBufferSize(value uint)

SetPropertyBufferSize sets the "buffer-size" property. The size of the backend buffer, in bytes.

func (*BufferedOutputStream) Tell

func (x *BufferedOutputStream) Tell() int64

Tells the current position within the stream.

func (*BufferedOutputStream) Truncate

func (x *BufferedOutputStream) Truncate(OffsetVar int64, CancellableVar *Cancellable) (bool, error)

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.

type BufferedOutputStreamClass

type BufferedOutputStreamClass struct {
	ParentClass FilterOutputStreamClass
	// contains filtered or unexported fields
}

func (*BufferedOutputStreamClass) GetGReserved1

func (x *BufferedOutputStreamClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*BufferedOutputStreamClass) GetGReserved2

func (x *BufferedOutputStreamClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*BufferedOutputStreamClass) GoPointer

func (x *BufferedOutputStreamClass) GoPointer() uintptr

func (*BufferedOutputStreamClass) OverrideGReserved1

func (x *BufferedOutputStreamClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*BufferedOutputStreamClass) OverrideGReserved2

func (x *BufferedOutputStreamClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

type BufferedOutputStreamPrivate

type BufferedOutputStreamPrivate struct {
	// contains filtered or unexported fields
}

func (*BufferedOutputStreamPrivate) GoPointer

func (x *BufferedOutputStreamPrivate) GoPointer() uintptr

type BusAcquiredCallback

type BusAcquiredCallback func(uintptr, string, uintptr)

Invoked when a connection to a message bus has been obtained.

type BusNameAcquiredCallback

type BusNameAcquiredCallback func(uintptr, string, uintptr)

Invoked when the name is acquired.

type BusNameAppearedCallback

type BusNameAppearedCallback func(uintptr, string, string, uintptr)

Invoked when the name being watched is known to have to have an owner.

type BusNameLostCallback

type BusNameLostCallback func(uintptr, string, uintptr)

Invoked when the name is lost or @connection has been closed.

type BusNameOwnerFlags

type BusNameOwnerFlags int

Flags used in g_bus_own_name().

const (

	// No flags set.
	GBusNameOwnerFlagsNoneValue BusNameOwnerFlags = 0
	// Allow another message bus connection to claim the name.
	GBusNameOwnerFlagsAllowReplacementValue BusNameOwnerFlags = 1
	// 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.
	GBusNameOwnerFlagsReplaceValue BusNameOwnerFlags = 2
	// If another message bus connection owns the name, immediately return an error
	// from [func@Gio.bus_own_name] rather than entering the waiting queue for that
	// name.
	GBusNameOwnerFlagsDoNotQueueValue BusNameOwnerFlags = 4
)

type BusNameVanishedCallback

type BusNameVanishedCallback func(uintptr, string, uintptr)

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.

type BusNameWatcherFlags

type BusNameWatcherFlags int

Flags used in g_bus_watch_name().

const (

	// No flags set.
	GBusNameWatcherFlagsNoneValue BusNameWatcherFlags = 0
	// If no-one owns the name when
	// beginning to watch the name, ask the bus to launch an owner for the
	// name.
	GBusNameWatcherFlagsAutoStartValue BusNameWatcherFlags = 1
)

type BusType

type BusType int

An enumeration for well-known message buses.

const (

	// An alias for the message bus that activated the process, if any.
	GBusTypeStarterValue BusType = -1
	// Not a message bus.
	GBusTypeNoneValue BusType = 0
	// The system-wide message bus.
	GBusTypeSystemValue BusType = 1
	// The login session message bus.
	GBusTypeSessionValue BusType = 2
)

type BytesIcon

type BytesIcon struct {
	gobject.Object
}

`GBytesIcon` specifies an image held in memory in a common format (usually PNG) to be used as icon.

func BytesIconNewFromInternalPtr

func BytesIconNewFromInternalPtr(ptr uintptr) *BytesIcon

func NewBytesIcon

func NewBytesIcon(BytesVar *glib.Bytes) *BytesIcon

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.

func (*BytesIcon) Equal

func (x *BytesIcon) Equal(Icon2Var Icon) bool

Checks if two icons are equal.

func (*BytesIcon) GetBytes

func (x *BytesIcon) GetBytes() *glib.Bytes

Gets the #GBytes associated with the given @icon.

func (*BytesIcon) GetPropertyBytes

func (x *BytesIcon) GetPropertyBytes() uintptr

GetPropertyBytes gets the "bytes" property. The bytes containing the icon.

func (*BytesIcon) GoPointer

func (c *BytesIcon) GoPointer() uintptr

func (*BytesIcon) Hash

func (x *BytesIcon) Hash() uint

Gets a hash for an icon.

func (*BytesIcon) Load

func (x *BytesIcon) Load(SizeVar int, TypeVar *string, CancellableVar *Cancellable) (*InputStream, error)

Loads a loadable icon. For the asynchronous version of this function, see g_loadable_icon_load_async().

func (*BytesIcon) LoadAsync

func (x *BytesIcon) LoadAsync(SizeVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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().

func (*BytesIcon) LoadFinish

func (x *BytesIcon) LoadFinish(ResVar AsyncResult, TypeVar *string) (*InputStream, error)

Finishes an asynchronous icon load started in g_loadable_icon_load_async().

func (*BytesIcon) Serialize

func (x *BytesIcon) Serialize() *glib.Variant

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.

func (*BytesIcon) SetGoPointer

func (c *BytesIcon) SetGoPointer(ptr uintptr)

func (*BytesIcon) SetPropertyBytes

func (x *BytesIcon) SetPropertyBytes(value uintptr)

SetPropertyBytes sets the "bytes" property. The bytes containing the icon.

func (*BytesIcon) ToString

func (x *BytesIcon) ToString() string

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`).

type Cancellable

type Cancellable struct {
	gobject.Object
}

`GCancellable` allows operations to be cancelled.

`GCancellable` is a thread-safe operation cancellation stack used throughout GIO to allow for cancellation of synchronous and asynchronous operations.

func CancellableGetCurrent

func CancellableGetCurrent() *Cancellable

Gets the top cancellable from the stack.

func CancellableNewFromInternalPtr

func CancellableNewFromInternalPtr(ptr uintptr) *Cancellable

func NewCancellable

func NewCancellable() *Cancellable

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.

func (*Cancellable) Cancel

func (x *Cancellable) Cancel()

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.

It is safe (although useless, since it will be a no-op) to call this function from a [signal@Gio.Cancellable::cancelled] signal handler.

func (*Cancellable) Connect

func (x *Cancellable) Connect(CallbackVar *gobject.Callback, DataVar uintptr, DataDestroyFuncVar *glib.DestroyNotify) uint

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 exactly once each time @cancellable is cancelled, either directly at the time of the connect if @cancellable is already cancelled, or when @cancellable is cancelled in some thread. In case the cancellable is reset via [method@Gio.Cancellable.reset] then the callback can be called again if the @cancellable is cancelled and if it had not been previously cancelled at the time [method@Gio.Cancellable.connect] was called (e.g. if the connection actually took place, returning a non-zero value).

@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. [method@Gio.Cancellable.cancel]. Note that since 2.82 GLib still holds a lock during the callback but it’s designed in a way that most of the [class@Gio.Cancellable] methods can be called, including [method@Gio.Cancellable.cancel] or [method@GObject.Object.unref].

There are still some methods that will deadlock (by design) when called from the [signal@Gio.Cancellable::cancelled] callbacks:

  • [method@Gio.Cancellable.connect]
  • [method@Gio.Cancellable.disconnect]
  • [method@Gio.Cancellable.reset]
  • [method@Gio.Cancellable.make_pollfd]
  • [method@Gio.Cancellable.release_fd]

func (*Cancellable) ConnectCancelled

func (x *Cancellable) ConnectCancelled(cb *func(Cancellable)) uint

Emitted when the operation has been cancelled.

Can be used by implementations of cancellable operations. If the operation is cancelled from another thread, the signal will be emitted in the thread that cancelled the operation, not the thread that is running the operation.

Note that disconnecting from this signal (or any signal) in a multi-threaded program is prone to race conditions. For instance it is possible that a signal handler may be invoked even after a call to g_signal_handler_disconnect() for that handler has already returned.

There is also a problem when cancellation happens right before connecting to the signal. If this happens the signal will unexpectedly not be emitted, and checking before connecting to the signal leaves a race condition where this is still happening.

In order to make it safe and easy to connect handlers there are two helper functions: g_cancellable_connect() and g_cancellable_disconnect() which protect against problems like this.

An example of how to us this: |[<!-- language="C" -->

// Make sure we don't do unnecessary work if already cancelled
if (g_cancellable_set_error_if_cancelled (cancellable, error))
  return;

// Set up all the data needed to be able to handle cancellation
// of the operation
my_data = my_data_new (...);

id = 0;
if (cancellable)
  id = g_cancellable_connect (cancellable,
			      G_CALLBACK (cancelled_handler)
			      data, NULL);

// cancellable operation here...

g_cancellable_disconnect (cancellable, id);

// cancelled_handler is never called after this, it is now safe
// to free the data
my_data_free (my_data);

]|

Note that the cancelled signal is emitted in the thread that the user cancelled from, which may be the main thread. So, the cancellable signal should not do something that can block.

func (*Cancellable) Disconnect

func (x *Cancellable) Disconnect(HandlerIdVar uint)

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.

func (*Cancellable) GetFd

func (x *Cancellable) GetFd() int

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().

func (*Cancellable) GoPointer

func (c *Cancellable) GoPointer() uintptr

func (*Cancellable) IsCancelled

func (x *Cancellable) IsCancelled() bool

Checks if a cancellable job has been cancelled.

func (*Cancellable) MakePollfd

func (x *Cancellable) MakePollfd(PollfdVar *glib.PollFD) bool

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().

Note that in the event that a [signal@Gio.Cancellable::cancelled] signal handler is currently running, this call will block until the handler has finished. Calling this function from a signal handler will therefore result in a deadlock.

func (*Cancellable) PopCurrent

func (x *Cancellable) PopCurrent()

Pops @cancellable off the cancellable stack (verifying that @cancellable is on the top of the stack).

func (*Cancellable) PushCurrent

func (x *Cancellable) PushCurrent()

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.

func (*Cancellable) ReleaseFd

func (x *Cancellable) ReleaseFd()

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.

Note that in the event that a [signal@Gio.Cancellable::cancelled] signal handler is currently running, this call will block until the handler has finished. Calling this function from a signal handler will therefore result in a deadlock.

func (*Cancellable) Reset

func (x *Cancellable) Reset()

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.

In the event that a [signal@Gio.Cancellable::cancelled] signal handler is currently running, this call will block until the handler has finished. Calling this function from a signal handler will therefore result in a deadlock.

func (*Cancellable) SetErrorIfCancelled

func (x *Cancellable) SetErrorIfCancelled() (bool, error)

If the @cancellable is cancelled, sets the error to notify that the operation was cancelled.

func (*Cancellable) SetGoPointer

func (c *Cancellable) SetGoPointer(ptr uintptr)

func (*Cancellable) SourceNew

func (x *Cancellable) SourceNew() *glib.Source

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.

type CancellableClass

type CancellableClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*CancellableClass) GetCancelled

func (x *CancellableClass) GetCancelled() func(*Cancellable)

GetCancelled gets the "cancelled" callback function.

func (*CancellableClass) GetGReserved1

func (x *CancellableClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*CancellableClass) GetGReserved2

func (x *CancellableClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*CancellableClass) GetGReserved3

func (x *CancellableClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*CancellableClass) GetGReserved4

func (x *CancellableClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*CancellableClass) GetGReserved5

func (x *CancellableClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*CancellableClass) GoPointer

func (x *CancellableClass) GoPointer() uintptr

func (*CancellableClass) OverrideCancelled

func (x *CancellableClass) OverrideCancelled(cb func(*Cancellable))

OverrideCancelled sets the "cancelled" callback function.

func (*CancellableClass) OverrideGReserved1

func (x *CancellableClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*CancellableClass) OverrideGReserved2

func (x *CancellableClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*CancellableClass) OverrideGReserved3

func (x *CancellableClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*CancellableClass) OverrideGReserved4

func (x *CancellableClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*CancellableClass) OverrideGReserved5

func (x *CancellableClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

type CancellablePrivate

type CancellablePrivate struct {
	// contains filtered or unexported fields
}

func (*CancellablePrivate) GoPointer

func (x *CancellablePrivate) GoPointer() uintptr

type CancellableSourceFunc

type CancellableSourceFunc func(uintptr, uintptr) bool

This is the function type of the callback used for the #GSource returned by g_cancellable_source_new().

type CharsetConverter

type CharsetConverter struct {
	gobject.Object
}

`GCharsetConverter` is an implementation of [iface@Gio.Converter] based on [struct@GLib.IConv].

func CharsetConverterNewFromInternalPtr

func CharsetConverterNewFromInternalPtr(ptr uintptr) *CharsetConverter

func NewCharsetConverter

func NewCharsetConverter(ToCharsetVar string, FromCharsetVar string) (*CharsetConverter, error)

Creates a new #GCharsetConverter.

func (*CharsetConverter) Convert

func (x *CharsetConverter) Convert(InbufVar []byte, InbufSizeVar uint, OutbufVar []byte, OutbufSizeVar uint, FlagsVar ConverterFlags, BytesReadVar *uint, BytesWrittenVar *uint) (ConverterResult, error)

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).

func (*CharsetConverter) ConvertBytes

func (x *CharsetConverter) ConvertBytes(BytesVar *glib.Bytes) (*glib.Bytes, error)

Applies @converter to the data in @bytes.

func (*CharsetConverter) GetNumFallbacks

func (x *CharsetConverter) GetNumFallbacks() uint

Gets the number of fallbacks that @converter has applied so far.

func (*CharsetConverter) GetPropertyFromCharset

func (x *CharsetConverter) GetPropertyFromCharset() string

GetPropertyFromCharset gets the "from-charset" property. The character encoding to convert from.

func (*CharsetConverter) GetPropertyToCharset

func (x *CharsetConverter) GetPropertyToCharset() string

GetPropertyToCharset gets the "to-charset" property. The character encoding to convert to.

func (*CharsetConverter) GetPropertyUseFallback

func (x *CharsetConverter) GetPropertyUseFallback() bool

GetPropertyUseFallback gets the "use-fallback" property. Use fallback (of form `\<hexval>`) for invalid bytes.

func (*CharsetConverter) GetUseFallback

func (x *CharsetConverter) GetUseFallback() bool

Gets the #GCharsetConverter:use-fallback property.

func (*CharsetConverter) GoPointer

func (c *CharsetConverter) GoPointer() uintptr

func (*CharsetConverter) Init

func (x *CharsetConverter) Init(CancellableVar *Cancellable) (bool, error)

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 [description][iface@Gio.Initable#description] 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.

func (*CharsetConverter) Reset

func (x *CharsetConverter) Reset()

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.

func (*CharsetConverter) SetGoPointer

func (c *CharsetConverter) SetGoPointer(ptr uintptr)

func (*CharsetConverter) SetPropertyFromCharset

func (x *CharsetConverter) SetPropertyFromCharset(value string)

SetPropertyFromCharset sets the "from-charset" property. The character encoding to convert from.

func (*CharsetConverter) SetPropertyToCharset

func (x *CharsetConverter) SetPropertyToCharset(value string)

SetPropertyToCharset sets the "to-charset" property. The character encoding to convert to.

func (*CharsetConverter) SetPropertyUseFallback

func (x *CharsetConverter) SetPropertyUseFallback(value bool)

SetPropertyUseFallback sets the "use-fallback" property. Use fallback (of form `\<hexval>`) for invalid bytes.

func (*CharsetConverter) SetUseFallback

func (x *CharsetConverter) SetUseFallback(UseFallbackVar bool)

Sets the #GCharsetConverter:use-fallback property.

type CharsetConverterClass

type CharsetConverterClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*CharsetConverterClass) GoPointer

func (x *CharsetConverterClass) GoPointer() uintptr

type Converter

type Converter interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	Convert(InbufVar []byte, InbufSizeVar uint, OutbufVar []byte, OutbufSizeVar uint, FlagsVar ConverterFlags, BytesReadVar *uint, BytesWrittenVar *uint) (ConverterResult, error)
	ConvertBytes(BytesVar *glib.Bytes) (*glib.Bytes, error)
	Reset()
}

`GConverter` is an interface for streaming conversions.

`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.

type ConverterBase

type ConverterBase struct {
	Ptr uintptr
}

func (*ConverterBase) Convert

func (x *ConverterBase) Convert(InbufVar []byte, InbufSizeVar uint, OutbufVar []byte, OutbufSizeVar uint, FlagsVar ConverterFlags, BytesReadVar *uint, BytesWrittenVar *uint) (ConverterResult, error)

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).

func (*ConverterBase) ConvertBytes

func (x *ConverterBase) ConvertBytes(BytesVar *glib.Bytes) (*glib.Bytes, error)

Applies @converter to the data in @bytes.

func (*ConverterBase) GoPointer

func (x *ConverterBase) GoPointer() uintptr

func (*ConverterBase) Reset

func (x *ConverterBase) Reset()

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.

func (*ConverterBase) SetGoPointer

func (x *ConverterBase) SetGoPointer(ptr uintptr)

type ConverterFlags

type ConverterFlags int

Flags used when calling a g_converter_convert().

const (

	// No flags.
	GConverterNoFlagsValue ConverterFlags = 0
	// At end of input data
	GConverterInputAtEndValue ConverterFlags = 1
	// Flush data
	GConverterFlushValue ConverterFlags = 2
)

type ConverterIface

type ConverterIface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

Provides an interface for converting data from one type to another type. The conversion can be stateful and may fail at any place.

func (*ConverterIface) GetConvert

func (x *ConverterIface) GetConvert() func(Converter, []byte, uint, []byte, uint, ConverterFlags, *uint, *uint) ConverterResult

GetConvert gets the "convert" callback function. Converts data.

func (*ConverterIface) GetReset

func (x *ConverterIface) GetReset() func(Converter)

GetReset gets the "reset" callback function. Reverts the internal state of the converter to its initial state.

func (*ConverterIface) GoPointer

func (x *ConverterIface) GoPointer() uintptr

func (*ConverterIface) OverrideConvert

func (x *ConverterIface) OverrideConvert(cb func(Converter, []byte, uint, []byte, uint, ConverterFlags, *uint, *uint) ConverterResult)

OverrideConvert sets the "convert" callback function. Converts data.

func (*ConverterIface) OverrideReset

func (x *ConverterIface) OverrideReset(cb func(Converter))

OverrideReset sets the "reset" callback function. Reverts the internal state of the converter to its initial state.

type ConverterInputStream

type ConverterInputStream struct {
	FilterInputStream
}

Converter input stream implements [class@Gio.InputStream] and allows conversion of data of various types during reading.

As of GLib 2.34, `GConverterInputStream` implements [iface@Gio.PollableInputStream].

func ConverterInputStreamNewFromInternalPtr

func ConverterInputStreamNewFromInternalPtr(ptr uintptr) *ConverterInputStream

func NewConverterInputStream

func NewConverterInputStream(BaseStreamVar *InputStream, ConverterVar Converter) *ConverterInputStream

Creates a new converter input stream for the @base_stream.

func (*ConverterInputStream) CanPoll

func (x *ConverterInputStream) CanPoll() bool

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.

func (*ConverterInputStream) CreateSource

func (x *ConverterInputStream) CreateSource(CancellableVar *Cancellable) *glib.Source

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.

func (*ConverterInputStream) GetConverter

func (x *ConverterInputStream) GetConverter() *ConverterBase

Gets the #GConverter that is used by @converter_stream.

func (*ConverterInputStream) GoPointer

func (c *ConverterInputStream) GoPointer() uintptr

func (*ConverterInputStream) IsReadable

func (x *ConverterInputStream) IsReadable() bool

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.

func (*ConverterInputStream) ReadNonblocking

func (x *ConverterInputStream) ReadNonblocking(BufferVar *[]byte, CountVar uint, CancellableVar *Cancellable) (int, error)

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.

func (*ConverterInputStream) SetGoPointer

func (c *ConverterInputStream) SetGoPointer(ptr uintptr)

type ConverterInputStreamClass

type ConverterInputStreamClass struct {
	ParentClass FilterInputStreamClass
	// contains filtered or unexported fields
}

func (*ConverterInputStreamClass) GetGReserved1

func (x *ConverterInputStreamClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*ConverterInputStreamClass) GetGReserved2

func (x *ConverterInputStreamClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*ConverterInputStreamClass) GetGReserved3

func (x *ConverterInputStreamClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*ConverterInputStreamClass) GetGReserved4

func (x *ConverterInputStreamClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*ConverterInputStreamClass) GetGReserved5

func (x *ConverterInputStreamClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*ConverterInputStreamClass) GoPointer

func (x *ConverterInputStreamClass) GoPointer() uintptr

func (*ConverterInputStreamClass) OverrideGReserved1

func (x *ConverterInputStreamClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*ConverterInputStreamClass) OverrideGReserved2

func (x *ConverterInputStreamClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*ConverterInputStreamClass) OverrideGReserved3

func (x *ConverterInputStreamClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*ConverterInputStreamClass) OverrideGReserved4

func (x *ConverterInputStreamClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*ConverterInputStreamClass) OverrideGReserved5

func (x *ConverterInputStreamClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

type ConverterInputStreamPrivate

type ConverterInputStreamPrivate struct {
	// contains filtered or unexported fields
}

func (*ConverterInputStreamPrivate) GoPointer

func (x *ConverterInputStreamPrivate) GoPointer() uintptr

type ConverterOutputStream

type ConverterOutputStream struct {
	FilterOutputStream
}

Converter output stream implements [class@Gio.OutputStream] and allows conversion of data of various types during reading.

As of GLib 2.34, `GConverterOutputStream` implements [iface@Gio.PollableOutputStream].

func ConverterOutputStreamNewFromInternalPtr

func ConverterOutputStreamNewFromInternalPtr(ptr uintptr) *ConverterOutputStream

func NewConverterOutputStream

func NewConverterOutputStream(BaseStreamVar *OutputStream, ConverterVar Converter) *ConverterOutputStream

Creates a new converter output stream for the @base_stream.

func (*ConverterOutputStream) CanPoll

func (x *ConverterOutputStream) CanPoll() bool

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.

func (*ConverterOutputStream) CreateSource

func (x *ConverterOutputStream) CreateSource(CancellableVar *Cancellable) *glib.Source

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.

func (*ConverterOutputStream) GetConverter

func (x *ConverterOutputStream) GetConverter() *ConverterBase

Gets the #GConverter that is used by @converter_stream.

func (*ConverterOutputStream) GoPointer

func (c *ConverterOutputStream) GoPointer() uintptr

func (*ConverterOutputStream) IsWritable

func (x *ConverterOutputStream) IsWritable() bool

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.

func (*ConverterOutputStream) SetGoPointer

func (c *ConverterOutputStream) SetGoPointer(ptr uintptr)

func (*ConverterOutputStream) WriteNonblocking

func (x *ConverterOutputStream) WriteNonblocking(BufferVar []byte, CountVar uint, CancellableVar *Cancellable) (int, error)

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.

func (*ConverterOutputStream) WritevNonblocking

func (x *ConverterOutputStream) WritevNonblocking(VectorsVar []OutputVector, NVectorsVar uint, BytesWrittenVar *uint, CancellableVar *Cancellable) (PollableReturn, error)

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.

type ConverterOutputStreamClass

type ConverterOutputStreamClass struct {
	ParentClass FilterOutputStreamClass
	// contains filtered or unexported fields
}

func (*ConverterOutputStreamClass) GetGReserved1

func (x *ConverterOutputStreamClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*ConverterOutputStreamClass) GetGReserved2

func (x *ConverterOutputStreamClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*ConverterOutputStreamClass) GetGReserved3

func (x *ConverterOutputStreamClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*ConverterOutputStreamClass) GetGReserved4

func (x *ConverterOutputStreamClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*ConverterOutputStreamClass) GetGReserved5

func (x *ConverterOutputStreamClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*ConverterOutputStreamClass) GoPointer

func (x *ConverterOutputStreamClass) GoPointer() uintptr

func (*ConverterOutputStreamClass) OverrideGReserved1

func (x *ConverterOutputStreamClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*ConverterOutputStreamClass) OverrideGReserved2

func (x *ConverterOutputStreamClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*ConverterOutputStreamClass) OverrideGReserved3

func (x *ConverterOutputStreamClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*ConverterOutputStreamClass) OverrideGReserved4

func (x *ConverterOutputStreamClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*ConverterOutputStreamClass) OverrideGReserved5

func (x *ConverterOutputStreamClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

type ConverterOutputStreamPrivate

type ConverterOutputStreamPrivate struct {
	// contains filtered or unexported fields
}

func (*ConverterOutputStreamPrivate) GoPointer

func (x *ConverterOutputStreamPrivate) GoPointer() uintptr

type ConverterResult

type ConverterResult int

Results returned from g_converter_convert().

const (

	// There was an error during conversion.
	GConverterErrorValue ConverterResult = 0
	// Some data was consumed or produced
	GConverterConvertedValue ConverterResult = 1
	// The conversion is finished
	GConverterFinishedValue ConverterResult = 2
	// Flushing is finished
	GConverterFlushedValue ConverterResult = 3
)

type Credentials

type Credentials struct {
	gobject.Object
}

The `GCredentials` type is a reference-counted wrapper for native credentials.

The information in `GCredentials` 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. [method@Gio.Socket.get_credentials].

Some operating systems supports securely sending and receiving credentials over a Unix Domain Socket, see [class@Gio.UnixCredentialsMessage], [method@Gio.UnixConnection.send_credentials] and [method@Gio.UnixConnection.receive_credentials] for details.

On Linux, the native credential type is a `struct ucred` - see the [`unix(7)` man page](man:unix(7)) 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`.

func CredentialsNewFromInternalPtr

func CredentialsNewFromInternalPtr(ptr uintptr) *Credentials

func NewCredentials

func NewCredentials() *Credentials

Creates a new #GCredentials object with credentials matching the the current process.

func (*Credentials) GetNative

func (x *Credentials) GetNative(NativeTypeVar CredentialsType) uintptr

Gets a pointer to native credentials of type @native_type from @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.

func (*Credentials) GetUnixPid

func (x *Credentials) GetUnixPid() (int, error)

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.

func (*Credentials) GetUnixUser

func (x *Credentials) GetUnixUser() (uint, error)

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.

As the signedness of `uid_t` is not specified by POSIX, it is recommended to check @error for failure rather than trying to check the return value, particularly in language bindings.

func (*Credentials) GoPointer

func (c *Credentials) GoPointer() uintptr

func (*Credentials) IsSameUser

func (x *Credentials) IsSameUser(OtherCredentialsVar *Credentials) (bool, error)

Checks if @credentials and @other_credentials is the same user.

This operation can fail if #GCredentials is not supported on the the OS.

func (*Credentials) SetGoPointer

func (c *Credentials) SetGoPointer(ptr uintptr)

func (*Credentials) SetNative

func (x *Credentials) SetNative(NativeTypeVar CredentialsType, NativeVar uintptr)

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.

func (*Credentials) SetUnixUser

func (x *Credentials) SetUnixUser(UidVar uint) (bool, error)

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.

func (*Credentials) ToString

func (x *Credentials) ToString() string

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.

type CredentialsClass

type CredentialsClass struct {
	// contains filtered or unexported fields
}

Class structure for #GCredentials.

func (*CredentialsClass) GoPointer

func (x *CredentialsClass) GoPointer() uintptr

type CredentialsType

type CredentialsType int

Enumeration describing different kinds of native credential types.

const (

	// Indicates an invalid native credential type.
	GCredentialsTypeInvalidValue CredentialsType = 0
	// The native credentials type is a `struct ucred`.
	GCredentialsTypeLinuxUcredValue CredentialsType = 1
	// The native credentials type is a `struct cmsgcred`.
	GCredentialsTypeFreebsdCmsgcredValue CredentialsType = 2
	// The native credentials type is a `struct sockpeercred`. Added in 2.30.
	GCredentialsTypeOpenbsdSockpeercredValue CredentialsType = 3
	// The native credentials type is a `ucred_t`. Added in 2.40.
	GCredentialsTypeSolarisUcredValue CredentialsType = 4
	// The native credentials type is a `struct unpcbid`. Added in 2.42.
	GCredentialsTypeNetbsdUnpcbidValue CredentialsType = 5
	// The native credentials type is a `struct xucred`. Added in 2.66.
	GCredentialsTypeAppleXucredValue CredentialsType = 6
	// The native credentials type is a PID `DWORD`. Added in 2.72.
	GCredentialsTypeWin32PidValue CredentialsType = 7
)

type DBusActionGroup

type DBusActionGroup struct {
	gobject.Object
}

`GDBusActionGroup` is an implementation of the [iface@Gio.ActionGroup] interface.

`GDBusActionGroup` can be used as a proxy for an action group that is exported over D-Bus with [method@Gio.DBusConnection.export_action_group].

func DBusActionGroupGet

func DBusActionGroupGet(ConnectionVar *DBusConnection, BusNameVar *string, ObjectPathVar string) *DBusActionGroup

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.

func DBusActionGroupNewFromInternalPtr

func DBusActionGroupNewFromInternalPtr(ptr uintptr) *DBusActionGroup

func (*DBusActionGroup) ActionAdded

func (x *DBusActionGroup) ActionAdded(ActionNameVar string)

Emits the [signal@Gio.ActionGroup::action-added] signal on @action_group.

This function should only be called by [type@Gio.ActionGroup] implementations.

func (*DBusActionGroup) ActionEnabledChanged

func (x *DBusActionGroup) ActionEnabledChanged(ActionNameVar string, EnabledVar bool)

Emits the [signal@Gio.ActionGroup::action-enabled-changed] signal on @action_group.

This function should only be called by [type@Gio.ActionGroup] implementations.

func (*DBusActionGroup) ActionRemoved

func (x *DBusActionGroup) ActionRemoved(ActionNameVar string)

Emits the [signal@Gio.ActionGroup::action-removed] signal on @action_group.

This function should only be called by [type@Gio.ActionGroup] implementations.

func (*DBusActionGroup) ActionStateChanged

func (x *DBusActionGroup) ActionStateChanged(ActionNameVar string, StateVar *glib.Variant)

Emits the [signal@Gio.ActionGroup::action-state-changed] signal on @action_group.

This function should only be called by [type@Gio.ActionGroup] implementations.

func (*DBusActionGroup) ActivateAction

func (x *DBusActionGroup) ActivateAction(ActionNameVar string, ParameterVar *glib.Variant)

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 [method@Gio.ActionGroup.get_action_parameter_type].

If the [type@Gio.ActionGroup] 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, [method@Gio.DBusConnection.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 [method@Gio.DBusConnection.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); ```

func (*DBusActionGroup) ActivateActionFull

func (x *DBusActionGroup) ActivateActionFull(ActionNameVar string, ParameterVar *glib.Variant, PlatformDataVar *glib.Variant)

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.

func (*DBusActionGroup) ChangeActionState

func (x *DBusActionGroup) ChangeActionState(ActionNameVar string, ValueVar *glib.Variant)

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 [method@Gio.ActionGroup.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 [method@Gio.ActionGroup.get_action_state_hint].

If the @value GVariant is floating, it is consumed.

func (*DBusActionGroup) ChangeActionStateFull

func (x *DBusActionGroup) ChangeActionStateFull(ActionNameVar string, ValueVar *glib.Variant, PlatformDataVar *glib.Variant)

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.

func (*DBusActionGroup) GetActionEnabled

func (x *DBusActionGroup) GetActionEnabled(ActionNameVar string) bool

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.

func (*DBusActionGroup) GetActionParameterType

func (x *DBusActionGroup) GetActionParameterType(ActionNameVar string) *glib.VariantType

Queries the type of the parameter that must be given when activating the named action within @action_group.

When activating the action using [method@Gio.ActionGroup.activate_action], the [type@GLib.Variant] 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 [type@GLib.Variant], 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.

func (*DBusActionGroup) GetActionState

func (x *DBusActionGroup) GetActionState(ActionNameVar string) *glib.Variant

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 [method@Gio.ActionGroup.get_action_state_type].

The return value (if non-`NULL`) should be freed with [method@GLib.Variant.unref] when it is no longer required.

func (*DBusActionGroup) GetActionStateHint

func (x *DBusActionGroup) GetActionStateHint(ActionNameVar string) *glib.Variant

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 [type@GLib.Variant] array is returned then each item in the array is a possible value for the state. If a [type@GLib.Variant] 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 [method@GLib.Variant.unref] when it is no longer required.

func (*DBusActionGroup) GetActionStateType

func (x *DBusActionGroup) GetActionStateType(ActionNameVar string) *glib.VariantType

Queries the type of the state of the named action within @action_group.

If the action is stateful then this function returns the [type@GLib.VariantType] of the state. All calls to [method@Gio.ActionGroup.change_action_state] must give a [type@GLib.Variant] of this type and [method@Gio.ActionGroup.get_action_state] will return a [type@GLib.Variant] of the same type.

If the action is not stateful then this function will return `NULL`. In that case, [method@Gio.ActionGroup.get_action_state] will return `NULL` and you must not call [method@Gio.ActionGroup.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.

func (*DBusActionGroup) GoPointer

func (c *DBusActionGroup) GoPointer() uintptr

func (*DBusActionGroup) HasAction

func (x *DBusActionGroup) HasAction(ActionNameVar string) bool

Checks if the named action exists within @action_group.

func (*DBusActionGroup) ListActions

func (x *DBusActionGroup) ListActions() []string

Lists the actions contained within @action_group.

The caller is responsible for freeing the list with [func@GLib.strfreev] when it is no longer required.

func (*DBusActionGroup) QueryAction

func (x *DBusActionGroup) QueryAction(ActionNameVar string, EnabledVar *bool, ParameterTypeVar **glib.VariantType, StateTypeVar **glib.VariantType, StateHintVar **glib.Variant, StateVar **glib.Variant) bool

Queries all aspects of the named action within an @action_group.

This function acquires the information available from [method@Gio.ActionGroup.has_action], [method@Gio.ActionGroup.get_action_enabled], [method@Gio.ActionGroup.get_action_parameter_type], [method@Gio.ActionGroup.get_action_state_type], [method@Gio.ActionGroup.get_action_state_hint] and [method@Gio.ActionGroup.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 [type@Gio.ActionGroup] 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.

func (*DBusActionGroup) SetGoPointer

func (c *DBusActionGroup) SetGoPointer(ptr uintptr)

type DBusAnnotationInfo

type DBusAnnotationInfo struct {
	RefCount int32

	Key uintptr

	Value uintptr

	Annotations uintptr
	// contains filtered or unexported fields
}

Information about an annotation.

func (*DBusAnnotationInfo) GoPointer

func (x *DBusAnnotationInfo) GoPointer() uintptr

func (*DBusAnnotationInfo) Ref

If @info is statically allocated does nothing. Otherwise increases the reference count.

func (*DBusAnnotationInfo) Unref

func (x *DBusAnnotationInfo) Unref()

If @info is statically allocated, does nothing. Otherwise decreases the reference count of @info. When its reference count drops to 0, the memory used is freed.

type DBusArgInfo

type DBusArgInfo struct {
	RefCount int32

	Name uintptr

	Signature uintptr

	Annotations uintptr
	// contains filtered or unexported fields
}

Information about an argument for a method or a signal.

func (*DBusArgInfo) GoPointer

func (x *DBusArgInfo) GoPointer() uintptr

func (*DBusArgInfo) Ref

func (x *DBusArgInfo) Ref() *DBusArgInfo

If @info is statically allocated does nothing. Otherwise increases the reference count.

func (*DBusArgInfo) Unref

func (x *DBusArgInfo) Unref()

If @info is statically allocated, does nothing. Otherwise decreases the reference count of @info. When its reference count drops to 0, the memory used is freed.

type DBusAuthObserver

type DBusAuthObserver struct {
	gobject.Object
}

`GDBusAuthObserver` provides a mechanism for participating in how a [class@Gio.DBusServer] (or a [class@Gio.DBusConnection]) 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

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;
}

```

func DBusAuthObserverNewFromInternalPtr

func DBusAuthObserverNewFromInternalPtr(ptr uintptr) *DBusAuthObserver

func NewDBusAuthObserver

func NewDBusAuthObserver() *DBusAuthObserver

Creates a new #GDBusAuthObserver object.

func (*DBusAuthObserver) AllowMechanism

func (x *DBusAuthObserver) AllowMechanism(MechanismVar string) bool

Emits the #GDBusAuthObserver::allow-mechanism signal on @observer.

func (*DBusAuthObserver) AuthorizeAuthenticatedPeer

func (x *DBusAuthObserver) AuthorizeAuthenticatedPeer(StreamVar *IOStream, CredentialsVar *Credentials) bool

Emits the #GDBusAuthObserver::authorize-authenticated-peer signal on @observer.

func (*DBusAuthObserver) ConnectAllowMechanism

func (x *DBusAuthObserver) ConnectAllowMechanism(cb *func(DBusAuthObserver, string) bool) uint

Emitted to check if @mechanism is allowed to be used.

func (*DBusAuthObserver) ConnectAuthorizeAuthenticatedPeer

func (x *DBusAuthObserver) ConnectAuthorizeAuthenticatedPeer(cb *func(DBusAuthObserver, uintptr, uintptr) bool) uint

Emitted to check if a peer that is successfully authenticated is authorized.

func (*DBusAuthObserver) GoPointer

func (c *DBusAuthObserver) GoPointer() uintptr

func (*DBusAuthObserver) SetGoPointer

func (c *DBusAuthObserver) SetGoPointer(ptr uintptr)

type DBusCallFlags

type DBusCallFlags int

Flags used in g_dbus_connection_call() and similar APIs.

const (

	// No flags set.
	GDbusCallFlagsNoneValue DBusCallFlags = 0
	// The bus must not launch
	// an owner for the destination name in response to this method
	// invocation.
	GDbusCallFlagsNoAutoStartValue DBusCallFlags = 1
	// the caller is prepared to
	// wait for interactive authorization. Since 2.46.
	GDbusCallFlagsAllowInteractiveAuthorizationValue DBusCallFlags = 2
)

type DBusCapabilityFlags

type DBusCapabilityFlags int

Capabilities negotiated with the remote peer.

const (

	// No flags set.
	GDbusCapabilityFlagsNoneValue DBusCapabilityFlags = 0
	// The connection
	// supports exchanging UNIX file descriptors with the remote peer.
	GDbusCapabilityFlagsUnixFdPassingValue DBusCapabilityFlags = 1
)

type DBusConnection

type DBusConnection struct {
	gobject.Object
}

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 [class@Gio.IOStream].

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 [func@Gio.bus_own_name], [func@Gio.bus_watch_name] or [func@Gio.DBusProxy.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 [func@Gio.bus_get] and [func@Gio.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, [func@Gio.DBusConnection.new] and [func@Gio.bus_get], and the synchronous versions of those methods, give you an initialized connection. Language bindings for GIO should use [func@Gio.Initable.new] or [func@Gio.AsyncInitable.new_async], which also initialize the connection.

If you construct an uninitialized `GDBusConnection`, such as via [ctor@GObject.Object.new], you must initialize it via [method@Gio.Initable.init] or [method@Gio.AsyncInitable.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 [method@GObject.Object.unref].

## An example D-Bus 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

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

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

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)

func BusGetFinish

func BusGetFinish(ResVar AsyncResult) (*DBusConnection, error)

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.

func BusGetSync

func BusGetSync(BusTypeVar BusType, CancellableVar *Cancellable) (*DBusConnection, error)

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.

func DBusConnectionNewFromInternalPtr

func DBusConnectionNewFromInternalPtr(ptr uintptr) *DBusConnection

func NewDBusConnectionFinish

func NewDBusConnectionFinish(ResVar AsyncResult) (*DBusConnection, error)

Finishes an operation started with g_dbus_connection_new().

func NewDBusConnectionForAddressFinish

func NewDBusConnectionForAddressFinish(ResVar AsyncResult) (*DBusConnection, error)

Finishes an operation started with g_dbus_connection_new_for_address().

func NewDBusConnectionForAddressSync

func NewDBusConnectionForAddressSync(AddressVar string, FlagsVar DBusConnectionFlags, ObserverVar *DBusAuthObserver, CancellableVar *Cancellable) (*DBusConnection, error)

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.

func NewDBusConnectionSync

func NewDBusConnectionSync(StreamVar *IOStream, GuidVar *string, FlagsVar DBusConnectionFlags, ObserverVar *DBusAuthObserver, CancellableVar *Cancellable) (*DBusConnection, error)

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.

func (*DBusConnection) AddFilter

func (x *DBusConnection) AddFilter(FilterFunctionVar *DBusMessageFilterFunction, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) uint

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.)

func (*DBusConnection) Call

func (x *DBusConnection) Call(BusNameVar *string, ObjectPathVar string, InterfaceNameVar string, MethodNameVar string, ParametersVar *glib.Variant, ReplyTypeVar *glib.VariantType, FlagsVar DBusCallFlags, TimeoutMsecVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.: |[<!-- language="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 (see [method@GLib.MainContext.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.

func (*DBusConnection) CallFinish

func (x *DBusConnection) CallFinish(ResVar AsyncResult) (*glib.Variant, error)

Finishes an operation started with g_dbus_connection_call().

func (*DBusConnection) CallSync

func (x *DBusConnection) CallSync(BusNameVar *string, ObjectPathVar string, InterfaceNameVar string, MethodNameVar string, ParametersVar *glib.Variant, ReplyTypeVar *glib.VariantType, FlagsVar DBusCallFlags, TimeoutMsecVar int, CancellableVar *Cancellable) (*glib.Variant, error)

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.: |[<!-- language="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.

func (*DBusConnection) CallWithUnixFdList

func (x *DBusConnection) CallWithUnixFdList(BusNameVar *string, ObjectPathVar string, InterfaceNameVar string, MethodNameVar string, ParametersVar *glib.Variant, ReplyTypeVar *glib.VariantType, FlagsVar DBusCallFlags, TimeoutMsecVar int, FdListVar *UnixFDList, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*DBusConnection) CallWithUnixFdListFinish

func (x *DBusConnection) CallWithUnixFdListFinish(OutFdListVar **UnixFDList, ResVar AsyncResult) (*glib.Variant, error)

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.

func (*DBusConnection) CallWithUnixFdListSync

func (x *DBusConnection) CallWithUnixFdListSync(BusNameVar *string, ObjectPathVar string, InterfaceNameVar string, MethodNameVar string, ParametersVar *glib.Variant, ReplyTypeVar *glib.VariantType, FlagsVar DBusCallFlags, TimeoutMsecVar int, FdListVar *UnixFDList, OutFdListVar **UnixFDList, CancellableVar *Cancellable) (*glib.Variant, error)

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.

func (*DBusConnection) Close

func (x *DBusConnection) Close(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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 (see [method@GLib.MainContext.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 (see [method@GLib.MainContext.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.

func (*DBusConnection) CloseFinish

func (x *DBusConnection) CloseFinish(ResVar AsyncResult) (bool, error)

Finishes an operation started with g_dbus_connection_close().

func (*DBusConnection) CloseSync

func (x *DBusConnection) CloseSync(CancellableVar *Cancellable) (bool, error)

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.

func (*DBusConnection) ConnectClosed

func (x *DBusConnection) ConnectClosed(cb *func(DBusConnection, bool, *glib.Error)) uint

Emitted when the connection is closed.

The cause of this event can be

  • If g_dbus_connection_close() is called. In this case @remote_peer_vanished is set to %FALSE and @error is %NULL.

  • If the remote peer closes the connection. In this case @remote_peer_vanished is set to %TRUE and @error is set.

  • If the remote peer sends invalid or malformed data. In this case @remote_peer_vanished is set to %FALSE and @error is set.

Upon receiving this signal, you should give up your reference to @connection. You are guaranteed that this signal is emitted only once.

func (*DBusConnection) EmitSignal

func (x *DBusConnection) EmitSignal(DestinationBusNameVar *string, ObjectPathVar string, InterfaceNameVar string, SignalNameVar string, ParametersVar *glib.Variant) (bool, error)

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).

func (*DBusConnection) ExportActionGroup

func (x *DBusConnection) ExportActionGroup(ObjectPathVar string, ActionGroupVar ActionGroup) (uint, error)

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 [method@Gio.DBusConnection.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.

func (*DBusConnection) ExportMenuModel

func (x *DBusConnection) ExportMenuModel(ObjectPathVar string, MenuVar *MenuModel) (uint, error)

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.

func (*DBusConnection) Flush

func (x *DBusConnection) Flush(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously flushes @connection, that is, writes all queued outgoing messages to the transport and then flushes the transport (using g_output_stream_flush_async()). This is useful in programs that want to emit a D-Bus signal and then exit immediately. Without flushing the connection, there is no guarantee 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 (see [method@GLib.MainContext.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.

func (*DBusConnection) FlushFinish

func (x *DBusConnection) FlushFinish(ResVar AsyncResult) (bool, error)

Finishes an operation started with g_dbus_connection_flush().

func (*DBusConnection) FlushSync

func (x *DBusConnection) FlushSync(CancellableVar *Cancellable) (bool, error)

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.

func (*DBusConnection) GetCapabilities

func (x *DBusConnection) GetCapabilities() DBusCapabilityFlags

Gets the capabilities negotiated with the remote peer

func (*DBusConnection) GetExitOnClose

func (x *DBusConnection) GetExitOnClose() bool

Gets whether the process is terminated when @connection is closed by the remote peer. See #GDBusConnection:exit-on-close for more details.

func (*DBusConnection) GetFlags

func (x *DBusConnection) GetFlags() DBusConnectionFlags

Gets the flags used to construct this connection

func (*DBusConnection) GetGuid

func (x *DBusConnection) GetGuid() string

The GUID of the peer performing the role of server when authenticating. See #GDBusConnection:guid for more details.

func (*DBusConnection) GetLastSerial

func (x *DBusConnection) GetLastSerial() uint32

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().

func (*DBusConnection) GetPeerCredentials

func (x *DBusConnection) GetPeerCredentials() *Credentials

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.

func (*DBusConnection) GetPropertyClosed

func (x *DBusConnection) GetPropertyClosed() bool

GetPropertyClosed gets the "closed" property. A boolean specifying whether the connection has been closed.

func (*DBusConnection) GetPropertyExitOnClose

func (x *DBusConnection) GetPropertyExitOnClose() bool

GetPropertyExitOnClose gets the "exit-on-close" property. 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.

func (*DBusConnection) GetPropertyGuid

func (x *DBusConnection) GetPropertyGuid() string

GetPropertyGuid gets the "guid" property. 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.

func (*DBusConnection) GetPropertyUniqueName

func (x *DBusConnection) GetPropertyUniqueName() string

GetPropertyUniqueName gets the "unique-name" property. The unique name as assigned by the message bus or %NULL if the connection is not open or not a message bus connection.

func (*DBusConnection) GetStream

func (x *DBusConnection) GetStream() *IOStream

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.

func (*DBusConnection) GetUniqueName

func (x *DBusConnection) GetUniqueName() string

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.

func (*DBusConnection) GoPointer

func (c *DBusConnection) GoPointer() uintptr

func (*DBusConnection) Init

func (x *DBusConnection) Init(CancellableVar *Cancellable) (bool, error)

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 [description][iface@Gio.Initable#description] 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.

func (*DBusConnection) InitAsync

func (x *DBusConnection) InitAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*DBusConnection) InitFinish

func (x *DBusConnection) InitFinish(ResVar AsyncResult) (bool, error)

Finishes asynchronous initialization and returns the result. See g_async_initable_init_async().

func (*DBusConnection) IsClosed

func (x *DBusConnection) IsClosed() bool

Gets whether @connection is closed.

func (*DBusConnection) NewFinish

func (x *DBusConnection) NewFinish(ResVar AsyncResult) (*gobject.Object, error)

Finishes the async construction for the various g_async_initable_new calls, returning the created object or %NULL on error.

func (*DBusConnection) RegisterObject

func (x *DBusConnection) RegisterObject(ObjectPathVar string, InterfaceInfoVar *DBusInterfaceInfo, VtableVar *DBusInterfaceVTable, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) (uint, error)

Registers callbacks for exported objects at @object_path with the D-Bus interface that is described in @interface_info.

Calls to functions in @vtable (and @user_data_free_func) will happen in the thread-default main context (see [method@GLib.MainContext.push_thread_default]) of the thread you are calling this method from.

Note that all #GVariant values passed to functions in @vtable will match the signature given in @interface_info - if a remote caller passes incorrect values, the `org.freedesktop.DBus.Error.InvalidArgs` is returned to the remote caller.

Additionally, if the remote caller attempts to invoke methods or access properties not mentioned in @interface_info the `org.freedesktop.DBus.Error.UnknownMethod` resp. `org.freedesktop.DBus.Error.InvalidArgs` errors are returned to the caller.

It is considered a programming error if the #GDBusInterfaceGetPropertyFunc function in @vtable returns a #GVariant of incorrect type.

If an existing callback is already registered at @object_path and @interface_name, then @error is set to %G_IO_ERROR_EXISTS.

GDBus automatically implements the standard D-Bus interfaces org.freedesktop.DBus.Properties, org.freedesktop.DBus.Introspectable and org.freedesktop.Peer, so you don't have to implement those for the objects you export. You can implement org.freedesktop.DBus.Properties yourself, e.g. to handle getting and setting of properties asynchronously.

Note that the reference count on @interface_info will be incremented by 1 (unless allocated statically, e.g. if the reference count is -1, see g_dbus_interface_info_ref()) for as long as the object is exported. Also note that @vtable will be copied.

See this [server][class@Gio.DBusConnection#an-example-d-bus-server] for an example of how to use this method.

func (*DBusConnection) RegisterObjectWithClosures

func (x *DBusConnection) RegisterObjectWithClosures(ObjectPathVar string, InterfaceInfoVar *DBusInterfaceInfo, MethodCallClosureVar *gobject.Closure, GetPropertyClosureVar *gobject.Closure, SetPropertyClosureVar *gobject.Closure) (uint, error)

Version of g_dbus_connection_register_object() using closures instead of a #GDBusInterfaceVTable for easier binding in other languages.

Note that the reference counting semantics of the function wrapped by @method_call_closure are the same as those of [callback@Gio.DBusInterfaceMethodCallFunc]: ownership of a reference to the [class@Gio.DBusMethodInvocation] is transferred to the function.

func (*DBusConnection) RegisterObjectWithClosures2

func (x *DBusConnection) RegisterObjectWithClosures2(ObjectPathVar string, InterfaceInfoVar *DBusInterfaceInfo, MethodCallClosureVar *gobject.Closure, GetPropertyClosureVar *gobject.Closure, SetPropertyClosureVar *gobject.Closure) (uint, error)

Version of [method@Gio.DBusConnection.register_object] using closures instead of a [type@Gio.DBusInterfaceVTable] for easier binding in other languages.

In contrast to [method@Gio.DBusConnection.register_object] and [method@Gio.DBusConnection.register_object_with_closures], the reference counting semantics of the function wrapped by @method_call_closure are *not* the same as those of [callback@Gio.DBusInterfaceMethodCallFunc]. Ownership of a reference to the [class@Gio.DBusMethodInvocation] is *not* transferred to the function. Bindings must ensure that they add a reference to the [class@Gio.DBusMethodInvocation] before calling any `g_dbus_method_invocation_return_*()` methods on it. This should be automatic as a result of the introspection annotations on those methods.

func (*DBusConnection) RegisterSubtree

func (x *DBusConnection) RegisterSubtree(ObjectPathVar string, VtableVar *DBusSubtreeVTable, FlagsVar DBusSubtreeFlags, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) (uint, error)

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 (see [method@GLib.MainContext.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][class@Gio.DBusConnection#an-example-for-exporting-a-subtree] for an example of how to use this method.

func (*DBusConnection) RemoveFilter

func (x *DBusConnection) RemoveFilter(FilterIdVar uint)

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.

func (*DBusConnection) SendMessage

func (x *DBusConnection) SendMessage(MessageVar *DBusMessage, FlagsVar DBusSendMessageFlags, OutSerialVar *uint32) (bool, error)

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][class@Gio.DBusConnection#an-example-d-bus-server] and [client][class@Gio.DBusConnection#an-example-for-file-descriptor-passing] 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.

func (*DBusConnection) SendMessageWithReply

func (x *DBusConnection) SendMessageWithReply(MessageVar *DBusMessage, FlagsVar DBusSendMessageFlags, TimeoutMsecVar int, OutSerialVar *uint32, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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 (see [method@GLib.MainContext.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][class@Gio.DBusConnection#an-example-d-bus-server] and [client][class@Gio.DBusConnection#an-example-for-file-descriptor-passing] for an example of how to use this low-level API to send and receive UNIX file descriptors.

func (*DBusConnection) SendMessageWithReplyFinish

func (x *DBusConnection) SendMessageWithReplyFinish(ResVar AsyncResult) (*DBusMessage, error)

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][class@Gio.DBusConnection#an-example-d-bus-server] and [client][class@Gio.DBusConnection#an-example-for-file-descriptor-passing] for an example of how to use this low-level API to send and receive UNIX file descriptors.

func (*DBusConnection) SendMessageWithReplySync

func (x *DBusConnection) SendMessageWithReplySync(MessageVar *DBusMessage, FlagsVar DBusSendMessageFlags, TimeoutMsecVar int, OutSerialVar *uint32, CancellableVar *Cancellable) (*DBusMessage, error)

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][class@Gio.DBusConnection#an-example-d-bus-server] and [client][class@Gio.DBusConnection#an-example-for-file-descriptor-passing] 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.

func (*DBusConnection) SetExitOnClose

func (x *DBusConnection) SetExitOnClose(ExitOnCloseVar bool)

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.

func (*DBusConnection) SetGoPointer

func (c *DBusConnection) SetGoPointer(ptr uintptr)

func (*DBusConnection) SetPropertyAddress

func (x *DBusConnection) SetPropertyAddress(value string)

SetPropertyAddress sets the "address" property. A D-Bus address specifying potential endpoints that can be used when establishing the connection.

func (*DBusConnection) SetPropertyExitOnClose

func (x *DBusConnection) SetPropertyExitOnClose(value bool)

SetPropertyExitOnClose sets the "exit-on-close" property. 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.

func (*DBusConnection) SetPropertyGuid

func (x *DBusConnection) SetPropertyGuid(value string)

SetPropertyGuid sets the "guid" property. 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.

func (*DBusConnection) SignalSubscribe

func (x *DBusConnection) SignalSubscribe(SenderVar *string, InterfaceNameVar *string, MemberVar *string, ObjectPathVar *string, Arg0Var *string, FlagsVar DBusSignalFlags, CallbackVar *DBusSignalCallback, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) uint

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 (see [method@GLib.MainContext.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.

func (*DBusConnection) SignalUnsubscribe

func (x *DBusConnection) SignalUnsubscribe(SubscriptionIdVar uint)

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.

func (*DBusConnection) StartMessageProcessing

func (x *DBusConnection) StartMessageProcessing()

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.

func (*DBusConnection) UnexportActionGroup

func (x *DBusConnection) UnexportActionGroup(ExportIdVar uint)

Reverses the effect of a previous call to [method@Gio.DBusConnection.export_action_group].

It is an error to call this function with an ID that wasn’t returned from [method@Gio.DBusConnection.export_action_group] or to call it with the same ID more than once.

func (*DBusConnection) UnexportMenuModel

func (x *DBusConnection) UnexportMenuModel(ExportIdVar uint)

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.

func (*DBusConnection) UnregisterObject

func (x *DBusConnection) UnregisterObject(RegistrationIdVar uint) bool

Unregisters an object.

func (*DBusConnection) UnregisterSubtree

func (x *DBusConnection) UnregisterSubtree(RegistrationIdVar uint) bool

Unregisters a subtree.

type DBusConnectionFlags

type DBusConnectionFlags int

Flags used when creating a new #GDBusConnection.

const (

	// No flags set.
	GDbusConnectionFlagsNoneValue DBusConnectionFlags = 0
	// Perform authentication against server.
	GDbusConnectionFlagsAuthenticationClientValue DBusConnectionFlags = 1
	// Perform authentication against client.
	GDbusConnectionFlagsAuthenticationServerValue DBusConnectionFlags = 2
	// When
	// authenticating as a server, allow the anonymous authentication
	// method.
	GDbusConnectionFlagsAuthenticationAllowAnonymousValue DBusConnectionFlags = 4
	// 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.
	GDbusConnectionFlagsMessageBusConnectionValue DBusConnectionFlags = 8
	// If set, processing of D-Bus messages is
	// delayed until g_dbus_connection_start_message_processing() is called.
	GDbusConnectionFlagsDelayMessageProcessingValue DBusConnectionFlags = 16
	// When authenticating
	// as a server, require the UID of the peer to be the same as the UID of the server. (Since: 2.68)
	GDbusConnectionFlagsAuthenticationRequireSameUserValue DBusConnectionFlags = 32
	// 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
	GDbusConnectionFlagsCrossNamespaceValue DBusConnectionFlags = 64
)

type DBusError

type DBusError int

Error codes for the %G_DBUS_ERROR error domain.

const (

	// A generic error; "something went wrong" - see the error message for
	// more.
	GDbusErrorFailedValue DBusError = 0
	// There was not enough memory to complete an operation.
	GDbusErrorNoMemoryValue DBusError = 1
	// The bus doesn't know how to launch a service to supply the bus name
	// you wanted.
	GDbusErrorServiceUnknownValue DBusError = 2
	// The bus name you referenced doesn't exist (i.e. no application owns
	// it).
	GDbusErrorNameHasNoOwnerValue DBusError = 3
	// No reply to a message expecting one, usually means a timeout occurred.
	GDbusErrorNoReplyValue DBusError = 4
	// Something went wrong reading or writing to a socket, for example.
	GDbusErrorIoErrorValue DBusError = 5
	// A D-Bus bus address was malformed.
	GDbusErrorBadAddressValue DBusError = 6
	// Requested operation isn't supported (like ENOSYS on UNIX).
	GDbusErrorNotSupportedValue DBusError = 7
	// Some limited resource is exhausted.
	GDbusErrorLimitsExceededValue DBusError = 8
	// Security restrictions don't allow doing what you're trying to do.
	GDbusErrorAccessDeniedValue DBusError = 9
	// Authentication didn't work.
	GDbusErrorAuthFailedValue DBusError = 10
	// Unable to connect to server (probably caused by ECONNREFUSED on a
	// socket).
	GDbusErrorNoServerValue DBusError = 11
	// 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.
	GDbusErrorTimeoutValue DBusError = 12
	// No network access (probably ENETUNREACH on a socket).
	GDbusErrorNoNetworkValue DBusError = 13
	// Can't bind a socket since its address is in use (i.e. EADDRINUSE).
	GDbusErrorAddressInUseValue DBusError = 14
	// The connection is disconnected and you're trying to use it.
	GDbusErrorDisconnectedValue DBusError = 15
	// Invalid arguments passed to a method call.
	GDbusErrorInvalidArgsValue DBusError = 16
	// Missing file.
	GDbusErrorFileNotFoundValue DBusError = 17
	// Existing file and the operation you're using does not silently overwrite.
	GDbusErrorFileExistsValue DBusError = 18
	// Method name you invoked isn't known by the object you invoked it on.
	GDbusErrorUnknownMethodValue DBusError = 19
	// 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.
	GDbusErrorTimedOutValue DBusError = 20
	// Tried to remove or modify a match rule that didn't exist.
	GDbusErrorMatchRuleNotFoundValue DBusError = 21
	// The match rule isn't syntactically valid.
	GDbusErrorMatchRuleInvalidValue DBusError = 22
	// While starting a new process, the exec() call failed.
	GDbusErrorSpawnExecFailedValue DBusError = 23
	// While starting a new process, the fork() call failed.
	GDbusErrorSpawnForkFailedValue DBusError = 24
	// While starting a new process, the child exited with a status code.
	GDbusErrorSpawnChildExitedValue DBusError = 25
	// While starting a new process, the child exited on a signal.
	GDbusErrorSpawnChildSignaledValue DBusError = 26
	// While starting a new process, something went wrong.
	GDbusErrorSpawnFailedValue DBusError = 27
	// We failed to setup the environment correctly.
	GDbusErrorSpawnSetupFailedValue DBusError = 28
	// We failed to setup the config parser correctly.
	GDbusErrorSpawnConfigInvalidValue DBusError = 29
	// Bus name was not valid.
	GDbusErrorSpawnServiceInvalidValue DBusError = 30
	// Service file not found in system-services directory.
	GDbusErrorSpawnServiceNotFoundValue DBusError = 31
	// Permissions are incorrect on the setuid helper.
	GDbusErrorSpawnPermissionsInvalidValue DBusError = 32
	// Service file invalid (Name, User or Exec missing).
	GDbusErrorSpawnFileInvalidValue DBusError = 33
	// Tried to get a UNIX process ID and it wasn't available.
	GDbusErrorSpawnNoMemoryValue DBusError = 34
	// Tried to get a UNIX process ID and it wasn't available.
	GDbusErrorUnixProcessIdUnknownValue DBusError = 35
	// A type signature is not valid.
	GDbusErrorInvalidSignatureValue DBusError = 36
	// A file contains invalid syntax or is otherwise broken.
	GDbusErrorInvalidFileContentValue DBusError = 37
	// Asked for SELinux security context and it wasn't available.
	GDbusErrorSelinuxSecurityContextUnknownValue DBusError = 38
	// Asked for ADT audit data and it wasn't available.
	GDbusErrorAdtAuditDataUnknownValue DBusError = 39
	// There's already an object with the requested object path.
	GDbusErrorObjectPathInUseValue DBusError = 40
	// Object you invoked a method on isn't known. Since 2.42
	GDbusErrorUnknownObjectValue DBusError = 41
	// Interface you invoked a method on isn't known by the object. Since 2.42
	GDbusErrorUnknownInterfaceValue DBusError = 42
	// Property you tried to access isn't known by the object. Since 2.42
	GDbusErrorUnknownPropertyValue DBusError = 43
	// Property you tried to set is read-only. Since 2.42
	GDbusErrorPropertyReadOnlyValue DBusError = 44
)

type DBusErrorEntry

type DBusErrorEntry struct {
	ErrorCode int32

	DbusErrorName uintptr
	// contains filtered or unexported fields
}

Struct used in [func@Gio.DBusError.register_error_domain].

func (*DBusErrorEntry) GoPointer

func (x *DBusErrorEntry) GoPointer() uintptr

type DBusInterface

type DBusInterface interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	DupObject() *DBusObjectBase
	GetInfo() *DBusInterfaceInfo
	GetObject() *DBusObjectBase
	SetObject(ObjectVar DBusObject)
}

Base type for D-Bus interfaces.

The `GDBusInterface` type is the base type for D-Bus interfaces both on the service side (see [class@Gio.DBusInterfaceSkeleton]) and client side (see [class@Gio.DBusProxy]).

type DBusInterfaceBase

type DBusInterfaceBase struct {
	Ptr uintptr
}

func (*DBusInterfaceBase) DupObject

func (x *DBusInterfaceBase) DupObject() *DBusObjectBase

Gets the #GDBusObject that @interface_ belongs to, if any.

func (*DBusInterfaceBase) GetInfo

func (x *DBusInterfaceBase) GetInfo() *DBusInterfaceInfo

Gets D-Bus introspection information for the D-Bus interface implemented by @interface_.

This can return %NULL if no #GDBusInterfaceInfo was provided during construction of @interface_ and is also not made available otherwise. For example, #GDBusProxy implements #GDBusInterface but allows for a %NULL #GDBusInterfaceInfo.

func (*DBusInterfaceBase) GetObject

func (x *DBusInterfaceBase) GetObject() *DBusObjectBase

Gets the #GDBusObject that @interface_ belongs to, if any.

It is not safe to use the returned object if @interface_ or the returned object is being used from other threads. See g_dbus_interface_dup_object() for a thread-safe alternative.

func (*DBusInterfaceBase) GoPointer

func (x *DBusInterfaceBase) GoPointer() uintptr

func (*DBusInterfaceBase) SetGoPointer

func (x *DBusInterfaceBase) SetGoPointer(ptr uintptr)

func (*DBusInterfaceBase) SetObject

func (x *DBusInterfaceBase) SetObject(ObjectVar DBusObject)

Sets the #GDBusObject for @interface_ to @object.

Note that @interface_ will hold a weak reference to @object.

type DBusInterfaceGetPropertyFunc

type DBusInterfaceGetPropertyFunc func(uintptr, string, string, string, string, **glib.Error, uintptr) uintptr

The type of the @get_property function in #GDBusInterfaceVTable.

type DBusInterfaceIface

type DBusInterfaceIface struct {
	ParentIface uintptr
	// contains filtered or unexported fields
}

Base type for D-Bus interfaces.

func (*DBusInterfaceIface) GetDupObject

func (x *DBusInterfaceIface) GetDupObject() func(DBusInterface) *DBusObjectBase

GetDupObject gets the "dup_object" callback function. Gets a reference to the enclosing #GDBusObject. See g_dbus_interface_dup_object(). Added in 2.32.

func (*DBusInterfaceIface) GetGetInfo

func (x *DBusInterfaceIface) GetGetInfo() func(DBusInterface) *DBusInterfaceInfo

GetGetInfo gets the "get_info" callback function. Returns a #GDBusInterfaceInfo. See g_dbus_interface_get_info().

func (*DBusInterfaceIface) GetGetObject

func (x *DBusInterfaceIface) GetGetObject() func(DBusInterface) *DBusObjectBase

GetGetObject gets the "get_object" callback function. Gets the enclosing #GDBusObject. See g_dbus_interface_get_object().

func (*DBusInterfaceIface) GetSetObject

func (x *DBusInterfaceIface) GetSetObject() func(DBusInterface, DBusObject)

GetSetObject gets the "set_object" callback function. Sets the enclosing #GDBusObject. See g_dbus_interface_set_object().

func (*DBusInterfaceIface) GoPointer

func (x *DBusInterfaceIface) GoPointer() uintptr

func (*DBusInterfaceIface) OverrideDupObject

func (x *DBusInterfaceIface) OverrideDupObject(cb func(DBusInterface) *DBusObjectBase)

OverrideDupObject sets the "dup_object" callback function. Gets a reference to the enclosing #GDBusObject. See g_dbus_interface_dup_object(). Added in 2.32.

func (*DBusInterfaceIface) OverrideGetInfo

func (x *DBusInterfaceIface) OverrideGetInfo(cb func(DBusInterface) *DBusInterfaceInfo)

OverrideGetInfo sets the "get_info" callback function. Returns a #GDBusInterfaceInfo. See g_dbus_interface_get_info().

func (*DBusInterfaceIface) OverrideGetObject

func (x *DBusInterfaceIface) OverrideGetObject(cb func(DBusInterface) *DBusObjectBase)

OverrideGetObject sets the "get_object" callback function. Gets the enclosing #GDBusObject. See g_dbus_interface_get_object().

func (*DBusInterfaceIface) OverrideSetObject

func (x *DBusInterfaceIface) OverrideSetObject(cb func(DBusInterface, DBusObject))

OverrideSetObject sets the "set_object" callback function. Sets the enclosing #GDBusObject. See g_dbus_interface_set_object().

type DBusInterfaceInfo

type DBusInterfaceInfo struct {
	RefCount int32

	Name uintptr

	Methods uintptr

	Signals uintptr

	Properties uintptr

	Annotations uintptr
	// contains filtered or unexported fields
}

Information about a D-Bus interface.

func (*DBusInterfaceInfo) CacheBuild

func (x *DBusInterfaceInfo) CacheBuild()

Builds a lookup-cache to speed up g_dbus_interface_info_lookup_method(), g_dbus_interface_info_lookup_signal() and g_dbus_interface_info_lookup_property().

If this has already been called with @info, the existing cache is used and its use count is increased.

Note that @info cannot be modified until g_dbus_interface_info_cache_release() is called.

func (*DBusInterfaceInfo) CacheRelease

func (x *DBusInterfaceInfo) CacheRelease()

Decrements the usage count for the cache for @info built by g_dbus_interface_info_cache_build() (if any) and frees the resources used by the cache if the usage count drops to zero.

func (*DBusInterfaceInfo) GenerateXml

func (x *DBusInterfaceInfo) GenerateXml(IndentVar uint, StringBuilderVar *glib.String)

Appends an XML representation of @info (and its children) to @string_builder.

This function is typically used for generating introspection XML documents at run-time for handling the `org.freedesktop.DBus.Introspectable.Introspect` method.

func (*DBusInterfaceInfo) GoPointer

func (x *DBusInterfaceInfo) GoPointer() uintptr

func (*DBusInterfaceInfo) LookupMethod

func (x *DBusInterfaceInfo) LookupMethod(NameVar string) *DBusMethodInfo

Looks up information about a method.

The cost of this function is O(n) in number of methods unless g_dbus_interface_info_cache_build() has been used on @info.

func (*DBusInterfaceInfo) LookupProperty

func (x *DBusInterfaceInfo) LookupProperty(NameVar string) *DBusPropertyInfo

Looks up information about a property.

The cost of this function is O(n) in number of properties unless g_dbus_interface_info_cache_build() has been used on @info.

func (*DBusInterfaceInfo) LookupSignal

func (x *DBusInterfaceInfo) LookupSignal(NameVar string) *DBusSignalInfo

Looks up information about a signal.

The cost of this function is O(n) in number of signals unless g_dbus_interface_info_cache_build() has been used on @info.

func (*DBusInterfaceInfo) Ref

If @info is statically allocated does nothing. Otherwise increases the reference count.

func (*DBusInterfaceInfo) Unref

func (x *DBusInterfaceInfo) Unref()

If @info is statically allocated, does nothing. Otherwise decreases the reference count of @info. When its reference count drops to 0, the memory used is freed.

type DBusInterfaceMethodCallFunc

type DBusInterfaceMethodCallFunc func(uintptr, string, string, string, string, *glib.Variant, uintptr, uintptr)

The type of the @method_call function in #GDBusInterfaceVTable.

@interface_name may be `NULL` if not specified by the sender, although it’s encouraged for the sender to set it. If unset, and the object has only one method (across all interfaces) matching @method_name, that method is invoked. Otherwise, behaviour is implementation defined. See the [D-Bus specification](https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-types-method). It is recommended to return [error@Gio.DBusError.UNKNOWN_METHOD].

type DBusInterfaceSetPropertyFunc

type DBusInterfaceSetPropertyFunc func(uintptr, string, string, string, string, *glib.Variant, **glib.Error, uintptr) bool

The type of the @set_property function in #GDBusInterfaceVTable.

type DBusInterfaceSkeleton

type DBusInterfaceSkeleton struct {
	gobject.Object
}

Abstract base class for D-Bus interfaces on the service side.

func DBusInterfaceSkeletonNewFromInternalPtr

func DBusInterfaceSkeletonNewFromInternalPtr(ptr uintptr) *DBusInterfaceSkeleton

func (*DBusInterfaceSkeleton) ConnectGAuthorizeMethod

func (x *DBusInterfaceSkeleton) ConnectGAuthorizeMethod(cb *func(DBusInterfaceSkeleton, uintptr) bool) uint

Emitted when a method is invoked by a remote caller and used to determine if the method call is authorized.

Note that this signal is emitted in a thread dedicated to handling the method call so handlers are allowed to perform blocking IO. This means that it is appropriate to call e.g. [polkit_authority_check_authorization_sync()](http://hal.freedesktop.org/docs/polkit/PolkitAuthority.html#polkit-authority-check-authorization-sync) with the [POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION](http://hal.freedesktop.org/docs/polkit/PolkitAuthority.html#POLKIT-CHECK-AUTHORIZATION-FLAGS-ALLOW-USER-INTERACTION:CAPS) flag set.

If %FALSE is returned then no further handlers are run and the signal handler must take a reference to @invocation and finish handling the call (e.g. return an error via g_dbus_method_invocation_return_error()).

Otherwise, if %TRUE is returned, signal emission continues. If no handlers return %FALSE, then the method is dispatched. If @interface has an enclosing #GDBusObjectSkeleton, then the #GDBusObjectSkeleton::authorize-method signal handlers run before the handlers for this signal.

The default class handler just returns %TRUE.

Please note that the common case is optimized: if no signals handlers are connected and the default class handler isn't overridden (for both @interface and the enclosing #GDBusObjectSkeleton, if any) and #GDBusInterfaceSkeleton:g-flags does not have the %G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD flags set, no dedicated thread is ever used and the call will be handled in the same thread as the object that @interface belongs to was exported in.

func (*DBusInterfaceSkeleton) DupObject

func (x *DBusInterfaceSkeleton) DupObject() *DBusObjectBase

Gets the #GDBusObject that @interface_ belongs to, if any.

func (*DBusInterfaceSkeleton) Export

func (x *DBusInterfaceSkeleton) Export(ConnectionVar *DBusConnection, ObjectPathVar string) (bool, error)

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.

func (*DBusInterfaceSkeleton) Flush

func (x *DBusInterfaceSkeleton) Flush()

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.

func (*DBusInterfaceSkeleton) GetConnection

func (x *DBusInterfaceSkeleton) GetConnection() *DBusConnection

Gets the first connection that @interface_ is exported on, if any.

func (*DBusInterfaceSkeleton) GetConnections

func (x *DBusInterfaceSkeleton) GetConnections() *glib.List

Gets a list of the connections that @interface_ is exported on.

func (*DBusInterfaceSkeleton) GetFlags

Gets the #GDBusInterfaceSkeletonFlags that describes what the behavior of @interface_

func (*DBusInterfaceSkeleton) GetInfo

Gets D-Bus introspection information for the D-Bus interface implemented by @interface_.

func (*DBusInterfaceSkeleton) GetObject

func (x *DBusInterfaceSkeleton) GetObject() *DBusObjectBase

Gets the #GDBusObject that @interface_ belongs to, if any.

It is not safe to use the returned object if @interface_ or the returned object is being used from other threads. See g_dbus_interface_dup_object() for a thread-safe alternative.

func (*DBusInterfaceSkeleton) GetObjectPath

func (x *DBusInterfaceSkeleton) GetObjectPath() string

Gets the object path that @interface_ is exported on, if any.

func (*DBusInterfaceSkeleton) GetProperties

func (x *DBusInterfaceSkeleton) GetProperties() *glib.Variant

Gets all D-Bus properties for @interface_.

func (*DBusInterfaceSkeleton) GetVtable

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.

func (*DBusInterfaceSkeleton) GoPointer

func (c *DBusInterfaceSkeleton) GoPointer() uintptr

func (*DBusInterfaceSkeleton) HasConnection

func (x *DBusInterfaceSkeleton) HasConnection(ConnectionVar *DBusConnection) bool

Checks if @interface_ is exported on @connection.

func (*DBusInterfaceSkeleton) SetFlags

func (x *DBusInterfaceSkeleton) SetFlags(FlagsVar DBusInterfaceSkeletonFlags)

Sets flags describing what the behavior of @skeleton should be.

func (*DBusInterfaceSkeleton) SetGoPointer

func (c *DBusInterfaceSkeleton) SetGoPointer(ptr uintptr)

func (*DBusInterfaceSkeleton) SetObject

func (x *DBusInterfaceSkeleton) SetObject(ObjectVar DBusObject)

Sets the #GDBusObject for @interface_ to @object.

Note that @interface_ will hold a weak reference to @object.

func (*DBusInterfaceSkeleton) Unexport

func (x *DBusInterfaceSkeleton) Unexport()

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()

func (*DBusInterfaceSkeleton) UnexportFromConnection

func (x *DBusInterfaceSkeleton) UnexportFromConnection(ConnectionVar *DBusConnection)

Stops exporting @interface_ on @connection.

To stop exporting on all connections the interface is exported on, use g_dbus_interface_skeleton_unexport().

type DBusInterfaceSkeletonClass

type DBusInterfaceSkeletonClass struct {
	ParentClass gobject.ObjectClass

	VfuncPadding [7]uintptr

	SignalPadding [8]uintptr
	// contains filtered or unexported fields
}

Class structure for #GDBusInterfaceSkeleton.

func (*DBusInterfaceSkeletonClass) GetFlush

GetFlush gets the "flush" callback function. Emits outstanding changes, if any. See g_dbus_interface_skeleton_flush().

func (*DBusInterfaceSkeletonClass) GetGAuthorizeMethod

GetGAuthorizeMethod gets the "g_authorize_method" callback function. Signal class handler for the #GDBusInterfaceSkeleton::g-authorize-method signal.

func (*DBusInterfaceSkeletonClass) GetGetInfo

GetGetInfo gets the "get_info" callback function. Returns a #GDBusInterfaceInfo. See g_dbus_interface_skeleton_get_info() for details.

func (*DBusInterfaceSkeletonClass) GetGetProperties

func (x *DBusInterfaceSkeletonClass) GetGetProperties() func(*DBusInterfaceSkeleton) *glib.Variant

GetGetProperties gets the "get_properties" callback function. Returns a #GVariant with all properties. See g_dbus_interface_skeleton_get_properties().

func (*DBusInterfaceSkeletonClass) GetGetVtable

GetGetVtable gets the "get_vtable" callback function. Returns a #GDBusInterfaceVTable. See g_dbus_interface_skeleton_get_vtable() for details.

func (*DBusInterfaceSkeletonClass) GetMethodDispatch added in v0.5.0

GetMethodDispatch gets the "method_dispatch" callback function. Dispatches a method invocation. (Since: 2.88)

func (*DBusInterfaceSkeletonClass) GoPointer

func (x *DBusInterfaceSkeletonClass) GoPointer() uintptr

func (*DBusInterfaceSkeletonClass) OverrideFlush

func (x *DBusInterfaceSkeletonClass) OverrideFlush(cb func(*DBusInterfaceSkeleton))

OverrideFlush sets the "flush" callback function. Emits outstanding changes, if any. See g_dbus_interface_skeleton_flush().

func (*DBusInterfaceSkeletonClass) OverrideGAuthorizeMethod

func (x *DBusInterfaceSkeletonClass) OverrideGAuthorizeMethod(cb func(*DBusInterfaceSkeleton, *DBusMethodInvocation) bool)

OverrideGAuthorizeMethod sets the "g_authorize_method" callback function. Signal class handler for the #GDBusInterfaceSkeleton::g-authorize-method signal.

func (*DBusInterfaceSkeletonClass) OverrideGetInfo

OverrideGetInfo sets the "get_info" callback function. Returns a #GDBusInterfaceInfo. See g_dbus_interface_skeleton_get_info() for details.

func (*DBusInterfaceSkeletonClass) OverrideGetProperties

func (x *DBusInterfaceSkeletonClass) OverrideGetProperties(cb func(*DBusInterfaceSkeleton) *glib.Variant)

OverrideGetProperties sets the "get_properties" callback function. Returns a #GVariant with all properties. See g_dbus_interface_skeleton_get_properties().

func (*DBusInterfaceSkeletonClass) OverrideGetVtable

func (x *DBusInterfaceSkeletonClass) OverrideGetVtable(cb func(*DBusInterfaceSkeleton) *DBusInterfaceVTable)

OverrideGetVtable sets the "get_vtable" callback function. Returns a #GDBusInterfaceVTable. See g_dbus_interface_skeleton_get_vtable() for details.

func (*DBusInterfaceSkeletonClass) OverrideMethodDispatch added in v0.5.0

OverrideMethodDispatch sets the "method_dispatch" callback function. Dispatches a method invocation. (Since: 2.88)

type DBusInterfaceSkeletonFlags

type DBusInterfaceSkeletonFlags int

Flags describing the behavior of a #GDBusInterfaceSkeleton instance.

const (

	// No flags set.
	GDbusInterfaceSkeletonFlagsNoneValue DBusInterfaceSkeletonFlags = 0
	// 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.
	GDbusInterfaceSkeletonFlagsHandleMethodInvocationsInThreadValue DBusInterfaceSkeletonFlags = 1
)

type DBusInterfaceSkeletonPrivate

type DBusInterfaceSkeletonPrivate struct {
	// contains filtered or unexported fields
}

func (*DBusInterfaceSkeletonPrivate) GoPointer

func (x *DBusInterfaceSkeletonPrivate) GoPointer() uintptr

type DBusInterfaceVTable

type DBusInterfaceVTable struct {
	MethodCall DBusInterfaceMethodCallFunc

	GetProperty DBusInterfaceGetPropertyFunc

	SetProperty DBusInterfaceSetPropertyFunc

	Padding [8]uintptr
	// contains filtered or unexported fields
}

Virtual table for handling properties and method calls for a D-Bus interface.

Since 2.38, if you want to handle getting/setting D-Bus properties asynchronously, give %NULL as your get_property() or set_property() function. The D-Bus call will be directed to your @method_call function, with the provided @interface_name set to "org.freedesktop.DBus.Properties".

Ownership of the #GDBusMethodInvocation object passed to the method_call() function is transferred to your handler; you must call one of the methods of #GDBusMethodInvocation to return a reply (possibly empty), or an error. These functions also take ownership of the passed-in invocation object, so unless the invocation object has otherwise been referenced, it will be then be freed. Calling one of these functions may be done within your method_call() implementation but it also can be done at a later point to handle the method asynchronously.

The usual checks on the validity of the calls is performed. For `Get` calls, an error is automatically returned if the property does not exist or the permissions do not allow access. The same checks are performed for `Set` calls, and the provided value is also checked for being the correct type.

For both `Get` and `Set` calls, the #GDBusMethodInvocation passed to the @method_call handler can be queried with g_dbus_method_invocation_get_property_info() to get a pointer to the #GDBusPropertyInfo of the property.

If you have readable properties specified in your interface info, you must ensure that you either provide a non-%NULL @get_property() function or provide implementations of both the `Get` and `GetAll` methods on org.freedesktop.DBus.Properties interface in your @method_call function. Note that the required return type of the `Get` call is `(v)`, not the type of the property. `GetAll` expects a return value of type `a{sv}`.

If you have writable properties specified in your interface info, you must ensure that you either provide a non-%NULL @set_property() function or provide an implementation of the `Set` call. If implementing the call, you must return the value of type %G_VARIANT_TYPE_UNIT.

func (*DBusInterfaceVTable) GoPointer

func (x *DBusInterfaceVTable) GoPointer() uintptr

type DBusMenuModel

type DBusMenuModel struct {
	MenuModel
}

`GDBusMenuModel` is an implementation of [class@Gio.MenuModel] that can be used as a proxy for a menu model that is exported over D-Bus with [method@Gio.DBusConnection.export_menu_model].

func DBusMenuModelGet

func DBusMenuModelGet(ConnectionVar *DBusConnection, BusNameVar *string, ObjectPathVar string) *DBusMenuModel

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.

func DBusMenuModelNewFromInternalPtr

func DBusMenuModelNewFromInternalPtr(ptr uintptr) *DBusMenuModel

func (*DBusMenuModel) GoPointer

func (c *DBusMenuModel) GoPointer() uintptr

func (*DBusMenuModel) SetGoPointer

func (c *DBusMenuModel) SetGoPointer(ptr uintptr)

type DBusMessage

type DBusMessage struct {
	gobject.Object
}

A type for representing D-Bus messages that can be sent or received on a [class@Gio.DBusConnection].

func DBusMessageNewFromInternalPtr

func DBusMessageNewFromInternalPtr(ptr uintptr) *DBusMessage

func NewDBusMessage

func NewDBusMessage() *DBusMessage

Creates a new empty #GDBusMessage.

func NewDBusMessageFromBlob

func NewDBusMessageFromBlob(BlobVar []byte, BlobLenVar uint, CapabilitiesVar DBusCapabilityFlags) (*DBusMessage, error)

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.

func NewDBusMessageMethodCall

func NewDBusMessageMethodCall(NameVar *string, PathVar string, InterfaceVar *string, MethodVar string) *DBusMessage

Creates a new #GDBusMessage for a method call.

func NewDBusMessageSignal

func NewDBusMessageSignal(PathVar string, InterfaceVar string, SignalVar string) *DBusMessage

Creates a new #GDBusMessage for a signal emission.

func (*DBusMessage) Copy

func (x *DBusMessage) Copy() (*DBusMessage, error)

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.

func (*DBusMessage) GetArg0

func (x *DBusMessage) GetArg0() string

Convenience to get the first item in the body of @message.

See [method@Gio.DBusMessage.get_arg0_path] for returning object-path-typed arg0 values.

func (*DBusMessage) GetArg0Path

func (x *DBusMessage) GetArg0Path() string

Convenience to get the first item in the body of @message.

See [method@Gio.DBusMessage.get_arg0] for returning string-typed arg0 values.

func (*DBusMessage) GetBody

func (x *DBusMessage) GetBody() *glib.Variant

Gets the body of a message.

func (*DBusMessage) GetByteOrder

func (x *DBusMessage) GetByteOrder() DBusMessageByteOrder

Gets the byte order of @message.

func (*DBusMessage) GetDestination

func (x *DBusMessage) GetDestination() string

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.

func (*DBusMessage) GetErrorName

func (x *DBusMessage) GetErrorName() string

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.

func (*DBusMessage) GetFlags

func (x *DBusMessage) GetFlags() DBusMessageFlags

Gets the flags for @message.

func (*DBusMessage) GetHeader

func (x *DBusMessage) GetHeader(HeaderFieldVar DBusMessageHeaderField) *glib.Variant

Gets a header field on @message.

The caller is responsible for checking the type of the returned #GVariant matches what is expected.

func (*DBusMessage) GetHeaderFields

func (x *DBusMessage) GetHeaderFields() uintptr

Gets an array of all header fields on @message that are set.

func (*DBusMessage) GetInterface

func (x *DBusMessage) GetInterface() string

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.

func (*DBusMessage) GetLocked

func (x *DBusMessage) GetLocked() bool

Checks whether @message is locked. To monitor changes to this value, connect to the #GObject::notify signal to listen for changes on the #GDBusMessage:locked property.

func (*DBusMessage) GetMember

func (x *DBusMessage) GetMember() string

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.

func (*DBusMessage) GetMessageType

func (x *DBusMessage) GetMessageType() DBusMessageType

Gets the type of @message.

func (*DBusMessage) GetNumUnixFds

func (x *DBusMessage) GetNumUnixFds() uint32

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.

func (*DBusMessage) GetPath

func (x *DBusMessage) GetPath() string

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.

func (*DBusMessage) GetPropertyLocked

func (x *DBusMessage) GetPropertyLocked() bool

GetPropertyLocked gets the "locked" property.

func (*DBusMessage) GetReplySerial

func (x *DBusMessage) GetReplySerial() uint32

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.

func (*DBusMessage) GetSender

func (x *DBusMessage) GetSender() string

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.

func (*DBusMessage) GetSerial

func (x *DBusMessage) GetSerial() uint32

Gets the serial for @message.

func (*DBusMessage) GetSignature

func (x *DBusMessage) GetSignature() string

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.

This will always be non-%NULL, but may be an empty string.

func (*DBusMessage) GetUnixFdList

func (x *DBusMessage) GetUnixFdList() *UnixFDList

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, ...)`.

func (*DBusMessage) GoPointer

func (c *DBusMessage) GoPointer() uintptr

func (*DBusMessage) Lock

func (x *DBusMessage) Lock()

If @message is locked, does nothing. Otherwise locks the message.

func (*DBusMessage) NewMethodError

func (x *DBusMessage) NewMethodError(ErrorNameVar string, ErrorMessageFormatVar string, varArgs ...interface{}) *DBusMessage

Creates a new #GDBusMessage that is an error reply to @method_call_message.

func (*DBusMessage) NewMethodErrorLiteral

func (x *DBusMessage) NewMethodErrorLiteral(ErrorNameVar string, ErrorMessageVar string) *DBusMessage

Creates a new #GDBusMessage that is an error reply to @method_call_message.

func (*DBusMessage) NewMethodErrorValist

func (x *DBusMessage) NewMethodErrorValist(ErrorNameVar string, ErrorMessageFormatVar string, VarArgsVar []interface{}) *DBusMessage

Like g_dbus_message_new_method_error() but intended for language bindings.

func (*DBusMessage) NewMethodReply

func (x *DBusMessage) NewMethodReply() *DBusMessage

Creates a new #GDBusMessage that is a reply to @method_call_message.

func (*DBusMessage) Print

func (x *DBusMessage) Print(IndentVar uint) string

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

```

func (*DBusMessage) SetBody

func (x *DBusMessage) SetBody(BodyVar *glib.Variant)

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.

func (*DBusMessage) SetByteOrder

func (x *DBusMessage) SetByteOrder(ByteOrderVar DBusMessageByteOrder)

Sets the byte order of @message.

func (*DBusMessage) SetDestination

func (x *DBusMessage) SetDestination(ValueVar *string)

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.

func (*DBusMessage) SetErrorName

func (x *DBusMessage) SetErrorName(ValueVar string)

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.

func (*DBusMessage) SetFlags

func (x *DBusMessage) SetFlags(FlagsVar DBusMessageFlags)

Sets the flags to set on @message.

func (*DBusMessage) SetGoPointer

func (c *DBusMessage) SetGoPointer(ptr uintptr)

func (*DBusMessage) SetHeader

func (x *DBusMessage) SetHeader(HeaderFieldVar DBusMessageHeaderField, ValueVar *glib.Variant)

Sets a header field on @message.

If @value is floating, @message assumes ownership of @value.

func (*DBusMessage) SetInterface

func (x *DBusMessage) SetInterface(ValueVar *string)

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.

func (*DBusMessage) SetMember

func (x *DBusMessage) SetMember(ValueVar *string)

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.

func (*DBusMessage) SetMessageType

func (x *DBusMessage) SetMessageType(TypeVar DBusMessageType)

Sets @message to be of @type.

func (*DBusMessage) SetNumUnixFds

func (x *DBusMessage) SetNumUnixFds(ValueVar uint32)

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.

func (*DBusMessage) SetPath

func (x *DBusMessage) SetPath(ValueVar *string)

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.

func (*DBusMessage) SetReplySerial

func (x *DBusMessage) SetReplySerial(ValueVar uint32)

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.

func (*DBusMessage) SetSender

func (x *DBusMessage) SetSender(ValueVar *string)

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.

func (*DBusMessage) SetSerial

func (x *DBusMessage) SetSerial(SerialVar uint32)

Sets the serial for @message.

The [D-Bus specification](https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages) does not allow the @serial to be zero.

func (*DBusMessage) SetSignature

func (x *DBusMessage) SetSignature(ValueVar *string)

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.

func (*DBusMessage) SetUnixFdList

func (x *DBusMessage) SetUnixFdList(FdListVar *UnixFDList)

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.

func (*DBusMessage) ToBlob

func (x *DBusMessage) ToBlob(OutSizeVar *uint, CapabilitiesVar DBusCapabilityFlags) (uintptr, error)

Serializes @message to a blob. The byte order returned by g_dbus_message_get_byte_order() will be used.

func (*DBusMessage) ToGerror

func (x *DBusMessage) ToGerror() (bool, error)

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.

type DBusMessageByteOrder

type DBusMessageByteOrder int

Enumeration used to describe the byte order of a D-Bus message.

const (

	// The byte order is big endian.
	GDbusMessageByteOrderBigEndianValue DBusMessageByteOrder = 66
	// The byte order is little endian.
	GDbusMessageByteOrderLittleEndianValue DBusMessageByteOrder = 108
)

type DBusMessageFilterFunction

type DBusMessageFilterFunction func(uintptr, uintptr, bool, uintptr) uintptr

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.

type DBusMessageFlags

type DBusMessageFlags int

Message flags used in #GDBusMessage.

const (

	// No flags set.
	GDbusMessageFlagsNoneValue DBusMessageFlags = 0
	// A reply is not expected.
	GDbusMessageFlagsNoReplyExpectedValue DBusMessageFlags = 1
	// The bus must not launch an
	// owner for the destination name in response to this message.
	GDbusMessageFlagsNoAutoStartValue DBusMessageFlags = 2
	// If set on a method
	// call, this flag means that the caller is prepared to wait for interactive
	// authorization. Since 2.46.
	GDbusMessageFlagsAllowInteractiveAuthorizationValue DBusMessageFlags = 4
)

type DBusMessageHeaderField

type DBusMessageHeaderField int

Header fields used in #GDBusMessage.

const (

	// Not a valid header field.
	GDbusMessageHeaderFieldInvalidValue DBusMessageHeaderField = 0
	// The object path.
	GDbusMessageHeaderFieldPathValue DBusMessageHeaderField = 1
	// The interface name.
	GDbusMessageHeaderFieldInterfaceValue DBusMessageHeaderField = 2
	// The method or signal name.
	GDbusMessageHeaderFieldMemberValue DBusMessageHeaderField = 3
	// The name of the error that occurred.
	GDbusMessageHeaderFieldErrorNameValue DBusMessageHeaderField = 4
	// The serial number the message is a reply to.
	GDbusMessageHeaderFieldReplySerialValue DBusMessageHeaderField = 5
	// The name the message is intended for.
	GDbusMessageHeaderFieldDestinationValue DBusMessageHeaderField = 6
	// Unique name of the sender of the message (filled in by the bus).
	GDbusMessageHeaderFieldSenderValue DBusMessageHeaderField = 7
	// The signature of the message body.
	GDbusMessageHeaderFieldSignatureValue DBusMessageHeaderField = 8
	// The number of UNIX file descriptors that accompany the message.
	GDbusMessageHeaderFieldNumUnixFdsValue DBusMessageHeaderField = 9
)

type DBusMessageType

type DBusMessageType int

Message types used in #GDBusMessage.

const (

	// Message is of invalid type.
	GDbusMessageTypeInvalidValue DBusMessageType = 0
	// Method call.
	GDbusMessageTypeMethodCallValue DBusMessageType = 1
	// Method reply.
	GDbusMessageTypeMethodReturnValue DBusMessageType = 2
	// Error reply.
	GDbusMessageTypeErrorValue DBusMessageType = 3
	// Signal emission.
	GDbusMessageTypeSignalValue DBusMessageType = 4
)

type DBusMethodInfo

type DBusMethodInfo struct {
	RefCount int32

	Name uintptr

	InArgs uintptr

	OutArgs uintptr

	Annotations uintptr
	// contains filtered or unexported fields
}

Information about a method on a D-Bus interface.

func (*DBusMethodInfo) GoPointer

func (x *DBusMethodInfo) GoPointer() uintptr

func (*DBusMethodInfo) Ref

func (x *DBusMethodInfo) Ref() *DBusMethodInfo

If @info is statically allocated does nothing. Otherwise increases the reference count.

func (*DBusMethodInfo) Unref

func (x *DBusMethodInfo) Unref()

If @info is statically allocated, does nothing. Otherwise decreases the reference count of @info. When its reference count drops to 0, the memory used is freed.

type DBusMethodInvocation

type DBusMethodInvocation struct {
	gobject.Object
}

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 [type@Gio.DBusInterfaceVTable] that was passed to [method@Gio.DBusConnection.register_object].

func DBusMethodInvocationNewFromInternalPtr

func DBusMethodInvocationNewFromInternalPtr(ptr uintptr) *DBusMethodInvocation

func (*DBusMethodInvocation) GetConnection

func (x *DBusMethodInvocation) GetConnection() *DBusConnection

Gets the #GDBusConnection the method was invoked on.

func (*DBusMethodInvocation) GetInterfaceName

func (x *DBusMethodInvocation) GetInterfaceName() string

Gets the name of the D-Bus interface the method was invoked on.

This can be `NULL` if it was not specified by the sender. See [callback@Gio.DBusInterfaceMethodCallFunc] or the [D-Bus Specification](https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-types-method) for details on when this can happen and how it should be handled.

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.

func (*DBusMethodInvocation) GetMessage

func (x *DBusMethodInvocation) GetMessage() *DBusMessage

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][class@Gio.DBusConnection#an-example-d-bus-server] and [client][class@Gio.DBusConnection#an-example-for-file-descriptor-passing] for an example of how to use this low-level API to send and receive UNIX file descriptors.

func (*DBusMethodInvocation) GetMethodInfo

func (x *DBusMethodInvocation) GetMethodInfo() *DBusMethodInfo

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.

func (*DBusMethodInvocation) GetMethodName

func (x *DBusMethodInvocation) GetMethodName() string

Gets the name of the method that was invoked.

func (*DBusMethodInvocation) GetObjectPath

func (x *DBusMethodInvocation) GetObjectPath() string

Gets the object path the method was invoked on.

func (*DBusMethodInvocation) GetParameters

func (x *DBusMethodInvocation) GetParameters() *glib.Variant

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.

func (*DBusMethodInvocation) GetPropertyInfo

func (x *DBusMethodInvocation) GetPropertyInfo() *DBusPropertyInfo

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.

func (*DBusMethodInvocation) GetSender

func (x *DBusMethodInvocation) GetSender() string

Gets the bus name that invoked the method.

This can return %NULL if not specified by the caller, e.g. on peer-to-peer connections.

func (*DBusMethodInvocation) GetUserData

func (x *DBusMethodInvocation) GetUserData() uintptr

Gets the @user_data #gpointer passed to g_dbus_connection_register_object().

func (*DBusMethodInvocation) GoPointer

func (c *DBusMethodInvocation) GoPointer() uintptr

func (*DBusMethodInvocation) ReturnDbusError

func (x *DBusMethodInvocation) ReturnDbusError(ErrorNameVar string, ErrorMessageVar string)

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.

func (*DBusMethodInvocation) ReturnError

func (x *DBusMethodInvocation) ReturnError(DomainVar glib.Quark, CodeVar int, FormatVar string, varArgs ...interface{})

Finishes handling a D-Bus method call by returning an error.

See g_dbus_error_encode_gerror() for details about what error name will be returned on the wire. In a nutshell, if the given error is registered using g_dbus_error_register_error() the name given during registration is used. Otherwise, a name of the form `org.gtk.GDBus.UnmappedGError.Quark...` is used. This provides transparent mapping of #GError between applications using GDBus.

If you are writing an application intended to be portable, always register errors with g_dbus_error_register_error() or use g_dbus_method_invocation_return_dbus_error().

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 free @invocation but otherwise do nothing (as per the recommendations of the D-Bus specification).

func (*DBusMethodInvocation) ReturnErrorLiteral

func (x *DBusMethodInvocation) ReturnErrorLiteral(DomainVar glib.Quark, CodeVar int, MessageVar string)

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.

func (*DBusMethodInvocation) ReturnErrorValist

func (x *DBusMethodInvocation) ReturnErrorValist(DomainVar glib.Quark, CodeVar int, FormatVar string, VarArgsVar []interface{})

Like g_dbus_method_invocation_return_error() but intended for language bindings.

This method will take ownership of @invocation. See #GDBusInterfaceVTable for more information about the ownership of @invocation.

func (*DBusMethodInvocation) ReturnGerror

func (x *DBusMethodInvocation) ReturnGerror(ErrorVar *glib.Error)

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.

func (*DBusMethodInvocation) ReturnValue

func (x *DBusMethodInvocation) ReturnValue(ParametersVar *glib.Variant)

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.

|[<!-- language="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).

func (*DBusMethodInvocation) ReturnValueWithUnixFdList

func (x *DBusMethodInvocation) ReturnValueWithUnixFdList(ParametersVar *glib.Variant, FdListVar *UnixFDList)

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.

func (*DBusMethodInvocation) SetGoPointer

func (c *DBusMethodInvocation) SetGoPointer(ptr uintptr)

func (*DBusMethodInvocation) TakeError

func (x *DBusMethodInvocation) TakeError(ErrorVar *glib.Error)

Like g_dbus_method_invocation_return_gerror() but takes ownership of @error so the caller does not need to free it.

This method will take ownership of @invocation. See #GDBusInterfaceVTable for more information about the ownership of @invocation.

type DBusNodeInfo

type DBusNodeInfo struct {
	RefCount int32

	Path uintptr

	Interfaces uintptr

	Nodes uintptr

	Annotations uintptr
	// contains filtered or unexported fields
}

Information about nodes in a remote object hierarchy.

func NewDBusNodeInfoForXml

func NewDBusNodeInfoForXml(XmlDataVar string) (*DBusNodeInfo, error)

Parses @xml_data and returns a #GDBusNodeInfo representing the data.

The introspection XML must contain exactly one top-level `<node>` element.

Note that this routine is using a [GMarkup](../glib/markup.html)-based parser that only accepts a subset of valid XML documents.

func (*DBusNodeInfo) GenerateXml

func (x *DBusNodeInfo) GenerateXml(IndentVar uint, StringBuilderVar *glib.String)

Appends an XML representation of @info (and its children) to @string_builder.

This function is typically used for generating introspection XML documents at run-time for handling the `org.freedesktop.DBus.Introspectable.Introspect` method.

func (*DBusNodeInfo) GoPointer

func (x *DBusNodeInfo) GoPointer() uintptr

func (*DBusNodeInfo) LookupInterface

func (x *DBusNodeInfo) LookupInterface(NameVar string) *DBusInterfaceInfo

Looks up information about an interface.

The cost of this function is O(n) in number of interfaces.

func (*DBusNodeInfo) Ref

func (x *DBusNodeInfo) Ref() *DBusNodeInfo

If @info is statically allocated does nothing. Otherwise increases the reference count.

func (*DBusNodeInfo) Unref

func (x *DBusNodeInfo) Unref()

If @info is statically allocated, does nothing. Otherwise decreases the reference count of @info. When its reference count drops to 0, the memory used is freed.

type DBusObject

type DBusObject interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	GetInterface(InterfaceNameVar string) *DBusInterfaceBase
	GetInterfaces() *glib.List
	GetObjectPath() string
}

The `GDBusObject` type is the base type for D-Bus objects on both the service side (see [class@Gio.DBusObjectSkeleton]) and the client side (see [class@Gio.DBusObjectProxy]). It is essentially just a container of interfaces.

type DBusObjectBase

type DBusObjectBase struct {
	Ptr uintptr
}

func (*DBusObjectBase) GetInterface

func (x *DBusObjectBase) GetInterface(InterfaceNameVar string) *DBusInterfaceBase

Gets the D-Bus interface with name @interface_name associated with @object, if any.

func (*DBusObjectBase) GetInterfaces

func (x *DBusObjectBase) GetInterfaces() *glib.List

Gets the D-Bus interfaces associated with @object.

func (*DBusObjectBase) GetObjectPath

func (x *DBusObjectBase) GetObjectPath() string

Gets the object path for @object.

func (*DBusObjectBase) GoPointer

func (x *DBusObjectBase) GoPointer() uintptr

func (*DBusObjectBase) SetGoPointer

func (x *DBusObjectBase) SetGoPointer(ptr uintptr)

type DBusObjectIface

type DBusObjectIface struct {
	ParentIface uintptr
	// contains filtered or unexported fields
}

Base object type for D-Bus objects.

func (*DBusObjectIface) GetGetInterface

func (x *DBusObjectIface) GetGetInterface() func(DBusObject, string) *DBusInterfaceBase

GetGetInterface gets the "get_interface" callback function. Returns an interface by name. See g_dbus_object_get_interface().

func (*DBusObjectIface) GetGetInterfaces

func (x *DBusObjectIface) GetGetInterfaces() func(DBusObject) *glib.List

GetGetInterfaces gets the "get_interfaces" callback function. Returns all interfaces. See g_dbus_object_get_interfaces().

func (*DBusObjectIface) GetGetObjectPath

func (x *DBusObjectIface) GetGetObjectPath() func(DBusObject) string

GetGetObjectPath gets the "get_object_path" callback function. Returns the object path. See g_dbus_object_get_object_path().

func (*DBusObjectIface) GetInterfaceAdded

func (x *DBusObjectIface) GetInterfaceAdded() func(DBusObject, DBusInterface)

GetInterfaceAdded gets the "interface_added" callback function. Signal handler for the #GDBusObject::interface-added signal.

func (*DBusObjectIface) GetInterfaceRemoved

func (x *DBusObjectIface) GetInterfaceRemoved() func(DBusObject, DBusInterface)

GetInterfaceRemoved gets the "interface_removed" callback function. Signal handler for the #GDBusObject::interface-removed signal.

func (*DBusObjectIface) GoPointer

func (x *DBusObjectIface) GoPointer() uintptr

func (*DBusObjectIface) OverrideGetInterface

func (x *DBusObjectIface) OverrideGetInterface(cb func(DBusObject, string) *DBusInterfaceBase)

OverrideGetInterface sets the "get_interface" callback function. Returns an interface by name. See g_dbus_object_get_interface().

func (*DBusObjectIface) OverrideGetInterfaces

func (x *DBusObjectIface) OverrideGetInterfaces(cb func(DBusObject) *glib.List)

OverrideGetInterfaces sets the "get_interfaces" callback function. Returns all interfaces. See g_dbus_object_get_interfaces().

func (*DBusObjectIface) OverrideGetObjectPath

func (x *DBusObjectIface) OverrideGetObjectPath(cb func(DBusObject) string)

OverrideGetObjectPath sets the "get_object_path" callback function. Returns the object path. See g_dbus_object_get_object_path().

func (*DBusObjectIface) OverrideInterfaceAdded

func (x *DBusObjectIface) OverrideInterfaceAdded(cb func(DBusObject, DBusInterface))

OverrideInterfaceAdded sets the "interface_added" callback function. Signal handler for the #GDBusObject::interface-added signal.

func (*DBusObjectIface) OverrideInterfaceRemoved

func (x *DBusObjectIface) OverrideInterfaceRemoved(cb func(DBusObject, DBusInterface))

OverrideInterfaceRemoved sets the "interface_removed" callback function. Signal handler for the #GDBusObject::interface-removed signal.

type DBusObjectManager

type DBusObjectManager interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	GetInterface(ObjectPathVar string, InterfaceNameVar string) *DBusInterfaceBase
	GetObject(ObjectPathVar string) *DBusObjectBase
	GetObjectPath() string
	GetObjects() *glib.List
}

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 [class@Gio.DBusObjectManagerClient] for the client-side implementation and [class@Gio.DBusObjectManagerServer] for the service-side implementation.

type DBusObjectManagerBase

type DBusObjectManagerBase struct {
	Ptr uintptr
}

func (*DBusObjectManagerBase) GetInterface

func (x *DBusObjectManagerBase) GetInterface(ObjectPathVar string, InterfaceNameVar string) *DBusInterfaceBase

Gets the interface proxy for @interface_name at @object_path, if any.

func (*DBusObjectManagerBase) GetObject

func (x *DBusObjectManagerBase) GetObject(ObjectPathVar string) *DBusObjectBase

Gets the #GDBusObject at @object_path, if any.

func (*DBusObjectManagerBase) GetObjectPath

func (x *DBusObjectManagerBase) GetObjectPath() string

Gets the object path that @manager is for.

func (*DBusObjectManagerBase) GetObjects

func (x *DBusObjectManagerBase) GetObjects() *glib.List

Gets all #GDBusObject objects known to @manager.

func (*DBusObjectManagerBase) GoPointer

func (x *DBusObjectManagerBase) GoPointer() uintptr

func (*DBusObjectManagerBase) SetGoPointer

func (x *DBusObjectManagerBase) SetGoPointer(ptr uintptr)

type DBusObjectManagerClient

type DBusObjectManagerClient struct {
	gobject.Object
}

`GDBusObjectManagerClient` is used to create, monitor and delete object proxies for remote objects exported by a [class@Gio.DBusObjectManagerServer] (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 [signal@Gio.DBusObjectManager::object-added] and [signal@Gio.DBusObjectManager::object-removed signals] and inspect the [class@Gio.DBusObjectProxy] objects returned by [method@Gio.DBusObjectManager.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. [method@Gio.DBusObjectManager.get_objects] returns the empty list) and the [property@Gio.DBusObjectManagerClient: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 [signal@GObject.Object::notify] signal to watch for changes on the [property@Gio.DBusObjectManagerClient:name-owner] property. When the name owner vanishes, the behavior is that [property@Gio.DBusObjectManagerClient:name-owner] is set to `NULL` (this includes emission of the [signal@GObject.Object::notify] signal) and then [signal@Gio.DBusObjectManager::object-removed] signals are synthesized for all currently existing object proxies. Since [property@Gio.DBusObjectManagerClient: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 [iface@Gio.DBusObjectManager]. Similarly, when a new name owner appears, [signal@Gio.DBusObjectManager::object-added] signals are synthesized while [property@Gio.DBusObjectManagerClient:name-owner] is still `NULL`. Only when all object proxies have been added, the [property@Gio.DBusObjectManagerClient:name-owner] is set to the new name owner (this includes emission of the [signal@GObject.Object::notify] signal). Furthermore, you are guaranteed that [property@Gio.DBusObjectManagerClient: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 [class@Gio.DBusProxy] instances. All signals (including the `org.freedesktop.DBus.Properties::PropertiesChanged` signal) delivered to [class@Gio.DBusProxy] 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 [class@Gio.DBusObjectProxy] and [class@Gio.DBusProxy] objects, the [signal@Gio.DBusObject::interface-added], [signal@Gio.DBusObject::interface-removed], [signal@Gio.DBusProxy::g-properties-changed] and [signal@Gio.DBusProxy::g-signal] signals are also emitted on the `GDBusObjectManagerClient` instance managing these objects. The signals emitted are [signal@Gio.DBusObjectManager::interface-added], [signal@Gio.DBusObjectManager::interface-removed], [signal@Gio.DBusObjectManagerClient::interface-proxy-properties-changed] and [signal@Gio.DBusObjectManagerClient::interface-proxy-signal].

Note that all callbacks and signals are emitted in the thread-default main context (see [method@GLib.MainContext.push_thread_default]) that the `GDBusObjectManagerClient` object was constructed in. Additionally, the [class@Gio.DBusObjectProxy] and [class@Gio.DBusProxy] objects originating from the `GDBusObjectManagerClient` object will be created in the same context and, consequently, will deliver signals in the same main loop.

func DBusObjectManagerClientNewFromInternalPtr

func DBusObjectManagerClientNewFromInternalPtr(ptr uintptr) *DBusObjectManagerClient

func NewDBusObjectManagerClientFinish

func NewDBusObjectManagerClientFinish(ResVar AsyncResult) (*DBusObjectManagerClient, error)

Finishes an operation started with g_dbus_object_manager_client_new().

func NewDBusObjectManagerClientForBusFinish

func NewDBusObjectManagerClientForBusFinish(ResVar AsyncResult) (*DBusObjectManagerClient, error)

Finishes an operation started with g_dbus_object_manager_client_new_for_bus().

func NewDBusObjectManagerClientForBusSync

func NewDBusObjectManagerClientForBusSync(BusTypeVar BusType, FlagsVar DBusObjectManagerClientFlags, NameVar string, ObjectPathVar string, GetProxyTypeFuncVar *DBusProxyTypeFunc, GetProxyTypeUserDataVar uintptr, GetProxyTypeDestroyNotifyVar *glib.DestroyNotify, CancellableVar *Cancellable) (*DBusObjectManagerClient, error)

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.

func NewDBusObjectManagerClientSync

func NewDBusObjectManagerClientSync(ConnectionVar *DBusConnection, FlagsVar DBusObjectManagerClientFlags, NameVar *string, ObjectPathVar string, GetProxyTypeFuncVar *DBusProxyTypeFunc, GetProxyTypeUserDataVar uintptr, GetProxyTypeDestroyNotifyVar *glib.DestroyNotify, CancellableVar *Cancellable) (*DBusObjectManagerClient, error)

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.

func (*DBusObjectManagerClient) ConnectInterfaceProxyPropertiesChanged

func (x *DBusObjectManagerClient) ConnectInterfaceProxyPropertiesChanged(cb *func(DBusObjectManagerClient, uintptr, uintptr, uintptr, []string)) uint

Emitted when one or more D-Bus properties on proxy changes. The local cache has already been updated when this signal fires. Note that both @changed_properties and @invalidated_properties are guaranteed to never be %NULL (either may be empty though).

This signal exists purely as a convenience to avoid having to connect signals to all interface proxies managed by @manager.

This signal is emitted in the thread-default main context (see [method@GLib.MainContext.push_thread_default]) that @manager was constructed in.

func (*DBusObjectManagerClient) ConnectInterfaceProxySignal

func (x *DBusObjectManagerClient) ConnectInterfaceProxySignal(cb *func(DBusObjectManagerClient, uintptr, uintptr, string, string, uintptr)) uint

Emitted when a D-Bus signal is received on @interface_proxy.

This signal exists purely as a convenience to avoid having to connect signals to all interface proxies managed by @manager.

This signal is emitted in the thread-default main context (see [method@GLib.MainContext.push_thread_default]) that @manager was constructed in.

func (*DBusObjectManagerClient) GetConnection

func (x *DBusObjectManagerClient) GetConnection() *DBusConnection

Gets the #GDBusConnection used by @manager.

func (*DBusObjectManagerClient) GetFlags

Gets the flags that @manager was constructed with.

func (*DBusObjectManagerClient) GetInterface

func (x *DBusObjectManagerClient) GetInterface(ObjectPathVar string, InterfaceNameVar string) *DBusInterfaceBase

Gets the interface proxy for @interface_name at @object_path, if any.

func (*DBusObjectManagerClient) GetName

func (x *DBusObjectManagerClient) GetName() string

Gets the name that @manager is for, or %NULL if not a message bus connection.

func (*DBusObjectManagerClient) GetNameOwner

func (x *DBusObjectManagerClient) GetNameOwner() string

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.

func (*DBusObjectManagerClient) GetObject

func (x *DBusObjectManagerClient) GetObject(ObjectPathVar string) *DBusObjectBase

Gets the #GDBusObject at @object_path, if any.

func (*DBusObjectManagerClient) GetObjectPath

func (x *DBusObjectManagerClient) GetObjectPath() string

Gets the object path that @manager is for.

func (*DBusObjectManagerClient) GetObjects

func (x *DBusObjectManagerClient) GetObjects() *glib.List

Gets all #GDBusObject objects known to @manager.

func (*DBusObjectManagerClient) GetPropertyGetProxyTypeDestroyNotify

func (x *DBusObjectManagerClient) GetPropertyGetProxyTypeDestroyNotify() uintptr

GetPropertyGetProxyTypeDestroyNotify gets the "get-proxy-type-destroy-notify" property. A #GDestroyNotify for the #gpointer user_data in #GDBusObjectManagerClient:get-proxy-type-user-data.

func (*DBusObjectManagerClient) GetPropertyGetProxyTypeFunc

func (x *DBusObjectManagerClient) GetPropertyGetProxyTypeFunc() uintptr

GetPropertyGetProxyTypeFunc gets the "get-proxy-type-func" property. The #GDBusProxyTypeFunc to use when determining what #GType to use for interface proxies or %NULL.

func (*DBusObjectManagerClient) GetPropertyGetProxyTypeUserData

func (x *DBusObjectManagerClient) GetPropertyGetProxyTypeUserData() uintptr

GetPropertyGetProxyTypeUserData gets the "get-proxy-type-user-data" property. The #gpointer user_data to pass to #GDBusObjectManagerClient:get-proxy-type-func.

func (*DBusObjectManagerClient) GetPropertyName

func (x *DBusObjectManagerClient) GetPropertyName() string

GetPropertyName gets the "name" property. The well-known name or unique name that the manager is for.

func (*DBusObjectManagerClient) GetPropertyNameOwner

func (x *DBusObjectManagerClient) GetPropertyNameOwner() string

GetPropertyNameOwner gets the "name-owner" property. 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.

func (*DBusObjectManagerClient) GetPropertyObjectPath

func (x *DBusObjectManagerClient) GetPropertyObjectPath() string

GetPropertyObjectPath gets the "object-path" property. The object path the manager is for.

func (*DBusObjectManagerClient) GoPointer

func (c *DBusObjectManagerClient) GoPointer() uintptr

func (*DBusObjectManagerClient) Init

func (x *DBusObjectManagerClient) Init(CancellableVar *Cancellable) (bool, error)

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 [description][iface@Gio.Initable#description] 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.

func (*DBusObjectManagerClient) InitAsync

func (x *DBusObjectManagerClient) InitAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*DBusObjectManagerClient) InitFinish

func (x *DBusObjectManagerClient) InitFinish(ResVar AsyncResult) (bool, error)

Finishes asynchronous initialization and returns the result. See g_async_initable_init_async().

func (*DBusObjectManagerClient) NewFinish

func (x *DBusObjectManagerClient) NewFinish(ResVar AsyncResult) (*gobject.Object, error)

Finishes the async construction for the various g_async_initable_new calls, returning the created object or %NULL on error.

func (*DBusObjectManagerClient) SetGoPointer

func (c *DBusObjectManagerClient) SetGoPointer(ptr uintptr)

func (*DBusObjectManagerClient) SetPropertyGetProxyTypeDestroyNotify

func (x *DBusObjectManagerClient) SetPropertyGetProxyTypeDestroyNotify(value uintptr)

SetPropertyGetProxyTypeDestroyNotify sets the "get-proxy-type-destroy-notify" property. A #GDestroyNotify for the #gpointer user_data in #GDBusObjectManagerClient:get-proxy-type-user-data.

func (*DBusObjectManagerClient) SetPropertyGetProxyTypeFunc

func (x *DBusObjectManagerClient) SetPropertyGetProxyTypeFunc(value uintptr)

SetPropertyGetProxyTypeFunc sets the "get-proxy-type-func" property. The #GDBusProxyTypeFunc to use when determining what #GType to use for interface proxies or %NULL.

func (*DBusObjectManagerClient) SetPropertyGetProxyTypeUserData

func (x *DBusObjectManagerClient) SetPropertyGetProxyTypeUserData(value uintptr)

SetPropertyGetProxyTypeUserData sets the "get-proxy-type-user-data" property. The #gpointer user_data to pass to #GDBusObjectManagerClient:get-proxy-type-func.

func (*DBusObjectManagerClient) SetPropertyName

func (x *DBusObjectManagerClient) SetPropertyName(value string)

SetPropertyName sets the "name" property. The well-known name or unique name that the manager is for.

func (*DBusObjectManagerClient) SetPropertyObjectPath

func (x *DBusObjectManagerClient) SetPropertyObjectPath(value string)

SetPropertyObjectPath sets the "object-path" property. The object path the manager is for.

type DBusObjectManagerClientClass

type DBusObjectManagerClientClass struct {
	ParentClass gobject.ObjectClass

	Padding [8]uintptr
	// contains filtered or unexported fields
}

Class structure for #GDBusObjectManagerClient.

func (*DBusObjectManagerClientClass) GetInterfaceProxyPropertiesChanged

func (x *DBusObjectManagerClientClass) GetInterfaceProxyPropertiesChanged() func(*DBusObjectManagerClient, *DBusObjectProxy, *DBusProxy, *glib.Variant, string)

GetInterfaceProxyPropertiesChanged gets the "interface_proxy_properties_changed" callback function. Signal class handler for the #GDBusObjectManagerClient::interface-proxy-properties-changed signal.

func (*DBusObjectManagerClientClass) GetInterfaceProxySignal

GetInterfaceProxySignal gets the "interface_proxy_signal" callback function. Signal class handler for the #GDBusObjectManagerClient::interface-proxy-signal signal.

func (*DBusObjectManagerClientClass) GoPointer

func (x *DBusObjectManagerClientClass) GoPointer() uintptr

func (*DBusObjectManagerClientClass) OverrideInterfaceProxyPropertiesChanged

func (x *DBusObjectManagerClientClass) OverrideInterfaceProxyPropertiesChanged(cb func(*DBusObjectManagerClient, *DBusObjectProxy, *DBusProxy, *glib.Variant, string))

OverrideInterfaceProxyPropertiesChanged sets the "interface_proxy_properties_changed" callback function. Signal class handler for the #GDBusObjectManagerClient::interface-proxy-properties-changed signal.

func (*DBusObjectManagerClientClass) OverrideInterfaceProxySignal

func (x *DBusObjectManagerClientClass) OverrideInterfaceProxySignal(cb func(*DBusObjectManagerClient, *DBusObjectProxy, *DBusProxy, string, string, *glib.Variant))

OverrideInterfaceProxySignal sets the "interface_proxy_signal" callback function. Signal class handler for the #GDBusObjectManagerClient::interface-proxy-signal signal.

type DBusObjectManagerClientFlags

type DBusObjectManagerClientFlags int

Flags used when constructing a #GDBusObjectManagerClient.

const (

	// No flags set.
	GDbusObjectManagerClientFlagsNoneValue DBusObjectManagerClientFlags = 0
	// 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.
	GDbusObjectManagerClientFlagsDoNotAutoStartValue DBusObjectManagerClientFlags = 1
)

type DBusObjectManagerClientPrivate

type DBusObjectManagerClientPrivate struct {
	// contains filtered or unexported fields
}

func (*DBusObjectManagerClientPrivate) GoPointer

func (x *DBusObjectManagerClientPrivate) GoPointer() uintptr

type DBusObjectManagerIface

type DBusObjectManagerIface struct {
	ParentIface uintptr
	// contains filtered or unexported fields
}

Base type for D-Bus object managers.

func (*DBusObjectManagerIface) GetGetInterface

GetGetInterface gets the "get_interface" callback function. Virtual function for g_dbus_object_manager_get_interface().

func (*DBusObjectManagerIface) GetGetObject

GetGetObject gets the "get_object" callback function. Virtual function for g_dbus_object_manager_get_object().

func (*DBusObjectManagerIface) GetGetObjectPath

func (x *DBusObjectManagerIface) GetGetObjectPath() func(DBusObjectManager) string

GetGetObjectPath gets the "get_object_path" callback function. Virtual function for g_dbus_object_manager_get_object_path().

func (*DBusObjectManagerIface) GetGetObjects

func (x *DBusObjectManagerIface) GetGetObjects() func(DBusObjectManager) *glib.List

GetGetObjects gets the "get_objects" callback function. Virtual function for g_dbus_object_manager_get_objects().

func (*DBusObjectManagerIface) GetInterfaceAdded

func (x *DBusObjectManagerIface) GetInterfaceAdded() func(DBusObjectManager, DBusObject, DBusInterface)

GetInterfaceAdded gets the "interface_added" callback function. Signal handler for the #GDBusObjectManager::interface-added signal.

func (*DBusObjectManagerIface) GetInterfaceRemoved

func (x *DBusObjectManagerIface) GetInterfaceRemoved() func(DBusObjectManager, DBusObject, DBusInterface)

GetInterfaceRemoved gets the "interface_removed" callback function. Signal handler for the #GDBusObjectManager::interface-removed signal.

func (*DBusObjectManagerIface) GetObjectAdded

func (x *DBusObjectManagerIface) GetObjectAdded() func(DBusObjectManager, DBusObject)

GetObjectAdded gets the "object_added" callback function. Signal handler for the #GDBusObjectManager::object-added signal.

func (*DBusObjectManagerIface) GetObjectRemoved

func (x *DBusObjectManagerIface) GetObjectRemoved() func(DBusObjectManager, DBusObject)

GetObjectRemoved gets the "object_removed" callback function. Signal handler for the #GDBusObjectManager::object-removed signal.

func (*DBusObjectManagerIface) GoPointer

func (x *DBusObjectManagerIface) GoPointer() uintptr

func (*DBusObjectManagerIface) OverrideGetInterface

func (x *DBusObjectManagerIface) OverrideGetInterface(cb func(DBusObjectManager, string, string) *DBusInterfaceBase)

OverrideGetInterface sets the "get_interface" callback function. Virtual function for g_dbus_object_manager_get_interface().

func (*DBusObjectManagerIface) OverrideGetObject

func (x *DBusObjectManagerIface) OverrideGetObject(cb func(DBusObjectManager, string) *DBusObjectBase)

OverrideGetObject sets the "get_object" callback function. Virtual function for g_dbus_object_manager_get_object().

func (*DBusObjectManagerIface) OverrideGetObjectPath

func (x *DBusObjectManagerIface) OverrideGetObjectPath(cb func(DBusObjectManager) string)

OverrideGetObjectPath sets the "get_object_path" callback function. Virtual function for g_dbus_object_manager_get_object_path().

func (*DBusObjectManagerIface) OverrideGetObjects

func (x *DBusObjectManagerIface) OverrideGetObjects(cb func(DBusObjectManager) *glib.List)

OverrideGetObjects sets the "get_objects" callback function. Virtual function for g_dbus_object_manager_get_objects().

func (*DBusObjectManagerIface) OverrideInterfaceAdded

func (x *DBusObjectManagerIface) OverrideInterfaceAdded(cb func(DBusObjectManager, DBusObject, DBusInterface))

OverrideInterfaceAdded sets the "interface_added" callback function. Signal handler for the #GDBusObjectManager::interface-added signal.

func (*DBusObjectManagerIface) OverrideInterfaceRemoved

func (x *DBusObjectManagerIface) OverrideInterfaceRemoved(cb func(DBusObjectManager, DBusObject, DBusInterface))

OverrideInterfaceRemoved sets the "interface_removed" callback function. Signal handler for the #GDBusObjectManager::interface-removed signal.

func (*DBusObjectManagerIface) OverrideObjectAdded

func (x *DBusObjectManagerIface) OverrideObjectAdded(cb func(DBusObjectManager, DBusObject))

OverrideObjectAdded sets the "object_added" callback function. Signal handler for the #GDBusObjectManager::object-added signal.

func (*DBusObjectManagerIface) OverrideObjectRemoved

func (x *DBusObjectManagerIface) OverrideObjectRemoved(cb func(DBusObjectManager, DBusObject))

OverrideObjectRemoved sets the "object_removed" callback function. Signal handler for the #GDBusObjectManager::object-removed signal.

type DBusObjectManagerServer

type DBusObjectManagerServer struct {
	gobject.Object
}

`GDBusObjectManagerServer` is used to export [iface@Gio.DBusObject] 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 [class@Gio.DBusObjectManagerClient] 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.

func DBusObjectManagerServerNewFromInternalPtr

func DBusObjectManagerServerNewFromInternalPtr(ptr uintptr) *DBusObjectManagerServer

func NewDBusObjectManagerServer

func NewDBusObjectManagerServer(ObjectPathVar string) *DBusObjectManagerServer

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.

func (*DBusObjectManagerServer) Export

func (x *DBusObjectManagerServer) Export(ObjectVar *DBusObjectSkeleton)

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.

func (*DBusObjectManagerServer) ExportUniquely

func (x *DBusObjectManagerServer) ExportUniquely(ObjectVar *DBusObjectSkeleton)

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.

func (*DBusObjectManagerServer) GetConnection

func (x *DBusObjectManagerServer) GetConnection() *DBusConnection

Gets the #GDBusConnection used by @manager.

func (*DBusObjectManagerServer) GetInterface

func (x *DBusObjectManagerServer) GetInterface(ObjectPathVar string, InterfaceNameVar string) *DBusInterfaceBase

Gets the interface proxy for @interface_name at @object_path, if any.

func (*DBusObjectManagerServer) GetObject

func (x *DBusObjectManagerServer) GetObject(ObjectPathVar string) *DBusObjectBase

Gets the #GDBusObject at @object_path, if any.

func (*DBusObjectManagerServer) GetObjectPath

func (x *DBusObjectManagerServer) GetObjectPath() string

Gets the object path that @manager is for.

func (*DBusObjectManagerServer) GetObjects

func (x *DBusObjectManagerServer) GetObjects() *glib.List

Gets all #GDBusObject objects known to @manager.

func (*DBusObjectManagerServer) GetPropertyObjectPath

func (x *DBusObjectManagerServer) GetPropertyObjectPath() string

GetPropertyObjectPath gets the "object-path" property. The object path to register the manager object at.

func (*DBusObjectManagerServer) GoPointer

func (c *DBusObjectManagerServer) GoPointer() uintptr

func (*DBusObjectManagerServer) IsExported

func (x *DBusObjectManagerServer) IsExported(ObjectVar *DBusObjectSkeleton) bool

Returns whether @object is currently exported on @manager.

func (*DBusObjectManagerServer) SetConnection

func (x *DBusObjectManagerServer) SetConnection(ConnectionVar *DBusConnection)

Exports all objects managed by @manager on @connection. If @connection is %NULL, stops exporting objects.

func (*DBusObjectManagerServer) SetGoPointer

func (c *DBusObjectManagerServer) SetGoPointer(ptr uintptr)

func (*DBusObjectManagerServer) SetPropertyObjectPath

func (x *DBusObjectManagerServer) SetPropertyObjectPath(value string)

SetPropertyObjectPath sets the "object-path" property. The object path to register the manager object at.

func (*DBusObjectManagerServer) Unexport

func (x *DBusObjectManagerServer) Unexport(ObjectPathVar string) bool

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.

type DBusObjectManagerServerClass

type DBusObjectManagerServerClass struct {
	ParentClass gobject.ObjectClass

	Padding [8]uintptr
	// contains filtered or unexported fields
}

Class structure for #GDBusObjectManagerServer.

func (*DBusObjectManagerServerClass) GoPointer

func (x *DBusObjectManagerServerClass) GoPointer() uintptr

type DBusObjectManagerServerPrivate

type DBusObjectManagerServerPrivate struct {
	// contains filtered or unexported fields
}

func (*DBusObjectManagerServerPrivate) GoPointer

func (x *DBusObjectManagerServerPrivate) GoPointer() uintptr

type DBusObjectProxy

type DBusObjectProxy struct {
	gobject.Object
}

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 [class@Gio.DBusObjectManagerClient] is used to obtain it.

func DBusObjectProxyNewFromInternalPtr

func DBusObjectProxyNewFromInternalPtr(ptr uintptr) *DBusObjectProxy

func NewDBusObjectProxy

func NewDBusObjectProxy(ConnectionVar *DBusConnection, ObjectPathVar string) *DBusObjectProxy

Creates a new #GDBusObjectProxy for the given connection and object path.

func (*DBusObjectProxy) GetConnection

func (x *DBusObjectProxy) GetConnection() *DBusConnection

Gets the connection that @proxy is for.

func (*DBusObjectProxy) GetInterface

func (x *DBusObjectProxy) GetInterface(InterfaceNameVar string) *DBusInterfaceBase

Gets the D-Bus interface with name @interface_name associated with @object, if any.

func (*DBusObjectProxy) GetInterfaces

func (x *DBusObjectProxy) GetInterfaces() *glib.List

Gets the D-Bus interfaces associated with @object.

func (*DBusObjectProxy) GetObjectPath

func (x *DBusObjectProxy) GetObjectPath() string

Gets the object path for @object.

func (*DBusObjectProxy) GetPropertyGObjectPath

func (x *DBusObjectProxy) GetPropertyGObjectPath() string

GetPropertyGObjectPath gets the "g-object-path" property. The object path of the proxy.

func (*DBusObjectProxy) GoPointer

func (c *DBusObjectProxy) GoPointer() uintptr

func (*DBusObjectProxy) SetGoPointer

func (c *DBusObjectProxy) SetGoPointer(ptr uintptr)

func (*DBusObjectProxy) SetPropertyGObjectPath

func (x *DBusObjectProxy) SetPropertyGObjectPath(value string)

SetPropertyGObjectPath sets the "g-object-path" property. The object path of the proxy.

type DBusObjectProxyClass

type DBusObjectProxyClass struct {
	ParentClass gobject.ObjectClass

	Padding [8]uintptr
	// contains filtered or unexported fields
}

Class structure for #GDBusObjectProxy.

func (*DBusObjectProxyClass) GoPointer

func (x *DBusObjectProxyClass) GoPointer() uintptr

type DBusObjectProxyPrivate

type DBusObjectProxyPrivate struct {
	// contains filtered or unexported fields
}

func (*DBusObjectProxyPrivate) GoPointer

func (x *DBusObjectProxyPrivate) GoPointer() uintptr

type DBusObjectSkeleton

type DBusObjectSkeleton struct {
	gobject.Object
}

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 [iface@Gio.DBusObjectManager].

func DBusObjectSkeletonNewFromInternalPtr

func DBusObjectSkeletonNewFromInternalPtr(ptr uintptr) *DBusObjectSkeleton

func NewDBusObjectSkeleton

func NewDBusObjectSkeleton(ObjectPathVar string) *DBusObjectSkeleton

Creates a new #GDBusObjectSkeleton.

func (*DBusObjectSkeleton) AddInterface

func (x *DBusObjectSkeleton) AddInterface(InterfaceVar *DBusInterfaceSkeleton)

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.

func (*DBusObjectSkeleton) ConnectAuthorizeMethod

func (x *DBusObjectSkeleton) ConnectAuthorizeMethod(cb *func(DBusObjectSkeleton, uintptr, uintptr) bool) uint

Emitted when a method is invoked by a remote caller and used to determine if the method call is authorized.

This signal is like #GDBusInterfaceSkeleton's #GDBusInterfaceSkeleton::g-authorize-method signal, except that it is for the enclosing object.

The default class handler just returns %TRUE.

func (*DBusObjectSkeleton) Flush

func (x *DBusObjectSkeleton) Flush()

This method simply calls g_dbus_interface_skeleton_flush() on all interfaces belonging to @object. See that method for when flushing is useful.

func (*DBusObjectSkeleton) GetInterface

func (x *DBusObjectSkeleton) GetInterface(InterfaceNameVar string) *DBusInterfaceBase

Gets the D-Bus interface with name @interface_name associated with @object, if any.

func (*DBusObjectSkeleton) GetInterfaces

func (x *DBusObjectSkeleton) GetInterfaces() *glib.List

Gets the D-Bus interfaces associated with @object.

func (*DBusObjectSkeleton) GetObjectPath

func (x *DBusObjectSkeleton) GetObjectPath() string

Gets the object path for @object.

func (*DBusObjectSkeleton) GetPropertyGObjectPath

func (x *DBusObjectSkeleton) GetPropertyGObjectPath() string

GetPropertyGObjectPath gets the "g-object-path" property. The object path where the object is exported.

func (*DBusObjectSkeleton) GoPointer

func (c *DBusObjectSkeleton) GoPointer() uintptr

func (*DBusObjectSkeleton) RemoveInterface

func (x *DBusObjectSkeleton) RemoveInterface(InterfaceVar *DBusInterfaceSkeleton)

Removes @interface_ from @object.

func (*DBusObjectSkeleton) RemoveInterfaceByName

func (x *DBusObjectSkeleton) RemoveInterfaceByName(InterfaceNameVar string)

Removes the #GDBusInterface with @interface_name from @object.

If no D-Bus interface of the given interface exists, this function does nothing.

func (*DBusObjectSkeleton) SetGoPointer

func (c *DBusObjectSkeleton) SetGoPointer(ptr uintptr)

func (*DBusObjectSkeleton) SetObjectPath

func (x *DBusObjectSkeleton) SetObjectPath(ObjectPathVar string)

Sets the object path for @object.

func (*DBusObjectSkeleton) SetPropertyGObjectPath

func (x *DBusObjectSkeleton) SetPropertyGObjectPath(value string)

SetPropertyGObjectPath sets the "g-object-path" property. The object path where the object is exported.

type DBusObjectSkeletonClass

type DBusObjectSkeletonClass struct {
	ParentClass gobject.ObjectClass

	Padding [8]uintptr
	// contains filtered or unexported fields
}

Class structure for #GDBusObjectSkeleton.

func (*DBusObjectSkeletonClass) GetAuthorizeMethod

GetAuthorizeMethod gets the "authorize_method" callback function. Signal class handler for the #GDBusObjectSkeleton::authorize-method signal.

func (*DBusObjectSkeletonClass) GoPointer

func (x *DBusObjectSkeletonClass) GoPointer() uintptr

func (*DBusObjectSkeletonClass) OverrideAuthorizeMethod

OverrideAuthorizeMethod sets the "authorize_method" callback function. Signal class handler for the #GDBusObjectSkeleton::authorize-method signal.

type DBusObjectSkeletonPrivate

type DBusObjectSkeletonPrivate struct {
	// contains filtered or unexported fields
}

func (*DBusObjectSkeletonPrivate) GoPointer

func (x *DBusObjectSkeletonPrivate) GoPointer() uintptr

type DBusPropertyInfo

type DBusPropertyInfo struct {
	RefCount int32

	Name uintptr

	Signature uintptr

	Flags DBusPropertyInfoFlags

	Annotations uintptr
	// contains filtered or unexported fields
}

Information about a D-Bus property on a D-Bus interface.

func (*DBusPropertyInfo) GoPointer

func (x *DBusPropertyInfo) GoPointer() uintptr

func (*DBusPropertyInfo) Ref

If @info is statically allocated does nothing. Otherwise increases the reference count.

func (*DBusPropertyInfo) Unref

func (x *DBusPropertyInfo) Unref()

If @info is statically allocated, does nothing. Otherwise decreases the reference count of @info. When its reference count drops to 0, the memory used is freed.

type DBusPropertyInfoFlags

type DBusPropertyInfoFlags int

Flags describing the access control of a D-Bus property.

const (

	// No flags set.
	GDbusPropertyInfoFlagsNoneValue DBusPropertyInfoFlags = 0
	// Property is readable.
	GDbusPropertyInfoFlagsReadableValue DBusPropertyInfoFlags = 1
	// Property is writable.
	GDbusPropertyInfoFlagsWritableValue DBusPropertyInfoFlags = 2
)

type DBusProxy

type DBusProxy struct {
	gobject.Object
}

`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 [flags@Gio.DBusProxyFlags] 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 [property@Gio.DBusProxy:g-name-owner]. Connect to the [signal@GObject.Object::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 [property@Gio.DBusProxy: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 [signal@Gio.DBusProxy::g-properties-changed] and [signal@Gio.DBusProxy::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](migrating-gdbus.html#using-gdbus-codegen) shows how this can easily be done using the [`gdbus-codegen`](gdbus-codegen.html) tool.

A `GDBusProxy` instance can be used from multiple threads but note that all signals (e.g. [signal@Gio.DBusProxy::g-signal], [signal@Gio.DBusProxy::g-properties-changed] and [signal@GObject.Object::notify]) are emitted in the thread-default main context (see [method@GLib.MainContext.push_thread_default]) of the thread where the instance was constructed.

## A watch proxy example 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).

func DBusProxyNewFromInternalPtr

func DBusProxyNewFromInternalPtr(ptr uintptr) *DBusProxy

func NewDBusProxyFinish

func NewDBusProxyFinish(ResVar AsyncResult) (*DBusProxy, error)

Finishes creating a #GDBusProxy.

func NewDBusProxyForBusFinish

func NewDBusProxyForBusFinish(ResVar AsyncResult) (*DBusProxy, error)

Finishes creating a #GDBusProxy.

func NewDBusProxyForBusSync

func NewDBusProxyForBusSync(BusTypeVar BusType, FlagsVar DBusProxyFlags, InfoVar *DBusInterfaceInfo, NameVar string, ObjectPathVar string, InterfaceNameVar string, CancellableVar *Cancellable) (*DBusProxy, error)

Like g_dbus_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.

#GDBusProxy is used in this [example][class@Gio.DBusProxy#a-watch-proxy-example].

func NewDBusProxySync

func NewDBusProxySync(ConnectionVar *DBusConnection, FlagsVar DBusProxyFlags, InfoVar *DBusInterfaceInfo, NameVar *string, ObjectPathVar string, InterfaceNameVar string, CancellableVar *Cancellable) (*DBusProxy, error)

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][class@Gio.DBusProxy#a-watch-proxy-example].

func (*DBusProxy) Call

func (x *DBusProxy) Call(MethodNameVar string, ParametersVar *glib.Variant, FlagsVar DBusCallFlags, TimeoutMsecVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.: |[<!-- language="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 (see [method@GLib.MainContext.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.

func (*DBusProxy) CallFinish

func (x *DBusProxy) CallFinish(ResVar AsyncResult) (*glib.Variant, error)

Finishes an operation started with g_dbus_proxy_call().

func (*DBusProxy) CallSync

func (x *DBusProxy) CallSync(MethodNameVar string, ParametersVar *glib.Variant, FlagsVar DBusCallFlags, TimeoutMsecVar int, CancellableVar *Cancellable) (*glib.Variant, error)

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.: |[<!-- language="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.

func (*DBusProxy) CallWithUnixFdList

func (x *DBusProxy) CallWithUnixFdList(MethodNameVar string, ParametersVar *glib.Variant, FlagsVar DBusCallFlags, TimeoutMsecVar int, FdListVar *UnixFDList, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Like g_dbus_proxy_call() but also takes a #GUnixFDList object.

This method is only available on UNIX.

func (*DBusProxy) CallWithUnixFdListFinish

func (x *DBusProxy) CallWithUnixFdListFinish(OutFdListVar **UnixFDList, ResVar AsyncResult) (*glib.Variant, error)

Finishes an operation started with g_dbus_proxy_call_with_unix_fd_list().

func (*DBusProxy) CallWithUnixFdListSync

func (x *DBusProxy) CallWithUnixFdListSync(MethodNameVar string, ParametersVar *glib.Variant, FlagsVar DBusCallFlags, TimeoutMsecVar int, FdListVar *UnixFDList, OutFdListVar **UnixFDList, CancellableVar *Cancellable) (*glib.Variant, error)

Like g_dbus_proxy_call_sync() but also takes and returns #GUnixFDList objects.

This method is only available on UNIX.

func (*DBusProxy) ConnectGPropertiesChanged

func (x *DBusProxy) ConnectGPropertiesChanged(cb *func(DBusProxy, uintptr, []string)) uint

Emitted when one or more D-Bus properties on @proxy changes. The local cache has already been updated when this signal fires. Note that both @changed_properties and @invalidated_properties are guaranteed to never be %NULL (either may be empty though).

If the proxy has the flag %G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES set, then @invalidated_properties will always be empty.

This signal corresponds to the `PropertiesChanged` D-Bus signal on the `org.freedesktop.DBus.Properties` interface.

func (*DBusProxy) ConnectGSignal

func (x *DBusProxy) ConnectGSignal(cb *func(DBusProxy, string, string, uintptr)) uint

Emitted when a signal from the remote object and interface that @proxy is for, has been received.

Since 2.72 this signal supports detailed connections. You can connect to the detailed signal `g-signal::x` in order to receive callbacks only when signal `x` is received from the remote object.

func (*DBusProxy) DupObject

func (x *DBusProxy) DupObject() *DBusObjectBase

Gets the #GDBusObject that @interface_ belongs to, if any.

func (*DBusProxy) GetCachedProperty

func (x *DBusProxy) GetCachedProperty(PropertyNameVar string) *glib.Variant

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.

func (*DBusProxy) GetCachedPropertyNames

func (x *DBusProxy) GetCachedPropertyNames() []string

Gets the names of all cached properties on @proxy.

func (*DBusProxy) GetConnection

func (x *DBusProxy) GetConnection() *DBusConnection

Gets the connection @proxy is for.

func (*DBusProxy) GetDefaultTimeout

func (x *DBusProxy) GetDefaultTimeout() int

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.

func (*DBusProxy) GetFlags

func (x *DBusProxy) GetFlags() DBusProxyFlags

Gets the flags that @proxy was constructed with.

func (*DBusProxy) GetInfo

func (x *DBusProxy) GetInfo() *DBusInterfaceInfo

Gets D-Bus introspection information for the D-Bus interface implemented by @interface_.

This can return %NULL if no #GDBusInterfaceInfo was provided during construction of @interface_ and is also not made available otherwise. For example, #GDBusProxy implements #GDBusInterface but allows for a %NULL #GDBusInterfaceInfo.

func (*DBusProxy) GetInterfaceInfo

func (x *DBusProxy) GetInterfaceInfo() *DBusInterfaceInfo

Returns the #GDBusInterfaceInfo, if any, specifying the interface that @proxy conforms to. See the #GDBusProxy:g-interface-info property for more details.

func (*DBusProxy) GetInterfaceName

func (x *DBusProxy) GetInterfaceName() string

Gets the D-Bus interface name @proxy is for.

func (*DBusProxy) GetName

func (x *DBusProxy) GetName() string

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.

func (*DBusProxy) GetNameOwner

func (x *DBusProxy) GetNameOwner() string

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.

func (*DBusProxy) GetObject

func (x *DBusProxy) GetObject() *DBusObjectBase

Gets the #GDBusObject that @interface_ belongs to, if any.

It is not safe to use the returned object if @interface_ or the returned object is being used from other threads. See g_dbus_interface_dup_object() for a thread-safe alternative.

func (*DBusProxy) GetObjectPath

func (x *DBusProxy) GetObjectPath() string

Gets the object path @proxy is for.

func (*DBusProxy) GetPropertyGDefaultTimeout

func (x *DBusProxy) GetPropertyGDefaultTimeout() int

GetPropertyGDefaultTimeout gets the "g-default-timeout" property. 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.

func (*DBusProxy) GetPropertyGInterfaceInfo

func (x *DBusProxy) GetPropertyGInterfaceInfo() uintptr

GetPropertyGInterfaceInfo gets the "g-interface-info" property. 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.

func (*DBusProxy) GetPropertyGInterfaceName

func (x *DBusProxy) GetPropertyGInterfaceName() string

GetPropertyGInterfaceName gets the "g-interface-name" property. The D-Bus interface name the proxy is for.

func (*DBusProxy) GetPropertyGName

func (x *DBusProxy) GetPropertyGName() string

GetPropertyGName gets the "g-name" property. The well-known or unique name that the proxy is for.

func (*DBusProxy) GetPropertyGNameOwner

func (x *DBusProxy) GetPropertyGNameOwner() string

GetPropertyGNameOwner gets the "g-name-owner" property. 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.

func (*DBusProxy) GetPropertyGObjectPath

func (x *DBusProxy) GetPropertyGObjectPath() string

GetPropertyGObjectPath gets the "g-object-path" property. The object path the proxy is for.

func (*DBusProxy) GoPointer

func (c *DBusProxy) GoPointer() uintptr

func (*DBusProxy) Init

func (x *DBusProxy) Init(CancellableVar *Cancellable) (bool, error)

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 [description][iface@Gio.Initable#description] 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.

func (*DBusProxy) InitAsync

func (x *DBusProxy) InitAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*DBusProxy) InitFinish

func (x *DBusProxy) InitFinish(ResVar AsyncResult) (bool, error)

Finishes asynchronous initialization and returns the result. See g_async_initable_init_async().

func (*DBusProxy) NewFinish

func (x *DBusProxy) NewFinish(ResVar AsyncResult) (*gobject.Object, error)

Finishes the async construction for the various g_async_initable_new calls, returning the created object or %NULL on error.

func (*DBusProxy) SetCachedProperty

func (x *DBusProxy) SetCachedProperty(PropertyNameVar string, ValueVar *glib.Variant)

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. |[<!-- language="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)`.

func (*DBusProxy) SetDefaultTimeout

func (x *DBusProxy) SetDefaultTimeout(TimeoutMsecVar int)

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.

func (*DBusProxy) SetGoPointer

func (c *DBusProxy) SetGoPointer(ptr uintptr)

func (*DBusProxy) SetInterfaceInfo

func (x *DBusProxy) SetInterfaceInfo(InfoVar *DBusInterfaceInfo)

Ensure that interactions with @proxy conform to the given interface. See the #GDBusProxy:g-interface-info property for more details.

func (*DBusProxy) SetObject

func (x *DBusProxy) SetObject(ObjectVar DBusObject)

Sets the #GDBusObject for @interface_ to @object.

Note that @interface_ will hold a weak reference to @object.

func (*DBusProxy) SetPropertyGDefaultTimeout

func (x *DBusProxy) SetPropertyGDefaultTimeout(value int)

SetPropertyGDefaultTimeout sets the "g-default-timeout" property. 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.

func (*DBusProxy) SetPropertyGInterfaceInfo

func (x *DBusProxy) SetPropertyGInterfaceInfo(value uintptr)

SetPropertyGInterfaceInfo sets the "g-interface-info" property. 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.

func (*DBusProxy) SetPropertyGInterfaceName

func (x *DBusProxy) SetPropertyGInterfaceName(value string)

SetPropertyGInterfaceName sets the "g-interface-name" property. The D-Bus interface name the proxy is for.

func (*DBusProxy) SetPropertyGName

func (x *DBusProxy) SetPropertyGName(value string)

SetPropertyGName sets the "g-name" property. The well-known or unique name that the proxy is for.

func (*DBusProxy) SetPropertyGObjectPath

func (x *DBusProxy) SetPropertyGObjectPath(value string)

SetPropertyGObjectPath sets the "g-object-path" property. The object path the proxy is for.

type DBusProxyClass

type DBusProxyClass struct {
	ParentClass gobject.ObjectClass

	Padding [32]uintptr
	// contains filtered or unexported fields
}

Class structure for #GDBusProxy.

func (*DBusProxyClass) GetGPropertiesChanged

func (x *DBusProxyClass) GetGPropertiesChanged() func(*DBusProxy, *glib.Variant, string)

GetGPropertiesChanged gets the "g_properties_changed" callback function. Signal class handler for the #GDBusProxy::g-properties-changed signal.

func (*DBusProxyClass) GetGSignal

func (x *DBusProxyClass) GetGSignal() func(*DBusProxy, string, string, *glib.Variant)

GetGSignal gets the "g_signal" callback function. Signal class handler for the #GDBusProxy::g-signal signal.

func (*DBusProxyClass) GoPointer

func (x *DBusProxyClass) GoPointer() uintptr

func (*DBusProxyClass) OverrideGPropertiesChanged

func (x *DBusProxyClass) OverrideGPropertiesChanged(cb func(*DBusProxy, *glib.Variant, string))

OverrideGPropertiesChanged sets the "g_properties_changed" callback function. Signal class handler for the #GDBusProxy::g-properties-changed signal.

func (*DBusProxyClass) OverrideGSignal

func (x *DBusProxyClass) OverrideGSignal(cb func(*DBusProxy, string, string, *glib.Variant))

OverrideGSignal sets the "g_signal" callback function. Signal class handler for the #GDBusProxy::g-signal signal.

type DBusProxyFlags

type DBusProxyFlags int

Flags used when constructing an instance of a #GDBusProxy derived class.

const (

	// No flags set.
	GDbusProxyFlagsNoneValue DBusProxyFlags = 0
	// Don't load properties.
	GDbusProxyFlagsDoNotLoadPropertiesValue DBusProxyFlags = 1
	// Don't connect to signals on the remote object.
	GDbusProxyFlagsDoNotConnectSignalsValue DBusProxyFlags = 2
	// 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.
	GDbusProxyFlagsDoNotAutoStartValue DBusProxyFlags = 4
	// 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.
	GDbusProxyFlagsGetInvalidatedPropertiesValue DBusProxyFlags = 8
	// 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.
	GDbusProxyFlagsDoNotAutoStartAtConstructionValue DBusProxyFlags = 16
	// 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)
	GDbusProxyFlagsNoMatchRuleValue DBusProxyFlags = 32
)

type DBusProxyPrivate

type DBusProxyPrivate struct {
	// contains filtered or unexported fields
}

func (*DBusProxyPrivate) GoPointer

func (x *DBusProxyPrivate) GoPointer() uintptr

type DBusProxyTypeFunc

type DBusProxyTypeFunc func(uintptr, string, string, uintptr) types.GType

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 context (see [method@GLib.MainContext.push_thread_default]) that @manager was constructed in.

type DBusSendMessageFlags

type DBusSendMessageFlags int

Flags used when sending #GDBusMessages on a #GDBusConnection.

const (

	// No flags set.
	GDbusSendMessageFlagsNoneValue DBusSendMessageFlags = 0
	// Do not automatically
	// assign a serial number from the #GDBusConnection object when
	// sending a message.
	GDbusSendMessageFlagsPreserveSerialValue DBusSendMessageFlags = 1
)

type DBusServer

type DBusServer struct {
	gobject.Object
}

`GDBusServer` is a helper for listening to and accepting D-Bus connections. This can be used to create a new D-Bus server, allowing two peers to use the D-Bus protocol for their own specialized communication. A server instance provided in this way will not perform message routing or implement the [`org.freedesktop.DBus` interface](https://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-messages).

To just export an object on a well-known name on a message bus, such as the session or system bus, you should instead use [func@Gio.bus_own_name].

An example of peer-to-peer communication with GDBus can be found in [gdbus-example-peer.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-example-peer.c).

Note that a minimal `GDBusServer` will accept connections from any peer. In many use-cases it will be necessary to add a [class@Gio.DBusAuthObserver] that only accepts connections that have successfully authenticated as the same user that is running the `GDBusServer`. Since GLib 2.68 this can be achieved more simply by passing the `G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER` flag to the server.

func DBusServerNewFromInternalPtr

func DBusServerNewFromInternalPtr(ptr uintptr) *DBusServer

func NewDBusServerSync

func NewDBusServerSync(AddressVar string, FlagsVar DBusServerFlags, GuidVar string, ObserverVar *DBusAuthObserver, CancellableVar *Cancellable) (*DBusServer, error)

Creates a new D-Bus server that listens on the first address in @address that works.

Once constructed, you can use g_dbus_server_get_client_address() to get a D-Bus address string that clients can use to connect.

To have control over the available authentication mechanisms and the users that are authorized to connect, it is strongly recommended to provide a non-%NULL #GDBusAuthObserver.

Connect to the #GDBusServer::new-connection signal to handle incoming connections.

The returned #GDBusServer isn't active - you have to start it with g_dbus_server_start().

#GDBusServer is used in this [example](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-example-peer.c).

This is a synchronous failable constructor. There is currently no asynchronous version.

func (*DBusServer) ConnectNewConnection

func (x *DBusServer) ConnectNewConnection(cb *func(DBusServer, uintptr) bool) uint

Emitted when a new authenticated connection has been made. Use g_dbus_connection_get_peer_credentials() to figure out what identity (if any), was authenticated.

If you want to accept the connection, take a reference to the @connection object and return %TRUE. When you are done with the connection call g_dbus_connection_close() and give up your reference. Note that the other peer may disconnect at any time - a typical thing to do when accepting a connection is to listen to the #GDBusConnection::closed signal.

If #GDBusServer:flags contains %G_DBUS_SERVER_FLAGS_RUN_IN_THREAD then the signal is emitted in a new thread dedicated to the connection. Otherwise the signal is emitted in the thread-default main context (see [method@GLib.MainContext.push_thread_default]) of the thread that @server was constructed in.

You are guaranteed that signal handlers for this signal runs before incoming messages on @connection are processed. This means that it's suitable to call g_dbus_connection_register_object() or similar from the signal handler.

func (*DBusServer) GetClientAddress

func (x *DBusServer) GetClientAddress() string

Gets a [D-Bus address](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses) string that can be used by clients to connect to @server.

This is valid and non-empty if initializing the #GDBusServer succeeded.

func (*DBusServer) GetFlags

func (x *DBusServer) GetFlags() DBusServerFlags

Gets the flags for @server.

func (*DBusServer) GetGuid

func (x *DBusServer) GetGuid() string

Gets the GUID for @server, as provided to g_dbus_server_new_sync().

func (*DBusServer) GetPropertyActive

func (x *DBusServer) GetPropertyActive() bool

GetPropertyActive gets the "active" property. Whether the server is currently active.

func (*DBusServer) GetPropertyAddress

func (x *DBusServer) GetPropertyAddress() string

GetPropertyAddress gets the "address" property. The D-Bus address to listen on.

func (*DBusServer) GetPropertyClientAddress

func (x *DBusServer) GetPropertyClientAddress() string

GetPropertyClientAddress gets the "client-address" property. The D-Bus address that clients can use.

func (*DBusServer) GetPropertyGuid

func (x *DBusServer) GetPropertyGuid() string

GetPropertyGuid gets the "guid" property. The GUID of the server.

See #GDBusConnection:guid for more details.

func (*DBusServer) GoPointer

func (c *DBusServer) GoPointer() uintptr

func (*DBusServer) Init

func (x *DBusServer) Init(CancellableVar *Cancellable) (bool, error)

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 [description][iface@Gio.Initable#description] 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.

func (*DBusServer) IsActive

func (x *DBusServer) IsActive() bool

Gets whether @server is active.

func (*DBusServer) SetGoPointer

func (c *DBusServer) SetGoPointer(ptr uintptr)

func (*DBusServer) SetPropertyAddress

func (x *DBusServer) SetPropertyAddress(value string)

SetPropertyAddress sets the "address" property. The D-Bus address to listen on.

func (*DBusServer) SetPropertyGuid

func (x *DBusServer) SetPropertyGuid(value string)

SetPropertyGuid sets the "guid" property. The GUID of the server.

See #GDBusConnection:guid for more details.

func (*DBusServer) Start

func (x *DBusServer) Start()

Starts @server.

func (*DBusServer) Stop

func (x *DBusServer) Stop()

Stops @server.

type DBusServerFlags

type DBusServerFlags int

Flags used when creating a #GDBusServer.

const (

	// No flags set.
	GDbusServerFlagsNoneValue DBusServerFlags = 0
	// All #GDBusServer::new-connection
	// signals will run in separated dedicated threads (see signal for
	// details).
	GDbusServerFlagsRunInThreadValue DBusServerFlags = 1
	// Allow the anonymous
	// authentication method.
	GDbusServerFlagsAuthenticationAllowAnonymousValue DBusServerFlags = 2
	// Require the UID of the
	// peer to be the same as the UID of the server when authenticating. (Since: 2.68)
	GDbusServerFlagsAuthenticationRequireSameUserValue DBusServerFlags = 4
)

type DBusSignalCallback

type DBusSignalCallback func(uintptr, string, string, string, string, *glib.Variant, uintptr)

Signature for callback function used in g_dbus_connection_signal_subscribe().

type DBusSignalFlags

type DBusSignalFlags int

Flags used when subscribing to signals via g_dbus_connection_signal_subscribe().

const (

	// No flags set.
	GDbusSignalFlagsNoneValue DBusSignalFlags = 0
	// 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).
	GDbusSignalFlagsNoMatchRuleValue DBusSignalFlags = 1
	// Match first arguments that
	// contain a bus or interface name with the given namespace.
	GDbusSignalFlagsMatchArg0NamespaceValue DBusSignalFlags = 2
	// 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.
	GDbusSignalFlagsMatchArg0PathValue DBusSignalFlags = 4
)

type DBusSignalInfo

type DBusSignalInfo struct {
	RefCount int32

	Name uintptr

	Args uintptr

	Annotations uintptr
	// contains filtered or unexported fields
}

Information about a signal on a D-Bus interface.

func (*DBusSignalInfo) GoPointer

func (x *DBusSignalInfo) GoPointer() uintptr

func (*DBusSignalInfo) Ref

func (x *DBusSignalInfo) Ref() *DBusSignalInfo

If @info is statically allocated does nothing. Otherwise increases the reference count.

func (*DBusSignalInfo) Unref

func (x *DBusSignalInfo) Unref()

If @info is statically allocated, does nothing. Otherwise decreases the reference count of @info. When its reference count drops to 0, the memory used is freed.

type DBusSubtreeDispatchFunc

type DBusSubtreeDispatchFunc func(uintptr, string, string, string, string, uintptr, uintptr) uintptr

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).

type DBusSubtreeEnumerateFunc

type DBusSubtreeEnumerateFunc func(uintptr, string, string, uintptr) []string

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().

type DBusSubtreeFlags

type DBusSubtreeFlags int

Flags passed to g_dbus_connection_register_subtree().

const (

	// No flags set.
	GDbusSubtreeFlagsNoneValue DBusSubtreeFlags = 0
	// 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.
	GDbusSubtreeFlagsDispatchToUnenumeratedNodesValue DBusSubtreeFlags = 1
)

type DBusSubtreeIntrospectFunc

type DBusSubtreeIntrospectFunc func(uintptr, string, string, string, uintptr) uintptr

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.

type DBusSubtreeVTable

type DBusSubtreeVTable struct {
	Enumerate DBusSubtreeEnumerateFunc

	Introspect DBusSubtreeIntrospectFunc

	Dispatch DBusSubtreeDispatchFunc

	Padding [8]uintptr
	// contains filtered or unexported fields
}

Virtual table for handling subtrees registered with g_dbus_connection_register_subtree().

func (*DBusSubtreeVTable) GoPointer

func (x *DBusSubtreeVTable) GoPointer() uintptr

type DataInputStream

type DataInputStream struct {
	BufferedInputStream
}

Data input stream implements [class@Gio.InputStream] and includes functions for reading structured data directly from a binary input stream.

func DataInputStreamNewFromInternalPtr

func DataInputStreamNewFromInternalPtr(ptr uintptr) *DataInputStream

func NewDataInputStream

func NewDataInputStream(BaseStreamVar *InputStream) *DataInputStream

Creates a new data input stream for the @base_stream.

func (*DataInputStream) CanSeek

func (x *DataInputStream) CanSeek() bool

Tests if the stream supports the #GSeekableIface.

func (*DataInputStream) CanTruncate

func (x *DataInputStream) CanTruncate() bool

Tests if the length of the stream can be adjusted with g_seekable_truncate().

func (*DataInputStream) GetByteOrder

func (x *DataInputStream) GetByteOrder() DataStreamByteOrder

Gets the byte order for the data input stream.

func (*DataInputStream) GetNewlineType

func (x *DataInputStream) GetNewlineType() DataStreamNewlineType

Gets the current newline type for the @stream.

func (*DataInputStream) GoPointer

func (c *DataInputStream) GoPointer() uintptr

func (*DataInputStream) ReadByte

func (x *DataInputStream) ReadByte(CancellableVar *Cancellable) (byte, error)

Reads an unsigned 8-bit/1-byte value from @stream.

func (*DataInputStream) ReadInt16

func (x *DataInputStream) ReadInt16(CancellableVar *Cancellable) (int16, error)

Reads a 16-bit/2-byte value from @stream.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().

func (*DataInputStream) ReadInt32

func (x *DataInputStream) ReadInt32(CancellableVar *Cancellable) (int32, error)

Reads a signed 32-bit/4-byte value from @stream.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().

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.

func (*DataInputStream) ReadInt64

func (x *DataInputStream) ReadInt64(CancellableVar *Cancellable) (int64, error)

Reads a 64-bit/8-byte value from @stream.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().

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.

func (*DataInputStream) ReadLine

func (x *DataInputStream) ReadLine(LengthVar *uint, CancellableVar *Cancellable) (uintptr, error)

Reads a line from the data input stream. Note that no encoding checks or conversion is performed; the input is not guaranteed to be UTF-8, and may in fact have embedded NUL characters.

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.

func (*DataInputStream) ReadLineAsync

func (x *DataInputStream) ReadLineAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

The asynchronous version of g_data_input_stream_read_line(). It is an error to have two outstanding calls to this function.

When the operation is finished, @callback will be called. You can then call g_data_input_stream_read_line_finish() to get the result of the operation.

func (*DataInputStream) ReadLineFinish

func (x *DataInputStream) ReadLineFinish(ResultVar AsyncResult, LengthVar *uint) (uintptr, error)

Finish an asynchronous call started by g_data_input_stream_read_line_async(). Note the warning about string encoding in g_data_input_stream_read_line() applies here as well.

func (*DataInputStream) ReadLineFinishUtf8

func (x *DataInputStream) ReadLineFinishUtf8(ResultVar AsyncResult, LengthVar *uint) (string, error)

Finish an asynchronous call started by g_data_input_stream_read_line_async().

func (*DataInputStream) ReadLineUtf8

func (x *DataInputStream) ReadLineUtf8(LengthVar *uint, CancellableVar *Cancellable) (string, error)

Reads a UTF-8 encoded line from the data input stream.

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.

func (*DataInputStream) ReadUint16

func (x *DataInputStream) ReadUint16(CancellableVar *Cancellable) (uint16, error)

Reads an unsigned 16-bit/2-byte value from @stream.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().

func (*DataInputStream) ReadUint32

func (x *DataInputStream) ReadUint32(CancellableVar *Cancellable) (uint32, error)

Reads an unsigned 32-bit/4-byte value from @stream.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().

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.

func (*DataInputStream) ReadUint64

func (x *DataInputStream) ReadUint64(CancellableVar *Cancellable) (uint64, error)

Reads an unsigned 64-bit/8-byte value from @stream.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order().

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.

func (*DataInputStream) ReadUntil

func (x *DataInputStream) ReadUntil(StopCharsVar string, LengthVar *uint, CancellableVar *Cancellable) (string, error)

Reads a string from the data input stream, up to the first occurrence of any of the stop characters.

Note that, in contrast to g_data_input_stream_read_until_async(), this function consumes the stop character that it finds.

Don't use this function in new code. Its functionality is inconsistent with g_data_input_stream_read_until_async(). Both functions will be marked as deprecated in a future release. Use g_data_input_stream_read_upto() instead, but note that that function does not consume the stop character.

func (*DataInputStream) ReadUntilAsync

func (x *DataInputStream) ReadUntilAsync(StopCharsVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

The asynchronous version of g_data_input_stream_read_until(). It is an error to have two outstanding calls to this function.

Note that, in contrast to g_data_input_stream_read_until(), this function does not consume the stop character that it finds. You must read it for yourself.

When the operation is finished, @callback will be called. You can then call g_data_input_stream_read_until_finish() to get the result of the operation.

Don't use this function in new code. Its functionality is inconsistent with g_data_input_stream_read_until(). Both functions will be marked as deprecated in a future release. Use g_data_input_stream_read_upto_async() instead.

func (*DataInputStream) ReadUntilFinish

func (x *DataInputStream) ReadUntilFinish(ResultVar AsyncResult, LengthVar *uint) (string, error)

Finish an asynchronous call started by g_data_input_stream_read_until_async().

func (*DataInputStream) ReadUpto

func (x *DataInputStream) ReadUpto(StopCharsVar string, StopCharsLenVar int, LengthVar *uint, CancellableVar *Cancellable) (string, error)

Reads a string from the data input stream, up to the first occurrence of any of the stop characters.

In contrast to g_data_input_stream_read_until(), this function does not consume the stop character. You have to use g_data_input_stream_read_byte() to get it before calling g_data_input_stream_read_upto() again.

Note that @stop_chars may contain '\0' if @stop_chars_len is specified.

The returned string will always be nul-terminated on success.

func (*DataInputStream) ReadUptoAsync

func (x *DataInputStream) ReadUptoAsync(StopCharsVar string, StopCharsLenVar int, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

The asynchronous version of g_data_input_stream_read_upto(). It is an error to have two outstanding calls to this function.

In contrast to g_data_input_stream_read_until(), this function does not consume the stop character. You have to use g_data_input_stream_read_byte() to get it before calling g_data_input_stream_read_upto() again.

Note that @stop_chars may contain '\0' if @stop_chars_len is specified.

When the operation is finished, @callback will be called. You can then call g_data_input_stream_read_upto_finish() to get the result of the operation.

func (*DataInputStream) ReadUptoFinish

func (x *DataInputStream) ReadUptoFinish(ResultVar AsyncResult, LengthVar *uint) (string, error)

Finish an asynchronous call started by g_data_input_stream_read_upto_async().

Note that this function does not consume the stop character. You have to use g_data_input_stream_read_byte() to get it before calling g_data_input_stream_read_upto_async() again.

The returned string will always be nul-terminated on success.

func (*DataInputStream) Seek

func (x *DataInputStream) Seek(OffsetVar int64, TypeVar glib.SeekType, CancellableVar *Cancellable) (bool, error)

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.

func (*DataInputStream) SetByteOrder

func (x *DataInputStream) SetByteOrder(OrderVar DataStreamByteOrder)

This function sets the byte order for the given @stream. All subsequent reads from the @stream will be read in the given @order.

func (*DataInputStream) SetGoPointer

func (c *DataInputStream) SetGoPointer(ptr uintptr)

func (*DataInputStream) SetNewlineType

func (x *DataInputStream) SetNewlineType(TypeVar DataStreamNewlineType)

Sets the newline type for the @stream.

Note that using G_DATA_STREAM_NEWLINE_TYPE_ANY is slightly unsafe. If a read chunk ends in "CR" we must read an additional byte to know if this is "CR" or "CR LF", and this might block if there is no more data available.

func (*DataInputStream) Tell

func (x *DataInputStream) Tell() int64

Tells the current position within the stream.

func (*DataInputStream) Truncate

func (x *DataInputStream) Truncate(OffsetVar int64, CancellableVar *Cancellable) (bool, error)

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.

type DataInputStreamClass

type DataInputStreamClass struct {
	ParentClass BufferedInputStreamClass
	// contains filtered or unexported fields
}

func (*DataInputStreamClass) GetGReserved1

func (x *DataInputStreamClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*DataInputStreamClass) GetGReserved2

func (x *DataInputStreamClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*DataInputStreamClass) GetGReserved3

func (x *DataInputStreamClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*DataInputStreamClass) GetGReserved4

func (x *DataInputStreamClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*DataInputStreamClass) GetGReserved5

func (x *DataInputStreamClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*DataInputStreamClass) GoPointer

func (x *DataInputStreamClass) GoPointer() uintptr

func (*DataInputStreamClass) OverrideGReserved1

func (x *DataInputStreamClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*DataInputStreamClass) OverrideGReserved2

func (x *DataInputStreamClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*DataInputStreamClass) OverrideGReserved3

func (x *DataInputStreamClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*DataInputStreamClass) OverrideGReserved4

func (x *DataInputStreamClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*DataInputStreamClass) OverrideGReserved5

func (x *DataInputStreamClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

type DataInputStreamPrivate

type DataInputStreamPrivate struct {
	// contains filtered or unexported fields
}

func (*DataInputStreamPrivate) GoPointer

func (x *DataInputStreamPrivate) GoPointer() uintptr

type DataOutputStream

type DataOutputStream struct {
	FilterOutputStream
}

Data output stream implements [class@Gio.OutputStream] and includes functions for writing data directly to an output stream.

func DataOutputStreamNewFromInternalPtr

func DataOutputStreamNewFromInternalPtr(ptr uintptr) *DataOutputStream

func NewDataOutputStream

func NewDataOutputStream(BaseStreamVar *OutputStream) *DataOutputStream

Creates a new data output stream for @base_stream.

func (*DataOutputStream) CanSeek

func (x *DataOutputStream) CanSeek() bool

Tests if the stream supports the #GSeekableIface.

func (*DataOutputStream) CanTruncate

func (x *DataOutputStream) CanTruncate() bool

Tests if the length of the stream can be adjusted with g_seekable_truncate().

func (*DataOutputStream) GetByteOrder

func (x *DataOutputStream) GetByteOrder() DataStreamByteOrder

Gets the byte order for the stream.

func (*DataOutputStream) GoPointer

func (c *DataOutputStream) GoPointer() uintptr

func (*DataOutputStream) PutByte

func (x *DataOutputStream) PutByte(DataVar byte, CancellableVar *Cancellable) (bool, error)

Puts a byte into the output stream.

func (*DataOutputStream) PutInt16

func (x *DataOutputStream) PutInt16(DataVar int16, CancellableVar *Cancellable) (bool, error)

Puts a signed 16-bit integer into the output stream.

func (*DataOutputStream) PutInt32

func (x *DataOutputStream) PutInt32(DataVar int32, CancellableVar *Cancellable) (bool, error)

Puts a signed 32-bit integer into the output stream.

func (*DataOutputStream) PutInt64

func (x *DataOutputStream) PutInt64(DataVar int64, CancellableVar *Cancellable) (bool, error)

Puts a signed 64-bit integer into the stream.

func (*DataOutputStream) PutString

func (x *DataOutputStream) PutString(StrVar string, CancellableVar *Cancellable) (bool, error)

Puts a string into the output stream.

func (*DataOutputStream) PutUint16

func (x *DataOutputStream) PutUint16(DataVar uint16, CancellableVar *Cancellable) (bool, error)

Puts an unsigned 16-bit integer into the output stream.

func (*DataOutputStream) PutUint32

func (x *DataOutputStream) PutUint32(DataVar uint32, CancellableVar *Cancellable) (bool, error)

Puts an unsigned 32-bit integer into the stream.

func (*DataOutputStream) PutUint64

func (x *DataOutputStream) PutUint64(DataVar uint64, CancellableVar *Cancellable) (bool, error)

Puts an unsigned 64-bit integer into the stream.

func (*DataOutputStream) Seek

func (x *DataOutputStream) Seek(OffsetVar int64, TypeVar glib.SeekType, CancellableVar *Cancellable) (bool, error)

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.

func (*DataOutputStream) SetByteOrder

func (x *DataOutputStream) SetByteOrder(OrderVar DataStreamByteOrder)

Sets the byte order of the data output stream to @order.

func (*DataOutputStream) SetGoPointer

func (c *DataOutputStream) SetGoPointer(ptr uintptr)

func (*DataOutputStream) Tell

func (x *DataOutputStream) Tell() int64

Tells the current position within the stream.

func (*DataOutputStream) Truncate

func (x *DataOutputStream) Truncate(OffsetVar int64, CancellableVar *Cancellable) (bool, error)

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.

type DataOutputStreamClass

type DataOutputStreamClass struct {
	ParentClass FilterOutputStreamClass
	// contains filtered or unexported fields
}

func (*DataOutputStreamClass) GetGReserved1

func (x *DataOutputStreamClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*DataOutputStreamClass) GetGReserved2

func (x *DataOutputStreamClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*DataOutputStreamClass) GetGReserved3

func (x *DataOutputStreamClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*DataOutputStreamClass) GetGReserved4

func (x *DataOutputStreamClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*DataOutputStreamClass) GetGReserved5

func (x *DataOutputStreamClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*DataOutputStreamClass) GoPointer

func (x *DataOutputStreamClass) GoPointer() uintptr

func (*DataOutputStreamClass) OverrideGReserved1

func (x *DataOutputStreamClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*DataOutputStreamClass) OverrideGReserved2

func (x *DataOutputStreamClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*DataOutputStreamClass) OverrideGReserved3

func (x *DataOutputStreamClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*DataOutputStreamClass) OverrideGReserved4

func (x *DataOutputStreamClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*DataOutputStreamClass) OverrideGReserved5

func (x *DataOutputStreamClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

type DataOutputStreamPrivate

type DataOutputStreamPrivate struct {
	// contains filtered or unexported fields
}

func (*DataOutputStreamPrivate) GoPointer

func (x *DataOutputStreamPrivate) GoPointer() uintptr

type DataStreamByteOrder

type DataStreamByteOrder int

#GDataStreamByteOrder is used to ensure proper endianness of streaming data sources across various machine architectures.

const (

	// Selects Big Endian byte order.
	GDataStreamByteOrderBigEndianValue DataStreamByteOrder = 0
	// Selects Little Endian byte order.
	GDataStreamByteOrderLittleEndianValue DataStreamByteOrder = 1
	// Selects endianness based on host machine's architecture.
	GDataStreamByteOrderHostEndianValue DataStreamByteOrder = 2
)

type DataStreamNewlineType

type DataStreamNewlineType int

#GDataStreamNewlineType is used when checking for or setting the line endings for a given file.

const (

	// Selects "LF" line endings, common on most modern UNIX platforms.
	GDataStreamNewlineTypeLfValue DataStreamNewlineType = 0
	// Selects "CR" line endings.
	GDataStreamNewlineTypeCrValue DataStreamNewlineType = 1
	// Selects "CR, LF" line ending, common on Microsoft Windows.
	GDataStreamNewlineTypeCrLfValue DataStreamNewlineType = 2
	// Automatically try to handle any line ending type.
	GDataStreamNewlineTypeAnyValue DataStreamNewlineType = 3
)

type DatagramBased

type DatagramBased interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	ConditionCheck(ConditionVar glib.IOCondition) glib.IOCondition
	ConditionWait(ConditionVar glib.IOCondition, TimeoutVar int64, CancellableVar *Cancellable) (bool, error)
	CreateSource(ConditionVar glib.IOCondition, CancellableVar *Cancellable) *glib.Source
	ReceiveMessages(MessagesVar []InputMessage, NumMessagesVar uint, FlagsVar int, TimeoutVar int64, CancellableVar *Cancellable) (int, error)
	SendMessages(MessagesVar []OutputMessage, NumMessagesVar uint, FlagsVar int, TimeoutVar int64, CancellableVar *Cancellable) (int, error)
}

Interface for socket-like objects with datagram semantics.

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 [class@Gio.Socket], 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 [class@Gio.IOStream].

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 [method@Gio.DatagramBased.condition_check] or [method@Gio.DatagramBased.condition_wait]. You can also use [method@Gio.DatagramBased.create_source] and attach it to a [struct@GLib.MainContext] 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`, `GDatagramBased`s can be either connection oriented (for example, SCTP) or connectionless (for example, UDP). `GDatagramBased`s 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.

type DatagramBasedBase

type DatagramBasedBase struct {
	Ptr uintptr
}

func (*DatagramBasedBase) ConditionCheck

func (x *DatagramBasedBase) ConditionCheck(ConditionVar glib.IOCondition) glib.IOCondition

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.

func (*DatagramBasedBase) ConditionWait

func (x *DatagramBasedBase) ConditionWait(ConditionVar glib.IOCondition, TimeoutVar int64, CancellableVar *Cancellable) (bool, error)

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).

func (*DatagramBasedBase) CreateSource

func (x *DatagramBasedBase) CreateSource(ConditionVar glib.IOCondition, CancellableVar *Cancellable) *glib.Source

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().

func (*DatagramBasedBase) GoPointer

func (x *DatagramBasedBase) GoPointer() uintptr

func (*DatagramBasedBase) ReceiveMessages

func (x *DatagramBasedBase) ReceiveMessages(MessagesVar []InputMessage, NumMessagesVar uint, FlagsVar int, TimeoutVar int64, CancellableVar *Cancellable) (int, error)

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.

func (*DatagramBasedBase) SendMessages

func (x *DatagramBasedBase) SendMessages(MessagesVar []OutputMessage, NumMessagesVar uint, FlagsVar int, TimeoutVar int64, CancellableVar *Cancellable) (int, error)

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.

func (*DatagramBasedBase) SetGoPointer

func (x *DatagramBasedBase) SetGoPointer(ptr uintptr)

type DatagramBasedInterface

type DatagramBasedInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

Provides an interface for socket-like objects which have datagram semantics, following the Berkeley sockets API. The interface methods are thin wrappers around the corresponding virtual methods, and no pre-processing of inputs is implemented — so implementations of this API must handle all functionality documented in the interface methods.

func (*DatagramBasedInterface) GetConditionCheck

func (x *DatagramBasedInterface) GetConditionCheck() func(DatagramBased, glib.IOCondition) glib.IOCondition

GetConditionCheck gets the "condition_check" callback function. Virtual method for g_datagram_based_condition_check().

func (*DatagramBasedInterface) GetConditionWait

func (x *DatagramBasedInterface) GetConditionWait() func(DatagramBased, glib.IOCondition, int64, *Cancellable) bool

GetConditionWait gets the "condition_wait" callback function. Virtual method for

g_datagram_based_condition_wait().

func (*DatagramBasedInterface) GetCreateSource

GetCreateSource gets the "create_source" callback function. Virtual method for g_datagram_based_create_source().

func (*DatagramBasedInterface) GetReceiveMessages

func (x *DatagramBasedInterface) GetReceiveMessages() func(DatagramBased, []InputMessage, uint, int, int64, *Cancellable) int

GetReceiveMessages gets the "receive_messages" callback function. Virtual method for g_datagram_based_receive_messages().

func (*DatagramBasedInterface) GetSendMessages

func (x *DatagramBasedInterface) GetSendMessages() func(DatagramBased, []OutputMessage, uint, int, int64, *Cancellable) int

GetSendMessages gets the "send_messages" callback function. Virtual method for g_datagram_based_send_messages().

func (*DatagramBasedInterface) GoPointer

func (x *DatagramBasedInterface) GoPointer() uintptr

func (*DatagramBasedInterface) OverrideConditionCheck

func (x *DatagramBasedInterface) OverrideConditionCheck(cb func(DatagramBased, glib.IOCondition) glib.IOCondition)

OverrideConditionCheck sets the "condition_check" callback function. Virtual method for g_datagram_based_condition_check().

func (*DatagramBasedInterface) OverrideConditionWait

func (x *DatagramBasedInterface) OverrideConditionWait(cb func(DatagramBased, glib.IOCondition, int64, *Cancellable) bool)

OverrideConditionWait sets the "condition_wait" callback function. Virtual method for

g_datagram_based_condition_wait().

func (*DatagramBasedInterface) OverrideCreateSource

func (x *DatagramBasedInterface) OverrideCreateSource(cb func(DatagramBased, glib.IOCondition, *Cancellable) *glib.Source)

OverrideCreateSource sets the "create_source" callback function. Virtual method for g_datagram_based_create_source().

func (*DatagramBasedInterface) OverrideReceiveMessages

func (x *DatagramBasedInterface) OverrideReceiveMessages(cb func(DatagramBased, []InputMessage, uint, int, int64, *Cancellable) int)

OverrideReceiveMessages sets the "receive_messages" callback function. Virtual method for g_datagram_based_receive_messages().

func (*DatagramBasedInterface) OverrideSendMessages

func (x *DatagramBasedInterface) OverrideSendMessages(cb func(DatagramBased, []OutputMessage, uint, int, int64, *Cancellable) int)

OverrideSendMessages sets the "send_messages" callback function. Virtual method for g_datagram_based_send_messages().

type DatagramBasedSourceFunc

type DatagramBasedSourceFunc func(uintptr, glib.IOCondition, uintptr) bool

This is the function type of the callback used for the #GSource returned by g_datagram_based_create_source().

type DebugController

type DebugController interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	GetDebugEnabled() bool
	SetDebugEnabled(DebugEnabledVar bool)
}

`GDebugController` is an interface to expose control of debugging features and debug output.

It is implemented on Linux using [class@Gio.DebugControllerDBus], 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 [property@Gio.DebugController:debug-enabled]. This controls [func@GLib.log_set_debug_enabled] by default. Application code may connect to the [signal@GObject.Object::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.

type DebugControllerBase

type DebugControllerBase struct {
	Ptr uintptr
}

func (*DebugControllerBase) GetDebugEnabled

func (x *DebugControllerBase) GetDebugEnabled() bool

Get the value of #GDebugController:debug-enabled.

func (*DebugControllerBase) GetPropertyDebugEnabled

func (x *DebugControllerBase) GetPropertyDebugEnabled() bool

GetPropertyDebugEnabled gets the "debug-enabled" property. %TRUE if debug output should be exposed (for example by forwarding it to the journal), %FALSE otherwise.

func (*DebugControllerBase) GoPointer

func (x *DebugControllerBase) GoPointer() uintptr

func (*DebugControllerBase) SetDebugEnabled

func (x *DebugControllerBase) SetDebugEnabled(DebugEnabledVar bool)

Set the value of #GDebugController:debug-enabled.

func (*DebugControllerBase) SetGoPointer

func (x *DebugControllerBase) SetGoPointer(ptr uintptr)

func (*DebugControllerBase) SetPropertyDebugEnabled

func (x *DebugControllerBase) SetPropertyDebugEnabled(value bool)

SetPropertyDebugEnabled sets the "debug-enabled" property. %TRUE if debug output should be exposed (for example by forwarding it to the journal), %FALSE otherwise.

type DebugControllerDBus

type DebugControllerDBus struct {
	gobject.Object
}

`GDebugControllerDBus` is an implementation of [iface@Gio.DebugController] which exposes debug settings as a D-Bus object.

It is a [iface@Gio.Initable] object, and will register an object at `/org/gtk/Debugging` on the bus given as [property@Gio.DebugControllerDBus:connection] once it’s initialized. The object will be unregistered when the last reference to the `GDebugControllerDBus` is dropped.

This D-Bus object can be used by remote processes to enable or disable debug output in this process. Remote processes calling `org.gtk.Debugging.SetDebugEnabled()` will affect the value of [property@Gio.DebugController:debug-enabled] and, by default, [func@GLib.log_get_debug_enabled].

By default, no processes are allowed to call `SetDebugEnabled()` unless a [signal@Gio.DebugControllerDBus::authorize] signal handler is installed. This is because the process may be privileged, or might expose sensitive information in its debug output. You may want to restrict the ability to enable debug output to privileged users or processes.

One option is to install a D-Bus security policy which restricts access to `SetDebugEnabled()`, installing something like the following in `$datadir/dbus-1/system.d/`:

```xml <?xml version="1.0"?> <!--*-nxml-*--> <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"

"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">

<busconfig>

<policy user="root">
  <allow send_destination="com.example.MyService" send_interface="org.gtk.Debugging"/>
</policy>
<policy context="default">
  <deny send_destination="com.example.MyService" send_interface="org.gtk.Debugging"/>
</policy>

</busconfig> ```

This will prevent the `SetDebugEnabled()` method from being called by all except root. It will not prevent the `DebugEnabled` property from being read, as it’s accessed through the `org.freedesktop.DBus.Properties` interface.

Another option is to use polkit to allow or deny requests on a case-by-case basis, allowing for the possibility of dynamic authorisation. To do this, connect to the [signal@Gio.DebugControllerDBus::authorize] signal and query polkit in it:

```c

g_autoptr(GError) child_error = NULL;
g_autoptr(GDBusConnection) connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
gulong debug_controller_authorize_id = 0;

// Set up the debug controller.
debug_controller = G_DEBUG_CONTROLLER (g_debug_controller_dbus_new (priv->connection, NULL, &child_error));
if (debug_controller == NULL)
  {
    g_error ("Could not register debug controller on bus: %s",
             child_error->message);
  }

debug_controller_authorize_id = g_signal_connect (debug_controller,
                                                  "authorize",
                                                  G_CALLBACK (debug_controller_authorize_cb),
                                                  self);

static gboolean
debug_controller_authorize_cb (GDebugControllerDBus  *debug_controller,
                               GDBusMethodInvocation *invocation,
                               gpointer               user_data)
{
  g_autoptr(PolkitAuthority) authority = NULL;
  g_autoptr(PolkitSubject) subject = NULL;
  g_autoptr(PolkitAuthorizationResult) auth_result = NULL;
  g_autoptr(GError) local_error = NULL;
  GDBusMessage *message;
  GDBusMessageFlags message_flags;
  PolkitCheckAuthorizationFlags flags = POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE;

  message = g_dbus_method_invocation_get_message (invocation);
  message_flags = g_dbus_message_get_flags (message);

  authority = polkit_authority_get_sync (NULL, &local_error);
  if (authority == NULL)
    {
      g_warning ("Failed to get polkit authority: %s", local_error->message);
      return FALSE;
    }

  if (message_flags & G_DBUS_MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION)
    flags |= POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION;

  subject = polkit_system_bus_name_new (g_dbus_method_invocation_get_sender (invocation));

  auth_result = polkit_authority_check_authorization_sync (authority,
                                                           subject,
                                                           "com.example.MyService.set-debug-enabled",
                                                           NULL,
                                                           flags,
                                                           NULL,
                                                           &local_error);
  if (auth_result == NULL)
    {
      g_warning ("Failed to get check polkit authorization: %s", local_error->message);
      return FALSE;
    }

  return polkit_authorization_result_get_is_authorized (auth_result);
}

```

func DebugControllerDBusNewFromInternalPtr

func DebugControllerDBusNewFromInternalPtr(ptr uintptr) *DebugControllerDBus

func NewDebugControllerDBus

func NewDebugControllerDBus(ConnectionVar *DBusConnection, CancellableVar *Cancellable) (*DebugControllerDBus, error)

Create a new #GDebugControllerDBus and synchronously initialize it.

Initializing the object will export the debug object on @connection. The object will remain registered until the last reference to the #GDebugControllerDBus is dropped.

Initialization may fail if registering the object on @connection fails.

func (*DebugControllerDBus) ConnectAuthorize

func (x *DebugControllerDBus) ConnectAuthorize(cb *func(DebugControllerDBus, uintptr) bool) uint

Emitted when a D-Bus peer is trying to change the debug settings and used to determine if that is authorized.

This signal is emitted in a dedicated worker thread, so handlers are allowed to perform blocking I/O. This means that, for example, it is appropriate to call `polkit_authority_check_authorization_sync()` to check authorization using polkit.

If %FALSE is returned then no further handlers are run and the request to change the debug settings is rejected.

Otherwise, if %TRUE is returned, signal emission continues. If no handlers return %FALSE, then the debug settings are allowed to be changed.

Signal handlers must not modify @invocation, or cause it to return a value.

The default class handler just returns %TRUE.

func (*DebugControllerDBus) GetDebugEnabled

func (x *DebugControllerDBus) GetDebugEnabled() bool

Get the value of #GDebugController:debug-enabled.

func (*DebugControllerDBus) GoPointer

func (c *DebugControllerDBus) GoPointer() uintptr

func (*DebugControllerDBus) Init

func (x *DebugControllerDBus) Init(CancellableVar *Cancellable) (bool, error)

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 [description][iface@Gio.Initable#description] 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.

func (*DebugControllerDBus) SetDebugEnabled

func (x *DebugControllerDBus) SetDebugEnabled(DebugEnabledVar bool)

Set the value of #GDebugController:debug-enabled.

func (*DebugControllerDBus) SetGoPointer

func (c *DebugControllerDBus) SetGoPointer(ptr uintptr)

func (*DebugControllerDBus) Stop

func (x *DebugControllerDBus) Stop()

Stop the debug controller, unregistering its object from the bus.

Any pending method calls to the object will complete successfully, but new ones will return an error. This method will block until all pending #GDebugControllerDBus::authorize signals have been handled. This is expected to not take long, as it will just be waiting for threads to join. If any #GDebugControllerDBus::authorize signal handlers are still executing in other threads, this will block until after they have returned.

This method will be called automatically when the final reference to the #GDebugControllerDBus is dropped. You may want to call it explicitly to know when the controller has been fully removed from the bus, or to break reference count cycles.

Calling this method from within a #GDebugControllerDBus::authorize signal handler will cause a deadlock and must not be done.

type DebugControllerDBusClass

type DebugControllerDBusClass struct {
	ParentClass gobject.ObjectClass

	Padding [12]uintptr
	// contains filtered or unexported fields
}

The virtual function table for #GDebugControllerDBus.

func (*DebugControllerDBusClass) GetAuthorize

GetAuthorize gets the "authorize" callback function. Default handler for the #GDebugControllerDBus::authorize signal.

func (*DebugControllerDBusClass) GoPointer

func (x *DebugControllerDBusClass) GoPointer() uintptr

func (*DebugControllerDBusClass) OverrideAuthorize

func (x *DebugControllerDBusClass) OverrideAuthorize(cb func(*DebugControllerDBus, *DBusMethodInvocation) bool)

OverrideAuthorize sets the "authorize" callback function. Default handler for the #GDebugControllerDBus::authorize signal.

type DebugControllerInterface

type DebugControllerInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

The virtual function table for #GDebugController.

func (*DebugControllerInterface) GoPointer

func (x *DebugControllerInterface) GoPointer() uintptr

type Drive

type Drive interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	CanEject() bool
	CanPollForMedia() bool
	CanStart() bool
	CanStartDegraded() bool
	CanStop() bool
	Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	EjectFinish(ResultVar AsyncResult) (bool, error)
	EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	EjectWithOperationFinish(ResultVar AsyncResult) (bool, error)
	EnumerateIdentifiers() []string
	GetIcon() *IconBase
	GetIdentifier(KindVar string) string
	GetName() string
	GetSortKey() string
	GetStartStopType() DriveStartStopType
	GetSymbolicIcon() *IconBase
	GetVolumes() *glib.List
	HasMedia() bool
	HasVolumes() bool
	IsMediaCheckAutomatic() bool
	IsMediaRemovable() bool
	IsRemovable() bool
	PollForMedia(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	PollForMediaFinish(ResultVar AsyncResult) (bool, error)
	Start(FlagsVar DriveStartFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	StartFinish(ResultVar AsyncResult) (bool, error)
	Stop(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	StopFinish(ResultVar AsyncResult) (bool, error)
}

`GDrive` represents a piece of hardware connected to the machine. It’s generally only created for removable hardware or hardware with removable media. For example, an optical disc drive, or a USB flash drive.

`GDrive` is a container class for [iface@Gio.Volume] 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 [method@Gio.Drive.get_start_stop_type].

For [porting from GnomeVFS](migrating-gnome-vfs.html) note that there is no equivalent of `GDrive` in that API.

type DriveBase

type DriveBase struct {
	Ptr uintptr
}

func (*DriveBase) CanEject

func (x *DriveBase) CanEject() bool

Checks if a drive can be ejected.

func (*DriveBase) CanPollForMedia

func (x *DriveBase) CanPollForMedia() bool

Checks if a drive can be polled for media changes.

func (*DriveBase) CanStart

func (x *DriveBase) CanStart() bool

Checks if a drive can be started.

func (*DriveBase) CanStartDegraded

func (x *DriveBase) CanStartDegraded() bool

Checks if a drive can be started degraded.

func (*DriveBase) CanStop

func (x *DriveBase) CanStop() bool

Checks if a drive can be stopped.

func (*DriveBase) Eject

func (x *DriveBase) Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*DriveBase) EjectFinish

func (x *DriveBase) EjectFinish(ResultVar AsyncResult) (bool, error)

Finishes ejecting a drive.

func (*DriveBase) EjectWithOperation

func (x *DriveBase) EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*DriveBase) EjectWithOperationFinish

func (x *DriveBase) EjectWithOperationFinish(ResultVar AsyncResult) (bool, error)

Finishes ejecting a drive. If any errors occurred during the operation, @error will be set to contain the errors and %FALSE will be returned.

func (*DriveBase) EnumerateIdentifiers

func (x *DriveBase) EnumerateIdentifiers() []string

Gets the kinds of identifiers that @drive has. Use g_drive_get_identifier() to obtain the identifiers themselves.

func (*DriveBase) GetIcon

func (x *DriveBase) GetIcon() *IconBase

Gets the icon for @drive.

func (*DriveBase) GetIdentifier

func (x *DriveBase) GetIdentifier(KindVar string) string

Gets the identifier of the given kind for @drive. The only identifier currently available is %G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE.

func (*DriveBase) GetName

func (x *DriveBase) GetName() string

Gets the name of @drive.

func (*DriveBase) GetSortKey

func (x *DriveBase) GetSortKey() string

Gets the sort key for @drive, if any.

func (*DriveBase) GetStartStopType

func (x *DriveBase) GetStartStopType() DriveStartStopType

Gets a hint about how a drive can be started/stopped.

func (*DriveBase) GetSymbolicIcon

func (x *DriveBase) GetSymbolicIcon() *IconBase

Gets the icon for @drive.

func (*DriveBase) GetVolumes

func (x *DriveBase) GetVolumes() *glib.List

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().

func (*DriveBase) GoPointer

func (x *DriveBase) GoPointer() uintptr

func (*DriveBase) HasMedia

func (x *DriveBase) HasMedia() bool

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.

func (*DriveBase) HasVolumes

func (x *DriveBase) HasVolumes() bool

Check if @drive has any mountable volumes.

func (*DriveBase) IsMediaCheckAutomatic

func (x *DriveBase) IsMediaCheckAutomatic() bool

Checks if @drive is capable of automatically detecting media changes.

func (*DriveBase) IsMediaRemovable

func (x *DriveBase) IsMediaRemovable() bool

Checks if the @drive supports removable media.

func (*DriveBase) IsRemovable

func (x *DriveBase) IsRemovable() bool

Checks if the #GDrive and/or its media is considered removable by the user. See g_drive_is_media_removable().

func (*DriveBase) PollForMedia

func (x *DriveBase) PollForMedia(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*DriveBase) PollForMediaFinish

func (x *DriveBase) PollForMediaFinish(ResultVar AsyncResult) (bool, error)

Finishes an operation started with g_drive_poll_for_media() on a drive.

func (*DriveBase) SetGoPointer

func (x *DriveBase) SetGoPointer(ptr uintptr)

func (*DriveBase) Start

func (x *DriveBase) Start(FlagsVar DriveStartFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*DriveBase) StartFinish

func (x *DriveBase) StartFinish(ResultVar AsyncResult) (bool, error)

Finishes starting a drive.

func (*DriveBase) Stop

func (x *DriveBase) Stop(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*DriveBase) StopFinish

func (x *DriveBase) StopFinish(ResultVar AsyncResult) (bool, error)

Finishes stopping a drive.

type DriveIface

type DriveIface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

Interface for creating #GDrive implementations.

func (*DriveIface) GetCanEject

func (x *DriveIface) GetCanEject() func(Drive) bool

GetCanEject gets the "can_eject" callback function. Returns %TRUE if the #GDrive can eject media.

func (*DriveIface) GetCanPollForMedia

func (x *DriveIface) GetCanPollForMedia() func(Drive) bool

GetCanPollForMedia gets the "can_poll_for_media" callback function. Returns %TRUE if the #GDrive is capable of manually polling for media change.

func (*DriveIface) GetCanStart

func (x *DriveIface) GetCanStart() func(Drive) bool

GetCanStart gets the "can_start" callback function. Returns %TRUE if a #GDrive can be started. Since 2.22.

func (*DriveIface) GetCanStartDegraded

func (x *DriveIface) GetCanStartDegraded() func(Drive) bool

GetCanStartDegraded gets the "can_start_degraded" callback function. Returns %TRUE if a #GDrive can be started degraded. Since 2.22.

func (*DriveIface) GetCanStop

func (x *DriveIface) GetCanStop() func(Drive) bool

GetCanStop gets the "can_stop" callback function. Returns %TRUE if a #GDrive can be stopped. Since 2.22.

func (*DriveIface) GetChanged

func (x *DriveIface) GetChanged() func(Drive)

GetChanged gets the "changed" callback function. Signal emitted when the drive is changed.

func (*DriveIface) GetDisconnected

func (x *DriveIface) GetDisconnected() func(Drive)

GetDisconnected gets the "disconnected" callback function. The removed signal that is emitted when the #GDrive have been disconnected. If the recipient is holding references to the object they should release them so the object can be finalized.

func (*DriveIface) GetEject

GetEject gets the "eject" callback function. Ejects a #GDrive.

func (*DriveIface) GetEjectButton

func (x *DriveIface) GetEjectButton() func(Drive)

GetEjectButton gets the "eject_button" callback function. Signal emitted when the physical eject button (if any) of a drive have been pressed.

func (*DriveIface) GetEjectFinish

func (x *DriveIface) GetEjectFinish() func(Drive, AsyncResult) bool

GetEjectFinish gets the "eject_finish" callback function. Finishes an eject operation.

func (*DriveIface) GetEjectWithOperation

func (x *DriveIface) GetEjectWithOperation() func(Drive, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr)

GetEjectWithOperation gets the "eject_with_operation" callback function. Starts ejecting a #GDrive using a #GMountOperation. Since 2.22.

func (*DriveIface) GetEjectWithOperationFinish

func (x *DriveIface) GetEjectWithOperationFinish() func(Drive, AsyncResult) bool

GetEjectWithOperationFinish gets the "eject_with_operation_finish" callback function. Finishes an eject operation using a #GMountOperation. Since 2.22.

func (*DriveIface) GetEnumerateIdentifiers

func (x *DriveIface) GetEnumerateIdentifiers() func(Drive) []string

GetEnumerateIdentifiers gets the "enumerate_identifiers" callback function. Returns an array strings listing the kinds

of identifiers which the #GDrive has.

func (*DriveIface) GetGetIcon

func (x *DriveIface) GetGetIcon() func(Drive) *IconBase

GetGetIcon gets the "get_icon" callback function. Returns a #GIcon for the given #GDrive.

func (*DriveIface) GetGetIdentifier

func (x *DriveIface) GetGetIdentifier() func(Drive, string) string

GetGetIdentifier gets the "get_identifier" callback function. Returns the identifier of the given kind, or %NULL if

the #GDrive doesn't have one.

func (*DriveIface) GetGetName

func (x *DriveIface) GetGetName() func(Drive) string

GetGetName gets the "get_name" callback function. Returns the name for the given #GDrive.

func (*DriveIface) GetGetSortKey

func (x *DriveIface) GetGetSortKey() func(Drive) string

GetGetSortKey gets the "get_sort_key" callback function. Gets a key used for sorting #GDrive instances or %NULL if no such key exists. Since 2.32.

func (*DriveIface) GetGetStartStopType

func (x *DriveIface) GetGetStartStopType() func(Drive) DriveStartStopType

GetGetStartStopType gets the "get_start_stop_type" callback function. Gets a #GDriveStartStopType with details about starting/stopping the drive. Since 2.22.

func (*DriveIface) GetGetSymbolicIcon

func (x *DriveIface) GetGetSymbolicIcon() func(Drive) *IconBase

GetGetSymbolicIcon gets the "get_symbolic_icon" callback function. Returns a symbolic #GIcon for the given #GDrive. Since 2.34.

func (*DriveIface) GetGetVolumes

func (x *DriveIface) GetGetVolumes() func(Drive) *glib.List

GetGetVolumes gets the "get_volumes" callback function. Returns a list #GList of #GVolume for the #GDrive.

func (*DriveIface) GetHasMedia

func (x *DriveIface) GetHasMedia() func(Drive) bool

GetHasMedia gets the "has_media" callback function. Returns %TRUE if the #GDrive has media inserted.

func (*DriveIface) GetHasVolumes

func (x *DriveIface) GetHasVolumes() func(Drive) bool

GetHasVolumes gets the "has_volumes" callback function. Returns %TRUE if the #GDrive has mountable volumes.

func (*DriveIface) GetIsMediaCheckAutomatic

func (x *DriveIface) GetIsMediaCheckAutomatic() func(Drive) bool

GetIsMediaCheckAutomatic gets the "is_media_check_automatic" callback function. Returns %TRUE if the #GDrive is capable of automatically detecting media changes.

func (*DriveIface) GetIsMediaRemovable

func (x *DriveIface) GetIsMediaRemovable() func(Drive) bool

GetIsMediaRemovable gets the "is_media_removable" callback function. Returns %TRUE if the #GDrive supports removal and insertion of media.

func (*DriveIface) GetIsRemovable

func (x *DriveIface) GetIsRemovable() func(Drive) bool

GetIsRemovable gets the "is_removable" callback function. Returns %TRUE if the #GDrive and/or its media is considered removable by the user. Since 2.50.

func (*DriveIface) GetPollForMedia

func (x *DriveIface) GetPollForMedia() func(Drive, *Cancellable, *AsyncReadyCallback, uintptr)

GetPollForMedia gets the "poll_for_media" callback function. Poll for media insertion/removal on a #GDrive.

func (*DriveIface) GetPollForMediaFinish

func (x *DriveIface) GetPollForMediaFinish() func(Drive, AsyncResult) bool

GetPollForMediaFinish gets the "poll_for_media_finish" callback function. Finishes a media poll operation.

func (*DriveIface) GetStart

GetStart gets the "start" callback function. Starts a #GDrive. Since 2.22.

func (*DriveIface) GetStartFinish

func (x *DriveIface) GetStartFinish() func(Drive, AsyncResult) bool

GetStartFinish gets the "start_finish" callback function. Finishes a start operation. Since 2.22.

func (*DriveIface) GetStop

GetStop gets the "stop" callback function. Stops a #GDrive. Since 2.22.

func (*DriveIface) GetStopButton

func (x *DriveIface) GetStopButton() func(Drive)

GetStopButton gets the "stop_button" callback function. Signal emitted when the physical stop button (if any) of a drive have been pressed. Since 2.22.

func (*DriveIface) GetStopFinish

func (x *DriveIface) GetStopFinish() func(Drive, AsyncResult) bool

GetStopFinish gets the "stop_finish" callback function. Finishes a stop operation. Since 2.22.

func (*DriveIface) GoPointer

func (x *DriveIface) GoPointer() uintptr

func (*DriveIface) OverrideCanEject

func (x *DriveIface) OverrideCanEject(cb func(Drive) bool)

OverrideCanEject sets the "can_eject" callback function. Returns %TRUE if the #GDrive can eject media.

func (*DriveIface) OverrideCanPollForMedia

func (x *DriveIface) OverrideCanPollForMedia(cb func(Drive) bool)

OverrideCanPollForMedia sets the "can_poll_for_media" callback function. Returns %TRUE if the #GDrive is capable of manually polling for media change.

func (*DriveIface) OverrideCanStart

func (x *DriveIface) OverrideCanStart(cb func(Drive) bool)

OverrideCanStart sets the "can_start" callback function. Returns %TRUE if a #GDrive can be started. Since 2.22.

func (*DriveIface) OverrideCanStartDegraded

func (x *DriveIface) OverrideCanStartDegraded(cb func(Drive) bool)

OverrideCanStartDegraded sets the "can_start_degraded" callback function. Returns %TRUE if a #GDrive can be started degraded. Since 2.22.

func (*DriveIface) OverrideCanStop

func (x *DriveIface) OverrideCanStop(cb func(Drive) bool)

OverrideCanStop sets the "can_stop" callback function. Returns %TRUE if a #GDrive can be stopped. Since 2.22.

func (*DriveIface) OverrideChanged

func (x *DriveIface) OverrideChanged(cb func(Drive))

OverrideChanged sets the "changed" callback function. Signal emitted when the drive is changed.

func (*DriveIface) OverrideDisconnected

func (x *DriveIface) OverrideDisconnected(cb func(Drive))

OverrideDisconnected sets the "disconnected" callback function. The removed signal that is emitted when the #GDrive have been disconnected. If the recipient is holding references to the object they should release them so the object can be finalized.

func (*DriveIface) OverrideEject

func (x *DriveIface) OverrideEject(cb func(Drive, MountUnmountFlags, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideEject sets the "eject" callback function. Ejects a #GDrive.

func (*DriveIface) OverrideEjectButton

func (x *DriveIface) OverrideEjectButton(cb func(Drive))

OverrideEjectButton sets the "eject_button" callback function. Signal emitted when the physical eject button (if any) of a drive have been pressed.

func (*DriveIface) OverrideEjectFinish

func (x *DriveIface) OverrideEjectFinish(cb func(Drive, AsyncResult) bool)

OverrideEjectFinish sets the "eject_finish" callback function. Finishes an eject operation.

func (*DriveIface) OverrideEjectWithOperation

func (x *DriveIface) OverrideEjectWithOperation(cb func(Drive, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideEjectWithOperation sets the "eject_with_operation" callback function. Starts ejecting a #GDrive using a #GMountOperation. Since 2.22.

func (*DriveIface) OverrideEjectWithOperationFinish

func (x *DriveIface) OverrideEjectWithOperationFinish(cb func(Drive, AsyncResult) bool)

OverrideEjectWithOperationFinish sets the "eject_with_operation_finish" callback function. Finishes an eject operation using a #GMountOperation. Since 2.22.

func (*DriveIface) OverrideEnumerateIdentifiers

func (x *DriveIface) OverrideEnumerateIdentifiers(cb func(Drive) []string)

OverrideEnumerateIdentifiers sets the "enumerate_identifiers" callback function. Returns an array strings listing the kinds

of identifiers which the #GDrive has.

func (*DriveIface) OverrideGetIcon

func (x *DriveIface) OverrideGetIcon(cb func(Drive) *IconBase)

OverrideGetIcon sets the "get_icon" callback function. Returns a #GIcon for the given #GDrive.

func (*DriveIface) OverrideGetIdentifier

func (x *DriveIface) OverrideGetIdentifier(cb func(Drive, string) string)

OverrideGetIdentifier sets the "get_identifier" callback function. Returns the identifier of the given kind, or %NULL if

the #GDrive doesn't have one.

func (*DriveIface) OverrideGetName

func (x *DriveIface) OverrideGetName(cb func(Drive) string)

OverrideGetName sets the "get_name" callback function. Returns the name for the given #GDrive.

func (*DriveIface) OverrideGetSortKey

func (x *DriveIface) OverrideGetSortKey(cb func(Drive) string)

OverrideGetSortKey sets the "get_sort_key" callback function. Gets a key used for sorting #GDrive instances or %NULL if no such key exists. Since 2.32.

func (*DriveIface) OverrideGetStartStopType

func (x *DriveIface) OverrideGetStartStopType(cb func(Drive) DriveStartStopType)

OverrideGetStartStopType sets the "get_start_stop_type" callback function. Gets a #GDriveStartStopType with details about starting/stopping the drive. Since 2.22.

func (*DriveIface) OverrideGetSymbolicIcon

func (x *DriveIface) OverrideGetSymbolicIcon(cb func(Drive) *IconBase)

OverrideGetSymbolicIcon sets the "get_symbolic_icon" callback function. Returns a symbolic #GIcon for the given #GDrive. Since 2.34.

func (*DriveIface) OverrideGetVolumes

func (x *DriveIface) OverrideGetVolumes(cb func(Drive) *glib.List)

OverrideGetVolumes sets the "get_volumes" callback function. Returns a list #GList of #GVolume for the #GDrive.

func (*DriveIface) OverrideHasMedia

func (x *DriveIface) OverrideHasMedia(cb func(Drive) bool)

OverrideHasMedia sets the "has_media" callback function. Returns %TRUE if the #GDrive has media inserted.

func (*DriveIface) OverrideHasVolumes

func (x *DriveIface) OverrideHasVolumes(cb func(Drive) bool)

OverrideHasVolumes sets the "has_volumes" callback function. Returns %TRUE if the #GDrive has mountable volumes.

func (*DriveIface) OverrideIsMediaCheckAutomatic

func (x *DriveIface) OverrideIsMediaCheckAutomatic(cb func(Drive) bool)

OverrideIsMediaCheckAutomatic sets the "is_media_check_automatic" callback function. Returns %TRUE if the #GDrive is capable of automatically detecting media changes.

func (*DriveIface) OverrideIsMediaRemovable

func (x *DriveIface) OverrideIsMediaRemovable(cb func(Drive) bool)

OverrideIsMediaRemovable sets the "is_media_removable" callback function. Returns %TRUE if the #GDrive supports removal and insertion of media.

func (*DriveIface) OverrideIsRemovable

func (x *DriveIface) OverrideIsRemovable(cb func(Drive) bool)

OverrideIsRemovable sets the "is_removable" callback function. Returns %TRUE if the #GDrive and/or its media is considered removable by the user. Since 2.50.

func (*DriveIface) OverridePollForMedia

func (x *DriveIface) OverridePollForMedia(cb func(Drive, *Cancellable, *AsyncReadyCallback, uintptr))

OverridePollForMedia sets the "poll_for_media" callback function. Poll for media insertion/removal on a #GDrive.

func (*DriveIface) OverridePollForMediaFinish

func (x *DriveIface) OverridePollForMediaFinish(cb func(Drive, AsyncResult) bool)

OverridePollForMediaFinish sets the "poll_for_media_finish" callback function. Finishes a media poll operation.

func (*DriveIface) OverrideStart

OverrideStart sets the "start" callback function. Starts a #GDrive. Since 2.22.

func (*DriveIface) OverrideStartFinish

func (x *DriveIface) OverrideStartFinish(cb func(Drive, AsyncResult) bool)

OverrideStartFinish sets the "start_finish" callback function. Finishes a start operation. Since 2.22.

func (*DriveIface) OverrideStop

OverrideStop sets the "stop" callback function. Stops a #GDrive. Since 2.22.

func (*DriveIface) OverrideStopButton

func (x *DriveIface) OverrideStopButton(cb func(Drive))

OverrideStopButton sets the "stop_button" callback function. Signal emitted when the physical stop button (if any) of a drive have been pressed. Since 2.22.

func (*DriveIface) OverrideStopFinish

func (x *DriveIface) OverrideStopFinish(cb func(Drive, AsyncResult) bool)

OverrideStopFinish sets the "stop_finish" callback function. Finishes a stop operation. Since 2.22.

type DriveStartFlags

type DriveStartFlags int

Flags used when starting a drive.

const (

	// No flags set.
	GDriveStartNoneValue DriveStartFlags = 0
)

type DriveStartStopType

type DriveStartStopType int

Enumeration describing how a drive can be started/stopped.

const (

	// Unknown or drive doesn't support
	//    start/stop.
	GDriveStartStopTypeUnknownValue DriveStartStopType = 0
	// The stop method will physically
	//    shut down the drive and e.g. power down the port the drive is
	//    attached to.
	GDriveStartStopTypeShutdownValue DriveStartStopType = 1
	// The start/stop methods are used
	//    for connecting/disconnect to the drive over the network.
	GDriveStartStopTypeNetworkValue DriveStartStopType = 2
	// The start/stop methods will
	//    assemble/disassemble a virtual drive from several physical
	//    drives.
	GDriveStartStopTypeMultidiskValue DriveStartStopType = 3
	// The start/stop methods will
	//    unlock/lock the disk (for example using the ATA `SECURITY UNLOCK
	//    DEVICE` command)
	GDriveStartStopTypePasswordValue DriveStartStopType = 4
)

type DtlsClientConnection

type DtlsClientConnection interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	GetAcceptedCas() *glib.List
	GetServerIdentity() *SocketConnectableBase
	GetValidationFlags() TlsCertificateFlags
	SetServerIdentity(IdentityVar SocketConnectable)
	SetValidationFlags(FlagsVar TlsCertificateFlags)
}

`GDtlsClientConnection` is the client-side subclass of [iface@Gio.DtlsConnection], representing a client-side DTLS connection.

type DtlsClientConnectionBase

type DtlsClientConnectionBase struct {
	Ptr uintptr
}

func DtlsClientConnectionNew

func DtlsClientConnectionNew(BaseSocketVar DatagramBased, ServerIdentityVar SocketConnectable) (*DtlsClientConnectionBase, error)

Creates a new #GDtlsClientConnection wrapping @base_socket which is assumed to communicate with the server identified by @server_identity.

func (*DtlsClientConnectionBase) GetAcceptedCas

func (x *DtlsClientConnectionBase) GetAcceptedCas() *glib.List

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.

func (*DtlsClientConnectionBase) GetServerIdentity

func (x *DtlsClientConnectionBase) GetServerIdentity() *SocketConnectableBase

Gets @conn's expected server identity

func (*DtlsClientConnectionBase) GetValidationFlags

func (x *DtlsClientConnectionBase) GetValidationFlags() TlsCertificateFlags

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.

func (*DtlsClientConnectionBase) GoPointer

func (x *DtlsClientConnectionBase) GoPointer() uintptr

func (*DtlsClientConnectionBase) SetGoPointer

func (x *DtlsClientConnectionBase) SetGoPointer(ptr uintptr)

func (*DtlsClientConnectionBase) SetServerIdentity

func (x *DtlsClientConnectionBase) SetServerIdentity(IdentityVar SocketConnectable)

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.

func (*DtlsClientConnectionBase) SetValidationFlags

func (x *DtlsClientConnectionBase) SetValidationFlags(FlagsVar TlsCertificateFlags)

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.

type DtlsClientConnectionInterface

type DtlsClientConnectionInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

vtable for a #GDtlsClientConnection implementation.

func (*DtlsClientConnectionInterface) GoPointer

func (x *DtlsClientConnectionInterface) GoPointer() uintptr

type DtlsConnection

type DtlsConnection interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	Close(CancellableVar *Cancellable) (bool, error)
	CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	CloseFinish(ResultVar AsyncResult) (bool, error)
	EmitAcceptCertificate(PeerCertVar *TlsCertificate, ErrorsVar TlsCertificateFlags) bool
	GetCertificate() *TlsCertificate
	GetChannelBindingData(TypeVar TlsChannelBindingType, DataVar *[]byte) (bool, error)
	GetCiphersuiteName() string
	GetDatabase() *TlsDatabase
	GetInteraction() *TlsInteraction
	GetNegotiatedProtocol() string
	GetPeerCertificate() *TlsCertificate
	GetPeerCertificateErrors() TlsCertificateFlags
	GetProtocolVersion() TlsProtocolVersion
	GetRehandshakeMode() TlsRehandshakeMode
	GetRequireCloseNotify() bool
	Handshake(CancellableVar *Cancellable) (bool, error)
	HandshakeAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	HandshakeFinish(ResultVar AsyncResult) (bool, error)
	SetAdvertisedProtocols(ProtocolsVar []string)
	SetCertificate(CertificateVar *TlsCertificate)
	SetDatabase(DatabaseVar *TlsDatabase)
	SetInteraction(InteractionVar *TlsInteraction)
	SetRehandshakeMode(ModeVar TlsRehandshakeMode)
	SetRequireCloseNotify(RequireCloseNotifyVar bool)
	Shutdown(ShutdownReadVar bool, ShutdownWriteVar bool, CancellableVar *Cancellable) (bool, error)
	ShutdownAsync(ShutdownReadVar bool, ShutdownWriteVar bool, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	ShutdownFinish(ResultVar AsyncResult) (bool, error)
}

`GDtlsConnection` is the base DTLS connection class type, which wraps a [iface@Gio.DatagramBased] and provides DTLS encryption on top of it. Its subclasses, [iface@Gio.DtlsClientConnection] and [iface@Gio.DtlsServerConnection], implement client-side and server-side DTLS, respectively.

For TLS support, see [class@Gio.TlsConnection].

As DTLS is datagram based, `GDtlsConnection` implements [iface@Gio.DatagramBased], presenting a datagram-socket-like API for the encrypted connection. This operates over a base datagram connection, which is also a `GDatagramBased` ([property@Gio.DtlsConnection:base-socket]).

To close a DTLS connection, use [method@Gio.DtlsConnection.close].

Neither [iface@Gio.DtlsServerConnection] or [iface@Gio.DtlsClientConnection] set the peer address on their base [iface@Gio.DatagramBased] if it is a [class@Gio.Socket] — it is up to the caller to do that if they wish. If they do not, and [method@Gio.Socket.close] is called on the base socket, the `GDtlsConnection` will not raise a `G_IO_ERROR_NOT_CONNECTED` error on further I/O.

type DtlsConnectionBase

type DtlsConnectionBase struct {
	Ptr uintptr
}

func (*DtlsConnectionBase) Close

func (x *DtlsConnectionBase) Close(CancellableVar *Cancellable) (bool, error)

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.

func (*DtlsConnectionBase) CloseAsync

func (x *DtlsConnectionBase) CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously close the DTLS connection. See g_dtls_connection_close() for more information.

func (*DtlsConnectionBase) CloseFinish

func (x *DtlsConnectionBase) CloseFinish(ResultVar AsyncResult) (bool, error)

Finish an asynchronous TLS close operation. See g_dtls_connection_close() for more information.

func (*DtlsConnectionBase) EmitAcceptCertificate

func (x *DtlsConnectionBase) EmitAcceptCertificate(PeerCertVar *TlsCertificate, ErrorsVar TlsCertificateFlags) bool

Used by #GDtlsConnection implementations to emit the #GDtlsConnection::accept-certificate signal.

func (*DtlsConnectionBase) GetCertificate

func (x *DtlsConnectionBase) GetCertificate() *TlsCertificate

Gets @conn's certificate, as set by g_dtls_connection_set_certificate().

func (*DtlsConnectionBase) GetChannelBindingData

func (x *DtlsConnectionBase) GetChannelBindingData(TypeVar TlsChannelBindingType, DataVar *[]byte) (bool, error)

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.

func (*DtlsConnectionBase) GetCiphersuiteName

func (x *DtlsConnectionBase) GetCiphersuiteName() string

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.

func (*DtlsConnectionBase) GetDatabase

func (x *DtlsConnectionBase) GetDatabase() *TlsDatabase

Gets the certificate database that @conn uses to verify peer certificates. See g_dtls_connection_set_database().

func (*DtlsConnectionBase) GetInteraction

func (x *DtlsConnectionBase) GetInteraction() *TlsInteraction

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.

func (*DtlsConnectionBase) GetNegotiatedProtocol

func (x *DtlsConnectionBase) GetNegotiatedProtocol() string

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().

func (*DtlsConnectionBase) GetPeerCertificate

func (x *DtlsConnectionBase) GetPeerCertificate() *TlsCertificate

Gets @conn's peer's certificate after the handshake has completed or failed. (It is not set during the emission of #GDtlsConnection::accept-certificate.)

func (*DtlsConnectionBase) GetPeerCertificateErrors

func (x *DtlsConnectionBase) GetPeerCertificateErrors() TlsCertificateFlags

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.)

func (*DtlsConnectionBase) GetPropertyAdvertisedProtocols

func (x *DtlsConnectionBase) GetPropertyAdvertisedProtocols() []string

GetPropertyAdvertisedProtocols gets the "advertised-protocols" property. The list of application-layer protocols that the connection advertises that it is willing to speak. See g_dtls_connection_set_advertised_protocols().

func (*DtlsConnectionBase) GetPropertyCiphersuiteName

func (x *DtlsConnectionBase) GetPropertyCiphersuiteName() string

GetPropertyCiphersuiteName gets the "ciphersuite-name" property. The name of the DTLS ciphersuite in use. See g_dtls_connection_get_ciphersuite_name().

func (*DtlsConnectionBase) GetPropertyNegotiatedProtocol

func (x *DtlsConnectionBase) GetPropertyNegotiatedProtocol() string

GetPropertyNegotiatedProtocol gets the "negotiated-protocol" property. The application-layer protocol negotiated during the TLS handshake. See g_dtls_connection_get_negotiated_protocol().

func (*DtlsConnectionBase) GetPropertyRequireCloseNotify

func (x *DtlsConnectionBase) GetPropertyRequireCloseNotify() bool

GetPropertyRequireCloseNotify gets the "require-close-notify" property. Whether or not proper TLS close notification is required. See g_dtls_connection_set_require_close_notify().

func (*DtlsConnectionBase) GetProtocolVersion

func (x *DtlsConnectionBase) GetProtocolVersion() TlsProtocolVersion

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.

func (*DtlsConnectionBase) GetRehandshakeMode

func (x *DtlsConnectionBase) GetRehandshakeMode() TlsRehandshakeMode

Gets @conn rehandshaking mode. See g_dtls_connection_set_rehandshake_mode() for details.

func (*DtlsConnectionBase) GetRequireCloseNotify

func (x *DtlsConnectionBase) GetRequireCloseNotify() bool

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.

func (*DtlsConnectionBase) GoPointer

func (x *DtlsConnectionBase) GoPointer() uintptr

func (*DtlsConnectionBase) Handshake

func (x *DtlsConnectionBase) Handshake(CancellableVar *Cancellable) (bool, error)

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.

func (*DtlsConnectionBase) HandshakeAsync

func (x *DtlsConnectionBase) HandshakeAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously performs a TLS handshake on @conn. See g_dtls_connection_handshake() for more information.

func (*DtlsConnectionBase) HandshakeFinish

func (x *DtlsConnectionBase) HandshakeFinish(ResultVar AsyncResult) (bool, error)

Finish an asynchronous TLS handshake operation. See g_dtls_connection_handshake() for more information.

func (*DtlsConnectionBase) SetAdvertisedProtocols

func (x *DtlsConnectionBase) SetAdvertisedProtocols(ProtocolsVar []string)

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.

func (*DtlsConnectionBase) SetCertificate

func (x *DtlsConnectionBase) SetCertificate(CertificateVar *TlsCertificate)

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.)

func (*DtlsConnectionBase) SetDatabase

func (x *DtlsConnectionBase) SetDatabase(DatabaseVar *TlsDatabase)

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.

func (*DtlsConnectionBase) SetGoPointer

func (x *DtlsConnectionBase) SetGoPointer(ptr uintptr)

func (*DtlsConnectionBase) SetInteraction

func (x *DtlsConnectionBase) SetInteraction(InteractionVar *TlsInteraction)

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.

func (*DtlsConnectionBase) SetPropertyAdvertisedProtocols

func (x *DtlsConnectionBase) SetPropertyAdvertisedProtocols(value []string)

SetPropertyAdvertisedProtocols sets the "advertised-protocols" property. The list of application-layer protocols that the connection advertises that it is willing to speak. See g_dtls_connection_set_advertised_protocols().

func (*DtlsConnectionBase) SetPropertyRequireCloseNotify

func (x *DtlsConnectionBase) SetPropertyRequireCloseNotify(value bool)

SetPropertyRequireCloseNotify sets the "require-close-notify" property. Whether or not proper TLS close notification is required. See g_dtls_connection_set_require_close_notify().

func (*DtlsConnectionBase) SetRehandshakeMode

func (x *DtlsConnectionBase) SetRehandshakeMode(ModeVar TlsRehandshakeMode)

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.

func (*DtlsConnectionBase) SetRequireCloseNotify

func (x *DtlsConnectionBase) SetRequireCloseNotify(RequireCloseNotifyVar bool)

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.

func (*DtlsConnectionBase) Shutdown

func (x *DtlsConnectionBase) Shutdown(ShutdownReadVar bool, ShutdownWriteVar bool, CancellableVar *Cancellable) (bool, error)

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.

func (*DtlsConnectionBase) ShutdownAsync

func (x *DtlsConnectionBase) ShutdownAsync(ShutdownReadVar bool, ShutdownWriteVar bool, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously shut down part or all of the DTLS connection. See g_dtls_connection_shutdown() for more information.

func (*DtlsConnectionBase) ShutdownFinish

func (x *DtlsConnectionBase) ShutdownFinish(ResultVar AsyncResult) (bool, error)

Finish an asynchronous TLS shutdown operation. See g_dtls_connection_shutdown() for more information.

type DtlsConnectionInterface

type DtlsConnectionInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

Virtual method table for a #GDtlsConnection implementation.

func (*DtlsConnectionInterface) GetAcceptCertificate

GetAcceptCertificate gets the "accept_certificate" callback function. Check whether to accept a certificate.

func (*DtlsConnectionInterface) GetGetBindingData

func (x *DtlsConnectionInterface) GetGetBindingData() func(DtlsConnection, TlsChannelBindingType, []byte) bool

GetGetBindingData gets the "get_binding_data" callback function. Retrieve TLS channel binding data (Since: 2.66)

func (*DtlsConnectionInterface) GetGetNegotiatedProtocol

func (x *DtlsConnectionInterface) GetGetNegotiatedProtocol() func(DtlsConnection) string

GetGetNegotiatedProtocol gets the "get_negotiated_protocol" callback function. Get ALPN-negotiated protocol (Since: 2.60)

func (*DtlsConnectionInterface) GetHandshake

func (x *DtlsConnectionInterface) GetHandshake() func(DtlsConnection, *Cancellable) bool

GetHandshake gets the "handshake" callback function. Perform a handshake operation.

func (*DtlsConnectionInterface) GetHandshakeAsync

GetHandshakeAsync gets the "handshake_async" callback function. Start an asynchronous handshake operation.

func (*DtlsConnectionInterface) GetHandshakeFinish

func (x *DtlsConnectionInterface) GetHandshakeFinish() func(DtlsConnection, AsyncResult) bool

GetHandshakeFinish gets the "handshake_finish" callback function. Finish an asynchronous handshake operation.

func (*DtlsConnectionInterface) GetSetAdvertisedProtocols

func (x *DtlsConnectionInterface) GetSetAdvertisedProtocols() func(DtlsConnection, []string)

GetSetAdvertisedProtocols gets the "set_advertised_protocols" callback function. Set APLN protocol list (Since: 2.60)

func (*DtlsConnectionInterface) GetShutdown

func (x *DtlsConnectionInterface) GetShutdown() func(DtlsConnection, bool, bool, *Cancellable) bool

GetShutdown gets the "shutdown" callback function. Shut down one or both directions of the connection.

func (*DtlsConnectionInterface) GetShutdownAsync

GetShutdownAsync gets the "shutdown_async" callback function. Start an asynchronous shutdown operation.

func (*DtlsConnectionInterface) GetShutdownFinish

func (x *DtlsConnectionInterface) GetShutdownFinish() func(DtlsConnection, AsyncResult) bool

GetShutdownFinish gets the "shutdown_finish" callback function. Finish an asynchronous shutdown operation.

func (*DtlsConnectionInterface) GoPointer

func (x *DtlsConnectionInterface) GoPointer() uintptr

func (*DtlsConnectionInterface) OverrideAcceptCertificate

func (x *DtlsConnectionInterface) OverrideAcceptCertificate(cb func(DtlsConnection, *TlsCertificate, TlsCertificateFlags) bool)

OverrideAcceptCertificate sets the "accept_certificate" callback function. Check whether to accept a certificate.

func (*DtlsConnectionInterface) OverrideGetBindingData

func (x *DtlsConnectionInterface) OverrideGetBindingData(cb func(DtlsConnection, TlsChannelBindingType, []byte) bool)

OverrideGetBindingData sets the "get_binding_data" callback function. Retrieve TLS channel binding data (Since: 2.66)

func (*DtlsConnectionInterface) OverrideGetNegotiatedProtocol

func (x *DtlsConnectionInterface) OverrideGetNegotiatedProtocol(cb func(DtlsConnection) string)

OverrideGetNegotiatedProtocol sets the "get_negotiated_protocol" callback function. Get ALPN-negotiated protocol (Since: 2.60)

func (*DtlsConnectionInterface) OverrideHandshake

func (x *DtlsConnectionInterface) OverrideHandshake(cb func(DtlsConnection, *Cancellable) bool)

OverrideHandshake sets the "handshake" callback function. Perform a handshake operation.

func (*DtlsConnectionInterface) OverrideHandshakeAsync

func (x *DtlsConnectionInterface) OverrideHandshakeAsync(cb func(DtlsConnection, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideHandshakeAsync sets the "handshake_async" callback function. Start an asynchronous handshake operation.

func (*DtlsConnectionInterface) OverrideHandshakeFinish

func (x *DtlsConnectionInterface) OverrideHandshakeFinish(cb func(DtlsConnection, AsyncResult) bool)

OverrideHandshakeFinish sets the "handshake_finish" callback function. Finish an asynchronous handshake operation.

func (*DtlsConnectionInterface) OverrideSetAdvertisedProtocols

func (x *DtlsConnectionInterface) OverrideSetAdvertisedProtocols(cb func(DtlsConnection, []string))

OverrideSetAdvertisedProtocols sets the "set_advertised_protocols" callback function. Set APLN protocol list (Since: 2.60)

func (*DtlsConnectionInterface) OverrideShutdown

func (x *DtlsConnectionInterface) OverrideShutdown(cb func(DtlsConnection, bool, bool, *Cancellable) bool)

OverrideShutdown sets the "shutdown" callback function. Shut down one or both directions of the connection.

func (*DtlsConnectionInterface) OverrideShutdownAsync

func (x *DtlsConnectionInterface) OverrideShutdownAsync(cb func(DtlsConnection, bool, bool, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideShutdownAsync sets the "shutdown_async" callback function. Start an asynchronous shutdown operation.

func (*DtlsConnectionInterface) OverrideShutdownFinish

func (x *DtlsConnectionInterface) OverrideShutdownFinish(cb func(DtlsConnection, AsyncResult) bool)

OverrideShutdownFinish sets the "shutdown_finish" callback function. Finish an asynchronous shutdown operation.

type DtlsServerConnection

type DtlsServerConnection interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
}

`GDtlsServerConnection` is the server-side subclass of [iface@Gio.DtlsConnection], representing a server-side DTLS connection.

type DtlsServerConnectionBase

type DtlsServerConnectionBase struct {
	Ptr uintptr
}

func DtlsServerConnectionNew

func DtlsServerConnectionNew(BaseSocketVar DatagramBased, CertificateVar *TlsCertificate) (*DtlsServerConnectionBase, error)

Creates a new #GDtlsServerConnection wrapping @base_socket.

func (*DtlsServerConnectionBase) GoPointer

func (x *DtlsServerConnectionBase) GoPointer() uintptr

func (*DtlsServerConnectionBase) SetGoPointer

func (x *DtlsServerConnectionBase) SetGoPointer(ptr uintptr)

type DtlsServerConnectionInterface

type DtlsServerConnectionInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

vtable for a #GDtlsServerConnection implementation.

func (*DtlsServerConnectionInterface) GoPointer

func (x *DtlsServerConnectionInterface) GoPointer() uintptr

type EcnCodePoint added in v0.5.0

type EcnCodePoint int

Possible values of Explicit Congestion Notification code points.

These appear in `TOS` (IPv4) or `TCLASS` (IPv6) packet headers and are described in [RFC 3168](https://www.rfc-editor.org/rfc/rfc3168#section-5).

const (

	// Not ECN-capable transport
	GEcnNoEcnValue EcnCodePoint = 0
	// ECN Capable Transport(1)
	GEcnEct1Value EcnCodePoint = 1
	// ECN Capable Transport(0)
	GEcnEct0Value EcnCodePoint = 2
	// Congestion Experienced
	GEcnEctCeValue EcnCodePoint = 3
)

type Emblem

type Emblem struct {
	gobject.Object
}

`GEmblem` is an implementation of [iface@Gio.Icon] that supports having an emblem, which is an icon with additional properties. It can than be added to a [class@Gio.EmblemedIcon].

Currently, only metainformation about the emblem's origin is supported. More may be added in the future.

func EmblemNewFromInternalPtr

func EmblemNewFromInternalPtr(ptr uintptr) *Emblem

func NewEmblem

func NewEmblem(IconVar Icon) *Emblem

Creates a new emblem for @icon.

func NewEmblemWithOrigin

func NewEmblemWithOrigin(IconVar Icon, OriginVar EmblemOrigin) *Emblem

Creates a new emblem for @icon.

func (*Emblem) Equal

func (x *Emblem) Equal(Icon2Var Icon) bool

Checks if two icons are equal.

func (*Emblem) GetIcon

func (x *Emblem) GetIcon() *IconBase

Gives back the icon from @emblem.

func (*Emblem) GetOrigin

func (x *Emblem) GetOrigin() EmblemOrigin

Gets the origin of the emblem.

func (*Emblem) GoPointer

func (c *Emblem) GoPointer() uintptr

func (*Emblem) Hash

func (x *Emblem) Hash() uint

Gets a hash for an icon.

func (*Emblem) Serialize

func (x *Emblem) Serialize() *glib.Variant

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.

func (*Emblem) SetGoPointer

func (c *Emblem) SetGoPointer(ptr uintptr)

func (*Emblem) ToString

func (x *Emblem) ToString() string

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`).

type EmblemClass

type EmblemClass struct {
	// contains filtered or unexported fields
}

func (*EmblemClass) GoPointer

func (x *EmblemClass) GoPointer() uintptr

type EmblemOrigin

type EmblemOrigin int

GEmblemOrigin is used to add information about the origin of the emblem to #GEmblem.

const (

	// Emblem of unknown origin
	GEmblemOriginUnknownValue EmblemOrigin = 0
	// Emblem adds device-specific information
	GEmblemOriginDeviceValue EmblemOrigin = 1
	// Emblem depicts live metadata, such as "readonly"
	GEmblemOriginLivemetadataValue EmblemOrigin = 2
	// Emblem comes from a user-defined tag, e.g. set by nautilus (in the future)
	GEmblemOriginTagValue EmblemOrigin = 3
)

type EmblemedIcon

type EmblemedIcon struct {
	gobject.Object
}

`GEmblemedIcon` is an implementation of [iface@Gio.Icon] that supports adding an emblem to an icon. Adding multiple emblems to an icon is ensured via [method@Gio.EmblemedIcon.add_emblem].

Note that `GEmblemedIcon` allows no control over the position of the emblems. See also [class@Gio.Emblem] for more information.

func EmblemedIconNewFromInternalPtr

func EmblemedIconNewFromInternalPtr(ptr uintptr) *EmblemedIcon

func NewEmblemedIcon

func NewEmblemedIcon(IconVar Icon, EmblemVar *Emblem) *EmblemedIcon

Creates a new emblemed icon for @icon with the emblem @emblem.

func (*EmblemedIcon) AddEmblem

func (x *EmblemedIcon) AddEmblem(EmblemVar *Emblem)

Adds @emblem to the #GList of #GEmblems.

func (*EmblemedIcon) ClearEmblems

func (x *EmblemedIcon) ClearEmblems()

Removes all the emblems from @icon.

func (*EmblemedIcon) Equal

func (x *EmblemedIcon) Equal(Icon2Var Icon) bool

Checks if two icons are equal.

func (*EmblemedIcon) GetEmblems

func (x *EmblemedIcon) GetEmblems() *glib.List

Gets the list of emblems for the @icon.

func (*EmblemedIcon) GetIcon

func (x *EmblemedIcon) GetIcon() *IconBase

Gets the main icon for @emblemed.

func (*EmblemedIcon) GoPointer

func (c *EmblemedIcon) GoPointer() uintptr

func (*EmblemedIcon) Hash

func (x *EmblemedIcon) Hash() uint

Gets a hash for an icon.

func (*EmblemedIcon) Serialize

func (x *EmblemedIcon) Serialize() *glib.Variant

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.

func (*EmblemedIcon) SetGoPointer

func (c *EmblemedIcon) SetGoPointer(ptr uintptr)

func (*EmblemedIcon) ToString

func (x *EmblemedIcon) ToString() string

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`).

type EmblemedIconClass

type EmblemedIconClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*EmblemedIconClass) GoPointer

func (x *EmblemedIconClass) GoPointer() uintptr

type EmblemedIconPrivate

type EmblemedIconPrivate struct {
	// contains filtered or unexported fields
}

func (*EmblemedIconPrivate) GoPointer

func (x *EmblemedIconPrivate) GoPointer() uintptr

type File

type File interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	AppendTo(FlagsVar FileCreateFlags, CancellableVar *Cancellable) (*FileOutputStream, error)
	AppendToAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	AppendToFinish(ResVar AsyncResult) (*FileOutputStream, error)
	BuildAttributeListForCopy(FlagsVar FileCopyFlags, CancellableVar *Cancellable) (string, error)
	Copy(DestinationVar File, FlagsVar FileCopyFlags, CancellableVar *Cancellable, ProgressCallbackVar *FileProgressCallback, ProgressCallbackDataVar uintptr) (bool, error)
	CopyAsync(DestinationVar File, FlagsVar FileCopyFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar *FileProgressCallback, ProgressCallbackDataVar uintptr, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	CopyAsyncWithClosures(DestinationVar File, FlagsVar FileCopyFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackClosureVar *gobject.Closure, ReadyCallbackClosureVar *gobject.Closure)
	CopyAttributes(DestinationVar File, FlagsVar FileCopyFlags, CancellableVar *Cancellable) (bool, error)
	CopyFinish(ResVar AsyncResult) (bool, error)
	Create(FlagsVar FileCreateFlags, CancellableVar *Cancellable) (*FileOutputStream, error)
	CreateAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	CreateFinish(ResVar AsyncResult) (*FileOutputStream, error)
	CreateReadwrite(FlagsVar FileCreateFlags, CancellableVar *Cancellable) (*FileIOStream, error)
	CreateReadwriteAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	CreateReadwriteFinish(ResVar AsyncResult) (*FileIOStream, error)
	Delete(CancellableVar *Cancellable) (bool, error)
	DeleteAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	DeleteFinish(ResultVar AsyncResult) (bool, error)
	Dup() *FileBase
	EjectMountable(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	EjectMountableFinish(ResultVar AsyncResult) (bool, error)
	EjectMountableWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	EjectMountableWithOperationFinish(ResultVar AsyncResult) (bool, error)
	EnumerateChildren(AttributesVar string, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (*FileEnumerator, error)
	EnumerateChildrenAsync(AttributesVar string, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	EnumerateChildrenFinish(ResVar AsyncResult) (*FileEnumerator, error)
	Equal(File2Var File) bool
	FindEnclosingMount(CancellableVar *Cancellable) (*MountBase, error)
	FindEnclosingMountAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	FindEnclosingMountFinish(ResVar AsyncResult) (*MountBase, error)
	GetBasename() string
	GetChild(NameVar string) *FileBase
	GetChildForDisplayName(DisplayNameVar string) (*FileBase, error)
	GetParent() *FileBase
	GetParseName() string
	GetPath() string
	GetRelativePath(DescendantVar File) string
	GetUri() string
	GetUriScheme() string
	HasParent(ParentVar File) bool
	HasPrefix(PrefixVar File) bool
	HasUriScheme(UriSchemeVar string) bool
	Hash() uint
	IsNative() bool
	LoadBytes(CancellableVar *Cancellable, EtagOutVar *string) (*glib.Bytes, error)
	LoadBytesAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	LoadBytesFinish(ResultVar AsyncResult, EtagOutVar *string) (*glib.Bytes, error)
	LoadContents(CancellableVar *Cancellable, ContentsVar *[]string, LengthVar *uint, EtagOutVar *string) (bool, error)
	LoadContentsAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	LoadContentsFinish(ResVar AsyncResult, ContentsVar *[]string, LengthVar *uint, EtagOutVar *string) (bool, error)
	LoadPartialContentsAsync(CancellableVar *Cancellable, ReadMoreCallbackVar *FileReadMoreCallback, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	LoadPartialContentsFinish(ResVar AsyncResult, ContentsVar *[]string, LengthVar *uint, EtagOutVar *string) (bool, error)
	MakeDirectory(CancellableVar *Cancellable) (bool, error)
	MakeDirectoryAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	MakeDirectoryFinish(ResultVar AsyncResult) (bool, error)
	MakeDirectoryWithParents(CancellableVar *Cancellable) (bool, error)
	MakeSymbolicLink(SymlinkValueVar string, CancellableVar *Cancellable) (bool, error)
	MakeSymbolicLinkAsync(SymlinkValueVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	MakeSymbolicLinkFinish(ResultVar AsyncResult) (bool, error)
	MeasureDiskUsage(FlagsVar FileMeasureFlags, CancellableVar *Cancellable, ProgressCallbackVar *FileMeasureProgressCallback, ProgressDataVar uintptr, DiskUsageVar *uint64, NumDirsVar *uint64, NumFilesVar *uint64) (bool, error)
	MeasureDiskUsageAsync(FlagsVar FileMeasureFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar *FileMeasureProgressCallback, ProgressDataVar uintptr, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	MeasureDiskUsageFinish(ResultVar AsyncResult, DiskUsageVar *uint64, NumDirsVar *uint64, NumFilesVar *uint64) (bool, error)
	Monitor(FlagsVar FileMonitorFlags, CancellableVar *Cancellable) (*FileMonitor, error)
	MonitorDirectory(FlagsVar FileMonitorFlags, CancellableVar *Cancellable) (*FileMonitor, error)
	MonitorFile(FlagsVar FileMonitorFlags, CancellableVar *Cancellable) (*FileMonitor, error)
	MountEnclosingVolume(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	MountEnclosingVolumeFinish(ResultVar AsyncResult) (bool, error)
	MountMountable(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	MountMountableFinish(ResultVar AsyncResult) (*FileBase, error)
	Move(DestinationVar File, FlagsVar FileCopyFlags, CancellableVar *Cancellable, ProgressCallbackVar *FileProgressCallback, ProgressCallbackDataVar uintptr) (bool, error)
	MoveAsync(DestinationVar File, FlagsVar FileCopyFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar *FileProgressCallback, ProgressCallbackDataVar uintptr, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	MoveAsyncWithClosures(DestinationVar File, FlagsVar FileCopyFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackClosureVar *gobject.Closure, ReadyCallbackClosureVar *gobject.Closure)
	MoveFinish(ResultVar AsyncResult) (bool, error)
	OpenReadwrite(CancellableVar *Cancellable) (*FileIOStream, error)
	OpenReadwriteAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	OpenReadwriteFinish(ResVar AsyncResult) (*FileIOStream, error)
	PeekPath() string
	PollMountable(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	PollMountableFinish(ResultVar AsyncResult) (bool, error)
	QueryDefaultHandler(CancellableVar *Cancellable) (*AppInfoBase, error)
	QueryDefaultHandlerAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	QueryDefaultHandlerFinish(ResultVar AsyncResult) (*AppInfoBase, error)
	QueryExists(CancellableVar *Cancellable) bool
	QueryFileType(FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) FileType
	QueryFilesystemInfo(AttributesVar string, CancellableVar *Cancellable) (*FileInfo, error)
	QueryFilesystemInfoAsync(AttributesVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	QueryFilesystemInfoFinish(ResVar AsyncResult) (*FileInfo, error)
	QueryInfo(AttributesVar string, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (*FileInfo, error)
	QueryInfoAsync(AttributesVar string, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	QueryInfoFinish(ResVar AsyncResult) (*FileInfo, error)
	QuerySettableAttributes(CancellableVar *Cancellable) (*FileAttributeInfoList, error)
	QueryWritableNamespaces(CancellableVar *Cancellable) (*FileAttributeInfoList, error)
	Read(CancellableVar *Cancellable) (*FileInputStream, error)
	ReadAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	ReadFinish(ResVar AsyncResult) (*FileInputStream, error)
	Replace(EtagVar *string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable) (*FileOutputStream, error)
	ReplaceAsync(EtagVar *string, MakeBackupVar bool, FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	ReplaceContents(ContentsVar string, LengthVar uint, EtagVar *string, MakeBackupVar bool, FlagsVar FileCreateFlags, NewEtagVar *string, CancellableVar *Cancellable) (bool, error)
	ReplaceContentsAsync(ContentsVar string, LengthVar uint, EtagVar *string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	ReplaceContentsBytesAsync(ContentsVar *glib.Bytes, EtagVar *string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	ReplaceContentsFinish(ResVar AsyncResult, NewEtagVar *string) (bool, error)
	ReplaceFinish(ResVar AsyncResult) (*FileOutputStream, error)
	ReplaceReadwrite(EtagVar *string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable) (*FileIOStream, error)
	ReplaceReadwriteAsync(EtagVar *string, MakeBackupVar bool, FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	ReplaceReadwriteFinish(ResVar AsyncResult) (*FileIOStream, error)
	ResolveRelativePath(RelativePathVar string) *FileBase
	SetAttribute(AttributeVar string, TypeVar FileAttributeType, ValuePVar uintptr, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (bool, error)
	SetAttributeByteString(AttributeVar string, ValueVar string, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (bool, error)
	SetAttributeInt32(AttributeVar string, ValueVar int32, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (bool, error)
	SetAttributeInt64(AttributeVar string, ValueVar int64, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (bool, error)
	SetAttributeString(AttributeVar string, ValueVar string, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (bool, error)
	SetAttributeUint32(AttributeVar string, ValueVar uint32, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (bool, error)
	SetAttributeUint64(AttributeVar string, ValueVar uint64, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (bool, error)
	SetAttributesAsync(InfoVar *FileInfo, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	SetAttributesFinish(ResultVar AsyncResult, InfoVar **FileInfo) (bool, error)
	SetAttributesFromInfo(InfoVar *FileInfo, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (bool, error)
	SetDisplayName(DisplayNameVar string, CancellableVar *Cancellable) (*FileBase, error)
	SetDisplayNameAsync(DisplayNameVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	SetDisplayNameFinish(ResVar AsyncResult) (*FileBase, error)
	StartMountable(FlagsVar DriveStartFlags, StartOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	StartMountableFinish(ResultVar AsyncResult) (bool, error)
	StopMountable(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	StopMountableFinish(ResultVar AsyncResult) (bool, error)
	SupportsThreadContexts() bool
	Trash(CancellableVar *Cancellable) (bool, error)
	TrashAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	TrashFinish(ResultVar AsyncResult) (bool, error)
	UnmountMountable(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	UnmountMountableFinish(ResultVar AsyncResult) (bool, error)
	UnmountMountableWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	UnmountMountableWithOperationFinish(ResultVar AsyncResult) (bool, error)
}

`GFile` is a high level abstraction for manipulating files on a virtual file system. `GFile`s 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 [class@Gio.InputStream] and [class@Gio.OutputStream]).

To construct a `GFile`, you can use:

  • [func@Gio.File.new_for_path] if you have a path.
  • [func@Gio.File.new_for_uri] if you have a URI.
  • [func@Gio.File.new_for_commandline_arg] or [func@Gio.File.new_for_commandline_arg_and_cwd] for a command line argument.
  • [func@Gio.File.new_tmp] to create a temporary file from a template.
  • [func@Gio.File.new_tmp_async] to asynchronously create a temporary file.
  • [func@Gio.File.new_tmp_dir_async] to asynchronously create a temporary directory.
  • [func@Gio.File.parse_name] from a UTF-8 string gotten from [method@Gio.File.get_parse_name].
  • [func@Gio.File.new_build_filename] or [func@Gio.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 `GFile`s are extensible it could also be something else that corresponds to a pathname in a userspace implementation of a filesystem.

`GFile`s 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 [method@Gio.File.get_parent] to get an identifier for the parent directory, [method@Gio.File.get_child] to get a child within a directory, and [method@Gio.File.resolve_relative_path] to resolve a relative path between two `GFile`s. There can be multiple hierarchies, so you may not end up at the same root if you repeatedly call [method@Gio.File.get_parent] on two different files.

All `GFile`s have a basename (get with [method@Gio.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 [method@Gio.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 `GFile`s 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 `GFile`s 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 `GFile`s.

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 [callback@Gio.AsyncReadyCallback] which is then used to finalize the operation, producing a [iface@Gio.AsyncResult] 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](overview.html#asynchronous-programming) for more.

Some `GFile` operations almost always take a noticeable amount of time, and so do not have synchronous analogs. Notable cases include:

  • [method@Gio.File.mount_mountable] to mount a mountable file.
  • [method@Gio.File.unmount_mountable_with_operation] to unmount a mountable file.
  • [method@Gio.File.eject_mountable_with_operation] to eject a mountable file.

## Entity Tags

One notable feature of `GFile`s 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 description of HTTP ETags in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-etag). `GFile` Entity Tags are a very similar concept.

type FileAttributeInfo

type FileAttributeInfo struct {
	Name uintptr

	Type FileAttributeType

	Flags FileAttributeInfoFlags
	// contains filtered or unexported fields
}

Information about a specific attribute.

func (*FileAttributeInfo) GoPointer

func (x *FileAttributeInfo) GoPointer() uintptr

type FileAttributeInfoFlags

type FileAttributeInfoFlags int

Flags specifying the behaviour of an attribute.

const (

	// no flags set.
	GFileAttributeInfoNoneValue FileAttributeInfoFlags = 0
	// copy the attribute values when the file is copied.
	GFileAttributeInfoCopyWithFileValue FileAttributeInfoFlags = 1
	// copy the attribute values when the file is moved.
	GFileAttributeInfoCopyWhenMovedValue FileAttributeInfoFlags = 2
)

type FileAttributeInfoList

type FileAttributeInfoList struct {
	Infos *FileAttributeInfo

	NInfos int
	// contains filtered or unexported fields
}

Acts as a lightweight registry for possible valid file attributes. The registry stores Key-Value pair formats as #GFileAttributeInfos.

func NewFileAttributeInfoList

func NewFileAttributeInfoList() *FileAttributeInfoList

Creates a new file attribute info list.

func (*FileAttributeInfoList) Add

func (x *FileAttributeInfoList) Add(NameVar string, TypeVar FileAttributeType, FlagsVar FileAttributeInfoFlags)

Adds a new attribute with @name to the @list, setting its @type and @flags.

func (*FileAttributeInfoList) Dup

Makes a duplicate of a file attribute info list.

func (*FileAttributeInfoList) GoPointer

func (x *FileAttributeInfoList) GoPointer() uintptr

func (*FileAttributeInfoList) Lookup

func (x *FileAttributeInfoList) Lookup(NameVar string) *FileAttributeInfo

Gets the file attribute with the name @name from @list.

func (*FileAttributeInfoList) Ref

References a file attribute info list.

func (*FileAttributeInfoList) Unref

func (x *FileAttributeInfoList) Unref()

Removes a reference from the given @list. If the reference count falls to zero, the @list is deleted.

type FileAttributeMatcher

type FileAttributeMatcher struct {
	// contains filtered or unexported fields
}

Determines if a string matches a file attribute.

func NewFileAttributeMatcher

func NewFileAttributeMatcher(AttributesVar string) *FileAttributeMatcher

Creates a new file attribute matcher, which matches attributes against a given string. [GFileAttributeMatchers][struct@FileAttributeMatcher] are reference counted structures, and are created with a reference count of 1. If the number of references falls to 0, the [struct@FileAttributeMatcher] is automatically destroyed.

The @attributes string should be formatted with specific keys separated from namespaces with a double colon. Several `"namespace::key"` strings may be concatenated with a single comma (e.g. `"standard::type,standard::is-hidden"`). The wildcard `"*"` may be used to match all keys and namespaces, or `"namespace::*"` will match all keys in a given namespace.

## Examples of file attribute matcher strings and results

  • `"*"`: matches all attributes.
  • `"standard::is-hidden"`: matches only the key is-hidden in the standard namespace.
  • `"standard::type,unix::*"`: matches the type key in the standard namespace and all keys in the unix namespace.

func (*FileAttributeMatcher) EnumerateNamespace

func (x *FileAttributeMatcher) EnumerateNamespace(NsVar string) bool

Checks if the matcher will match all of the keys in a given namespace. This will always return %TRUE if a wildcard character is in use (e.g. if matcher was created with "standard::\*" and @ns is "standard", or if matcher was created using "*" and namespace is anything.)

TODO: this is awkwardly worded.

func (*FileAttributeMatcher) EnumerateNext

func (x *FileAttributeMatcher) EnumerateNext() string

Gets the next matched attribute from a #GFileAttributeMatcher.

func (*FileAttributeMatcher) GoPointer

func (x *FileAttributeMatcher) GoPointer() uintptr

func (*FileAttributeMatcher) Matches

func (x *FileAttributeMatcher) Matches(AttributeVar string) bool

Checks if an attribute will be matched by an attribute matcher. If the matcher was created with the "*" matching string, this function will always return %TRUE.

func (*FileAttributeMatcher) MatchesOnly

func (x *FileAttributeMatcher) MatchesOnly(AttributeVar string) bool

Checks if an attribute matcher only matches a given attribute. Always returns %FALSE if "*" was used when creating the matcher.

func (*FileAttributeMatcher) Ref

References a file attribute matcher.

func (*FileAttributeMatcher) Subtract

Subtracts all attributes of @subtract from @matcher and returns a matcher that supports those attributes.

Note that currently it is not possible to remove a single attribute when the @matcher matches the whole namespace - or remove a namespace or attribute when the matcher matches everything. This is a limitation of the current implementation, but may be fixed in the future.

func (*FileAttributeMatcher) ToString

func (x *FileAttributeMatcher) ToString() string

Prints what the matcher is matching against. The format will be equal to the format passed to g_file_attribute_matcher_new(). The output however, might not be identical, as the matcher may decide to use a different order or omit needless parts.

func (*FileAttributeMatcher) Unref

func (x *FileAttributeMatcher) Unref()

Unreferences @matcher. If the reference count falls below 1, the @matcher is automatically freed.

type FileAttributeStatus

type FileAttributeStatus int

Used by g_file_set_attributes_from_info() when setting file attributes.

const (

	// Attribute value is unset (empty).
	GFileAttributeStatusUnsetValue FileAttributeStatus = 0
	// Attribute value is set.
	GFileAttributeStatusSetValue FileAttributeStatus = 1
	// Indicates an error in setting the value.
	GFileAttributeStatusErrorSettingValue FileAttributeStatus = 2
)

type FileAttributeType

type FileAttributeType int

The data types for file attributes.

const (

	// indicates an invalid or uninitialized type.
	GFileAttributeTypeInvalidValue FileAttributeType = 0
	// a null terminated UTF8 string.
	GFileAttributeTypeStringValue FileAttributeType = 1
	// a zero terminated string of non-zero bytes.
	GFileAttributeTypeByteStringValue FileAttributeType = 2
	// a boolean value.
	GFileAttributeTypeBooleanValue FileAttributeType = 3
	// an unsigned 4-byte/32-bit integer.
	GFileAttributeTypeUint32Value FileAttributeType = 4
	// a signed 4-byte/32-bit integer.
	GFileAttributeTypeInt32Value FileAttributeType = 5
	// an unsigned 8-byte/64-bit integer.
	GFileAttributeTypeUint64Value FileAttributeType = 6
	// a signed 8-byte/64-bit integer.
	GFileAttributeTypeInt64Value FileAttributeType = 7
	// a #GObject.
	GFileAttributeTypeObjectValue FileAttributeType = 8
	// a %NULL terminated char **. Since 2.22
	GFileAttributeTypeStringvValue FileAttributeType = 9
)

type FileBase

type FileBase struct {
	Ptr uintptr
}

func FileNewBuildFilenamev

func FileNewBuildFilenamev(ArgsVar []string) *FileBase

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.

func FileNewForCommandlineArg

func FileNewForCommandlineArg(ArgVar string) *FileBase

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.

func FileNewForCommandlineArgAndCwd

func FileNewForCommandlineArgAndCwd(ArgVar string, CwdVar string) *FileBase

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().

func FileNewForPath

func FileNewForPath(PathVar string) *FileBase

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.

func FileNewForUri

func FileNewForUri(UriVar string) *FileBase

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.

func FileNewTmp

func FileNewTmp(TmplVar *string, IostreamVar **FileIOStream) (*FileBase, error)

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.

func FileNewTmpDirFinish

func FileNewTmpDirFinish(ResultVar AsyncResult) (*FileBase, error)

Finishes a temporary directory creation started by g_file_new_tmp_dir_async().

func FileNewTmpFinish

func FileNewTmpFinish(ResultVar AsyncResult, IostreamVar **FileIOStream) (*FileBase, error)

Finishes a temporary file creation started by g_file_new_tmp_async().

func FileParseName

func FileParseName(ParseNameVar string) *FileBase

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.

func (*FileBase) AppendTo

func (x *FileBase) AppendTo(FlagsVar FileCreateFlags, CancellableVar *Cancellable) (*FileOutputStream, error)

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.

func (*FileBase) AppendToAsync

func (x *FileBase) AppendToAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) AppendToFinish

func (x *FileBase) AppendToFinish(ResVar AsyncResult) (*FileOutputStream, error)

Finishes an asynchronous file append operation started with g_file_append_to_async().

func (*FileBase) BuildAttributeListForCopy

func (x *FileBase) BuildAttributeListForCopy(FlagsVar FileCopyFlags, CancellableVar *Cancellable) (string, error)

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).

func (*FileBase) Copy

func (x *FileBase) Copy(DestinationVar File, FlagsVar FileCopyFlags, CancellableVar *Cancellable, ProgressCallbackVar *FileProgressCallback, ProgressCallbackDataVar uintptr) (bool, error)

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().

func (*FileBase) CopyAsync

func (x *FileBase) CopyAsync(DestinationVar File, FlagsVar FileCopyFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar *FileProgressCallback, ProgressCallbackDataVar uintptr, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) CopyAsyncWithClosures

func (x *FileBase) CopyAsyncWithClosures(DestinationVar File, FlagsVar FileCopyFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackClosureVar *gobject.Closure, ReadyCallbackClosureVar *gobject.Closure)

Version of [method@Gio.File.copy_async] using closures instead of callbacks for easier binding in other languages.

func (*FileBase) CopyAttributes

func (x *FileBase) CopyAttributes(DestinationVar File, FlagsVar FileCopyFlags, CancellableVar *Cancellable) (bool, error)

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.

func (*FileBase) CopyFinish

func (x *FileBase) CopyFinish(ResVar AsyncResult) (bool, error)

Finishes copying the file started with g_file_copy_async().

func (*FileBase) Create

func (x *FileBase) Create(FlagsVar FileCreateFlags, CancellableVar *Cancellable) (*FileOutputStream, error)

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.

func (*FileBase) CreateAsync

func (x *FileBase) CreateAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) CreateFinish

func (x *FileBase) CreateFinish(ResVar AsyncResult) (*FileOutputStream, error)

Finishes an asynchronous file create operation started with g_file_create_async().

func (*FileBase) CreateReadwrite

func (x *FileBase) CreateReadwrite(FlagsVar FileCreateFlags, CancellableVar *Cancellable) (*FileIOStream, error)

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.

func (*FileBase) CreateReadwriteAsync

func (x *FileBase) CreateReadwriteAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) CreateReadwriteFinish

func (x *FileBase) CreateReadwriteFinish(ResVar AsyncResult) (*FileIOStream, error)

Finishes an asynchronous file create operation started with g_file_create_readwrite_async().

func (*FileBase) Delete

func (x *FileBase) Delete(CancellableVar *Cancellable) (bool, error)

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.

func (*FileBase) DeleteAsync

func (x *FileBase) DeleteAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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().

func (*FileBase) DeleteFinish

func (x *FileBase) DeleteFinish(ResultVar AsyncResult) (bool, error)

Finishes deleting a file started with g_file_delete_async().

func (*FileBase) Dup

func (x *FileBase) Dup() *FileBase

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.

func (*FileBase) EjectMountable

func (x *FileBase) EjectMountable(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) EjectMountableFinish

func (x *FileBase) EjectMountableFinish(ResultVar AsyncResult) (bool, error)

Finishes an asynchronous eject operation started by g_file_eject_mountable().

func (*FileBase) EjectMountableWithOperation

func (x *FileBase) EjectMountableWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) EjectMountableWithOperationFinish

func (x *FileBase) EjectMountableWithOperationFinish(ResultVar AsyncResult) (bool, error)

Finishes an asynchronous eject operation started by g_file_eject_mountable_with_operation().

func (*FileBase) EnumerateChildren

func (x *FileBase) EnumerateChildren(AttributesVar string, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (*FileEnumerator, error)

Gets the requested information about the files in a directory. The result is a [class@FileEnumerator] object that will give out [class@FileInfo] 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 [const@FILE_ATTRIBUTE_STANDARD_NAME]. [const@FILE_ATTRIBUTE_STANDARD_NAME] should always be specified if you plan to call [method@FileEnumerator.get_child] or [method@FileEnumerator.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 [error@Gio.IOErrorEnum.CANCELLED] will be returned.

If the file does not exist, the [error@Gio.IOErrorEnum.NOT_FOUND] error will be returned. If the file is not a directory, the [error@Gio.IOErrorEnum.NOT_DIRECTORY] error will be returned. Other errors are possible too.

func (*FileBase) EnumerateChildrenAsync

func (x *FileBase) EnumerateChildrenAsync(AttributesVar string, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) EnumerateChildrenFinish

func (x *FileBase) EnumerateChildrenFinish(ResVar AsyncResult) (*FileEnumerator, error)

Finishes an async enumerate children operation. See g_file_enumerate_children_async().

func (*FileBase) Equal

func (x *FileBase) Equal(File2Var File) bool

Checks if the two given #GFiles refer to the same file.

This function can be used with [method@Gio.File.hash] to insert [iface@Gio.File]s efficiently in a hash table.

Note that two #GFiles that differ can still refer to the same file on the filesystem due to various forms of filename aliasing. For local files, this function essentially compares the file paths, so two [iface@Gio.File]s which point to different hard or soft links will not be considered equal, despite pointing to the same content.

For determining whether two files are hardlinked, see [const@Gio.FILE_ATTRIBUTE_ID_FILE].

This call does no blocking I/O.

func (*FileBase) FindEnclosingMount

func (x *FileBase) FindEnclosingMount(CancellableVar *Cancellable) (*MountBase, error)

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.

func (*FileBase) FindEnclosingMountAsync

func (x *FileBase) FindEnclosingMountAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) FindEnclosingMountFinish

func (x *FileBase) FindEnclosingMountFinish(ResVar AsyncResult) (*MountBase, error)

Finishes an asynchronous find mount request. See g_file_find_enclosing_mount_async().

func (*FileBase) GetBasename

func (x *FileBase) GetBasename() string

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.

func (*FileBase) GetChild

func (x *FileBase) GetChild(NameVar string) *FileBase

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.

func (*FileBase) GetChildForDisplayName

func (x *FileBase) GetChildForDisplayName(DisplayNameVar string) (*FileBase, error)

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.

func (*FileBase) GetParent

func (x *FileBase) GetParent() *FileBase

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.

func (*FileBase) GetParseName

func (x *FileBase) GetParseName() string

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.

func (*FileBase) GetPath

func (x *FileBase) GetPath() string

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.

func (*FileBase) GetRelativePath

func (x *FileBase) GetRelativePath(DescendantVar File) string

Gets the path for @descendant relative to @parent.

This call does no blocking I/O.

func (*FileBase) GetUri

func (x *FileBase) GetUri() string

Gets the URI for the @file.

This call does no blocking I/O.

func (*FileBase) GetUriScheme

func (x *FileBase) GetUriScheme() string

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.

func (*FileBase) GoPointer

func (x *FileBase) GoPointer() uintptr

func (*FileBase) HasParent

func (x *FileBase) HasParent(ParentVar File) bool

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.

func (*FileBase) HasPrefix

func (x *FileBase) HasPrefix(PrefixVar File) bool

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.

func (*FileBase) HasUriScheme

func (x *FileBase) HasUriScheme(UriSchemeVar string) bool

Checks to see if a #GFile has a given URI scheme.

This call does no blocking I/O.

func (*FileBase) Hash

func (x *FileBase) Hash() uint

Creates a hash value for a #GFile.

This call does no blocking I/O.

func (*FileBase) IsNative

func (x *FileBase) IsNative() bool

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.

func (*FileBase) LoadBytes

func (x *FileBase) LoadBytes(CancellableVar *Cancellable, EtagOutVar *string) (*glib.Bytes, error)

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.

func (*FileBase) LoadBytesAsync

func (x *FileBase) LoadBytesAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) LoadBytesFinish

func (x *FileBase) LoadBytesFinish(ResultVar AsyncResult, EtagOutVar *string) (*glib.Bytes, error)

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.

func (*FileBase) LoadContents

func (x *FileBase) LoadContents(CancellableVar *Cancellable, ContentsVar *[]string, LengthVar *uint, EtagOutVar *string) (bool, error)

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.

func (*FileBase) LoadContentsAsync

func (x *FileBase) LoadContentsAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) LoadContentsFinish

func (x *FileBase) LoadContentsFinish(ResVar AsyncResult, ContentsVar *[]string, LengthVar *uint, EtagOutVar *string) (bool, error)

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.

func (*FileBase) LoadPartialContentsAsync

func (x *FileBase) LoadPartialContentsAsync(CancellableVar *Cancellable, ReadMoreCallbackVar *FileReadMoreCallback, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Reads the partial contents of a file. A #GFileReadMoreCallback should be used to stop reading from the file when appropriate, else this function will behave exactly as g_file_load_contents_async(). This operation can be finished by g_file_load_partial_contents_finish().

Users of this function should be aware that @user_data is passed to both the @read_more_callback and 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.

func (*FileBase) LoadPartialContentsFinish

func (x *FileBase) LoadPartialContentsFinish(ResVar AsyncResult, ContentsVar *[]string, LengthVar *uint, EtagOutVar *string) (bool, error)

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.

func (*FileBase) MakeDirectory

func (x *FileBase) MakeDirectory(CancellableVar *Cancellable) (bool, error)

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. If the directory already exists, [error@Gio.IOErrorEnum.EXISTS] will be returned.

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.

func (*FileBase) MakeDirectoryAsync

func (x *FileBase) MakeDirectoryAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously creates a directory.

func (*FileBase) MakeDirectoryFinish

func (x *FileBase) MakeDirectoryFinish(ResultVar AsyncResult) (bool, error)

Finishes an asynchronous directory creation, started with g_file_make_directory_async().

func (*FileBase) MakeDirectoryWithParents

func (x *FileBase) MakeDirectoryWithParents(CancellableVar *Cancellable) (bool, error)

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.

func (x *FileBase) MakeSymbolicLink(SymlinkValueVar string, CancellableVar *Cancellable) (bool, error)

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.

func (*FileBase) MakeSymbolicLinkAsync

func (x *FileBase) MakeSymbolicLinkAsync(SymlinkValueVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously creates a symbolic link named @file which contains the string @symlink_value.

func (*FileBase) MakeSymbolicLinkFinish

func (x *FileBase) MakeSymbolicLinkFinish(ResultVar AsyncResult) (bool, error)

Finishes an asynchronous symbolic link creation, started with g_file_make_symbolic_link_async().

func (*FileBase) MeasureDiskUsage

func (x *FileBase) MeasureDiskUsage(FlagsVar FileMeasureFlags, CancellableVar *Cancellable, ProgressCallbackVar *FileMeasureProgressCallback, ProgressDataVar uintptr, DiskUsageVar *uint64, NumDirsVar *uint64, NumFilesVar *uint64) (bool, error)

Recursively measures the disk usage of @file.

This is essentially an analog of the 'du' command, but it also reports the number of directories and non-directory files encountered (including things like symbolic links).

By default, errors are only reported against the toplevel file itself. Errors found while recursing are silently ignored, unless %G_FILE_MEASURE_REPORT_ANY_ERROR is given in @flags.

The returned size, @disk_usage, is in bytes and should be formatted with g_format_size() in order to get something reasonable for showing in a user interface.

@progress_callback and @progress_data can be given to request periodic progress updates while scanning. See the documentation for #GFileMeasureProgressCallback for information about when and how the callback will be invoked.

func (*FileBase) MeasureDiskUsageAsync

func (x *FileBase) MeasureDiskUsageAsync(FlagsVar FileMeasureFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar *FileMeasureProgressCallback, ProgressDataVar uintptr, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Recursively measures the disk usage of @file.

This is the asynchronous version of g_file_measure_disk_usage(). See there for more information.

func (*FileBase) MeasureDiskUsageFinish

func (x *FileBase) MeasureDiskUsageFinish(ResultVar AsyncResult, DiskUsageVar *uint64, NumDirsVar *uint64, NumFilesVar *uint64) (bool, error)

Collects the results from an earlier call to g_file_measure_disk_usage_async(). See g_file_measure_disk_usage() for more information.

func (*FileBase) Monitor

func (x *FileBase) Monitor(FlagsVar FileMonitorFlags, CancellableVar *Cancellable) (*FileMonitor, error)

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.

func (*FileBase) MonitorDirectory

func (x *FileBase) MonitorDirectory(FlagsVar FileMonitorFlags, CancellableVar *Cancellable) (*FileMonitor, error)

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().

func (*FileBase) MonitorFile

func (x *FileBase) MonitorFile(FlagsVar FileMonitorFlags, CancellableVar *Cancellable) (*FileMonitor, error)

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.

func (*FileBase) MountEnclosingVolume

func (x *FileBase) MountEnclosingVolume(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) MountEnclosingVolumeFinish

func (x *FileBase) MountEnclosingVolumeFinish(ResultVar AsyncResult) (bool, error)

Finishes a mount operation started by g_file_mount_enclosing_volume().

func (*FileBase) MountMountable

func (x *FileBase) MountMountable(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) MountMountableFinish

func (x *FileBase) MountMountableFinish(ResultVar AsyncResult) (*FileBase, error)

Finishes a mount operation. See g_file_mount_mountable() for details.

Finish an asynchronous mount operation that was started with g_file_mount_mountable().

func (*FileBase) Move

func (x *FileBase) Move(DestinationVar File, FlagsVar FileCopyFlags, CancellableVar *Cancellable, ProgressCallbackVar *FileProgressCallback, ProgressCallbackDataVar uintptr) (bool, error)

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).

func (*FileBase) MoveAsync

func (x *FileBase) MoveAsync(DestinationVar File, FlagsVar FileCopyFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar *FileProgressCallback, ProgressCallbackDataVar uintptr, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) MoveAsyncWithClosures

func (x *FileBase) MoveAsyncWithClosures(DestinationVar File, FlagsVar FileCopyFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackClosureVar *gobject.Closure, ReadyCallbackClosureVar *gobject.Closure)

Version of [method@Gio.File.move_async] using closures instead of callbacks for easier binding in other languages.

func (*FileBase) MoveFinish

func (x *FileBase) MoveFinish(ResultVar AsyncResult) (bool, error)

Finishes an asynchronous file movement, started with g_file_move_async().

func (*FileBase) OpenReadwrite

func (x *FileBase) OpenReadwrite(CancellableVar *Cancellable) (*FileIOStream, error)

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.

func (*FileBase) OpenReadwriteAsync

func (x *FileBase) OpenReadwriteAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) OpenReadwriteFinish

func (x *FileBase) OpenReadwriteFinish(ResVar AsyncResult) (*FileIOStream, error)

Finishes an asynchronous file read operation started with g_file_open_readwrite_async().

func (*FileBase) PeekPath

func (x *FileBase) PeekPath() string

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.

func (*FileBase) PollMountable

func (x *FileBase) PollMountable(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) PollMountableFinish

func (x *FileBase) PollMountableFinish(ResultVar AsyncResult) (bool, error)

Finishes a poll operation. See g_file_poll_mountable() for details.

Finish an asynchronous poll operation that was polled with g_file_poll_mountable().

func (*FileBase) QueryDefaultHandler

func (x *FileBase) QueryDefaultHandler(CancellableVar *Cancellable) (*AppInfoBase, error)

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.

func (*FileBase) QueryDefaultHandlerAsync

func (x *FileBase) QueryDefaultHandlerAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Async version of g_file_query_default_handler().

func (*FileBase) QueryDefaultHandlerFinish

func (x *FileBase) QueryDefaultHandlerFinish(ResultVar AsyncResult) (*AppInfoBase, error)

Finishes a g_file_query_default_handler_async() operation.

func (*FileBase) QueryExists

func (x *FileBase) QueryExists(CancellableVar *Cancellable) bool

Utility function to check if a particular file exists.

The fallback implementation of this API is using [method@Gio.File.query_info] and therefore may do blocking I/O. To asynchronously query the existence of a file, use [method@Gio.File.query_info_async].

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.

func (*FileBase) QueryFileType

func (x *FileBase) QueryFileType(FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) FileType

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.

func (*FileBase) QueryFilesystemInfo

func (x *FileBase) QueryFilesystemInfo(AttributesVar string, CancellableVar *Cancellable) (*FileInfo, error)

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.

func (*FileBase) QueryFilesystemInfoAsync

func (x *FileBase) QueryFilesystemInfoAsync(AttributesVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) QueryFilesystemInfoFinish

func (x *FileBase) QueryFilesystemInfoFinish(ResVar AsyncResult) (*FileInfo, error)

Finishes an asynchronous filesystem info query. See g_file_query_filesystem_info_async().

func (*FileBase) QueryInfo

func (x *FileBase) QueryInfo(AttributesVar string, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (*FileInfo, error)

Gets the requested information about specified @file.

The result is a [class@Gio.FileInfo] 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. In particular this means that if a file is inaccessible (due to being in a folder with restrictive permissions), for example, you can expect the returned [class@Gio.FileInfo] to have very few attributes set. You should check whether an attribute is set using [method@Gio.FileInfo.has_attribute] before trying to retrieve its value.

It is guaranteed that if any of the following attributes are listed in @attributes, they will always be set in the returned [class@Gio.FileInfo], even if the user doesn’t have permissions to access the file:

  • [const@Gio.FILE_ATTRIBUTE_STANDARD_NAME]
  • [const@Gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME]

@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 might be `"standard::*,owner::user"`. The standard attributes are available as defines, like [const@Gio.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 [error@Gio.IOErrorEnum.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 [flags@Gio.FileQueryInfoFlags.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 [error@Gio.IOErrorEnum.NOT_FOUND] error will be returned. Other errors are possible too, and depend on what kind of file system the file is on.

func (*FileBase) QueryInfoAsync

func (x *FileBase) QueryInfoAsync(AttributesVar string, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) QueryInfoFinish

func (x *FileBase) QueryInfoFinish(ResVar AsyncResult) (*FileInfo, error)

Finishes an asynchronous file info query. See g_file_query_info_async().

func (*FileBase) QuerySettableAttributes

func (x *FileBase) QuerySettableAttributes(CancellableVar *Cancellable) (*FileAttributeInfoList, error)

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.

func (*FileBase) QueryWritableNamespaces

func (x *FileBase) QueryWritableNamespaces(CancellableVar *Cancellable) (*FileAttributeInfoList, error)

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.

func (*FileBase) Read

func (x *FileBase) Read(CancellableVar *Cancellable) (*FileInputStream, error)

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.

func (*FileBase) ReadAsync

func (x *FileBase) ReadAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) ReadFinish

func (x *FileBase) ReadFinish(ResVar AsyncResult) (*FileInputStream, error)

Finishes an asynchronous file read operation started with g_file_read_async().

func (*FileBase) Replace

func (x *FileBase) Replace(EtagVar *string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable) (*FileOutputStream, error)

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.

func (*FileBase) ReplaceAsync

func (x *FileBase) ReplaceAsync(EtagVar *string, MakeBackupVar bool, FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) ReplaceContents

func (x *FileBase) ReplaceContents(ContentsVar string, LengthVar uint, EtagVar *string, MakeBackupVar bool, FlagsVar FileCreateFlags, NewEtagVar *string, CancellableVar *Cancellable) (bool, error)

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.

func (*FileBase) ReplaceContentsAsync

func (x *FileBase) ReplaceContentsAsync(ContentsVar string, LengthVar uint, EtagVar *string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) ReplaceContentsBytesAsync

func (x *FileBase) ReplaceContentsBytesAsync(ContentsVar *glib.Bytes, EtagVar *string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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().

func (*FileBase) ReplaceContentsFinish

func (x *FileBase) ReplaceContentsFinish(ResVar AsyncResult, NewEtagVar *string) (bool, error)

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.

func (*FileBase) ReplaceFinish

func (x *FileBase) ReplaceFinish(ResVar AsyncResult) (*FileOutputStream, error)

Finishes an asynchronous file replace operation started with g_file_replace_async().

func (*FileBase) ReplaceReadwrite

func (x *FileBase) ReplaceReadwrite(EtagVar *string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable) (*FileIOStream, error)

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.

func (*FileBase) ReplaceReadwriteAsync

func (x *FileBase) ReplaceReadwriteAsync(EtagVar *string, MakeBackupVar bool, FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) ReplaceReadwriteFinish

func (x *FileBase) ReplaceReadwriteFinish(ResVar AsyncResult) (*FileIOStream, error)

Finishes an asynchronous file replace operation started with g_file_replace_readwrite_async().

func (*FileBase) ResolveRelativePath

func (x *FileBase) ResolveRelativePath(RelativePathVar string) *FileBase

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).

func (*FileBase) SetAttribute

func (x *FileBase) SetAttribute(AttributeVar string, TypeVar FileAttributeType, ValuePVar uintptr, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (bool, error)

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.

func (*FileBase) SetAttributeByteString

func (x *FileBase) SetAttributeByteString(AttributeVar string, ValueVar string, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (bool, error)

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.

func (*FileBase) SetAttributeInt32

func (x *FileBase) SetAttributeInt32(AttributeVar string, ValueVar int32, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (bool, error)

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.

func (*FileBase) SetAttributeInt64

func (x *FileBase) SetAttributeInt64(AttributeVar string, ValueVar int64, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (bool, error)

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.

func (*FileBase) SetAttributeString

func (x *FileBase) SetAttributeString(AttributeVar string, ValueVar string, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (bool, error)

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.

func (*FileBase) SetAttributeUint32

func (x *FileBase) SetAttributeUint32(AttributeVar string, ValueVar uint32, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (bool, error)

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.

func (*FileBase) SetAttributeUint64

func (x *FileBase) SetAttributeUint64(AttributeVar string, ValueVar uint64, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (bool, error)

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.

func (*FileBase) SetAttributesAsync

func (x *FileBase) SetAttributesAsync(InfoVar *FileInfo, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) SetAttributesFinish

func (x *FileBase) SetAttributesFinish(ResultVar AsyncResult, InfoVar **FileInfo) (bool, error)

Finishes setting an attribute started in g_file_set_attributes_async().

func (*FileBase) SetAttributesFromInfo

func (x *FileBase) SetAttributesFromInfo(InfoVar *FileInfo, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) (bool, error)

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.

func (*FileBase) SetDisplayName

func (x *FileBase) SetDisplayName(DisplayNameVar string, CancellableVar *Cancellable) (*FileBase, error)

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.

func (*FileBase) SetDisplayNameAsync

func (x *FileBase) SetDisplayNameAsync(DisplayNameVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) SetDisplayNameFinish

func (x *FileBase) SetDisplayNameFinish(ResVar AsyncResult) (*FileBase, error)

Finishes setting a display name started with g_file_set_display_name_async().

func (*FileBase) SetGoPointer

func (x *FileBase) SetGoPointer(ptr uintptr)

func (*FileBase) StartMountable

func (x *FileBase) StartMountable(FlagsVar DriveStartFlags, StartOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) StartMountableFinish

func (x *FileBase) StartMountableFinish(ResultVar AsyncResult) (bool, error)

Finishes a start operation. See g_file_start_mountable() for details.

Finish an asynchronous start operation that was started with g_file_start_mountable().

func (*FileBase) StopMountable

func (x *FileBase) StopMountable(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) StopMountableFinish

func (x *FileBase) StopMountableFinish(ResultVar AsyncResult) (bool, error)

Finishes a stop operation, see g_file_stop_mountable() for details.

Finish an asynchronous stop operation that was started with g_file_stop_mountable().

func (*FileBase) SupportsThreadContexts

func (x *FileBase) SupportsThreadContexts() bool

Checks if @file supports thread-default main contexts (see [method@GLib.MainContext.push_thread_default]) If this returns %FALSE, you cannot perform asynchronous operations on @file in a thread that has a thread-default context.

func (*FileBase) Trash

func (x *FileBase) Trash(CancellableVar *Cancellable) (bool, error)

Sends @file to the "Trashcan", if possible. This is similar to deleting it, but the user can recover it before emptying the trashcan. Trashing is disabled for system mounts by default (see g_unix_mount_entry_is_system_internal()), 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 particular mounts, the %G_IO_ERROR_NOT_SUPPORTED error will be returned in that case. Since 2.82, the `x-gvfs-trash` unix mount option can be used to enable g_file_trash() support for particular system mounts.

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.

func (*FileBase) TrashAsync

func (x *FileBase) TrashAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously sends @file to the Trash location, if possible.

func (*FileBase) TrashFinish

func (x *FileBase) TrashFinish(ResultVar AsyncResult) (bool, error)

Finishes an asynchronous file trashing operation, started with g_file_trash_async().

func (*FileBase) UnmountMountable

func (x *FileBase) UnmountMountable(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) UnmountMountableFinish

func (x *FileBase) UnmountMountableFinish(ResultVar AsyncResult) (bool, error)

Finishes an unmount operation, see g_file_unmount_mountable() for details.

Finish an asynchronous unmount operation that was started with g_file_unmount_mountable().

func (*FileBase) UnmountMountableWithOperation

func (x *FileBase) UnmountMountableWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*FileBase) UnmountMountableWithOperationFinish

func (x *FileBase) UnmountMountableWithOperationFinish(ResultVar AsyncResult) (bool, error)

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().

type FileCopyFlags

type FileCopyFlags int

Flags used when copying or moving files.

const (

	// No flags set.
	GFileCopyNoneValue FileCopyFlags = 0
	// Overwrite any existing files
	GFileCopyOverwriteValue FileCopyFlags = 1
	// Make a backup of any existing files.
	GFileCopyBackupValue FileCopyFlags = 2
	// Don't follow symlinks.
	GFileCopyNofollowSymlinksValue FileCopyFlags = 4
	// Copy all file metadata instead of just default set used for copy (see #GFileInfo).
	GFileCopyAllMetadataValue FileCopyFlags = 8
	// Don't use copy and delete fallback if native move not supported.
	GFileCopyNoFallbackForMoveValue FileCopyFlags = 16
	// Leaves target file with default perms, instead of setting the source file perms.
	GFileCopyTargetDefaultPermsValue FileCopyFlags = 32
	// Use default modification
	//     timestamps instead of copying them from the source file. Since 2.80
	GFileCopyTargetDefaultModifiedTimeValue FileCopyFlags = 64
)

type FileCreateFlags

type FileCreateFlags int

Flags used when an operation may create a file.

const (

	// No flags set.
	GFileCreateNoneValue FileCreateFlags = 0
	// Create a file that can only be
	//    accessed by the current user.
	GFileCreatePrivateValue FileCreateFlags = 1
	// 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
	GFileCreateReplaceDestinationValue FileCreateFlags = 2
)

type FileEnumerator

type FileEnumerator struct {
	gobject.Object
}

`GFileEnumerator` allows you to operate on a set of [iface@Gio.File] objects, returning a [class@Gio.FileInfo] structure for each file enumerated (e.g. [method@Gio.File.enumerate_children] will return a `GFileEnumerator` for each of the children within a directory).

To get the next file's information from a `GFileEnumerator`, use [method@Gio.FileEnumerator.next_file] or its asynchronous version, [method@Gio.FileEnumerator.next_files_async]. Note that the asynchronous version will return a list of [class@Gio.FileInfo] objects, whereas the synchronous will only return the next file in the enumerator.

The ordering of returned files is unspecified for non-Unix platforms; for more information, see [method@GLib.Dir.read_name]. On Unix, when operating on local files, returned files will be sorted by inode number. Effectively you can assume that the ordering of returned files will be stable between successive calls (and applications) assuming the directory is unchanged.

If your application needs a specific ordering, such as by name or modification time, you will have to implement that in your application code.

To close a `GFileEnumerator`, use [method@Gio.FileEnumerator.close], or its asynchronous version, [method@Gio.FileEnumerator.close_async]. Once a `GFileEnumerator` is closed, no further actions may be performed on it, and it should be freed with [method@GObject.Object.unref].

func FileEnumeratorNewFromInternalPtr

func FileEnumeratorNewFromInternalPtr(ptr uintptr) *FileEnumerator

func (*FileEnumerator) Close

func (x *FileEnumerator) Close(CancellableVar *Cancellable) (bool, error)

Releases all resources used by this enumerator, making the enumerator return %G_IO_ERROR_CLOSED on all calls.

This will be automatically called when the last reference is dropped, but you might want to call this function to make sure resources are released as early as possible.

func (*FileEnumerator) CloseAsync

func (x *FileEnumerator) CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously closes the file 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 in g_file_enumerator_close_finish().

func (*FileEnumerator) CloseFinish

func (x *FileEnumerator) CloseFinish(ResultVar AsyncResult) (bool, error)

Finishes closing a file enumerator, started from g_file_enumerator_close_async().

If the file enumerator was already closed when g_file_enumerator_close_async() was called, then this function will report %G_IO_ERROR_CLOSED in @error, and return %FALSE. If the file enumerator had pending operation when the close operation was started, then this function will report %G_IO_ERROR_PENDING, and return %FALSE. If @cancellable was not %NULL, then the operation may have been cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be set, and %FALSE will be returned.

func (*FileEnumerator) GetChild

func (x *FileEnumerator) GetChild(InfoVar *FileInfo) *FileBase

Return a new #GFile which refers to the file named by @info in the source directory of @enumerator. This function is primarily intended to be used inside loops with g_file_enumerator_next_file().

To use this, %G_FILE_ATTRIBUTE_STANDARD_NAME must have been listed in the attributes list used when creating the #GFileEnumerator.

This is a convenience method that's equivalent to: |[<!-- language="C" -->

gchar *name = g_file_info_get_name (info);
GFile *child = g_file_get_child (g_file_enumerator_get_container (enumr),
                                 name);

]|

func (*FileEnumerator) GetContainer

func (x *FileEnumerator) GetContainer() *FileBase

Get the #GFile container which is being enumerated.

func (*FileEnumerator) GoPointer

func (c *FileEnumerator) GoPointer() uintptr

func (*FileEnumerator) HasPending

func (x *FileEnumerator) HasPending() bool

Checks if the file enumerator has pending operations.

func (*FileEnumerator) IsClosed

func (x *FileEnumerator) IsClosed() bool

Checks if the file enumerator has been closed.

func (*FileEnumerator) Iterate

func (x *FileEnumerator) Iterate(OutInfoVar **FileInfo, OutChildVar **File, CancellableVar *Cancellable) (bool, error)

This is a version of g_file_enumerator_next_file() that's easier to use correctly from C programs. With g_file_enumerator_next_file(), the gboolean return value signifies "end of iteration or error", which requires allocation of a temporary #GError.

In contrast, with this function, a %FALSE return from g_file_enumerator_iterate() *always* means "error". End of iteration is signaled by @out_info or @out_child being %NULL.

Another crucial difference is that the references for @out_info and @out_child are owned by @direnum (they are cached as hidden properties). You must not unref them in your own code. This makes memory management significantly easier for C code in combination with loops.

Finally, this function optionally allows retrieving a #GFile as well.

You must specify at least one of @out_info or @out_child.

The code pattern for correctly using g_file_enumerator_iterate() from C is:

|[ direnum = g_file_enumerate_children (file, ...); while (TRUE)

{
  GFileInfo *info;
  if (!g_file_enumerator_iterate (direnum, &info, NULL, cancellable, error))
    goto out;
  if (!info)
    break;
  ... do stuff with "info"; do not unref it! ...
}

out:

g_object_unref (direnum); // Note: frees the last @info

]|

func (*FileEnumerator) NextFile

func (x *FileEnumerator) NextFile(CancellableVar *Cancellable) (*FileInfo, error)

Returns information for the next file in the enumerated object. Will block until the information is available. The #GFileInfo returned from this function will contain attributes that match the attribute string that was passed when the #GFileEnumerator was created.

See the documentation of #GFileEnumerator for information about the order of returned files.

On error, returns %NULL and sets @error to the error. If the enumerator is at the end, %NULL will be returned and @error will be unset.

func (*FileEnumerator) NextFilesAsync

func (x *FileEnumerator) NextFilesAsync(NumFilesVar int, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Request information for a number of files from the enumerator asynchronously. When all I/O for the operation is finished the @callback will be called with the requested information.

See the documentation of #GFileEnumerator for information about the order of returned files.

Once the end of the enumerator is reached, or if an error occurs, the @callback will be called with an empty list. In this case, the previous call to g_file_enumerator_next_files_async() will typically have returned fewer than @num_files items.

If a request is cancelled the callback will be called with %G_IO_ERROR_CANCELLED.

This leads to the following pseudo-code usage: |[ g_autoptr(GFile) dir = get_directory (); g_autoptr(GFileEnumerator) enumerator = NULL; g_autolist(GFileInfo) files = NULL; g_autoptr(GError) local_error = NULL;

enumerator = yield g_file_enumerate_children_async (dir,

G_FILE_ATTRIBUTE_STANDARD_NAME ","
G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NONE,
G_PRIORITY_DEFAULT,
cancellable,
…,
&local_error);

if (enumerator == NULL)

g_error ("Error enumerating: %s", local_error->message);

// Loop until no files are returned, either because the end of the enumerator // has been reached, or an error was returned. do

{
  files = yield g_file_enumerator_next_files_async (enumerator,
                                                    5,  // number of files to request
                                                    G_PRIORITY_DEFAULT,
                                                    cancellable,
                                                    …,
                                                    &local_error);

  // Process the returned files, but don’t assume that exactly 5 were returned.
  for (GList *l = files; l != NULL; l = l->next)
    {
      GFileInfo *info = l->data;
      handle_file_info (info);
    }
}

while (files != NULL);

if (local_error != NULL &&

  !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_error ("Error while enumerating: %s", local_error->message);

]|

During an async request no other sync and async calls are allowed, and will result in %G_IO_ERROR_PENDING errors.

Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is %G_PRIORITY_DEFAULT.

func (*FileEnumerator) NextFilesFinish

func (x *FileEnumerator) NextFilesFinish(ResultVar AsyncResult) (*glib.List, error)

Finishes the asynchronous operation started with g_file_enumerator_next_files_async().

func (*FileEnumerator) SetGoPointer

func (c *FileEnumerator) SetGoPointer(ptr uintptr)

func (*FileEnumerator) SetPending

func (x *FileEnumerator) SetPending(PendingVar bool)

Sets the file enumerator as having pending operations.

type FileEnumeratorClass

type FileEnumeratorClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*FileEnumeratorClass) GetCloseAsync

GetCloseAsync gets the "close_async" callback function.

func (*FileEnumeratorClass) GetCloseFinish

func (x *FileEnumeratorClass) GetCloseFinish() func(*FileEnumerator, AsyncResult) bool

GetCloseFinish gets the "close_finish" callback function.

func (*FileEnumeratorClass) GetCloseFn

func (x *FileEnumeratorClass) GetCloseFn() func(*FileEnumerator, *Cancellable) bool

GetCloseFn gets the "close_fn" callback function.

func (*FileEnumeratorClass) GetGReserved1

func (x *FileEnumeratorClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*FileEnumeratorClass) GetGReserved2

func (x *FileEnumeratorClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*FileEnumeratorClass) GetGReserved3

func (x *FileEnumeratorClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*FileEnumeratorClass) GetGReserved4

func (x *FileEnumeratorClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*FileEnumeratorClass) GetGReserved5

func (x *FileEnumeratorClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*FileEnumeratorClass) GetGReserved6

func (x *FileEnumeratorClass) GetGReserved6() func()

GetGReserved6 gets the "_g_reserved6" callback function.

func (*FileEnumeratorClass) GetGReserved7

func (x *FileEnumeratorClass) GetGReserved7() func()

GetGReserved7 gets the "_g_reserved7" callback function.

func (*FileEnumeratorClass) GetNextFile

func (x *FileEnumeratorClass) GetNextFile() func(*FileEnumerator, *Cancellable) *FileInfo

GetNextFile gets the "next_file" callback function.

func (*FileEnumeratorClass) GetNextFilesAsync

func (x *FileEnumeratorClass) GetNextFilesAsync() func(*FileEnumerator, int, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetNextFilesAsync gets the "next_files_async" callback function.

func (*FileEnumeratorClass) GetNextFilesFinish

func (x *FileEnumeratorClass) GetNextFilesFinish() func(*FileEnumerator, AsyncResult) *glib.List

GetNextFilesFinish gets the "next_files_finish" callback function.

func (*FileEnumeratorClass) GoPointer

func (x *FileEnumeratorClass) GoPointer() uintptr

func (*FileEnumeratorClass) OverrideCloseAsync

func (x *FileEnumeratorClass) OverrideCloseAsync(cb func(*FileEnumerator, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideCloseAsync sets the "close_async" callback function.

func (*FileEnumeratorClass) OverrideCloseFinish

func (x *FileEnumeratorClass) OverrideCloseFinish(cb func(*FileEnumerator, AsyncResult) bool)

OverrideCloseFinish sets the "close_finish" callback function.

func (*FileEnumeratorClass) OverrideCloseFn

func (x *FileEnumeratorClass) OverrideCloseFn(cb func(*FileEnumerator, *Cancellable) bool)

OverrideCloseFn sets the "close_fn" callback function.

func (*FileEnumeratorClass) OverrideGReserved1

func (x *FileEnumeratorClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*FileEnumeratorClass) OverrideGReserved2

func (x *FileEnumeratorClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*FileEnumeratorClass) OverrideGReserved3

func (x *FileEnumeratorClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*FileEnumeratorClass) OverrideGReserved4

func (x *FileEnumeratorClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*FileEnumeratorClass) OverrideGReserved5

func (x *FileEnumeratorClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

func (*FileEnumeratorClass) OverrideGReserved6

func (x *FileEnumeratorClass) OverrideGReserved6(cb func())

OverrideGReserved6 sets the "_g_reserved6" callback function.

func (*FileEnumeratorClass) OverrideGReserved7

func (x *FileEnumeratorClass) OverrideGReserved7(cb func())

OverrideGReserved7 sets the "_g_reserved7" callback function.

func (*FileEnumeratorClass) OverrideNextFile

func (x *FileEnumeratorClass) OverrideNextFile(cb func(*FileEnumerator, *Cancellable) *FileInfo)

OverrideNextFile sets the "next_file" callback function.

func (*FileEnumeratorClass) OverrideNextFilesAsync

func (x *FileEnumeratorClass) OverrideNextFilesAsync(cb func(*FileEnumerator, int, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideNextFilesAsync sets the "next_files_async" callback function.

func (*FileEnumeratorClass) OverrideNextFilesFinish

func (x *FileEnumeratorClass) OverrideNextFilesFinish(cb func(*FileEnumerator, AsyncResult) *glib.List)

OverrideNextFilesFinish sets the "next_files_finish" callback function.

type FileEnumeratorPrivate

type FileEnumeratorPrivate struct {
	// contains filtered or unexported fields
}

func (*FileEnumeratorPrivate) GoPointer

func (x *FileEnumeratorPrivate) GoPointer() uintptr

type FileIOStream

type FileIOStream struct {
	IOStream
}

`GFileIOStream` provides I/O streams that both read and write to the same file handle.

`GFileIOStream` implements [iface@Gio.Seekable], which allows the I/O stream to jump to arbitrary positions in the file and to truncate the file, provided the filesystem of the file supports these operations.

To find the position of a file I/O stream, use [method@Gio.Seekable.tell].

To find out if a file I/O stream supports seeking, use [method@Gio.Seekable.can_seek]. To position a file I/O stream, use [method@Gio.Seekable.seek]. To find out if a file I/O stream supports truncating, use [method@Gio.Seekable.can_truncate]. To truncate a file I/O stream, use [method@Gio.Seekable.truncate].

The default implementation of all the `GFileIOStream` operations and the implementation of [iface@Gio.Seekable] just call into the same operations on the output stream.

func FileIOStreamNewFromInternalPtr

func FileIOStreamNewFromInternalPtr(ptr uintptr) *FileIOStream

func (*FileIOStream) CanSeek

func (x *FileIOStream) CanSeek() bool

Tests if the stream supports the #GSeekableIface.

func (*FileIOStream) CanTruncate

func (x *FileIOStream) CanTruncate() bool

Tests if the length of the stream can be adjusted with g_seekable_truncate().

func (*FileIOStream) GetEtag

func (x *FileIOStream) GetEtag() string

Gets the entity tag for the file when it has been written. This must be called after the stream has been written and closed, as the etag can change while writing.

func (*FileIOStream) GoPointer

func (c *FileIOStream) GoPointer() uintptr

func (*FileIOStream) QueryInfo

func (x *FileIOStream) QueryInfo(AttributesVar string, CancellableVar *Cancellable) (*FileInfo, error)

Queries a file io stream for the given @attributes. This function blocks while querying the stream. For the asynchronous version of this function, see g_file_io_stream_query_info_async(). While the stream is blocked, the stream will set the pending flag internally, and any other operations on the stream will fail with %G_IO_ERROR_PENDING.

Can fail if the stream was already closed (with @error being set to %G_IO_ERROR_CLOSED), the stream has pending operations (with @error being set to %G_IO_ERROR_PENDING), or if querying info is not supported for the stream's interface (with @error being set to %G_IO_ERROR_NOT_SUPPORTED). I all cases of failure, %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 set, and %NULL will be returned.

func (*FileIOStream) QueryInfoAsync

func (x *FileIOStream) QueryInfoAsync(AttributesVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously queries the @stream for a #GFileInfo. When completed, @callback will be called with a #GAsyncResult which can be used to finish the operation with g_file_io_stream_query_info_finish().

For the synchronous version of this function, see g_file_io_stream_query_info().

func (*FileIOStream) QueryInfoFinish

func (x *FileIOStream) QueryInfoFinish(ResultVar AsyncResult) (*FileInfo, error)

Finalizes the asynchronous query started by g_file_io_stream_query_info_async().

func (*FileIOStream) Seek

func (x *FileIOStream) Seek(OffsetVar int64, TypeVar glib.SeekType, CancellableVar *Cancellable) (bool, error)

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.

func (*FileIOStream) SetGoPointer

func (c *FileIOStream) SetGoPointer(ptr uintptr)

func (*FileIOStream) Tell

func (x *FileIOStream) Tell() int64

Tells the current position within the stream.

func (*FileIOStream) Truncate

func (x *FileIOStream) Truncate(OffsetVar int64, CancellableVar *Cancellable) (bool, error)

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.

type FileIOStreamClass

type FileIOStreamClass struct {
	ParentClass IOStreamClass
	// contains filtered or unexported fields
}

func (*FileIOStreamClass) GetCanSeek

func (x *FileIOStreamClass) GetCanSeek() func(*FileIOStream) bool

GetCanSeek gets the "can_seek" callback function.

func (*FileIOStreamClass) GetCanTruncate

func (x *FileIOStreamClass) GetCanTruncate() func(*FileIOStream) bool

GetCanTruncate gets the "can_truncate" callback function.

func (*FileIOStreamClass) GetGReserved1

func (x *FileIOStreamClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*FileIOStreamClass) GetGReserved2

func (x *FileIOStreamClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*FileIOStreamClass) GetGReserved3

func (x *FileIOStreamClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*FileIOStreamClass) GetGReserved4

func (x *FileIOStreamClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*FileIOStreamClass) GetGReserved5

func (x *FileIOStreamClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*FileIOStreamClass) GetGetEtag

func (x *FileIOStreamClass) GetGetEtag() func(*FileIOStream) string

GetGetEtag gets the "get_etag" callback function.

func (*FileIOStreamClass) GetQueryInfo

func (x *FileIOStreamClass) GetQueryInfo() func(*FileIOStream, string, *Cancellable) *FileInfo

GetQueryInfo gets the "query_info" callback function.

func (*FileIOStreamClass) GetQueryInfoAsync

func (x *FileIOStreamClass) GetQueryInfoAsync() func(*FileIOStream, string, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetQueryInfoAsync gets the "query_info_async" callback function.

func (*FileIOStreamClass) GetQueryInfoFinish

func (x *FileIOStreamClass) GetQueryInfoFinish() func(*FileIOStream, AsyncResult) *FileInfo

GetQueryInfoFinish gets the "query_info_finish" callback function.

func (*FileIOStreamClass) GetSeek

GetSeek gets the "seek" callback function.

func (*FileIOStreamClass) GetTell

func (x *FileIOStreamClass) GetTell() func(*FileIOStream) int64

GetTell gets the "tell" callback function.

func (*FileIOStreamClass) GetTruncateFn

func (x *FileIOStreamClass) GetTruncateFn() func(*FileIOStream, int64, *Cancellable) bool

GetTruncateFn gets the "truncate_fn" callback function.

func (*FileIOStreamClass) GoPointer

func (x *FileIOStreamClass) GoPointer() uintptr

func (*FileIOStreamClass) OverrideCanSeek

func (x *FileIOStreamClass) OverrideCanSeek(cb func(*FileIOStream) bool)

OverrideCanSeek sets the "can_seek" callback function.

func (*FileIOStreamClass) OverrideCanTruncate

func (x *FileIOStreamClass) OverrideCanTruncate(cb func(*FileIOStream) bool)

OverrideCanTruncate sets the "can_truncate" callback function.

func (*FileIOStreamClass) OverrideGReserved1

func (x *FileIOStreamClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*FileIOStreamClass) OverrideGReserved2

func (x *FileIOStreamClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*FileIOStreamClass) OverrideGReserved3

func (x *FileIOStreamClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*FileIOStreamClass) OverrideGReserved4

func (x *FileIOStreamClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*FileIOStreamClass) OverrideGReserved5

func (x *FileIOStreamClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

func (*FileIOStreamClass) OverrideGetEtag

func (x *FileIOStreamClass) OverrideGetEtag(cb func(*FileIOStream) string)

OverrideGetEtag sets the "get_etag" callback function.

func (*FileIOStreamClass) OverrideQueryInfo

func (x *FileIOStreamClass) OverrideQueryInfo(cb func(*FileIOStream, string, *Cancellable) *FileInfo)

OverrideQueryInfo sets the "query_info" callback function.

func (*FileIOStreamClass) OverrideQueryInfoAsync

func (x *FileIOStreamClass) OverrideQueryInfoAsync(cb func(*FileIOStream, string, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideQueryInfoAsync sets the "query_info_async" callback function.

func (*FileIOStreamClass) OverrideQueryInfoFinish

func (x *FileIOStreamClass) OverrideQueryInfoFinish(cb func(*FileIOStream, AsyncResult) *FileInfo)

OverrideQueryInfoFinish sets the "query_info_finish" callback function.

func (*FileIOStreamClass) OverrideSeek

func (x *FileIOStreamClass) OverrideSeek(cb func(*FileIOStream, int64, glib.SeekType, *Cancellable) bool)

OverrideSeek sets the "seek" callback function.

func (*FileIOStreamClass) OverrideTell

func (x *FileIOStreamClass) OverrideTell(cb func(*FileIOStream) int64)

OverrideTell sets the "tell" callback function.

func (*FileIOStreamClass) OverrideTruncateFn

func (x *FileIOStreamClass) OverrideTruncateFn(cb func(*FileIOStream, int64, *Cancellable) bool)

OverrideTruncateFn sets the "truncate_fn" callback function.

type FileIOStreamPrivate

type FileIOStreamPrivate struct {
	// contains filtered or unexported fields
}

func (*FileIOStreamPrivate) GoPointer

func (x *FileIOStreamPrivate) GoPointer() uintptr

type FileIcon

type FileIcon struct {
	gobject.Object
}

`GFileIcon` specifies an icon by pointing to an image file to be used as icon.

It implements [iface@Gio.LoadableIcon].

func FileIconNewFromInternalPtr

func FileIconNewFromInternalPtr(ptr uintptr) *FileIcon

func NewFileIcon

func NewFileIcon(FileVar File) *FileIcon

Creates a new icon for a file.

func (*FileIcon) Equal

func (x *FileIcon) Equal(Icon2Var Icon) bool

Checks if two icons are equal.

func (*FileIcon) GetFile

func (x *FileIcon) GetFile() *FileBase

Gets the #GFile associated with the given @icon.

func (*FileIcon) GoPointer

func (c *FileIcon) GoPointer() uintptr

func (*FileIcon) Hash

func (x *FileIcon) Hash() uint

Gets a hash for an icon.

func (*FileIcon) Load

func (x *FileIcon) Load(SizeVar int, TypeVar *string, CancellableVar *Cancellable) (*InputStream, error)

Loads a loadable icon. For the asynchronous version of this function, see g_loadable_icon_load_async().

func (*FileIcon) LoadAsync

func (x *FileIcon) LoadAsync(SizeVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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().

func (*FileIcon) LoadFinish

func (x *FileIcon) LoadFinish(ResVar AsyncResult, TypeVar *string) (*InputStream, error)

Finishes an asynchronous icon load started in g_loadable_icon_load_async().

func (*FileIcon) Serialize

func (x *FileIcon) Serialize() *glib.Variant

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.

func (*FileIcon) SetGoPointer

func (c *FileIcon) SetGoPointer(ptr uintptr)

func (*FileIcon) ToString

func (x *FileIcon) ToString() string

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`).

type FileIconClass

type FileIconClass struct {
	// contains filtered or unexported fields
}

func (*FileIconClass) GoPointer

func (x *FileIconClass) GoPointer() uintptr

type FileIface

type FileIface struct {
	GIface uintptr

	SupportsThreadContexts bool
	// contains filtered or unexported fields
}

An interface for writing VFS file handles.

func (*FileIface) GetAppendTo

func (x *FileIface) GetAppendTo() func(File, FileCreateFlags, *Cancellable) *FileOutputStream

GetAppendTo gets the "append_to" callback function. Writes to the end of a file.

func (*FileIface) GetAppendToAsync

func (x *FileIface) GetAppendToAsync() func(File, FileCreateFlags, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetAppendToAsync gets the "append_to_async" callback function. Asynchronously writes to the end of a file.

func (*FileIface) GetAppendToFinish

func (x *FileIface) GetAppendToFinish() func(File, AsyncResult) *FileOutputStream

GetAppendToFinish gets the "append_to_finish" callback function. Finishes an asynchronous file append operation.

func (*FileIface) GetCopy

GetCopy gets the "copy" callback function. Copies a file. %NULL if copying is unsupported, which will

cause `GFile` to use a fallback copy method where it reads from the
source and writes to the destination.

func (*FileIface) GetCopyAsync

GetCopyAsync gets the "copy_async" callback function. Asynchronously copies a file.

func (*FileIface) GetCopyFinish

func (x *FileIface) GetCopyFinish() func(File, AsyncResult) bool

GetCopyFinish gets the "copy_finish" callback function. Finishes an asynchronous copy operation.

func (*FileIface) GetCreate

func (x *FileIface) GetCreate() func(File, FileCreateFlags, *Cancellable) *FileOutputStream

GetCreate gets the "create" callback function. Creates a new file.

func (*FileIface) GetCreateAsync

func (x *FileIface) GetCreateAsync() func(File, FileCreateFlags, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetCreateAsync gets the "create_async" callback function. Asynchronously creates a file.

func (*FileIface) GetCreateFinish

func (x *FileIface) GetCreateFinish() func(File, AsyncResult) *FileOutputStream

GetCreateFinish gets the "create_finish" callback function. Finishes asynchronously creating a file.

func (*FileIface) GetCreateReadwrite

func (x *FileIface) GetCreateReadwrite() func(File, FileCreateFlags, *Cancellable) *FileIOStream

GetCreateReadwrite gets the "create_readwrite" callback function. Creates file read/write. Since 2.22.

func (*FileIface) GetCreateReadwriteAsync

func (x *FileIface) GetCreateReadwriteAsync() func(File, FileCreateFlags, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetCreateReadwriteAsync gets the "create_readwrite_async" callback function. Asynchronously creates file read/write. Since 2.22.

func (*FileIface) GetCreateReadwriteFinish

func (x *FileIface) GetCreateReadwriteFinish() func(File, AsyncResult) *FileIOStream

GetCreateReadwriteFinish gets the "create_readwrite_finish" callback function. Finishes an asynchronous creates read/write. Since 2.22.

func (*FileIface) GetDeleteFile

func (x *FileIface) GetDeleteFile() func(File, *Cancellable) bool

GetDeleteFile gets the "delete_file" callback function. Deletes a file.

func (*FileIface) GetDeleteFileAsync

func (x *FileIface) GetDeleteFileAsync() func(File, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetDeleteFileAsync gets the "delete_file_async" callback function. Asynchronously deletes a file.

func (*FileIface) GetDeleteFileFinish

func (x *FileIface) GetDeleteFileFinish() func(File, AsyncResult) bool

GetDeleteFileFinish gets the "delete_file_finish" callback function. Finishes an asynchronous delete.

func (*FileIface) GetDup

func (x *FileIface) GetDup() func(File) *FileBase

GetDup gets the "dup" callback function. Duplicates a #GFile.

func (*FileIface) GetEjectMountable

func (x *FileIface) GetEjectMountable() func(File, MountUnmountFlags, *Cancellable, *AsyncReadyCallback, uintptr)

GetEjectMountable gets the "eject_mountable" callback function. Ejects a mountable.

func (*FileIface) GetEjectMountableFinish

func (x *FileIface) GetEjectMountableFinish() func(File, AsyncResult) bool

GetEjectMountableFinish gets the "eject_mountable_finish" callback function. Finishes an eject operation.

func (*FileIface) GetEjectMountableWithOperation

func (x *FileIface) GetEjectMountableWithOperation() func(File, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr)

GetEjectMountableWithOperation gets the "eject_mountable_with_operation" callback function. Ejects a mountable object using a #GMountOperation. Since 2.22.

func (*FileIface) GetEjectMountableWithOperationFinish

func (x *FileIface) GetEjectMountableWithOperationFinish() func(File, AsyncResult) bool

GetEjectMountableWithOperationFinish gets the "eject_mountable_with_operation_finish" callback function. Finishes an eject operation using a #GMountOperation. Since 2.22.

func (*FileIface) GetEnumerateChildren

func (x *FileIface) GetEnumerateChildren() func(File, string, FileQueryInfoFlags, *Cancellable) *FileEnumerator

GetEnumerateChildren gets the "enumerate_children" callback function. Gets a #GFileEnumerator with the children of a #GFile.

func (*FileIface) GetEnumerateChildrenAsync

func (x *FileIface) GetEnumerateChildrenAsync() func(File, string, FileQueryInfoFlags, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetEnumerateChildrenAsync gets the "enumerate_children_async" callback function. Asynchronously gets a #GFileEnumerator with the children of a #GFile.

func (*FileIface) GetEnumerateChildrenFinish

func (x *FileIface) GetEnumerateChildrenFinish() func(File, AsyncResult) *FileEnumerator

GetEnumerateChildrenFinish gets the "enumerate_children_finish" callback function. Finishes asynchronously enumerating the children.

func (*FileIface) GetEqual

func (x *FileIface) GetEqual() func(File, File) bool

GetEqual gets the "equal" callback function. Checks equality of two given #GFiles.

func (*FileIface) GetFindEnclosingMount

func (x *FileIface) GetFindEnclosingMount() func(File, *Cancellable) *MountBase

GetFindEnclosingMount gets the "find_enclosing_mount" callback function. Gets a #GMount for the #GFile.

func (*FileIface) GetFindEnclosingMountAsync

func (x *FileIface) GetFindEnclosingMountAsync() func(File, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetFindEnclosingMountAsync gets the "find_enclosing_mount_async" callback function. Asynchronously gets the #GMount for a #GFile.

func (*FileIface) GetFindEnclosingMountFinish

func (x *FileIface) GetFindEnclosingMountFinish() func(File, AsyncResult) *MountBase

GetFindEnclosingMountFinish gets the "find_enclosing_mount_finish" callback function. Finishes asynchronously getting the volume.

func (*FileIface) GetGetBasename

func (x *FileIface) GetGetBasename() func(File) string

GetGetBasename gets the "get_basename" callback function. Gets the basename for a given #GFile.

func (*FileIface) GetGetChildForDisplayName

func (x *FileIface) GetGetChildForDisplayName() func(File, string) *FileBase

GetGetChildForDisplayName gets the "get_child_for_display_name" callback function. Gets the child #GFile for a given display name.

func (*FileIface) GetGetParent

func (x *FileIface) GetGetParent() func(File) *FileBase

GetGetParent gets the "get_parent" callback function. Gets the parent directory for the #GFile.

func (*FileIface) GetGetParseName

func (x *FileIface) GetGetParseName() func(File) string

GetGetParseName gets the "get_parse_name" callback function. Gets the parsed name for the #GFile.

func (*FileIface) GetGetPath

func (x *FileIface) GetGetPath() func(File) string

GetGetPath gets the "get_path" callback function. Gets the current path within a #GFile.

func (*FileIface) GetGetRelativePath

func (x *FileIface) GetGetRelativePath() func(File, File) string

GetGetRelativePath gets the "get_relative_path" callback function. Gets the path for a #GFile relative to a given path.

func (*FileIface) GetGetUri

func (x *FileIface) GetGetUri() func(File) string

GetGetUri gets the "get_uri" callback function. Gets a URI for the path within a #GFile.

func (*FileIface) GetGetUriScheme

func (x *FileIface) GetGetUriScheme() func(File) string

GetGetUriScheme gets the "get_uri_scheme" callback function. Gets the URI scheme for a #GFile.

func (*FileIface) GetHasUriScheme

func (x *FileIface) GetHasUriScheme() func(File, string) bool

GetHasUriScheme gets the "has_uri_scheme" callback function. Checks to see if a #GFile has a given URI scheme.

func (*FileIface) GetHash

func (x *FileIface) GetHash() func(File) uint

GetHash gets the "hash" callback function. Creates a hash of a #GFile.

func (*FileIface) GetIsNative

func (x *FileIface) GetIsNative() func(File) bool

GetIsNative gets the "is_native" callback function. Checks to see if a file is native to the system.

func (*FileIface) GetMakeDirectory

func (x *FileIface) GetMakeDirectory() func(File, *Cancellable) bool

GetMakeDirectory gets the "make_directory" callback function. Makes a directory.

func (*FileIface) GetMakeDirectoryAsync

func (x *FileIface) GetMakeDirectoryAsync() func(File, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetMakeDirectoryAsync gets the "make_directory_async" callback function. Asynchronously makes a directory.

func (*FileIface) GetMakeDirectoryFinish

func (x *FileIface) GetMakeDirectoryFinish() func(File, AsyncResult) bool

GetMakeDirectoryFinish gets the "make_directory_finish" callback function. Finishes making a directory asynchronously.

func (x *FileIface) GetMakeSymbolicLink() func(File, string, *Cancellable) bool

GetMakeSymbolicLink gets the "make_symbolic_link" callback function. Makes a symbolic link. %NULL if symbolic

links are unsupported.

func (*FileIface) GetMakeSymbolicLinkAsync

func (x *FileIface) GetMakeSymbolicLinkAsync() func(File, string, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetMakeSymbolicLinkAsync gets the "make_symbolic_link_async" callback function. Asynchronously makes a symbolic link

func (*FileIface) GetMakeSymbolicLinkFinish

func (x *FileIface) GetMakeSymbolicLinkFinish() func(File, AsyncResult) bool

GetMakeSymbolicLinkFinish gets the "make_symbolic_link_finish" callback function. Finishes making a symbolic link asynchronously.

func (*FileIface) GetMeasureDiskUsage

GetMeasureDiskUsage gets the "measure_disk_usage" callback function. Recursively measures the disk usage of @file. Since 2.38

func (*FileIface) GetMeasureDiskUsageAsync

GetMeasureDiskUsageAsync gets the "measure_disk_usage_async" callback function. Asynchronously recursively measures the disk usage of @file. Since 2.38

func (*FileIface) GetMeasureDiskUsageFinish

func (x *FileIface) GetMeasureDiskUsageFinish() func(File, AsyncResult, *uint64, *uint64, *uint64) bool

GetMeasureDiskUsageFinish gets the "measure_disk_usage_finish" callback function. Finishes an asynchronous recursive measurement of the disk usage of @file. Since 2.38

func (*FileIface) GetMonitorDir

func (x *FileIface) GetMonitorDir() func(File, FileMonitorFlags, *Cancellable) *FileMonitor

GetMonitorDir gets the "monitor_dir" callback function. Creates a #GFileMonitor for the location.

func (*FileIface) GetMonitorFile

func (x *FileIface) GetMonitorFile() func(File, FileMonitorFlags, *Cancellable) *FileMonitor

GetMonitorFile gets the "monitor_file" callback function. Creates a #GFileMonitor for the location.

func (*FileIface) GetMountEnclosingVolume

func (x *FileIface) GetMountEnclosingVolume() func(File, MountMountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr)

GetMountEnclosingVolume gets the "mount_enclosing_volume" callback function. Mounts a specified location.

func (*FileIface) GetMountEnclosingVolumeFinish

func (x *FileIface) GetMountEnclosingVolumeFinish() func(File, AsyncResult) bool

GetMountEnclosingVolumeFinish gets the "mount_enclosing_volume_finish" callback function. Finishes mounting a specified location.

func (*FileIface) GetMountMountable

func (x *FileIface) GetMountMountable() func(File, MountMountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr)

GetMountMountable gets the "mount_mountable" callback function. Mounts a mountable object.

func (*FileIface) GetMountMountableFinish

func (x *FileIface) GetMountMountableFinish() func(File, AsyncResult) *FileBase

GetMountMountableFinish gets the "mount_mountable_finish" callback function. Finishes a mounting operation.

func (*FileIface) GetMove

GetMove gets the "move" callback function. Moves a file.

func (*FileIface) GetMoveAsync

GetMoveAsync gets the "move_async" callback function. Asynchronously moves a file. Since: 2.72

func (*FileIface) GetMoveFinish

func (x *FileIface) GetMoveFinish() func(File, AsyncResult) bool

GetMoveFinish gets the "move_finish" callback function. Finishes an asynchronous move operation. Since: 2.72

func (*FileIface) GetOpenReadwrite

func (x *FileIface) GetOpenReadwrite() func(File, *Cancellable) *FileIOStream

GetOpenReadwrite gets the "open_readwrite" callback function. Open file read/write. Since 2.22.

func (*FileIface) GetOpenReadwriteAsync

func (x *FileIface) GetOpenReadwriteAsync() func(File, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetOpenReadwriteAsync gets the "open_readwrite_async" callback function. Asynchronously opens file read/write. Since 2.22.

func (*FileIface) GetOpenReadwriteFinish

func (x *FileIface) GetOpenReadwriteFinish() func(File, AsyncResult) *FileIOStream

GetOpenReadwriteFinish gets the "open_readwrite_finish" callback function. Finishes an asynchronous open read/write. Since 2.22.

func (*FileIface) GetPollMountable

func (x *FileIface) GetPollMountable() func(File, *Cancellable, *AsyncReadyCallback, uintptr)

GetPollMountable gets the "poll_mountable" callback function. Polls a mountable object for media changes. Since 2.22.

func (*FileIface) GetPollMountableFinish

func (x *FileIface) GetPollMountableFinish() func(File, AsyncResult) bool

GetPollMountableFinish gets the "poll_mountable_finish" callback function. Finishes a poll operation for media changes. Since 2.22.

func (*FileIface) GetPrefixMatches

func (x *FileIface) GetPrefixMatches() func(File, File) bool

GetPrefixMatches gets the "prefix_matches" callback function. Checks whether a #GFile contains a specified file.

func (*FileIface) GetQueryExists

func (x *FileIface) GetQueryExists() func(File, *Cancellable) bool

GetQueryExists gets the "query_exists" callback function. Queries whether a file exists. Since 2.84

func (*FileIface) GetQueryFilesystemInfo

func (x *FileIface) GetQueryFilesystemInfo() func(File, string, *Cancellable) *FileInfo

GetQueryFilesystemInfo gets the "query_filesystem_info" callback function. Gets a #GFileInfo for the file system #GFile is on.

func (*FileIface) GetQueryFilesystemInfoAsync

func (x *FileIface) GetQueryFilesystemInfoAsync() func(File, string, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetQueryFilesystemInfoAsync gets the "query_filesystem_info_async" callback function. Asynchronously gets a #GFileInfo for the file system #GFile is on.

func (*FileIface) GetQueryFilesystemInfoFinish

func (x *FileIface) GetQueryFilesystemInfoFinish() func(File, AsyncResult) *FileInfo

GetQueryFilesystemInfoFinish gets the "query_filesystem_info_finish" callback function. Finishes asynchronously getting the file system info.

func (*FileIface) GetQueryInfo

func (x *FileIface) GetQueryInfo() func(File, string, FileQueryInfoFlags, *Cancellable) *FileInfo

GetQueryInfo gets the "query_info" callback function. Gets the #GFileInfo for a #GFile.

func (*FileIface) GetQueryInfoAsync

func (x *FileIface) GetQueryInfoAsync() func(File, string, FileQueryInfoFlags, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetQueryInfoAsync gets the "query_info_async" callback function. Asynchronously gets the #GFileInfo for a #GFile.

func (*FileIface) GetQueryInfoFinish

func (x *FileIface) GetQueryInfoFinish() func(File, AsyncResult) *FileInfo

GetQueryInfoFinish gets the "query_info_finish" callback function. Finishes an asynchronous query info operation.

func (*FileIface) GetQuerySettableAttributes

func (x *FileIface) GetQuerySettableAttributes() func(File, *Cancellable) *FileAttributeInfoList

GetQuerySettableAttributes gets the "query_settable_attributes" callback function. Returns a list of #GFileAttributeInfos that can be set.

func (*FileIface) GetQuerySettableAttributesAsync

func (x *FileIface) GetQuerySettableAttributesAsync() func()

GetQuerySettableAttributesAsync gets the "_query_settable_attributes_async" callback function. Asynchronously gets a list of #GFileAttributeInfos that can be set.

func (*FileIface) GetQuerySettableAttributesFinish

func (x *FileIface) GetQuerySettableAttributesFinish() func()

GetQuerySettableAttributesFinish gets the "_query_settable_attributes_finish" callback function. Finishes asynchronously querying settable attributes.

func (*FileIface) GetQueryWritableNamespaces

func (x *FileIface) GetQueryWritableNamespaces() func(File, *Cancellable) *FileAttributeInfoList

GetQueryWritableNamespaces gets the "query_writable_namespaces" callback function. Returns a list of #GFileAttributeInfo namespaces that are writable.

func (*FileIface) GetQueryWritableNamespacesAsync

func (x *FileIface) GetQueryWritableNamespacesAsync() func()

GetQueryWritableNamespacesAsync gets the "_query_writable_namespaces_async" callback function. Asynchronously gets a list of #GFileAttributeInfo namespaces that are writable.

func (*FileIface) GetQueryWritableNamespacesFinish

func (x *FileIface) GetQueryWritableNamespacesFinish() func()

GetQueryWritableNamespacesFinish gets the "_query_writable_namespaces_finish" callback function. Finishes asynchronously querying the writable namespaces.

func (*FileIface) GetReadAsync

func (x *FileIface) GetReadAsync() func(File, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetReadAsync gets the "read_async" callback function. Asynchronously reads a file.

func (*FileIface) GetReadFinish

func (x *FileIface) GetReadFinish() func(File, AsyncResult) *FileInputStream

GetReadFinish gets the "read_finish" callback function. Finishes asynchronously reading a file.

func (*FileIface) GetReadFn

func (x *FileIface) GetReadFn() func(File, *Cancellable) *FileInputStream

GetReadFn gets the "read_fn" callback function. Reads a file asynchronously.

func (*FileIface) GetReplace

GetReplace gets the "replace" callback function. Replaces the contents of a file.

func (*FileIface) GetReplaceAsync

func (x *FileIface) GetReplaceAsync() func(File, string, bool, FileCreateFlags, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetReplaceAsync gets the "replace_async" callback function. Asynchronously replaces the contents of a file.

func (*FileIface) GetReplaceFinish

func (x *FileIface) GetReplaceFinish() func(File, AsyncResult) *FileOutputStream

GetReplaceFinish gets the "replace_finish" callback function. Finishes asynchronously replacing a file.

func (*FileIface) GetReplaceReadwrite

func (x *FileIface) GetReplaceReadwrite() func(File, string, bool, FileCreateFlags, *Cancellable) *FileIOStream

GetReplaceReadwrite gets the "replace_readwrite" callback function. Replaces file read/write. Since 2.22.

func (*FileIface) GetReplaceReadwriteAsync

func (x *FileIface) GetReplaceReadwriteAsync() func(File, string, bool, FileCreateFlags, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetReplaceReadwriteAsync gets the "replace_readwrite_async" callback function. Asynchronously replaces file read/write. Since 2.22.

func (*FileIface) GetReplaceReadwriteFinish

func (x *FileIface) GetReplaceReadwriteFinish() func(File, AsyncResult) *FileIOStream

GetReplaceReadwriteFinish gets the "replace_readwrite_finish" callback function. Finishes an asynchronous replace read/write. Since 2.22.

func (*FileIface) GetResolveRelativePath

func (x *FileIface) GetResolveRelativePath() func(File, string) *FileBase

GetResolveRelativePath gets the "resolve_relative_path" callback function. Resolves a relative path for a #GFile to an absolute path.

func (*FileIface) GetSetAttribute

GetSetAttribute gets the "set_attribute" callback function. Sets a #GFileAttributeInfo.

func (*FileIface) GetSetAttributesAsync

func (x *FileIface) GetSetAttributesAsync() func(File, *FileInfo, FileQueryInfoFlags, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetSetAttributesAsync gets the "set_attributes_async" callback function. Asynchronously sets a file's attributes.

func (*FileIface) GetSetAttributesFinish

func (x *FileIface) GetSetAttributesFinish() func(File, AsyncResult, **FileInfo) bool

GetSetAttributesFinish gets the "set_attributes_finish" callback function. Finishes setting a file's attributes asynchronously.

func (*FileIface) GetSetAttributesFromInfo

func (x *FileIface) GetSetAttributesFromInfo() func(File, *FileInfo, FileQueryInfoFlags, *Cancellable) bool

GetSetAttributesFromInfo gets the "set_attributes_from_info" callback function. Sets a #GFileAttributeInfo with information from a #GFileInfo.

func (*FileIface) GetSetDisplayName

func (x *FileIface) GetSetDisplayName() func(File, string, *Cancellable) *FileBase

GetSetDisplayName gets the "set_display_name" callback function. Sets the display name for a #GFile.

func (*FileIface) GetSetDisplayNameAsync

func (x *FileIface) GetSetDisplayNameAsync() func(File, string, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetSetDisplayNameAsync gets the "set_display_name_async" callback function. Asynchronously sets a #GFile's display name.

func (*FileIface) GetSetDisplayNameFinish

func (x *FileIface) GetSetDisplayNameFinish() func(File, AsyncResult) *FileBase

GetSetDisplayNameFinish gets the "set_display_name_finish" callback function. Finishes asynchronously setting a #GFile's display name.

func (*FileIface) GetStartMountable

func (x *FileIface) GetStartMountable() func(File, DriveStartFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr)

GetStartMountable gets the "start_mountable" callback function. Starts a mountable object. Since 2.22.

func (*FileIface) GetStartMountableFinish

func (x *FileIface) GetStartMountableFinish() func(File, AsyncResult) bool

GetStartMountableFinish gets the "start_mountable_finish" callback function. Finishes a start operation. Since 2.22.

func (*FileIface) GetStopMountable

GetStopMountable gets the "stop_mountable" callback function. Stops a mountable. Since 2.22.

func (*FileIface) GetStopMountableFinish

func (x *FileIface) GetStopMountableFinish() func(File, AsyncResult) bool

GetStopMountableFinish gets the "stop_mountable_finish" callback function. Finishes a stop operation. Since 2.22.

func (*FileIface) GetTrash

func (x *FileIface) GetTrash() func(File, *Cancellable) bool

GetTrash gets the "trash" callback function. Sends a #GFile to the Trash location.

func (*FileIface) GetTrashAsync

func (x *FileIface) GetTrashAsync() func(File, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetTrashAsync gets the "trash_async" callback function. Asynchronously sends a #GFile to the Trash location.

func (*FileIface) GetTrashFinish

func (x *FileIface) GetTrashFinish() func(File, AsyncResult) bool

GetTrashFinish gets the "trash_finish" callback function. Finishes an asynchronous file trashing operation.

func (*FileIface) GetUnmountMountable

func (x *FileIface) GetUnmountMountable() func(File, MountUnmountFlags, *Cancellable, *AsyncReadyCallback, uintptr)

GetUnmountMountable gets the "unmount_mountable" callback function. Unmounts a mountable object.

func (*FileIface) GetUnmountMountableFinish

func (x *FileIface) GetUnmountMountableFinish() func(File, AsyncResult) bool

GetUnmountMountableFinish gets the "unmount_mountable_finish" callback function. Finishes an unmount operation.

func (*FileIface) GetUnmountMountableWithOperation

func (x *FileIface) GetUnmountMountableWithOperation() func(File, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr)

GetUnmountMountableWithOperation gets the "unmount_mountable_with_operation" callback function. Unmounts a mountable object using a #GMountOperation. Since 2.22.

func (*FileIface) GetUnmountMountableWithOperationFinish

func (x *FileIface) GetUnmountMountableWithOperationFinish() func(File, AsyncResult) bool

GetUnmountMountableWithOperationFinish gets the "unmount_mountable_with_operation_finish" callback function. Finishes an unmount operation using a #GMountOperation. Since 2.22.

func (*FileIface) GoPointer

func (x *FileIface) GoPointer() uintptr

func (*FileIface) OverrideAppendTo

func (x *FileIface) OverrideAppendTo(cb func(File, FileCreateFlags, *Cancellable) *FileOutputStream)

OverrideAppendTo sets the "append_to" callback function. Writes to the end of a file.

func (*FileIface) OverrideAppendToAsync

func (x *FileIface) OverrideAppendToAsync(cb func(File, FileCreateFlags, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideAppendToAsync sets the "append_to_async" callback function. Asynchronously writes to the end of a file.

func (*FileIface) OverrideAppendToFinish

func (x *FileIface) OverrideAppendToFinish(cb func(File, AsyncResult) *FileOutputStream)

OverrideAppendToFinish sets the "append_to_finish" callback function. Finishes an asynchronous file append operation.

func (*FileIface) OverrideCopy

func (x *FileIface) OverrideCopy(cb func(File, File, FileCopyFlags, *Cancellable, *FileProgressCallback, uintptr) bool)

OverrideCopy sets the "copy" callback function. Copies a file. %NULL if copying is unsupported, which will

cause `GFile` to use a fallback copy method where it reads from the
source and writes to the destination.

func (*FileIface) OverrideCopyAsync

OverrideCopyAsync sets the "copy_async" callback function. Asynchronously copies a file.

func (*FileIface) OverrideCopyFinish

func (x *FileIface) OverrideCopyFinish(cb func(File, AsyncResult) bool)

OverrideCopyFinish sets the "copy_finish" callback function. Finishes an asynchronous copy operation.

func (*FileIface) OverrideCreate

func (x *FileIface) OverrideCreate(cb func(File, FileCreateFlags, *Cancellable) *FileOutputStream)

OverrideCreate sets the "create" callback function. Creates a new file.

func (*FileIface) OverrideCreateAsync

func (x *FileIface) OverrideCreateAsync(cb func(File, FileCreateFlags, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideCreateAsync sets the "create_async" callback function. Asynchronously creates a file.

func (*FileIface) OverrideCreateFinish

func (x *FileIface) OverrideCreateFinish(cb func(File, AsyncResult) *FileOutputStream)

OverrideCreateFinish sets the "create_finish" callback function. Finishes asynchronously creating a file.

func (*FileIface) OverrideCreateReadwrite

func (x *FileIface) OverrideCreateReadwrite(cb func(File, FileCreateFlags, *Cancellable) *FileIOStream)

OverrideCreateReadwrite sets the "create_readwrite" callback function. Creates file read/write. Since 2.22.

func (*FileIface) OverrideCreateReadwriteAsync

func (x *FileIface) OverrideCreateReadwriteAsync(cb func(File, FileCreateFlags, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideCreateReadwriteAsync sets the "create_readwrite_async" callback function. Asynchronously creates file read/write. Since 2.22.

func (*FileIface) OverrideCreateReadwriteFinish

func (x *FileIface) OverrideCreateReadwriteFinish(cb func(File, AsyncResult) *FileIOStream)

OverrideCreateReadwriteFinish sets the "create_readwrite_finish" callback function. Finishes an asynchronous creates read/write. Since 2.22.

func (*FileIface) OverrideDeleteFile

func (x *FileIface) OverrideDeleteFile(cb func(File, *Cancellable) bool)

OverrideDeleteFile sets the "delete_file" callback function. Deletes a file.

func (*FileIface) OverrideDeleteFileAsync

func (x *FileIface) OverrideDeleteFileAsync(cb func(File, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideDeleteFileAsync sets the "delete_file_async" callback function. Asynchronously deletes a file.

func (*FileIface) OverrideDeleteFileFinish

func (x *FileIface) OverrideDeleteFileFinish(cb func(File, AsyncResult) bool)

OverrideDeleteFileFinish sets the "delete_file_finish" callback function. Finishes an asynchronous delete.

func (*FileIface) OverrideDup

func (x *FileIface) OverrideDup(cb func(File) *FileBase)

OverrideDup sets the "dup" callback function. Duplicates a #GFile.

func (*FileIface) OverrideEjectMountable

func (x *FileIface) OverrideEjectMountable(cb func(File, MountUnmountFlags, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideEjectMountable sets the "eject_mountable" callback function. Ejects a mountable.

func (*FileIface) OverrideEjectMountableFinish

func (x *FileIface) OverrideEjectMountableFinish(cb func(File, AsyncResult) bool)

OverrideEjectMountableFinish sets the "eject_mountable_finish" callback function. Finishes an eject operation.

func (*FileIface) OverrideEjectMountableWithOperation

func (x *FileIface) OverrideEjectMountableWithOperation(cb func(File, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideEjectMountableWithOperation sets the "eject_mountable_with_operation" callback function. Ejects a mountable object using a #GMountOperation. Since 2.22.

func (*FileIface) OverrideEjectMountableWithOperationFinish

func (x *FileIface) OverrideEjectMountableWithOperationFinish(cb func(File, AsyncResult) bool)

OverrideEjectMountableWithOperationFinish sets the "eject_mountable_with_operation_finish" callback function. Finishes an eject operation using a #GMountOperation. Since 2.22.

func (*FileIface) OverrideEnumerateChildren

func (x *FileIface) OverrideEnumerateChildren(cb func(File, string, FileQueryInfoFlags, *Cancellable) *FileEnumerator)

OverrideEnumerateChildren sets the "enumerate_children" callback function. Gets a #GFileEnumerator with the children of a #GFile.

func (*FileIface) OverrideEnumerateChildrenAsync

func (x *FileIface) OverrideEnumerateChildrenAsync(cb func(File, string, FileQueryInfoFlags, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideEnumerateChildrenAsync sets the "enumerate_children_async" callback function. Asynchronously gets a #GFileEnumerator with the children of a #GFile.

func (*FileIface) OverrideEnumerateChildrenFinish

func (x *FileIface) OverrideEnumerateChildrenFinish(cb func(File, AsyncResult) *FileEnumerator)

OverrideEnumerateChildrenFinish sets the "enumerate_children_finish" callback function. Finishes asynchronously enumerating the children.

func (*FileIface) OverrideEqual

func (x *FileIface) OverrideEqual(cb func(File, File) bool)

OverrideEqual sets the "equal" callback function. Checks equality of two given #GFiles.

func (*FileIface) OverrideFindEnclosingMount

func (x *FileIface) OverrideFindEnclosingMount(cb func(File, *Cancellable) *MountBase)

OverrideFindEnclosingMount sets the "find_enclosing_mount" callback function. Gets a #GMount for the #GFile.

func (*FileIface) OverrideFindEnclosingMountAsync

func (x *FileIface) OverrideFindEnclosingMountAsync(cb func(File, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideFindEnclosingMountAsync sets the "find_enclosing_mount_async" callback function. Asynchronously gets the #GMount for a #GFile.

func (*FileIface) OverrideFindEnclosingMountFinish

func (x *FileIface) OverrideFindEnclosingMountFinish(cb func(File, AsyncResult) *MountBase)

OverrideFindEnclosingMountFinish sets the "find_enclosing_mount_finish" callback function. Finishes asynchronously getting the volume.

func (*FileIface) OverrideGetBasename

func (x *FileIface) OverrideGetBasename(cb func(File) string)

OverrideGetBasename sets the "get_basename" callback function. Gets the basename for a given #GFile.

func (*FileIface) OverrideGetChildForDisplayName

func (x *FileIface) OverrideGetChildForDisplayName(cb func(File, string) *FileBase)

OverrideGetChildForDisplayName sets the "get_child_for_display_name" callback function. Gets the child #GFile for a given display name.

func (*FileIface) OverrideGetParent

func (x *FileIface) OverrideGetParent(cb func(File) *FileBase)

OverrideGetParent sets the "get_parent" callback function. Gets the parent directory for the #GFile.

func (*FileIface) OverrideGetParseName

func (x *FileIface) OverrideGetParseName(cb func(File) string)

OverrideGetParseName sets the "get_parse_name" callback function. Gets the parsed name for the #GFile.

func (*FileIface) OverrideGetPath

func (x *FileIface) OverrideGetPath(cb func(File) string)

OverrideGetPath sets the "get_path" callback function. Gets the current path within a #GFile.

func (*FileIface) OverrideGetRelativePath

func (x *FileIface) OverrideGetRelativePath(cb func(File, File) string)

OverrideGetRelativePath sets the "get_relative_path" callback function. Gets the path for a #GFile relative to a given path.

func (*FileIface) OverrideGetUri

func (x *FileIface) OverrideGetUri(cb func(File) string)

OverrideGetUri sets the "get_uri" callback function. Gets a URI for the path within a #GFile.

func (*FileIface) OverrideGetUriScheme

func (x *FileIface) OverrideGetUriScheme(cb func(File) string)

OverrideGetUriScheme sets the "get_uri_scheme" callback function. Gets the URI scheme for a #GFile.

func (*FileIface) OverrideHasUriScheme

func (x *FileIface) OverrideHasUriScheme(cb func(File, string) bool)

OverrideHasUriScheme sets the "has_uri_scheme" callback function. Checks to see if a #GFile has a given URI scheme.

func (*FileIface) OverrideHash

func (x *FileIface) OverrideHash(cb func(File) uint)

OverrideHash sets the "hash" callback function. Creates a hash of a #GFile.

func (*FileIface) OverrideIsNative

func (x *FileIface) OverrideIsNative(cb func(File) bool)

OverrideIsNative sets the "is_native" callback function. Checks to see if a file is native to the system.

func (*FileIface) OverrideMakeDirectory

func (x *FileIface) OverrideMakeDirectory(cb func(File, *Cancellable) bool)

OverrideMakeDirectory sets the "make_directory" callback function. Makes a directory.

func (*FileIface) OverrideMakeDirectoryAsync

func (x *FileIface) OverrideMakeDirectoryAsync(cb func(File, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideMakeDirectoryAsync sets the "make_directory_async" callback function. Asynchronously makes a directory.

func (*FileIface) OverrideMakeDirectoryFinish

func (x *FileIface) OverrideMakeDirectoryFinish(cb func(File, AsyncResult) bool)

OverrideMakeDirectoryFinish sets the "make_directory_finish" callback function. Finishes making a directory asynchronously.

func (x *FileIface) OverrideMakeSymbolicLink(cb func(File, string, *Cancellable) bool)

OverrideMakeSymbolicLink sets the "make_symbolic_link" callback function. Makes a symbolic link. %NULL if symbolic

links are unsupported.

func (*FileIface) OverrideMakeSymbolicLinkAsync

func (x *FileIface) OverrideMakeSymbolicLinkAsync(cb func(File, string, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideMakeSymbolicLinkAsync sets the "make_symbolic_link_async" callback function. Asynchronously makes a symbolic link

func (*FileIface) OverrideMakeSymbolicLinkFinish

func (x *FileIface) OverrideMakeSymbolicLinkFinish(cb func(File, AsyncResult) bool)

OverrideMakeSymbolicLinkFinish sets the "make_symbolic_link_finish" callback function. Finishes making a symbolic link asynchronously.

func (*FileIface) OverrideMeasureDiskUsage

func (x *FileIface) OverrideMeasureDiskUsage(cb func(File, FileMeasureFlags, *Cancellable, *FileMeasureProgressCallback, uintptr, *uint64, *uint64, *uint64) bool)

OverrideMeasureDiskUsage sets the "measure_disk_usage" callback function. Recursively measures the disk usage of @file. Since 2.38

func (*FileIface) OverrideMeasureDiskUsageAsync

func (x *FileIface) OverrideMeasureDiskUsageAsync(cb func(File, FileMeasureFlags, int, *Cancellable, *FileMeasureProgressCallback, uintptr, *AsyncReadyCallback, uintptr))

OverrideMeasureDiskUsageAsync sets the "measure_disk_usage_async" callback function. Asynchronously recursively measures the disk usage of @file. Since 2.38

func (*FileIface) OverrideMeasureDiskUsageFinish

func (x *FileIface) OverrideMeasureDiskUsageFinish(cb func(File, AsyncResult, *uint64, *uint64, *uint64) bool)

OverrideMeasureDiskUsageFinish sets the "measure_disk_usage_finish" callback function. Finishes an asynchronous recursive measurement of the disk usage of @file. Since 2.38

func (*FileIface) OverrideMonitorDir

func (x *FileIface) OverrideMonitorDir(cb func(File, FileMonitorFlags, *Cancellable) *FileMonitor)

OverrideMonitorDir sets the "monitor_dir" callback function. Creates a #GFileMonitor for the location.

func (*FileIface) OverrideMonitorFile

func (x *FileIface) OverrideMonitorFile(cb func(File, FileMonitorFlags, *Cancellable) *FileMonitor)

OverrideMonitorFile sets the "monitor_file" callback function. Creates a #GFileMonitor for the location.

func (*FileIface) OverrideMountEnclosingVolume

func (x *FileIface) OverrideMountEnclosingVolume(cb func(File, MountMountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideMountEnclosingVolume sets the "mount_enclosing_volume" callback function. Mounts a specified location.

func (*FileIface) OverrideMountEnclosingVolumeFinish

func (x *FileIface) OverrideMountEnclosingVolumeFinish(cb func(File, AsyncResult) bool)

OverrideMountEnclosingVolumeFinish sets the "mount_enclosing_volume_finish" callback function. Finishes mounting a specified location.

func (*FileIface) OverrideMountMountable

func (x *FileIface) OverrideMountMountable(cb func(File, MountMountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideMountMountable sets the "mount_mountable" callback function. Mounts a mountable object.

func (*FileIface) OverrideMountMountableFinish

func (x *FileIface) OverrideMountMountableFinish(cb func(File, AsyncResult) *FileBase)

OverrideMountMountableFinish sets the "mount_mountable_finish" callback function. Finishes a mounting operation.

func (*FileIface) OverrideMove

func (x *FileIface) OverrideMove(cb func(File, File, FileCopyFlags, *Cancellable, *FileProgressCallback, uintptr) bool)

OverrideMove sets the "move" callback function. Moves a file.

func (*FileIface) OverrideMoveAsync

OverrideMoveAsync sets the "move_async" callback function. Asynchronously moves a file. Since: 2.72

func (*FileIface) OverrideMoveFinish

func (x *FileIface) OverrideMoveFinish(cb func(File, AsyncResult) bool)

OverrideMoveFinish sets the "move_finish" callback function. Finishes an asynchronous move operation. Since: 2.72

func (*FileIface) OverrideOpenReadwrite

func (x *FileIface) OverrideOpenReadwrite(cb func(File, *Cancellable) *FileIOStream)

OverrideOpenReadwrite sets the "open_readwrite" callback function. Open file read/write. Since 2.22.

func (*FileIface) OverrideOpenReadwriteAsync

func (x *FileIface) OverrideOpenReadwriteAsync(cb func(File, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideOpenReadwriteAsync sets the "open_readwrite_async" callback function. Asynchronously opens file read/write. Since 2.22.

func (*FileIface) OverrideOpenReadwriteFinish

func (x *FileIface) OverrideOpenReadwriteFinish(cb func(File, AsyncResult) *FileIOStream)

OverrideOpenReadwriteFinish sets the "open_readwrite_finish" callback function. Finishes an asynchronous open read/write. Since 2.22.

func (*FileIface) OverridePollMountable

func (x *FileIface) OverridePollMountable(cb func(File, *Cancellable, *AsyncReadyCallback, uintptr))

OverridePollMountable sets the "poll_mountable" callback function. Polls a mountable object for media changes. Since 2.22.

func (*FileIface) OverridePollMountableFinish

func (x *FileIface) OverridePollMountableFinish(cb func(File, AsyncResult) bool)

OverridePollMountableFinish sets the "poll_mountable_finish" callback function. Finishes a poll operation for media changes. Since 2.22.

func (*FileIface) OverridePrefixMatches

func (x *FileIface) OverridePrefixMatches(cb func(File, File) bool)

OverridePrefixMatches sets the "prefix_matches" callback function. Checks whether a #GFile contains a specified file.

func (*FileIface) OverrideQueryExists

func (x *FileIface) OverrideQueryExists(cb func(File, *Cancellable) bool)

OverrideQueryExists sets the "query_exists" callback function. Queries whether a file exists. Since 2.84

func (*FileIface) OverrideQueryFilesystemInfo

func (x *FileIface) OverrideQueryFilesystemInfo(cb func(File, string, *Cancellable) *FileInfo)

OverrideQueryFilesystemInfo sets the "query_filesystem_info" callback function. Gets a #GFileInfo for the file system #GFile is on.

func (*FileIface) OverrideQueryFilesystemInfoAsync

func (x *FileIface) OverrideQueryFilesystemInfoAsync(cb func(File, string, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideQueryFilesystemInfoAsync sets the "query_filesystem_info_async" callback function. Asynchronously gets a #GFileInfo for the file system #GFile is on.

func (*FileIface) OverrideQueryFilesystemInfoFinish

func (x *FileIface) OverrideQueryFilesystemInfoFinish(cb func(File, AsyncResult) *FileInfo)

OverrideQueryFilesystemInfoFinish sets the "query_filesystem_info_finish" callback function. Finishes asynchronously getting the file system info.

func (*FileIface) OverrideQueryInfo

func (x *FileIface) OverrideQueryInfo(cb func(File, string, FileQueryInfoFlags, *Cancellable) *FileInfo)

OverrideQueryInfo sets the "query_info" callback function. Gets the #GFileInfo for a #GFile.

func (*FileIface) OverrideQueryInfoAsync

func (x *FileIface) OverrideQueryInfoAsync(cb func(File, string, FileQueryInfoFlags, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideQueryInfoAsync sets the "query_info_async" callback function. Asynchronously gets the #GFileInfo for a #GFile.

func (*FileIface) OverrideQueryInfoFinish

func (x *FileIface) OverrideQueryInfoFinish(cb func(File, AsyncResult) *FileInfo)

OverrideQueryInfoFinish sets the "query_info_finish" callback function. Finishes an asynchronous query info operation.

func (*FileIface) OverrideQuerySettableAttributes

func (x *FileIface) OverrideQuerySettableAttributes(cb func(File, *Cancellable) *FileAttributeInfoList)

OverrideQuerySettableAttributes sets the "query_settable_attributes" callback function. Returns a list of #GFileAttributeInfos that can be set.

func (*FileIface) OverrideQuerySettableAttributesAsync

func (x *FileIface) OverrideQuerySettableAttributesAsync(cb func())

OverrideQuerySettableAttributesAsync sets the "_query_settable_attributes_async" callback function. Asynchronously gets a list of #GFileAttributeInfos that can be set.

func (*FileIface) OverrideQuerySettableAttributesFinish

func (x *FileIface) OverrideQuerySettableAttributesFinish(cb func())

OverrideQuerySettableAttributesFinish sets the "_query_settable_attributes_finish" callback function. Finishes asynchronously querying settable attributes.

func (*FileIface) OverrideQueryWritableNamespaces

func (x *FileIface) OverrideQueryWritableNamespaces(cb func(File, *Cancellable) *FileAttributeInfoList)

OverrideQueryWritableNamespaces sets the "query_writable_namespaces" callback function. Returns a list of #GFileAttributeInfo namespaces that are writable.

func (*FileIface) OverrideQueryWritableNamespacesAsync

func (x *FileIface) OverrideQueryWritableNamespacesAsync(cb func())

OverrideQueryWritableNamespacesAsync sets the "_query_writable_namespaces_async" callback function. Asynchronously gets a list of #GFileAttributeInfo namespaces that are writable.

func (*FileIface) OverrideQueryWritableNamespacesFinish

func (x *FileIface) OverrideQueryWritableNamespacesFinish(cb func())

OverrideQueryWritableNamespacesFinish sets the "_query_writable_namespaces_finish" callback function. Finishes asynchronously querying the writable namespaces.

func (*FileIface) OverrideReadAsync

func (x *FileIface) OverrideReadAsync(cb func(File, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideReadAsync sets the "read_async" callback function. Asynchronously reads a file.

func (*FileIface) OverrideReadFinish

func (x *FileIface) OverrideReadFinish(cb func(File, AsyncResult) *FileInputStream)

OverrideReadFinish sets the "read_finish" callback function. Finishes asynchronously reading a file.

func (*FileIface) OverrideReadFn

func (x *FileIface) OverrideReadFn(cb func(File, *Cancellable) *FileInputStream)

OverrideReadFn sets the "read_fn" callback function. Reads a file asynchronously.

func (*FileIface) OverrideReplace

func (x *FileIface) OverrideReplace(cb func(File, string, bool, FileCreateFlags, *Cancellable) *FileOutputStream)

OverrideReplace sets the "replace" callback function. Replaces the contents of a file.

func (*FileIface) OverrideReplaceAsync

func (x *FileIface) OverrideReplaceAsync(cb func(File, string, bool, FileCreateFlags, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideReplaceAsync sets the "replace_async" callback function. Asynchronously replaces the contents of a file.

func (*FileIface) OverrideReplaceFinish

func (x *FileIface) OverrideReplaceFinish(cb func(File, AsyncResult) *FileOutputStream)

OverrideReplaceFinish sets the "replace_finish" callback function. Finishes asynchronously replacing a file.

func (*FileIface) OverrideReplaceReadwrite

func (x *FileIface) OverrideReplaceReadwrite(cb func(File, string, bool, FileCreateFlags, *Cancellable) *FileIOStream)

OverrideReplaceReadwrite sets the "replace_readwrite" callback function. Replaces file read/write. Since 2.22.

func (*FileIface) OverrideReplaceReadwriteAsync

func (x *FileIface) OverrideReplaceReadwriteAsync(cb func(File, string, bool, FileCreateFlags, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideReplaceReadwriteAsync sets the "replace_readwrite_async" callback function. Asynchronously replaces file read/write. Since 2.22.

func (*FileIface) OverrideReplaceReadwriteFinish

func (x *FileIface) OverrideReplaceReadwriteFinish(cb func(File, AsyncResult) *FileIOStream)

OverrideReplaceReadwriteFinish sets the "replace_readwrite_finish" callback function. Finishes an asynchronous replace read/write. Since 2.22.

func (*FileIface) OverrideResolveRelativePath

func (x *FileIface) OverrideResolveRelativePath(cb func(File, string) *FileBase)

OverrideResolveRelativePath sets the "resolve_relative_path" callback function. Resolves a relative path for a #GFile to an absolute path.

func (*FileIface) OverrideSetAttribute

func (x *FileIface) OverrideSetAttribute(cb func(File, string, FileAttributeType, uintptr, FileQueryInfoFlags, *Cancellable) bool)

OverrideSetAttribute sets the "set_attribute" callback function. Sets a #GFileAttributeInfo.

func (*FileIface) OverrideSetAttributesAsync

func (x *FileIface) OverrideSetAttributesAsync(cb func(File, *FileInfo, FileQueryInfoFlags, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideSetAttributesAsync sets the "set_attributes_async" callback function. Asynchronously sets a file's attributes.

func (*FileIface) OverrideSetAttributesFinish

func (x *FileIface) OverrideSetAttributesFinish(cb func(File, AsyncResult, **FileInfo) bool)

OverrideSetAttributesFinish sets the "set_attributes_finish" callback function. Finishes setting a file's attributes asynchronously.

func (*FileIface) OverrideSetAttributesFromInfo

func (x *FileIface) OverrideSetAttributesFromInfo(cb func(File, *FileInfo, FileQueryInfoFlags, *Cancellable) bool)

OverrideSetAttributesFromInfo sets the "set_attributes_from_info" callback function. Sets a #GFileAttributeInfo with information from a #GFileInfo.

func (*FileIface) OverrideSetDisplayName

func (x *FileIface) OverrideSetDisplayName(cb func(File, string, *Cancellable) *FileBase)

OverrideSetDisplayName sets the "set_display_name" callback function. Sets the display name for a #GFile.

func (*FileIface) OverrideSetDisplayNameAsync

func (x *FileIface) OverrideSetDisplayNameAsync(cb func(File, string, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideSetDisplayNameAsync sets the "set_display_name_async" callback function. Asynchronously sets a #GFile's display name.

func (*FileIface) OverrideSetDisplayNameFinish

func (x *FileIface) OverrideSetDisplayNameFinish(cb func(File, AsyncResult) *FileBase)

OverrideSetDisplayNameFinish sets the "set_display_name_finish" callback function. Finishes asynchronously setting a #GFile's display name.

func (*FileIface) OverrideStartMountable

func (x *FileIface) OverrideStartMountable(cb func(File, DriveStartFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideStartMountable sets the "start_mountable" callback function. Starts a mountable object. Since 2.22.

func (*FileIface) OverrideStartMountableFinish

func (x *FileIface) OverrideStartMountableFinish(cb func(File, AsyncResult) bool)

OverrideStartMountableFinish sets the "start_mountable_finish" callback function. Finishes a start operation. Since 2.22.

func (*FileIface) OverrideStopMountable

func (x *FileIface) OverrideStopMountable(cb func(File, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideStopMountable sets the "stop_mountable" callback function. Stops a mountable. Since 2.22.

func (*FileIface) OverrideStopMountableFinish

func (x *FileIface) OverrideStopMountableFinish(cb func(File, AsyncResult) bool)

OverrideStopMountableFinish sets the "stop_mountable_finish" callback function. Finishes a stop operation. Since 2.22.

func (*FileIface) OverrideTrash

func (x *FileIface) OverrideTrash(cb func(File, *Cancellable) bool)

OverrideTrash sets the "trash" callback function. Sends a #GFile to the Trash location.

func (*FileIface) OverrideTrashAsync

func (x *FileIface) OverrideTrashAsync(cb func(File, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideTrashAsync sets the "trash_async" callback function. Asynchronously sends a #GFile to the Trash location.

func (*FileIface) OverrideTrashFinish

func (x *FileIface) OverrideTrashFinish(cb func(File, AsyncResult) bool)

OverrideTrashFinish sets the "trash_finish" callback function. Finishes an asynchronous file trashing operation.

func (*FileIface) OverrideUnmountMountable

func (x *FileIface) OverrideUnmountMountable(cb func(File, MountUnmountFlags, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideUnmountMountable sets the "unmount_mountable" callback function. Unmounts a mountable object.

func (*FileIface) OverrideUnmountMountableFinish

func (x *FileIface) OverrideUnmountMountableFinish(cb func(File, AsyncResult) bool)

OverrideUnmountMountableFinish sets the "unmount_mountable_finish" callback function. Finishes an unmount operation.

func (*FileIface) OverrideUnmountMountableWithOperation

func (x *FileIface) OverrideUnmountMountableWithOperation(cb func(File, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideUnmountMountableWithOperation sets the "unmount_mountable_with_operation" callback function. Unmounts a mountable object using a #GMountOperation. Since 2.22.

func (*FileIface) OverrideUnmountMountableWithOperationFinish

func (x *FileIface) OverrideUnmountMountableWithOperationFinish(cb func(File, AsyncResult) bool)

OverrideUnmountMountableWithOperationFinish sets the "unmount_mountable_with_operation_finish" callback function. Finishes an unmount operation using a #GMountOperation. Since 2.22.

type FileInfo

type FileInfo struct {
	gobject.Object
}

Stores information about a file system object referenced by a [iface@Gio.File].

Functionality for manipulating basic metadata for files. `GFileInfo` implements methods for getting information that all files should contain, and allows for manipulation of extended attributes.

See the [file attributes](file-attributes.html) document for more information on how GIO handles file attributes.

To obtain a `GFileInfo` for a [iface@Gio.File], use [method@Gio.File.query_info] (or its async variant). To obtain a `GFileInfo` for a file input or output stream, use [method@Gio.FileInputStream.query_info] or [method@Gio.FileOutputStream.query_info] (or their async variants).

To change the actual attributes of a file, you should then set the attribute in the `GFileInfo` and call [method@Gio.File.set_attributes_from_info] or [method@Gio.File.set_attributes_async] on a `GFile`.

However, not all attributes can be changed in the file. For instance, the actual size of a file cannot be changed via [method@Gio.FileInfo.set_size]. You may call [method@Gio.File.query_settable_attributes] and [method@Gio.File.query_writable_namespaces] to discover the settable attributes of a particular file at runtime.

The direct accessors, such as [method@Gio.FileInfo.get_name], are slightly more optimized than the generic attribute accessors, such as [method@Gio.FileInfo.get_attribute_byte_string].This optimization will matter only if calling the API in a tight loop.

It is an error to call these accessors without specifying their required file attributes when creating the `GFileInfo`. Use [method@Gio.FileInfo.has_attribute] or [method@Gio.FileInfo.list_attributes] to check what attributes are specified for a `GFileInfo`.

[struct@Gio.FileAttributeMatcher] allows for searching through a `GFileInfo` for attributes.

func FileInfoNewFromInternalPtr

func FileInfoNewFromInternalPtr(ptr uintptr) *FileInfo

func NewFileInfo

func NewFileInfo() *FileInfo

Creates a new file info structure.

func (*FileInfo) ClearStatus

func (x *FileInfo) ClearStatus()

Clears the status information from @info.

func (*FileInfo) CopyInto

func (x *FileInfo) CopyInto(DestInfoVar *FileInfo)

First clears all of the [GFileAttribute](file-attributes.html#file-attributes) of @dest_info, and then copies all of the file attributes from @src_info to @dest_info.

func (*FileInfo) Dup

func (x *FileInfo) Dup() *FileInfo

Duplicates a file info structure.

func (*FileInfo) GetAccessDateTime

func (x *FileInfo) GetAccessDateTime() *glib.DateTime

Gets the access time of the current @info and returns it as a #GDateTime.

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_TIME_ACCESS. If %G_FILE_ATTRIBUTE_TIME_ACCESS_USEC is provided, the resulting #GDateTime will additionally have microsecond precision.

If nanosecond precision is needed, %G_FILE_ATTRIBUTE_TIME_ACCESS_NSEC must be queried separately using g_file_info_get_attribute_uint32().

func (*FileInfo) GetAttributeAsString

func (x *FileInfo) GetAttributeAsString(AttributeVar string) string

Gets the value of an attribute, formatted as a human readable string.

This escapes things as needed to make the string valid UTF-8 and readable by humans. It’s not meant to be a machine readable or reversible escaping format.

To format file name attributes of type [enum@Gio.FileAttributeType.BYTE_STRING] for output as UTF-8, use [func@GLib.filename_to_utf8] instead: ```c const char *trash_orig_path_byte_string; g_autofree char *trash_orig_path_utf8 = NULL;

trash_orig_path_byte_string = g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_TRASH_ORIG_PATH); trash_orig_path_utf8 = g_filename_to_utf8 (trash_orig_path_byte_string, -1, NULL, NULL, NULL); if (trash_orig_path_utf8 != NULL)

g_message ("Some larger UTF-8 string with filename embedded as %s", trash_orig_path_utf8);

```

func (*FileInfo) GetAttributeBoolean

func (x *FileInfo) GetAttributeBoolean(AttributeVar string) bool

Gets the value of a boolean attribute. If the attribute does not contain a boolean value, %FALSE will be returned.

func (*FileInfo) GetAttributeByteString

func (x *FileInfo) GetAttributeByteString(AttributeVar string) string

Gets the value of a byte string attribute. If the attribute does not contain a byte string, %NULL will be returned.

func (*FileInfo) GetAttributeData

func (x *FileInfo) GetAttributeData(AttributeVar string, TypeVar *FileAttributeType, ValuePpVar *uintptr, StatusVar *FileAttributeStatus) bool

Gets the attribute type, value and status for an attribute key.

func (*FileInfo) GetAttributeFilePath

func (x *FileInfo) GetAttributeFilePath(AttributeVar string) string

Gets the value of a byte string attribute as a file path.

If the attribute does not contain a byte string, `NULL` will be returned.

This function is meant to be used by language bindings that have specific handling for Unix paths.

func (*FileInfo) GetAttributeInt32

func (x *FileInfo) GetAttributeInt32(AttributeVar string) int32

Gets a signed 32-bit integer contained within the attribute. If the attribute does not contain a signed 32-bit integer, or is invalid, 0 will be returned.

func (*FileInfo) GetAttributeInt64

func (x *FileInfo) GetAttributeInt64(AttributeVar string) int64

Gets a signed 64-bit integer contained within the attribute. If the attribute does not contain a signed 64-bit integer, or is invalid, 0 will be returned.

func (*FileInfo) GetAttributeObject

func (x *FileInfo) GetAttributeObject(AttributeVar string) *gobject.Object

Gets the value of a #GObject attribute. If the attribute does not contain a #GObject, %NULL will be returned.

func (*FileInfo) GetAttributeStatus

func (x *FileInfo) GetAttributeStatus(AttributeVar string) FileAttributeStatus

Gets the attribute status for an attribute key.

func (*FileInfo) GetAttributeString

func (x *FileInfo) GetAttributeString(AttributeVar string) string

Gets the value of a string attribute. If the attribute does not contain a string, %NULL will be returned.

func (*FileInfo) GetAttributeStringv

func (x *FileInfo) GetAttributeStringv(AttributeVar string) []string

Gets the value of a stringv attribute. If the attribute does not contain a stringv, %NULL will be returned.

func (*FileInfo) GetAttributeType

func (x *FileInfo) GetAttributeType(AttributeVar string) FileAttributeType

Gets the attribute type for an attribute key.

func (*FileInfo) GetAttributeUint32

func (x *FileInfo) GetAttributeUint32(AttributeVar string) uint32

Gets an unsigned 32-bit integer contained within the attribute. If the attribute does not contain an unsigned 32-bit integer, or is invalid, 0 will be returned.

func (*FileInfo) GetAttributeUint64

func (x *FileInfo) GetAttributeUint64(AttributeVar string) uint64

Gets a unsigned 64-bit integer contained within the attribute. If the attribute does not contain an unsigned 64-bit integer, or is invalid, 0 will be returned.

func (*FileInfo) GetContentType

func (x *FileInfo) GetContentType() string

Gets the file's content type.

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE.

func (*FileInfo) GetCreationDateTime

func (x *FileInfo) GetCreationDateTime() *glib.DateTime

Gets the creation time of the current @info and returns it as a #GDateTime.

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_TIME_CREATED. If %G_FILE_ATTRIBUTE_TIME_CREATED_USEC is provided, the resulting #GDateTime will additionally have microsecond precision.

If nanosecond precision is needed, %G_FILE_ATTRIBUTE_TIME_CREATED_NSEC must be queried separately using g_file_info_get_attribute_uint32().

func (*FileInfo) GetDeletionDate

func (x *FileInfo) GetDeletionDate() *glib.DateTime

Returns the #GDateTime representing the deletion date of the file, as available in %G_FILE_ATTRIBUTE_TRASH_DELETION_DATE. If the %G_FILE_ATTRIBUTE_TRASH_DELETION_DATE attribute is unset, %NULL is returned.

func (*FileInfo) GetDisplayName

func (x *FileInfo) GetDisplayName() string

Gets a display name for a file. This is guaranteed to always be set.

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.

func (*FileInfo) GetEditName

func (x *FileInfo) GetEditName() string

Gets the edit name for a file.

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME.

func (*FileInfo) GetEtag

func (x *FileInfo) GetEtag() string

Gets the [entity tag][iface@Gio.File#entity-tags] for a given #GFileInfo. See %G_FILE_ATTRIBUTE_ETAG_VALUE.

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_ETAG_VALUE.

func (*FileInfo) GetFileType

func (x *FileInfo) GetFileType() FileType

Gets a file's type (whether it is a regular file, symlink, etc). This is different from the file's content type, see g_file_info_get_content_type().

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_STANDARD_TYPE.

func (*FileInfo) GetIcon

func (x *FileInfo) GetIcon() *IconBase

Gets the icon for a file.

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_STANDARD_ICON.

func (*FileInfo) GetIsBackup

func (x *FileInfo) GetIsBackup() bool

Checks if a file is a backup file.

The exact semantics of what constitutes a backup file are backend-specific. For local files, a file is considered a backup if its name ends with `~` and it is a regular file. This follows the POSIX convention used by text editors such as Emacs.

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP.

func (*FileInfo) GetIsHidden

func (x *FileInfo) GetIsHidden() bool

Checks if a file is hidden.

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.

func (x *FileInfo) GetIsSymlink() bool

Checks if a file is a symlink.

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.

func (*FileInfo) GetModificationDateTime

func (x *FileInfo) GetModificationDateTime() *glib.DateTime

Gets the modification time of the current @info and returns it as a #GDateTime.

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_TIME_MODIFIED. If %G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC is provided, the resulting #GDateTime will additionally have microsecond precision.

If nanosecond precision is needed, %G_FILE_ATTRIBUTE_TIME_MODIFIED_NSEC must be queried separately using g_file_info_get_attribute_uint32().

func (*FileInfo) GetModificationTime

func (x *FileInfo) GetModificationTime(ResultVar *glib.TimeVal)

Gets the modification time of the current @info and sets it in @result.

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_TIME_MODIFIED. If %G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC is provided it will be used too.

func (*FileInfo) GetName

func (x *FileInfo) GetName() string

Gets the name for a file. This is guaranteed to always be set.

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_STANDARD_NAME.

func (*FileInfo) GetSize

func (x *FileInfo) GetSize() int64

Gets the file's size (in bytes). The size is retrieved through the value of the %G_FILE_ATTRIBUTE_STANDARD_SIZE attribute and is converted from #guint64 to #goffset before returning the result.

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_STANDARD_SIZE.

func (*FileInfo) GetSortOrder

func (x *FileInfo) GetSortOrder() int32

Gets the value of the sort_order attribute from the #GFileInfo. See %G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.

func (*FileInfo) GetSymbolicIcon

func (x *FileInfo) GetSymbolicIcon() *IconBase

Gets the symbolic icon for a file.

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON.

func (*FileInfo) GetSymlinkTarget

func (x *FileInfo) GetSymlinkTarget() string

Gets the symlink target for a given #GFileInfo.

It is an error to call this if the #GFileInfo does not contain %G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET.

func (*FileInfo) GoPointer

func (c *FileInfo) GoPointer() uintptr

func (*FileInfo) HasAttribute

func (x *FileInfo) HasAttribute(AttributeVar string) bool

Checks if a file info structure has an attribute named @attribute.

func (*FileInfo) HasNamespace

func (x *FileInfo) HasNamespace(NameSpaceVar string) bool

Checks if a file info structure has an attribute in the specified @name_space.

func (*FileInfo) ListAttributes

func (x *FileInfo) ListAttributes(NameSpaceVar *string) []string

Lists the file info structure's attributes.

func (*FileInfo) RemoveAttribute

func (x *FileInfo) RemoveAttribute(AttributeVar string)

Removes all cases of @attribute from @info if it exists.

func (*FileInfo) SetAccessDateTime

func (x *FileInfo) SetAccessDateTime(AtimeVar *glib.DateTime)

Sets the %G_FILE_ATTRIBUTE_TIME_ACCESS and %G_FILE_ATTRIBUTE_TIME_ACCESS_USEC attributes in the file info to the given date/time value.

%G_FILE_ATTRIBUTE_TIME_ACCESS_NSEC will be cleared.

func (*FileInfo) SetAttribute

func (x *FileInfo) SetAttribute(AttributeVar string, TypeVar FileAttributeType, ValuePVar uintptr)

Sets the @attribute to contain the given value, if possible. To unset the attribute, use %G_FILE_ATTRIBUTE_TYPE_INVALID for @type.

func (*FileInfo) SetAttributeBoolean

func (x *FileInfo) SetAttributeBoolean(AttributeVar string, AttrValueVar bool)

Sets the @attribute to contain the given @attr_value, if possible.

func (*FileInfo) SetAttributeByteString

func (x *FileInfo) SetAttributeByteString(AttributeVar string, AttrValueVar string)

Sets the @attribute to contain the given @attr_value, if possible.

func (*FileInfo) SetAttributeFilePath

func (x *FileInfo) SetAttributeFilePath(AttributeVar string, AttrValueVar string)

Sets the @attribute to contain the given @attr_value, if possible.

This function is meant to be used by language bindings that have specific handling for Unix paths.

func (*FileInfo) SetAttributeInt32

func (x *FileInfo) SetAttributeInt32(AttributeVar string, AttrValueVar int32)

Sets the @attribute to contain the given @attr_value, if possible.

func (*FileInfo) SetAttributeInt64

func (x *FileInfo) SetAttributeInt64(AttributeVar string, AttrValueVar int64)

Sets the @attribute to contain the given @attr_value, if possible.

func (*FileInfo) SetAttributeMask

func (x *FileInfo) SetAttributeMask(MaskVar *FileAttributeMatcher)

Sets @mask on @info to match specific attribute types.

func (*FileInfo) SetAttributeObject

func (x *FileInfo) SetAttributeObject(AttributeVar string, AttrValueVar *gobject.Object)

Sets the @attribute to contain the given @attr_value, if possible.

func (*FileInfo) SetAttributeStatus

func (x *FileInfo) SetAttributeStatus(AttributeVar string, StatusVar FileAttributeStatus) bool

Sets the attribute status for an attribute key. This is only needed by external code that implement g_file_set_attributes_from_info() or similar functions.

The attribute must exist in @info for this to work. Otherwise %FALSE is returned and @info is unchanged.

func (*FileInfo) SetAttributeString

func (x *FileInfo) SetAttributeString(AttributeVar string, AttrValueVar string)

Sets the @attribute to contain the given @attr_value, if possible.

func (*FileInfo) SetAttributeStringv

func (x *FileInfo) SetAttributeStringv(AttributeVar string, AttrValueVar []string)

Sets the @attribute to contain the given @attr_value, if possible.

Sinze: 2.22

func (*FileInfo) SetAttributeUint32

func (x *FileInfo) SetAttributeUint32(AttributeVar string, AttrValueVar uint32)

Sets the @attribute to contain the given @attr_value, if possible.

func (*FileInfo) SetAttributeUint64

func (x *FileInfo) SetAttributeUint64(AttributeVar string, AttrValueVar uint64)

Sets the @attribute to contain the given @attr_value, if possible.

func (*FileInfo) SetContentType

func (x *FileInfo) SetContentType(ContentTypeVar string)

Sets the content type attribute for a given #GFileInfo. See %G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE.

func (*FileInfo) SetCreationDateTime

func (x *FileInfo) SetCreationDateTime(CreationTimeVar *glib.DateTime)

Sets the %G_FILE_ATTRIBUTE_TIME_CREATED and %G_FILE_ATTRIBUTE_TIME_CREATED_USEC attributes in the file info to the given date/time value.

%G_FILE_ATTRIBUTE_TIME_CREATED_NSEC will be cleared.

func (*FileInfo) SetDisplayName

func (x *FileInfo) SetDisplayName(DisplayNameVar string)

Sets the display name for the current #GFileInfo. See %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.

func (*FileInfo) SetEditName

func (x *FileInfo) SetEditName(EditNameVar string)

Sets the edit name for the current file. See %G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME.

func (*FileInfo) SetFileType

func (x *FileInfo) SetFileType(TypeVar FileType)

Sets the file type in a #GFileInfo to @type. See %G_FILE_ATTRIBUTE_STANDARD_TYPE.

func (*FileInfo) SetGoPointer

func (c *FileInfo) SetGoPointer(ptr uintptr)

func (*FileInfo) SetIcon

func (x *FileInfo) SetIcon(IconVar Icon)

Sets the icon for a given #GFileInfo. See %G_FILE_ATTRIBUTE_STANDARD_ICON.

func (*FileInfo) SetIsHidden

func (x *FileInfo) SetIsHidden(IsHiddenVar bool)

Sets the "is_hidden" attribute in a #GFileInfo according to @is_hidden. See %G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.

func (x *FileInfo) SetIsSymlink(IsSymlinkVar bool)

Sets the "is_symlink" attribute in a #GFileInfo according to @is_symlink. See %G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.

func (*FileInfo) SetModificationDateTime

func (x *FileInfo) SetModificationDateTime(MtimeVar *glib.DateTime)

Sets the %G_FILE_ATTRIBUTE_TIME_MODIFIED and %G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC attributes in the file info to the given date/time value.

%G_FILE_ATTRIBUTE_TIME_MODIFIED_NSEC will be cleared.

func (*FileInfo) SetModificationTime

func (x *FileInfo) SetModificationTime(MtimeVar *glib.TimeVal)

Sets the %G_FILE_ATTRIBUTE_TIME_MODIFIED and %G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC attributes in the file info to the given time value.

%G_FILE_ATTRIBUTE_TIME_MODIFIED_NSEC will be cleared.

func (*FileInfo) SetName

func (x *FileInfo) SetName(NameVar string)

Sets the name attribute for the current #GFileInfo. See %G_FILE_ATTRIBUTE_STANDARD_NAME.

func (*FileInfo) SetSize

func (x *FileInfo) SetSize(SizeVar int64)

Sets the %G_FILE_ATTRIBUTE_STANDARD_SIZE attribute in the file info to the given size.

func (*FileInfo) SetSortOrder

func (x *FileInfo) SetSortOrder(SortOrderVar int32)

Sets the sort order attribute in the file info structure. See %G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.

func (*FileInfo) SetSymbolicIcon

func (x *FileInfo) SetSymbolicIcon(IconVar Icon)

Sets the symbolic icon for a given #GFileInfo. See %G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON.

func (*FileInfo) SetSymlinkTarget

func (x *FileInfo) SetSymlinkTarget(SymlinkTargetVar string)

Sets the %G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET attribute in the file info to the given symlink target.

func (*FileInfo) UnsetAttributeMask

func (x *FileInfo) UnsetAttributeMask()

Unsets a mask set by g_file_info_set_attribute_mask(), if one is set.

type FileInfoClass

type FileInfoClass struct {
	// contains filtered or unexported fields
}

func (*FileInfoClass) GoPointer

func (x *FileInfoClass) GoPointer() uintptr

type FileInputStream

type FileInputStream struct {
	InputStream
}

`GFileInputStream` provides input streams that take their content from a file.

`GFileInputStream` implements [iface@Gio.Seekable], which allows the input stream to jump to arbitrary positions in the file, provided the filesystem of the file allows it. To find the position of a file input stream, use [method@Gio.Seekable.tell]. To find out if a file input stream supports seeking, use [vfunc@Gio.Seekable.can_seek]. To position a file input stream, use [vfunc@Gio.Seekable.seek].

func FileInputStreamNewFromInternalPtr

func FileInputStreamNewFromInternalPtr(ptr uintptr) *FileInputStream

func (*FileInputStream) CanSeek

func (x *FileInputStream) CanSeek() bool

Tests if the stream supports the #GSeekableIface.

func (*FileInputStream) CanTruncate

func (x *FileInputStream) CanTruncate() bool

Tests if the length of the stream can be adjusted with g_seekable_truncate().

func (*FileInputStream) GoPointer

func (c *FileInputStream) GoPointer() uintptr

func (*FileInputStream) QueryInfo

func (x *FileInputStream) QueryInfo(AttributesVar string, CancellableVar *Cancellable) (*FileInfo, error)

Queries a file input stream the given @attributes. This function blocks while querying the stream. For the asynchronous (non-blocking) version of this function, see g_file_input_stream_query_info_async(). While the stream is blocked, the stream will set the pending flag internally, and any other operations on the stream will fail with %G_IO_ERROR_PENDING.

func (*FileInputStream) QueryInfoAsync

func (x *FileInputStream) QueryInfoAsync(AttributesVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Queries the stream information asynchronously. When the operation is finished @callback will be called. You can then call g_file_input_stream_query_info_finish() to get the result of the operation.

For the synchronous version of this function, see g_file_input_stream_query_info().

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 set

func (*FileInputStream) QueryInfoFinish

func (x *FileInputStream) QueryInfoFinish(ResultVar AsyncResult) (*FileInfo, error)

Finishes an asynchronous info query operation.

func (*FileInputStream) Seek

func (x *FileInputStream) Seek(OffsetVar int64, TypeVar glib.SeekType, CancellableVar *Cancellable) (bool, error)

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.

func (*FileInputStream) SetGoPointer

func (c *FileInputStream) SetGoPointer(ptr uintptr)

func (*FileInputStream) Tell

func (x *FileInputStream) Tell() int64

Tells the current position within the stream.

func (*FileInputStream) Truncate

func (x *FileInputStream) Truncate(OffsetVar int64, CancellableVar *Cancellable) (bool, error)

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.

type FileInputStreamClass

type FileInputStreamClass struct {
	ParentClass InputStreamClass
	// contains filtered or unexported fields
}

func (*FileInputStreamClass) GetCanSeek

func (x *FileInputStreamClass) GetCanSeek() func(*FileInputStream) bool

GetCanSeek gets the "can_seek" callback function.

func (*FileInputStreamClass) GetGReserved1

func (x *FileInputStreamClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*FileInputStreamClass) GetGReserved2

func (x *FileInputStreamClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*FileInputStreamClass) GetGReserved3

func (x *FileInputStreamClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*FileInputStreamClass) GetGReserved4

func (x *FileInputStreamClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*FileInputStreamClass) GetGReserved5

func (x *FileInputStreamClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*FileInputStreamClass) GetQueryInfo

func (x *FileInputStreamClass) GetQueryInfo() func(*FileInputStream, string, *Cancellable) *FileInfo

GetQueryInfo gets the "query_info" callback function.

func (*FileInputStreamClass) GetQueryInfoAsync

GetQueryInfoAsync gets the "query_info_async" callback function.

func (*FileInputStreamClass) GetQueryInfoFinish

func (x *FileInputStreamClass) GetQueryInfoFinish() func(*FileInputStream, AsyncResult) *FileInfo

GetQueryInfoFinish gets the "query_info_finish" callback function.

func (*FileInputStreamClass) GetSeek

GetSeek gets the "seek" callback function.

func (*FileInputStreamClass) GetTell

func (x *FileInputStreamClass) GetTell() func(*FileInputStream) int64

GetTell gets the "tell" callback function.

func (*FileInputStreamClass) GoPointer

func (x *FileInputStreamClass) GoPointer() uintptr

func (*FileInputStreamClass) OverrideCanSeek

func (x *FileInputStreamClass) OverrideCanSeek(cb func(*FileInputStream) bool)

OverrideCanSeek sets the "can_seek" callback function.

func (*FileInputStreamClass) OverrideGReserved1

func (x *FileInputStreamClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*FileInputStreamClass) OverrideGReserved2

func (x *FileInputStreamClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*FileInputStreamClass) OverrideGReserved3

func (x *FileInputStreamClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*FileInputStreamClass) OverrideGReserved4

func (x *FileInputStreamClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*FileInputStreamClass) OverrideGReserved5

func (x *FileInputStreamClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

func (*FileInputStreamClass) OverrideQueryInfo

func (x *FileInputStreamClass) OverrideQueryInfo(cb func(*FileInputStream, string, *Cancellable) *FileInfo)

OverrideQueryInfo sets the "query_info" callback function.

func (*FileInputStreamClass) OverrideQueryInfoAsync

func (x *FileInputStreamClass) OverrideQueryInfoAsync(cb func(*FileInputStream, string, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideQueryInfoAsync sets the "query_info_async" callback function.

func (*FileInputStreamClass) OverrideQueryInfoFinish

func (x *FileInputStreamClass) OverrideQueryInfoFinish(cb func(*FileInputStream, AsyncResult) *FileInfo)

OverrideQueryInfoFinish sets the "query_info_finish" callback function.

func (*FileInputStreamClass) OverrideSeek

func (x *FileInputStreamClass) OverrideSeek(cb func(*FileInputStream, int64, glib.SeekType, *Cancellable) bool)

OverrideSeek sets the "seek" callback function.

func (*FileInputStreamClass) OverrideTell

func (x *FileInputStreamClass) OverrideTell(cb func(*FileInputStream) int64)

OverrideTell sets the "tell" callback function.

type FileInputStreamPrivate

type FileInputStreamPrivate struct {
	// contains filtered or unexported fields
}

func (*FileInputStreamPrivate) GoPointer

func (x *FileInputStreamPrivate) GoPointer() uintptr

type FileMeasureFlags

type FileMeasureFlags int

Flags that can be used with g_file_measure_disk_usage().

const (

	// No flags set.
	GFileMeasureNoneValue FileMeasureFlags = 0
	// Report any error encountered
	//   while traversing the directory tree.  Normally errors are only
	//   reported for the toplevel file.
	GFileMeasureReportAnyErrorValue FileMeasureFlags = 2
	// 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.
	GFileMeasureApparentSizeValue FileMeasureFlags = 4
	// Do not cross mount point boundaries.
	//   Compare with `du -x`.
	GFileMeasureNoXdevValue FileMeasureFlags = 8
)

type FileMeasureProgressCallback

type FileMeasureProgressCallback func(bool, uint64, uint64, uint64, uintptr)

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.

type FileMonitor

type FileMonitor struct {
	gobject.Object
}

Monitors a file or directory for changes.

To obtain a `GFileMonitor` for a file or directory, use [method@Gio.File.monitor], [method@Gio.File.monitor_file], or [method@Gio.File.monitor_directory].

To get informed about changes to the file or directory you are monitoring, connect to the [signal@Gio.FileMonitor::changed] signal. The signal will be emitted in the thread-default main context (see [method@GLib.MainContext.push_thread_default]) of the thread that the monitor was created in (though if the global default main context is blocked, this may cause notifications to be blocked even if the thread-default context is still running).

func FileMonitorNewFromInternalPtr

func FileMonitorNewFromInternalPtr(ptr uintptr) *FileMonitor

func (*FileMonitor) Cancel

func (x *FileMonitor) Cancel() bool

Cancels a file monitor.

func (*FileMonitor) ConnectChanged

func (x *FileMonitor) ConnectChanged(cb *func(FileMonitor, uintptr, uintptr, FileMonitorEvent)) uint

Emitted when @file has been changed.

If using %G_FILE_MONITOR_WATCH_MOVES on a directory monitor, and the information is available (and if supported by the backend), @event_type may be %G_FILE_MONITOR_EVENT_RENAMED, %G_FILE_MONITOR_EVENT_MOVED_IN or %G_FILE_MONITOR_EVENT_MOVED_OUT.

In all cases @file will be a child of the monitored directory. For renames, @file will be the old name and @other_file is the new name. For "moved in" events, @file is the name of the file that appeared and @other_file is the old name that it was moved from (in another directory). For "moved out" events, @file is the name of the file that used to be in this directory and @other_file is the name of the file at its new location.

It makes sense to treat %G_FILE_MONITOR_EVENT_MOVED_IN as equivalent to %G_FILE_MONITOR_EVENT_CREATED and %G_FILE_MONITOR_EVENT_MOVED_OUT as equivalent to %G_FILE_MONITOR_EVENT_DELETED, with extra information. %G_FILE_MONITOR_EVENT_RENAMED is equivalent to a delete/create pair. This is exactly how the events will be reported in the case that the %G_FILE_MONITOR_WATCH_MOVES flag is not in use.

If using the deprecated flag %G_FILE_MONITOR_SEND_MOVED flag and @event_type is %G_FILE_MONITOR_EVENT_MOVED, @file will be set to a #GFile containing the old path, and @other_file will be set to a #GFile containing the new path.

In all the other cases, @other_file will be set to #NULL.

func (*FileMonitor) EmitEvent

func (x *FileMonitor) EmitEvent(ChildVar File, OtherFileVar File, EventTypeVar FileMonitorEvent)

Emits the #GFileMonitor::changed signal if a change has taken place. Should be called from file monitor implementations only.

Implementations are responsible to call this method from the thread-default main context (see [method@GLib.MainContext.push_thread_default]) of the thread that the monitor was created in.

func (*FileMonitor) GetPropertyCancelled

func (x *FileMonitor) GetPropertyCancelled() bool

GetPropertyCancelled gets the "cancelled" property. Whether the monitor has been cancelled.

func (*FileMonitor) GetPropertyRateLimit

func (x *FileMonitor) GetPropertyRateLimit() int

GetPropertyRateLimit gets the "rate-limit" property. The limit of the monitor to watch for changes, in milliseconds.

func (*FileMonitor) GoPointer

func (c *FileMonitor) GoPointer() uintptr

func (*FileMonitor) IsCancelled

func (x *FileMonitor) IsCancelled() bool

Returns whether the monitor is canceled.

func (*FileMonitor) SetGoPointer

func (c *FileMonitor) SetGoPointer(ptr uintptr)

func (*FileMonitor) SetPropertyRateLimit

func (x *FileMonitor) SetPropertyRateLimit(value int)

SetPropertyRateLimit sets the "rate-limit" property. The limit of the monitor to watch for changes, in milliseconds.

func (*FileMonitor) SetRateLimit

func (x *FileMonitor) SetRateLimit(LimitMsecsVar int)

Sets the rate limit to which the @monitor will report consecutive change events to the same file.

type FileMonitorClass

type FileMonitorClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*FileMonitorClass) GetCancel

func (x *FileMonitorClass) GetCancel() func(*FileMonitor) bool

GetCancel gets the "cancel" callback function.

func (*FileMonitorClass) GetChanged

func (x *FileMonitorClass) GetChanged() func(*FileMonitor, File, File, FileMonitorEvent)

GetChanged gets the "changed" callback function.

func (*FileMonitorClass) GetGReserved1

func (x *FileMonitorClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*FileMonitorClass) GetGReserved2

func (x *FileMonitorClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*FileMonitorClass) GetGReserved3

func (x *FileMonitorClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*FileMonitorClass) GetGReserved4

func (x *FileMonitorClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*FileMonitorClass) GetGReserved5

func (x *FileMonitorClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*FileMonitorClass) GoPointer

func (x *FileMonitorClass) GoPointer() uintptr

func (*FileMonitorClass) OverrideCancel

func (x *FileMonitorClass) OverrideCancel(cb func(*FileMonitor) bool)

OverrideCancel sets the "cancel" callback function.

func (*FileMonitorClass) OverrideChanged

func (x *FileMonitorClass) OverrideChanged(cb func(*FileMonitor, File, File, FileMonitorEvent))

OverrideChanged sets the "changed" callback function.

func (*FileMonitorClass) OverrideGReserved1

func (x *FileMonitorClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*FileMonitorClass) OverrideGReserved2

func (x *FileMonitorClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*FileMonitorClass) OverrideGReserved3

func (x *FileMonitorClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*FileMonitorClass) OverrideGReserved4

func (x *FileMonitorClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*FileMonitorClass) OverrideGReserved5

func (x *FileMonitorClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

type FileMonitorEvent

type FileMonitorEvent int

Specifies what type of event a monitor event is.

const (

	// a file changed.
	GFileMonitorEventChangedValue FileMonitorEvent = 0
	// a hint that this was probably the last change in a set of changes.
	GFileMonitorEventChangesDoneHintValue FileMonitorEvent = 1
	// a file was deleted.
	GFileMonitorEventDeletedValue FileMonitorEvent = 2
	// a file was created.
	GFileMonitorEventCreatedValue FileMonitorEvent = 3
	// a file attribute was changed.
	GFileMonitorEventAttributeChangedValue FileMonitorEvent = 4
	// the file location will soon be unmounted.
	GFileMonitorEventPreUnmountValue FileMonitorEvent = 5
	// the file location was unmounted.
	GFileMonitorEventUnmountedValue FileMonitorEvent = 6
	// the file was moved -- only sent if the
	//   (deprecated) %G_FILE_MONITOR_SEND_MOVED flag is set
	GFileMonitorEventMovedValue FileMonitorEvent = 7
	// the file was renamed within the
	//   current directory -- only sent if the %G_FILE_MONITOR_WATCH_MOVES
	//   flag is set.  Since: 2.46.
	GFileMonitorEventRenamedValue FileMonitorEvent = 8
	// 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.
	GFileMonitorEventMovedInValue FileMonitorEvent = 9
	// 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
	GFileMonitorEventMovedOutValue FileMonitorEvent = 10
)

type FileMonitorFlags

type FileMonitorFlags int

Flags used to set what a #GFileMonitor will watch for.

const (

	// No flags set.
	GFileMonitorNoneValue FileMonitorFlags = 0
	// Watch for mount events.
	GFileMonitorWatchMountsValue FileMonitorFlags = 1
	// 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.
	GFileMonitorSendMovedValue FileMonitorFlags = 2
	// Watch for changes to the file made
	//   via another hard link. Since 2.36.
	GFileMonitorWatchHardLinksValue FileMonitorFlags = 4
	// 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.
	GFileMonitorWatchMovesValue FileMonitorFlags = 8
)

type FileMonitorPrivate

type FileMonitorPrivate struct {
	// contains filtered or unexported fields
}

func (*FileMonitorPrivate) GoPointer

func (x *FileMonitorPrivate) GoPointer() uintptr

type FileOutputStream

type FileOutputStream struct {
	OutputStream
}

`GFileOutputStream` provides output streams that write their content to a file.

`GFileOutputStream` implements [iface@Gio.Seekable], which allows the output stream to jump to arbitrary positions in the file and to truncate the file, provided the filesystem of the file supports these operations.

To find the position of a file output stream, use [method@Gio.Seekable.tell]. To find out if a file output stream supports seeking, use [method@Gio.Seekable.can_seek].To position a file output stream, use [method@Gio.Seekable.seek]. To find out if a file output stream supports truncating, use [method@Gio.Seekable.can_truncate]. To truncate a file output stream, use [method@Gio.Seekable.truncate].

func FileOutputStreamNewFromInternalPtr

func FileOutputStreamNewFromInternalPtr(ptr uintptr) *FileOutputStream

func (*FileOutputStream) CanSeek

func (x *FileOutputStream) CanSeek() bool

Tests if the stream supports the #GSeekableIface.

func (*FileOutputStream) CanTruncate

func (x *FileOutputStream) CanTruncate() bool

Tests if the length of the stream can be adjusted with g_seekable_truncate().

func (*FileOutputStream) GetEtag

func (x *FileOutputStream) GetEtag() string

Gets the entity tag for the file when it has been written. This must be called after the stream has been written and closed, as the etag can change while writing.

func (*FileOutputStream) GoPointer

func (c *FileOutputStream) GoPointer() uintptr

func (*FileOutputStream) QueryInfo

func (x *FileOutputStream) QueryInfo(AttributesVar string, CancellableVar *Cancellable) (*FileInfo, error)

Queries a file output stream for the given @attributes. This function blocks while querying the stream. For the asynchronous version of this function, see g_file_output_stream_query_info_async(). While the stream is blocked, the stream will set the pending flag internally, and any other operations on the stream will fail with %G_IO_ERROR_PENDING.

Can fail if the stream was already closed (with @error being set to %G_IO_ERROR_CLOSED), the stream has pending operations (with @error being set to %G_IO_ERROR_PENDING), or if querying info is not supported for the stream's interface (with @error being set to %G_IO_ERROR_NOT_SUPPORTED). In all cases of failure, %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 set, and %NULL will be returned.

func (*FileOutputStream) QueryInfoAsync

func (x *FileOutputStream) QueryInfoAsync(AttributesVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously queries the @stream for a #GFileInfo. When completed, @callback will be called with a #GAsyncResult which can be used to finish the operation with g_file_output_stream_query_info_finish().

For the synchronous version of this function, see g_file_output_stream_query_info().

func (*FileOutputStream) QueryInfoFinish

func (x *FileOutputStream) QueryInfoFinish(ResultVar AsyncResult) (*FileInfo, error)

Finalizes the asynchronous query started by g_file_output_stream_query_info_async().

func (*FileOutputStream) Seek

func (x *FileOutputStream) Seek(OffsetVar int64, TypeVar glib.SeekType, CancellableVar *Cancellable) (bool, error)

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.

func (*FileOutputStream) SetGoPointer

func (c *FileOutputStream) SetGoPointer(ptr uintptr)

func (*FileOutputStream) Tell

func (x *FileOutputStream) Tell() int64

Tells the current position within the stream.

func (*FileOutputStream) Truncate

func (x *FileOutputStream) Truncate(OffsetVar int64, CancellableVar *Cancellable) (bool, error)

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.

type FileOutputStreamClass

type FileOutputStreamClass struct {
	ParentClass OutputStreamClass
	// contains filtered or unexported fields
}

func (*FileOutputStreamClass) GetCanSeek

func (x *FileOutputStreamClass) GetCanSeek() func(*FileOutputStream) bool

GetCanSeek gets the "can_seek" callback function.

func (*FileOutputStreamClass) GetCanTruncate

func (x *FileOutputStreamClass) GetCanTruncate() func(*FileOutputStream) bool

GetCanTruncate gets the "can_truncate" callback function.

func (*FileOutputStreamClass) GetGReserved1

func (x *FileOutputStreamClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*FileOutputStreamClass) GetGReserved2

func (x *FileOutputStreamClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*FileOutputStreamClass) GetGReserved3

func (x *FileOutputStreamClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*FileOutputStreamClass) GetGReserved4

func (x *FileOutputStreamClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*FileOutputStreamClass) GetGReserved5

func (x *FileOutputStreamClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*FileOutputStreamClass) GetGetEtag

func (x *FileOutputStreamClass) GetGetEtag() func(*FileOutputStream) string

GetGetEtag gets the "get_etag" callback function.

func (*FileOutputStreamClass) GetQueryInfo

func (x *FileOutputStreamClass) GetQueryInfo() func(*FileOutputStream, string, *Cancellable) *FileInfo

GetQueryInfo gets the "query_info" callback function.

func (*FileOutputStreamClass) GetQueryInfoAsync

GetQueryInfoAsync gets the "query_info_async" callback function.

func (*FileOutputStreamClass) GetQueryInfoFinish

func (x *FileOutputStreamClass) GetQueryInfoFinish() func(*FileOutputStream, AsyncResult) *FileInfo

GetQueryInfoFinish gets the "query_info_finish" callback function.

func (*FileOutputStreamClass) GetSeek

GetSeek gets the "seek" callback function.

func (*FileOutputStreamClass) GetTell

func (x *FileOutputStreamClass) GetTell() func(*FileOutputStream) int64

GetTell gets the "tell" callback function.

func (*FileOutputStreamClass) GetTruncateFn

func (x *FileOutputStreamClass) GetTruncateFn() func(*FileOutputStream, int64, *Cancellable) bool

GetTruncateFn gets the "truncate_fn" callback function.

func (*FileOutputStreamClass) GoPointer

func (x *FileOutputStreamClass) GoPointer() uintptr

func (*FileOutputStreamClass) OverrideCanSeek

func (x *FileOutputStreamClass) OverrideCanSeek(cb func(*FileOutputStream) bool)

OverrideCanSeek sets the "can_seek" callback function.

func (*FileOutputStreamClass) OverrideCanTruncate

func (x *FileOutputStreamClass) OverrideCanTruncate(cb func(*FileOutputStream) bool)

OverrideCanTruncate sets the "can_truncate" callback function.

func (*FileOutputStreamClass) OverrideGReserved1

func (x *FileOutputStreamClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*FileOutputStreamClass) OverrideGReserved2

func (x *FileOutputStreamClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*FileOutputStreamClass) OverrideGReserved3

func (x *FileOutputStreamClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*FileOutputStreamClass) OverrideGReserved4

func (x *FileOutputStreamClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*FileOutputStreamClass) OverrideGReserved5

func (x *FileOutputStreamClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

func (*FileOutputStreamClass) OverrideGetEtag

func (x *FileOutputStreamClass) OverrideGetEtag(cb func(*FileOutputStream) string)

OverrideGetEtag sets the "get_etag" callback function.

func (*FileOutputStreamClass) OverrideQueryInfo

func (x *FileOutputStreamClass) OverrideQueryInfo(cb func(*FileOutputStream, string, *Cancellable) *FileInfo)

OverrideQueryInfo sets the "query_info" callback function.

func (*FileOutputStreamClass) OverrideQueryInfoAsync

func (x *FileOutputStreamClass) OverrideQueryInfoAsync(cb func(*FileOutputStream, string, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideQueryInfoAsync sets the "query_info_async" callback function.

func (*FileOutputStreamClass) OverrideQueryInfoFinish

func (x *FileOutputStreamClass) OverrideQueryInfoFinish(cb func(*FileOutputStream, AsyncResult) *FileInfo)

OverrideQueryInfoFinish sets the "query_info_finish" callback function.

func (*FileOutputStreamClass) OverrideSeek

func (x *FileOutputStreamClass) OverrideSeek(cb func(*FileOutputStream, int64, glib.SeekType, *Cancellable) bool)

OverrideSeek sets the "seek" callback function.

func (*FileOutputStreamClass) OverrideTell

func (x *FileOutputStreamClass) OverrideTell(cb func(*FileOutputStream) int64)

OverrideTell sets the "tell" callback function.

func (*FileOutputStreamClass) OverrideTruncateFn

func (x *FileOutputStreamClass) OverrideTruncateFn(cb func(*FileOutputStream, int64, *Cancellable) bool)

OverrideTruncateFn sets the "truncate_fn" callback function.

type FileOutputStreamPrivate

type FileOutputStreamPrivate struct {
	// contains filtered or unexported fields
}

func (*FileOutputStreamPrivate) GoPointer

func (x *FileOutputStreamPrivate) GoPointer() uintptr

type FileProgressCallback

type FileProgressCallback func(int64, int64, uintptr)

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.

type FileQueryInfoFlags

type FileQueryInfoFlags int

Flags used when querying a #GFileInfo.

const (

	// No flags set.
	GFileQueryInfoNoneValue FileQueryInfoFlags = 0
	// Don't follow symlinks.
	GFileQueryInfoNofollowSymlinksValue FileQueryInfoFlags = 1
)

type FileReadMoreCallback

type FileReadMoreCallback func(string, int64, uintptr) bool

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.

type FileType

type FileType int

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.

const (

	// File's type is unknown.
	GFileTypeUnknownValue FileType = 0
	// File handle represents a regular file.
	GFileTypeRegularValue FileType = 1
	// File handle represents a directory.
	GFileTypeDirectoryValue FileType = 2
	// File handle represents a symbolic link
	//    (Unix systems).
	GFileTypeSymbolicLinkValue FileType = 3
	// File is a "special" file, such as a socket, fifo,
	//    block device, or character device.
	GFileTypeSpecialValue FileType = 4
	// File is a shortcut (Windows systems).
	GFileTypeShortcutValue FileType = 5
	// File is a mountable location.
	GFileTypeMountableValue FileType = 6
)

type FilenameCompleter

type FilenameCompleter struct {
	gobject.Object
}

Completes partial file and directory names given a partial string by looking in the file system for clues. Can return a list of possible completion strings for widget implementations.

func FilenameCompleterNewFromInternalPtr

func FilenameCompleterNewFromInternalPtr(ptr uintptr) *FilenameCompleter

func NewFilenameCompleter

func NewFilenameCompleter() *FilenameCompleter

Creates a new filename completer.

func (*FilenameCompleter) ConnectGotCompletionData

func (x *FilenameCompleter) ConnectGotCompletionData(cb *func(FilenameCompleter)) uint

Emitted when the file name completion information comes available.

func (*FilenameCompleter) GetCompletionSuffix

func (x *FilenameCompleter) GetCompletionSuffix(InitialTextVar string) string

Obtains a suffix completion for @initial_text from @completer.

Suffix will be an empty string if there's no shared suffix among matching completions. If there's no matching completions anyway, `NULL` is returned.

func (*FilenameCompleter) GetCompletions

func (x *FilenameCompleter) GetCompletions(InitialTextVar string) []string

Gets an array of completion strings for a given initial text.

func (*FilenameCompleter) GoPointer

func (c *FilenameCompleter) GoPointer() uintptr

func (*FilenameCompleter) SetDirsOnly

func (x *FilenameCompleter) SetDirsOnly(DirsOnlyVar bool)

If @dirs_only is %TRUE, @completer will only complete directory names, and not file names.

This function needs to be called before waiting for results from the completer to be populated.

func (*FilenameCompleter) SetGoPointer

func (c *FilenameCompleter) SetGoPointer(ptr uintptr)

type FilenameCompleterClass

type FilenameCompleterClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*FilenameCompleterClass) GetGReserved1

func (x *FilenameCompleterClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*FilenameCompleterClass) GetGReserved2

func (x *FilenameCompleterClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*FilenameCompleterClass) GetGReserved3

func (x *FilenameCompleterClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*FilenameCompleterClass) GetGotCompletionData

func (x *FilenameCompleterClass) GetGotCompletionData() func(*FilenameCompleter)

GetGotCompletionData gets the "got_completion_data" callback function.

func (*FilenameCompleterClass) GoPointer

func (x *FilenameCompleterClass) GoPointer() uintptr

func (*FilenameCompleterClass) OverrideGReserved1

func (x *FilenameCompleterClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*FilenameCompleterClass) OverrideGReserved2

func (x *FilenameCompleterClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*FilenameCompleterClass) OverrideGReserved3

func (x *FilenameCompleterClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*FilenameCompleterClass) OverrideGotCompletionData

func (x *FilenameCompleterClass) OverrideGotCompletionData(cb func(*FilenameCompleter))

OverrideGotCompletionData sets the "got_completion_data" callback function.

type FilesystemPreviewType

type FilesystemPreviewType int

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.

const (

	// Only preview files if user has explicitly requested it.
	GFilesystemPreviewTypeIfAlwaysValue FilesystemPreviewType = 0
	// Preview files if user has requested preview of "local" files.
	GFilesystemPreviewTypeIfLocalValue FilesystemPreviewType = 1
	// Never preview files.
	GFilesystemPreviewTypeNeverValue FilesystemPreviewType = 2
)

type FilterInputStream

type FilterInputStream struct {
	InputStream
}

Base class for input stream implementations that perform some kind of filtering operation on a base stream. Typical examples of filtering operations are character set conversion, compression and byte order flipping.

func FilterInputStreamNewFromInternalPtr

func FilterInputStreamNewFromInternalPtr(ptr uintptr) *FilterInputStream

func (*FilterInputStream) GetBaseStream

func (x *FilterInputStream) GetBaseStream() *InputStream

Gets the base stream for the filter stream.

func (*FilterInputStream) GetCloseBaseStream

func (x *FilterInputStream) GetCloseBaseStream() bool

Returns whether the base stream will be closed when @stream is closed.

func (*FilterInputStream) GetPropertyCloseBaseStream

func (x *FilterInputStream) GetPropertyCloseBaseStream() bool

GetPropertyCloseBaseStream gets the "close-base-stream" property. Whether the base stream should be closed when the filter stream is closed.

func (*FilterInputStream) GoPointer

func (c *FilterInputStream) GoPointer() uintptr

func (*FilterInputStream) SetCloseBaseStream

func (x *FilterInputStream) SetCloseBaseStream(CloseBaseVar bool)

Sets whether the base stream will be closed when @stream is closed.

func (*FilterInputStream) SetGoPointer

func (c *FilterInputStream) SetGoPointer(ptr uintptr)

func (*FilterInputStream) SetPropertyCloseBaseStream

func (x *FilterInputStream) SetPropertyCloseBaseStream(value bool)

SetPropertyCloseBaseStream sets the "close-base-stream" property. Whether the base stream should be closed when the filter stream is closed.

type FilterInputStreamClass

type FilterInputStreamClass struct {
	ParentClass InputStreamClass
	// contains filtered or unexported fields
}

func (*FilterInputStreamClass) GetGReserved1

func (x *FilterInputStreamClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*FilterInputStreamClass) GetGReserved2

func (x *FilterInputStreamClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*FilterInputStreamClass) GetGReserved3

func (x *FilterInputStreamClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*FilterInputStreamClass) GoPointer

func (x *FilterInputStreamClass) GoPointer() uintptr

func (*FilterInputStreamClass) OverrideGReserved1

func (x *FilterInputStreamClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*FilterInputStreamClass) OverrideGReserved2

func (x *FilterInputStreamClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*FilterInputStreamClass) OverrideGReserved3

func (x *FilterInputStreamClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

type FilterOutputStream

type FilterOutputStream struct {
	OutputStream
}

Base class for output stream implementations that perform some kind of filtering operation on a base stream. Typical examples of filtering operations are character set conversion, compression and byte order flipping.

func FilterOutputStreamNewFromInternalPtr

func FilterOutputStreamNewFromInternalPtr(ptr uintptr) *FilterOutputStream

func (*FilterOutputStream) GetBaseStream

func (x *FilterOutputStream) GetBaseStream() *OutputStream

Gets the base stream for the filter stream.

func (*FilterOutputStream) GetCloseBaseStream

func (x *FilterOutputStream) GetCloseBaseStream() bool

Returns whether the base stream will be closed when @stream is closed.

func (*FilterOutputStream) GetPropertyCloseBaseStream

func (x *FilterOutputStream) GetPropertyCloseBaseStream() bool

GetPropertyCloseBaseStream gets the "close-base-stream" property. Whether the base stream should be closed when the filter stream is closed.

func (*FilterOutputStream) GoPointer

func (c *FilterOutputStream) GoPointer() uintptr

func (*FilterOutputStream) SetCloseBaseStream

func (x *FilterOutputStream) SetCloseBaseStream(CloseBaseVar bool)

Sets whether the base stream will be closed when @stream is closed.

func (*FilterOutputStream) SetGoPointer

func (c *FilterOutputStream) SetGoPointer(ptr uintptr)

func (*FilterOutputStream) SetPropertyCloseBaseStream

func (x *FilterOutputStream) SetPropertyCloseBaseStream(value bool)

SetPropertyCloseBaseStream sets the "close-base-stream" property. Whether the base stream should be closed when the filter stream is closed.

type FilterOutputStreamClass

type FilterOutputStreamClass struct {
	ParentClass OutputStreamClass
	// contains filtered or unexported fields
}

func (*FilterOutputStreamClass) GetGReserved1

func (x *FilterOutputStreamClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*FilterOutputStreamClass) GetGReserved2

func (x *FilterOutputStreamClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*FilterOutputStreamClass) GetGReserved3

func (x *FilterOutputStreamClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*FilterOutputStreamClass) GoPointer

func (x *FilterOutputStreamClass) GoPointer() uintptr

func (*FilterOutputStreamClass) OverrideGReserved1

func (x *FilterOutputStreamClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*FilterOutputStreamClass) OverrideGReserved2

func (x *FilterOutputStreamClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*FilterOutputStreamClass) OverrideGReserved3

func (x *FilterOutputStreamClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

type IOErrorEnum

type IOErrorEnum int

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 |[<!-- language="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.

const (

	// Generic error condition for when an operation fails
	//     and no more specific #GIOErrorEnum value is defined.
	GIoErrorFailedValue IOErrorEnum = 0
	// File not found.
	GIoErrorNotFoundValue IOErrorEnum = 1
	// File already exists.
	GIoErrorExistsValue IOErrorEnum = 2
	// File is a directory.
	GIoErrorIsDirectoryValue IOErrorEnum = 3
	// File is not a directory.
	GIoErrorNotDirectoryValue IOErrorEnum = 4
	// File is a directory that isn't empty.
	GIoErrorNotEmptyValue IOErrorEnum = 5
	// File is not a regular file.
	GIoErrorNotRegularFileValue IOErrorEnum = 6
	// File is not a symbolic link.
	GIoErrorNotSymbolicLinkValue IOErrorEnum = 7
	// File cannot be mounted.
	GIoErrorNotMountableFileValue IOErrorEnum = 8
	// Filename is too many characters.
	GIoErrorFilenameTooLongValue IOErrorEnum = 9
	// Filename is invalid or contains invalid characters.
	GIoErrorInvalidFilenameValue IOErrorEnum = 10
	// File contains too many symbolic links.
	GIoErrorTooManyLinksValue IOErrorEnum = 11
	// No space left on drive.
	GIoErrorNoSpaceValue IOErrorEnum = 12
	// Invalid argument.
	GIoErrorInvalidArgumentValue IOErrorEnum = 13
	// Permission denied.
	GIoErrorPermissionDeniedValue IOErrorEnum = 14
	// Operation (or one of its parameters) not supported
	GIoErrorNotSupportedValue IOErrorEnum = 15
	// File isn't mounted.
	GIoErrorNotMountedValue IOErrorEnum = 16
	// File is already mounted.
	GIoErrorAlreadyMountedValue IOErrorEnum = 17
	// File was closed.
	GIoErrorClosedValue IOErrorEnum = 18
	// Operation was cancelled. See #GCancellable.
	GIoErrorCancelledValue IOErrorEnum = 19
	// Operations are still pending.
	GIoErrorPendingValue IOErrorEnum = 20
	// File is read only.
	GIoErrorReadOnlyValue IOErrorEnum = 21
	// Backup couldn't be created.
	GIoErrorCantCreateBackupValue IOErrorEnum = 22
	// File's Entity Tag was incorrect.
	GIoErrorWrongEtagValue IOErrorEnum = 23
	// Operation timed out.
	GIoErrorTimedOutValue IOErrorEnum = 24
	// Operation would be recursive.
	GIoErrorWouldRecurseValue IOErrorEnum = 25
	// File is busy.
	GIoErrorBusyValue IOErrorEnum = 26
	// Operation would block.
	GIoErrorWouldBlockValue IOErrorEnum = 27
	// Host couldn't be found (remote operations).
	GIoErrorHostNotFoundValue IOErrorEnum = 28
	// Operation would merge files.
	GIoErrorWouldMergeValue IOErrorEnum = 29
	// Operation failed and a helper program has
	//     already interacted with the user. Do not display any error dialog.
	GIoErrorFailedHandledValue IOErrorEnum = 30
	// The current process has too many files
	//     open and can't open any more. Duplicate descriptors do count toward
	//     this limit. Since 2.20
	GIoErrorTooManyOpenFilesValue IOErrorEnum = 31
	// The object has not been initialized. Since 2.22
	GIoErrorNotInitializedValue IOErrorEnum = 32
	// The requested address is already in use. Since 2.22
	GIoErrorAddressInUseValue IOErrorEnum = 33
	// Need more input to finish operation. Since 2.24
	GIoErrorPartialInputValue IOErrorEnum = 34
	// The input data was invalid. Since 2.24
	GIoErrorInvalidDataValue IOErrorEnum = 35
	// 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.
	GIoErrorDbusErrorValue IOErrorEnum = 36
	// Host unreachable. Since 2.26
	GIoErrorHostUnreachableValue IOErrorEnum = 37
	// Network unreachable. Since 2.26
	GIoErrorNetworkUnreachableValue IOErrorEnum = 38
	// Connection refused. Since 2.26
	GIoErrorConnectionRefusedValue IOErrorEnum = 39
	// Connection to proxy server failed. Since 2.26
	GIoErrorProxyFailedValue IOErrorEnum = 40
	// Proxy authentication failed. Since 2.26
	GIoErrorProxyAuthFailedValue IOErrorEnum = 41
	// Proxy server needs authentication. Since 2.26
	GIoErrorProxyNeedAuthValue IOErrorEnum = 42
	// Proxy connection is not allowed by ruleset.
	//     Since 2.26
	GIoErrorProxyNotAllowedValue IOErrorEnum = 43
	// Broken pipe. Since 2.36
	GIoErrorBrokenPipeValue IOErrorEnum = 44
	// 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.
	GIoErrorConnectionClosedValue IOErrorEnum = 44
	// Transport endpoint is not connected. Since 2.44
	GIoErrorNotConnectedValue IOErrorEnum = 45
	// Message too large. Since 2.48.
	GIoErrorMessageTooLargeValue IOErrorEnum = 46
	// No such device found. Since 2.74
	GIoErrorNoSuchDeviceValue IOErrorEnum = 47
	// Destination address unset. Since 2.80
	GIoErrorDestinationUnsetValue IOErrorEnum = 48
)

func IoErrorFromErrno

func IoErrorFromErrno(ErrNoVar int) IOErrorEnum

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 immediately after the call returns, and use the saved value instead of `errno`:

|[<!-- language="C" -->

int saved_errno;

ret = read (blah);
saved_errno = errno;

g_io_error_from_errno (saved_errno);

]|

func IoErrorFromFileError

func IoErrorFromFileError(FileErrorVar glib.FileError) IOErrorEnum

Converts #GFileError error codes into GIO error codes.

type IOExtension

type IOExtension struct {
	// contains filtered or unexported fields
}

#GIOExtension is an opaque data structure and can only be accessed using the following functions.

func IoExtensionPointImplement

func IoExtensionPointImplement(ExtensionPointNameVar string, TypeVar types.GType, ExtensionNameVar string, PriorityVar int) *IOExtension

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.

func (*IOExtension) GetName

func (x *IOExtension) GetName() string

Gets the name under which @extension was registered.

Note that the same type may be registered as extension for multiple extension points, under different names.

func (*IOExtension) GetPriority

func (x *IOExtension) GetPriority() int

Gets the priority with which @extension was registered.

func (*IOExtension) GetType

func (x *IOExtension) GetType() types.GType

Gets the type associated with @extension.

func (*IOExtension) GoPointer

func (x *IOExtension) GoPointer() uintptr

func (*IOExtension) RefClass

func (x *IOExtension) RefClass() *gobject.TypeClass

Gets a reference to the class for the type that is associated with @extension.

type IOExtensionPoint

type IOExtensionPoint struct {
	// contains filtered or unexported fields
}

`GIOExtensionPoint` provides a mechanism for modules to extend the functionality of the library or application that loaded it in an organized fashion.

An extension point is identified by a name, and it may optionally require that any implementation must be of a certain type (or derived thereof). Use [func@Gio.IOExtensionPoint.register] to register an extension point, and [method@Gio.IOExtensionPoint.set_required_type] to set a required type.

A module can implement an extension point by specifying the [type@GObject.Type] that implements the functionality. Additionally, each implementation of an extension point has a name, and a priority. Use [func@Gio.IOExtensionPoint.implement] to implement an extension point.

```c GIOExtensionPoint *ep;

// Register an extension point ep = g_io_extension_point_register ("my-extension-point"); g_io_extension_point_set_required_type (ep, MY_TYPE_EXAMPLE); ```

```c // Implement an extension point G_DEFINE_TYPE (MyExampleImpl, my_example_impl, MY_TYPE_EXAMPLE) g_io_extension_point_implement ("my-extension-point",

my_example_impl_get_type (),
"my-example",
10);

```

It is up to the code that registered the extension point how
it uses the implementations that have been associated with it.
Depending on the use case, it may use all implementations, or
only the one with the highest priority, or pick a specific
one by name.

To avoid opening all modules just to find out what extension
points they implement, GIO makes use of a caching mechanism,
see [gio-querymodules](gio-querymodules.html).
You are expected to run this command after installing a
GIO module.

The `GIO_EXTRA_MODULES` environment variable can be used to
specify additional directories to automatically load modules
from. This environment variable has the same syntax as the
`PATH`. If two modules have the same base name in different
directories, then the latter one will be ignored. If additional
directories are specified GIO will load modules from the built-in
directory last.

func IoExtensionPointLookup

func IoExtensionPointLookup(NameVar string) *IOExtensionPoint

Looks up an existing extension point.

func IoExtensionPointRegister

func IoExtensionPointRegister(NameVar string) *IOExtensionPoint

Registers an extension point.

func (*IOExtensionPoint) GetExtensionByName

func (x *IOExtensionPoint) GetExtensionByName(NameVar string) *IOExtension

Finds a #GIOExtension for an extension point by name.

func (*IOExtensionPoint) GetExtensions

func (x *IOExtensionPoint) GetExtensions() *glib.List

Gets a list of all extensions that implement this extension point. The list is sorted by priority, beginning with the highest priority.

func (*IOExtensionPoint) GetRequiredType

func (x *IOExtensionPoint) GetRequiredType() types.GType

Gets the required type for @extension_point.

func (*IOExtensionPoint) GoPointer

func (x *IOExtensionPoint) GoPointer() uintptr

func (*IOExtensionPoint) SetRequiredType

func (x *IOExtensionPoint) SetRequiredType(TypeVar types.GType)

Sets the required type for @extension_point to @type. All implementations must henceforth have this type.

type IOModule

type IOModule struct {
	gobject.TypeModule
}

Provides an interface and default functions for loading and unloading modules. This is used internally to make GIO extensible, but can also be used by others to implement module loading.

func IOModuleNewFromInternalPtr

func IOModuleNewFromInternalPtr(ptr uintptr) *IOModule

func NewIOModule

func NewIOModule(FilenameVar string) *IOModule

Creates a new GIOModule that will load the specific shared library when in use.

func (*IOModule) CompleteInterfaceInfo

func (x *IOModule) CompleteInterfaceInfo(InstanceTypeVar types.GType, InterfaceTypeVar types.GType, InfoVar *gobject.InterfaceInfo)

Calls the @complete_interface_info function from the #GTypePluginClass of @plugin. There should be no need to use this function outside of the GObject type system itself.

func (*IOModule) CompleteTypeInfo

func (x *IOModule) CompleteTypeInfo(GTypeVar types.GType, InfoVar *gobject.TypeInfo, ValueTableVar *gobject.TypeValueTable)

Calls the @complete_type_info function from the #GTypePluginClass of @plugin. There should be no need to use this function outside of the GObject type system itself.

func (*IOModule) GoPointer

func (c *IOModule) GoPointer() uintptr

func (*IOModule) Load

func (x *IOModule) Load()

Required API for GIO modules to implement.

This function is run after the module has been loaded into GIO, to initialize the module. Typically, this function will call g_io_extension_point_implement().

Since 2.56, this function should be named `g_io_<modulename>_load`, where `modulename` is the plugin’s filename with the `lib` or `libgio` prefix and everything after the first dot removed, and with `-` replaced with `_` throughout. For example, `libgiognutls-helper.so` becomes `gnutls_helper`. Using the new symbol names avoids name clashes when building modules statically. The old symbol names continue to be supported, but cannot be used for static builds.

func (*IOModule) SetGoPointer

func (c *IOModule) SetGoPointer(ptr uintptr)

func (*IOModule) Unload

func (x *IOModule) Unload()

Required API for GIO modules to implement.

This function is run when the module is being unloaded from GIO, to finalize the module.

Since 2.56, this function should be named `g_io_<modulename>_unload`, where `modulename` is the plugin’s filename with the `lib` or `libgio` prefix and everything after the first dot removed, and with `-` replaced with `_` throughout. For example, `libgiognutls-helper.so` becomes `gnutls_helper`. Using the new symbol names avoids name clashes when building modules statically. The old symbol names continue to be supported, but cannot be used for static builds.

func (*IOModule) Unuse

func (x *IOModule) Unuse()

Calls the @unuse_plugin function from the #GTypePluginClass of @plugin. There should be no need to use this function outside of the GObject type system itself.

func (*IOModule) Use

func (x *IOModule) Use()

Calls the @use_plugin function from the #GTypePluginClass of @plugin. There should be no need to use this function outside of the GObject type system itself.

type IOModuleClass

type IOModuleClass struct {
	// contains filtered or unexported fields
}

func (*IOModuleClass) GoPointer

func (x *IOModuleClass) GoPointer() uintptr

type IOModuleScope

type IOModuleScope struct {
	// contains filtered or unexported fields
}

Represents a scope for loading IO modules. A scope can be used for blocking duplicate modules, or blocking a module you don't want to load.

The scope can be used with g_io_modules_load_all_in_directory_with_scope() or g_io_modules_scan_all_in_directory_with_scope().

func (*IOModuleScope) Block

func (x *IOModuleScope) Block(BasenameVar string)

Block modules with the given @basename from being loaded when this scope is used with g_io_modules_scan_all_in_directory_with_scope() or g_io_modules_load_all_in_directory_with_scope().

func (*IOModuleScope) Free

func (x *IOModuleScope) Free()

Free a module scope.

func (*IOModuleScope) GoPointer

func (x *IOModuleScope) GoPointer() uintptr

type IOModuleScopeFlags

type IOModuleScopeFlags int

Flags for use with g_io_module_scope_new().

const (

	// No module scan flags
	GIoModuleScopeNoneValue IOModuleScopeFlags = 0
	// When using this scope to load or
	//     scan modules, automatically block a modules which has the same base
	//     basename as previously loaded module.
	GIoModuleScopeBlockDuplicatesValue IOModuleScopeFlags = 1
)

type IOSchedulerJob

type IOSchedulerJob struct {
	// contains filtered or unexported fields
}

Opaque class for defining and scheduling IO jobs.

func (*IOSchedulerJob) GoPointer

func (x *IOSchedulerJob) GoPointer() uintptr

func (*IOSchedulerJob) SendToMainloop

func (x *IOSchedulerJob) SendToMainloop(FuncVar *glib.SourceFunc, UserDataVar uintptr, NotifyVar *glib.DestroyNotify) bool

Used from an I/O job to send a callback to be run in the thread that the job was started from, waiting for the result (and thus blocking the I/O job).

func (*IOSchedulerJob) SendToMainloopAsync

func (x *IOSchedulerJob) SendToMainloopAsync(FuncVar *glib.SourceFunc, UserDataVar uintptr, NotifyVar *glib.DestroyNotify)

Used from an I/O job to send a callback to be run asynchronously in the thread that the job was started from. The callback will be run when the main loop is available, but at that time the I/O job might have finished. The return value from the callback is ignored.

Note that if you are passing the @user_data from g_io_scheduler_push_job() on to this function you have to ensure that it is not freed before @func is called, either by passing %NULL as @notify to g_io_scheduler_push_job() or by using refcounting for @user_data.

type IOSchedulerJobFunc

type IOSchedulerJobFunc func(*IOSchedulerJob, uintptr, uintptr) bool

I/O Job function.

Long-running jobs should periodically check the @cancellable to see if they have been cancelled.

type IOStream

type IOStream struct {
	gobject.Object
}

`GIOStream` represents an object that has both read and write streams. Generally the two streams act as separate input and output streams, but they share some common resources and state. For instance, for seekable streams, both streams may use the same position.

Examples of `GIOStream` objects are [class@Gio.SocketConnection], which represents a two-way network connection; and [class@Gio.FileIOStream], which represents a file handle opened in read-write mode.

To do the actual reading and writing you need to get the substreams with [method@Gio.IOStream.get_input_stream] and [method@Gio.IOStream.get_output_stream].

The `GIOStream` object owns the input and the output streams, not the other way around, so keeping the substreams alive will not keep the `GIOStream` object alive. If the `GIOStream` object is freed it will be closed, thus closing the substreams, so even if the substreams stay alive they will always return `G_IO_ERROR_CLOSED` for all operations.

To close a stream use [method@Gio.IOStream.close] which will close the common stream object and also the individual substreams. You can also close the substreams themselves. In most cases this only marks the substream as closed, so further I/O on it fails but common state in the `GIOStream` may still be open. However, some streams may support ‘half-closed’ states where one direction of the stream is actually shut down.

Operations on `GIOStream`s cannot be started while another operation on the `GIOStream` or its substreams is in progress. Specifically, an application can read from the [class@Gio.InputStream] and write to the [class@Gio.OutputStream] simultaneously (either in separate threads, or as asynchronous operations in the same thread), but an application cannot start any `GIOStream` operation while there is a `GIOStream`, `GInputStream` or `GOutputStream` operation in progress, and an application can’t start any `GInputStream` or `GOutputStream` operation while there is a `GIOStream` operation in progress.

This is a product of individual stream operations being associated with a given [type@GLib.MainContext] (the thread-default context at the time the operation was started), rather than entire streams being associated with a single `GMainContext`.

GIO may run operations on `GIOStream`s from other (worker) threads, and this may be exposed to application code in the behaviour of wrapper streams, such as [class@Gio.BufferedInputStream] or [class@Gio.TlsConnection]. With such wrapper APIs, application code may only run operations on the base (wrapped) stream when the wrapper stream is idle. Note that the semantics of such operations may not be well-defined due to the state the wrapper stream leaves the base stream in (though they are guaranteed not to crash).

func DbusAddressGetStreamFinish

func DbusAddressGetStreamFinish(ResVar AsyncResult, OutGuidVar *string) (*IOStream, error)

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.

func DbusAddressGetStreamSync

func DbusAddressGetStreamSync(AddressVar string, OutGuidVar *string, CancellableVar *Cancellable) (*IOStream, error)

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.

func IOStreamNewFromInternalPtr

func IOStreamNewFromInternalPtr(ptr uintptr) *IOStream

func (*IOStream) ClearPending

func (x *IOStream) ClearPending()

Clears the pending flag on @stream.

func (*IOStream) Close

func (x *IOStream) Close(CancellableVar *Cancellable) (bool, error)

Closes the stream, releasing resources related to it. This will also close the individual input and output streams, if they are not already closed.

Once the stream is closed, all other operations will return %G_IO_ERROR_CLOSED. Closing a stream multiple times will not return an error.

Closing a stream will automatically flush any outstanding buffers in the stream.

Streams 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.

Some streams might keep the backing store of the stream (e.g. a file descriptor) open after the stream is closed. See the documentation for the individual stream for details.

On failure the first error that happened will be reported, but the close operation will finish as much as possible. A stream that failed to close will still return %G_IO_ERROR_CLOSED for all operations. Still, it is important to check and report the error to the user, otherwise there might be a loss of data as all data might not be written.

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. Cancelling a close will still leave the stream closed, but some streams can use a faster close that doesn't block to e.g. check errors.

The default implementation of this method just calls close on the individual input/output streams.

func (*IOStream) CloseAsync

func (x *IOStream) CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Requests an asynchronous close of the stream, releasing resources related to it. When the operation is finished @callback will be called. You can then call g_io_stream_close_finish() to get the result of the operation.

For behaviour details see g_io_stream_close().

The asynchronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all.

func (*IOStream) CloseFinish

func (x *IOStream) CloseFinish(ResultVar AsyncResult) (bool, error)

Closes a stream.

func (*IOStream) GetInputStream

func (x *IOStream) GetInputStream() *InputStream

Gets the input stream for this object. This is used for reading.

func (*IOStream) GetOutputStream

func (x *IOStream) GetOutputStream() *OutputStream

Gets the output stream for this object. This is used for writing.

func (*IOStream) GetPropertyClosed

func (x *IOStream) GetPropertyClosed() bool

GetPropertyClosed gets the "closed" property. Whether the stream is closed.

func (*IOStream) GoPointer

func (c *IOStream) GoPointer() uintptr

func (*IOStream) HasPending

func (x *IOStream) HasPending() bool

Checks if a stream has pending actions.

func (*IOStream) IsClosed

func (x *IOStream) IsClosed() bool

Checks if a stream is closed.

func (*IOStream) SetGoPointer

func (c *IOStream) SetGoPointer(ptr uintptr)

func (*IOStream) SetPending

func (x *IOStream) SetPending() (bool, error)

Sets @stream to have actions pending. If the pending flag is already set or @stream is closed, it will return %FALSE and set @error.

func (*IOStream) SpliceAsync

func (x *IOStream) SpliceAsync(Stream2Var *IOStream, FlagsVar IOStreamSpliceFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously splice the output stream of @stream1 to the input stream of @stream2, and splice the output stream of @stream2 to the input stream of @stream1.

When the operation is finished @callback will be called. You can then call g_io_stream_splice_finish() to get the result of the operation.

type IOStreamAdapter

type IOStreamAdapter struct {
	// contains filtered or unexported fields
}

func (*IOStreamAdapter) GoPointer

func (x *IOStreamAdapter) GoPointer() uintptr

type IOStreamClass

type IOStreamClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*IOStreamClass) GetCloseAsync

func (x *IOStreamClass) GetCloseAsync() func(*IOStream, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetCloseAsync gets the "close_async" callback function.

func (*IOStreamClass) GetCloseFinish

func (x *IOStreamClass) GetCloseFinish() func(*IOStream, AsyncResult) bool

GetCloseFinish gets the "close_finish" callback function.

func (*IOStreamClass) GetCloseFn

func (x *IOStreamClass) GetCloseFn() func(*IOStream, *Cancellable) bool

GetCloseFn gets the "close_fn" callback function.

func (*IOStreamClass) GetGReserved1

func (x *IOStreamClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*IOStreamClass) GetGReserved2

func (x *IOStreamClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*IOStreamClass) GetGReserved3

func (x *IOStreamClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*IOStreamClass) GetGReserved4

func (x *IOStreamClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*IOStreamClass) GetGReserved5

func (x *IOStreamClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*IOStreamClass) GetGReserved6

func (x *IOStreamClass) GetGReserved6() func()

GetGReserved6 gets the "_g_reserved6" callback function.

func (*IOStreamClass) GetGReserved7

func (x *IOStreamClass) GetGReserved7() func()

GetGReserved7 gets the "_g_reserved7" callback function.

func (*IOStreamClass) GetGReserved8

func (x *IOStreamClass) GetGReserved8() func()

GetGReserved8 gets the "_g_reserved8" callback function.

func (*IOStreamClass) GetGReserved9

func (x *IOStreamClass) GetGReserved9() func()

GetGReserved9 gets the "_g_reserved9" callback function.

func (*IOStreamClass) GetGReserved10

func (x *IOStreamClass) GetGReserved10() func()

GetGReserved10 gets the "_g_reserved10" callback function.

func (*IOStreamClass) GetGetInputStream

func (x *IOStreamClass) GetGetInputStream() func(*IOStream) *InputStream

GetGetInputStream gets the "get_input_stream" callback function.

func (*IOStreamClass) GetGetOutputStream

func (x *IOStreamClass) GetGetOutputStream() func(*IOStream) *OutputStream

GetGetOutputStream gets the "get_output_stream" callback function.

func (*IOStreamClass) GoPointer

func (x *IOStreamClass) GoPointer() uintptr

func (*IOStreamClass) OverrideCloseAsync

func (x *IOStreamClass) OverrideCloseAsync(cb func(*IOStream, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideCloseAsync sets the "close_async" callback function.

func (*IOStreamClass) OverrideCloseFinish

func (x *IOStreamClass) OverrideCloseFinish(cb func(*IOStream, AsyncResult) bool)

OverrideCloseFinish sets the "close_finish" callback function.

func (*IOStreamClass) OverrideCloseFn

func (x *IOStreamClass) OverrideCloseFn(cb func(*IOStream, *Cancellable) bool)

OverrideCloseFn sets the "close_fn" callback function.

func (*IOStreamClass) OverrideGReserved1

func (x *IOStreamClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*IOStreamClass) OverrideGReserved2

func (x *IOStreamClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*IOStreamClass) OverrideGReserved3

func (x *IOStreamClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*IOStreamClass) OverrideGReserved4

func (x *IOStreamClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*IOStreamClass) OverrideGReserved5

func (x *IOStreamClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

func (*IOStreamClass) OverrideGReserved6

func (x *IOStreamClass) OverrideGReserved6(cb func())

OverrideGReserved6 sets the "_g_reserved6" callback function.

func (*IOStreamClass) OverrideGReserved7

func (x *IOStreamClass) OverrideGReserved7(cb func())

OverrideGReserved7 sets the "_g_reserved7" callback function.

func (*IOStreamClass) OverrideGReserved8

func (x *IOStreamClass) OverrideGReserved8(cb func())

OverrideGReserved8 sets the "_g_reserved8" callback function.

func (*IOStreamClass) OverrideGReserved9

func (x *IOStreamClass) OverrideGReserved9(cb func())

OverrideGReserved9 sets the "_g_reserved9" callback function.

func (*IOStreamClass) OverrideGReserved10

func (x *IOStreamClass) OverrideGReserved10(cb func())

OverrideGReserved10 sets the "_g_reserved10" callback function.

func (*IOStreamClass) OverrideGetInputStream

func (x *IOStreamClass) OverrideGetInputStream(cb func(*IOStream) *InputStream)

OverrideGetInputStream sets the "get_input_stream" callback function.

func (*IOStreamClass) OverrideGetOutputStream

func (x *IOStreamClass) OverrideGetOutputStream(cb func(*IOStream) *OutputStream)

OverrideGetOutputStream sets the "get_output_stream" callback function.

type IOStreamPrivate

type IOStreamPrivate struct {
	// contains filtered or unexported fields
}

func (*IOStreamPrivate) GoPointer

func (x *IOStreamPrivate) GoPointer() uintptr

type IOStreamSpliceFlags

type IOStreamSpliceFlags int

GIOStreamSpliceFlags determine how streams should be spliced.

const (

	// Do not close either stream.
	GIoStreamSpliceNoneValue IOStreamSpliceFlags = 0
	// Close the first stream after
	//     the splice.
	GIoStreamSpliceCloseStream1Value IOStreamSpliceFlags = 1
	// Close the second stream after
	//     the splice.
	GIoStreamSpliceCloseStream2Value IOStreamSpliceFlags = 2
	// Wait for both splice operations to finish
	//     before calling the callback.
	GIoStreamSpliceWaitForBothValue IOStreamSpliceFlags = 4
)

type IPTosMessage added in v0.5.0

type IPTosMessage struct {
	SocketControlMessage
}

Contains the type of service (ToS) byte of an IPv4 header.

This consists of the DSCP field as per [RFC 2474](https://www.rfc-editor.org/rfc/rfc2474#section-3), and the ECN field as per [RFC 3168](https://www.rfc-editor.org/rfc/rfc3168#section-5).

It may be received using [method@Gio.Socket.receive_message] over UDP sockets (i.e. sockets in the `G_SOCKET_FAMILY_IPV4` family with `G_SOCKET_TYPE_DATAGRAM` type). The message is not meant for sending. To set ToS field to be used in datagrams sent on a [class@Gio.Socket] use: ```c g_socket_set_option (socket, IPPROTO_IP, IP_TOS, <ToS value>, &error); ```

func IPTosMessageNewFromInternalPtr added in v0.5.0

func IPTosMessageNewFromInternalPtr(ptr uintptr) *IPTosMessage

func NewIPTosMessage added in v0.5.0

func NewIPTosMessage(DscpVar byte, EcnVar EcnCodePoint) *IPTosMessage

Creates a new type-of-service message with given DSCP and ECN values.

func (*IPTosMessage) GetDscp added in v0.5.0

func (x *IPTosMessage) GetDscp() byte

Gets the differentiated services code point stored in @message.

func (*IPTosMessage) GetEcn added in v0.5.0

func (x *IPTosMessage) GetEcn() EcnCodePoint

Gets the Explicit Congestion Notification code point stored in @message.

func (*IPTosMessage) GoPointer added in v0.5.0

func (c *IPTosMessage) GoPointer() uintptr

func (*IPTosMessage) SetGoPointer added in v0.5.0

func (c *IPTosMessage) SetGoPointer(ptr uintptr)

type IPTosMessageClass added in v0.5.0

type IPTosMessageClass struct {
	ParentClass SocketControlMessageClass
	// contains filtered or unexported fields
}

func (*IPTosMessageClass) GoPointer added in v0.5.0

func (x *IPTosMessageClass) GoPointer() uintptr

type IPv6TclassMessage added in v0.5.0

type IPv6TclassMessage struct {
	SocketControlMessage
}

Contains the Traffic Class byte of an IPv6 header.

This consists of the DSCP field as per [RFC 2474](https://www.rfc-editor.org/rfc/rfc2474#section-3), and the ECN field as per [RFC 3168](https://www.rfc-editor.org/rfc/rfc3168#section-5).

It may be received using [method@Gio.Socket.receive_message] over UDP sockets (i.e. sockets in the `G_SOCKET_FAMILY_IPV6` family with `G_SOCKET_TYPE_DATAGRAM` type). The message is not meant for sending. To set Traffic Class field to be used in datagrams sent on a [class@Gio.Socket] use: ```c g_socket_set_option (socket, IPPROTO_IPV6, IPV6_TCLASS, <TC value>, &error); ```

func IPv6TclassMessageNewFromInternalPtr added in v0.5.0

func IPv6TclassMessageNewFromInternalPtr(ptr uintptr) *IPv6TclassMessage

func NewIPv6TclassMessage added in v0.5.0

func NewIPv6TclassMessage(DscpVar byte, EcnVar EcnCodePoint) *IPv6TclassMessage

Creates a new traffic class message with given DSCP and ECN values.

func (*IPv6TclassMessage) GetDscp added in v0.5.0

func (x *IPv6TclassMessage) GetDscp() byte

Gets the differentiated services code point stored in @message.

func (*IPv6TclassMessage) GetEcn added in v0.5.0

func (x *IPv6TclassMessage) GetEcn() EcnCodePoint

Gets the Explicit Congestion Notification code point stored in @message.

func (*IPv6TclassMessage) GoPointer added in v0.5.0

func (c *IPv6TclassMessage) GoPointer() uintptr

func (*IPv6TclassMessage) SetGoPointer added in v0.5.0

func (c *IPv6TclassMessage) SetGoPointer(ptr uintptr)

type IPv6TclassMessageClass added in v0.5.0

type IPv6TclassMessageClass struct {
	ParentClass SocketControlMessageClass
	// contains filtered or unexported fields
}

func (*IPv6TclassMessageClass) GoPointer added in v0.5.0

func (x *IPv6TclassMessageClass) GoPointer() uintptr

type Icon

type Icon interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	Equal(Icon2Var Icon) bool
	Hash() uint
	Serialize() *glib.Variant
	ToString() string
}

`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 [class@Gio.ThemedIcon]), or the path to an icon (see [iface@Gio.LoadableIcon]).

To obtain a hash of a `GIcon`, see [method@Gio.Icon.hash].

To check if two `GIcon`s are equal, see [method@Gio.Icon.equal].

For serializing a `GIcon`, use [method@Gio.Icon.serialize] and [func@Gio.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: [iface@Gio.LoadableIcon], [class@Gio.ThemedIcon] and [class@Gio.EmblemedIcon]. It may also make sense to have fast-paths for other cases (like handling [`GdkPixbuf`](https://docs.gtk.org/gdk-pixbuf/class.Pixbuf.html) directly, for example) but all compliant `GIcon` implementations outside of GIO must implement [iface@Gio.LoadableIcon].

If your application or library provides one or more `GIcon` implementations you need to ensure that your new implementation also implements [iface@Gio.LoadableIcon]. Additionally, you must provide an implementation of [method@Gio.Icon.serialize] that gives a result that is understood by [func@Gio.Icon.deserialize], yielding one of the built-in icon types.

type IconBase

type IconBase struct {
	Ptr uintptr
}

func ContentTypeGetIcon

func ContentTypeGetIcon(TypeVar string) *IconBase

Gets the icon for a content type.

func ContentTypeGetSymbolicIcon

func ContentTypeGetSymbolicIcon(TypeVar string) *IconBase

Gets the symbolic icon for a content type.

func IconDeserialize

func IconDeserialize(ValueVar *glib.Variant) *IconBase

Deserializes a #GIcon previously serialized using g_icon_serialize().

func IconNewForString

func IconNewForString(StrVar string) (*IconBase, error)

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().

func (*IconBase) Equal

func (x *IconBase) Equal(Icon2Var Icon) bool

Checks if two icons are equal.

func (*IconBase) GoPointer

func (x *IconBase) GoPointer() uintptr

func (*IconBase) Hash

func (x *IconBase) Hash() uint

Gets a hash for an icon.

func (*IconBase) Serialize

func (x *IconBase) Serialize() *glib.Variant

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.

func (*IconBase) SetGoPointer

func (x *IconBase) SetGoPointer(ptr uintptr)

func (*IconBase) ToString

func (x *IconBase) ToString() string

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`).

type IconIface

type IconIface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

GIconIface is used to implement GIcon types for various different systems. See #GThemedIcon and #GLoadableIcon for examples of how to implement this interface.

func (*IconIface) GetEqual

func (x *IconIface) GetEqual() func(Icon, Icon) bool

GetEqual gets the "equal" callback function. Checks if two #GIcons are equal.

func (*IconIface) GetFromTokens

func (x *IconIface) GetFromTokens() func(string, int, int) *IconBase

GetFromTokens gets the "from_tokens" callback function. Constructs a #GIcon from tokens. Set the #GError if the tokens are malformed. Don't implement if the #GIcon can't be serialized (Since 2.20).

func (*IconIface) GetHash

func (x *IconIface) GetHash() func(Icon) uint

GetHash gets the "hash" callback function. A hash for a given #GIcon.

func (*IconIface) GetSerialize

func (x *IconIface) GetSerialize() func(Icon) *glib.Variant

GetSerialize gets the "serialize" callback function. Serializes a #GIcon into a #GVariant. Since: 2.38

func (*IconIface) GetToTokens

func (x *IconIface) GetToTokens() func(Icon, *[]string, *int) bool

GetToTokens gets the "to_tokens" callback function. Serializes a #GIcon into tokens. The tokens must not contain any whitespace. Don't implement if the #GIcon can't be serialized (Since 2.20).

func (*IconIface) GoPointer

func (x *IconIface) GoPointer() uintptr

func (*IconIface) OverrideEqual

func (x *IconIface) OverrideEqual(cb func(Icon, Icon) bool)

OverrideEqual sets the "equal" callback function. Checks if two #GIcons are equal.

func (*IconIface) OverrideFromTokens

func (x *IconIface) OverrideFromTokens(cb func(string, int, int) *IconBase)

OverrideFromTokens sets the "from_tokens" callback function. Constructs a #GIcon from tokens. Set the #GError if the tokens are malformed. Don't implement if the #GIcon can't be serialized (Since 2.20).

func (*IconIface) OverrideHash

func (x *IconIface) OverrideHash(cb func(Icon) uint)

OverrideHash sets the "hash" callback function. A hash for a given #GIcon.

func (*IconIface) OverrideSerialize

func (x *IconIface) OverrideSerialize(cb func(Icon) *glib.Variant)

OverrideSerialize sets the "serialize" callback function. Serializes a #GIcon into a #GVariant. Since: 2.38

func (*IconIface) OverrideToTokens

func (x *IconIface) OverrideToTokens(cb func(Icon, *[]string, *int) bool)

OverrideToTokens sets the "to_tokens" callback function. Serializes a #GIcon into tokens. The tokens must not contain any whitespace. Don't implement if the #GIcon can't be serialized (Since 2.20).

type InetAddress

type InetAddress struct {
	gobject.Object
}

`GInetAddress` represents an IPv4 or IPv6 internet address. Use [method@Gio.Resolver.lookup_by_name] or [method@Gio.Resolver.lookup_by_name_async] to look up the `GInetAddress` for a hostname. Use [method@Gio.Resolver.lookup_by_address] or [method@Gio.Resolver.lookup_by_address_async] to look up the hostname for a `GInetAddress`.

To actually connect to a remote host, you will need a [class@Gio.InetSocketAddress] (which includes a `GInetAddress` as well as a port number).

func InetAddressNewFromInternalPtr

func InetAddressNewFromInternalPtr(ptr uintptr) *InetAddress

func NewInetAddressAny

func NewInetAddressAny(FamilyVar SocketFamily) *InetAddress

Creates a #GInetAddress for the "any" address (unassigned/"don't care") for @family.

func NewInetAddressFromBytes

func NewInetAddressFromBytes(BytesVar []byte, FamilyVar SocketFamily) *InetAddress

Creates a new #GInetAddress from the given @family and @bytes. @bytes should be 4 bytes for %G_SOCKET_FAMILY_IPV4 and 16 bytes for %G_SOCKET_FAMILY_IPV6.

func NewInetAddressFromBytesWithIpv6Info

func NewInetAddressFromBytesWithIpv6Info(BytesVar []byte, FamilyVar SocketFamily, FlowinfoVar uint32, ScopeIdVar uint32) *InetAddress

Creates a new [class@Gio.InetAddress] from the given @family, @bytes and @scope_id.

@bytes must be 4 bytes for [enum@Gio.SocketFamily.IPV4] and 16 bytes for [enum@Gio.SocketFamily.IPV6].

func NewInetAddressFromString

func NewInetAddressFromString(StringVar string) *InetAddress

Parses @string as an IP address and creates a new #GInetAddress.

If @address is an IPv6 address, it can also contain a scope ID (separated from the address by a `%`). Note that currently this behavior is platform specific. This may change in a future release.

func NewInetAddressLoopback

func NewInetAddressLoopback(FamilyVar SocketFamily) *InetAddress

Creates a #GInetAddress for the loopback address for @family.

func (*InetAddress) Equal

func (x *InetAddress) Equal(OtherAddressVar *InetAddress) bool

Checks if two #GInetAddress instances are equal, e.g. the same address.

func (*InetAddress) GetFamily

func (x *InetAddress) GetFamily() SocketFamily

Gets @address's family

func (*InetAddress) GetFlowinfo

func (x *InetAddress) GetFlowinfo() uint32

Gets the value of [property@Gio.InetAddress:flowinfo].

func (*InetAddress) GetIsAny

func (x *InetAddress) GetIsAny() bool

Tests whether @address is the "any" address for its family.

func (*InetAddress) GetIsLinkLocal

func (x *InetAddress) GetIsLinkLocal() bool

Tests whether @address is a link-local address (that is, if it identifies a host on a local network that is not connected to the Internet).

func (*InetAddress) GetIsLoopback

func (x *InetAddress) GetIsLoopback() bool

Tests whether @address is the loopback address for its family.

func (*InetAddress) GetIsMcGlobal

func (x *InetAddress) GetIsMcGlobal() bool

Tests whether @address is a global multicast address.

func (*InetAddress) GetIsMcLinkLocal

func (x *InetAddress) GetIsMcLinkLocal() bool

Tests whether @address is a link-local multicast address.

func (*InetAddress) GetIsMcNodeLocal

func (x *InetAddress) GetIsMcNodeLocal() bool

Tests whether @address is a node-local multicast address.

func (*InetAddress) GetIsMcOrgLocal

func (x *InetAddress) GetIsMcOrgLocal() bool

Tests whether @address is an organization-local multicast address.

func (*InetAddress) GetIsMcSiteLocal

func (x *InetAddress) GetIsMcSiteLocal() bool

Tests whether @address is a site-local multicast address.

func (*InetAddress) GetIsMulticast

func (x *InetAddress) GetIsMulticast() bool

Tests whether @address is a multicast address.

func (*InetAddress) GetIsSiteLocal

func (x *InetAddress) GetIsSiteLocal() bool

Tests whether @address is a site-local address such as 10.0.0.1 (that is, the address identifies a host on a local network that can not be reached directly from the Internet, but which may have outgoing Internet connectivity via a NAT or firewall).

func (*InetAddress) GetNativeSize

func (x *InetAddress) GetNativeSize() uint

Gets the size of the native raw binary address for @address. This is the size of the data that you get from g_inet_address_to_bytes().

func (*InetAddress) GetPropertyBytes

func (x *InetAddress) GetPropertyBytes() uintptr

GetPropertyBytes gets the "bytes" property. The raw address data.

func (*InetAddress) GetPropertyFlowinfo

func (x *InetAddress) GetPropertyFlowinfo() uint

GetPropertyFlowinfo gets the "flowinfo" property. The flowinfo for an IPv6 address. See [method@Gio.InetAddress.get_flowinfo].

func (*InetAddress) GetPropertyIsAny

func (x *InetAddress) GetPropertyIsAny() bool

GetPropertyIsAny gets the "is-any" property. Whether this is the "any" address for its family. See g_inet_address_get_is_any().

func (*InetAddress) GetPropertyIsLinkLocal

func (x *InetAddress) GetPropertyIsLinkLocal() bool

GetPropertyIsLinkLocal gets the "is-link-local" property. Whether this is a link-local address. See g_inet_address_get_is_link_local().

func (*InetAddress) GetPropertyIsLoopback

func (x *InetAddress) GetPropertyIsLoopback() bool

GetPropertyIsLoopback gets the "is-loopback" property. Whether this is the loopback address for its family. See g_inet_address_get_is_loopback().

func (*InetAddress) GetPropertyIsMcGlobal

func (x *InetAddress) GetPropertyIsMcGlobal() bool

GetPropertyIsMcGlobal gets the "is-mc-global" property. Whether this is a global multicast address. See g_inet_address_get_is_mc_global().

func (*InetAddress) GetPropertyIsMcLinkLocal

func (x *InetAddress) GetPropertyIsMcLinkLocal() bool

GetPropertyIsMcLinkLocal gets the "is-mc-link-local" property. Whether this is a link-local multicast address. See g_inet_address_get_is_mc_link_local().

func (*InetAddress) GetPropertyIsMcNodeLocal

func (x *InetAddress) GetPropertyIsMcNodeLocal() bool

GetPropertyIsMcNodeLocal gets the "is-mc-node-local" property. Whether this is a node-local multicast address. See g_inet_address_get_is_mc_node_local().

func (*InetAddress) GetPropertyIsMcOrgLocal

func (x *InetAddress) GetPropertyIsMcOrgLocal() bool

GetPropertyIsMcOrgLocal gets the "is-mc-org-local" property. Whether this is an organization-local multicast address. See g_inet_address_get_is_mc_org_local().

func (*InetAddress) GetPropertyIsMcSiteLocal

func (x *InetAddress) GetPropertyIsMcSiteLocal() bool

GetPropertyIsMcSiteLocal gets the "is-mc-site-local" property. Whether this is a site-local multicast address. See g_inet_address_get_is_mc_site_local().

func (*InetAddress) GetPropertyIsMulticast

func (x *InetAddress) GetPropertyIsMulticast() bool

GetPropertyIsMulticast gets the "is-multicast" property. Whether this is a multicast address. See g_inet_address_get_is_multicast().

func (*InetAddress) GetPropertyIsSiteLocal

func (x *InetAddress) GetPropertyIsSiteLocal() bool

GetPropertyIsSiteLocal gets the "is-site-local" property. Whether this is a site-local address. See g_inet_address_get_is_loopback().

func (*InetAddress) GetPropertyScopeId

func (x *InetAddress) GetPropertyScopeId() uint

GetPropertyScopeId gets the "scope-id" property. The scope-id for an IPv6 address. See [method@Gio.InetAddress.get_scope_id].

func (*InetAddress) GetScopeId

func (x *InetAddress) GetScopeId() uint32

Gets the value of [property@Gio.InetAddress:scope-id].

func (*InetAddress) GoPointer

func (c *InetAddress) GoPointer() uintptr

func (*InetAddress) SetGoPointer

func (c *InetAddress) SetGoPointer(ptr uintptr)

func (*InetAddress) SetPropertyBytes

func (x *InetAddress) SetPropertyBytes(value uintptr)

SetPropertyBytes sets the "bytes" property. The raw address data.

func (*InetAddress) SetPropertyFlowinfo

func (x *InetAddress) SetPropertyFlowinfo(value uint)

SetPropertyFlowinfo sets the "flowinfo" property. The flowinfo for an IPv6 address. See [method@Gio.InetAddress.get_flowinfo].

func (*InetAddress) SetPropertyScopeId

func (x *InetAddress) SetPropertyScopeId(value uint)

SetPropertyScopeId sets the "scope-id" property. The scope-id for an IPv6 address. See [method@Gio.InetAddress.get_scope_id].

func (*InetAddress) ToBytes

func (x *InetAddress) ToBytes() byte

Gets the raw binary address data from @address.

func (*InetAddress) ToString

func (x *InetAddress) ToString() string

Converts @address to string form.

type InetAddressClass

type InetAddressClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*InetAddressClass) GetToBytes

func (x *InetAddressClass) GetToBytes() func(*InetAddress) byte

GetToBytes gets the "to_bytes" callback function.

func (*InetAddressClass) GetToString

func (x *InetAddressClass) GetToString() func(*InetAddress) string

GetToString gets the "to_string" callback function.

func (*InetAddressClass) GoPointer

func (x *InetAddressClass) GoPointer() uintptr

func (*InetAddressClass) OverrideToBytes

func (x *InetAddressClass) OverrideToBytes(cb func(*InetAddress) byte)

OverrideToBytes sets the "to_bytes" callback function.

func (*InetAddressClass) OverrideToString

func (x *InetAddressClass) OverrideToString(cb func(*InetAddress) string)

OverrideToString sets the "to_string" callback function.

type InetAddressMask

type InetAddressMask struct {
	gobject.Object
}

`GInetAddressMask` represents a range of IPv4 or IPv6 addresses described by a base address and a length indicating how many bits of the base address are relevant for matching purposes. These are often given in string form. For example, `10.0.0.0/8`, or `fe80::/10`.

func InetAddressMaskNewFromInternalPtr

func InetAddressMaskNewFromInternalPtr(ptr uintptr) *InetAddressMask

func NewInetAddressMask

func NewInetAddressMask(AddrVar *InetAddress, LengthVar uint) (*InetAddressMask, error)

Creates a new #GInetAddressMask representing all addresses whose first @length bits match @addr.

func NewInetAddressMaskFromString

func NewInetAddressMaskFromString(MaskStringVar string) (*InetAddressMask, error)

Parses @mask_string as an IP address and (optional) length, and creates a new #GInetAddressMask. The length, if present, is delimited by a "/". If it is not present, then the length is assumed to be the full length of the address.

func (*InetAddressMask) Equal

func (x *InetAddressMask) Equal(Mask2Var *InetAddressMask) bool

Tests if @mask and @mask2 are the same mask.

func (*InetAddressMask) GetAddress

func (x *InetAddressMask) GetAddress() *InetAddress

Gets @mask's base address

func (*InetAddressMask) GetFamily

func (x *InetAddressMask) GetFamily() SocketFamily

Gets the #GSocketFamily of @mask's address

func (*InetAddressMask) GetLength

func (x *InetAddressMask) GetLength() uint

Gets @mask's length

func (*InetAddressMask) GetPropertyLength

func (x *InetAddressMask) GetPropertyLength() uint

GetPropertyLength gets the "length" property. The prefix length, in bytes.

func (*InetAddressMask) GoPointer

func (c *InetAddressMask) GoPointer() uintptr

func (*InetAddressMask) Init

func (x *InetAddressMask) Init(CancellableVar *Cancellable) (bool, error)

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 [description][iface@Gio.Initable#description] 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.

func (*InetAddressMask) Matches

func (x *InetAddressMask) Matches(AddressVar *InetAddress) bool

Tests if @address falls within the range described by @mask.

func (*InetAddressMask) SetGoPointer

func (c *InetAddressMask) SetGoPointer(ptr uintptr)

func (*InetAddressMask) SetPropertyLength

func (x *InetAddressMask) SetPropertyLength(value uint)

SetPropertyLength sets the "length" property. The prefix length, in bytes.

func (*InetAddressMask) ToString

func (x *InetAddressMask) ToString() string

Converts @mask back to its corresponding string form.

type InetAddressMaskClass

type InetAddressMaskClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*InetAddressMaskClass) GoPointer

func (x *InetAddressMaskClass) GoPointer() uintptr

type InetAddressMaskPrivate

type InetAddressMaskPrivate struct {
	// contains filtered or unexported fields
}

func (*InetAddressMaskPrivate) GoPointer

func (x *InetAddressMaskPrivate) GoPointer() uintptr

type InetAddressPrivate

type InetAddressPrivate struct {
	// contains filtered or unexported fields
}

func (*InetAddressPrivate) GoPointer

func (x *InetAddressPrivate) GoPointer() uintptr

type InetSocketAddress

type InetSocketAddress struct {
	SocketAddress
}

An IPv4 or IPv6 socket address. That is, the combination of a [class@Gio.InetAddress] and a port number.

In UNIX terms, `GInetSocketAddress` corresponds to a [`struct sockaddr_in` or `struct sockaddr_in6`](man:sockaddr(3type)).

func InetSocketAddressNewFromInternalPtr

func InetSocketAddressNewFromInternalPtr(ptr uintptr) *InetSocketAddress

func NewInetSocketAddress

func NewInetSocketAddress(AddressVar *InetAddress, PortVar uint16) *InetSocketAddress

Creates a new #GInetSocketAddress for @address and @port.

func NewInetSocketAddressFromString

func NewInetSocketAddressFromString(AddressVar string, PortVar uint) *InetSocketAddress

Creates a new #GInetSocketAddress for @address and @port.

If @address is an IPv6 address, it can also contain a scope ID (separated from the address by a `%`). Note that currently this behavior is platform specific. This may change in a future release.

func (*InetSocketAddress) Enumerate

Creates a #GSocketAddressEnumerator for @connectable.

func (*InetSocketAddress) GetAddress

func (x *InetSocketAddress) GetAddress() *InetAddress

Gets @address's #GInetAddress.

func (*InetSocketAddress) GetFlowinfo

func (x *InetSocketAddress) GetFlowinfo() uint32

Gets the `sin6_flowinfo` field from @address, which must be an IPv6 address.

If not overridden this value will be inherited from [property@Gio.InetSocketAddress:address].

func (*InetSocketAddress) GetPort

func (x *InetSocketAddress) GetPort() uint16

Gets @address's port.

func (*InetSocketAddress) GetPropertyFlowinfo

func (x *InetSocketAddress) GetPropertyFlowinfo() uint

GetPropertyFlowinfo gets the "flowinfo" property. The `sin6_flowinfo` field, for IPv6 addresses.

If unset this property is inherited from [property@Gio.InetSocketAddress:address].

func (*InetSocketAddress) GetPropertyPort

func (x *InetSocketAddress) GetPropertyPort() uint

GetPropertyPort gets the "port" property. The port.

func (*InetSocketAddress) GetPropertyScopeId

func (x *InetSocketAddress) GetPropertyScopeId() uint

GetPropertyScopeId gets the "scope-id" property. The `sin6_scope_id` field, for IPv6 addresses.

If unset this property is inherited from [property@Gio.InetSocketAddress:address].

func (*InetSocketAddress) GetScopeId

func (x *InetSocketAddress) GetScopeId() uint32

Gets the `sin6_scope_id` field from @address, which must be an IPv6 address.

If not overridden this value will be inherited from [property@Gio.InetSocketAddress:address].

func (*InetSocketAddress) GoPointer

func (c *InetSocketAddress) GoPointer() uintptr

func (*InetSocketAddress) ProxyEnumerate

func (x *InetSocketAddress) ProxyEnumerate() *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().

func (*InetSocketAddress) SetGoPointer

func (c *InetSocketAddress) SetGoPointer(ptr uintptr)

func (*InetSocketAddress) SetPropertyFlowinfo

func (x *InetSocketAddress) SetPropertyFlowinfo(value uint)

SetPropertyFlowinfo sets the "flowinfo" property. The `sin6_flowinfo` field, for IPv6 addresses.

If unset this property is inherited from [property@Gio.InetSocketAddress:address].

func (*InetSocketAddress) SetPropertyPort

func (x *InetSocketAddress) SetPropertyPort(value uint)

SetPropertyPort sets the "port" property. The port.

func (*InetSocketAddress) SetPropertyScopeId

func (x *InetSocketAddress) SetPropertyScopeId(value uint)

SetPropertyScopeId sets the "scope-id" property. The `sin6_scope_id` field, for IPv6 addresses.

If unset this property is inherited from [property@Gio.InetSocketAddress:address].

func (*InetSocketAddress) ToString

func (x *InetSocketAddress) ToString() string

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.

type InetSocketAddressClass

type InetSocketAddressClass struct {
	ParentClass SocketAddressClass
	// contains filtered or unexported fields
}

func (*InetSocketAddressClass) GoPointer

func (x *InetSocketAddressClass) GoPointer() uintptr

type InetSocketAddressPrivate

type InetSocketAddressPrivate struct {
	// contains filtered or unexported fields
}

func (*InetSocketAddressPrivate) GoPointer

func (x *InetSocketAddressPrivate) GoPointer() uintptr

type Initable

type Initable interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	Init(CancellableVar *Cancellable) (bool, error)
}

`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 [method@Gio.Initable.init] or [method@Gio.AsyncInitable.init_async] (the latter is only available if it also implements [iface@Gio.AsyncInitable]).

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 [func@GLib.critical] or [func@GLib.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 [func@Gio.Initable.new] directly, or indirectly via a `foo_thing_new()` wrapper. This will call [method@Gio.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.

type InitableBase

type InitableBase struct {
	Ptr uintptr
}

func (*InitableBase) GoPointer

func (x *InitableBase) GoPointer() uintptr

func (*InitableBase) Init

func (x *InitableBase) Init(CancellableVar *Cancellable) (bool, error)

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 [description][iface@Gio.Initable#description] 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.

func (*InitableBase) SetGoPointer

func (x *InitableBase) SetGoPointer(ptr uintptr)

type InitableIface

type InitableIface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

Provides an interface for initializing object such that initialization may fail.

func (*InitableIface) GetInit

func (x *InitableIface) GetInit() func(Initable, *Cancellable) bool

GetInit gets the "init" callback function. Initializes the object.

func (*InitableIface) GoPointer

func (x *InitableIface) GoPointer() uintptr

func (*InitableIface) OverrideInit

func (x *InitableIface) OverrideInit(cb func(Initable, *Cancellable) bool)

OverrideInit sets the "init" callback function. Initializes the object.

type InputMessage

type InputMessage struct {
	Address **SocketAddress

	Vectors []InputVector

	NumVectors uint

	BytesReceived uint

	Flags int32

	ControlMessages uintptr

	NumControlMessages uint
	// contains filtered or unexported fields
}

Structure used for scatter/gather data input when receiving multiple messages or packets in one go. You generally pass in an array of empty #GInputVectors and the operation will use all the buffers as if they were one buffer, and will set @bytes_received to the total number of bytes received across all #GInputVectors.

This structure closely mirrors `struct mmsghdr` and `struct msghdr` from the POSIX sockets API (see `man 2 recvmmsg`).

If @address is non-%NULL then it is set to the source address the message was received from, and the caller must free it afterwards.

If @control_messages is non-%NULL then it is set to an array of control messages received with the message (if any), and the caller must free it afterwards. @num_control_messages is set to the number of elements in this array, which may be zero.

Flags relevant to this message will be returned in @flags. For example, `MSG_EOR` or `MSG_TRUNC`.

func (*InputMessage) GoPointer

func (x *InputMessage) GoPointer() uintptr

type InputStream

type InputStream struct {
	gobject.Object
}

`GInputStream` is a base class for implementing streaming input.

It has functions to read from a stream ([method@Gio.InputStream.read]), to close a stream ([method@Gio.InputStream.close]) and to skip some content ([method@Gio.InputStream.skip]).

To copy the content of an input stream to an output stream without manually handling the reads and writes, use [method@Gio.OutputStream.splice].

See the documentation for [class@Gio.IOStream] for details of thread safety of streaming APIs.

All of these functions have async variants too.

func InputStreamNewFromInternalPtr

func InputStreamNewFromInternalPtr(ptr uintptr) *InputStream

func ResourcesOpenStream

func ResourcesOpenStream(PathVar string, LookupFlagsVar ResourceLookupFlags) (*InputStream, error)

Looks for a file at the specified @path in the set of globally registered resources and returns a [class@Gio.InputStream] that lets you read the data.

@lookup_flags controls the behaviour of the lookup.

func (*InputStream) ClearPending

func (x *InputStream) ClearPending()

Clears the pending flag on @stream.

func (*InputStream) Close

func (x *InputStream) Close(CancellableVar *Cancellable) (bool, error)

Closes the stream, releasing resources related to it.

Once the stream is closed, all other operations will return %G_IO_ERROR_CLOSED. Closing a stream multiple times will not return an error.

Streams 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.

Some streams might keep the backing store of the stream (e.g. a file descriptor) open after the stream is closed. See the documentation for the individual stream for details.

On failure the first error that happened will be reported, but the close operation will finish as much as possible. A stream that failed to close will still return %G_IO_ERROR_CLOSED for all operations. Still, it is important to check and report the error to the user.

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. Cancelling a close will still leave the stream closed, but some streams can use a faster close that doesn't block to e.g. check errors.

func (*InputStream) CloseAsync

func (x *InputStream) CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Requests an asynchronous closes of the stream, releasing resources related to it. When the operation is finished @callback will be called. You can then call g_input_stream_close_finish() to get the result of the operation.

For behaviour details see g_input_stream_close().

The asynchronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all.

func (*InputStream) CloseFinish

func (x *InputStream) CloseFinish(ResultVar AsyncResult) (bool, error)

Finishes closing a stream asynchronously, started from g_input_stream_close_async().

func (*InputStream) GoPointer

func (c *InputStream) GoPointer() uintptr

func (*InputStream) HasPending

func (x *InputStream) HasPending() bool

Checks if an input stream has pending actions.

func (*InputStream) IsClosed

func (x *InputStream) IsClosed() bool

Checks if an input stream is closed.

func (*InputStream) Read

func (x *InputStream) Read(BufferVar *[]byte, CountVar uint, CancellableVar *Cancellable) (int, error)

Tries to read @count bytes from the stream into the buffer starting at @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.

The returned @buffer is not a nul-terminated string, it can contain nul bytes at any position, and this function doesn't nul-terminate 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.

func (*InputStream) ReadAll

func (x *InputStream) ReadAll(BufferVar *[]byte, CountVar uint, BytesReadVar *uint, CancellableVar *Cancellable) (bool, error)

Tries to read @count bytes from the stream into the buffer starting at @buffer. Will block during this read.

This function is similar to g_input_stream_read(), except it tries to read as many bytes as requested, only stopping on an error or end of stream.

On a successful read of @count bytes, or if we reached the end of the stream, %TRUE is returned, and @bytes_read is set to the number of bytes read into @buffer.

If there is an error during the operation %FALSE is returned and @error is set to indicate the error status.

As a special exception to the normal conventions for functions that use #GError, if this function returns %FALSE (and sets @error) then @bytes_read will be set to the number of bytes that were successfully read before the error was encountered. This functionality is only available from C. If you need it from another language then you must write your own loop around g_input_stream_read().

func (*InputStream) ReadAllAsync

func (x *InputStream) ReadAllAsync(BufferVar *[]byte, CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Request an asynchronous read of @count bytes from the stream into the buffer starting at @buffer.

This is the asynchronous equivalent of [method@InputStream.read_all].

Call [method@InputStream.read_all_finish] to collect the result.

Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is %G_PRIORITY_DEFAULT.

func (*InputStream) ReadAllFinish

func (x *InputStream) ReadAllFinish(ResultVar AsyncResult, BytesReadVar *uint) (bool, error)

Finishes an asynchronous stream read operation started with [method@InputStream.read_all_async].

As a special exception to the normal conventions for functions that use #GError, if this function returns %FALSE (and sets @error) then @bytes_read will be set to the number of bytes that were successfully read before the error was encountered. This functionality is only available from C. If you need it from another language then you must write your own loop around g_input_stream_read_async().

func (*InputStream) ReadAsync

func (x *InputStream) ReadAsync(BufferVar *[]byte, CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Request an asynchronous read of @count bytes from the stream into the buffer starting at @buffer. When the operation is finished @callback will be called. You can then call g_input_stream_read_finish() to get the result of the operation.

During an async request no other sync and async calls are allowed on @stream, and will result in %G_IO_ERROR_PENDING errors.

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 will be passed to the callback. 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, but generally we try to read as many bytes as requested. Zero is returned on end of file (or if @count is zero), but never otherwise.

Any outstanding i/o request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is %G_PRIORITY_DEFAULT.

The asynchronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all.

func (*InputStream) ReadBytes

func (x *InputStream) ReadBytes(CountVar uint, CancellableVar *Cancellable) (*glib.Bytes, error)

Like g_input_stream_read(), this tries to read @count bytes from the stream in a blocking fashion. However, rather than reading into a user-supplied buffer, this will create a new #GBytes containing the data that was read. This may be easier to use from language bindings.

If count is zero, returns a zero-length #GBytes and does nothing. A value of @count larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.

On success, a new #GBytes is returned. It is not an error if the size of this object is not the same as the requested size, as it can happen e.g. near the end of a file. A zero-length #GBytes is returned on end of file (or if @count is zero), but never otherwise.

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 %NULL is returned and @error is set accordingly.

func (*InputStream) ReadBytesAsync

func (x *InputStream) ReadBytesAsync(CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Request an asynchronous read of @count bytes from the stream into a new #GBytes. When the operation is finished @callback will be called. You can then call g_input_stream_read_bytes_finish() to get the result of the operation.

During an async request no other sync and async calls are allowed on @stream, and will result in %G_IO_ERROR_PENDING errors.

A value of @count larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.

On success, the new #GBytes will be passed to the callback. It is not an error if this is smaller than the requested size, as it can happen e.g. near the end of a file, but generally we try to read as many bytes as requested. Zero is returned on end of file (or if @count is zero), but never otherwise.

Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is %G_PRIORITY_DEFAULT.

func (*InputStream) ReadBytesFinish

func (x *InputStream) ReadBytesFinish(ResultVar AsyncResult) (*glib.Bytes, error)

Finishes an asynchronous stream read-into-#GBytes operation.

func (*InputStream) ReadFinish

func (x *InputStream) ReadFinish(ResultVar AsyncResult) (int, error)

Finishes an asynchronous stream read operation.

func (*InputStream) SetGoPointer

func (c *InputStream) SetGoPointer(ptr uintptr)

func (*InputStream) SetPending

func (x *InputStream) SetPending() (bool, error)

Sets @stream to have actions pending. If the pending flag is already set or @stream is closed, it will return %FALSE and set @error.

func (*InputStream) Skip

func (x *InputStream) Skip(CountVar uint, CancellableVar *Cancellable) (int, error)

Tries to skip @count bytes from the stream. Will block during the operation.

This is identical to g_input_stream_read(), from a behaviour standpoint, but the bytes that are skipped are not returned to the user. Some streams have an implementation that is more efficient than reading the data.

This function is optional for inherited classes, as the default implementation emulates it using read.

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.

func (*InputStream) SkipAsync

func (x *InputStream) SkipAsync(CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Request an asynchronous skip of @count bytes from the stream. When the operation is finished @callback will be called. You can then call g_input_stream_skip_finish() to get the result of the operation.

During an async request no other sync and async calls are allowed, and will result in %G_IO_ERROR_PENDING errors.

A value of @count larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.

On success, the number of bytes skipped will be passed to the callback. 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, but generally we try to skip as many bytes as requested. Zero is returned on end of file (or if @count is zero), but never otherwise.

Any outstanding i/o request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is %G_PRIORITY_DEFAULT.

The asynchronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one, you must override all.

func (*InputStream) SkipFinish

func (x *InputStream) SkipFinish(ResultVar AsyncResult) (int, error)

Finishes a stream skip operation.

type InputStreamClass

type InputStreamClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*InputStreamClass) GetCloseAsync

func (x *InputStreamClass) GetCloseAsync() func(*InputStream, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetCloseAsync gets the "close_async" callback function.

func (*InputStreamClass) GetCloseFinish

func (x *InputStreamClass) GetCloseFinish() func(*InputStream, AsyncResult) bool

GetCloseFinish gets the "close_finish" callback function.

func (*InputStreamClass) GetCloseFn

func (x *InputStreamClass) GetCloseFn() func(*InputStream, *Cancellable) bool

GetCloseFn gets the "close_fn" callback function.

func (*InputStreamClass) GetGReserved1

func (x *InputStreamClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*InputStreamClass) GetGReserved2

func (x *InputStreamClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*InputStreamClass) GetGReserved3

func (x *InputStreamClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*InputStreamClass) GetGReserved4

func (x *InputStreamClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*InputStreamClass) GetGReserved5

func (x *InputStreamClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*InputStreamClass) GetReadAsync

func (x *InputStreamClass) GetReadAsync() func(*InputStream, *[]byte, uint, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetReadAsync gets the "read_async" callback function.

func (*InputStreamClass) GetReadFinish

func (x *InputStreamClass) GetReadFinish() func(*InputStream, AsyncResult) int

GetReadFinish gets the "read_finish" callback function.

func (*InputStreamClass) GetReadFn

func (x *InputStreamClass) GetReadFn() func(*InputStream, uintptr, uint, *Cancellable) int

GetReadFn gets the "read_fn" callback function.

func (*InputStreamClass) GetSkip

func (x *InputStreamClass) GetSkip() func(*InputStream, uint, *Cancellable) int

GetSkip gets the "skip" callback function.

func (*InputStreamClass) GetSkipAsync

func (x *InputStreamClass) GetSkipAsync() func(*InputStream, uint, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetSkipAsync gets the "skip_async" callback function.

func (*InputStreamClass) GetSkipFinish

func (x *InputStreamClass) GetSkipFinish() func(*InputStream, AsyncResult) int

GetSkipFinish gets the "skip_finish" callback function.

func (*InputStreamClass) GoPointer

func (x *InputStreamClass) GoPointer() uintptr

func (*InputStreamClass) OverrideCloseAsync

func (x *InputStreamClass) OverrideCloseAsync(cb func(*InputStream, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideCloseAsync sets the "close_async" callback function.

func (*InputStreamClass) OverrideCloseFinish

func (x *InputStreamClass) OverrideCloseFinish(cb func(*InputStream, AsyncResult) bool)

OverrideCloseFinish sets the "close_finish" callback function.

func (*InputStreamClass) OverrideCloseFn

func (x *InputStreamClass) OverrideCloseFn(cb func(*InputStream, *Cancellable) bool)

OverrideCloseFn sets the "close_fn" callback function.

func (*InputStreamClass) OverrideGReserved1

func (x *InputStreamClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*InputStreamClass) OverrideGReserved2

func (x *InputStreamClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*InputStreamClass) OverrideGReserved3

func (x *InputStreamClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*InputStreamClass) OverrideGReserved4

func (x *InputStreamClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*InputStreamClass) OverrideGReserved5

func (x *InputStreamClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

func (*InputStreamClass) OverrideReadAsync

func (x *InputStreamClass) OverrideReadAsync(cb func(*InputStream, *[]byte, uint, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideReadAsync sets the "read_async" callback function.

func (*InputStreamClass) OverrideReadFinish

func (x *InputStreamClass) OverrideReadFinish(cb func(*InputStream, AsyncResult) int)

OverrideReadFinish sets the "read_finish" callback function.

func (*InputStreamClass) OverrideReadFn

func (x *InputStreamClass) OverrideReadFn(cb func(*InputStream, uintptr, uint, *Cancellable) int)

OverrideReadFn sets the "read_fn" callback function.

func (*InputStreamClass) OverrideSkip

func (x *InputStreamClass) OverrideSkip(cb func(*InputStream, uint, *Cancellable) int)

OverrideSkip sets the "skip" callback function.

func (*InputStreamClass) OverrideSkipAsync

func (x *InputStreamClass) OverrideSkipAsync(cb func(*InputStream, uint, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideSkipAsync sets the "skip_async" callback function.

func (*InputStreamClass) OverrideSkipFinish

func (x *InputStreamClass) OverrideSkipFinish(cb func(*InputStream, AsyncResult) int)

OverrideSkipFinish sets the "skip_finish" callback function.

type InputStreamPrivate

type InputStreamPrivate struct {
	// contains filtered or unexported fields
}

func (*InputStreamPrivate) GoPointer

func (x *InputStreamPrivate) GoPointer() uintptr

type InputVector

type InputVector struct {
	Buffer uintptr

	Size uint
	// contains filtered or unexported fields
}

Structure used for scatter/gather data input. You generally pass in an array of #GInputVectors and the operation will store the read data starting in the first buffer, switching to the next as needed.

func (*InputVector) GoPointer

func (x *InputVector) GoPointer() uintptr

type ListModel

type ListModel interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	GetItem(PositionVar uint) uintptr
	GetItemType() types.GType
	GetNItems() uint
	GetObject(PositionVar uint) *gobject.Object
	ItemsChanged(PositionVar uint, RemovedVar uint, AddedVar uint)
}

`GListModel` is an interface that represents a mutable list of [class@GObject.Object]. 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 [signal@GObject.Object::notify] signal). Taken together with the [signal@Gio.ListModel::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. [method@Gio.ListModel.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: [method@Gio.ListModel.get_n_items] returns the number of items in the list and [method@Gio.ListModel.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 [method@Gio.ListModel.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 (see [method@GLib.MainContext.push_thread_default]) in effect at the time that the model was created.

Over time, it has established itself as good practice for list model 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 [method@Gio.ListModel.get_item_type] and [method@Gio.ListModel.get_n_items] respectively and be defined as such:

```c properties[PROP_ITEM_TYPE] =

g_param_spec_gtype ("item-type", NULL, NULL, G_TYPE_OBJECT,
                    G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);

properties[PROP_N_ITEMS] =

g_param_spec_uint ("n-items", NULL, NULL, 0, G_MAXUINT, 0,
                   G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);

```

type ListModelBase

type ListModelBase struct {
	Ptr uintptr
}

func (*ListModelBase) GetItem

func (x *ListModelBase) GetItem(PositionVar uint) uintptr

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 also: g_list_model_get_n_items()

func (*ListModelBase) GetItemType

func (x *ListModelBase) GetItemType() types.GType

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.

func (*ListModelBase) GetNItems

func (x *ListModelBase) GetNItems() uint

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.

func (*ListModelBase) GetObject

func (x *ListModelBase) GetObject(PositionVar uint) *gobject.Object

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()

func (*ListModelBase) GoPointer

func (x *ListModelBase) GoPointer() uintptr

func (*ListModelBase) ItemsChanged

func (x *ListModelBase) ItemsChanged(PositionVar uint, RemovedVar uint, AddedVar uint)

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.

func (*ListModelBase) SetGoPointer

func (x *ListModelBase) SetGoPointer(ptr uintptr)

type ListModelInterface

type ListModelInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

The virtual function table for #GListModel.

func (*ListModelInterface) GetGetItem

func (x *ListModelInterface) GetGetItem() func(ListModel, uint) *gobject.Object

GetGetItem gets the "get_item" callback function. the virtual function pointer for g_list_model_get_item()

func (*ListModelInterface) GetGetItemType

func (x *ListModelInterface) GetGetItemType() func(ListModel) types.GType

GetGetItemType gets the "get_item_type" callback function. the virtual function pointer for g_list_model_get_item_type()

func (*ListModelInterface) GetGetNItems

func (x *ListModelInterface) GetGetNItems() func(ListModel) uint

GetGetNItems gets the "get_n_items" callback function. the virtual function pointer for g_list_model_get_n_items()

func (*ListModelInterface) GoPointer

func (x *ListModelInterface) GoPointer() uintptr

func (*ListModelInterface) OverrideGetItem

func (x *ListModelInterface) OverrideGetItem(cb func(ListModel, uint) *gobject.Object)

OverrideGetItem sets the "get_item" callback function. the virtual function pointer for g_list_model_get_item()

func (*ListModelInterface) OverrideGetItemType

func (x *ListModelInterface) OverrideGetItemType(cb func(ListModel) types.GType)

OverrideGetItemType sets the "get_item_type" callback function. the virtual function pointer for g_list_model_get_item_type()

func (*ListModelInterface) OverrideGetNItems

func (x *ListModelInterface) OverrideGetNItems(cb func(ListModel) uint)

OverrideGetNItems sets the "get_n_items" callback function. the virtual function pointer for g_list_model_get_n_items()

type ListStore

type ListStore struct {
	gobject.Object
}

`GListStore` is a simple implementation of [iface@Gio.ListModel] that stores all items in memory.

It provides insertions, deletions, and lookups in logarithmic time with a fast path for the common case of iterating the list linearly.

func ListStoreNewFromInternalPtr

func ListStoreNewFromInternalPtr(ptr uintptr) *ListStore

func NewListStore

func NewListStore(ItemTypeVar types.GType) *ListStore

Creates a new #GListStore with items of type @item_type. @item_type must be a subclass of #GObject.

func (*ListStore) Append

func (x *ListStore) Append(ItemVar *gobject.Object)

Appends @item to @store. @item must be of type #GListStore:item-type.

This function takes a ref on @item.

Use g_list_store_splice() to append multiple items at the same time efficiently.

func (*ListStore) Find

func (x *ListStore) Find(ItemVar *gobject.Object, PositionVar *uint) bool

Looks up the given @item in the list store by looping over the items until the first occurrence of @item. If @item was not found, then @position will not be set, and this method will return %FALSE.

If you need to compare the two items with a custom comparison function, use g_list_store_find_with_equal_func() with a custom #GEqualFunc instead.

func (*ListStore) FindWithEqualFunc

func (x *ListStore) FindWithEqualFunc(ItemVar *gobject.Object, EqualFuncVar *glib.EqualFunc, PositionVar *uint) bool

Looks up the given @item in the list store by looping over the items and comparing them with @equal_func until the first occurrence of @item which matches. If @item was not found, then @position will not be set, and this method will return %FALSE.

@item is always passed as second parameter to @equal_func.

Since GLib 2.76 it is possible to pass `NULL` for @item.

func (*ListStore) FindWithEqualFuncFull

func (x *ListStore) FindWithEqualFuncFull(ItemVar *gobject.Object, EqualFuncVar *glib.EqualFuncFull, UserDataVar uintptr, PositionVar *uint) bool

Like g_list_store_find_with_equal_func() but with an additional @user_data that is passed to @equal_func.

@item is always passed as second parameter to @equal_func.

Since GLib 2.76 it is possible to pass `NULL` for @item.

func (*ListStore) GetItem

func (x *ListStore) GetItem(PositionVar uint) uintptr

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 also: g_list_model_get_n_items()

func (*ListStore) GetItemType

func (x *ListStore) GetItemType() types.GType

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.

func (*ListStore) GetNItems

func (x *ListStore) GetNItems() uint

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.

func (*ListStore) GetObject

func (x *ListStore) GetObject(PositionVar uint) *gobject.Object

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()

func (*ListStore) GetPropertyNItems

func (x *ListStore) GetPropertyNItems() uint

GetPropertyNItems gets the "n-items" property. The number of items contained in this list store.

func (*ListStore) GoPointer

func (c *ListStore) GoPointer() uintptr

func (*ListStore) Insert

func (x *ListStore) Insert(PositionVar uint, ItemVar *gobject.Object)

Inserts @item into @store at @position. @item must be of type #GListStore:item-type or derived from it. @position must be smaller than the length of the list, or equal to it to append.

This function takes a ref on @item.

Use g_list_store_splice() to insert multiple items at the same time efficiently.

func (*ListStore) InsertSorted

func (x *ListStore) InsertSorted(ItemVar *gobject.Object, CompareFuncVar *glib.CompareDataFunc, UserDataVar uintptr) uint

Inserts @item into @store at a position to be determined by the @compare_func.

The list must already be sorted before calling this function or the result is undefined. Usually you would approach this by only ever inserting items by way of this function.

This function takes a ref on @item.

func (*ListStore) ItemsChanged

func (x *ListStore) ItemsChanged(PositionVar uint, RemovedVar uint, AddedVar uint)

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.

func (*ListStore) Remove

func (x *ListStore) Remove(PositionVar uint)

Removes the item from @store that is at @position. @position must be smaller than the current length of the list.

Use g_list_store_splice() to remove multiple items at the same time efficiently.

func (*ListStore) RemoveAll

func (x *ListStore) RemoveAll()

Removes all items from @store.

func (*ListStore) SetGoPointer

func (c *ListStore) SetGoPointer(ptr uintptr)

func (*ListStore) Sort

func (x *ListStore) Sort(CompareFuncVar *glib.CompareDataFunc, UserDataVar uintptr)

Sort the items in @store according to @compare_func.

func (*ListStore) Splice

func (x *ListStore) Splice(PositionVar uint, NRemovalsVar uint, AdditionsVar []gobject.Object, NAdditionsVar uint)

Changes @store by removing @n_removals items and adding @n_additions items to it. @additions must contain @n_additions items of type #GListStore:item-type. %NULL is not permitted.

This function is more efficient than g_list_store_insert() and g_list_store_remove(), because it only emits #GListModel::items-changed once for the change.

This function takes a ref on each item in @additions.

The parameters @position and @n_removals must be correct (ie: @position + @n_removals must be less than or equal to the length of the list at the time this function is called).

type ListStoreClass

type ListStoreClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*ListStoreClass) GoPointer

func (x *ListStoreClass) GoPointer() uintptr

type LoadableIcon

type LoadableIcon interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	Load(SizeVar int, TypeVar *string, CancellableVar *Cancellable) (*InputStream, error)
	LoadAsync(SizeVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	LoadFinish(ResVar AsyncResult, TypeVar *string) (*InputStream, error)
}

`GLoadableIcon` extends the [iface@Gio.Icon] interface and adds the ability to load icons from streams.

type LoadableIconBase

type LoadableIconBase struct {
	Ptr uintptr
}

func (*LoadableIconBase) GoPointer

func (x *LoadableIconBase) GoPointer() uintptr

func (*LoadableIconBase) Load

func (x *LoadableIconBase) Load(SizeVar int, TypeVar *string, CancellableVar *Cancellable) (*InputStream, error)

Loads a loadable icon. For the asynchronous version of this function, see g_loadable_icon_load_async().

func (*LoadableIconBase) LoadAsync

func (x *LoadableIconBase) LoadAsync(SizeVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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().

func (*LoadableIconBase) LoadFinish

func (x *LoadableIconBase) LoadFinish(ResVar AsyncResult, TypeVar *string) (*InputStream, error)

Finishes an asynchronous icon load started in g_loadable_icon_load_async().

func (*LoadableIconBase) SetGoPointer

func (x *LoadableIconBase) SetGoPointer(ptr uintptr)

type LoadableIconIface

type LoadableIconIface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

Interface for icons that can be loaded as a stream.

func (*LoadableIconIface) GetLoad

GetLoad gets the "load" callback function. Loads an icon.

func (*LoadableIconIface) GetLoadAsync

GetLoadAsync gets the "load_async" callback function. Loads an icon asynchronously.

func (*LoadableIconIface) GetLoadFinish

func (x *LoadableIconIface) GetLoadFinish() func(LoadableIcon, AsyncResult, *string) *InputStream

GetLoadFinish gets the "load_finish" callback function. Finishes an asynchronous icon load.

func (*LoadableIconIface) GoPointer

func (x *LoadableIconIface) GoPointer() uintptr

func (*LoadableIconIface) OverrideLoad

func (x *LoadableIconIface) OverrideLoad(cb func(LoadableIcon, int, *string, *Cancellable) *InputStream)

OverrideLoad sets the "load" callback function. Loads an icon.

func (*LoadableIconIface) OverrideLoadAsync

func (x *LoadableIconIface) OverrideLoadAsync(cb func(LoadableIcon, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideLoadAsync sets the "load_async" callback function. Loads an icon asynchronously.

func (*LoadableIconIface) OverrideLoadFinish

func (x *LoadableIconIface) OverrideLoadFinish(cb func(LoadableIcon, AsyncResult, *string) *InputStream)

OverrideLoadFinish sets the "load_finish" callback function. Finishes an asynchronous icon load.

type MemoryInputStream

type MemoryInputStream struct {
	InputStream
}

`GMemoryInputStream` is a class for using arbitrary memory chunks as input for GIO streaming input operations.

As of GLib 2.34, `GMemoryInputStream` implements [iface@Gio.PollableInputStream].

func MemoryInputStreamNewFromInternalPtr

func MemoryInputStreamNewFromInternalPtr(ptr uintptr) *MemoryInputStream

func NewMemoryInputStream

func NewMemoryInputStream() *MemoryInputStream

Creates a new empty #GMemoryInputStream.

func NewMemoryInputStreamFromBytes

func NewMemoryInputStreamFromBytes(BytesVar *glib.Bytes) *MemoryInputStream

Creates a new #GMemoryInputStream with data from the given @bytes.

func NewMemoryInputStreamFromData

func NewMemoryInputStreamFromData(DataVar []byte, LenVar int, DestroyVar *glib.DestroyNotify) *MemoryInputStream

Creates a new #GMemoryInputStream with data in memory of a given size.

func (*MemoryInputStream) AddBytes

func (x *MemoryInputStream) AddBytes(BytesVar *glib.Bytes)

Appends @bytes to data that can be read from the input stream.

func (*MemoryInputStream) AddData

func (x *MemoryInputStream) AddData(DataVar []byte, LenVar int, DestroyVar *glib.DestroyNotify)

Appends @data to data that can be read from the input stream

func (*MemoryInputStream) CanPoll

func (x *MemoryInputStream) CanPoll() bool

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.

func (*MemoryInputStream) CanSeek

func (x *MemoryInputStream) CanSeek() bool

Tests if the stream supports the #GSeekableIface.

func (*MemoryInputStream) CanTruncate

func (x *MemoryInputStream) CanTruncate() bool

Tests if the length of the stream can be adjusted with g_seekable_truncate().

func (*MemoryInputStream) CreateSource

func (x *MemoryInputStream) CreateSource(CancellableVar *Cancellable) *glib.Source

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.

func (*MemoryInputStream) GoPointer

func (c *MemoryInputStream) GoPointer() uintptr

func (*MemoryInputStream) IsReadable

func (x *MemoryInputStream) IsReadable() bool

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.

func (*MemoryInputStream) ReadNonblocking

func (x *MemoryInputStream) ReadNonblocking(BufferVar *[]byte, CountVar uint, CancellableVar *Cancellable) (int, error)

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.

func (*MemoryInputStream) Seek

func (x *MemoryInputStream) Seek(OffsetVar int64, TypeVar glib.SeekType, CancellableVar *Cancellable) (bool, error)

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.

func (*MemoryInputStream) SetGoPointer

func (c *MemoryInputStream) SetGoPointer(ptr uintptr)

func (*MemoryInputStream) Tell

func (x *MemoryInputStream) Tell() int64

Tells the current position within the stream.

func (*MemoryInputStream) Truncate

func (x *MemoryInputStream) Truncate(OffsetVar int64, CancellableVar *Cancellable) (bool, error)

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.

type MemoryInputStreamClass

type MemoryInputStreamClass struct {
	ParentClass InputStreamClass
	// contains filtered or unexported fields
}

func (*MemoryInputStreamClass) GetGReserved1

func (x *MemoryInputStreamClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*MemoryInputStreamClass) GetGReserved2

func (x *MemoryInputStreamClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*MemoryInputStreamClass) GetGReserved3

func (x *MemoryInputStreamClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*MemoryInputStreamClass) GetGReserved4

func (x *MemoryInputStreamClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*MemoryInputStreamClass) GetGReserved5

func (x *MemoryInputStreamClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*MemoryInputStreamClass) GoPointer

func (x *MemoryInputStreamClass) GoPointer() uintptr

func (*MemoryInputStreamClass) OverrideGReserved1

func (x *MemoryInputStreamClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*MemoryInputStreamClass) OverrideGReserved2

func (x *MemoryInputStreamClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*MemoryInputStreamClass) OverrideGReserved3

func (x *MemoryInputStreamClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*MemoryInputStreamClass) OverrideGReserved4

func (x *MemoryInputStreamClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*MemoryInputStreamClass) OverrideGReserved5

func (x *MemoryInputStreamClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

type MemoryInputStreamPrivate

type MemoryInputStreamPrivate struct {
	// contains filtered or unexported fields
}

func (*MemoryInputStreamPrivate) GoPointer

func (x *MemoryInputStreamPrivate) GoPointer() uintptr

type MemoryMonitor

type MemoryMonitor interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
}

`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(3)) 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 [type@Gio.MemoryMonitorWarningLevel] 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 [signal@Gio.MemoryMonitor::low-memory-warning] signal, and unref the `GMemoryMonitor` itself when exiting.

type MemoryMonitorBase

type MemoryMonitorBase struct {
	Ptr uintptr
}

func MemoryMonitorDupDefault

func MemoryMonitorDupDefault() *MemoryMonitorBase

Gets a reference to the default #GMemoryMonitor for the system.

func (*MemoryMonitorBase) GoPointer

func (x *MemoryMonitorBase) GoPointer() uintptr

func (*MemoryMonitorBase) SetGoPointer

func (x *MemoryMonitorBase) SetGoPointer(ptr uintptr)

type MemoryMonitorInterface

type MemoryMonitorInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

The virtual function table for #GMemoryMonitor.

func (*MemoryMonitorInterface) GetLowMemoryWarning

func (x *MemoryMonitorInterface) GetLowMemoryWarning() func(MemoryMonitor, MemoryMonitorWarningLevel)

GetLowMemoryWarning gets the "low_memory_warning" callback function. the virtual function pointer for the

#GMemoryMonitor::low-memory-warning signal.

func (*MemoryMonitorInterface) GoPointer

func (x *MemoryMonitorInterface) GoPointer() uintptr

func (*MemoryMonitorInterface) OverrideLowMemoryWarning

func (x *MemoryMonitorInterface) OverrideLowMemoryWarning(cb func(MemoryMonitor, MemoryMonitorWarningLevel))

OverrideLowMemoryWarning sets the "low_memory_warning" callback function. the virtual function pointer for the

#GMemoryMonitor::low-memory-warning signal.

type MemoryMonitorWarningLevel

type MemoryMonitorWarningLevel int

Memory availability warning levels.

Note that because new values might be added, it is recommended that applications check #GMemoryMonitorWarningLevel as ranges, for example: |[<!-- language="C" --> if (warning_level > G_MEMORY_MONITOR_WARNING_LEVEL_LOW)

drop_caches ();

]|

const (

	// Memory on the device is low, processes
	//   should free up unneeded resources (for example, in-memory caches) so they can
	//   be used elsewhere.
	GMemoryMonitorWarningLevelLowValue MemoryMonitorWarningLevel = 50
	// 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.
	GMemoryMonitorWarningLevelMediumValue MemoryMonitorWarningLevel = 100
	// The system will soon start terminating
	//   processes to reclaim memory, including background processes.
	GMemoryMonitorWarningLevelCriticalValue MemoryMonitorWarningLevel = 255
)

type MemoryOutputStream

type MemoryOutputStream struct {
	OutputStream
}

`GMemoryOutputStream` is a class for using arbitrary memory chunks as output for GIO streaming output operations.

As of GLib 2.34, `GMemoryOutputStream` trivially implements [iface@Gio.PollableOutputStream]: it always polls as ready.

func MemoryOutputStreamNewFromInternalPtr

func MemoryOutputStreamNewFromInternalPtr(ptr uintptr) *MemoryOutputStream

func NewMemoryOutputStream

func NewMemoryOutputStream(DataVar uintptr, SizeVar uint, ReallocFunctionVar *ReallocFunc, DestroyFunctionVar *glib.DestroyNotify) *MemoryOutputStream

Creates a new #GMemoryOutputStream.

In most cases this is not the function you want. See g_memory_output_stream_new_resizable() instead.

If @data is non-%NULL, the stream will use that for its internal storage.

If @realloc_fn is non-%NULL, it will be used for resizing the internal storage when necessary and the stream will be considered resizable. In that case, the stream will start out being (conceptually) empty. @size is used only as a hint for how big @data is. Specifically, seeking to the end of a newly-created stream will seek to zero, not @size. Seeking past the end of the stream and then writing will introduce a zero-filled gap.

If @realloc_fn is %NULL then the stream is fixed-sized. Seeking to the end will seek to @size exactly. Writing past the end will give an 'out of space' error. Attempting to seek past the end will fail. Unlike the resizable case, seeking to an offset within the stream and writing will preserve the bytes passed in as @data before that point and will return them as part of g_memory_output_stream_steal_data(). If you intend to seek you should probably therefore ensure that @data is properly initialised.

It is probably only meaningful to provide @data and @size in the case that you want a fixed-sized stream. Put another way: if @realloc_fn is non-%NULL then it makes most sense to give @data as %NULL and @size as 0 (allowing #GMemoryOutputStream to do the initial allocation for itself).

|[<!-- language="C" --> // a stream that can grow stream = g_memory_output_stream_new (NULL, 0, realloc, free);

// another stream that can grow stream2 = g_memory_output_stream_new (NULL, 0, g_realloc, g_free);

// a fixed-size stream data = malloc (200); stream3 = g_memory_output_stream_new (data, 200, NULL, free); ]|

func NewMemoryOutputStreamResizable

func NewMemoryOutputStreamResizable() *MemoryOutputStream

Creates a new #GMemoryOutputStream, using g_realloc() and g_free() for memory allocation.

func (*MemoryOutputStream) CanPoll

func (x *MemoryOutputStream) CanPoll() bool

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.

func (*MemoryOutputStream) CanSeek

func (x *MemoryOutputStream) CanSeek() bool

Tests if the stream supports the #GSeekableIface.

func (*MemoryOutputStream) CanTruncate

func (x *MemoryOutputStream) CanTruncate() bool

Tests if the length of the stream can be adjusted with g_seekable_truncate().

func (*MemoryOutputStream) CreateSource

func (x *MemoryOutputStream) CreateSource(CancellableVar *Cancellable) *glib.Source

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.

func (*MemoryOutputStream) GetData

func (x *MemoryOutputStream) GetData() uintptr

Gets any loaded data from the @ostream.

Note that the returned pointer may become invalid on the next write or truncate operation on the stream.

func (*MemoryOutputStream) GetDataSize

func (x *MemoryOutputStream) GetDataSize() uint

Returns the number of bytes from the start up to including the last byte written in the stream that has not been truncated away.

func (*MemoryOutputStream) GetPropertyData

func (x *MemoryOutputStream) GetPropertyData() uintptr

GetPropertyData gets the "data" property. Pointer to buffer where data will be written.

func (*MemoryOutputStream) GetPropertyDataSize

func (x *MemoryOutputStream) GetPropertyDataSize() uint

GetPropertyDataSize gets the "data-size" property. Size of data written to the buffer.

func (*MemoryOutputStream) GetPropertyDestroyFunction

func (x *MemoryOutputStream) GetPropertyDestroyFunction() uintptr

GetPropertyDestroyFunction gets the "destroy-function" property. Function called with the buffer as argument when the stream is destroyed.

func (*MemoryOutputStream) GetPropertyReallocFunction

func (x *MemoryOutputStream) GetPropertyReallocFunction() uintptr

GetPropertyReallocFunction gets the "realloc-function" property. Function with realloc semantics called to enlarge the buffer.

func (*MemoryOutputStream) GetPropertySize

func (x *MemoryOutputStream) GetPropertySize() uint

GetPropertySize gets the "size" property. Current size of the data buffer.

func (*MemoryOutputStream) GetSize

func (x *MemoryOutputStream) GetSize() uint

Gets the size of the currently allocated data area (available from g_memory_output_stream_get_data()).

You probably don't want to use this function on resizable streams. See g_memory_output_stream_get_data_size() instead. For resizable streams the size returned by this function is an implementation detail and may be change at any time in response to operations on the stream.

If the stream is fixed-sized (ie: no realloc was passed to g_memory_output_stream_new()) then this is the maximum size of the stream and further writes will return %G_IO_ERROR_NO_SPACE.

In any case, if you want the number of bytes currently written to the stream, use g_memory_output_stream_get_data_size().

func (*MemoryOutputStream) GoPointer

func (c *MemoryOutputStream) GoPointer() uintptr

func (*MemoryOutputStream) IsWritable

func (x *MemoryOutputStream) IsWritable() bool

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.

func (*MemoryOutputStream) Seek

func (x *MemoryOutputStream) Seek(OffsetVar int64, TypeVar glib.SeekType, CancellableVar *Cancellable) (bool, error)

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.

func (*MemoryOutputStream) SetGoPointer

func (c *MemoryOutputStream) SetGoPointer(ptr uintptr)

func (*MemoryOutputStream) SetPropertyData

func (x *MemoryOutputStream) SetPropertyData(value uintptr)

SetPropertyData sets the "data" property. Pointer to buffer where data will be written.

func (*MemoryOutputStream) SetPropertyDestroyFunction

func (x *MemoryOutputStream) SetPropertyDestroyFunction(value uintptr)

SetPropertyDestroyFunction sets the "destroy-function" property. Function called with the buffer as argument when the stream is destroyed.

func (*MemoryOutputStream) SetPropertyReallocFunction

func (x *MemoryOutputStream) SetPropertyReallocFunction(value uintptr)

SetPropertyReallocFunction sets the "realloc-function" property. Function with realloc semantics called to enlarge the buffer.

func (*MemoryOutputStream) SetPropertySize

func (x *MemoryOutputStream) SetPropertySize(value uint)

SetPropertySize sets the "size" property. Current size of the data buffer.

func (*MemoryOutputStream) StealAsBytes

func (x *MemoryOutputStream) StealAsBytes() *glib.Bytes

Returns data from the @ostream as a #GBytes. @ostream must be closed before calling this function.

func (*MemoryOutputStream) StealData

func (x *MemoryOutputStream) StealData() uintptr

Gets any loaded data from the @ostream. Ownership of the data is transferred to the caller; when no longer needed it must be freed using the free function set in @ostream's #GMemoryOutputStream:destroy-function property.

@ostream must be closed before calling this function.

func (*MemoryOutputStream) Tell

func (x *MemoryOutputStream) Tell() int64

Tells the current position within the stream.

func (*MemoryOutputStream) Truncate

func (x *MemoryOutputStream) Truncate(OffsetVar int64, CancellableVar *Cancellable) (bool, error)

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.

func (*MemoryOutputStream) WriteNonblocking

func (x *MemoryOutputStream) WriteNonblocking(BufferVar []byte, CountVar uint, CancellableVar *Cancellable) (int, error)

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.

func (*MemoryOutputStream) WritevNonblocking

func (x *MemoryOutputStream) WritevNonblocking(VectorsVar []OutputVector, NVectorsVar uint, BytesWrittenVar *uint, CancellableVar *Cancellable) (PollableReturn, error)

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.

type MemoryOutputStreamClass

type MemoryOutputStreamClass struct {
	ParentClass OutputStreamClass
	// contains filtered or unexported fields
}

func (*MemoryOutputStreamClass) GetGReserved1

func (x *MemoryOutputStreamClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*MemoryOutputStreamClass) GetGReserved2

func (x *MemoryOutputStreamClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*MemoryOutputStreamClass) GetGReserved3

func (x *MemoryOutputStreamClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*MemoryOutputStreamClass) GetGReserved4

func (x *MemoryOutputStreamClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*MemoryOutputStreamClass) GetGReserved5

func (x *MemoryOutputStreamClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*MemoryOutputStreamClass) GoPointer

func (x *MemoryOutputStreamClass) GoPointer() uintptr

func (*MemoryOutputStreamClass) OverrideGReserved1

func (x *MemoryOutputStreamClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*MemoryOutputStreamClass) OverrideGReserved2

func (x *MemoryOutputStreamClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*MemoryOutputStreamClass) OverrideGReserved3

func (x *MemoryOutputStreamClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*MemoryOutputStreamClass) OverrideGReserved4

func (x *MemoryOutputStreamClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*MemoryOutputStreamClass) OverrideGReserved5

func (x *MemoryOutputStreamClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

type MemoryOutputStreamPrivate

type MemoryOutputStreamPrivate struct {
	// contains filtered or unexported fields
}

func (*MemoryOutputStreamPrivate) GoPointer

func (x *MemoryOutputStreamPrivate) GoPointer() uintptr
type Menu struct {
	MenuModel
}

`GMenu` is a simple implementation of [class@Gio.MenuModel]. You populate a `GMenu` by adding [class@Gio.MenuItem] instances to it.

There are some convenience functions to allow you to directly add items (avoiding [class@Gio.MenuItem]) for the common cases. To add a regular item, use [method@Gio.Menu.insert]. To add a section, use [method@Gio.Menu.insert_section]. To add a submenu, use [method@Gio.Menu.insert_submenu].

func MenuNewFromInternalPtr(ptr uintptr) *Menu

func NewMenu

func NewMenu() *Menu

Creates a new #GMenu.

The new menu has no items.

func (x *Menu) Append(LabelVar *string, DetailedActionVar *string)

Convenience function for appending a normal menu item to the end of @menu. Combine g_menu_item_new() and g_menu_insert_item() for a more flexible alternative.

func (x *Menu) AppendItem(ItemVar *MenuItem)

Appends @item to the end of @menu.

See g_menu_insert_item() for more information.

func (x *Menu) AppendSection(LabelVar *string, SectionVar *MenuModel)

Convenience function for appending a section menu item to the end of @menu. Combine g_menu_item_new_section() and g_menu_insert_item() for a more flexible alternative.

func (x *Menu) AppendSubmenu(LabelVar *string, SubmenuVar *MenuModel)

Convenience function for appending a submenu menu item to the end of @menu. Combine g_menu_item_new_submenu() and g_menu_insert_item() for a more flexible alternative.

func (x *Menu) Freeze()

Marks @menu as frozen.

After the menu is frozen, it is an error to attempt to make any changes to it. In effect this means that the #GMenu API must no longer be used.

This function causes g_menu_model_is_mutable() to begin returning %FALSE, which has some positive performance implications.

func (c *Menu) GoPointer() uintptr
func (x *Menu) Insert(PositionVar int, LabelVar *string, DetailedActionVar *string)

Convenience function for inserting a normal menu item into @menu. Combine g_menu_item_new() and g_menu_insert_item() for a more flexible alternative.

func (x *Menu) InsertItem(PositionVar int, ItemVar *MenuItem)

Inserts @item into @menu.

The "insertion" is actually done by copying all of the attribute and link values of @item and using them to form a new item within @menu. As such, @item itself is not really inserted, but rather, a menu item that is exactly the same as the one presently described by @item.

This means that @item is essentially useless after the insertion occurs. Any changes you make to it are ignored unless it is inserted again (at which point its updated values will be copied).

You should probably just free @item once you're done.

There are many convenience functions to take care of common cases. See g_menu_insert(), g_menu_insert_section() and g_menu_insert_submenu() as well as "prepend" and "append" variants of each of these functions.

func (x *Menu) InsertSection(PositionVar int, LabelVar *string, SectionVar *MenuModel)

Convenience function for inserting a section menu item into @menu. Combine g_menu_item_new_section() and g_menu_insert_item() for a more flexible alternative.

func (x *Menu) InsertSubmenu(PositionVar int, LabelVar *string, SubmenuVar *MenuModel)

Convenience function for inserting a submenu menu item into @menu. Combine g_menu_item_new_submenu() and g_menu_insert_item() for a more flexible alternative.

func (x *Menu) Prepend(LabelVar *string, DetailedActionVar *string)

Convenience function for prepending a normal menu item to the start of @menu. Combine g_menu_item_new() and g_menu_insert_item() for a more flexible alternative.

func (x *Menu) PrependItem(ItemVar *MenuItem)

Prepends @item to the start of @menu.

See g_menu_insert_item() for more information.

func (x *Menu) PrependSection(LabelVar *string, SectionVar *MenuModel)

Convenience function for prepending a section menu item to the start of @menu. Combine g_menu_item_new_section() and g_menu_insert_item() for a more flexible alternative.

func (x *Menu) PrependSubmenu(LabelVar *string, SubmenuVar *MenuModel)

Convenience function for prepending a submenu menu item to the start of @menu. Combine g_menu_item_new_submenu() and g_menu_insert_item() for a more flexible alternative.

func (x *Menu) Remove(PositionVar int)

Removes an item from the menu.

@position gives the index of the item to remove.

It is an error if position is not in range the range from 0 to one less than the number of items in the menu.

It is not possible to remove items by identity since items are added to the menu simply by copying their links and attributes (ie: identity of the item itself is not preserved).

func (x *Menu) RemoveAll()

Removes all items in the menu.

func (c *Menu) SetGoPointer(ptr uintptr)
type MenuAttributeIter struct {
	gobject.Object
}

#GMenuAttributeIter is an opaque structure type. You must access it using the functions below.

func MenuAttributeIterNewFromInternalPtr(ptr uintptr) *MenuAttributeIter
func (x *MenuAttributeIter) GetName() string

Gets the name of the attribute at the current iterator position, as a string.

The iterator is not advanced.

func (x *MenuAttributeIter) GetNext(OutNameVar *string, ValueVar **glib.Variant) bool

This function combines g_menu_attribute_iter_next() with g_menu_attribute_iter_get_name() and g_menu_attribute_iter_get_value().

First the iterator is advanced to the next (possibly first) attribute. If that fails, then %FALSE is returned and there are no other effects.

If successful, @name and @value are set to the name and value of the attribute that has just been advanced to. At this point, g_menu_attribute_iter_get_name() and g_menu_attribute_iter_get_value() will return the same values again.

The value returned in @name remains valid for as long as the iterator remains at the current position. The value returned in @value must be unreffed using g_variant_unref() when it is no longer in use.

func (x *MenuAttributeIter) GetValue() *glib.Variant

Gets the value of the attribute at the current iterator position.

The iterator is not advanced.

func (c *MenuAttributeIter) GoPointer() uintptr
func (x *MenuAttributeIter) Next() bool

Attempts to advance the iterator to the next (possibly first) attribute.

%TRUE is returned on success, or %FALSE if there are no more attributes.

You must call this function when you first acquire the iterator to advance it to the first attribute (and determine if the first attribute exists at all).

func (c *MenuAttributeIter) SetGoPointer(ptr uintptr)
type MenuAttributeIterClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}
func (x *MenuAttributeIterClass) GetGetNext() func(*MenuAttributeIter, *string, **glib.Variant) bool

GetGetNext gets the "get_next" callback function.

func (x *MenuAttributeIterClass) GoPointer() uintptr
func (x *MenuAttributeIterClass) OverrideGetNext(cb func(*MenuAttributeIter, *string, **glib.Variant) bool)

OverrideGetNext sets the "get_next" callback function.

type MenuAttributeIterPrivate struct {
	// contains filtered or unexported fields
}
func (x *MenuAttributeIterPrivate) GoPointer() uintptr
type MenuItem struct {
	gobject.Object
}

#GMenuItem is an opaque structure type. You must access it using the functions below.

func MenuItemNewFromInternalPtr(ptr uintptr) *MenuItem

func NewMenuItem

func NewMenuItem(LabelVar *string, DetailedActionVar *string) *MenuItem

Creates a new #GMenuItem.

If @label is non-%NULL it is used to set the "label" attribute of the new item.

If @detailed_action is non-%NULL it is used to set the "action" and possibly the "target" attribute of the new item. See g_menu_item_set_detailed_action() for more information.

func NewMenuItemFromModel

func NewMenuItemFromModel(ModelVar *MenuModel, ItemIndexVar int) *MenuItem

Creates a #GMenuItem as an exact copy of an existing menu item in a #GMenuModel.

@item_index must be valid (ie: be sure to call g_menu_model_get_n_items() first).

func NewMenuItemSection

func NewMenuItemSection(LabelVar *string, SectionVar *MenuModel) *MenuItem

Creates a new #GMenuItem representing a section.

This is a convenience API around g_menu_item_new() and g_menu_item_set_section().

The effect of having one menu appear as a section of another is exactly as it sounds: the items from @section become a direct part of the menu that @menu_item is added to.

Visual separation is typically displayed between two non-empty sections. If @label is non-%NULL then it will be incorporated into this visual indication. This allows for labeled subsections of a menu.

As a simple example, consider a typical "Edit" menu from a simple program. It probably contains an "Undo" and "Redo" item, followed by a separator, followed by "Cut", "Copy" and "Paste".

This would be accomplished by creating three #GMenu instances. The first would be populated with the "Undo" and "Redo" items, and the second with the "Cut", "Copy" and "Paste" items. The first and second menus would then be added as submenus of the third. In XML format, this would look something like the following: |[ <menu id='edit-menu'>

<section>
  <item label='Undo'/>
  <item label='Redo'/>
</section>
<section>
  <item label='Cut'/>
  <item label='Copy'/>
  <item label='Paste'/>
</section>

</menu> ]|

The following example is exactly equivalent. It is more illustrative of the exact relationship between the menus and items (keeping in mind that the 'link' element defines a new menu that is linked to the containing one). The style of the second example is more verbose and difficult to read (and therefore not recommended except for the purpose of understanding what is really going on). |[ <menu id='edit-menu'>

<item>
  <link name='section'>
    <item label='Undo'/>
    <item label='Redo'/>
  </link>
</item>
<item>
  <link name='section'>
    <item label='Cut'/>
    <item label='Copy'/>
    <item label='Paste'/>
  </link>
</item>

</menu> ]|

func NewMenuItemSubmenu

func NewMenuItemSubmenu(LabelVar *string, SubmenuVar *MenuModel) *MenuItem

Creates a new #GMenuItem representing a submenu.

This is a convenience API around g_menu_item_new() and g_menu_item_set_submenu().

func (x *MenuItem) GetAttribute(AttributeVar string, FormatStringVar string, varArgs ...interface{}) bool

Queries the named @attribute on @menu_item.

If the attribute exists and matches the #GVariantType corresponding to @format_string then @format_string is used to deconstruct the value into the positional parameters and %TRUE is returned.

If the attribute does not exist, or it does exist but has the wrong type, then the positional parameters are ignored and %FALSE is returned.

func (x *MenuItem) GetAttributeValue(AttributeVar string, ExpectedTypeVar *glib.VariantType) *glib.Variant

Queries the named @attribute on @menu_item.

If @expected_type is specified and the attribute does not have this type, %NULL is returned. %NULL is also returned if the attribute simply does not exist.

func (x *MenuItem) GetLink(LinkVar string) *MenuModel

Queries the named @link on @menu_item.

func (c *MenuItem) GoPointer() uintptr
func (x *MenuItem) SetActionAndTarget(ActionVar *string, FormatStringVar *string, varArgs ...interface{})

Sets or unsets the "action" and "target" attributes of @menu_item.

If @action is %NULL then both the "action" and "target" attributes are unset (and @format_string is ignored along with the positional parameters).

If @action is non-%NULL then the "action" attribute is set. @format_string is then inspected. If it is non-%NULL then the proper position parameters are collected to create a #GVariant instance to use as the target value. If it is %NULL then the positional parameters are ignored and the "target" attribute is unset.

See also g_menu_item_set_action_and_target_value() for an equivalent call that directly accepts a #GVariant. See g_menu_item_set_detailed_action() for a more convenient version that works with string-typed targets.

See also g_menu_item_set_action_and_target_value() for a description of the semantics of the action and target attributes.

func (x *MenuItem) SetActionAndTargetValue(ActionVar *string, TargetValueVar *glib.Variant)

Sets or unsets the "action" and "target" attributes of @menu_item.

If @action is %NULL then both the "action" and "target" attributes are unset (and @target_value is ignored).

If @action is non-%NULL then the "action" attribute is set. The "target" attribute is then set to the value of @target_value if it is non-%NULL or unset otherwise.

Normal menu items (ie: not submenu, section or other custom item types) are expected to have the "action" attribute set to identify the action that they are associated with. The state type of the action help to determine the disposition of the menu item. See #GAction and #GActionGroup for an overview of actions.

In general, clicking on the menu item will result in activation of the named action with the "target" attribute given as the parameter to the action invocation. If the "target" attribute is not set then the action is invoked with no parameter.

If the action has no state then the menu item is usually drawn as a plain menu item (ie: with no additional decoration).

If the action has a boolean state then the menu item is usually drawn as a toggle menu item (ie: with a checkmark or equivalent indication). The item should be marked as 'toggled' or 'checked' when the boolean state is %TRUE.

If the action has a string state then the menu item is usually drawn as a radio menu item (ie: with a radio bullet or equivalent indication). The item should be marked as 'selected' when the string state is equal to the value of the @target property.

See g_menu_item_set_action_and_target() or g_menu_item_set_detailed_action() for two equivalent calls that are probably more convenient for most uses.

func (x *MenuItem) SetAttribute(AttributeVar string, FormatStringVar *string, varArgs ...interface{})

Sets or unsets an attribute on @menu_item.

The attribute to set or unset is specified by @attribute. This can be one of the standard attribute names %G_MENU_ATTRIBUTE_LABEL, %G_MENU_ATTRIBUTE_ACTION, %G_MENU_ATTRIBUTE_TARGET, or a custom attribute name. Attribute names are restricted to lowercase characters, numbers and '-'. Furthermore, the names must begin with a lowercase character, must not end with a '-', and must not contain consecutive dashes.

If @format_string is non-%NULL then the proper position parameters are collected to create a #GVariant instance to use as the attribute value. If it is %NULL then the positional parameterrs are ignored and the named attribute is unset.

See also g_menu_item_set_attribute_value() for an equivalent call that directly accepts a #GVariant.

func (x *MenuItem) SetAttributeValue(AttributeVar string, ValueVar *glib.Variant)

Sets or unsets an attribute on @menu_item.

The attribute to set or unset is specified by @attribute. This can be one of the standard attribute names %G_MENU_ATTRIBUTE_LABEL, %G_MENU_ATTRIBUTE_ACTION, %G_MENU_ATTRIBUTE_TARGET, or a custom attribute name. Attribute names are restricted to lowercase characters, numbers and '-'. Furthermore, the names must begin with a lowercase character, must not end with a '-', and must not contain consecutive dashes.

must consist only of lowercase ASCII characters, digits and '-'.

If @value is non-%NULL then it is used as the new value for the attribute. If @value is %NULL then the attribute is unset. If the @value #GVariant is floating, it is consumed.

See also g_menu_item_set_attribute() for a more convenient way to do the same.

func (x *MenuItem) SetDetailedAction(DetailedActionVar string)

Sets the "action" and possibly the "target" attribute of @menu_item.

The format of @detailed_action is the same format parsed by g_action_parse_detailed_name().

See g_menu_item_set_action_and_target() or g_menu_item_set_action_and_target_value() for more flexible (but slightly less convenient) alternatives.

See also g_menu_item_set_action_and_target_value() for a description of the semantics of the action and target attributes.

func (c *MenuItem) SetGoPointer(ptr uintptr)
func (x *MenuItem) SetIcon(IconVar Icon)

Sets (or unsets) the icon on @menu_item.

This call is the same as calling g_icon_serialize() and using the result as the value to g_menu_item_set_attribute_value() for %G_MENU_ATTRIBUTE_ICON.

This API is only intended for use with "noun" menu items; things like bookmarks or applications in an "Open With" menu. Don't use it on menu items corresponding to verbs (eg: stock icons for 'Save' or 'Quit').

If @icon is %NULL then the icon is unset.

func (x *MenuItem) SetLabel(LabelVar *string)

Sets or unsets the "label" attribute of @menu_item.

If @label is non-%NULL it is used as the label for the menu item. If it is %NULL then the label attribute is unset.

func (x *MenuItem) SetLink(LinkVar string, ModelVar *MenuModel)

Creates a link from @menu_item to @model if non-%NULL, or unsets it.

Links are used to establish a relationship between a particular menu item and another menu. For example, %G_MENU_LINK_SUBMENU is used to associate a submenu with a particular menu item, and %G_MENU_LINK_SECTION is used to create a section. Other types of link can be used, but there is no guarantee that clients will be able to make sense of them. Link types are restricted to lowercase characters, numbers and '-'. Furthermore, the names must begin with a lowercase character, must not end with a '-', and must not contain consecutive dashes.

func (x *MenuItem) SetSection(SectionVar *MenuModel)

Sets or unsets the "section" link of @menu_item to @section.

The effect of having one menu appear as a section of another is exactly as it sounds: the items from @section become a direct part of the menu that @menu_item is added to. See g_menu_item_new_section() for more information about what it means for a menu item to be a section.

func (x *MenuItem) SetSubmenu(SubmenuVar *MenuModel)

Sets or unsets the "submenu" link of @menu_item to @submenu.

If @submenu is non-%NULL, it is linked to. If it is %NULL then the link is unset.

The effect of having one menu appear as a submenu of another is exactly as it sounds.

type MenuLinkIter struct {
	gobject.Object
}

#GMenuLinkIter is an opaque structure type. You must access it using the functions below.

func MenuLinkIterNewFromInternalPtr(ptr uintptr) *MenuLinkIter
func (x *MenuLinkIter) GetName() string

Gets the name of the link at the current iterator position.

The iterator is not advanced.

func (x *MenuLinkIter) GetNext(OutLinkVar *string, ValueVar **MenuModel) bool

This function combines g_menu_link_iter_next() with g_menu_link_iter_get_name() and g_menu_link_iter_get_value().

First the iterator is advanced to the next (possibly first) link. If that fails, then %FALSE is returned and there are no other effects.

If successful, @out_link and @value are set to the name and #GMenuModel of the link that has just been advanced to. At this point, g_menu_link_iter_get_name() and g_menu_link_iter_get_value() will return the same values again.

The value returned in @out_link remains valid for as long as the iterator remains at the current position. The value returned in @value must be unreffed using g_object_unref() when it is no longer in use.

func (x *MenuLinkIter) GetValue() *MenuModel

Gets the linked #GMenuModel at the current iterator position.

The iterator is not advanced.

func (c *MenuLinkIter) GoPointer() uintptr
func (x *MenuLinkIter) Next() bool

Attempts to advance the iterator to the next (possibly first) link.

%TRUE is returned on success, or %FALSE if there are no more links.

You must call this function when you first acquire the iterator to advance it to the first link (and determine if the first link exists at all).

func (c *MenuLinkIter) SetGoPointer(ptr uintptr)
type MenuLinkIterClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}
func (x *MenuLinkIterClass) GetGetNext() func(*MenuLinkIter, *string, **MenuModel) bool

GetGetNext gets the "get_next" callback function.

func (x *MenuLinkIterClass) GoPointer() uintptr
func (x *MenuLinkIterClass) OverrideGetNext(cb func(*MenuLinkIter, *string, **MenuModel) bool)

OverrideGetNext sets the "get_next" callback function.

type MenuLinkIterPrivate struct {
	// contains filtered or unexported fields
}
func (x *MenuLinkIterPrivate) GoPointer() uintptr
type MenuModel struct {
	gobject.Object
}

`GMenuModel` represents the contents of a menu — an ordered list of menu items. The items are associated with actions, which can be activated through them. Items can be grouped in sections, and may have submenus associated with them. Both items and sections usually have some representation data, such as labels or icons. The type of the associated action (ie whether it is stateful, and what kind of state it has) can influence the representation of the item.

The conceptual model of menus in `GMenuModel` is hierarchical: sections and submenus are again represented by `GMenuModel`s. Menus themselves do not define their own roles. Rather, the role of a particular `GMenuModel` is defined by the item that references it (or, in the case of the ‘root’ menu, is defined by the context in which it is used).

As an example, consider the visible portions of this menu:

## An example menu

![](menu-example.png)

While this kind of deeply nested menu is no longer considered good UI practice, it serves as a good example of the concepts in `GMenuModel`. There are 8 ‘menus’ visible in the screenshot: one menubar, two submenus and 5 sections:

- the toplevel menubar (containing 4 items) - the View submenu (containing 3 sections) - the first section of the View submenu (containing 2 items) - the second section of the View submenu (containing 1 item) - the final section of the View submenu (containing 1 item) - the Highlight Mode submenu (containing 2 sections) - the Sources section (containing 2 items) - the Markup section (containing 2 items)

The [example](#a-menu-example) illustrates the conceptual connection between these 8 menus. Each large block in the figure represents a menu and the smaller blocks within the large block represent items in that menu. Some items contain references to other menus.

## A menu example

<picture>

<source srcset="menu-model-dark.svg" media="(prefers-color-scheme: dark)">
<img src="menu-model-light.svg" alt="menu model">

</picture>

Notice that the separators visible in the [example](#an-example-menu) appear nowhere in the [menu model](#a-menu-example). This is because separators are not explicitly represented in the menu model. Instead, a separator is inserted between any two non-empty sections of a menu. Section items can have labels just like any other item. In that case, a display system may show a section header instead of a separator.

The motivation for this abstract model of application controls is that modern user interfaces tend to make these controls available outside the application. Examples include global menus, jumplists, dash boards, etc. To support such uses, it is necessary to ‘export’ information about actions and their representation in menus, which is exactly what the action group exporter and the menu model exporter do for [iface@Gio.ActionGroup] and [class@Gio.MenuModel]. The client-side counterparts to make use of the exported information are [class@Gio.DBusActionGroup] and [class@Gio.DBusMenuModel].

The API of `GMenuModel` is very generic, with iterators for the attributes and links of an item, see [method@Gio.MenuModel.iterate_item_attributes] and [method@Gio.MenuModel.iterate_item_links]. The ‘standard’ attributes and link types have predefined names: `G_MENU_ATTRIBUTE_LABEL`, `G_MENU_ATTRIBUTE_ACTION`, `G_MENU_ATTRIBUTE_TARGET`, `G_MENU_LINK_SECTION` and `G_MENU_LINK_SUBMENU`.

Items in a `GMenuModel` represent active controls if they refer to an action that can get activated when the user interacts with the menu item. The reference to the action is encoded by the string ID in the `G_MENU_ATTRIBUTE_ACTION` attribute. An action ID uniquely identifies an action in an action group. Which action group(s) provide actions depends on the context in which the menu model is used. E.g. when the model is exported as the application menu of a [`GtkApplication`](https://docs.gtk.org/gtk4/class.Application.html), actions can be application-wide or window-specific (and thus come from two different action groups). By convention, the application-wide actions have names that start with `app.`, while the names of window-specific actions start with `win.`.

While a wide variety of stateful actions is possible, the following is the minimum that is expected to be supported by all users of exported menu information: - an action with no parameter type and no state - an action with no parameter type and boolean state - an action with string parameter type and string state

## Stateless

A stateless action typically corresponds to an ordinary menu item.

Selecting such a menu item will activate the action (with no parameter).

## Boolean State

An action with a boolean state will most typically be used with a ‘toggle’ or ‘switch’ menu item. The state can be set directly, but activating the action (with no parameter) results in the state being toggled.

Selecting a toggle menu item will activate the action. The menu item should be rendered as ‘checked’ when the state is true.

## String Parameter and State

Actions with string parameters and state will most typically be used to represent an enumerated choice over the items available for a group of radio menu items. Activating the action with a string parameter is equivalent to setting that parameter as the state.

Radio menu items, in addition to being associated with the action, will have a target value. Selecting that menu item will result in activation of the action with the target value as the parameter. The menu item should be rendered as ‘selected’ when the state of the action is equal to the target value of the menu item.

func MenuModelNewFromInternalPtr(ptr uintptr) *MenuModel
func (x *MenuModel) ConnectItemsChanged(cb *func(MenuModel, int, int, int)) uint

Emitted when a change has occurred to the menu.

The only changes that can occur to a menu is that items are removed or added. Items may not change (except by being removed and added back in the same location). This signal is capable of describing both of those changes (at the same time).

The signal means that starting at the index @position, @removed items were removed and @added items were added in their place. If @removed is zero then only items were added. If @added is zero then only items were removed.

As an example, if the menu contains items a, b, c, d (in that order) and the signal (2, 1, 3) occurs then the new composition of the menu will be a, b, \_, \_, \_, d (with each _ representing some new item).

Signal handlers may query the model (particularly the added items) and expect to see the results of the modification that is being reported. The signal is emitted after the modification.

func (x *MenuModel) GetItemAttribute(ItemIndexVar int, AttributeVar string, FormatStringVar string, varArgs ...interface{}) bool

Queries item at position @item_index in @model for the attribute specified by @attribute.

If the attribute exists and matches the #GVariantType corresponding to @format_string then @format_string is used to deconstruct the value into the positional parameters and %TRUE is returned.

If the attribute does not exist, or it does exist but has the wrong type, then the positional parameters are ignored and %FALSE is returned.

This function is a mix of g_menu_model_get_item_attribute_value() and g_variant_get(), followed by a g_variant_unref(). As such, @format_string must make a complete copy of the data (since the #GVariant may go away after the call to g_variant_unref()). In particular, no '&' characters are allowed in @format_string.

func (x *MenuModel) GetItemAttributeValue(ItemIndexVar int, AttributeVar string, ExpectedTypeVar *glib.VariantType) *glib.Variant

Queries the item at position @item_index in @model for the attribute specified by @attribute.

If @expected_type is non-%NULL then it specifies the expected type of the attribute. If it is %NULL then any type will be accepted.

If the attribute exists and matches @expected_type (or if the expected type is unspecified) then the value is returned.

If the attribute does not exist, or does not match the expected type then %NULL is returned.

func (x *MenuModel) GetItemLink(ItemIndexVar int, LinkVar string) *MenuModel

Queries the item at position @item_index in @model for the link specified by @link.

If the link exists, the linked #GMenuModel is returned. If the link does not exist, %NULL is returned.

func (x *MenuModel) GetNItems() int

Query the number of items in @model.

func (c *MenuModel) GoPointer() uintptr
func (x *MenuModel) IsMutable() bool

Queries if @model is mutable.

An immutable #GMenuModel will never emit the #GMenuModel::items-changed signal. Consumers of the model may make optimisations accordingly.

func (x *MenuModel) ItemsChanged(PositionVar int, RemovedVar int, AddedVar int)

Requests emission of the #GMenuModel::items-changed signal on @model.

This function should never be called except by #GMenuModel subclasses. Any other calls to this function will very likely lead to a violation of the interface of the model.

The implementation should update its internal representation of the menu before emitting the signal. The implementation should further expect to receive queries about the new state of the menu (and particularly added menu items) while signal handlers are running.

The implementation must dispatch this call directly from a mainloop entry and not in response to calls -- particularly those from the #GMenuModel API. Said another way: the menu must not change while user code is running without returning to the mainloop.

func (x *MenuModel) IterateItemAttributes(ItemIndexVar int) *MenuAttributeIter

Creates a #GMenuAttributeIter to iterate over the attributes of the item at position @item_index in @model.

You must free the iterator with g_object_unref() when you are done.

func (x *MenuModel) IterateItemLinks(ItemIndexVar int) *MenuLinkIter

Creates a #GMenuLinkIter to iterate over the links of the item at position @item_index in @model.

You must free the iterator with g_object_unref() when you are done.

func (c *MenuModel) SetGoPointer(ptr uintptr)
type MenuModelClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}
func (x *MenuModelClass) GetGetItemAttributeValue() func(*MenuModel, int, string, *glib.VariantType) *glib.Variant

GetGetItemAttributeValue gets the "get_item_attribute_value" callback function.

func (x *MenuModelClass) GetGetItemAttributes() func(*MenuModel, int, **glib.HashTable)

GetGetItemAttributes gets the "get_item_attributes" callback function.

func (x *MenuModelClass) GetGetItemLink() func(*MenuModel, int, string) *MenuModel

GetGetItemLink gets the "get_item_link" callback function.

func (x *MenuModelClass) GetGetItemLinks() func(*MenuModel, int, **glib.HashTable)

GetGetItemLinks gets the "get_item_links" callback function.

func (x *MenuModelClass) GetGetNItems() func(*MenuModel) int

GetGetNItems gets the "get_n_items" callback function.

func (x *MenuModelClass) GetIsMutable() func(*MenuModel) bool

GetIsMutable gets the "is_mutable" callback function.

func (x *MenuModelClass) GetIterateItemAttributes() func(*MenuModel, int) *MenuAttributeIter

GetIterateItemAttributes gets the "iterate_item_attributes" callback function.

func (x *MenuModelClass) GetIterateItemLinks() func(*MenuModel, int) *MenuLinkIter

GetIterateItemLinks gets the "iterate_item_links" callback function.

func (x *MenuModelClass) GoPointer() uintptr
func (x *MenuModelClass) OverrideGetItemAttributeValue(cb func(*MenuModel, int, string, *glib.VariantType) *glib.Variant)

OverrideGetItemAttributeValue sets the "get_item_attribute_value" callback function.

func (x *MenuModelClass) OverrideGetItemAttributes(cb func(*MenuModel, int, **glib.HashTable))

OverrideGetItemAttributes sets the "get_item_attributes" callback function.

func (x *MenuModelClass) OverrideGetItemLink(cb func(*MenuModel, int, string) *MenuModel)

OverrideGetItemLink sets the "get_item_link" callback function.

func (x *MenuModelClass) OverrideGetItemLinks(cb func(*MenuModel, int, **glib.HashTable))

OverrideGetItemLinks sets the "get_item_links" callback function.

func (x *MenuModelClass) OverrideGetNItems(cb func(*MenuModel) int)

OverrideGetNItems sets the "get_n_items" callback function.

func (x *MenuModelClass) OverrideIsMutable(cb func(*MenuModel) bool)

OverrideIsMutable sets the "is_mutable" callback function.

func (x *MenuModelClass) OverrideIterateItemAttributes(cb func(*MenuModel, int) *MenuAttributeIter)

OverrideIterateItemAttributes sets the "iterate_item_attributes" callback function.

func (x *MenuModelClass) OverrideIterateItemLinks(cb func(*MenuModel, int) *MenuLinkIter)

OverrideIterateItemLinks sets the "iterate_item_links" callback function.

type MenuModelPrivate struct {
	// contains filtered or unexported fields
}
func (x *MenuModelPrivate) GoPointer() uintptr

type Mount

type Mount interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	CanEject() bool
	CanUnmount() bool
	Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	EjectFinish(ResultVar AsyncResult) (bool, error)
	EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	EjectWithOperationFinish(ResultVar AsyncResult) (bool, error)
	GetDefaultLocation() *FileBase
	GetDrive() *DriveBase
	GetIcon() *IconBase
	GetName() string
	GetRoot() *FileBase
	GetSortKey() string
	GetSymbolicIcon() *IconBase
	GetUuid() string
	GetVolume() *VolumeBase
	GuessContentType(ForceRescanVar bool, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	GuessContentTypeFinish(ResultVar AsyncResult) ([]string, error)
	GuessContentTypeSync(ForceRescanVar bool, CancellableVar *Cancellable) ([]string, error)
	IsShadowed() bool
	Remount(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	RemountFinish(ResultVar AsyncResult) (bool, error)
	Shadow()
	Unmount(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	UnmountFinish(ResultVar AsyncResult) (bool, error)
	UnmountWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	UnmountWithOperationFinish(ResultVar AsyncResult) (bool, error)
	Unshadow()
}

The `GMount` interface represents a user-visible mount, such as a mounted file system.

`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.

A `GMount` might be associated with a [iface@Gio.Volume] (such as a USB flash drive) which hosts it.

Unmounting a `GMount` instance is an asynchronous operation. For more information about asynchronous operations, see [iface@Gio.AsyncResult] and [class@Gio.Task]. To unmount a `GMount` instance, first call [method@Gio.Mount.unmount_with_operation] with (at least) the `GMount` instance and a [type@Gio.AsyncReadyCallback]. The callback will be fired when the operation has resolved (either with success or failure), and a [iface@Gio.AsyncResult] structure will be passed to the callback. That callback should then call [method@Gio.Mount.unmount_with_operation_finish] with the `GMount` and the [iface@Gio.AsyncResult] data to see if the operation was completed successfully. If an `error` is present when [method@Gio.Mount.unmount_with_operation_finish] is called, then it will be filled with any error information.

Note, when [porting from GnomeVFS](migrating-gnome-vfs.html), `GMount` is the moral equivalent of `GnomeVFSVolume`.

type MountBase

type MountBase struct {
	Ptr uintptr
}

func (*MountBase) CanEject

func (x *MountBase) CanEject() bool

Checks if @mount can be ejected.

func (*MountBase) CanUnmount

func (x *MountBase) CanUnmount() bool

Checks if @mount can be unmounted.

func (*MountBase) Eject

func (x *MountBase) Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*MountBase) EjectFinish

func (x *MountBase) EjectFinish(ResultVar AsyncResult) (bool, error)

Finishes ejecting a mount. If any errors occurred during the operation, @error will be set to contain the errors and %FALSE will be returned.

func (*MountBase) EjectWithOperation

func (x *MountBase) EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*MountBase) EjectWithOperationFinish

func (x *MountBase) EjectWithOperationFinish(ResultVar AsyncResult) (bool, error)

Finishes ejecting a mount. If any errors occurred during the operation, @error will be set to contain the errors and %FALSE will be returned.

func (*MountBase) GetDefaultLocation

func (x *MountBase) GetDefaultLocation() *FileBase

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).

func (*MountBase) GetDrive

func (x *MountBase) GetDrive() *DriveBase

Gets the drive for the @mount.

This is a convenience method for getting the #GVolume and then using that object to get the #GDrive.

func (*MountBase) GetIcon

func (x *MountBase) GetIcon() *IconBase

Gets the icon for @mount.

func (*MountBase) GetName

func (x *MountBase) GetName() string

Gets the name of @mount.

func (*MountBase) GetRoot

func (x *MountBase) GetRoot() *FileBase

Gets the root directory on @mount.

func (*MountBase) GetSortKey

func (x *MountBase) GetSortKey() string

Gets the sort key for @mount, if any.

func (*MountBase) GetSymbolicIcon

func (x *MountBase) GetSymbolicIcon() *IconBase

Gets the symbolic icon for @mount.

func (*MountBase) GetUuid

func (x *MountBase) GetUuid() string

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.

func (*MountBase) GetVolume

func (x *MountBase) GetVolume() *VolumeBase

Gets the volume for the @mount.

func (*MountBase) GoPointer

func (x *MountBase) GoPointer() uintptr

func (*MountBase) GuessContentType

func (x *MountBase) GuessContentType(ForceRescanVar bool, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*MountBase) GuessContentTypeFinish

func (x *MountBase) GuessContentTypeFinish(ResultVar AsyncResult) ([]string, error)

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.

func (*MountBase) GuessContentTypeSync

func (x *MountBase) GuessContentTypeSync(ForceRescanVar bool, CancellableVar *Cancellable) ([]string, error)

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.

func (*MountBase) IsShadowed

func (x *MountBase) IsShadowed() bool

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.

func (*MountBase) Remount

func (x *MountBase) Remount(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*MountBase) RemountFinish

func (x *MountBase) RemountFinish(ResultVar AsyncResult) (bool, error)

Finishes remounting a mount. If any errors occurred during the operation, @error will be set to contain the errors and %FALSE will be returned.

func (*MountBase) SetGoPointer

func (x *MountBase) SetGoPointer(ptr uintptr)

func (*MountBase) Shadow

func (x *MountBase) Shadow()

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.

func (*MountBase) Unmount

func (x *MountBase) Unmount(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*MountBase) UnmountFinish

func (x *MountBase) UnmountFinish(ResultVar AsyncResult) (bool, error)

Finishes unmounting a mount. If any errors occurred during the operation, @error will be set to contain the errors and %FALSE will be returned.

func (*MountBase) UnmountWithOperation

func (x *MountBase) UnmountWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*MountBase) UnmountWithOperationFinish

func (x *MountBase) UnmountWithOperationFinish(ResultVar AsyncResult) (bool, error)

Finishes unmounting a mount. If any errors occurred during the operation, @error will be set to contain the errors and %FALSE will be returned.

func (*MountBase) Unshadow

func (x *MountBase) Unshadow()

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.

type MountIface

type MountIface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

Interface for implementing operations for mounts.

func (*MountIface) GetCanEject

func (x *MountIface) GetCanEject() func(Mount) bool

GetCanEject gets the "can_eject" callback function. Checks if a #GMount can be ejected.

func (*MountIface) GetCanUnmount

func (x *MountIface) GetCanUnmount() func(Mount) bool

GetCanUnmount gets the "can_unmount" callback function. Checks if a #GMount can be unmounted.

func (*MountIface) GetChanged

func (x *MountIface) GetChanged() func(Mount)

GetChanged gets the "changed" callback function. Changed signal that is emitted when the mount's state has changed.

func (*MountIface) GetEject

GetEject gets the "eject" callback function. Starts ejecting a #GMount.

func (*MountIface) GetEjectFinish

func (x *MountIface) GetEjectFinish() func(Mount, AsyncResult) bool

GetEjectFinish gets the "eject_finish" callback function. Finishes an eject operation.

func (*MountIface) GetEjectWithOperation

func (x *MountIface) GetEjectWithOperation() func(Mount, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr)

GetEjectWithOperation gets the "eject_with_operation" callback function. Starts ejecting a #GMount using a #GMountOperation. Since 2.22.

func (*MountIface) GetEjectWithOperationFinish

func (x *MountIface) GetEjectWithOperationFinish() func(Mount, AsyncResult) bool

GetEjectWithOperationFinish gets the "eject_with_operation_finish" callback function. Finishes an eject operation using a #GMountOperation. Since 2.22.

func (*MountIface) GetGetDefaultLocation

func (x *MountIface) GetGetDefaultLocation() func(Mount) *FileBase

GetGetDefaultLocation gets the "get_default_location" callback function. Gets a #GFile indication a start location that can be use as the entry point for this mount. Since 2.24.

func (*MountIface) GetGetDrive

func (x *MountIface) GetGetDrive() func(Mount) *DriveBase

GetGetDrive gets the "get_drive" callback function. Gets a #GDrive the volume of the mount is located on. Returns %NULL if the #GMount is not associated with a #GDrive or a #GVolume. This is convenience method for getting the #GVolume and using that to get the #GDrive.

func (*MountIface) GetGetIcon

func (x *MountIface) GetGetIcon() func(Mount) *IconBase

GetGetIcon gets the "get_icon" callback function. Gets a #GIcon for the #GMount.

func (*MountIface) GetGetName

func (x *MountIface) GetGetName() func(Mount) string

GetGetName gets the "get_name" callback function. Gets a string containing the name of the #GMount.

func (*MountIface) GetGetRoot

func (x *MountIface) GetGetRoot() func(Mount) *FileBase

GetGetRoot gets the "get_root" callback function. Gets a #GFile to the root directory of the #GMount.

func (*MountIface) GetGetSortKey

func (x *MountIface) GetGetSortKey() func(Mount) string

GetGetSortKey gets the "get_sort_key" callback function. Gets a key used for sorting #GMount instance or %NULL if no such key exists. Since 2.32.

func (*MountIface) GetGetSymbolicIcon

func (x *MountIface) GetGetSymbolicIcon() func(Mount) *IconBase

GetGetSymbolicIcon gets the "get_symbolic_icon" callback function. Gets a symbolic #GIcon for the #GMount. Since 2.34.

func (*MountIface) GetGetUuid

func (x *MountIface) GetGetUuid() func(Mount) string

GetGetUuid gets the "get_uuid" callback function. Gets the UUID for the #GMount. 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.

func (*MountIface) GetGetVolume

func (x *MountIface) GetGetVolume() func(Mount) *VolumeBase

GetGetVolume gets the "get_volume" callback function. Gets a #GVolume the mount is located on. Returns %NULL if the #GMount is not associated with a #GVolume.

func (*MountIface) GetGuessContentType

func (x *MountIface) GetGuessContentType() func(Mount, bool, *Cancellable, *AsyncReadyCallback, uintptr)

GetGuessContentType gets the "guess_content_type" callback function. Starts guessing the type of the content of a #GMount.

See g_mount_guess_content_type() for more information on content
type guessing. This operation was added in 2.18.

func (*MountIface) GetGuessContentTypeFinish

func (x *MountIface) GetGuessContentTypeFinish() func(Mount, AsyncResult) []string

GetGuessContentTypeFinish gets the "guess_content_type_finish" callback function. Finishes a content type guessing operation. Added in 2.18.

func (*MountIface) GetGuessContentTypeSync

func (x *MountIface) GetGuessContentTypeSync() func(Mount, bool, *Cancellable) []string

GetGuessContentTypeSync gets the "guess_content_type_sync" callback function. Synchronous variant of @guess_content_type. Added in 2.18

func (*MountIface) GetPreUnmount

func (x *MountIface) GetPreUnmount() func(Mount)

GetPreUnmount gets the "pre_unmount" callback function. The ::pre-unmount signal that is emitted when the #GMount will soon be emitted. If the recipient is somehow holding the mount open by keeping an open file on it it should close the file.

func (*MountIface) GetRemount

GetRemount gets the "remount" callback function. Starts remounting a #GMount.

func (*MountIface) GetRemountFinish

func (x *MountIface) GetRemountFinish() func(Mount, AsyncResult) bool

GetRemountFinish gets the "remount_finish" callback function. Finishes a remounting operation.

func (*MountIface) GetUnmount

GetUnmount gets the "unmount" callback function. Starts unmounting a #GMount.

func (*MountIface) GetUnmountFinish

func (x *MountIface) GetUnmountFinish() func(Mount, AsyncResult) bool

GetUnmountFinish gets the "unmount_finish" callback function. Finishes an unmounting operation.

func (*MountIface) GetUnmountWithOperation

func (x *MountIface) GetUnmountWithOperation() func(Mount, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr)

GetUnmountWithOperation gets the "unmount_with_operation" callback function. Starts unmounting a #GMount using a #GMountOperation. Since 2.22.

func (*MountIface) GetUnmountWithOperationFinish

func (x *MountIface) GetUnmountWithOperationFinish() func(Mount, AsyncResult) bool

GetUnmountWithOperationFinish gets the "unmount_with_operation_finish" callback function. Finishes an unmounting operation using a #GMountOperation. Since 2.22.

func (*MountIface) GetUnmounted

func (x *MountIface) GetUnmounted() func(Mount)

GetUnmounted gets the "unmounted" callback function. The unmounted signal that is emitted when the #GMount have been unmounted. If the recipient is holding references to the object they should release them so the object can be finalized.

func (*MountIface) GoPointer

func (x *MountIface) GoPointer() uintptr

func (*MountIface) OverrideCanEject

func (x *MountIface) OverrideCanEject(cb func(Mount) bool)

OverrideCanEject sets the "can_eject" callback function. Checks if a #GMount can be ejected.

func (*MountIface) OverrideCanUnmount

func (x *MountIface) OverrideCanUnmount(cb func(Mount) bool)

OverrideCanUnmount sets the "can_unmount" callback function. Checks if a #GMount can be unmounted.

func (*MountIface) OverrideChanged

func (x *MountIface) OverrideChanged(cb func(Mount))

OverrideChanged sets the "changed" callback function. Changed signal that is emitted when the mount's state has changed.

func (*MountIface) OverrideEject

func (x *MountIface) OverrideEject(cb func(Mount, MountUnmountFlags, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideEject sets the "eject" callback function. Starts ejecting a #GMount.

func (*MountIface) OverrideEjectFinish

func (x *MountIface) OverrideEjectFinish(cb func(Mount, AsyncResult) bool)

OverrideEjectFinish sets the "eject_finish" callback function. Finishes an eject operation.

func (*MountIface) OverrideEjectWithOperation

func (x *MountIface) OverrideEjectWithOperation(cb func(Mount, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideEjectWithOperation sets the "eject_with_operation" callback function. Starts ejecting a #GMount using a #GMountOperation. Since 2.22.

func (*MountIface) OverrideEjectWithOperationFinish

func (x *MountIface) OverrideEjectWithOperationFinish(cb func(Mount, AsyncResult) bool)

OverrideEjectWithOperationFinish sets the "eject_with_operation_finish" callback function. Finishes an eject operation using a #GMountOperation. Since 2.22.

func (*MountIface) OverrideGetDefaultLocation

func (x *MountIface) OverrideGetDefaultLocation(cb func(Mount) *FileBase)

OverrideGetDefaultLocation sets the "get_default_location" callback function. Gets a #GFile indication a start location that can be use as the entry point for this mount. Since 2.24.

func (*MountIface) OverrideGetDrive

func (x *MountIface) OverrideGetDrive(cb func(Mount) *DriveBase)

OverrideGetDrive sets the "get_drive" callback function. Gets a #GDrive the volume of the mount is located on. Returns %NULL if the #GMount is not associated with a #GDrive or a #GVolume. This is convenience method for getting the #GVolume and using that to get the #GDrive.

func (*MountIface) OverrideGetIcon

func (x *MountIface) OverrideGetIcon(cb func(Mount) *IconBase)

OverrideGetIcon sets the "get_icon" callback function. Gets a #GIcon for the #GMount.

func (*MountIface) OverrideGetName

func (x *MountIface) OverrideGetName(cb func(Mount) string)

OverrideGetName sets the "get_name" callback function. Gets a string containing the name of the #GMount.

func (*MountIface) OverrideGetRoot

func (x *MountIface) OverrideGetRoot(cb func(Mount) *FileBase)

OverrideGetRoot sets the "get_root" callback function. Gets a #GFile to the root directory of the #GMount.

func (*MountIface) OverrideGetSortKey

func (x *MountIface) OverrideGetSortKey(cb func(Mount) string)

OverrideGetSortKey sets the "get_sort_key" callback function. Gets a key used for sorting #GMount instance or %NULL if no such key exists. Since 2.32.

func (*MountIface) OverrideGetSymbolicIcon

func (x *MountIface) OverrideGetSymbolicIcon(cb func(Mount) *IconBase)

OverrideGetSymbolicIcon sets the "get_symbolic_icon" callback function. Gets a symbolic #GIcon for the #GMount. Since 2.34.

func (*MountIface) OverrideGetUuid

func (x *MountIface) OverrideGetUuid(cb func(Mount) string)

OverrideGetUuid sets the "get_uuid" callback function. Gets the UUID for the #GMount. 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.

func (*MountIface) OverrideGetVolume

func (x *MountIface) OverrideGetVolume(cb func(Mount) *VolumeBase)

OverrideGetVolume sets the "get_volume" callback function. Gets a #GVolume the mount is located on. Returns %NULL if the #GMount is not associated with a #GVolume.

func (*MountIface) OverrideGuessContentType

func (x *MountIface) OverrideGuessContentType(cb func(Mount, bool, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideGuessContentType sets the "guess_content_type" callback function. Starts guessing the type of the content of a #GMount.

See g_mount_guess_content_type() for more information on content
type guessing. This operation was added in 2.18.

func (*MountIface) OverrideGuessContentTypeFinish

func (x *MountIface) OverrideGuessContentTypeFinish(cb func(Mount, AsyncResult) []string)

OverrideGuessContentTypeFinish sets the "guess_content_type_finish" callback function. Finishes a content type guessing operation. Added in 2.18.

func (*MountIface) OverrideGuessContentTypeSync

func (x *MountIface) OverrideGuessContentTypeSync(cb func(Mount, bool, *Cancellable) []string)

OverrideGuessContentTypeSync sets the "guess_content_type_sync" callback function. Synchronous variant of @guess_content_type. Added in 2.18

func (*MountIface) OverridePreUnmount

func (x *MountIface) OverridePreUnmount(cb func(Mount))

OverridePreUnmount sets the "pre_unmount" callback function. The ::pre-unmount signal that is emitted when the #GMount will soon be emitted. If the recipient is somehow holding the mount open by keeping an open file on it it should close the file.

func (*MountIface) OverrideRemount

OverrideRemount sets the "remount" callback function. Starts remounting a #GMount.

func (*MountIface) OverrideRemountFinish

func (x *MountIface) OverrideRemountFinish(cb func(Mount, AsyncResult) bool)

OverrideRemountFinish sets the "remount_finish" callback function. Finishes a remounting operation.

func (*MountIface) OverrideUnmount

func (x *MountIface) OverrideUnmount(cb func(Mount, MountUnmountFlags, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideUnmount sets the "unmount" callback function. Starts unmounting a #GMount.

func (*MountIface) OverrideUnmountFinish

func (x *MountIface) OverrideUnmountFinish(cb func(Mount, AsyncResult) bool)

OverrideUnmountFinish sets the "unmount_finish" callback function. Finishes an unmounting operation.

func (*MountIface) OverrideUnmountWithOperation

func (x *MountIface) OverrideUnmountWithOperation(cb func(Mount, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideUnmountWithOperation sets the "unmount_with_operation" callback function. Starts unmounting a #GMount using a #GMountOperation. Since 2.22.

func (*MountIface) OverrideUnmountWithOperationFinish

func (x *MountIface) OverrideUnmountWithOperationFinish(cb func(Mount, AsyncResult) bool)

OverrideUnmountWithOperationFinish sets the "unmount_with_operation_finish" callback function. Finishes an unmounting operation using a #GMountOperation. Since 2.22.

func (*MountIface) OverrideUnmounted

func (x *MountIface) OverrideUnmounted(cb func(Mount))

OverrideUnmounted sets the "unmounted" callback function. The unmounted signal that is emitted when the #GMount have been unmounted. If the recipient is holding references to the object they should release them so the object can be finalized.

type MountMountFlags

type MountMountFlags int

Flags used when mounting a mount.

const (

	// No flags set.
	GMountMountNoneValue MountMountFlags = 0
)

type MountOperation

type MountOperation struct {
	gobject.Object
}

`GMountOperation` provides a mechanism for interacting with the user. It can be used for authenticating mountable operations, such as loop mounting files, hard drive partitions or server locations. It can also be used to ask the user questions or show a list of applications preventing unmount or eject operations from completing.

Note that `GMountOperation` is used for more than just [iface@Gio.Mount] objects – for example it is also used in [method@Gio.Drive.start] and [method@Gio.Drive.stop].

Users should instantiate a subclass of this that implements all the various callbacks to show the required dialogs, such as [`GtkMountOperation`](https://docs.gtk.org/gtk4/class.MountOperation.html). If no user interaction is desired (for example when automounting filesystems at login time), usually `NULL` can be passed, see each method taking a `GMountOperation` for details.

Throughout the API, the term ‘TCRYPT’ is used to mean ‘compatible with TrueCrypt and VeraCrypt’. [TrueCrypt](https://en.wikipedia.org/wiki/TrueCrypt) is a discontinued system for encrypting file containers, partitions or whole disks, typically used with Windows. [VeraCrypt](https://www.veracrypt.fr/) is a maintained fork of TrueCrypt with various improvements and auditing fixes.

func MountOperationNewFromInternalPtr

func MountOperationNewFromInternalPtr(ptr uintptr) *MountOperation

func NewMountOperation

func NewMountOperation() *MountOperation

Creates a new mount operation.

func (*MountOperation) ConnectAborted

func (x *MountOperation) ConnectAborted(cb *func(MountOperation)) uint

Emitted by the backend when e.g. a device becomes unavailable while a mount operation is in progress.

Implementations of GMountOperation should handle this signal by dismissing open password dialogs.

func (*MountOperation) ConnectAskPassword

func (x *MountOperation) ConnectAskPassword(cb *func(MountOperation, string, string, string, AskPasswordFlags)) uint

Emitted when a mount operation asks the user for a password.

If the message contains a line break, the first line should be presented as a heading. For example, it may be used as the primary text in a #GtkMessageDialog.

func (*MountOperation) ConnectAskQuestion

func (x *MountOperation) ConnectAskQuestion(cb *func(MountOperation, string, []string)) uint

Emitted when asking the user a question and gives a list of choices for the user to choose from.

If the message contains a line break, the first line should be presented as a heading. For example, it may be used as the primary text in a #GtkMessageDialog.

func (*MountOperation) ConnectReply

func (x *MountOperation) ConnectReply(cb *func(MountOperation, MountOperationResult)) uint

Emitted when the user has replied to the mount operation.

func (*MountOperation) ConnectShowProcesses

func (x *MountOperation) ConnectShowProcesses(cb *func(MountOperation, string, []glib.Pid, []string)) uint

Emitted when one or more processes are blocking an operation e.g. unmounting/ejecting a #GMount or stopping a #GDrive.

Note that this signal may be emitted several times to update the list of blocking processes as processes close files. The application should only respond with g_mount_operation_reply() to the latest signal (setting #GMountOperation:choice to the choice the user made).

If the message contains a line break, the first line should be presented as a heading. For example, it may be used as the primary text in a #GtkMessageDialog.

func (*MountOperation) ConnectShowUnmountProgress

func (x *MountOperation) ConnectShowUnmountProgress(cb *func(MountOperation, string, int64, int64)) uint

Emitted when an unmount operation has been busy for more than some time (typically 1.5 seconds).

When unmounting or ejecting a volume, the kernel might need to flush pending data in its buffers to the volume stable storage, and this operation can take a considerable amount of time. This signal may be emitted several times as long as the unmount operation is outstanding, and then one last time when the operation is completed, with @bytes_left set to zero.

Implementations of GMountOperation should handle this signal by showing an UI notification, and then dismiss it, or show another notification of completion, when @bytes_left reaches zero.

If the message contains a line break, the first line should be presented as a heading. For example, it may be used as the primary text in a #GtkMessageDialog.

func (*MountOperation) GetAnonymous

func (x *MountOperation) GetAnonymous() bool

Check to see whether the mount operation is being used for an anonymous user.

func (*MountOperation) GetChoice

func (x *MountOperation) GetChoice() int

Gets a choice from the mount operation.

func (*MountOperation) GetDomain

func (x *MountOperation) GetDomain() string

Gets the domain of the mount operation.

func (*MountOperation) GetIsTcryptHiddenVolume

func (x *MountOperation) GetIsTcryptHiddenVolume() bool

Check to see whether the mount operation is being used for a TCRYPT hidden volume.

func (*MountOperation) GetIsTcryptSystemVolume

func (x *MountOperation) GetIsTcryptSystemVolume() bool

Check to see whether the mount operation is being used for a TCRYPT system volume.

func (*MountOperation) GetPassword

func (x *MountOperation) GetPassword() string

Gets a password from the mount operation.

func (*MountOperation) GetPasswordSave

func (x *MountOperation) GetPasswordSave() PasswordSave

Gets the state of saving passwords for the mount operation.

func (*MountOperation) GetPim

func (x *MountOperation) GetPim() uint

Gets a PIM from the mount operation.

func (*MountOperation) GetPropertyAnonymous

func (x *MountOperation) GetPropertyAnonymous() bool

GetPropertyAnonymous gets the "anonymous" property. Whether to use an anonymous user when authenticating.

func (*MountOperation) GetPropertyChoice

func (x *MountOperation) GetPropertyChoice() int

GetPropertyChoice gets the "choice" property. The index of the user's choice when a question is asked during the mount operation. See the #GMountOperation::ask-question signal.

func (*MountOperation) GetPropertyDomain

func (x *MountOperation) GetPropertyDomain() string

GetPropertyDomain gets the "domain" property. The domain to use for the mount operation.

func (*MountOperation) GetPropertyIsTcryptHiddenVolume

func (x *MountOperation) GetPropertyIsTcryptHiddenVolume() bool

GetPropertyIsTcryptHiddenVolume gets the "is-tcrypt-hidden-volume" property. Whether the device to be unlocked is a TCRYPT hidden volume. See [the VeraCrypt documentation](https://www.veracrypt.fr/en/Hidden%20Volume.html).

func (*MountOperation) GetPropertyIsTcryptSystemVolume

func (x *MountOperation) GetPropertyIsTcryptSystemVolume() bool

GetPropertyIsTcryptSystemVolume gets the "is-tcrypt-system-volume" property. Whether the device to be unlocked is a TCRYPT system volume. In this context, a system volume is a volume with a bootloader and operating system installed. This is only supported for Windows operating systems. For further documentation, see [the VeraCrypt documentation](https://www.veracrypt.fr/en/System%20Encryption.html).

func (*MountOperation) GetPropertyPassword

func (x *MountOperation) GetPropertyPassword() string

GetPropertyPassword gets the "password" property. The password that is used for authentication when carrying out the mount operation.

func (*MountOperation) GetPropertyPim

func (x *MountOperation) GetPropertyPim() uint

GetPropertyPim gets the "pim" property. The VeraCrypt PIM value, when unlocking a VeraCrypt volume. See [the VeraCrypt documentation](https://www.veracrypt.fr/en/Personal%20Iterations%20Multiplier%20(PIM).html).

func (*MountOperation) GetPropertyUsername

func (x *MountOperation) GetPropertyUsername() string

GetPropertyUsername gets the "username" property. The user name that is used for authentication when carrying out the mount operation.

func (*MountOperation) GetUsername

func (x *MountOperation) GetUsername() string

Get the user name from the mount operation.

func (*MountOperation) GoPointer

func (c *MountOperation) GoPointer() uintptr

func (*MountOperation) Reply

func (x *MountOperation) Reply(ResultVar MountOperationResult)

Emits the #GMountOperation::reply signal.

func (*MountOperation) SetAnonymous

func (x *MountOperation) SetAnonymous(AnonymousVar bool)

Sets the mount operation to use an anonymous user if @anonymous is %TRUE.

func (*MountOperation) SetChoice

func (x *MountOperation) SetChoice(ChoiceVar int)

Sets a default choice for the mount operation.

func (*MountOperation) SetDomain

func (x *MountOperation) SetDomain(DomainVar *string)

Sets the mount operation's domain.

func (*MountOperation) SetGoPointer

func (c *MountOperation) SetGoPointer(ptr uintptr)

func (*MountOperation) SetIsTcryptHiddenVolume

func (x *MountOperation) SetIsTcryptHiddenVolume(HiddenVolumeVar bool)

Sets the mount operation to use a hidden volume if @hidden_volume is %TRUE.

func (*MountOperation) SetIsTcryptSystemVolume

func (x *MountOperation) SetIsTcryptSystemVolume(SystemVolumeVar bool)

Sets the mount operation to use a system volume if @system_volume is %TRUE.

func (*MountOperation) SetPassword

func (x *MountOperation) SetPassword(PasswordVar *string)

Sets the mount operation's password to @password.

func (*MountOperation) SetPasswordSave

func (x *MountOperation) SetPasswordSave(SaveVar PasswordSave)

Sets the state of saving passwords for the mount operation.

func (*MountOperation) SetPim

func (x *MountOperation) SetPim(PimVar uint)

Sets the mount operation's PIM to @pim.

func (*MountOperation) SetPropertyAnonymous

func (x *MountOperation) SetPropertyAnonymous(value bool)

SetPropertyAnonymous sets the "anonymous" property. Whether to use an anonymous user when authenticating.

func (*MountOperation) SetPropertyChoice

func (x *MountOperation) SetPropertyChoice(value int)

SetPropertyChoice sets the "choice" property. The index of the user's choice when a question is asked during the mount operation. See the #GMountOperation::ask-question signal.

func (*MountOperation) SetPropertyDomain

func (x *MountOperation) SetPropertyDomain(value string)

SetPropertyDomain sets the "domain" property. The domain to use for the mount operation.

func (*MountOperation) SetPropertyIsTcryptHiddenVolume

func (x *MountOperation) SetPropertyIsTcryptHiddenVolume(value bool)

SetPropertyIsTcryptHiddenVolume sets the "is-tcrypt-hidden-volume" property. Whether the device to be unlocked is a TCRYPT hidden volume. See [the VeraCrypt documentation](https://www.veracrypt.fr/en/Hidden%20Volume.html).

func (*MountOperation) SetPropertyIsTcryptSystemVolume

func (x *MountOperation) SetPropertyIsTcryptSystemVolume(value bool)

SetPropertyIsTcryptSystemVolume sets the "is-tcrypt-system-volume" property. Whether the device to be unlocked is a TCRYPT system volume. In this context, a system volume is a volume with a bootloader and operating system installed. This is only supported for Windows operating systems. For further documentation, see [the VeraCrypt documentation](https://www.veracrypt.fr/en/System%20Encryption.html).

func (*MountOperation) SetPropertyPassword

func (x *MountOperation) SetPropertyPassword(value string)

SetPropertyPassword sets the "password" property. The password that is used for authentication when carrying out the mount operation.

func (*MountOperation) SetPropertyPim

func (x *MountOperation) SetPropertyPim(value uint)

SetPropertyPim sets the "pim" property. The VeraCrypt PIM value, when unlocking a VeraCrypt volume. See [the VeraCrypt documentation](https://www.veracrypt.fr/en/Personal%20Iterations%20Multiplier%20(PIM).html).

func (*MountOperation) SetPropertyUsername

func (x *MountOperation) SetPropertyUsername(value string)

SetPropertyUsername sets the "username" property. The user name that is used for authentication when carrying out the mount operation.

func (*MountOperation) SetUsername

func (x *MountOperation) SetUsername(UsernameVar *string)

Sets the user name within @op to @username.

type MountOperationClass

type MountOperationClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*MountOperationClass) GetAborted

func (x *MountOperationClass) GetAborted() func(*MountOperation)

GetAborted gets the "aborted" callback function.

func (*MountOperationClass) GetAskPassword

func (x *MountOperationClass) GetAskPassword() func(*MountOperation, string, string, string, AskPasswordFlags)

GetAskPassword gets the "ask_password" callback function.

func (*MountOperationClass) GetAskQuestion

func (x *MountOperationClass) GetAskQuestion() func(*MountOperation, string, []string)

GetAskQuestion gets the "ask_question" callback function.

func (*MountOperationClass) GetGReserved1

func (x *MountOperationClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*MountOperationClass) GetGReserved2

func (x *MountOperationClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*MountOperationClass) GetGReserved3

func (x *MountOperationClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*MountOperationClass) GetGReserved4

func (x *MountOperationClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*MountOperationClass) GetGReserved5

func (x *MountOperationClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*MountOperationClass) GetGReserved6

func (x *MountOperationClass) GetGReserved6() func()

GetGReserved6 gets the "_g_reserved6" callback function.

func (*MountOperationClass) GetGReserved7

func (x *MountOperationClass) GetGReserved7() func()

GetGReserved7 gets the "_g_reserved7" callback function.

func (*MountOperationClass) GetGReserved8

func (x *MountOperationClass) GetGReserved8() func()

GetGReserved8 gets the "_g_reserved8" callback function.

func (*MountOperationClass) GetGReserved9

func (x *MountOperationClass) GetGReserved9() func()

GetGReserved9 gets the "_g_reserved9" callback function.

func (*MountOperationClass) GetReply

GetReply gets the "reply" callback function.

func (*MountOperationClass) GetShowProcesses

func (x *MountOperationClass) GetShowProcesses() func(*MountOperation, string, []glib.Pid, []string)

GetShowProcesses gets the "show_processes" callback function.

func (*MountOperationClass) GetShowUnmountProgress

func (x *MountOperationClass) GetShowUnmountProgress() func(*MountOperation, string, int64, int64)

GetShowUnmountProgress gets the "show_unmount_progress" callback function.

func (*MountOperationClass) GoPointer

func (x *MountOperationClass) GoPointer() uintptr

func (*MountOperationClass) OverrideAborted

func (x *MountOperationClass) OverrideAborted(cb func(*MountOperation))

OverrideAborted sets the "aborted" callback function.

func (*MountOperationClass) OverrideAskPassword

func (x *MountOperationClass) OverrideAskPassword(cb func(*MountOperation, string, string, string, AskPasswordFlags))

OverrideAskPassword sets the "ask_password" callback function.

func (*MountOperationClass) OverrideAskQuestion

func (x *MountOperationClass) OverrideAskQuestion(cb func(*MountOperation, string, []string))

OverrideAskQuestion sets the "ask_question" callback function.

func (*MountOperationClass) OverrideGReserved1

func (x *MountOperationClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*MountOperationClass) OverrideGReserved2

func (x *MountOperationClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*MountOperationClass) OverrideGReserved3

func (x *MountOperationClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*MountOperationClass) OverrideGReserved4

func (x *MountOperationClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*MountOperationClass) OverrideGReserved5

func (x *MountOperationClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

func (*MountOperationClass) OverrideGReserved6

func (x *MountOperationClass) OverrideGReserved6(cb func())

OverrideGReserved6 sets the "_g_reserved6" callback function.

func (*MountOperationClass) OverrideGReserved7

func (x *MountOperationClass) OverrideGReserved7(cb func())

OverrideGReserved7 sets the "_g_reserved7" callback function.

func (*MountOperationClass) OverrideGReserved8

func (x *MountOperationClass) OverrideGReserved8(cb func())

OverrideGReserved8 sets the "_g_reserved8" callback function.

func (*MountOperationClass) OverrideGReserved9

func (x *MountOperationClass) OverrideGReserved9(cb func())

OverrideGReserved9 sets the "_g_reserved9" callback function.

func (*MountOperationClass) OverrideReply

func (x *MountOperationClass) OverrideReply(cb func(*MountOperation, MountOperationResult))

OverrideReply sets the "reply" callback function.

func (*MountOperationClass) OverrideShowProcesses

func (x *MountOperationClass) OverrideShowProcesses(cb func(*MountOperation, string, []glib.Pid, []string))

OverrideShowProcesses sets the "show_processes" callback function.

func (*MountOperationClass) OverrideShowUnmountProgress

func (x *MountOperationClass) OverrideShowUnmountProgress(cb func(*MountOperation, string, int64, int64))

OverrideShowUnmountProgress sets the "show_unmount_progress" callback function.

type MountOperationPrivate

type MountOperationPrivate struct {
	// contains filtered or unexported fields
}

func (*MountOperationPrivate) GoPointer

func (x *MountOperationPrivate) GoPointer() uintptr

type MountOperationResult

type MountOperationResult int

#GMountOperationResult is returned as a result when a request for information is send by the mounting operation.

const (

	// The request was fulfilled and the
	//     user specified data is now available
	GMountOperationHandledValue MountOperationResult = 0
	// The user requested the mount operation
	//     to be aborted
	GMountOperationAbortedValue MountOperationResult = 1
	// The request was unhandled (i.e. not
	//     implemented)
	GMountOperationUnhandledValue MountOperationResult = 2
)

type MountUnmountFlags

type MountUnmountFlags int

Flags used when an unmounting a mount.

const (

	// No flags set.
	GMountUnmountNoneValue MountUnmountFlags = 0
	// Unmount even if there are outstanding
	//  file operations on the mount.
	GMountUnmountForceValue MountUnmountFlags = 1
)

type NativeSocketAddress

type NativeSocketAddress struct {
	SocketAddress
}

A socket address of some unknown native type.

This corresponds to a general `struct sockaddr` of a type not otherwise handled by GLib.

func NativeSocketAddressNewFromInternalPtr

func NativeSocketAddressNewFromInternalPtr(ptr uintptr) *NativeSocketAddress

func NewNativeSocketAddress

func NewNativeSocketAddress(NativeVar uintptr, LenVar uint) *NativeSocketAddress

Creates a new #GNativeSocketAddress for @native and @len.

func (*NativeSocketAddress) Enumerate

Creates a #GSocketAddressEnumerator for @connectable.

func (*NativeSocketAddress) GoPointer

func (c *NativeSocketAddress) GoPointer() uintptr

func (*NativeSocketAddress) ProxyEnumerate

func (x *NativeSocketAddress) ProxyEnumerate() *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().

func (*NativeSocketAddress) SetGoPointer

func (c *NativeSocketAddress) SetGoPointer(ptr uintptr)

func (*NativeSocketAddress) ToString

func (x *NativeSocketAddress) ToString() string

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.

type NativeSocketAddressClass

type NativeSocketAddressClass struct {
	ParentClass SocketAddressClass
	// contains filtered or unexported fields
}

func (*NativeSocketAddressClass) GoPointer

func (x *NativeSocketAddressClass) GoPointer() uintptr

type NativeSocketAddressPrivate

type NativeSocketAddressPrivate struct {
	// contains filtered or unexported fields
}

func (*NativeSocketAddressPrivate) GoPointer

func (x *NativeSocketAddressPrivate) GoPointer() uintptr

type NativeVolumeMonitor

type NativeVolumeMonitor struct {
	VolumeMonitor
}

func NativeVolumeMonitorNewFromInternalPtr

func NativeVolumeMonitorNewFromInternalPtr(ptr uintptr) *NativeVolumeMonitor

func (*NativeVolumeMonitor) GoPointer

func (c *NativeVolumeMonitor) GoPointer() uintptr

func (*NativeVolumeMonitor) SetGoPointer

func (c *NativeVolumeMonitor) SetGoPointer(ptr uintptr)

type NativeVolumeMonitorClass

type NativeVolumeMonitorClass struct {
	ParentClass VolumeMonitorClass
	// contains filtered or unexported fields
}

func (*NativeVolumeMonitorClass) GetGetMountForMountPath

func (x *NativeVolumeMonitorClass) GetGetMountForMountPath() func(string, *Cancellable) *MountBase

GetGetMountForMountPath gets the "get_mount_for_mount_path" callback function.

func (*NativeVolumeMonitorClass) GoPointer

func (x *NativeVolumeMonitorClass) GoPointer() uintptr

func (*NativeVolumeMonitorClass) OverrideGetMountForMountPath

func (x *NativeVolumeMonitorClass) OverrideGetMountForMountPath(cb func(string, *Cancellable) *MountBase)

OverrideGetMountForMountPath sets the "get_mount_for_mount_path" callback function.

type NetworkAddress

type NetworkAddress struct {
	gobject.Object
}

`GNetworkAddress` provides an easy way to resolve a hostname and then attempt to connect to that host, handling the possibility of multiple IP addresses and multiple address families.

The enumeration results of resolved addresses *may* be cached as long as this object is kept alive which may have unexpected results if alive for too long.

See [iface@Gio.SocketConnectable] for an example of using the connectable interface.

func NetworkAddressNewFromInternalPtr

func NetworkAddressNewFromInternalPtr(ptr uintptr) *NetworkAddress

func NetworkAddressParse

func NetworkAddressParse(HostAndPortVar string, DefaultPortVar uint16) (*NetworkAddress, error)

Creates a new #GSocketConnectable for connecting to the given @hostname and @port. May fail and return %NULL in case parsing @host_and_port fails.

@host_and_port may be in any of a number of recognised formats; an IPv6 address, an IPv4 address, or a domain name (in which case a DNS lookup is performed). Quoting with [] is supported for all address types. A port override may be specified in the usual way with a colon.

If no port is specified in @host_and_port then @default_port will be used as the port number to connect to.

In general, @host_and_port is expected to be provided by the user (allowing them to give the hostname, and a port override if necessary) and @default_port is expected to be provided by the application.

(The port component of @host_and_port can also be specified as a service name rather than as a numeric port, but this functionality is deprecated, because it depends on the contents of /etc/services, which is generally quite sparse on platforms other than Linux.)

func NetworkAddressParseUri

func NetworkAddressParseUri(UriVar string, DefaultPortVar uint16) (*NetworkAddress, error)

Creates a new #GSocketConnectable for connecting to the given @uri. May fail and return %NULL in case parsing @uri fails.

Using this rather than g_network_address_new() or g_network_address_parse() allows #GSocketClient to determine when to use application-specific proxy protocols.

func NewNetworkAddress

func NewNetworkAddress(HostnameVar string, PortVar uint16) *NetworkAddress

Creates a new #GSocketConnectable for connecting to the given @hostname and @port.

Note that depending on the configuration of the machine, a @hostname of `localhost` may refer to the IPv4 loopback address only, or to both IPv4 and IPv6; use g_network_address_new_loopback() to create a #GNetworkAddress that is guaranteed to resolve to both addresses.

func NewNetworkAddressLoopback

func NewNetworkAddressLoopback(PortVar uint16) *NetworkAddress

Creates a new #GSocketConnectable for connecting to the local host over a loopback connection to the given @port. This is intended for use in connecting to local services which may be running on IPv4 or IPv6.

The connectable will return IPv4 and IPv6 loopback addresses, regardless of how the host resolves `localhost`. By contrast, g_network_address_new() will often only return an IPv4 address when resolving `localhost`, and an IPv6 address for `localhost6`.

g_network_address_get_hostname() will always return `localhost` for a #GNetworkAddress created with this constructor.

func (*NetworkAddress) Enumerate

func (x *NetworkAddress) Enumerate() *SocketAddressEnumerator

Creates a #GSocketAddressEnumerator for @connectable.

func (*NetworkAddress) GetHostname

func (x *NetworkAddress) GetHostname() string

Gets @addr's hostname. This might be either UTF-8 or ASCII-encoded, depending on what @addr was created with.

func (*NetworkAddress) GetPort

func (x *NetworkAddress) GetPort() uint16

Gets @addr's port number

func (*NetworkAddress) GetPropertyHostname

func (x *NetworkAddress) GetPropertyHostname() string

GetPropertyHostname gets the "hostname" property. Hostname to resolve.

func (*NetworkAddress) GetPropertyPort

func (x *NetworkAddress) GetPropertyPort() uint

GetPropertyPort gets the "port" property. Network port.

func (*NetworkAddress) GetPropertyScheme

func (x *NetworkAddress) GetPropertyScheme() string

GetPropertyScheme gets the "scheme" property. URI scheme.

func (*NetworkAddress) GetScheme

func (x *NetworkAddress) GetScheme() string

Gets @addr's scheme

func (*NetworkAddress) GoPointer

func (c *NetworkAddress) GoPointer() uintptr

func (*NetworkAddress) ProxyEnumerate

func (x *NetworkAddress) ProxyEnumerate() *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().

func (*NetworkAddress) SetGoPointer

func (c *NetworkAddress) SetGoPointer(ptr uintptr)

func (*NetworkAddress) SetPropertyHostname

func (x *NetworkAddress) SetPropertyHostname(value string)

SetPropertyHostname sets the "hostname" property. Hostname to resolve.

func (*NetworkAddress) SetPropertyPort

func (x *NetworkAddress) SetPropertyPort(value uint)

SetPropertyPort sets the "port" property. Network port.

func (*NetworkAddress) SetPropertyScheme

func (x *NetworkAddress) SetPropertyScheme(value string)

SetPropertyScheme sets the "scheme" property. URI scheme.

func (*NetworkAddress) ToString

func (x *NetworkAddress) ToString() string

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.

type NetworkAddressClass

type NetworkAddressClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*NetworkAddressClass) GoPointer

func (x *NetworkAddressClass) GoPointer() uintptr

type NetworkAddressPrivate

type NetworkAddressPrivate struct {
	// contains filtered or unexported fields
}

func (*NetworkAddressPrivate) GoPointer

func (x *NetworkAddressPrivate) GoPointer() uintptr

type NetworkConnectivity

type NetworkConnectivity int

The host's network connectivity state, as reported by #GNetworkMonitor.

const (

	// The host is not configured with a
	//   route to the Internet; it may or may not be connected to a local
	//   network.
	GNetworkConnectivityLocalValue NetworkConnectivity = 1
	// 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.
	GNetworkConnectivityLimitedValue NetworkConnectivity = 2
	// The host is behind a captive portal and
	//   cannot reach the full Internet.
	GNetworkConnectivityPortalValue NetworkConnectivity = 3
	// The host is connected to a network, and
	//   appears to be able to reach the full Internet.
	GNetworkConnectivityFullValue NetworkConnectivity = 4
)

type NetworkMonitor

type NetworkMonitor interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	CanReach(ConnectableVar SocketConnectable, CancellableVar *Cancellable) (bool, error)
	CanReachAsync(ConnectableVar SocketConnectable, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	CanReachFinish(ResultVar AsyncResult) (bool, error)
	GetConnectivity() NetworkConnectivity
	GetNetworkAvailable() bool
	GetNetworkMetered() bool
}

`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.

type NetworkMonitorBase

type NetworkMonitorBase struct {
	Ptr uintptr
}

func NetworkMonitorGetDefault

func NetworkMonitorGetDefault() *NetworkMonitorBase

Gets the default #GNetworkMonitor for the system.

func (*NetworkMonitorBase) CanReach

func (x *NetworkMonitorBase) CanReach(ConnectableVar SocketConnectable, CancellableVar *Cancellable) (bool, error)

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().

func (*NetworkMonitorBase) CanReachAsync

func (x *NetworkMonitorBase) CanReachAsync(ConnectableVar SocketConnectable, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*NetworkMonitorBase) CanReachFinish

func (x *NetworkMonitorBase) CanReachFinish(ResultVar AsyncResult) (bool, error)

Finishes an async network connectivity test. See g_network_monitor_can_reach_async().

func (*NetworkMonitorBase) GetConnectivity

func (x *NetworkMonitorBase) GetConnectivity() NetworkConnectivity

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.

func (*NetworkMonitorBase) GetNetworkAvailable

func (x *NetworkMonitorBase) GetNetworkAvailable() bool

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.

func (*NetworkMonitorBase) GetNetworkMetered

func (x *NetworkMonitorBase) GetNetworkMetered() bool

Checks if the network is metered. See #GNetworkMonitor:network-metered for more details.

func (*NetworkMonitorBase) GetPropertyNetworkAvailable

func (x *NetworkMonitorBase) GetPropertyNetworkAvailable() bool

GetPropertyNetworkAvailable gets the "network-available" property. 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.

func (*NetworkMonitorBase) GetPropertyNetworkMetered

func (x *NetworkMonitorBase) GetPropertyNetworkMetered() bool

GetPropertyNetworkMetered gets the "network-metered" property. 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.

func (*NetworkMonitorBase) GoPointer

func (x *NetworkMonitorBase) GoPointer() uintptr

func (*NetworkMonitorBase) SetGoPointer

func (x *NetworkMonitorBase) SetGoPointer(ptr uintptr)

type NetworkMonitorInterface

type NetworkMonitorInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

The virtual function table for #GNetworkMonitor.

func (*NetworkMonitorInterface) GetCanReach

GetCanReach gets the "can_reach" callback function. the virtual function pointer for g_network_monitor_can_reach()

func (*NetworkMonitorInterface) GetCanReachAsync

GetCanReachAsync gets the "can_reach_async" callback function. the virtual function pointer for

g_network_monitor_can_reach_async()

func (*NetworkMonitorInterface) GetCanReachFinish

func (x *NetworkMonitorInterface) GetCanReachFinish() func(NetworkMonitor, AsyncResult) bool

GetCanReachFinish gets the "can_reach_finish" callback function. the virtual function pointer for

g_network_monitor_can_reach_finish()

func (*NetworkMonitorInterface) GetNetworkChanged

func (x *NetworkMonitorInterface) GetNetworkChanged() func(NetworkMonitor, bool)

GetNetworkChanged gets the "network_changed" callback function. the virtual function pointer for the

GNetworkMonitor::network-changed signal.

func (*NetworkMonitorInterface) GoPointer

func (x *NetworkMonitorInterface) GoPointer() uintptr

func (*NetworkMonitorInterface) OverrideCanReach

func (x *NetworkMonitorInterface) OverrideCanReach(cb func(NetworkMonitor, SocketConnectable, *Cancellable) bool)

OverrideCanReach sets the "can_reach" callback function. the virtual function pointer for g_network_monitor_can_reach()

func (*NetworkMonitorInterface) OverrideCanReachAsync

OverrideCanReachAsync sets the "can_reach_async" callback function. the virtual function pointer for

g_network_monitor_can_reach_async()

func (*NetworkMonitorInterface) OverrideCanReachFinish

func (x *NetworkMonitorInterface) OverrideCanReachFinish(cb func(NetworkMonitor, AsyncResult) bool)

OverrideCanReachFinish sets the "can_reach_finish" callback function. the virtual function pointer for

g_network_monitor_can_reach_finish()

func (*NetworkMonitorInterface) OverrideNetworkChanged

func (x *NetworkMonitorInterface) OverrideNetworkChanged(cb func(NetworkMonitor, bool))

OverrideNetworkChanged sets the "network_changed" callback function. the virtual function pointer for the

GNetworkMonitor::network-changed signal.

type NetworkService

type NetworkService struct {
	gobject.Object
}

Like [class@Gio.NetworkAddress] does with hostnames, `GNetworkService` provides an easy way to resolve a SRV record, and then attempt to connect to one of the hosts that implements that service, handling service priority/weighting, multiple IP addresses, and multiple address families.

See [struct@Gio.SrvTarget] for more information about SRV records, and see [iface@Gio.SocketConnectable] for an example of using the connectable interface.

func NetworkServiceNewFromInternalPtr

func NetworkServiceNewFromInternalPtr(ptr uintptr) *NetworkService

func NewNetworkService

func NewNetworkService(ServiceVar string, ProtocolVar string, DomainVar string) *NetworkService

Creates a new #GNetworkService representing the given @service, @protocol, and @domain. This will initially be unresolved; use the #GSocketConnectable interface to resolve it.

func (*NetworkService) Enumerate

func (x *NetworkService) Enumerate() *SocketAddressEnumerator

Creates a #GSocketAddressEnumerator for @connectable.

func (*NetworkService) GetDomain

func (x *NetworkService) GetDomain() string

Gets the domain that @srv serves. This might be either UTF-8 or ASCII-encoded, depending on what @srv was created with.

func (*NetworkService) GetPropertyDomain

func (x *NetworkService) GetPropertyDomain() string

GetPropertyDomain gets the "domain" property. Network domain, for example `example.com`.

func (*NetworkService) GetPropertyProtocol

func (x *NetworkService) GetPropertyProtocol() string

GetPropertyProtocol gets the "protocol" property. Network protocol, for example `tcp`.

func (*NetworkService) GetPropertyScheme

func (x *NetworkService) GetPropertyScheme() string

GetPropertyScheme gets the "scheme" property. Network scheme (default is to use service).

func (*NetworkService) GetPropertyService

func (x *NetworkService) GetPropertyService() string

GetPropertyService gets the "service" property. Service name, for example `ldap`.

func (*NetworkService) GetProtocol

func (x *NetworkService) GetProtocol() string

Gets @srv's protocol name (eg, "tcp").

func (*NetworkService) GetScheme

func (x *NetworkService) GetScheme() string

Gets the URI scheme used to resolve proxies. By default, the service name is used as scheme.

func (*NetworkService) GetService

func (x *NetworkService) GetService() string

Gets @srv's service name (eg, "ldap").

func (*NetworkService) GoPointer

func (c *NetworkService) GoPointer() uintptr

func (*NetworkService) ProxyEnumerate

func (x *NetworkService) ProxyEnumerate() *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().

func (*NetworkService) SetGoPointer

func (c *NetworkService) SetGoPointer(ptr uintptr)

func (*NetworkService) SetPropertyDomain

func (x *NetworkService) SetPropertyDomain(value string)

SetPropertyDomain sets the "domain" property. Network domain, for example `example.com`.

func (*NetworkService) SetPropertyProtocol

func (x *NetworkService) SetPropertyProtocol(value string)

SetPropertyProtocol sets the "protocol" property. Network protocol, for example `tcp`.

func (*NetworkService) SetPropertyScheme

func (x *NetworkService) SetPropertyScheme(value string)

SetPropertyScheme sets the "scheme" property. Network scheme (default is to use service).

func (*NetworkService) SetPropertyService

func (x *NetworkService) SetPropertyService(value string)

SetPropertyService sets the "service" property. Service name, for example `ldap`.

func (*NetworkService) SetScheme

func (x *NetworkService) SetScheme(SchemeVar string)

Set's the URI scheme used to resolve proxies. By default, the service name is used as scheme.

func (*NetworkService) ToString

func (x *NetworkService) ToString() string

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.

type NetworkServiceClass

type NetworkServiceClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*NetworkServiceClass) GoPointer

func (x *NetworkServiceClass) GoPointer() uintptr

type NetworkServicePrivate

type NetworkServicePrivate struct {
	// contains filtered or unexported fields
}

func (*NetworkServicePrivate) GoPointer

func (x *NetworkServicePrivate) GoPointer() uintptr

type Notification

type Notification struct {
	gobject.Object
}

`GNotification` is a mechanism for creating a notification to be shown to the user — typically as a pop-up notification presented by the desktop environment shell.

The key difference between `GNotification` and other similar APIs is that, if supported by the desktop environment, notifications sent with `GNotification` will persist after the application has exited, and even across system reboots.

Since the user may click on a notification while the application is not running, applications using `GNotification` should be able to be started as a D-Bus service, using [class@Gio.Application].

In order for `GNotification` to work, the application must have installed a `.desktop` file. For example: ``` [Desktop Entry] Name=Test Application Comment=Description of what Test Application does Exec=gnome-test-application Icon=org.gnome.TestApplication Terminal=false Type=Application Categories=GNOME;GTK;TestApplication Category; StartupNotify=true DBusActivatable=true X-GNOME-UsesNotifications=true ```

The `X-GNOME-UsesNotifications` key indicates to GNOME Control Center that this application uses notifications, so it can be listed in the Control Center’s ‘Notifications’ panel.

The `.desktop` file must be named as `org.gnome.TestApplication.desktop`, where `org.gnome.TestApplication` is the ID passed to [ctor@Gio.Application.new].

User interaction with a notification (either the default action, or buttons) must be associated with actions on the application (ie: `app.` actions). It is not possible to route user interaction through the notification itself, because the object will not exist if the application is autostarted as a result of a notification being clicked.

A notification can be sent with [method@Gio.Application.send_notification].

In Windows, notification actions are unsupported, when sending the notification a warning will be printed if a default action or action buttons were added.

func NewNotification

func NewNotification(TitleVar string) *Notification

Creates a new #GNotification with @title as its title.

After populating @notification with more details, it can be sent to the desktop shell with g_application_send_notification(). Changing any properties after this call will not have any effect until resending @notification.

func NotificationNewFromInternalPtr

func NotificationNewFromInternalPtr(ptr uintptr) *Notification

func (*Notification) AddButton

func (x *Notification) AddButton(LabelVar string, DetailedActionVar string)

Adds a button to @notification that activates the action in @detailed_action when clicked. That action must be an application-wide action (starting with "app."). If @detailed_action contains a target, the action will be activated with that target as its parameter.

See g_action_parse_detailed_name() for a description of the format for @detailed_action.

func (*Notification) AddButtonWithTarget

func (x *Notification) AddButtonWithTarget(LabelVar string, ActionVar string, TargetFormatVar *string, varArgs ...interface{})

Adds a button to @notification that activates @action when clicked. @action must be an application-wide action (it must start with "app.").

If @target_format is given, it is used to collect remaining positional parameters into a #GVariant instance, similar to g_variant_new(). @action will be activated with that #GVariant as its parameter.

func (*Notification) AddButtonWithTargetValue

func (x *Notification) AddButtonWithTargetValue(LabelVar string, ActionVar string, TargetVar *glib.Variant)

Adds a button to @notification that activates @action when clicked. @action must be an application-wide action (it must start with "app.").

If @target is non-%NULL, @action will be activated with @target as its parameter.

func (*Notification) GoPointer

func (c *Notification) GoPointer() uintptr

func (*Notification) SetBody

func (x *Notification) SetBody(BodyVar *string)

Sets the body of @notification to @body.

func (*Notification) SetCategory

func (x *Notification) SetCategory(CategoryVar *string)

Sets the type of @notification to @category. Categories have a main type like `email`, `im` or `device` and can have a detail separated by a `.`, e.g. `im.received` or `email.arrived`. Setting the category helps the notification server to select proper feedback to the user.

Standard categories are [listed in the specification](https://specifications.freedesktop.org/notification-spec/latest/ar01s06.html).

func (*Notification) SetDefaultAction

func (x *Notification) SetDefaultAction(DetailedActionVar string)

Sets the default action of @notification to @detailed_action. This action is activated when the notification is clicked on.

The action in @detailed_action must be an application-wide action (it must start with "app."). If @detailed_action contains a target, the given action will be activated with that target as its parameter. See g_action_parse_detailed_name() for a description of the format for @detailed_action.

When no default action is set, the application that the notification was sent on is activated.

func (*Notification) SetDefaultActionAndTarget

func (x *Notification) SetDefaultActionAndTarget(ActionVar string, TargetFormatVar *string, varArgs ...interface{})

Sets the default action of @notification to @action. This action is activated when the notification is clicked on. It must be an application-wide action (it must start with "app.").

If @target_format is given, it is used to collect remaining positional parameters into a #GVariant instance, similar to g_variant_new(). @action will be activated with that #GVariant as its parameter.

When no default action is set, the application that the notification was sent on is activated.

func (*Notification) SetDefaultActionAndTargetValue

func (x *Notification) SetDefaultActionAndTargetValue(ActionVar string, TargetVar *glib.Variant)

Sets the default action of @notification to @action. This action is activated when the notification is clicked on. It must be an application-wide action (start with "app.").

If @target is non-%NULL, @action will be activated with @target as its parameter. If @target is floating, it will be consumed.

When no default action is set, the application that the notification was sent on is activated.

func (*Notification) SetGoPointer

func (c *Notification) SetGoPointer(ptr uintptr)

func (*Notification) SetIcon

func (x *Notification) SetIcon(IconVar Icon)

Sets the icon of @notification to @icon.

func (*Notification) SetPriority

func (x *Notification) SetPriority(PriorityVar NotificationPriority)

Sets the priority of @notification to @priority. See #GNotificationPriority for possible values.

func (*Notification) SetTitle

func (x *Notification) SetTitle(TitleVar string)

Sets the title of @notification to @title.

func (*Notification) SetUrgent

func (x *Notification) SetUrgent(UrgentVar bool)

Deprecated in favor of g_notification_set_priority().

type NotificationPriority

type NotificationPriority int

Priority levels for #GNotifications.

const (

	// the default priority, to be used for the
	//   majority of notifications (for example email messages, software updates,
	//   completed download/sync operations)
	GNotificationPriorityNormalValue NotificationPriority = 0
	// for notifications that do not require
	//   immediate attention - typically used for contextual background
	//   information, such as contact birthdays or local weather
	GNotificationPriorityLowValue NotificationPriority = 1
	// for events that require more attention,
	//   usually because responses are time-sensitive (for example chat and SMS
	//   messages or alarms)
	GNotificationPriorityHighValue NotificationPriority = 2
	// for urgent notifications, or notifications
	//   that require a response in a short space of time (for example phone calls
	//   or emergency warnings)
	GNotificationPriorityUrgentValue NotificationPriority = 3
)

type OutputMessage

type OutputMessage struct {
	Address *SocketAddress

	Vectors *OutputVector

	NumVectors uint

	BytesSent uint

	ControlMessages uintptr

	NumControlMessages uint
	// contains filtered or unexported fields
}

Structure used for scatter/gather data output when sending multiple messages or packets in one go. You generally pass in an array of #GOutputVectors and the operation will use all the buffers as if they were one buffer.

If @address is %NULL then the message is sent to the default receiver (as previously set by g_socket_connect()).

func (*OutputMessage) GoPointer

func (x *OutputMessage) GoPointer() uintptr

type OutputStream

type OutputStream struct {
	gobject.Object
}

`GOutputStream` is a base class for implementing streaming output.

It has functions to write to a stream ([method@Gio.OutputStream.write]), to close a stream ([method@Gio.OutputStream.close]) and to flush pending writes ([method@Gio.OutputStream.flush]).

To copy the content of an input stream to an output stream without manually handling the reads and writes, use [method@Gio.OutputStream.splice].

See the documentation for [class@Gio.IOStream] for details of thread safety of streaming APIs.

All of these functions have async variants too.

All classes derived from `GOutputStream` *should* implement synchronous writing, splicing, flushing and closing streams, but *may* implement asynchronous versions.

func OutputStreamNewFromInternalPtr

func OutputStreamNewFromInternalPtr(ptr uintptr) *OutputStream

func (*OutputStream) ClearPending

func (x *OutputStream) ClearPending()

Clears the pending flag on @stream.

func (*OutputStream) Close

func (x *OutputStream) Close(CancellableVar *Cancellable) (bool, error)

Closes the stream, releasing resources related to it.

Once the stream is closed, all other operations will return %G_IO_ERROR_CLOSED. Closing a stream multiple times will not return an error.

Closing a stream will automatically flush any outstanding buffers in the stream.

Streams 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.

Some streams might keep the backing store of the stream (e.g. a file descriptor) open after the stream is closed. See the documentation for the individual stream for details.

On failure the first error that happened will be reported, but the close operation will finish as much as possible. A stream that failed to close will still return %G_IO_ERROR_CLOSED for all operations. Still, it is important to check and report the error to the user, otherwise there might be a loss of data as all data might not be written.

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. Cancelling a close will still leave the stream closed, but there some streams can use a faster close that doesn't block to e.g. check errors. On cancellation (as with any error) there is no guarantee that all written data will reach the target.

func (*OutputStream) CloseAsync

func (x *OutputStream) CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Requests an asynchronous close of the stream, releasing resources related to it. When the operation is finished @callback will be called. You can then call g_output_stream_close_finish() to get the result of the operation.

For behaviour details see g_output_stream_close().

The asynchronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all.

func (*OutputStream) CloseFinish

func (x *OutputStream) CloseFinish(ResultVar AsyncResult) (bool, error)

Closes an output stream.

func (*OutputStream) Flush

func (x *OutputStream) Flush(CancellableVar *Cancellable) (bool, error)

Forces a write of all user-space buffered data for the given @stream. Will block during the operation. Closing the stream will implicitly cause a flush.

This function is optional for inherited classes.

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.

func (*OutputStream) FlushAsync

func (x *OutputStream) FlushAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Forces an asynchronous write of all user-space buffered data for the given @stream. For behaviour details see g_output_stream_flush().

When the operation is finished @callback will be called. You can then call g_output_stream_flush_finish() to get the result of the operation.

func (*OutputStream) FlushFinish

func (x *OutputStream) FlushFinish(ResultVar AsyncResult) (bool, error)

Finishes flushing an output stream.

func (*OutputStream) GoPointer

func (c *OutputStream) GoPointer() uintptr

func (*OutputStream) HasPending

func (x *OutputStream) HasPending() bool

Checks if an output stream has pending actions.

func (*OutputStream) IsClosed

func (x *OutputStream) IsClosed() bool

Checks if an output stream has already been closed.

func (*OutputStream) IsClosing

func (x *OutputStream) IsClosing() bool

Checks if an output stream is being closed. This can be used inside e.g. a flush implementation to see if the flush (or other i/o operation) is called from within the closing operation.

func (*OutputStream) Printf

func (x *OutputStream) Printf(BytesWrittenVar *uint, CancellableVar *Cancellable, ErrorVar **glib.Error, FormatVar string, varArgs ...interface{}) bool

This is a utility function around g_output_stream_write_all(). It uses g_strdup_vprintf() to turn @format and @... into a string that is then written to @stream.

See the documentation of g_output_stream_write_all() about the behavior of the actual write operation.

Note that partial writes cannot be properly checked with this function due to the variable length of the written string, if you need precise control over partial write failures, you need to create you own printf()-like wrapper around g_output_stream_write() or g_output_stream_write_all().

func (*OutputStream) SetGoPointer

func (c *OutputStream) SetGoPointer(ptr uintptr)

func (*OutputStream) SetPending

func (x *OutputStream) SetPending() (bool, error)

Sets @stream to have actions pending. If the pending flag is already set or @stream is closed, it will return %FALSE and set @error.

func (*OutputStream) Splice

func (x *OutputStream) Splice(SourceVar *InputStream, FlagsVar OutputStreamSpliceFlags, CancellableVar *Cancellable) (int, error)

Splices an input stream into an output stream.

func (*OutputStream) SpliceAsync

func (x *OutputStream) SpliceAsync(SourceVar *InputStream, FlagsVar OutputStreamSpliceFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Splices a stream asynchronously. When the operation is finished @callback will be called. You can then call g_output_stream_splice_finish() to get the result of the operation.

For the synchronous, blocking version of this function, see g_output_stream_splice().

func (*OutputStream) SpliceFinish

func (x *OutputStream) SpliceFinish(ResultVar AsyncResult) (int, error)

Finishes an asynchronous stream splice operation.

func (*OutputStream) Vprintf

func (x *OutputStream) Vprintf(BytesWrittenVar *uint, CancellableVar *Cancellable, ErrorVar **glib.Error, FormatVar string, ArgsVar []interface{}) bool

This is a utility function around g_output_stream_write_all(). It uses g_strdup_vprintf() to turn @format and @args into a string that is then written to @stream.

See the documentation of g_output_stream_write_all() about the behavior of the actual write operation.

Note that partial writes cannot be properly checked with this function due to the variable length of the written string, if you need precise control over partial write failures, you need to create you own printf()-like wrapper around g_output_stream_write() or g_output_stream_write_all().

func (*OutputStream) Write

func (x *OutputStream) Write(BufferVar []byte, CountVar uint, CancellableVar *Cancellable) (int, error)

Tries to write @count bytes from @buffer into the stream. Will block during the operation.

If count is 0, returns 0 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 written to the stream is returned. It is not an error if this is not the same as the requested size, as it can happen e.g. on a partial I/O error, or if there is not enough storage in the stream. All writes block until at least one byte is written or an error occurs; 0 is never returned (unless @count is 0).

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.

func (*OutputStream) WriteAll

func (x *OutputStream) WriteAll(BufferVar []byte, CountVar uint, BytesWrittenVar *uint, CancellableVar *Cancellable) (bool, error)

Tries to write @count bytes from @buffer into the stream. Will block during the operation.

This function is similar to g_output_stream_write(), except it tries to write as many bytes as requested, only stopping on an error.

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 %FALSE is returned and @error is set to indicate the error status.

As a special exception to the normal conventions for functions that use #GError, if this function returns %FALSE (and sets @error) then @bytes_written will be set to the number of bytes that were successfully written before the error was encountered. This functionality is only available from C. If you need it from another language then you must write your own loop around g_output_stream_write().

func (*OutputStream) WriteAllAsync

func (x *OutputStream) WriteAllAsync(BufferVar []byte, CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Request an asynchronous write of @count bytes from @buffer into the stream. When the operation is finished @callback will be called. You can then call g_output_stream_write_all_finish() to get the result of the operation.

This is the asynchronous version of g_output_stream_write_all().

Call g_output_stream_write_all_finish() to collect the result.

Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is %G_PRIORITY_DEFAULT.

Note that no copy of @buffer will be made, so it must stay valid until @callback is called.

func (*OutputStream) WriteAllFinish

func (x *OutputStream) WriteAllFinish(ResultVar AsyncResult, BytesWrittenVar *uint) (bool, error)

Finishes an asynchronous stream write operation started with g_output_stream_write_all_async().

As a special exception to the normal conventions for functions that use #GError, if this function returns %FALSE (and sets @error) then @bytes_written will be set to the number of bytes that were successfully written before the error was encountered. This functionality is only available from C. If you need it from another language then you must write your own loop around g_output_stream_write_async().

func (*OutputStream) WriteAsync

func (x *OutputStream) WriteAsync(BufferVar []byte, CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Request an asynchronous write of @count bytes from @buffer into the stream. When the operation is finished @callback will be called. You can then call g_output_stream_write_finish() to get the result of the operation.

During an async request no other sync and async calls are allowed, and will result in %G_IO_ERROR_PENDING errors.

A value of @count larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.

On success, the number of bytes written will be passed to the @callback. It is not an error if this is not the same as the requested size, as it can happen e.g. on a partial I/O error, but generally we try to write as many bytes as requested.

You are guaranteed that this method will never fail with %G_IO_ERROR_WOULD_BLOCK - if @stream can't accept more data, the method will just wait until this changes.

Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is %G_PRIORITY_DEFAULT.

The asynchronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all.

For the synchronous, blocking version of this function, see g_output_stream_write().

Note that no copy of @buffer will be made, so it must stay valid until @callback is called. See g_output_stream_write_bytes_async() for a #GBytes version that will automatically hold a reference to the contents (without copying) for the duration of the call.

func (*OutputStream) WriteBytes

func (x *OutputStream) WriteBytes(BytesVar *glib.Bytes, CancellableVar *Cancellable) (int, error)

A wrapper function for g_output_stream_write() which takes a #GBytes as input. This can be more convenient for use by language bindings or in other cases where the refcounted nature of #GBytes is helpful over a bare pointer interface.

However, note that this function may still perform partial writes, just like g_output_stream_write(). If that occurs, to continue writing, you will need to create a new #GBytes containing just the remaining bytes, using g_bytes_new_from_bytes(). Passing the same #GBytes instance multiple times potentially can result in duplicated data in the output stream.

func (*OutputStream) WriteBytesAsync

func (x *OutputStream) WriteBytesAsync(BytesVar *glib.Bytes, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

This function is similar to g_output_stream_write_async(), but takes a #GBytes as input. Due to the refcounted nature of #GBytes, this allows the stream to avoid taking a copy of the data.

However, note that this function may still perform partial writes, just like g_output_stream_write_async(). If that occurs, to continue writing, you will need to create a new #GBytes containing just the remaining bytes, using g_bytes_new_from_bytes(). Passing the same #GBytes instance multiple times potentially can result in duplicated data in the output stream.

For the synchronous, blocking version of this function, see g_output_stream_write_bytes().

func (*OutputStream) WriteBytesFinish

func (x *OutputStream) WriteBytesFinish(ResultVar AsyncResult) (int, error)

Finishes a stream write-from-#GBytes operation.

func (*OutputStream) WriteFinish

func (x *OutputStream) WriteFinish(ResultVar AsyncResult) (int, error)

Finishes a stream write operation.

func (*OutputStream) Writev

func (x *OutputStream) Writev(VectorsVar []OutputVector, NVectorsVar uint, BytesWrittenVar *uint, CancellableVar *Cancellable) (bool, error)

Tries to write the bytes contained in the @n_vectors @vectors into the stream. Will block during the operation.

If @n_vectors is 0 or the sum of all bytes in @vectors is 0, returns 0 and does nothing.

On success, the number of bytes written to the stream is returned. It is not an error if this is not the same as the requested size, as it can happen e.g. on a partial I/O error, or if there is not enough storage in the stream. All writes block until at least one byte is written or an error occurs; 0 is never returned (unless @n_vectors is 0 or the sum of all bytes in @vectors is 0).

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.

Some implementations of g_output_stream_writev() may have limitations on the aggregate buffer size, and will return %G_IO_ERROR_INVALID_ARGUMENT if these are exceeded. For example, when writing to a local file on UNIX platforms, the aggregate buffer size must not exceed %G_MAXSSIZE bytes.

func (*OutputStream) WritevAll

func (x *OutputStream) WritevAll(VectorsVar []OutputVector, NVectorsVar uint, BytesWrittenVar *uint, CancellableVar *Cancellable) (bool, error)

Tries to write the bytes contained in the @n_vectors @vectors into the stream. Will block during the operation.

This function is similar to g_output_stream_writev(), except it tries to write as many bytes as requested, only stopping on an error.

On a successful write of all @n_vectors vectors, %TRUE is returned, and @bytes_written is set to the sum of all the sizes of @vectors.

If there is an error during the operation %FALSE is returned and @error is set to indicate the error status.

As a special exception to the normal conventions for functions that use #GError, if this function returns %FALSE (and sets @error) then @bytes_written will be set to the number of bytes that were successfully written before the error was encountered. This functionality is only available from C. If you need it from another language then you must write your own loop around g_output_stream_write().

The content of the individual elements of @vectors might be changed by this function.

func (*OutputStream) WritevAllAsync

func (x *OutputStream) WritevAllAsync(VectorsVar []OutputVector, NVectorsVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Request an asynchronous write of the bytes contained in the @n_vectors @vectors into the stream. When the operation is finished @callback will be called. You can then call g_output_stream_writev_all_finish() to get the result of the operation.

This is the asynchronous version of g_output_stream_writev_all().

Call g_output_stream_writev_all_finish() to collect the result.

Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is %G_PRIORITY_DEFAULT.

Note that no copy of @vectors will be made, so it must stay valid until @callback is called. The content of the individual elements of @vectors might be changed by this function.

func (*OutputStream) WritevAllFinish

func (x *OutputStream) WritevAllFinish(ResultVar AsyncResult, BytesWrittenVar *uint) (bool, error)

Finishes an asynchronous stream write operation started with g_output_stream_writev_all_async().

As a special exception to the normal conventions for functions that use #GError, if this function returns %FALSE (and sets @error) then @bytes_written will be set to the number of bytes that were successfully written before the error was encountered. This functionality is only available from C. If you need it from another language then you must write your own loop around g_output_stream_writev_async().

func (*OutputStream) WritevAsync

func (x *OutputStream) WritevAsync(VectorsVar []OutputVector, NVectorsVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Request an asynchronous write of the bytes contained in @n_vectors @vectors into the stream. When the operation is finished @callback will be called. You can then call g_output_stream_writev_finish() to get the result of the operation.

During an async request no other sync and async calls are allowed, and will result in %G_IO_ERROR_PENDING errors.

On success, the number of bytes written will be passed to the @callback. It is not an error if this is not the same as the requested size, as it can happen e.g. on a partial I/O error, but generally we try to write as many bytes as requested.

You are guaranteed that this method will never fail with %G_IO_ERROR_WOULD_BLOCK — if @stream can't accept more data, the method will just wait until this changes.

Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is %G_PRIORITY_DEFAULT.

The asynchronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all.

For the synchronous, blocking version of this function, see g_output_stream_writev().

Note that no copy of @vectors will be made, so it must stay valid until @callback is called.

func (*OutputStream) WritevFinish

func (x *OutputStream) WritevFinish(ResultVar AsyncResult, BytesWrittenVar *uint) (bool, error)

Finishes a stream writev operation.

type OutputStreamClass

type OutputStreamClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*OutputStreamClass) GetCloseAsync

func (x *OutputStreamClass) GetCloseAsync() func(*OutputStream, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetCloseAsync gets the "close_async" callback function.

func (*OutputStreamClass) GetCloseFinish

func (x *OutputStreamClass) GetCloseFinish() func(*OutputStream, AsyncResult) bool

GetCloseFinish gets the "close_finish" callback function.

func (*OutputStreamClass) GetCloseFn

func (x *OutputStreamClass) GetCloseFn() func(*OutputStream, *Cancellable) bool

GetCloseFn gets the "close_fn" callback function.

func (*OutputStreamClass) GetFlush

func (x *OutputStreamClass) GetFlush() func(*OutputStream, *Cancellable) bool

GetFlush gets the "flush" callback function.

func (*OutputStreamClass) GetFlushAsync

func (x *OutputStreamClass) GetFlushAsync() func(*OutputStream, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetFlushAsync gets the "flush_async" callback function.

func (*OutputStreamClass) GetFlushFinish

func (x *OutputStreamClass) GetFlushFinish() func(*OutputStream, AsyncResult) bool

GetFlushFinish gets the "flush_finish" callback function.

func (*OutputStreamClass) GetGReserved4

func (x *OutputStreamClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*OutputStreamClass) GetGReserved5

func (x *OutputStreamClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*OutputStreamClass) GetGReserved6

func (x *OutputStreamClass) GetGReserved6() func()

GetGReserved6 gets the "_g_reserved6" callback function.

func (*OutputStreamClass) GetGReserved7

func (x *OutputStreamClass) GetGReserved7() func()

GetGReserved7 gets the "_g_reserved7" callback function.

func (*OutputStreamClass) GetGReserved8

func (x *OutputStreamClass) GetGReserved8() func()

GetGReserved8 gets the "_g_reserved8" callback function.

func (*OutputStreamClass) GetSplice

GetSplice gets the "splice" callback function.

func (*OutputStreamClass) GetSpliceAsync

GetSpliceAsync gets the "splice_async" callback function.

func (*OutputStreamClass) GetSpliceFinish

func (x *OutputStreamClass) GetSpliceFinish() func(*OutputStream, AsyncResult) int

GetSpliceFinish gets the "splice_finish" callback function.

func (*OutputStreamClass) GetWriteAsync

func (x *OutputStreamClass) GetWriteAsync() func(*OutputStream, []byte, uint, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetWriteAsync gets the "write_async" callback function.

func (*OutputStreamClass) GetWriteFinish

func (x *OutputStreamClass) GetWriteFinish() func(*OutputStream, AsyncResult) int

GetWriteFinish gets the "write_finish" callback function.

func (*OutputStreamClass) GetWriteFn

func (x *OutputStreamClass) GetWriteFn() func(*OutputStream, []byte, uint, *Cancellable) int

GetWriteFn gets the "write_fn" callback function.

func (*OutputStreamClass) GetWritevAsync

GetWritevAsync gets the "writev_async" callback function.

func (*OutputStreamClass) GetWritevFinish

func (x *OutputStreamClass) GetWritevFinish() func(*OutputStream, AsyncResult, *uint) bool

GetWritevFinish gets the "writev_finish" callback function.

func (*OutputStreamClass) GetWritevFn

func (x *OutputStreamClass) GetWritevFn() func(*OutputStream, []OutputVector, uint, *uint, *Cancellable) bool

GetWritevFn gets the "writev_fn" callback function.

func (*OutputStreamClass) GoPointer

func (x *OutputStreamClass) GoPointer() uintptr

func (*OutputStreamClass) OverrideCloseAsync

func (x *OutputStreamClass) OverrideCloseAsync(cb func(*OutputStream, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideCloseAsync sets the "close_async" callback function.

func (*OutputStreamClass) OverrideCloseFinish

func (x *OutputStreamClass) OverrideCloseFinish(cb func(*OutputStream, AsyncResult) bool)

OverrideCloseFinish sets the "close_finish" callback function.

func (*OutputStreamClass) OverrideCloseFn

func (x *OutputStreamClass) OverrideCloseFn(cb func(*OutputStream, *Cancellable) bool)

OverrideCloseFn sets the "close_fn" callback function.

func (*OutputStreamClass) OverrideFlush

func (x *OutputStreamClass) OverrideFlush(cb func(*OutputStream, *Cancellable) bool)

OverrideFlush sets the "flush" callback function.

func (*OutputStreamClass) OverrideFlushAsync

func (x *OutputStreamClass) OverrideFlushAsync(cb func(*OutputStream, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideFlushAsync sets the "flush_async" callback function.

func (*OutputStreamClass) OverrideFlushFinish

func (x *OutputStreamClass) OverrideFlushFinish(cb func(*OutputStream, AsyncResult) bool)

OverrideFlushFinish sets the "flush_finish" callback function.

func (*OutputStreamClass) OverrideGReserved4

func (x *OutputStreamClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*OutputStreamClass) OverrideGReserved5

func (x *OutputStreamClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

func (*OutputStreamClass) OverrideGReserved6

func (x *OutputStreamClass) OverrideGReserved6(cb func())

OverrideGReserved6 sets the "_g_reserved6" callback function.

func (*OutputStreamClass) OverrideGReserved7

func (x *OutputStreamClass) OverrideGReserved7(cb func())

OverrideGReserved7 sets the "_g_reserved7" callback function.

func (*OutputStreamClass) OverrideGReserved8

func (x *OutputStreamClass) OverrideGReserved8(cb func())

OverrideGReserved8 sets the "_g_reserved8" callback function.

func (*OutputStreamClass) OverrideSplice

OverrideSplice sets the "splice" callback function.

func (*OutputStreamClass) OverrideSpliceAsync

OverrideSpliceAsync sets the "splice_async" callback function.

func (*OutputStreamClass) OverrideSpliceFinish

func (x *OutputStreamClass) OverrideSpliceFinish(cb func(*OutputStream, AsyncResult) int)

OverrideSpliceFinish sets the "splice_finish" callback function.

func (*OutputStreamClass) OverrideWriteAsync

func (x *OutputStreamClass) OverrideWriteAsync(cb func(*OutputStream, []byte, uint, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideWriteAsync sets the "write_async" callback function.

func (*OutputStreamClass) OverrideWriteFinish

func (x *OutputStreamClass) OverrideWriteFinish(cb func(*OutputStream, AsyncResult) int)

OverrideWriteFinish sets the "write_finish" callback function.

func (*OutputStreamClass) OverrideWriteFn

func (x *OutputStreamClass) OverrideWriteFn(cb func(*OutputStream, []byte, uint, *Cancellable) int)

OverrideWriteFn sets the "write_fn" callback function.

func (*OutputStreamClass) OverrideWritevAsync

func (x *OutputStreamClass) OverrideWritevAsync(cb func(*OutputStream, []OutputVector, uint, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideWritevAsync sets the "writev_async" callback function.

func (*OutputStreamClass) OverrideWritevFinish

func (x *OutputStreamClass) OverrideWritevFinish(cb func(*OutputStream, AsyncResult, *uint) bool)

OverrideWritevFinish sets the "writev_finish" callback function.

func (*OutputStreamClass) OverrideWritevFn

func (x *OutputStreamClass) OverrideWritevFn(cb func(*OutputStream, []OutputVector, uint, *uint, *Cancellable) bool)

OverrideWritevFn sets the "writev_fn" callback function.

type OutputStreamPrivate

type OutputStreamPrivate struct {
	// contains filtered or unexported fields
}

func (*OutputStreamPrivate) GoPointer

func (x *OutputStreamPrivate) GoPointer() uintptr

type OutputStreamSpliceFlags

type OutputStreamSpliceFlags int

GOutputStreamSpliceFlags determine how streams should be spliced.

const (

	// Do not close either stream.
	GOutputStreamSpliceNoneValue OutputStreamSpliceFlags = 0
	// Close the source stream after
	//     the splice.
	GOutputStreamSpliceCloseSourceValue OutputStreamSpliceFlags = 1
	// Close the target stream after
	//     the splice.
	GOutputStreamSpliceCloseTargetValue OutputStreamSpliceFlags = 2
)

type OutputVector

type OutputVector struct {
	Buffer uintptr

	Size uint
	// contains filtered or unexported fields
}

Structure used for scatter/gather data output. You generally pass in an array of #GOutputVectors and the operation will use all the buffers as if they were one buffer.

func (*OutputVector) GoPointer

func (x *OutputVector) GoPointer() uintptr

type PasswordSave

type PasswordSave int

#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.

const (

	// never save a password.
	GPasswordSaveNeverValue PasswordSave = 0
	// save a password for the session.
	GPasswordSaveForSessionValue PasswordSave = 1
	// save a password permanently.
	GPasswordSavePermanentlyValue PasswordSave = 2
)

type Permission

type Permission struct {
	gobject.Object
}

A `GPermission` represents the status of the caller’s permission to perform a certain action.

You can query if the action is currently allowed and if it is possible to acquire the permission so that the action will be allowed in the future.

There is also an API to actually acquire the permission and one to release it.

As an example, a `GPermission` might represent the ability for the user to write to a [class@Gio.Settings] object. This `GPermission` object could then be used to decide if it is appropriate to show a “Click here to unlock” button in a dialog and to provide the mechanism to invoke when that button is clicked.

func PermissionNewFromInternalPtr

func PermissionNewFromInternalPtr(ptr uintptr) *Permission

func (*Permission) Acquire

func (x *Permission) Acquire(CancellableVar *Cancellable) (bool, error)

Attempts to acquire the permission represented by @permission.

The precise method by which this happens depends on the permission and the underlying authentication mechanism. A simple example is that a dialog may appear asking the user to enter their password.

You should check with g_permission_get_can_acquire() before calling this function.

If the permission is acquired then %TRUE is returned. Otherwise, %FALSE is returned and @error is set appropriately.

This call is blocking, likely for a very long time (in the case that user interaction is required). See g_permission_acquire_async() for the non-blocking version.

func (*Permission) AcquireAsync

func (x *Permission) AcquireAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Attempts to acquire the permission represented by @permission.

This is the first half of the asynchronous version of g_permission_acquire().

func (*Permission) AcquireFinish

func (x *Permission) AcquireFinish(ResultVar AsyncResult) (bool, error)

Collects the result of attempting to acquire the permission represented by @permission.

This is the second half of the asynchronous version of g_permission_acquire().

func (*Permission) GetAllowed

func (x *Permission) GetAllowed() bool

Gets the value of the 'allowed' property. This property is %TRUE if the caller currently has permission to perform the action that @permission represents the permission to perform.

func (*Permission) GetCanAcquire

func (x *Permission) GetCanAcquire() bool

Gets the value of the 'can-acquire' property. This property is %TRUE if it is generally possible to acquire the permission by calling g_permission_acquire().

func (*Permission) GetCanRelease

func (x *Permission) GetCanRelease() bool

Gets the value of the 'can-release' property. This property is %TRUE if it is generally possible to release the permission by calling g_permission_release().

func (*Permission) GetPropertyAllowed

func (x *Permission) GetPropertyAllowed() bool

GetPropertyAllowed gets the "allowed" property. %TRUE if the caller currently has permission to perform the action that @permission represents the permission to perform.

func (*Permission) GetPropertyCanAcquire

func (x *Permission) GetPropertyCanAcquire() bool

GetPropertyCanAcquire gets the "can-acquire" property. %TRUE if it is generally possible to acquire the permission by calling g_permission_acquire().

func (*Permission) GetPropertyCanRelease

func (x *Permission) GetPropertyCanRelease() bool

GetPropertyCanRelease gets the "can-release" property. %TRUE if it is generally possible to release the permission by calling g_permission_release().

func (*Permission) GoPointer

func (c *Permission) GoPointer() uintptr

func (*Permission) ImplUpdate

func (x *Permission) ImplUpdate(AllowedVar bool, CanAcquireVar bool, CanReleaseVar bool)

This function is called by the #GPermission implementation to update the properties of the permission. You should never call this function except from a #GPermission implementation.

GObject notify signals are generated, as appropriate.

func (*Permission) Release

func (x *Permission) Release(CancellableVar *Cancellable) (bool, error)

Attempts to release the permission represented by @permission.

The precise method by which this happens depends on the permission and the underlying authentication mechanism. In most cases the permission will be dropped immediately without further action.

You should check with g_permission_get_can_release() before calling this function.

If the permission is released then %TRUE is returned. Otherwise, %FALSE is returned and @error is set appropriately.

This call is blocking, likely for a very long time (in the case that user interaction is required). See g_permission_release_async() for the non-blocking version.

func (*Permission) ReleaseAsync

func (x *Permission) ReleaseAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Attempts to release the permission represented by @permission.

This is the first half of the asynchronous version of g_permission_release().

func (*Permission) ReleaseFinish

func (x *Permission) ReleaseFinish(ResultVar AsyncResult) (bool, error)

Collects the result of attempting to release the permission represented by @permission.

This is the second half of the asynchronous version of g_permission_release().

func (*Permission) SetGoPointer

func (c *Permission) SetGoPointer(ptr uintptr)

type PermissionClass

type PermissionClass struct {
	ParentClass gobject.ObjectClass

	Reserved [16]uintptr
	// contains filtered or unexported fields
}

func (*PermissionClass) GetAcquire

func (x *PermissionClass) GetAcquire() func(*Permission, *Cancellable) bool

GetAcquire gets the "acquire" callback function.

func (*PermissionClass) GetAcquireAsync

func (x *PermissionClass) GetAcquireAsync() func(*Permission, *Cancellable, *AsyncReadyCallback, uintptr)

GetAcquireAsync gets the "acquire_async" callback function.

func (*PermissionClass) GetAcquireFinish

func (x *PermissionClass) GetAcquireFinish() func(*Permission, AsyncResult) bool

GetAcquireFinish gets the "acquire_finish" callback function.

func (*PermissionClass) GetRelease

func (x *PermissionClass) GetRelease() func(*Permission, *Cancellable) bool

GetRelease gets the "release" callback function.

func (*PermissionClass) GetReleaseAsync

func (x *PermissionClass) GetReleaseAsync() func(*Permission, *Cancellable, *AsyncReadyCallback, uintptr)

GetReleaseAsync gets the "release_async" callback function.

func (*PermissionClass) GetReleaseFinish

func (x *PermissionClass) GetReleaseFinish() func(*Permission, AsyncResult) bool

GetReleaseFinish gets the "release_finish" callback function.

func (*PermissionClass) GoPointer

func (x *PermissionClass) GoPointer() uintptr

func (*PermissionClass) OverrideAcquire

func (x *PermissionClass) OverrideAcquire(cb func(*Permission, *Cancellable) bool)

OverrideAcquire sets the "acquire" callback function.

func (*PermissionClass) OverrideAcquireAsync

func (x *PermissionClass) OverrideAcquireAsync(cb func(*Permission, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideAcquireAsync sets the "acquire_async" callback function.

func (*PermissionClass) OverrideAcquireFinish

func (x *PermissionClass) OverrideAcquireFinish(cb func(*Permission, AsyncResult) bool)

OverrideAcquireFinish sets the "acquire_finish" callback function.

func (*PermissionClass) OverrideRelease

func (x *PermissionClass) OverrideRelease(cb func(*Permission, *Cancellable) bool)

OverrideRelease sets the "release" callback function.

func (*PermissionClass) OverrideReleaseAsync

func (x *PermissionClass) OverrideReleaseAsync(cb func(*Permission, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideReleaseAsync sets the "release_async" callback function.

func (*PermissionClass) OverrideReleaseFinish

func (x *PermissionClass) OverrideReleaseFinish(cb func(*Permission, AsyncResult) bool)

OverrideReleaseFinish sets the "release_finish" callback function.

type PermissionPrivate

type PermissionPrivate struct {
	// contains filtered or unexported fields
}

func (*PermissionPrivate) GoPointer

func (x *PermissionPrivate) GoPointer() uintptr

type PollableInputStream

type PollableInputStream interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	CanPoll() bool
	CreateSource(CancellableVar *Cancellable) *glib.Source
	IsReadable() bool
	ReadNonblocking(BufferVar *[]byte, CountVar uint, CancellableVar *Cancellable) (int, error)
}

`GPollableInputStream` is implemented by [class@Gio.InputStream]s 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 [method@Gio.PollableInputStream.can_poll] returns false, then the behavior of other `GPollableInputStream` methods is undefined.

type PollableInputStreamBase

type PollableInputStreamBase struct {
	Ptr uintptr
}

func (*PollableInputStreamBase) CanPoll

func (x *PollableInputStreamBase) CanPoll() bool

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.

func (*PollableInputStreamBase) CreateSource

func (x *PollableInputStreamBase) CreateSource(CancellableVar *Cancellable) *glib.Source

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.

func (*PollableInputStreamBase) GoPointer

func (x *PollableInputStreamBase) GoPointer() uintptr

func (*PollableInputStreamBase) IsReadable

func (x *PollableInputStreamBase) IsReadable() bool

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.

func (*PollableInputStreamBase) ReadNonblocking

func (x *PollableInputStreamBase) ReadNonblocking(BufferVar *[]byte, CountVar uint, CancellableVar *Cancellable) (int, error)

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.

func (*PollableInputStreamBase) SetGoPointer

func (x *PollableInputStreamBase) SetGoPointer(ptr uintptr)

type PollableInputStreamInterface

type PollableInputStreamInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

The interface for pollable input streams.

The default implementation of @can_poll always returns %TRUE.

The default implementation of @read_nonblocking calls g_pollable_input_stream_is_readable(), and then calls g_input_stream_read() if it returns %TRUE. This means you only need to override it if it is possible that your @is_readable implementation may return %TRUE when the stream is not actually readable.

func (*PollableInputStreamInterface) GetCanPoll

GetCanPoll gets the "can_poll" callback function. Checks if the #GPollableInputStream instance is actually pollable

func (*PollableInputStreamInterface) GetCreateSource

GetCreateSource gets the "create_source" callback function. Creates a #GSource to poll the stream

func (*PollableInputStreamInterface) GetIsReadable

func (x *PollableInputStreamInterface) GetIsReadable() func(PollableInputStream) bool

GetIsReadable gets the "is_readable" callback function. Checks if the stream is readable

func (*PollableInputStreamInterface) GetReadNonblocking

func (x *PollableInputStreamInterface) GetReadNonblocking() func(PollableInputStream, *[]byte, uint) int

GetReadNonblocking gets the "read_nonblocking" callback function. Does a non-blocking read or returns

%G_IO_ERROR_WOULD_BLOCK

func (*PollableInputStreamInterface) GoPointer

func (x *PollableInputStreamInterface) GoPointer() uintptr

func (*PollableInputStreamInterface) OverrideCanPoll

func (x *PollableInputStreamInterface) OverrideCanPoll(cb func(PollableInputStream) bool)

OverrideCanPoll sets the "can_poll" callback function. Checks if the #GPollableInputStream instance is actually pollable

func (*PollableInputStreamInterface) OverrideCreateSource

func (x *PollableInputStreamInterface) OverrideCreateSource(cb func(PollableInputStream, *Cancellable) *glib.Source)

OverrideCreateSource sets the "create_source" callback function. Creates a #GSource to poll the stream

func (*PollableInputStreamInterface) OverrideIsReadable

func (x *PollableInputStreamInterface) OverrideIsReadable(cb func(PollableInputStream) bool)

OverrideIsReadable sets the "is_readable" callback function. Checks if the stream is readable

func (*PollableInputStreamInterface) OverrideReadNonblocking

func (x *PollableInputStreamInterface) OverrideReadNonblocking(cb func(PollableInputStream, *[]byte, uint) int)

OverrideReadNonblocking sets the "read_nonblocking" callback function. Does a non-blocking read or returns

%G_IO_ERROR_WOULD_BLOCK

type PollableOutputStream

type PollableOutputStream interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	CanPoll() bool
	CreateSource(CancellableVar *Cancellable) *glib.Source
	IsWritable() bool
	WriteNonblocking(BufferVar []byte, CountVar uint, CancellableVar *Cancellable) (int, error)
	WritevNonblocking(VectorsVar []OutputVector, NVectorsVar uint, BytesWrittenVar *uint, CancellableVar *Cancellable) (PollableReturn, error)
}

`GPollableOutputStream` is implemented by [class@Gio.OutputStream]s 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 [method@Gio.PollableOutputStream.can_poll] returns false, then the behavior of other `GPollableOutputStream` methods is undefined.

type PollableOutputStreamBase

type PollableOutputStreamBase struct {
	Ptr uintptr
}

func (*PollableOutputStreamBase) CanPoll

func (x *PollableOutputStreamBase) CanPoll() bool

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.

func (*PollableOutputStreamBase) CreateSource

func (x *PollableOutputStreamBase) CreateSource(CancellableVar *Cancellable) *glib.Source

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.

func (*PollableOutputStreamBase) GoPointer

func (x *PollableOutputStreamBase) GoPointer() uintptr

func (*PollableOutputStreamBase) IsWritable

func (x *PollableOutputStreamBase) IsWritable() bool

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.

func (*PollableOutputStreamBase) SetGoPointer

func (x *PollableOutputStreamBase) SetGoPointer(ptr uintptr)

func (*PollableOutputStreamBase) WriteNonblocking

func (x *PollableOutputStreamBase) WriteNonblocking(BufferVar []byte, CountVar uint, CancellableVar *Cancellable) (int, error)

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.

func (*PollableOutputStreamBase) WritevNonblocking

func (x *PollableOutputStreamBase) WritevNonblocking(VectorsVar []OutputVector, NVectorsVar uint, BytesWrittenVar *uint, CancellableVar *Cancellable) (PollableReturn, error)

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.

type PollableOutputStreamInterface

type PollableOutputStreamInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

The interface for pollable output streams.

The default implementation of @can_poll always returns %TRUE.

The default implementation of @write_nonblocking calls g_pollable_output_stream_is_writable(), and then calls g_output_stream_write() if it returns %TRUE. This means you only need to override it if it is possible that your @is_writable implementation may return %TRUE when the stream is not actually writable.

The default implementation of @writev_nonblocking calls g_pollable_output_stream_write_nonblocking() for each vector, and converts its return value and error (if set) to a #GPollableReturn. You should override this where possible to avoid having to allocate a #GError to return %G_IO_ERROR_WOULD_BLOCK.

func (*PollableOutputStreamInterface) GetCanPoll

GetCanPoll gets the "can_poll" callback function. Checks if the #GPollableOutputStream instance is actually pollable

func (*PollableOutputStreamInterface) GetCreateSource

GetCreateSource gets the "create_source" callback function. Creates a #GSource to poll the stream

func (*PollableOutputStreamInterface) GetIsWritable

func (x *PollableOutputStreamInterface) GetIsWritable() func(PollableOutputStream) bool

GetIsWritable gets the "is_writable" callback function. Checks if the stream is writable

func (*PollableOutputStreamInterface) GetWriteNonblocking

func (x *PollableOutputStreamInterface) GetWriteNonblocking() func(PollableOutputStream, []byte, uint) int

GetWriteNonblocking gets the "write_nonblocking" callback function. Does a non-blocking write or returns

%G_IO_ERROR_WOULD_BLOCK

func (*PollableOutputStreamInterface) GetWritevNonblocking

GetWritevNonblocking gets the "writev_nonblocking" callback function. Does a vectored non-blocking write, or returns

%G_POLLABLE_RETURN_WOULD_BLOCK

func (*PollableOutputStreamInterface) GoPointer

func (x *PollableOutputStreamInterface) GoPointer() uintptr

func (*PollableOutputStreamInterface) OverrideCanPoll

func (x *PollableOutputStreamInterface) OverrideCanPoll(cb func(PollableOutputStream) bool)

OverrideCanPoll sets the "can_poll" callback function. Checks if the #GPollableOutputStream instance is actually pollable

func (*PollableOutputStreamInterface) OverrideCreateSource

func (x *PollableOutputStreamInterface) OverrideCreateSource(cb func(PollableOutputStream, *Cancellable) *glib.Source)

OverrideCreateSource sets the "create_source" callback function. Creates a #GSource to poll the stream

func (*PollableOutputStreamInterface) OverrideIsWritable

func (x *PollableOutputStreamInterface) OverrideIsWritable(cb func(PollableOutputStream) bool)

OverrideIsWritable sets the "is_writable" callback function. Checks if the stream is writable

func (*PollableOutputStreamInterface) OverrideWriteNonblocking

func (x *PollableOutputStreamInterface) OverrideWriteNonblocking(cb func(PollableOutputStream, []byte, uint) int)

OverrideWriteNonblocking sets the "write_nonblocking" callback function. Does a non-blocking write or returns

%G_IO_ERROR_WOULD_BLOCK

func (*PollableOutputStreamInterface) OverrideWritevNonblocking

func (x *PollableOutputStreamInterface) OverrideWritevNonblocking(cb func(PollableOutputStream, []OutputVector, uint, *uint) PollableReturn)

OverrideWritevNonblocking sets the "writev_nonblocking" callback function. Does a vectored non-blocking write, or returns

%G_POLLABLE_RETURN_WOULD_BLOCK

type PollableReturn

type PollableReturn int

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.

const (

	// Generic error condition for when an operation fails.
	GPollableReturnFailedValue PollableReturn = 0
	// The operation was successfully finished.
	GPollableReturnOkValue PollableReturn = 1
	// The operation would block.
	GPollableReturnWouldBlockValue PollableReturn = -27
)

type PollableSourceFunc

type PollableSourceFunc func(uintptr, uintptr) bool

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().

type PowerProfileMonitor

type PowerProfileMonitor interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	GetPowerSaverEnabled() bool
}

`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 [signal@GObject.Object::notify] signal for [property@Gio.PowerProfileMonitor:power-saver-enabled], and unref the `GPowerProfileMonitor` itself when exiting.

type PowerProfileMonitorBase

type PowerProfileMonitorBase struct {
	Ptr uintptr
}

func PowerProfileMonitorDupDefault

func PowerProfileMonitorDupDefault() *PowerProfileMonitorBase

Gets a reference to the default #GPowerProfileMonitor for the system.

func (*PowerProfileMonitorBase) GetPowerSaverEnabled

func (x *PowerProfileMonitorBase) GetPowerSaverEnabled() bool

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.

func (*PowerProfileMonitorBase) GetPropertyPowerSaverEnabled

func (x *PowerProfileMonitorBase) GetPropertyPowerSaverEnabled() bool

GetPropertyPowerSaverEnabled gets the "power-saver-enabled" property. Whether “Power Saver” mode is enabled on the system.

func (*PowerProfileMonitorBase) GoPointer

func (x *PowerProfileMonitorBase) GoPointer() uintptr

func (*PowerProfileMonitorBase) SetGoPointer

func (x *PowerProfileMonitorBase) SetGoPointer(ptr uintptr)

type PowerProfileMonitorInterface

type PowerProfileMonitorInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

The virtual function table for #GPowerProfileMonitor.

func (*PowerProfileMonitorInterface) GoPointer

func (x *PowerProfileMonitorInterface) GoPointer() uintptr

type PropertyAction

type PropertyAction struct {
	gobject.Object
}

A `GPropertyAction` is a way to get a [iface@Gio.Action] with a state value reflecting and controlling the value of a [class@GObject.Object] property.

The state of the action will correspond to the value of the property. Changing it will change the property (assuming the requested value matches the requirements as specified in the [type@GObject.ParamSpec]).

Only the most common types are presently supported. Booleans are mapped to booleans, strings to strings, signed/unsigned integers to int32/uint32 and floats and doubles to doubles.

If the property is an enum then the state will be string-typed and conversion will automatically be performed between the enum value and ‘nick’ string as per the [type@GObject.EnumValue] table.

Flags types are not currently supported.

Properties of object types, boxed types and pointer types are not supported and probably never will be.

Properties of [type@GLib.Variant] types are not currently supported.

If the property is boolean-valued then the action will have a `NULL` parameter type, and activating the action (with no parameter) will toggle the value of the property.

In all other cases, the parameter type will correspond to the type of the property.

The general idea here is to reduce the number of locations where a particular piece of state is kept (and therefore has to be synchronised between). `GPropertyAction` does not have a separate state that is kept in sync with the property value — its state is the property value.

For example, it might be useful to create a [iface@Gio.Action] corresponding to the `visible-child-name` property of a [`GtkStack`](https://docs.gtk.org/gtk4/class.Stack.html) so that the current page can be switched from a menu. The active radio indication in the menu is then directly determined from the active page of the `GtkStack`.

An anti-example would be binding the `active-id` property on a [`GtkComboBox`](https://docs.gtk.org/gtk4/class.ComboBox.html). This is because the state of the combo box itself is probably uninteresting and is actually being used to control something else.

Another anti-example would be to bind to the `visible-child-name` property of a [`GtkStack`](https://docs.gtk.org/gtk4/class.Stack.html) if this value is actually stored in [class@Gio.Settings]. In that case, the real source of the value is* [class@Gio.Settings]. If you want a [iface@Gio.Action] to control a setting stored in [class@Gio.Settings], see [method@Gio.Settings.create_action] instead, and possibly combine its use with [method@Gio.Settings.bind].

func NewPropertyAction

func NewPropertyAction(NameVar string, ObjectVar *gobject.Object, PropertyNameVar string) *PropertyAction

Creates a #GAction corresponding to the value of property @property_name on @object.

The property must be existent and readable and writable (and not construct-only).

This function takes a reference on @object and doesn't release it until the action is destroyed.

func PropertyActionNewFromInternalPtr

func PropertyActionNewFromInternalPtr(ptr uintptr) *PropertyAction

func (*PropertyAction) Activate

func (x *PropertyAction) Activate(ParameterVar *glib.Variant)

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 [type@GLib.Variant] is floating, it is consumed.

func (*PropertyAction) ChangeState

func (x *PropertyAction) ChangeState(ValueVar *glib.Variant)

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 [method@Gio.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 [method@Gio.Action.get_state_hint].

If the @value [type@GLib.Variant] is floating, it is consumed.

func (*PropertyAction) GetEnabled

func (x *PropertyAction) GetEnabled() bool

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.

func (*PropertyAction) GetName

func (x *PropertyAction) GetName() string

Queries the name of @action.

func (*PropertyAction) GetParameterType

func (x *PropertyAction) GetParameterType() *glib.VariantType

Queries the type of the parameter that must be given when activating @action.

When activating the action using [method@Gio.Action.activate], the [type@GLib.Variant] 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 [type@GLib.Variant], but `NULL` instead.

func (*PropertyAction) GetPropertyEnabled

func (x *PropertyAction) GetPropertyEnabled() bool

GetPropertyEnabled gets the "enabled" property. If @action is currently enabled.

If the action is disabled then calls to g_action_activate() and g_action_change_state() have no effect.

func (*PropertyAction) GetPropertyInvertBoolean

func (x *PropertyAction) GetPropertyInvertBoolean() bool

GetPropertyInvertBoolean gets the "invert-boolean" property. If %TRUE, the state of the action will be the negation of the property value, provided the property is boolean.

func (*PropertyAction) GetPropertyName

func (x *PropertyAction) GetPropertyName() string

GetPropertyName gets the "name" property. The name of the action. This is mostly meaningful for identifying the action once it has been added to a #GActionMap.

func (*PropertyAction) GetPropertyParameterType

func (x *PropertyAction) GetPropertyParameterType() uintptr

GetPropertyParameterType gets the "parameter-type" property. The type of the parameter that must be given when activating the action.

func (*PropertyAction) GetPropertyState

func (x *PropertyAction) GetPropertyState() uintptr

GetPropertyState gets the "state" property. The state of the action, or %NULL if the action is stateless.

func (*PropertyAction) GetPropertyStateType

func (x *PropertyAction) GetPropertyStateType() uintptr

GetPropertyStateType gets the "state-type" property. The #GVariantType of the state that the action has, or %NULL if the action is stateless.

func (*PropertyAction) GetState

func (x *PropertyAction) GetState() *glib.Variant

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 [method@Gio.Action.get_state_type].

The return value (if non-`NULL`) should be freed with [method@GLib.Variant.unref] when it is no longer required.

func (*PropertyAction) GetStateHint

func (x *PropertyAction) GetStateHint() *glib.Variant

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 [type@GLib.Variant] array is returned then each item in the array is a possible value for the state. If a [type@GLib.Variant] 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 [method@GLib.Variant.unref] when it is no longer required.

func (*PropertyAction) GetStateType

func (x *PropertyAction) GetStateType() *glib.VariantType

Queries the type of the state of @action.

If the action is stateful (e.g. created with [ctor@Gio.SimpleAction.new_stateful]) then this function returns the [type@GLib.VariantType] of the state. This is the type of the initial value given as the state. All calls to [method@Gio.Action.change_state] must give a [type@GLib.Variant] of this type and [method@Gio.Action.get_state] will return a [type@GLib.Variant] of the same type.

If the action is not stateful (e.g. created with [ctor@Gio.SimpleAction.new]) then this function will return `NULL`. In that case, [method@Gio.Action.get_state] will return `NULL` and you must not call [method@Gio.Action.change_state].

func (*PropertyAction) GoPointer

func (c *PropertyAction) GoPointer() uintptr

func (*PropertyAction) SetGoPointer

func (c *PropertyAction) SetGoPointer(ptr uintptr)

func (*PropertyAction) SetPropertyInvertBoolean

func (x *PropertyAction) SetPropertyInvertBoolean(value bool)

SetPropertyInvertBoolean sets the "invert-boolean" property. If %TRUE, the state of the action will be the negation of the property value, provided the property is boolean.

func (*PropertyAction) SetPropertyName

func (x *PropertyAction) SetPropertyName(value string)

SetPropertyName sets the "name" property. The name of the action. This is mostly meaningful for identifying the action once it has been added to a #GActionMap.

func (*PropertyAction) SetPropertyPropertyName

func (x *PropertyAction) SetPropertyPropertyName(value string)

SetPropertyPropertyName sets the "property-name" property. The name of the property to wrap on the object.

The property must exist on the passed-in object and it must be readable and writable (and not construct-only).

type Proxy

type Proxy interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	Connect(ConnectionVar *IOStream, ProxyAddressVar *ProxyAddress, CancellableVar *Cancellable) (*IOStream, error)
	ConnectAsync(ConnectionVar *IOStream, ProxyAddressVar *ProxyAddress, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	ConnectFinish(ResultVar AsyncResult) (*IOStream, error)
	SupportsHostname() bool
}

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 [method@Gio.IOExtensionPoint.get_extension_by_name].

type ProxyAddress

type ProxyAddress struct {
	InetSocketAddress
}

A [class@Gio.InetSocketAddress] representing a connection via a proxy server.

func NewProxyAddress

func NewProxyAddress(InetaddrVar *InetAddress, PortVar uint16, ProtocolVar string, DestHostnameVar string, DestPortVar uint16, UsernameVar *string, PasswordVar *string) *ProxyAddress

Creates a new #GProxyAddress for @inetaddr with @protocol that should tunnel through @dest_hostname and @dest_port.

(Note that this method doesn't set the #GProxyAddress:uri or #GProxyAddress:destination-protocol fields; use g_object_new() directly if you want to set those.)

func ProxyAddressNewFromInternalPtr

func ProxyAddressNewFromInternalPtr(ptr uintptr) *ProxyAddress

func (*ProxyAddress) Enumerate

func (x *ProxyAddress) Enumerate() *SocketAddressEnumerator

Creates a #GSocketAddressEnumerator for @connectable.

func (*ProxyAddress) GetDestinationHostname

func (x *ProxyAddress) GetDestinationHostname() string

Gets @proxy's destination hostname; that is, the name of the host that will be connected to via the proxy, not the name of the proxy itself.

func (*ProxyAddress) GetDestinationPort

func (x *ProxyAddress) GetDestinationPort() uint16

Gets @proxy's destination port; that is, the port on the destination host that will be connected to via the proxy, not the port number of the proxy itself.

func (*ProxyAddress) GetDestinationProtocol

func (x *ProxyAddress) GetDestinationProtocol() string

Gets the protocol that is being spoken to the destination server; eg, "http" or "ftp".

func (*ProxyAddress) GetPassword

func (x *ProxyAddress) GetPassword() string

Gets @proxy's password.

func (*ProxyAddress) GetPropertyDestinationHostname

func (x *ProxyAddress) GetPropertyDestinationHostname() string

GetPropertyDestinationHostname gets the "destination-hostname" property. The proxy destination hostname.

func (*ProxyAddress) GetPropertyDestinationPort

func (x *ProxyAddress) GetPropertyDestinationPort() uint

GetPropertyDestinationPort gets the "destination-port" property. The proxy destination port.

func (*ProxyAddress) GetPropertyDestinationProtocol

func (x *ProxyAddress) GetPropertyDestinationProtocol() string

GetPropertyDestinationProtocol gets the "destination-protocol" property. The protocol being spoke to the destination host, or %NULL if the #GProxyAddress doesn't know.

func (*ProxyAddress) GetPropertyPassword

func (x *ProxyAddress) GetPropertyPassword() string

GetPropertyPassword gets the "password" property. The proxy password.

func (*ProxyAddress) GetPropertyProtocol

func (x *ProxyAddress) GetPropertyProtocol() string

GetPropertyProtocol gets the "protocol" property. The proxy protocol.

func (*ProxyAddress) GetPropertyUri

func (x *ProxyAddress) GetPropertyUri() string

GetPropertyUri gets the "uri" property. The URI string that the proxy was constructed from (or %NULL if the creator didn't specify this).

func (*ProxyAddress) GetPropertyUsername

func (x *ProxyAddress) GetPropertyUsername() string

GetPropertyUsername gets the "username" property. The proxy username.

func (*ProxyAddress) GetProtocol

func (x *ProxyAddress) GetProtocol() string

Gets @proxy's protocol. eg, "socks" or "http"

func (*ProxyAddress) GetUri

func (x *ProxyAddress) GetUri() string

Gets the proxy URI that @proxy was constructed from.

func (*ProxyAddress) GetUsername

func (x *ProxyAddress) GetUsername() string

Gets @proxy's username.

func (*ProxyAddress) GoPointer

func (c *ProxyAddress) GoPointer() uintptr

func (*ProxyAddress) ProxyEnumerate

func (x *ProxyAddress) ProxyEnumerate() *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().

func (*ProxyAddress) SetGoPointer

func (c *ProxyAddress) SetGoPointer(ptr uintptr)

func (*ProxyAddress) SetPropertyDestinationHostname

func (x *ProxyAddress) SetPropertyDestinationHostname(value string)

SetPropertyDestinationHostname sets the "destination-hostname" property. The proxy destination hostname.

func (*ProxyAddress) SetPropertyDestinationPort

func (x *ProxyAddress) SetPropertyDestinationPort(value uint)

SetPropertyDestinationPort sets the "destination-port" property. The proxy destination port.

func (*ProxyAddress) SetPropertyDestinationProtocol

func (x *ProxyAddress) SetPropertyDestinationProtocol(value string)

SetPropertyDestinationProtocol sets the "destination-protocol" property. The protocol being spoke to the destination host, or %NULL if the #GProxyAddress doesn't know.

func (*ProxyAddress) SetPropertyPassword

func (x *ProxyAddress) SetPropertyPassword(value string)

SetPropertyPassword sets the "password" property. The proxy password.

func (*ProxyAddress) SetPropertyProtocol

func (x *ProxyAddress) SetPropertyProtocol(value string)

SetPropertyProtocol sets the "protocol" property. The proxy protocol.

func (*ProxyAddress) SetPropertyUri

func (x *ProxyAddress) SetPropertyUri(value string)

SetPropertyUri sets the "uri" property. The URI string that the proxy was constructed from (or %NULL if the creator didn't specify this).

func (*ProxyAddress) SetPropertyUsername

func (x *ProxyAddress) SetPropertyUsername(value string)

SetPropertyUsername sets the "username" property. The proxy username.

func (*ProxyAddress) ToString

func (x *ProxyAddress) ToString() string

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.

type ProxyAddressClass

type ProxyAddressClass struct {
	ParentClass InetSocketAddressClass
	// contains filtered or unexported fields
}

Class structure for #GProxyAddress.

func (*ProxyAddressClass) GoPointer

func (x *ProxyAddressClass) GoPointer() uintptr

type ProxyAddressEnumerator

type ProxyAddressEnumerator struct {
	SocketAddressEnumerator
}

`GProxyAddressEnumerator` is a wrapper around [class@Gio.SocketAddressEnumerator] which takes the [class@Gio.SocketAddress] instances returned by the [class@Gio.SocketAddressEnumerator] and wraps them in [class@Gio.ProxyAddress] instances, using the given [property@Gio.ProxyAddressEnumerator:proxy-resolver].

This enumerator will be returned (for example, by [method@Gio.SocketConnectable.enumerate]) as appropriate when a proxy is configured; there should be no need to manually wrap a [class@Gio.SocketAddressEnumerator] instance with one.

func ProxyAddressEnumeratorNewFromInternalPtr

func ProxyAddressEnumeratorNewFromInternalPtr(ptr uintptr) *ProxyAddressEnumerator

func (*ProxyAddressEnumerator) GetPropertyDefaultPort

func (x *ProxyAddressEnumerator) GetPropertyDefaultPort() uint

GetPropertyDefaultPort gets the "default-port" property. The default port to use if #GProxyAddressEnumerator:uri does not specify one.

func (*ProxyAddressEnumerator) GetPropertyUri

func (x *ProxyAddressEnumerator) GetPropertyUri() string

GetPropertyUri gets the "uri" property. The destination URI. Use `none://` for a generic socket.

func (*ProxyAddressEnumerator) GoPointer

func (c *ProxyAddressEnumerator) GoPointer() uintptr

func (*ProxyAddressEnumerator) SetGoPointer

func (c *ProxyAddressEnumerator) SetGoPointer(ptr uintptr)

func (*ProxyAddressEnumerator) SetPropertyDefaultPort

func (x *ProxyAddressEnumerator) SetPropertyDefaultPort(value uint)

SetPropertyDefaultPort sets the "default-port" property. The default port to use if #GProxyAddressEnumerator:uri does not specify one.

func (*ProxyAddressEnumerator) SetPropertyUri

func (x *ProxyAddressEnumerator) SetPropertyUri(value string)

SetPropertyUri sets the "uri" property. The destination URI. Use `none://` for a generic socket.

type ProxyAddressEnumeratorClass

type ProxyAddressEnumeratorClass struct {
	ParentClass SocketAddressEnumeratorClass
	// contains filtered or unexported fields
}

Class structure for #GProxyAddressEnumerator.

func (*ProxyAddressEnumeratorClass) GetGReserved1

func (x *ProxyAddressEnumeratorClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*ProxyAddressEnumeratorClass) GetGReserved2

func (x *ProxyAddressEnumeratorClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*ProxyAddressEnumeratorClass) GetGReserved3

func (x *ProxyAddressEnumeratorClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*ProxyAddressEnumeratorClass) GetGReserved4

func (x *ProxyAddressEnumeratorClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*ProxyAddressEnumeratorClass) GetGReserved5

func (x *ProxyAddressEnumeratorClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*ProxyAddressEnumeratorClass) GetGReserved6

func (x *ProxyAddressEnumeratorClass) GetGReserved6() func()

GetGReserved6 gets the "_g_reserved6" callback function.

func (*ProxyAddressEnumeratorClass) GetGReserved7

func (x *ProxyAddressEnumeratorClass) GetGReserved7() func()

GetGReserved7 gets the "_g_reserved7" callback function.

func (*ProxyAddressEnumeratorClass) GoPointer

func (x *ProxyAddressEnumeratorClass) GoPointer() uintptr

func (*ProxyAddressEnumeratorClass) OverrideGReserved1

func (x *ProxyAddressEnumeratorClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*ProxyAddressEnumeratorClass) OverrideGReserved2

func (x *ProxyAddressEnumeratorClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*ProxyAddressEnumeratorClass) OverrideGReserved3

func (x *ProxyAddressEnumeratorClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*ProxyAddressEnumeratorClass) OverrideGReserved4

func (x *ProxyAddressEnumeratorClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*ProxyAddressEnumeratorClass) OverrideGReserved5

func (x *ProxyAddressEnumeratorClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

func (*ProxyAddressEnumeratorClass) OverrideGReserved6

func (x *ProxyAddressEnumeratorClass) OverrideGReserved6(cb func())

OverrideGReserved6 sets the "_g_reserved6" callback function.

func (*ProxyAddressEnumeratorClass) OverrideGReserved7

func (x *ProxyAddressEnumeratorClass) OverrideGReserved7(cb func())

OverrideGReserved7 sets the "_g_reserved7" callback function.

type ProxyAddressEnumeratorPrivate

type ProxyAddressEnumeratorPrivate struct {
	// contains filtered or unexported fields
}

func (*ProxyAddressEnumeratorPrivate) GoPointer

func (x *ProxyAddressEnumeratorPrivate) GoPointer() uintptr

type ProxyAddressPrivate

type ProxyAddressPrivate struct {
	// contains filtered or unexported fields
}

func (*ProxyAddressPrivate) GoPointer

func (x *ProxyAddressPrivate) GoPointer() uintptr

type ProxyBase

type ProxyBase struct {
	Ptr uintptr
}

func ProxyGetDefaultForProtocol

func ProxyGetDefaultForProtocol(ProtocolVar string) *ProxyBase

Find the `gio-proxy` extension point for a proxy implementation that supports the specified protocol.

func (*ProxyBase) Connect

func (x *ProxyBase) Connect(ConnectionVar *IOStream, ProxyAddressVar *ProxyAddress, CancellableVar *Cancellable) (*IOStream, error)

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.

func (*ProxyBase) ConnectAsync

func (x *ProxyBase) ConnectAsync(ConnectionVar *IOStream, ProxyAddressVar *ProxyAddress, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronous version of g_proxy_connect().

func (*ProxyBase) ConnectFinish

func (x *ProxyBase) ConnectFinish(ResultVar AsyncResult) (*IOStream, error)

See g_proxy_connect().

func (*ProxyBase) GoPointer

func (x *ProxyBase) GoPointer() uintptr

func (*ProxyBase) SetGoPointer

func (x *ProxyBase) SetGoPointer(ptr uintptr)

func (*ProxyBase) SupportsHostname

func (x *ProxyBase) SupportsHostname() bool

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().

type ProxyInterface

type ProxyInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

Provides an interface for handling proxy connection and payload.

func (*ProxyInterface) GetConnect

func (x *ProxyInterface) GetConnect() func(Proxy, *IOStream, *ProxyAddress, *Cancellable) *IOStream

GetConnect gets the "connect" callback function. Connect to proxy server and wrap (if required) the #connection

to handle payload.

func (*ProxyInterface) GetConnectAsync

func (x *ProxyInterface) GetConnectAsync() func(Proxy, *IOStream, *ProxyAddress, *Cancellable, *AsyncReadyCallback, uintptr)

GetConnectAsync gets the "connect_async" callback function. Same as connect() but asynchronous.

func (*ProxyInterface) GetConnectFinish

func (x *ProxyInterface) GetConnectFinish() func(Proxy, AsyncResult) *IOStream

GetConnectFinish gets the "connect_finish" callback function. Returns the result of connect_async()

func (*ProxyInterface) GetSupportsHostname

func (x *ProxyInterface) GetSupportsHostname() func(Proxy) bool

GetSupportsHostname gets the "supports_hostname" callback function. Returns whether the proxy supports hostname lookups.

func (*ProxyInterface) GoPointer

func (x *ProxyInterface) GoPointer() uintptr

func (*ProxyInterface) OverrideConnect

func (x *ProxyInterface) OverrideConnect(cb func(Proxy, *IOStream, *ProxyAddress, *Cancellable) *IOStream)

OverrideConnect sets the "connect" callback function. Connect to proxy server and wrap (if required) the #connection

to handle payload.

func (*ProxyInterface) OverrideConnectAsync

func (x *ProxyInterface) OverrideConnectAsync(cb func(Proxy, *IOStream, *ProxyAddress, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideConnectAsync sets the "connect_async" callback function. Same as connect() but asynchronous.

func (*ProxyInterface) OverrideConnectFinish

func (x *ProxyInterface) OverrideConnectFinish(cb func(Proxy, AsyncResult) *IOStream)

OverrideConnectFinish sets the "connect_finish" callback function. Returns the result of connect_async()

func (*ProxyInterface) OverrideSupportsHostname

func (x *ProxyInterface) OverrideSupportsHostname(cb func(Proxy) bool)

OverrideSupportsHostname sets the "supports_hostname" callback function. Returns whether the proxy supports hostname lookups.

type ProxyResolver

type ProxyResolver interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	IsSupported() bool
	Lookup(UriVar string, CancellableVar *Cancellable) ([]string, error)
	LookupAsync(UriVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	LookupFinish(ResultVar AsyncResult) ([]string, error)
}

`GProxyResolver` provides synchronous and asynchronous network proxy resolution. `GProxyResolver` is used within [class@Gio.SocketClient] through the method [method@Gio.SocketConnectable.proxy_enumerate].

Implementations of `GProxyResolver` based on [libproxy](https://github.com/libproxy/libproxy) and GNOME settings can be found in [glib-networking](https://gitlab.gnome.org/GNOME/glib-networking). GIO comes with an implementation for use inside Flatpak portals.

type ProxyResolverBase

type ProxyResolverBase struct {
	Ptr uintptr
}

func ProxyResolverGetDefault

func ProxyResolverGetDefault() *ProxyResolverBase

Gets the default #GProxyResolver for the system.

func SimpleProxyResolverNew

func SimpleProxyResolverNew(DefaultProxyVar *string, IgnoreHostsVar []string) *ProxyResolverBase

Creates a new #GSimpleProxyResolver. See #GSimpleProxyResolver:default-proxy and #GSimpleProxyResolver:ignore-hosts for more details on how the arguments are interpreted.

func (*ProxyResolverBase) GoPointer

func (x *ProxyResolverBase) GoPointer() uintptr

func (*ProxyResolverBase) IsSupported

func (x *ProxyResolverBase) IsSupported() bool

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.)

func (*ProxyResolverBase) Lookup

func (x *ProxyResolverBase) Lookup(UriVar string, CancellableVar *Cancellable) ([]string, error)

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 `<protocol>://[user[:password]@]host[:port]` or `direct://`, where `<protocol>` 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.

func (*ProxyResolverBase) LookupAsync

func (x *ProxyResolverBase) LookupAsync(UriVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more details.

func (*ProxyResolverBase) LookupFinish

func (x *ProxyResolverBase) LookupFinish(ResultVar AsyncResult) ([]string, error)

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.

func (*ProxyResolverBase) SetGoPointer

func (x *ProxyResolverBase) SetGoPointer(ptr uintptr)

type ProxyResolverInterface

type ProxyResolverInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

The virtual function table for #GProxyResolver.

func (*ProxyResolverInterface) GetIsSupported

func (x *ProxyResolverInterface) GetIsSupported() func(ProxyResolver) bool

GetIsSupported gets the "is_supported" callback function. the virtual function pointer for g_proxy_resolver_is_supported()

func (*ProxyResolverInterface) GetLookup

func (x *ProxyResolverInterface) GetLookup() func(ProxyResolver, string, *Cancellable) []string

GetLookup gets the "lookup" callback function. the virtual function pointer for g_proxy_resolver_lookup()

func (*ProxyResolverInterface) GetLookupAsync

GetLookupAsync gets the "lookup_async" callback function. the virtual function pointer for

g_proxy_resolver_lookup_async()

func (*ProxyResolverInterface) GetLookupFinish

func (x *ProxyResolverInterface) GetLookupFinish() func(ProxyResolver, AsyncResult) []string

GetLookupFinish gets the "lookup_finish" callback function. the virtual function pointer for

g_proxy_resolver_lookup_finish()

func (*ProxyResolverInterface) GoPointer

func (x *ProxyResolverInterface) GoPointer() uintptr

func (*ProxyResolverInterface) OverrideIsSupported

func (x *ProxyResolverInterface) OverrideIsSupported(cb func(ProxyResolver) bool)

OverrideIsSupported sets the "is_supported" callback function. the virtual function pointer for g_proxy_resolver_is_supported()

func (*ProxyResolverInterface) OverrideLookup

func (x *ProxyResolverInterface) OverrideLookup(cb func(ProxyResolver, string, *Cancellable) []string)

OverrideLookup sets the "lookup" callback function. the virtual function pointer for g_proxy_resolver_lookup()

func (*ProxyResolverInterface) OverrideLookupAsync

func (x *ProxyResolverInterface) OverrideLookupAsync(cb func(ProxyResolver, string, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideLookupAsync sets the "lookup_async" callback function. the virtual function pointer for

g_proxy_resolver_lookup_async()

func (*ProxyResolverInterface) OverrideLookupFinish

func (x *ProxyResolverInterface) OverrideLookupFinish(cb func(ProxyResolver, AsyncResult) []string)

OverrideLookupFinish sets the "lookup_finish" callback function. the virtual function pointer for

g_proxy_resolver_lookup_finish()

type ReallocFunc

type ReallocFunc func(uintptr, uint) uintptr

Changes the size of the memory block pointed to by @data to @size bytes.

The function should have the same semantics as realloc().

type RemoteActionGroup

type RemoteActionGroup interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	ActivateActionFull(ActionNameVar string, ParameterVar *glib.Variant, PlatformDataVar *glib.Variant)
	ChangeActionStateFull(ActionNameVar string, ValueVar *glib.Variant, PlatformDataVar *glib.Variant)
}

The `GRemoteActionGroup` interface is implemented by [iface@Gio.ActionGroup] 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 [iface@Gio.ActionGroup] used to activate actions: [method@Gio.ActionGroup.activate_action] and [method@Gio.ActionGroup.change_action_state]. These variants allow a ‘platform data’ [struct@GLib.Variant] to be specified: a dictionary providing context for the action invocation (for example: timestamps, startup notification IDs, etc).

[class@Gio.DBusActionGroup] implements `GRemoteActionGroup`. This provides a mechanism to send platform data for action invocations over D-Bus.

Additionally, [method@Gio.DBusConnection.export_action_group] will check if the exported [iface@Gio.ActionGroup] 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.

type RemoteActionGroupBase

type RemoteActionGroupBase struct {
	Ptr uintptr
}

func (*RemoteActionGroupBase) ActivateActionFull

func (x *RemoteActionGroupBase) ActivateActionFull(ActionNameVar string, ParameterVar *glib.Variant, PlatformDataVar *glib.Variant)

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.

func (*RemoteActionGroupBase) ChangeActionStateFull

func (x *RemoteActionGroupBase) ChangeActionStateFull(ActionNameVar string, ValueVar *glib.Variant, PlatformDataVar *glib.Variant)

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.

func (*RemoteActionGroupBase) GoPointer

func (x *RemoteActionGroupBase) GoPointer() uintptr

func (*RemoteActionGroupBase) SetGoPointer

func (x *RemoteActionGroupBase) SetGoPointer(ptr uintptr)

type RemoteActionGroupInterface

type RemoteActionGroupInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

The virtual function table for #GRemoteActionGroup.

func (*RemoteActionGroupInterface) GetActivateActionFull

func (x *RemoteActionGroupInterface) GetActivateActionFull() func(RemoteActionGroup, string, *glib.Variant, *glib.Variant)

GetActivateActionFull gets the "activate_action_full" callback function. the virtual function pointer for g_remote_action_group_activate_action_full()

func (*RemoteActionGroupInterface) GetChangeActionStateFull

func (x *RemoteActionGroupInterface) GetChangeActionStateFull() func(RemoteActionGroup, string, *glib.Variant, *glib.Variant)

GetChangeActionStateFull gets the "change_action_state_full" callback function. the virtual function pointer for g_remote_action_group_change_action_state_full()

func (*RemoteActionGroupInterface) GoPointer

func (x *RemoteActionGroupInterface) GoPointer() uintptr

func (*RemoteActionGroupInterface) OverrideActivateActionFull

func (x *RemoteActionGroupInterface) OverrideActivateActionFull(cb func(RemoteActionGroup, string, *glib.Variant, *glib.Variant))

OverrideActivateActionFull sets the "activate_action_full" callback function. the virtual function pointer for g_remote_action_group_activate_action_full()

func (*RemoteActionGroupInterface) OverrideChangeActionStateFull

func (x *RemoteActionGroupInterface) OverrideChangeActionStateFull(cb func(RemoteActionGroup, string, *glib.Variant, *glib.Variant))

OverrideChangeActionStateFull sets the "change_action_state_full" callback function. the virtual function pointer for g_remote_action_group_change_action_state_full()

type Resolver

type Resolver struct {
	gobject.Object
}

The object that handles DNS resolution. Use [func@Gio.Resolver.get_default] to get the default resolver.

`GResolver` provides cancellable synchronous and asynchronous DNS resolution, for hostnames ([method@Gio.Resolver.lookup_by_address], [method@Gio.Resolver.lookup_by_name] and their async variants) and SRV (service) records ([method@Gio.Resolver.lookup_service]).

[class@Gio.NetworkAddress] and [class@Gio.NetworkService] provide wrappers around `GResolver` functionality that also implement [iface@Gio.SocketConnectable], making it easy to connect to a remote host/service.

The default resolver (see [func@Gio.Resolver.get_default]) has a timeout of 30s set on it since GLib 2.78. Earlier versions of GLib did not support resolver timeouts.

This is an abstract type; subclasses of it implement different resolvers for different platforms and situations.

func ResolverGetDefault

func ResolverGetDefault() *Resolver

Gets the default #GResolver. You should unref it when you are done with it. #GResolver may use its reference count as a hint about how many threads it should allocate for concurrent DNS resolutions.

func ResolverNewFromInternalPtr

func ResolverNewFromInternalPtr(ptr uintptr) *Resolver

func (*Resolver) ConnectReload

func (x *Resolver) ConnectReload(cb *func(Resolver)) uint

Emitted when the resolver notices that the system resolver configuration has changed.

func (*Resolver) GetPropertyTimeout

func (x *Resolver) GetPropertyTimeout() uint

GetPropertyTimeout gets the "timeout" property. The timeout applied to all resolver lookups, in milliseconds.

This may be changed through the lifetime of the #GResolver. The new value will apply to any lookups started after the change, but not to any already-ongoing lookups.

If this is `0`, no timeout is applied to lookups.

No timeout was applied to lookups before this property was added in GLib 2.78.

func (*Resolver) GetTimeout

func (x *Resolver) GetTimeout() uint

Get the timeout applied to all resolver lookups. See #GResolver:timeout.

func (*Resolver) GoPointer

func (c *Resolver) GoPointer() uintptr

func (*Resolver) LookupByAddress

func (x *Resolver) LookupByAddress(AddressVar *InetAddress, CancellableVar *Cancellable) (string, error)

Synchronously reverse-resolves @address to determine its associated hostname.

If the DNS resolution fails, @error (if non-%NULL) will be set to a value from #GResolverError.

If @cancellable is non-%NULL, it can be used to cancel the operation, in which case @error (if non-%NULL) will be set to %G_IO_ERROR_CANCELLED.

func (*Resolver) LookupByAddressAsync

func (x *Resolver) LookupByAddressAsync(AddressVar *InetAddress, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Begins asynchronously reverse-resolving @address to determine its associated hostname, and eventually calls @callback, which must call g_resolver_lookup_by_address_finish() to get the final result.

func (*Resolver) LookupByAddressFinish

func (x *Resolver) LookupByAddressFinish(ResultVar AsyncResult) (string, error)

Retrieves the result of a previous call to g_resolver_lookup_by_address_async().

If the DNS resolution failed, @error (if non-%NULL) will be set to a value from #GResolverError. If the operation was cancelled, @error will be set to %G_IO_ERROR_CANCELLED.

func (*Resolver) LookupByName

func (x *Resolver) LookupByName(HostnameVar string, CancellableVar *Cancellable) (*glib.List, error)

Synchronously resolves @hostname to determine its associated IP address(es). @hostname may be an ASCII-only or UTF-8 hostname, or the textual form of an IP address (in which case this just becomes a wrapper around g_inet_address_new_from_string()).

On success, g_resolver_lookup_by_name() will return a non-empty #GList of #GInetAddress, sorted in order of preference and guaranteed to not contain duplicates. That is, if using the result to connect to @hostname, you should attempt to connect to the first address first, then the second if the first fails, etc. If you are using the result to listen on a socket, it is appropriate to add each result using e.g. g_socket_listener_add_address().

If the DNS resolution fails, @error (if non-%NULL) will be set to a value from #GResolverError and %NULL will be returned.

If @cancellable is non-%NULL, it can be used to cancel the operation, in which case @error (if non-%NULL) will be set to %G_IO_ERROR_CANCELLED.

If you are planning to connect to a socket on the resolved IP address, it may be easier to create a #GNetworkAddress and use its #GSocketConnectable interface.

func (*Resolver) LookupByNameAsync

func (x *Resolver) LookupByNameAsync(HostnameVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Begins asynchronously resolving @hostname to determine its associated IP address(es), and eventually calls @callback, which must call g_resolver_lookup_by_name_finish() to get the result. See g_resolver_lookup_by_name() for more details.

func (*Resolver) LookupByNameFinish

func (x *Resolver) LookupByNameFinish(ResultVar AsyncResult) (*glib.List, error)

Retrieves the result of a call to g_resolver_lookup_by_name_async().

If the DNS resolution failed, @error (if non-%NULL) will be set to a value from #GResolverError. If the operation was cancelled, @error will be set to %G_IO_ERROR_CANCELLED.

func (*Resolver) LookupByNameWithFlags

func (x *Resolver) LookupByNameWithFlags(HostnameVar string, FlagsVar ResolverNameLookupFlags, CancellableVar *Cancellable) (*glib.List, error)

This differs from g_resolver_lookup_by_name() in that you can modify the lookup behavior with @flags. For example this can be used to limit results with %G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY.

func (*Resolver) LookupByNameWithFlagsAsync

func (x *Resolver) LookupByNameWithFlagsAsync(HostnameVar string, FlagsVar ResolverNameLookupFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Begins asynchronously resolving @hostname to determine its associated IP address(es), and eventually calls @callback, which must call g_resolver_lookup_by_name_with_flags_finish() to get the result. See g_resolver_lookup_by_name() for more details.

func (*Resolver) LookupByNameWithFlagsFinish

func (x *Resolver) LookupByNameWithFlagsFinish(ResultVar AsyncResult) (*glib.List, error)

Retrieves the result of a call to g_resolver_lookup_by_name_with_flags_async().

If the DNS resolution failed, @error (if non-%NULL) will be set to a value from #GResolverError. If the operation was cancelled, @error will be set to %G_IO_ERROR_CANCELLED.

func (*Resolver) LookupRecords

func (x *Resolver) LookupRecords(RrnameVar string, RecordTypeVar ResolverRecordType, CancellableVar *Cancellable) (*glib.List, error)

Synchronously performs a DNS record lookup for the given @rrname and returns a list of records as #GVariant tuples. See #GResolverRecordType for information on what the records contain for each @record_type.

If the DNS resolution fails, @error (if non-%NULL) will be set to a value from #GResolverError and %NULL will be returned.

If @cancellable is non-%NULL, it can be used to cancel the operation, in which case @error (if non-%NULL) will be set to %G_IO_ERROR_CANCELLED.

func (*Resolver) LookupRecordsAsync

func (x *Resolver) LookupRecordsAsync(RrnameVar string, RecordTypeVar ResolverRecordType, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Begins asynchronously performing a DNS lookup for the given @rrname, and eventually calls @callback, which must call g_resolver_lookup_records_finish() to get the final result. See g_resolver_lookup_records() for more details.

func (*Resolver) LookupRecordsFinish

func (x *Resolver) LookupRecordsFinish(ResultVar AsyncResult) (*glib.List, error)

Retrieves the result of a previous call to g_resolver_lookup_records_async(). Returns a non-empty list of records as #GVariant tuples. See #GResolverRecordType for information on what the records contain.

If the DNS resolution failed, @error (if non-%NULL) will be set to a value from #GResolverError. If the operation was cancelled, @error will be set to %G_IO_ERROR_CANCELLED.

func (*Resolver) LookupService

func (x *Resolver) LookupService(ServiceVar string, ProtocolVar string, DomainVar string, CancellableVar *Cancellable) (*glib.List, error)

Synchronously performs a DNS SRV lookup for the given @service and @protocol in the given @domain and returns an array of #GSrvTarget. @domain may be an ASCII-only or UTF-8 hostname. Note also that the @service and @protocol arguments do not include the leading underscore that appears in the actual DNS entry.

On success, g_resolver_lookup_service() will return a non-empty #GList of #GSrvTarget, sorted in order of preference. (That is, you should attempt to connect to the first target first, then the second if the first fails, etc.)

If the DNS resolution fails, @error (if non-%NULL) will be set to a value from #GResolverError and %NULL will be returned.

If @cancellable is non-%NULL, it can be used to cancel the operation, in which case @error (if non-%NULL) will be set to %G_IO_ERROR_CANCELLED.

If you are planning to connect to the service, it is usually easier to create a #GNetworkService and use its #GSocketConnectable interface.

func (*Resolver) LookupServiceAsync

func (x *Resolver) LookupServiceAsync(ServiceVar string, ProtocolVar string, DomainVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Begins asynchronously performing a DNS SRV lookup for the given @service and @protocol in the given @domain, and eventually calls @callback, which must call g_resolver_lookup_service_finish() to get the final result. See g_resolver_lookup_service() for more details.

func (*Resolver) LookupServiceFinish

func (x *Resolver) LookupServiceFinish(ResultVar AsyncResult) (*glib.List, error)

Retrieves the result of a previous call to g_resolver_lookup_service_async().

If the DNS resolution failed, @error (if non-%NULL) will be set to a value from #GResolverError. If the operation was cancelled, @error will be set to %G_IO_ERROR_CANCELLED.

func (*Resolver) SetDefault

func (x *Resolver) SetDefault()

Sets @resolver to be the application's default resolver (reffing @resolver, and unreffing the previous default resolver, if any). Future calls to g_resolver_get_default() will return this resolver.

This can be used if an application wants to perform any sort of DNS caching or "pinning"; it can implement its own #GResolver that calls the original default resolver for DNS operations, and implements its own cache policies on top of that, and then set itself as the default resolver for all later code to use.

func (*Resolver) SetGoPointer

func (c *Resolver) SetGoPointer(ptr uintptr)

func (*Resolver) SetPropertyTimeout

func (x *Resolver) SetPropertyTimeout(value uint)

SetPropertyTimeout sets the "timeout" property. The timeout applied to all resolver lookups, in milliseconds.

This may be changed through the lifetime of the #GResolver. The new value will apply to any lookups started after the change, but not to any already-ongoing lookups.

If this is `0`, no timeout is applied to lookups.

No timeout was applied to lookups before this property was added in GLib 2.78.

func (*Resolver) SetTimeout

func (x *Resolver) SetTimeout(TimeoutMsVar uint)

Set the timeout applied to all resolver lookups. See #GResolver:timeout.

type ResolverClass

type ResolverClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*ResolverClass) GetLookupByAddress

func (x *ResolverClass) GetLookupByAddress() func(*Resolver, *InetAddress, *Cancellable) string

GetLookupByAddress gets the "lookup_by_address" callback function.

func (*ResolverClass) GetLookupByAddressAsync

func (x *ResolverClass) GetLookupByAddressAsync() func(*Resolver, *InetAddress, *Cancellable, *AsyncReadyCallback, uintptr)

GetLookupByAddressAsync gets the "lookup_by_address_async" callback function.

func (*ResolverClass) GetLookupByAddressFinish

func (x *ResolverClass) GetLookupByAddressFinish() func(*Resolver, AsyncResult) string

GetLookupByAddressFinish gets the "lookup_by_address_finish" callback function.

func (*ResolverClass) GetLookupByName

func (x *ResolverClass) GetLookupByName() func(*Resolver, string, *Cancellable) *glib.List

GetLookupByName gets the "lookup_by_name" callback function.

func (*ResolverClass) GetLookupByNameAsync

func (x *ResolverClass) GetLookupByNameAsync() func(*Resolver, string, *Cancellable, *AsyncReadyCallback, uintptr)

GetLookupByNameAsync gets the "lookup_by_name_async" callback function.

func (*ResolverClass) GetLookupByNameFinish

func (x *ResolverClass) GetLookupByNameFinish() func(*Resolver, AsyncResult) *glib.List

GetLookupByNameFinish gets the "lookup_by_name_finish" callback function.

func (*ResolverClass) GetLookupByNameWithFlags

func (x *ResolverClass) GetLookupByNameWithFlags() func(*Resolver, string, ResolverNameLookupFlags, *Cancellable) *glib.List

GetLookupByNameWithFlags gets the "lookup_by_name_with_flags" callback function.

func (*ResolverClass) GetLookupByNameWithFlagsAsync

func (x *ResolverClass) GetLookupByNameWithFlagsAsync() func(*Resolver, string, ResolverNameLookupFlags, *Cancellable, *AsyncReadyCallback, uintptr)

GetLookupByNameWithFlagsAsync gets the "lookup_by_name_with_flags_async" callback function.

func (*ResolverClass) GetLookupByNameWithFlagsFinish

func (x *ResolverClass) GetLookupByNameWithFlagsFinish() func(*Resolver, AsyncResult) *glib.List

GetLookupByNameWithFlagsFinish gets the "lookup_by_name_with_flags_finish" callback function.

func (*ResolverClass) GetLookupRecords

func (x *ResolverClass) GetLookupRecords() func(*Resolver, string, ResolverRecordType, *Cancellable) *glib.List

GetLookupRecords gets the "lookup_records" callback function.

func (*ResolverClass) GetLookupRecordsAsync

func (x *ResolverClass) GetLookupRecordsAsync() func(*Resolver, string, ResolverRecordType, *Cancellable, *AsyncReadyCallback, uintptr)

GetLookupRecordsAsync gets the "lookup_records_async" callback function.

func (*ResolverClass) GetLookupRecordsFinish

func (x *ResolverClass) GetLookupRecordsFinish() func(*Resolver, AsyncResult) *glib.List

GetLookupRecordsFinish gets the "lookup_records_finish" callback function.

func (*ResolverClass) GetLookupService

func (x *ResolverClass) GetLookupService() func(*Resolver, string, *Cancellable) *glib.List

GetLookupService gets the "lookup_service" callback function.

func (*ResolverClass) GetLookupServiceAsync

func (x *ResolverClass) GetLookupServiceAsync() func(*Resolver, string, *Cancellable, *AsyncReadyCallback, uintptr)

GetLookupServiceAsync gets the "lookup_service_async" callback function.

func (*ResolverClass) GetLookupServiceFinish

func (x *ResolverClass) GetLookupServiceFinish() func(*Resolver, AsyncResult) *glib.List

GetLookupServiceFinish gets the "lookup_service_finish" callback function.

func (*ResolverClass) GetReload

func (x *ResolverClass) GetReload() func(*Resolver)

GetReload gets the "reload" callback function.

func (*ResolverClass) GoPointer

func (x *ResolverClass) GoPointer() uintptr

func (*ResolverClass) OverrideLookupByAddress

func (x *ResolverClass) OverrideLookupByAddress(cb func(*Resolver, *InetAddress, *Cancellable) string)

OverrideLookupByAddress sets the "lookup_by_address" callback function.

func (*ResolverClass) OverrideLookupByAddressAsync

func (x *ResolverClass) OverrideLookupByAddressAsync(cb func(*Resolver, *InetAddress, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideLookupByAddressAsync sets the "lookup_by_address_async" callback function.

func (*ResolverClass) OverrideLookupByAddressFinish

func (x *ResolverClass) OverrideLookupByAddressFinish(cb func(*Resolver, AsyncResult) string)

OverrideLookupByAddressFinish sets the "lookup_by_address_finish" callback function.

func (*ResolverClass) OverrideLookupByName

func (x *ResolverClass) OverrideLookupByName(cb func(*Resolver, string, *Cancellable) *glib.List)

OverrideLookupByName sets the "lookup_by_name" callback function.

func (*ResolverClass) OverrideLookupByNameAsync

func (x *ResolverClass) OverrideLookupByNameAsync(cb func(*Resolver, string, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideLookupByNameAsync sets the "lookup_by_name_async" callback function.

func (*ResolverClass) OverrideLookupByNameFinish

func (x *ResolverClass) OverrideLookupByNameFinish(cb func(*Resolver, AsyncResult) *glib.List)

OverrideLookupByNameFinish sets the "lookup_by_name_finish" callback function.

func (*ResolverClass) OverrideLookupByNameWithFlags

func (x *ResolverClass) OverrideLookupByNameWithFlags(cb func(*Resolver, string, ResolverNameLookupFlags, *Cancellable) *glib.List)

OverrideLookupByNameWithFlags sets the "lookup_by_name_with_flags" callback function.

func (*ResolverClass) OverrideLookupByNameWithFlagsAsync

func (x *ResolverClass) OverrideLookupByNameWithFlagsAsync(cb func(*Resolver, string, ResolverNameLookupFlags, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideLookupByNameWithFlagsAsync sets the "lookup_by_name_with_flags_async" callback function.

func (*ResolverClass) OverrideLookupByNameWithFlagsFinish

func (x *ResolverClass) OverrideLookupByNameWithFlagsFinish(cb func(*Resolver, AsyncResult) *glib.List)

OverrideLookupByNameWithFlagsFinish sets the "lookup_by_name_with_flags_finish" callback function.

func (*ResolverClass) OverrideLookupRecords

func (x *ResolverClass) OverrideLookupRecords(cb func(*Resolver, string, ResolverRecordType, *Cancellable) *glib.List)

OverrideLookupRecords sets the "lookup_records" callback function.

func (*ResolverClass) OverrideLookupRecordsAsync

func (x *ResolverClass) OverrideLookupRecordsAsync(cb func(*Resolver, string, ResolverRecordType, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideLookupRecordsAsync sets the "lookup_records_async" callback function.

func (*ResolverClass) OverrideLookupRecordsFinish

func (x *ResolverClass) OverrideLookupRecordsFinish(cb func(*Resolver, AsyncResult) *glib.List)

OverrideLookupRecordsFinish sets the "lookup_records_finish" callback function.

func (*ResolverClass) OverrideLookupService

func (x *ResolverClass) OverrideLookupService(cb func(*Resolver, string, *Cancellable) *glib.List)

OverrideLookupService sets the "lookup_service" callback function.

func (*ResolverClass) OverrideLookupServiceAsync

func (x *ResolverClass) OverrideLookupServiceAsync(cb func(*Resolver, string, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideLookupServiceAsync sets the "lookup_service_async" callback function.

func (*ResolverClass) OverrideLookupServiceFinish

func (x *ResolverClass) OverrideLookupServiceFinish(cb func(*Resolver, AsyncResult) *glib.List)

OverrideLookupServiceFinish sets the "lookup_service_finish" callback function.

func (*ResolverClass) OverrideReload

func (x *ResolverClass) OverrideReload(cb func(*Resolver))

OverrideReload sets the "reload" callback function.

type ResolverError

type ResolverError int

An error code used with %G_RESOLVER_ERROR in a #GError returned from a #GResolver routine.

const (

	// the requested name/address/service was not
	//     found
	GResolverErrorNotFoundValue ResolverError = 0
	// the requested information could not
	//     be looked up due to a network error or similar problem
	GResolverErrorTemporaryFailureValue ResolverError = 1
	// unknown error
	GResolverErrorInternalValue ResolverError = 2
)

type ResolverNameLookupFlags

type ResolverNameLookupFlags int

Flags to modify lookup behavior.

const (

	// default behavior (same as g_resolver_lookup_by_name())
	GResolverNameLookupFlagsDefaultValue ResolverNameLookupFlags = 0
	// only resolve ipv4 addresses
	GResolverNameLookupFlagsIpv4OnlyValue ResolverNameLookupFlags = 1
	// only resolve ipv6 addresses
	GResolverNameLookupFlagsIpv6OnlyValue ResolverNameLookupFlags = 2
)

type ResolverPrivate

type ResolverPrivate struct {
	// contains filtered or unexported fields
}

func (*ResolverPrivate) GoPointer

func (x *ResolverPrivate) GoPointer() uintptr

type ResolverRecordType

type ResolverRecordType int

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.

const (

	// look up DNS SRV records for a domain
	GResolverRecordSrvValue ResolverRecordType = 1
	// look up DNS MX records for a domain
	GResolverRecordMxValue ResolverRecordType = 2
	// look up DNS TXT records for a name
	GResolverRecordTxtValue ResolverRecordType = 3
	// look up DNS SOA records for a zone
	GResolverRecordSoaValue ResolverRecordType = 4
	// look up DNS NS records for a domain
	GResolverRecordNsValue ResolverRecordType = 5
)

type Resource

type Resource struct {
	// contains filtered or unexported fields
}

Applications and libraries often contain binary or textual data that is really part of the application, rather than user data. For instance [`GtkBuilder`](https://docs.gtk.org/gtk4/class.Builder.html) `.ui` files, splashscreen images, [class@Gio.Menu] markup XML, CSS files, icons, etc. These are often shipped as files in `$datadir/appname`, or manually included as literal strings in the code.

The `GResource` API and the [`glib-compile-resources`](glib-compile-resources.html) program provide a convenient and efficient alternative to this which has some nice properties. You maintain the files as normal files, so it’s easy to edit them, but during the build the files are combined into a binary bundle that is linked into the executable. This means that loading the resource files are efficient (as they are already in memory, shared with other instances) and simple (no need to check for things like I/O errors or locate the files in the filesystem). It also makes it easier to create relocatable applications.

Resource files can also be marked as compressed. Such files will be included in the resource bundle in a compressed form, but will be automatically uncompressed when the resource is used. This is very useful e.g. for larger text files that are parsed once (or rarely) and then thrown away.

Resource files can also be marked to be preprocessed, by setting the value of the `preprocess` attribute to a comma-separated list of preprocessing options. The only options currently supported are:

  • `xml-stripblanks` which will use the [`xmllint`](man:xmllint(1)) command to strip ignorable whitespace from the XML file. For this to work, the `XMLLINT` environment variable must be set to the full path to the xmllint executable, or xmllint must be in the `PATH`; otherwise the preprocessing step is skipped.

  • `to-pixdata` (deprecated since gdk-pixbuf 2.32) which will use the `gdk-pixbuf-pixdata` command to convert images to the [`GdkPixdata`](https://docs.gtk.org/gdk-pixbuf/class.Pixdata.html) format, which allows you to create pixbufs directly using the data inside the resource file, rather than an (uncompressed) copy of it. For this, the `gdk-pixbuf-pixdata` program must be in the `PATH`, or the `GDK_PIXBUF_PIXDATA` environment variable must be set to the full path to the `gdk-pixbuf-pixdata` executable; otherwise the resource compiler will abort. `to-pixdata` has been deprecated since gdk-pixbuf 2.32, as `GResource` supports embedding modern image formats just as well. Instead of using it, embed a PNG or SVG file in your `GResource`.

  • `json-stripblanks` which will use the [`json-glib-format`](man:json-glib-format(1)) command to strip ignorable whitespace from the JSON file. For this to work, the `JSON_GLIB_FORMAT` environment variable must be set to the full path to the `json-glib-format` executable, or it must be in the `PATH`; otherwise the preprocessing step is skipped. In addition, at least version 1.6 of `json-glib-format` is required.

Resource files will be exported in the `GResource` namespace using the combination of the given `prefix` and the filename from the `file` element. The `alias` attribute can be used to alter the filename to expose them at a different location in the resource namespace. Typically, this is used to include files from a different source directory without exposing the source directory in the resource namespace, as in the example below.

Resource bundles are created by the [`glib-compile-resources`](glib-compile-resources.html) program which takes an XML file that describes the bundle, and a set of files that the XML references. These are combined into a binary resource bundle.

An example resource description: ```xml <?xml version="1.0" encoding="UTF-8"?> <gresources>

<gresource prefix="/org/gtk/Example">
  <file>data/splashscreen.png</file>
  <file compressed="true">dialog.ui</file>
  <file preprocess="xml-stripblanks">menumarkup.xml</file>
  <file alias="example.css">data/example.css</file>
</gresource>

</gresources> ```

This will create a resource bundle with the following files: ``` /org/gtk/Example/data/splashscreen.png /org/gtk/Example/dialog.ui /org/gtk/Example/menumarkup.xml /org/gtk/Example/example.css ```

Note that all resources in the process share the same namespace, so use Java-style path prefixes (like in the above example) to avoid conflicts.

You can then use [`glib-compile-resources`](glib-compile-resources.html) to compile the XML to a binary bundle that you can load with [func@Gio.Resource.load]. However, it’s more common to use the `--generate-source` and `--generate-header` arguments to create a source file and header to link directly into your application. This will generate `get_resource()`, `register_resource()` and `unregister_resource()` functions, prefixed by the `--c-name` argument passed to [`glib-compile-resources`](glib-compile-resources.html). `get_resource()` returns the generated `GResource` object. The register and unregister functions register the resource so its files can be accessed using [func@Gio.resources_lookup_data].

Once a `GResource` has been created and registered all the data in it can be accessed globally in the process by using API calls like [func@Gio.resources_open_stream] to stream the data or [func@Gio.resources_lookup_data] to get a direct pointer to the data. You can also use URIs like `resource:///org/gtk/Example/data/splashscreen.png` with [iface@Gio.File] to access the resource data.

Some higher-level APIs, such as [`GtkApplication`](https://docs.gtk.org/gtk4/class.Application.html), will automatically load resources from certain well-known paths in the resource namespace as a convenience. See the documentation for those APIs for details.

There are two forms of the generated source, the default version uses the compiler support for constructor and destructor functions (where available) to automatically create and register the `GResource` on startup or library load time. If you pass `--manual-register`, two functions to register/unregister the resource are created instead. This requires an explicit initialization call in your application/library, but it works on all platforms, even on the minor ones where constructors are not supported. (Constructor support is available for at least Win32, Mac OS and Linux.)

Note that resource data can point directly into the data segment of e.g. a library, so if you are unloading libraries during runtime you need to be very careful with keeping around pointers to data from a resource, as this goes away when the library is unloaded. However, in practice this is not generally a problem, since most resource accesses are for your own resources, and resource data is often used once, during parsing, and then released.

Overlays

When debugging a program or testing a change to an installed version, it is often useful to be able to replace resources in the program or library, without recompiling, for debugging or quick hacking and testing purposes. Since GLib 2.50, it is possible to use the `G_RESOURCE_OVERLAYS` environment variable to selectively overlay resources with replacements from the filesystem. It is a `G_SEARCHPATH_SEPARATOR`-separated list of substitutions to perform during resource lookups. It is ignored when running in a setuid process.

A substitution has the form

``` /org/gtk/libgtk=/home/desrt/gtk-overlay ```

The part before the `=` is the resource subpath for which the overlay applies. The part after is a filesystem path which contains files and subdirectories as you would like to be loaded as resources with the equivalent names.

In the example above, if an application tried to load a resource with the resource path `/org/gtk/libgtk/ui/gtkdialog.ui` then `GResource` would check the filesystem path `/home/desrt/gtk-overlay/ui/gtkdialog.ui`. If a file was found there, it would be used instead. This is an overlay, not an outright replacement, which means that if a file is not found at that path, the built-in version will be used instead. Whiteouts are not currently supported.

Substitutions must start with a slash, and must not contain a trailing slash before the `=`. The filesystem path after the `=` should ideally be absolute, but this is not strictly required. It is possible to overlay the location of a single resource with an individual file.

func NewResourceFromData

func NewResourceFromData(DataVar *glib.Bytes) (*Resource, error)

Creates a [struct@Gio.Resource] from a reference to the binary resource bundle.

This will keep a reference to @data while the resource lives, so the data should not be modified or freed.

If you want to use this resource in the global resource namespace you need to register it with [func@Gio.resources_register].

Note: @data must be backed by memory that is at least pointer aligned. Otherwise this function will internally create a copy of the memory since GLib 2.56, or in older versions fail and exit the process.

If @data is empty or corrupt, %G_RESOURCE_ERROR_INTERNAL will be returned.

func ResourceLoad

func ResourceLoad(FilenameVar string) (*Resource, error)

Loads a binary resource bundle and creates a [struct@Gio.Resource] 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 [func@Gio.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 [ctor@GLib.MappedFile.new] will be returned.

func (*Resource) EnumerateChildren

func (x *Resource) EnumerateChildren(PathVar string, LookupFlagsVar ResourceLookupFlags) ([]string, error)

Returns all the names of children at the specified @path in the resource.

The return result is a `NULL` terminated list of strings which should be released with [func@GLib.strfreev].

If @path is invalid or does not exist in the [struct@Gio.Resource], %G_RESOURCE_ERROR_NOT_FOUND will be returned.

@lookup_flags controls the behaviour of the lookup.

func (*Resource) GetInfo

func (x *Resource) GetInfo(PathVar string, LookupFlagsVar ResourceLookupFlags, SizeVar *uint, FlagsVar *uint32) (bool, error)

Looks for a file at the specified @path in the resource and if found returns information about it.

@lookup_flags controls the behaviour of the lookup.

The only error this can return is %G_RESOURCE_ERROR_NOT_FOUND, if @path was not found in @resource.

func (*Resource) GoPointer

func (x *Resource) GoPointer() uintptr

func (*Resource) HasChildren

func (x *Resource) HasChildren(PathVar string) bool

Returns whether the specified @path in the resource has children.

func (*Resource) LookupData

func (x *Resource) LookupData(PathVar string, LookupFlagsVar ResourceLookupFlags) (*glib.Bytes, error)

Looks for a file at the specified @path in the resource and returns a [struct@GLib.Bytes] 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 [struct@GLib.Bytes].

For uncompressed resource files this is a pointer directly into the resource bundle, which is typically in some read-only data section in the program binary. For compressed files, memory is allocated on the heap and the data is automatically uncompressed.

@lookup_flags controls the behaviour of the lookup.

This can return error %G_RESOURCE_ERROR_NOT_FOUND if @path was not found in @resource, or %G_RESOURCE_ERROR_INTERNAL if decompression of a compressed resource failed.

func (*Resource) OpenStream

func (x *Resource) OpenStream(PathVar string, LookupFlagsVar ResourceLookupFlags) (*InputStream, error)

Looks for a file at the specified @path in the resource and returns a [class@Gio.InputStream] that lets you read the data.

@lookup_flags controls the behaviour of the lookup.

The only error this can return is %G_RESOURCE_ERROR_NOT_FOUND, if @path was not found in @resource.

func (*Resource) Ref

func (x *Resource) Ref() *Resource

Atomically increments the reference count of @resource by one.

This function is threadsafe and may be called from any thread.

func (*Resource) Register

func (x *Resource) Register()

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 [func@Gio.resources_lookup_data].

func (*Resource) Unref

func (x *Resource) Unref()

Atomically decrements the reference count of @resource by one.

If the reference count drops to 0, all memory allocated by the resource is released. This function is threadsafe and may be called from any thread.

func (*Resource) Unregister

func (x *Resource) Unregister()

Unregisters the resource from the process-global set of resources.

type ResourceError

type ResourceError int

An error code used with %G_RESOURCE_ERROR in a #GError returned from a #GResource routine.

const (

	// no file was found at the requested path
	GResourceErrorNotFoundValue ResourceError = 0
	// unknown error
	GResourceErrorInternalValue ResourceError = 1
)

type ResourceFlags

type ResourceFlags int

GResourceFlags give information about a particular file inside a resource bundle.

const (

	// No flags set.
	GResourceFlagsNoneValue ResourceFlags = 0
	// The file is compressed.
	GResourceFlagsCompressedValue ResourceFlags = 1
)

type ResourceLookupFlags

type ResourceLookupFlags int

GResourceLookupFlags determine how resource path lookups are handled.

const (

	// No flags set.
	GResourceLookupFlagsNoneValue ResourceLookupFlags = 0
)

type Seekable

type Seekable interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	CanSeek() bool
	CanTruncate() bool
	Seek(OffsetVar int64, TypeVar glib.SeekType, CancellableVar *Cancellable) (bool, error)
	Tell() int64
	Truncate(OffsetVar int64, CancellableVar *Cancellable) (bool, error)
}

`GSeekable` is implemented by streams (implementations of [class@Gio.InputStream] or [class@Gio.OutputStream]) 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()`](man:lseek(2)) 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()`](man:lseek(2)) on a normal file. Seeking past the end and writing data will usually cause the stream to resize by introducing zero bytes.

type SeekableBase

type SeekableBase struct {
	Ptr uintptr
}

func (*SeekableBase) CanSeek

func (x *SeekableBase) CanSeek() bool

Tests if the stream supports the #GSeekableIface.

func (*SeekableBase) CanTruncate

func (x *SeekableBase) CanTruncate() bool

Tests if the length of the stream can be adjusted with g_seekable_truncate().

func (*SeekableBase) GoPointer

func (x *SeekableBase) GoPointer() uintptr

func (*SeekableBase) Seek

func (x *SeekableBase) Seek(OffsetVar int64, TypeVar glib.SeekType, CancellableVar *Cancellable) (bool, error)

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.

func (*SeekableBase) SetGoPointer

func (x *SeekableBase) SetGoPointer(ptr uintptr)

func (*SeekableBase) Tell

func (x *SeekableBase) Tell() int64

Tells the current position within the stream.

func (*SeekableBase) Truncate

func (x *SeekableBase) Truncate(OffsetVar int64, CancellableVar *Cancellable) (bool, error)

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.

type SeekableIface

type SeekableIface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

Provides an interface for implementing seekable functionality on I/O Streams.

func (*SeekableIface) GetCanSeek

func (x *SeekableIface) GetCanSeek() func(Seekable) bool

GetCanSeek gets the "can_seek" callback function. Checks if seeking is supported by the stream.

func (*SeekableIface) GetCanTruncate

func (x *SeekableIface) GetCanTruncate() func(Seekable) bool

GetCanTruncate gets the "can_truncate" callback function. Checks if truncation is supported by the stream.

func (*SeekableIface) GetSeek

func (x *SeekableIface) GetSeek() func(Seekable, int64, glib.SeekType, *Cancellable) bool

GetSeek gets the "seek" callback function. Seeks to a location within a stream.

func (*SeekableIface) GetTell

func (x *SeekableIface) GetTell() func(Seekable) int64

GetTell gets the "tell" callback function. Tells the current location within a stream.

func (*SeekableIface) GetTruncateFn

func (x *SeekableIface) GetTruncateFn() func(Seekable, int64, *Cancellable) bool

GetTruncateFn gets the "truncate_fn" callback function. Truncates a stream.

func (*SeekableIface) GoPointer

func (x *SeekableIface) GoPointer() uintptr

func (*SeekableIface) OverrideCanSeek

func (x *SeekableIface) OverrideCanSeek(cb func(Seekable) bool)

OverrideCanSeek sets the "can_seek" callback function. Checks if seeking is supported by the stream.

func (*SeekableIface) OverrideCanTruncate

func (x *SeekableIface) OverrideCanTruncate(cb func(Seekable) bool)

OverrideCanTruncate sets the "can_truncate" callback function. Checks if truncation is supported by the stream.

func (*SeekableIface) OverrideSeek

func (x *SeekableIface) OverrideSeek(cb func(Seekable, int64, glib.SeekType, *Cancellable) bool)

OverrideSeek sets the "seek" callback function. Seeks to a location within a stream.

func (*SeekableIface) OverrideTell

func (x *SeekableIface) OverrideTell(cb func(Seekable) int64)

OverrideTell sets the "tell" callback function. Tells the current location within a stream.

func (*SeekableIface) OverrideTruncateFn

func (x *SeekableIface) OverrideTruncateFn(cb func(Seekable, int64, *Cancellable) bool)

OverrideTruncateFn sets the "truncate_fn" callback function. Truncates a stream.

type Settings

type Settings struct {
	gobject.Object
}

The `GSettings` class provides a convenient API for storing and retrieving application settings.

Reads and writes can be considered to be non-blocking. Reading settings with `GSettings` is typically extremely fast: on approximately the same order of magnitude (but slower than) a [struct@GLib.HashTable] lookup. Writing settings is also extremely fast in terms of time to return to your application, but can be extremely expensive for other threads and other processes. Many settings backends (including dconf) have lazy initialisation which means in the common case of the user using their computer without modifying any settings a lot of work can be avoided. For dconf, the D-Bus service doesn’t even need to be started in this case. For this reason, you should only ever modify `GSettings` keys in response to explicit user action. Particular care should be paid to ensure that modifications are not made during startup — for example, when setting the initial value of preferences widgets. The built-in [method@Gio.Settings.bind] functionality is careful not to write settings in response to notify signals as a result of modifications that it makes to widgets.

When creating a `GSettings` instance, you have to specify a schema that describes the keys in your settings and their types and default values, as well as some other information.

Normally, a schema has a fixed path that determines where the settings are stored in the conceptual global tree of settings. However, schemas can also be ‘[relocatable](#relocatable-schemas)’, i.e. not equipped with a fixed path. This is useful e.g. when the schema describes an ‘account’, and you want to be able to store a arbitrary number of accounts.

Paths must start with and end with a forward slash character (`/`) and must not contain two sequential slash characters. Paths should be chosen based on a domain name associated with the program or library to which the settings belong. Examples of paths are `/org/gtk/settings/file-chooser/` and `/ca/desrt/dconf-editor/`. Paths should not start with `/apps/`, `/desktop/` or `/system/` as they often did in GConf.

Unlike other configuration systems (like GConf), GSettings does not restrict keys to basic types like strings and numbers. GSettings stores values as [struct@GLib.Variant], and allows any [type@GLib.VariantType] for keys. Key names are restricted to lowercase characters, numbers and `-`. Furthermore, the names must begin with a lowercase character, must not end with a `-`, and must not contain consecutive dashes.

Similar to GConf, the default values in GSettings schemas can be localized, but the localized values are stored in gettext catalogs and looked up with the domain that is specified in the `gettext-domain` attribute of the `<schemalist>` or `<schema>` elements and the category that is specified in the `l10n` attribute of the `<default>` element. The string which is translated includes all text in the `<default>` element, including any surrounding quotation marks.

The `l10n` attribute must be set to `messages` or `time`, and sets the [locale category for translation](https://www.gnu.org/software/gettext/manual/html_node/Aspects.html#index-locale-categories-1). The `messages` category should be used by default; use `time` for translatable date or time formats. A translation comment can be added as an XML comment immediately above the `<default>` element — it is recommended to add these comments to aid translators understand the meaning and implications of the default value. An optional translation `context` attribute can be set on the `<default>` element to disambiguate multiple defaults which use the same string.

For example: ```xml

<!-- Translators: A list of words which are not allowed to be typed, in
     GVariant serialization syntax.
     See: https://developer.gnome.org/glib/stable/gvariant-text.html -->
<default l10n='messages' context='Banned words'>['bad', 'words']</default>

```

Translations of default values must remain syntactically valid serialized [struct@GLib.Variant]s (e.g. retaining any surrounding quotation marks) or runtime errors will occur.

GSettings uses schemas in a compact binary form that is created by the [`glib-compile-schemas`](glib-compile-schemas.html) utility. The input is a schema description in an XML format.

A DTD for the gschema XML format can be found here: [gschema.dtd](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/gschema.dtd)

The [`glib-compile-schemas`](glib-compile-schemas.html) tool expects schema files to have the extension `.gschema.xml`.

At runtime, schemas are identified by their ID (as specified in the `id` attribute of the `<schema>` element). The convention for schema IDs is to use a dotted name, similar in style to a D-Bus bus name, e.g. `org.gnome.SessionManager`. In particular, if the settings are for a specific service that owns a D-Bus bus name, the D-Bus bus name and schema ID should match. For schemas which deal with settings not associated with one named application, the ID should not use StudlyCaps, e.g. `org.gnome.font-rendering`.

In addition to [struct@GLib.Variant] types, keys can have types that have enumerated types. These can be described by a `<choice>`, `<enum>` or `<flags>` element, as seen in the second example below. The underlying type of such a key is string, but you can use [method@Gio.Settings.get_enum], [method@Gio.Settings.set_enum], [method@Gio.Settings.get_flags], [method@Gio.Settings.set_flags] access the numeric values corresponding to the string value of enum and flags keys.

An example for default value: ```xml <schemalist>

<schema id="org.gtk.Test" path="/org/gtk/Test/" gettext-domain="test">

  <key name="greeting" type="s">
    <default l10n="messages">"Hello, earthlings"</default>
    <summary>A greeting</summary>
    <description>
      Greeting of the invading martians
    </description>
  </key>

  <key name="box" type="(ii)">
    <default>(20,30)</default>
  </key>

  <key name="empty-string" type="s">
    <default>""</default>
    <summary>Empty strings have to be provided in GVariant form</summary>
  </key>

</schema>

</schemalist> ```

An example for ranges, choices and enumerated types: ```xml <schemalist>

<enum id="org.gtk.Test.myenum">
  <value nick="first" value="1"/>
  <value nick="second" value="2"/>
</enum>

<flags id="org.gtk.Test.myflags">
  <value nick="flag1" value="1"/>
  <value nick="flag2" value="2"/>
  <value nick="flag3" value="4"/>
</flags>

<schema id="org.gtk.Test">

  <key name="key-with-range" type="i">
    <range min="1" max="100"/>
    <default>10</default>
  </key>

  <key name="key-with-choices" type="s">
    <choices>
      <choice value='Elisabeth'/>
      <choice value='Annabeth'/>
      <choice value='Joe'/>
    </choices>
    <aliases>
      <alias value='Anna' target='Annabeth'/>
      <alias value='Beth' target='Elisabeth'/>
    </aliases>
    <default>'Joe'</default>
  </key>

  <key name='enumerated-key' enum='org.gtk.Test.myenum'>
    <default>'first'</default>
  </key>

  <key name='flags-key' flags='org.gtk.Test.myflags'>
    <default>["flag1","flag2"]</default>
  </key>
</schema>

</schemalist> ```

## Vendor overrides

Default values are defined in the schemas that get installed by an application. Sometimes, it is necessary for a vendor or distributor to adjust these defaults. Since patching the XML source for the schema is inconvenient and error-prone, [`glib-compile-schemas`](glib-compile-schemas.html) reads so-called ‘vendor override’ files. These are keyfiles in the same directory as the XML schema sources which can override default values. The schema ID serves as the group name in the key file, and the values are expected in serialized [struct@GLib.Variant] form, as in the following example: ``` [org.gtk.Example] key1='string' key2=1.5 ```

`glib-compile-schemas` expects schema files to have the extension `.gschema.override`.

## Delay-apply mode

By default, values set on a [class@Gio.Settings] instance immediately start to be written to the backend (although these writes may not complete by the time that [method@Gio.Settings.set]) returns; see [func@Gio.Settings.sync]).

In order to allow groups of settings to be changed simultaneously and atomically, GSettings also supports a ‘delay-apply’ mode. In this mode, updated values are kept locally in the [class@Gio.Settings] instance until they are explicitly applied by calling [method@Gio.Settings.apply].

For example, this could be useful for a preferences dialog where the preferences all need to be applied simultaneously when the user clicks ‘Save’.

Switching a [class@Gio.Settings] instance to ‘delay-apply’ mode is a one-time irreversible operation: from that point onwards, *all* changes made to that [class@Gio.Settings] have to be explicitly applied by calling [method@Gio.Settings.apply]. The ‘delay-apply’ mode is also propagated to any child settings objects subsequently created using [method@Gio.Settings.get_child].

At any point, the set of unapplied changes can be queried using [property@Gio.Settings:has-unapplied], and discarded by calling [method@Gio.Settings.revert].

## Binding

A very convenient feature of GSettings lets you bind [class@GObject.Object] properties directly to settings, using [method@Gio.Settings.bind]. Once a [class@GObject.Object] property has been bound to a setting, changes on either side are automatically propagated to the other side. GSettings handles details like mapping between [class@GObject.Object] and [struct@GLib.Variant] types, and preventing infinite cycles.

This makes it very easy to hook up a preferences dialog to the underlying settings. To make this even more convenient, GSettings looks for a boolean property with the name `sensitivity` and automatically binds it to the writability of the bound setting. If this ‘magic’ gets in the way, it can be suppressed with the `G_SETTINGS_BIND_NO_SENSITIVITY` flag.

## Relocatable schemas

A relocatable schema is one with no `path` attribute specified on its `<schema>` element. By using [ctor@Gio.Settings.new_with_path], a `GSettings` object can be instantiated for a relocatable schema, assigning a path to the instance. Paths passed to [ctor@Gio.Settings.new_with_path] will typically be constructed dynamically from a constant prefix plus some form of instance identifier; but they must still be valid GSettings paths. Paths could also be constant and used with a globally installed schema originating from a dependency library.

For example, a relocatable schema could be used to store geometry information for different windows in an application. If the schema ID was `org.foo.MyApp.Window`, it could be instantiated for paths `/org/foo/MyApp/main/`, `/org/foo/MyApp/document-1/`, `/org/foo/MyApp/document-2/`, etc. If any of the paths are well-known they can be specified as `<child>` elements in the parent schema, e.g.: ```xml <schema id="org.foo.MyApp" path="/org/foo/MyApp/">

<child name="main" schema="org.foo.MyApp.Window"/>

</schema> ```

## Build system integration

### Meson

GSettings is natively supported by Meson’s [GNOME module](https://mesonbuild.com/Gnome-module.html).

You can install the schemas as any other data file:

``` install_data(

'org.foo.MyApp.gschema.xml',
install_dir: get_option('datadir') / 'glib-2.0/schemas',

) ```

You can use `gnome.post_install()` function to compile the schemas on installation:

``` gnome = import('gnome') gnome.post_install(

glib_compile_schemas: true,

) ```

If an enumerated type defined in a C header file is to be used in a GSettings schema, it can either be defined manually using an `<enum>` element in the schema XML, or it can be extracted automatically from the C header. This approach is preferred, as it ensures the two representations are always synchronised. To do so, you will need to use the `gnome.mkenums()` function with the following templates:

``` schemas_enums = gnome.mkenums('org.foo.MyApp.enums.xml',

comments: '<!-- @comment@ -->',
fhead: '<schemalist>',
vhead: '  <@type@ id="org.foo.MyApp.@EnumName@">',
vprod: '    <value nick="@valuenick@" value="@valuenum@"/>',
vtail: '  </@type@>',
ftail: '</schemalist>',
sources: enum_sources,
install_header: true,
install_dir: get_option('datadir') / 'glib-2.0/schemas',

) ```

It is recommended to validate your schemas as part of the test suite for your application:

``` test('validate-schema',

find_program('glib-compile-schemas'),
args: ['--strict', '--dry-run', meson.current_source_dir()],

) ```

If your application allows running uninstalled, you should also use the `gnome.compile_schemas()` function to compile the schemas in the current build directory:

``` gnome.compile_schemas() ```

### Autotools

GSettings comes with autotools integration to simplify compiling and installing schemas. To add GSettings support to an application, add the following to your `configure.ac`: ``` GLIB_GSETTINGS ```

In the appropriate `Makefile.am`, use the following snippet to compile and install the named schema: ``` gsettings_SCHEMAS = org.foo.MyApp.gschema.xml EXTRA_DIST = $(gsettings_SCHEMAS)

@GSETTINGS_RULES@ ```

If an enumerated type defined in a C header file is to be used in a GSettings schema, it can either be defined manually using an `<enum>` element in the schema XML, or it can be extracted automatically from the C header. This approach is preferred, as it ensures the two representations are always synchronised. To do so, add the following to the relevant `Makefile.am`: ``` gsettings_ENUM_NAMESPACE = org.foo.MyApp gsettings_ENUM_FILES = my-app-enums.h my-app-misc.h ```

`gsettings_ENUM_NAMESPACE` specifies the schema namespace for the enum files, which are specified in `gsettings_ENUM_FILES`. This will generate a `org.foo.MyApp.enums.xml` file containing the extracted enums, which will be automatically included in the schema compilation, install and uninstall rules. It should not be committed to version control or included in `EXTRA_DIST`.

## Localization

No changes are needed to the build system to mark a schema XML file for translation. Assuming it sets the `gettext-domain` attribute, a schema may be marked for translation by adding it to `POTFILES.in`, assuming gettext 0.19 or newer is in use (the preferred method for translation): ``` data/org.foo.MyApp.gschema.xml ```

Alternatively, if intltool 0.50.1 is in use: ``` [type: gettext/gsettings]data/org.foo.MyApp.gschema.xml ```

GSettings will use gettext to look up translations for the `<summary>` and `<description>` elements, and also any `<default>` elements which have a `l10n` attribute set.

Translations **must not** be included in the `.gschema.xml` file by the build system, for example by using a rule to generate the XML file from a template.

func NewSettings

func NewSettings(SchemaIdVar string) *Settings

Creates a new [class@Gio.Settings] object with the schema specified by @schema_id.

It is an error for the schema to not exist: schemas are an essential part of a program, as they provide type information. If schemas need to be dynamically loaded (for example, from an optional runtime dependency), [method@Gio.SettingsSchemaSource.lookup] can be used to test for their existence before loading them.

Signals on the newly created [class@Gio.Settings] object will be dispatched via the thread-default [struct@GLib.MainContext] in effect at the time of the call to [ctor@Gio.Settings.new]. The new [class@Gio.Settings] will hold a reference on the context. See [method@GLib.MainContext.push_thread_default].

func NewSettingsFull

func NewSettingsFull(SchemaVar *SettingsSchema, BackendVar *SettingsBackend, PathVar *string) *Settings

Creates a new [class@Gio.Settings] object with a given schema, backend and path.

It should be extremely rare that you ever want to use this function. It is made available for advanced use-cases (such as plugin systems that want to provide access to schemas loaded from custom locations, etc).

At the most basic level, a [class@Gio.Settings] object is a pure composition of four things: a [struct@Gio.SettingsSchema], a [class@Gio.SettingsBackend], a path within that backend, and a [struct@GLib.MainContext] to which signals are dispatched.

This constructor therefore gives you full control over constructing [class@Gio.Settings] instances. The first 3 parameters are given directly as @schema, @backend and @path, and the main context is taken from the thread-default (as per [ctor@Gio.Settings.new]).

If @backend is `NULL` then the default backend is used.

If @path is `NULL` then the path from the schema is used. It is an error if @path is `NULL` and the schema has no path of its own or if @path is non-`NULL` and not equal to the path that the schema does have.

func NewSettingsWithBackend

func NewSettingsWithBackend(SchemaIdVar string, BackendVar *SettingsBackend) *Settings

Creates a new [class@Gio.Settings] object with the schema specified by @schema_id and a given [class@Gio.SettingsBackend].

Creating a [class@Gio.Settings] object with a different backend allows accessing settings from a database other than the usual one. For example, it may make sense to pass a backend corresponding to the ‘defaults’ settings database on the system to get a settings object that modifies the system default settings instead of the settings for this user.

func NewSettingsWithBackendAndPath

func NewSettingsWithBackendAndPath(SchemaIdVar string, BackendVar *SettingsBackend, PathVar string) *Settings

Creates a new [class@Gio.Settings] object with the schema specified by @schema_id and a given [class@Gio.SettingsBackend] and path.

This is a mix of [ctor@Gio.Settings.new_with_backend] and [ctor@Gio.Settings.new_with_path].

func NewSettingsWithPath

func NewSettingsWithPath(SchemaIdVar string, PathVar string) *Settings

Creates a new [class@Gio.Settings] object with the relocatable schema specified by @schema_id and a given path.

You only need to do this if you want to directly create a settings object with a schema that doesn’t have a specified path of its own. That’s quite rare.

It is a programmer error to call this function for a schema that has an explicitly specified path.

It is a programmer error if @path is not a valid path. A valid path begins and ends with `/` and does not contain two consecutive `/` characters.

func SettingsNewFromInternalPtr

func SettingsNewFromInternalPtr(ptr uintptr) *Settings

func (*Settings) Apply

func (x *Settings) Apply()

Applies any changes that have been made to the settings.

This function does nothing unless @settings is in [‘delay-apply’ mode](class.Settings.html#delay-apply-mode). In the normal case settings are always applied immediately.

func (*Settings) Bind

func (x *Settings) Bind(KeyVar string, ObjectVar *gobject.Object, PropertyVar string, FlagsVar SettingsBindFlags)

Create a binding between the @key in the @settings object and the property @property of @object.

The binding uses the default GIO mapping functions to map between the settings and property values. These functions handle booleans, numeric types and string types in a straightforward way. Use [method@Gio.Settings.bind_with_mapping] if you need a custom mapping, or map between types that are not supported by the default mapping functions.

Unless the @flags include [flags@Gio.SettingsBindFlags.NO_SENSITIVITY], this function also establishes a binding between the writability of @key and the `sensitive` property of @object (if @object has a boolean property by that name). See [method@Gio.Settings.bind_writable] for more details about writable bindings.

Note that the lifecycle of the binding is tied to @object, and that you can have only one binding per object property. If you bind the same property twice on the same object, the second binding overrides the first one.

func (*Settings) BindWithMapping

func (x *Settings) BindWithMapping(KeyVar string, ObjectVar *gobject.Object, PropertyVar string, FlagsVar SettingsBindFlags, GetMappingVar *SettingsBindGetMapping, SetMappingVar *SettingsBindSetMapping, UserDataVar uintptr, DestroyVar *glib.DestroyNotify)

Create a binding between the @key in the @settings object and the property @property of @object.

The binding uses the provided mapping functions to map between settings and property values.

Note that the lifecycle of the binding is tied to @object, and that you can have only one binding per object property. If you bind the same property twice on the same object, the second binding overrides the first one.

func (*Settings) BindWithMappingClosures

func (x *Settings) BindWithMappingClosures(KeyVar string, ObjectVar *gobject.Object, PropertyVar string, FlagsVar SettingsBindFlags, GetMappingVar *gobject.Closure, SetMappingVar *gobject.Closure)

Version of [method@Gio.Settings.bind_with_mapping] using closures instead of callbacks for easier binding in other languages.

func (*Settings) BindWritable

func (x *Settings) BindWritable(KeyVar string, ObjectVar *gobject.Object, PropertyVar string, InvertedVar bool)

Create a binding between the writability of @key in the @settings object and the property @property of @object.

The property must be boolean; `sensitive` or `visible` properties of widgets are the most likely candidates.

Writable bindings are always uni-directional; changes of the writability of the setting will be propagated to the object property, not the other way.

When the @inverted argument is true, the binding inverts the value as it passes from the setting to the object, i.e. @property will be set to true if the key is not writable.

Note that the lifecycle of the binding is tied to @object, and that you can have only one binding per object property. If you bind the same property twice on the same object, the second binding overrides the first one.

func (*Settings) ConnectChangeEvent

func (x *Settings) ConnectChangeEvent(cb *func(Settings, uintptr, int) bool) uint

Emitted once per change event that affects this settings object.

You should connect to this signal only if you are interested in viewing groups of changes before they are split out into multiple emissions of the [signal@Gio.Settings::changed] signal. For most use cases it is more appropriate to use the [signal@Gio.Settings::changed] signal.

In the event that the change event applies to one or more specified keys, @keys will be an array of [alias@GLib.Quark]s of length @n_keys. In the event that the change event applies to the [class@Gio.Settings] object as a whole (ie: potentially every key has been changed) then @keys will be `NULL` and @n_keys will be `0`.

The default handler for this signal invokes the [signal@Gio.Settings::changed] signal for each affected key. If any other connected handler returns true then this default functionality will be suppressed.

func (*Settings) ConnectChanged

func (x *Settings) ConnectChanged(cb *func(Settings, string)) uint

Emitted when a key has potentially changed.

You should call one of the [method@Gio.Settings.get] calls to check the new value.

This signal supports detailed connections. You can connect to the detailed signal `changed::x` in order to only receive callbacks when key `x` changes.

Note that @settings only emits this signal if you have read @key at least once while a signal handler was already connected for @key.

func (*Settings) ConnectWritableChangeEvent

func (x *Settings) ConnectWritableChangeEvent(cb *func(Settings, uint) bool) uint

Emitted once per writability change event that affects this settings object.

You should connect to this signal if you are interested in viewing groups of changes before they are split out into multiple emissions of the [signal@Gio.Settings::writable-changed] signal. For most use cases it is more appropriate to use the [signal@Gio.Settings::writable-changed] signal.

In the event that the writability change applies only to a single key, @key will be set to the [alias@GLib.Quark] for that key. In the event that the writability change affects the entire settings object, @key will be `0`.

The default handler for this signal invokes the [signal@Gio.Settings::writable-changed] and [signal@Gio.Settings::changed] signals for each affected key. This is done because changes in writability might also imply changes in value (if for example, a new mandatory setting is introduced). If any other connected handler returns true then this default functionality will be suppressed.

func (*Settings) ConnectWritableChanged

func (x *Settings) ConnectWritableChanged(cb *func(Settings, string)) uint

Emitted when the writability of a key has potentially changed.

You should call [method@Gio.Settings.is_writable] in order to determine the new status.

This signal supports detailed connections. You can connect to the detailed signal `writable-changed::x` in order to only receive callbacks when the writability of `x` changes.

func (*Settings) CreateAction

func (x *Settings) CreateAction(KeyVar string) *ActionBase

Creates a [iface@Gio.Action] corresponding to a given [class@Gio.Settings] key.

The action has the same name as the key.

The value of the key becomes the state of the action and the action is enabled when the key is writable. Changing the state of the action results in the key being written to. Changes to the value or writability of the key cause appropriate change notifications to be emitted for the action.

For boolean-valued keys, action activations take no parameter and result in the toggling of the value. For all other types, activations take the new value for the key (which must have the correct type).

func (*Settings) Delay

func (x *Settings) Delay()

Changes the [class@Gio.Settings] object into [‘delay-apply’ mode](class.Settings.html#delay-apply-mode).

In this mode, changes to @settings are not immediately propagated to the backend, but kept locally until [method@Gio.Settings.apply] is called.

func (*Settings) Get

func (x *Settings) Get(KeyVar string, FormatVar string, varArgs ...interface{})

Gets the value that is stored at @key in @settings.

A convenience function that combines [method@Gio.Settings.get_value] with [method@GLib.Variant.get].

It is a programmer error to give a @key that isn’t contained in the schema for @settings or for the [struct@GLib.VariantType] of @format to mismatch the type given in the schema.

func (*Settings) GetBoolean

func (x *Settings) GetBoolean(KeyVar string) bool

Gets the value that is stored at @key in @settings.

A convenience variant of [method@Gio.Settings.get] for booleans.

It is a programmer error to give a @key that isn’t specified as having a `b` type in the schema for @settings (see [struct@GLib.VariantType]).

func (*Settings) GetChild

func (x *Settings) GetChild(NameVar string) *Settings

Creates a child settings object which has a base path of `base-path/name`, where `base-path` is the base path of @settings and `name` is as specified by the caller.

The schema for the child settings object must have been declared in the schema of @settings using a `<child>` element.

The created child settings object will inherit the [property@Gio.Settings:delay-apply] mode from @settings.

func (*Settings) GetDefaultValue

func (x *Settings) GetDefaultValue(KeyVar string) *glib.Variant

Gets the ‘default value’ of a key.

This is the value that would be read if [method@Gio.Settings.reset] were to be called on the key.

Note that this may be a different value than returned by [method@Gio.SettingsSchemaKey.get_default_value] if the system administrator has provided a default value.

Comparing the return values of [method@Gio.Settings.get_default_value] and [method@Gio.Settings.get_value] is not sufficient for determining if a value has been set because the user may have explicitly set the value to something that happens to be equal to the default. The difference here is that if the default changes in the future, the user’s key will still be set.

This function may be useful for adding an indication to a UI of what the default value was before the user set it.

It is a programmer error to give a @key that isn’t contained in the schema for @settings.

func (*Settings) GetDouble

func (x *Settings) GetDouble(KeyVar string) float64

Gets the value that is stored at @key in @settings.

A convenience variant of [method@Gio.Settings.get] for doubles.

It is a programmer error to give a @key that isn’t specified as having a `d` type in the schema for @settings (see [struct@GLib.VariantType]).

func (*Settings) GetEnum

func (x *Settings) GetEnum(KeyVar string) int

Gets the value that is stored in @settings for @key and converts it to the enum value that it represents.

In order to use this function the type of the value must be a string and it must be marked in the schema file as an enumerated type.

It is a programmer error to give a @key that isn’t contained in the schema for @settings or is not marked as an enumerated type.

If the value stored in the configuration database is not a valid value for the enumerated type then this function will return the default value.

func (*Settings) GetFlags

func (x *Settings) GetFlags(KeyVar string) uint

Gets the value that is stored in @settings for @key and converts it to the flags value that it represents.

In order to use this function the type of the value must be an array of strings and it must be marked in the schema file as a flags type.

It is a programmer error to give a @key that isn’t contained in the schema for @settings or is not marked as a flags type.

If the value stored in the configuration database is not a valid value for the flags type then this function will return the default value.

func (*Settings) GetHasUnapplied

func (x *Settings) GetHasUnapplied() bool

Returns whether the [class@Gio.Settings] object has any unapplied changes.

This can only be the case if it is in [‘delay-apply’ mode](class.Settings.html#delay-apply-mode).

func (*Settings) GetInt

func (x *Settings) GetInt(KeyVar string) int

Gets the value that is stored at @key in @settings.

A convenience variant of [method@Gio.Settings.get] for 32-bit integers.

It is a programmer error to give a @key that isn’t specified as having an `i` type in the schema for @settings (see [struct@GLib.VariantType]).

func (*Settings) GetInt64

func (x *Settings) GetInt64(KeyVar string) int64

Gets the value that is stored at @key in @settings.

A convenience variant of [method@Gio.Settings.get] for 64-bit integers.

It is a programmer error to give a @key that isn’t specified as having an `x` type in the schema for @settings (see [struct@GLib.VariantType]).

func (*Settings) GetMapped

func (x *Settings) GetMapped(KeyVar string, MappingVar *SettingsGetMapping, UserDataVar uintptr) uintptr

Gets the value that is stored at @key in @settings, subject to application-level validation/mapping.

You should use this function when the application needs to perform some processing on the value of the key (for example, parsing). The @mapping function performs that processing. If the function indicates that the processing was unsuccessful (due to a parse error, for example) then the mapping is tried again with another value.

This allows a robust ‘fall back to defaults’ behaviour to be implemented somewhat automatically.

The first value that is tried is the user’s setting for the key. If the mapping function fails to map this value, other values may be tried in an unspecified order (system or site defaults, translated schema default values, untranslated schema default values, etc).

If the mapping function fails for all possible values, one additional attempt is made: the mapping function is called with a `NULL` value. If the mapping function still indicates failure at this point then the application will be aborted.

The result parameter for the @mapping function is pointed to a `gpointer` which is initially set to `NULL`. The same pointer is given to each invocation of @mapping. The final value of that `gpointer` is what is returned by this function. `NULL` is valid; it is returned just as any other value would be.

func (*Settings) GetPropertyDelayApply

func (x *Settings) GetPropertyDelayApply() bool

GetPropertyDelayApply gets the "delay-apply" property. Whether the [class@Gio.Settings] object is in [‘delay-apply’ mode](class.Settings.html#delay-apply-mode).

func (*Settings) GetPropertyHasUnapplied

func (x *Settings) GetPropertyHasUnapplied() bool

GetPropertyHasUnapplied gets the "has-unapplied" property. Whether the [class@Gio.Settings] object has outstanding changes.

These changes will be applied when [method@Gio.Settings.apply] is called.

func (*Settings) GetPropertyPath

func (x *Settings) GetPropertyPath() string

GetPropertyPath gets the "path" property. The path within the backend where the settings are stored.

func (*Settings) GetPropertySchema

func (x *Settings) GetPropertySchema() string

GetPropertySchema gets the "schema" property. The name of the schema that describes the types of keys for this [class@Gio.Settings] object.

The type of this property is *not* [struct@Gio.SettingsSchema]. [struct@Gio.SettingsSchema] has only existed since version 2.32 and unfortunately this name was used in previous versions to refer to the schema ID rather than the schema itself. Take care to use the [property@Gio.Settings:settings-schema] property if you wish to pass in a [struct@Gio.SettingsSchema].

func (*Settings) GetPropertySchemaId

func (x *Settings) GetPropertySchemaId() string

GetPropertySchemaId gets the "schema-id" property. The name of the schema that describes the types of keys for this [class@Gio.Settings] object.

func (*Settings) GetPropertySettingsSchema

func (x *Settings) GetPropertySettingsSchema() uintptr

GetPropertySettingsSchema gets the "settings-schema" property. The [struct@Gio.SettingsSchema] describing the types of keys for this [class@Gio.Settings] object.

Ideally, this property would be called [property@Gio.Settings:schema]. [struct@Gio.SettingsSchema] has only existed since version 2.32, however, and before then the [property@Gio.Settings:schema] property was used to refer to the ID of the schema rather than the schema itself. Take care.

func (*Settings) GetRange

func (x *Settings) GetRange(KeyVar string) *glib.Variant

Queries the range of a key.

func (*Settings) GetString

func (x *Settings) GetString(KeyVar string) string

Gets the value that is stored at @key in @settings.

A convenience variant of [method@Gio.Settings.get] for strings.

It is a programmer error to give a @key that isn’t specified as having an `s` type in the schema for @settings (see [struct@GLib.VariantType]).

func (*Settings) GetStrv

func (x *Settings) GetStrv(KeyVar string) []string

A convenience variant of [method@Gio.Settings.get] for string arrays.

It is a programmer error to give a @key that isn’t specified as having an `as` type in the schema for @settings (see [struct@GLib.VariantType]).

func (*Settings) GetUint

func (x *Settings) GetUint(KeyVar string) uint

Gets the value that is stored at @key in @settings.

A convenience variant of [method@Gio.Settings.get] for 32-bit unsigned integers.

It is a programmer error to give a @key that isn’t specified as having a `u` type in the schema for @settings (see [struct@GLib.VariantType]).

func (*Settings) GetUint64

func (x *Settings) GetUint64(KeyVar string) uint64

Gets the value that is stored at @key in @settings.

A convenience variant of [method@Gio.Settings.get] for 64-bit unsigned integers.

It is a programmer error to give a @key that isn’t specified as having a `t` type in the schema for @settings (see [struct@GLib.VariantType]).

func (*Settings) GetUserValue

func (x *Settings) GetUserValue(KeyVar string) *glib.Variant

Checks the ‘user value’ of a key, if there is one.

The user value of a key is the last value that was set by the user.

After calling [method@Gio.Settings.reset] this function should always return `NULL` (assuming something is not wrong with the system configuration).

It is possible that [method@Gio.Settings.get_value] will return a different value than this function. This can happen in the case that the user set a value for a key that was subsequently locked down by the system administrator — this function will return the user’s old value.

This function may be useful for adding a ‘reset’ option to a UI or for providing indication that a particular value has been changed.

It is a programmer error to give a @key that isn’t contained in the schema for @settings.

func (*Settings) GetValue

func (x *Settings) GetValue(KeyVar string) *glib.Variant

Gets the value that is stored in @settings for @key.

It is a programmer error to give a @key that isn’t contained in the schema for @settings.

func (*Settings) GoPointer

func (c *Settings) GoPointer() uintptr

func (*Settings) IsWritable

func (x *Settings) IsWritable(NameVar string) bool

Finds out if a key can be written.

func (*Settings) ListChildren

func (x *Settings) ListChildren() []string

Gets the list of children on @settings.

The list is exactly the list of strings for which it is not an error to call [method@Gio.Settings.get_child].

There is little reason to call this function from ‘normal’ code, since you should already know what children are in your schema. This function may still be useful there for introspection reasons, however.

You should free the return value with [func@GLib.strfreev] when you are done with it.

func (*Settings) ListKeys

func (x *Settings) ListKeys() []string

Introspects the list of keys on @settings.

You should probably not be calling this function from ‘normal’ code (since you should already know what keys are in your schema). This function is intended for introspection reasons.

You should free the return value with [func@GLib.strfreev] when you are done with it.

func (*Settings) RangeCheck

func (x *Settings) RangeCheck(KeyVar string, ValueVar *glib.Variant) bool

Checks if the given @value is of the correct type and within the permitted range for @key.

func (*Settings) Reset

func (x *Settings) Reset(KeyVar string)

Resets @key to its default value.

This call resets the key, as much as possible, to its default value. That might be the value specified in the schema or the one set by the administrator.

func (*Settings) Revert

func (x *Settings) Revert()

Reverts all unapplied changes to the settings.

This function does nothing unless @settings is in [‘delay-apply’ mode](class.Settings.html#delay-apply-mode). In the normal case settings are always applied immediately.

Change notifications will be emitted for affected keys.

func (*Settings) Set

func (x *Settings) Set(KeyVar string, FormatVar string, varArgs ...interface{}) bool

Sets @key in @settings to @value.

A convenience function that combines [method@Gio.Settings.set_value] with [ctor@GLib.Variant.new].

It is a programmer error to give a @key that isn’t contained in the schema for @settings or for the [struct@GLib.VariantType] of @format to mismatch the type given in the schema.

func (*Settings) SetBoolean

func (x *Settings) SetBoolean(KeyVar string, ValueVar bool) bool

Sets @key in @settings to @value.

A convenience variant of [method@Gio.Settings.set] for booleans.

It is a programmer error to give a @key that isn’t specified as having a `b` type in the schema for @settings (see [struct@GLib.VariantType]).

func (*Settings) SetDouble

func (x *Settings) SetDouble(KeyVar string, ValueVar float64) bool

Sets @key in @settings to @value.

A convenience variant of [method@Gio.Settings.set] for doubles.

It is a programmer error to give a @key that isn’t specified as having a `d` type in the schema for @settings (see [struct@GLib.VariantType]).

func (*Settings) SetEnum

func (x *Settings) SetEnum(KeyVar string, ValueVar int) bool

Looks up the enumerated type nick for @value and writes it to @key, within @settings.

It is a programmer error to give a @key that isn’t contained in the schema for @settings or is not marked as an enumerated type, or for @value not to be a valid value for the named type.

After performing the write, accessing @key directly with [method@Gio.Settings.get_string] will return the ‘nick’ associated with @value.

func (*Settings) SetFlags

func (x *Settings) SetFlags(KeyVar string, ValueVar uint) bool

Looks up the flags type nicks for the bits specified by @value, puts them in an array of strings and writes the array to @key, within @settings.

It is a programmer error to give a @key that isn’t contained in the schema for @settings or is not marked as a flags type, or for @value to contain any bits that are not value for the named type.

After performing the write, accessing @key directly with [method@Gio.Settings.get_strv] will return an array of ‘nicks’; one for each bit in @value.

func (*Settings) SetGoPointer

func (c *Settings) SetGoPointer(ptr uintptr)

func (*Settings) SetInt

func (x *Settings) SetInt(KeyVar string, ValueVar int) bool

Sets @key in @settings to @value.

A convenience variant of [method@Gio.Settings.set] for 32-bit integers.

It is a programmer error to give a @key that isn’t specified as having an `i` type in the schema for @settings (see [struct@GLib.VariantType]).

func (*Settings) SetInt64

func (x *Settings) SetInt64(KeyVar string, ValueVar int64) bool

Sets @key in @settings to @value.

A convenience variant of [method@Gio.Settings.set] for 64-bit integers.

It is a programmer error to give a @key that isn’t specified as having an `x` type in the schema for @settings (see [struct@GLib.VariantType]).

func (*Settings) SetPropertyPath

func (x *Settings) SetPropertyPath(value string)

SetPropertyPath sets the "path" property. The path within the backend where the settings are stored.

func (*Settings) SetPropertySchema

func (x *Settings) SetPropertySchema(value string)

SetPropertySchema sets the "schema" property. The name of the schema that describes the types of keys for this [class@Gio.Settings] object.

The type of this property is *not* [struct@Gio.SettingsSchema]. [struct@Gio.SettingsSchema] has only existed since version 2.32 and unfortunately this name was used in previous versions to refer to the schema ID rather than the schema itself. Take care to use the [property@Gio.Settings:settings-schema] property if you wish to pass in a [struct@Gio.SettingsSchema].

func (*Settings) SetPropertySchemaId

func (x *Settings) SetPropertySchemaId(value string)

SetPropertySchemaId sets the "schema-id" property. The name of the schema that describes the types of keys for this [class@Gio.Settings] object.

func (*Settings) SetPropertySettingsSchema

func (x *Settings) SetPropertySettingsSchema(value uintptr)

SetPropertySettingsSchema sets the "settings-schema" property. The [struct@Gio.SettingsSchema] describing the types of keys for this [class@Gio.Settings] object.

Ideally, this property would be called [property@Gio.Settings:schema]. [struct@Gio.SettingsSchema] has only existed since version 2.32, however, and before then the [property@Gio.Settings:schema] property was used to refer to the ID of the schema rather than the schema itself. Take care.

func (*Settings) SetString

func (x *Settings) SetString(KeyVar string, ValueVar string) bool

Sets @key in @settings to @value.

A convenience variant of [method@Gio.Settings.set] for strings.

It is a programmer error to give a @key that isn’t specified as having an `s` type in the schema for @settings (see [struct@GLib.VariantType]).

func (*Settings) SetStrv

func (x *Settings) SetStrv(KeyVar string, ValueVar []string) bool

Sets @key in @settings to @value.

A convenience variant of [method@Gio.Settings.set] for string arrays. If @value is `NULL`, then @key is set to be the empty array.

It is a programmer error to give a @key that isn’t specified as having an `as` type in the schema for @settings (see [struct@GLib.VariantType]).

func (*Settings) SetUint

func (x *Settings) SetUint(KeyVar string, ValueVar uint) bool

Sets @key in @settings to @value.

A convenience variant of [method@Gio.Settings.set] for 32-bit unsigned integers.

It is a programmer error to give a @key that isn’t specified as having a `u` type in the schema for @settings (see [struct@GLib.VariantType]).

func (*Settings) SetUint64

func (x *Settings) SetUint64(KeyVar string, ValueVar uint64) bool

Sets @key in @settings to @value.

A convenience variant of [method@Gio.Settings.set] for 64-bit unsigned integers.

It is a programmer error to give a @key that isn’t specified as having a `t` type in the schema for @settings (see [struct@GLib.VariantType]).

func (*Settings) SetValue

func (x *Settings) SetValue(KeyVar string, ValueVar *glib.Variant) bool

Sets @key in @settings to @value.

It is a programmer error to give a @key that isn’t contained in the schema for @settings or for @value to have the incorrect type, per the schema.

If @value is floating then this function consumes the reference.

type SettingsBackend

type SettingsBackend struct {
	gobject.Object
}

The `GSettingsBackend` interface defines a generic interface for non-strictly-typed data that is stored in a hierarchy. To implement an alternative storage backend for [class@Gio.Settings], you need to implement the `GSettingsBackend` interface and then make it implement the extension point `G_SETTINGS_BACKEND_EXTENSION_POINT_NAME`.

The interface defines methods for reading and writing values, a method for determining if writing of certain values will fail (lockdown) and a change notification mechanism.

The semantics of the interface are very precisely defined and implementations must carefully adhere to the expectations of callers that are documented on each of the interface methods.

Some of the `GSettingsBackend` functions accept or return a [struct@GLib.Tree]. These trees always have strings as keys and [struct@GLib.Variant] as values.

The `GSettingsBackend` API is exported to allow third-party implementations, but does not carry the same stability guarantees as the public GIO API. For this reason, you have to define the C preprocessor symbol `G_SETTINGS_ENABLE_BACKEND` before including `gio/gsettingsbackend.h`.

func KeyfileSettingsBackendNew

func KeyfileSettingsBackendNew(FilenameVar string, RootPathVar string, RootGroupVar *string) *SettingsBackend

Creates a keyfile-backed [class@Gio.SettingsBackend].

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 setting the key `"/apps/example/enabled"` to 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.

func MemorySettingsBackendNew

func MemorySettingsBackendNew() *SettingsBackend

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.

func NullSettingsBackendNew

func NullSettingsBackendNew() *SettingsBackend

Creates a readonly #GSettingsBackend.

This backend does not allow changes to settings, so all settings will always have their default values.

func SettingsBackendGetDefault

func SettingsBackendGetDefault() *SettingsBackend

Returns the default #GSettingsBackend. It is possible to override the default by setting the `GSETTINGS_BACKEND` environment variable to the name of a settings backend.

The user gets a reference to the backend.

func SettingsBackendNewFromInternalPtr

func SettingsBackendNewFromInternalPtr(ptr uintptr) *SettingsBackend

func (*SettingsBackend) Changed

func (x *SettingsBackend) Changed(KeyVar string, OriginTagVar uintptr)

Signals that a single key has possibly changed. Backend implementations should call this if a key has possibly changed its value.

@key must be a valid key (ie starting with a slash, not containing '//', and not ending with a slash).

The implementation must call this function during any call to g_settings_backend_write(), before the call returns (except in the case that no keys are actually changed and it cares to detect this fact). It may not rely on the existence of a mainloop for dispatching the signal later.

The implementation may call this function at any other time it likes in response to other events (such as changes occurring outside of the program). These calls may originate from a mainloop or may originate in response to any other action (including from calls to g_settings_backend_write()).

In the case that this call is in response to a call to g_settings_backend_write() then @origin_tag must be set to the same value that was passed to that call.

func (*SettingsBackend) ChangedTree

func (x *SettingsBackend) ChangedTree(TreeVar *glib.Tree, OriginTagVar uintptr)

This call is a convenience wrapper. It gets the list of changes from @tree, computes the longest common prefix and calls g_settings_backend_changed().

func (*SettingsBackend) GoPointer

func (c *SettingsBackend) GoPointer() uintptr

func (*SettingsBackend) KeysChanged

func (x *SettingsBackend) KeysChanged(PathVar string, ItemsVar []string, OriginTagVar uintptr)

Signals that a list of keys have possibly changed. Backend implementations should call this if keys have possibly changed their values.

@path must be a valid path (ie starting and ending with a slash and not containing '//'). Each string in @items must form a valid key name when @path is prefixed to it (ie: each item must not start or end with '/' and must not contain '//').

The meaning of this signal is that any of the key names resulting from the concatenation of @path with each item in @items may have changed.

The same rules for when notifications must occur apply as per g_settings_backend_changed(). These two calls can be used interchangeably if exactly one item has changed (although in that case g_settings_backend_changed() is definitely preferred).

For efficiency reasons, the implementation should strive for @path to be as long as possible (ie: the longest common prefix of all of the keys that were changed) but this is not strictly required.

func (*SettingsBackend) PathChanged

func (x *SettingsBackend) PathChanged(PathVar string, OriginTagVar uintptr)

Signals that all keys below a given path may have possibly changed. Backend implementations should call this if an entire path of keys have possibly changed their values.

@path must be a valid path (ie starting and ending with a slash and not containing '//').

The meaning of this signal is that any of the key which has a name starting with @path may have changed.

The same rules for when notifications must occur apply as per g_settings_backend_changed(). This call might be an appropriate reasponse to a 'reset' call but implementations are also free to explicitly list the keys that were affected by that call if they can easily do so.

For efficiency reasons, the implementation should strive for @path to be as long as possible (ie: the longest common prefix of all of the keys that were changed) but this is not strictly required. As an example, if this function is called with the path of "/" then every single key in the application will be notified of a possible change.

func (*SettingsBackend) PathWritableChanged

func (x *SettingsBackend) PathWritableChanged(PathVar string)

Signals that the writability of all keys below a given path may have changed.

Since GSettings performs no locking operations for itself, this call will always be made in response to external events.

func (*SettingsBackend) SetGoPointer

func (c *SettingsBackend) SetGoPointer(ptr uintptr)

func (*SettingsBackend) WritableChanged

func (x *SettingsBackend) WritableChanged(KeyVar string)

Signals that the writability of a single key has possibly changed.

Since GSettings performs no locking operations for itself, this call will always be made in response to external events.

type SettingsBackendClass

type SettingsBackendClass struct {
	ParentClass gobject.ObjectClass

	Padding [23]uintptr
	// contains filtered or unexported fields
}

Class structure for #GSettingsBackend.

func (*SettingsBackendClass) GetGetPermission

func (x *SettingsBackendClass) GetGetPermission() func(*SettingsBackend, string) *Permission

GetGetPermission gets the "get_permission" callback function. virtual method to get permission of a key

func (*SettingsBackendClass) GetGetWritable

func (x *SettingsBackendClass) GetGetWritable() func(*SettingsBackend, string) bool

GetGetWritable gets the "get_writable" callback function. virtual method to get if a key is writable

func (*SettingsBackendClass) GetRead

GetRead gets the "read" callback function. virtual method to read a key's value

func (*SettingsBackendClass) GetReadUserValue

func (x *SettingsBackendClass) GetReadUserValue() func(*SettingsBackend, string, *glib.VariantType) *glib.Variant

GetReadUserValue gets the "read_user_value" callback function. virtual method to read user's key value

func (*SettingsBackendClass) GetReset

func (x *SettingsBackendClass) GetReset() func(*SettingsBackend, string, uintptr)

GetReset gets the "reset" callback function. virtual method to reset state

func (*SettingsBackendClass) GetSubscribe

func (x *SettingsBackendClass) GetSubscribe() func(*SettingsBackend, string)

GetSubscribe gets the "subscribe" callback function. virtual method to subscribe to key changes

func (*SettingsBackendClass) GetSync

func (x *SettingsBackendClass) GetSync() func(*SettingsBackend)

GetSync gets the "sync" callback function. virtual method to sync state

func (*SettingsBackendClass) GetUnsubscribe

func (x *SettingsBackendClass) GetUnsubscribe() func(*SettingsBackend, string)

GetUnsubscribe gets the "unsubscribe" callback function. virtual method to unsubscribe to key changes

func (*SettingsBackendClass) GetWrite

GetWrite gets the "write" callback function. virtual method to change key's value

func (*SettingsBackendClass) GetWriteTree

func (x *SettingsBackendClass) GetWriteTree() func(*SettingsBackend, *glib.Tree, uintptr) bool

GetWriteTree gets the "write_tree" callback function. virtual method to change a tree of keys

func (*SettingsBackendClass) GoPointer

func (x *SettingsBackendClass) GoPointer() uintptr

func (*SettingsBackendClass) OverrideGetPermission

func (x *SettingsBackendClass) OverrideGetPermission(cb func(*SettingsBackend, string) *Permission)

OverrideGetPermission sets the "get_permission" callback function. virtual method to get permission of a key

func (*SettingsBackendClass) OverrideGetWritable

func (x *SettingsBackendClass) OverrideGetWritable(cb func(*SettingsBackend, string) bool)

OverrideGetWritable sets the "get_writable" callback function. virtual method to get if a key is writable

func (*SettingsBackendClass) OverrideRead

func (x *SettingsBackendClass) OverrideRead(cb func(*SettingsBackend, string, *glib.VariantType, bool) *glib.Variant)

OverrideRead sets the "read" callback function. virtual method to read a key's value

func (*SettingsBackendClass) OverrideReadUserValue

func (x *SettingsBackendClass) OverrideReadUserValue(cb func(*SettingsBackend, string, *glib.VariantType) *glib.Variant)

OverrideReadUserValue sets the "read_user_value" callback function. virtual method to read user's key value

func (*SettingsBackendClass) OverrideReset

func (x *SettingsBackendClass) OverrideReset(cb func(*SettingsBackend, string, uintptr))

OverrideReset sets the "reset" callback function. virtual method to reset state

func (*SettingsBackendClass) OverrideSubscribe

func (x *SettingsBackendClass) OverrideSubscribe(cb func(*SettingsBackend, string))

OverrideSubscribe sets the "subscribe" callback function. virtual method to subscribe to key changes

func (*SettingsBackendClass) OverrideSync

func (x *SettingsBackendClass) OverrideSync(cb func(*SettingsBackend))

OverrideSync sets the "sync" callback function. virtual method to sync state

func (*SettingsBackendClass) OverrideUnsubscribe

func (x *SettingsBackendClass) OverrideUnsubscribe(cb func(*SettingsBackend, string))

OverrideUnsubscribe sets the "unsubscribe" callback function. virtual method to unsubscribe to key changes

func (*SettingsBackendClass) OverrideWrite

func (x *SettingsBackendClass) OverrideWrite(cb func(*SettingsBackend, string, *glib.Variant, uintptr) bool)

OverrideWrite sets the "write" callback function. virtual method to change key's value

func (*SettingsBackendClass) OverrideWriteTree

func (x *SettingsBackendClass) OverrideWriteTree(cb func(*SettingsBackend, *glib.Tree, uintptr) bool)

OverrideWriteTree sets the "write_tree" callback function. virtual method to change a tree of keys

type SettingsBackendPrivate

type SettingsBackendPrivate struct {
	// contains filtered or unexported fields
}

func (*SettingsBackendPrivate) GoPointer

func (x *SettingsBackendPrivate) GoPointer() uintptr

type SettingsBindFlags

type SettingsBindFlags int

Flags used when creating a binding.

These flags determine in which direction the binding works. The default is to synchronize in both directions.

const (

	// Equivalent to `G_SETTINGS_BIND_GET|G_SETTINGS_BIND_SET`
	GSettingsBindDefaultValue SettingsBindFlags = 0
	// Update the [class@GObject.Object] property when the setting changes.
	//   It is an error to use this flag if the property is not writable.
	GSettingsBindGetValue SettingsBindFlags = 1
	// Update the setting when the [class@GObject.Object] property changes.
	//   It is an error to use this flag if the property is not readable.
	GSettingsBindSetValue SettingsBindFlags = 2
	// Do not try to bind a ‘sensitivity’ property to the writability of the setting
	GSettingsBindNoSensitivityValue SettingsBindFlags = 4
	// When set in addition to [flags@Gio.SettingsBindFlags.GET],
	//   set the [class@GObject.Object] property
	//   value initially from the setting, but do not listen for changes of the setting
	GSettingsBindGetNoChangesValue SettingsBindFlags = 8
	// When passed to [method@Gio.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 [method@Gio.Settings.bind_with_mapping].
	GSettingsBindInvertBooleanValue SettingsBindFlags = 16
)

type SettingsBindGetMapping

type SettingsBindGetMapping func(*gobject.Value, *glib.Variant, uintptr) bool

The type for the function that is used to convert from [class@Gio.Settings] to an object property.

The @value is already initialized to hold values of the appropriate type.

type SettingsBindSetMapping

type SettingsBindSetMapping func(*gobject.Value, *glib.VariantType, uintptr) uintptr

The type for the function that is used to convert an object property value to a [struct@GLib.Variant] for storing it in [class@Gio.Settings].

type SettingsClass

type SettingsClass struct {
	ParentClass gobject.ObjectClass

	Padding [20]uintptr
	// contains filtered or unexported fields
}

func (*SettingsClass) GetChangeEvent

func (x *SettingsClass) GetChangeEvent() func(*Settings, *glib.Quark, int) bool

GetChangeEvent gets the "change_event" callback function.

func (*SettingsClass) GetChanged

func (x *SettingsClass) GetChanged() func(*Settings, string)

GetChanged gets the "changed" callback function.

func (*SettingsClass) GetWritableChangeEvent

func (x *SettingsClass) GetWritableChangeEvent() func(*Settings, glib.Quark) bool

GetWritableChangeEvent gets the "writable_change_event" callback function.

func (*SettingsClass) GetWritableChanged

func (x *SettingsClass) GetWritableChanged() func(*Settings, string)

GetWritableChanged gets the "writable_changed" callback function.

func (*SettingsClass) GoPointer

func (x *SettingsClass) GoPointer() uintptr

func (*SettingsClass) OverrideChangeEvent

func (x *SettingsClass) OverrideChangeEvent(cb func(*Settings, *glib.Quark, int) bool)

OverrideChangeEvent sets the "change_event" callback function.

func (*SettingsClass) OverrideChanged

func (x *SettingsClass) OverrideChanged(cb func(*Settings, string))

OverrideChanged sets the "changed" callback function.

func (*SettingsClass) OverrideWritableChangeEvent

func (x *SettingsClass) OverrideWritableChangeEvent(cb func(*Settings, glib.Quark) bool)

OverrideWritableChangeEvent sets the "writable_change_event" callback function.

func (*SettingsClass) OverrideWritableChanged

func (x *SettingsClass) OverrideWritableChanged(cb func(*Settings, string))

OverrideWritableChanged sets the "writable_changed" callback function.

type SettingsGetMapping

type SettingsGetMapping func(*glib.Variant, *uintptr, uintptr) bool

The type of the function that is used to convert from a value stored in a [class@Gio.Settings] 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.

type SettingsPrivate

type SettingsPrivate struct {
	// contains filtered or unexported fields
}

func (*SettingsPrivate) GoPointer

func (x *SettingsPrivate) GoPointer() uintptr

type SettingsSchema

type SettingsSchema struct {
	// contains filtered or unexported fields
}

The [struct@Gio.SettingsSchemaSource] and `GSettingsSchema` APIs provide a mechanism for advanced control over the loading of schemas and a mechanism for introspecting their content.

Plugin loading systems that wish to provide plugins a way to access settings face the problem of how to make the schemas for these settings visible to GSettings. Typically, a plugin will want to ship the schema along with itself and it won't be installed into the standard system directories for schemas.

[struct@Gio.SettingsSchemaSource] provides a mechanism for dealing with this by allowing the creation of a new ‘schema source’ from which schemas can be acquired. This schema source can then become part of the metadata associated with the plugin and queried whenever the plugin requires access to some settings.

Consider the following example:

```c typedef struct

{
   …
   GSettingsSchemaSource *schema_source;
   …
} Plugin;

Plugin * initialise_plugin (const gchar *dir)

{
  Plugin *plugin;

  …

  plugin->schema_source =
    g_settings_schema_source_new_from_directory (dir,
      g_settings_schema_source_get_default (), FALSE, NULL);

  …

  return plugin;
}

GSettings * plugin_get_settings (Plugin *plugin,

const gchar *schema_id)

{
  GSettingsSchema *schema;

  if (schema_id == NULL)
    schema_id = plugin->identifier;

  schema = g_settings_schema_source_lookup (plugin->schema_source,
                                            schema_id, FALSE);

  if (schema == NULL)
    {
      … disable the plugin or abort, etc …
    }

  return g_settings_new_full (schema, NULL, NULL);
}

```

The code above shows how hooks should be added to the code that initialises (or enables) the plugin to create the schema source and how an API can be added to the plugin system to provide a convenient way for the plugin to access its settings, using the schemas that it ships.

From the standpoint of the plugin, it would need to ensure that it ships a gschemas.compiled file as part of itself, and then simply do the following:

```c

{
  GSettings *settings;
  gint some_value;

  settings = plugin_get_settings (self, NULL);
  some_value = g_settings_get_int (settings, "some-value");
  …
}

```

It's also possible that the plugin system expects the schema source files (ie: `.gschema.xml` files) instead of a `gschemas.compiled` file. In that case, the plugin loading system must compile the schemas for itself before attempting to create the settings source.

func (*SettingsSchema) GetId

func (x *SettingsSchema) GetId() string

Get the ID of @schema.

func (*SettingsSchema) GetKey

func (x *SettingsSchema) GetKey(NameVar string) *SettingsSchemaKey

Gets the key named @name from @schema.

It is a programmer error to request a key that does not exist. See g_settings_schema_list_keys().

func (*SettingsSchema) GetPath

func (x *SettingsSchema) GetPath() string

Gets the path associated with @schema, or %NULL.

Schemas may be single-instance or relocatable. Single-instance schemas correspond to exactly one set of keys in the backend database: those located at the path returned by this function.

Relocatable schemas can be referenced by other schemas and can therefore describe multiple sets of keys at different locations. For relocatable schemas, this function will return %NULL.

func (*SettingsSchema) GoPointer

func (x *SettingsSchema) GoPointer() uintptr

func (*SettingsSchema) HasKey

func (x *SettingsSchema) HasKey(NameVar string) bool

Checks if @schema has a key named @name.

func (*SettingsSchema) ListChildren

func (x *SettingsSchema) ListChildren() []string

Gets the list of children in @schema.

You should free the return value with g_strfreev() when you are done with it.

func (*SettingsSchema) ListKeys

func (x *SettingsSchema) ListKeys() []string

Introspects the list of keys on @schema.

You should probably not be calling this function from "normal" code (since you should already know what keys are in your schema). This function is intended for introspection reasons.

func (*SettingsSchema) Ref

func (x *SettingsSchema) Ref() *SettingsSchema

Increase the reference count of @schema, returning a new reference.

func (*SettingsSchema) Unref

func (x *SettingsSchema) Unref()

Decrease the reference count of @schema, possibly freeing it.

type SettingsSchemaKey

type SettingsSchemaKey struct {
	// contains filtered or unexported fields
}

#GSettingsSchemaKey is an opaque data structure and can only be accessed using the following functions.

func (*SettingsSchemaKey) GetDefaultValue

func (x *SettingsSchemaKey) GetDefaultValue() *glib.Variant

Gets the default value for @key.

Note that this is the default value according to the schema. System administrator defaults and lockdown are not visible via this API.

func (*SettingsSchemaKey) GetDescription

func (x *SettingsSchemaKey) GetDescription() string

Gets the description for @key.

If no description has been provided in the schema for @key, returns %NULL.

The description can be one sentence to several paragraphs in length. Paragraphs are delimited with a double newline. Descriptions can be translated and the value returned from this function is is the current locale.

This function is slow. The summary and description information for the schemas is not stored in the compiled schema database so this function has to parse all of the source XML files in the schema directory.

func (*SettingsSchemaKey) GetName

func (x *SettingsSchemaKey) GetName() string

Gets the name of @key.

func (*SettingsSchemaKey) GetRange

func (x *SettingsSchemaKey) GetRange() *glib.Variant

Queries the range of a key.

This function will return a #GVariant that fully describes the range of values that are valid for @key.

The type of #GVariant returned is `(sv)`. The string describes the type of range restriction in effect. The type and meaning of the value contained in the variant depends on the string.

If the string is `'type'` then the variant contains an empty array. The element type of that empty array is the expected type of value and all values of that type are valid.

If the string is `'enum'` then the variant contains an array enumerating the possible values. Each item in the array is a possible valid value and no other values are valid.

If the string is `'flags'` then the variant contains an array. Each item in the array is a value that may appear zero or one times in an array to be used as the value for this key. For example, if the variant contained the array `['x', 'y']` then the valid values for the key would be `[]`, `['x']`, `['y']`, `['x', 'y']` and `['y', 'x']`.

Finally, if the string is `'range'` then the variant contains a pair of like-typed values -- the minimum and maximum permissible values for this key.

This information should not be used by normal programs. It is considered to be a hint for introspection purposes. Normal programs should already know what is permitted by their own schema. The format may change in any way in the future -- but particularly, new forms may be added to the possibilities described above.

You should free the returned value with g_variant_unref() when it is no longer needed.

func (*SettingsSchemaKey) GetSummary

func (x *SettingsSchemaKey) GetSummary() string

Gets the summary for @key.

If no summary has been provided in the schema for @key, returns %NULL.

The summary is a short description of the purpose of the key; usually one short sentence. Summaries can be translated and the value returned from this function is is the current locale.

This function is slow. The summary and description information for the schemas is not stored in the compiled schema database so this function has to parse all of the source XML files in the schema directory.

func (*SettingsSchemaKey) GetValueType

func (x *SettingsSchemaKey) GetValueType() *glib.VariantType

Gets the #GVariantType of @key.

func (*SettingsSchemaKey) GoPointer

func (x *SettingsSchemaKey) GoPointer() uintptr

func (*SettingsSchemaKey) RangeCheck

func (x *SettingsSchemaKey) RangeCheck(ValueVar *glib.Variant) bool

Checks if the given @value is within the permitted range for @key.

It is a programmer error if @value is not of the correct type — you must check for this first.

func (*SettingsSchemaKey) Ref

Increase the reference count of @key, returning a new reference.

func (*SettingsSchemaKey) Unref

func (x *SettingsSchemaKey) Unref()

Decrease the reference count of @key, possibly freeing it.

type SettingsSchemaSource

type SettingsSchemaSource struct {
	// contains filtered or unexported fields
}

This is an opaque structure type. You may not access it directly.

func NewSettingsSchemaSourceFromDirectory

func NewSettingsSchemaSourceFromDirectory(DirectoryVar string, ParentVar *SettingsSchemaSource, TrustedVar bool) (*SettingsSchemaSource, error)

Attempts to create a new schema source corresponding to the contents of the given directory.

This function is not required for normal uses of #GSettings but it may be useful to authors of plugin management systems.

The directory should contain a file called `gschemas.compiled` as produced by the [glib-compile-schemas][glib-compile-schemas] tool.

If @trusted is %TRUE then `gschemas.compiled` is trusted not to be corrupted. This assumption has a performance advantage, but can result in crashes or inconsistent behaviour in the case of a corrupted file. Generally, you should set @trusted to %TRUE for files installed by the system and to %FALSE for files in the home directory.

In either case, an empty file or some types of corruption in the file will result in %G_FILE_ERROR_INVAL being returned.

If @parent is non-%NULL then there are two effects.

First, if g_settings_schema_source_lookup() is called with the @recursive flag set to %TRUE and the schema can not be found in the source, the lookup will recurse to the parent.

Second, any references to other schemas specified within this source (ie: `child` or `extends`) references may be resolved from the @parent.

For this second reason, except in very unusual situations, the @parent should probably be given as the default schema source, as returned by g_settings_schema_source_get_default().

func SettingsSchemaSourceGetDefault

func SettingsSchemaSourceGetDefault() *SettingsSchemaSource

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.

func (*SettingsSchemaSource) GoPointer

func (x *SettingsSchemaSource) GoPointer() uintptr

func (*SettingsSchemaSource) ListSchemas

func (x *SettingsSchemaSource) ListSchemas(RecursiveVar bool, NonRelocatableVar *[]string, RelocatableVar *[]string)

Lists the schemas in a given source.

If @recursive is %TRUE then include parent sources. If %FALSE then only include the schemas from one source (ie: one directory). You probably want %TRUE.

Non-relocatable schemas are those for which you can call g_settings_new(). Relocatable schemas are those for which you must use g_settings_new_with_path().

Do not call this function from normal programs. This is designed for use by database editors, commandline tools, etc.

func (*SettingsSchemaSource) Lookup

func (x *SettingsSchemaSource) Lookup(SchemaIdVar string, RecursiveVar bool) *SettingsSchema

Looks up a schema with the identifier @schema_id in @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 the schema isn't found directly in @source and @recursive is %TRUE then the parent sources will also be checked.

If the schema isn't found, %NULL is returned.

func (*SettingsSchemaSource) Ref

Increase the reference count of @source, returning a new reference.

func (*SettingsSchemaSource) Unref

func (x *SettingsSchemaSource) Unref()

Decrease the reference count of @source, possibly freeing it.

type SimpleAction

type SimpleAction struct {
	gobject.Object
}

A `GSimpleAction` is the obvious simple implementation of the [iface@Gio.Action] interface. This is the easiest way to create an action for purposes of adding it to a [class@Gio.SimpleActionGroup].

func NewSimpleAction

func NewSimpleAction(NameVar string, ParameterTypeVar *glib.VariantType) *SimpleAction

Creates a new action.

The created action is stateless. See g_simple_action_new_stateful() to create an action that has state.

func NewSimpleActionStateful

func NewSimpleActionStateful(NameVar string, ParameterTypeVar *glib.VariantType, StateVar *glib.Variant) *SimpleAction

Creates a new stateful action.

All future state values must have the same #GVariantType as the initial @state.

If the @state #GVariant is floating, it is consumed.

func SimpleActionNewFromInternalPtr

func SimpleActionNewFromInternalPtr(ptr uintptr) *SimpleAction

func (*SimpleAction) Activate

func (x *SimpleAction) Activate(ParameterVar *glib.Variant)

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 [type@GLib.Variant] is floating, it is consumed.

func (*SimpleAction) ChangeState

func (x *SimpleAction) ChangeState(ValueVar *glib.Variant)

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 [method@Gio.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 [method@Gio.Action.get_state_hint].

If the @value [type@GLib.Variant] is floating, it is consumed.

func (*SimpleAction) ConnectActivate

func (x *SimpleAction) ConnectActivate(cb *func(SimpleAction, uintptr)) uint

Indicates that the action was just activated.

@parameter will always be of the expected type, i.e. the parameter type specified when the action was created. If an incorrect type is given when activating the action, this signal is not emitted.

Since GLib 2.40, if no handler is connected to this signal then the default behaviour for boolean-stated actions with a %NULL parameter type is to toggle them via the #GSimpleAction::change-state signal. For stateful actions where the state type is equal to the parameter type, the default is to forward them directly to #GSimpleAction::change-state. This should allow almost all users of #GSimpleAction to connect only one handler or the other.

func (*SimpleAction) ConnectChangeState

func (x *SimpleAction) ConnectChangeState(cb *func(SimpleAction, uintptr)) uint

Indicates that the action just received a request to change its state.

@value will always be of the correct state type, i.e. the type of the initial state passed to g_simple_action_new_stateful(). If an incorrect type is given when requesting to change the state, this signal is not emitted.

If no handler is connected to this signal then the default behaviour is to call g_simple_action_set_state() to set the state to the requested value. If you connect a signal handler then no default action is taken. If the state should change then you must call g_simple_action_set_state() from the handler.

An example of a 'change-state' handler: |[<!-- language="C" --> static void change_volume_state (GSimpleAction *action,

GVariant      *value,
gpointer       user_data)

{
  gint requested;

  requested = g_variant_get_int32 (value);

  // Volume only goes from 0 to 10
  if (0 <= requested && requested <= 10)
    g_simple_action_set_state (action, value);
}

]|

The handler need not set the state to the requested value. It could set it to any value at all, or take some other action.

func (*SimpleAction) GetEnabled

func (x *SimpleAction) GetEnabled() bool

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.

func (*SimpleAction) GetName

func (x *SimpleAction) GetName() string

Queries the name of @action.

func (*SimpleAction) GetParameterType

func (x *SimpleAction) GetParameterType() *glib.VariantType

Queries the type of the parameter that must be given when activating @action.

When activating the action using [method@Gio.Action.activate], the [type@GLib.Variant] 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 [type@GLib.Variant], but `NULL` instead.

func (*SimpleAction) GetPropertyEnabled

func (x *SimpleAction) GetPropertyEnabled() bool

GetPropertyEnabled gets the "enabled" property. If @action is currently enabled.

If the action is disabled then calls to g_action_activate() and g_action_change_state() have no effect.

func (*SimpleAction) GetPropertyName

func (x *SimpleAction) GetPropertyName() string

GetPropertyName gets the "name" property. The name of the action. This is mostly meaningful for identifying the action once it has been added to a #GSimpleActionGroup.

func (*SimpleAction) GetPropertyParameterType

func (x *SimpleAction) GetPropertyParameterType() uintptr

GetPropertyParameterType gets the "parameter-type" property. The type of the parameter that must be given when activating the action.

func (*SimpleAction) GetPropertyState

func (x *SimpleAction) GetPropertyState() uintptr

GetPropertyState gets the "state" property. The state of the action, or %NULL if the action is stateless.

func (*SimpleAction) GetPropertyStateType

func (x *SimpleAction) GetPropertyStateType() uintptr

GetPropertyStateType gets the "state-type" property. The #GVariantType of the state that the action has, or %NULL if the action is stateless.

func (*SimpleAction) GetState

func (x *SimpleAction) GetState() *glib.Variant

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 [method@Gio.Action.get_state_type].

The return value (if non-`NULL`) should be freed with [method@GLib.Variant.unref] when it is no longer required.

func (*SimpleAction) GetStateHint

func (x *SimpleAction) GetStateHint() *glib.Variant

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 [type@GLib.Variant] array is returned then each item in the array is a possible value for the state. If a [type@GLib.Variant] 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 [method@GLib.Variant.unref] when it is no longer required.

func (*SimpleAction) GetStateType

func (x *SimpleAction) GetStateType() *glib.VariantType

Queries the type of the state of @action.

If the action is stateful (e.g. created with [ctor@Gio.SimpleAction.new_stateful]) then this function returns the [type@GLib.VariantType] of the state. This is the type of the initial value given as the state. All calls to [method@Gio.Action.change_state] must give a [type@GLib.Variant] of this type and [method@Gio.Action.get_state] will return a [type@GLib.Variant] of the same type.

If the action is not stateful (e.g. created with [ctor@Gio.SimpleAction.new]) then this function will return `NULL`. In that case, [method@Gio.Action.get_state] will return `NULL` and you must not call [method@Gio.Action.change_state].

func (*SimpleAction) GoPointer

func (c *SimpleAction) GoPointer() uintptr

func (*SimpleAction) SetEnabled

func (x *SimpleAction) SetEnabled(EnabledVar bool)

Sets the action as enabled or not.

An action must be enabled in order to be activated or in order to have its state changed from outside callers.

This should only be called by the implementor of the action. Users of the action should not attempt to modify its enabled flag.

func (*SimpleAction) SetGoPointer

func (c *SimpleAction) SetGoPointer(ptr uintptr)

func (*SimpleAction) SetPropertyEnabled

func (x *SimpleAction) SetPropertyEnabled(value bool)

SetPropertyEnabled sets the "enabled" property. If @action is currently enabled.

If the action is disabled then calls to g_action_activate() and g_action_change_state() have no effect.

func (*SimpleAction) SetPropertyName

func (x *SimpleAction) SetPropertyName(value string)

SetPropertyName sets the "name" property. The name of the action. This is mostly meaningful for identifying the action once it has been added to a #GSimpleActionGroup.

func (*SimpleAction) SetPropertyParameterType

func (x *SimpleAction) SetPropertyParameterType(value uintptr)

SetPropertyParameterType sets the "parameter-type" property. The type of the parameter that must be given when activating the action.

func (*SimpleAction) SetPropertyState

func (x *SimpleAction) SetPropertyState(value uintptr)

SetPropertyState sets the "state" property. The state of the action, or %NULL if the action is stateless.

func (*SimpleAction) SetState

func (x *SimpleAction) SetState(ValueVar *glib.Variant)

Sets the state of the action.

This directly updates the 'state' property to the given value.

This should only be called by the implementor of the action. Users of the action should not attempt to directly modify the 'state' property. Instead, they should call g_action_change_state() to request the change.

If the @value GVariant is floating, it is consumed.

func (*SimpleAction) SetStateHint

func (x *SimpleAction) SetStateHint(StateHintVar *glib.Variant)

Sets the state hint for the action.

See g_action_get_state_hint() for more information about action state hints.

type SimpleActionGroup

type SimpleActionGroup struct {
	gobject.Object
}

`GSimpleActionGroup` is a hash table filled with [iface@Gio.Action] objects, implementing the [iface@Gio.ActionGroup] and [iface@Gio.ActionMap] interfaces.

func NewSimpleActionGroup

func NewSimpleActionGroup() *SimpleActionGroup

Creates a new, empty, #GSimpleActionGroup.

func SimpleActionGroupNewFromInternalPtr

func SimpleActionGroupNewFromInternalPtr(ptr uintptr) *SimpleActionGroup

func (*SimpleActionGroup) ActionAdded

func (x *SimpleActionGroup) ActionAdded(ActionNameVar string)

Emits the [signal@Gio.ActionGroup::action-added] signal on @action_group.

This function should only be called by [type@Gio.ActionGroup] implementations.

func (*SimpleActionGroup) ActionEnabledChanged

func (x *SimpleActionGroup) ActionEnabledChanged(ActionNameVar string, EnabledVar bool)

Emits the [signal@Gio.ActionGroup::action-enabled-changed] signal on @action_group.

This function should only be called by [type@Gio.ActionGroup] implementations.

func (*SimpleActionGroup) ActionRemoved

func (x *SimpleActionGroup) ActionRemoved(ActionNameVar string)

Emits the [signal@Gio.ActionGroup::action-removed] signal on @action_group.

This function should only be called by [type@Gio.ActionGroup] implementations.

func (*SimpleActionGroup) ActionStateChanged

func (x *SimpleActionGroup) ActionStateChanged(ActionNameVar string, StateVar *glib.Variant)

Emits the [signal@Gio.ActionGroup::action-state-changed] signal on @action_group.

This function should only be called by [type@Gio.ActionGroup] implementations.

func (*SimpleActionGroup) ActivateAction

func (x *SimpleActionGroup) ActivateAction(ActionNameVar string, ParameterVar *glib.Variant)

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 [method@Gio.ActionGroup.get_action_parameter_type].

If the [type@Gio.ActionGroup] 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, [method@Gio.DBusConnection.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 [method@Gio.DBusConnection.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); ```

func (*SimpleActionGroup) AddAction

func (x *SimpleActionGroup) AddAction(ActionVar Action)

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.

func (*SimpleActionGroup) AddActionEntries

func (x *SimpleActionGroup) AddActionEntries(EntriesVar []ActionEntry, NEntriesVar int, UserDataVar uintptr)

A convenience function for creating multiple [class@Gio.SimpleAction] instances and adding them to a [iface@Gio.ActionMap].

Each action is constructed as per one [struct@Gio.ActionEntry].

```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);
}

```

func (*SimpleActionGroup) AddEntries

func (x *SimpleActionGroup) AddEntries(EntriesVar []ActionEntry, NEntriesVar int, UserDataVar uintptr)

A convenience function for creating multiple #GSimpleAction instances and adding them to the action group.

func (*SimpleActionGroup) ChangeActionState

func (x *SimpleActionGroup) ChangeActionState(ActionNameVar string, ValueVar *glib.Variant)

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 [method@Gio.ActionGroup.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 [method@Gio.ActionGroup.get_action_state_hint].

If the @value GVariant is floating, it is consumed.

func (*SimpleActionGroup) GetActionEnabled

func (x *SimpleActionGroup) GetActionEnabled(ActionNameVar string) bool

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.

func (*SimpleActionGroup) GetActionParameterType

func (x *SimpleActionGroup) GetActionParameterType(ActionNameVar string) *glib.VariantType

Queries the type of the parameter that must be given when activating the named action within @action_group.

When activating the action using [method@Gio.ActionGroup.activate_action], the [type@GLib.Variant] 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 [type@GLib.Variant], 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.

func (*SimpleActionGroup) GetActionState

func (x *SimpleActionGroup) GetActionState(ActionNameVar string) *glib.Variant

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 [method@Gio.ActionGroup.get_action_state_type].

The return value (if non-`NULL`) should be freed with [method@GLib.Variant.unref] when it is no longer required.

func (*SimpleActionGroup) GetActionStateHint

func (x *SimpleActionGroup) GetActionStateHint(ActionNameVar string) *glib.Variant

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 [type@GLib.Variant] array is returned then each item in the array is a possible value for the state. If a [type@GLib.Variant] 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 [method@GLib.Variant.unref] when it is no longer required.

func (*SimpleActionGroup) GetActionStateType

func (x *SimpleActionGroup) GetActionStateType(ActionNameVar string) *glib.VariantType

Queries the type of the state of the named action within @action_group.

If the action is stateful then this function returns the [type@GLib.VariantType] of the state. All calls to [method@Gio.ActionGroup.change_action_state] must give a [type@GLib.Variant] of this type and [method@Gio.ActionGroup.get_action_state] will return a [type@GLib.Variant] of the same type.

If the action is not stateful then this function will return `NULL`. In that case, [method@Gio.ActionGroup.get_action_state] will return `NULL` and you must not call [method@Gio.ActionGroup.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.

func (*SimpleActionGroup) GoPointer

func (c *SimpleActionGroup) GoPointer() uintptr

func (*SimpleActionGroup) HasAction

func (x *SimpleActionGroup) HasAction(ActionNameVar string) bool

Checks if the named action exists within @action_group.

func (*SimpleActionGroup) Insert

func (x *SimpleActionGroup) Insert(ActionVar Action)

Adds an action to the action group.

If the action group already contains an action with the same name as @action then the old action is dropped from the group.

The action group takes its own reference on @action.

func (*SimpleActionGroup) ListActions

func (x *SimpleActionGroup) ListActions() []string

Lists the actions contained within @action_group.

The caller is responsible for freeing the list with [func@GLib.strfreev] when it is no longer required.

func (*SimpleActionGroup) Lookup

func (x *SimpleActionGroup) Lookup(ActionNameVar string) *ActionBase

Looks up the action with the name @action_name in the group.

If no such action exists, returns %NULL.

func (*SimpleActionGroup) LookupAction

func (x *SimpleActionGroup) LookupAction(ActionNameVar string) *ActionBase

Looks up the action with the name @action_name in @action_map.

If no such action exists, returns `NULL`.

func (*SimpleActionGroup) QueryAction

func (x *SimpleActionGroup) QueryAction(ActionNameVar string, EnabledVar *bool, ParameterTypeVar **glib.VariantType, StateTypeVar **glib.VariantType, StateHintVar **glib.Variant, StateVar **glib.Variant) bool

Queries all aspects of the named action within an @action_group.

This function acquires the information available from [method@Gio.ActionGroup.has_action], [method@Gio.ActionGroup.get_action_enabled], [method@Gio.ActionGroup.get_action_parameter_type], [method@Gio.ActionGroup.get_action_state_type], [method@Gio.ActionGroup.get_action_state_hint] and [method@Gio.ActionGroup.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 [type@Gio.ActionGroup] 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.

func (*SimpleActionGroup) Remove

func (x *SimpleActionGroup) Remove(ActionNameVar string)

Removes the named action from the action group.

If no action of this name is in the group then nothing happens.

func (*SimpleActionGroup) RemoveAction

func (x *SimpleActionGroup) RemoveAction(ActionNameVar string)

Removes the named action from the action map.

If no action of this name is in the map then nothing happens.

func (*SimpleActionGroup) RemoveActionEntries

func (x *SimpleActionGroup) RemoveActionEntries(EntriesVar []ActionEntry, NEntriesVar int)

Remove actions from a [iface@Gio.ActionMap]. This is meant as the reverse of [method@Gio.ActionMap.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));
}

```

func (*SimpleActionGroup) SetGoPointer

func (c *SimpleActionGroup) SetGoPointer(ptr uintptr)

type SimpleActionGroupClass

type SimpleActionGroupClass struct {
	ParentClass gobject.ObjectClass

	Padding [12]uintptr
	// contains filtered or unexported fields
}

func (*SimpleActionGroupClass) GoPointer

func (x *SimpleActionGroupClass) GoPointer() uintptr

type SimpleActionGroupPrivate

type SimpleActionGroupPrivate struct {
	// contains filtered or unexported fields
}

func (*SimpleActionGroupPrivate) GoPointer

func (x *SimpleActionGroupPrivate) GoPointer() uintptr

type SimpleAsyncResult

type SimpleAsyncResult struct {
	gobject.Object
}

As of GLib 2.46, `GSimpleAsyncResult` is deprecated in favor of [class@Gio.Task], which provides a simpler API.

`GSimpleAsyncResult` implements [iface@Gio.AsyncResult].

`GSimpleAsyncResult` handles [type@Gio.AsyncReadyCallback]s, error reporting, operation cancellation and the final state of an operation, completely transparent to the application. Results can be returned as a pointer e.g. for functions that return data that is collected asynchronously, a boolean value for checking the success or failure of an operation, or a `gssize` for operations which return the number of bytes modified by the operation; all of the simple return cases are covered.

Most of the time, an application will not need to know of the details of this API; it is handled transparently, and any necessary operations are handled by [iface@Gio.AsyncResult]’s interface. However, if implementing a new GIO module, for writing language bindings, or for complex applications that need better control of how asynchronous operations are completed, it is important to understand this functionality.

`GSimpleAsyncResult`s are tagged with the calling function to ensure that asynchronous functions and their finishing functions are used together correctly.

To create a new `GSimpleAsyncResult`, call [ctor@Gio.SimpleAsyncResult.new]. If the result needs to be created for a `GError`, use [ctor@Gio.SimpleAsyncResult.new_from_error] or [ctor@Gio.SimpleAsyncResult.new_take_error]. If a `GError` is not available (e.g. the asynchronous operation doesn’t take a `GError` argument), but the result still needs to be created for an error condition, use [ctor@Gio.SimpleAsyncResult.new_error] (or [method@Gio.SimpleAsyncResult.set_error_va] if your application or binding requires passing a variable argument list directly), and the error can then be propagated through the use of [method@Gio.SimpleAsyncResult.propagate_error].

An asynchronous operation can be made to ignore a cancellation event by calling [method@Gio.SimpleAsyncResult.set_handle_cancellation] with a `GSimpleAsyncResult` for the operation and `FALSE`. This is useful for operations that are dangerous to cancel, such as close (which would cause a leak if cancelled before being run).

`GSimpleAsyncResult` can integrate into GLib’s event loop, [type@GLib.MainLoop], or it can use [type@GLib.Thread]s. [method@Gio.SimpleAsyncResult.complete] will finish an I/O task directly from the point where it is called. [method@Gio.SimpleAsyncResult.complete_in_idle] will finish it from an idle handler in the thread-default main context (see [method@GLib.MainContext.push_thread_default]) where the `GSimpleAsyncResult` was created. [method@Gio.SimpleAsyncResult.run_in_thread] will run the job in a separate thread and then use [method@Gio.SimpleAsyncResult.complete_in_idle] to deliver the result.

To set the results of an asynchronous function, [method@Gio.SimpleAsyncResult.set_op_res_gpointer], [method@Gio.SimpleAsyncResult.set_op_res_gboolean], and [method@Gio.SimpleAsyncResult.set_op_res_gssize] are provided, setting the operation's result to a `gpointer`, `gboolean`, or `gssize`, respectively.

Likewise, to get the result of an asynchronous function, [method@Gio.SimpleAsyncResult.get_op_res_gpointer], [method@Gio.SimpleAsyncResult.get_op_res_gboolean], and [method@Gio.SimpleAsyncResult.get_op_res_gssize] are provided, getting the operation’s result as a `gpointer`, `gboolean`, and `gssize`, respectively.

For the details of the requirements implementations must respect, see [iface@Gio.AsyncResult]. A typical implementation of an asynchronous operation using `GSimpleAsyncResult` looks something like this:

```c static void baked_cb (Cake *cake,

gpointer user_data)

{
  // In this example, this callback is not given a reference to the cake,
  // so the GSimpleAsyncResult has to take a reference to it.
  GSimpleAsyncResult *result = user_data;

  if (cake == NULL)
    g_simple_async_result_set_error (result,
                                     BAKER_ERRORS,
                                     BAKER_ERROR_NO_FLOUR,
                                     "Go to the supermarket");
  else
    g_simple_async_result_set_op_res_gpointer (result,
                                               g_object_ref (cake),
                                               g_object_unref);

  // In this example, we assume that baked_cb is called as a callback from
  // the mainloop, so it's safe to complete the operation synchronously here.
  // If, however, _baker_prepare_cake () might call its callback without
  // first returning to the mainloop — inadvisable, but some APIs do so —
  // we would need to use g_simple_async_result_complete_in_idle().
  g_simple_async_result_complete (result);
  g_object_unref (result);
}

void baker_bake_cake_async (Baker *self,

guint               radius,
GAsyncReadyCallback callback,
gpointer            user_data)

{
  GSimpleAsyncResult *simple;
  Cake               *cake;

  if (radius < 3)
    {
      g_simple_async_report_error_in_idle (G_OBJECT (self),
                                           callback,
                                           user_data,
                                           BAKER_ERRORS,
                                           BAKER_ERROR_TOO_SMALL,
                                           "%ucm radius cakes are silly",
                                           radius);
      return;
    }

  simple = g_simple_async_result_new (G_OBJECT (self),
                                      callback,
                                      user_data,
                                      baker_bake_cake_async);
  cake = _baker_get_cached_cake (self, radius);

  if (cake != NULL)
    {
      g_simple_async_result_set_op_res_gpointer (simple,
                                                 g_object_ref (cake),
                                                 g_object_unref);
      g_simple_async_result_complete_in_idle (simple);
      g_object_unref (simple);
      // Drop the reference returned by _baker_get_cached_cake();
      // the GSimpleAsyncResult has taken its own reference.
      g_object_unref (cake);
      return;
    }

  _baker_prepare_cake (self, radius, baked_cb, simple);
}

Cake * baker_bake_cake_finish (Baker *self,

GAsyncResult *result,
GError      **error)

{
  GSimpleAsyncResult *simple;
  Cake               *cake;

  g_return_val_if_fail (g_simple_async_result_is_valid (result,
                                                        G_OBJECT (self),
                                                        baker_bake_cake_async),
                        NULL);

  simple = (GSimpleAsyncResult *) result;

  if (g_simple_async_result_propagate_error (simple, error))
    return NULL;

  cake = CAKE (g_simple_async_result_get_op_res_gpointer (simple));
  return g_object_ref (cake);
}

```

func NewSimpleAsyncResult

func NewSimpleAsyncResult(SourceObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, UserDataVar uintptr, SourceTagVar uintptr) *SimpleAsyncResult

Creates a #GSimpleAsyncResult.

The common convention is to create the #GSimpleAsyncResult in the function that starts the asynchronous operation and use that same function as the @source_tag.

If your operation supports cancellation with #GCancellable (which it probably should) then you should provide the user's cancellable to g_simple_async_result_set_check_cancellable() immediately after this function returns.

func NewSimpleAsyncResultError

func NewSimpleAsyncResultError(SourceObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, UserDataVar uintptr, DomainVar glib.Quark, CodeVar int, FormatVar string, varArgs ...interface{}) *SimpleAsyncResult

Creates a new #GSimpleAsyncResult with a set error.

func NewSimpleAsyncResultFromError

func NewSimpleAsyncResultFromError(SourceObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, UserDataVar uintptr, ErrorVar *glib.Error) *SimpleAsyncResult

Creates a #GSimpleAsyncResult from an error condition.

func NewSimpleAsyncResultTakeError

func NewSimpleAsyncResultTakeError(SourceObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, UserDataVar uintptr, ErrorVar *glib.Error) *SimpleAsyncResult

Creates a #GSimpleAsyncResult from an error condition, and takes over the caller's ownership of @error, so the caller does not need to free it anymore.

func SimpleAsyncResultNewFromInternalPtr

func SimpleAsyncResultNewFromInternalPtr(ptr uintptr) *SimpleAsyncResult

func (*SimpleAsyncResult) Complete

func (x *SimpleAsyncResult) Complete()

Completes an asynchronous I/O job immediately. Must be called in the thread where the asynchronous result was to be delivered, as it invokes the callback directly. If you are in a different thread use g_simple_async_result_complete_in_idle().

Calling this function takes a reference to @simple for as long as is needed to complete the call.

func (*SimpleAsyncResult) CompleteInIdle

func (x *SimpleAsyncResult) CompleteInIdle()

Completes an asynchronous function in an idle handler in the thread-default main context (see [method@GLib.MainContext.push_thread_default]) of the thread that @simple was initially created in (and re-pushes that context around the invocation of the callback).

Calling this function takes a reference to @simple for as long as is needed to complete the call.

func (*SimpleAsyncResult) GetOpResGboolean

func (x *SimpleAsyncResult) GetOpResGboolean() bool

Gets the operation result boolean from within the asynchronous result.

func (*SimpleAsyncResult) GetOpResGpointer

func (x *SimpleAsyncResult) GetOpResGpointer() uintptr

Gets a pointer result as returned by the asynchronous function.

func (*SimpleAsyncResult) GetOpResGssize

func (x *SimpleAsyncResult) GetOpResGssize() int

Gets a gssize from the asynchronous result.

func (*SimpleAsyncResult) GetSourceObject

func (x *SimpleAsyncResult) GetSourceObject() *gobject.Object

Gets the source object from a [iface@Gio.AsyncResult].

func (*SimpleAsyncResult) GetSourceTag

func (x *SimpleAsyncResult) GetSourceTag() uintptr

Gets the source tag for the #GSimpleAsyncResult.

func (*SimpleAsyncResult) GetUserData

func (x *SimpleAsyncResult) GetUserData() uintptr

Gets the user data from a [iface@Gio.AsyncResult].

func (*SimpleAsyncResult) GoPointer

func (c *SimpleAsyncResult) GoPointer() uintptr

func (*SimpleAsyncResult) IsTagged

func (x *SimpleAsyncResult) IsTagged(SourceTagVar uintptr) bool

Checks if @res has the given @source_tag (generally a function pointer indicating the function @res was created by).

func (*SimpleAsyncResult) LegacyPropagateError

func (x *SimpleAsyncResult) LegacyPropagateError() (bool, error)

If @res is a [class@Gio.SimpleAsyncResult], this is equivalent to [method@Gio.SimpleAsyncResult.propagate_error]. Otherwise it returns `FALSE`.

This can be used for legacy error handling in async `*_finish()` wrapper functions that traditionally handled [class@Gio.SimpleAsyncResult] error returns themselves rather than calling into the virtual method. This should not be used in new code; [iface@Gio.AsyncResult] errors that are set by virtual methods should also be extracted by virtual methods, to enable subclasses to chain up correctly.

func (*SimpleAsyncResult) PropagateError

func (x *SimpleAsyncResult) PropagateError() (bool, error)

Propagates an error from within the simple asynchronous result to a given destination.

If the #GCancellable given to a prior call to g_simple_async_result_set_check_cancellable() is cancelled then this function will return %TRUE with @dest set appropriately.

func (*SimpleAsyncResult) RunInThread

func (x *SimpleAsyncResult) RunInThread(FuncVar *SimpleAsyncThreadFunc, IoPriorityVar int, CancellableVar *Cancellable)

Runs the asynchronous job in a separate thread and then calls g_simple_async_result_complete_in_idle() on @simple to return the result to the appropriate main loop.

Calling this function takes a reference to @simple for as long as is needed to run the job and report its completion.

func (*SimpleAsyncResult) SetCheckCancellable

func (x *SimpleAsyncResult) SetCheckCancellable(CheckCancellableVar *Cancellable)

Sets a #GCancellable to check before dispatching results.

This function has one very specific purpose: the provided cancellable is checked at the time of g_simple_async_result_propagate_error() If it is cancelled, these functions will return an "Operation was cancelled" error (%G_IO_ERROR_CANCELLED).

Implementors of cancellable asynchronous functions should use this in order to provide a guarantee to their callers that cancelling an async operation will reliably result in an error being returned for that operation (even if a positive result for the operation has already been sent as an idle to the main context to be dispatched).

The checking described above is done regardless of any call to the unrelated g_simple_async_result_set_handle_cancellation() function.

func (*SimpleAsyncResult) SetError

func (x *SimpleAsyncResult) SetError(DomainVar glib.Quark, CodeVar int, FormatVar string, varArgs ...interface{})

Sets an error within the asynchronous result without a #GError.

func (*SimpleAsyncResult) SetErrorVa

func (x *SimpleAsyncResult) SetErrorVa(DomainVar glib.Quark, CodeVar int, FormatVar string, ArgsVar []interface{})

Sets an error within the asynchronous result without a #GError. Unless writing a binding, see g_simple_async_result_set_error().

func (*SimpleAsyncResult) SetFromError

func (x *SimpleAsyncResult) SetFromError(ErrorVar *glib.Error)

Sets the result from a #GError.

func (*SimpleAsyncResult) SetGoPointer

func (c *SimpleAsyncResult) SetGoPointer(ptr uintptr)

func (*SimpleAsyncResult) SetHandleCancellation

func (x *SimpleAsyncResult) SetHandleCancellation(HandleCancellationVar bool)

Sets whether to handle cancellation within the asynchronous operation.

This function has nothing to do with g_simple_async_result_set_check_cancellable(). It only refers to the #GCancellable passed to g_simple_async_result_run_in_thread().

func (*SimpleAsyncResult) SetOpResGboolean

func (x *SimpleAsyncResult) SetOpResGboolean(OpResVar bool)

Sets the operation result to a boolean within the asynchronous result.

func (*SimpleAsyncResult) SetOpResGpointer

func (x *SimpleAsyncResult) SetOpResGpointer(OpResVar uintptr, DestroyOpResVar *glib.DestroyNotify)

Sets the operation result within the asynchronous result to a pointer.

func (*SimpleAsyncResult) SetOpResGssize

func (x *SimpleAsyncResult) SetOpResGssize(OpResVar int)

Sets the operation result within the asynchronous result to the given @op_res.

func (*SimpleAsyncResult) TakeError

func (x *SimpleAsyncResult) TakeError(ErrorVar *glib.Error)

Sets the result from @error, and takes over the caller's ownership of @error, so the caller does not need to free it any more.

type SimpleAsyncResultClass

type SimpleAsyncResultClass struct {
	// contains filtered or unexported fields
}

func (*SimpleAsyncResultClass) GoPointer

func (x *SimpleAsyncResultClass) GoPointer() uintptr

type SimpleAsyncThreadFunc

type SimpleAsyncThreadFunc func(uintptr, uintptr, uintptr)

Simple thread function that runs an asynchronous operation and checks for cancellation.

type SimpleIOStream

type SimpleIOStream struct {
	IOStream
}

`GSimpleIOStream` creates a [class@Gio.IOStream] from an arbitrary [class@Gio.InputStream] and [class@Gio.OutputStream]. This allows any pair of input and output streams to be used with [class@Gio.IOStream] methods.

This is useful when you obtained a [class@Gio.InputStream] and a [class@Gio.OutputStream] by other means, for instance creating them with platform specific methods as [`g_unix_input_stream_new()`](../gio-unix/ctor.UnixInputStream.new.html) (from `gio-unix-2.0.pc` / `GioUnix-2.0`), and you want to take advantage of the methods provided by [class@Gio.IOStream].

func NewSimpleIOStream

func NewSimpleIOStream(InputStreamVar *InputStream, OutputStreamVar *OutputStream) *SimpleIOStream

Creates a new #GSimpleIOStream wrapping @input_stream and @output_stream. See also #GIOStream.

func SimpleIOStreamNewFromInternalPtr

func SimpleIOStreamNewFromInternalPtr(ptr uintptr) *SimpleIOStream

func (*SimpleIOStream) GoPointer

func (c *SimpleIOStream) GoPointer() uintptr

func (*SimpleIOStream) SetGoPointer

func (c *SimpleIOStream) SetGoPointer(ptr uintptr)

type SimplePermission

type SimplePermission struct {
	Permission
}

`GSimplePermission` is a trivial implementation of [class@Gio.Permission] that represents a permission that is either always or never allowed. The value is given at construction and doesn’t change.

Calling [method@Gio.Permission.acquire] or [method@Gio.Permission.release] on a `GSimplePermission` will result in errors.

func NewSimplePermission

func NewSimplePermission(AllowedVar bool) *SimplePermission

Creates a new #GPermission instance that represents an action that is either always or never allowed.

func SimplePermissionNewFromInternalPtr

func SimplePermissionNewFromInternalPtr(ptr uintptr) *SimplePermission

func (*SimplePermission) GoPointer

func (c *SimplePermission) GoPointer() uintptr

func (*SimplePermission) SetGoPointer

func (c *SimplePermission) SetGoPointer(ptr uintptr)

type SimpleProxyResolver

type SimpleProxyResolver struct {
	gobject.Object
}

`GSimpleProxyResolver` is a simple [iface@Gio.ProxyResolver] implementation that handles a single default proxy, multiple URI-scheme-specific proxies, and a list of hosts that proxies should not be used for.

`GSimpleProxyResolver` is never the default proxy resolver, but it can be used as the base class for another proxy resolver implementation, or it can be created and used manually, such as with [method@Gio.SocketClient.set_proxy_resolver].

func SimpleProxyResolverNewFromInternalPtr

func SimpleProxyResolverNewFromInternalPtr(ptr uintptr) *SimpleProxyResolver

func (*SimpleProxyResolver) GetPropertyDefaultProxy

func (x *SimpleProxyResolver) GetPropertyDefaultProxy() string

GetPropertyDefaultProxy gets the "default-proxy" property. The default proxy URI that will be used for any URI that doesn't match #GSimpleProxyResolver:ignore-hosts, and doesn't match any of the schemes set with g_simple_proxy_resolver_set_uri_proxy().

Note that as a special case, if this URI starts with "socks://", #GSimpleProxyResolver will treat it as referring to all three of the socks5, socks4a, and socks4 proxy types.

func (*SimpleProxyResolver) GetPropertyIgnoreHosts

func (x *SimpleProxyResolver) GetPropertyIgnoreHosts() []string

GetPropertyIgnoreHosts gets the "ignore-hosts" property. A list of hostnames and IP addresses that the resolver should allow direct connections to.

Entries can be in one of 4 formats:

  • A hostname, such as "example.com", ".example.com", or "*.example.com", any of which match "example.com" or any subdomain of it.

  • An IPv4 or IPv6 address, such as "192.168.1.1", which matches only that address.

  • A hostname or IP address followed by a port, such as "example.com:80", which matches whatever the hostname or IP address would match, but only for URLs with the (explicitly) indicated port. In the case of an IPv6 address, the address part must appear in brackets: "[::1]:443"

  • An IP address range, given by a base address and prefix length, such as "fe80::/10", which matches any address in that range.

Note that when dealing with Unicode hostnames, the matching is done against the ASCII form of the name.

Also note that hostname exclusions apply only to connections made to hosts identified by name, and IP address exclusions apply only to connections made to hosts identified by address. That is, if example.com has an address of 192.168.1.1, and the :ignore-hosts list contains only "192.168.1.1", then a connection to "example.com" (eg, via a #GNetworkAddress) will use the proxy, and a connection to "192.168.1.1" (eg, via a #GInetSocketAddress) will not.

These rules match the "ignore-hosts"/"noproxy" rules most commonly used by other applications.

func (*SimpleProxyResolver) GoPointer

func (c *SimpleProxyResolver) GoPointer() uintptr

func (*SimpleProxyResolver) IsSupported

func (x *SimpleProxyResolver) IsSupported() bool

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.)

func (*SimpleProxyResolver) Lookup

func (x *SimpleProxyResolver) Lookup(UriVar string, CancellableVar *Cancellable) ([]string, error)

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 `<protocol>://[user[:password]@]host[:port]` or `direct://`, where `<protocol>` 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.

func (*SimpleProxyResolver) LookupAsync

func (x *SimpleProxyResolver) LookupAsync(UriVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more details.

func (*SimpleProxyResolver) LookupFinish

func (x *SimpleProxyResolver) LookupFinish(ResultVar AsyncResult) ([]string, error)

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.

func (*SimpleProxyResolver) SetDefaultProxy

func (x *SimpleProxyResolver) SetDefaultProxy(DefaultProxyVar *string)

Sets the default proxy on @resolver, to be used for any URIs that don't match #GSimpleProxyResolver:ignore-hosts or a proxy set via g_simple_proxy_resolver_set_uri_proxy().

If @default_proxy starts with "socks://", #GSimpleProxyResolver will treat it as referring to all three of the socks5, socks4a, and socks4 proxy types.

func (*SimpleProxyResolver) SetGoPointer

func (c *SimpleProxyResolver) SetGoPointer(ptr uintptr)

func (*SimpleProxyResolver) SetIgnoreHosts

func (x *SimpleProxyResolver) SetIgnoreHosts(IgnoreHostsVar []string)

Sets the list of ignored hosts.

See #GSimpleProxyResolver:ignore-hosts for more details on how the @ignore_hosts argument is interpreted.

func (*SimpleProxyResolver) SetPropertyDefaultProxy

func (x *SimpleProxyResolver) SetPropertyDefaultProxy(value string)

SetPropertyDefaultProxy sets the "default-proxy" property. The default proxy URI that will be used for any URI that doesn't match #GSimpleProxyResolver:ignore-hosts, and doesn't match any of the schemes set with g_simple_proxy_resolver_set_uri_proxy().

Note that as a special case, if this URI starts with "socks://", #GSimpleProxyResolver will treat it as referring to all three of the socks5, socks4a, and socks4 proxy types.

func (*SimpleProxyResolver) SetPropertyIgnoreHosts

func (x *SimpleProxyResolver) SetPropertyIgnoreHosts(value []string)

SetPropertyIgnoreHosts sets the "ignore-hosts" property. A list of hostnames and IP addresses that the resolver should allow direct connections to.

Entries can be in one of 4 formats:

  • A hostname, such as "example.com", ".example.com", or "*.example.com", any of which match "example.com" or any subdomain of it.

  • An IPv4 or IPv6 address, such as "192.168.1.1", which matches only that address.

  • A hostname or IP address followed by a port, such as "example.com:80", which matches whatever the hostname or IP address would match, but only for URLs with the (explicitly) indicated port. In the case of an IPv6 address, the address part must appear in brackets: "[::1]:443"

  • An IP address range, given by a base address and prefix length, such as "fe80::/10", which matches any address in that range.

Note that when dealing with Unicode hostnames, the matching is done against the ASCII form of the name.

Also note that hostname exclusions apply only to connections made to hosts identified by name, and IP address exclusions apply only to connections made to hosts identified by address. That is, if example.com has an address of 192.168.1.1, and the :ignore-hosts list contains only "192.168.1.1", then a connection to "example.com" (eg, via a #GNetworkAddress) will use the proxy, and a connection to "192.168.1.1" (eg, via a #GInetSocketAddress) will not.

These rules match the "ignore-hosts"/"noproxy" rules most commonly used by other applications.

func (*SimpleProxyResolver) SetUriProxy

func (x *SimpleProxyResolver) SetUriProxy(UriSchemeVar string, ProxyVar string)

Adds a URI-scheme-specific proxy to @resolver; URIs whose scheme matches @uri_scheme (and which don't match #GSimpleProxyResolver:ignore-hosts) will be proxied via @proxy.

As with #GSimpleProxyResolver:default-proxy, if @proxy starts with "socks://", #GSimpleProxyResolver will treat it as referring to all three of the socks5, socks4a, and socks4 proxy types.

type SimpleProxyResolverClass

type SimpleProxyResolverClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*SimpleProxyResolverClass) GetGReserved1

func (x *SimpleProxyResolverClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*SimpleProxyResolverClass) GetGReserved2

func (x *SimpleProxyResolverClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*SimpleProxyResolverClass) GetGReserved3

func (x *SimpleProxyResolverClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*SimpleProxyResolverClass) GetGReserved4

func (x *SimpleProxyResolverClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*SimpleProxyResolverClass) GetGReserved5

func (x *SimpleProxyResolverClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*SimpleProxyResolverClass) GoPointer

func (x *SimpleProxyResolverClass) GoPointer() uintptr

func (*SimpleProxyResolverClass) OverrideGReserved1

func (x *SimpleProxyResolverClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*SimpleProxyResolverClass) OverrideGReserved2

func (x *SimpleProxyResolverClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*SimpleProxyResolverClass) OverrideGReserved3

func (x *SimpleProxyResolverClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*SimpleProxyResolverClass) OverrideGReserved4

func (x *SimpleProxyResolverClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*SimpleProxyResolverClass) OverrideGReserved5

func (x *SimpleProxyResolverClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

type SimpleProxyResolverPrivate

type SimpleProxyResolverPrivate struct {
	// contains filtered or unexported fields
}

func (*SimpleProxyResolverPrivate) GoPointer

func (x *SimpleProxyResolverPrivate) GoPointer() uintptr

type Socket

type Socket struct {
	gobject.Object
}

A `GSocket` is a low-level networking primitive. It is a more or less direct mapping of the BSD socket API in a portable GObject based API. It supports both the UNIX socket implementations and winsock2 on Windows.

`GSocket` is the platform independent base upon which the higher level network primitives are based. Applications are not typically meant to use it directly, but rather through classes like [class@Gio.SocketClient], [class@Gio.SocketService] and [class@Gio.SocketConnection]. However there may be cases where direct use of `GSocket` is useful.

`GSocket` implements the [iface@Gio.Initable] interface, so if it is manually constructed by e.g. [ctor@GObject.Object.new] you must call [method@Gio.Initable.init] and check the results before using the object. This is done automatically in [ctor@Gio.Socket.new] and [ctor@Gio.Socket.new_from_fd], so these functions can return `NULL`.

Sockets operate in two general modes, blocking or non-blocking. When in blocking mode all operations (which don’t take an explicit blocking parameter) block until the requested operation is finished or there is an error. In non-blocking mode all calls that would block return immediately with a `G_IO_ERROR_WOULD_BLOCK` error. To know when a call would successfully run you can call [method@Gio.Socket.condition_check], or [method@Gio.Socket.condition_wait]. You can also use [method@Gio.Socket.create_source] and attach it to a [type@GLib.MainContext] to get callbacks when I/O is possible. Note that all sockets are always set to non blocking mode in the system, and blocking mode is emulated in `GSocket`.

When working in non-blocking mode 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`.

`GSocket`s can be either connection oriented or datagram based. For connection oriented types you must first establish a connection by either connecting to an address or accepting a connection from another address. For connectionless socket types the target/source address is specified or received in each I/O operation.

All socket file descriptors are set to be close-on-exec.

Note that creating a `GSocket` causes the signal `SIGPIPE` to be ignored for the remainder of the program. If you are writing a command-line utility that uses `GSocket`, you may need to take into account the fact that your program will not automatically be killed if it tries to write to `stdout` after it has been closed.

Like most other APIs in GLib, `GSocket` is not inherently thread safe. To use a `GSocket` concurrently from multiple threads, you must implement your own locking.

## Nagle’s algorithm

Since GLib 2.80, `GSocket` will automatically set the `TCP_NODELAY` option on all `G_SOCKET_TYPE_STREAM` sockets. This disables [Nagle’s algorithm](https://en.wikipedia.org/wiki/Nagle%27s_algorithm) as it typically does more harm than good on modern networks.

If your application needs Nagle’s algorithm enabled, call [method@Gio.Socket.set_option] after constructing a `GSocket` to enable it: ```c socket = g_socket_new (…, G_SOCKET_TYPE_STREAM, …); if (socket != NULL)

{
  g_socket_set_option (socket, IPPROTO_TCP, TCP_NODELAY, FALSE, &local_error);
  // handle error if needed
}

```

func NewSocket

func NewSocket(FamilyVar SocketFamily, TypeVar SocketType, ProtocolVar SocketProtocol) (*Socket, error)

Creates a new #GSocket with the defined family, type and protocol. If @protocol is 0 (%G_SOCKET_PROTOCOL_DEFAULT) the default protocol type for the family and type is used.

The @protocol is a family and type specific int that specifies what kind of protocol to use. #GSocketProtocol lists several common ones. Many families only support one protocol, and use 0 for this, others support several and using 0 means to use the default protocol for the family and type.

The protocol id is passed directly to the operating system, so you can use protocols not listed in #GSocketProtocol if you know the protocol number used for it.

func NewSocketFromFd

func NewSocketFromFd(FdVar int) (*Socket, error)

Creates a new #GSocket from a native file descriptor or winsock SOCKET handle.

This reads all the settings from the file descriptor so that all properties should work. Note that the file descriptor will be set to non-blocking mode, independent on the blocking mode of the #GSocket.

On success, the returned #GSocket takes ownership of @fd. On failure, the caller must close @fd themselves.

Since GLib 2.46, it is no longer a fatal error to call this on a non-socket descriptor. Instead, a GError will be set with code %G_IO_ERROR_FAILED

func SocketNewFromInternalPtr

func SocketNewFromInternalPtr(ptr uintptr) *Socket

func (*Socket) Accept

func (x *Socket) Accept(CancellableVar *Cancellable) (*Socket, error)

Accept incoming connections on a connection-based socket. This removes the first outstanding connection request from the listening socket and creates a #GSocket object for it.

The @socket must be bound to a local address with g_socket_bind() and must be listening for incoming connections (g_socket_listen()).

If there are no outstanding connections then the operation will block or return %G_IO_ERROR_WOULD_BLOCK if non-blocking I/O is enabled. To be notified of an incoming connection, wait for the %G_IO_IN condition.

func (*Socket) Bind

func (x *Socket) Bind(AddressVar *SocketAddress, AllowReuseVar bool) (bool, error)

When a socket is created it is attached to an address family, but it doesn't have an address in this family. g_socket_bind() assigns the address (sometimes called name) of the socket.

It is generally required to bind to a local address before you can receive connections. (See g_socket_listen() and g_socket_accept() ). In certain situations, you may also want to bind a socket that will be used to initiate connections, though this is not normally required.

If @socket is a TCP socket, then @allow_reuse controls the setting of the `SO_REUSEADDR` socket option; normally it should be %TRUE for server sockets (sockets that you will eventually call g_socket_accept() on), and %FALSE for client sockets. (Failing to set this flag on a server socket may cause g_socket_bind() to return %G_IO_ERROR_ADDRESS_IN_USE if the server program is stopped and then immediately restarted.)

If @socket is a UDP socket, then @allow_reuse determines whether or not other UDP sockets can be bound to the same address at the same time. In particular, you can have several UDP sockets bound to the same address, and they will all receive all of the multicast and broadcast packets sent to that address. (The behavior of unicast UDP packets to an address with multiple listeners is not defined.)

func (*Socket) CheckConnectResult

func (x *Socket) CheckConnectResult() (bool, error)

Checks and resets the pending connect error for the socket. This is used to check for errors when g_socket_connect() is used in non-blocking mode.

func (*Socket) Close

func (x *Socket) Close() (bool, error)

Closes the socket, shutting down any active connection.

Closing a socket does not wait for all outstanding I/O operations to finish, so the caller should not rely on them to be guaranteed to complete even if the close returns with no error.

Once the socket is closed, all other operations will return %G_IO_ERROR_CLOSED. Closing a socket multiple times will not return an error.

Sockets 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.

Beware that due to the way that TCP works, it is possible for recently-sent data to be lost if either you close a socket while the %G_IO_IN condition is set, or else if the remote connection tries to send something to you after you close the socket but before it has finished reading all of the data you sent. There is no easy generic way to avoid this problem; the easiest fix is to design the network protocol such that the client will never send data "out of turn". Another solution is for the server to half-close the connection by calling g_socket_shutdown() with only the @shutdown_write flag set, and then wait for the client to notice this and close its side of the connection, after which the server can safely call g_socket_close(). (This is what #GTcpConnection does if you call g_tcp_connection_set_graceful_disconnect(). But of course, this only works if the client will close its connection after the server does.)

func (*Socket) ConditionCheck

func (x *Socket) ConditionCheck(ConditionVar glib.IOCondition) glib.IOCondition

Checks on the readiness of @socket to perform operations. The operations specified in @condition are checked for and masked against the currently-satisfied conditions on @socket. The result is returned.

Note that on Windows, it is possible for an operation to return %G_IO_ERROR_WOULD_BLOCK even immediately after g_socket_condition_check() has claimed that the socket is ready for writing. Rather than calling g_socket_condition_check() and then writing to the socket if it succeeds, it is generally better to simply try writing to the socket 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.

This call never blocks.

func (*Socket) ConditionTimedWait

func (x *Socket) ConditionTimedWait(ConditionVar glib.IOCondition, TimeoutUsVar int64, CancellableVar *Cancellable) (bool, error)

Waits for up to @timeout_us microseconds for @condition to become true on @socket. If the condition is met, %TRUE is returned.

If @cancellable is cancelled before the condition is met, or if @timeout_us (or the socket's #GSocket:timeout) is reached before the condition is met, then %FALSE is returned and @error, if non-%NULL, is set to the appropriate value (%G_IO_ERROR_CANCELLED or %G_IO_ERROR_TIMED_OUT).

If you don't want a timeout, use g_socket_condition_wait(). (Alternatively, you can pass -1 for @timeout_us.)

Note that although @timeout_us is in microseconds for consistency with other GLib APIs, this function actually only has millisecond resolution, and the behavior is undefined if @timeout_us is not an exact number of milliseconds.

func (*Socket) ConditionWait

func (x *Socket) ConditionWait(ConditionVar glib.IOCondition, CancellableVar *Cancellable) (bool, error)

Waits for @condition to become true on @socket. When the condition is met, %TRUE is returned.

If @cancellable is cancelled before the condition is met, or if the socket has a timeout set and it is reached before the condition is met, then %FALSE is returned and @error, if non-%NULL, is set to the appropriate value (%G_IO_ERROR_CANCELLED or %G_IO_ERROR_TIMED_OUT).

See also g_socket_condition_timed_wait().

func (*Socket) Connect

func (x *Socket) Connect(AddressVar *SocketAddress, CancellableVar *Cancellable) (bool, error)

Connect the socket to the specified remote address.

For connection oriented socket this generally means we attempt to make a connection to the @address. For a connection-less socket it sets the default address for g_socket_send() and discards all incoming datagrams from other sources.

Generally connection oriented sockets can only connect once, but connection-less sockets can connect multiple times to change the default address.

If the connect call needs to do network I/O it will block, unless non-blocking I/O is enabled. Then %G_IO_ERROR_PENDING is returned and the user can be notified of the connection finishing by waiting for the G_IO_OUT condition. The result of the connection must then be checked with g_socket_check_connect_result().

func (*Socket) ConnectionFactoryCreateConnection

func (x *Socket) ConnectionFactoryCreateConnection() *SocketConnection

Creates a #GSocketConnection subclass of the right type for @socket.

func (*Socket) CreateSource

func (x *Socket) CreateSource(ConditionVar glib.IOCondition, CancellableVar *Cancellable) *glib.Source

Creates a #GSource that can be attached to a %GMainContext to monitor for the availability of the specified @condition on the socket. The #GSource keeps a reference to the @socket.

The callback on the source is of the #GSocketSourceFunc type.

It is meaningless to specify %G_IO_ERR or %G_IO_HUP in @condition; these conditions will always be reported output if they are true.

@cancellable if not %NULL 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().

If @socket has a timeout set, and it is reached before @condition occurs, the source will then trigger anyway, reporting %G_IO_IN or %G_IO_OUT depending on @condition. However, @socket will have been marked as having had a timeout, and so the next #GSocket I/O method you call will then fail with a %G_IO_ERROR_TIMED_OUT.

func (*Socket) GetAvailableBytes

func (x *Socket) GetAvailableBytes() int

Get the amount of data pending in the OS input buffer, without blocking.

If @socket is a UDP or SCTP socket, this will return the size of just the next packet, even if additional packets are buffered after that one.

Note that on Windows, this function is rather inefficient in the UDP case, and so if you know any plausible upper bound on the size of the incoming packet, it is better to just do a g_socket_receive() with a buffer of that size, rather than calling g_socket_get_available_bytes() first and then doing a receive of exactly the right size.

func (*Socket) GetBlocking

func (x *Socket) GetBlocking() bool

Gets the blocking mode of the socket. For details on blocking I/O, see g_socket_set_blocking().

func (*Socket) GetBroadcast

func (x *Socket) GetBroadcast() bool

Gets the broadcast setting on @socket; if %TRUE, it is possible to send packets to broadcast addresses.

func (*Socket) GetCredentials

func (x *Socket) GetCredentials() (*Credentials, error)

Returns the credentials of the foreign process connected to this socket, if any (e.g. it is only supported for %G_SOCKET_FAMILY_UNIX sockets).

If this operation isn't supported on the OS, the method fails with the %G_IO_ERROR_NOT_SUPPORTED error. On Linux this is implemented by reading the %SO_PEERCRED option on the underlying socket.

This method can be expected to be available on the following platforms:

- Linux since GLib 2.26 - OpenBSD since GLib 2.30 - Solaris, Illumos and OpenSolaris since GLib 2.40 - NetBSD since GLib 2.42 - macOS, tvOS, iOS since GLib 2.66

Other ways to obtain credentials from a foreign peer includes the #GUnixCredentialsMessage type and g_unix_connection_send_credentials() / g_unix_connection_receive_credentials() functions.

func (*Socket) GetFamily

func (x *Socket) GetFamily() SocketFamily

Gets the socket family of the socket.

func (*Socket) GetFd

func (x *Socket) GetFd() int

Returns the underlying OS socket object. On unix this is a socket file descriptor, and on Windows this is a Winsock2 SOCKET handle. This may be useful for doing platform specific or otherwise unusual operations on the socket.

func (*Socket) GetKeepalive

func (x *Socket) GetKeepalive() bool

Gets the keepalive mode of the socket. For details on this, see g_socket_set_keepalive().

func (*Socket) GetListenBacklog

func (x *Socket) GetListenBacklog() int

Gets the listen backlog setting of the socket. For details on this, see g_socket_set_listen_backlog().

func (*Socket) GetLocalAddress

func (x *Socket) GetLocalAddress() (*SocketAddress, error)

Try to get the local address of a bound socket. This is only useful if the socket has been bound to a local address, either explicitly or implicitly when connecting.

func (*Socket) GetMulticastLoopback

func (x *Socket) GetMulticastLoopback() bool

Gets the multicast loopback setting on @socket; if %TRUE (the default), outgoing multicast packets will be looped back to multicast listeners on the same host.

func (*Socket) GetMulticastTtl

func (x *Socket) GetMulticastTtl() uint

Gets the multicast time-to-live setting on @socket; see g_socket_set_multicast_ttl() for more details.

func (*Socket) GetOption

func (x *Socket) GetOption(LevelVar int, OptnameVar int, ValueVar *int) (bool, error)

Gets the value of an integer-valued option on @socket, as with getsockopt(). (If you need to fetch a non-integer-valued option, you will need to call getsockopt() directly.)

The [`<gio/gnetworking.h>`](networking.html) header pulls in system headers that will define most of the standard/portable socket options. For unusual socket protocols or platform-dependent options, you may need to include additional headers.

Note that even for socket options that are a single byte in size, @value is still a pointer to a #gint variable, not a #guchar; g_socket_get_option() will handle the conversion internally.

func (*Socket) GetPropertyBlocking

func (x *Socket) GetPropertyBlocking() bool

GetPropertyBlocking gets the "blocking" property. Whether I/O on this socket is blocking.

func (*Socket) GetPropertyBroadcast

func (x *Socket) GetPropertyBroadcast() bool

GetPropertyBroadcast gets the "broadcast" property. Whether the socket should allow sending to broadcast addresses.

func (*Socket) GetPropertyFd

func (x *Socket) GetPropertyFd() int

GetPropertyFd gets the "fd" property. The socket’s file descriptor.

func (*Socket) GetPropertyKeepalive

func (x *Socket) GetPropertyKeepalive() bool

GetPropertyKeepalive gets the "keepalive" property. Whether to keep the connection alive by sending periodic pings.

func (*Socket) GetPropertyListenBacklog

func (x *Socket) GetPropertyListenBacklog() int

GetPropertyListenBacklog gets the "listen-backlog" property. The number of outstanding connections in the listen queue.

func (*Socket) GetPropertyMulticastLoopback

func (x *Socket) GetPropertyMulticastLoopback() bool

GetPropertyMulticastLoopback gets the "multicast-loopback" property. Whether outgoing multicast packets loop back to the local host.

func (*Socket) GetPropertyMulticastTtl

func (x *Socket) GetPropertyMulticastTtl() uint

GetPropertyMulticastTtl gets the "multicast-ttl" property. Time-to-live out outgoing multicast packets

func (*Socket) GetPropertyTimeout

func (x *Socket) GetPropertyTimeout() uint

GetPropertyTimeout gets the "timeout" property. The timeout in seconds on socket I/O

func (*Socket) GetPropertyTtl

func (x *Socket) GetPropertyTtl() uint

GetPropertyTtl gets the "ttl" property. Time-to-live for outgoing unicast packets

func (*Socket) GetProtocol

func (x *Socket) GetProtocol() SocketProtocol

Gets the socket protocol id the socket was created with. In case the protocol is unknown, -1 is returned.

func (*Socket) GetRemoteAddress

func (x *Socket) GetRemoteAddress() (*SocketAddress, error)

Try to get the remote address of a connected socket. This is only useful for connection oriented sockets that have been connected.

func (*Socket) GetSocketType

func (x *Socket) GetSocketType() SocketType

Gets the socket type of the socket.

func (*Socket) GetTimeout

func (x *Socket) GetTimeout() uint

Gets the timeout setting of the socket. For details on this, see g_socket_set_timeout().

func (*Socket) GetTtl

func (x *Socket) GetTtl() uint

Gets the unicast time-to-live setting on @socket; see g_socket_set_ttl() for more details.

func (*Socket) GoPointer

func (c *Socket) GoPointer() uintptr

func (*Socket) Init

func (x *Socket) Init(CancellableVar *Cancellable) (bool, error)

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 [description][iface@Gio.Initable#description] 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.

func (*Socket) IsClosed

func (x *Socket) IsClosed() bool

Checks whether a socket is closed.

func (*Socket) IsConnected

func (x *Socket) IsConnected() bool

Check whether the socket is connected. This is only useful for connection-oriented sockets.

If using g_socket_shutdown(), this function will return %TRUE until the socket has been shut down for reading and writing. If you do a non-blocking connect, this function will not return %TRUE until after you call g_socket_check_connect_result().

func (*Socket) JoinMulticastGroup

func (x *Socket) JoinMulticastGroup(GroupVar *InetAddress, SourceSpecificVar bool, IfaceVar *string) (bool, error)

Registers @socket to receive multicast messages sent to @group. @socket must be a %G_SOCKET_TYPE_DATAGRAM socket, and must have been bound to an appropriate interface and port with g_socket_bind().

If @iface is %NULL, the system will automatically pick an interface to bind to based on @group.

If @source_specific is %TRUE, source-specific multicast as defined in RFC 4604 is used. Note that on older platforms this may fail with a %G_IO_ERROR_NOT_SUPPORTED error.

To bind to a given source-specific multicast address, use g_socket_join_multicast_group_ssm() instead.

func (*Socket) JoinMulticastGroupSsm

func (x *Socket) JoinMulticastGroupSsm(GroupVar *InetAddress, SourceSpecificVar *InetAddress, IfaceVar *string) (bool, error)

Registers @socket to receive multicast messages sent to @group. @socket must be a %G_SOCKET_TYPE_DATAGRAM socket, and must have been bound to an appropriate interface and port with g_socket_bind().

If @iface is %NULL, the system will automatically pick an interface to bind to based on @group.

If @source_specific is not %NULL, use source-specific multicast as defined in RFC 4604. Note that on older platforms this may fail with a %G_IO_ERROR_NOT_SUPPORTED error.

Note that this function can be called multiple times for the same @group with different @source_specific in order to receive multicast packets from more than one source.

func (*Socket) LeaveMulticastGroup

func (x *Socket) LeaveMulticastGroup(GroupVar *InetAddress, SourceSpecificVar bool, IfaceVar *string) (bool, error)

Removes @socket from the multicast group defined by @group, @iface, and @source_specific (which must all have the same values they had when you joined the group).

@socket remains bound to its address and port, and can still receive unicast messages after calling this.

To unbind to a given source-specific multicast address, use g_socket_leave_multicast_group_ssm() instead.

func (*Socket) LeaveMulticastGroupSsm

func (x *Socket) LeaveMulticastGroupSsm(GroupVar *InetAddress, SourceSpecificVar *InetAddress, IfaceVar *string) (bool, error)

Removes @socket from the multicast group defined by @group, @iface, and @source_specific (which must all have the same values they had when you joined the group).

@socket remains bound to its address and port, and can still receive unicast messages after calling this.

func (*Socket) Listen

func (x *Socket) Listen() (bool, error)

Marks the socket as a server socket, i.e. a socket that is used to accept incoming requests using g_socket_accept().

Before calling this the socket must be bound to a local address using g_socket_bind().

To set the maximum amount of outstanding clients, use g_socket_set_listen_backlog().

func (*Socket) Receive

func (x *Socket) Receive(BufferVar *[]byte, SizeVar uint, CancellableVar *Cancellable) (int, error)

Receive data (up to @size bytes) from a socket. This is mainly used by connection-oriented sockets; it is identical to g_socket_receive_from() with @address set to %NULL.

For %G_SOCKET_TYPE_DATAGRAM and %G_SOCKET_TYPE_SEQPACKET sockets, g_socket_receive() will always read either 0 or 1 complete messages from the socket. If the received message is too large to fit in @buffer, then the data beyond @size bytes will be discarded, without any explicit indication that this has occurred.

For %G_SOCKET_TYPE_STREAM sockets, g_socket_receive() can return any number of bytes, up to @size. If more than @size bytes have been received, the additional data will be returned in future calls to g_socket_receive().

If the socket is in blocking mode the call will block until there is some data to receive, the connection is closed, or there is an error. If there is no data available and the socket is in non-blocking mode, a %G_IO_ERROR_WOULD_BLOCK error will be returned. To be notified when data is available, wait for the %G_IO_IN condition.

On error -1 is returned and @error is set accordingly.

func (*Socket) ReceiveBytes

func (x *Socket) ReceiveBytes(SizeVar uint, TimeoutUsVar int64, CancellableVar *Cancellable) (*glib.Bytes, error)

Receives data (up to @size bytes) from a socket.

This function is a variant of [method@Gio.Socket.receive] which returns a [struct@GLib.Bytes] rather than a plain buffer.

Pass `-1` to @timeout_us to block indefinitely until data is received (or the connection is closed, or there is an error). Pass `0` to use the default timeout from [property@Gio.Socket:timeout], or pass a positive number to wait for that many microseconds for data before returning `G_IO_ERROR_TIMED_OUT`.

func (*Socket) ReceiveBytesFrom

func (x *Socket) ReceiveBytesFrom(AddressVar **SocketAddress, SizeVar uint, TimeoutUsVar int64, CancellableVar *Cancellable) (*glib.Bytes, error)

Receive data (up to @size bytes) from a socket.

This function is a variant of [method@Gio.Socket.receive_from] which returns a [struct@GLib.Bytes] rather than a plain buffer.

If @address is non-%NULL then @address will be set equal to the source address of the received packet.

The @address is owned by the caller.

Pass `-1` to @timeout_us to block indefinitely until data is received (or the connection is closed, or there is an error). Pass `0` to use the default timeout from [property@Gio.Socket:timeout], or pass a positive number to wait for that many microseconds for data before returning `G_IO_ERROR_TIMED_OUT`.

func (*Socket) ReceiveFrom

func (x *Socket) ReceiveFrom(AddressVar **SocketAddress, BufferVar *[]byte, SizeVar uint, CancellableVar *Cancellable) (int, error)

Receive data (up to @size bytes) from a socket.

If @address is non-%NULL then @address will be set equal to the source address of the received packet. @address is owned by the caller.

See g_socket_receive() for additional information.

func (*Socket) ReceiveMessage

func (x *Socket) ReceiveMessage(AddressVar **SocketAddress, VectorsVar []InputVector, NumVectorsVar int, MessagesVar *uintptr, NumMessagesVar *int, FlagsVar *int, CancellableVar *Cancellable) (int, error)

Receive data from a socket. For receiving multiple messages, see g_socket_receive_messages(); for easier use, see g_socket_receive() and g_socket_receive_from().

If @address is non-%NULL then @address will be set equal to the source address of the received packet. @address is owned by the caller.

@vector must point to an array of #GInputVector structs and @num_vectors must be the length of this array. These structs describe the buffers that received data will be scattered into. If @num_vectors is -1, then @vectors is assumed to be terminated by a #GInputVector with a %NULL buffer pointer.

As a special case, if @num_vectors is 0 (in which case, @vectors may of course be %NULL), then a single byte is received and discarded. This is to facilitate the common practice of sending a single '\0' byte for the purposes of transferring ancillary data.

@messages, if non-%NULL, will be set to point to a newly-allocated array of #GSocketControlMessage instances or %NULL if no such messages was received. These correspond to the control messages received from the kernel, one #GSocketControlMessage per message from the kernel. This array is %NULL-terminated and must be freed by the caller using g_free() after calling g_object_unref() on each element. If @messages is %NULL, any control messages received will be discarded.

@num_messages, if non-%NULL, will be set to the number of control messages received.

If both @messages and @num_messages are non-%NULL, then @num_messages gives the number of #GSocketControlMessage instances in @messages (ie: not including the %NULL terminator).

@flags is an in/out parameter. 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 (and g_socket_receive_message() may pass system-specific flags out). Flags passed in to the parameter affect the receive operation; flags returned out of it are relevant to the specific returned message.

As with g_socket_receive(), data may be discarded if @socket is %G_SOCKET_TYPE_DATAGRAM or %G_SOCKET_TYPE_SEQPACKET and you do not provide enough buffer space to read a complete message. You can pass %G_SOCKET_MSG_PEEK in @flags to peek at the current message without removing it from the receive queue, but there is no portable way to find out the length of the message other than by reading it into a sufficiently-large buffer.

If the socket is in blocking mode the call will block until there is some data to receive, the connection is closed, or there is an error. If there is no data available and the socket is in non-blocking mode, a %G_IO_ERROR_WOULD_BLOCK error will be returned. To be notified when data is available, wait for the %G_IO_IN condition.

On error -1 is returned and @error is set accordingly.

func (*Socket) ReceiveMessages

func (x *Socket) ReceiveMessages(MessagesVar []InputMessage, NumMessagesVar uint, FlagsVar int, CancellableVar *Cancellable) (int, error)

Receive multiple data messages from @socket in one go. This is the most complicated and fully-featured version of this call. For easier use, see g_socket_receive(), g_socket_receive_from(), and g_socket_receive_message().

@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. Using multiple #GInputVectors is more memory-efficient than manually copying data out of a single buffer to multiple sources, and more system-call-efficient than making multiple calls to g_socket_receive(), such as in scenarios where a lot of data packets need to be received (e.g. high-bandwidth video streaming over RTP/UDP).

@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 #GSocket:blocking is %TRUE the call will block until @num_messages have been received, or the end of the stream is reached.

If #GSocket:blocking is %FALSE 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.

In blocking mode, if #GSocket:timeout is positive and is reached before any messages are received, %G_IO_ERROR_TIMED_OUT is returned, otherwise up to @num_messages are returned. (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_socket_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 operating system will be returned, and subsequent calls to g_socket_receive_messages() will return 0 (with no error set).

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.

func (*Socket) ReceiveWithBlocking

func (x *Socket) ReceiveWithBlocking(BufferVar *[]byte, SizeVar uint, BlockingVar bool, CancellableVar *Cancellable) (int, error)

This behaves exactly the same as g_socket_receive(), except that the choice of blocking or non-blocking behavior is determined by the @blocking argument rather than by @socket's properties.

func (*Socket) Send

func (x *Socket) Send(BufferVar []byte, SizeVar uint, CancellableVar *Cancellable) (int, error)

Tries to send @size bytes from @buffer on the socket. This is mainly used by connection-oriented sockets; it is identical to g_socket_send_to() with @address set to %NULL.

If the socket is in blocking mode the call will block until there is space for the data in the socket queue. If there is no space available and the socket is in non-blocking mode a %G_IO_ERROR_WOULD_BLOCK error will be returned. To be notified when space is available, wait for the %G_IO_OUT condition. Note though that you may still receive %G_IO_ERROR_WOULD_BLOCK from g_socket_send() 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.)

On error -1 is returned and @error is set accordingly.

func (*Socket) SendMessage

func (x *Socket) SendMessage(AddressVar *SocketAddress, VectorsVar []OutputVector, NumVectorsVar int, MessagesVar uintptr, NumMessagesVar int, FlagsVar int, CancellableVar *Cancellable) (int, error)

Send data to @address on @socket. For sending multiple messages see g_socket_send_messages(); for easier use, see g_socket_send() and g_socket_send_to().

If @address is %NULL then the message is sent to the default receiver (set by g_socket_connect()).

@vectors must point to an array of #GOutputVector structs and @num_vectors must be the length of this array. (If @num_vectors is -1, then @vectors is assumed to be terminated by a #GOutputVector with a %NULL buffer pointer.) The #GOutputVector structs describe the buffers that the sent data will be gathered from. Using multiple #GOutputVectors is more memory-efficient than manually copying data from multiple sources into a single buffer, and more network-efficient than making multiple calls to g_socket_send().

@messages, if non-%NULL, is taken to point to an array of @num_messages #GSocketControlMessage instances. These correspond to the control messages to be sent on the socket. If @num_messages is -1 then @messages is treated as a %NULL-terminated array.

@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.

If the socket is in blocking mode the call will block until there is space for the data in the socket queue. If there is no space available and the socket is in non-blocking mode a %G_IO_ERROR_WOULD_BLOCK error will be returned. To be notified when space is available, wait for the %G_IO_OUT condition. Note though that you may still receive %G_IO_ERROR_WOULD_BLOCK from g_socket_send() 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.)

The sum of the sizes of each #GOutputVector in vectors must not be greater than %G_MAXSSIZE. If the message can be larger than this, then it is mandatory to use the g_socket_send_message_with_timeout() function.

On error -1 is returned and @error is set accordingly.

func (*Socket) SendMessageWithTimeout

func (x *Socket) SendMessageWithTimeout(AddressVar *SocketAddress, VectorsVar []OutputVector, NumVectorsVar int, MessagesVar uintptr, NumMessagesVar int, FlagsVar int, TimeoutUsVar int64, BytesWrittenVar *uint, CancellableVar *Cancellable) (PollableReturn, error)

This behaves exactly the same as g_socket_send_message(), except that the choice of timeout behavior is determined by the @timeout_us argument rather than by @socket's properties.

On error %G_POLLABLE_RETURN_FAILED is returned and @error is set accordingly, or if the socket is currently not writable %G_POLLABLE_RETURN_WOULD_BLOCK is returned. @bytes_written will contain 0 in both cases.

func (*Socket) SendMessages

func (x *Socket) SendMessages(MessagesVar []OutputMessage, NumMessagesVar uint, FlagsVar int, CancellableVar *Cancellable) (int, error)

Send multiple data messages from @socket in one go. This is the most complicated and fully-featured version of this call. For easier use, see g_socket_send(), g_socket_send_to(), and g_socket_send_message().

@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. Using multiple #GOutputVectors is more memory-efficient than manually copying data from multiple sources into a single buffer, and more network-efficient than making multiple calls to g_socket_send(). Sending multiple messages in one go avoids the overhead of making a lot of syscalls in scenarios where a lot of data packets need to be sent (e.g. high-bandwidth video streaming over RTP/UDP), or where the same data needs to be sent to multiple recipients.

@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.

If the socket is in blocking mode the call will block until there is space for all the data in the socket queue. If there is no space available and the socket is in non-blocking mode a %G_IO_ERROR_WOULD_BLOCK error will be returned if no data was written at all, otherwise the number of messages sent will be returned. To be notified when space is available, wait for the %G_IO_OUT condition. Note though that you may still receive %G_IO_ERROR_WOULD_BLOCK from g_socket_send() 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.)

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.

func (*Socket) SendTo

func (x *Socket) SendTo(AddressVar *SocketAddress, BufferVar []byte, SizeVar uint, CancellableVar *Cancellable) (int, error)

Tries to send @size bytes from @buffer to @address. If @address is %NULL then the message is sent to the default receiver (set by g_socket_connect()).

See g_socket_send() for additional information.

func (*Socket) SendWithBlocking

func (x *Socket) SendWithBlocking(BufferVar []byte, SizeVar uint, BlockingVar bool, CancellableVar *Cancellable) (int, error)

This behaves exactly the same as g_socket_send(), except that the choice of blocking or non-blocking behavior is determined by the @blocking argument rather than by @socket's properties.

func (*Socket) SetBlocking

func (x *Socket) SetBlocking(BlockingVar bool)

Sets the blocking mode of the socket. In blocking mode all operations (which don’t take an explicit blocking parameter) block until they succeed or there is an error. In non-blocking mode all functions return results immediately or with a %G_IO_ERROR_WOULD_BLOCK error.

All sockets are created in blocking mode. However, note that the platform level socket is always non-blocking, and blocking mode is a GSocket level feature.

func (*Socket) SetBroadcast

func (x *Socket) SetBroadcast(BroadcastVar bool)

Sets whether @socket should allow sending to broadcast addresses. This is %FALSE by default.

func (*Socket) SetGoPointer

func (c *Socket) SetGoPointer(ptr uintptr)

func (*Socket) SetKeepalive

func (x *Socket) SetKeepalive(KeepaliveVar bool)

Sets or unsets the %SO_KEEPALIVE flag on the underlying socket. When this flag is set on a socket, the system will attempt to verify that the remote socket endpoint is still present if a sufficiently long period of time passes with no data being exchanged. If the system is unable to verify the presence of the remote endpoint, it will automatically close the connection.

This option is only functional on certain kinds of sockets. (Notably, %G_SOCKET_PROTOCOL_TCP sockets.)

The exact time between pings is system- and protocol-dependent, but will normally be at least two hours. Most commonly, you would set this flag on a server socket if you want to allow clients to remain idle for long periods of time, but also want to ensure that connections are eventually garbage-collected if clients crash or become unreachable.

func (*Socket) SetListenBacklog

func (x *Socket) SetListenBacklog(BacklogVar int)

Sets the maximum number of outstanding connections allowed when listening on this socket. If more clients than this are connecting to the socket and the application is not handling them on time then the new connections will be refused.

Note that this must be called before g_socket_listen() and has no effect if called after that.

func (*Socket) SetMulticastLoopback

func (x *Socket) SetMulticastLoopback(LoopbackVar bool)

Sets whether outgoing multicast packets will be received by sockets listening on that multicast address on the same host. This is %TRUE by default.

func (*Socket) SetMulticastTtl

func (x *Socket) SetMulticastTtl(TtlVar uint)

Sets the time-to-live for outgoing multicast datagrams on @socket. By default, this is 1, meaning that multicast packets will not leave the local network.

func (*Socket) SetOption

func (x *Socket) SetOption(LevelVar int, OptnameVar int, ValueVar int) (bool, error)

Sets the value of an integer-valued option on @socket, as with setsockopt(). (If you need to set a non-integer-valued option, you will need to call setsockopt() directly.)

The [`<gio/gnetworking.h>`](networking.html) header pulls in system headers that will define most of the standard/portable socket options. For unusual socket protocols or platform-dependent options, you may need to include additional headers.

func (*Socket) SetPropertyBlocking

func (x *Socket) SetPropertyBlocking(value bool)

SetPropertyBlocking sets the "blocking" property. Whether I/O on this socket is blocking.

func (*Socket) SetPropertyBroadcast

func (x *Socket) SetPropertyBroadcast(value bool)

SetPropertyBroadcast sets the "broadcast" property. Whether the socket should allow sending to broadcast addresses.

func (*Socket) SetPropertyFd

func (x *Socket) SetPropertyFd(value int)

SetPropertyFd sets the "fd" property. The socket’s file descriptor.

func (*Socket) SetPropertyKeepalive

func (x *Socket) SetPropertyKeepalive(value bool)

SetPropertyKeepalive sets the "keepalive" property. Whether to keep the connection alive by sending periodic pings.

func (*Socket) SetPropertyListenBacklog

func (x *Socket) SetPropertyListenBacklog(value int)

SetPropertyListenBacklog sets the "listen-backlog" property. The number of outstanding connections in the listen queue.

func (*Socket) SetPropertyMulticastLoopback

func (x *Socket) SetPropertyMulticastLoopback(value bool)

SetPropertyMulticastLoopback sets the "multicast-loopback" property. Whether outgoing multicast packets loop back to the local host.

func (*Socket) SetPropertyMulticastTtl

func (x *Socket) SetPropertyMulticastTtl(value uint)

SetPropertyMulticastTtl sets the "multicast-ttl" property. Time-to-live out outgoing multicast packets

func (*Socket) SetPropertyTimeout

func (x *Socket) SetPropertyTimeout(value uint)

SetPropertyTimeout sets the "timeout" property. The timeout in seconds on socket I/O

func (*Socket) SetPropertyTtl

func (x *Socket) SetPropertyTtl(value uint)

SetPropertyTtl sets the "ttl" property. Time-to-live for outgoing unicast packets

func (*Socket) SetTimeout

func (x *Socket) SetTimeout(TimeoutVar uint)

Sets the time in seconds after which I/O operations on @socket will time out if they have not yet completed.

On a blocking socket, this means that any blocking #GSocket operation will time out after @timeout seconds of inactivity, returning %G_IO_ERROR_TIMED_OUT.

On a non-blocking socket, calls to g_socket_condition_wait() will also fail with %G_IO_ERROR_TIMED_OUT after the given time. Sources created with g_socket_create_source() will trigger after @timeout seconds of inactivity, with the requested condition set, at which point calling g_socket_receive(), g_socket_send(), g_socket_check_connect_result(), etc, will fail with %G_IO_ERROR_TIMED_OUT.

If @timeout is 0 (the default), operations will never time out on their own.

Note that if an I/O operation is interrupted by a signal, this may cause the timeout to be reset.

func (*Socket) SetTtl

func (x *Socket) SetTtl(TtlVar uint)

Sets the time-to-live for outgoing unicast packets on @socket. By default the platform-specific default value is used.

func (*Socket) Shutdown

func (x *Socket) Shutdown(ShutdownReadVar bool, ShutdownWriteVar bool) (bool, error)

Shut down part or all of a full-duplex connection.

If @shutdown_read is %TRUE then the receiving side of the connection is shut down, and further reading is disallowed.

If @shutdown_write is %TRUE then the sending side of the connection is shut down, and further writing is disallowed.

It is allowed for both @shutdown_read and @shutdown_write to be %TRUE.

One example where it is useful to shut down only one side of a connection is graceful disconnect for TCP connections where you close the sending side, then wait for the other side to close the connection, thus ensuring that the other side saw all sent data.

func (*Socket) SpeaksIpv4

func (x *Socket) SpeaksIpv4() bool

Checks if a socket is capable of speaking IPv4.

IPv4 sockets are capable of speaking IPv4. On some operating systems and under some combinations of circumstances IPv6 sockets are also capable of speaking IPv4. See RFC 3493 section 3.7 for more information.

No other types of sockets are currently considered as being capable of speaking IPv4.

type SocketAddress

type SocketAddress struct {
	gobject.Object
}

`GSocketAddress` is the equivalent of [`struct sockaddr`](man:sockaddr(3type)) and its subtypes in the BSD sockets API. This is an abstract class; use [class@Gio.InetSocketAddress] for internet sockets, or [class@Gio.UnixSocketAddress] for UNIX domain sockets.

func NewSocketAddressFromNative

func NewSocketAddressFromNative(NativeVar uintptr, LenVar uint) *SocketAddress

Creates a #GSocketAddress subclass corresponding to the native struct sockaddr @native.

func SocketAddressNewFromInternalPtr

func SocketAddressNewFromInternalPtr(ptr uintptr) *SocketAddress

func (*SocketAddress) Enumerate

func (x *SocketAddress) Enumerate() *SocketAddressEnumerator

Creates a #GSocketAddressEnumerator for @connectable.

func (*SocketAddress) GetFamily

func (x *SocketAddress) GetFamily() SocketFamily

Gets the socket family type of @address.

func (*SocketAddress) GetNativeSize

func (x *SocketAddress) GetNativeSize() int

Gets the size of @address's native struct sockaddr. You can use this to allocate memory to pass to g_socket_address_to_native().

func (*SocketAddress) GoPointer

func (c *SocketAddress) GoPointer() uintptr

func (*SocketAddress) ProxyEnumerate

func (x *SocketAddress) ProxyEnumerate() *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().

func (*SocketAddress) SetGoPointer

func (c *SocketAddress) SetGoPointer(ptr uintptr)

func (*SocketAddress) ToNative

func (x *SocketAddress) ToNative(DestVar uintptr, DestlenVar uint) (bool, error)

Converts a #GSocketAddress to a native struct sockaddr, which can be passed to low-level functions like connect() or bind().

If not enough space is available, a %G_IO_ERROR_NO_SPACE error is returned. If the address type is not known on the system then a %G_IO_ERROR_NOT_SUPPORTED error is returned.

func (*SocketAddress) ToString

func (x *SocketAddress) ToString() string

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.

type SocketAddressClass

type SocketAddressClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*SocketAddressClass) GetGetFamily

func (x *SocketAddressClass) GetGetFamily() func(*SocketAddress) SocketFamily

GetGetFamily gets the "get_family" callback function.

func (*SocketAddressClass) GetGetNativeSize

func (x *SocketAddressClass) GetGetNativeSize() func(*SocketAddress) int

GetGetNativeSize gets the "get_native_size" callback function.

func (*SocketAddressClass) GetToNative

func (x *SocketAddressClass) GetToNative() func(*SocketAddress, uintptr, uint) bool

GetToNative gets the "to_native" callback function.

func (*SocketAddressClass) GoPointer

func (x *SocketAddressClass) GoPointer() uintptr

func (*SocketAddressClass) OverrideGetFamily

func (x *SocketAddressClass) OverrideGetFamily(cb func(*SocketAddress) SocketFamily)

OverrideGetFamily sets the "get_family" callback function.

func (*SocketAddressClass) OverrideGetNativeSize

func (x *SocketAddressClass) OverrideGetNativeSize(cb func(*SocketAddress) int)

OverrideGetNativeSize sets the "get_native_size" callback function.

func (*SocketAddressClass) OverrideToNative

func (x *SocketAddressClass) OverrideToNative(cb func(*SocketAddress, uintptr, uint) bool)

OverrideToNative sets the "to_native" callback function.

type SocketAddressEnumerator

type SocketAddressEnumerator struct {
	gobject.Object
}

`GSocketAddressEnumerator` is an enumerator type for [class@Gio.SocketAddress] instances. It is returned by enumeration functions such as [method@Gio.SocketConnectable.enumerate], which returns a `GSocketAddressEnumerator` to list each [class@Gio.SocketAddress] which could be used to connect to that [iface@Gio.SocketConnectable].

Enumeration is typically a blocking operation, so the asynchronous methods [method@Gio.SocketAddressEnumerator.next_async] and [method@Gio.SocketAddressEnumerator.next_finish] should be used where possible.

Each `GSocketAddressEnumerator` can only be enumerated once. Once [method@Gio.SocketAddressEnumerator.next] has returned `NULL`, further enumeration with that `GSocketAddressEnumerator` is not possible, and it can be unreffed.

func SocketAddressEnumeratorNewFromInternalPtr

func SocketAddressEnumeratorNewFromInternalPtr(ptr uintptr) *SocketAddressEnumerator

func (*SocketAddressEnumerator) GoPointer

func (c *SocketAddressEnumerator) GoPointer() uintptr

func (*SocketAddressEnumerator) Next

func (x *SocketAddressEnumerator) Next(CancellableVar *Cancellable) (*SocketAddress, error)

Retrieves the next #GSocketAddress from @enumerator. Note that this may block for some amount of time. (Eg, a #GNetworkAddress may need to do a DNS lookup before it can return an address.) Use g_socket_address_enumerator_next_async() if you need to avoid blocking.

If @enumerator is expected to yield addresses, but for some reason is unable to (eg, because of a DNS error), then the first call to g_socket_address_enumerator_next() will return an appropriate error in `*error`. However, if the first call to g_socket_address_enumerator_next() succeeds, then any further internal errors (other than @cancellable being triggered) will be ignored.

func (*SocketAddressEnumerator) NextAsync

func (x *SocketAddressEnumerator) NextAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously retrieves the next #GSocketAddress from @enumerator and then calls @callback, which must call g_socket_address_enumerator_next_finish() to get the result.

It is an error to call this multiple times before the previous callback has finished.

func (*SocketAddressEnumerator) NextFinish

func (x *SocketAddressEnumerator) NextFinish(ResultVar AsyncResult) (*SocketAddress, error)

Retrieves the result of a completed call to g_socket_address_enumerator_next_async(). See g_socket_address_enumerator_next() for more information about error handling.

func (*SocketAddressEnumerator) SetGoPointer

func (c *SocketAddressEnumerator) SetGoPointer(ptr uintptr)

type SocketAddressEnumeratorClass

type SocketAddressEnumeratorClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

Class structure for #GSocketAddressEnumerator.

func (*SocketAddressEnumeratorClass) GetNext

GetNext gets the "next" callback function. Virtual method for g_socket_address_enumerator_next().

func (*SocketAddressEnumeratorClass) GetNextAsync

GetNextAsync gets the "next_async" callback function. Virtual method for g_socket_address_enumerator_next_async().

func (*SocketAddressEnumeratorClass) GetNextFinish

GetNextFinish gets the "next_finish" callback function. Virtual method for g_socket_address_enumerator_next_finish().

func (*SocketAddressEnumeratorClass) GoPointer

func (x *SocketAddressEnumeratorClass) GoPointer() uintptr

func (*SocketAddressEnumeratorClass) OverrideNext

OverrideNext sets the "next" callback function. Virtual method for g_socket_address_enumerator_next().

func (*SocketAddressEnumeratorClass) OverrideNextAsync

OverrideNextAsync sets the "next_async" callback function. Virtual method for g_socket_address_enumerator_next_async().

func (*SocketAddressEnumeratorClass) OverrideNextFinish

OverrideNextFinish sets the "next_finish" callback function. Virtual method for g_socket_address_enumerator_next_finish().

type SocketClass

type SocketClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*SocketClass) GetGReserved1

func (x *SocketClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*SocketClass) GetGReserved2

func (x *SocketClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*SocketClass) GetGReserved3

func (x *SocketClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*SocketClass) GetGReserved4

func (x *SocketClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*SocketClass) GetGReserved5

func (x *SocketClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*SocketClass) GetGReserved6

func (x *SocketClass) GetGReserved6() func()

GetGReserved6 gets the "_g_reserved6" callback function.

func (*SocketClass) GetGReserved7

func (x *SocketClass) GetGReserved7() func()

GetGReserved7 gets the "_g_reserved7" callback function.

func (*SocketClass) GetGReserved8

func (x *SocketClass) GetGReserved8() func()

GetGReserved8 gets the "_g_reserved8" callback function.

func (*SocketClass) GetGReserved9

func (x *SocketClass) GetGReserved9() func()

GetGReserved9 gets the "_g_reserved9" callback function.

func (*SocketClass) GetGReserved10

func (x *SocketClass) GetGReserved10() func()

GetGReserved10 gets the "_g_reserved10" callback function.

func (*SocketClass) GoPointer

func (x *SocketClass) GoPointer() uintptr

func (*SocketClass) OverrideGReserved1

func (x *SocketClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*SocketClass) OverrideGReserved2

func (x *SocketClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*SocketClass) OverrideGReserved3

func (x *SocketClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*SocketClass) OverrideGReserved4

func (x *SocketClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*SocketClass) OverrideGReserved5

func (x *SocketClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

func (*SocketClass) OverrideGReserved6

func (x *SocketClass) OverrideGReserved6(cb func())

OverrideGReserved6 sets the "_g_reserved6" callback function.

func (*SocketClass) OverrideGReserved7

func (x *SocketClass) OverrideGReserved7(cb func())

OverrideGReserved7 sets the "_g_reserved7" callback function.

func (*SocketClass) OverrideGReserved8

func (x *SocketClass) OverrideGReserved8(cb func())

OverrideGReserved8 sets the "_g_reserved8" callback function.

func (*SocketClass) OverrideGReserved9

func (x *SocketClass) OverrideGReserved9(cb func())

OverrideGReserved9 sets the "_g_reserved9" callback function.

func (*SocketClass) OverrideGReserved10

func (x *SocketClass) OverrideGReserved10(cb func())

OverrideGReserved10 sets the "_g_reserved10" callback function.

type SocketClient

type SocketClient struct {
	gobject.Object
}

`GSocketClient` is a lightweight high-level utility class for connecting to a network host using a connection oriented socket type.

You create a `GSocketClient` object, set any options you want, and then call a sync or async connect operation, which returns a [class@Gio.SocketConnection] subclass on success.

The type of the [class@Gio.SocketConnection] object returned depends on the type of the underlying socket that is in use. For instance, for a TCP/IP connection it will be a [class@Gio.TcpConnection].

As `GSocketClient` is a lightweight object, you don't need to cache it. You can just create a new one any time you need one.

func NewSocketClient

func NewSocketClient() *SocketClient

Creates a new #GSocketClient with the default options.

func SocketClientNewFromInternalPtr

func SocketClientNewFromInternalPtr(ptr uintptr) *SocketClient

func (*SocketClient) AddApplicationProxy

func (x *SocketClient) AddApplicationProxy(ProtocolVar string)

Enable proxy protocols to be handled by the application. When the indicated proxy protocol is returned by the #GProxyResolver, #GSocketClient will consider this protocol as supported but will not try to find a #GProxy instance to handle handshaking. The application must check for this case by calling g_socket_connection_get_remote_address() on the returned #GSocketConnection, and seeing if it's a #GProxyAddress of the appropriate type, to determine whether or not it needs to handle the proxy handshaking itself.

This should be used for proxy protocols that are dialects of another protocol such as HTTP proxy. It also allows cohabitation of proxy protocols that are reused between protocols. A good example is HTTP. It can be used to proxy HTTP, FTP and Gopher and can also be use as generic socket proxy through the HTTP CONNECT method.

When the proxy is detected as being an application proxy, TLS handshake will be skipped. This is required to let the application do the proxy specific handshake.

func (*SocketClient) Connect

func (x *SocketClient) Connect(ConnectableVar SocketConnectable, CancellableVar *Cancellable) (*SocketConnection, error)

Tries to resolve the @connectable and make a network connection to it.

Upon a successful connection, a new #GSocketConnection is constructed and returned. The caller owns this new object and must drop their reference to it when finished with it.

The type of the #GSocketConnection object returned depends on the type of the underlying socket that is used. For instance, for a TCP/IP connection it will be a #GTcpConnection.

The socket created will be the same family as the address that the @connectable resolves to, unless family is set with g_socket_client_set_family() or indirectly via g_socket_client_set_local_address(). The socket type defaults to %G_SOCKET_TYPE_STREAM but can be set with g_socket_client_set_socket_type().

If a local address is specified with g_socket_client_set_local_address() the socket will be bound to this address before connecting.

func (*SocketClient) ConnectAsync

func (x *SocketClient) ConnectAsync(ConnectableVar SocketConnectable, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

This is the asynchronous version of g_socket_client_connect().

You may wish to prefer the asynchronous version even in synchronous command line programs because, since 2.60, it implements [RFC 8305](https://tools.ietf.org/html/rfc8305) "Happy Eyeballs" recommendations to work around long connection timeouts in networks where IPv6 is broken by performing an IPv4 connection simultaneously without waiting for IPv6 to time out, which is not supported by the synchronous call. (This is not an API guarantee, and may change in the future.)

When the operation is finished @callback will be called. You can then call g_socket_client_connect_finish() to get the result of the operation.

func (*SocketClient) ConnectEvent

func (x *SocketClient) ConnectEvent(cb *func(SocketClient, SocketClientEvent, uintptr, uintptr)) uint

Emitted when @client's activity on @connectable changes state. Among other things, this can be used to provide progress information about a network connection in the UI. The meanings of the different @event values are as follows:

  • %G_SOCKET_CLIENT_RESOLVING: @client is about to look up @connectable in DNS. @connection will be %NULL.

  • %G_SOCKET_CLIENT_RESOLVED: @client has successfully resolved @connectable in DNS. @connection will be %NULL.

  • %G_SOCKET_CLIENT_CONNECTING: @client is about to make a connection to a remote host; either a proxy server or the destination server itself. @connection is the #GSocketConnection, which is not yet connected. Since GLib 2.40, you can access the remote address via g_socket_connection_get_remote_address().

  • %G_SOCKET_CLIENT_CONNECTED: @client has successfully connected to a remote host. @connection is the connected #GSocketConnection.

  • %G_SOCKET_CLIENT_PROXY_NEGOTIATING: @client is about to negotiate with a proxy to get it to connect to @connectable. @connection is the #GSocketConnection to the proxy server.

  • %G_SOCKET_CLIENT_PROXY_NEGOTIATED: @client has negotiated a connection to @connectable through a proxy server. @connection is the stream returned from g_proxy_connect(), which may or may not be a #GSocketConnection.

  • %G_SOCKET_CLIENT_TLS_HANDSHAKING: @client is about to begin a TLS handshake. @connection is a #GTlsClientConnection.

  • %G_SOCKET_CLIENT_TLS_HANDSHAKED: @client has successfully completed the TLS handshake. @connection is a #GTlsClientConnection.

  • %G_SOCKET_CLIENT_COMPLETE: @client has either successfully connected to @connectable (in which case @connection is the #GSocketConnection that it will be returning to the caller) or has failed (in which case @connection is %NULL and the client is about to return an error).

Each event except %G_SOCKET_CLIENT_COMPLETE may be emitted multiple times (or not at all) for a given connectable (in particular, if @client ends up attempting to connect to more than one address). However, if @client emits the #GSocketClient::event signal at all for a given connectable, then it will always emit it with %G_SOCKET_CLIENT_COMPLETE when it is done.

Note that there may be additional #GSocketClientEvent values in the future; unrecognized @event values should be ignored.

func (*SocketClient) ConnectFinish

func (x *SocketClient) ConnectFinish(ResultVar AsyncResult) (*SocketConnection, error)

Finishes an async connect operation. See g_socket_client_connect_async()

func (*SocketClient) ConnectToHost

func (x *SocketClient) ConnectToHost(HostAndPortVar string, DefaultPortVar uint16, CancellableVar *Cancellable) (*SocketConnection, error)

This is a helper function for g_socket_client_connect().

Attempts to create a TCP connection to the named host.

@host_and_port may be in any of a number of recognized formats; an IPv6 address, an IPv4 address, or a domain name (in which case a DNS lookup is performed). Quoting with [] is supported for all address types. A port override may be specified in the usual way with a colon. Ports may be given as decimal numbers or symbolic names (in which case an /etc/services lookup is performed).

If no port override is given in @host_and_port then @default_port will be used as the port number to connect to.

In general, @host_and_port is expected to be provided by the user (allowing them to give the hostname, and a port override if necessary) and @default_port is expected to be provided by the application.

In the case that an IP address is given, a single connection attempt is made. In the case that a name is given, multiple connection attempts may be made, in turn and according to the number of address records in DNS, until a connection succeeds.

Upon a successful connection, a new #GSocketConnection is constructed and returned. The caller owns this new object and must drop their reference to it when finished with it.

In the event of any failure (DNS error, service not found, no hosts connectable) %NULL is returned and @error (if non-%NULL) is set accordingly.

func (*SocketClient) ConnectToHostAsync

func (x *SocketClient) ConnectToHostAsync(HostAndPortVar string, DefaultPortVar uint16, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

This is the asynchronous version of g_socket_client_connect_to_host().

When the operation is finished @callback will be called. You can then call g_socket_client_connect_to_host_finish() to get the result of the operation.

func (*SocketClient) ConnectToHostFinish

func (x *SocketClient) ConnectToHostFinish(ResultVar AsyncResult) (*SocketConnection, error)

Finishes an async connect operation. See g_socket_client_connect_to_host_async()

func (*SocketClient) ConnectToService

func (x *SocketClient) ConnectToService(DomainVar string, ServiceVar string, CancellableVar *Cancellable) (*SocketConnection, error)

Attempts to create a TCP connection to a service.

This call looks up the SRV record for @service at @domain for the "tcp" protocol. It then attempts to connect, in turn, to each of the hosts providing the service until either a connection succeeds or there are no hosts remaining.

Upon a successful connection, a new #GSocketConnection is constructed and returned. The caller owns this new object and must drop their reference to it when finished with it.

In the event of any failure (DNS error, service not found, no hosts connectable) %NULL is returned and @error (if non-%NULL) is set accordingly.

func (*SocketClient) ConnectToServiceAsync

func (x *SocketClient) ConnectToServiceAsync(DomainVar string, ServiceVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

This is the asynchronous version of g_socket_client_connect_to_service().

func (*SocketClient) ConnectToServiceFinish

func (x *SocketClient) ConnectToServiceFinish(ResultVar AsyncResult) (*SocketConnection, error)

Finishes an async connect operation. See g_socket_client_connect_to_service_async()

func (*SocketClient) ConnectToUri

func (x *SocketClient) ConnectToUri(UriVar string, DefaultPortVar uint16, CancellableVar *Cancellable) (*SocketConnection, error)

This is a helper function for g_socket_client_connect().

Attempts to create a TCP connection with a network URI.

@uri may be any valid URI containing an "authority" (hostname/port) component. If a port is not specified in the URI, @default_port will be used. TLS will be negotiated if #GSocketClient:tls is %TRUE. (#GSocketClient does not know to automatically assume TLS for certain URI schemes.)

Using this rather than g_socket_client_connect() or g_socket_client_connect_to_host() allows #GSocketClient to determine when to use application-specific proxy protocols.

Upon a successful connection, a new #GSocketConnection is constructed and returned. The caller owns this new object and must drop their reference to it when finished with it.

In the event of any failure (DNS error, service not found, no hosts connectable) %NULL is returned and @error (if non-%NULL) is set accordingly.

func (*SocketClient) ConnectToUriAsync

func (x *SocketClient) ConnectToUriAsync(UriVar string, DefaultPortVar uint16, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

This is the asynchronous version of g_socket_client_connect_to_uri().

When the operation is finished @callback will be called. You can then call g_socket_client_connect_to_uri_finish() to get the result of the operation.

func (*SocketClient) ConnectToUriFinish

func (x *SocketClient) ConnectToUriFinish(ResultVar AsyncResult) (*SocketConnection, error)

Finishes an async connect operation. See g_socket_client_connect_to_uri_async()

func (*SocketClient) GetEnableProxy

func (x *SocketClient) GetEnableProxy() bool

Gets the proxy enable state; see g_socket_client_set_enable_proxy()

func (*SocketClient) GetFamily

func (x *SocketClient) GetFamily() SocketFamily

Gets the socket family of the socket client.

See g_socket_client_set_family() for details.

func (*SocketClient) GetLocalAddress

func (x *SocketClient) GetLocalAddress() *SocketAddress

Gets the local address of the socket client.

See g_socket_client_set_local_address() for details.

func (*SocketClient) GetPropertyEnableProxy

func (x *SocketClient) GetPropertyEnableProxy() bool

GetPropertyEnableProxy gets the "enable-proxy" property. Enable proxy support.

func (*SocketClient) GetPropertyTimeout

func (x *SocketClient) GetPropertyTimeout() uint

GetPropertyTimeout gets the "timeout" property. The I/O timeout for sockets, in seconds, or `0` for none.

func (*SocketClient) GetPropertyTls

func (x *SocketClient) GetPropertyTls() bool

GetPropertyTls gets the "tls" property. Whether to create TLS connections.

func (*SocketClient) GetProtocol

func (x *SocketClient) GetProtocol() SocketProtocol

Gets the protocol name type of the socket client.

See g_socket_client_set_protocol() for details.

func (*SocketClient) GetProxyResolver

func (x *SocketClient) GetProxyResolver() *ProxyResolverBase

Gets the #GProxyResolver being used by @client. Normally, this will be the resolver returned by g_proxy_resolver_get_default(), but you can override it with g_socket_client_set_proxy_resolver().

func (*SocketClient) GetSocketType

func (x *SocketClient) GetSocketType() SocketType

Gets the socket type of the socket client.

See g_socket_client_set_socket_type() for details.

func (*SocketClient) GetTimeout

func (x *SocketClient) GetTimeout() uint

Gets the I/O timeout time for sockets created by @client.

See g_socket_client_set_timeout() for details.

func (*SocketClient) GetTls

func (x *SocketClient) GetTls() bool

Gets whether @client creates TLS connections. See g_socket_client_set_tls() for details.

func (*SocketClient) GetTlsValidationFlags

func (x *SocketClient) GetTlsValidationFlags() TlsCertificateFlags

Gets the TLS validation flags used creating TLS connections via @client.

This function does not work as originally designed and is impossible to use correctly. See #GSocketClient:tls-validation-flags for more information.

func (*SocketClient) GoPointer

func (c *SocketClient) GoPointer() uintptr

func (*SocketClient) SetEnableProxy

func (x *SocketClient) SetEnableProxy(EnableVar bool)

Sets whether or not @client attempts to make connections via a proxy server. When enabled (the default), #GSocketClient will use a #GProxyResolver to determine if a proxy protocol such as SOCKS is needed, and automatically do the necessary proxy negotiation.

See also g_socket_client_set_proxy_resolver().

func (*SocketClient) SetFamily

func (x *SocketClient) SetFamily(FamilyVar SocketFamily)

Sets the socket family of the socket client. If this is set to something other than %G_SOCKET_FAMILY_INVALID then the sockets created by this object will be of the specified family.

This might be useful for instance if you want to force the local connection to be an ipv4 socket, even though the address might be an ipv6 mapped to ipv4 address.

func (*SocketClient) SetGoPointer

func (c *SocketClient) SetGoPointer(ptr uintptr)

func (*SocketClient) SetLocalAddress

func (x *SocketClient) SetLocalAddress(AddressVar *SocketAddress)

Sets the local address of the socket client. The sockets created by this object will bound to the specified address (if not %NULL) before connecting.

This is useful if you want to ensure that the local side of the connection is on a specific port, or on a specific interface.

func (*SocketClient) SetPropertyEnableProxy

func (x *SocketClient) SetPropertyEnableProxy(value bool)

SetPropertyEnableProxy sets the "enable-proxy" property. Enable proxy support.

func (*SocketClient) SetPropertyTimeout

func (x *SocketClient) SetPropertyTimeout(value uint)

SetPropertyTimeout sets the "timeout" property. The I/O timeout for sockets, in seconds, or `0` for none.

func (*SocketClient) SetPropertyTls

func (x *SocketClient) SetPropertyTls(value bool)

SetPropertyTls sets the "tls" property. Whether to create TLS connections.

func (*SocketClient) SetProtocol

func (x *SocketClient) SetProtocol(ProtocolVar SocketProtocol)

Sets the protocol of the socket client. The sockets created by this object will use of the specified protocol.

If @protocol is %G_SOCKET_PROTOCOL_DEFAULT that means to use the default protocol for the socket family and type.

func (*SocketClient) SetProxyResolver

func (x *SocketClient) SetProxyResolver(ProxyResolverVar ProxyResolver)

Overrides the #GProxyResolver used by @client. You can call this if you want to use specific proxies, rather than using the system default proxy settings.

Note that whether or not the proxy resolver is actually used depends on the setting of #GSocketClient:enable-proxy, which is not changed by this function (but which is %TRUE by default)

func (*SocketClient) SetSocketType

func (x *SocketClient) SetSocketType(TypeVar SocketType)

Sets the socket type of the socket client. The sockets created by this object will be of the specified type.

It doesn't make sense to specify a type of %G_SOCKET_TYPE_DATAGRAM, as GSocketClient is used for connection oriented services.

func (*SocketClient) SetTimeout

func (x *SocketClient) SetTimeout(TimeoutVar uint)

Sets the I/O timeout for sockets created by @client. @timeout is a time in seconds, or 0 for no timeout (the default).

The timeout value affects the initial connection attempt as well, so setting this may cause calls to g_socket_client_connect(), etc, to fail with %G_IO_ERROR_TIMED_OUT.

func (*SocketClient) SetTls

func (x *SocketClient) SetTls(TlsVar bool)

Sets whether @client creates TLS (aka SSL) connections. If @tls is %TRUE, @client will wrap its connections in a #GTlsClientConnection and perform a TLS handshake when connecting.

Note that since #GSocketClient must return a #GSocketConnection, but #GTlsClientConnection is not a #GSocketConnection, this actually wraps the resulting #GTlsClientConnection in a #GTcpWrapperConnection when returning it. You can use g_tcp_wrapper_connection_get_base_io_stream() on the return value to extract the #GTlsClientConnection.

If you need to modify the behavior of the TLS handshake (eg, by setting a client-side certificate to use, or connecting to the #GTlsConnection::accept-certificate signal), you can connect to @client's #GSocketClient::event signal and wait for it to be emitted with %G_SOCKET_CLIENT_TLS_HANDSHAKING, which will give you a chance to see the #GTlsClientConnection before the handshake starts.

func (*SocketClient) SetTlsValidationFlags

func (x *SocketClient) SetTlsValidationFlags(FlagsVar TlsCertificateFlags)

Sets the TLS validation flags used when creating TLS connections via @client. The default value is %G_TLS_CERTIFICATE_VALIDATE_ALL.

This function does not work as originally designed and is impossible to use correctly. See #GSocketClient:tls-validation-flags for more information.

type SocketClientClass

type SocketClientClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*SocketClientClass) GetEvent

GetEvent gets the "event" callback function.

func (*SocketClientClass) GetGReserved1

func (x *SocketClientClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*SocketClientClass) GetGReserved2

func (x *SocketClientClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*SocketClientClass) GetGReserved3

func (x *SocketClientClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*SocketClientClass) GetGReserved4

func (x *SocketClientClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*SocketClientClass) GoPointer

func (x *SocketClientClass) GoPointer() uintptr

func (*SocketClientClass) OverrideEvent

OverrideEvent sets the "event" callback function.

func (*SocketClientClass) OverrideGReserved1

func (x *SocketClientClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*SocketClientClass) OverrideGReserved2

func (x *SocketClientClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*SocketClientClass) OverrideGReserved3

func (x *SocketClientClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*SocketClientClass) OverrideGReserved4

func (x *SocketClientClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

type SocketClientEvent

type SocketClientEvent int

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.

const (

	// The client is doing a DNS lookup.
	GSocketClientResolvingValue SocketClientEvent = 0
	// The client has completed a DNS lookup.
	GSocketClientResolvedValue SocketClientEvent = 1
	// The client is connecting to a remote
	//   host (either a proxy or the destination server).
	GSocketClientConnectingValue SocketClientEvent = 2
	// The client has connected to a remote
	//   host.
	GSocketClientConnectedValue SocketClientEvent = 3
	// The client is negotiating
	//   with a proxy to connect to the destination server.
	GSocketClientProxyNegotiatingValue SocketClientEvent = 4
	// The client has negotiated
	//   with the proxy server.
	GSocketClientProxyNegotiatedValue SocketClientEvent = 5
	// The client is performing a
	//   TLS handshake.
	GSocketClientTlsHandshakingValue SocketClientEvent = 6
	// The client has performed a
	//   TLS handshake.
	GSocketClientTlsHandshakedValue SocketClientEvent = 7
	// The client is done with a particular
	//   #GSocketConnectable.
	GSocketClientCompleteValue SocketClientEvent = 8
)

type SocketClientPrivate

type SocketClientPrivate struct {
	// contains filtered or unexported fields
}

func (*SocketClientPrivate) GoPointer

func (x *SocketClientPrivate) GoPointer() uintptr

type SocketConnectable

type SocketConnectable interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	Enumerate() *SocketAddressEnumerator
	ProxyEnumerate() *SocketAddressEnumerator
	ToString() string
}

Objects that describe one or more potential socket endpoints implement `GSocketConnectable`. Callers can then use [method@Gio.SocketConnectable.enumerate] to get a [class@Gio.SocketAddressEnumerator] 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;
    }
}

```

type SocketConnectableBase

type SocketConnectableBase struct {
	Ptr uintptr
}

func (*SocketConnectableBase) Enumerate

Creates a #GSocketAddressEnumerator for @connectable.

func (*SocketConnectableBase) GoPointer

func (x *SocketConnectableBase) GoPointer() uintptr

func (*SocketConnectableBase) ProxyEnumerate

func (x *SocketConnectableBase) ProxyEnumerate() *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().

func (*SocketConnectableBase) SetGoPointer

func (x *SocketConnectableBase) SetGoPointer(ptr uintptr)

func (*SocketConnectableBase) ToString

func (x *SocketConnectableBase) ToString() string

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.

type SocketConnectableIface

type SocketConnectableIface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

Provides an interface for returning a #GSocketAddressEnumerator and #GProxyAddressEnumerator

func (*SocketConnectableIface) GetEnumerate

GetEnumerate gets the "enumerate" callback function. Creates a #GSocketAddressEnumerator

func (*SocketConnectableIface) GetProxyEnumerate

GetProxyEnumerate gets the "proxy_enumerate" callback function. Creates a #GProxyAddressEnumerator

func (*SocketConnectableIface) GetToString

func (x *SocketConnectableIface) GetToString() func(SocketConnectable) string

GetToString gets the "to_string" callback function. Format the connectable’s address as a string for debugging.

Implementing this is optional. (Since: 2.48)

func (*SocketConnectableIface) GoPointer

func (x *SocketConnectableIface) GoPointer() uintptr

func (*SocketConnectableIface) OverrideEnumerate

func (x *SocketConnectableIface) OverrideEnumerate(cb func(SocketConnectable) *SocketAddressEnumerator)

OverrideEnumerate sets the "enumerate" callback function. Creates a #GSocketAddressEnumerator

func (*SocketConnectableIface) OverrideProxyEnumerate

func (x *SocketConnectableIface) OverrideProxyEnumerate(cb func(SocketConnectable) *SocketAddressEnumerator)

OverrideProxyEnumerate sets the "proxy_enumerate" callback function. Creates a #GProxyAddressEnumerator

func (*SocketConnectableIface) OverrideToString

func (x *SocketConnectableIface) OverrideToString(cb func(SocketConnectable) string)

OverrideToString sets the "to_string" callback function. Format the connectable’s address as a string for debugging.

Implementing this is optional. (Since: 2.48)

type SocketConnection

type SocketConnection struct {
	IOStream
}

`GSocketConnection` is a [class@Gio.IOStream] for a connected socket. They can be created either by [class@Gio.SocketClient] when connecting to a host, or by [class@Gio.SocketListener] when accepting a new client.

The type of the `GSocketConnection` object returned from these calls depends on the type of the underlying socket that is in use. For instance, for a TCP/IP connection it will be a [class@Gio.TcpConnection].

Choosing what type of object to construct is done with the socket connection factory, and it is possible for third parties to register custom socket connection types for specific combination of socket family/type/protocol using [func@Gio.SocketConnection.factory_register_type].

To close a `GSocketConnection`, use [method@Gio.IOStream.close]. Closing both substreams of the [class@Gio.IOStream] separately will not close the underlying [class@Gio.Socket].

func SocketConnectionNewFromInternalPtr

func SocketConnectionNewFromInternalPtr(ptr uintptr) *SocketConnection

func (*SocketConnection) Connect

func (x *SocketConnection) Connect(AddressVar *SocketAddress, CancellableVar *Cancellable) (bool, error)

Connect @connection to the specified remote address.

func (*SocketConnection) ConnectAsync

func (x *SocketConnection) ConnectAsync(AddressVar *SocketAddress, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously connect @connection to the specified remote address.

This clears the #GSocket:blocking flag on @connection's underlying socket if it is currently set.

If #GSocket:timeout is set, the operation will time out and return %G_IO_ERROR_TIMED_OUT after that period. Otherwise, it will continue indefinitely until operating system timeouts (if any) are hit.

Use g_socket_connection_connect_finish() to retrieve the result.

func (*SocketConnection) ConnectFinish

func (x *SocketConnection) ConnectFinish(ResultVar AsyncResult) (bool, error)

Gets the result of a g_socket_connection_connect_async() call.

func (*SocketConnection) GetLocalAddress

func (x *SocketConnection) GetLocalAddress() (*SocketAddress, error)

Try to get the local address of a socket connection.

func (*SocketConnection) GetRemoteAddress

func (x *SocketConnection) GetRemoteAddress() (*SocketAddress, error)

Try to get the remote address of a socket connection.

Since GLib 2.40, when used with g_socket_client_connect() or g_socket_client_connect_async(), during emission of %G_SOCKET_CLIENT_CONNECTING, this function will return the remote address that will be used for the connection. This allows applications to print e.g. "Connecting to example.com (10.42.77.3)...".

func (*SocketConnection) GetSocket

func (x *SocketConnection) GetSocket() *Socket

Gets the underlying #GSocket object of the connection. This can be useful if you want to do something unusual on it not supported by the #GSocketConnection APIs.

func (*SocketConnection) GoPointer

func (c *SocketConnection) GoPointer() uintptr

func (*SocketConnection) IsConnected

func (x *SocketConnection) IsConnected() bool

Checks if @connection is connected. This is equivalent to calling g_socket_is_connected() on @connection's underlying #GSocket.

func (*SocketConnection) SetGoPointer

func (c *SocketConnection) SetGoPointer(ptr uintptr)

type SocketConnectionClass

type SocketConnectionClass struct {
	ParentClass IOStreamClass
	// contains filtered or unexported fields
}

func (*SocketConnectionClass) GetGReserved1

func (x *SocketConnectionClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*SocketConnectionClass) GetGReserved2

func (x *SocketConnectionClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*SocketConnectionClass) GetGReserved3

func (x *SocketConnectionClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*SocketConnectionClass) GetGReserved4

func (x *SocketConnectionClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*SocketConnectionClass) GetGReserved5

func (x *SocketConnectionClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*SocketConnectionClass) GetGReserved6

func (x *SocketConnectionClass) GetGReserved6() func()

GetGReserved6 gets the "_g_reserved6" callback function.

func (*SocketConnectionClass) GoPointer

func (x *SocketConnectionClass) GoPointer() uintptr

func (*SocketConnectionClass) OverrideGReserved1

func (x *SocketConnectionClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*SocketConnectionClass) OverrideGReserved2

func (x *SocketConnectionClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*SocketConnectionClass) OverrideGReserved3

func (x *SocketConnectionClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*SocketConnectionClass) OverrideGReserved4

func (x *SocketConnectionClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*SocketConnectionClass) OverrideGReserved5

func (x *SocketConnectionClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

func (*SocketConnectionClass) OverrideGReserved6

func (x *SocketConnectionClass) OverrideGReserved6(cb func())

OverrideGReserved6 sets the "_g_reserved6" callback function.

type SocketConnectionPrivate

type SocketConnectionPrivate struct {
	// contains filtered or unexported fields
}

func (*SocketConnectionPrivate) GoPointer

func (x *SocketConnectionPrivate) GoPointer() uintptr

type SocketControlMessage

type SocketControlMessage struct {
	gobject.Object
}

A `GSocketControlMessage` is a special-purpose utility message that can be sent to or received from a [class@Gio.Socket]. These types of messages are often called ‘ancillary data’.

The message can represent some sort of special instruction to or information from the socket or can represent a special kind of transfer to the peer (for example, sending a file descriptor over a UNIX socket).

These messages are sent with [method@Gio.Socket.send_message] and received with [method@Gio.Socket.receive_message].

To extend the set of control messages that can be sent, subclass this class and override the `get_size`, `get_level`, `get_type` and `serialize` methods.

To extend the set of control messages that can be received, subclass this class and implement the `deserialize` method. Also, make sure your class is registered with the [type@GObject.Type] type system before calling [method@Gio.Socket.receive_message] to read such a message.

func SocketControlMessageDeserialize

func SocketControlMessageDeserialize(LevelVar int, TypeVar int, SizeVar uint, DataVar uintptr) *SocketControlMessage

Tries to deserialize a socket control message of a given @level and @type. This will ask all known (to GType) subclasses of #GSocketControlMessage if they can understand this kind of message and if so deserialize it into a #GSocketControlMessage.

If there is no implementation for this kind of control message, %NULL will be returned.

func SocketControlMessageNewFromInternalPtr

func SocketControlMessageNewFromInternalPtr(ptr uintptr) *SocketControlMessage

func (*SocketControlMessage) GetLevel

func (x *SocketControlMessage) GetLevel() int

Returns the "level" (i.e. the originating protocol) of the control message. This is often SOL_SOCKET.

func (*SocketControlMessage) GetMsgType

func (x *SocketControlMessage) GetMsgType() int

Returns the protocol specific type of the control message. For instance, for UNIX fd passing this would be SCM_RIGHTS.

func (*SocketControlMessage) GetSize

func (x *SocketControlMessage) GetSize() uint

Returns the space required for the control message, not including headers or alignment.

func (*SocketControlMessage) GoPointer

func (c *SocketControlMessage) GoPointer() uintptr

func (*SocketControlMessage) Serialize

func (x *SocketControlMessage) Serialize(DataVar uintptr)

Converts the data in the message to bytes placed in the message.

@data is guaranteed to have enough space to fit the size returned by g_socket_control_message_get_size() on this object.

func (*SocketControlMessage) SetGoPointer

func (c *SocketControlMessage) SetGoPointer(ptr uintptr)

type SocketControlMessageClass

type SocketControlMessageClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

Class structure for #GSocketControlMessage.

func (*SocketControlMessageClass) GetDeserialize

func (x *SocketControlMessageClass) GetDeserialize() func(int, int, uint, uintptr) *SocketControlMessage

GetDeserialize gets the "deserialize" callback function. Tries to deserialize a message.

func (*SocketControlMessageClass) GetGReserved1

func (x *SocketControlMessageClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*SocketControlMessageClass) GetGReserved2

func (x *SocketControlMessageClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*SocketControlMessageClass) GetGReserved3

func (x *SocketControlMessageClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*SocketControlMessageClass) GetGReserved4

func (x *SocketControlMessageClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*SocketControlMessageClass) GetGReserved5

func (x *SocketControlMessageClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*SocketControlMessageClass) GetGetLevel

func (x *SocketControlMessageClass) GetGetLevel() func(*SocketControlMessage) int

GetGetLevel gets the "get_level" callback function. gets the protocol of the message.

func (*SocketControlMessageClass) GetGetSize

func (x *SocketControlMessageClass) GetGetSize() func(*SocketControlMessage) uint

GetGetSize gets the "get_size" callback function. gets the size of the message.

func (*SocketControlMessageClass) GetGetType

func (x *SocketControlMessageClass) GetGetType() func(*SocketControlMessage) int

GetGetType gets the "get_type" callback function. gets the protocol specific type of the message.

func (*SocketControlMessageClass) GetSerialize

func (x *SocketControlMessageClass) GetSerialize() func(*SocketControlMessage, uintptr)

GetSerialize gets the "serialize" callback function. Writes out the message data.

func (*SocketControlMessageClass) GoPointer

func (x *SocketControlMessageClass) GoPointer() uintptr

func (*SocketControlMessageClass) OverrideDeserialize

func (x *SocketControlMessageClass) OverrideDeserialize(cb func(int, int, uint, uintptr) *SocketControlMessage)

OverrideDeserialize sets the "deserialize" callback function. Tries to deserialize a message.

func (*SocketControlMessageClass) OverrideGReserved1

func (x *SocketControlMessageClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*SocketControlMessageClass) OverrideGReserved2

func (x *SocketControlMessageClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*SocketControlMessageClass) OverrideGReserved3

func (x *SocketControlMessageClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*SocketControlMessageClass) OverrideGReserved4

func (x *SocketControlMessageClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*SocketControlMessageClass) OverrideGReserved5

func (x *SocketControlMessageClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

func (*SocketControlMessageClass) OverrideGetLevel

func (x *SocketControlMessageClass) OverrideGetLevel(cb func(*SocketControlMessage) int)

OverrideGetLevel sets the "get_level" callback function. gets the protocol of the message.

func (*SocketControlMessageClass) OverrideGetSize

func (x *SocketControlMessageClass) OverrideGetSize(cb func(*SocketControlMessage) uint)

OverrideGetSize sets the "get_size" callback function. gets the size of the message.

func (*SocketControlMessageClass) OverrideGetType

func (x *SocketControlMessageClass) OverrideGetType(cb func(*SocketControlMessage) int)

OverrideGetType sets the "get_type" callback function. gets the protocol specific type of the message.

func (*SocketControlMessageClass) OverrideSerialize

func (x *SocketControlMessageClass) OverrideSerialize(cb func(*SocketControlMessage, uintptr))

OverrideSerialize sets the "serialize" callback function. Writes out the message data.

type SocketControlMessagePrivate

type SocketControlMessagePrivate struct {
	// contains filtered or unexported fields
}

func (*SocketControlMessagePrivate) GoPointer

func (x *SocketControlMessagePrivate) GoPointer() uintptr

type SocketFamily

type SocketFamily int

The protocol family of a #GSocketAddress. (These values are identical to the system defines %AF_INET, %AF_INET6 and %AF_UNIX, if available.)

const (

	// no address family
	GSocketFamilyInvalidValue SocketFamily = 0
	// the UNIX domain family
	GSocketFamilyUnixValue SocketFamily = 1
	// the IPv4 family
	GSocketFamilyIpv4Value SocketFamily = 2
	// the IPv6 family
	GSocketFamilyIpv6Value SocketFamily = 10
)

type SocketListener

type SocketListener struct {
	gobject.Object
}

A `GSocketListener` is an object that keeps track of a set of server sockets and helps you accept sockets from any of the socket, either sync or async.

Add addresses and ports to listen on using [method@Gio.SocketListener.add_address] and [method@Gio.SocketListener.add_inet_port]. These will be listened on until [method@Gio.SocketListener.close] is called. Dropping your final reference to the `GSocketListener` will not cause [method@Gio.SocketListener.close] to be called implicitly, as some references to the `GSocketListener` may be held internally.

If you want to implement a network server, also look at [class@Gio.SocketService] and [class@Gio.ThreadedSocketService] which are subclasses of `GSocketListener` that make this even easier.

func NewSocketListener

func NewSocketListener() *SocketListener

Creates a new #GSocketListener with no sockets to listen for. New listeners can be added with e.g. g_socket_listener_add_address() or g_socket_listener_add_inet_port().

func SocketListenerNewFromInternalPtr

func SocketListenerNewFromInternalPtr(ptr uintptr) *SocketListener

func (*SocketListener) Accept

func (x *SocketListener) Accept(SourceObjectVar **gobject.Object, CancellableVar *Cancellable) (*SocketConnection, error)

Blocks waiting for a client to connect to any of the sockets added to the listener. Returns a #GSocketConnection for the socket that was accepted.

If @source_object is not %NULL it will be filled out with the source object specified when the corresponding socket or address was added to the listener.

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.

func (*SocketListener) AcceptAsync

func (x *SocketListener) AcceptAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

This is the asynchronous version of g_socket_listener_accept().

When the operation is finished @callback will be called. You can then call g_socket_listener_accept_finish() to get the result of the operation.

func (*SocketListener) AcceptFinish

func (x *SocketListener) AcceptFinish(ResultVar AsyncResult, SourceObjectVar **gobject.Object) (*SocketConnection, error)

Finishes an async accept operation. See g_socket_listener_accept_async()

func (*SocketListener) AcceptSocket

func (x *SocketListener) AcceptSocket(SourceObjectVar **gobject.Object, CancellableVar *Cancellable) (*Socket, error)

Blocks waiting for a client to connect to any of the sockets added to the listener. Returns the #GSocket that was accepted.

If you want to accept the high-level #GSocketConnection, not a #GSocket, which is often the case, then you should use g_socket_listener_accept() instead.

If @source_object is not %NULL it will be filled out with the source object specified when the corresponding socket or address was added to the listener.

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.

func (*SocketListener) AcceptSocketAsync

func (x *SocketListener) AcceptSocketAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

This is the asynchronous version of g_socket_listener_accept_socket().

When the operation is finished @callback will be called. You can then call g_socket_listener_accept_socket_finish() to get the result of the operation.

func (*SocketListener) AcceptSocketFinish

func (x *SocketListener) AcceptSocketFinish(ResultVar AsyncResult, SourceObjectVar **gobject.Object) (*Socket, error)

Finishes an async accept operation. See g_socket_listener_accept_socket_async()

func (*SocketListener) AddAddress

func (x *SocketListener) AddAddress(AddressVar *SocketAddress, TypeVar SocketType, ProtocolVar SocketProtocol, SourceObjectVar *gobject.Object, EffectiveAddressVar **SocketAddress) (bool, error)

Creates a socket of type @type and protocol @protocol, binds it to @address and adds it to the set of sockets we're accepting sockets from.

Note that adding an IPv6 address, depending on the platform, may or may not result in a listener that also accepts IPv4 connections. For more deterministic behavior, see g_socket_listener_add_inet_port().

@source_object will be passed out in the various calls to accept to identify this particular source, which is useful if you're listening on multiple addresses and do different things depending on what address is connected to.

If successful and @effective_address is non-%NULL then it will be set to the address that the binding actually occurred at. This is helpful for determining the port number that was used for when requesting a binding to port 0 (ie: "any port"). This address, if requested, belongs to the caller and must be freed.

Call g_socket_listener_close() to stop listening on @address; this will not be done automatically when you drop your final reference to @listener, as references may be held internally.

func (*SocketListener) AddAnyInetPort

func (x *SocketListener) AddAnyInetPort(SourceObjectVar *gobject.Object) (uint16, error)

Listens for TCP connections on any available port number for both IPv6 and IPv4 (if each is available).

This is useful if you need to have a socket for incoming connections but don't care about the specific port number.

If possible, the [class@Gio.SocketListener] will listen on both IPv4 and IPv6 (listening on the same port on both). If listening on one of the socket families fails, the [class@Gio.SocketListener] will only listen on the other. If listening on both fails, an error will be returned.

If you need to distinguish whether listening on IPv4 or IPv6 or both was successful, connect to [signal@Gio.SocketListener::event].

@source_object will be passed out in the various calls to accept to identify this particular source, which is useful if you're listening on multiple addresses and do different things depending on what address is connected to.

func (*SocketListener) AddInetPort

func (x *SocketListener) AddInetPort(PortVar uint16, SourceObjectVar *gobject.Object) (bool, error)

Helper function for g_socket_listener_add_address() that creates a TCP/IP socket listening on IPv4 and IPv6 (if supported) on the specified port on all interfaces.

If possible, the [class@Gio.SocketListener] will listen on both IPv4 and IPv6 (listening on the same port on both). If listening on one of the socket families fails, the [class@Gio.SocketListener] will only listen on the other. If listening on both fails, an error will be returned.

If you need to distinguish whether listening on IPv4 or IPv6 or both was successful, connect to [signal@Gio.SocketListener::event].

@source_object will be passed out in the various calls to accept to identify this particular source, which is useful if you're listening on multiple addresses and do different things depending on what address is connected to.

Call g_socket_listener_close() to stop listening on @port; this will not be done automatically when you drop your final reference to @listener, as references may be held internally.

func (*SocketListener) AddSocket

func (x *SocketListener) AddSocket(SocketVar *Socket, SourceObjectVar *gobject.Object) (bool, error)

Adds @socket to the set of sockets that we try to accept new clients from. The socket must be bound to a local address and listened to.

For parallel calls to [class@Gio.SocketListener] methods to work, the socket must be in non-blocking mode. (See [property@Gio.Socket:blocking].)

@source_object will be passed out in the various calls to accept to identify this particular source, which is useful if you're listening on multiple addresses and do different things depending on what address is connected to.

The @socket will not be automatically closed when the @listener is finalized unless the listener held the final reference to the socket. Before GLib 2.42, the @socket was automatically closed on finalization of the @listener, even if references to it were held elsewhere.

func (*SocketListener) Close

func (x *SocketListener) Close()

Closes all the sockets in the listener.

func (*SocketListener) ConnectEvent

func (x *SocketListener) ConnectEvent(cb *func(SocketListener, SocketListenerEvent, uintptr)) uint

Emitted when @listener's activity on @socket changes state. Note that when @listener is used to listen on both IPv4 and IPv6, a separate set of signals will be emitted for each, and the order they happen in is undefined.

func (*SocketListener) GetPropertyListenBacklog

func (x *SocketListener) GetPropertyListenBacklog() int

GetPropertyListenBacklog gets the "listen-backlog" property. The number of outstanding connections in the listen queue.

func (*SocketListener) GoPointer

func (c *SocketListener) GoPointer() uintptr

func (*SocketListener) SetBacklog

func (x *SocketListener) SetBacklog(ListenBacklogVar int)

Sets the listen backlog on the sockets in the listener. This must be called before adding any sockets, addresses or ports to the #GSocketListener (for example, by calling g_socket_listener_add_inet_port()) to be effective.

See g_socket_set_listen_backlog() for details

func (*SocketListener) SetGoPointer

func (c *SocketListener) SetGoPointer(ptr uintptr)

func (*SocketListener) SetPropertyListenBacklog

func (x *SocketListener) SetPropertyListenBacklog(value int)

SetPropertyListenBacklog sets the "listen-backlog" property. The number of outstanding connections in the listen queue.

type SocketListenerClass

type SocketListenerClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

Class structure for #GSocketListener.

func (*SocketListenerClass) GetChanged

func (x *SocketListenerClass) GetChanged() func(*SocketListener)

GetChanged gets the "changed" callback function. virtual method called when the set of socket listened to changes

func (*SocketListenerClass) GetEvent

GetEvent gets the "event" callback function.

func (*SocketListenerClass) GetGReserved2

func (x *SocketListenerClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*SocketListenerClass) GetGReserved3

func (x *SocketListenerClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*SocketListenerClass) GetGReserved4

func (x *SocketListenerClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*SocketListenerClass) GetGReserved5

func (x *SocketListenerClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*SocketListenerClass) GetGReserved6

func (x *SocketListenerClass) GetGReserved6() func()

GetGReserved6 gets the "_g_reserved6" callback function.

func (*SocketListenerClass) GoPointer

func (x *SocketListenerClass) GoPointer() uintptr

func (*SocketListenerClass) OverrideChanged

func (x *SocketListenerClass) OverrideChanged(cb func(*SocketListener))

OverrideChanged sets the "changed" callback function. virtual method called when the set of socket listened to changes

func (*SocketListenerClass) OverrideEvent

func (x *SocketListenerClass) OverrideEvent(cb func(*SocketListener, SocketListenerEvent, *Socket))

OverrideEvent sets the "event" callback function.

func (*SocketListenerClass) OverrideGReserved2

func (x *SocketListenerClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*SocketListenerClass) OverrideGReserved3

func (x *SocketListenerClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*SocketListenerClass) OverrideGReserved4

func (x *SocketListenerClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*SocketListenerClass) OverrideGReserved5

func (x *SocketListenerClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

func (*SocketListenerClass) OverrideGReserved6

func (x *SocketListenerClass) OverrideGReserved6(cb func())

OverrideGReserved6 sets the "_g_reserved6" callback function.

type SocketListenerEvent

type SocketListenerEvent int

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.

const (

	// The listener is about to bind a socket.
	GSocketListenerBindingValue SocketListenerEvent = 0
	// The listener has bound a socket.
	GSocketListenerBoundValue SocketListenerEvent = 1
	// The listener is about to start
	//    listening on this socket.
	GSocketListenerListeningValue SocketListenerEvent = 2
	// The listener is now listening on
	//   this socket.
	GSocketListenerListenedValue SocketListenerEvent = 3
)

type SocketListenerPrivate

type SocketListenerPrivate struct {
	// contains filtered or unexported fields
}

func (*SocketListenerPrivate) GoPointer

func (x *SocketListenerPrivate) GoPointer() uintptr

type SocketMsgFlags

type SocketMsgFlags int

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.

const (

	// No flags.
	GSocketMsgNoneValue SocketMsgFlags = 0
	// Request to send/receive out of band data.
	GSocketMsgOobValue SocketMsgFlags = 1
	// Read data from the socket without removing it from
	//     the queue.
	GSocketMsgPeekValue SocketMsgFlags = 2
	// Don't use a gateway to send out the packet,
	//     only send to hosts on directly connected networks.
	GSocketMsgDontrouteValue SocketMsgFlags = 4
)

type SocketPrivate

type SocketPrivate struct {
	// contains filtered or unexported fields
}

func (*SocketPrivate) GoPointer

func (x *SocketPrivate) GoPointer() uintptr

type SocketProtocol

type SocketProtocol int

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.

const (

	// The protocol type is unknown
	GSocketProtocolUnknownValue SocketProtocol = -1
	// The default protocol for the family/type
	GSocketProtocolDefaultValue SocketProtocol = 0
	// TCP over IP
	GSocketProtocolTcpValue SocketProtocol = 6
	// UDP over IP
	GSocketProtocolUdpValue SocketProtocol = 17
	// SCTP over IP
	GSocketProtocolSctpValue SocketProtocol = 132
)

type SocketService

type SocketService struct {
	SocketListener
}

A `GSocketService` is an object that represents a service that is provided to the network or over local sockets. When a new connection is made to the service the [signal@Gio.SocketService::incoming] signal is emitted.

A `GSocketService` is a subclass of [class@Gio.SocketListener] and you need to add the addresses you want to accept connections on with the [class@Gio.SocketListener] APIs.

There are two options for implementing a network service based on `GSocketService`. The first is to create the service using [ctor@Gio.SocketService.new] and to connect to the [signal@Gio.SocketService::incoming] signal. The second is to subclass `GSocketService` and override the default signal handler implementation.

In either case, the handler must immediately return, or else it will block additional incoming connections from being serviced. If you are interested in writing connection handlers that contain blocking code then see [class@Gio.ThreadedSocketService].

The socket service runs on the main loop of the thread-default context (see [method@GLib.MainContext.push_thread_default]) of the thread it is created in, and is not threadsafe in general. However, the calls to start and stop the service are thread-safe so these can be used from threads that handle incoming clients.

func NewSocketService

func NewSocketService() *SocketService

Creates a new #GSocketService with no sockets to listen for. New listeners can be added with e.g. g_socket_listener_add_address() or g_socket_listener_add_inet_port().

New services are created active, there is no need to call g_socket_service_start(), unless g_socket_service_stop() has been called before.

func SocketServiceNewFromInternalPtr

func SocketServiceNewFromInternalPtr(ptr uintptr) *SocketService

func (*SocketService) ConnectIncoming

func (x *SocketService) ConnectIncoming(cb *func(SocketService, uintptr, uintptr) bool) uint

The ::incoming signal is emitted when a new incoming connection to @service needs to be handled. The handler must initiate the handling of @connection, but may not block; in essence, asynchronous operations must be used.

@connection will be unreffed once the signal handler returns, so you need to ref it yourself if you are planning to use it.

func (*SocketService) GetPropertyActive

func (x *SocketService) GetPropertyActive() bool

GetPropertyActive gets the "active" property. Whether the service is currently accepting connections.

func (*SocketService) GoPointer

func (c *SocketService) GoPointer() uintptr

func (*SocketService) IsActive

func (x *SocketService) IsActive() bool

Check whether the service is active or not. An active service will accept new clients that connect, while a non-active service will let connecting clients queue up until the service is started.

func (*SocketService) SetGoPointer

func (c *SocketService) SetGoPointer(ptr uintptr)

func (*SocketService) SetPropertyActive

func (x *SocketService) SetPropertyActive(value bool)

SetPropertyActive sets the "active" property. Whether the service is currently accepting connections.

func (*SocketService) Start

func (x *SocketService) Start()

Restarts the service, i.e. start accepting connections from the added sockets when the mainloop runs. This only needs to be called after the service has been stopped from g_socket_service_stop().

This call is thread-safe, so it may be called from a thread handling an incoming client request.

func (*SocketService) Stop

func (x *SocketService) Stop()

Stops the service, i.e. stops accepting connections from the added sockets when the mainloop runs.

This call is thread-safe, so it may be called from a thread handling an incoming client request.

Note that this only stops accepting new connections; it does not close the listening sockets, and you can call g_socket_service_start() again later to begin listening again. To close the listening sockets, call g_socket_listener_close(). (This will happen automatically when the #GSocketService is finalized.)

This must be called before calling g_socket_listener_close() as the socket service will start accepting connections immediately when a new socket is added.

type SocketServiceClass

type SocketServiceClass struct {
	ParentClass SocketListenerClass
	// contains filtered or unexported fields
}

Class structure for #GSocketService.

func (*SocketServiceClass) GetGReserved1

func (x *SocketServiceClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*SocketServiceClass) GetGReserved2

func (x *SocketServiceClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*SocketServiceClass) GetGReserved3

func (x *SocketServiceClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*SocketServiceClass) GetGReserved4

func (x *SocketServiceClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*SocketServiceClass) GetGReserved5

func (x *SocketServiceClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*SocketServiceClass) GetGReserved6

func (x *SocketServiceClass) GetGReserved6() func()

GetGReserved6 gets the "_g_reserved6" callback function.

func (*SocketServiceClass) GetIncoming

GetIncoming gets the "incoming" callback function. signal emitted when new connections are accepted

func (*SocketServiceClass) GoPointer

func (x *SocketServiceClass) GoPointer() uintptr

func (*SocketServiceClass) OverrideGReserved1

func (x *SocketServiceClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*SocketServiceClass) OverrideGReserved2

func (x *SocketServiceClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*SocketServiceClass) OverrideGReserved3

func (x *SocketServiceClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*SocketServiceClass) OverrideGReserved4

func (x *SocketServiceClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*SocketServiceClass) OverrideGReserved5

func (x *SocketServiceClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

func (*SocketServiceClass) OverrideGReserved6

func (x *SocketServiceClass) OverrideGReserved6(cb func())

OverrideGReserved6 sets the "_g_reserved6" callback function.

func (*SocketServiceClass) OverrideIncoming

func (x *SocketServiceClass) OverrideIncoming(cb func(*SocketService, *SocketConnection, *gobject.Object) bool)

OverrideIncoming sets the "incoming" callback function. signal emitted when new connections are accepted

type SocketServicePrivate

type SocketServicePrivate struct {
	// contains filtered or unexported fields
}

func (*SocketServicePrivate) GoPointer

func (x *SocketServicePrivate) GoPointer() uintptr

type SocketSourceFunc

type SocketSourceFunc func(uintptr, glib.IOCondition, uintptr) bool

This is the function type of the callback used for the #GSource returned by g_socket_create_source().

type SocketType

type SocketType int

Flags used when creating a #GSocket. Some protocols may not implement all the socket types.

const (

	// Type unknown or wrong
	GSocketTypeInvalidValue SocketType = 0
	// Reliable connection-based byte streams (e.g. TCP).
	GSocketTypeStreamValue SocketType = 1
	// Connectionless, unreliable datagram passing.
	//     (e.g. UDP)
	GSocketTypeDatagramValue SocketType = 2
	// Reliable connection-based passing of datagrams
	//     of fixed maximum length (e.g. SCTP).
	GSocketTypeSeqpacketValue SocketType = 3
)

type SrvTarget

type SrvTarget struct {
	// contains filtered or unexported fields
}

A single target host/port that a network service is running on.

SRV (service) records are used by some network protocols to provide service-specific aliasing and load-balancing. For example, XMPP (Jabber) uses SRV records to locate the XMPP server for a domain; rather than connecting directly to ‘example.com’ or assuming a specific server hostname like ‘xmpp.example.com’, an XMPP client would look up the `xmpp-client` SRV record for ‘example.com’, and then connect to whatever host was pointed to by that record.

You can use [method@Gio.Resolver.lookup_service] or [method@Gio.Resolver.lookup_service_async] to find the `GSrvTarget`s for a given service. However, if you are simply planning to connect to the remote service, you can use [class@Gio.NetworkService]’s [iface@Gio.SocketConnectable] interface and not need to worry about `GSrvTarget` at all.

func NewSrvTarget

func NewSrvTarget(HostnameVar string, PortVar uint16, PriorityVar uint16, WeightVar uint16) *SrvTarget

Creates a new #GSrvTarget with the given parameters.

You should not need to use this; normally #GSrvTargets are created by #GResolver.

func (*SrvTarget) Copy

func (x *SrvTarget) Copy() *SrvTarget

Copies @target

func (*SrvTarget) Free

func (x *SrvTarget) Free()

Frees @target

func (*SrvTarget) GetHostname

func (x *SrvTarget) GetHostname() string

Gets @target's hostname (in ASCII form; if you are going to present this to the user, you should use g_hostname_is_ascii_encoded() to check if it contains encoded Unicode segments, and use g_hostname_to_unicode() to convert it if it does.)

func (*SrvTarget) GetPort

func (x *SrvTarget) GetPort() uint16

Gets @target's port

func (*SrvTarget) GetPriority

func (x *SrvTarget) GetPriority() uint16

Gets @target's priority. You should not need to look at this; #GResolver already sorts the targets according to the algorithm in RFC 2782.

func (*SrvTarget) GetWeight

func (x *SrvTarget) GetWeight() uint16

Gets @target's weight. You should not need to look at this; #GResolver already sorts the targets according to the algorithm in RFC 2782.

func (*SrvTarget) GoPointer

func (x *SrvTarget) GoPointer() uintptr

type StaticResource

type StaticResource struct {
	Data byte

	DataLen uint

	Resource *Resource

	Next *StaticResource

	Padding uintptr
	// contains filtered or unexported fields
}

`GStaticResource` is an opaque data structure and can only be accessed using the following functions.

func (*StaticResource) Fini

func (x *StaticResource) Fini()

Finalizes a [struct@Gio.Resource] initialized by [method@Gio.StaticResource.init].

This is normally used by code generated by [`glib-compile-resources`](glib-compile-resources.html) and is not typically used by other code.

func (*StaticResource) GetResource

func (x *StaticResource) GetResource() *Resource

Gets the [struct@Gio.Resource] that was registered by a call to [method@Gio.StaticResource.init].

This is normally used by code generated by [`glib-compile-resources`](glib-compile-resources.html) and is not typically used by other code.

func (*StaticResource) GoPointer

func (x *StaticResource) GoPointer() uintptr

func (*StaticResource) Init

func (x *StaticResource) Init()

Initializes a [struct@Gio.Resource] from static data using a [struct@Gio.StaticResource].

This is normally used by code generated by [`glib-compile-resources`](glib-compile-resources.html) and is not typically used by other code.

type Subprocess

type Subprocess struct {
	gobject.Object
}

`GSubprocess` allows the creation of and interaction with child processes.

Processes can be communicated with using standard GIO-style APIs (ie: [class@Gio.InputStream], [class@Gio.OutputStream]). There are GIO-style APIs to wait for process termination (ie: cancellable and with an asynchronous variant).

There is an API to force a process to terminate, as well as a race-free API for sending UNIX signals to a subprocess.

One major advantage that GIO brings over the core GLib library is comprehensive API for asynchronous I/O, such [method@Gio.OutputStream.splice_async]. This makes `GSubprocess` significantly more powerful and flexible than equivalent APIs in some other languages such as the `subprocess.py` included with Python. For example, using `GSubprocess` one could create two child processes, reading standard output from the first, processing it, and writing to the input stream of the second, all without blocking the main loop.

A powerful [method@Gio.Subprocess.communicate] API is provided similar to the `communicate()` method of `subprocess.py`. This enables very easy interaction with a subprocess that has been opened with pipes.

`GSubprocess` defaults to tight control over the file descriptors open in the child process, avoiding dangling-FD issues that are caused by a simple `fork()`/`exec()`. The only open file descriptors in the spawned process are ones that were explicitly specified by the `GSubprocess` API (unless `G_SUBPROCESS_FLAGS_INHERIT_FDS` was specified).

`GSubprocess` will quickly reap all child processes as they exit, avoiding ‘zombie processes’ remaining around for long periods of time. [method@Gio.Subprocess.wait] can be used to wait for this to happen, but it will happen even without the call being explicitly made.

As a matter of principle, `GSubprocess` has no API that accepts shell-style space-separated strings. It will, however, match the typical shell behaviour of searching the `PATH` for executables that do not contain a directory separator in their name. By default, the `PATH` of the current process is used. You can specify `G_SUBPROCESS_FLAGS_SEARCH_PATH_FROM_ENVP` to use the `PATH` of the launcher environment instead.

`GSubprocess` attempts to have a very simple API for most uses (ie: spawning a subprocess with arguments and support for most typical kinds of input and output redirection). See [ctor@Gio.Subprocess.new]. The [class@Gio.SubprocessLauncher] API is provided for more complicated cases (advanced types of redirection, environment variable manipulation, change of working directory, child setup functions, etc).

A typical use of `GSubprocess` will involve calling [ctor@Gio.Subprocess.new], followed by [method@Gio.Subprocess.wait_async] or [method@Gio.Subprocess.wait]. After the process exits, the status can be checked using functions such as [method@Gio.Subprocess.get_if_exited] (which are similar to the familiar `WIFEXITED`-style POSIX macros).

Note that as of GLib 2.82, creating a `GSubprocess` causes the signal `SIGPIPE` to be ignored for the remainder of the program. If you are writing a command-line utility that uses `GSubprocess`, you may need to take into account the fact that your program will not automatically be killed if it tries to write to `stdout` after it has been closed.

func NewSubprocess

func NewSubprocess(FlagsVar SubprocessFlags, ErrorVar **glib.Error, Argv0Var string, varArgs ...interface{}) *Subprocess

Create a new process with the given flags and varargs argument list. By default, matching the g_spawn_async() defaults, the child's stdin will be set to the system null device, and stdout/stderr will be inherited from the parent. You can use @flags to control this behavior.

The argument list must be terminated with %NULL.

func NewSubprocessv

func NewSubprocessv(ArgvVar []string, FlagsVar SubprocessFlags) (*Subprocess, error)

Create a new process with the given flags and argument list.

The argument list is expected to be %NULL-terminated.

func SubprocessNewFromInternalPtr

func SubprocessNewFromInternalPtr(ptr uintptr) *Subprocess

func (*Subprocess) Communicate

func (x *Subprocess) Communicate(StdinBufVar *glib.Bytes, CancellableVar *Cancellable, StdoutBufVar **glib.Bytes, StderrBufVar **glib.Bytes) (bool, error)

Communicate with the subprocess until it terminates, and all input and output has been completed.

If @stdin_buf is given, the subprocess must have been created with %G_SUBPROCESS_FLAGS_STDIN_PIPE. The given data is fed to the stdin of the subprocess and the pipe is closed (ie: EOF).

At the same time (as not to cause blocking when dealing with large amounts of data), if %G_SUBPROCESS_FLAGS_STDOUT_PIPE or %G_SUBPROCESS_FLAGS_STDERR_PIPE were used, reads from those streams. The data that was read is returned in @stdout and/or the @stderr.

If the subprocess was created with %G_SUBPROCESS_FLAGS_STDOUT_PIPE, @stdout_buf will contain the data read from stdout. Otherwise, for subprocesses not created with %G_SUBPROCESS_FLAGS_STDOUT_PIPE, @stdout_buf will be set to %NULL. Similar provisions apply to @stderr_buf and %G_SUBPROCESS_FLAGS_STDERR_PIPE.

As usual, any output variable may be given as %NULL to ignore it.

If you desire the stdout and stderr data to be interleaved, create the subprocess with %G_SUBPROCESS_FLAGS_STDOUT_PIPE and %G_SUBPROCESS_FLAGS_STDERR_MERGE. The merged result will be returned in @stdout_buf and @stderr_buf will be set to %NULL.

In case of any error (including cancellation), %FALSE will be returned with @error set. Some or all of the stdin data may have been written. Any stdout or stderr data that has been read will be discarded. None of the out variables (aside from @error) will have been set to anything in particular and should not be inspected.

In the case that %TRUE is returned, the subprocess has exited and the exit status inspection APIs (eg: g_subprocess_get_if_exited(), g_subprocess_get_exit_status()) may be used.

You should not attempt to use any of the subprocess pipes after starting this function, since they may be left in strange states, even if the operation was cancelled. You should especially not attempt to interact with the pipes while the operation is in progress (either from another thread or if using the asynchronous version).

func (*Subprocess) CommunicateAsync

func (x *Subprocess) CommunicateAsync(StdinBufVar *glib.Bytes, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronous version of g_subprocess_communicate(). Complete invocation with g_subprocess_communicate_finish().

func (*Subprocess) CommunicateFinish

func (x *Subprocess) CommunicateFinish(ResultVar AsyncResult, StdoutBufVar **glib.Bytes, StderrBufVar **glib.Bytes) (bool, error)

Complete an invocation of g_subprocess_communicate_async().

func (*Subprocess) CommunicateUtf8

func (x *Subprocess) CommunicateUtf8(StdinBufVar *string, CancellableVar *Cancellable, StdoutBufVar *string, StderrBufVar *string) (bool, error)

Like g_subprocess_communicate(), but validates the output of the process as UTF-8, and returns it as a regular NUL terminated string.

On error, @stdout_buf and @stderr_buf will be set to undefined values and should not be used.

func (*Subprocess) CommunicateUtf8Async

func (x *Subprocess) CommunicateUtf8Async(StdinBufVar *string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronous version of g_subprocess_communicate_utf8(). Complete invocation with g_subprocess_communicate_utf8_finish().

func (*Subprocess) CommunicateUtf8Finish

func (x *Subprocess) CommunicateUtf8Finish(ResultVar AsyncResult, StdoutBufVar *string, StderrBufVar *string) (bool, error)

Complete an invocation of g_subprocess_communicate_utf8_async().

func (*Subprocess) ForceExit

func (x *Subprocess) ForceExit()

Use an operating-system specific method to attempt an immediate, forceful termination of the process. There is no mechanism to determine whether or not the request itself was successful; however, you can use g_subprocess_wait() to monitor the status of the process after calling this function.

On Unix, this function sends %SIGKILL.

func (*Subprocess) GetExitStatus

func (x *Subprocess) GetExitStatus() int

Check the exit status of the subprocess, given that it exited normally. This is the value passed to the exit() system call or the return value from main.

This is equivalent to the system WEXITSTATUS macro.

It is an error to call this function before g_subprocess_wait() and unless g_subprocess_get_if_exited() returned %TRUE.

func (*Subprocess) GetIdentifier

func (x *Subprocess) GetIdentifier() string

On UNIX, returns the process ID as a decimal string. On Windows, returns the result of GetProcessId() also as a string. If the subprocess has terminated, this will return %NULL.

func (*Subprocess) GetIfExited

func (x *Subprocess) GetIfExited() bool

Check if the given subprocess exited normally (ie: by way of exit() or return from main()).

This is equivalent to the system WIFEXITED macro.

It is an error to call this function before g_subprocess_wait() has returned.

func (*Subprocess) GetIfSignaled

func (x *Subprocess) GetIfSignaled() bool

Check if the given subprocess terminated in response to a signal.

This is equivalent to the system WIFSIGNALED macro.

It is an error to call this function before g_subprocess_wait() has returned.

func (*Subprocess) GetStatus

func (x *Subprocess) GetStatus() int

Gets the raw status code of the process, as from waitpid().

This value has no particular meaning, but it can be used with the macros defined by the system headers such as WIFEXITED. It can also be used with g_spawn_check_wait_status().

It is more likely that you want to use g_subprocess_get_if_exited() followed by g_subprocess_get_exit_status().

It is an error to call this function before g_subprocess_wait() has returned.

func (*Subprocess) GetStderrPipe

func (x *Subprocess) GetStderrPipe() *InputStream

Gets the #GInputStream from which to read the stderr output of @subprocess.

The process must have been created with %G_SUBPROCESS_FLAGS_STDERR_PIPE, otherwise %NULL will be returned.

func (*Subprocess) GetStdinPipe

func (x *Subprocess) GetStdinPipe() *OutputStream

Gets the #GOutputStream that you can write to in order to give data to the stdin of @subprocess.

The process must have been created with %G_SUBPROCESS_FLAGS_STDIN_PIPE and not %G_SUBPROCESS_FLAGS_STDIN_INHERIT, otherwise %NULL will be returned.

func (*Subprocess) GetStdoutPipe

func (x *Subprocess) GetStdoutPipe() *InputStream

Gets the #GInputStream from which to read the stdout output of @subprocess.

The process must have been created with %G_SUBPROCESS_FLAGS_STDOUT_PIPE, otherwise %NULL will be returned.

func (*Subprocess) GetSuccessful

func (x *Subprocess) GetSuccessful() bool

Checks if the process was "successful". A process is considered successful if it exited cleanly with an exit status of 0, either by way of the exit() system call or return from main().

It is an error to call this function before g_subprocess_wait() has returned.

func (*Subprocess) GetTermSig

func (x *Subprocess) GetTermSig() int

Get the signal number that caused the subprocess to terminate, given that it terminated due to a signal.

This is equivalent to the system WTERMSIG macro.

It is an error to call this function before g_subprocess_wait() and unless g_subprocess_get_if_signaled() returned %TRUE.

func (*Subprocess) GoPointer

func (c *Subprocess) GoPointer() uintptr

func (*Subprocess) Init

func (x *Subprocess) Init(CancellableVar *Cancellable) (bool, error)

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 [description][iface@Gio.Initable#description] 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.

func (*Subprocess) SendSignal

func (x *Subprocess) SendSignal(SignalNumVar int)

Sends the UNIX signal @signal_num to the subprocess, if it is still running.

This API is race-free. If the subprocess has terminated, it will not be signalled.

This API is not available on Windows.

func (*Subprocess) SetGoPointer

func (c *Subprocess) SetGoPointer(ptr uintptr)

func (*Subprocess) SetPropertyArgv

func (x *Subprocess) SetPropertyArgv(value []string)

SetPropertyArgv sets the "argv" property. Argument vector.

func (*Subprocess) Wait

func (x *Subprocess) Wait(CancellableVar *Cancellable) (bool, error)

Synchronously wait for the subprocess to terminate.

After the process terminates you can query its exit status with functions such as g_subprocess_get_if_exited() and g_subprocess_get_exit_status().

This function does not fail in the case of the subprocess having abnormal termination. See g_subprocess_wait_check() for that.

Cancelling @cancellable doesn't kill the subprocess. Call g_subprocess_force_exit() if it is desirable.

func (*Subprocess) WaitAsync

func (x *Subprocess) WaitAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Wait for the subprocess to terminate.

This is the asynchronous version of g_subprocess_wait().

func (*Subprocess) WaitCheck

func (x *Subprocess) WaitCheck(CancellableVar *Cancellable) (bool, error)

Combines g_subprocess_wait() with g_spawn_check_wait_status().

func (*Subprocess) WaitCheckAsync

func (x *Subprocess) WaitCheckAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Combines g_subprocess_wait_async() with g_spawn_check_wait_status().

This is the asynchronous version of g_subprocess_wait_check().

func (*Subprocess) WaitCheckFinish

func (x *Subprocess) WaitCheckFinish(ResultVar AsyncResult) (bool, error)

Collects the result of a previous call to g_subprocess_wait_check_async().

func (*Subprocess) WaitFinish

func (x *Subprocess) WaitFinish(ResultVar AsyncResult) (bool, error)

Collects the result of a previous call to g_subprocess_wait_async().

type SubprocessFlags

type SubprocessFlags int

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.

const (

	// No flags.
	GSubprocessFlagsNoneValue SubprocessFlags = 0
	// create a pipe for the stdin of the
	//   spawned process that can be accessed with
	//   g_subprocess_get_stdin_pipe().
	GSubprocessFlagsStdinPipeValue SubprocessFlags = 1
	// stdin is inherited from the
	//   calling process.
	GSubprocessFlagsStdinInheritValue SubprocessFlags = 2
	// create a pipe for the stdout of the
	//   spawned process that can be accessed with
	//   g_subprocess_get_stdout_pipe().
	GSubprocessFlagsStdoutPipeValue SubprocessFlags = 4
	// silence the stdout of the spawned
	//   process (ie: redirect to `/dev/null`).
	GSubprocessFlagsStdoutSilenceValue SubprocessFlags = 8
	// create a pipe for the stderr of the
	//   spawned process that can be accessed with
	//   g_subprocess_get_stderr_pipe().
	GSubprocessFlagsStderrPipeValue SubprocessFlags = 16
	// silence the stderr of the spawned
	//   process (ie: redirect to `/dev/null`).
	GSubprocessFlagsStderrSilenceValue SubprocessFlags = 32
	// 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.
	GSubprocessFlagsStderrMergeValue SubprocessFlags = 64
	// 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).
	GSubprocessFlagsInheritFdsValue SubprocessFlags = 128
	// if path searching is
	//   needed when spawning the subprocess, use the `PATH` in the launcher
	//   environment. (Since: 2.72)
	GSubprocessFlagsSearchPathFromEnvpValue SubprocessFlags = 256
)

type SubprocessLauncher

type SubprocessLauncher struct {
	gobject.Object
}

This class contains a set of options for launching child processes, such as where its standard input and output will be directed, the argument list, the environment, and more.

While the [class@Gio.Subprocess] class has high level functions covering popular cases, use of this class allows access to more advanced options. It can also be used to launch multiple subprocesses with a similar configuration.

func NewSubprocessLauncher

func NewSubprocessLauncher(FlagsVar SubprocessFlags) *SubprocessLauncher

Creates a new #GSubprocessLauncher.

The launcher is created with the default options. A copy of the environment of the calling process is made at the time of this call and will be used as the environment that the process is launched in.

func SubprocessLauncherNewFromInternalPtr

func SubprocessLauncherNewFromInternalPtr(ptr uintptr) *SubprocessLauncher

func (*SubprocessLauncher) Close

func (x *SubprocessLauncher) Close()

Closes all the file descriptors previously passed to the object with g_subprocess_launcher_take_fd(), g_subprocess_launcher_take_stderr_fd(), etc.

After calling this method, any subsequent calls to g_subprocess_launcher_spawn() or g_subprocess_launcher_spawnv() will return %G_IO_ERROR_CLOSED. This method is idempotent if called more than once.

This function is called automatically when the #GSubprocessLauncher is disposed, but is provided separately so that garbage collected language bindings can call it earlier to guarantee when FDs are closed.

func (*SubprocessLauncher) Getenv

func (x *SubprocessLauncher) Getenv(VariableVar string) string

Returns the value of the environment variable @variable in the environment of processes launched from this launcher.

On UNIX, the returned string can be an arbitrary byte string. On Windows, it will be UTF-8.

func (*SubprocessLauncher) GoPointer

func (c *SubprocessLauncher) GoPointer() uintptr

func (*SubprocessLauncher) SetChildSetup

func (x *SubprocessLauncher) SetChildSetup(ChildSetupVar *glib.SpawnChildSetupFunc, UserDataVar uintptr, DestroyNotifyVar *glib.DestroyNotify)

Sets up a child setup function.

The child setup function will be called after fork() but before exec() on the child's side.

@destroy_notify will not be automatically called on the child's side of the fork(). It will only be called when the last reference on the #GSubprocessLauncher is dropped or when a new child setup function is given.

%NULL can be given as @child_setup to disable the functionality.

Child setup functions are only available on UNIX.

func (*SubprocessLauncher) SetCwd

func (x *SubprocessLauncher) SetCwd(CwdVar string)

Sets the current working directory that processes will be launched with.

By default processes are launched with the current working directory of the launching process at the time of launch.

func (*SubprocessLauncher) SetEnviron

func (x *SubprocessLauncher) SetEnviron(EnvVar []string)

Replace the entire environment of processes launched from this launcher with the given 'environ' variable.

Typically you will build this variable by using g_listenv() to copy the process 'environ' and using the functions g_environ_setenv(), g_environ_unsetenv(), etc.

As an alternative, you can use g_subprocess_launcher_setenv(), g_subprocess_launcher_unsetenv(), etc.

Pass an empty array to set an empty environment. Pass %NULL to inherit the parent process’ environment. As of GLib 2.54, the parent process’ environment will be copied when g_subprocess_launcher_set_environ() is called. Previously, it was copied when the subprocess was executed. This means the copied environment may now be modified (using g_subprocess_launcher_setenv(), etc.) before launching the subprocess.

On UNIX, all strings in this array can be arbitrary byte strings. On Windows, they should be in UTF-8.

func (*SubprocessLauncher) SetFlags

func (x *SubprocessLauncher) SetFlags(FlagsVar SubprocessFlags)

Sets the flags on the launcher.

The default flags are %G_SUBPROCESS_FLAGS_NONE.

You may not set flags that specify conflicting options for how to handle a particular stdio stream (eg: specifying both %G_SUBPROCESS_FLAGS_STDIN_PIPE and %G_SUBPROCESS_FLAGS_STDIN_INHERIT).

You may also not set a flag that conflicts with a previous call to a function like g_subprocess_launcher_set_stdin_file_path() or g_subprocess_launcher_take_stdout_fd().

func (*SubprocessLauncher) SetGoPointer

func (c *SubprocessLauncher) SetGoPointer(ptr uintptr)

func (*SubprocessLauncher) SetStderrFilePath

func (x *SubprocessLauncher) SetStderrFilePath(PathVar *string)

Sets the file path to use as the stderr for spawned processes.

If @path is %NULL then any previously given path is unset.

The file will be created or truncated when the process is spawned, as would be the case if using '2>' at the shell.

If you want to send both stdout and stderr to the same file then use %G_SUBPROCESS_FLAGS_STDERR_MERGE.

You may not set a stderr file path if a stderr fd is already set or if the launcher flags contain any flags directing stderr elsewhere.

This feature is only available on UNIX.

func (*SubprocessLauncher) SetStdinFilePath

func (x *SubprocessLauncher) SetStdinFilePath(PathVar *string)

Sets the file path to use as the stdin for spawned processes.

If @path is %NULL then any previously given path is unset.

The file must exist or spawning the process will fail.

You may not set a stdin file path if a stdin fd is already set or if the launcher flags contain any flags directing stdin elsewhere.

This feature is only available on UNIX.

func (*SubprocessLauncher) SetStdoutFilePath

func (x *SubprocessLauncher) SetStdoutFilePath(PathVar *string)

Sets the file path to use as the stdout for spawned processes.

If @path is %NULL then any previously given path is unset.

The file will be created or truncated when the process is spawned, as would be the case if using '>' at the shell.

You may not set a stdout file path if a stdout fd is already set or if the launcher flags contain any flags directing stdout elsewhere.

This feature is only available on UNIX.

func (*SubprocessLauncher) Setenv

func (x *SubprocessLauncher) Setenv(VariableVar string, ValueVar string, OverwriteVar bool)

Sets the environment variable @variable in the environment of processes launched from this launcher.

On UNIX, both the variable's name and value can be arbitrary byte strings, except that the variable's name cannot contain '='. On Windows, they should be in UTF-8.

func (*SubprocessLauncher) Spawn

func (x *SubprocessLauncher) Spawn(ErrorVar **glib.Error, Argv0Var string, varArgs ...interface{}) *Subprocess

Creates a #GSubprocess given a provided varargs list of arguments.

func (*SubprocessLauncher) Spawnv

func (x *SubprocessLauncher) Spawnv(ArgvVar []string) (*Subprocess, error)

Creates a #GSubprocess given a provided array of arguments.

func (*SubprocessLauncher) TakeFd

func (x *SubprocessLauncher) TakeFd(SourceFdVar int, TargetFdVar int)

Transfer an arbitrary file descriptor from parent process to the child. This function takes ownership of the @source_fd; it will be closed in the parent when @self is freed.

By default, all file descriptors from the parent will be closed. This function allows you to create (for example) a custom `pipe()` or `socketpair()` before launching the process, and choose the target descriptor in the child.

An example use case is GNUPG, which has a command line argument `--passphrase-fd` providing a file descriptor number where it expects the passphrase to be written.

func (*SubprocessLauncher) TakeStderrFd

func (x *SubprocessLauncher) TakeStderrFd(FdVar int)

Sets the file descriptor to use as the stderr for spawned processes.

If @fd is -1 then any previously given fd is unset.

Note that the default behaviour is to pass stderr through to the stderr of the parent process.

The passed @fd belongs to the #GSubprocessLauncher. It will be automatically closed when the launcher is finalized. The file descriptor will also be closed on the child side when executing the spawned process.

You may not set a stderr fd if a stderr file path is already set or if the launcher flags contain any flags directing stderr elsewhere.

This feature is only available on UNIX.

func (*SubprocessLauncher) TakeStdinFd

func (x *SubprocessLauncher) TakeStdinFd(FdVar int)

Sets the file descriptor to use as the stdin for spawned processes.

If @fd is -1 then any previously given fd is unset.

Note that if your intention is to have the stdin of the calling process inherited by the child then %G_SUBPROCESS_FLAGS_STDIN_INHERIT is a better way to go about doing that.

The passed @fd is noted but will not be touched in the current process. It is therefore necessary that it be kept open by the caller until the subprocess is spawned. The file descriptor will also not be explicitly closed on the child side, so it must be marked O_CLOEXEC if that's what you want.

You may not set a stdin fd if a stdin file path is already set or if the launcher flags contain any flags directing stdin elsewhere.

This feature is only available on UNIX.

func (*SubprocessLauncher) TakeStdoutFd

func (x *SubprocessLauncher) TakeStdoutFd(FdVar int)

Sets the file descriptor to use as the stdout for spawned processes.

If @fd is -1 then any previously given fd is unset.

Note that the default behaviour is to pass stdout through to the stdout of the parent process.

The passed @fd is noted but will not be touched in the current process. It is therefore necessary that it be kept open by the caller until the subprocess is spawned. The file descriptor will also not be explicitly closed on the child side, so it must be marked O_CLOEXEC if that's what you want.

You may not set a stdout fd if a stdout file path is already set or if the launcher flags contain any flags directing stdout elsewhere.

This feature is only available on UNIX.

func (*SubprocessLauncher) Unsetenv

func (x *SubprocessLauncher) Unsetenv(VariableVar string)

Removes the environment variable @variable from the environment of processes launched from this launcher.

On UNIX, the variable's name can be an arbitrary byte string not containing '='. On Windows, it should be in UTF-8.

type Task

type Task struct {
	gobject.Object
}

A `GTask` represents and manages a cancellable ‘task’.

## Asynchronous operations

The most common usage of `GTask` is as a [iface@Gio.AsyncResult], to manage data during an asynchronous operation. You call [ctor@Gio.Task.new] in the ‘start’ method, followed by [method@Gio.Task.set_task_data] and the like if you need to keep some additional data associated with the task, and then pass the task object around through your asynchronous operation. Eventually, you will call a method such as [method@Gio.Task.return_pointer] or [method@Gio.Task.return_error], which will save the value you give it and then invoke the task’s callback function in the thread-default main context (see [method@GLib.MainContext.push_thread_default]) where it was created (waiting until the next iteration of the main loop first, if necessary). The caller will pass the `GTask` back to the operation’s finish function (as a [iface@Gio.AsyncResult]), and you can use [method@Gio.Task.propagate_pointer] or the like to extract the return value.

Using `GTask` requires the thread-default [struct@GLib.MainContext] from when the `GTask` was constructed to be running at least until the task has completed and its data has been freed.

If a `GTask` has been constructed and its callback set, it is an error to not call `g_task_return_*()` on it. GLib will warn at runtime if this happens (since 2.76).

Here is an example for using `GTask` as a [iface@Gio.AsyncResult]: ```c

typedef struct {
  CakeFrostingType frosting;
  char *message;
} DecorationData;

static void decoration_data_free (DecorationData *decoration)

{
  g_free (decoration->message);
  g_slice_free (DecorationData, decoration);
}

static void baked_cb (Cake *cake,

gpointer  user_data)

{
  GTask *task = user_data;
  DecorationData *decoration = g_task_get_task_data (task);
  GError *error = NULL;

  if (cake == NULL)
    {
      g_task_return_new_error (task, BAKER_ERROR, BAKER_ERROR_NO_FLOUR,
                               "Go to the supermarket");
      g_object_unref (task);
      return;
    }

  if (!cake_decorate (cake, decoration->frosting, decoration->message, &error))
    {
      g_object_unref (cake);
      // g_task_return_error() takes ownership of error
      g_task_return_error (task, error);
      g_object_unref (task);
      return;
    }

  g_task_return_pointer (task, cake, g_object_unref);
  g_object_unref (task);
}

void baker_bake_cake_async (Baker *self,

guint                radius,
CakeFlavor           flavor,
CakeFrostingType     frosting,
const char          *message,
GCancellable        *cancellable,
GAsyncReadyCallback  callback,
gpointer             user_data)

{
  GTask *task;
  DecorationData *decoration;
  Cake  *cake;

  task = g_task_new (self, cancellable, callback, user_data);
  if (radius < 3)
    {
      g_task_return_new_error (task, BAKER_ERROR, BAKER_ERROR_TOO_SMALL,
                               "%ucm radius cakes are silly",
                               radius);
      g_object_unref (task);
      return;
    }

  cake = _baker_get_cached_cake (self, radius, flavor, frosting, message);
  if (cake != NULL)
    {
      // _baker_get_cached_cake() returns a reffed cake
      g_task_return_pointer (task, cake, g_object_unref);
      g_object_unref (task);
      return;
    }

  decoration = g_slice_new (DecorationData);
  decoration->frosting = frosting;
  decoration->message = g_strdup (message);
  g_task_set_task_data (task, decoration, (GDestroyNotify) decoration_data_free);

  _baker_begin_cake (self, radius, flavor, cancellable, baked_cb, task);
}

Cake * baker_bake_cake_finish (Baker *self,

GAsyncResult  *result,
GError       **error)

{
  g_return_val_if_fail (g_task_is_valid (result, self), NULL);

  return g_task_propagate_pointer (G_TASK (result), error);
}

```

## Chained asynchronous operations

`GTask` also tries to simplify asynchronous operations that internally chain together several smaller asynchronous operations. [method@Gio.Task.get_cancellable], [method@Gio.Task.get_context], and [method@Gio.Task.get_priority] allow you to get back the task’s [class@Gio.Cancellable], [struct@GLib.MainContext], and [I/O priority](iface.AsyncResult.html#io-priority) when starting a new subtask, so you don’t have to keep track of them yourself. [method@Gio.Task.attach_source] simplifies the case of waiting for a source to fire (automatically using the correct [struct@GLib.MainContext] and priority).

Here is an example for chained asynchronous operations: ```c

typedef struct {
  Cake *cake;
  CakeFrostingType frosting;
  char *message;
} BakingData;

static void decoration_data_free (BakingData *bd)

{
  if (bd->cake)
    g_object_unref (bd->cake);
  g_free (bd->message);
  g_slice_free (BakingData, bd);
}

static void decorated_cb (Cake *cake,

GAsyncResult *result,
gpointer      user_data)

{
  GTask *task = user_data;
  GError *error = NULL;

  if (!cake_decorate_finish (cake, result, &error))
    {
      g_object_unref (cake);
      g_task_return_error (task, error);
      g_object_unref (task);
      return;
    }

  // baking_data_free() will drop its ref on the cake, so we have to
  // take another here to give to the caller.
  g_task_return_pointer (task, g_object_ref (cake), g_object_unref);
  g_object_unref (task);
}

static gboolean decorator_ready (gpointer user_data)

{
  GTask *task = user_data;
  BakingData *bd = g_task_get_task_data (task);

  cake_decorate_async (bd->cake, bd->frosting, bd->message,
                       g_task_get_cancellable (task),
                       decorated_cb, task);

  return G_SOURCE_REMOVE;
}

static void baked_cb (Cake *cake,

gpointer  user_data)

{
  GTask *task = user_data;
  BakingData *bd = g_task_get_task_data (task);
  GError *error = NULL;

  if (cake == NULL)
    {
      g_task_return_new_error (task, BAKER_ERROR, BAKER_ERROR_NO_FLOUR,
                               "Go to the supermarket");
      g_object_unref (task);
      return;
    }

  bd->cake = cake;

  // Bail out now if the user has already cancelled
  if (g_task_return_error_if_cancelled (task))
    {
      g_object_unref (task);
      return;
    }

  if (cake_decorator_available (cake))
    decorator_ready (task);
  else
    {
      GSource *source;

      source = cake_decorator_wait_source_new (cake);
      // Attach @source to @task’s GMainContext and have it call
      // decorator_ready() when it is ready.
      g_task_attach_source (task, source, decorator_ready);
      g_source_unref (source);
    }
}

void baker_bake_cake_async (Baker *self,

guint                radius,
CakeFlavor           flavor,
CakeFrostingType     frosting,
const char          *message,
gint                 priority,
GCancellable        *cancellable,
GAsyncReadyCallback  callback,
gpointer             user_data)

{
  GTask *task;
  BakingData *bd;

  task = g_task_new (self, cancellable, callback, user_data);
  g_task_set_priority (task, priority);

  bd = g_slice_new0 (BakingData);
  bd->frosting = frosting;
  bd->message = g_strdup (message);
  g_task_set_task_data (task, bd, (GDestroyNotify) baking_data_free);

  _baker_begin_cake (self, radius, flavor, cancellable, baked_cb, task);
}

Cake * baker_bake_cake_finish (Baker *self,

GAsyncResult  *result,
GError       **error)

{
  g_return_val_if_fail (g_task_is_valid (result, self), NULL);

  return g_task_propagate_pointer (G_TASK (result), error);
}

```

## Asynchronous operations from synchronous ones

You can use [method@Gio.Task.run_in_thread] to turn a synchronous operation into an asynchronous one, by running it in a thread. When it completes, the result will be dispatched to the thread-default main context (see [method@GLib.MainContext.push_thread_default]) where the `GTask` was created.

Running a task in a thread: ```c

typedef struct {
  guint radius;
  CakeFlavor flavor;
  CakeFrostingType frosting;
  char *message;
} CakeData;

static void cake_data_free (CakeData *cake_data)

{
  g_free (cake_data->message);
  g_slice_free (CakeData, cake_data);
}

static void bake_cake_thread (GTask *task,

gpointer       source_object,
gpointer       task_data,
GCancellable  *cancellable)

{
  Baker *self = source_object;
  CakeData *cake_data = task_data;
  Cake *cake;
  GError *error = NULL;

  cake = bake_cake (baker, cake_data->radius, cake_data->flavor,
                    cake_data->frosting, cake_data->message,
                    cancellable, &error);
  if (cake)
    g_task_return_pointer (task, cake, g_object_unref);
  else
    g_task_return_error (task, error);
}

void baker_bake_cake_async (Baker *self,

guint                radius,
CakeFlavor           flavor,
CakeFrostingType     frosting,
const char          *message,
GCancellable        *cancellable,
GAsyncReadyCallback  callback,
gpointer             user_data)

{
  CakeData *cake_data;
  GTask *task;

  cake_data = g_slice_new (CakeData);
  cake_data->radius = radius;
  cake_data->flavor = flavor;
  cake_data->frosting = frosting;
  cake_data->message = g_strdup (message);
  task = g_task_new (self, cancellable, callback, user_data);
  g_task_set_task_data (task, cake_data, (GDestroyNotify) cake_data_free);
  g_task_run_in_thread (task, bake_cake_thread);
  g_object_unref (task);
}

Cake * baker_bake_cake_finish (Baker *self,

GAsyncResult  *result,
GError       **error)

{
  g_return_val_if_fail (g_task_is_valid (result, self), NULL);

  return g_task_propagate_pointer (G_TASK (result), error);
}

```

## Adding cancellability to uncancellable tasks

Finally, [method@Gio.Task.run_in_thread] and [method@Gio.Task.run_in_thread_sync] can be used to turn an uncancellable operation into a cancellable one. If you call [method@Gio.Task.set_return_on_cancel], passing `TRUE`, then if the task’s [class@Gio.Cancellable] is cancelled, it will return control back to the caller immediately, while allowing the task thread to continue running in the background (and simply discarding its result when it finally does finish). Provided that the task thread is careful about how it uses locks and other externally-visible resources, this allows you to make ‘GLib-friendly’ asynchronous and cancellable synchronous variants of blocking APIs.

Cancelling a task: ```c static void bake_cake_thread (GTask *task,

gpointer       source_object,
gpointer       task_data,
GCancellable  *cancellable)

{
  Baker *self = source_object;
  CakeData *cake_data = task_data;
  Cake *cake;
  GError *error = NULL;

  cake = bake_cake (baker, cake_data->radius, cake_data->flavor,
                    cake_data->frosting, cake_data->message,
                    &error);
  if (error)
    {
      g_task_return_error (task, error);
      return;
    }

  // If the task has already been cancelled, then we don’t want to add
  // the cake to the cake cache. Likewise, we don’t  want to have the
  // task get cancelled in the middle of updating the cache.
  // g_task_set_return_on_cancel() will return %TRUE here if it managed
  // to disable return-on-cancel, or %FALSE if the task was cancelled
  // before it could.
  if (g_task_set_return_on_cancel (task, FALSE))
    {
      // If the caller cancels at this point, their
      // GAsyncReadyCallback won’t be invoked until we return,
      // so we don’t have to worry that this code will run at
      // the same time as that code does. But if there were
      // other functions that might look at the cake cache,
      // then we’d probably need a GMutex here as well.
      baker_add_cake_to_cache (baker, cake);
      g_task_return_pointer (task, cake, g_object_unref);
    }
}

void baker_bake_cake_async (Baker *self,

guint                radius,
CakeFlavor           flavor,
CakeFrostingType     frosting,
const char          *message,
GCancellable        *cancellable,
GAsyncReadyCallback  callback,
gpointer             user_data)

{
  CakeData *cake_data;
  GTask *task;

  cake_data = g_slice_new (CakeData);

  ...

  task = g_task_new (self, cancellable, callback, user_data);
  g_task_set_task_data (task, cake_data, (GDestroyNotify) cake_data_free);
  g_task_set_return_on_cancel (task, TRUE);
  g_task_run_in_thread (task, bake_cake_thread);
}

Cake * baker_bake_cake_sync (Baker *self,

guint                radius,
CakeFlavor           flavor,
CakeFrostingType     frosting,
const char          *message,
GCancellable        *cancellable,
GError             **error)

{
  CakeData *cake_data;
  GTask *task;
  Cake *cake;

  cake_data = g_slice_new (CakeData);

  ...

  task = g_task_new (self, cancellable, NULL, NULL);
  g_task_set_task_data (task, cake_data, (GDestroyNotify) cake_data_free);
  g_task_set_return_on_cancel (task, TRUE);
  g_task_run_in_thread_sync (task, bake_cake_thread);

  cake = g_task_propagate_pointer (task, error);
  g_object_unref (task);
  return cake;
}

```

## Porting from [class@Gio.SimpleAsyncResult]

`GTask`’s API attempts to be simpler than [class@Gio.SimpleAsyncResult]’s in several ways:

  • You can save task-specific data with [method@Gio.Task.set_task_data], and retrieve it later with [method@Gio.Task.get_task_data]. This replaces the abuse of [method@Gio.SimpleAsyncResult.set_op_res_gpointer] for the same purpose with [class@Gio.SimpleAsyncResult].
  • In addition to the task data, `GTask` also keeps track of the [priority](iface.AsyncResult.html#io-priority), [class@Gio.Cancellable], and [struct@GLib.MainContext] associated with the task, so tasks that consist of a chain of simpler asynchronous operations will have easy access to those values when starting each sub-task.
  • [method@Gio.Task.return_error_if_cancelled] provides simplified handling for cancellation. In addition, cancellation overrides any other `GTask` return value by default, like [class@Gio.SimpleAsyncResult] does when [method@Gio.SimpleAsyncResult.set_check_cancellable] is called. (You can use [method@Gio.Task.set_check_cancellable] to turn off that behavior.) On the other hand, [method@Gio.Task.run_in_thread] guarantees that it will always run your `task_func`, even if the task’s [class@Gio.Cancellable] is already cancelled before the task gets a chance to run; you can start your `task_func` with a [method@Gio.Task.return_error_if_cancelled] check if you need the old behavior.
  • The ‘return’ methods (eg, [method@Gio.Task.return_pointer]) automatically cause the task to be ‘completed’ as well, and there is no need to worry about the ‘complete’ vs ‘complete in idle’ distinction. (`GTask` automatically figures out whether the task’s callback can be invoked directly, or if it needs to be sent to another [struct@GLib.MainContext], or delayed until the next iteration of the current [struct@GLib.MainContext].)
  • The ‘finish’ functions for `GTask` based operations are generally much simpler than [class@Gio.SimpleAsyncResult] ones, normally consisting of only a single call to [method@Gio.Task.propagate_pointer] or the like. Since [method@Gio.Task.propagate_pointer] ‘steals’ the return value from the `GTask`, it is not necessary to juggle pointers around to prevent it from being freed twice.
  • With [class@Gio.SimpleAsyncResult], it was common to call [method@Gio.SimpleAsyncResult.propagate_error] from the `_finish()` wrapper function, and have virtual method implementations only deal with successful returns. This behavior is deprecated, because it makes it difficult for a subclass to chain to a parent class’s async methods. Instead, the wrapper function should just be a simple wrapper, and the virtual method should call an appropriate `g_task_propagate_` function. Note that wrapper methods can now use [method@Gio.AsyncResult.legacy_propagate_error] to do old-style [class@Gio.SimpleAsyncResult] error-returning behavior, and [method@Gio.AsyncResult.is_tagged] to check if a result is tagged as having come from the `_async()` wrapper function (for ‘short-circuit’ results, such as when passing `0` to [method@Gio.InputStream.read_async]).

## Thread-safety considerations

Due to some infelicities in the API design, there is a thread-safety concern that users of `GTask` have to be aware of:

If the `main` thread drops its last reference to the source object or the task data before the task is finalized, then the finalizers of these objects may be called on the worker thread.

This is a problem if the finalizers use non-threadsafe API, and can lead to hard-to-debug crashes. Possible workarounds include:

  • Clear task data in a signal handler for `notify::completed`
  • Keep iterating a main context in the main thread and defer dropping the reference to the source object to that main context when the task is finalized

func NewTask

func NewTask(SourceObjectVar *gobject.Object, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, CallbackDataVar uintptr) *Task

Creates a #GTask acting on @source_object, which will eventually be used to invoke @callback in the current thread-default main context (see [method@GLib.MainContext.push_thread_default]).

Call this in the "start" method of your asynchronous method, and pass the #GTask around throughout the asynchronous operation. You can use g_task_set_task_data() to attach task-specific data to the object, which you can retrieve later via g_task_get_task_data().

By default, if @cancellable is cancelled, then the return value of the task will always be %G_IO_ERROR_CANCELLED, even if the task had already completed before the cancellation. This allows for simplified handling in cases where cancellation may imply that other objects that the task depends on have been destroyed. If you do not want this behavior, you can use g_task_set_check_cancellable() to change it.

func TaskNewFromInternalPtr

func TaskNewFromInternalPtr(ptr uintptr) *Task

func (*Task) AttachSource

func (x *Task) AttachSource(SourceVar *glib.Source, CallbackVar *glib.SourceFunc)

A utility function for dealing with async operations where you need to wait for a #GSource to trigger. Attaches @source to @task's #GMainContext with @task's [priority](iface.AsyncResult.html#io-priority), and sets @source's callback to @callback, with @task as the callback's `user_data`.

It will set the @source’s name to the task’s name (as set with g_task_set_name()), if one has been set on the task and the source doesn’t yet have a name.

This takes a reference on @task until @source is destroyed.

func (*Task) GetCancellable

func (x *Task) GetCancellable() *Cancellable

Gets @task's #GCancellable

func (*Task) GetCheckCancellable

func (x *Task) GetCheckCancellable() bool

Gets @task's check-cancellable flag. See g_task_set_check_cancellable() for more details.

func (*Task) GetCompleted

func (x *Task) GetCompleted() bool

Gets the value of #GTask:completed. This changes from %FALSE to %TRUE after the task’s callback is invoked, and will return %FALSE if called from inside the callback.

func (*Task) GetContext

func (x *Task) GetContext() *glib.MainContext

Gets the #GMainContext that @task will return its result in (that is, the context that was the thread-default main context (see [method@GLib.MainContext.push_thread_default]) at the point when @task was created).

This will always return a non-%NULL value, even if the task's context is the default #GMainContext.

func (*Task) GetName

func (x *Task) GetName() string

Gets @task’s name. See g_task_set_name().

func (*Task) GetPriority

func (x *Task) GetPriority() int

Gets @task's priority

func (*Task) GetPropertyCompleted

func (x *Task) GetPropertyCompleted() bool

GetPropertyCompleted gets the "completed" property. Whether the task has completed, meaning its callback (if set) has been invoked.

This can only happen after g_task_return_pointer(), g_task_return_error() or one of the other return functions have been called on the task. However, it is not guaranteed to happen immediately after those functions are called, as the task’s callback may need to be scheduled to run in a different thread.

That means it is **not safe** to use this property to track whether a return function has been called on the #GTask. Callers must do that tracking themselves, typically by linking the lifetime of the #GTask to the control flow of their code.

This property is guaranteed to change from %FALSE to %TRUE exactly once.

The #GObject::notify signal for this change is emitted in the same main context as the task’s callback, immediately after that callback is invoked.

func (*Task) GetReturnOnCancel

func (x *Task) GetReturnOnCancel() bool

Gets @task's return-on-cancel flag. See g_task_set_return_on_cancel() for more details.

func (*Task) GetSourceObject

func (x *Task) GetSourceObject() *gobject.Object

Gets the source object from @task. Like g_async_result_get_source_object(), but does not ref the object.

func (*Task) GetSourceTag

func (x *Task) GetSourceTag() uintptr

Gets @task's source tag. See g_task_set_source_tag().

func (*Task) GetTaskData

func (x *Task) GetTaskData() uintptr

Gets @task's `task_data`.

func (*Task) GetUserData

func (x *Task) GetUserData() uintptr

Gets the user data from a [iface@Gio.AsyncResult].

func (*Task) GoPointer

func (c *Task) GoPointer() uintptr

func (*Task) HadError

func (x *Task) HadError() bool

Tests if @task resulted in an error.

func (*Task) IsTagged

func (x *Task) IsTagged(SourceTagVar uintptr) bool

Checks if @res has the given @source_tag (generally a function pointer indicating the function @res was created by).

func (*Task) LegacyPropagateError

func (x *Task) LegacyPropagateError() (bool, error)

If @res is a [class@Gio.SimpleAsyncResult], this is equivalent to [method@Gio.SimpleAsyncResult.propagate_error]. Otherwise it returns `FALSE`.

This can be used for legacy error handling in async `*_finish()` wrapper functions that traditionally handled [class@Gio.SimpleAsyncResult] error returns themselves rather than calling into the virtual method. This should not be used in new code; [iface@Gio.AsyncResult] errors that are set by virtual methods should also be extracted by virtual methods, to enable subclasses to chain up correctly.

func (*Task) PropagateBoolean

func (x *Task) PropagateBoolean() (bool, error)

Gets the result of @task as a #gboolean.

If the task resulted in an error, or was cancelled, then this will instead return %FALSE and set @error.

Since this method transfers ownership of the return value (or error) to the caller, you may only call it once.

func (*Task) PropagateInt

func (x *Task) PropagateInt() (int, error)

Gets the result of @task as an integer (#gssize).

If the task resulted in an error, or was cancelled, then this will instead return -1 and set @error.

Since this method transfers ownership of the return value (or error) to the caller, you may only call it once.

func (*Task) PropagatePointer

func (x *Task) PropagatePointer() (uintptr, error)

Gets the result of @task as a pointer, and transfers ownership of that value to the caller.

If the task resulted in an error, or was cancelled, then this will instead return %NULL and set @error.

Since this method transfers ownership of the return value (or error) to the caller, you may only call it once.

func (*Task) PropagateValue

func (x *Task) PropagateValue(ValueVar *gobject.Value) (bool, error)

Gets the result of @task as a #GValue, and transfers ownership of that value to the caller. As with g_task_return_value(), this is a generic low-level method; g_task_propagate_pointer() and the like will usually be more useful for C code.

If the task resulted in an error, or was cancelled, then this will instead set @error and return %FALSE.

Since this method transfers ownership of the return value (or error) to the caller, you may only call it once.

func (*Task) ReturnBoolean

func (x *Task) ReturnBoolean(ResultVar bool)

Sets @task's result to @result and completes the task (see g_task_return_pointer() for more discussion of exactly what this means).

func (*Task) ReturnError

func (x *Task) ReturnError(ErrorVar *glib.Error)

Sets @task's result to @error (which @task assumes ownership of) and completes the task (see g_task_return_pointer() for more discussion of exactly what this means).

Note that since the task takes ownership of @error, and since the task may be completed before returning from g_task_return_error(), you cannot assume that @error is still valid after calling this. Call g_error_copy() on the error if you need to keep a local copy as well.

See also [method@Gio.Task.return_new_error], [method@Gio.Task.return_new_error_literal].

func (*Task) ReturnErrorIfCancelled

func (x *Task) ReturnErrorIfCancelled() bool

Checks if @task's #GCancellable has been cancelled, and if so, sets @task's error accordingly and completes the task (see g_task_return_pointer() for more discussion of exactly what this means).

func (*Task) ReturnInt

func (x *Task) ReturnInt(ResultVar int)

Sets @task's result to @result and completes the task (see g_task_return_pointer() for more discussion of exactly what this means).

func (*Task) ReturnNewError

func (x *Task) ReturnNewError(DomainVar glib.Quark, CodeVar int, FormatVar string, varArgs ...interface{})

Sets @task's result to a new #GError created from @domain, @code, @format, and the remaining arguments, and completes the task (see g_task_return_pointer() for more discussion of exactly what this means).

See also g_task_return_error().

func (*Task) ReturnNewErrorLiteral

func (x *Task) ReturnNewErrorLiteral(DomainVar glib.Quark, CodeVar int, MessageVar string)

Sets @task’s result to a new [type@GLib.Error] created from @domain, @code, @message and completes the task.

See [method@Gio.Task.return_pointer] for more discussion of exactly what ‘completing the task’ means.

See also [method@Gio.Task.return_new_error].

func (*Task) ReturnPointer

func (x *Task) ReturnPointer(ResultVar uintptr, ResultDestroyVar *glib.DestroyNotify)

Sets @task's result to @result and completes the task. If @result is not %NULL, then @result_destroy will be used to free @result if the caller does not take ownership of it with g_task_propagate_pointer().

"Completes the task" means that for an ordinary asynchronous task it will either invoke the task's callback, or else queue that callback to be invoked in the proper #GMainContext, or in the next iteration of the current #GMainContext. For a task run via g_task_run_in_thread() or g_task_run_in_thread_sync(), calling this method will save @result to be returned to the caller later, but the task will not actually be completed until the #GTaskThreadFunc exits.

Note that since the task may be completed before returning from g_task_return_pointer(), you cannot assume that @result is still valid after calling this, unless you are still holding another reference on it.

func (*Task) ReturnPrefixedError

func (x *Task) ReturnPrefixedError(ErrorVar *glib.Error, FormatVar string, varArgs ...interface{})

Sets @task's result to @error (which @task assumes ownership of), with the message prefixed according to @format, and completes the task (see g_task_return_pointer() for more discussion of exactly what this means).

Note that since the task takes ownership of @error, and since the task may be completed before returning from g_task_return_prefixed_error(), you cannot assume that @error is still valid after calling this. Call g_error_copy() on the error if you need to keep a local copy as well.

See also g_task_return_error(), g_prefix_error().

func (*Task) ReturnValue

func (x *Task) ReturnValue(ResultVar *gobject.Value)

Sets @task's result to @result (by copying it) and completes the task.

If @result is %NULL then a #GValue of type %G_TYPE_POINTER with a value of %NULL will be used for the result.

This is a very generic low-level method intended primarily for use by language bindings; for C code, g_task_return_pointer() and the like will normally be much easier to use.

func (*Task) RunInThread

func (x *Task) RunInThread(TaskFuncVar *TaskThreadFunc)

Runs @task_func in another thread. When @task_func returns, @task's #GAsyncReadyCallback will be invoked in @task's #GMainContext.

This takes a ref on @task until the task completes.

See #GTaskThreadFunc for more details about how @task_func is handled.

Although GLib currently rate-limits the tasks queued via g_task_run_in_thread(), you should not assume that it will always do this. If you have a very large number of tasks to run (several tens of tasks), but don't want them to all run at once, you should only queue a limited number of them (around ten) at a time.

Be aware that if your task depends on other tasks to complete, use of this function could lead to a livelock if the other tasks also use this function and enough of them (around 10) execute in a dependency chain, as that will exhaust the thread pool. If this situation is possible, consider using a separate worker thread or thread pool explicitly, rather than using g_task_run_in_thread().

func (*Task) RunInThreadSync

func (x *Task) RunInThreadSync(TaskFuncVar *TaskThreadFunc)

Runs @task_func in another thread, and waits for it to return or be cancelled. You can use g_task_propagate_pointer(), etc, afterward to get the result of @task_func.

See #GTaskThreadFunc for more details about how @task_func is handled.

Normally this is used with tasks created with a %NULL `callback`, but note that even if the task does have a callback, it will not be invoked when @task_func returns. #GTask:completed will be set to %TRUE just before this function returns.

Although GLib currently rate-limits the tasks queued via g_task_run_in_thread_sync(), you should not assume that it will always do this. If you have a very large number of tasks to run, but don't want them to all run at once, you should only queue a limited number of them at a time.

func (*Task) SetCheckCancellable

func (x *Task) SetCheckCancellable(CheckCancellableVar bool)

Sets or clears @task's check-cancellable flag. If this is %TRUE (the default), then g_task_propagate_pointer(), etc, and g_task_had_error() will check the task's #GCancellable first, and if it has been cancelled, then they will consider the task to have returned an "Operation was cancelled" error (%G_IO_ERROR_CANCELLED), regardless of any other error or return value the task may have had.

If @check_cancellable is %FALSE, then the #GTask will not check the cancellable itself, and it is up to @task's owner to do this (eg, via g_task_return_error_if_cancelled()).

If you are using g_task_set_return_on_cancel() as well, then you must leave check-cancellable set %TRUE.

func (*Task) SetGoPointer

func (c *Task) SetGoPointer(ptr uintptr)

func (*Task) SetName

func (x *Task) SetName(NameVar *string)

Sets @task’s name, used in debugging and profiling. The name defaults to %NULL.

The task name should describe in a human readable way what the task does. For example, ‘Open file’ or ‘Connect to network host’. It is used to set the name of the #GSource used for idle completion of the task.

This function may only be called before the @task is first used in a thread other than the one it was constructed in.

func (*Task) SetPriority

func (x *Task) SetPriority(PriorityVar int)

Sets @task's priority. If you do not call this, it will default to %G_PRIORITY_DEFAULT.

This will affect the priority of #GSources created with g_task_attach_source() and the scheduling of tasks run in threads, and can also be explicitly retrieved later via g_task_get_priority().

func (*Task) SetReturnOnCancel

func (x *Task) SetReturnOnCancel(ReturnOnCancelVar bool) bool

Sets or clears @task's return-on-cancel flag. This is only meaningful for tasks run via g_task_run_in_thread() or g_task_run_in_thread_sync().

If @return_on_cancel is %TRUE, then cancelling @task's #GCancellable will immediately cause it to return, as though the task's #GTaskThreadFunc had called g_task_return_error_if_cancelled() and then returned.

This allows you to create a cancellable wrapper around an uninterruptible function. The #GTaskThreadFunc just needs to be careful that it does not modify any externally-visible state after it has been cancelled. To do that, the thread should call g_task_set_return_on_cancel() again to (atomically) set return-on-cancel %FALSE before making externally-visible changes; if the task gets cancelled before the return-on-cancel flag could be changed, g_task_set_return_on_cancel() will indicate this by returning %FALSE.

You can disable and re-enable this flag multiple times if you wish. If the task's #GCancellable is cancelled while return-on-cancel is %FALSE, then calling g_task_set_return_on_cancel() to set it %TRUE again will cause the task to be cancelled at that point.

If the task's #GCancellable is already cancelled before you call g_task_run_in_thread()/g_task_run_in_thread_sync(), then the #GTaskThreadFunc will still be run (for consistency), but the task will also be completed right away.

func (*Task) SetSourceTag

func (x *Task) SetSourceTag(SourceTagVar uintptr)

Sets @task's source tag.

You can use this to tag a task return value with a particular pointer (usually a pointer to the function doing the tagging) and then later check it using g_task_get_source_tag() (or g_async_result_is_tagged()) in the task's "finish" function, to figure out if the response came from a particular place.

A macro wrapper around this function will automatically set the task’s name to the string form of @source_tag if it’s not already set, for convenience.

func (*Task) SetStaticName

func (x *Task) SetStaticName(NameVar *string)

Sets @task’s name, used in debugging and profiling.

This is a variant of g_task_set_name() that avoids copying @name.

This function is called automatically by [method@Gio.Task.set_source_tag] unless a name is set.

func (*Task) SetTaskData

func (x *Task) SetTaskData(TaskDataVar uintptr, TaskDataDestroyVar *glib.DestroyNotify)

Sets @task's task data (freeing the existing task data, if any).

type TaskClass

type TaskClass struct {
	// contains filtered or unexported fields
}

func (*TaskClass) GoPointer

func (x *TaskClass) GoPointer() uintptr

type TaskThreadFunc

type TaskThreadFunc func(uintptr, uintptr, uintptr, uintptr)

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.

type TcpConnection

type TcpConnection struct {
	SocketConnection
}

This is the subclass of [class@Gio.SocketConnection] that is created for TCP/IP sockets.

func TcpConnectionNewFromInternalPtr

func TcpConnectionNewFromInternalPtr(ptr uintptr) *TcpConnection

func (*TcpConnection) GetGracefulDisconnect

func (x *TcpConnection) GetGracefulDisconnect() bool

Checks if graceful disconnects are used. See g_tcp_connection_set_graceful_disconnect().

func (*TcpConnection) GetPropertyGracefulDisconnect

func (x *TcpConnection) GetPropertyGracefulDisconnect() bool

GetPropertyGracefulDisconnect gets the "graceful-disconnect" property. Whether [method@Gio.IOStream.close] does a graceful disconnect.

func (*TcpConnection) GoPointer

func (c *TcpConnection) GoPointer() uintptr

func (*TcpConnection) SetGoPointer

func (c *TcpConnection) SetGoPointer(ptr uintptr)

func (*TcpConnection) SetGracefulDisconnect

func (x *TcpConnection) SetGracefulDisconnect(GracefulDisconnectVar bool)

This enables graceful disconnects on close. A graceful disconnect means that we signal the receiving end that the connection is terminated and wait for it to close the connection before closing the connection.

A graceful disconnect means that we can be sure that we successfully sent all the outstanding data to the other end, or get an error reported. However, it also means we have to wait for all the data to reach the other side and for it to acknowledge this by closing the socket, which may take a while. For this reason it is disabled by default.

func (*TcpConnection) SetPropertyGracefulDisconnect

func (x *TcpConnection) SetPropertyGracefulDisconnect(value bool)

SetPropertyGracefulDisconnect sets the "graceful-disconnect" property. Whether [method@Gio.IOStream.close] does a graceful disconnect.

type TcpConnectionClass

type TcpConnectionClass struct {
	ParentClass SocketConnectionClass
	// contains filtered or unexported fields
}

func (*TcpConnectionClass) GoPointer

func (x *TcpConnectionClass) GoPointer() uintptr

type TcpConnectionPrivate

type TcpConnectionPrivate struct {
	// contains filtered or unexported fields
}

func (*TcpConnectionPrivate) GoPointer

func (x *TcpConnectionPrivate) GoPointer() uintptr

type TcpWrapperConnection

type TcpWrapperConnection struct {
	TcpConnection
}

A `GTcpWrapperConnection` can be used to wrap a [class@Gio.IOStream] that is based on a [class@Gio.Socket], but which is not actually a [class@Gio.SocketConnection]. This is used by [class@Gio.SocketClient] so that it can always return a [class@Gio.SocketConnection], even when the connection it has actually created is not directly a [class@Gio.SocketConnection].

func NewTcpWrapperConnection

func NewTcpWrapperConnection(BaseIoStreamVar *IOStream, SocketVar *Socket) *TcpWrapperConnection

Wraps @base_io_stream and @socket together as a #GSocketConnection.

func TcpWrapperConnectionNewFromInternalPtr

func TcpWrapperConnectionNewFromInternalPtr(ptr uintptr) *TcpWrapperConnection

func (*TcpWrapperConnection) GetBaseIoStream

func (x *TcpWrapperConnection) GetBaseIoStream() *IOStream

Gets @conn's base #GIOStream

func (*TcpWrapperConnection) GoPointer

func (c *TcpWrapperConnection) GoPointer() uintptr

func (*TcpWrapperConnection) SetGoPointer

func (c *TcpWrapperConnection) SetGoPointer(ptr uintptr)

type TcpWrapperConnectionClass

type TcpWrapperConnectionClass struct {
	ParentClass TcpConnectionClass
	// contains filtered or unexported fields
}

func (*TcpWrapperConnectionClass) GoPointer

func (x *TcpWrapperConnectionClass) GoPointer() uintptr

type TcpWrapperConnectionPrivate

type TcpWrapperConnectionPrivate struct {
	// contains filtered or unexported fields
}

func (*TcpWrapperConnectionPrivate) GoPointer

func (x *TcpWrapperConnectionPrivate) GoPointer() uintptr

type TestDBus

type TestDBus struct {
	gobject.Object
}

A helper class for testing code which uses D-Bus without touching the user’s session bus.

Note that `GTestDBus` modifies the user’s environment, calling [`setenv()`](man:setenv(3)). This is not thread-safe, so all `GTestDBus` calls should be completed before threads are spawned, or should have appropriate locking to ensure no access conflicts to environment variables shared between `GTestDBus` and other threads.

## Creating unit tests using `GTestDBus`

Testing of D-Bus services can be tricky because normally we only ever run D-Bus services over an existing instance of the D-Bus daemon thus we usually don’t activate D-Bus services that are not yet installed into the target system. The `GTestDBus` object makes this easier for us by taking care of the lower level tasks such as running a private D-Bus daemon and looking up uninstalled services in customizable locations, typically in your source code tree.

The first thing you will need is a separate service description file for the D-Bus daemon. Typically a `services` subdirectory of your `tests` directory is a good place to put this file.

The service file should list your service along with an absolute path to the uninstalled service executable in your source tree. Using autotools we would achieve this by adding a file such as `my-server.service.in` in the services directory and have it processed by configure.

``` [D-BUS Service] Name=org.gtk.GDBus.Examples.ObjectManager Exec=@abs_top_builddir@/gio/tests/gdbus-example-objectmanager-server ```

You will also need to indicate this service directory in your test fixtures, so you will need to pass the path while compiling your test cases. Typically this is done with autotools with an added preprocessor flag specified to compile your tests such as:

``` -DTEST_SERVICES=\""$(abs_top_builddir)/tests/services"\" ```

Once you have a service definition file which is local to your source tree, you can proceed to set up a GTest fixture using the `GTestDBus` scaffolding.

An example of a test fixture for D-Bus services can be found here: [gdbus-test-fixture.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-test-fixture.c)

Note that these examples only deal with isolating the D-Bus aspect of your service. To successfully run isolated unit tests on your service you may need some additional modifications to your test case fixture. For example; if your service uses [class@Gio.Settings] and installs a schema then it is important that your test service not load the schema in the ordinary installed location (chances are that your service and schema files are not yet installed, or worse; there is an older version of the schema file sitting in the install location).

Most of the time we can work around these obstacles using the environment. Since the environment is inherited by the D-Bus daemon created by `GTestDBus` and then in turn inherited by any services the D-Bus daemon activates, using the setup routine for your fixture is a practical place to help sandbox your runtime environment. For the rather typical GSettings case we can work around this by setting `GSETTINGS_SCHEMA_DIR` to the in tree directory holding your schemas in the above `fixture_setup()` routine.

The GSettings schemas need to be locally pre-compiled for this to work. This can be achieved by compiling the schemas locally as a step before running test cases, an autotools setup might do the following in the directory holding schemas:

```

all-am:
        $(GLIB_COMPILE_SCHEMAS) .

CLEANFILES += gschemas.compiled

```

func NewTestDBus

func NewTestDBus(FlagsVar TestDBusFlags) *TestDBus

Create a new #GTestDBus object.

func TestDBusNewFromInternalPtr

func TestDBusNewFromInternalPtr(ptr uintptr) *TestDBus

func (*TestDBus) AddServiceDir

func (x *TestDBus) AddServiceDir(PathVar string)

Add a path where dbus-daemon will look up .service files. This can't be called after g_test_dbus_up().

func (*TestDBus) Down

func (x *TestDBus) Down()

Stop the session bus started by g_test_dbus_up().

This will wait for the singleton returned by g_bus_get() or g_bus_get_sync() to be destroyed. This is done to ensure that the next unit test won't get a leaked singleton from this test.

func (*TestDBus) GetBusAddress

func (x *TestDBus) GetBusAddress() string

Get the address on which dbus-daemon is running. If g_test_dbus_up() has not been called yet, %NULL is returned. This can be used with g_dbus_connection_new_for_address().

func (*TestDBus) GetFlags

func (x *TestDBus) GetFlags() TestDBusFlags

Get the flags of the #GTestDBus object.

func (*TestDBus) GoPointer

func (c *TestDBus) GoPointer() uintptr

func (*TestDBus) SetGoPointer

func (c *TestDBus) SetGoPointer(ptr uintptr)

func (*TestDBus) Stop

func (x *TestDBus) Stop()

Stop the session bus started by g_test_dbus_up().

Unlike g_test_dbus_down(), this won't verify the #GDBusConnection singleton returned by g_bus_get() or g_bus_get_sync() is destroyed. Unit tests wanting to verify behaviour after the session bus has been stopped can use this function but should still call g_test_dbus_down() when done.

func (*TestDBus) Up

func (x *TestDBus) Up()

Start a dbus-daemon instance and set DBUS_SESSION_BUS_ADDRESS. After this call, it is safe for unit tests to start sending messages on the session bus.

If this function is called from setup callback of g_test_add(), g_test_dbus_down() must be called in its teardown callback.

If this function is called from unit test's main(), then g_test_dbus_down() must be called after g_test_run().

type TestDBusFlags

type TestDBusFlags int

Flags to define future #GTestDBus behaviour.

const (

	// No flags.
	GTestDbusNoneValue TestDBusFlags = 0
)

type ThemedIcon

type ThemedIcon struct {
	gobject.Object
}

`GThemedIcon` is an implementation of [iface@Gio.Icon] that supports icon themes.

`GThemedIcon` contains a list of all of the icons present in an icon theme, so that icons can be looked up quickly. `GThemedIcon` does not provide actual pixmaps for icons, just the icon names. Ideally something like [method@Gtk.IconTheme.choose_icon] should be used to resolve the list of names so that fallback icons work nicely with themes that inherit other themes.

func NewThemedIcon

func NewThemedIcon(IconnameVar string) *ThemedIcon

Creates a new themed icon for @iconname.

func NewThemedIconFromNames

func NewThemedIconFromNames(IconnamesVar []string, LenVar int) *ThemedIcon

Creates a new themed icon for @iconnames.

func NewThemedIconWithDefaultFallbacks

func NewThemedIconWithDefaultFallbacks(IconnameVar string) *ThemedIcon

Creates a new themed icon for @iconname, and all the names that can be created by shortening @iconname at '-' characters.

In the following example, @icon1 and @icon2 are equivalent: |[<!-- language="C" -->

const char *names[] = {
  "gnome-dev-cdrom-audio",
  "gnome-dev-cdrom",
  "gnome-dev",
  "gnome"
};

icon1 = g_themed_icon_new_from_names (names, 4); icon2 = g_themed_icon_new_with_default_fallbacks ("gnome-dev-cdrom-audio"); ]|

func ThemedIconNewFromInternalPtr

func ThemedIconNewFromInternalPtr(ptr uintptr) *ThemedIcon

func (*ThemedIcon) AppendName

func (x *ThemedIcon) AppendName(IconnameVar string)

Append a name to the list of icons from within @icon.

Note that doing so invalidates the hash computed by prior calls to g_icon_hash().

func (*ThemedIcon) Equal

func (x *ThemedIcon) Equal(Icon2Var Icon) bool

Checks if two icons are equal.

func (*ThemedIcon) GetNames

func (x *ThemedIcon) GetNames() []string

Gets the names of icons from within @icon.

func (*ThemedIcon) GetPropertyNames

func (x *ThemedIcon) GetPropertyNames() []string

GetPropertyNames gets the "names" property. A %NULL-terminated array of icon names.

func (*ThemedIcon) GetPropertyUseDefaultFallbacks

func (x *ThemedIcon) GetPropertyUseDefaultFallbacks() bool

GetPropertyUseDefaultFallbacks gets the "use-default-fallbacks" property. Whether to use the default fallbacks found by shortening the icon name at '-' characters. If the "names" array has more than one element, ignores any past the first.

For example, if the icon name was "gnome-dev-cdrom-audio", the array would become |[<!-- language="C" -->

{
  "gnome-dev-cdrom-audio",
  "gnome-dev-cdrom",
  "gnome-dev",
  "gnome",
  NULL
};

]|

func (*ThemedIcon) GoPointer

func (c *ThemedIcon) GoPointer() uintptr

func (*ThemedIcon) Hash

func (x *ThemedIcon) Hash() uint

Gets a hash for an icon.

func (*ThemedIcon) PrependName

func (x *ThemedIcon) PrependName(IconnameVar string)

Prepend a name to the list of icons from within @icon.

Note that doing so invalidates the hash computed by prior calls to g_icon_hash().

func (*ThemedIcon) Serialize

func (x *ThemedIcon) Serialize() *glib.Variant

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.

func (*ThemedIcon) SetGoPointer

func (c *ThemedIcon) SetGoPointer(ptr uintptr)

func (*ThemedIcon) SetPropertyName

func (x *ThemedIcon) SetPropertyName(value string)

SetPropertyName sets the "name" property. The icon name.

func (*ThemedIcon) SetPropertyNames

func (x *ThemedIcon) SetPropertyNames(value []string)

SetPropertyNames sets the "names" property. A %NULL-terminated array of icon names.

func (*ThemedIcon) SetPropertyUseDefaultFallbacks

func (x *ThemedIcon) SetPropertyUseDefaultFallbacks(value bool)

SetPropertyUseDefaultFallbacks sets the "use-default-fallbacks" property. Whether to use the default fallbacks found by shortening the icon name at '-' characters. If the "names" array has more than one element, ignores any past the first.

For example, if the icon name was "gnome-dev-cdrom-audio", the array would become |[<!-- language="C" -->

{
  "gnome-dev-cdrom-audio",
  "gnome-dev-cdrom",
  "gnome-dev",
  "gnome",
  NULL
};

]|

func (*ThemedIcon) ToString

func (x *ThemedIcon) ToString() string

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`).

type ThemedIconClass

type ThemedIconClass struct {
	// contains filtered or unexported fields
}

func (*ThemedIconClass) GoPointer

func (x *ThemedIconClass) GoPointer() uintptr

type ThreadedResolver

type ThreadedResolver struct {
	Resolver
}

#GThreadedResolver is an implementation of #GResolver which calls the libc lookup functions in threads to allow them to run asynchronously.

func ThreadedResolverNewFromInternalPtr

func ThreadedResolverNewFromInternalPtr(ptr uintptr) *ThreadedResolver

func (*ThreadedResolver) GoPointer

func (c *ThreadedResolver) GoPointer() uintptr

func (*ThreadedResolver) SetGoPointer

func (c *ThreadedResolver) SetGoPointer(ptr uintptr)

type ThreadedResolverClass

type ThreadedResolverClass struct {
	ParentClass ResolverClass
	// contains filtered or unexported fields
}

func (*ThreadedResolverClass) GoPointer

func (x *ThreadedResolverClass) GoPointer() uintptr

type ThreadedSocketService

type ThreadedSocketService struct {
	SocketService
}

A `GThreadedSocketService` is a simple subclass of [class@Gio.SocketService] that handles incoming connections by creating a worker thread and dispatching the connection to it by emitting the [signal@Gio.ThreadedSocketService::run signal] in the new thread.

The signal handler may perform blocking I/O and need not return until the connection is closed.

The service is implemented using a thread pool, so there is a limited amount of threads available to serve incoming requests. The service automatically stops the [class@Gio.SocketService] from accepting new connections when all threads are busy.

As with [class@Gio.SocketService], you may connect to [signal@Gio.ThreadedSocketService::run], or subclass and override the default handler.

func NewThreadedSocketService

func NewThreadedSocketService(MaxThreadsVar int) *ThreadedSocketService

Creates a new #GThreadedSocketService with no listeners. Listeners must be added with one of the #GSocketListener "add" methods.

func ThreadedSocketServiceNewFromInternalPtr

func ThreadedSocketServiceNewFromInternalPtr(ptr uintptr) *ThreadedSocketService

func (*ThreadedSocketService) ConnectRun

The ::run signal is emitted in a worker thread in response to an incoming connection. This thread is dedicated to handling @connection and may perform blocking IO. The signal handler need not return until the connection is closed.

func (*ThreadedSocketService) GetPropertyMaxThreads

func (x *ThreadedSocketService) GetPropertyMaxThreads() int

GetPropertyMaxThreads gets the "max-threads" property. The maximum number of threads handling clients for this service.

func (*ThreadedSocketService) GoPointer

func (c *ThreadedSocketService) GoPointer() uintptr

func (*ThreadedSocketService) SetGoPointer

func (c *ThreadedSocketService) SetGoPointer(ptr uintptr)

func (*ThreadedSocketService) SetPropertyMaxThreads

func (x *ThreadedSocketService) SetPropertyMaxThreads(value int)

SetPropertyMaxThreads sets the "max-threads" property. The maximum number of threads handling clients for this service.

type ThreadedSocketServiceClass

type ThreadedSocketServiceClass struct {
	ParentClass SocketServiceClass
	// contains filtered or unexported fields
}

func (*ThreadedSocketServiceClass) GetGReserved1

func (x *ThreadedSocketServiceClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*ThreadedSocketServiceClass) GetGReserved2

func (x *ThreadedSocketServiceClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*ThreadedSocketServiceClass) GetGReserved3

func (x *ThreadedSocketServiceClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*ThreadedSocketServiceClass) GetGReserved4

func (x *ThreadedSocketServiceClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*ThreadedSocketServiceClass) GetGReserved5

func (x *ThreadedSocketServiceClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*ThreadedSocketServiceClass) GetRun

GetRun gets the "run" callback function.

func (*ThreadedSocketServiceClass) GoPointer

func (x *ThreadedSocketServiceClass) GoPointer() uintptr

func (*ThreadedSocketServiceClass) OverrideGReserved1

func (x *ThreadedSocketServiceClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*ThreadedSocketServiceClass) OverrideGReserved2

func (x *ThreadedSocketServiceClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*ThreadedSocketServiceClass) OverrideGReserved3

func (x *ThreadedSocketServiceClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*ThreadedSocketServiceClass) OverrideGReserved4

func (x *ThreadedSocketServiceClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*ThreadedSocketServiceClass) OverrideGReserved5

func (x *ThreadedSocketServiceClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

func (*ThreadedSocketServiceClass) OverrideRun

OverrideRun sets the "run" callback function.

type ThreadedSocketServicePrivate

type ThreadedSocketServicePrivate struct {
	// contains filtered or unexported fields
}

func (*ThreadedSocketServicePrivate) GoPointer

func (x *ThreadedSocketServicePrivate) GoPointer() uintptr

type TlsAuthenticationMode

type TlsAuthenticationMode int

The client authentication mode for a #GTlsServerConnection.

const (

	// client authentication not required
	GTlsAuthenticationNoneValue TlsAuthenticationMode = 0
	// client authentication is requested
	GTlsAuthenticationRequestedValue TlsAuthenticationMode = 1
	// client authentication is required
	GTlsAuthenticationRequiredValue TlsAuthenticationMode = 2
)

type TlsBackend

type TlsBackend interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	GetCertificateType() types.GType
	GetClientConnectionType() types.GType
	GetDefaultDatabase() *TlsDatabase
	GetDtlsClientConnectionType() types.GType
	GetDtlsServerConnectionType() types.GType
	GetFileDatabaseType() types.GType
	GetServerConnectionType() types.GType
	SetDefaultDatabase(DatabaseVar *TlsDatabase)
	SupportsDtls() bool
	SupportsTls() bool
}

TLS (Transport Layer Security, aka SSL) and DTLS backend. This is an internal type used to coordinate the different classes implemented by a TLS backend.

type TlsBackendBase

type TlsBackendBase struct {
	Ptr uintptr
}

func TlsBackendGetDefault

func TlsBackendGetDefault() *TlsBackendBase

Gets the default #GTlsBackend for the system.

func (*TlsBackendBase) GetCertificateType

func (x *TlsBackendBase) GetCertificateType() types.GType

Gets the #GType of @backend's #GTlsCertificate implementation.

func (*TlsBackendBase) GetClientConnectionType

func (x *TlsBackendBase) GetClientConnectionType() types.GType

Gets the #GType of @backend's #GTlsClientConnection implementation.

func (*TlsBackendBase) GetDefaultDatabase

func (x *TlsBackendBase) GetDefaultDatabase() *TlsDatabase

Gets the default #GTlsDatabase used to verify TLS connections.

func (*TlsBackendBase) GetDtlsClientConnectionType

func (x *TlsBackendBase) GetDtlsClientConnectionType() types.GType

Gets the #GType of @backend’s #GDtlsClientConnection implementation.

func (*TlsBackendBase) GetDtlsServerConnectionType

func (x *TlsBackendBase) GetDtlsServerConnectionType() types.GType

Gets the #GType of @backend’s #GDtlsServerConnection implementation.

func (*TlsBackendBase) GetFileDatabaseType

func (x *TlsBackendBase) GetFileDatabaseType() types.GType

Gets the #GType of @backend's #GTlsFileDatabase implementation.

func (*TlsBackendBase) GetServerConnectionType

func (x *TlsBackendBase) GetServerConnectionType() types.GType

Gets the #GType of @backend's #GTlsServerConnection implementation.

func (*TlsBackendBase) GoPointer

func (x *TlsBackendBase) GoPointer() uintptr

func (*TlsBackendBase) SetDefaultDatabase

func (x *TlsBackendBase) SetDefaultDatabase(DatabaseVar *TlsDatabase)

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.

func (*TlsBackendBase) SetGoPointer

func (x *TlsBackendBase) SetGoPointer(ptr uintptr)

func (*TlsBackendBase) SupportsDtls

func (x *TlsBackendBase) SupportsDtls() bool

Checks if DTLS is supported. DTLS support may not be available even if TLS support is available, and vice-versa.

func (*TlsBackendBase) SupportsTls

func (x *TlsBackendBase) SupportsTls() bool

Checks if TLS is supported; if this returns %FALSE for the default #GTlsBackend, it means no "real" TLS backend is available.

type TlsBackendInterface

type TlsBackendInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

Provides an interface for describing TLS-related types.

func (*TlsBackendInterface) GetGetCertificateType

func (x *TlsBackendInterface) GetGetCertificateType() func() types.GType

GetGetCertificateType gets the "get_certificate_type" callback function. returns the #GTlsCertificate implementation type

func (*TlsBackendInterface) GetGetClientConnectionType

func (x *TlsBackendInterface) GetGetClientConnectionType() func() types.GType

GetGetClientConnectionType gets the "get_client_connection_type" callback function. returns the #GTlsClientConnection implementation type

func (*TlsBackendInterface) GetGetDefaultDatabase

func (x *TlsBackendInterface) GetGetDefaultDatabase() func(TlsBackend) *TlsDatabase

GetGetDefaultDatabase gets the "get_default_database" callback function. returns a default #GTlsDatabase instance.

func (*TlsBackendInterface) GetGetDtlsClientConnectionType

func (x *TlsBackendInterface) GetGetDtlsClientConnectionType() func() types.GType

GetGetDtlsClientConnectionType gets the "get_dtls_client_connection_type" callback function. returns the #GDtlsClientConnection implementation type

func (*TlsBackendInterface) GetGetDtlsServerConnectionType

func (x *TlsBackendInterface) GetGetDtlsServerConnectionType() func() types.GType

GetGetDtlsServerConnectionType gets the "get_dtls_server_connection_type" callback function. returns the #GDtlsServerConnection implementation type

func (*TlsBackendInterface) GetGetFileDatabaseType

func (x *TlsBackendInterface) GetGetFileDatabaseType() func() types.GType

GetGetFileDatabaseType gets the "get_file_database_type" callback function. returns the #GTlsFileDatabase implementation type.

func (*TlsBackendInterface) GetGetServerConnectionType

func (x *TlsBackendInterface) GetGetServerConnectionType() func() types.GType

GetGetServerConnectionType gets the "get_server_connection_type" callback function. returns the #GTlsServerConnection implementation type

func (*TlsBackendInterface) GetSupportsDtls

func (x *TlsBackendInterface) GetSupportsDtls() func(TlsBackend) bool

GetSupportsDtls gets the "supports_dtls" callback function. returns whether the backend supports DTLS

func (*TlsBackendInterface) GetSupportsTls

func (x *TlsBackendInterface) GetSupportsTls() func(TlsBackend) bool

GetSupportsTls gets the "supports_tls" callback function. returns whether the backend supports TLS.

func (*TlsBackendInterface) GoPointer

func (x *TlsBackendInterface) GoPointer() uintptr

func (*TlsBackendInterface) OverrideGetCertificateType

func (x *TlsBackendInterface) OverrideGetCertificateType(cb func() types.GType)

OverrideGetCertificateType sets the "get_certificate_type" callback function. returns the #GTlsCertificate implementation type

func (*TlsBackendInterface) OverrideGetClientConnectionType

func (x *TlsBackendInterface) OverrideGetClientConnectionType(cb func() types.GType)

OverrideGetClientConnectionType sets the "get_client_connection_type" callback function. returns the #GTlsClientConnection implementation type

func (*TlsBackendInterface) OverrideGetDefaultDatabase

func (x *TlsBackendInterface) OverrideGetDefaultDatabase(cb func(TlsBackend) *TlsDatabase)

OverrideGetDefaultDatabase sets the "get_default_database" callback function. returns a default #GTlsDatabase instance.

func (*TlsBackendInterface) OverrideGetDtlsClientConnectionType

func (x *TlsBackendInterface) OverrideGetDtlsClientConnectionType(cb func() types.GType)

OverrideGetDtlsClientConnectionType sets the "get_dtls_client_connection_type" callback function. returns the #GDtlsClientConnection implementation type

func (*TlsBackendInterface) OverrideGetDtlsServerConnectionType

func (x *TlsBackendInterface) OverrideGetDtlsServerConnectionType(cb func() types.GType)

OverrideGetDtlsServerConnectionType sets the "get_dtls_server_connection_type" callback function. returns the #GDtlsServerConnection implementation type

func (*TlsBackendInterface) OverrideGetFileDatabaseType

func (x *TlsBackendInterface) OverrideGetFileDatabaseType(cb func() types.GType)

OverrideGetFileDatabaseType sets the "get_file_database_type" callback function. returns the #GTlsFileDatabase implementation type.

func (*TlsBackendInterface) OverrideGetServerConnectionType

func (x *TlsBackendInterface) OverrideGetServerConnectionType(cb func() types.GType)

OverrideGetServerConnectionType sets the "get_server_connection_type" callback function. returns the #GTlsServerConnection implementation type

func (*TlsBackendInterface) OverrideSupportsDtls

func (x *TlsBackendInterface) OverrideSupportsDtls(cb func(TlsBackend) bool)

OverrideSupportsDtls sets the "supports_dtls" callback function. returns whether the backend supports DTLS

func (*TlsBackendInterface) OverrideSupportsTls

func (x *TlsBackendInterface) OverrideSupportsTls(cb func(TlsBackend) bool)

OverrideSupportsTls sets the "supports_tls" callback function. returns whether the backend supports TLS.

type TlsCertificate

type TlsCertificate struct {
	gobject.Object
}

A certificate used for TLS authentication and encryption. This can represent either a certificate only (eg, the certificate received by a client from a server), or the combination of a certificate and a private key (which is needed when acting as a [iface@Gio.TlsServerConnection]).

func NewTlsCertificateFromFile

func NewTlsCertificateFromFile(FileVar string) (*TlsCertificate, error)

Creates a #GTlsCertificate from the data in @file.

As of 2.72, if the filename ends in `.p12` or `.pfx` the data is loaded by g_tls_certificate_new_from_pkcs12() otherwise it is loaded by g_tls_certificate_new_from_pem(). See those functions for exact details.

If @file cannot be read or parsed, the function will return %NULL and set @error.

func NewTlsCertificateFromFileWithPassword

func NewTlsCertificateFromFileWithPassword(FileVar string, PasswordVar string) (*TlsCertificate, error)

Creates a #GTlsCertificate from the data in @file.

If @file cannot be read or parsed, the function will return %NULL and set @error.

Any unknown file types will error with %G_IO_ERROR_NOT_SUPPORTED. Currently only `.p12` and `.pfx` files are supported. See g_tls_certificate_new_from_pkcs12() for more details.

func NewTlsCertificateFromFiles

func NewTlsCertificateFromFiles(CertFileVar string, KeyFileVar string) (*TlsCertificate, error)

Creates a #GTlsCertificate from the PEM-encoded data in @cert_file and @key_file. The returned certificate will be the first certificate found in @cert_file. As of GLib 2.44, if @cert_file contains more certificates it will try to load a certificate chain. All certificates will be verified in the order found (top-level certificate should be the last one in the file) and the #GTlsCertificate:issuer property of each certificate will be set accordingly if the verification succeeds. If any certificate in the chain cannot be verified, the first certificate in the file will still be returned.

If either file cannot be read or parsed, the function will return %NULL and set @error. Otherwise, this behaves like g_tls_certificate_new_from_pem().

func NewTlsCertificateFromPem

func NewTlsCertificateFromPem(DataVar string, LengthVar int) (*TlsCertificate, error)

Creates a #GTlsCertificate from the PEM-encoded data in @data. If @data includes both a certificate and a private key, then the returned certificate will include the private key data as well. (See the #GTlsCertificate:private-key-pem property for information about supported formats.)

The returned certificate will be the first certificate found in @data. As of GLib 2.44, if @data contains more certificates it will try to load a certificate chain. All certificates will be verified in the order found (top-level certificate should be the last one in the file) and the #GTlsCertificate:issuer property of each certificate will be set accordingly if the verification succeeds. If any certificate in the chain cannot be verified, the first certificate in the file will still be returned.

func NewTlsCertificateFromPkcs11Uris

func NewTlsCertificateFromPkcs11Uris(Pkcs11UriVar string, PrivateKeyPkcs11UriVar *string) (*TlsCertificate, error)

Creates a #GTlsCertificate from a [PKCS \#11](https://docs.oasis-open.org/pkcs11/pkcs11-base/v3.0/os/pkcs11-base-v3.0-os.html) URI.

An example @pkcs11_uri would be `pkcs11:model=Model;manufacturer=Manufacture;serial=1;token=My%20Client%20Certificate;id=%01`

Where the token’s layout is:

|[ Object 0:

URL: pkcs11:model=Model;manufacturer=Manufacture;serial=1;token=My%20Client%20Certificate;id=%01;object=private%20key;type=private
Type: Private key (RSA-2048)
ID: 01

Object 1:

URL: pkcs11:model=Model;manufacturer=Manufacture;serial=1;token=My%20Client%20Certificate;id=%01;object=Certificate%20for%20Authentication;type=cert
Type: X.509 Certificate (RSA-2048)
ID: 01

]|

In this case the certificate and private key would both be detected and used as expected. @pkcs_uri may also just reference an X.509 certificate object and then optionally @private_key_pkcs11_uri allows using a private key exposed under a different URI.

Note that the private key is not accessed until usage and may fail or require a PIN later.

func NewTlsCertificateFromPkcs12

func NewTlsCertificateFromPkcs12(DataVar []byte, LengthVar uint, PasswordVar *string) (*TlsCertificate, error)

Creates a #GTlsCertificate from the data in @data. It must contain a certificate and matching private key.

If extra certificates are included they will be verified as a chain and the #GTlsCertificate:issuer property will be set. All other data will be ignored.

You can pass as single password for all of the data which will be used both for the PKCS #12 container as well as encrypted private keys. If decryption fails it will error with %G_TLS_ERROR_BAD_CERTIFICATE_PASSWORD.

This constructor requires support in the current #GTlsBackend. If support is missing it will error with %G_IO_ERROR_NOT_SUPPORTED.

Other parsing failures will error with %G_TLS_ERROR_BAD_CERTIFICATE.

func TlsCertificateNewFromInternalPtr

func TlsCertificateNewFromInternalPtr(ptr uintptr) *TlsCertificate

func (*TlsCertificate) GetDnsNames

func (x *TlsCertificate) GetDnsNames() uintptr

Gets the value of #GTlsCertificate:dns-names.

func (*TlsCertificate) GetIpAddresses

func (x *TlsCertificate) GetIpAddresses() uintptr

Gets the value of #GTlsCertificate:ip-addresses.

func (*TlsCertificate) GetIssuer

func (x *TlsCertificate) GetIssuer() *TlsCertificate

Gets the #GTlsCertificate representing @cert's issuer, if known

func (*TlsCertificate) GetIssuerName

func (x *TlsCertificate) GetIssuerName() string

Returns the issuer name from the certificate.

func (*TlsCertificate) GetNotValidAfter

func (x *TlsCertificate) GetNotValidAfter() *glib.DateTime

Returns the time at which the certificate became or will become invalid.

func (*TlsCertificate) GetNotValidBefore

func (x *TlsCertificate) GetNotValidBefore() *glib.DateTime

Returns the time at which the certificate became or will become valid.

func (*TlsCertificate) GetPropertyCertificate

func (x *TlsCertificate) GetPropertyCertificate() []byte

GetPropertyCertificate gets the "certificate" property. The DER (binary) encoded representation of the certificate. This property and the #GTlsCertificate:certificate-pem property represent the same data, just in different forms.

func (*TlsCertificate) GetPropertyCertificatePem

func (x *TlsCertificate) GetPropertyCertificatePem() string

GetPropertyCertificatePem gets the "certificate-pem" property. The PEM (ASCII) encoded representation of the certificate. This property and the #GTlsCertificate:certificate property represent the same data, just in different forms.

func (*TlsCertificate) GetPropertyDnsNames

func (x *TlsCertificate) GetPropertyDnsNames() []uintptr

GetPropertyDnsNames gets the "dns-names" property. The DNS names from the certificate's Subject Alternative Names (SANs), %NULL if unavailable.

func (*TlsCertificate) GetPropertyIpAddresses

func (x *TlsCertificate) GetPropertyIpAddresses() []uintptr

GetPropertyIpAddresses gets the "ip-addresses" property. The IP addresses from the certificate's Subject Alternative Names (SANs), %NULL if unavailable.

func (*TlsCertificate) GetPropertyIssuerName

func (x *TlsCertificate) GetPropertyIssuerName() string

GetPropertyIssuerName gets the "issuer-name" property. The issuer from the certificate, %NULL if unavailable.

func (*TlsCertificate) GetPropertyNotValidAfter

func (x *TlsCertificate) GetPropertyNotValidAfter() uintptr

GetPropertyNotValidAfter gets the "not-valid-after" property. The time at which this cert is no longer valid, %NULL if unavailable.

func (*TlsCertificate) GetPropertyNotValidBefore

func (x *TlsCertificate) GetPropertyNotValidBefore() uintptr

GetPropertyNotValidBefore gets the "not-valid-before" property. The time at which this cert is considered to be valid, %NULL if unavailable.

func (*TlsCertificate) GetPropertyPkcs11Uri

func (x *TlsCertificate) GetPropertyPkcs11Uri() string

GetPropertyPkcs11Uri gets the "pkcs11-uri" property. A URI referencing the [PKCS \#11](https://docs.oasis-open.org/pkcs11/pkcs11-base/v3.0/os/pkcs11-base-v3.0-os.html) objects containing an X.509 certificate and optionally a private key.

If %NULL, the certificate is either not backed by PKCS \#11 or the #GTlsBackend does not support PKCS \#11.

func (*TlsCertificate) GetPropertyPrivateKey

func (x *TlsCertificate) GetPropertyPrivateKey() []byte

GetPropertyPrivateKey gets the "private-key" property. The DER (binary) encoded representation of the certificate's private key, in either [PKCS \#1 format](https://datatracker.ietf.org/doc/html/rfc8017) or unencrypted [PKCS \#8 format.](https://datatracker.ietf.org/doc/html/rfc5208) PKCS \#8 format is supported since 2.32; earlier releases only support PKCS \#1. You can use the `openssl rsa` tool to convert PKCS \#8 keys to PKCS \#1.

This property (or the #GTlsCertificate:private-key-pem property) can be set when constructing a key (for example, from a file). Since GLib 2.70, it is now also readable; however, be aware that if the private key is backed by a PKCS \#11 URI – for example, if it is stored on a smartcard – then this property will be %NULL. If so, the private key must be referenced via its PKCS \#11 URI, #GTlsCertificate:private-key-pkcs11-uri. You must check both properties to see if the certificate really has a private key. When this property is read, the output format will be unencrypted PKCS \#8.

func (*TlsCertificate) GetPropertyPrivateKeyPem

func (x *TlsCertificate) GetPropertyPrivateKeyPem() string

GetPropertyPrivateKeyPem gets the "private-key-pem" property. The PEM (ASCII) encoded representation of the certificate's private key in either [PKCS \#1 format](https://datatracker.ietf.org/doc/html/rfc8017) ("`BEGIN RSA PRIVATE KEY`") or unencrypted [PKCS \#8 format](https://datatracker.ietf.org/doc/html/rfc5208) ("`BEGIN PRIVATE KEY`"). PKCS \#8 format is supported since 2.32; earlier releases only support PKCS \#1. You can use the `openssl rsa` tool to convert PKCS \#8 keys to PKCS \#1.

This property (or the #GTlsCertificate:private-key property) can be set when constructing a key (for example, from a file). Since GLib 2.70, it is now also readable; however, be aware that if the private key is backed by a PKCS \#11 URI - for example, if it is stored on a smartcard - then this property will be %NULL. If so, the private key must be referenced via its PKCS \#11 URI, #GTlsCertificate:private-key-pkcs11-uri. You must check both properties to see if the certificate really has a private key. When this property is read, the output format will be unencrypted PKCS \#8.

func (*TlsCertificate) GetPropertyPrivateKeyPkcs11Uri

func (x *TlsCertificate) GetPropertyPrivateKeyPkcs11Uri() string

GetPropertyPrivateKeyPkcs11Uri gets the "private-key-pkcs11-uri" property. A URI referencing a [PKCS \#11](https://docs.oasis-open.org/pkcs11/pkcs11-base/v3.0/os/pkcs11-base-v3.0-os.html) object containing a private key.

func (*TlsCertificate) GetPropertySubjectName

func (x *TlsCertificate) GetPropertySubjectName() string

GetPropertySubjectName gets the "subject-name" property. The subject from the cert, %NULL if unavailable.

func (*TlsCertificate) GetSubjectName

func (x *TlsCertificate) GetSubjectName() string

Returns the subject name from the certificate.

func (*TlsCertificate) GoPointer

func (c *TlsCertificate) GoPointer() uintptr

func (*TlsCertificate) IsSame

func (x *TlsCertificate) IsSame(CertTwoVar *TlsCertificate) bool

Check if two #GTlsCertificate objects represent the same certificate. The raw DER byte data of the two certificates are checked for equality. This has the effect that two certificates may compare equal even if their #GTlsCertificate:issuer, #GTlsCertificate:private-key, or #GTlsCertificate:private-key-pem properties differ.

func (*TlsCertificate) SetGoPointer

func (c *TlsCertificate) SetGoPointer(ptr uintptr)

func (*TlsCertificate) SetPropertyCertificate

func (x *TlsCertificate) SetPropertyCertificate(value []byte)

SetPropertyCertificate sets the "certificate" property. The DER (binary) encoded representation of the certificate. This property and the #GTlsCertificate:certificate-pem property represent the same data, just in different forms.

func (*TlsCertificate) SetPropertyCertificatePem

func (x *TlsCertificate) SetPropertyCertificatePem(value string)

SetPropertyCertificatePem sets the "certificate-pem" property. The PEM (ASCII) encoded representation of the certificate. This property and the #GTlsCertificate:certificate property represent the same data, just in different forms.

func (*TlsCertificate) SetPropertyPassword

func (x *TlsCertificate) SetPropertyPassword(value string)

SetPropertyPassword sets the "password" property. An optional password used when constructed with GTlsCertificate:pkcs12-data.

func (*TlsCertificate) SetPropertyPkcs11Uri

func (x *TlsCertificate) SetPropertyPkcs11Uri(value string)

SetPropertyPkcs11Uri sets the "pkcs11-uri" property. A URI referencing the [PKCS \#11](https://docs.oasis-open.org/pkcs11/pkcs11-base/v3.0/os/pkcs11-base-v3.0-os.html) objects containing an X.509 certificate and optionally a private key.

If %NULL, the certificate is either not backed by PKCS \#11 or the #GTlsBackend does not support PKCS \#11.

func (*TlsCertificate) SetPropertyPkcs12Data

func (x *TlsCertificate) SetPropertyPkcs12Data(value []byte)

SetPropertyPkcs12Data sets the "pkcs12-data" property. The PKCS #12 formatted data used to construct the object.

See also: g_tls_certificate_new_from_pkcs12()

func (*TlsCertificate) SetPropertyPrivateKey

func (x *TlsCertificate) SetPropertyPrivateKey(value []byte)

SetPropertyPrivateKey sets the "private-key" property. The DER (binary) encoded representation of the certificate's private key, in either [PKCS \#1 format](https://datatracker.ietf.org/doc/html/rfc8017) or unencrypted [PKCS \#8 format.](https://datatracker.ietf.org/doc/html/rfc5208) PKCS \#8 format is supported since 2.32; earlier releases only support PKCS \#1. You can use the `openssl rsa` tool to convert PKCS \#8 keys to PKCS \#1.

This property (or the #GTlsCertificate:private-key-pem property) can be set when constructing a key (for example, from a file). Since GLib 2.70, it is now also readable; however, be aware that if the private key is backed by a PKCS \#11 URI – for example, if it is stored on a smartcard – then this property will be %NULL. If so, the private key must be referenced via its PKCS \#11 URI, #GTlsCertificate:private-key-pkcs11-uri. You must check both properties to see if the certificate really has a private key. When this property is read, the output format will be unencrypted PKCS \#8.

func (*TlsCertificate) SetPropertyPrivateKeyPem

func (x *TlsCertificate) SetPropertyPrivateKeyPem(value string)

SetPropertyPrivateKeyPem sets the "private-key-pem" property. The PEM (ASCII) encoded representation of the certificate's private key in either [PKCS \#1 format](https://datatracker.ietf.org/doc/html/rfc8017) ("`BEGIN RSA PRIVATE KEY`") or unencrypted [PKCS \#8 format](https://datatracker.ietf.org/doc/html/rfc5208) ("`BEGIN PRIVATE KEY`"). PKCS \#8 format is supported since 2.32; earlier releases only support PKCS \#1. You can use the `openssl rsa` tool to convert PKCS \#8 keys to PKCS \#1.

This property (or the #GTlsCertificate:private-key property) can be set when constructing a key (for example, from a file). Since GLib 2.70, it is now also readable; however, be aware that if the private key is backed by a PKCS \#11 URI - for example, if it is stored on a smartcard - then this property will be %NULL. If so, the private key must be referenced via its PKCS \#11 URI, #GTlsCertificate:private-key-pkcs11-uri. You must check both properties to see if the certificate really has a private key. When this property is read, the output format will be unencrypted PKCS \#8.

func (*TlsCertificate) SetPropertyPrivateKeyPkcs11Uri

func (x *TlsCertificate) SetPropertyPrivateKeyPkcs11Uri(value string)

SetPropertyPrivateKeyPkcs11Uri sets the "private-key-pkcs11-uri" property. A URI referencing a [PKCS \#11](https://docs.oasis-open.org/pkcs11/pkcs11-base/v3.0/os/pkcs11-base-v3.0-os.html) object containing a private key.

func (*TlsCertificate) Verify

func (x *TlsCertificate) Verify(IdentityVar SocketConnectable, TrustedCaVar *TlsCertificate) TlsCertificateFlags

This verifies @cert and returns a set of #GTlsCertificateFlags indicating any problems found with it. This can be used to verify a certificate outside the context of making a connection, or to check a certificate against a CA that is not part of the system CA database.

If @cert is valid, %G_TLS_CERTIFICATE_NO_FLAGS is returned.

If @identity is not %NULL, @cert's name(s) will be compared against it, and %G_TLS_CERTIFICATE_BAD_IDENTITY will be set in the return value if it does not match. If @identity is %NULL, that bit will never be set in the return value.

If @trusted_ca is not %NULL, then @cert (or one of the certificates in its chain) must be signed by it, or else %G_TLS_CERTIFICATE_UNKNOWN_CA will be set in the return value. If @trusted_ca is %NULL, that bit will never be set in the return value.

GLib guarantees that if certificate verification fails, at least one error will be set in the return value, 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.

Because TLS session context is not used, #GTlsCertificate may not perform as many checks on the certificates as #GTlsConnection would. For example, certificate constraints may not be honored, and revocation checks may not be performed. The best way to verify TLS certificates used by a TLS connection is to let #GTlsConnection handle the verification.

type TlsCertificateClass

type TlsCertificateClass struct {
	ParentClass gobject.ObjectClass

	Padding [8]uintptr
	// contains filtered or unexported fields
}

func (*TlsCertificateClass) GetVerify

GetVerify gets the "verify" callback function.

func (*TlsCertificateClass) GoPointer

func (x *TlsCertificateClass) GoPointer() uintptr

func (*TlsCertificateClass) OverrideVerify

OverrideVerify sets the "verify" callback function.

type TlsCertificateFlags

type TlsCertificateFlags int

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.

const (

	// No flags set. Since: 2.74
	GTlsCertificateNoFlagsValue TlsCertificateFlags = 0
	// The signing certificate authority is
	//   not known.
	GTlsCertificateUnknownCaValue TlsCertificateFlags = 1
	// The certificate does not match the
	//   expected identity of the site that it was retrieved from.
	GTlsCertificateBadIdentityValue TlsCertificateFlags = 2
	// The certificate's activation time
	//   is still in the future
	GTlsCertificateNotActivatedValue TlsCertificateFlags = 4
	// The certificate has expired
	GTlsCertificateExpiredValue TlsCertificateFlags = 8
	// The certificate has been revoked
	//   according to the #GTlsConnection's certificate revocation list.
	GTlsCertificateRevokedValue TlsCertificateFlags = 16
	// The certificate's algorithm is
	//   considered insecure.
	GTlsCertificateInsecureValue TlsCertificateFlags = 32
	// Some other error occurred validating
	//   the certificate
	GTlsCertificateGenericErrorValue TlsCertificateFlags = 64
	// the combination of all of the above
	//   flags
	GTlsCertificateValidateAllValue TlsCertificateFlags = 127
)

type TlsCertificatePrivate

type TlsCertificatePrivate struct {
	// contains filtered or unexported fields
}

func (*TlsCertificatePrivate) GoPointer

func (x *TlsCertificatePrivate) GoPointer() uintptr

type TlsCertificateRequestFlags

type TlsCertificateRequestFlags int

Flags for g_tls_interaction_request_certificate(), g_tls_interaction_request_certificate_async(), and g_tls_interaction_invoke_request_certificate().

const (

	// No flags
	GTlsCertificateRequestNoneValue TlsCertificateRequestFlags = 0
)

type TlsChannelBindingError

type TlsChannelBindingError int

An error code used with %G_TLS_CHANNEL_BINDING_ERROR in a #GError to indicate a TLS channel binding retrieval error.

const (

	// Either entire binding
	//    retrieval facility or specific binding type is not implemented in the
	//    TLS backend.
	GTlsChannelBindingErrorNotImplementedValue TlsChannelBindingError = 0
	// The handshake is not yet
	//    complete on the connection which is a strong requirement for any existing
	//    binding type.
	GTlsChannelBindingErrorInvalidStateValue TlsChannelBindingError = 1
	// 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.
	GTlsChannelBindingErrorNotAvailableValue TlsChannelBindingError = 2
	// 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.
	GTlsChannelBindingErrorNotSupportedValue TlsChannelBindingError = 3
	// Any other backend error
	//    preventing binding data retrieval.
	GTlsChannelBindingErrorGeneralErrorValue TlsChannelBindingError = 4
)

type TlsChannelBindingType

type TlsChannelBindingType int

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.

const (

	// [`tls-unique`](https://tools.ietf.org/html/rfc5929#section-3) binding
	//    type
	GTlsChannelBindingTlsUniqueValue TlsChannelBindingType = 0
	// [`tls-server-end-point`](https://tools.ietf.org/html/rfc5929#section-4)
	//    binding type
	GTlsChannelBindingTlsServerEndPointValue TlsChannelBindingType = 1
	// [`tls-exporter`](https://www.rfc-editor.org/rfc/rfc9266.html) binding
	//    type. Since: 2.74
	GTlsChannelBindingTlsExporterValue TlsChannelBindingType = 2
)

type TlsClientConnection

type TlsClientConnection interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	CopySessionState(SourceVar TlsClientConnection)
	GetAcceptedCas() *glib.List
	GetServerIdentity() *SocketConnectableBase
	GetUseSsl3() bool
	GetValidationFlags() TlsCertificateFlags
	SetServerIdentity(IdentityVar SocketConnectable)
	SetUseSsl3(UseSsl3Var bool)
	SetValidationFlags(FlagsVar TlsCertificateFlags)
}

`GTlsClientConnection` is the client-side subclass of [class@Gio.TlsConnection], representing a client-side TLS connection.

type TlsClientConnectionBase

type TlsClientConnectionBase struct {
	Ptr uintptr
}

func TlsClientConnectionNew

func TlsClientConnectionNew(BaseIoStreamVar *IOStream, ServerIdentityVar SocketConnectable) (*TlsClientConnectionBase, error)

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.

func (*TlsClientConnectionBase) CopySessionState

func (x *TlsClientConnectionBase) CopySessionState(SourceVar 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.

func (*TlsClientConnectionBase) GetAcceptedCas

func (x *TlsClientConnectionBase) GetAcceptedCas() *glib.List

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.

func (*TlsClientConnectionBase) GetPropertyUseSsl3

func (x *TlsClientConnectionBase) GetPropertyUseSsl3() bool

GetPropertyUseSsl3 gets the "use-ssl3" property. SSL 3.0 is no longer supported. See g_tls_client_connection_set_use_ssl3() for details.

func (*TlsClientConnectionBase) GetServerIdentity

func (x *TlsClientConnectionBase) GetServerIdentity() *SocketConnectableBase

Gets @conn's expected server identity

func (*TlsClientConnectionBase) GetUseSsl3

func (x *TlsClientConnectionBase) GetUseSsl3() bool

SSL 3.0 is no longer supported. See g_tls_client_connection_set_use_ssl3() for details.

func (*TlsClientConnectionBase) GetValidationFlags

func (x *TlsClientConnectionBase) GetValidationFlags() TlsCertificateFlags

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.

func (*TlsClientConnectionBase) GoPointer

func (x *TlsClientConnectionBase) GoPointer() uintptr

func (*TlsClientConnectionBase) SetGoPointer

func (x *TlsClientConnectionBase) SetGoPointer(ptr uintptr)

func (*TlsClientConnectionBase) SetPropertyUseSsl3

func (x *TlsClientConnectionBase) SetPropertyUseSsl3(value bool)

SetPropertyUseSsl3 sets the "use-ssl3" property. SSL 3.0 is no longer supported. See g_tls_client_connection_set_use_ssl3() for details.

func (*TlsClientConnectionBase) SetServerIdentity

func (x *TlsClientConnectionBase) SetServerIdentity(IdentityVar SocketConnectable)

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.

func (*TlsClientConnectionBase) SetUseSsl3

func (x *TlsClientConnectionBase) SetUseSsl3(UseSsl3Var bool)

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.

func (*TlsClientConnectionBase) SetValidationFlags

func (x *TlsClientConnectionBase) SetValidationFlags(FlagsVar TlsCertificateFlags)

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.

type TlsClientConnectionInterface

type TlsClientConnectionInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

vtable for a #GTlsClientConnection implementation.

func (*TlsClientConnectionInterface) GetCopySessionState

GetCopySessionState gets the "copy_session_state" callback function. Copies session state from one #GTlsClientConnection to another.

func (*TlsClientConnectionInterface) GoPointer

func (x *TlsClientConnectionInterface) GoPointer() uintptr

func (*TlsClientConnectionInterface) OverrideCopySessionState

func (x *TlsClientConnectionInterface) OverrideCopySessionState(cb func(TlsClientConnection, TlsClientConnection))

OverrideCopySessionState sets the "copy_session_state" callback function. Copies session state from one #GTlsClientConnection to another.

type TlsConnection

type TlsConnection struct {
	IOStream
}

`GTlsConnection` is the base TLS connection class type, which wraps a [class@Gio.IOStream] and provides TLS encryption on top of it. Its subclasses, [iface@Gio.TlsClientConnection] and [iface@Gio.TlsServerConnection], implement client-side and server-side TLS, respectively.

For DTLS (Datagram TLS) support, see [iface@Gio.DtlsConnection].

func TlsConnectionNewFromInternalPtr

func TlsConnectionNewFromInternalPtr(ptr uintptr) *TlsConnection

func (*TlsConnection) ConnectAcceptCertificate

func (x *TlsConnection) ConnectAcceptCertificate(cb *func(TlsConnection, uintptr, TlsCertificateFlags) bool) uint

Emitted during the TLS handshake after the peer certificate has been received. You can examine @peer_cert's certification path by calling g_tls_certificate_get_issuer() on it.

For a client-side connection, @peer_cert is the server's certificate, and the signal will only be emitted if the certificate was not acceptable according to @conn's #GTlsClientConnection:validation_flags. If you would like the certificate to be accepted despite @errors, return %TRUE from the signal handler. Otherwise, if no handler accepts the certificate, the handshake will fail with %G_TLS_ERROR_BAD_CERTIFICATE.

GLib guarantees that if certificate verification fails, this signal will be emitted with at least one error will be set in @errors, 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 ignore %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.

For a server-side connection, @peer_cert is the certificate presented by the client, if this was requested via the server's #GTlsServerConnection:authentication_mode. On the server side, the signal is always emitted when the client presents a certificate, and the certificate will only be accepted if a handler returns %TRUE.

Note that if this signal is emitted as part of asynchronous I/O in the main thread, then you should not attempt to interact with the user before returning from the signal handler. If you want to let the user decide whether or not to accept the certificate, you would have to return %FALSE from the signal handler on the first attempt, and then after the connection attempt returns a %G_TLS_ERROR_BAD_CERTIFICATE, you can interact with the user, and if the user decides to accept the certificate, remember that fact, create a new connection, and return %TRUE from the signal handler the next time.

If you are doing I/O in another thread, you do not need to worry about this, and can simply block in the signal handler until the UI thread returns an answer.

func (*TlsConnection) EmitAcceptCertificate

func (x *TlsConnection) EmitAcceptCertificate(PeerCertVar *TlsCertificate, ErrorsVar TlsCertificateFlags) bool

Used by #GTlsConnection implementations to emit the #GTlsConnection::accept-certificate signal.

func (*TlsConnection) GetCertificate

func (x *TlsConnection) GetCertificate() *TlsCertificate

Gets @conn's certificate, as set by g_tls_connection_set_certificate().

func (*TlsConnection) GetChannelBindingData

func (x *TlsConnection) GetChannelBindingData(TypeVar TlsChannelBindingType, DataVar *[]byte) (bool, error)

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.

func (*TlsConnection) GetCiphersuiteName

func (x *TlsConnection) GetCiphersuiteName() string

Returns the name of the current TLS 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.

func (*TlsConnection) GetDatabase

func (x *TlsConnection) GetDatabase() *TlsDatabase

Gets the certificate database that @conn uses to verify peer certificates. See g_tls_connection_set_database().

func (*TlsConnection) GetInteraction

func (x *TlsConnection) GetInteraction() *TlsInteraction

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.

func (*TlsConnection) GetNegotiatedProtocol

func (x *TlsConnection) GetNegotiatedProtocol() string

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_tls_connection_set_advertised_protocols().

func (*TlsConnection) GetPeerCertificate

func (x *TlsConnection) GetPeerCertificate() *TlsCertificate

Gets @conn's peer's certificate after the handshake has completed or failed. (It is not set during the emission of #GTlsConnection::accept-certificate.)

func (*TlsConnection) GetPeerCertificateErrors

func (x *TlsConnection) GetPeerCertificateErrors() TlsCertificateFlags

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 #GTlsConnection::accept-certificate.)

See #GTlsConnection:peer-certificate-errors for more information.

func (*TlsConnection) GetPropertyAdvertisedProtocols

func (x *TlsConnection) GetPropertyAdvertisedProtocols() []string

GetPropertyAdvertisedProtocols gets the "advertised-protocols" property. The list of application-layer protocols that the connection advertises that it is willing to speak. See g_tls_connection_set_advertised_protocols().

func (*TlsConnection) GetPropertyCiphersuiteName

func (x *TlsConnection) GetPropertyCiphersuiteName() string

GetPropertyCiphersuiteName gets the "ciphersuite-name" property. The name of the TLS ciphersuite in use. See g_tls_connection_get_ciphersuite_name().

func (*TlsConnection) GetPropertyNegotiatedProtocol

func (x *TlsConnection) GetPropertyNegotiatedProtocol() string

GetPropertyNegotiatedProtocol gets the "negotiated-protocol" property. The application-layer protocol negotiated during the TLS handshake. See g_tls_connection_get_negotiated_protocol().

func (*TlsConnection) GetPropertyRequireCloseNotify

func (x *TlsConnection) GetPropertyRequireCloseNotify() bool

GetPropertyRequireCloseNotify gets the "require-close-notify" property. Whether or not proper TLS close notification is required. See g_tls_connection_set_require_close_notify().

func (*TlsConnection) GetPropertyUseSystemCertdb

func (x *TlsConnection) GetPropertyUseSystemCertdb() bool

GetPropertyUseSystemCertdb gets the "use-system-certdb" property. Whether or not the system certificate database will be used to verify peer certificates. See g_tls_connection_set_use_system_certdb().

func (*TlsConnection) GetProtocolVersion

func (x *TlsConnection) GetProtocolVersion() TlsProtocolVersion

Returns the current TLS 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.

func (*TlsConnection) GetRehandshakeMode

func (x *TlsConnection) GetRehandshakeMode() TlsRehandshakeMode

Gets @conn rehandshaking mode. See g_tls_connection_set_rehandshake_mode() for details.

func (*TlsConnection) GetRequireCloseNotify

func (x *TlsConnection) GetRequireCloseNotify() bool

Tests whether or not @conn expects a proper TLS close notification when the connection is closed. See g_tls_connection_set_require_close_notify() for details.

func (*TlsConnection) GetUseSystemCertdb

func (x *TlsConnection) GetUseSystemCertdb() bool

Gets whether @conn uses the system certificate database to verify peer certificates. See g_tls_connection_set_use_system_certdb().

func (*TlsConnection) GoPointer

func (c *TlsConnection) GoPointer() uintptr

func (*TlsConnection) Handshake

func (x *TlsConnection) Handshake(CancellableVar *Cancellable) (bool, error)

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 (or after sending a "STARTTLS"-type command), #GTlsConnection will handle this for you automatically when you try to send or receive data on the connection. You can call g_tls_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_tls_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.

When using a #GTlsConnection created by #GSocketClient, the #GSocketClient performs the initial handshake, so calling this function manually is not recommended.

#GTlsConnection::accept_certificate may be emitted during the handshake.

func (*TlsConnection) HandshakeAsync

func (x *TlsConnection) HandshakeAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously performs a TLS handshake on @conn. See g_tls_connection_handshake() for more information.

func (*TlsConnection) HandshakeFinish

func (x *TlsConnection) HandshakeFinish(ResultVar AsyncResult) (bool, error)

Finish an asynchronous TLS handshake operation. See g_tls_connection_handshake() for more information.

func (*TlsConnection) SetAdvertisedProtocols

func (x *TlsConnection) SetAdvertisedProtocols(ProtocolsVar []string)

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_tls_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.

func (*TlsConnection) SetCertificate

func (x *TlsConnection) SetCertificate(CertificateVar *TlsCertificate)

This sets the certificate that @conn will present to its peer during the TLS handshake. For a #GTlsServerConnection, it is mandatory to set this, and that will normally be done at construct time.

For a #GTlsClientConnection, 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_tls_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_tls_client_connection_get_accepted_cas() will return non-%NULL.)

func (*TlsConnection) SetDatabase

func (x *TlsConnection) SetDatabase(DatabaseVar *TlsDatabase)

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 #GTlsConnection::accept-certificate will always be emitted on client-side connections, unless that bit is not set in #GTlsClientConnection:validation-flags).

There are nonintuitive security implications when using a non-default database. See #GTlsConnection:database for details.

func (*TlsConnection) SetGoPointer

func (c *TlsConnection) SetGoPointer(ptr uintptr)

func (*TlsConnection) SetInteraction

func (x *TlsConnection) SetInteraction(InteractionVar *TlsInteraction)

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.

func (*TlsConnection) SetPropertyAdvertisedProtocols

func (x *TlsConnection) SetPropertyAdvertisedProtocols(value []string)

SetPropertyAdvertisedProtocols sets the "advertised-protocols" property. The list of application-layer protocols that the connection advertises that it is willing to speak. See g_tls_connection_set_advertised_protocols().

func (*TlsConnection) SetPropertyRequireCloseNotify

func (x *TlsConnection) SetPropertyRequireCloseNotify(value bool)

SetPropertyRequireCloseNotify sets the "require-close-notify" property. Whether or not proper TLS close notification is required. See g_tls_connection_set_require_close_notify().

func (*TlsConnection) SetPropertyUseSystemCertdb

func (x *TlsConnection) SetPropertyUseSystemCertdb(value bool)

SetPropertyUseSystemCertdb sets the "use-system-certdb" property. Whether or not the system certificate database will be used to verify peer certificates. See g_tls_connection_set_use_system_certdb().

func (*TlsConnection) SetRehandshakeMode

func (x *TlsConnection) SetRehandshakeMode(ModeVar TlsRehandshakeMode)

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.

func (*TlsConnection) SetRequireCloseNotify

func (x *TlsConnection) SetRequireCloseNotify(RequireCloseNotifyVar bool)

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 sometimes omitted. (TLS 1.1 explicitly allows this; in TLS 1.0 it is technically an error, but often done anyway.) You can use g_tls_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 #GSocketConnection, 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_io_stream_close() itself on @conn, 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 #GTlsConnection:base-io-stream rather than closing @conn itself, but note that this may only be done when no other operations are pending on @conn or the base I/O stream.

func (*TlsConnection) SetUseSystemCertdb

func (x *TlsConnection) SetUseSystemCertdb(UseSystemCertdbVar bool)

Sets whether @conn uses the system certificate database to verify peer certificates. This is %TRUE by default. If set to %FALSE, then peer certificate validation will always set the %G_TLS_CERTIFICATE_UNKNOWN_CA error (meaning #GTlsConnection::accept-certificate will always be emitted on client-side connections, unless that bit is not set in #GTlsClientConnection:validation-flags).

type TlsConnectionClass

type TlsConnectionClass struct {
	ParentClass IOStreamClass

	Padding [6]uintptr
	// contains filtered or unexported fields
}

The class structure for the #GTlsConnection type.

func (*TlsConnectionClass) GetAcceptCertificate

func (x *TlsConnectionClass) GetAcceptCertificate() func(*TlsConnection, *TlsCertificate, TlsCertificateFlags) bool

GetAcceptCertificate gets the "accept_certificate" callback function. Check whether to accept a certificate.

func (*TlsConnectionClass) GetGetBindingData

func (x *TlsConnectionClass) GetGetBindingData() func(*TlsConnection, TlsChannelBindingType, []byte) bool

GetGetBindingData gets the "get_binding_data" callback function. Retrieve TLS channel binding data (Since: 2.66)

func (*TlsConnectionClass) GetGetNegotiatedProtocol

func (x *TlsConnectionClass) GetGetNegotiatedProtocol() func(*TlsConnection) string

GetGetNegotiatedProtocol gets the "get_negotiated_protocol" callback function. Get ALPN-negotiated protocol (Since: 2.70)

func (*TlsConnectionClass) GetHandshake

func (x *TlsConnectionClass) GetHandshake() func(*TlsConnection, *Cancellable) bool

GetHandshake gets the "handshake" callback function. Perform a handshake operation.

func (*TlsConnectionClass) GetHandshakeAsync

func (x *TlsConnectionClass) GetHandshakeAsync() func(*TlsConnection, int, *Cancellable, *AsyncReadyCallback, uintptr)

GetHandshakeAsync gets the "handshake_async" callback function. Start an asynchronous handshake operation.

func (*TlsConnectionClass) GetHandshakeFinish

func (x *TlsConnectionClass) GetHandshakeFinish() func(*TlsConnection, AsyncResult) bool

GetHandshakeFinish gets the "handshake_finish" callback function. Finish an asynchronous handshake operation.

func (*TlsConnectionClass) GoPointer

func (x *TlsConnectionClass) GoPointer() uintptr

func (*TlsConnectionClass) OverrideAcceptCertificate

func (x *TlsConnectionClass) OverrideAcceptCertificate(cb func(*TlsConnection, *TlsCertificate, TlsCertificateFlags) bool)

OverrideAcceptCertificate sets the "accept_certificate" callback function. Check whether to accept a certificate.

func (*TlsConnectionClass) OverrideGetBindingData

func (x *TlsConnectionClass) OverrideGetBindingData(cb func(*TlsConnection, TlsChannelBindingType, []byte) bool)

OverrideGetBindingData sets the "get_binding_data" callback function. Retrieve TLS channel binding data (Since: 2.66)

func (*TlsConnectionClass) OverrideGetNegotiatedProtocol

func (x *TlsConnectionClass) OverrideGetNegotiatedProtocol(cb func(*TlsConnection) string)

OverrideGetNegotiatedProtocol sets the "get_negotiated_protocol" callback function. Get ALPN-negotiated protocol (Since: 2.70)

func (*TlsConnectionClass) OverrideHandshake

func (x *TlsConnectionClass) OverrideHandshake(cb func(*TlsConnection, *Cancellable) bool)

OverrideHandshake sets the "handshake" callback function. Perform a handshake operation.

func (*TlsConnectionClass) OverrideHandshakeAsync

func (x *TlsConnectionClass) OverrideHandshakeAsync(cb func(*TlsConnection, int, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideHandshakeAsync sets the "handshake_async" callback function. Start an asynchronous handshake operation.

func (*TlsConnectionClass) OverrideHandshakeFinish

func (x *TlsConnectionClass) OverrideHandshakeFinish(cb func(*TlsConnection, AsyncResult) bool)

OverrideHandshakeFinish sets the "handshake_finish" callback function. Finish an asynchronous handshake operation.

type TlsConnectionPrivate

type TlsConnectionPrivate struct {
	// contains filtered or unexported fields
}

func (*TlsConnectionPrivate) GoPointer

func (x *TlsConnectionPrivate) GoPointer() uintptr

type TlsDatabase

type TlsDatabase struct {
	gobject.Object
}

`GTlsDatabase` is used to look up certificates and other information from a certificate or key store. It is an abstract base class which TLS library specific subtypes override.

A `GTlsDatabase` may be accessed from multiple threads by the TLS backend. All implementations are required to be fully thread-safe.

Most common client applications will not directly interact with `GTlsDatabase`. It is used internally by [class@Gio.TlsConnection].

func TlsDatabaseNewFromInternalPtr

func TlsDatabaseNewFromInternalPtr(ptr uintptr) *TlsDatabase

func (*TlsDatabase) CreateCertificateHandle

func (x *TlsDatabase) CreateCertificateHandle(CertificateVar *TlsCertificate) string

Create a handle string for the certificate. The database will only be able to create a handle for certificates that originate from the database. In cases where the database cannot create a handle for a certificate, %NULL will be returned.

This handle should be stable across various instances of the application, and between applications. If a certificate is modified in the database, then it is not guaranteed that this handle will continue to point to it.

func (*TlsDatabase) GoPointer

func (c *TlsDatabase) GoPointer() uintptr

func (*TlsDatabase) LookupCertificateForHandle

func (x *TlsDatabase) LookupCertificateForHandle(HandleVar string, InteractionVar *TlsInteraction, FlagsVar TlsDatabaseLookupFlags, CancellableVar *Cancellable) (*TlsCertificate, error)

Look up a certificate by its handle.

The handle should have been created by calling g_tls_database_create_certificate_handle() on a #GTlsDatabase object of the same TLS backend. The handle is designed to remain valid across instantiations of the database.

If the handle is no longer valid, or does not point to a certificate in this database, then %NULL will be returned.

This function can block, use g_tls_database_lookup_certificate_for_handle_async() to perform the lookup operation asynchronously.

func (*TlsDatabase) LookupCertificateForHandleAsync

func (x *TlsDatabase) LookupCertificateForHandleAsync(HandleVar string, InteractionVar *TlsInteraction, FlagsVar TlsDatabaseLookupFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously look up a certificate by its handle in the database. See g_tls_database_lookup_certificate_for_handle() for more information.

func (*TlsDatabase) LookupCertificateForHandleFinish

func (x *TlsDatabase) LookupCertificateForHandleFinish(ResultVar AsyncResult) (*TlsCertificate, error)

Finish an asynchronous lookup of a certificate by its handle. See g_tls_database_lookup_certificate_for_handle() for more information.

If the handle is no longer valid, or does not point to a certificate in this database, then %NULL will be returned.

func (*TlsDatabase) LookupCertificateIssuer

func (x *TlsDatabase) LookupCertificateIssuer(CertificateVar *TlsCertificate, InteractionVar *TlsInteraction, FlagsVar TlsDatabaseLookupFlags, CancellableVar *Cancellable) (*TlsCertificate, error)

Look up the issuer of @certificate in the database. The #GTlsCertificate:issuer property of @certificate is not modified, and the two certificates are not hooked into a chain.

This function can block. Use g_tls_database_lookup_certificate_issuer_async() to perform the lookup operation asynchronously.

Beware this function cannot be used to build certification paths. The issuer certificate returned by this function may not be the same as the certificate that would actually be used to construct a valid certification path during certificate verification. [RFC 4158](https://datatracker.ietf.org/doc/html/rfc4158) explains why an issuer certificate cannot be naively assumed to be part of the the certification path (though GLib's TLS backends may not follow the path building strategies outlined in this RFC). Due to the complexity of certification path building, GLib does not provide any way to know which certification path will actually be used when verifying a TLS certificate. Accordingly, this function cannot be used to make security-related decisions. Only GLib itself should make security decisions about TLS certificates.

func (*TlsDatabase) LookupCertificateIssuerAsync

func (x *TlsDatabase) LookupCertificateIssuerAsync(CertificateVar *TlsCertificate, InteractionVar *TlsInteraction, FlagsVar TlsDatabaseLookupFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously look up the issuer of @certificate in the database. See g_tls_database_lookup_certificate_issuer() for more information.

func (*TlsDatabase) LookupCertificateIssuerFinish

func (x *TlsDatabase) LookupCertificateIssuerFinish(ResultVar AsyncResult) (*TlsCertificate, error)

Finish an asynchronous lookup issuer operation. See g_tls_database_lookup_certificate_issuer() for more information.

func (*TlsDatabase) LookupCertificatesIssuedBy

func (x *TlsDatabase) LookupCertificatesIssuedBy(IssuerRawDnVar []byte, InteractionVar *TlsInteraction, FlagsVar TlsDatabaseLookupFlags, CancellableVar *Cancellable) (*glib.List, error)

Look up certificates issued by this issuer in the database.

This function can block, use g_tls_database_lookup_certificates_issued_by_async() to perform the lookup operation asynchronously.

func (*TlsDatabase) LookupCertificatesIssuedByAsync

func (x *TlsDatabase) LookupCertificatesIssuedByAsync(IssuerRawDnVar []byte, InteractionVar *TlsInteraction, FlagsVar TlsDatabaseLookupFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously look up certificates issued by this issuer in the database. See g_tls_database_lookup_certificates_issued_by() for more information.

The database may choose to hold a reference to the issuer byte array for the duration of this asynchronous operation. The byte array should not be modified during this time.

func (*TlsDatabase) LookupCertificatesIssuedByFinish

func (x *TlsDatabase) LookupCertificatesIssuedByFinish(ResultVar AsyncResult) (*glib.List, error)

Finish an asynchronous lookup of certificates. See g_tls_database_lookup_certificates_issued_by() for more information.

func (*TlsDatabase) SetGoPointer

func (c *TlsDatabase) SetGoPointer(ptr uintptr)

func (*TlsDatabase) VerifyChain

func (x *TlsDatabase) VerifyChain(ChainVar *TlsCertificate, PurposeVar string, IdentityVar SocketConnectable, InteractionVar *TlsInteraction, FlagsVar TlsDatabaseVerifyFlags, CancellableVar *Cancellable) (TlsCertificateFlags, error)

Determines the validity of a certificate chain, outside the context of a TLS session.

@chain is a chain of #GTlsCertificate objects each pointing to the next certificate in the chain by its #GTlsCertificate:issuer property.

@purpose describes the purpose (or usage) for which the certificate is being used. Typically @purpose will be set to %G_TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER which means that the certificate is being used to authenticate a server (and we are acting as the client).

The @identity is used to ensure the server certificate is valid for the expected peer identity. If the identity does not match the certificate, %G_TLS_CERTIFICATE_BAD_IDENTITY will be set in the return value. If @identity is %NULL, that bit will never be set in the return value. The peer identity may also be used to check for pinned certificates (trust exceptions) in the database. These may override the normal verification process on a host-by-host basis.

Currently there are no @flags, and %G_TLS_DATABASE_VERIFY_NONE should be used.

If @chain is found to be valid, then the return value will be 0. If @chain is found to be invalid, then the return value will indicate at least one problem found. If the function is unable to determine whether @chain is valid (for example, because @cancellable is triggered before it completes) then the return value will be %G_TLS_CERTIFICATE_GENERIC_ERROR and @error will be set accordingly. @error is not set when @chain is successfully analyzed but found to be invalid.

GLib guarantees that if certificate verification fails, at least one error will be set in the return value, 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.

Prior to GLib 2.48, GLib's default TLS backend modified @chain to represent the certification path built by #GTlsDatabase during certificate verification by adjusting the #GTlsCertificate:issuer property of each certificate in @chain. Since GLib 2.48, this no longer occurs, so you cannot rely on #GTlsCertificate:issuer to represent the actual certification path used during certificate verification.

Because TLS session context is not used, #GTlsDatabase may not perform as many checks on the certificates as #GTlsConnection would. For example, certificate constraints may not be honored, and revocation checks may not be performed. The best way to verify TLS certificates used by a TLS connection is to let #GTlsConnection handle the verification.

The TLS backend may attempt to look up and add missing certificates to the chain. This may involve HTTP requests to download missing certificates.

This function can block. Use g_tls_database_verify_chain_async() to perform the verification operation asynchronously.

func (*TlsDatabase) VerifyChainAsync

func (x *TlsDatabase) VerifyChainAsync(ChainVar *TlsCertificate, PurposeVar string, IdentityVar SocketConnectable, InteractionVar *TlsInteraction, FlagsVar TlsDatabaseVerifyFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously determines the validity of a certificate chain after looking up and adding any missing certificates to the chain. See g_tls_database_verify_chain() for more information.

func (*TlsDatabase) VerifyChainFinish

func (x *TlsDatabase) VerifyChainFinish(ResultVar AsyncResult) (TlsCertificateFlags, error)

Finish an asynchronous verify chain operation. See g_tls_database_verify_chain() for more information.

If @chain is found to be valid, then the return value will be 0. If @chain is found to be invalid, then the return value will indicate the problems found. If the function is unable to determine whether @chain is valid or not (eg, because @cancellable is triggered before it completes) then the return value will be %G_TLS_CERTIFICATE_GENERIC_ERROR and @error will be set accordingly. @error is not set when @chain is successfully analyzed but found to be invalid.

type TlsDatabaseClass

type TlsDatabaseClass struct {
	ParentClass gobject.ObjectClass

	Padding [16]uintptr
	// contains filtered or unexported fields
}

The class for #GTlsDatabase. Derived classes should implement the various virtual methods. _async and _finish methods have a default implementation that runs the corresponding sync method in a thread.

func (*TlsDatabaseClass) GetCreateCertificateHandle

func (x *TlsDatabaseClass) GetCreateCertificateHandle() func(*TlsDatabase, *TlsCertificate) string

GetCreateCertificateHandle gets the "create_certificate_handle" callback function. Virtual method implementing

g_tls_database_create_certificate_handle().

func (*TlsDatabaseClass) GetLookupCertificateForHandle

func (x *TlsDatabaseClass) GetLookupCertificateForHandle() func(*TlsDatabase, string, *TlsInteraction, TlsDatabaseLookupFlags, *Cancellable) *TlsCertificate

GetLookupCertificateForHandle gets the "lookup_certificate_for_handle" callback function. Virtual method implementing

g_tls_database_lookup_certificate_for_handle().

func (*TlsDatabaseClass) GetLookupCertificateForHandleAsync

func (x *TlsDatabaseClass) GetLookupCertificateForHandleAsync() func(*TlsDatabase, string, *TlsInteraction, TlsDatabaseLookupFlags, *Cancellable, *AsyncReadyCallback, uintptr)

GetLookupCertificateForHandleAsync gets the "lookup_certificate_for_handle_async" callback function. Virtual method implementing

g_tls_database_lookup_certificate_for_handle_async().

func (*TlsDatabaseClass) GetLookupCertificateForHandleFinish

func (x *TlsDatabaseClass) GetLookupCertificateForHandleFinish() func(*TlsDatabase, AsyncResult) *TlsCertificate

GetLookupCertificateForHandleFinish gets the "lookup_certificate_for_handle_finish" callback function. Virtual method implementing

g_tls_database_lookup_certificate_for_handle_finish().

func (*TlsDatabaseClass) GetLookupCertificateIssuer

GetLookupCertificateIssuer gets the "lookup_certificate_issuer" callback function. Virtual method implementing

g_tls_database_lookup_certificate_issuer().

func (*TlsDatabaseClass) GetLookupCertificateIssuerAsync

GetLookupCertificateIssuerAsync gets the "lookup_certificate_issuer_async" callback function. Virtual method implementing

g_tls_database_lookup_certificate_issuer_async().

func (*TlsDatabaseClass) GetLookupCertificateIssuerFinish

func (x *TlsDatabaseClass) GetLookupCertificateIssuerFinish() func(*TlsDatabase, AsyncResult) *TlsCertificate

GetLookupCertificateIssuerFinish gets the "lookup_certificate_issuer_finish" callback function. Virtual method implementing

g_tls_database_lookup_certificate_issuer_finish().

func (*TlsDatabaseClass) GetLookupCertificatesIssuedBy

func (x *TlsDatabaseClass) GetLookupCertificatesIssuedBy() func(*TlsDatabase, []byte, *TlsInteraction, TlsDatabaseLookupFlags, *Cancellable) *glib.List

GetLookupCertificatesIssuedBy gets the "lookup_certificates_issued_by" callback function. Virtual method implementing

g_tls_database_lookup_certificates_issued_by().

func (*TlsDatabaseClass) GetLookupCertificatesIssuedByAsync

func (x *TlsDatabaseClass) GetLookupCertificatesIssuedByAsync() func(*TlsDatabase, []byte, *TlsInteraction, TlsDatabaseLookupFlags, *Cancellable, *AsyncReadyCallback, uintptr)

GetLookupCertificatesIssuedByAsync gets the "lookup_certificates_issued_by_async" callback function. Virtual method implementing

g_tls_database_lookup_certificates_issued_by_async().

func (*TlsDatabaseClass) GetLookupCertificatesIssuedByFinish

func (x *TlsDatabaseClass) GetLookupCertificatesIssuedByFinish() func(*TlsDatabase, AsyncResult) *glib.List

GetLookupCertificatesIssuedByFinish gets the "lookup_certificates_issued_by_finish" callback function. Virtual method implementing

g_tls_database_lookup_certificates_issued_by_finish().

func (*TlsDatabaseClass) GetVerifyChain

GetVerifyChain gets the "verify_chain" callback function. Virtual method implementing

g_tls_database_verify_chain().

func (*TlsDatabaseClass) GetVerifyChainAsync

GetVerifyChainAsync gets the "verify_chain_async" callback function. Virtual method implementing

g_tls_database_verify_chain_async().

func (*TlsDatabaseClass) GetVerifyChainFinish

func (x *TlsDatabaseClass) GetVerifyChainFinish() func(*TlsDatabase, AsyncResult) TlsCertificateFlags

GetVerifyChainFinish gets the "verify_chain_finish" callback function. Virtual method implementing

g_tls_database_verify_chain_finish().

func (*TlsDatabaseClass) GoPointer

func (x *TlsDatabaseClass) GoPointer() uintptr

func (*TlsDatabaseClass) OverrideCreateCertificateHandle

func (x *TlsDatabaseClass) OverrideCreateCertificateHandle(cb func(*TlsDatabase, *TlsCertificate) string)

OverrideCreateCertificateHandle sets the "create_certificate_handle" callback function. Virtual method implementing

g_tls_database_create_certificate_handle().

func (*TlsDatabaseClass) OverrideLookupCertificateForHandle

func (x *TlsDatabaseClass) OverrideLookupCertificateForHandle(cb func(*TlsDatabase, string, *TlsInteraction, TlsDatabaseLookupFlags, *Cancellable) *TlsCertificate)

OverrideLookupCertificateForHandle sets the "lookup_certificate_for_handle" callback function. Virtual method implementing

g_tls_database_lookup_certificate_for_handle().

func (*TlsDatabaseClass) OverrideLookupCertificateForHandleAsync

func (x *TlsDatabaseClass) OverrideLookupCertificateForHandleAsync(cb func(*TlsDatabase, string, *TlsInteraction, TlsDatabaseLookupFlags, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideLookupCertificateForHandleAsync sets the "lookup_certificate_for_handle_async" callback function. Virtual method implementing

g_tls_database_lookup_certificate_for_handle_async().

func (*TlsDatabaseClass) OverrideLookupCertificateForHandleFinish

func (x *TlsDatabaseClass) OverrideLookupCertificateForHandleFinish(cb func(*TlsDatabase, AsyncResult) *TlsCertificate)

OverrideLookupCertificateForHandleFinish sets the "lookup_certificate_for_handle_finish" callback function. Virtual method implementing

g_tls_database_lookup_certificate_for_handle_finish().

func (*TlsDatabaseClass) OverrideLookupCertificateIssuer

func (x *TlsDatabaseClass) OverrideLookupCertificateIssuer(cb func(*TlsDatabase, *TlsCertificate, *TlsInteraction, TlsDatabaseLookupFlags, *Cancellable) *TlsCertificate)

OverrideLookupCertificateIssuer sets the "lookup_certificate_issuer" callback function. Virtual method implementing

g_tls_database_lookup_certificate_issuer().

func (*TlsDatabaseClass) OverrideLookupCertificateIssuerAsync

func (x *TlsDatabaseClass) OverrideLookupCertificateIssuerAsync(cb func(*TlsDatabase, *TlsCertificate, *TlsInteraction, TlsDatabaseLookupFlags, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideLookupCertificateIssuerAsync sets the "lookup_certificate_issuer_async" callback function. Virtual method implementing

g_tls_database_lookup_certificate_issuer_async().

func (*TlsDatabaseClass) OverrideLookupCertificateIssuerFinish

func (x *TlsDatabaseClass) OverrideLookupCertificateIssuerFinish(cb func(*TlsDatabase, AsyncResult) *TlsCertificate)

OverrideLookupCertificateIssuerFinish sets the "lookup_certificate_issuer_finish" callback function. Virtual method implementing

g_tls_database_lookup_certificate_issuer_finish().

func (*TlsDatabaseClass) OverrideLookupCertificatesIssuedBy

func (x *TlsDatabaseClass) OverrideLookupCertificatesIssuedBy(cb func(*TlsDatabase, []byte, *TlsInteraction, TlsDatabaseLookupFlags, *Cancellable) *glib.List)

OverrideLookupCertificatesIssuedBy sets the "lookup_certificates_issued_by" callback function. Virtual method implementing

g_tls_database_lookup_certificates_issued_by().

func (*TlsDatabaseClass) OverrideLookupCertificatesIssuedByAsync

func (x *TlsDatabaseClass) OverrideLookupCertificatesIssuedByAsync(cb func(*TlsDatabase, []byte, *TlsInteraction, TlsDatabaseLookupFlags, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideLookupCertificatesIssuedByAsync sets the "lookup_certificates_issued_by_async" callback function. Virtual method implementing

g_tls_database_lookup_certificates_issued_by_async().

func (*TlsDatabaseClass) OverrideLookupCertificatesIssuedByFinish

func (x *TlsDatabaseClass) OverrideLookupCertificatesIssuedByFinish(cb func(*TlsDatabase, AsyncResult) *glib.List)

OverrideLookupCertificatesIssuedByFinish sets the "lookup_certificates_issued_by_finish" callback function. Virtual method implementing

g_tls_database_lookup_certificates_issued_by_finish().

func (*TlsDatabaseClass) OverrideVerifyChain

OverrideVerifyChain sets the "verify_chain" callback function. Virtual method implementing

g_tls_database_verify_chain().

func (*TlsDatabaseClass) OverrideVerifyChainAsync

OverrideVerifyChainAsync sets the "verify_chain_async" callback function. Virtual method implementing

g_tls_database_verify_chain_async().

func (*TlsDatabaseClass) OverrideVerifyChainFinish

func (x *TlsDatabaseClass) OverrideVerifyChainFinish(cb func(*TlsDatabase, AsyncResult) TlsCertificateFlags)

OverrideVerifyChainFinish sets the "verify_chain_finish" callback function. Virtual method implementing

g_tls_database_verify_chain_finish().

type TlsDatabaseLookupFlags

type TlsDatabaseLookupFlags int

Flags for g_tls_database_lookup_certificate_for_handle(), g_tls_database_lookup_certificate_issuer(), and g_tls_database_lookup_certificates_issued_by().

const (

	// No lookup flags
	GTlsDatabaseLookupNoneValue TlsDatabaseLookupFlags = 0
	// Restrict lookup to certificates that have
	//     a private key.
	GTlsDatabaseLookupKeypairValue TlsDatabaseLookupFlags = 1
)

type TlsDatabasePrivate

type TlsDatabasePrivate struct {
	// contains filtered or unexported fields
}

func (*TlsDatabasePrivate) GoPointer

func (x *TlsDatabasePrivate) GoPointer() uintptr

type TlsDatabaseVerifyFlags

type TlsDatabaseVerifyFlags int

Flags for g_tls_database_verify_chain().

const (

	// No verification flags
	GTlsDatabaseVerifyNoneValue TlsDatabaseVerifyFlags = 0
)

type TlsError

type TlsError int

An error code used with %G_TLS_ERROR in a #GError returned from a TLS-related routine.

const (

	// No TLS provider is available
	GTlsErrorUnavailableValue TlsError = 0
	// Miscellaneous TLS error
	GTlsErrorMiscValue TlsError = 1
	// The certificate presented could not
	//   be parsed or failed validation.
	GTlsErrorBadCertificateValue TlsError = 2
	// The TLS handshake failed because the
	//   peer does not seem to be a TLS server.
	GTlsErrorNotTlsValue TlsError = 3
	// The TLS handshake failed because the
	//   peer's certificate was not acceptable.
	GTlsErrorHandshakeValue TlsError = 4
	// The TLS handshake failed because
	//   the server requested a client-side certificate, but none was
	//   provided. See g_tls_connection_set_certificate().
	GTlsErrorCertificateRequiredValue TlsError = 5
	// The TLS connection was closed without proper
	//   notice, which may indicate an attack. See
	//   g_tls_connection_set_require_close_notify().
	GTlsErrorEofValue TlsError = 6
	// The TLS handshake failed
	//   because the client sent the fallback SCSV, indicating a protocol
	//   downgrade attack. Since: 2.60
	GTlsErrorInappropriateFallbackValue TlsError = 7
	// The certificate failed
	//   to load because a password was incorrect. Since: 2.72
	GTlsErrorBadCertificatePasswordValue TlsError = 8
)

type TlsFileDatabase

type TlsFileDatabase interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
}

`GTlsFileDatabase` is implemented by [class@Gio.TlsDatabase] objects which load their certificate information from a file. It is an interface which TLS library specific subtypes implement.

type TlsFileDatabaseBase

type TlsFileDatabaseBase struct {
	Ptr uintptr
}

func TlsFileDatabaseNew

func TlsFileDatabaseNew(AnchorsVar string) (*TlsFileDatabaseBase, error)

Creates a new #GTlsFileDatabase which uses anchor certificate authorities in @anchors to verify certificate chains.

The certificates in @anchors must be PEM encoded.

func (*TlsFileDatabaseBase) GetPropertyAnchors

func (x *TlsFileDatabaseBase) GetPropertyAnchors() string

GetPropertyAnchors gets the "anchors" property. 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.

func (*TlsFileDatabaseBase) GoPointer

func (x *TlsFileDatabaseBase) GoPointer() uintptr

func (*TlsFileDatabaseBase) SetGoPointer

func (x *TlsFileDatabaseBase) SetGoPointer(ptr uintptr)

func (*TlsFileDatabaseBase) SetPropertyAnchors

func (x *TlsFileDatabaseBase) SetPropertyAnchors(value string)

SetPropertyAnchors sets the "anchors" property. 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.

type TlsFileDatabaseInterface

type TlsFileDatabaseInterface struct {
	GIface uintptr

	Padding [8]uintptr
	// contains filtered or unexported fields
}

Provides an interface for #GTlsFileDatabase implementations.

func (*TlsFileDatabaseInterface) GoPointer

func (x *TlsFileDatabaseInterface) GoPointer() uintptr

type TlsInteraction

type TlsInteraction struct {
	gobject.Object
}

`GTlsInteraction` provides a mechanism for the TLS connection and database code to interact with the user. It can be used to ask the user for passwords.

To use a `GTlsInteraction` with a TLS connection use [method@Gio.TlsConnection.set_interaction].

Callers should instantiate a derived class that implements the various interaction methods to show the required dialogs.

Callers should use the 'invoke' functions like [method@Gio.TlsInteraction.invoke_ask_password] to run interaction methods. These functions make sure that the interaction is invoked in the main loop and not in the current thread, if the current thread is not running the main loop.

Derived classes can choose to implement whichever interactions methods they’d like to support by overriding those virtual methods in their class initialization function. Any interactions not implemented will return `G_TLS_INTERACTION_UNHANDLED`. If a derived class implements an async method, it must also implement the corresponding finish method.

func TlsInteractionNewFromInternalPtr

func TlsInteractionNewFromInternalPtr(ptr uintptr) *TlsInteraction

func (*TlsInteraction) AskPassword

func (x *TlsInteraction) AskPassword(PasswordVar *TlsPassword, CancellableVar *Cancellable) (TlsInteractionResult, error)

Run synchronous interaction to ask the user for a password. In general, g_tls_interaction_invoke_ask_password() should be used instead of this function.

Derived subclasses usually implement a password prompt, although they may also choose to provide a password from elsewhere. The @password value will be filled in and then @callback will be called. Alternatively the user may abort this password request, which will usually abort the TLS connection.

If the interaction is cancelled by the cancellation object, or by the user then %G_TLS_INTERACTION_FAILED will be returned with an error that contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

func (*TlsInteraction) AskPasswordAsync

func (x *TlsInteraction) AskPasswordAsync(PasswordVar *TlsPassword, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Run asynchronous interaction to ask the user for a password. In general, g_tls_interaction_invoke_ask_password() should be used instead of this function.

Derived subclasses usually implement a password prompt, although they may also choose to provide a password from elsewhere. The @password value will be filled in and then @callback will be called. Alternatively the user may abort this password request, which will usually abort the TLS connection.

If the interaction is cancelled by the cancellation object, or by the user then %G_TLS_INTERACTION_FAILED will be returned with an error that contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

Certain implementations may not support immediate cancellation.

func (*TlsInteraction) AskPasswordFinish

func (x *TlsInteraction) AskPasswordFinish(ResultVar AsyncResult) (TlsInteractionResult, error)

Complete an ask password user interaction request. This should be once the g_tls_interaction_ask_password_async() completion callback is called.

If %G_TLS_INTERACTION_HANDLED is returned, then the #GTlsPassword passed to g_tls_interaction_ask_password() will have its password filled in.

If the interaction is cancelled by the cancellation object, or by the user then %G_TLS_INTERACTION_FAILED will be returned with an error that contains a %G_IO_ERROR_CANCELLED error code.

func (*TlsInteraction) GoPointer

func (c *TlsInteraction) GoPointer() uintptr

func (*TlsInteraction) InvokeAskPassword

func (x *TlsInteraction) InvokeAskPassword(PasswordVar *TlsPassword, CancellableVar *Cancellable) (TlsInteractionResult, error)

Invoke the interaction to ask the user for a password. It invokes this interaction in the main loop, specifically the #GMainContext returned by g_main_context_get_thread_default() when the interaction is created. This is called by called by #GTlsConnection or #GTlsDatabase to ask the user for a password.

Derived subclasses usually implement a password prompt, although they may also choose to provide a password from elsewhere. The @password value will be filled in and then @callback will be called. Alternatively the user may abort this password request, which will usually abort the TLS connection.

The implementation can either be a synchronous (eg: modal dialog) or an asynchronous one (eg: modeless dialog). This function will take care of calling which ever one correctly.

If the interaction is cancelled by the cancellation object, or by the user then %G_TLS_INTERACTION_FAILED will be returned with an error that contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

func (*TlsInteraction) InvokeRequestCertificate

func (x *TlsInteraction) InvokeRequestCertificate(ConnectionVar *TlsConnection, FlagsVar TlsCertificateRequestFlags, CancellableVar *Cancellable) (TlsInteractionResult, error)

Invoke the interaction to ask the user to choose a certificate to use with the connection. It invokes this interaction in the main loop, specifically the #GMainContext returned by g_main_context_get_thread_default() when the interaction is created. This is called by called by #GTlsConnection when the peer requests a certificate during the handshake.

Derived subclasses usually implement a certificate selector, although they may also choose to provide a certificate from elsewhere. Alternatively the user may abort this certificate request, which may or may not abort the TLS connection.

The implementation can either be a synchronous (eg: modal dialog) or an asynchronous one (eg: modeless dialog). This function will take care of calling which ever one correctly.

If the interaction is cancelled by the cancellation object, or by the user then %G_TLS_INTERACTION_FAILED will be returned with an error that contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

func (*TlsInteraction) RequestCertificate

func (x *TlsInteraction) RequestCertificate(ConnectionVar *TlsConnection, FlagsVar TlsCertificateRequestFlags, CancellableVar *Cancellable) (TlsInteractionResult, error)

Run synchronous interaction to ask the user to choose a certificate to use with the connection. In general, g_tls_interaction_invoke_request_certificate() should be used instead of this function.

Derived subclasses usually implement a certificate selector, although they may also choose to provide a certificate from elsewhere. Alternatively the user may abort this certificate request, which will usually abort the TLS connection.

If %G_TLS_INTERACTION_HANDLED is returned, then the #GTlsConnection passed to g_tls_interaction_request_certificate() will have had its #GTlsConnection:certificate filled in.

If the interaction is cancelled by the cancellation object, or by the user then %G_TLS_INTERACTION_FAILED will be returned with an error that contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

func (*TlsInteraction) RequestCertificateAsync

func (x *TlsInteraction) RequestCertificateAsync(ConnectionVar *TlsConnection, FlagsVar TlsCertificateRequestFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Run asynchronous interaction to ask the user for a certificate to use with the connection. In general, g_tls_interaction_invoke_request_certificate() should be used instead of this function.

Derived subclasses usually implement a certificate selector, although they may also choose to provide a certificate from elsewhere. @callback will be called when the operation completes. Alternatively the user may abort this certificate request, which will usually abort the TLS connection.

func (*TlsInteraction) RequestCertificateFinish

func (x *TlsInteraction) RequestCertificateFinish(ResultVar AsyncResult) (TlsInteractionResult, error)

Complete a request certificate user interaction request. This should be once the g_tls_interaction_request_certificate_async() completion callback is called.

If %G_TLS_INTERACTION_HANDLED is returned, then the #GTlsConnection passed to g_tls_interaction_request_certificate_async() will have had its #GTlsConnection:certificate filled in.

If the interaction is cancelled by the cancellation object, or by the user then %G_TLS_INTERACTION_FAILED will be returned with an error that contains a %G_IO_ERROR_CANCELLED error code.

func (*TlsInteraction) SetGoPointer

func (c *TlsInteraction) SetGoPointer(ptr uintptr)

type TlsInteractionClass

type TlsInteractionClass struct {
	ParentClass gobject.ObjectClass

	Padding [21]uintptr
	// contains filtered or unexported fields
}

The class for #GTlsInteraction. Derived classes implement the various virtual interaction methods to handle TLS interactions.

Derived classes can choose to implement whichever interactions methods they'd like to support by overriding those virtual methods in their class initialization function. If a derived class implements an async method, it must also implement the corresponding finish method.

The synchronous interaction methods should implement to display modal dialogs, and the asynchronous methods to display modeless dialogs.

If the user cancels an interaction, then the result should be %G_TLS_INTERACTION_FAILED and the error should be set with a domain of %G_IO_ERROR and code of %G_IO_ERROR_CANCELLED.

func (*TlsInteractionClass) GetAskPassword

GetAskPassword gets the "ask_password" callback function. ask for a password synchronously. If the implementation

returns %G_TLS_INTERACTION_HANDLED, then the password argument should
have been filled in by using g_tls_password_set_value() or a similar
function.

func (*TlsInteractionClass) GetAskPasswordAsync

GetAskPasswordAsync gets the "ask_password_async" callback function. ask for a password asynchronously.

func (*TlsInteractionClass) GetAskPasswordFinish

func (x *TlsInteractionClass) GetAskPasswordFinish() func(*TlsInteraction, AsyncResult) TlsInteractionResult

GetAskPasswordFinish gets the "ask_password_finish" callback function. complete operation to ask for a password asynchronously.

If the implementation returns %G_TLS_INTERACTION_HANDLED, then the
password argument of the async method should have been filled in by using
g_tls_password_set_value() or a similar function.

func (*TlsInteractionClass) GetRequestCertificate

GetRequestCertificate gets the "request_certificate" callback function. ask for a certificate synchronously. If the

implementation returns %G_TLS_INTERACTION_HANDLED, then the connection
argument should have been filled in by using
g_tls_connection_set_certificate().

func (*TlsInteractionClass) GetRequestCertificateAsync

GetRequestCertificateAsync gets the "request_certificate_async" callback function. ask for a certificate asynchronously.

func (*TlsInteractionClass) GetRequestCertificateFinish

func (x *TlsInteractionClass) GetRequestCertificateFinish() func(*TlsInteraction, AsyncResult) TlsInteractionResult

GetRequestCertificateFinish gets the "request_certificate_finish" callback function. complete operation to ask for a certificate

asynchronously. If the implementation returns %G_TLS_INTERACTION_HANDLED,
then the connection argument of the async method should have been
filled in by using g_tls_connection_set_certificate().

func (*TlsInteractionClass) GoPointer

func (x *TlsInteractionClass) GoPointer() uintptr

func (*TlsInteractionClass) OverrideAskPassword

func (x *TlsInteractionClass) OverrideAskPassword(cb func(*TlsInteraction, *TlsPassword, *Cancellable) TlsInteractionResult)

OverrideAskPassword sets the "ask_password" callback function. ask for a password synchronously. If the implementation

returns %G_TLS_INTERACTION_HANDLED, then the password argument should
have been filled in by using g_tls_password_set_value() or a similar
function.

func (*TlsInteractionClass) OverrideAskPasswordAsync

func (x *TlsInteractionClass) OverrideAskPasswordAsync(cb func(*TlsInteraction, *TlsPassword, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideAskPasswordAsync sets the "ask_password_async" callback function. ask for a password asynchronously.

func (*TlsInteractionClass) OverrideAskPasswordFinish

func (x *TlsInteractionClass) OverrideAskPasswordFinish(cb func(*TlsInteraction, AsyncResult) TlsInteractionResult)

OverrideAskPasswordFinish sets the "ask_password_finish" callback function. complete operation to ask for a password asynchronously.

If the implementation returns %G_TLS_INTERACTION_HANDLED, then the
password argument of the async method should have been filled in by using
g_tls_password_set_value() or a similar function.

func (*TlsInteractionClass) OverrideRequestCertificate

OverrideRequestCertificate sets the "request_certificate" callback function. ask for a certificate synchronously. If the

implementation returns %G_TLS_INTERACTION_HANDLED, then the connection
argument should have been filled in by using
g_tls_connection_set_certificate().

func (*TlsInteractionClass) OverrideRequestCertificateAsync

OverrideRequestCertificateAsync sets the "request_certificate_async" callback function. ask for a certificate asynchronously.

func (*TlsInteractionClass) OverrideRequestCertificateFinish

func (x *TlsInteractionClass) OverrideRequestCertificateFinish(cb func(*TlsInteraction, AsyncResult) TlsInteractionResult)

OverrideRequestCertificateFinish sets the "request_certificate_finish" callback function. complete operation to ask for a certificate

asynchronously. If the implementation returns %G_TLS_INTERACTION_HANDLED,
then the connection argument of the async method should have been
filled in by using g_tls_connection_set_certificate().

type TlsInteractionPrivate

type TlsInteractionPrivate struct {
	// contains filtered or unexported fields
}

func (*TlsInteractionPrivate) GoPointer

func (x *TlsInteractionPrivate) GoPointer() uintptr

type TlsInteractionResult

type TlsInteractionResult int

#GTlsInteractionResult is returned by various functions in #GTlsInteraction when finishing an interaction request.

const (

	// The interaction was unhandled (i.e. not
	//     implemented).
	GTlsInteractionUnhandledValue TlsInteractionResult = 0
	// The interaction completed, and resulting data
	//     is available.
	GTlsInteractionHandledValue TlsInteractionResult = 1
	// The interaction has failed, or was cancelled.
	//     and the operation should be aborted.
	GTlsInteractionFailedValue TlsInteractionResult = 2
)

type TlsPassword

type TlsPassword struct {
	gobject.Object
}

An abstract interface representing a password used in TLS. Often used in user interaction such as unlocking a key storage token.

func NewTlsPassword

func NewTlsPassword(FlagsVar TlsPasswordFlags, DescriptionVar string) *TlsPassword

Create a new #GTlsPassword object.

func TlsPasswordNewFromInternalPtr

func TlsPasswordNewFromInternalPtr(ptr uintptr) *TlsPassword

func (*TlsPassword) GetDescription

func (x *TlsPassword) GetDescription() string

Get a description string about what the password will be used for.

func (*TlsPassword) GetFlags

func (x *TlsPassword) GetFlags() TlsPasswordFlags

Get flags about the password.

func (*TlsPassword) GetPropertyDescription

func (x *TlsPassword) GetPropertyDescription() string

GetPropertyDescription gets the "description" property. Description of what the password is for.

func (*TlsPassword) GetPropertyWarning

func (x *TlsPassword) GetPropertyWarning() string

GetPropertyWarning gets the "warning" property. Warning about the password.

func (*TlsPassword) GetValue

func (x *TlsPassword) GetValue(LengthVar *uint) uintptr

Get the password value. If @length is not %NULL then it will be filled in with the length of the password value. (Note that the password value is not nul-terminated, so you can only pass %NULL for @length in contexts where you know the password will have a certain fixed length.)

func (*TlsPassword) GetWarning

func (x *TlsPassword) GetWarning() string

Get a user readable translated warning. Usually this warning is a representation of the password flags returned from g_tls_password_get_flags().

func (*TlsPassword) GoPointer

func (c *TlsPassword) GoPointer() uintptr

func (*TlsPassword) SetDescription

func (x *TlsPassword) SetDescription(DescriptionVar string)

Set a description string about what the password will be used for.

func (*TlsPassword) SetFlags

func (x *TlsPassword) SetFlags(FlagsVar TlsPasswordFlags)

Set flags about the password.

func (*TlsPassword) SetGoPointer

func (c *TlsPassword) SetGoPointer(ptr uintptr)

func (*TlsPassword) SetPropertyDescription

func (x *TlsPassword) SetPropertyDescription(value string)

SetPropertyDescription sets the "description" property. Description of what the password is for.

func (*TlsPassword) SetPropertyWarning

func (x *TlsPassword) SetPropertyWarning(value string)

SetPropertyWarning sets the "warning" property. Warning about the password.

func (*TlsPassword) SetValue

func (x *TlsPassword) SetValue(ValueVar []byte, LengthVar int)

Set the value for this password. The @value will be copied by the password object.

Specify the @length, for a non-nul-terminated password. Pass -1 as @length if using a nul-terminated password, and @length will be calculated automatically. (Note that the terminating nul is not considered part of the password in this case.)

func (*TlsPassword) SetValueFull

func (x *TlsPassword) SetValueFull(ValueVar []byte, LengthVar int, DestroyVar *glib.DestroyNotify)

Provide the value for this password.

The @value will be owned by the password object, and later freed using the @destroy function callback.

Specify the @length, for a non-nul-terminated password. Pass -1 as @length if using a nul-terminated password, and @length will be calculated automatically. (Note that the terminating nul is not considered part of the password in this case.)

func (*TlsPassword) SetWarning

func (x *TlsPassword) SetWarning(WarningVar string)

Set a user readable translated warning. Usually this warning is a representation of the password flags returned from g_tls_password_get_flags().

type TlsPasswordClass

type TlsPasswordClass struct {
	ParentClass gobject.ObjectClass

	Padding [4]uintptr
	// contains filtered or unexported fields
}

Class structure for #GTlsPassword.

func (*TlsPasswordClass) GetGetDefaultWarning

func (x *TlsPasswordClass) GetGetDefaultWarning() func(*TlsPassword) string

GetGetDefaultWarning gets the "get_default_warning" callback function. virtual method for g_tls_password_get_warning() if no

value has been set using g_tls_password_set_warning()

func (*TlsPasswordClass) GetGetValue

func (x *TlsPasswordClass) GetGetValue() func(*TlsPassword, *uint) uintptr

GetGetValue gets the "get_value" callback function. virtual method for g_tls_password_get_value()

func (*TlsPasswordClass) GetSetValue

func (x *TlsPasswordClass) GetSetValue() func(*TlsPassword, []byte, int, *glib.DestroyNotify)

GetSetValue gets the "set_value" callback function. virtual method for g_tls_password_set_value()

func (*TlsPasswordClass) GoPointer

func (x *TlsPasswordClass) GoPointer() uintptr

func (*TlsPasswordClass) OverrideGetDefaultWarning

func (x *TlsPasswordClass) OverrideGetDefaultWarning(cb func(*TlsPassword) string)

OverrideGetDefaultWarning sets the "get_default_warning" callback function. virtual method for g_tls_password_get_warning() if no

value has been set using g_tls_password_set_warning()

func (*TlsPasswordClass) OverrideGetValue

func (x *TlsPasswordClass) OverrideGetValue(cb func(*TlsPassword, *uint) uintptr)

OverrideGetValue sets the "get_value" callback function. virtual method for g_tls_password_get_value()

func (*TlsPasswordClass) OverrideSetValue

func (x *TlsPasswordClass) OverrideSetValue(cb func(*TlsPassword, []byte, int, *glib.DestroyNotify))

OverrideSetValue sets the "set_value" callback function. virtual method for g_tls_password_set_value()

type TlsPasswordFlags

type TlsPasswordFlags int

Various flags for the password.

const (

	// No flags
	GTlsPasswordNoneValue TlsPasswordFlags = 0
	// The password was wrong, and the user should retry.
	GTlsPasswordRetryValue TlsPasswordFlags = 2
	// Hint to the user that the password has been
	//    wrong many times, and the user may not have many chances left.
	GTlsPasswordManyTriesValue TlsPasswordFlags = 4
	// Hint to the user that this is the last try to get
	//    this password right.
	GTlsPasswordFinalTryValue TlsPasswordFlags = 8
	// For PKCS #11, the user PIN is required.
	//    Since: 2.70.
	GTlsPasswordPkcs11UserValue TlsPasswordFlags = 16
	// For PKCS #11, the security officer
	//    PIN is required. Since: 2.70.
	GTlsPasswordPkcs11SecurityOfficerValue TlsPasswordFlags = 32
	// For PKCS #11, the context-specific
	//    PIN is required. Since: 2.70.
	GTlsPasswordPkcs11ContextSpecificValue TlsPasswordFlags = 64
)

type TlsPasswordPrivate

type TlsPasswordPrivate struct {
	// contains filtered or unexported fields
}

func (*TlsPasswordPrivate) GoPointer

func (x *TlsPasswordPrivate) GoPointer() uintptr

type TlsProtocolVersion

type TlsProtocolVersion int

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.

const (

	// No protocol version or unknown protocol version
	GTlsProtocolVersionUnknownValue TlsProtocolVersion = 0
	// SSL 3.0, which is insecure and should not be used
	GTlsProtocolVersionSsl30Value TlsProtocolVersion = 1
	// TLS 1.0, which is insecure and should not be used
	GTlsProtocolVersionTls10Value TlsProtocolVersion = 2
	// TLS 1.1, which is insecure and should not be used
	GTlsProtocolVersionTls11Value TlsProtocolVersion = 3
	// TLS 1.2, defined by [RFC 5246](https://datatracker.ietf.org/doc/html/rfc5246)
	GTlsProtocolVersionTls12Value TlsProtocolVersion = 4
	// TLS 1.3, defined by [RFC 8446](https://datatracker.ietf.org/doc/html/rfc8446)
	GTlsProtocolVersionTls13Value TlsProtocolVersion = 5
	// DTLS 1.0, which is insecure and should not be used
	GTlsProtocolVersionDtls10Value TlsProtocolVersion = 201
	// DTLS 1.2, defined by [RFC 6347](https://datatracker.ietf.org/doc/html/rfc6347)
	GTlsProtocolVersionDtls12Value TlsProtocolVersion = 202
)

type TlsRehandshakeMode

type TlsRehandshakeMode int

When to allow rehandshaking. See g_tls_connection_set_rehandshake_mode().

const (

	// Never allow rehandshaking
	GTlsRehandshakeNeverValue TlsRehandshakeMode = 0
	// Allow safe rehandshaking only
	GTlsRehandshakeSafelyValue TlsRehandshakeMode = 1
	// Allow unsafe rehandshaking
	GTlsRehandshakeUnsafelyValue TlsRehandshakeMode = 2
)

type TlsServerConnection

type TlsServerConnection interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
}

`GTlsServerConnection` is the server-side subclass of [class@Gio.TlsConnection], representing a server-side TLS connection.

type TlsServerConnectionBase

type TlsServerConnectionBase struct {
	Ptr uintptr
}

func TlsServerConnectionNew

func TlsServerConnectionNew(BaseIoStreamVar *IOStream, CertificateVar *TlsCertificate) (*TlsServerConnectionBase, error)

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.

func (*TlsServerConnectionBase) GoPointer

func (x *TlsServerConnectionBase) GoPointer() uintptr

func (*TlsServerConnectionBase) SetGoPointer

func (x *TlsServerConnectionBase) SetGoPointer(ptr uintptr)

type TlsServerConnectionInterface

type TlsServerConnectionInterface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

vtable for a #GTlsServerConnection implementation.

func (*TlsServerConnectionInterface) GoPointer

func (x *TlsServerConnectionInterface) GoPointer() uintptr

type UnixConnection

type UnixConnection struct {
	SocketConnection
}

This is the subclass of [class@Gio.SocketConnection] that is created for UNIX domain sockets.

It contains functions to do some of the UNIX socket specific functionality like passing file descriptors.

Since GLib 2.72, `GUnixConnection` is available on all platforms. It requires underlying system support (such as Windows 10 with `AF_UNIX`) at run time.

Before GLib 2.72, `<gio/gunixconnection.h>` belonged to the UNIX-specific GIO interfaces, thus you had to use the `gio-unix-2.0.pc` pkg-config file when using it. This is no longer necessary since GLib 2.72.

func UnixConnectionNewFromInternalPtr

func UnixConnectionNewFromInternalPtr(ptr uintptr) *UnixConnection

func (*UnixConnection) GoPointer

func (c *UnixConnection) GoPointer() uintptr

func (*UnixConnection) ReceiveCredentials

func (x *UnixConnection) ReceiveCredentials(CancellableVar *Cancellable) (*Credentials, error)

Receives credentials from the sending end of the connection. The sending end has to call g_unix_connection_send_credentials() (or similar) for this to work.

As well as reading the credentials this also reads (and discards) a single byte from the stream, as this is required for credentials passing to work on some implementations.

This method can be expected to be available on the following platforms:

- Linux since GLib 2.26 - FreeBSD since GLib 2.26 - GNU/kFreeBSD since GLib 2.36 - Solaris, Illumos and OpenSolaris since GLib 2.40 - GNU/Hurd since GLib 2.40

Other ways to exchange credentials with a foreign peer includes the #GUnixCredentialsMessage type and g_socket_get_credentials() function.

func (*UnixConnection) ReceiveCredentialsAsync

func (x *UnixConnection) ReceiveCredentialsAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously receive credentials.

For more details, see g_unix_connection_receive_credentials() which is the synchronous version of this call.

When the operation is finished, @callback will be called. You can then call g_unix_connection_receive_credentials_finish() to get the result of the operation.

func (*UnixConnection) ReceiveCredentialsFinish

func (x *UnixConnection) ReceiveCredentialsFinish(ResultVar AsyncResult) (*Credentials, error)

Finishes an asynchronous receive credentials operation started with g_unix_connection_receive_credentials_async().

func (*UnixConnection) ReceiveFd

func (x *UnixConnection) ReceiveFd(CancellableVar *Cancellable) (int, error)

Receives a file descriptor from the sending end of the connection. The sending end has to call g_unix_connection_send_fd() for this to work.

As well as reading the fd this also reads a single byte from the stream, as this is required for fd passing to work on some implementations.

func (*UnixConnection) SendCredentials

func (x *UnixConnection) SendCredentials(CancellableVar *Cancellable) (bool, error)

Passes the credentials of the current user the receiving side of the connection. The receiving end has to call g_unix_connection_receive_credentials() (or similar) to accept the credentials.

As well as sending the credentials this also writes a single NUL byte to the stream, as this is required for credentials passing to work on some implementations.

This method can be expected to be available on the following platforms:

- Linux since GLib 2.26 - FreeBSD since GLib 2.26 - GNU/kFreeBSD since GLib 2.36 - Solaris, Illumos and OpenSolaris since GLib 2.40 - GNU/Hurd since GLib 2.40

Other ways to exchange credentials with a foreign peer includes the #GUnixCredentialsMessage type and g_socket_get_credentials() function.

func (*UnixConnection) SendCredentialsAsync

func (x *UnixConnection) SendCredentialsAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

Asynchronously send credentials.

For more details, see g_unix_connection_send_credentials() which is the synchronous version of this call.

When the operation is finished, @callback will be called. You can then call g_unix_connection_send_credentials_finish() to get the result of the operation.

func (*UnixConnection) SendCredentialsFinish

func (x *UnixConnection) SendCredentialsFinish(ResultVar AsyncResult) (bool, error)

Finishes an asynchronous send credentials operation started with g_unix_connection_send_credentials_async().

func (*UnixConnection) SendFd

func (x *UnixConnection) SendFd(FdVar int, CancellableVar *Cancellable) (bool, error)

Passes a file descriptor to the receiving side of the connection. The receiving end has to call g_unix_connection_receive_fd() to accept the file descriptor.

As well as sending the fd this also writes a single byte to the stream, as this is required for fd passing to work on some implementations.

func (*UnixConnection) SetGoPointer

func (c *UnixConnection) SetGoPointer(ptr uintptr)

type UnixConnectionClass

type UnixConnectionClass struct {
	ParentClass SocketConnectionClass
	// contains filtered or unexported fields
}

func (*UnixConnectionClass) GoPointer

func (x *UnixConnectionClass) GoPointer() uintptr

type UnixConnectionPrivate

type UnixConnectionPrivate struct {
	// contains filtered or unexported fields
}

func (*UnixConnectionPrivate) GoPointer

func (x *UnixConnectionPrivate) GoPointer() uintptr

type UnixCredentialsMessage

type UnixCredentialsMessage struct {
	SocketControlMessage
}

This [class@Gio.SocketControlMessage] contains a [class@Gio.Credentials] instance. It may be sent using [method@Gio.Socket.send_message] and received using [method@Gio.Socket.receive_message] over UNIX sockets (ie: sockets in the `G_SOCKET_FAMILY_UNIX` family).

For an easier way to send and receive credentials over stream-oriented UNIX sockets, see [method@Gio.UnixConnection.send_credentials] and [method@Gio.UnixConnection.receive_credentials]. To receive credentials of a foreign process connected to a socket, use [method@Gio.Socket.get_credentials].

Since GLib 2.72, `GUnixCredentialMessage` is available on all platforms. It requires underlying system support (such as Windows 10 with `AF_UNIX`) at run time.

Before GLib 2.72, `<gio/gunixcredentialsmessage.h>` belonged to the UNIX-specific GIO interfaces, thus you had to use the `gio-unix-2.0.pc` pkg-config file when using it. This is no longer necessary since GLib 2.72.

func NewUnixCredentialsMessage

func NewUnixCredentialsMessage() *UnixCredentialsMessage

Creates a new #GUnixCredentialsMessage with credentials matching the current processes.

func NewUnixCredentialsMessageWithCredentials

func NewUnixCredentialsMessageWithCredentials(CredentialsVar *Credentials) *UnixCredentialsMessage

Creates a new #GUnixCredentialsMessage holding @credentials.

func UnixCredentialsMessageNewFromInternalPtr

func UnixCredentialsMessageNewFromInternalPtr(ptr uintptr) *UnixCredentialsMessage

func (*UnixCredentialsMessage) GetCredentials

func (x *UnixCredentialsMessage) GetCredentials() *Credentials

Gets the credentials stored in @message.

func (*UnixCredentialsMessage) GoPointer

func (c *UnixCredentialsMessage) GoPointer() uintptr

func (*UnixCredentialsMessage) SetGoPointer

func (c *UnixCredentialsMessage) SetGoPointer(ptr uintptr)

type UnixCredentialsMessageClass

type UnixCredentialsMessageClass struct {
	ParentClass SocketControlMessageClass
	// contains filtered or unexported fields
}

Class structure for #GUnixCredentialsMessage.

func (*UnixCredentialsMessageClass) GetGReserved1

func (x *UnixCredentialsMessageClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*UnixCredentialsMessageClass) GetGReserved2

func (x *UnixCredentialsMessageClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*UnixCredentialsMessageClass) GoPointer

func (x *UnixCredentialsMessageClass) GoPointer() uintptr

func (*UnixCredentialsMessageClass) OverrideGReserved1

func (x *UnixCredentialsMessageClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*UnixCredentialsMessageClass) OverrideGReserved2

func (x *UnixCredentialsMessageClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

type UnixCredentialsMessagePrivate

type UnixCredentialsMessagePrivate struct {
	// contains filtered or unexported fields
}

func (*UnixCredentialsMessagePrivate) GoPointer

func (x *UnixCredentialsMessagePrivate) GoPointer() uintptr

type UnixFDList

type UnixFDList struct {
	gobject.Object
}

A `GUnixFDList` contains a list of file descriptors. It owns the file descriptors that it contains, closing them when finalized.

It may be wrapped in a [`GUnixFDMessage`](../gio-unix/class.UnixFDMessage.html) and sent over a [class@Gio.Socket] in the `G_SOCKET_FAMILY_UNIX` family by using [method@Gio.Socket.send_message] and received using [method@Gio.Socket.receive_message].

Before 2.74, `<gio/gunixfdlist.h>` belonged to the UNIX-specific GIO interfaces, thus you had to use the `gio-unix-2.0.pc` pkg-config file when using it.

Since 2.74, the API is available for Windows.

func NewUnixFDList

func NewUnixFDList() *UnixFDList

Creates a new #GUnixFDList containing no file descriptors.

func NewUnixFDListFromArray

func NewUnixFDListFromArray(FdsVar []int, NFdsVar int) *UnixFDList

Creates a new #GUnixFDList containing the file descriptors given in @fds. The file descriptors become the property of the new list and may no longer be used by the caller. The array itself is owned by the caller.

Each file descriptor in the array should be set to close-on-exec.

If @n_fds is -1 then @fds must be terminated with -1.

func UnixFDListNewFromInternalPtr

func UnixFDListNewFromInternalPtr(ptr uintptr) *UnixFDList

func (*UnixFDList) Append

func (x *UnixFDList) Append(FdVar int) (int, error)

Adds a file descriptor to @list.

The file descriptor is duplicated using dup(). You keep your copy of the descriptor and the copy contained in @list will be closed when @list is finalized.

A possible cause of failure is exceeding the per-process or system-wide file descriptor limit.

The index of the file descriptor in the list is returned. If you use this index with g_unix_fd_list_get() then you will receive back a duplicated copy of the same file descriptor.

func (*UnixFDList) Get

func (x *UnixFDList) Get(IndexVar int) (int, error)

Gets a file descriptor out of @list.

@index_ specifies the index of the file descriptor to get. It is a programmer error for @index_ to be out of range; see g_unix_fd_list_get_length().

The file descriptor is duplicated using dup() and set as close-on-exec before being returned. You must call close() on it when you are done.

A possible cause of failure is exceeding the per-process or system-wide file descriptor limit.

func (*UnixFDList) GetLength

func (x *UnixFDList) GetLength() int

Gets the length of @list (ie: the number of file descriptors contained within).

func (*UnixFDList) GoPointer

func (c *UnixFDList) GoPointer() uintptr

func (*UnixFDList) PeekFds

func (x *UnixFDList) PeekFds(LengthVar *int) uintptr

Returns the array of file descriptors that is contained in this object.

After this call, the descriptors remain the property of @list. The caller must not close them and must not free the array. The array is valid only until @list is changed in any way.

If @length is non-%NULL then it is set to the number of file descriptors in the returned array. The returned array is also terminated with -1.

This function never returns %NULL. In case there are no file descriptors contained in @list, an empty array is returned.

func (*UnixFDList) SetGoPointer

func (c *UnixFDList) SetGoPointer(ptr uintptr)

func (*UnixFDList) StealFds

func (x *UnixFDList) StealFds(LengthVar *int) uintptr

Returns the array of file descriptors that is contained in this object.

After this call, the descriptors are no longer contained in @list. Further calls will return an empty list (unless more descriptors have been added).

The return result of this function must be freed with g_free(). The caller is also responsible for closing all of the file descriptors. The file descriptors in the array are set to close-on-exec.

If @length is non-%NULL then it is set to the number of file descriptors in the returned array. The returned array is also terminated with -1.

This function never returns %NULL. In case there are no file descriptors contained in @list, an empty array is returned.

type UnixFDListClass

type UnixFDListClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*UnixFDListClass) GetGReserved1

func (x *UnixFDListClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*UnixFDListClass) GetGReserved2

func (x *UnixFDListClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*UnixFDListClass) GetGReserved3

func (x *UnixFDListClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*UnixFDListClass) GetGReserved4

func (x *UnixFDListClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*UnixFDListClass) GetGReserved5

func (x *UnixFDListClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*UnixFDListClass) GoPointer

func (x *UnixFDListClass) GoPointer() uintptr

func (*UnixFDListClass) OverrideGReserved1

func (x *UnixFDListClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*UnixFDListClass) OverrideGReserved2

func (x *UnixFDListClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*UnixFDListClass) OverrideGReserved3

func (x *UnixFDListClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*UnixFDListClass) OverrideGReserved4

func (x *UnixFDListClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*UnixFDListClass) OverrideGReserved5

func (x *UnixFDListClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

type UnixFDListPrivate

type UnixFDListPrivate struct {
	// contains filtered or unexported fields
}

func (*UnixFDListPrivate) GoPointer

func (x *UnixFDListPrivate) GoPointer() uintptr

type UnixSocketAddress

type UnixSocketAddress struct {
	SocketAddress
}

Support for UNIX-domain (also known as local) sockets, corresponding to `struct sockaddr_un`.

UNIX domain sockets are generally visible in the filesystem. However, some systems support abstract socket names which are not visible in the filesystem and not affected by the filesystem permissions, visibility, etc. Currently this is only supported under Linux. If you attempt to use abstract sockets on other systems, function calls may return `G_IO_ERROR_NOT_SUPPORTED` errors. You can use [func@Gio.UnixSocketAddress.abstract_names_supported] to see if abstract names are supported.

Since GLib 2.72, `GUnixSocketAddress` is available on all platforms. It requires underlying system support (such as Windows 10 with `AF_UNIX`) at run time.

Before GLib 2.72, `<gio/gunixsocketaddress.h>` belonged to the UNIX-specific GIO interfaces, thus you had to use the `gio-unix-2.0.pc` pkg-config file when using it. This is no longer necessary since GLib 2.72.

func NewUnixSocketAddress

func NewUnixSocketAddress(PathVar string) *UnixSocketAddress

Creates a new #GUnixSocketAddress for @path.

To create abstract socket addresses, on systems that support that, use g_unix_socket_address_new_abstract().

func NewUnixSocketAddressAbstract

func NewUnixSocketAddressAbstract(PathVar []byte, PathLenVar int) *UnixSocketAddress

Creates a new %G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED #GUnixSocketAddress for @path.

func NewUnixSocketAddressWithType

func NewUnixSocketAddressWithType(PathVar []byte, PathLenVar int, TypeVar UnixSocketAddressType) *UnixSocketAddress

Creates a new #GUnixSocketAddress of type @type with name @path.

If @type is %G_UNIX_SOCKET_ADDRESS_PATH, this is equivalent to calling g_unix_socket_address_new().

If @type is %G_UNIX_SOCKET_ADDRESS_ANONYMOUS, @path and @path_len will be ignored.

If @path_type is %G_UNIX_SOCKET_ADDRESS_ABSTRACT, then @path_len bytes of @path will be copied to the socket's path, and only those bytes will be considered part of the name. (If @path_len is -1, then @path is assumed to be NUL-terminated.) For example, if @path was "test", then calling g_socket_address_get_native_size() on the returned socket would return 7 (2 bytes of overhead, 1 byte for the abstract-socket indicator byte, and 4 bytes for the name "test").

If @path_type is %G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED, then @path_len bytes of @path will be copied to the socket's path, the rest of the path will be padded with 0 bytes, and the entire zero-padded buffer will be considered the name. (As above, if @path_len is -1, then @path is assumed to be NUL-terminated.) In this case, g_socket_address_get_native_size() will always return the full size of a `struct sockaddr_un`, although g_unix_socket_address_get_path_len() will still return just the length of @path.

%G_UNIX_SOCKET_ADDRESS_ABSTRACT is preferred over %G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED for new programs. Of course, when connecting to a server created by another process, you must use the appropriate type corresponding to how that process created its listening socket.

func UnixSocketAddressNewFromInternalPtr

func UnixSocketAddressNewFromInternalPtr(ptr uintptr) *UnixSocketAddress

func (*UnixSocketAddress) Enumerate

Creates a #GSocketAddressEnumerator for @connectable.

func (*UnixSocketAddress) GetAddressType

func (x *UnixSocketAddress) GetAddressType() UnixSocketAddressType

Gets @address's type.

func (*UnixSocketAddress) GetIsAbstract

func (x *UnixSocketAddress) GetIsAbstract() bool

Tests if @address is abstract.

func (*UnixSocketAddress) GetPath

func (x *UnixSocketAddress) GetPath() string

Gets @address's path, or for abstract sockets the "name".

Guaranteed to be zero-terminated, but an abstract socket may contain embedded zeros, and thus you should use g_unix_socket_address_get_path_len() to get the true length of this string.

func (*UnixSocketAddress) GetPathLen

func (x *UnixSocketAddress) GetPathLen() uint

Gets the length of @address's path.

For details, see g_unix_socket_address_get_path().

func (*UnixSocketAddress) GetPropertyAbstract

func (x *UnixSocketAddress) GetPropertyAbstract() bool

GetPropertyAbstract gets the "abstract" property. Whether or not this is an abstract address

func (*UnixSocketAddress) GetPropertyPath

func (x *UnixSocketAddress) GetPropertyPath() string

GetPropertyPath gets the "path" property. Unix socket path.

func (*UnixSocketAddress) GetPropertyPathAsArray

func (x *UnixSocketAddress) GetPropertyPathAsArray() []byte

GetPropertyPathAsArray gets the "path-as-array" property. Unix socket path, as a byte array.

func (*UnixSocketAddress) GoPointer

func (c *UnixSocketAddress) GoPointer() uintptr

func (*UnixSocketAddress) ProxyEnumerate

func (x *UnixSocketAddress) ProxyEnumerate() *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().

func (*UnixSocketAddress) SetGoPointer

func (c *UnixSocketAddress) SetGoPointer(ptr uintptr)

func (*UnixSocketAddress) SetPropertyAbstract

func (x *UnixSocketAddress) SetPropertyAbstract(value bool)

SetPropertyAbstract sets the "abstract" property. Whether or not this is an abstract address

func (*UnixSocketAddress) SetPropertyPath

func (x *UnixSocketAddress) SetPropertyPath(value string)

SetPropertyPath sets the "path" property. Unix socket path.

func (*UnixSocketAddress) SetPropertyPathAsArray

func (x *UnixSocketAddress) SetPropertyPathAsArray(value []byte)

SetPropertyPathAsArray sets the "path-as-array" property. Unix socket path, as a byte array.

func (*UnixSocketAddress) ToString

func (x *UnixSocketAddress) ToString() string

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.

type UnixSocketAddressClass

type UnixSocketAddressClass struct {
	ParentClass SocketAddressClass
	// contains filtered or unexported fields
}

func (*UnixSocketAddressClass) GoPointer

func (x *UnixSocketAddressClass) GoPointer() uintptr

type UnixSocketAddressPrivate

type UnixSocketAddressPrivate struct {
	// contains filtered or unexported fields
}

func (*UnixSocketAddressPrivate) GoPointer

func (x *UnixSocketAddressPrivate) GoPointer() uintptr

type UnixSocketAddressType

type UnixSocketAddressType int

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.

const (

	// invalid
	GUnixSocketAddressInvalidValue UnixSocketAddressType = 0
	// anonymous
	GUnixSocketAddressAnonymousValue UnixSocketAddressType = 1
	// a filesystem path
	GUnixSocketAddressPathValue UnixSocketAddressType = 2
	// an abstract name
	GUnixSocketAddressAbstractValue UnixSocketAddressType = 3
	// an abstract name, 0-padded
	//   to the full length of a unix socket name
	GUnixSocketAddressAbstractPaddedValue UnixSocketAddressType = 4
)

type Vfs

type Vfs struct {
	gobject.Object
}

Entry point for using GIO functionality.

func VfsGetDefault

func VfsGetDefault() *Vfs

Gets the default #GVfs for the system.

func VfsGetLocal

func VfsGetLocal() *Vfs

Gets the local #GVfs for the system.

func VfsNewFromInternalPtr

func VfsNewFromInternalPtr(ptr uintptr) *Vfs

func (*Vfs) GetFileForPath

func (x *Vfs) GetFileForPath(PathVar string) *FileBase

Gets a #GFile for @path.

func (*Vfs) GetFileForUri

func (x *Vfs) GetFileForUri(UriVar string) *FileBase

Gets a #GFile for @uri.

This operation never fails, but the returned object might not support any I/O operation if the URI is malformed or if the URI scheme is not supported.

func (*Vfs) GetSupportedUriSchemes

func (x *Vfs) GetSupportedUriSchemes() []string

Gets a list of URI schemes supported by @vfs.

func (*Vfs) GoPointer

func (c *Vfs) GoPointer() uintptr

func (*Vfs) IsActive

func (x *Vfs) IsActive() bool

Checks if the VFS is active.

func (*Vfs) ParseName

func (x *Vfs) ParseName(ParseNameVar string) *FileBase

This operation never fails, but the returned object might not support any I/O operations if the @parse_name cannot be parsed by the #GVfs module.

func (*Vfs) RegisterUriScheme

func (x *Vfs) RegisterUriScheme(SchemeVar string, UriFuncVar *VfsFileLookupFunc, UriDataVar uintptr, UriDestroyVar *glib.DestroyNotify, ParseNameFuncVar *VfsFileLookupFunc, ParseNameDataVar uintptr, ParseNameDestroyVar *glib.DestroyNotify) bool

Registers @uri_func and @parse_name_func as the #GFile URI and parse name lookup functions for URIs with a scheme matching @scheme. Note that @scheme is registered only within the running application, as opposed to desktop-wide as it happens with GVfs backends.

When a #GFile is requested with an URI containing @scheme (e.g. through g_file_new_for_uri()), @uri_func will be called to allow a custom constructor. The implementation of @uri_func should not be blocking, and must not call g_vfs_register_uri_scheme() or g_vfs_unregister_uri_scheme().

When g_file_parse_name() is called with a parse name obtained from such file, @parse_name_func will be called to allow the #GFile to be created again. In that case, it's responsibility of @parse_name_func to make sure the parse name matches what the custom #GFile implementation returned when g_file_get_parse_name() was previously called. The implementation of @parse_name_func should not be blocking, and must not call g_vfs_register_uri_scheme() or g_vfs_unregister_uri_scheme().

It's an error to call this function twice with the same scheme. To unregister a custom URI scheme, use g_vfs_unregister_uri_scheme().

func (*Vfs) SetGoPointer

func (c *Vfs) SetGoPointer(ptr uintptr)

func (*Vfs) UnregisterUriScheme

func (x *Vfs) UnregisterUriScheme(SchemeVar string) bool

Unregisters the URI handler for @scheme previously registered with g_vfs_register_uri_scheme().

type VfsClass

type VfsClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*VfsClass) GetAddWritableNamespaces

func (x *VfsClass) GetAddWritableNamespaces() func(*Vfs, *FileAttributeInfoList)

GetAddWritableNamespaces gets the "add_writable_namespaces" callback function.

func (*VfsClass) GetDeserializeIcon

func (x *VfsClass) GetDeserializeIcon() func(*Vfs, *glib.Variant) *IconBase

GetDeserializeIcon gets the "deserialize_icon" callback function.

func (*VfsClass) GetGReserved1

func (x *VfsClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*VfsClass) GetGReserved2

func (x *VfsClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*VfsClass) GetGReserved3

func (x *VfsClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*VfsClass) GetGReserved4

func (x *VfsClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*VfsClass) GetGReserved5

func (x *VfsClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*VfsClass) GetGReserved6

func (x *VfsClass) GetGReserved6() func()

GetGReserved6 gets the "_g_reserved6" callback function.

func (*VfsClass) GetGetFileForPath

func (x *VfsClass) GetGetFileForPath() func(*Vfs, string) *FileBase

GetGetFileForPath gets the "get_file_for_path" callback function.

func (*VfsClass) GetGetFileForUri

func (x *VfsClass) GetGetFileForUri() func(*Vfs, string) *FileBase

GetGetFileForUri gets the "get_file_for_uri" callback function.

func (*VfsClass) GetGetSupportedUriSchemes

func (x *VfsClass) GetGetSupportedUriSchemes() func(*Vfs) []string

GetGetSupportedUriSchemes gets the "get_supported_uri_schemes" callback function.

func (*VfsClass) GetIsActive

func (x *VfsClass) GetIsActive() func(*Vfs) bool

GetIsActive gets the "is_active" callback function.

func (*VfsClass) GetLocalFileAddInfo

func (x *VfsClass) GetLocalFileAddInfo() func(*Vfs, string, uint64, *FileAttributeMatcher, *FileInfo, *Cancellable, uintptr, *glib.DestroyNotify)

GetLocalFileAddInfo gets the "local_file_add_info" callback function.

func (*VfsClass) GetLocalFileMoved

func (x *VfsClass) GetLocalFileMoved() func(*Vfs, string, string)

GetLocalFileMoved gets the "local_file_moved" callback function.

func (*VfsClass) GetLocalFileRemoved

func (x *VfsClass) GetLocalFileRemoved() func(*Vfs, string)

GetLocalFileRemoved gets the "local_file_removed" callback function.

func (*VfsClass) GetLocalFileSetAttributes

func (x *VfsClass) GetLocalFileSetAttributes() func(*Vfs, string, *FileInfo, FileQueryInfoFlags, *Cancellable) bool

GetLocalFileSetAttributes gets the "local_file_set_attributes" callback function.

func (*VfsClass) GetParseName

func (x *VfsClass) GetParseName() func(*Vfs, string) *FileBase

GetParseName gets the "parse_name" callback function.

func (*VfsClass) GoPointer

func (x *VfsClass) GoPointer() uintptr

func (*VfsClass) OverrideAddWritableNamespaces

func (x *VfsClass) OverrideAddWritableNamespaces(cb func(*Vfs, *FileAttributeInfoList))

OverrideAddWritableNamespaces sets the "add_writable_namespaces" callback function.

func (*VfsClass) OverrideDeserializeIcon

func (x *VfsClass) OverrideDeserializeIcon(cb func(*Vfs, *glib.Variant) *IconBase)

OverrideDeserializeIcon sets the "deserialize_icon" callback function.

func (*VfsClass) OverrideGReserved1

func (x *VfsClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*VfsClass) OverrideGReserved2

func (x *VfsClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*VfsClass) OverrideGReserved3

func (x *VfsClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*VfsClass) OverrideGReserved4

func (x *VfsClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*VfsClass) OverrideGReserved5

func (x *VfsClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

func (*VfsClass) OverrideGReserved6

func (x *VfsClass) OverrideGReserved6(cb func())

OverrideGReserved6 sets the "_g_reserved6" callback function.

func (*VfsClass) OverrideGetFileForPath

func (x *VfsClass) OverrideGetFileForPath(cb func(*Vfs, string) *FileBase)

OverrideGetFileForPath sets the "get_file_for_path" callback function.

func (*VfsClass) OverrideGetFileForUri

func (x *VfsClass) OverrideGetFileForUri(cb func(*Vfs, string) *FileBase)

OverrideGetFileForUri sets the "get_file_for_uri" callback function.

func (*VfsClass) OverrideGetSupportedUriSchemes

func (x *VfsClass) OverrideGetSupportedUriSchemes(cb func(*Vfs) []string)

OverrideGetSupportedUriSchemes sets the "get_supported_uri_schemes" callback function.

func (*VfsClass) OverrideIsActive

func (x *VfsClass) OverrideIsActive(cb func(*Vfs) bool)

OverrideIsActive sets the "is_active" callback function.

func (*VfsClass) OverrideLocalFileAddInfo

func (x *VfsClass) OverrideLocalFileAddInfo(cb func(*Vfs, string, uint64, *FileAttributeMatcher, *FileInfo, *Cancellable, uintptr, *glib.DestroyNotify))

OverrideLocalFileAddInfo sets the "local_file_add_info" callback function.

func (*VfsClass) OverrideLocalFileMoved

func (x *VfsClass) OverrideLocalFileMoved(cb func(*Vfs, string, string))

OverrideLocalFileMoved sets the "local_file_moved" callback function.

func (*VfsClass) OverrideLocalFileRemoved

func (x *VfsClass) OverrideLocalFileRemoved(cb func(*Vfs, string))

OverrideLocalFileRemoved sets the "local_file_removed" callback function.

func (*VfsClass) OverrideLocalFileSetAttributes

func (x *VfsClass) OverrideLocalFileSetAttributes(cb func(*Vfs, string, *FileInfo, FileQueryInfoFlags, *Cancellable) bool)

OverrideLocalFileSetAttributes sets the "local_file_set_attributes" callback function.

func (*VfsClass) OverrideParseName

func (x *VfsClass) OverrideParseName(cb func(*Vfs, string) *FileBase)

OverrideParseName sets the "parse_name" callback function.

type VfsFileLookupFunc

type VfsFileLookupFunc func(uintptr, string, uintptr) uintptr

This function type is used by g_vfs_register_uri_scheme() to make it possible for a client to associate a 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.

type Volume

type Volume interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
	CanEject() bool
	CanMount() bool
	Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	EjectFinish(ResultVar AsyncResult) (bool, error)
	EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	EjectWithOperationFinish(ResultVar AsyncResult) (bool, error)
	EnumerateIdentifiers() []string
	GetActivationRoot() *FileBase
	GetDrive() *DriveBase
	GetIcon() *IconBase
	GetIdentifier(KindVar string) string
	GetMount() *MountBase
	GetName() string
	GetSortKey() string
	GetSymbolicIcon() *IconBase
	GetUuid() string
	Mount(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
	MountFinish(ResultVar AsyncResult) (bool, error)
	ShouldAutomount() bool
}

The `GVolume` interface represents user-visible objects that can be mounted. For example, a file system partition on a USB flash drive, or an optical disc inserted into a disc drive.

If a `GVolume` is currently mounted, the corresponding [iface@Gio.Mount] can be retrieved using [method@Gio.Volume.get_mount].

Mounting a `GVolume` instance is an asynchronous operation. For more information about asynchronous operations, see [iface@Gio.AsyncResult] and [class@Gio.Task]. To mount a `GVolume`, first call [method@Gio.Volume.mount] with (at least) the `GVolume` instance, optionally a [class@Gio.MountOperation] object and a [type@Gio.AsyncReadyCallback].

Typically, one will only want to pass `NULL` for the [class@Gio.MountOperation] 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 [iface@Gio.AsyncResult] instance will be passed to the callback. That callback should then call [method@Gio.Volume.mount_finish] with the `GVolume` instance and the [iface@Gio.AsyncResult] data to see if the operation was completed successfully. If a [type@GLib.Error] is present when [method@Gio.Volume.mount_finish] is called, then it will be filled with any error information.

Note, when [porting from GnomeVFS](migrating-gnome-vfs.html), `GVolume` is the moral equivalent of `GnomeVFSDrive`.

## Volume Identifiers

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 command line). 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 [method@Gio.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()`.

type VolumeBase

type VolumeBase struct {
	Ptr uintptr
}

func VolumeMonitorAdoptOrphanMount

func VolumeMonitorAdoptOrphanMount(MountVar Mount) *VolumeBase

This function should be called by any #GVolumeMonitor implementation when a new #GMount object is created that is not associated with a #GVolume object. It must be called just before emitting the @mount_added signal.

If the return value is not %NULL, the caller must associate the returned #GVolume object with the #GMount. This involves returning it in its g_mount_get_volume() implementation. The caller must also listen for the "removed" signal on the returned object and give up its reference when handling that signal

Similarly, if implementing g_volume_monitor_adopt_orphan_mount(), the implementor must take a reference to @mount and return it in its g_volume_get_mount() implemented. Also, the implementor must listen for the "unmounted" signal on @mount and give up its reference upon handling that signal.

There are two main use cases for this function.

One is when implementing a user space file system driver that reads blocks of a block device that is already represented by the native volume monitor (for example a CD Audio file system driver). Such a driver will generate its own #GMount object that needs to be associated with the #GVolume object that represents the volume.

The other is for implementing a #GVolumeMonitor whose sole purpose is to return #GVolume objects representing entries in the users "favorite servers" list or similar.

func (*VolumeBase) CanEject

func (x *VolumeBase) CanEject() bool

Checks if a volume can be ejected.

func (*VolumeBase) CanMount

func (x *VolumeBase) CanMount() bool

Checks if a volume can be mounted.

func (*VolumeBase) Eject

func (x *VolumeBase) Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*VolumeBase) EjectFinish

func (x *VolumeBase) EjectFinish(ResultVar AsyncResult) (bool, error)

Finishes ejecting a volume. If any errors occurred during the operation, @error will be set to contain the errors and %FALSE will be returned.

func (*VolumeBase) EjectWithOperation

func (x *VolumeBase) EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*VolumeBase) EjectWithOperationFinish

func (x *VolumeBase) EjectWithOperationFinish(ResultVar AsyncResult) (bool, error)

Finishes ejecting a volume. If any errors occurred during the operation, @error will be set to contain the errors and %FALSE will be returned.

func (*VolumeBase) EnumerateIdentifiers

func (x *VolumeBase) EnumerateIdentifiers() []string

Gets the kinds of [identifiers](#volume-identifiers) that @volume has. Use g_volume_get_identifier() to obtain the identifiers themselves.

func (*VolumeBase) GetActivationRoot

func (x *VolumeBase) GetActivationRoot() *FileBase

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

|[<!-- language="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 |[<!-- language="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.

func (*VolumeBase) GetDrive

func (x *VolumeBase) GetDrive() *DriveBase

Gets the drive for the @volume.

func (*VolumeBase) GetIcon

func (x *VolumeBase) GetIcon() *IconBase

Gets the icon for @volume.

func (*VolumeBase) GetIdentifier

func (x *VolumeBase) GetIdentifier(KindVar string) string

Gets the identifier of the given kind for @volume. See the [introduction](#volume-identifiers) for more information about volume identifiers.

func (*VolumeBase) GetMount

func (x *VolumeBase) GetMount() *MountBase

Gets the mount for the @volume.

func (*VolumeBase) GetName

func (x *VolumeBase) GetName() string

Gets the name of @volume.

func (*VolumeBase) GetSortKey

func (x *VolumeBase) GetSortKey() string

Gets the sort key for @volume, if any.

func (*VolumeBase) GetSymbolicIcon

func (x *VolumeBase) GetSymbolicIcon() *IconBase

Gets the symbolic icon for @volume.

func (*VolumeBase) GetUuid

func (x *VolumeBase) GetUuid() string

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.

func (*VolumeBase) GoPointer

func (x *VolumeBase) GoPointer() uintptr

func (*VolumeBase) Mount

func (x *VolumeBase) Mount(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)

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.

func (*VolumeBase) MountFinish

func (x *VolumeBase) MountFinish(ResultVar AsyncResult) (bool, error)

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.

func (*VolumeBase) SetGoPointer

func (x *VolumeBase) SetGoPointer(ptr uintptr)

func (*VolumeBase) ShouldAutomount

func (x *VolumeBase) ShouldAutomount() bool

Returns whether the volume should be automatically mounted.

type VolumeIface

type VolumeIface struct {
	GIface uintptr
	// contains filtered or unexported fields
}

Interface for implementing operations for mountable volumes.

func (*VolumeIface) GetCanEject

func (x *VolumeIface) GetCanEject() func(Volume) bool

GetCanEject gets the "can_eject" callback function. Checks if a #GVolume can be ejected.

func (*VolumeIface) GetCanMount

func (x *VolumeIface) GetCanMount() func(Volume) bool

GetCanMount gets the "can_mount" callback function. Returns %TRUE if the #GVolume can be mounted.

func (*VolumeIface) GetChanged

func (x *VolumeIface) GetChanged() func(Volume)

GetChanged gets the "changed" callback function. Changed signal that is emitted when the volume's state has changed.

func (*VolumeIface) GetEject

GetEject gets the "eject" callback function. Ejects a given #GVolume.

func (*VolumeIface) GetEjectFinish

func (x *VolumeIface) GetEjectFinish() func(Volume, AsyncResult) bool

GetEjectFinish gets the "eject_finish" callback function. Finishes an eject operation.

func (*VolumeIface) GetEjectWithOperation

func (x *VolumeIface) GetEjectWithOperation() func(Volume, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr)

GetEjectWithOperation gets the "eject_with_operation" callback function. Starts ejecting a #GVolume using a #GMountOperation. Since 2.22.

func (*VolumeIface) GetEjectWithOperationFinish

func (x *VolumeIface) GetEjectWithOperationFinish() func(Volume, AsyncResult) bool

GetEjectWithOperationFinish gets the "eject_with_operation_finish" callback function. Finishes an eject operation using a #GMountOperation. Since 2.22.

func (*VolumeIface) GetEnumerateIdentifiers

func (x *VolumeIface) GetEnumerateIdentifiers() func(Volume) []string

GetEnumerateIdentifiers gets the "enumerate_identifiers" callback function. Returns an array strings listing the kinds

of [identifiers](#volume-identifiers) which the #GVolume has.

func (*VolumeIface) GetGetActivationRoot

func (x *VolumeIface) GetGetActivationRoot() func(Volume) *FileBase

GetGetActivationRoot gets the "get_activation_root" callback function. Returns the activation root for the #GVolume if it is known in advance or %NULL if

it is not known.

func (*VolumeIface) GetGetDrive

func (x *VolumeIface) GetGetDrive() func(Volume) *DriveBase

GetGetDrive gets the "get_drive" callback function. Gets a #GDrive the volume is located on. Returns %NULL if the #GVolume is not associated with a #GDrive.

func (*VolumeIface) GetGetIcon

func (x *VolumeIface) GetGetIcon() func(Volume) *IconBase

GetGetIcon gets the "get_icon" callback function. Gets a #GIcon for the #GVolume.

func (*VolumeIface) GetGetIdentifier

func (x *VolumeIface) GetGetIdentifier() func(Volume, string) string

GetGetIdentifier gets the "get_identifier" callback function. Returns the [identifier](#volume-identifiers) of the given kind, or %NULL if

the #GVolume doesn't have one.

func (*VolumeIface) GetGetMount

func (x *VolumeIface) GetGetMount() func(Volume) *MountBase

GetGetMount gets the "get_mount" callback function. Gets a #GMount representing the mounted volume. Returns %NULL if the #GVolume is not mounted.

func (*VolumeIface) GetGetName

func (x *VolumeIface) GetGetName() func(Volume) string

GetGetName gets the "get_name" callback function. Gets a string containing the name of the #GVolume.

func (*VolumeIface) GetGetSortKey

func (x *VolumeIface) GetGetSortKey() func(Volume) string

GetGetSortKey gets the "get_sort_key" callback function. Gets a key used for sorting #GVolume instance or %NULL if no such key exists. Since 2.32.

func (*VolumeIface) GetGetSymbolicIcon

func (x *VolumeIface) GetGetSymbolicIcon() func(Volume) *IconBase

GetGetSymbolicIcon gets the "get_symbolic_icon" callback function. Gets a symbolic #GIcon for the #GVolume. Since 2.34.

func (*VolumeIface) GetGetUuid

func (x *VolumeIface) GetGetUuid() func(Volume) string

GetGetUuid gets the "get_uuid" callback function. Gets the UUID for the #GVolume. 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.

func (*VolumeIface) GetMountFinish

func (x *VolumeIface) GetMountFinish() func(Volume, AsyncResult) bool

GetMountFinish gets the "mount_finish" callback function. Finishes a mount operation.

func (*VolumeIface) GetMountFn

GetMountFn gets the "mount_fn" callback function. Mounts a given #GVolume.

#GVolume implementations must emit the #GMountOperation::aborted
signal before completing a mount operation that is aborted while
awaiting input from the user through a #GMountOperation instance.

func (*VolumeIface) GetRemoved

func (x *VolumeIface) GetRemoved() func(Volume)

GetRemoved gets the "removed" callback function. The removed signal that is emitted when the #GVolume have been removed. If the recipient is holding references to the object they should release them so the object can be finalized.

func (*VolumeIface) GetShouldAutomount

func (x *VolumeIface) GetShouldAutomount() func(Volume) bool

GetShouldAutomount gets the "should_automount" callback function. Returns %TRUE if the #GVolume should be automatically mounted.

func (*VolumeIface) GoPointer

func (x *VolumeIface) GoPointer() uintptr

func (*VolumeIface) OverrideCanEject

func (x *VolumeIface) OverrideCanEject(cb func(Volume) bool)

OverrideCanEject sets the "can_eject" callback function. Checks if a #GVolume can be ejected.

func (*VolumeIface) OverrideCanMount

func (x *VolumeIface) OverrideCanMount(cb func(Volume) bool)

OverrideCanMount sets the "can_mount" callback function. Returns %TRUE if the #GVolume can be mounted.

func (*VolumeIface) OverrideChanged

func (x *VolumeIface) OverrideChanged(cb func(Volume))

OverrideChanged sets the "changed" callback function. Changed signal that is emitted when the volume's state has changed.

func (*VolumeIface) OverrideEject

func (x *VolumeIface) OverrideEject(cb func(Volume, MountUnmountFlags, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideEject sets the "eject" callback function. Ejects a given #GVolume.

func (*VolumeIface) OverrideEjectFinish

func (x *VolumeIface) OverrideEjectFinish(cb func(Volume, AsyncResult) bool)

OverrideEjectFinish sets the "eject_finish" callback function. Finishes an eject operation.

func (*VolumeIface) OverrideEjectWithOperation

func (x *VolumeIface) OverrideEjectWithOperation(cb func(Volume, MountUnmountFlags, *MountOperation, *Cancellable, *AsyncReadyCallback, uintptr))

OverrideEjectWithOperation sets the "eject_with_operation" callback function. Starts ejecting a #GVolume using a #GMountOperation. Since 2.22.

func (*VolumeIface) OverrideEjectWithOperationFinish

func (x *VolumeIface) OverrideEjectWithOperationFinish(cb func(Volume, AsyncResult) bool)

OverrideEjectWithOperationFinish sets the "eject_with_operation_finish" callback function. Finishes an eject operation using a #GMountOperation. Since 2.22.

func (*VolumeIface) OverrideEnumerateIdentifiers

func (x *VolumeIface) OverrideEnumerateIdentifiers(cb func(Volume) []string)

OverrideEnumerateIdentifiers sets the "enumerate_identifiers" callback function. Returns an array strings listing the kinds

of [identifiers](#volume-identifiers) which the #GVolume has.

func (*VolumeIface) OverrideGetActivationRoot

func (x *VolumeIface) OverrideGetActivationRoot(cb func(Volume) *FileBase)

OverrideGetActivationRoot sets the "get_activation_root" callback function. Returns the activation root for the #GVolume if it is known in advance or %NULL if

it is not known.

func (*VolumeIface) OverrideGetDrive

func (x *VolumeIface) OverrideGetDrive(cb func(Volume) *DriveBase)

OverrideGetDrive sets the "get_drive" callback function. Gets a #GDrive the volume is located on. Returns %NULL if the #GVolume is not associated with a #GDrive.

func (*VolumeIface) OverrideGetIcon

func (x *VolumeIface) OverrideGetIcon(cb func(Volume) *IconBase)

OverrideGetIcon sets the "get_icon" callback function. Gets a #GIcon for the #GVolume.

func (*VolumeIface) OverrideGetIdentifier

func (x *VolumeIface) OverrideGetIdentifier(cb func(Volume, string) string)

OverrideGetIdentifier sets the "get_identifier" callback function. Returns the [identifier](#volume-identifiers) of the given kind, or %NULL if

the #GVolume doesn't have one.

func (*VolumeIface) OverrideGetMount

func (x *VolumeIface) OverrideGetMount(cb func(Volume) *MountBase)

OverrideGetMount sets the "get_mount" callback function. Gets a #GMount representing the mounted volume. Returns %NULL if the #GVolume is not mounted.

func (*VolumeIface) OverrideGetName

func (x *VolumeIface) OverrideGetName(cb func(Volume) string)

OverrideGetName sets the "get_name" callback function. Gets a string containing the name of the #GVolume.

func (*VolumeIface) OverrideGetSortKey

func (x *VolumeIface) OverrideGetSortKey(cb func(Volume) string)

OverrideGetSortKey sets the "get_sort_key" callback function. Gets a key used for sorting #GVolume instance or %NULL if no such key exists. Since 2.32.

func (*VolumeIface) OverrideGetSymbolicIcon

func (x *VolumeIface) OverrideGetSymbolicIcon(cb func(Volume) *IconBase)

OverrideGetSymbolicIcon sets the "get_symbolic_icon" callback function. Gets a symbolic #GIcon for the #GVolume. Since 2.34.

func (*VolumeIface) OverrideGetUuid

func (x *VolumeIface) OverrideGetUuid(cb func(Volume) string)

OverrideGetUuid sets the "get_uuid" callback function. Gets the UUID for the #GVolume. 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.

func (*VolumeIface) OverrideMountFinish

func (x *VolumeIface) OverrideMountFinish(cb func(Volume, AsyncResult) bool)

OverrideMountFinish sets the "mount_finish" callback function. Finishes a mount operation.

func (*VolumeIface) OverrideMountFn

OverrideMountFn sets the "mount_fn" callback function. Mounts a given #GVolume.

#GVolume implementations must emit the #GMountOperation::aborted
signal before completing a mount operation that is aborted while
awaiting input from the user through a #GMountOperation instance.

func (*VolumeIface) OverrideRemoved

func (x *VolumeIface) OverrideRemoved(cb func(Volume))

OverrideRemoved sets the "removed" callback function. The removed signal that is emitted when the #GVolume have been removed. If the recipient is holding references to the object they should release them so the object can be finalized.

func (*VolumeIface) OverrideShouldAutomount

func (x *VolumeIface) OverrideShouldAutomount(cb func(Volume) bool)

OverrideShouldAutomount sets the "should_automount" callback function. Returns %TRUE if the #GVolume should be automatically mounted.

type VolumeMonitor

type VolumeMonitor struct {
	gobject.Object
}

`GVolumeMonitor` is for listing the user interesting devices and volumes on the computer. In other words, what a file selector or file manager would show in a sidebar.

`GVolumeMonitor` is not thread-default-context aware (see [method@GLib.MainContext.push_thread_default]), and so should not be used other than from the main thread, with no thread-default-context active.

In order to receive updates about volumes and mounts monitored through GVFS, a main loop must be running.

func VolumeMonitorGet

func VolumeMonitorGet() *VolumeMonitor

Gets the volume monitor used by gio.

func VolumeMonitorNewFromInternalPtr

func VolumeMonitorNewFromInternalPtr(ptr uintptr) *VolumeMonitor

func (*VolumeMonitor) ConnectDriveChanged

func (x *VolumeMonitor) ConnectDriveChanged(cb *func(VolumeMonitor, uintptr)) uint

Emitted when a drive changes.

func (*VolumeMonitor) ConnectDriveConnected

func (x *VolumeMonitor) ConnectDriveConnected(cb *func(VolumeMonitor, uintptr)) uint

Emitted when a drive is connected to the system.

func (*VolumeMonitor) ConnectDriveDisconnected

func (x *VolumeMonitor) ConnectDriveDisconnected(cb *func(VolumeMonitor, uintptr)) uint

Emitted when a drive is disconnected from the system.

func (*VolumeMonitor) ConnectDriveEjectButton

func (x *VolumeMonitor) ConnectDriveEjectButton(cb *func(VolumeMonitor, uintptr)) uint

Emitted when the eject button is pressed on @drive.

func (*VolumeMonitor) ConnectDriveStopButton

func (x *VolumeMonitor) ConnectDriveStopButton(cb *func(VolumeMonitor, uintptr)) uint

Emitted when the stop button is pressed on @drive.

func (*VolumeMonitor) ConnectMountAdded

func (x *VolumeMonitor) ConnectMountAdded(cb *func(VolumeMonitor, uintptr)) uint

Emitted when a mount is added.

func (*VolumeMonitor) ConnectMountChanged

func (x *VolumeMonitor) ConnectMountChanged(cb *func(VolumeMonitor, uintptr)) uint

Emitted when a mount changes.

func (*VolumeMonitor) ConnectMountPreUnmount

func (x *VolumeMonitor) ConnectMountPreUnmount(cb *func(VolumeMonitor, uintptr)) uint

May be emitted when a mount is about to be removed.

This signal depends on the backend and is only emitted if GIO was used to unmount.

func (*VolumeMonitor) ConnectMountRemoved

func (x *VolumeMonitor) ConnectMountRemoved(cb *func(VolumeMonitor, uintptr)) uint

Emitted when a mount is removed.

func (*VolumeMonitor) ConnectVolumeAdded

func (x *VolumeMonitor) ConnectVolumeAdded(cb *func(VolumeMonitor, uintptr)) uint

Emitted when a mountable volume is added to the system.

func (*VolumeMonitor) ConnectVolumeChanged

func (x *VolumeMonitor) ConnectVolumeChanged(cb *func(VolumeMonitor, uintptr)) uint

Emitted when mountable volume is changed.

func (*VolumeMonitor) ConnectVolumeRemoved

func (x *VolumeMonitor) ConnectVolumeRemoved(cb *func(VolumeMonitor, uintptr)) uint

Emitted when a mountable volume is removed from the system.

func (*VolumeMonitor) GetConnectedDrives

func (x *VolumeMonitor) GetConnectedDrives() *glib.List

Gets a list of drives connected to the system.

The returned list should be freed with g_list_free(), after its elements have been unreffed with g_object_unref().

func (*VolumeMonitor) GetMountForUuid

func (x *VolumeMonitor) GetMountForUuid(UuidVar string) *MountBase

Finds a #GMount object by its UUID (see g_mount_get_uuid())

func (*VolumeMonitor) GetMounts

func (x *VolumeMonitor) GetMounts() *glib.List

Gets a list of the mounts on the system.

The returned list should be freed with g_list_free(), after its elements have been unreffed with g_object_unref().

func (*VolumeMonitor) GetVolumeForUuid

func (x *VolumeMonitor) GetVolumeForUuid(UuidVar string) *VolumeBase

Finds a #GVolume object by its UUID (see g_volume_get_uuid())

func (*VolumeMonitor) GetVolumes

func (x *VolumeMonitor) GetVolumes() *glib.List

Gets a list of the volumes on the system.

The returned list should be freed with g_list_free(), after its elements have been unreffed with g_object_unref().

func (*VolumeMonitor) GoPointer

func (c *VolumeMonitor) GoPointer() uintptr

func (*VolumeMonitor) SetGoPointer

func (c *VolumeMonitor) SetGoPointer(ptr uintptr)

type VolumeMonitorClass

type VolumeMonitorClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*VolumeMonitorClass) GetAdoptOrphanMount

func (x *VolumeMonitorClass) GetAdoptOrphanMount() func(Mount, *VolumeMonitor) *VolumeBase

GetAdoptOrphanMount gets the "adopt_orphan_mount" callback function.

func (*VolumeMonitorClass) GetDriveChanged

func (x *VolumeMonitorClass) GetDriveChanged() func(*VolumeMonitor, Drive)

GetDriveChanged gets the "drive_changed" callback function.

func (*VolumeMonitorClass) GetDriveConnected

func (x *VolumeMonitorClass) GetDriveConnected() func(*VolumeMonitor, Drive)

GetDriveConnected gets the "drive_connected" callback function.

func (*VolumeMonitorClass) GetDriveDisconnected

func (x *VolumeMonitorClass) GetDriveDisconnected() func(*VolumeMonitor, Drive)

GetDriveDisconnected gets the "drive_disconnected" callback function.

func (*VolumeMonitorClass) GetDriveEjectButton

func (x *VolumeMonitorClass) GetDriveEjectButton() func(*VolumeMonitor, Drive)

GetDriveEjectButton gets the "drive_eject_button" callback function.

func (*VolumeMonitorClass) GetDriveStopButton

func (x *VolumeMonitorClass) GetDriveStopButton() func(*VolumeMonitor, Drive)

GetDriveStopButton gets the "drive_stop_button" callback function.

func (*VolumeMonitorClass) GetGReserved1

func (x *VolumeMonitorClass) GetGReserved1() func()

GetGReserved1 gets the "_g_reserved1" callback function.

func (*VolumeMonitorClass) GetGReserved2

func (x *VolumeMonitorClass) GetGReserved2() func()

GetGReserved2 gets the "_g_reserved2" callback function.

func (*VolumeMonitorClass) GetGReserved3

func (x *VolumeMonitorClass) GetGReserved3() func()

GetGReserved3 gets the "_g_reserved3" callback function.

func (*VolumeMonitorClass) GetGReserved4

func (x *VolumeMonitorClass) GetGReserved4() func()

GetGReserved4 gets the "_g_reserved4" callback function.

func (*VolumeMonitorClass) GetGReserved5

func (x *VolumeMonitorClass) GetGReserved5() func()

GetGReserved5 gets the "_g_reserved5" callback function.

func (*VolumeMonitorClass) GetGReserved6

func (x *VolumeMonitorClass) GetGReserved6() func()

GetGReserved6 gets the "_g_reserved6" callback function.

func (*VolumeMonitorClass) GetGetConnectedDrives

func (x *VolumeMonitorClass) GetGetConnectedDrives() func(*VolumeMonitor) *glib.List

GetGetConnectedDrives gets the "get_connected_drives" callback function.

func (*VolumeMonitorClass) GetGetMountForUuid

func (x *VolumeMonitorClass) GetGetMountForUuid() func(*VolumeMonitor, string) *MountBase

GetGetMountForUuid gets the "get_mount_for_uuid" callback function.

func (*VolumeMonitorClass) GetGetMounts

func (x *VolumeMonitorClass) GetGetMounts() func(*VolumeMonitor) *glib.List

GetGetMounts gets the "get_mounts" callback function.

func (*VolumeMonitorClass) GetGetVolumeForUuid

func (x *VolumeMonitorClass) GetGetVolumeForUuid() func(*VolumeMonitor, string) *VolumeBase

GetGetVolumeForUuid gets the "get_volume_for_uuid" callback function.

func (*VolumeMonitorClass) GetGetVolumes

func (x *VolumeMonitorClass) GetGetVolumes() func(*VolumeMonitor) *glib.List

GetGetVolumes gets the "get_volumes" callback function.

func (*VolumeMonitorClass) GetIsSupported

func (x *VolumeMonitorClass) GetIsSupported() func() bool

GetIsSupported gets the "is_supported" callback function.

func (*VolumeMonitorClass) GetMountAdded

func (x *VolumeMonitorClass) GetMountAdded() func(*VolumeMonitor, Mount)

GetMountAdded gets the "mount_added" callback function.

func (*VolumeMonitorClass) GetMountChanged

func (x *VolumeMonitorClass) GetMountChanged() func(*VolumeMonitor, Mount)

GetMountChanged gets the "mount_changed" callback function.

func (*VolumeMonitorClass) GetMountPreUnmount

func (x *VolumeMonitorClass) GetMountPreUnmount() func(*VolumeMonitor, Mount)

GetMountPreUnmount gets the "mount_pre_unmount" callback function.

func (*VolumeMonitorClass) GetMountRemoved

func (x *VolumeMonitorClass) GetMountRemoved() func(*VolumeMonitor, Mount)

GetMountRemoved gets the "mount_removed" callback function.

func (*VolumeMonitorClass) GetVolumeAdded

func (x *VolumeMonitorClass) GetVolumeAdded() func(*VolumeMonitor, Volume)

GetVolumeAdded gets the "volume_added" callback function.

func (*VolumeMonitorClass) GetVolumeChanged

func (x *VolumeMonitorClass) GetVolumeChanged() func(*VolumeMonitor, Volume)

GetVolumeChanged gets the "volume_changed" callback function.

func (*VolumeMonitorClass) GetVolumeRemoved

func (x *VolumeMonitorClass) GetVolumeRemoved() func(*VolumeMonitor, Volume)

GetVolumeRemoved gets the "volume_removed" callback function.

func (*VolumeMonitorClass) GoPointer

func (x *VolumeMonitorClass) GoPointer() uintptr

func (*VolumeMonitorClass) OverrideAdoptOrphanMount

func (x *VolumeMonitorClass) OverrideAdoptOrphanMount(cb func(Mount, *VolumeMonitor) *VolumeBase)

OverrideAdoptOrphanMount sets the "adopt_orphan_mount" callback function.

func (*VolumeMonitorClass) OverrideDriveChanged

func (x *VolumeMonitorClass) OverrideDriveChanged(cb func(*VolumeMonitor, Drive))

OverrideDriveChanged sets the "drive_changed" callback function.

func (*VolumeMonitorClass) OverrideDriveConnected

func (x *VolumeMonitorClass) OverrideDriveConnected(cb func(*VolumeMonitor, Drive))

OverrideDriveConnected sets the "drive_connected" callback function.

func (*VolumeMonitorClass) OverrideDriveDisconnected

func (x *VolumeMonitorClass) OverrideDriveDisconnected(cb func(*VolumeMonitor, Drive))

OverrideDriveDisconnected sets the "drive_disconnected" callback function.

func (*VolumeMonitorClass) OverrideDriveEjectButton

func (x *VolumeMonitorClass) OverrideDriveEjectButton(cb func(*VolumeMonitor, Drive))

OverrideDriveEjectButton sets the "drive_eject_button" callback function.

func (*VolumeMonitorClass) OverrideDriveStopButton

func (x *VolumeMonitorClass) OverrideDriveStopButton(cb func(*VolumeMonitor, Drive))

OverrideDriveStopButton sets the "drive_stop_button" callback function.

func (*VolumeMonitorClass) OverrideGReserved1

func (x *VolumeMonitorClass) OverrideGReserved1(cb func())

OverrideGReserved1 sets the "_g_reserved1" callback function.

func (*VolumeMonitorClass) OverrideGReserved2

func (x *VolumeMonitorClass) OverrideGReserved2(cb func())

OverrideGReserved2 sets the "_g_reserved2" callback function.

func (*VolumeMonitorClass) OverrideGReserved3

func (x *VolumeMonitorClass) OverrideGReserved3(cb func())

OverrideGReserved3 sets the "_g_reserved3" callback function.

func (*VolumeMonitorClass) OverrideGReserved4

func (x *VolumeMonitorClass) OverrideGReserved4(cb func())

OverrideGReserved4 sets the "_g_reserved4" callback function.

func (*VolumeMonitorClass) OverrideGReserved5

func (x *VolumeMonitorClass) OverrideGReserved5(cb func())

OverrideGReserved5 sets the "_g_reserved5" callback function.

func (*VolumeMonitorClass) OverrideGReserved6

func (x *VolumeMonitorClass) OverrideGReserved6(cb func())

OverrideGReserved6 sets the "_g_reserved6" callback function.

func (*VolumeMonitorClass) OverrideGetConnectedDrives

func (x *VolumeMonitorClass) OverrideGetConnectedDrives(cb func(*VolumeMonitor) *glib.List)

OverrideGetConnectedDrives sets the "get_connected_drives" callback function.

func (*VolumeMonitorClass) OverrideGetMountForUuid

func (x *VolumeMonitorClass) OverrideGetMountForUuid(cb func(*VolumeMonitor, string) *MountBase)

OverrideGetMountForUuid sets the "get_mount_for_uuid" callback function.

func (*VolumeMonitorClass) OverrideGetMounts

func (x *VolumeMonitorClass) OverrideGetMounts(cb func(*VolumeMonitor) *glib.List)

OverrideGetMounts sets the "get_mounts" callback function.

func (*VolumeMonitorClass) OverrideGetVolumeForUuid

func (x *VolumeMonitorClass) OverrideGetVolumeForUuid(cb func(*VolumeMonitor, string) *VolumeBase)

OverrideGetVolumeForUuid sets the "get_volume_for_uuid" callback function.

func (*VolumeMonitorClass) OverrideGetVolumes

func (x *VolumeMonitorClass) OverrideGetVolumes(cb func(*VolumeMonitor) *glib.List)

OverrideGetVolumes sets the "get_volumes" callback function.

func (*VolumeMonitorClass) OverrideIsSupported

func (x *VolumeMonitorClass) OverrideIsSupported(cb func() bool)

OverrideIsSupported sets the "is_supported" callback function.

func (*VolumeMonitorClass) OverrideMountAdded

func (x *VolumeMonitorClass) OverrideMountAdded(cb func(*VolumeMonitor, Mount))

OverrideMountAdded sets the "mount_added" callback function.

func (*VolumeMonitorClass) OverrideMountChanged

func (x *VolumeMonitorClass) OverrideMountChanged(cb func(*VolumeMonitor, Mount))

OverrideMountChanged sets the "mount_changed" callback function.

func (*VolumeMonitorClass) OverrideMountPreUnmount

func (x *VolumeMonitorClass) OverrideMountPreUnmount(cb func(*VolumeMonitor, Mount))

OverrideMountPreUnmount sets the "mount_pre_unmount" callback function.

func (*VolumeMonitorClass) OverrideMountRemoved

func (x *VolumeMonitorClass) OverrideMountRemoved(cb func(*VolumeMonitor, Mount))

OverrideMountRemoved sets the "mount_removed" callback function.

func (*VolumeMonitorClass) OverrideVolumeAdded

func (x *VolumeMonitorClass) OverrideVolumeAdded(cb func(*VolumeMonitor, Volume))

OverrideVolumeAdded sets the "volume_added" callback function.

func (*VolumeMonitorClass) OverrideVolumeChanged

func (x *VolumeMonitorClass) OverrideVolumeChanged(cb func(*VolumeMonitor, Volume))

OverrideVolumeChanged sets the "volume_changed" callback function.

func (*VolumeMonitorClass) OverrideVolumeRemoved

func (x *VolumeMonitorClass) OverrideVolumeRemoved(cb func(*VolumeMonitor, Volume))

OverrideVolumeRemoved sets the "volume_removed" callback function.

type ZlibCompressor

type ZlibCompressor struct {
	gobject.Object
}

`GZlibCompressor` is an implementation of [iface@Gio.Converter] that compresses data using zlib.

func NewZlibCompressor

func NewZlibCompressor(FormatVar ZlibCompressorFormat, LevelVar int) *ZlibCompressor

Creates a compressor.

func ZlibCompressorNewFromInternalPtr

func ZlibCompressorNewFromInternalPtr(ptr uintptr) *ZlibCompressor

func (*ZlibCompressor) Convert

func (x *ZlibCompressor) Convert(InbufVar []byte, InbufSizeVar uint, OutbufVar []byte, OutbufSizeVar uint, FlagsVar ConverterFlags, BytesReadVar *uint, BytesWrittenVar *uint) (ConverterResult, error)

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).

func (*ZlibCompressor) ConvertBytes

func (x *ZlibCompressor) ConvertBytes(BytesVar *glib.Bytes) (*glib.Bytes, error)

Applies @converter to the data in @bytes.

func (*ZlibCompressor) GetFileInfo

func (x *ZlibCompressor) GetFileInfo() *FileInfo

Gets the [property@Gio.ZlibCompressor:file-info] property.

func (*ZlibCompressor) GetOs

func (x *ZlibCompressor) GetOs() int

Gets the [property@Gio.ZlibCompressor:os] property.

func (*ZlibCompressor) GetPropertyLevel

func (x *ZlibCompressor) GetPropertyLevel() int

GetPropertyLevel gets the "level" property. The level of compression from `0` (no compression) to `9` (most compression).

`-1` for the default level.

func (*ZlibCompressor) GetPropertyOs

func (x *ZlibCompressor) GetPropertyOs() int

GetPropertyOs gets the "os" property. The OS code of the gzip header.

This will be used if set to a non-negative value, and if [property@Gio.ZlibCompressor:format] is [enum@Gio.ZlibCompressorFormat.GZIP], the compressor will set the OS code of the gzip header to this value.

If the value is unset, zlib will set the OS code depending on the platform. This may be undesirable when reproducible output is desired. In that case setting the OS code to `3` (for Unix) is recommended.

func (*ZlibCompressor) GoPointer

func (c *ZlibCompressor) GoPointer() uintptr

func (*ZlibCompressor) Reset

func (x *ZlibCompressor) Reset()

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.

func (*ZlibCompressor) SetFileInfo

func (x *ZlibCompressor) SetFileInfo(FileInfoVar *FileInfo)

Sets the [property@Gio.ZlibCompressor:file-info] property.

Note: it is an error to call this function while a compression is in progress; it may only be called immediately after creation of @compressor, or after resetting it with [method@Gio.Converter.reset].

func (*ZlibCompressor) SetGoPointer

func (c *ZlibCompressor) SetGoPointer(ptr uintptr)

func (*ZlibCompressor) SetOs

func (x *ZlibCompressor) SetOs(OsVar int)

Sets the [property@Gio.ZlibCompressor:os] property.

Note: it is an error to call this function while a compression is in progress; it may only be called immediately after creation of @compressor, or after resetting it with [method@Gio.Converter.reset].

func (*ZlibCompressor) SetPropertyLevel

func (x *ZlibCompressor) SetPropertyLevel(value int)

SetPropertyLevel sets the "level" property. The level of compression from `0` (no compression) to `9` (most compression).

`-1` for the default level.

func (*ZlibCompressor) SetPropertyOs

func (x *ZlibCompressor) SetPropertyOs(value int)

SetPropertyOs sets the "os" property. The OS code of the gzip header.

This will be used if set to a non-negative value, and if [property@Gio.ZlibCompressor:format] is [enum@Gio.ZlibCompressorFormat.GZIP], the compressor will set the OS code of the gzip header to this value.

If the value is unset, zlib will set the OS code depending on the platform. This may be undesirable when reproducible output is desired. In that case setting the OS code to `3` (for Unix) is recommended.

type ZlibCompressorClass

type ZlibCompressorClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*ZlibCompressorClass) GoPointer

func (x *ZlibCompressorClass) GoPointer() uintptr

type ZlibCompressorFormat

type ZlibCompressorFormat int

Used to select the type of data format to use for #GZlibDecompressor and #GZlibCompressor.

const (

	// deflate compression with zlib header
	GZlibCompressorFormatZlibValue ZlibCompressorFormat = 0
	// gzip file format
	GZlibCompressorFormatGzipValue ZlibCompressorFormat = 1
	// deflate compression with no header
	GZlibCompressorFormatRawValue ZlibCompressorFormat = 2
)

type ZlibDecompressor

type ZlibDecompressor struct {
	gobject.Object
}

`GZlibDecompressor` is an implementation of [iface@Gio.Converter] that decompresses data compressed with zlib.

func NewZlibDecompressor

func NewZlibDecompressor(FormatVar ZlibCompressorFormat) *ZlibDecompressor

Creates a new decompressor.

func ZlibDecompressorNewFromInternalPtr

func ZlibDecompressorNewFromInternalPtr(ptr uintptr) *ZlibDecompressor

func (*ZlibDecompressor) Convert

func (x *ZlibDecompressor) Convert(InbufVar []byte, InbufSizeVar uint, OutbufVar []byte, OutbufSizeVar uint, FlagsVar ConverterFlags, BytesReadVar *uint, BytesWrittenVar *uint) (ConverterResult, error)

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).

func (*ZlibDecompressor) ConvertBytes

func (x *ZlibDecompressor) ConvertBytes(BytesVar *glib.Bytes) (*glib.Bytes, error)

Applies @converter to the data in @bytes.

func (*ZlibDecompressor) GetFileInfo

func (x *ZlibDecompressor) GetFileInfo() *FileInfo

Gets the [property@Gio.ZlibDecompressor:file-info] property.

func (*ZlibDecompressor) GoPointer

func (c *ZlibDecompressor) GoPointer() uintptr

func (*ZlibDecompressor) Reset

func (x *ZlibDecompressor) Reset()

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.

func (*ZlibDecompressor) SetGoPointer

func (c *ZlibDecompressor) SetGoPointer(ptr uintptr)

type ZlibDecompressorClass

type ZlibDecompressorClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*ZlibDecompressorClass) GoPointer

func (x *ZlibDecompressorClass) GoPointer() uintptr

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL