@girs/glib-2.0 2.76.1-3.2.3 → 2.78.0-3.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/glib-2.0.d.cts CHANGED
@@ -1388,7 +1388,7 @@ export enum TraverseType {
1388
1388
  * Since new unicode versions may add new types here, applications should be ready
1389
1389
  * to handle unknown values. They may be regarded as %G_UNICODE_BREAK_UNKNOWN.
1390
1390
  *
1391
- * See [Unicode Line Breaking Algorithm](http://www.unicode.org/unicode/reports/tr14/).
1391
+ * See [Unicode Line Breaking Algorithm](https://www.unicode.org/reports/tr14/).
1392
1392
  */
1393
1393
  export enum UnicodeBreakType {
1394
1394
  /**
@@ -3647,6 +3647,29 @@ export const ANALYZER_ANALYZING: number
3647
3647
  *
3648
3648
  */
3649
3649
  export const ASCII_DTOSTR_BUF_SIZE: number
3650
+ /**
3651
+ * Evaluates to the initial reference count for `gatomicrefcount`.
3652
+ *
3653
+ * This macro is useful for initializing `gatomicrefcount` fields inside
3654
+ * structures, for instance:
3655
+ *
3656
+ *
3657
+ * ```c
3658
+ * typedef struct {
3659
+ * gatomicrefcount ref_count;
3660
+ * char *name;
3661
+ * char *address;
3662
+ * } Person;
3663
+ *
3664
+ * static const Person default_person = {
3665
+ * .ref_count = G_ATOMIC_REF_COUNT_INIT,
3666
+ * .name = "Default name",
3667
+ * .address = "Default address",
3668
+ * };
3669
+ * ```
3670
+ *
3671
+ */
3672
+ export const ATOMIC_REF_COUNT_INIT: number
3650
3673
  /**
3651
3674
  * Specifies one of the possible types of byte order.
3652
3675
  * See %G_BYTE_ORDER.
@@ -4126,7 +4149,7 @@ export const LOG_2_BASE_10: number
4126
4149
  * not advisable, as it cannot be filtered against using the `G_MESSAGES_DEBUG`
4127
4150
  * environment variable.
4128
4151
  *
4129
- * For example, GTK+ uses this in its `Makefile.am`:
4152
+ * For example, GTK uses this in its `Makefile.am`:
4130
4153
  *
4131
4154
  * ```
4132
4155
  * AM_CPPFLAGS = -DG_LOG_DOMAIN=\"Gtk\"
@@ -4302,13 +4325,13 @@ export const PRIORITY_DEFAULT_IDLE: number
4302
4325
  /**
4303
4326
  * Use this for high priority event sources.
4304
4327
  *
4305
- * It is not used within GLib or GTK+.
4328
+ * It is not used within GLib or GTK.
4306
4329
  */
4307
4330
  export const PRIORITY_HIGH: number
4308
4331
  /**
4309
4332
  * Use this for high priority idle functions.
4310
4333
  *
4311
- * GTK+ uses %G_PRIORITY_HIGH_IDLE + 10 for resizing operations,
4334
+ * GTK uses %G_PRIORITY_HIGH_IDLE + 10 for resizing operations,
4312
4335
  * and %G_PRIORITY_HIGH_IDLE + 20 for redrawing operations. (This is
4313
4336
  * done to ensure that any pending resizes are processed before any
4314
4337
  * pending redraws, so that widgets are not redrawn twice unnecessarily.)
@@ -4317,9 +4340,32 @@ export const PRIORITY_HIGH_IDLE: number
4317
4340
  /**
4318
4341
  * Use this for very low priority background tasks.
4319
4342
  *
4320
- * It is not used within GLib or GTK+.
4343
+ * It is not used within GLib or GTK.
4321
4344
  */
4322
4345
  export const PRIORITY_LOW: number
4346
+ /**
4347
+ * Evaluates to the initial reference count for `grefcount`.
4348
+ *
4349
+ * This macro is useful for initializing `grefcount` fields inside
4350
+ * structures, for instance:
4351
+ *
4352
+ *
4353
+ * ```c
4354
+ * typedef struct {
4355
+ * grefcount ref_count;
4356
+ * char *name;
4357
+ * char *address;
4358
+ * } Person;
4359
+ *
4360
+ * static const Person default_person = {
4361
+ * .ref_count = G_REF_COUNT_INIT,
4362
+ * .name = "Default name",
4363
+ * .address = "Default address",
4364
+ * };
4365
+ * ```
4366
+ *
4367
+ */
4368
+ export const REF_COUNT_INIT: number
4323
4369
  /**
4324
4370
  * The search path separator character.
4325
4371
  * This is ':' on UNIX machines and ';' under Windows.
@@ -4783,6 +4829,7 @@ export function ascii_toupper(c: number): number
4783
4829
  export function ascii_xdigit_value(c: number): number
4784
4830
  export function assert_warning(log_domain: string | null, file: string | null, line: number, pretty_function: string | null, expression: string | null): void
4785
4831
  export function assertion_message(domain: string | null, file: string | null, line: number, func: string | null, message: string | null): void
4832
+ export function assertion_message_cmpint(domain: string | null, file: string | null, line: number, func: string | null, expr: string | null, arg1: number, cmp: string | null, arg2: number, numtype: number): void
4786
4833
  export function assertion_message_cmpstr(domain: string | null, file: string | null, line: number, func: string | null, expr: string | null, arg1: string | null, cmp: string | null, arg2: string | null): void
4787
4834
  export function assertion_message_cmpstrv(domain: string | null, file: string | null, line: number, func: string | null, expr: string | null, arg1: string | null, arg2: string | null, first_wrong_idx: number): void
4788
4835
  export function assertion_message_error(domain: string | null, file: string | null, line: number, func: string | null, expr: string | null, error: Error, error_domain: Quark, error_code: number): void
@@ -5434,8 +5481,10 @@ export function byte_array_free_to_bytes(array: Uint8Array): Bytes
5434
5481
  */
5435
5482
  export function byte_array_new(): Uint8Array
5436
5483
  /**
5437
- * Create byte array containing the data. The data will be owned by the array
5438
- * and will be freed with g_free(), i.e. it could be allocated using g_strdup().
5484
+ * Creates a byte array containing the `data`.
5485
+ * After this call, `data` belongs to the #GByteArray and may no longer be
5486
+ * modified by the caller. The memory of `data` has to be dynamically
5487
+ * allocated and will eventually be freed with g_free().
5439
5488
  *
5440
5489
  * Do not use it if `len` is greater than %G_MAXUINT. #GByteArray
5441
5490
  * stores the length of its data in #guint, which may be shorter than
@@ -5574,6 +5623,14 @@ export function child_watch_add(priority: number, pid: Pid, function_: ChildWatc
5574
5623
  * mechanism, including `waitpid(pid, ...)` or a second child-watch
5575
5624
  * source for the same `pid`
5576
5625
  * * the application must not ignore `SIGCHLD`
5626
+ * * Before 2.78, the application could not send a signal (`kill()`) to the
5627
+ * watched `pid` in a race free manner. Since 2.78, you can do that while the
5628
+ * associated #GMainContext is acquired.
5629
+ * * Before 2.78, even after destroying the #GSource, you could not
5630
+ * be sure that `pid` wasn't already reaped. Hence, it was also not
5631
+ * safe to `kill()` or `waitpid()` on the process ID after the child watch
5632
+ * source was gone. Destroying the source before it fired made it
5633
+ * impossible to reliably reap the process.
5577
5634
  *
5578
5635
  * If any of those conditions are not met, this and related APIs will
5579
5636
  * not work correctly. This can often be diagnosed via a GLib warning
@@ -5602,8 +5659,12 @@ export function clear_error(): void
5602
5659
  *
5603
5660
  * It is a bug to call this function with an invalid file descriptor.
5604
5661
  *
5605
- * Since 2.76, this function is guaranteed to be async-signal-safe if (and only
5606
- * if) `error` is %NULL and `fd` is a valid open file descriptor.
5662
+ * On POSIX platforms since GLib 2.76, this function is async-signal safe
5663
+ * if (and only if) `error` is %NULL and `fd` is a valid open file descriptor.
5664
+ * This makes it safe to call from a signal handler or a #GSpawnChildSetupFunc
5665
+ * under those conditions.
5666
+ * See [`signal(7)`](man:signal(7)) and
5667
+ * [`signal-safety(7)`](man:signal-safety(7)) for more details.
5607
5668
  * @param fd A file descriptor
5608
5669
  * @returns %TRUE on success, %FALSE if there was an error.
5609
5670
  */
@@ -5937,12 +5998,12 @@ export function dcgettext(domain: string | null, msgid: string | null, category:
5937
5998
  * translations for the current locale.
5938
5999
  *
5939
6000
  * The advantage of using this function over dgettext() proper is that
5940
- * libraries using this function (like GTK+) will not use translations
6001
+ * libraries using this function (like GTK) will not use translations
5941
6002
  * if the application using the library does not have translations for
5942
6003
  * the current locale. This results in a consistent English-only
5943
6004
  * interface instead of one having partial translations. For this
5944
6005
  * feature to work, the call to textdomain() and setlocale() should
5945
- * precede any g_dgettext() invocations. For GTK+, it means calling
6006
+ * precede any g_dgettext() invocations. For GTK, it means calling
5946
6007
  * textdomain() before gtk_init or its variants.
5947
6008
  *
5948
6009
  * This function disables translations if and only if upon its first
@@ -5960,7 +6021,7 @@ export function dcgettext(domain: string | null, msgid: string | null, category:
5960
6021
  *
5961
6022
  * Note that this behavior may not be desired for example if an application
5962
6023
  * has its untranslated messages in a language other than English. In those
5963
- * cases the application should call textdomain() after initializing GTK+.
6024
+ * cases the application should call textdomain() after initializing GTK.
5964
6025
  *
5965
6026
  * Applications should normally not use this function directly,
5966
6027
  * but use the _() macro for translations.
@@ -6371,6 +6432,11 @@ export function filename_display_name(filename: string): string | null
6371
6432
  /**
6372
6433
  * Converts an escaped ASCII-encoded URI to a local filename in the
6373
6434
  * encoding used for filenames.
6435
+ *
6436
+ * Since GLib 2.78, the query string and fragment can be present in the URI,
6437
+ * but are not part of the resulting filename.
6438
+ * We take inspiration from https://url.spec.whatwg.org/#file-state,
6439
+ * but we don't support the entire standard.
6374
6440
  * @param uri a uri describing a filename (escaped, encoded in ASCII).
6375
6441
  * @returns a newly-allocated string holding the resulting filename, or %NULL on an error.
6376
6442
  */
@@ -6487,6 +6553,12 @@ export function format_size_full(size: number, flags: FormatSizeFlags): string |
6487
6553
  * If you know the allocated size of `mem,` calling g_free_sized() may be faster,
6488
6554
  * depending on the libc implementation in use.
6489
6555
  *
6556
+ * Starting from GLib 2.78, this may happen automatically in case a GCC
6557
+ * compatible compiler is used with some optimization level and the allocated
6558
+ * size is known at compile time (see [documentation of
6559
+ * `__builtin_object_size()`](https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html)
6560
+ * to understand its caveats).
6561
+ *
6490
6562
  * If `mem` is %NULL it simply returns, so there is no need to check `mem`
6491
6563
  * against %NULL before calling this function.
6492
6564
  * @param mem the memory to free
@@ -6500,6 +6572,10 @@ export function free(mem: any | null): void
6500
6572
  * It is an error if `size` doesn’t match the size passed when `mem` was
6501
6573
  * allocated. `size` is passed to this function to allow optimizations in the
6502
6574
  * allocator. If you don’t know the allocation size, use g_free() instead.
6575
+ *
6576
+ * In case a GCC compatible compiler is used, this function may be used
6577
+ * automatically via g_free() if the allocated size is known at compile time,
6578
+ * since GLib 2.78.
6503
6579
  * @param mem the memory to free
6504
6580
  * @param size size of `mem,` in bytes
6505
6581
  */
@@ -6761,7 +6837,7 @@ export function get_os_info(key_name: string | null): string | null
6761
6837
  * in contrast to g_get_application_name().
6762
6838
  *
6763
6839
  * If you are using #GApplication the program name is set in
6764
- * g_application_run(). In case of GDK or GTK+ it is set in
6840
+ * g_application_run(). In case of GDK or GTK it is set in
6765
6841
  * gdk_init(), which is called by gtk_init() and the
6766
6842
  * #GtkApplication::startup handler. The program name is found by
6767
6843
  * taking the last component of `argv[`0].
@@ -7839,7 +7915,7 @@ export function main_current_source(): Source | null
7839
7915
  /**
7840
7916
  * Returns the depth of the stack of calls to
7841
7917
  * g_main_context_dispatch() on any #GMainContext in the current thread.
7842
- * That is, when called from the toplevel, it gives 0. When
7918
+ * That is, when called from the toplevel, it gives 0. When
7843
7919
  * called from within a callback from g_main_context_iteration()
7844
7920
  * (or g_main_loop_run(), etc.) it returns 1. When called from within
7845
7921
  * a callback to a recursive call to g_main_context_iteration(),
@@ -8182,7 +8258,7 @@ export function option_error_quark(): Quark
8182
8258
  /**
8183
8259
  * Parses a string containing debugging options
8184
8260
  * into a %guint containing bit flags. This is used
8185
- * within GDK and GTK+ to parse the debug options passed on the
8261
+ * within GDK and GTK to parse the debug options passed on the
8186
8262
  * command line or through environment variables.
8187
8263
  *
8188
8264
  * If `string` is equal to "all", all flags are set. Any flags
@@ -8376,7 +8452,7 @@ export function propagate_error(src: Error): /* dest */ Error | null
8376
8452
  * with statically allocated strings in the main program, but not with
8377
8453
  * statically allocated memory in dynamically loaded modules, if you
8378
8454
  * expect to ever unload the module again (e.g. do not use this
8379
- * function in GTK+ theme engines).
8455
+ * function in GTK theme engines).
8380
8456
  *
8381
8457
  * This function must not be used before library constructors have finished
8382
8458
  * running. In particular, this means it cannot be used to initialize global
@@ -8841,7 +8917,7 @@ export function set_error_literal(domain: Quark, code: number, message: string |
8841
8917
  * in contrast to g_set_application_name().
8842
8918
  *
8843
8919
  * If you are using #GApplication the program name is set in
8844
- * g_application_run(). In case of GDK or GTK+ it is set in
8920
+ * g_application_run(). In case of GDK or GTK it is set in
8845
8921
  * gdk_init(), which is called by gtk_init() and the
8846
8922
  * #GtkApplication::startup handler. The program name is found by
8847
8923
  * taking the last component of `argv[`0].
@@ -9117,7 +9193,7 @@ export function spaced_primes_closest(num: number): number
9117
9193
  * @param argv child's argument vector
9118
9194
  * @param envp child's environment, or %NULL to inherit parent's
9119
9195
  * @param flags flags from #GSpawnFlags
9120
- * @param child_setup function to run in the child just before exec()
9196
+ * @param child_setup function to run in the child just before `exec()`
9121
9197
  * @returns %TRUE on success, %FALSE if error is set
9122
9198
  */
9123
9199
  export function spawn_async(working_directory: string | null, argv: string[], envp: string[] | null, flags: SpawnFlags, child_setup: SpawnChildSetupFunc | null): [ /* returnType */ boolean, /* child_pid */ Pid ]
@@ -9130,7 +9206,7 @@ export function spawn_async(working_directory: string | null, argv: string[], en
9130
9206
  * @param argv child's argument vector, in the GLib file name encoding; it must be non-empty and %NULL-terminated
9131
9207
  * @param envp child's environment, or %NULL to inherit parent's, in the GLib file name encoding
9132
9208
  * @param flags flags from #GSpawnFlags
9133
- * @param child_setup function to run in the child just before exec()
9209
+ * @param child_setup function to run in the child just before `exec()`
9134
9210
  * @param stdin_fd file descriptor to use for child's stdin, or `-1`
9135
9211
  * @param stdout_fd file descriptor to use for child's stdout, or `-1`
9136
9212
  * @param stderr_fd file descriptor to use for child's stderr, or `-1`
@@ -9144,7 +9220,7 @@ export function spawn_async_with_fds(working_directory: string | null, argv: str
9144
9220
  * @param argv child's argument vector, in the GLib file name encoding; it must be non-empty and %NULL-terminated
9145
9221
  * @param envp child's environment, or %NULL to inherit parent's, in the GLib file name encoding
9146
9222
  * @param flags flags from #GSpawnFlags
9147
- * @param child_setup function to run in the child just before exec()
9223
+ * @param child_setup function to run in the child just before `exec()`
9148
9224
  * @returns %TRUE on success, %FALSE if an error was set
9149
9225
  */
9150
9226
  export function spawn_async_with_pipes(working_directory: string | null, argv: string[], envp: string[] | null, flags: SpawnFlags, child_setup: SpawnChildSetupFunc | null): [ /* returnType */ boolean, /* child_pid */ Pid, /* standard_input */ number, /* standard_output */ number, /* standard_error */ number ]
@@ -9347,7 +9423,7 @@ export function spawn_async_with_pipes(working_directory: string | null, argv: s
9347
9423
  * @param argv child's argument vector, in the GLib file name encoding; it must be non-empty and %NULL-terminated
9348
9424
  * @param envp child's environment, or %NULL to inherit parent's, in the GLib file name encoding
9349
9425
  * @param flags flags from #GSpawnFlags
9350
- * @param child_setup function to run in the child just before `exec()`
9426
+ * @param child_setup function to run in the child just before `exec()`
9351
9427
  * @param stdin_fd file descriptor to use for child's stdin, or `-1`
9352
9428
  * @param stdout_fd file descriptor to use for child's stdout, or `-1`
9353
9429
  * @param stderr_fd file descriptor to use for child's stderr, or `-1`
@@ -9500,7 +9576,7 @@ export function spawn_exit_error_quark(): Quark
9500
9576
  * @param argv child's argument vector, which must be non-empty and %NULL-terminated
9501
9577
  * @param envp child's environment, or %NULL to inherit parent's
9502
9578
  * @param flags flags from #GSpawnFlags
9503
- * @param child_setup function to run in the child just before exec()
9579
+ * @param child_setup function to run in the child just before `exec()`
9504
9580
  * @returns %TRUE on success, %FALSE if an error was set
9505
9581
  */
9506
9582
  export function spawn_sync(working_directory: string | null, argv: string[], envp: string[] | null, flags: SpawnFlags, child_setup: SpawnChildSetupFunc | null): [ /* returnType */ boolean, /* standard_output */ Uint8Array, /* standard_error */ Uint8Array, /* wait_status */ number ]
@@ -9947,10 +10023,59 @@ export function strrstr_len(haystack: string | null, haystack_len: number, needl
9947
10023
  * @returns a UTF-8 string describing the signal. If the signal is unknown, it returns "unknown signal (<signum>)".
9948
10024
  */
9949
10025
  export function strsignal(signum: number): string | null
10026
+ /**
10027
+ * Splits a string into a maximum of `max_tokens` pieces, using the given
10028
+ * `delimiter`. If `max_tokens` is reached, the remainder of `string` is
10029
+ * appended to the last token.
10030
+ *
10031
+ * As an example, the result of g_strsplit (":a:bc::d:", ":", -1) is a
10032
+ * %NULL-terminated vector containing the six strings "", "a", "bc", "", "d"
10033
+ * and "".
10034
+ *
10035
+ * As a special case, the result of splitting the empty string "" is an empty
10036
+ * vector, not a vector containing a single string. The reason for this
10037
+ * special case is that being able to represent an empty vector is typically
10038
+ * more useful than consistent handling of empty elements. If you do need
10039
+ * to represent empty elements, you'll need to check for the empty string
10040
+ * before calling g_strsplit().
10041
+ * @param string a string to split
10042
+ * @param delimiter 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.
10043
+ * @param max_tokens the maximum number of pieces to split `string` into. If this is less than 1, the string is split completely.
10044
+ * @returns a newly-allocated %NULL-terminated array of strings. Use g_strfreev() to free it.
10045
+ */
10046
+ export function strsplit(string: string | null, delimiter: string | null, max_tokens: number): string[]
10047
+ /**
10048
+ * Splits `string` into a number of tokens not containing any of the characters
10049
+ * in `delimiter`. A token is the (possibly empty) longest string that does not
10050
+ * contain any of the characters in `delimiters`. If `max_tokens` is reached, the
10051
+ * remainder is appended to the last token.
10052
+ *
10053
+ * For example the result of g_strsplit_set ("abc:def/ghi", ":/", -1) is a
10054
+ * %NULL-terminated vector containing the three strings "abc", "def",
10055
+ * and "ghi".
10056
+ *
10057
+ * The result of g_strsplit_set (":def/ghi:", ":/", -1) is a %NULL-terminated
10058
+ * vector containing the four strings "", "def", "ghi", and "".
10059
+ *
10060
+ * As a special case, the result of splitting the empty string "" is an empty
10061
+ * vector, not a vector containing a single string. The reason for this
10062
+ * special case is that being able to represent an empty vector is typically
10063
+ * more useful than consistent handling of empty elements. If you do need
10064
+ * to represent empty elements, you'll need to check for the empty string
10065
+ * before calling g_strsplit_set().
10066
+ *
10067
+ * Note that this function works on bytes not characters, so it can't be used
10068
+ * to delimit UTF-8 strings for anything but ASCII characters.
10069
+ * @param string The string to be tokenized
10070
+ * @param delimiters A nul-terminated string containing bytes that are used to split the string (it can accept an empty string, which will result in no string splitting).
10071
+ * @param max_tokens The maximum number of tokens to split `string` into. If this is less than 1, the string is split completely
10072
+ * @returns a newly-allocated %NULL-terminated array of strings. Use g_strfreev() to free it.
10073
+ */
10074
+ export function strsplit_set(string: string | null, delimiters: string | null, max_tokens: number): string[]
9950
10075
  /**
9951
10076
  * Searches the string `haystack` for the first occurrence
9952
10077
  * of the string `needle,` limiting the length of the search
9953
- * to `haystack_len`.
10078
+ * to `haystack_len` or a nul terminator byte (whichever is reached first).
9954
10079
  * @param haystack a nul-terminated string
9955
10080
  * @param haystack_len the maximum length of `haystack` in bytes. A length of -1 can be used to mean "search the entire string", like `strstr()`.
9956
10081
  * @param needle the string to search for
@@ -10083,6 +10208,14 @@ export function test_bug(bug_uri_snippet: string | null): void
10083
10208
  * @param uri_pattern the base pattern for bug URIs
10084
10209
  */
10085
10210
  export function test_bug_base(uri_pattern: string | null): void
10211
+ /**
10212
+ * Attempt to disable system crash reporting infrastructure.
10213
+ *
10214
+ * This function should be called before exercising code paths that are
10215
+ * expected or intended to crash, to avoid wasting resources in system-wide
10216
+ * crash collection infrastructure such as systemd-coredump or abrt.
10217
+ */
10218
+ export function test_disable_crash_reporting(): void
10086
10219
  /**
10087
10220
  * Indicates that a message with the given `log_domain` and `log_level,`
10088
10221
  * with text matching `pattern,` is expected to be logged. When this
@@ -10451,6 +10584,11 @@ export function test_trap_reached_timeout(): boolean
10451
10584
  * the subprocess, you can call g_test_subprocess() (after calling
10452
10585
  * g_test_init()) to see whether you are in a subprocess.
10453
10586
  *
10587
+ * Internally, this function tracks the child process using
10588
+ * g_child_watch_source_new(), so your process must not ignore `SIGCHLD`, and
10589
+ * must not attempt to watch or wait for the child process via another
10590
+ * mechanism.
10591
+ *
10454
10592
  * The following example tests that calling
10455
10593
  * `my_object_new(1000000)` will abort with an error
10456
10594
  * message.
@@ -10907,10 +11045,9 @@ export function unichar_fully_decompose(ch: string, compat: boolean, result_len:
10907
11045
  * glyph and `mirrored_ch` is set, it puts that character in the address
10908
11046
  * pointed to by `mirrored_ch`. Otherwise the original character is put.
10909
11047
  * @param ch a Unicode character
10910
- * @param mirrored_ch location to store the mirrored character
10911
11048
  * @returns %TRUE if @ch has a mirrored character, %FALSE otherwise
10912
11049
  */
10913
- export function unichar_get_mirror_char(ch: string, mirrored_ch: string): boolean
11050
+ export function unichar_get_mirror_char(ch: string): [ /* returnType */ boolean, /* mirrored_ch */ string ]
10914
11051
  /**
10915
11052
  * Looks up the #GUnicodeScript for a particular character (as defined
10916
11053
  * by Unicode Standard Annex \#24). No check is made for `ch` being a
@@ -11186,12 +11323,15 @@ export function unix_error_quark(): Quark
11186
11323
  */
11187
11324
  export function unix_fd_add_full(priority: number, fd: number, condition: IOCondition, function_: UnixFDSourceFunc): number
11188
11325
  /**
11189
- * Creates a #GSource to watch for a particular IO condition on a file
11326
+ * Creates a #GSource to watch for a particular I/O condition on a file
11190
11327
  * descriptor.
11191
11328
  *
11192
- * The source will never close the fd -- you must do it yourself.
11329
+ * The source will never close the `fd` you must do it yourself.
11330
+ *
11331
+ * Any callback attached to the returned #GSource must have type
11332
+ * #GUnixFDSourceFunc.
11193
11333
  * @param fd a file descriptor
11194
- * @param condition IO conditions to watch for on `fd`
11334
+ * @param condition I/O conditions to watch for on `fd`
11195
11335
  * @returns the newly created #GSource
11196
11336
  */
11197
11337
  export function unix_fd_source_new(fd: number, condition: IOCondition): Source
@@ -11214,12 +11354,20 @@ export function unix_get_passwd_entry(user_name: string | null): any | null
11214
11354
  /**
11215
11355
  * Similar to the UNIX pipe() call, but on modern systems like Linux
11216
11356
  * uses the pipe2() system call, which atomically creates a pipe with
11217
- * the configured flags. The only supported flag currently is
11218
- * %FD_CLOEXEC. If for example you want to configure %O_NONBLOCK, that
11219
- * must still be done separately with fcntl().
11357
+ * the configured flags.
11358
+ *
11359
+ * As of GLib 2.78, the supported flags are `O_CLOEXEC`/`FD_CLOEXEC` (see below)
11360
+ * and `O_NONBLOCK`. Prior to GLib 2.78, only `FD_CLOEXEC` was supported — if
11361
+ * you wanted to configure `O_NONBLOCK` then that had to be done separately with
11362
+ * `fcntl()`.
11363
+ *
11364
+ * It is a programmer error to call this function with unsupported flags, and a
11365
+ * critical warning will be raised.
11220
11366
  *
11221
- * This function does not take %O_CLOEXEC, it takes %FD_CLOEXEC as if
11222
- * for fcntl(); these are different on Linux/glibc.
11367
+ * As of GLib 2.78, it is preferred to pass `O_CLOEXEC` in, rather than
11368
+ * `FD_CLOEXEC`, as that matches the underlying `pipe()` API more closely. Prior
11369
+ * to 2.78, only `FD_CLOEXEC` was supported. Support for `FD_CLOEXEC` may be
11370
+ * deprecated and removed in future.
11223
11371
  * @param fds Array of two integers
11224
11372
  * @param flags Bitfield of file descriptor flags, as for fcntl()
11225
11373
  * @returns %TRUE on success, %FALSE if not (and errno will be set).
@@ -11398,7 +11546,7 @@ export function uri_is_valid(uri_string: string | null, flags: UriFlags): boolea
11398
11546
  *
11399
11547
  * When `host` is present, `path` must either be empty or begin with a slash (`/`)
11400
11548
  * character. When `host` is not present, `path` cannot begin with two slash
11401
- * characters (`//`). See
11549
+ * characters (`//`). See
11402
11550
  * [RFC 3986, section 3](https://tools.ietf.org/html/rfc3986#section-3).
11403
11551
  *
11404
11552
  * See also g_uri_join_with_user(), which allows specifying the
@@ -11997,6 +12145,17 @@ export function utf8_to_ucs4_fast(str: string | null, len: number): [ /* returnT
11997
12145
  * @returns a pointer to a newly allocated UTF-16 string. This value must be freed with g_free(). If an error occurs, %NULL will be returned and @error set.
11998
12146
  */
11999
12147
  export function utf8_to_utf16(str: string | null, len: number): [ /* returnType */ number, /* items_read */ number, /* items_written */ number ]
12148
+ /**
12149
+ * Cuts off the middle of the string, preserving half of `truncate_length`
12150
+ * characters at the beginning and half at the end.
12151
+ *
12152
+ * If `string` is already short enough, this returns a copy of `string`.
12153
+ * If `truncate_length` is `0`, an empty string is returned.
12154
+ * @param string a nul-terminated UTF-8 encoded string
12155
+ * @param truncate_length the new size of `string,` in characters, including the ellipsis character
12156
+ * @returns a newly-allocated copy of @string ellipsized in the middle
12157
+ */
12158
+ export function utf8_truncate_middle(string: string | null, truncate_length: number): string | null
12000
12159
  /**
12001
12160
  * Validates UTF-8 encoded text. `str` is the text to validate;
12002
12161
  * if `str` is nul-terminated, then `max_len` can be -1, otherwise
@@ -12009,7 +12168,7 @@ export function utf8_to_utf16(str: string | null, len: number): [ /* returnType
12009
12168
  * Note that g_utf8_validate() returns %FALSE if `max_len` is
12010
12169
  * positive and any of the `max_len` bytes are nul.
12011
12170
  *
12012
- * Returns %TRUE if all of `str` was valid. Many GLib and GTK+
12171
+ * Returns %TRUE if all of `str` was valid. Many GLib and GTK
12013
12172
  * routines require valid UTF-8 as input; so data read from a file
12014
12173
  * or the network should be checked with g_utf8_validate() before
12015
12174
  * doing anything else with it.
@@ -12356,7 +12515,7 @@ export interface ErrorInitFunc {
12356
12515
  /**
12357
12516
  * Declares a type of function which takes an arbitrary
12358
12517
  * data pointer argument and has no return value. It is
12359
- * not currently used in GLib or GTK+.
12518
+ * not currently used in GLib or GTK.
12360
12519
  * @callback
12361
12520
  * @param data a data pointer
12362
12521
  */
@@ -13642,7 +13801,44 @@ export interface BookmarkFile {
13642
13801
  }
13643
13802
 
13644
13803
  /**
13645
- * An opaque data structure representing a set of bookmarks.
13804
+ * GBookmarkFile lets you parse, edit or create files containing bookmarks
13805
+ * to URI, along with some meta-data about the resource pointed by the URI
13806
+ * like its MIME type, the application that is registering the bookmark and
13807
+ * the icon that should be used to represent the bookmark. The data is stored
13808
+ * using the
13809
+ * [Desktop Bookmark Specification](http://www.gnome.org/~ebassi/bookmark-spec).
13810
+ *
13811
+ * The syntax of the bookmark files is described in detail inside the
13812
+ * Desktop Bookmark Specification, here is a quick summary: bookmark
13813
+ * files use a sub-class of the XML Bookmark Exchange Language
13814
+ * specification, consisting of valid UTF-8 encoded XML, under the
13815
+ * <xbel> root element; each bookmark is stored inside a
13816
+ * <bookmark> element, using its URI: no relative paths can
13817
+ * be used inside a bookmark file. The bookmark may have a user defined
13818
+ * title and description, to be used instead of the URI. Under the
13819
+ * <metadata> element, with its owner attribute set to
13820
+ * `http://freedesktop.org`, is stored the meta-data about a resource
13821
+ * pointed by its URI. The meta-data consists of the resource's MIME
13822
+ * type; the applications that have registered a bookmark; the groups
13823
+ * to which a bookmark belongs to; a visibility flag, used to set the
13824
+ * bookmark as "private" to the applications and groups that has it
13825
+ * registered; the URI and MIME type of an icon, to be used when
13826
+ * displaying the bookmark inside a GUI.
13827
+ *
13828
+ * Here is an example of a bookmark file:
13829
+ * [bookmarks.xbel](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/glib/tests/bookmarks.xbel)
13830
+ *
13831
+ * A bookmark file might contain more than one bookmark; each bookmark
13832
+ * is accessed through its URI.
13833
+ *
13834
+ * The important caveat of bookmark files is that when you add a new
13835
+ * bookmark you must also add the application that is registering it, using
13836
+ * g_bookmark_file_add_application() or g_bookmark_file_set_application_info().
13837
+ * If a bookmark has no applications then it won't be dumped when creating
13838
+ * the on disk representation, using g_bookmark_file_to_data() or
13839
+ * g_bookmark_file_to_file().
13840
+ *
13841
+ * The #GBookmarkFile parser was added in GLib 2.12.
13646
13842
  * @record
13647
13843
  */
13648
13844
  export class BookmarkFile {
@@ -13711,8 +13907,10 @@ export class ByteArray {
13711
13907
  */
13712
13908
  static new(): Uint8Array
13713
13909
  /**
13714
- * Create byte array containing the data. The data will be owned by the array
13715
- * and will be freed with g_free(), i.e. it could be allocated using g_strdup().
13910
+ * Creates a byte array containing the `data`.
13911
+ * After this call, `data` belongs to the #GByteArray and may no longer be
13912
+ * modified by the caller. The memory of `data` has to be dynamically
13913
+ * allocated and will eventually be freed with g_free().
13716
13914
  *
13717
13915
  * Do not use it if `len` is greater than %G_MAXUINT. #GByteArray
13718
13916
  * stores the length of its data in #guint, which may be shorter than
@@ -13959,11 +14157,9 @@ export class Bytes {
13959
14157
  /**
13960
14158
  * Creates a new #GBytes from `data`.
13961
14159
  *
13962
- * After this call, `data` belongs to the bytes and may no longer be
13963
- * modified by the caller. g_free() will be called on `data` when the
13964
- * bytes is no longer in use. Because of this `data` must have been created by
13965
- * a call to g_malloc(), g_malloc0() or g_realloc() or by one of the many
13966
- * functions that wrap these calls (such as g_new(), g_strdup(), etc).
14160
+ * After this call, `data` belongs to the #GBytes and may no longer be
14161
+ * modified by the caller. The memory of `data` has to be dynamically
14162
+ * allocated and will eventually be freed with g_free().
13967
14163
  *
13968
14164
  * For creating #GBytes with memory from other allocators, see
13969
14165
  * g_bytes_new_with_free_func().
@@ -14866,103 +15062,103 @@ export interface DateTime {
14866
15062
  * Creates a newly allocated string representing the requested `format`.
14867
15063
  *
14868
15064
  * The format strings understood by this function are a subset of the
14869
- * strftime() format language as specified by C99. The \%D, \%U and \%W
14870
- * conversions are not supported, nor is the 'E' modifier. The GNU
14871
- * extensions \%k, \%l, \%s and \%P are supported, however, as are the
14872
- * '0', '_' and '-' modifiers. The Python extension \%f is also supported.
15065
+ * `strftime()` format language as specified by C99. The `%D`, `%U` and `%W`
15066
+ * conversions are not supported, nor is the `E` modifier. The GNU
15067
+ * extensions `%k`, `%l`, `%s` and `%P` are supported, however, as are the
15068
+ * `0`, `_` and `-` modifiers. The Python extension `%f` is also supported.
14873
15069
  *
14874
- * In contrast to strftime(), this function always produces a UTF-8
15070
+ * In contrast to `strftime()`, this function always produces a UTF-8
14875
15071
  * string, regardless of the current locale. Note that the rendering of
14876
- * many formats is locale-dependent and may not match the strftime()
15072
+ * many formats is locale-dependent and may not match the `strftime()`
14877
15073
  * output exactly.
14878
15074
  *
14879
15075
  * The following format specifiers are supported:
14880
15076
  *
14881
- * - \%a: the abbreviated weekday name according to the current locale
14882
- * - \%A: the full weekday name according to the current locale
14883
- * - \%b: the abbreviated month name according to the current locale
14884
- * - \%B: the full month name according to the current locale
14885
- * - \%c: the preferred date and time representation for the current locale
14886
- * - \%C: the century number (year/100) as a 2-digit integer (00-99)
14887
- * - \%d: the day of the month as a decimal number (range 01 to 31)
14888
- * - \%e: the day of the month as a decimal number (range 1 to 31);
14889
- * single digits are preceded by a figure space
14890
- * - \%F: equivalent to `%Y-%m-%d` (the ISO 8601 date format)
14891
- * - \%g: the last two digits of the ISO 8601 week-based year as a
14892
- * decimal number (00-99). This works well with \%V and \%u.
14893
- * - \%G: the ISO 8601 week-based year as a decimal number. This works
14894
- * well with \%V and \%u.
14895
- * - \%h: equivalent to \%b
14896
- * - \%H: the hour as a decimal number using a 24-hour clock (range 00 to 23)
14897
- * - \%I: the hour as a decimal number using a 12-hour clock (range 01 to 12)
14898
- * - \%j: the day of the year as a decimal number (range 001 to 366)
14899
- * - \%k: the hour (24-hour clock) as a decimal number (range 0 to 23);
14900
- * single digits are preceded by a figure space
14901
- * - \%l: the hour (12-hour clock) as a decimal number (range 1 to 12);
14902
- * single digits are preceded by a figure space
14903
- * - \%m: the month as a decimal number (range 01 to 12)
14904
- * - \%M: the minute as a decimal number (range 00 to 59)
14905
- * - \%f: the microsecond as a decimal number (range 000000 to 999999)
14906
- * - \%p: either "AM" or "PM" according to the given time value, or the
15077
+ * - `%a`: the abbreviated weekday name according to the current locale
15078
+ * - `%A`: the full weekday name according to the current locale
15079
+ * - `%b`: the abbreviated month name according to the current locale
15080
+ * - `%B`: the full month name according to the current locale
15081
+ * - `%c`: the preferred date and time representation for the current locale
15082
+ * - `%C`: the century number (year/100) as a 2-digit integer (00-99)
15083
+ * - `%d`: the day of the month as a decimal number (range 01 to 31)
15084
+ * - `%e`: the day of the month as a decimal number (range 1 to 31);
15085
+ * single digits are preceded by a figure space (U+2007)
15086
+ * - `%F`: equivalent to `%Y-%m-%d` (the ISO 8601 date format)
15087
+ * - `%g`: the last two digits of the ISO 8601 week-based year as a
15088
+ * decimal number (00-99). This works well with `%V` and `%u`.
15089
+ * - `%G`: the ISO 8601 week-based year as a decimal number. This works
15090
+ * well with `%V` and `%u`.
15091
+ * - `%h`: equivalent to `%b`
15092
+ * - `%H`: the hour as a decimal number using a 24-hour clock (range 00 to 23)
15093
+ * - `%I`: the hour as a decimal number using a 12-hour clock (range 01 to 12)
15094
+ * - `%j`: the day of the year as a decimal number (range 001 to 366)
15095
+ * - `%k`: the hour (24-hour clock) as a decimal number (range 0 to 23);
15096
+ * single digits are preceded by a figure space (U+2007)
15097
+ * - `%l`: the hour (12-hour clock) as a decimal number (range 1 to 12);
15098
+ * single digits are preceded by a figure space (U+2007)
15099
+ * - `%m`: the month as a decimal number (range 01 to 12)
15100
+ * - `%M`: the minute as a decimal number (range 00 to 59)
15101
+ * - `%f`: the microsecond as a decimal number (range 000000 to 999999)
15102
+ * - `%p`: either AM or PM according to the given time value, or the
14907
15103
  * corresponding strings for the current locale. Noon is treated as
14908
- * "PM" and midnight as "AM". Use of this format specifier is discouraged, as
14909
- * many locales have no concept of AM/PM formatting. Use \%c or \%X instead.
14910
- * - \%P: like \%p but lowercase: "am" or "pm" or a corresponding string for
15104
+ * PM and midnight as AM’. Use of this format specifier is discouraged, as
15105
+ * many locales have no concept of AM/PM formatting. Use `%c` or `%X` instead.
15106
+ * - `%P`: like `%p` but lowercase: am or pm or a corresponding string for
14911
15107
  * the current locale. Use of this format specifier is discouraged, as
14912
- * many locales have no concept of AM/PM formatting. Use \%c or \%X instead.
14913
- * - \%r: the time in a.m. or p.m. notation. Use of this format specifier is
14914
- * discouraged, as many locales have no concept of AM/PM formatting. Use \%c
14915
- * or \%X instead.
14916
- * - \%R: the time in 24-hour notation (\%H:\%M)
14917
- * - \%s: the number of seconds since the Epoch, that is, since 1970-01-01
15108
+ * many locales have no concept of AM/PM formatting. Use `%c` or `%X` instead.
15109
+ * - `%r`: the time in a.m. or p.m. notation. Use of this format specifier is
15110
+ * discouraged, as many locales have no concept of AM/PM formatting. Use `%c`
15111
+ * or `%X` instead.
15112
+ * - `%R`: the time in 24-hour notation (`%H:%M`)
15113
+ * - `%s`: the number of seconds since the Epoch, that is, since 1970-01-01
14918
15114
  * 00:00:00 UTC
14919
- * - \%S: the second as a decimal number (range 00 to 60)
14920
- * - \%t: a tab character
14921
- * - \%T: the time in 24-hour notation with seconds (\%H:\%M:\%S)
14922
- * - \%u: the ISO 8601 standard day of the week as a decimal, range 1 to 7,
14923
- * Monday being 1. This works well with \%G and \%V.
14924
- * - \%V: the ISO 8601 standard week number of the current year as a decimal
15115
+ * - `%S`: the second as a decimal number (range 00 to 60)
15116
+ * - `%t`: a tab character
15117
+ * - `%T`: the time in 24-hour notation with seconds (`%H:%M:%S`)
15118
+ * - `%u`: the ISO 8601 standard day of the week as a decimal, range 1 to 7,
15119
+ * Monday being 1. This works well with `%G` and `%V`.
15120
+ * - `%V`: the ISO 8601 standard week number of the current year as a decimal
14925
15121
  * number, range 01 to 53, where week 1 is the first week that has at
14926
15122
  * least 4 days in the new year. See g_date_time_get_week_of_year().
14927
- * This works well with \%G and \%u.
14928
- * - \%w: the day of the week as a decimal, range 0 to 6, Sunday being 0.
14929
- * This is not the ISO 8601 standard format -- use \%u instead.
14930
- * - \%x: the preferred date representation for the current locale without
15123
+ * This works well with `%G` and `%u`.
15124
+ * - `%w`: the day of the week as a decimal, range 0 to 6, Sunday being 0.
15125
+ * This is not the ISO 8601 standard format use `%u` instead.
15126
+ * - `%x`: the preferred date representation for the current locale without
14931
15127
  * the time
14932
- * - \%X: the preferred time representation for the current locale without
15128
+ * - `%X`: the preferred time representation for the current locale without
14933
15129
  * the date
14934
- * - \%y: the year as a decimal number without the century
14935
- * - \%Y: the year as a decimal number including the century
14936
- * - \%z: the time zone as an offset from UTC (+hhmm)
14937
- * - \%:z: the time zone as an offset from UTC (+hh:mm).
14938
- * This is a gnulib strftime() extension. Since: 2.38
14939
- * - \%::z: the time zone as an offset from UTC (+hh:mm:ss). This is a
14940
- * gnulib strftime() extension. Since: 2.38
14941
- * - \%:::z: the time zone as an offset from UTC, with : to necessary
14942
- * precision (e.g., -04, +05:30). This is a gnulib strftime() extension. Since: 2.38
14943
- * - \%Z: the time zone or name or abbreviation
14944
- * - \%\%: a literal \% character
15130
+ * - `%y`: the year as a decimal number without the century
15131
+ * - `%Y`: the year as a decimal number including the century
15132
+ * - `%z`: the time zone as an offset from UTC (`+hhmm`)
15133
+ * - `%:z`: the time zone as an offset from UTC (`+hh:mm`).
15134
+ * This is a gnulib `strftime()` extension. Since: 2.38
15135
+ * - `%::z`: the time zone as an offset from UTC (`+hh:mm:ss`). This is a
15136
+ * gnulib `strftime()` extension. Since: 2.38
15137
+ * - `%:::z`: the time zone as an offset from UTC, with `:` to necessary
15138
+ * precision (e.g., `-04`, `+05:30`). This is a gnulib `strftime()` extension. Since: 2.38
15139
+ * - `%Z`: the time zone or name or abbreviation
15140
+ * - `%%`: a literal `%` character
14945
15141
  *
14946
15142
  * Some conversion specifications can be modified by preceding the
14947
15143
  * conversion specifier by one or more modifier characters. The
14948
15144
  * following modifiers are supported for many of the numeric
14949
15145
  * conversions:
14950
15146
  *
14951
- * - O: Use alternative numeric symbols, if the current locale supports those.
14952
- * - _: Pad a numeric result with spaces. This overrides the default padding
15147
+ * - `O`: Use alternative numeric symbols, if the current locale supports those.
15148
+ * - `_`: Pad a numeric result with spaces. This overrides the default padding
14953
15149
  * for the specifier.
14954
- * - -: Do not pad a numeric result. This overrides the default padding
15150
+ * - `-`: Do not pad a numeric result. This overrides the default padding
14955
15151
  * for the specifier.
14956
- * - 0: Pad a numeric result with zeros. This overrides the default padding
15152
+ * - `0`: Pad a numeric result with zeros. This overrides the default padding
14957
15153
  * for the specifier.
14958
15154
  *
14959
- * Additionally, when O is used with B, b, or h, it produces the alternative
15155
+ * Additionally, when `O` is used with `B`, `b`, or `h`, it produces the alternative
14960
15156
  * form of a month name. The alternative form should be used when the month
14961
15157
  * name is used without a day number (e.g., standalone). It is required in
14962
15158
  * some languages (Baltic, Slavic, Greek, and more) due to their grammatical
14963
- * rules. For other languages there is no difference. \%OB is a GNU and BSD
14964
- * strftime() extension expected to be added to the future POSIX specification,
14965
- * \%Ob and \%Oh are GNU strftime() extensions. Since: 2.56
15159
+ * rules. For other languages there is no difference. `%OB` is a GNU and BSD
15160
+ * `strftime()` extension expected to be added to the future POSIX specification,
15161
+ * `%Ob` and `%Oh` are GNU `strftime()` extensions. Since: 2.56
14966
15162
  * @param format a valid UTF-8 string, containing the format for the #GDateTime
14967
15163
  * @returns a newly allocated string formatted to the requested format or %NULL in the case that there was an error (such as a format specifier not being supported in the current locale). The string should be freed with g_free().
14968
15164
  */
@@ -17076,8 +17272,146 @@ export interface KeyFile {
17076
17272
  }
17077
17273
 
17078
17274
  /**
17079
- * The GKeyFile struct contains only private data
17080
- * and should not be accessed directly.
17275
+ * #GKeyFile lets you parse, edit or create files containing groups of
17276
+ * key-value pairs, which we call "key files" for lack of a better name.
17277
+ * Several freedesktop.org specifications use key files now, e.g the
17278
+ * [Desktop Entry Specification](http://freedesktop.org/Standards/desktop-entry-spec)
17279
+ * and the
17280
+ * [Icon Theme Specification](http://freedesktop.org/Standards/icon-theme-spec).
17281
+ *
17282
+ * The syntax of key files is described in detail in the
17283
+ * [Desktop Entry Specification](http://freedesktop.org/Standards/desktop-entry-spec),
17284
+ * here is a quick summary: Key files
17285
+ * consists of groups of key-value pairs, interspersed with comments.
17286
+ *
17287
+ *
17288
+ * ```
17289
+ * # this is just an example
17290
+ * # there can be comments before the first group
17291
+ *
17292
+ * [First Group]
17293
+ *
17294
+ * Name=Key File Example\tthis value shows\nescaping
17295
+ *
17296
+ * # localized strings are stored in multiple key-value pairs
17297
+ * Welcome=Hello
17298
+ * Welcome[de]=Hallo
17299
+ * Welcome[fr_FR]=Bonjour
17300
+ * Welcome[it]=Ciao
17301
+ * Welcome[be`latin]`=Hello
17302
+ *
17303
+ * [Another Group]
17304
+ *
17305
+ * Numbers=2;20;-200;0
17306
+ *
17307
+ * Booleans=true;false;true;true
17308
+ * ```
17309
+ *
17310
+ *
17311
+ * Lines beginning with a '#' and blank lines are considered comments.
17312
+ *
17313
+ * Groups are started by a header line containing the group name enclosed
17314
+ * in '[' and ']', and ended implicitly by the start of the next group or
17315
+ * the end of the file. Each key-value pair must be contained in a group.
17316
+ *
17317
+ * Key-value pairs generally have the form `key=value`, with the
17318
+ * exception of localized strings, which have the form
17319
+ * `key[locale]=value`, with a locale identifier of the
17320
+ * form `lang_COUNTRY`MODIFIER`` where `COUNTRY` and `MODIFIER`
17321
+ * are optional.
17322
+ * Space before and after the '=' character are ignored. Newline, tab,
17323
+ * carriage return and backslash characters in value are escaped as \n,
17324
+ * \t, \r, and \\\\, respectively. To preserve leading spaces in values,
17325
+ * these can also be escaped as \s.
17326
+ *
17327
+ * Key files can store strings (possibly with localized variants), integers,
17328
+ * booleans and lists of these. Lists are separated by a separator character,
17329
+ * typically ';' or ','. To use the list separator character in a value in
17330
+ * a list, it has to be escaped by prefixing it with a backslash.
17331
+ *
17332
+ * This syntax is obviously inspired by the .ini files commonly met
17333
+ * on Windows, but there are some important differences:
17334
+ *
17335
+ * - .ini files use the ';' character to begin comments,
17336
+ * key files use the '#' character.
17337
+ *
17338
+ * - Key files do not allow for ungrouped keys meaning only
17339
+ * comments can precede the first group.
17340
+ *
17341
+ * - Key files are always encoded in UTF-8.
17342
+ *
17343
+ * - Key and Group names are case-sensitive. For example, a group called
17344
+ * [GROUP] is a different from [group].
17345
+ *
17346
+ * - .ini files don't have a strongly typed boolean entry type,
17347
+ * they only have GetProfileInt(). In key files, only
17348
+ * true and false (in lower case) are allowed.
17349
+ *
17350
+ * Note that in contrast to the
17351
+ * [Desktop Entry Specification](http://freedesktop.org/Standards/desktop-entry-spec),
17352
+ * groups in key files may contain the same
17353
+ * key multiple times; the last entry wins. Key files may also contain
17354
+ * multiple groups with the same name; they are merged together.
17355
+ * Another difference is that keys and group names in key files are not
17356
+ * restricted to ASCII characters.
17357
+ *
17358
+ * Here is an example of loading a key file and reading a value:
17359
+ *
17360
+ *
17361
+ * ```c
17362
+ * g_autoptr(GError) error = NULL;
17363
+ * g_autoptr(GKeyFile) key_file = g_key_file_new ();
17364
+ *
17365
+ * if (!g_key_file_load_from_file (key_file, "key-file.ini", flags, &error))
17366
+ * {
17367
+ * if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
17368
+ * g_warning ("Error loading key file: %s", error->message);
17369
+ * return;
17370
+ * }
17371
+ *
17372
+ * g_autofree gchar *val = g_key_file_get_string (key_file, "Group Name", "SomeKey", &error);
17373
+ * if (val == NULL &&
17374
+ * !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND))
17375
+ * {
17376
+ * g_warning ("Error finding key in key file: %s", error->message);
17377
+ * return;
17378
+ * }
17379
+ * else if (val == NULL)
17380
+ * {
17381
+ * // Fall back to a default value.
17382
+ * val = g_strdup ("default-value");
17383
+ * }
17384
+ * ```
17385
+ *
17386
+ *
17387
+ * Here is an example of creating and saving a key file:
17388
+ *
17389
+ *
17390
+ * ```c
17391
+ * g_autoptr(GKeyFile) key_file = g_key_file_new ();
17392
+ * const gchar *val = …;
17393
+ * g_autoptr(GError) error = NULL;
17394
+ *
17395
+ * g_key_file_set_string (key_file, "Group Name", "SomeKey", val);
17396
+ *
17397
+ * // Save as a file.
17398
+ * if (!g_key_file_save_to_file (key_file, "key-file.ini", &error))
17399
+ * {
17400
+ * g_warning ("Error saving key file: %s", error->message);
17401
+ * return;
17402
+ * }
17403
+ *
17404
+ * // Or store to a GBytes for use elsewhere.
17405
+ * gsize data_len;
17406
+ * g_autofree guint8 *data = (guint8 *) g_key_file_to_data (key_file, &data_len, &error);
17407
+ * if (data == NULL)
17408
+ * {
17409
+ * g_warning ("Error saving key file: %s", error->message);
17410
+ * return;
17411
+ * }
17412
+ * g_autoptr(GBytes) bytes = g_bytes_new_take (g_steal_pointer (&data), data_len);
17413
+ * ```
17414
+ *
17081
17415
  * @record
17082
17416
  */
17083
17417
  export class KeyFile {
@@ -17195,7 +17529,7 @@ export interface MainContext {
17195
17529
  *
17196
17530
  * You must be the owner of a context before you
17197
17531
  * can call g_main_context_prepare(), g_main_context_query(),
17198
- * g_main_context_check(), g_main_context_dispatch().
17532
+ * g_main_context_check(), g_main_context_dispatch(), g_main_context_release().
17199
17533
  *
17200
17534
  * Since 2.76 `context` can be %NULL to use the global-default
17201
17535
  * main context.
@@ -17391,6 +17725,9 @@ export interface MainContext {
17391
17725
  * with g_main_context_acquire(). If the context was acquired multiple
17392
17726
  * times, the ownership will be released only when g_main_context_release()
17393
17727
  * is called as many times as it was acquired.
17728
+ *
17729
+ * You must have successfully acquired the context with
17730
+ * g_main_context_acquire() before you may call this function.
17394
17731
  */
17395
17732
  release(): void
17396
17733
  /**
@@ -17562,7 +17899,7 @@ export interface MainLoop {
17562
17899
 
17563
17900
  /**
17564
17901
  * The `GMainLoop` struct is an opaque data type
17565
- * representing the main event loop of a GLib or GTK+ application.
17902
+ * representing the main event loop of a GLib or GTK application.
17566
17903
  * @record
17567
17904
  */
17568
17905
  export class MainLoop {
@@ -18660,9 +18997,165 @@ export interface OptionContext {
18660
18997
  }
18661
18998
 
18662
18999
  /**
18663
- * A `GOptionContext` struct defines which options
18664
- * are accepted by the commandline option parser. The struct has only private
18665
- * fields and should not be directly accessed.
19000
+ * The GOption commandline parser is intended to be a simpler replacement
19001
+ * for the popt library. It supports short and long commandline options,
19002
+ * as shown in the following example:
19003
+ *
19004
+ * `testtreemodel -r 1 --max-size 20 --rand --display=:1.0 -vb -- file1 file2`
19005
+ *
19006
+ * The example demonstrates a number of features of the GOption
19007
+ * commandline parser:
19008
+ *
19009
+ * - Options can be single letters, prefixed by a single dash.
19010
+ *
19011
+ * - Multiple short options can be grouped behind a single dash.
19012
+ *
19013
+ * - Long options are prefixed by two consecutive dashes.
19014
+ *
19015
+ * - Options can have an extra argument, which can be a number, a string or
19016
+ * a filename. For long options, the extra argument can be appended with
19017
+ * an equals sign after the option name, which is useful if the extra
19018
+ * argument starts with a dash, which would otherwise cause it to be
19019
+ * interpreted as another option.
19020
+ *
19021
+ * - Non-option arguments are returned to the application as rest arguments.
19022
+ *
19023
+ * - An argument consisting solely of two dashes turns off further parsing,
19024
+ * any remaining arguments (even those starting with a dash) are returned
19025
+ * to the application as rest arguments.
19026
+ *
19027
+ * Another important feature of GOption is that it can automatically
19028
+ * generate nicely formatted help output. Unless it is explicitly turned
19029
+ * off with g_option_context_set_help_enabled(), GOption will recognize
19030
+ * the `--help`, `-?`, `--help-all` and `--help-groupname` options
19031
+ * (where `groupname` is the name of a #GOptionGroup) and write a text
19032
+ * similar to the one shown in the following example to stdout.
19033
+ *
19034
+ *
19035
+ * ```
19036
+ * Usage:
19037
+ * testtreemodel [OPTION...] - test tree model performance
19038
+ *
19039
+ * Help Options:
19040
+ * -h, --help Show help options
19041
+ * --help-all Show all help options
19042
+ * --help-gtk Show GTK Options
19043
+ *
19044
+ * Application Options:
19045
+ * -r, --repeats=N Average over N repetitions
19046
+ * -m, --max-size=M Test up to 2^M items
19047
+ * --display=DISPLAY X display to use
19048
+ * -v, --verbose Be verbose
19049
+ * -b, --beep Beep when done
19050
+ * --rand Randomize the data
19051
+ * ```
19052
+ *
19053
+ *
19054
+ * GOption groups options in #GOptionGroups, which makes it easy to
19055
+ * incorporate options from multiple sources. The intended use for this is
19056
+ * to let applications collect option groups from the libraries it uses,
19057
+ * add them to their #GOptionContext, and parse all options by a single call
19058
+ * to g_option_context_parse(). See gtk_get_option_group() for an example.
19059
+ *
19060
+ * If an option is declared to be of type string or filename, GOption takes
19061
+ * care of converting it to the right encoding; strings are returned in
19062
+ * UTF-8, filenames are returned in the GLib filename encoding. Note that
19063
+ * this only works if setlocale() has been called before
19064
+ * g_option_context_parse().
19065
+ *
19066
+ * Here is a complete example of setting up GOption to parse the example
19067
+ * commandline above and produce the example help output.
19068
+ *
19069
+ * ```c
19070
+ * static gint repeats = 2;
19071
+ * static gint max_size = 8;
19072
+ * static gboolean verbose = FALSE;
19073
+ * static gboolean beep = FALSE;
19074
+ * static gboolean randomize = FALSE;
19075
+ *
19076
+ * static GOptionEntry entries[] =
19077
+ * {
19078
+ * { "repeats", 'r', 0, G_OPTION_ARG_INT, &repeats, "Average over N repetitions", "N" },
19079
+ * { "max-size", 'm', 0, G_OPTION_ARG_INT, &max_size, "Test up to 2^M items", "M" },
19080
+ * { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL },
19081
+ * { "beep", 'b', 0, G_OPTION_ARG_NONE, &beep, "Beep when done", NULL },
19082
+ * { "rand", 0, 0, G_OPTION_ARG_NONE, &randomize, "Randomize the data", NULL },
19083
+ * G_OPTION_ENTRY_NULL
19084
+ * };
19085
+ *
19086
+ * int
19087
+ * main (int argc, char *argv[])
19088
+ * {
19089
+ * GError *error = NULL;
19090
+ * GOptionContext *context;
19091
+ *
19092
+ * context = g_option_context_new ("- test tree model performance");
19093
+ * g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
19094
+ * g_option_context_add_group (context, gtk_get_option_group (TRUE));
19095
+ * if (!g_option_context_parse (context, &argc, &argv, &error))
19096
+ * {
19097
+ * g_print ("option parsing failed: %s\n", error->message);
19098
+ * exit (1);
19099
+ * }
19100
+ *
19101
+ * ...
19102
+ *
19103
+ * }
19104
+ * ```
19105
+ *
19106
+ *
19107
+ * On UNIX systems, the argv that is passed to main() has no particular
19108
+ * encoding, even to the extent that different parts of it may have
19109
+ * different encodings. In general, normal arguments and flags will be
19110
+ * in the current locale and filenames should be considered to be opaque
19111
+ * byte strings. Proper use of %G_OPTION_ARG_FILENAME vs
19112
+ * %G_OPTION_ARG_STRING is therefore important.
19113
+ *
19114
+ * Note that on Windows, filenames do have an encoding, but using
19115
+ * #GOptionContext with the argv as passed to main() will result in a
19116
+ * program that can only accept commandline arguments with characters
19117
+ * from the system codepage. This can cause problems when attempting to
19118
+ * deal with filenames containing Unicode characters that fall outside
19119
+ * of the codepage.
19120
+ *
19121
+ * A solution to this is to use g_win32_get_command_line() and
19122
+ * g_option_context_parse_strv() which will properly handle full Unicode
19123
+ * filenames. If you are using #GApplication, this is done
19124
+ * automatically for you.
19125
+ *
19126
+ * The following example shows how you can use #GOptionContext directly
19127
+ * in order to correctly deal with Unicode filenames on Windows:
19128
+ *
19129
+ *
19130
+ * ```c
19131
+ * int
19132
+ * main (int argc, char **argv)
19133
+ * {
19134
+ * GError *error = NULL;
19135
+ * GOptionContext *context;
19136
+ * gchar **args;
19137
+ *
19138
+ * #ifdef G_OS_WIN32
19139
+ * args = g_win32_get_command_line ();
19140
+ * #else
19141
+ * args = g_strdupv (argv);
19142
+ * #endif
19143
+ *
19144
+ * // set up context
19145
+ *
19146
+ * if (!g_option_context_parse_strv (context, &args, &error))
19147
+ * {
19148
+ * // error happened
19149
+ * }
19150
+ *
19151
+ * ...
19152
+ *
19153
+ * g_strfreev (args);
19154
+ *
19155
+ * ...
19156
+ * }
19157
+ * ```
19158
+ *
18666
19159
  * @record
18667
19160
  */
18668
19161
  export class OptionContext {
@@ -18709,13 +19202,13 @@ export interface OptionEntry {
18709
19202
  * called to handle the extra argument. Otherwise, `arg_data` is a
18710
19203
  * pointer to a location to store the value, the required type of
18711
19204
  * the location depends on the `arg` type:
18712
- * - %G_OPTION_ARG_NONE: %gboolean
18713
- * - %G_OPTION_ARG_STRING: %gchar*
18714
- * - %G_OPTION_ARG_INT: %gint
18715
- * - %G_OPTION_ARG_FILENAME: %gchar*
18716
- * - %G_OPTION_ARG_STRING_ARRAY: %gchar**
18717
- * - %G_OPTION_ARG_FILENAME_ARRAY: %gchar**
18718
- * - %G_OPTION_ARG_DOUBLE: %gdouble
19205
+ * - %G_OPTION_ARG_NONE: %gboolean
19206
+ * - %G_OPTION_ARG_STRING: %gchar*
19207
+ * - %G_OPTION_ARG_INT: %gint
19208
+ * - %G_OPTION_ARG_FILENAME: %gchar*
19209
+ * - %G_OPTION_ARG_STRING_ARRAY: %gchar**
19210
+ * - %G_OPTION_ARG_FILENAME_ARRAY: %gchar**
19211
+ * - %G_OPTION_ARG_DOUBLE: %gdouble
18719
19212
  * If `arg` type is %G_OPTION_ARG_STRING or %G_OPTION_ARG_FILENAME,
18720
19213
  * the location will contain a newly allocated string if the option
18721
19214
  * was given. That string needs to be freed by the callee using g_free().
@@ -18817,6 +19310,11 @@ export class OptionGroup {
18817
19310
 
18818
19311
  /**
18819
19312
  * Creates a new #GOptionGroup.
19313
+ *
19314
+ * `description` is typically used to provide a title for the group. If so, it
19315
+ * is recommended that it’s written in title case, and has a trailing colon so
19316
+ * that it matches the style of built-in GLib group titles such as
19317
+ * ‘Application Options:’.
18820
19318
  * @constructor
18821
19319
  * @param name the name for the option group, this is used to provide help for the options in this group with `--help-``name`
18822
19320
  * @param description a description for this group to be shown in `--help`. This string is translated using the translation domain or translation function of the group
@@ -18828,6 +19326,11 @@ export class OptionGroup {
18828
19326
  constructor(name: string | null, description: string | null, help_description: string | null, user_data: any | null, destroy: DestroyNotify | null)
18829
19327
  /**
18830
19328
  * Creates a new #GOptionGroup.
19329
+ *
19330
+ * `description` is typically used to provide a title for the group. If so, it
19331
+ * is recommended that it’s written in title case, and has a trailing colon so
19332
+ * that it matches the style of built-in GLib group titles such as
19333
+ * ‘Application Options:’.
18831
19334
  * @constructor
18832
19335
  * @param name the name for the option group, this is used to provide help for the options in this group with `--help-``name`
18833
19336
  * @param description a description for this group to be shown in `--help`. This string is translated using the translation domain or translation function of the group
@@ -21315,7 +21818,7 @@ export interface Source {
21315
21818
  *
21316
21819
  * The source name should describe in a human-readable way
21317
21820
  * what the source does. For example, "X11 event queue"
21318
- * or "GTK+ repaint idle handler" or whatever it is.
21821
+ * or "GTK repaint idle handler" or whatever it is.
21319
21822
  *
21320
21823
  * It is permitted to call this function multiple times, but is not
21321
21824
  * recommended due to the potential performance impact. For example,
@@ -21895,6 +22398,17 @@ export class String {
21895
22398
  * @returns a new #GString
21896
22399
  */
21897
22400
  static new_len(init: string | null, len: number): String
22401
+ /**
22402
+ * Creates a new #GString, initialized with the given string.
22403
+ *
22404
+ * After this call, `init` belongs to the #GString and may no longer be
22405
+ * modified by the caller. The memory of `data` has to be dynamically
22406
+ * allocated and will eventually be freed with g_free().
22407
+ * @constructor
22408
+ * @param init initial text used as the string. Ownership of the string is transferred to the #GString. Passing %NULL creates an empty string.
22409
+ * @returns the new #GString
22410
+ */
22411
+ static new_take(init: string | null): String
21898
22412
  /**
21899
22413
  * Creates a new #GString, with enough space for `dfl_size`
21900
22414
  * bytes. This is useful if you are going to add a lot of
@@ -23046,9 +23560,9 @@ export interface Tree {
23046
23560
  * are O(log(n)).
23047
23561
  * @param key the key to insert
23048
23562
  * @param value the value corresponding to the key
23049
- * @returns the inserted (or set) node.
23563
+ * @returns the inserted (or set) node or %NULL if insertion would overflow the tree node counter.
23050
23564
  */
23051
- insert_node(key: any | null, value: any | null): TreeNode
23565
+ insert_node(key: any | null, value: any | null): TreeNode | null
23052
23566
  /**
23053
23567
  * Gets the value corresponding to the given key. Since a #GTree is
23054
23568
  * automatically balanced as key/value pairs are added, key lookup
@@ -23087,7 +23601,7 @@ export interface Tree {
23087
23601
  lower_bound(key: any | null): TreeNode | null
23088
23602
  /**
23089
23603
  * Gets the number of nodes in a #GTree.
23090
- * @returns the number of nodes in @tree
23604
+ * @returns the number of nodes in @tree The node counter value type is really a #guint, but it is returned as a #gint due to backward compatibility issues (can be cast back to #guint to support its full range of values).
23091
23605
  */
23092
23606
  nnodes(): number
23093
23607
  /**
@@ -23148,9 +23662,9 @@ export interface Tree {
23148
23662
  * so that the distance from the root to every leaf is as small as possible.
23149
23663
  * @param key the key to insert
23150
23664
  * @param value the value corresponding to the key
23151
- * @returns the inserted (or set) node.
23665
+ * @returns the inserted (or set) node or %NULL if insertion would overflow the tree node counter.
23152
23666
  */
23153
- replace_node(key: any | null, value: any | null): TreeNode
23667
+ replace_node(key: any | null, value: any | null): TreeNode | null
23154
23668
  /**
23155
23669
  * Removes a key and its associated value from a #GTree without calling
23156
23670
  * the key and value destroy functions.
@@ -23579,7 +24093,7 @@ export class Uri {
23579
24093
  *
23580
24094
  * When `host` is present, `path` must either be empty or begin with a slash (`/`)
23581
24095
  * character. When `host` is not present, `path` cannot begin with two slash
23582
- * characters (`//`). See
24096
+ * characters (`//`). See
23583
24097
  * [RFC 3986, section 3](https://tools.ietf.org/html/rfc3986#section-3).
23584
24098
  *
23585
24099
  * See also g_uri_join_with_user(), which allows specifying the
@@ -25005,8 +25519,8 @@ export class Variant {
25005
25519
  */
25006
25520
  static new_maybe(child_type: VariantType | null, child: Variant | null): Variant
25007
25521
  /**
25008
- * Creates a D-Bus object path #GVariant with the contents of `string`.
25009
- * `string` must be a valid D-Bus object path. Use
25522
+ * Creates a D-Bus object path #GVariant with the contents of `object_path`.
25523
+ * `object_path` must be a valid D-Bus object path. Use
25010
25524
  * g_variant_is_object_path() if you're not sure.
25011
25525
  * @constructor
25012
25526
  * @param object_path a normal C nul-terminated string