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