[1677:7] extends: object
Specifies the type of function passed to g_node_children_foreach(). The function is called with each child node, together with the user data passed to g_node_children_foreach().
NodeForeachFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (node, data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[3048:7] extends: object
Declares a type of function which takes no arguments and has no return value. It is used to specify the type function passed to g_atexit().
VoidFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline ()
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[3117:14] static extends: object
Generated low-level function wrappers for namespace GLib.
getLib ()
access (string filename, int mode)
A wrapper for the POSIX access() function. This function is used to test a pathname for one or several of read, write or execute permissions, or just existence. On Windows, the file protection mechanism is not at all POSIX-like, and the underlying function in the C library only checks the FAT-style READONLY attribute, and does not look at the ACL of a file at all. This function is this in practise almost useless on Windows. Software that needs to handle file permissions on Windows more exactly should use the Win32 API. See your C library manual for more details about access().
filename is a pathname in the GLib file name encoding (UTF-8 on Windows).mode is as in access().aligned_alloc (int n_blocks, int n_block_bytes, int alignment)
This function is similar to g_malloc(), allocating (@n_blocks *
bytes, but care is taken to align the allocated memory to with the given alignment value. Additionally, it will detect possible overflow during multiplication. If the allocation fails (because the system is out of memory), the program is terminated. Aligned memory allocations returned by this function can only be freed using g_aligned_free_sized() or g_aligned_free().n_blocks is the number of blocks to allocate.n_block_bytes is the size of each block in bytes.alignment is the alignment to be enforced, which must be a positive power of 2 and a multiple of sizeof(void*).aligned_alloc0 (int n_blocks, int n_block_bytes, int alignment)
This function is similar to g_aligned_alloc(), but it will also clear the allocated memory before returning it.
n_blocks is the number of blocks to allocate.n_block_bytes is the size of each block in bytes.alignment is the alignment to be enforced, which must be a positive power of 2 and a multiple of sizeof(void*).aligned_free (mem)
Frees the memory allocated by g_aligned_alloc().
mem is the memory to deallocate.None.aligned_free_sized (mem, int alignment, int size)
Frees the memory pointed to by @mem, assuming it is has the given @size and @alignment. If @mem is %NULL this is a no-op (and @size is ignored). It is an error if @size doesn’t match the size, or @alignment doesn’t match the alignment, passed when @mem was allocated. @size and @alignment are passed to this function to allow optimizations in the allocator. If you don’t know either of them, use g_aligned_free() instead.
mem is the memory to free.alignment is alignment of @mem.size is size of @mem, in bytes.None.array_new_take (data, int len, bool clear, int element_size)
Creates a new
GArraywith @data as array data, @len as length and a reference count of 1. This avoids having to copy the data manually, when it can just be inherited. After this call, @data belongs to theGArrayand may no longer be modified by the caller. The memory of @data has to be dynamically allocated and will eventually be freed with [func@GLib.free]. In case the elements need to be cleared when the array is freed, use [func@GLib.Array.set_clear_func] to set a [callback@GLib.DestroyNotify] function to perform such task. Do not use it if @len or @element_size are greater thanG_MAXUINT.GArraystores the length of its data inguint, which may be shorter thangsize.
data is an array of elements of @element_size.len is the number of elements in @data.clear is if true, GArray elements should be automatically cleared to 0 when they are allocated.element_size is the size of each element in bytes.array_new_take_zero_terminated (data, bool clear, int element_size)
Creates a new
GArraywith @data as array data, computing the length of it and setting the reference count to 1. This avoids having to copy the data manually, when it can just be inherited. After this call, @data belongs to theGArrayand may no longer be modified by the caller. The memory of @data has to be dynamically allocated and will eventually be freed with [func@GLib.free]. The length is calculated by iterating through @data until the firstNULLelement is found. In case the elements need to be cleared when the array is freed, use [func@GLib.Array.set_clear_func] to set a [callback@GLib.DestroyNotify] function to perform such task. Do not use it if @data length or
are greater than G_MAXUINT. GArray stores the length of its data in guint, which may be shorter than gsize.data is an array of elements of @element_size, NULL terminated.clear is if true, GArray elements should be automatically cleared to 0 when they are allocated.element_size is the size of each element in bytes.ascii_digit_value (int c)
Determines the numeric value of a character as a decimal digit. If the character is not a decimal digit according to [func@GLib.ascii_isdigit],
-1is returned. Differs from [func@GLib.unichar_digit_value] because it takes a char, so there's no worry about sign extension if characters are signed.
c is an ASCII character.ascii_dtostr (string buffer, int buf_len, double d)
Converts a
gdoubleto a string, using the '.' as decimal point. This function generates enough precision that converting the string back using [func@GLib.ascii_strtod] gives the same machine-number (on machines with IEEE compatible 64bit doubles). It is guaranteed that the size of the resulting string will never be larger than [const@GLib.ASCII_DTOSTR_BUF_SIZE] bytes, including the terminating nul character, which is always added.
buffer is a buffer to place the resulting string in.buf_len is the length of the buffer.d is the value to convert.ascii_formatd (string buffer, int buf_len, string format, double d)
Converts a
gdoubleto a string, using the '.' as decimal point. To format the number you pass in aprintf()-style format string. Allowed conversion specifiers are 'e', 'E', 'f', 'F', 'g' and 'G'. The @format must just be a single format specifier starting with%, expecting agdoubleargument. The returned buffer is guaranteed to be nul-terminated. If you just want to want to serialize the value into a string, use [func@GLib.ascii_dtostr].
buffer is a buffer to place the resulting string in.buf_len is the length of the buffer.format is the printf()-style format to use for the code to use for converting.d is the value to convert.ascii_strcasecmp (string s1, string s2)
Compare two strings, ignoring the case of ASCII characters. Unlike the BSD
strcasecmp()function, this only recognizes standard ASCII letters and ignores the locale, treating all non-ASCII bytes as if they are not letters. This function should be used only on strings that are known to be in encodings where the bytes corresponding to ASCII letters always represent themselves. This includes UTF-8 and the ISO-8859-* charsets, but not for instance double-byte encodings like the Windows Codepage 932, where the trailing bytes of double-byte characters include all ASCII letters. If you compare two CP932 strings using this function, you will get false matches. Both @s1 and @s2 must be non-NULL.
s1 is string to compare with @s2.s2 is string to compare with @s1.ascii_strdown (string str, int len)
Converts all upper case ASCII letters to lower case ASCII letters, with semantics that exactly match [func@GLib.ascii_tolower].
str is a string.len is length of @str in bytes, or -1 if @str is nul-terminated.ascii_strncasecmp (string s1, string s2, int n)
Compare @s1 and @s2, ignoring the case of ASCII characters and any characters after the first @n in each string. If either string is less than @n bytes long, comparison will stop at the first nul byte encountered. Unlike the BSD
strncasecmp()function, this only recognizes standard ASCII letters and ignores the locale, treating all non-ASCII characters as if they are not letters. The same warning as in [func@GLib.ascii_strcasecmp] applies: Use this function only on strings known to be in encodings where bytes corresponding to ASCII letters always represent themselves.
s1 is string to compare with @s2.s2 is string to compare with @s1.n is number of characters to compare.ascii_strup (string str, int len)
Converts all lower case ASCII letters to upper case ASCII letters, with semantics that exactly match [func@GLib.ascii_toupper].
str is a string.len is length of @str in bytes, or -1 if @str is nul-terminated.ascii_tolower (int c)
Convert a character to ASCII lower case. If the character is not an ASCII upper case letter, it is returned unchanged. Unlike the standard C library
tolower()function, this only recognizes standard ASCII letters and ignores the locale, returning all non-ASCII characters unchanged, even if they are lower case letters in a particular character set. Also unlike the standard library function, this takes and returns a char, not an int, so don't call it onEOFbut no need to worry about casting togucharbefore passing a possibly non-ASCII character in.
c is any character.ascii_toupper (int c)
Convert a character to ASCII upper case. If the character is not an ASCII lower case letter, it is returned unchanged. Unlike the standard C library
toupper()function, this only recognizes standard ASCII letters and ignores the locale, returning all non-ASCII characters unchanged, even if they are upper case letters in a particular character set. Also unlike the standard library function, this takes and returns a char, not an int, so don't call it onEOFbut no need to worry about casting togucharbefore passing a possibly non-ASCII character in.
c is any character.ascii_xdigit_value (int c)
Determines the numeric value of a character as a hexadecimal digit. If the character is not a hex digit according to [func@GLib.ascii_isxdigit],
-1is returned. Differs from [func@GLib.unichar_xdigit_value] because it takes a char, so there's no worry about sign extension if characters are signed. Differs from [func@GLib.unichar_xdigit_value] because it takes a char, so there's no worry about sign extension if characters are signed.
c is an ASCII character.assert_warning (string log_domain, string file, int line, string pretty_function, string expression)
Generated wrapper for GIR function
assert_warning. Native symbol:g_assert_warning.
None.assertion_message (string domain, string file, int line, string func, string message)
Generated wrapper for GIR function
assertion_message. Native symbol:g_assertion_message.
None.assertion_message_cmpstr (string domain, string file, int line, string func, string expr, string arg1, string cmp, string arg2)
Generated wrapper for GIR function
assertion_message_cmpstr. Native symbol:g_assertion_message_cmpstr.
None.assertion_message_cmpstrv (string domain, string file, int line, string func, string expr, string arg1, string arg2, int first_wrong_idx)
Generated wrapper for GIR function
assertion_message_cmpstrv. Native symbol:g_assertion_message_cmpstrv.
None.assertion_message_expr (string domain, string file, int line, string func, string expr)
Internal function used to print messages from the public g_assert() and g_assert_not_reached() macros.
domain is log domain.file is file containing the assertion.line is line number of the assertion.func is function containing the assertion.expr is expression which failed.None.async_queue_new ()
Creates a new asynchronous queue.
atomic_int_add (atomic, int val)
Atomically adds @val to the value of @atomic. Think of this operation as an atomic version of
{ tmp = *atomic; *atomic += val; return tmp; }. This call acts as a full compiler and hardware memory barrier. Before version 2.30, this function did not return a value (but g_atomic_int_exchange_and_add() did, and had the same meaning). While
has a volatile qualifier, this is a historical artifact and the pointer passed to it should not be volatile.atomic is a pointer to a #gint or #guint.val is the value to add.atomic_int_and (atomic, int val)
Performs an atomic bitwise 'and' of the value of @atomic and @val, storing the result back in @atomic. This call acts as a full compiler and hardware memory barrier. Think of this operation as an atomic version of
{ tmp = *atomic; *atomic &= val; return tmp; }. While @atomic has avolatilequalifier, this is a historical artifact and the pointer passed to it should not bevolatile.
atomic is a pointer to a #gint or #guint.val is the value to 'and'.atomic_int_compare_and_exchange (atomic, int oldval, int newval)
Compares @atomic to @oldval and, if equal, sets it to @newval. If @atomic was not equal to @oldval then no change occurs. This compare and exchange is done atomically. Think of this operation as an atomic version of
{ if (*atomic == oldval) { *atomic = newval; return TRUE; } else return FALSE; }. This call acts as a full compiler and hardware memory barrier. While
has a volatile qualifier, this is a historical artifact and the pointer passed to it should not be volatile.atomic is a pointer to a #gint or #guint.oldval is the value to compare with.newval is the value to conditionally replace with.atomic_int_dec_and_test (atomic)
Decrements the value of @atomic by 1. Think of this operation as an atomic version of
{ *atomic -= 1; return (*atomic == 0); }. This call acts as a full compiler and hardware memory barrier. While @atomic has avolatilequalifier, this is a historical artifact and the pointer passed to it should not bevolatile.
atomic is a pointer to a #gint or #guint.atomic_int_exchange (atomic, int newval)
Sets the @atomic to @newval and returns the old value from @atomic. This exchange is done atomically. Think of this operation as an atomic version of
{ tmp = *atomic; *atomic = val; return tmp; }. This call acts as a full compiler and hardware memory barrier.
atomic is a pointer to a #gint or #guint.newval is the value to replace with.atomic_int_exchange_and_add (atomic, int val)
This function existed before g_atomic_int_add() returned the prior value of the integer (which it now does). It is retained only for compatibility reasons. Don't use this function in new code.
atomic is a pointer to a #gint.val is the value to add.atomic_int_get (atomic)
Gets the current value of @atomic. This call acts as a full compiler and hardware memory barrier. While @atomic has a
volatilequalifier, this is a historical artifact and the pointer passed to it should not bevolatile.
atomic is a pointer to a #gint or #guint.atomic_int_inc (atomic)
Increments the value of @atomic by 1. Think of this operation as an atomic version of
{ *atomic += 1; }. This call acts as a full compiler and hardware memory barrier. While @atomic has avolatilequalifier, this is a historical artifact and the pointer passed to it should not bevolatile.
atomic is a pointer to a #gint or #guint.None.atomic_int_or (atomic, int val)
Performs an atomic bitwise 'or' of the value of @atomic and @val, storing the result back in @atomic. Think of this operation as an atomic version of
{ tmp = *atomic; *atomic |= val; return tmp; }. This call acts as a full compiler and hardware memory barrier. While @atomic has avolatilequalifier, this is a historical artifact and the pointer passed to it should not bevolatile.
atomic is a pointer to a #gint or #guint.val is the value to 'or'.atomic_int_set (atomic, int newval)
Sets the value of @atomic to @newval. This call acts as a full compiler and hardware memory barrier. While @atomic has a
volatilequalifier, this is a historical artifact and the pointer passed to it should not bevolatile.
atomic is a pointer to a #gint or #guint.newval is a new value to store.None.atomic_int_xor (atomic, int val)
Performs an atomic bitwise 'xor' of the value of @atomic and @val, storing the result back in @atomic. Think of this operation as an atomic version of
{ tmp = *atomic; *atomic ^= val; return tmp; }. This call acts as a full compiler and hardware memory barrier. While @atomic has avolatilequalifier, this is a historical artifact and the pointer passed to it should not bevolatile.
atomic is a pointer to a #gint or #guint.val is the value to 'xor'.atomic_pointer_compare_and_exchange (atomic, oldval, newval)
Compares @atomic to @oldval and, if equal, sets it to @newval. If @atomic was not equal to @oldval then no change occurs. This compare and exchange is done atomically. Think of this operation as an atomic version of
{ if (*atomic == oldval) { *atomic = newval; return TRUE; } else return FALSE; }. This call acts as a full compiler and hardware memory barrier. While
has a volatile qualifier, this is a historical artifact and the pointer passed to it should not be volatile.atomic is a pointer to a #gpointer-sized value.oldval is the value to compare with.newval is the value to conditionally replace with.atomic_pointer_exchange (atomic, newval)
Sets the @atomic to @newval and returns the old value from @atomic. This exchange is done atomically. Think of this operation as an atomic version of
{ tmp = *atomic; *atomic = val; return tmp; }. This call acts as a full compiler and hardware memory barrier.
atomic is a pointer to a #gpointer-sized value.newval is the value to replace with.atomic_pointer_get (atomic)
Gets the current value of @atomic. This call acts as a full compiler and hardware memory barrier. While @atomic has a
volatilequalifier, this is a historical artifact and the pointer passed to it should not bevolatile.
atomic is a pointer to a #gpointer-sized value.atomic_pointer_set (atomic, newval)
Sets the value of @atomic to @newval. This call acts as a full compiler and hardware memory barrier. While @atomic has a
volatilequalifier, this is a historical artifact and the pointer passed to it should not bevolatile.
atomic is a pointer to a #gpointer-sized value.newval is a new value to store.None.atomic_rc_box_acquire (mem_block)
Atomically acquires a reference on the data pointed by @mem_block.
mem_block is a pointer to reference counted data.atomic_rc_box_alloc (int block_size)
Allocates @block_size bytes of memory, and adds atomic reference counting semantics to it. The data will be freed when its reference count drops to zero. The allocated data is guaranteed to be suitably aligned for any built-in type.
block_size is the size of the allocation, must be greater than 0.atomic_rc_box_alloc0 (int block_size)
Allocates @block_size bytes of memory, and adds atomic reference counting semantics to it. The contents of the returned data is set to zero. The data will be freed when its reference count drops to zero. The allocated data is guaranteed to be suitably aligned for any built-in type.
block_size is the size of the allocation, must be greater than 0.atomic_rc_box_dup (int block_size, mem_block)
Allocates a new block of data with atomic reference counting semantics, and copies @block_size bytes of @mem_block into it.
block_size is the number of bytes to copy, must be greater than 0.mem_block is the memory to copy.atomic_rc_box_get_size (mem_block)
Retrieves the size of the reference counted data pointed by @mem_block.
mem_block is a pointer to reference counted data.atomic_rc_box_release (mem_block)
Atomically releases a reference on the data pointed by @mem_block. If the reference was the last one, it will free the resources allocated for
mem_block is a pointer to reference counted data.None.atomic_ref_count_compare (int arc, int val)
Atomically compares the current value of @arc with @val.
arc is the address of an atomic reference count variable.val is the value to compare.atomic_ref_count_dec (int arc)
Atomically decreases the reference count. If %TRUE is returned, the reference count reached 0. After this point, @arc is an undefined state and must be reinitialized with g_atomic_ref_count_init() to be used again.
arc is the address of an atomic reference count variable.atomic_ref_count_inc (int arc)
Atomically increases the reference count.
arc is the address of an atomic reference count variable.None.basename (string file_name)
Gets the name of the file without any leading directory components. It returns a pointer into the given file name string.
file_name is the name of the file.bit_lock (address, int lock_bit)
Sets the indicated @lock_bit in @address. If the bit is already set, this call will block until g_bit_unlock() unsets the corresponding bit. Attempting to lock on two different bits within the same integer is not supported and will very probably cause deadlocks. The value of the bit that is set is (1u << @bit). If @bit is not between 0 and 31 then the result is undefined. This function accesses @address atomically. All other accesses to @address must be atomic in order for this function to work reliably. While @address has a
volatilequalifier, this is a historical artifact and the argument passed to it should not bevolatile.
address is a pointer to an integer.lock_bit is a bit value between 0 and 31.None.bit_nth_lsf (int mask, int nth_bit)
Find the position of the first bit set in @mask, searching from (but not including) @nth_bit upwards. Bits are numbered from 0 (least significant) to sizeof(#gulong) * 8 - 1 (31 or 63, usually). To start searching from the 0th bit, set @nth_bit to -1.
mask is a #gulong containing flags.nth_bit is the index of the bit to start the search from.bit_nth_msf (int mask, int nth_bit)
Find the position of the first bit set in @mask, searching from (but not including) @nth_bit downwards. Bits are numbered from 0 (least significant) to sizeof(#gulong) * 8 - 1 (31 or 63, usually). To start searching from the last bit, set @nth_bit to -1 or GLIB_SIZEOF_LONG * 8.
mask is a #gulong containing flags.nth_bit is the index of the bit to start the search from.bit_storage (int number)
Gets the number of bits used to hold @number, e.g. if @number is 4, 3 bits are needed.
number is a #guint.bit_trylock (address, int lock_bit)
Sets the indicated @lock_bit in @address, returning %TRUE if successful. If the bit is already set, returns %FALSE immediately. Attempting to lock on two different bits within the same integer is not supported. The value of the bit that is set is (1u << @bit). If @bit is not between 0 and 31 then the result is undefined. This function accesses @address atomically. All other accesses to @address must be atomic in order for this function to work reliably. While @address has a
volatilequalifier, this is a historical artifact and the argument passed to it should not bevolatile.
address is a pointer to an integer.lock_bit is a bit value between 0 and 31.bit_unlock (address, int lock_bit)
Clears the indicated @lock_bit in @address. If another thread is currently blocked in g_bit_lock() on this same bit then it will be woken up. This function accesses @address atomically. All other accesses to
must be atomic in order for this function to work reliably. While @address has a volatile qualifier, this is a historical artifact and the argument passed to it should not be volatile.address is a pointer to an integer.lock_bit is a bit value between 0 and 31.None.bit_unlock_and_set (address, int lock_bit, int new_val, int preserve_mask)
This is like [func@GLib.bit_unlock] but also atomically sets @address to
If @preserve_mask is not zero, then the @preserve_mask bits will be preserved in @address and are not set to @val. Note that the @lock_bit bit will always be unset regardless of @val, @preserve_mask and the currently set value in @address.address is a pointer to an integer.lock_bit is a bit value between 0 and 31.new_val is the new value to set.preserve_mask is mask for bits from @address to preserve.None.blow_chunks ()
Generated wrapper for GIR function
blow_chunks. Native symbol:g_blow_chunks.
None.build_filenamev (list args)
Creates a filename from a vector of elements using the correct separator for the current platform. This function behaves exactly like g_build_filename(), but takes the path elements as a string array, instead of varargs. This function is mainly meant for language bindings. If you are building a path programmatically you may want to use #GPathBuf instead.
args is %NULL-terminated array of strings containing the path elements..build_pathv (string separator, list args)
Behaves exactly like g_build_path(), but takes the path elements as a string array, instead of variadic arguments. This function is mainly meant for language bindings.
separator is a string used to separate the elements of the path..args is %NULL-terminated array of strings containing the path elements..canonicalize_filename (string filename, string relative_to)
Gets the canonical file name from @filename. All triple slashes are turned into single slashes, and all
..and.s resolved against
Symlinks are not followed, and the returned path is guaranteed to be absolute. If @filename is an absolute path, @relative_to is ignored. Otherwise, @relative_to will be prepended to @filename to make it absolute. @relative_to must be an absolute path, or %NULL. Ifis %NULL, it'll fallback to g_get_current_dir(). This function never fails, and will canonicalize file paths even if they don't exist. No file system I/O is done.filename is the name of the file.relative_to is the relative directory, or %NULL to use the current working directory.chdir (string path)
A wrapper for the POSIX chdir() function. The function changes the current directory of the process to @path. See your C library manual for more details about chdir().
path is a pathname in the GLib file name encoding (UTF-8 on Windows).check_version (int required_major, int required_minor, int required_micro)
Checks that the GLib library in use is compatible with the given version. Generally you would pass in the constants %GLIB_MAJOR_VERSION, %GLIB_MINOR_VERSION, %GLIB_MICRO_VERSION as the three arguments to this function; that produces a check that the library in use is compatible with the version of GLib the application or module was compiled against. Compatibility is defined by two things: first the version of the running library is newer than the version
@required_major.required_minor.@required_micro. Second the running library must be binary compatible with the version@required_major.@required_minor.@required_micro(same major version.)
required_major is the required major version.required_minor is the required minor version.required_micro is the required micro version.checksum_type_get_length (string checksum_type)
Gets the length in bytes of digests of type @checksum_type
checksum_type is a #GChecksumType.chmod (string filename, int mode)
A wrapper for the POSIX chmod() function. The chmod() function is used to set the permissions of a file system object. On Windows the file protection mechanism is not at all POSIX-like, and the underlying chmod() function in the C library just sets or clears the FAT-style READONLY attribute. It does not touch any ACL. Software that needs to manage file permissions on Windows exactly should use the Win32 API. See your C library manual for more details about chmod().
filename is a pathname in the GLib file name encoding (UTF-8 on Windows).mode is as in chmod().clear_error ()
If @err or
*erris %NULL, does nothing. Otherwise, calls g_error_free() on*errand sets*errto %NULL.
None.close (int fd)
This wraps the close() call. In case of error, %errno will be preserved, but the error will also be stored as a #GError in @error. In case of success, %errno is undefined. Besides using #GError, there is another major reason to prefer this function over the call provided by the system; on Unix, it will attempt to correctly handle %EINTR, which has platform-specific semantics. It is a bug to call this function with an invalid file descriptor. On POSIX platforms since GLib 2.76, this function is async-signal safe if (and only if) @error is %NULL and @fd is a valid open file descriptor. This makes it safe to call from a signal handler or a #GSpawnChildSetupFunc under those conditions. See
signal(7)andsignal-safety(7)for more details.
fd is A file descriptor.compute_checksum_for_bytes (string checksum_type, object data)
Computes the checksum for a binary @data. This is a convenience wrapper for g_checksum_new(), g_checksum_get_string() and g_checksum_free(). The hexadecimal string returned will be in lower case.
checksum_type is a #GChecksumType.data is binary blob to compute the digest of.compute_checksum_for_string (string checksum_type, string str, int length)
Computes the checksum of a string. The hexadecimal string returned will be in lower case.
checksum_type is a #GChecksumType.str is the string to compute the checksum of.length is the length of the string, or -1 if the string is null-terminated..compute_hmac_for_bytes (string digest_type, object key, object data)
Computes the HMAC for a binary @data. This is a convenience wrapper for g_hmac_new(), g_hmac_get_string() and g_hmac_unref(). The hexadecimal string returned will be in lower case.
digest_type is a #GChecksumType to use for the HMAC.key is the key to use in the HMAC.data is binary blob to compute the HMAC of.cond_new ()
Allocates and initializes a new #GCond.
creat (string filename, int mode)
A wrapper for the POSIX creat() function. The creat() function is used to convert a pathname into a file descriptor, creating a file if necessary. On POSIX systems file descriptors are implemented by the operating system. On Windows, it's the C library that implements creat() and file descriptors. The actual Windows API for opening files is different, see MSDN documentation for CreateFile(). The Win32 API uses file handles, which are more randomish integers, not small integers like file descriptors. Because file descriptors are specific to the C library on Windows, the file descriptor returned by this function makes sense only to functions in the same C library. Thus if the GLib-using code uses a different C library than GLib does, the file descriptor returned by this function cannot be passed to C library functions like write() or read(). See your C library manual for more details about creat().
filename is a pathname in the GLib file name encoding (UTF-8 on Windows).mode is as in creat().datalist_clear (object datalist)
Frees all the data elements of the datalist. The data elements' destroy functions are called if they have been set.
datalist is a datalist..None.datalist_get_data (object datalist, string key)
Gets a data element, using its string identifier. This is slower than g_datalist_id_get_data() because it compares strings.
datalist is a datalist..key is the string identifying a data element..datalist_get_flags (object datalist)
Gets flags values packed in together with the datalist. See g_datalist_set_flags().
datalist is pointer to the location that holds a list.datalist_init (object datalist)
Resets the datalist to %NULL. It does not free any memory or call any destroy functions.
datalist is a pointer to a pointer to a datalist..None.datalist_set_flags (object datalist, int flags)
Turns on flag values for a data list. This function is used to keep a small number of boolean flags in an object with a data list without using any additional space. It is not generally useful except in circumstances where space is very tight. (It is used in the base #GObject type, for example.)
datalist is pointer to the location that holds a list.flags is the flags to turn on. The values of the flags are restricted by %G_DATALIST_FLAGS_MASK (currently 3; giving two possible boolean flags). A value for @flags that doesn't fit within the mask is an error..None.datalist_unset_flags (object datalist, int flags)
Turns off flag values for a data list. See g_datalist_unset_flags()
datalist is pointer to the location that holds a list.flags is the flags to turn off. The values of the flags are restricted by %G_DATALIST_FLAGS_MASK (currently 3: giving two possible boolean flags). A value for @flags that doesn't fit within the mask is an error..None.dataset_destroy (dataset_location)
Destroys the dataset, freeing all memory allocated, and calling any destroy functions set for data elements.
dataset_location is the location identifying the dataset..None.date_strftime (string s, int slen, string format, date)
Generates a printed representation of the date, in a locale-specific way. Works just like the platform's C library strftime() function, but only accepts date-related formats; time-related formats give undefined results. Date must be valid. Unlike strftime() (which uses the locale encoding), works on a UTF-8 format string and stores a UTF-8 result. This function does not provide any conversion specifiers in addition to those implemented by the platform's C library. For example, don't expect that using g_date_strftime() would make the %F provided by the C99 strftime() work on Windows where the C library only complies to C89.
s is destination buffer.slen is buffer size.format is format string.date is valid #GDate.date_valid_month (string month)
Returns %TRUE if the month value is valid. The 12 #GDateMonth enumeration values are the only valid months.
month is month.date_valid_weekday (string weekday)
Returns %TRUE if the weekday is valid. The seven #GDateWeekday enumeration values are the only valid weekdays.
weekday is weekday.dcgettext (string domain, string msgid, int category)
This is a variant of g_dgettext() that allows specifying a locale category instead of always using
LC_MESSAGES. See g_dgettext() for more information about how this functions differs from calling dcgettext() directly.
domain is the translation domain to use, or %NULL to use the domain set with textdomain().msgid is message to translate.category is a locale category.dgettext (string domain, string msgid)
This function is a wrapper of dgettext() which does not translate the message if the default domain as set with textdomain() has no translations for the current locale. The advantage of using this function over dgettext() proper is that libraries using this function (like GTK) will not use translations if the application using the library does not have translations for the current locale. This results in a consistent English-only interface instead of one having partial translations. For this feature to work, the call to textdomain() and setlocale() should precede any g_dgettext() invocations. For GTK, it means calling textdomain() before gtk_init or its variants. This function disables translations if and only if upon its first call all the following conditions hold: - @domain is not %NULL - textdomain() has been called to set a default text domain - there is no translations available for the default text domain and the current locale - current locale is not "C" or any English locales (those starting with "en_") Note that this behavior may not be desired for example if an application has its untranslated messages in a language other than English. In those cases the application should call textdomain() after initializing GTK. Applications should normally not use this function directly, but use the _() macro for translations.
domain is the translation domain to use, or %NULL to use the domain set with textdomain().msgid is message to translate.dir_make_tmp (string tmpl)
Creates a subdirectory in the preferred directory for temporary files (as returned by g_get_tmp_dir()). @tmpl should be a string in the GLib file name encoding containing a sequence of six 'X' characters, as the parameter to g_mkstemp(). However, unlike these functions, the template should only be a basename, no directory components are allowed. If template is %NULL, a default template is used. Note that in contrast to g_mkdtemp() (and mkdtemp()) @tmpl is not modified, and might thus be a read-only literal string.
tmpl is Template for directory name, as in g_mkdtemp(), basename only, or %NULL for a default template.direct_equal (v1, v2)
Compares two #gpointer arguments and returns %TRUE if they are equal. It can be passed to g_hash_table_new() as the @key_equal_func parameter, when using opaque pointers compared by pointer value as keys in a #GHashTable. This equality function is also appropriate for keys that are integers stored in pointers, such as
GINT_TO_POINTER (n).
v1 is a key.v2 is a key to compare with @v1.direct_hash (v)
Converts a gpointer to a hash value. It can be passed to g_hash_table_new() as the @hash_func parameter, when using opaque pointers compared by pointer value as keys in a #GHashTable. This hash function is also appropriate for keys that are integers stored in pointers, such as
GINT_TO_POINTER (n).
v is a #gpointer key.dngettext (string domain, string msgid, string msgid_plural, int n)
This function is a wrapper of dngettext() which does not translate the message if the default domain as set with textdomain() has no translations for the current locale. See g_dgettext() for details of how this differs from dngettext() proper.
domain is the translation domain to use, or %NULL to use the domain set with textdomain().msgid is message to translate.msgid_plural is plural form of the message.n is the quantity for which translation is needed.double_equal (v1, v2)
Compares the two #gdouble values being pointed to and returns %TRUE if they are equal. It can be passed to g_hash_table_new() as the
parameter, when using non-%NULL pointers to doubles as keys in a #GHashTable.v1 is a pointer to a #gdouble key.v2 is a pointer to a #gdouble key to compare with @v1.double_hash (v)
Converts a pointer to a #gdouble to a hash value. It can be passed to g_hash_table_new() as the @hash_func parameter, It can be passed to g_hash_table_new() as the @hash_func parameter, when using non-%NULL pointers to doubles as keys in a #GHashTable.
v is a pointer to a #gdouble key.dpgettext (string domain, string msgctxtid, int msgidoffset)
This function is a variant of g_dgettext() which supports a disambiguating message context. GNU gettext uses the '\004' character to separate the message context and message id in @msgctxtid. If 0 is passed as @msgidoffset, this function will fall back to trying to use the deprecated convention of using "|" as a separation character. This uses g_dgettext() internally. See that functions for differences with dgettext() proper. Applications should normally not use this function directly, but use the C_() macro for translations with context.
domain is the translation domain to use, or %NULL to use the domain set with textdomain().msgctxtid is a combined message context and message id, separated by a \004 character.msgidoffset is the offset of the message id in @msgctxid.dpgettext2 (string domain, string context, string msgid)
This function is a variant of g_dgettext() which supports a disambiguating message context. GNU gettext uses the '\004' character to separate the message context and message id in @msgctxtid. This uses g_dgettext() internally. See that functions for differences with dgettext() proper. This function differs from C_() in that it is not a macro and thus you may use non-string-literals as context and msgid arguments.
domain is the translation domain to use, or %NULL to use the domain set with textdomain().context is the message context.msgid is the message.environ_getenv (list envp, string variable)
Returns the value of the environment variable @variable in the provided list @envp.
envp is an environment list (eg, as returned from g_get_environ()), or %NULL for an empty environment list.variable is the environment variable to get.environ_setenv (list envp, string variable, string value, bool overwrite)
Sets the environment variable @variable in the provided list @envp to
envp is an environment list that can be freed using g_strfreev() (e.g., as returned from g_get_environ()), or %NULL for an empty environment list.variable is the environment variable to set, must not contain '='.value is the value for to set the variable to.overwrite is whether to change the variable if it already exists.environ_unsetenv (list envp, string variable)
Removes the environment variable @variable from the provided environment
envp is an environment list that can be freed using g_strfreev() (e.g., as returned from g_get_environ()), or %NULL for an empty environment list.variable is the environment variable to remove, must not contain '='.file_error_from_errno (int err_no)
Gets a #GFileError constant based on the passed-in @err_no. For example, if you pass in
EEXISTthis function returns %G_FILE_ERROR_EXIST. Unlikeerrnovalues, you can portably assume that all #GFileError values will exist. Normally a #GFileError value goes into a #GError returned from a function that manipulates files. So you would use g_file_error_from_errno() when constructing a #GError.
err_no is an "errno" value.file_read_link (string filename)
Reads the contents of the symbolic link @filename like the POSIX
readlink()function. The returned string is in the encoding used for filenames. Use g_filename_to_utf8() to convert it to UTF-8. The returned string may also be a relative path. Use g_build_filename() to convert it to an absolute path: |[ g_autoptr(GError) local_error = NULL; g_autofree gchar *link_target = g_file_read_link ("/etc/localtime", &local_error); if (local_error != NULL) g_error ("Error reading link: %s", local_error->message); if (!g_path_is_absolute (link_target)) { g_autofree gchar *absolute_link_target = g_build_filename ("/etc", link_target, NULL); g_free (link_target); link_target = g_steal_pointer (&absolute_link_target); } ]|
filename is the symbolic link.file_test (string filename, string test)
Returns %TRUE if any of the tests in the bitfield @test are %TRUE. For example,
(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)will return %TRUE if the file exists; the check whether it's a directory doesn't matter since the existence test is %TRUE. With the current set of available tests, there's no point passing in more than one test at a time. Apart from %G_FILE_TEST_IS_SYMLINK all tests follow symbolic links, so for a symbolic link to a regular file g_file_test() will return %TRUE for both %G_FILE_TEST_IS_SYMLINK and %G_FILE_TEST_IS_REGULAR. Note, that for a dangling symbolic link g_file_test() will return %TRUE for %G_FILE_TEST_IS_SYMLINK and %FALSE for all other flags. You should never use g_file_test() to test whether it is safe to perform an operation, because there is always the possibility of the condition changing before you actually perform the operation, see TOCTOU. For example, you might think you could use %G_FILE_TEST_IS_SYMLINK to know whether it is safe to write to a file without being tricked into writing into a different location. It doesn't work! |[ // DON'T DO THIS if (!g_file_test (filename, G_FILE_TEST_IS_SYMLINK)) { fd = g_open (filename, O_WRONLY); // write to fd } // DO THIS INSTEAD fd = g_open (filename, O_WRONLY | O_NOFOLLOW | O_CLOEXEC); if (fd == -1) { // check error if (errno == ELOOP) // file is a symlink and can be ignored else // handle errors as before } else { // write to fd } ]| Another thing to note is that %G_FILE_TEST_EXISTS and %G_FILE_TEST_IS_EXECUTABLE are implemented using the access() system call. This usually doesn't matter, but if your program is setuid or setgid it means that these tests will give you the answer for the real user ID and group ID, rather than the effective user ID and group ID. On Windows, there are no symlinks, so testing for %G_FILE_TEST_IS_SYMLINK will always return %FALSE. Testing for %G_FILE_TEST_IS_EXECUTABLE will just check that the file exists and its name indicates that it is executable, checking for well-known extensions and those listed in thePATHEXTenvironment variable.
filename is a filename to test in the GLib file name encoding.test is bitfield of #GFileTest flags.filename_display_basename (string filename)
Returns the display basename for the particular filename, guaranteed to be valid UTF-8. The display name might not be identical to the filename, for instance there might be problems converting it to UTF-8, and some files can be translated in the display. If GLib cannot make sense of the encoding of @filename, as a last resort it replaces unknown characters with U+FFFD, the Unicode replacement character. You can search the result for the UTF-8 encoding of this character (which is "\357\277\275" in octal notation) to find out if @filename was in an invalid encoding. You must pass the whole absolute pathname to this functions so that translation of well known locations can be done. This function is preferred over g_filename_display_name() if you know the whole path, as it allows translation.
filename is an absolute pathname in the GLib file name encoding.filename_display_name (string filename)
Converts a filename into a valid UTF-8 string. The conversion is not necessarily reversible, so you should keep the original around and use the return value of this function only for display purposes. Unlike g_filename_to_utf8(), the result is guaranteed to be non-%NULL even if the filename actually isn't in the GLib file name encoding. If GLib cannot make sense of the encoding of @filename, as a last resort it replaces unknown characters with U+FFFD, the Unicode replacement character. You can search the result for the UTF-8 encoding of this character (which is "\357\277\275" in octal notation) to find out if
was in an invalid encoding. If you know the whole pathname of the file you should use g_filename_display_basename(), since that allows location-based translation of filenames.filename is a pathname hopefully in the GLib file name encoding.filename_to_uri (string filename, string hostname)
Converts an absolute filename to an escaped ASCII-encoded URI, with the path component following Section 3.3. of RFC 2396.
filename is an absolute filename specified in the GLib file name encoding, which is the on-disk file name bytes on Unix, and UTF-8 on Windows.hostname is A UTF-8 encoded hostname, or %NULL for none..find_program_in_path (string program)
Locates the first executable named @program in the user's path, in the same way that execvp() would locate it. Returns an allocated string with the absolute path name, or %NULL if the program is not found in the path. If @program is already an absolute path, returns a copy of @program if
exists and is executable, and %NULL otherwise. On Windows, ifdoes not have a file type suffix, tries with the suffixes .exe, .cmd, .bat and .com, and the suffixes in the PATHEXT environment variable. On Windows, it looks for the file in the same way as CreateProcess() would. This means first in the directory where the executing program was loaded from, then in the current directory, then in the Windows 32-bit system directory, then in the Windows directory, and finally in the directories in the PATH environment variable. If the program is found, the return value contains the full name including the type suffix.program is a program name in the GLib file name encoding.fopen (string filename, string mode)
A wrapper for the stdio
fopen()function. Thefopen()function opens a file and associates a new stream with it. Because file descriptors are specific to the C library on Windows, and a file descriptor is part of theFILEstruct, theFILE*returned by this function makes sense only to functions in the same C library. Thus if the GLib-using code uses a different C library than GLib does, the FILE* returned by this function cannot be passed to C library functions likefprintf()orfread(). See your C library manual for more details aboutfopen(). Asclose()andfclose()are part of the C library, this implies that it is currently impossible to close a file if the application C library and the C library used by GLib are different. Convenience functions like g_file_set_contents_full() avoid this problem. Since GLib 2.86, theeoption is supported in @mode on all platforms. On Unix platforms it will setO_CLOEXECon the opened file descriptor. On Windows platforms it will be converted to theNmodifier. It is recommended to seteunconditionally, unless you know the returned file should be shared between this process and a new fork.
filename is a pathname in the GLib file name encoding (UTF-8 on Windows).mode is a string describing the mode in which the file should be opened.free (mem)
Frees the memory pointed to by @mem. If you know the allocated size of
calling g_free_sized() may be faster, depending on the libc implementation in use. Starting from GLib 2.78, this may happen automatically in case a GCC compatible compiler is used with some optimization level and the allocated size is known at compile time (see documentation of __builtin_object_size() to understand its caveats). If @mem is %NULL it simply returns, so there is no need to check @mem against %NULL before calling this function.mem is the memory to free.None.free_sized (mem, int size)
Frees the memory pointed to by @mem, assuming it is has the given @size. If @mem is %NULL this is a no-op (and @size is ignored). It is an error if @size doesn’t match the size passed when @mem was allocated. @size is passed to this function to allow optimizations in the allocator. If you don’t know the allocation size, use g_free() instead. In case a GCC compatible compiler is used, this function may be used automatically via g_free() if the allocated size is known at compile time, since GLib 2.78.
mem is the memory to free.size is size of @mem, in bytes.None.freopen (string filename, string mode, stream)
A wrapper for the POSIX freopen() function. The freopen() function opens a file and associates it with an existing stream. See your C library manual for more details about freopen(). Since GLib 2.86, the
eoption is supported in @mode on all platforms. See the documentation for [func@GLib.fopen] for more details.
filename is a pathname in the GLib file name encoding (UTF-8 on Windows).mode is a string describing the mode in which the file should be opened.stream is an existing stream which will be reused, or %NULL.fsync (int fd)
A wrapper for the POSIX
fsync()function. On Windows,_commit()will be used. On macOS,fcntl(F_FULLFSYNC)will be used. Thefsync()function is used to synchronize a file's in-core state with that of the disk. This wrapper will handle retrying onEINTR. See the C library manual for more details about fsync().
fd is a file descriptor.get_application_name ()
Gets a human-readable name for the application, as set by g_set_application_name(). This name should be localized if possible, and is intended for display to the user. Contrast with g_get_prgname(), which gets a non-localized name. If g_set_application_name() has not been called, returns the result of g_get_prgname() (which may be %NULL if g_set_prgname() has also not been called).
get_codeset ()
Gets the character set for the current locale.
get_current_dir ()
Gets the current directory. The returned string should be freed when no longer needed. The encoding of the returned string is system defined. On Windows, it is always UTF-8. Since GLib 2.40, this function will return the value of the "PWD" environment variable if it is set and it happens to be the same as the current directory. This can make a difference in the case that the current directory is the target of a symbolic link.
get_current_time (result)
Queries the system wall-clock time. This is equivalent to the UNIX
gettimeofday()function, but portable. You may find [func@GLib.get_real_time] to be more convenient.
result is [struct@GLib.TimeVal] structure in which to store current time.None.get_environ ()
Gets the list of environment variables for the current process. The list is %NULL terminated and each item in the list is of the form 'NAME=VALUE'. This is equivalent to direct access to the 'environ' global variable, except portable. The return value is freshly allocated and it should be freed with g_strfreev() when it is no longer needed.
get_home_dir ()
Gets the current user's home directory. As with most UNIX tools, this function will return the value of the
HOMEenvironment variable if it is set to an existing absolute path name, falling back to thepasswdfile in the case that it is unset. If the path given inHOMEis non-absolute, does not exist, or is not a directory, the result is undefined. Before version 2.36 this function would ignore theHOMEenvironment variable, taking the value from thepasswddatabase instead. This was changed to increase the compatibility of GLib with other programs (and the XDG basedir specification) and to increase testability of programs based on GLib (by making it easier to run them from test frameworks). If your program has a strong requirement for either the new or the old behaviour (and if you don't wish to increase your GLib dependency to ensure that the new behaviour is in effect) then you should either directly check theHOMEenvironment variable yourself or unset it before calling any functions in GLib.
get_host_name ()
Return a name for the machine. The returned name is not necessarily a fully-qualified domain name, or even present in DNS or some other name service at all. It need not even be unique on your local network or site, but usually it is. Callers should not rely on the return value having any specific properties like uniqueness for security purposes. Even if the name of the machine is changed while an application is running, the return value from this function does not change. The returned string is owned by GLib and should not be modified or freed. If no name can be determined, a default fixed string "localhost" is returned. The encoding of the returned string is UTF-8.
get_language_names ()
Computes a list of applicable locale names, which can be used to e.g. construct locale-dependent filenames or search paths. The returned list is sorted from most desirable to least desirable and always contains the default locale "C". For example, if LANGUAGE=de:en_US, then the returned list is "de", "en_US", "en", "C". This function consults the environment variables
LANGUAGE,LC_ALL,LC_MESSAGESandLANGto find the list of locales specified by the user.
get_language_names_with_category (string category_name)
Computes a list of applicable locale names with a locale category name, which can be used to construct the fallback locale-dependent filenames or search paths. The returned list is sorted from most desirable to least desirable and always contains the default locale "C". This function consults the environment variables
LANGUAGE,LC_ALL, @category_name, andLANGto find the list of locales specified by the user. g_get_language_names() returns g_get_language_names_with_category("LC_MESSAGES").
category_name is a locale category name.get_locale_variants (string locale)
Returns a list of derived variants of @locale, which can be used to e.g. construct locale-dependent filenames or search paths. The returned list is sorted from most desirable to least desirable. This function handles territory, charset and extra locale modifiers. See
setlocale(3)for information about locales and their format. @locale itself is guaranteed to be returned in the output. For example, if @locale isfr_BE, then the returned list isfr_BE,fr. If @locale isen_GB.UTF-8@euro, then the returned list isen_GB.UTF-8@euro,en_GB.UTF-8,en_GB@euro,en_GB,en.UTF-8@euro,en.UTF-8,en@euro,en. If you need the list of variants for the current locale, use g_get_language_names().
locale is a locale identifier.get_num_processors ()
Determine the approximate number of threads that the system will schedule simultaneously for this process. This is intended to be used as a parameter to g_thread_pool_new() for CPU bound tasks and similar cases.
get_os_info (string key_name)
Get information about the operating system. On Linux this comes from the
/etc/os-releasefile. On other systems, it may come from a variety of sources. You can either use the standard key names like %G_OS_INFO_KEY_NAME or pass any UTF-8 string key name. For example,/etc/os-releaseprovides a number of other less commonly used values that may be useful. No key is guaranteed to be provided, so the caller should always check if the result is %NULL.
key_name is a key for the OS info being requested, for example %G_OS_INFO_KEY_NAME..get_prgname ()
Gets the name of the program. This name should not be localized, in contrast to g_get_application_name(). If you are using #GApplication the program name is set in g_application_run(). In case of GDK or GTK it is set in gdk_init(), which is called by gtk_init() and the #GtkApplication::startup handler. The program name is found by taking the last component of @argv[0].
get_real_name ()
Gets the real name of the user. This usually comes from the user's entry in the
passwdfile. The encoding of the returned string is system-defined. (On Windows, it is, however, always UTF-8.) If the real user name cannot be determined, the string "Unknown" is returned.
get_system_config_dirs ()
Returns an ordered list of base directories in which to access system-wide configuration information. On UNIX platforms this is determined using the mechanisms described in the XDG Base Directory Specification. In this case the list of directories retrieved will be
XDG_CONFIG_DIRS. On Windows it follows XDG Base Directory Specification ifXDG_CONFIG_DIRSis defined. IfXDG_CONFIG_DIRSis undefined, the directory that contains application data for all users is used instead. A typical path isC:\Documents and Settings\All Users\Application Data. This folder is used for application data that is not user specific. For example, an application can store a spell-check dictionary, a database of clip art, or a log file in the FOLDERID_ProgramData folder. This information will not roam and is available to anyone using the computer. The return value is cached and modifying it at runtime is not supported, as it’s not thread-safe to modify environment variables at runtime.
get_system_data_dirs ()
Returns an ordered list of base directories in which to access system-wide application data. On UNIX platforms this is determined using the mechanisms described in the XDG Base Directory Specification In this case the list of directories retrieved will be
XDG_DATA_DIRS. On Windows it follows XDG Base Directory Specification ifXDG_DATA_DIRSis defined. IfXDG_DATA_DIRSis undefined, the first elements in the list are the Application Data and Documents folders for All Users. (These can be determined only on Windows 2000 or later and are not present in the list on other Windows versions.) See documentation for FOLDERID_ProgramData and FOLDERID_PublicDocuments. Then follows the "share" subfolder in the installation folder for the package containing the DLL that calls this function, if it can be determined. Finally the list contains the "share" subfolder in the installation folder for GLib, and in the installation folder for the package the application's .exe file belongs to. The installation folders above are determined by looking up the folder where the module (DLL or EXE) in question is located. If the folder's name is "bin", its parent is used, otherwise the folder itself. Note that on Windows the returned list can vary depending on where this function is called. The return value is cached and modifying it at runtime is not supported, as it’s not thread-safe to modify environment variables at runtime.
get_tmp_dir ()
Gets the directory to use for temporary files. On UNIX, this is taken from the
TMPDIRenvironment variable. If the variable is not set,P_tmpdiris used, as defined by the system C library. Failing that, a hard-coded default of "/tmp" is returned. On Windows, theTEMPenvironment variable is used, with the root directory of the Windows installation (eg: "C:") used as a default. The encoding of the returned string is system-defined. On Windows, it is always UTF-8. The return value is never %NULL or the empty string.
get_user_cache_dir ()
Returns a base directory in which to store non-essential, cached data specific to particular user. On UNIX platforms this is determined using the mechanisms described in the XDG Base Directory Specification. In this case the directory retrieved will be
XDG_CACHE_HOME. On Windows it follows XDG Base Directory Specification ifXDG_CACHE_HOMEis defined. IfXDG_CACHE_HOMEis undefined, the directory that serves as a common repository for temporary Internet files is used instead. A typical path isC:\Documents and Settings\username\Local Settings\Temporary Internet Files. See the documentation forFOLDERID_InternetCache. The return value is cached and modifying it at runtime is not supported, as it’s not thread-safe to modify environment variables at runtime.
get_user_config_dir ()
Returns a base directory in which to store user-specific application configuration information such as user preferences and settings. On UNIX platforms this is determined using the mechanisms described in the XDG Base Directory Specification. In this case the directory retrieved will be
XDG_CONFIG_HOME. On Windows it follows XDG Base Directory Specification ifXDG_CONFIG_HOMEis defined. IfXDG_CONFIG_HOMEis undefined, the folder to use for local (as opposed to roaming) application data is used instead. See the documentation forFOLDERID_LocalAppData. Note that in this case on Windows it will be the same as what g_get_user_data_dir() returns. The return value is cached and modifying it at runtime is not supported, as it’s not thread-safe to modify environment variables at runtime.
get_user_data_dir ()
Returns a base directory in which to access application data such as icons that is customized for a particular user. On UNIX platforms this is determined using the mechanisms described in the XDG Base Directory Specification. In this case the directory retrieved will be
XDG_DATA_HOME. On Windows it follows XDG Base Directory Specification ifXDG_DATA_HOMEis defined. IfXDG_DATA_HOMEis undefined, the folder to use for local (as opposed to roaming) application data is used instead. See the documentation forFOLDERID_LocalAppData. Note that in this case on Windows it will be the same as what g_get_user_config_dir() returns. The return value is cached and modifying it at runtime is not supported, as it’s not thread-safe to modify environment variables at runtime.
get_user_name ()
Gets the user name of the current user. The encoding of the returned string is system-defined. On UNIX, it might be the preferred file name encoding, or something else, and there is no guarantee that it is even consistent on a machine. On Windows, it is always UTF-8.
get_user_runtime_dir ()
Returns a directory that is unique to the current user on the local system. This is determined using the mechanisms described in the XDG Base Directory Specification. This is the directory specified in the
XDG_RUNTIME_DIRenvironment variable. In the case that this variable is not set, we return the value of g_get_user_cache_dir(), after verifying that it exists. The return value is cached and modifying it at runtime is not supported, as it’s not thread-safe to modify environment variables at runtime.
get_user_special_dir (string directory)
Returns the full path of a special directory using its logical id. On UNIX this is done using the XDG special user directories. For compatibility with existing practise, %G_USER_DIRECTORY_DESKTOP falls back to
$HOME/Desktopwhen XDG special user directories have not been set up. Depending on the platform, the user might be able to change the path of the special directory without requiring the session to restart; GLib will not reflect any change once the special directories are loaded.
directory is the logical id of special directory.get_user_state_dir ()
Returns a base directory in which to store state files specific to particular user. On UNIX platforms this is determined using the mechanisms described in the XDG Base Directory Specification. In this case the directory retrieved will be
XDG_STATE_HOME. On Windows it follows XDG Base Directory Specification ifXDG_STATE_HOMEis defined. IfXDG_STATE_HOMEis undefined, the folder to use for local (as opposed to roaming) application data is used instead. See the documentation forFOLDERID_LocalAppData. Note that in this case on Windows it will be the same as what g_get_user_data_dir() returns. The return value is cached and modifying it at runtime is not supported, as it’s not thread-safe to modify environment variables at runtime.
getenv (string variable)
Returns the value of an environment variable. On UNIX, the name and value are byte strings which might or might not be in some consistent character set and encoding. On Windows, they are in UTF-8. On Windows, in case the environment variable's value contains references to other environment variables, they are expanded.
variable is the environment variable to get.hash_table_add (object hash_table, key)
This is a convenience function for using a #GHashTable as a set. It is equivalent to calling g_hash_table_replace() with @key as both the key and the value. In particular, this means that if @key already exists in the hash table, then the old copy of @key in the hash table is freed and
replaces it in the table. When a hash table only ever contains keys that have themselves as the corresponding value it is able to be stored more efficiently. See the discussion in the section description. Starting from GLib 2.40, this function returns a boolean value to indicate whether the newly added value was already in the hash table or not.hash_table is a #GHashTable.key is a key to insert.hash_table_contains (object hash_table, key)
Checks if @key is in @hash_table.
hash_table is a #GHashTable.key is a key to check.hash_table_destroy (object hash_table)
Destroys all keys and values in the #GHashTable and decrements its reference count by 1. If keys and/or values are dynamically allocated, you should either free them first or create the #GHashTable with destroy notifiers using g_hash_table_new_full(). In the latter case the destroy functions you supplied will be called on all keys and values during the destruction phase.
hash_table is a #GHashTable.None.hash_table_get_keys_as_ptr_array (object hash_table)
Retrieves every key inside @hash_table, as a #GPtrArray. The returned data is valid until changes to the hash release those keys. This iterates over every entry in the hash table to build its return value. To iterate over the entries in a #GHashTable more efficiently, use a #GHashTableIter. You should always unref the returned array with g_ptr_array_unref().
hash_table is a #GHashTable.hash_table_get_values_as_ptr_array (object hash_table)
Retrieves every value inside @hash_table, as a #GPtrArray. The returned data is valid until changes to the hash release those values. This iterates over every entry in the hash table to build its return value. To iterate over the entries in a #GHashTable more efficiently, use a #GHashTableIter. You should always unref the returned array with g_ptr_array_unref().
hash_table is a #GHashTable.hash_table_insert (object hash_table, key, value)
Inserts a new key and value into a #GHashTable. If the key already exists in the #GHashTable its current value is replaced with the new value. If you supplied a @value_destroy_func when creating the #GHashTable, the old value is freed using that function. If you supplied a @key_destroy_func when creating the #GHashTable, the passed key is freed using that function. Starting from GLib 2.40, this function returns a boolean value to indicate whether the newly added value was already in the hash table or not.
hash_table is a #GHashTable.key is a key to insert.value is the value to associate with the key.hash_table_lookup (object hash_table, key)
Looks up a key in a #GHashTable. Note that this function cannot distinguish between a key that is not present and one which is present and has the value %NULL. If you need this distinction, use g_hash_table_lookup_extended().
hash_table is a #GHashTable.key is the key to look up.hash_table_new_similar (object other_hash_table)
Creates a new #GHashTable like g_hash_table_new_full() with a reference count of 1. It inherits the hash function, the key equal function, the key destroy function, as well as the value destroy function, from
The returned hash table will be empty; it will not contain the keys or values from @other_hash_table.other_hash_table is Another #GHashTable.hash_table_ref (object hash_table)
Atomically increments the reference count of @hash_table by one. This function is MT-safe and may be called from any thread.
hash_table is a valid #GHashTable.hash_table_remove (object hash_table, key)
Removes a key and its associated value from a #GHashTable. If the #GHashTable was created using g_hash_table_new_full(), the key and value are freed using the supplied destroy functions, otherwise you have to make sure that any dynamically allocated values are freed yourself.
hash_table is a #GHashTable.key is the key to remove.hash_table_remove_all (object hash_table)
Removes all keys and their associated values from a #GHashTable. If the #GHashTable was created using g_hash_table_new_full(), the keys and values are freed using the supplied destroy functions, otherwise you have to make sure that any dynamically allocated values are freed yourself.
hash_table is a #GHashTable.None.hash_table_replace (object hash_table, key, value)
Inserts a new key and value into a #GHashTable similar to g_hash_table_insert(). The difference is that if the key already exists in the #GHashTable, it gets replaced by the new key. If you supplied a
when creating the #GHashTable, the old value is freed using that function. If you supplied a @key_destroy_func when creating the #GHashTable, the old key is freed using that function. Starting from GLib 2.40, this function returns a boolean value to indicate whether the newly added value was already in the hash table or not.hash_table is a #GHashTable.key is a key to insert.value is the value to associate with the key.hash_table_size (object hash_table)
Returns the number of elements contained in the #GHashTable.
hash_table is a #GHashTable.hash_table_steal (object hash_table, key)
Removes a key and its associated value from a #GHashTable without calling the key and value destroy functions.
hash_table is a #GHashTable.key is the key to remove.hash_table_steal_all (object hash_table)
Removes all keys and their associated values from a #GHashTable without calling the key and value destroy functions.
hash_table is a #GHashTable.None.hash_table_steal_all_keys (object hash_table)
Removes all keys and their associated values from a #GHashTable without calling the key destroy functions, returning the keys as a #GPtrArray with the free func set to the @hash_table key destroy function.
hash_table is a #GHashTable.hash_table_steal_all_values (object hash_table)
Removes all keys and their associated values from a #GHashTable without calling the value destroy functions, returning the values as a #GPtrArray with the free func set to the @hash_table value destroy function.
hash_table is a #GHashTable.hash_table_unref (object hash_table)
Atomically decrements the reference count of @hash_table by one. If the reference count drops to 0, all keys and values will be destroyed, and all memory allocated by the hash table is released. This function is MT-safe and may be called from any thread.
hash_table is a valid #GHashTable.None.hook_destroy (object hook_list, int hook_id)
Destroys a #GHook, given its ID.
hook_list is a #GHookList.hook_id is a hook ID.hook_destroy_link (object hook_list, object hook)
Removes one #GHook from a #GHookList, marking it inactive and calling g_hook_unref() on it.
hook_list is a #GHookList.hook is the #GHook to remove.None.hook_free (object hook_list, object hook)
Calls the #GHookList @finalize_hook function if it exists, and frees the memory allocated for the #GHook.
hook_list is a #GHookList.hook is the #GHook to free.None.hook_insert_before (object hook_list, object sibling, object hook)
Inserts a #GHook into a #GHookList, before a given #GHook.
hook_list is a #GHookList.sibling is the #GHook to insert the new #GHook before.hook is the #GHook to insert.None.hook_prepend (object hook_list, object hook)
Prepends a #GHook on the start of a #GHookList.
hook_list is a #GHookList.hook is the #GHook to add to the start of @hook_list.None.hook_unref (object hook_list, object hook)
Decrements the reference count of a #GHook. If the reference count falls to 0, the #GHook is removed from the #GHookList and g_hook_free() is called to free it.
hook_list is a #GHookList.hook is the #GHook to unref.None.hostname_is_ascii_encoded (string hostname)
Tests if @hostname contains segments with an ASCII-compatible encoding of an Internationalized Domain Name. If this returns %TRUE, you should decode the hostname with g_hostname_to_unicode() before displaying it to the user. Note that a hostname might contain a mix of encoded and unencoded segments, and so it is possible for g_hostname_is_non_ascii() and g_hostname_is_ascii_encoded() to both return %TRUE for a name.
hostname is a hostname.hostname_is_ip_address (string hostname)
Tests if @hostname is the string form of an IPv4 or IPv6 address. (Eg, "192.168.0.1".) Since 2.66, IPv6 addresses with a zone-id are accepted (RFC6874).
hostname is a hostname (or IP address in string form).hostname_is_non_ascii (string hostname)
Tests if @hostname contains Unicode characters. If this returns %TRUE, you need to encode the hostname with g_hostname_to_ascii() before using it in non-IDN-aware contexts. Note that a hostname might contain a mix of encoded and unencoded segments, and so it is possible for g_hostname_is_non_ascii() and g_hostname_is_ascii_encoded() to both return %TRUE for a name.
hostname is a hostname.hostname_to_ascii (string hostname)
Converts @hostname to its canonical ASCII form; an ASCII-only string containing no uppercase letters and not ending with a trailing dot.
hostname is a valid UTF-8 or ASCII hostname.hostname_to_unicode (string hostname)
Converts @hostname to its canonical presentation form; a UTF-8 string in Unicode normalization form C, containing no uppercase letters, no forbidden characters, and no ASCII-encoded segments, and not ending with a trailing dot. Of course if @hostname is not an internationalized hostname, then the canonical presentation form will be entirely ASCII.
hostname is a valid UTF-8 or ASCII hostname.iconv_open (string to_codeset, string from_codeset)
Same as the standard UNIX routine iconv_open(), but may be implemented via libiconv on UNIX flavors that lack a native implementation. GLib provides g_convert() and g_locale_to_utf8() which are likely more convenient than the raw iconv wrappers.
to_codeset is destination codeset.from_codeset is source codeset.idle_remove_by_data (data)
Removes the idle function with the given data.
data is the data for the idle source’s callback..idle_source_new ()
Creates a new idle source. The source will not initially be associated with any [struct@GLib.MainContext] and must be added to one with [method@GLib.Source.attach] before it will be executed. Note that the default priority for idle sources is [const@GLib.PRIORITY_DEFAULT_IDLE], as compared to other sources which have a default priority of [const@GLib.PRIORITY_DEFAULT].
int64_equal (v1, v2)
Compares the two #gint64 values being pointed to and returns %TRUE if they are equal. It can be passed to g_hash_table_new() as the
parameter, when using non-%NULL pointers to 64-bit integers as keys in a #GHashTable.v1 is a pointer to a #gint64 key.v2 is a pointer to a #gint64 key to compare with @v1.int64_hash (v)
Converts a pointer to a #gint64 to a hash value. It can be passed to g_hash_table_new() as the @hash_func parameter, when using non-%NULL pointers to 64-bit integer values as keys in a #GHashTable.
v is a pointer to a #gint64 key.int_equal (v1, v2)
Compares the two #gint values being pointed to and returns %TRUE if they are equal. It can be passed to g_hash_table_new() as the @key_equal_func parameter, when using non-%NULL pointers to integers as keys in a #GHashTable. Note that this function acts on pointers to #gint, not on #gint directly: if your hash table's keys are of the form
GINT_TO_POINTER (n), use g_direct_equal() instead.
v1 is a pointer to a #gint key.v2 is a pointer to a #gint key to compare with @v1.int_hash (v)
Converts a pointer to a #gint to a hash value. It can be passed to g_hash_table_new() as the @hash_func parameter, when using non-%NULL pointers to integer values as keys in a #GHashTable. Note that this function acts on pointers to #gint, not on #gint directly: if your hash table's keys are of the form
GINT_TO_POINTER (n), use g_direct_hash() instead.
v is a pointer to a #gint key.intern_static_string (string arg0String)
Returns a canonical representation for @string. Interned strings can be compared for equality by comparing the pointers, instead of using strcmp(). g_intern_static_string() does not copy the string, therefore
must not be freed or modified. This function must not be used before library constructors have finished running. In particular, this means it cannot be used to initialize global variables in C++.string is a static string.intern_string (string arg0String)
Returns a canonical representation for @string. Interned strings can be compared for equality by comparing the pointers, instead of using strcmp(). This function must not be used before library constructors have finished running. In particular, this means it cannot be used to initialize global variables in C++.
string is a string.io_channel_error_from_errno (int en)
Converts an
errnoerror number to a #GIOChannelError.
en is an errno error number, e.g. EINVAL.io_create_watch (object channel, string condition)
Creates a #GSource that's dispatched when @condition is met for the given
For example, if condition is %G_IO_IN, the source will be dispatched when there's data available for reading. The callback function invoked by the #GSource should be added with g_source_set_callback(), but it has type #GIOFunc (not #GSourceFunc). g_io_add_watch() is a simpler interface to this same functionality, for the case where you want to add the source to the default main loop context at the default priority. On Windows, polling a #GSource created to watch a channel for a socket puts the socket in non-blocking mode. This is a side-effect of the implementation and unavoidable.channel is a #GIOChannel to watch.condition is conditions to watch for.list_pop_allocator ()
Generated wrapper for GIR function
list_pop_allocator. Native symbol:g_list_pop_allocator.
None.list_push_allocator (object allocator)
Generated wrapper for GIR function
list_push_allocator. Native symbol:g_list_push_allocator.
None.listenv ()
Gets the names of all variables set in the environment. Programs that want to be portable to Windows should typically use this function and g_getenv() instead of using the environ array from the C library directly. On Windows, the strings in the environ array are in system codepage encoding, while in most of the typical use cases for environment variables in GLib-using programs you want the UTF-8 encoding that this function and g_getenv() provide.
log_default_handler (string log_domain, string log_level, string message, unused_data)
The default log handler set up by GLib; [func@GLib.log_set_default_handler] allows to install an alternate default log handler. This is used if no log handler has been set for the particular log domain and log level combination. It outputs the message to
stderrorstdoutand if the log level is fatal it calls [func@GLib.BREAKPOINT]. It automatically prints a new-line character after the message, so one does not need to be manually included in
The behavior of this log handler can be influenced by a number of environment variables: - G_MESSAGES_PREFIXED: A :-separated list of log levels for which messages should be prefixed by the program name and PID of the application. - G_MESSAGES_DEBUG: A space-separated list of log domains for which debug and informational messages are printed. By default these messages are not printed. If you need to set the allowed domains at runtime, use [func@GLib.log_writer_default_set_debug_domains]. - DEBUG_INVOCATION: If set to 1, this is equivalent to G_MESSAGES_DEBUG=all. DEBUG_INVOCATION is a standard environment variable set by systemd to prompt debug output. (Since: 2.84) stderr is used for levels [flags@GLib.LogLevelFlags.LEVEL_ERROR], [flags@GLib.LogLevelFlags.LEVEL_CRITICAL], [flags@GLib.LogLevelFlags.LEVEL_WARNING] and [flags@GLib.LogLevelFlags.LEVEL_MESSAGE]. stdout is used for the rest, unless stderr was requested by [func@GLib.log_writer_default_set_use_stderr]. This has no effect if structured logging is enabled; see Using Structured Logging.log_domain is the log domain of the message, or NULL for the default "" application domain.log_level is the level of the message.message is the message.unused_data is data passed from [func@GLib.log] which is unused.None.log_get_always_fatal ()
Gets the current fatal mask. This is mostly used by custom log writers to make fatal messages (
fatal-warnings,fatal-criticals) work as expected, when using theG_DEBUGenvironment variable (see Running GLib Applications). An example usage is shown below:c static GLogWriterOutput my_custom_log_writer_fn (GLogLevelFlags log_level, const GLogField *fields, gsize n_fields, gpointer user_data) { // abort if the message was fatal if (log_level & g_log_get_always_fatal ()) g_abort (); // custom log handling code ... ... // success return G_LOG_WRITER_HANDLED; }
log_get_debug_enabled ()
Return whether debug output from the GLib logging system is enabled. Note that this should not be used to conditionalise calls to [func@GLib.debug] or other logging functions; it should only be used from [type@GLib.LogWriterFunc] implementations. Note also that the value of this does not depend on
G_MESSAGES_DEBUG, norDEBUG_INVOCATION, nor [func@GLib.log_writer_default_set_debug_domains]; see the docs for [func@GLib.log_set_debug_enabled].
log_remove_handler (string log_domain, int handler_id)
Removes the log handler. This has no effect if structured logging is enabled; see Using Structured Logging.
log_domain is the log domain.handler_id is the ID of the handler, which was returned in [func@GLib.log_set_handler].None.log_set_always_fatal (string fatal_mask)
Sets the message levels which are always fatal, in any log domain. When a message with any of these levels is logged the program terminates. You can only set the levels defined by GLib to be fatal. [flags@GLib.LogLevelFlags.LEVEL_ERROR] is always fatal. You can also make some message levels fatal at runtime by setting the
G_DEBUGenvironment variable (see Running GLib Applications). Libraries should not call this function, as it affects all messages logged by a process, including those from other libraries. Structured log messages (using [func@GLib.log_structured] and [func@GLib.log_structured_array]) are fatal only if the default log writer is used; otherwise it is up to the writer function to determine which log messages are fatal. See Using Structured Logging.
fatal_mask is the mask containing bits set for each level of error which is to be fatal.log_set_debug_enabled (bool enabled)
Enable or disable debug output from the GLib logging system for all domains. This value interacts disjunctively with
G_MESSAGES_DEBUG,DEBUG_INVOCATIONand [func@GLib.log_writer_default_set_debug_domains] — if any of them would allow a debug message to be outputted, it will be. Note that this should not be used from within library code to enable debug output — it is intended for external use.
enabled is TRUE to enable debug output, FALSE otherwise.None.log_set_fatal_mask (string log_domain, string fatal_mask)
Sets the log levels which are fatal in the given domain. [flags@GLib.LogLevelFlags.LEVEL_ERROR] is always fatal. This has no effect on structured log messages (using [func@GLib.log_structured] or [func@GLib.log_structured_array]). To change the fatal behaviour for specific log messages, programs must install a custom log writer function using [func@GLib.log_set_writer_func]. See Using Structured Logging. This function is mostly intended to be used with [flags@GLib.LogLevelFlags.LEVEL_CRITICAL]. You should typically not set [flags@GLib.LogLevelFlags.LEVEL_WARNING], [flags@GLib.LogLevelFlags.LEVEL_MESSAGE], [flags@GLib.LogLevelFlags.LEVEL_INFO] or [flags@GLib.LogLevelFlags.LEVEL_DEBUG] as fatal except inside of test programs.
log_domain is the log domain.fatal_mask is the new fatal mask.log_variant (string log_domain, string log_level, object fields)
Log a message with structured data, accepting the data within a [type@GLib.Variant]. This version is especially useful for use in other languages, via introspection. The only mandatory item in the @fields dictionary is the
"MESSAGE"which must contain the text shown to the user. The values in the @fields dictionary are likely to be of typeG_VARIANT_TYPE_STRING. Array of bytes (G_VARIANT_TYPE_BYTESTRING) is also supported. In this case the message is handled as binary and will be forwarded to the log writer as such. The size of the array should not be higher thanG_MAXSSIZE. Otherwise it will be truncated to this size. For other types [method@GLib.Variant.print] will be used to convert the value into a string. For more details on its usage and about the parameters, see [func@GLib.log_structured].
log_domain is log domain, usually G_LOG_DOMAIN.log_level is log level, either from [type@GLib.LogLevelFlags], or a user-defined level.fields is a dictionary ([type@GLib.Variant] of the type G_VARIANT_TYPE_VARDICT) containing the key-value pairs of message data..None.log_writer_default_set_debug_domains (string domains)
Reset the list of domains to be logged, that might be initially set by the
G_MESSAGES_DEBUGorDEBUG_INVOCATIONenvironment variables. This function is thread-safe.
domains is NULL-terminated array with domains to be printed. NULL or an array with no values means none. Array with a single value "all" means all..None.log_writer_default_set_use_stderr (bool use_stderr)
Configure whether the built-in log functions will output all log messages to
stderr. The built-in log functions are [func@GLib.log_default_handler] for the old-style API, and both [func@GLib.log_writer_default] and [func@GLib.log_writer_standard_streams] for the structured API. By default, log messages of levels [flags@GLib.LogLevelFlags.LEVEL_INFO] and [flags@GLib.LogLevelFlags.LEVEL_DEBUG] are sent tostdout, and other log messages are sent tostderr. This is problematic for applications that intend to reservestdoutfor structured output such as JSON or XML. This function sets global state. It is not thread-aware, and should be called at the very start of a program, before creating any other threads or creating objects that could create worker threads of their own.
use_stderr is If TRUE, use stderr for log messages that would normally have appeared on stdout.None.log_writer_default_would_drop (string log_level, string log_domain)
Check whether [func@GLib.log_writer_default] and [func@GLib.log_default_handler] would ignore a message with the given domain and level. As with [func@GLib.log_default_handler], this function drops debug and informational messages unless their log domain (or
all) is listed in the space-separatedG_MESSAGES_DEBUGenvironment variable, orDEBUG_INVOCATION=1is set in the environment, or by [func@GLib.log_writer_default_set_debug_domains]. This can be used when implementing log writers with the same filtering behaviour as the default, but a different destination or output format:c if (g_log_writer_default_would_drop (log_level, log_domain)) return G_LOG_WRITER_HANDLED; ]| or to skip an expensive computation if it is only needed for a debugging message, and `G_MESSAGES_DEBUG` and `DEBUG_INVOCATION` are not set:c if (!g_log_writer_default_would_drop (G_LOG_LEVEL_DEBUG, G_LOG_DOMAIN)) { g_autofree gchar *result = expensive_computation (my_object); g_debug ("my_object result: %s", result); } ```
log_level is log level, either from [type@GLib.LogLevelFlags], or a user-defined level.log_domain is log domain.log_writer_is_journald (int output_fd)
Check whether the given @output_fd file descriptor is a connection to the systemd journal, or something else (like a log file or
stdoutorstderr). Invalid file descriptors are accepted and returnFALSE, which allows for the following construct without needing any additional error handling:c is_journald = g_log_writer_is_journald (fileno (stderr));
output_fd is output file descriptor to check.log_writer_supports_color (int output_fd)
Check whether the given @output_fd file descriptor supports ANSI color escape sequences. If so, they can safely be used when formatting log messages.
output_fd is output file descriptor to check.lstat (string filename, object buf)
A wrapper for the POSIX lstat() function. The lstat() function is like stat() except that in the case of symbolic links, it returns information about the symbolic link itself and not the file that it refers to. If the system does not support symbolic links g_lstat() is identical to g_stat(). See your C library manual for more details about lstat().
filename is a pathname in the GLib file name encoding (UTF-8 on Windows).buf is a pointer to a stat struct, which will be filled with the file information.main_context_default ()
Returns the global-default main context. This is the main context used for main loop functions when a main loop is not explicitly specified, and corresponds to the ‘main’ main loop. See also [func@GLib.MainContext.get_thread_default].
main_context_get_thread_default ()
Gets the thread-default main context for this thread. Asynchronous operations that want to be able to be run in contexts other than the default one should call this method or [func@GLib.MainContext.ref_thread_default] to get a [struct@GLib.MainContext] to add their [struct@GLib.Source]s to. (Note that even in single-threaded programs applications may sometimes want to temporarily push a non-default context, so it is not safe to assume that this will always return
NULLif you are running in the default thread.) If you need to hold a reference on the context, use [func@GLib.MainContext.ref_thread_default] instead.
main_context_ref_thread_default ()
Gets a reference to the thread-default [struct@GLib.MainContext] for this thread This is the same as [func@GLib.MainContext.get_thread_default], but it also adds a reference to the returned main context with [method@GLib.MainContext.ref]. In addition, unlike [func@GLib.MainContext.get_thread_default], if the thread-default context is the global-default context, this will return that [struct@GLib.MainContext] (with a ref added to it) rather than returning
NULL.
main_current_source ()
Returns the currently firing source for this thread.
main_depth ()
Returns the depth of the stack of calls to [method@GLib.MainContext.dispatch] on any #GMainContext in the current thread. That is, when called from the top level, it gives
0. When called from within a callback from [method@GLib.MainContext.iteration] (or [method@GLib.MainLoop.run], etc.) it returns1. When called from within a callback to a recursive call to [method@GLib.MainContext.iteration], it returns2. And so forth. This function is useful in a situation like the following: Imagine an extremely simple ‘garbage collected’ system.c static GList *free_list; gpointer allocate_memory (gsize size) { gpointer result = g_malloc (size); free_list = g_list_prepend (free_list, result); return result; } void free_allocated_memory (void) { GList *l; for (l = free_list; l; l = l->next); g_free (l->data); g_list_free (free_list); free_list = NULL; } [...] while (TRUE); { g_main_context_iteration (NULL, TRUE); free_allocated_memory(); }This works from an application, however, if you want to do the same thing from a library, it gets more difficult, since you no longer control the main loop. You might think you can simply use an idle function to make the call tofree_allocated_memory(), but that doesn’t work, since the idle function could be called from a recursive callback. This can be fixed by using [func@GLib.main_depth]c gpointer allocate_memory (gsize size) { FreeListBlock *block = g_new (FreeListBlock, 1); block->mem = g_malloc (size); block->depth = g_main_depth (); free_list = g_list_prepend (free_list, block); return block->mem; } void free_allocated_memory (void) { GList *l; int depth = g_main_depth (); for (l = free_list; l; ); { GList *next = l->next; FreeListBlock *block = l->data; if (block->depth > depth) { g_free (block->mem); g_free (block); free_list = g_list_delete_link (free_list, l); } l = next; } }There is a temptation to use [func@GLib.main_depth] to solve problems with reentrancy. For instance, while waiting for data to be received from the network in response to a menu item, the menu item might be selected again. It might seem that one could make the menu item’s callback return immediately and do nothing if [func@GLib.main_depth] returns a value greater than 1. However, this should be avoided since the user then sees selecting the menu item do nothing. Furthermore, you’ll find yourself adding these checks all over your code, since there are doubtless many, many things that the user could do. Instead, you can use the following techniques: 1. Usegtk_widget_set_sensitive()or modal dialogs to prevent the user from interacting with elements while the main loop is recursing. 2. Avoid main loop recursion in situations where you can’t handle arbitrary callbacks. Instead, structure your code so that you simply return to the main loop and then get called again when there is more work to do.
malloc (int n_bytes)
Allocates @n_bytes bytes of memory. If @n_bytes is 0 it returns %NULL. If the allocation fails (because the system is out of memory), the program is terminated.
n_bytes is the number of bytes to allocate.malloc0 (int n_bytes)
Allocates @n_bytes bytes of memory, initialized to 0's. If @n_bytes is 0 it returns %NULL. If the allocation fails (because the system is out of memory), the program is terminated.
n_bytes is the number of bytes to allocate.malloc0_n (int n_blocks, int n_block_bytes)
This function is similar to g_malloc0(), allocating (@n_blocks *
bytes, but care is taken to detect possible overflow during multiplication. If the allocation fails (because the system is out of memory), the program is terminated.n_blocks is the number of blocks to allocate.n_block_bytes is the size of each block in bytes.malloc_n (int n_blocks, int n_block_bytes)
This function is similar to g_malloc(), allocating (@n_blocks *
bytes, but care is taken to detect possible overflow during multiplication. If the allocation fails (because the system is out of memory), the program is terminated.n_blocks is the number of blocks to allocate.n_block_bytes is the size of each block in bytes.markup_escape_text (string text, int length)
Escapes text so that the markup parser will parse it verbatim. Less than, greater than, ampersand, etc. are replaced with the corresponding entities. This function would typically be used when writing out a file to be parsed with the markup parser. Note that this function doesn't protect whitespace and line endings from being processed according to the XML rules for normalization of line endings and attribute values. Note also that this function will produce character references in the range of ... for all control sequences except for tabstop, newline and carriage return. The character references in this range are not valid XML 1.0, but they are valid XML 1.1 and will be accepted by the GMarkup parser.
text is some valid UTF-8 text.length is length of @text in bytes, or -1 if the text is nul-terminated.mem_chunk_info ()
Generated wrapper for GIR function
mem_chunk_info. Native symbol:g_mem_chunk_info.
None.mem_is_system_malloc ()
Checks whether the allocator used by g_malloc() is the system's malloc implementation. If it returns %TRUE memory allocated with malloc() can be used interchangeably with memory allocated using g_malloc(). This function is useful for avoiding an extra copy of allocated memory returned by a non-GLib-based API.
mem_profile ()
GLib used to support some tools for memory profiling, but this no longer works. There are many other useful tools for memory profiling these days which can be used instead.
None.mem_set_vtable (object vtable)
This function used to let you override the memory allocation function. However, its use was incompatible with the use of global constructors in GLib and GIO, because those use the GLib allocators before main is reached. Therefore this function is now deprecated and is just a stub.
vtable is table of memory allocation routines..None.memdup (mem, int byte_size)
Allocates @byte_size bytes of memory, and copies @byte_size bytes into it from @mem. If @mem is
NULLit returnsNULL.
mem is the memory to copy.byte_size is the number of bytes to copy.memdup2 (mem, int byte_size)
Allocates @byte_size bytes of memory, and copies @byte_size bytes into it from @mem. If @mem is
NULLit returnsNULL. This replaces [func@GLib.memdup], which was prone to integer overflows when converting the argument from agsizeto aguint.
mem is the memory to copy.byte_size is the number of bytes to copy.mkdir (string filename, int mode)
A wrapper for the POSIX mkdir() function. The mkdir() function attempts to create a directory with the given name and permissions. The mode argument is ignored on Windows. See your C library manual for more details about mkdir().
filename is a pathname in the GLib file name encoding (UTF-8 on Windows).mode is permissions to use for the newly created directory.mkdir_with_parents (string pathname, int mode)
Create a directory if it doesn't already exist. Create intermediate parent directories as needed, too.
pathname is a pathname in the GLib file name encoding.mode is permissions to use for newly created directories.mkdtemp (string tmpl)
Creates a temporary directory in the current directory. See the
mkdtemp()documentation on most UNIX-like systems. The parameter is a string that should follow the rules for mkdtemp() templates, i.e. contain the string "XXXXXX". g_mkdtemp() is slightly more flexible than mkdtemp() in that the sequence does not have to occur at the very end of the template. The X string will be modified to form the name of a directory that didn't exist. The string should be in the GLib file name encoding. Most importantly, on Windows it should be in UTF-8. If you are going to be creating a temporary directory inside the directory returned by g_get_tmp_dir(), you might want to use g_dir_make_tmp() instead.
tmpl is template directory name.mkdtemp_full (string tmpl, int mode)
Creates a temporary directory in the current directory. See the
mkdtemp()documentation on most UNIX-like systems. The parameter is a string that should follow the rules for mkdtemp() templates, i.e. contain the string "XXXXXX". g_mkdtemp_full() is slightly more flexible than mkdtemp() in that the sequence does not have to occur at the very end of the template and you can pass a @mode. The X string will be modified to form the name of a directory that didn't exist. The string should be in the GLib file name encoding. Most importantly, on Windows it should be in UTF-8. If you are going to be creating a temporary directory inside the directory returned by g_get_tmp_dir(), you might want to use g_dir_make_tmp() instead.
tmpl is template directory name.mode is permissions to create the temporary directory with.mkstemp (string tmpl)
Opens a temporary file in the current directory. See the
mkstemp()documentation on most UNIX-like systems. The parameter is a string that should follow the rules for mkstemp() templates, i.e. contain the string "XXXXXX". g_mkstemp() is slightly more flexible than mkstemp() in that the sequence does not have to occur at the very end of the template. The X string will be modified to form the name of a file that didn't exist. The string should be in the GLib file name encoding. Most importantly, on Windows it should be in UTF-8.
tmpl is template filename.mkstemp_full (string tmpl, int flags, int mode)
Opens a temporary file in the current directory. See the
mkstemp()documentation on most UNIX-like systems. The parameter is a string that should follow the rules for mkstemp() templates, i.e. contain the string "XXXXXX". g_mkstemp_full() is slightly more flexible than mkstemp() in that the sequence does not have to occur at the very end of the template and you can pass a @mode and additional
The X string will be modified to form the name of a file that didn't exist. The string should be in the GLib file name encoding. Most importantly, on Windows it should be in UTF-8.tmpl is template filename.flags is flags to pass to an open() call in addition to O_EXCL and O_CREAT, which are passed automatically.mode is permissions to create the temporary file with.node_pop_allocator ()
Generated wrapper for GIR function
node_pop_allocator. Native symbol:g_node_pop_allocator.
None.node_push_allocator (object allocator)
Generated wrapper for GIR function
node_push_allocator. Native symbol:g_node_push_allocator.
None.nullify_pointer (nullify_location)
Set the pointer at the specified location to %NULL.
nullify_location is the memory address of the pointer..None.on_error_query (string prg_name)
Prompts the user with
[E]xit, [H]alt, show [S]tack trace or [P]roceed. This function is intended to be used for debugging use only. The following example shows how it can be used together with the g_log() functions. |[ #include <glib.h> static void log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) { g_log_default_handler (log_domain, log_level, message, user_data); g_on_error_query (MY_PROGRAM_NAME); } int main (int argc, char *argv[]) { g_log_set_handler (MY_LOG_DOMAIN, G_LOG_LEVEL_WARNING | G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL, log_handler, NULL); ... ]| If "[E]xit" is selected, the application terminates with a call to _exit(0). If "[S]tack" trace is selected, g_on_error_stack_trace() is called. This invokes gdb, which attaches to the current process and shows a stack trace. The prompt is then shown again. If "[P]roceed" is selected, the function returns. This function may cause different actions on non-UNIX platforms. On Windows consider using theG_DEBUGGERenvironment variable (see Running GLib Applications) and calling g_on_error_stack_trace() instead.
prg_name is the program name, needed by gdb for the "[S]tack trace" option. If @prg_name is %NULL, g_get_prgname() is called to get the program name (which will work correctly if gdk_init() or gtk_init() has been called).None.on_error_stack_trace (string prg_name)
Invokes gdb, which attaches to the current process and shows a stack trace. Called by g_on_error_query() when the "[S]tack trace" option is selected. You can get the current process's program name with g_get_prgname(), assuming that you have called gtk_init() or gdk_init(). This function may cause different actions on non-UNIX platforms. When running on Windows, this function is not called by g_on_error_query(). If called directly, it will raise an exception, which will crash the program. If the
G_DEBUGGERenvironment variable is set, a debugger will be invoked to attach and handle that exception (see Running GLib Applications).
prg_name is the program name, needed by gdb for the "[S]tack trace" option, or NULL to use a default string.None.once_init_enter_impl (int location)
Generated wrapper for GIR function
once_init_enter_impl. Native symbol:g_once_init_enter_impl.
once_init_enter_pointer (location)
This functions behaves in the same way as g_once_init_enter(), but can can be used to initialize pointers (or #guintptr) instead of #gsize. |[ static MyStruct *interesting_struct = NULL; if (g_once_init_enter_pointer (&interesting_struct)) { MyStruct *setup_value = allocate_my_struct (); // initialization code here g_once_init_leave_pointer (&interesting_struct, g_steal_pointer (&setup_value)); } // use interesting_struct here ]|
location is location of a static initializable variable containing NULL.once_init_leave_pointer (location, result)
Counterpart to g_once_init_enter_pointer(). Expects a location of a static
NULL-initialized initialization variable, and an initialization value other thanNULL. Sets the variable to the initialization value, and releases concurrent threads blocking in g_once_init_enter_pointer() on this initialization variable. This functions behaves in the same way as g_once_init_leave(), but can be used to initialize pointers (or #guintptr) instead of #gsize.
location is location of a static initializable variable containing NULL.result is new non-NULL value for *location.None.open (string filename, int flags, int mode)
A wrapper for the POSIX open() function. The open() function is used to convert a pathname into a file descriptor. On POSIX systems file descriptors are implemented by the operating system. On Windows, it's the C library that implements open() and file descriptors. The actual Win32 API for opening files is quite different, see MSDN documentation for CreateFile(). The Win32 API uses file handles, which are more randomish integers, not small integers like file descriptors. Because file descriptors are specific to the C library on Windows, the file descriptor returned by this function makes sense only to functions in the same C library. Thus if the GLib-using code uses a different C library than GLib does, the file descriptor returned by this function cannot be passed to C library functions like write() or read(). See your C library manual for more details about open().
filename is a pathname in the GLib file name encoding (UTF-8 on Windows).flags is as in open().mode is as in open().path_buf_equal (v1, v2)
Compares two path buffers for equality and returns
TRUEif they are equal. The paths inside the path buffers are not going to be normalized, soX/Y/Z/A/..,X/./Y/ZandX/Y/Zare not going to be considered equal. This function can be passed to g_hash_table_new() as thekey_equal_funcparameter.
v1 is a path buffer to compare.v2 is a path buffer to compare.path_get_basename (string file_name)
Gets the last component of the filename. If @file_name ends with a directory separator it gets the component before the last slash. If
consists only of directory separators (and on Windows, possibly a drive letter), a single separator is returned. If @file_name is empty, it gets ".".file_name is the name of the file.path_get_dirname (string file_name)
Gets the directory components of a file name. For example, the directory component of
/usr/bin/testis/usr/bin. The directory component of/is/. If the file name has no directory components "." is returned. The returned string should be freed when no longer needed.
file_name is the name of the file.path_is_absolute (string file_name)
Returns %TRUE if the given @file_name is an absolute file name. Note that this is a somewhat vague concept on Windows. On POSIX systems, an absolute file name is well-defined. It always starts from the single root directory. For example "/usr/local". On Windows, the concepts of current drive and drive-specific current directory introduce vagueness. This function interprets as an absolute file name one that either begins with a directory separator such as "\Users\tml" or begins with the root on a drive, for example "C:\Windows". The first case also includes UNC paths such as "\\myserver\docs\foo". In all cases, either slashes or backslashes are accepted. Note that a file name relative to the current drive root does not truly specify a file uniquely over time and across processes, as the current drive is a per-process value and can be changed. File names relative the current directory on some specific drive, such as "D:foo/bar", are not interpreted as absolute by this function, but they obviously are not relative to the normal current directory as returned by getcwd() or g_get_current_dir() either. Such paths should be avoided, or need to be handled using Windows-specific code.
file_name is a file name.path_skip_root (string file_name)
Returns a pointer into @file_name after the root component, i.e. after the "/" in UNIX or "C:" under Windows. If @file_name is not an absolute path it returns %NULL.
file_name is a file name.pattern_match (object pspec, int string_length, string arg2String, string string_reversed)
Matches a string against a compiled pattern. Passing the correct length of the string given is mandatory. The reversed string can be omitted by passing
NULL, this is more efficient if the reversed version of the string to be matched is not at hand, asg_pattern_match()will only construct it if the compiled pattern requires reverse matches. Note that, if the user code will (possibly) match a string against a multitude of patterns containing wildcards, chances are high that some patterns will require a reversed string. In this case, it’s more efficient to provide the reversed string to avoid multiple constructions thereof in the various calls tog_pattern_match(). Note also that the reverse of a UTF-8 encoded string can in general not be obtained by [func@GLib.strreverse]. This works only if the string does not contain any multibyte characters. GLib offers the [func@GLib.utf8_strreverse] function to reverse UTF-8 encoded strings.
pspec is a #GPatternSpec.string_length is the length of @string (in bytes, i.e. strlen(), not [func@GLib.utf8_strlen]).string is the UTF-8 encoded string to match.string_reversed is the reverse of @string.pattern_match_simple (string pattern, string arg1String)
Matches a string against a pattern given as a string. If this function is to be called in a loop, it’s more efficient to compile the pattern once with [ctor@GLib.PatternSpec.new] and call [method@GLib.PatternSpec.match_string] repeatedly.
pattern is the UTF-8 encoded pattern.string is the UTF-8 encoded string to match.pattern_match_string (object pspec, string arg1String)
Matches a string against a compiled pattern. If the string is to be matched against more than one pattern, consider using [method@GLib.PatternSpec.match] instead while supplying the reversed string.
pspec is a #GPatternSpec.string is the UTF-8 encoded string to match.pointer_bit_lock (address, int lock_bit)
This is equivalent to g_bit_lock, but working on pointers (or other pointer-sized values). For portability reasons, you may only lock on the bottom 32 bits of the pointer. While @address has a
volatilequalifier, this is a historical artifact and the argument passed to it should not bevolatile.
address is a pointer to a #gpointer-sized value.lock_bit is a bit value between 0 and 31.None.pointer_bit_trylock (address, int lock_bit)
This is equivalent to g_bit_trylock(), but working on pointers (or other pointer-sized values). For portability reasons, you may only lock on the bottom 32 bits of the pointer. While @address has a
volatilequalifier, this is a historical artifact and the argument passed to it should not bevolatile.
address is a pointer to a #gpointer-sized value.lock_bit is a bit value between 0 and 31.pointer_bit_unlock (address, int lock_bit)
This is equivalent to g_bit_unlock, but working on pointers (or other pointer-sized values). For portability reasons, you may only lock on the bottom 32 bits of the pointer. While @address has a
volatilequalifier, this is a historical artifact and the argument passed to it should not bevolatile.
address is a pointer to a #gpointer-sized value.lock_bit is a bit value between 0 and 31.None.poll (fds, int nfds, int timeout)
Polls @fds, as with the poll() system call, but portably. (On systems that don't have poll(), it is emulated using select().) This is used internally by #GMainContext, but it can be called directly if you need to block until a file descriptor is ready, but don't want to run the full main loop. Each element of @fds is a #GPollFD describing a single file descriptor to poll. The @fd field indicates the file descriptor, and the
field indicates the events to poll for. On return, the @revents fields will be filled with the events that actually occurred. On POSIX systems, the file descriptors in @fds can be any sort of file descriptor, but the situation is much more complicated on Windows. If you need to use g_poll() in code that has to run on Windows, the easiest solution is to construct all of your #GPollFDs with g_io_channel_win32_make_pollfd().fds is file descriptors to poll.nfds is the number of file descriptors in @fds.timeout is amount of time to wait, in milliseconds, or -1 to wait forever.random_double ()
Returns a random #gdouble equally distributed over the range [0..1).
random_double_range (double begin, double end)
Returns a random #gdouble equally distributed over the range [@begin..@end).
begin is lower closed bound of the interval.end is upper open bound of the interval.rc_box_acquire (mem_block)
Acquires a reference on the data pointed by @mem_block.
mem_block is a pointer to reference counted data.rc_box_alloc (int block_size)
Allocates @block_size bytes of memory, and adds reference counting semantics to it. The data will be freed when its reference count drops to zero. The allocated data is guaranteed to be suitably aligned for any built-in type.
block_size is the size of the allocation, must be greater than 0.rc_box_alloc0 (int block_size)
Allocates @block_size bytes of memory, and adds reference counting semantics to it. The contents of the returned data is set to zero. The data will be freed when its reference count drops to zero. The allocated data is guaranteed to be suitably aligned for any built-in type.
block_size is the size of the allocation, must be greater than 0.rc_box_dup (int block_size, mem_block)
Allocates a new block of data with reference counting semantics, and copies @block_size bytes of @mem_block into it.
block_size is the number of bytes to copy, must be greater than 0.mem_block is the memory to copy.rc_box_get_size (mem_block)
Retrieves the size of the reference counted data pointed by @mem_block.
mem_block is a pointer to reference counted data.rc_box_release (mem_block)
Releases a reference on the data pointed by @mem_block. If the reference was the last one, it will free the resources allocated for @mem_block.
mem_block is a pointer to reference counted data.None.realloc (mem, int n_bytes)
Reallocates the memory pointed to by @mem, so that it now has space for
bytes of memory. It returns the new address of the memory, which may have been moved. @mem may be %NULL, in which case it's considered to have zero-length. @n_bytes may be 0, in which case %NULL will be returned and @mem will be freed unless it is %NULL. If the allocation fails (because the system is out of memory), the program is terminated.mem is the memory to reallocate.n_bytes is new size of the memory in bytes.realloc_n (mem, int n_blocks, int n_block_bytes)
This function is similar to g_realloc(), allocating (@n_blocks *
bytes, but care is taken to detect possible overflow during multiplication. If the allocation fails (because the system is out of memory), the program is terminated.mem is the memory to reallocate.n_blocks is the number of blocks to allocate.n_block_bytes is the size of each block in bytes.ref_count_compare (int rc, int val)
Compares the current value of @rc with @val.
rc is the address of a reference count variable.val is the value to compare.ref_string_acquire (string str)
Acquires a reference on a string.
str is a reference counted string.ref_string_equal (string str1, string str2)
Compares two ref-counted strings for byte-by-byte equality. It can be passed to [func@GLib.HashTable.new] as the key equality function, and behaves exactly the same as [func@GLib.str_equal] (or
strcmp()), but can return slightly faster as it can check the string lengths before checking all the bytes.
str1 is a reference counted string.str2 is a reference counted string.ref_string_length (string str)
Retrieves the length of @str.
str is a reference counted string.ref_string_new (string str)
Creates a new reference counted string and copies the contents of @str into it.
str is a NUL-terminated string.ref_string_new_intern (string str)
Creates a new reference counted string and copies the content of @str into it. If you call this function multiple times with the same @str, or with the same contents of @str, it will return a new reference, instead of creating a new string.
str is a NUL-terminated string.ref_string_new_len (string str, int len)
Creates a new reference counted string and copies the contents of @str into it, up to @len bytes. Since this function does not stop at nul bytes, it is the caller's responsibility to ensure that @str has at least
addressable bytes.str is a string.len is length of @str to use, or -1 if @str is nul-terminated.ref_string_release (string str)
Releases a reference on a string; if it was the last reference, the resources allocated by the string are freed as well.
str is a reference counted string.None.regex_escape_nul (string arg0String, int length)
Escapes the nul characters in @string to "\x00". It can be used to compile a regex with embedded nul characters. For completeness, @length can be -1 for a nul-terminated string. In this case the output string will be of course equal to @string.
string is the string to escape.length is the length of @string.regex_escape_string (string arg0String, int length)
Escapes the special characters used for regular expressions in @string, for instance "a.b*c" becomes "a.b*c". This function is useful to dynamically generate regular expressions. @string can contain nul characters that are replaced with "\0", in this case remember to specify the correct length of @string in @length.
string is the string to escape.length is the length of @string, in bytes, or -1 if @string is nul-terminated.regex_match_simple (string pattern, string arg1String, string compile_options, string match_options)
Scans for a match in @string for @pattern. This function is equivalent to g_regex_match() but it does not require to compile the pattern with g_regex_new(), avoiding some lines of code when you need just to do a match without extracting substrings, capture counts, and so on. If this function is to be called on the same @pattern more than once, it's more efficient to compile the pattern once with g_regex_new() and then use g_regex_match().
pattern is the regular expression.string is the string to scan for matches.compile_options is compile options for the regular expression, or 0.match_options is match options, or 0.regex_split_simple (string pattern, string arg1String, string compile_options, string match_options)
Breaks the string on the pattern, and returns an array of the tokens. If the pattern contains capturing parentheses, then the text for each of the substrings will also be returned. If the pattern does not match anywhere in the string, then the whole string is returned as the first token. This function is equivalent to g_regex_split() but it does not require to compile the pattern with g_regex_new(), avoiding some lines of code when you need just to do a split without extracting substrings, capture counts, and so on. If this function is to be called on the same @pattern more than once, it's more efficient to compile the pattern once with g_regex_new() and then use g_regex_split(). As a special case, the result of splitting the empty string "" is an empty vector, not a vector containing a single string. The reason for this special case is that being able to represent an empty vector is typically more useful than consistent handling of empty elements. If you do need to represent empty elements, you'll need to check for the empty string before calling this function. A pattern that can match empty strings splits @string into separate characters wherever it matches the empty string between characters. For example splitting "ab c" using as a separator "\s*", you will get "a", "b" and "c".
pattern is the regular expression.string is the string to scan for matches.compile_options is compile options for the regular expression, or 0.match_options is match options, or 0.reload_user_special_dirs_cache ()
Resets the cache used for g_get_user_special_dir(), so that the latest on-disk version is used. Call this only if you just changed the data on disk yourself. Due to thread safety issues this may cause leaking of strings that were previously returned from g_get_user_special_dir() that can't be freed. We ensure to only leak the data for the directories that actually changed value though.
None.remove (string filename)
A wrapper for the POSIX remove() function. The remove() function deletes a name from the filesystem. See your C library manual for more details about how remove() works on your system. On Unix, remove() removes also directories, as it calls unlink() for files and rmdir() for directories. On Windows, although remove() in the C library only works for files, this function tries first remove() and then if that fails rmdir(), and thus works for both files and directories. Note however, that on Windows, it is in general not possible to remove a file that is open to some process, or mapped into memory. If this function fails on Windows you can't infer too much from the errno value. rmdir() is tried regardless of what caused remove() to fail. Any errno value set by remove() will be overwritten by that set by rmdir().
filename is a pathname in the GLib file name encoding (UTF-8 on Windows).rename (string oldfilename, string newfilename)
A wrapper for the POSIX rename() function. The rename() function renames a file, moving it between directories if required. See your C library manual for more details about how rename() works on your system. It is not possible in general on Windows to rename a file that is open to some process.
oldfilename is a pathname in the GLib file name encoding (UTF-8 on Windows).newfilename is a pathname in the GLib file name encoding.return_if_fail_warning (string log_domain, string pretty_function, string expression)
Internal function used to print messages from the public [func@GLib.return_if_fail] and [func@GLib.return_val_if_fail] macros.
log_domain is log domain.pretty_function is function containing the assertion.expression is expression which failed.None.rmdir (string filename)
A wrapper for the POSIX rmdir() function. The rmdir() function deletes a directory from the filesystem. See your C library manual for more details about how rmdir() works on your system.
filename is a pathname in the GLib file name encoding (UTF-8 on Windows).sequence_get (object iter)
Returns the data that @iter points to.
iter is a #GSequenceIter.sequence_insert_before (object iter, data)
Inserts a new item just before the item pointed to by @iter.
iter is a #GSequenceIter.data is the data for the new item.sequence_move (object src, object dest)
Moves the item pointed to by @src to the position indicated by @dest. After calling this function @dest will point to the position immediately after @src. It is allowed for @src and @dest to point into different sequences.
src is a #GSequenceIter pointing to the item to move.dest is a #GSequenceIter pointing to the position to which the item is moved.None.sequence_move_range (object dest, object begin, object end)
Inserts the (@begin, @end) range at the destination pointed to by @dest. The @begin and @end iters must point into the same sequence. It is allowed for @dest to point to a different sequence than the one pointed into by @begin and @end. If @dest is %NULL, the range indicated by @begin and @end is removed from the sequence. If @dest points to a place within the (@begin, @end) range, the range does not move.
dest is a #GSequenceIter.begin is a #GSequenceIter.end is a #GSequenceIter.None.sequence_range_get_midpoint (object begin, object end)
Finds an iterator somewhere in the range (@begin, @end). This iterator will be close to the middle of the range, but is not guaranteed to be exactly in the middle. The @begin and @end iterators must both point to the same sequence and @begin must come before or be equal to @end in the sequence.
begin is a #GSequenceIter.end is a #GSequenceIter.sequence_remove (object iter)
Removes the item pointed to by @iter. It is an error to pass the end iterator to this function. If the sequence has a data destroy function associated with it, this function is called on the data for the removed item.
iter is a #GSequenceIter.None.sequence_remove_range (object begin, object end)
Removes all items in the (@begin, @end) range. If the sequence has a data destroy function associated with it, this function is called on the data for the removed items.
begin is a #GSequenceIter.end is a #GSequenceIter.None.sequence_set (object iter, data)
Changes the data for the item pointed to by @iter to be @data. If the sequence has a data destroy function associated with it, that function is called on the existing data that @iter pointed to.
iter is a #GSequenceIter.data is new data for the item.None.sequence_swap (object a, object b)
Swaps the items pointed to by @a and @b. It is allowed for @a and @b to point into difference sequences.
a is a #GSequenceIter.b is a #GSequenceIter.None.set_application_name (string application_name)
Sets a human-readable name for the application. This name should be localized if possible, and is intended for display to the user. Contrast with g_set_prgname(), which sets a non-localized name. g_set_prgname() will be called automatically by gtk_init(), but g_set_application_name() will not. Note that for thread safety reasons, this function can only be called once. The application name will be used in contexts such as error messages, or when displaying an application's name in the task list.
application_name is localized name of the application.None.set_prgname (string prgname)
Sets the name of the program. This name should not be localized, in contrast to g_set_application_name(). If you are using #GApplication the program name is set in g_application_run(). In case of GDK or GTK it is set in gdk_init(), which is called by gtk_init() and the #GtkApplication::startup handler. By default, the program name is found by taking the last component of @argv[0]. Since GLib 2.72, this function can be called multiple times and is fully thread safe. Prior to GLib 2.72, this function could only be called once per process. See the GTK documentation for requirements on integrating g_set_prgname() with GTK applications.
prgname is the name of the program..None.setenv (string variable, string value, bool overwrite)
Sets an environment variable. 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. Note that on some systems, when variables are overwritten, the memory used for the previous variables and its value isn't reclaimed. You should be mindful of the fact that environment variable handling in UNIX is not thread-safe, and your program may crash if one thread calls g_setenv() while another thread is calling getenv(). (And note that many functions, such as gettext(), call getenv() internally.) This function is only safe to use at the very start of your program, before creating any other threads (or creating objects that create worker threads of their own). If you need to set up the environment for a child process, you can use g_get_environ() to get an environment array, modify that with g_environ_setenv() and g_environ_unsetenv(), and then pass that array directly to execvpe(), g_spawn_async(), or the like.
variable is the environment variable to set, must not contain '='..value is the value for to set the variable to..overwrite is whether to change the variable if it already exists..shell_quote (string unquoted_string)
Quotes a string so that the shell (/bin/sh) will interpret the quoted string to mean @unquoted_string. If you pass a filename to the shell, for example, you should first quote it with this function. The return value must be freed with g_free(). The quoting style used is undefined (single or double quotes may be used).
unquoted_string is a literal string.shell_unquote (string quoted_string)
Unquotes a string as the shell (/bin/sh) would. This function only handles quotes; if a string contains file globs, arithmetic operators, variables, backticks, redirections, or other special-to-the-shell features, the result will be different from the result a real shell would produce (the variables, backticks, etc. will be passed through literally instead of being expanded). This function is guaranteed to succeed if applied to the result of g_shell_quote(). If it fails, it returns %NULL and sets the error. The @quoted_string need not actually contain quoted or escaped text; g_shell_unquote() simply goes through the string and unquotes/unescapes anything that the shell would. Both single and double quotes are handled, as are escapes including escaped newlines. The return value must be freed with g_free(). Possible errors are in the %G_SHELL_ERROR domain. Shell quoting rules are a bit strange. Single quotes preserve the literal string exactly. escape sequences are not allowed; not even
\'- if you want a'in the quoted text, you have to do something like'foo'\''bar'. Double quotes allow$, ```,",\, and newline to be escaped with backslash. Otherwise double quotes preserve things literally.
quoted_string is shell-quoted string.slice_alloc (int block_size)
Allocates a block of memory from the libc allocator. The block address handed out can be expected to be aligned to at least
1 * sizeof (void*). Since GLib 2.76 this always uses the system malloc() implementation internally.
block_size is the number of bytes to allocate.slice_alloc0 (int block_size)
Allocates a block of memory via g_slice_alloc() and initializes the returned memory to 0. Since GLib 2.76 this always uses the system malloc() implementation internally.
block_size is the number of bytes to allocate.slice_copy (int block_size, mem_block)
Allocates a block of memory from the slice allocator and copies
bytes into it from @mem_block. @mem_block must be non-%NULL if @block_size is non-zero. Since GLib 2.76 this always uses the system malloc() implementation internally.block_size is the number of bytes to allocate.mem_block is the memory to copy.slice_free1 (int block_size, mem_block)
Frees a block of memory. The memory must have been allocated via g_slice_alloc() or g_slice_alloc0() and the @block_size has to match the size specified upon allocation. Note that the exact release behaviour can be changed with the
G_DEBUG=gc-friendlyenvironment variable. If @mem_block is %NULL, this function does nothing. Since GLib 2.76 this always uses the system free_sized() implementation internally.
block_size is the size of the block.mem_block is a pointer to the block to free.None.slice_free_chain_with_offset (int block_size, mem_chain, int next_offset)
Frees a linked list of memory blocks of structure type @type. The memory blocks must be equal-sized, allocated via g_slice_alloc() or g_slice_alloc0() and linked together by a @next pointer (similar to #GSList). The offset of the @next field in each block is passed as third argument. Note that the exact release behaviour can be changed with the
G_DEBUG=gc-friendlyenvironment variable. If @mem_chain is %NULL, this function does nothing. Since GLib 2.76 this always uses the system free_sized() implementation internally.
block_size is the size of the blocks.mem_chain is a pointer to the first block of the chain.next_offset is the offset of the @next field in the blocks.None.slist_pop_allocator ()
Generated wrapper for GIR function
slist_pop_allocator. Native symbol:g_slist_pop_allocator.
None.slist_push_allocator (object allocator)
Generated wrapper for GIR function
slist_push_allocator. Native symbol:g_slist_push_allocator.
None.source_remove (int tag)
Removes the source with the given ID from the default main context. You must use [method@GLib.Source.destroy] for sources added to a non-default main context. The ID of a [struct@GLib.Source] is given by [method@GLib.Source.get_id], or will be returned by the functions [method@GLib.Source.attach], [func@GLib.idle_add], [func@GLib.idle_add_full], [func@GLib.timeout_add], [func@GLib.timeout_add_full], [func@GLib.child_watch_add], [func@GLib.child_watch_add_full], [func@GLib.io_add_watch], and [func@GLib.io_add_watch_full]. It is a programmer error to attempt to remove a non-existent source. More specifically: source IDs can be reissued after a source has been destroyed and therefore it is never valid to use this function with a source ID which may have already been removed. An example is when scheduling an idle to run in another thread with [func@GLib.idle_add]: the idle may already have run and been removed by the time this function is called on its (now invalid) source ID. This source ID may have been reissued, leading to the operation being performed against the wrong source.
tag is the ID of the source to remove..source_remove_by_funcs_user_data (object funcs, user_data)
Removes a source from the default main loop context given the source functions and user data. If multiple sources exist with the same source functions and user data, only one will be destroyed.
funcs is the @source_funcs passed to [ctor@GLib.Source.new].user_data is the user data for the callback.source_remove_by_user_data (user_data)
Removes a source from the default main loop context given the user data for the callback. If multiple sources exist with the same user data, only one will be destroyed.
user_data is the user_data for the callback.source_set_name_by_id (int tag, string name)
Sets the name of a source using its ID. This is a convenience utility to set source names from the return value of [func@GLib.idle_add], [func@GLib.timeout_add], etc. It is a programmer error to attempt to set the name of a non-existent source. More specifically: source IDs can be reissued after a source has been destroyed and therefore it is never valid to use this function with a source ID which may have already been removed. An example is when scheduling an idle to run in another thread with [func@GLib.idle_add]: the idle may already have run and been removed by the time this function is called on its (now invalid) source ID. This source ID may have been reissued, leading to the operation being performed against the wrong source.
tag is a source ID.name is debug name for the source.None.spaced_primes_closest (int num)
Gets the smallest prime number from a built-in array of primes which is larger than @num. This is used within GLib to calculate the optimum size of a #GHashTable. The built-in array of primes ranges from 11 to 13845163 such that each prime is approximately 1.5-2 times the previous prime.
num is a #guint.spawn_check_exit_status (int wait_status)
An old name for g_spawn_check_wait_status(), deprecated because its name is misleading. Despite the name of the function, @wait_status must be the wait status as returned by g_spawn_sync(), g_subprocess_get_status(),
waitpid(), etc. On Unix platforms, it is incorrect for it to be the exit status as passed toexit()or returned by g_subprocess_get_exit_status() orWEXITSTATUS().
wait_status is A status as returned from g_spawn_sync().spawn_check_wait_status (int wait_status)
Set @error if @wait_status indicates the child exited abnormally (e.g. with a nonzero exit code, or via a fatal signal). The g_spawn_sync() and g_child_watch_add() family of APIs return the status of subprocesses encoded in a platform-specific way. On Unix, this is guaranteed to be in the same format waitpid() returns, and on Windows it is guaranteed to be the result of GetExitCodeProcess(). Prior to the introduction of this function in GLib 2.34, interpreting @wait_status required use of platform-specific APIs, which is problematic for software using GLib as a cross-platform layer. Additionally, many programs simply want to determine whether or not the child exited successfully, and either propagate a #GError or print a message to standard error. In that common case, this function can be used. Note that the error message in @error will contain human-readable information about the wait status. The
and @code of @error have special semantics in the case where the process has an "exit code", as opposed to being killed by a signal. On Unix, this happens if WIFEXITED() would be true of @wait_status. On Windows, it is always the case. The special semantics are that the actual exit code will be the code set in @error, and the domain will be %G_SPAWN_EXIT_ERROR. This allows you to differentiate between different exit codes. If the process was terminated by some means other than an exit status (for example if it was killed by a signal), the domain will be %G_SPAWN_ERROR and the code will be %G_SPAWN_ERROR_FAILED. This function just offers convenience; you can of course also check the available platform via a macro such as %G_OS_UNIX, and use WIFEXITED() and WEXITSTATUS() on @wait_status directly. Do not attempt to scan or parse the error message string; it may be translated and/or change in future versions of GLib. Prior to version 2.70, g_spawn_check_exit_status() provides the same functionality, although under a misleading name.wait_status is A platform-specific wait status as returned from g_spawn_sync().spawn_command_line_async (string command_line)
A simple version of g_spawn_async() that parses a command line with g_shell_parse_argv() and passes it to g_spawn_async(). Runs a command line in the background. Unlike g_spawn_async(), the %G_SPAWN_SEARCH_PATH flag is enabled, other flags are not. Note that %G_SPAWN_SEARCH_PATH can have security implications, so consider using g_spawn_async() directly if appropriate. Possible errors are those from g_shell_parse_argv() and g_spawn_async(). The same concerns on Windows apply as for g_spawn_command_line_sync().
command_line is a command line.stat (string filename, object buf)
A wrapper for the POSIX stat() function. The stat() function returns information about a file. On Windows the stat() function in the C library checks only the FAT-style READONLY attribute and does not look at the ACL at all. Thus on Windows the protection bits in the @st_mode field are a fabrication of little use. On Windows the Microsoft C libraries have several variants of the stat struct and stat() function with names like _stat(), _stat32(), _stat32i64() and _stat64i32(). The one used here is for 32-bit code the one with 32-bit size and time fields, specifically called _stat32(). In Microsoft's compiler, by default struct stat means one with 64-bit time fields while in MinGW struct stat is the legacy one with 32-bit fields. To hopefully clear up this messs, the gstdio.h header defines a type #GStatBuf which is the appropriate struct type depending on the platform and/or compiler being used. On POSIX it is just struct stat, but note that even on POSIX platforms, stat() might be a macro. See your C library manual for more details about stat().
filename is a pathname in the GLib file name encoding (UTF-8 on Windows).buf is a pointer to a stat struct, which will be filled with the file information.stpcpy (string dest, string src)
Copies a nul-terminated string into the destination buffer, including the trailing nul byte, and returns a pointer to the trailing nul byte in
dest. The return value is useful for concatenating multiple strings without having to repeatedly scan for the end.
dest is destination buffer.src is source string.str_equal (v1, v2)
Compares two strings for byte-by-byte equality and returns %TRUE if they are equal. It can be passed to g_hash_table_new() as the @key_equal_func parameter, when using non-%NULL strings as keys in a #GHashTable. This function is typically used for hash table comparisons, but can be used for general purpose comparisons of non-%NULL strings. For a %NULL-safe string comparison function, see g_strcmp0().
v1 is a key.v2 is a key to compare with @v1.str_has_prefix (string str, string prefix)
Looks whether the string @str begins with @prefix.
str is a string to look in.prefix is the prefix to look for.str_has_suffix (string str, string suffix)
Looks whether a string ends with @suffix.
str is a string to look in.suffix is the suffix to look for.str_hash (v)
Converts a string to a hash value. This function implements the widely used "djb" hash apparently posted by Daniel Bernstein to comp.lang.c some time ago. The 32 bit unsigned hash value starts at 5381 and for each byte 'c' in the string, is updated:
hash = hash * 33 + c. This function uses the signed value of each byte. It can be passed to g_hash_table_new() as the @hash_func parameter, when using non-%NULL strings as keys in a #GHashTable. Note that this function may not be a perfect fit for all use cases. For example, it produces some hash collisions with strings as short as 2.
v is a string key.str_is_ascii (string str)
Determines if a string is pure ASCII. A string is pure ASCII if it contains no bytes with the high bit set.
str is a string.str_match_string (string search_term, string potential_hit, bool accept_alternates)
Checks if a search conducted for @search_term should match
This function calls [func@GLib.str_tokenize_and_fold] on both @search_term and @potential_hit. ASCII alternates are never taken for @search_term but will be taken for @potential_hit according to the value of @accept_alternates. A hit occurs when each folded token inis a prefix of a folded token from @potential_hit. Depending on how you're performing the search, it will typically be faster to call g_str_tokenize_and_fold() on each string in your corpus and build an index on the returned folded tokens, then call g_str_tokenize_and_fold() on the search term and perform lookups into that index. As some examples, searching for ‘fred’ would match the potential hit ‘Smith, Fred’ and also ‘Frédéric’. Searching for ‘Fréd’ would match ‘Frédéric’ but not ‘Frederic’ (due to the one-directional nature of accent matching). Searching ‘fo’ would match ‘Foo’ and ‘Bar Foo Baz’, but not ‘SFO’ (because no word has ‘fo’ as a prefix).search_term is the search term from the user.potential_hit is the text that may be a hit.accept_alternates is if true, ASCII alternates are accepted.str_to_ascii (string str, string from_locale)
Transliterate @str to plain ASCII. For best results, @str should be in composed normalised form. This function performs a reasonably good set of character replacements. The particular set of replacements that is done may change by version or even by runtime environment. If the source language of @str is known, it can used to improve the accuracy of the translation by passing it as @from_locale. It should be a valid POSIX locale string (of the form
language[_territory][.codeset][@modifier]). If @from_locale is %NULL then the current locale is used. If you want to do translation for no specific locale, and you want it to be done independently of the currently locale, specify"C"for @from_locale.
str is a string, in UTF-8.from_locale is the source locale, if known.strcanon (string arg0String, string valid_chars, int substitutor)
For each character in @string, if the character is not in @valid_chars, replaces the character with @substitutor. Modifies @string in place, and return @string itself, not a copy. The return value is to allow nesting such as:
C g_ascii_strup (g_strcanon (str, "abc", '?'))In order to modify a copy, you may use [func@GLib.strdup]:C reformatted = g_strcanon (g_strdup (const_str), "abc", '?'); … g_free (reformatted);
string is a nul-terminated array of bytes.valid_chars is bytes permitted in @string.substitutor is replacement character for disallowed bytes.strcasecmp (string s1, string s2)
A case-insensitive string comparison, corresponding to the standard
strcasecmp()function on platforms which support it.
s1 is string to compare with @s2.s2 is string to compare with @s1.strchomp (string arg0String)
Removes trailing whitespace from a string. This function doesn't allocate or reallocate any memory; it modifies @string in place. Therefore, it cannot be used on statically allocated strings. The pointer to @string is returned to allow the nesting of functions. Also see [func@GLib.strchug] and [func@GLib.strstrip].
string is a string to remove the trailing whitespace from.strchug (string arg0String)
Removes leading whitespace from a string, by moving the rest of the characters forward. This function doesn't allocate or reallocate any memory; it modifies @string in place. Therefore, it cannot be used on statically allocated strings. The pointer to @string is returned to allow the nesting of functions. Also see [func@GLib.strchomp] and [func@GLib.strstrip].
string is a string to remove the leading whitespace from.strcmp0 (string str1, string str2)
Compares @str1 and @str2 like
strcmp(). HandlesNULLgracefully by sorting it before non-NULLstrings. Comparing twoNULLpointers returns 0.
str1 is a string.str2 is another string.strcompress (string source)
Makes a copy of a string replacing C string-style escape sequences with their one byte equivalent: -
\b→ U+0008 Backspace -\f→ U+000C Form Feed -\n→ U+000A Line Feed -\r→ U+000D Carriage Return -\t→ U+0009 Horizontal Tabulation -\v→ U+000B Vertical Tabulation -\followed by one to three octal digits → the numeric value (mod 256) -\followed by any other character → the character as is. For example,\\will turn into a backslash (\) and\"into a double quote ("). [func@GLib.strescape] does the reverse conversion.
source is a string to compress.strdelimit (string arg0String, string delimiters, int new_delimiter)
Converts any delimiter characters in @string to @new_delimiter. Any characters in @string which are found in @delimiters are changed to the
character. Modifies @string in place, and returns @string itself, not a copy. The return value is to allow nesting such as: C g_ascii_strup (g_strdelimit (str, "abc", '?')) In order to modify a copy, you may use [func@GLib.strdup]: C reformatted = g_strdelimit (g_strdup (const_str), "abc", '?'); … g_free (reformatted); string is the string to convert.delimiters is a string containing the current delimiters, or NULL to use the standard delimiters defined in [const@GLib.STR_DELIMITERS].new_delimiter is the new delimiter character.strdown (string arg0String)
Converts a string to lower case.
string is the string to convert.strdup (string str)
Duplicates a string. If @str is
NULLit returnsNULL.
str is the string to duplicate.strdupv (list str_array)
Copies an array of strings. The copy is a deep copy; each string is also copied. If called on a
NULLvalue,g_strdupv()simply returnsNULL.
str_array is an array of strings to copy.strerror (int errnum)
Returns a string corresponding to the given error code, e.g. "no such process". Unlike
strerror(), this always returns a string in UTF-8 encoding, and the pointer is guaranteed to remain valid for the lifetime of the process. If the error code is unknown, it returns a string like “Unknown error <code>”. Note that the string may be translated according to the current locale. The value oferrnowill not be changed by this function. However, it may be changed by intermediate function calls, so you should save its value as soon as the call returns:C int saved_errno; ret = read (blah); saved_errno = errno; g_strerror (saved_errno);
errnum is the system error number. See the standard C errno documentation.strescape (string source, string exceptions)
It replaces the following special characters in the string @source with their corresponding C escape sequence: | Symbol | Escape | |-----------------------------------------------------------------------------|--------| | U+0008 Backspace |
\b| | U+000C Form Feed |\f| | U+000A Line Feed |\n| | U+000D Carriage Return |\r| | U+0009 Horizontal Tabulation |\t| | U+000B Vertical Tabulation |\v| It also inserts a backslash (\) before any backslash or a double quote ("). Additionally all characters in the range 0x01-0x1F (everything below SPACE) and in the range 0x7F-0xFF (all non-ASCII chars) are replaced with a backslash followed by their octal representation. Characters supplied in @exceptions are not escaped. [func@GLib.strcompress] does the reverse conversion.
source is a string to escape.exceptions is a string of characters not to escape in @source.strfreev (list str_array)
Frees an array of strings, as well as each string it contains. If
is NULL, this function simply returns.str_array is an array of strings to free.None.strip_context (string msgid, string msgval)
An auxiliary function for gettext() support (see Q_()).
msgid is a string.msgval is another string.strjoinv (string separator, list str_array)
Joins an array of strings together to form one long string, with the optional @separator inserted between each of them. If @str_array has no items, the return value will be an empty string. If @str_array contains a single item, @separator will not appear in the resulting string.
separator is a string to insert between each of the strings.str_array is an array of strings to join.strlcat (string dest, string src, int dest_size)
Portability wrapper that calls
strlcat()on systems which have it, and emulates it otherwise. Appends nul-terminated @src string to @dest, guaranteeing nul-termination for @dest. The total size of @dest won't exceed @dest_size. At most @dest_size - 1 characters will be copied. Unlikestrncat(), @dest_size is the full size of dest, not the space left over. This function does not allocate memory. It always nul-terminates (unless @dest_size == 0 or there were no nul characters in the @dest_size characters of dest to start with). Caveat: this is supposedly a more secure alternative tostrcat()orstrncat(), but for real security [func@GLib.strconcat] is harder to mess up.
dest is destination buffer, already containing one nul-terminated string.src is source buffer.dest_size is length of @dest buffer in bytes (not length of existing string inside @dest).strlcpy (string dest, string src, int dest_size)
Portability wrapper that calls
strlcpy()on systems which have it, and emulatesstrlcpy()otherwise. Copies @src to @dest; @dest is guaranteed to be nul-terminated; @src must be nul-terminated; @dest_size is the buffer size, not the number of bytes to copy. At most @dest_size - 1 characters will be copied. Always nul-terminates (unless @dest_size is 0). This function does not allocate memory. Unlikestrncpy(), this function doesn't pad @dest (so it's often faster). It returns the size of the attempted result,strlen (src), so if @retval >= @dest_size, truncation occurred. Caveat:strlcpy()is supposedly more secure thanstrcpy()orstrncpy(), but if you really want to avoid screwups, [func@GLib.strdup] is an even better idea.
dest is destination buffer.src is source buffer.dest_size is length of @dest in bytes.strncasecmp (string s1, string s2, int n)
A case-insensitive string comparison, corresponding to the standard
strncasecmp()function on platforms which support it. It is similar to [func@GLib.strcasecmp] except it only compares the first @n characters of the strings.
s1 is string to compare with @s2.s2 is string to compare with @s1.n is the maximum number of characters to compare.strndup (string str, int n)
Duplicates the first @n bytes of a string, returning a newly-allocated buffer @n + 1 bytes long which will always be nul-terminated. If @str is less than @n bytes long the buffer is padded with nuls. If @str is
NULLit returnsNULL. To copy a number of characters from a UTF-8 encoded string, use [func@GLib.utf8_strncpy] instead.
str is the string to duplicate.n is the maximum number of bytes to copy from @str.strnfill (int length, int fill_char)
Creates a new string @length bytes long filled with @fill_char.
length is the length of the new string.fill_char is the byte to fill the string with.strreverse (string arg0String)
Reverses all of the bytes in a string. For example,
g_strreverse ("abcdef")will result in "fedcba". Note thatg_strreverse()doesn't work on UTF-8 strings containing multibyte characters. For that purpose, use [func@GLib.utf8_strreverse].
string is the string to reverse.strrstr (string haystack, string needle)
Searches the string @haystack for the last occurrence of the string
The fact that this function returns gchar * rather than const gchar * is a historical artifact.haystack is a string to search in.needle is the string to search for.strrstr_len (string haystack, int haystack_len, string needle)
Searches the string @haystack for the last occurrence of the string
limiting the length of the search to @haystack_len. The fact that this function returns gchar * rather than const gchar * is a historical artifact.haystack is a string to search in.haystack_len is the maximum length of @haystack in bytes. A length of -1 can be used to mean "search the entire string", like [func@GLib.strrstr].needle is the string to search for.strsignal (int signum)
Returns a string describing the given signal, e.g. "Segmentation fault". If the signal is unknown, it returns “unknown signal (<signum>)”. You should use this function in preference to
strsignal(), because it returns a string in UTF-8 encoding, and since not all platforms support thestrsignal()function.
signum is the signal number. See the signal documentation.strsplit (string arg0String, string delimiter, int max_tokens)
Splits a string into a maximum of @max_tokens pieces, using the given
If @max_tokens is reached, the remainder of @string is appended to the last token. As an example, the result of g_strsplit (":a:bc::d:", ":", -1) is an array containing the six strings "", "a", "bc", "", "d" and "". As a special case, the result of splitting the empty string "" is an empty array, not an array containing a single string. The reason for this special case is that being able to represent an empty array is typically more useful than consistent handling of empty elements. If you do need to represent empty elements, you'll need to check for the empty string before calling g_strsplit().string is a string to split.delimiter is a string which specifies the places at which to split the string. The delimiter is not included in any of the resulting strings, unless @max_tokens is reached..max_tokens is the maximum number of pieces to split @string into If this is less than 1, the string is split completely.strstr_len (string haystack, int haystack_len, string needle)
Searches the string @haystack for the first occurrence of the string
limiting the length of the search to @haystack_len or a nul terminator byte (whichever is reached first). A length of -1 can be used to mean “search the entire string”, like strstr(). The fact that this function returns gchar * rather than const gchar * is a historical artifact.haystack is a string to search in.haystack_len is the maximum length of @haystack in bytes, or -1 to search it entirely.needle is the string to search for.strup (string arg0String)
Converts a string to upper case.
string is the string to convert.strv_contains (list strv, string str)
Checks if an array of strings contains the string @str according to [func@GLib.str_equal]. @strv must not be
NULL.
strv is an array of strings to search in.str is the string to search for.strv_equal (list strv1, list strv2)
Checks if two arrays of strings contain exactly the same elements in exactly the same order. Elements are compared using [func@GLib.str_equal]. To match independently of order, sort the arrays first (using [func@GLib.qsort_with_data] or similar). Two empty arrays are considered equal. Neither @strv1 nor @strv2 may be
NULL.
strv1 is an array of strings to compare to @strv2.strv2 is an array of strings to compare to @strv1.strv_length (list str_array)
Returns the length of an array of strings. @str_array must not be
NULL.
str_array is an array of strings.test_assert_expected_messages_internal (string domain, string file, int line, string func)
Generated wrapper for GIR function
test_assert_expected_messages_internal. Native symbol:g_test_assert_expected_messages_internal.
None.test_bug (string bug_uri_snippet)
Adds a message to test reports that associates a bug URI with a test case. Bug URIs are constructed from a base URI set with [func@GLib.test_bug_base] and @bug_uri_snippet. If [func@GLib.test_bug_base] has not been called, it is assumed to be the empty string, so a full URI can be provided to [func@GLib.test_bug] instead. See also [func@GLib.test_summary]. Since GLib 2.70, the base URI is not prepended to @bug_uri_snippet if it is already a valid URI.
bug_uri_snippet is Bug specific bug tracker URI or URI portion..None.test_bug_base (string uri_pattern)
Specifies the base URI for bug reports. The base URI is used to construct bug report messages for [func@GLib.test_message] when [func@GLib.test_bug] is called. Calling this function outside of a test case sets the default base URI for all test cases. Calling it from within a test case changes the base URI for the scope of the test case only. Bug URIs are constructed by appending a bug specific URI portion to
or by replacing the special string %s within @uri_pattern if that is present. If [func@GLib.test_bug_base] is not called, bug URIs are formed solely from the value provided by [func@GLib.test_bug].uri_pattern is the base pattern for bug URIs.None.test_create_suite (string suite_name)
Creates a new test suite with the name @suite_name.
suite_name is a name for the suite.test_disable_crash_reporting ()
Attempts to disable system crash reporting infrastructure. This function should be called before exercising code paths that are expected or intended to crash, to avoid wasting resources in system-wide crash collection infrastructure such as systemd-coredump or abrt.
None.test_expect_message (string log_domain, string log_level, string pattern)
Indicates that a message with the given @log_domain and @log_level, with text matching @pattern, is expected to be logged. When this message is logged, it will not be printed, and the test case will not abort. This API may only be used with the old logging API ([func@GLib.log] without
G_LOG_USE_STRUCTUREDdefined). It will not work with the structured logging API. See Testing for Messages. Use [func@GLib.test_assert_expected_messages] to assert that all previously-expected messages have been seen and suppressed. You can call this multiple times in a row, if multiple messages are expected as a result of a single call. (The messages must appear in the same order as the calls to [func@GLib.test_expect_message].) For example:c // g_main_context_push_thread_default() should fail if the // context is already owned by another thread. g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "assertion*acquired_context*failed"); g_main_context_push_thread_default (bad_context); g_test_assert_expected_messages ();Note that you cannot use this to test [func@GLib.error] messages, since [func@GLib.error] intentionally never returns even if the program doesn’t abort; use [func@GLib.test_trap_subprocess] in this case. If messages at [flags@GLib.LogLevelFlags.LEVEL_DEBUG] are emitted, but not explicitly expected via [func@GLib.test_expect_message] then they will be ignored.
log_domain is the log domain of the message.log_level is the log level of the message.pattern is a glob-style pattern (see [type@GLib.PatternSpec]).None.test_fail ()
Indicates that a test failed. This function can be called multiple times from the same test. You can use this function if your test failed in a recoverable way. Do not use this function if the failure of a test could cause other tests to malfunction. Calling this function will not stop the test from running, you need to return from the test function yourself. So you can produce additional diagnostic messages or even continue running the test. If not called from inside a test, this function does nothing. Note that unlike [func@GLib.test_skip] and [func@GLib.test_incomplete], this function does not log a message alongside the test failure. If details of the test failure are available, either log them with [func@GLib.test_message] before [func@GLib.test_fail], or use [func@GLib.test_fail_printf] instead.
None.test_failed ()
Returns whether a test has already failed. This will be the case when [func@GLib.test_fail], [func@GLib.test_incomplete] or [func@GLib.test_skip] have been called, but also if an assertion has failed. This can be useful to return early from a test if continuing after a failed assertion might be harmful. The return value of this function is only meaningful if it is called from inside a test function.
test_get_dir (string file_type)
Gets the pathname of the directory containing test files of the type specified by @file_type. This is approximately the same as calling
g_test_build_filename("."), but you don't need to free the return value.
file_type is the type of file (built vs. distributed).test_get_path ()
Gets the test path for the test currently being run. In essence, it will be the same string passed as the first argument to e.g. [func@GLib.test_add] when the test was added. This function returns a valid string only within a test function. Note that this is a test path, not a file system path.
test_get_root ()
Gets the toplevel test suite for the test path API.
test_incomplete (string msg)
Indicates that a test failed because of some incomplete functionality. This function can be called multiple times from the same test. Calling this function will not stop the test from running, you need to return from the test function yourself. So you can produce additional diagnostic messages or even continue running the test. If not called from inside a test, this function does nothing.
msg is explanation.None.test_log_type_name (string log_type)
Generated wrapper for GIR function
test_log_type_name. Native symbol:g_test_log_type_name.
test_queue_free (gfree_pointer)
Enqueues a pointer to be released with [func@GLib.free] during the next teardown phase. This is equivalent to calling [func@GLib.test_queue_destroy] with a destroy callback of [func@GLib.free].
gfree_pointer is the pointer to be stored.None.test_rand_double ()
Gets a reproducible random floating point number. See [func@GLib.test_rand_int] for details on test case random numbers.
test_rand_double_range (double range_start, double range_end)
Gets a reproducible random floating point number out of a specified range. See [func@GLib.test_rand_int] for details on test case random numbers.
range_start is the minimum value returned by this function.range_end is the minimum value not returned by this function.test_run ()
Runs all tests under the toplevel suite. The toplevel suite can be retrieved with [func@GLib.test_get_root]. Similar to [func@GLib.test_run_suite], the test cases to be run are filtered according to test path arguments (
-p testpathand-s testpath) as parsed by [func@GLib.test_init]. [func@GLib.test_run_suite] or [func@GLib.test_run] may only be called once in a program. In general, the tests and sub-suites within each suite are run in the order in which they are defined. However, note that prior to GLib 2.36, there was a bug in theg_test_add_*functions which caused them to create multiple suites with the same name, meaning that if you created tests "/foo/simple", "/bar/simple", and "/foo/using-bar" in that order, they would get run in that order (since [func@GLib.test_run] would run the first "/foo" suite, then the "/bar" suite, then the second "/foo" suite). As of 2.36, this bug is fixed, and adding the tests in that order would result in a running order of "/foo/simple", "/foo/using-bar", "/bar/simple". If this new ordering is sub-optimal (because it puts more-complicated tests before simpler ones, making it harder to figure out exactly what has failed), you can fix it by changing the test paths to group tests by suite in a way that will result in the desired running order. Eg, "/simple/foo", "/simple/bar", "/complex/foo-using-bar". However, you should never make the actual result of a test depend on the order that tests are run in. If you need to ensure that some particular code runs before or after a given test case, use [func@GLib.test_add], which lets you specify setup and teardown functions. If all tests are skipped or marked as incomplete (expected failures), this function will return 0 if producing TAP output, or 77 (treated as "skip test" by Automake) otherwise.
test_run_suite (object suite)
Executes the tests within @suite and all nested test suites. The test suites to be executed are filtered according to test path arguments (
-p testpathand-s testpath) as parsed by [func@GLib.test_init]. See the [func@GLib.test_run] documentation for more information on the order that tests are run in. [func@GLib.test_run_suite] or [func@GLib.test_run] may only be called once in a program.
suite is a test suite.test_set_nonfatal_assertions ()
Changes the behaviour of the various assertion macros. The
g_assert_*()macros,g_test_assert_expected_messages()and the variousg_test_trap_assert_*()macros are changed to not abort to program. Instead, they will call [func@GLib.test_fail] and continue. (This also changes the behavior of [func@GLib.test_fail] so that it will not cause the test program to abort after completing the failed test.) Note that the [func@GLib.assert_not_reached] and [func@GLib.assert] macros are not affected by this. This function can only be called after [func@GLib.test_init].
None.test_skip (string msg)
Indicates that a test was skipped. Calling this function will not stop the test from running, you need to return from the test function yourself. So you can produce additional diagnostic messages or even continue running the test. If not called from inside a test, this function does nothing.
msg is explanation.None.test_subprocess ()
Returns true if the test program is running under [func@GLib.test_trap_subprocess].
test_summary (string summary)
Sets the summary for a test. This may be included in test report output, and is useful documentation for anyone reading the source code or modifying a test in future. It must be a single line, and it should summarise what the test checks, and how. This should be called at the top of a test function. For example:
c static void test_array_sort (void) { g_test_summary ("Test my_array_sort() sorts the array correctly and stably, " "including testing zero length and one-element arrays."); // ... }See also [func@GLib.test_bug].
summary is summary of the test purpose.None.test_timer_elapsed ()
Gets the number of seconds since the last start of the timer with [func@GLib.test_timer_start].
test_timer_last ()
Reports the last result of [func@GLib.test_timer_elapsed].
test_timer_start ()
Starts a timing test. Call [func@GLib.test_timer_elapsed] when the task is supposed to be done. Call this function again to restart the timer.
None.test_trap_has_passed ()
Checks the result of the last [func@GLib.test_trap_subprocess] call.
test_trap_has_skipped ()
Checks the result of the last [func@GLib.test_trap_subprocess] call.
test_trap_reached_timeout ()
Checks the result of the last [func@GLib.test_trap_subprocess] call.
thread_exit (retval)
Terminates the current thread. If another thread is waiting for us using g_thread_join() then the waiting thread will be woken up and get @retval as the return value of g_thread_join(). Calling g_thread_exit() with a parameter @retval is equivalent to returning @retval from the function
as given to g_thread_new(). You must only call g_thread_exit() from a thread that you created yourself with g_thread_new() or related APIs. You must not call this function from a thread created with another threading library or or from within a #GThreadPool.retval is the return value of this thread.None.thread_get_initialized ()
Indicates if g_thread_init() has been called.
thread_init (vtable)
If you use GLib from more than one thread, you must initialize the thread system by calling g_thread_init(). Since version 2.24, calling g_thread_init() multiple times is allowed, but nothing happens except for the first call. Since version 2.32, GLib does not support custom thread implementations anymore and the @vtable parameter is ignored and you should pass %NULL. ::: note g_thread_init() must not be called directly or indirectly in a callback from GLib. Also no mutexes may be currently locked while calling g_thread_init(). ::: note To use g_thread_init() in your program, you have to link with the libraries that the command
pkg-config --libs gthread-2.0outputs. This is not the case for all the other thread-related functions of GLib. Those can be used without having to link with the thread libraries.
vtable is a function table of type #GThreadFunctions, that provides the entry points to the thread system to be used. Since 2.32, this parameter is ignored and should always be %NULL.None.thread_init_with_errorcheck_mutexes (vtable)
Generated wrapper for GIR function
thread_init_with_errorcheck_mutexes. Native symbol:g_thread_init_with_errorcheck_mutexes.
None.thread_pool_get_max_idle_time ()
This function will return the maximum @interval that a thread will wait in the thread pool for new tasks before being stopped. If this function returns 0, threads waiting in the thread pool for new work are not stopped.
thread_pool_get_max_unused_threads ()
Returns the maximal allowed number of unused threads.
thread_pool_get_num_unused_threads ()
Returns the number of currently unused threads.
thread_pool_set_max_idle_time (int interval)
This function will set the maximum @interval that a thread waiting in the pool for new tasks can be idle for before being stopped. This function is similar to calling g_thread_pool_stop_unused_threads() on a regular timeout, except this is done on a per thread basis. By setting @interval to 0, idle threads will not be stopped. The default value is 15000 (15 seconds).
interval is the maximum @interval (in milliseconds) a thread can be idle.None.thread_pool_set_max_unused_threads (int max_threads)
Sets the maximal number of unused threads to @max_threads. If
is -1, no limit is imposed on the number of unused threads. The default value is 8 since GLib 2.84. Previously the default value was 2.max_threads is maximal number of unused threads.None.thread_pool_stop_unused_threads ()
Stops all currently unused threads. This does not change the maximal number of unused threads. This function can be used to regularly stop all unused threads e.g. from g_timeout_add().
None.thread_self ()
This function returns the #GThread corresponding to the current thread. Note that this function does not increase the reference count of the returned struct. This function will return a #GThread even for threads that were not created by GLib (i.e. those created by other threading APIs). This may be useful for thread identification purposes (i.e. comparisons) but you must not use GLib functions (such as g_thread_join()) on these threads.
thread_yield ()
Causes the calling thread to voluntarily relinquish the CPU, so that other threads can run. This function is often used as a method to make busy wait less evil.
None.timeout_source_new (int interval)
Creates a new timeout source. The source will not initially be associated with any [struct@GLib.MainContext] and must be added to one with [method@GLib.Source.attach] before it will be executed. The interval given is in terms of monotonic time, not wall clock time. See [func@GLib.get_monotonic_time].
interval is the timeout interval in milliseconds.timeout_source_new_seconds (int interval)
Creates a new timeout source. The source will not initially be associated with any [struct@GLib.MainContext] and must be added to one with [method@GLib.Source.attach] before it will be executed. The scheduling granularity/accuracy of this timeout source will be in seconds. The interval given is in terms of monotonic time, not wall clock time. See [func@GLib.get_monotonic_time].
interval is the timeout interval in seconds.trash_stack_height (object stack_p)
Returns the height of a #GTrashStack. Note that execution of this function is of O(N) complexity where N denotes the number of items on the stack.
stack_p is a #GTrashStack.trash_stack_peek (object stack_p)
Returns the element at the top of a #GTrashStack which may be %NULL.
stack_p is a #GTrashStack.trash_stack_pop (object stack_p)
Pops a piece of memory off a #GTrashStack.
stack_p is a #GTrashStack.trash_stack_push (object stack_p, data_p)
Pushes a piece of memory onto a #GTrashStack.
stack_p is a #GTrashStack.data_p is the piece of memory to push on the stack.None.try_malloc (int n_bytes)
Attempts to allocate @n_bytes, and returns %NULL on failure. Contrast with g_malloc(), which aborts the program on failure.
n_bytes is number of bytes to allocate..try_malloc0 (int n_bytes)
Attempts to allocate @n_bytes, initialized to 0's, and returns %NULL on failure. Contrast with g_malloc0(), which aborts the program on failure.
n_bytes is number of bytes to allocate.try_malloc0_n (int n_blocks, int n_block_bytes)
This function is similar to g_try_malloc0(), allocating (@n_blocks *
bytes, but care is taken to detect possible overflow during multiplication.n_blocks is the number of blocks to allocate.n_block_bytes is the size of each block in bytes.try_malloc_n (int n_blocks, int n_block_bytes)
This function is similar to g_try_malloc(), allocating (@n_blocks *
bytes, but care is taken to detect possible overflow during multiplication.n_blocks is the number of blocks to allocate.n_block_bytes is the size of each block in bytes.try_realloc (mem, int n_bytes)
Attempts to realloc @mem to a new size, @n_bytes, and returns %NULL on failure. Contrast with g_realloc(), which aborts the program on failure. If @mem is %NULL, behaves the same as g_try_malloc().
mem is previously-allocated memory, or %NULL..n_bytes is number of bytes to allocate..try_realloc_n (mem, int n_blocks, int n_block_bytes)
This function is similar to g_try_realloc(), allocating (@n_blocks *
bytes, but care is taken to detect possible overflow during multiplication.mem is previously-allocated memory, or %NULL..n_blocks is the number of blocks to allocate.n_block_bytes is the size of each block in bytes.unlink (string filename)
A wrapper for the POSIX unlink() function. The unlink() function deletes a name from the filesystem. If this was the last link to the file and no processes have it opened, the diskspace occupied by the file is freed. See your C library manual for more details about unlink(). Note that on Windows, it is in general not possible to delete files that are open to some process, or mapped into memory.
filename is a pathname in the GLib file name encoding (UTF-8 on Windows).unsetenv (string variable)
Removes an environment variable from the environment. Note that on some systems, when variables are overwritten, the memory used for the previous variables and its value isn't reclaimed. You should be mindful of the fact that environment variable handling in UNIX is not thread-safe, and your program may crash if one thread calls g_unsetenv() while another thread is calling getenv(). (And note that many functions, such as gettext(), call getenv() internally.) This function is only safe to use at the very start of your program, before creating any other threads (or creating objects that create worker threads of their own). If you need to set up the environment for a child process, you can use g_get_environ() to get an environment array, modify that with g_environ_setenv() and g_environ_unsetenv(), and then pass that array directly to execvpe(), g_spawn_async(), or the like.
variable is the environment variable to remove, must not contain '='.None.uri_build (string flags, string scheme, string userinfo, string host, int port, string path, string query, string fragment)
Creates a new #GUri from the given components according to @flags. See also g_uri_build_with_user(), which allows specifying the components of the "userinfo" separately.
flags is flags describing how to build the #GUri.scheme is the URI scheme.userinfo is the userinfo component, or %NULL.host is the host component, or %NULL.port is the port, or -1.path is the path component.query is the query component, or %NULL.fragment is the fragment, or %NULL.uri_build_with_user (string flags, string scheme, string user, string password, string auth_params, string host, int port, string path, string query, string fragment)
Creates a new #GUri from the given components according to @flags (%G_URI_FLAGS_HAS_PASSWORD is added unconditionally). The @flags must be coherent with the passed values, in particular use
%-encoded values with %G_URI_FLAGS_ENCODED. In contrast to g_uri_build(), this allows specifying the components of the ‘userinfo’ field separately. Note that
must be non-%NULL if either @password or @auth_params is non-%NULL.flags is flags describing how to build the #GUri.scheme is the URI scheme.user is the user component of the userinfo, or %NULL.password is the password component of the userinfo, or %NULL.auth_params is the auth params of the userinfo, or %NULL.host is the host component, or %NULL.port is the port, or -1.path is the path component.query is the query component, or %NULL.fragment is the fragment, or %NULL.uri_escape_string (string unescaped, string reserved_chars_allowed, bool allow_utf8)
Escapes a string for use in a URI. Normally all characters that are not "unreserved" (i.e. ASCII alphanumerical characters plus dash, dot, underscore and tilde) are escaped. But if you specify characters in
they are not escaped. This is useful for the "reserved" characters in the URI specification, since those are allowed unescaped in some portions of a URI.unescaped is the unescaped input string..reserved_chars_allowed is a string of reserved characters that are allowed to be used, or %NULL..allow_utf8 is %TRUE if the result can include UTF-8 characters..uri_is_valid (string uri_string, string flags)
Parses @uri_string according to @flags, to determine whether it is a valid absolute URI, i.e. it does not need to be resolved relative to another URI using g_uri_parse_relative(). If it’s not a valid URI, an error is returned explaining how it’s invalid. See g_uri_split(), and the definition of #GUriFlags, for more information on the effect of @flags.
uri_string is a string containing an absolute URI.flags is flags for parsing @uri_string.uri_join (string flags, string scheme, string userinfo, string host, int port, string path, string query, string fragment)
Joins the given components together according to @flags to create an absolute URI string. @path may not be %NULL (though it may be the empty string). When @host is present, @path must either be empty or begin with a slash (
/) character. When @host is not present, @path cannot begin with two slash characters (//). See RFC 3986, section 3. See also g_uri_join_with_user(), which allows specifying the components of the ‘userinfo’ separately. %G_URI_FLAGS_HAS_PASSWORD and %G_URI_FLAGS_HAS_AUTH_PARAMS are ignored if set in @flags.
flags is flags describing how to build the URI string.scheme is the URI scheme, or %NULL.userinfo is the userinfo component, or %NULL.host is the host component, or %NULL.port is the port, or -1.path is the path component.query is the query component, or %NULL.fragment is the fragment, or %NULL.uri_join_with_user (string flags, string scheme, string user, string password, string auth_params, string host, int port, string path, string query, string fragment)
Joins the given components together according to @flags to create an absolute URI string. @path may not be %NULL (though it may be the empty string). In contrast to g_uri_join(), this allows specifying the components of the ‘userinfo’ separately. It otherwise behaves the same. %G_URI_FLAGS_HAS_PASSWORD and %G_URI_FLAGS_HAS_AUTH_PARAMS are ignored if set in @flags.
flags is flags describing how to build the URI string.scheme is the URI scheme, or %NULL.user is the user component of the userinfo, or %NULL.password is the password component of the userinfo, or %NULL.auth_params is the auth params of the userinfo, or %NULL.host is the host component, or %NULL.port is the port, or -1.path is the path component.query is the query component, or %NULL.fragment is the fragment, or %NULL.uri_list_extract_uris (string uri_list)
Splits an URI list conforming to the text/uri-list mime type defined in RFC 2483 into individual URIs, discarding any comments. The URIs are not validated.
uri_list is an URI list.uri_parse (string uri_string, string flags)
Parses @uri_string according to @flags. If the result is not a valid absolute URI, it will be discarded, and an error returned.
uri_string is a string representing an absolute URI.flags is flags describing how to parse @uri_string.uri_parse_params (string params, int length, string separators, string flags)
Many URI schemes include one or more attribute/value pairs as part of the URI value. This method can be used to parse them into a hash table. When an attribute has multiple occurrences, the last value is the final returned value. If you need to handle repeated attributes differently, use #GUriParamsIter. The @params string is assumed to still be
%-encoded, but the returned values will be fully decoded. (Thus it is possible that the returned values may contain=or @separators, if the value was encoded in the input.) Invalid%-encoding is treated as with the %G_URI_FLAGS_PARSE_RELAXED rules for g_uri_parse(). (However, if
is the path or query string from a #GUri that was parsed without %G_URI_FLAGS_PARSE_RELAXED and %G_URI_FLAGS_ENCODED, then you already know that it does not contain any invalid encoding.) %G_URI_PARAMS_WWW_FORM is handled as documented for g_uri_params_iter_init(). If %G_URI_PARAMS_CASE_INSENSITIVE is passed toattributes will be compared case-insensitively, so a params string attr=123&Attr=456 will only return a single attribute–value pair, Attr=456. Case will be preserved in the returned attributes. Ifcannot be parsed (for example, it contains two @separators characters in a row), then @error is set and %NULL is returned.params is a %-encoded string containing attribute=value parameters.length is the length of @params, or -1 if it is nul-terminated.separators is the separator byte character set between parameters. (usually &, but sometimes ; or both &;). Note that this function works on bytes not characters, so it can't be used to delimit UTF-8 strings for anything but ASCII characters. You may pass an empty set, in which case no splitting will occur..flags is flags to modify the way the parameters are handled..uri_parse_scheme (string uri)
Gets the scheme portion of a URI string. RFC 3986 decodes the scheme as: |[ URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] ]| Common schemes include
file,https,svn+ssh, etc.
uri is a valid URI..uri_peek_scheme (string uri)
Gets the scheme portion of a URI string. RFC 3986 decodes the scheme as: |[ URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] ]| Common schemes include
file,https,svn+ssh, etc. Unlike g_uri_parse_scheme(), the returned scheme is normalized to all-lowercase and does not need to be freed.
uri is a valid URI..uri_resolve_relative (string base_uri_string, string uri_ref, string flags)
Parses @uri_ref according to @flags and, if it is a relative URI, resolves it relative to
If the result is not a valid absolute URI, it will be discarded, and an error returned. (If @base_uri_string is %NULL, this just returns @uri_ref, or %NULL if @uri_ref is invalid or not absolute.)base_uri_string is a string representing a base URI.uri_ref is a string representing a relative or absolute URI.flags is flags describing how to parse @uri_ref.uri_unescape_bytes (string escaped_string, int length, string illegal_characters)
Unescapes a segment of an escaped string as binary data. Note that in contrast to g_uri_unescape_string(), this does allow nul bytes to appear in the output. If any of the characters in @illegal_characters appears as an escaped character in @escaped_string, then that is an error and %NULL will be returned. This is useful if you want to avoid for instance having a slash being expanded in an escaped path element, which might confuse pathname handling.
escaped_string is A URI-escaped string.length is the length (in bytes) of @escaped_string to escape, or -1 if it is nul-terminated..illegal_characters is a string of illegal characters not to be allowed, or %NULL..uri_unescape_segment (string escaped_string, string escaped_string_end, string illegal_characters)
Unescapes a segment of an escaped string. If any of the characters in
or the NUL character appears as an escaped character in @escaped_string, then that is an error and %NULL will be returned. This is useful if you want to avoid for instance having a slash being expanded in an escaped path element, which might confuse pathname handling. Note: NUL byte is not accepted in the output, in contrast to g_uri_unescape_bytes().escaped_string is A string, may be %NULL.escaped_string_end is Pointer to end of @escaped_string, may be %NULL.illegal_characters is An optional string of illegal characters not to be allowed, may be %NULL.uri_unescape_string (string escaped_string, string illegal_characters)
Unescapes a whole escaped string. If any of the characters in
or the NUL character appears as an escaped character in @escaped_string, then that is an error and %NULL will be returned. This is useful if you want to avoid for instance having a slash being expanded in an escaped path element, which might confuse pathname handling.escaped_string is an escaped string to be unescaped..illegal_characters is a string of illegal characters not to be allowed, or %NULL..usleep (int microseconds)
Pauses the current thread for the given number of microseconds. There are 1 million microseconds per second (represented by the %G_USEC_PER_SEC macro). g_usleep() may have limited precision, depending on hardware and operating system; don't rely on the exact length of the sleep.
microseconds is number of microseconds to pause.None.utf8_casefold (string str, int len)
Converts a string into a form that is independent of case. The result will not correspond to any particular case, but can be compared for equality or ordered with the results of calling g_utf8_casefold() on other strings. Note that calling g_utf8_casefold() followed by g_utf8_collate() is only an approximation to the correct linguistic case insensitive ordering, though it is a fairly good one. Getting this exactly right would require a more sophisticated collation function that takes case sensitivity into account. GLib does not currently provide such a function.
str is a UTF-8 encoded string.len is length of @str, in bytes, or -1 if @str is nul-terminated..utf8_collate (string str1, string str2)
Compares two strings for ordering using the linguistically correct rules for the current locale. When sorting a large number of strings, it will be significantly faster to obtain collation keys with g_utf8_collate_key() and compare the keys with strcmp() when sorting instead of sorting the original strings. If the two strings are not comparable due to being in different collation sequences, the result is undefined. This can happen if the strings are in different language scripts, for example.
str1 is a UTF-8 encoded string.str2 is a UTF-8 encoded string.utf8_collate_key (string str, int len)
Converts a string into a collation key that can be compared with other collation keys produced by the same function using strcmp(). The results of comparing the collation keys of two strings with strcmp() will always be the same as comparing the two original keys with g_utf8_collate(). Note that this function depends on the current locale. Note that the returned string is not guaranteed to be in any encoding, especially UTF-8. The returned value is meant to be used only for comparisons.
str is a UTF-8 encoded string..len is length of @str, in bytes, or -1 if @str is nul-terminated..utf8_collate_key_for_filename (string str, int len)
Converts a string into a collation key that can be compared with other collation keys produced by the same function using strcmp(). In order to sort filenames correctly, this function treats the dot '.' as a special case. Most dictionary orderings seem to consider it insignificant, thus producing the ordering "event.c" "eventgenerator.c" "event.h" instead of "event.c" "event.h" "eventgenerator.c". Also, we would like to treat numbers intelligently so that "file1" "file10" "file5" is sorted as "file1" "file5" "file10". Note that this function depends on the current locale. Note that the returned string is not guaranteed to be in any encoding, especially UTF-8. The returned value is meant to be used only for comparisons.
str is a UTF-8 encoded string..len is length of @str, in bytes, or -1 if @str is nul-terminated..utf8_find_next_char (string p, string end)
Finds the start of the next UTF-8 character in the string after @p. @p does not have to be at the beginning of a UTF-8 character. No check is made to see if the character found is actually valid other than it starts with an appropriate byte. If @end is
NULL, the return value will never beNULL: if the end of the string is reached, a pointer to the terminating nul byte is returned. If @end is non-NULL, the return value will beNULLif the end of the string is reached.
p is a pointer to a position within a UTF-8 encoded string.end is a pointer to the byte following the end of the string, or NULL to indicate that the string is nul-terminated.utf8_find_prev_char (string str, string p)
Given a position @p with a UTF-8 encoded string @str, find the start of the previous UTF-8 character starting before @p. Returns
NULLif no UTF-8 characters are present in @str before @p. @p does not have to be at the beginning of a UTF-8 character. No check is made to see if the character found is actually valid other than it starts with an appropriate byte.
str is pointer to the beginning of a UTF-8 encoded string.p is pointer to some position within @str.utf8_make_valid (string str, int len)
If the provided string is valid UTF-8, return a copy of it. If not, return a copy in which bytes that could not be interpreted as valid Unicode are replaced with the Unicode replacement character (U+FFFD). For example, this is an appropriate function to use if you have received a string that was incorrectly declared to be UTF-8, and you need a valid UTF-8 version of it that can be logged or displayed to the user, with the assumption that it is close enough to ASCII or UTF-8 to be mostly readable as-is.
str is string to coerce into UTF-8.len is the maximum length of @str to use, in bytes. If @len is negative, then the string is nul-terminated..utf8_normalize (string str, int len, string mode)
Converts a string into canonical form, standardizing such issues as whether a character with an accent is represented as a base character and combining accent or as a single precomposed character. The string has to be valid UTF-8, otherwise %NULL is returned. You should generally call g_utf8_normalize() before comparing two Unicode strings. The normalization mode %G_NORMALIZE_DEFAULT only standardizes differences that do not affect the text content, such as the above-mentioned accent representation. %G_NORMALIZE_ALL also standardizes the "compatibility" characters in Unicode, such as SUPERSCRIPT THREE to the standard forms (in this case DIGIT THREE). Formatting information may be lost but for most text operations such characters should be considered the same. %G_NORMALIZE_DEFAULT_COMPOSE and %G_NORMALIZE_ALL_COMPOSE are like %G_NORMALIZE_DEFAULT and %G_NORMALIZE_ALL, but returned a result with composed forms rather than a maximally decomposed form. This is often useful if you intend to convert the string to a legacy encoding or pass it to a system with less capable Unicode handling.
str is a UTF-8 encoded string..len is length of @str, in bytes, or -1 if @str is nul-terminated..mode is the type of normalization to perform..utf8_offset_to_pointer (string str, int offset)
Converts from an integer character offset to a pointer to a position within the string. Since 2.10, this function allows to pass a negative
to step backwards. It is usually worth stepping backwards from the end instead of forwards if @offset is in the last fourth of the string, since moving forward is about 3 times faster than moving backward. Note that this function doesn’t abort when reaching the end ofTherefore you should be sure that @offset is within string boundaries before calling that function. Call [func@GLib.utf8_strlen] when unsure. This limitation exists as this function is called frequently during text rendering and therefore has to be as fast as possible.str is a UTF-8 encoded string.offset is a character offset within @str.utf8_pointer_to_offset (string str, string pos)
Converts from a pointer to position within a string to an integer character offset. Since 2.10, this function allows @pos to be before
and returns a negative offset in this case.str is a UTF-8 encoded string.pos is a pointer to a position within @str.utf8_prev_char (string p)
Finds the previous UTF-8 character in the string before @p. @p does not have to be at the beginning of a UTF-8 character. No check is made to see if the character found is actually valid other than it starts with an appropriate byte. If @p might be the first character of the string, you must use [func@GLib.utf8_find_prev_char] instead.
p is a pointer to a position within a UTF-8 encoded string.utf8_strdown (string str, int len)
Converts all Unicode characters in the string that have a case to lowercase. The exact manner that this is done depends on the current locale, and may result in the number of characters in the string changing.
str is a UTF-8 encoded string.len is length of @str, in bytes, or -1 if @str is nul-terminated..utf8_strlen (string p, int max)
Computes the length of the string in characters, not including the terminating nul character. If the @max’th byte falls in the middle of a character, the last (partial) character is not counted.
p is pointer to the start of a UTF-8 encoded string.max is the maximum number of bytes to examine. If @max is less than 0, then the string is assumed to be nul-terminated. If @max is 0, @p will not be examined and may be NULL. If @max is greater than 0, up tobytes are examined.utf8_strncpy (string dest, string src, int n)
Like the standard C
strncpy()function, but copies a given number of characters instead of a given number of bytes. The @src string must be valid UTF-8 encoded text. (Use [func@GLib.utf8_validate] on all text before trying to use UTF-8 utility functions with it.) Note you must ensure @dest is at least 4 * @n + 1 to fit the largest possible UTF-8 characters
dest is buffer to fill with characters from @src.src is UTF-8 encoded string.n is character count.utf8_strreverse (string str, int len)
Reverses a UTF-8 string. @str must be valid UTF-8 encoded text. (Use [func@GLib.utf8_validate] on all text before trying to use UTF-8 utility functions with it.) This function is intended for programmatic uses of reversed strings. It pays no attention to decomposed characters, combining marks, byte order marks, directional indicators (LRM, LRO, etc) and similar characters which might need special handling when reversing a string for display purposes. Note that unlike [func@GLib.strreverse], this function returns newly-allocated memory, which should be freed with [func@GLib.free] when no longer needed.
str is a UTF-8 encoded string.len is the maximum length of @str to use, in bytes. If @len is negative, then the string is nul-terminated..utf8_strup (string str, int len)
Converts all Unicode characters in the string that have a case to uppercase. The exact manner that this is done depends on the current locale, and may result in the number of characters in the string increasing. (For instance, the German ess-zet will be changed to SS.)
str is a UTF-8 encoded string.len is length of @str, in bytes, or -1 if @str is nul-terminated..utf8_substring (string str, int start_pos, int end_pos)
Copies a substring out of a UTF-8 encoded string. The substring will contain @end_pos - @start_pos characters. Since GLib 2.72,
-1can be passed to @end_pos to indicate the end of the string.
str is a UTF-8 encoded string.start_pos is a character offset within @str.end_pos is another character offset within @str, or -1 to indicate the end of the string.utf8_truncate_middle (string arg0String, int truncate_length)
Cuts off the middle of the string, preserving half of @truncate_length characters at the beginning and half at the end. If @string is already short enough, this returns a copy of @string. If @truncate_length is
0, an empty string is returned.
string is a nul-terminated UTF-8 encoded string.truncate_length is the new size of @string, in characters, including the ellipsis character.utime (string filename, utb)
A wrapper for the POSIX utime() function. The utime() function sets the access and modification timestamps of a file. See your C library manual for more details about how utime() works on your system.
filename is a pathname in the GLib file name encoding (UTF-8 on Windows).utb is a pointer to a struct utimbuf..uuid_string_is_valid (string str)
Parses the string @str and verify if it is a UUID. The function accepts the following syntax: - simple forms (e.g.
f81d4fae-7dec-11d0-a765-00a0c91e6bf6) Note that hyphens are required within the UUID string itself, as per the aforementioned RFC.
str is a string representing a UUID.uuid_string_random ()
Generates a random UUID (RFC 4122 version 4) as a string. It has the same randomness guarantees as #GRand, so must not be used for cryptographic purposes such as key generation, nonces, salts or one-time pads.
variant_is_object_path (string arg0String)
Determines if a given string is a valid D-Bus object path. You should ensure that a string is a valid D-Bus object path before passing it to g_variant_new_object_path(). A valid object path starts with
/followed by zero or more sequences of characters separated by/characters. Each sequence must contain only the characters[A-Z][a-z][0-9]_. No sequence (including the one following the final/character) may be empty.
string is a normal C nul-terminated string.variant_is_signature (string arg0String)
Determines if a given string is a valid D-Bus type signature. You should ensure that a string is a valid D-Bus type signature before passing it to g_variant_new_signature(). D-Bus type signatures consist of zero or more definite #GVariantType strings in sequence.
string is a normal C nul-terminated string.variant_parse (object type, string text, string limit, string endptr)
Parses a #GVariant from a text representation. A single #GVariant is parsed from the content of @text. The format is described here. The memory at @limit will never be accessed and the parser behaves as if the character at @limit is the nul terminator. This has the effect of bounding @text. If @endptr is non-%NULL then @text is permitted to contain data following the value that this function parses and @endptr will be updated to point to the first character past the end of the text parsed by this function. If
is %NULL and there is extra data then an error is returned. Ifis non-%NULL then the value will be parsed to have that type. This may result in additional parse errors (in the case that the parsed value doesn't fit the type) but may also result in fewer errors (in the case that the type would have been ambiguous, such as with empty arrays). In the event that the parsing is successful, the resulting #GVariant is returned. It is never floating, and must be freed with [method@GLib.Variant.unref]. In case of any error, %NULL will be returned. If @error is non-%NULL then it will be set to reflect the error that occurred. Officially, the language understood by the parser is “any string produced by [method@GLib.Variant.print]”. This explicitly includes g_variant_print()’s annotated types like int64 -1000. There may be implementation specific restrictions on deeply nested values, which would result in a %G_VARIANT_PARSE_ERROR_RECURSION error. #GVariant is guaranteed to handle nesting up to at least 64 levels.type is a #GVariantType, or %NULL.text is a string containing a GVariant in text form.limit is a pointer to the end of @text, or %NULL.endptr is a location to store the end pointer, or %NULL.variant_parse_error_print_context (object error, string source_str)
Pretty-prints a message showing the context of a #GVariant parse error within the string for which parsing was attempted. The resulting string is suitable for output to the console or other monospace media where newlines are treated in the usual way. The message will typically look something like one of the following: |[ unterminated string constant: (1, 2, 3, 'abc ^^^^ ]| or |[ unable to find a common type: [1, 2, 3, 'str'] ^ ^^^^^ ]| The format of the message may change in a future version. @error must have come from a failed attempt to g_variant_parse() and @source_str must be exactly the same string that caused the error. If @source_str was not nul-terminated when you passed it to g_variant_parse() then you must add nul termination before using this function.
error is a #GError from the #GVariantParseError domain.source_str is the string that was given to the parser.variant_type_checked_ (string type_string)
Generated wrapper for GIR function
variant_type_checked_. Native symbol:g_variant_type_checked_.
variant_type_string_get_depth_ (string type_string)
Generated wrapper for GIR function
variant_type_string_get_depth_. Native symbol:g_variant_type_string_get_depth_.
variant_type_string_is_valid (string type_string)
Checks if @type_string is a valid GVariant type string. This call is equivalent to calling [func@GLib.VariantType.string_scan] and confirming that the following character is a nul terminator.
type_string is a pointer to any string.warn_message (string domain, string file, int line, string func, string warnexpr)
Internal function used to print messages from the public [func@GLib.warn_if_reached] and [func@GLib.warn_if_fail] macros.
domain is log domain.file is file containing the warning.line is line number of the warning.func is function containing the warning.warnexpr is expression which failed.None.[1890:7] extends: object
The type of function to be used as callback when a parse error occurs.
OptionErrorFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (context, group, data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[1532:7] extends: object
Defines the type of function used by g_hook_list_marshal().
HookMarshallerCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (hook, marshal_data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[1178:7] extends: object
Defines the type of function used by g_hook_list_marshal_check().
HookCheckMarshallerCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (hook, marshal_data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[1821:7] extends: object
The type of function to be passed as callback for %G_OPTION_ARG_CALLBACK options.
OptionArgFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (option_name, value, data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[1604:7] extends: object
Specifies the type of function passed to g_io_add_watch() or g_io_add_watch_full(), which is called when the requested condition on a #GIOChannel is satisfied.
IOFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (source, condition, data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[2905:7] extends: object
Specifies the type of function passed to g_tree_traverse(). It is passed the key and value of each node, together with the @user_data parameter passed to g_tree_traverse(). If the function returns %TRUE, the traversal is stopped.
TraverseFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (key, value, data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[86:7] extends: object
Specifies the type of the @key_dup_func function passed to g_cache_new(). The function is passed a key (not a value as the prototype implies) and should return a duplicate of the key.
CacheDupFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (value)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[2834:7] extends: object
The type of functions which are used to translate user-visible strings, for
output.TranslateFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (str, data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[1750:7] extends: object
Specifies the type of function passed to g_node_traverse(). The function is called with each of the nodes visited, together with the user data passed to g_node_traverse(). If the function returns %TRUE, then the traversal is stopped.
NodeTraverseFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (node, data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[877:7] extends: object
Specifies the type of function which is called just after an extended error
instance is created and its fields filled. It should only initialize the
fields in the private data, which can be received with the generated
*_get_private() function. Normally, it is better to use
G_DEFINE_EXTENDED_ERROR(), as it already takes care of getting the private
data from @error.
ErrorInitFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (error)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[2462:7] extends: object
Checks if the source is ready to be dispatched. Called after all the file
descriptors are polled. The source should return %TRUE if it is ready to be
dispatched. Note that some time may have passed since the previous prepare
function was called, so the source should be checked again here. Since 2.36
this may be NULL, in which case the effect is as if the function always
returns FALSE.
SourceFuncsCheckFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (source)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[2764:7] extends: object
Specifies the type of the @func functions passed to g_thread_new() or g_thread_try_new().
ThreadFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[15:7] extends: object
Specifies the type of the @value_destroy_func and @key_destroy_func functions passed to g_cache_new(). The functions are passed a pointer to the #GCache key or #GCache value and should free any memory and other resources associated with it.
CacheDestroyFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (value)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[512:7] extends: object
A function of this signature is used to copy the node data when doing a deep-copy of a tree.
CopyFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (src, data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[653:7] extends: object
Specifies the type of a function used to test two values for equality. The function should return %TRUE if both values are equal and %FALSE otherwise.
EqualFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (a, b)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[948:7] extends: object
Declares a type of function which takes an arbitrary data pointer argument and has no return value. It is not currently used in GLib or GTK.
FreeFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[2245:7] extends: object
A #GSequenceIterCompareFunc is a function used to compare iterators. It must return zero if the iterators compare equal, a negative value if @a comes before @b, and a positive value if @b comes before @a.
SequenceIterCompareFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (a, b, data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[583:7] extends: object
Specifies the type of function which is called when a data element is destroyed. It is passed the pointer to the data element and should free any memory and resources allocated for it.
DestroyNotifyCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[726:7] extends: object
Specifies the type of function which is called when an extended error instance is freed. It is passed the error pointer about to be freed, and should free the error's private data fields. Normally, it is better to use G_DEFINE_EXTENDED_ERROR(), as it already takes care of getting the private data from @error.
ErrorClearFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (error)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[442:7] extends: object
Specifies the type of the function passed to g_completion_set_compare(). This is used when you use strings as #GCompletion items.
CompletionStrncmpFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (s1, s2, n)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[2103:7] extends: object
Specifies the type of the print handler functions. These are called with the complete formatted string to output.
PrintFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (arg0String)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[1463:7] extends: object
Defines the type of a hook function that can be invoked by g_hook_list_invoke().
HookFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[1961:7] extends: object
The type of function that can be called before and after parsing.
OptionParseFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (context, group, data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[2625:7] extends: object
Specifies the type of the setup function passed to g_spawn_async(),
g_spawn_sync() and g_spawn_async_with_pipes(), which can, in very limited
ways, be used to affect the child's execution. On POSIX platforms, the
function is called in the child after GLib has performed all the setup it
plans to perform, but before calling exec(). Actions taken in this function
will only affect the child, not the parent. On Windows, the function is
called in the parent. Its usefulness on Windows is thus questionable. In many
cases executing the child setup function in the parent can have ill effects,
and you should be very careful when porting software to Windows that uses
child setup functions. However, even on POSIX, you are extremely limited in
what you can safely do from a #GSpawnChildSetupFunc, because any mutexes that
were held by other threads in the parent process at the time of the fork()
will still be locked in the child process, and they will never be unlocked
(since the threads that held them don't exist in the child). POSIX allows
only async-signal-safe functions (see signal(7)) to be called in the child
between fork() and exec(), which drastically limits the usefulness of child
setup functions. In particular, it is not safe to call any function which may
call malloc(), which includes POSIX functions such as setenv(). If you need
to set up the child environment differently from the parent, you should use
g_get_environ(), g_environ_setenv(), and g_environ_unsetenv(), and then pass
the complete environment list to the g_spawn... function.
SpawnChildSetupFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[301:7] extends: object
Specifies the type of a comparison function used to compare two values. The function should return a negative integer if the first value comes before the second, 0 if they are equal, or a positive integer if the first value comes after the second.
CompareFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (a, b)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[2535:7] extends: object
Finalizes the source. Called when the source is finalized. At this point, the source will have been destroyed, had its callback cleared, and have been removed from its [type@GLib.MainContext], but it will still have its final reference count, so methods can be called on it from within this function.
SourceFuncsFinalizeFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (source)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[801:7] extends: object
Specifies the type of function which is called when an extended error instance is copied. It is passed the pointer to the destination error and source error, and should copy only the fields of the private data from @src_error to @dest_error. Normally, it is better to use G_DEFINE_EXTENDED_ERROR(), as it already takes care of getting the private data from @src_error and @dest_error.
ErrorCopyFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (src_error, dest_error)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[2172:7] extends: object
Specifies the type of the message handler function.
ScannerMsgFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (scanner, message, error)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[1039:7] extends: object
Specifies the type of the hash function which is passed to
[func@HashTable.new] when a [struct@HashTable] is created. The function is
passed a key and should return an unsigned int hash value. The functions
[func@direct_hash], [func@int_hash] and [func@str_hash] provide hash
functions which can be used when the key is a void*, int*, and char*
respectively. [func@direct_hash] is also the appropriate hash function for
keys of the form GINT_TO_POINTER (n) (or similar macros). A good
hash functions should produce hash values that are evenly distributed over a
fairly large range. The modulus is taken with the hash table size (a prime
number) to find the 'bucket' to place each key into. The function should also
be very fast, since it is called for each key lookup. Note that the hash
functions provided by GLib have these qualities, but are not particularly
robust against manufactured keys that cause hash collisions. Therefore, you
should consider choosing a more secure hash function when using a
[struct@HashTable] with keys that originate in untrusted data (such as HTTP
requests). Using [func@str_hash] in that situation might make your
application vulnerable to Algorithmic Complexity
Attacks. The key to choosing a good hash
is unpredictability. Even cryptographic hashes are very easy to find
collisions for when the remainder is taken modulo a somewhat predictable
prime number. There must be an element of randomness that an attacker is
unable to guess.
HashFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (key)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[229:7] extends: object
Specifies the type of function passed to [func@GLib.clear_handle_id] The implementation is expected to free the resource identified by @handle_id; for instance, if @handle_id is a [struct@GLib.Source] ID, [func@GLib.Source.remove] can be used.
ClearHandleFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (handle_id)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[1392:7] extends: object
Defines the type of the function passed to g_hook_find().
HookFindFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (hook, data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[2977:7] extends: object
Specifies the type of function passed to g_tree_foreach_node(). It is passed each node, together with the @user_data parameter passed to g_tree_foreach_node(). If the function returns %TRUE, the traversal is stopped.
TraverseNodeFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (node, data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[2694:7] extends: object
The type used for test case functions.
TestFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline ()
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[1249:7] extends: object
Defines the type of function used to compare #GHook elements in g_hook_insert_sorted().
HookCompareFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (new_hook, sibling)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[2317:7] extends: object
Dispose function for @source. See [method@GLib.Source.set_dispose_function] for details.
SourceDisposeFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (source)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[372:7] extends: object
Specifies the type of the function passed to g_completion_new(). It should return the string corresponding to the given target item. This is used when you use data structures as #GCompletion items.
CompletionFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (item)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[1109:7] extends: object
Defines the type of a hook function that can be invoked by g_hook_list_invoke_check().
HookCheckFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[1321:7] extends: object
Defines the type of function to be called when a hook in a list of hooks gets finalized.
HookFinalizeFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (hook_list, hook)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[2033:7] extends: object
Specifies the type of function passed to g_main_context_set_poll_func(). The semantics of the function should match those of the poll() system call.
PollFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (ufds, nfsd, timeout_)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[2388:7] extends: object
This is just a placeholder for #GClosureMarshal, which cannot be used here for dependency reasons.
SourceDummyMarshalCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline ()
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[157:7] extends: object
Specifies the type of the @value_new_func function passed to g_cache_new(). It is passed a #GCache key and should create the value corresponding to the key.
CacheNewFuncCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (key)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.