@girs/glib-2.0 2.76.1-3.1.0 → 2.77.0-3.2.2
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/README.md +1 -1
- package/glib-2.0.d.cts +553 -118
- package/glib-2.0.d.ts +553 -118
- package/package.json +4 -10
- package/{tsconfig.doc.json → tsconfig.json} +2 -0
- package/typedoc.json +7 -0
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](
|
|
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
|
|
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
|
|
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
|
-
*
|
|
5438
|
-
*
|
|
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
|
-
*
|
|
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
|
|
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
|
|
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.
|
|
@@ -6487,6 +6548,12 @@ export function format_size_full(size: number, flags: FormatSizeFlags): string |
|
|
|
6487
6548
|
* If you know the allocated size of `mem,` calling g_free_sized() may be faster,
|
|
6488
6549
|
* depending on the libc implementation in use.
|
|
6489
6550
|
*
|
|
6551
|
+
* Starting from GLib 2.78, this may happen automatically in case a GCC
|
|
6552
|
+
* compatible compiler is used with some optimization level and the allocated
|
|
6553
|
+
* size is known at compile time (see [documentation of
|
|
6554
|
+
* `__builtin_object_size()`](https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html)
|
|
6555
|
+
* to understand its caveats).
|
|
6556
|
+
*
|
|
6490
6557
|
* If `mem` is %NULL it simply returns, so there is no need to check `mem`
|
|
6491
6558
|
* against %NULL before calling this function.
|
|
6492
6559
|
* @param mem the memory to free
|
|
@@ -6500,6 +6567,10 @@ export function free(mem: any | null): void
|
|
|
6500
6567
|
* It is an error if `size` doesn’t match the size passed when `mem` was
|
|
6501
6568
|
* allocated. `size` is passed to this function to allow optimizations in the
|
|
6502
6569
|
* allocator. If you don’t know the allocation size, use g_free() instead.
|
|
6570
|
+
*
|
|
6571
|
+
* In case a GCC compatible compiler is used, this function may be used
|
|
6572
|
+
* automatically via g_free() if the allocated size is known at compile time,
|
|
6573
|
+
* since GLib 2.78.
|
|
6503
6574
|
* @param mem the memory to free
|
|
6504
6575
|
* @param size size of `mem,` in bytes
|
|
6505
6576
|
*/
|
|
@@ -6761,7 +6832,7 @@ export function get_os_info(key_name: string | null): string | null
|
|
|
6761
6832
|
* in contrast to g_get_application_name().
|
|
6762
6833
|
*
|
|
6763
6834
|
* If you are using #GApplication the program name is set in
|
|
6764
|
-
* g_application_run(). In case of GDK or GTK
|
|
6835
|
+
* g_application_run(). In case of GDK or GTK it is set in
|
|
6765
6836
|
* gdk_init(), which is called by gtk_init() and the
|
|
6766
6837
|
* #GtkApplication::startup handler. The program name is found by
|
|
6767
6838
|
* taking the last component of `argv[`0].
|
|
@@ -7839,7 +7910,7 @@ export function main_current_source(): Source | null
|
|
|
7839
7910
|
/**
|
|
7840
7911
|
* Returns the depth of the stack of calls to
|
|
7841
7912
|
* g_main_context_dispatch() on any #GMainContext in the current thread.
|
|
7842
|
-
*
|
|
7913
|
+
* That is, when called from the toplevel, it gives 0. When
|
|
7843
7914
|
* called from within a callback from g_main_context_iteration()
|
|
7844
7915
|
* (or g_main_loop_run(), etc.) it returns 1. When called from within
|
|
7845
7916
|
* a callback to a recursive call to g_main_context_iteration(),
|
|
@@ -8182,7 +8253,7 @@ export function option_error_quark(): Quark
|
|
|
8182
8253
|
/**
|
|
8183
8254
|
* Parses a string containing debugging options
|
|
8184
8255
|
* into a %guint containing bit flags. This is used
|
|
8185
|
-
* within GDK and GTK
|
|
8256
|
+
* within GDK and GTK to parse the debug options passed on the
|
|
8186
8257
|
* command line or through environment variables.
|
|
8187
8258
|
*
|
|
8188
8259
|
* If `string` is equal to "all", all flags are set. Any flags
|
|
@@ -8376,7 +8447,7 @@ export function propagate_error(src: Error): /* dest */ Error | null
|
|
|
8376
8447
|
* with statically allocated strings in the main program, but not with
|
|
8377
8448
|
* statically allocated memory in dynamically loaded modules, if you
|
|
8378
8449
|
* expect to ever unload the module again (e.g. do not use this
|
|
8379
|
-
* function in GTK
|
|
8450
|
+
* function in GTK theme engines).
|
|
8380
8451
|
*
|
|
8381
8452
|
* This function must not be used before library constructors have finished
|
|
8382
8453
|
* running. In particular, this means it cannot be used to initialize global
|
|
@@ -8841,7 +8912,7 @@ export function set_error_literal(domain: Quark, code: number, message: string |
|
|
|
8841
8912
|
* in contrast to g_set_application_name().
|
|
8842
8913
|
*
|
|
8843
8914
|
* If you are using #GApplication the program name is set in
|
|
8844
|
-
* g_application_run(). In case of GDK or GTK
|
|
8915
|
+
* g_application_run(). In case of GDK or GTK it is set in
|
|
8845
8916
|
* gdk_init(), which is called by gtk_init() and the
|
|
8846
8917
|
* #GtkApplication::startup handler. The program name is found by
|
|
8847
8918
|
* taking the last component of `argv[`0].
|
|
@@ -9950,7 +10021,7 @@ export function strsignal(signum: number): string | null
|
|
|
9950
10021
|
/**
|
|
9951
10022
|
* Searches the string `haystack` for the first occurrence
|
|
9952
10023
|
* of the string `needle,` limiting the length of the search
|
|
9953
|
-
* to `haystack_len
|
|
10024
|
+
* to `haystack_len` or a nul terminator byte (whichever is reached first).
|
|
9954
10025
|
* @param haystack a nul-terminated string
|
|
9955
10026
|
* @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
10027
|
* @param needle the string to search for
|
|
@@ -11186,12 +11257,15 @@ export function unix_error_quark(): Quark
|
|
|
11186
11257
|
*/
|
|
11187
11258
|
export function unix_fd_add_full(priority: number, fd: number, condition: IOCondition, function_: UnixFDSourceFunc): number
|
|
11188
11259
|
/**
|
|
11189
|
-
* Creates a #GSource to watch for a particular
|
|
11260
|
+
* Creates a #GSource to watch for a particular I/O condition on a file
|
|
11190
11261
|
* descriptor.
|
|
11191
11262
|
*
|
|
11192
|
-
* The source will never close the fd
|
|
11263
|
+
* The source will never close the `fd` — you must do it yourself.
|
|
11264
|
+
*
|
|
11265
|
+
* Any callback attached to the returned #GSource must have type
|
|
11266
|
+
* #GUnixFDSourceFunc.
|
|
11193
11267
|
* @param fd a file descriptor
|
|
11194
|
-
* @param condition
|
|
11268
|
+
* @param condition I/O conditions to watch for on `fd`
|
|
11195
11269
|
* @returns the newly created #GSource
|
|
11196
11270
|
*/
|
|
11197
11271
|
export function unix_fd_source_new(fd: number, condition: IOCondition): Source
|
|
@@ -11214,11 +11288,16 @@ export function unix_get_passwd_entry(user_name: string | null): any | null
|
|
|
11214
11288
|
/**
|
|
11215
11289
|
* Similar to the UNIX pipe() call, but on modern systems like Linux
|
|
11216
11290
|
* uses the pipe2() system call, which atomically creates a pipe with
|
|
11217
|
-
* the configured flags.
|
|
11218
|
-
*
|
|
11219
|
-
*
|
|
11291
|
+
* the configured flags.
|
|
11292
|
+
*
|
|
11293
|
+
* As of GLib 2.78, the supported flags are `FD_CLOEXEC` and `O_NONBLOCK`. Prior
|
|
11294
|
+
* to GLib 2.78, only `FD_CLOEXEC` was supported — if you wanted to configure
|
|
11295
|
+
* `O_NONBLOCK` then that had to be done separately with `fcntl()`.
|
|
11296
|
+
*
|
|
11297
|
+
* It is a programmer error to call this function with unsupported flags, and a
|
|
11298
|
+
* critical warning will be raised.
|
|
11220
11299
|
*
|
|
11221
|
-
* This function does not take
|
|
11300
|
+
* This function does not take `O_CLOEXEC`, it takes `FD_CLOEXEC` as if
|
|
11222
11301
|
* for fcntl(); these are different on Linux/glibc.
|
|
11223
11302
|
* @param fds Array of two integers
|
|
11224
11303
|
* @param flags Bitfield of file descriptor flags, as for fcntl()
|
|
@@ -11398,7 +11477,7 @@ export function uri_is_valid(uri_string: string | null, flags: UriFlags): boolea
|
|
|
11398
11477
|
*
|
|
11399
11478
|
* When `host` is present, `path` must either be empty or begin with a slash (`/`)
|
|
11400
11479
|
* character. When `host` is not present, `path` cannot begin with two slash
|
|
11401
|
-
*
|
|
11480
|
+
* characters (`//`). See
|
|
11402
11481
|
* [RFC 3986, section 3](https://tools.ietf.org/html/rfc3986#section-3).
|
|
11403
11482
|
*
|
|
11404
11483
|
* See also g_uri_join_with_user(), which allows specifying the
|
|
@@ -11997,6 +12076,17 @@ export function utf8_to_ucs4_fast(str: string | null, len: number): [ /* returnT
|
|
|
11997
12076
|
* @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
12077
|
*/
|
|
11999
12078
|
export function utf8_to_utf16(str: string | null, len: number): [ /* returnType */ number, /* items_read */ number, /* items_written */ number ]
|
|
12079
|
+
/**
|
|
12080
|
+
* Cuts off the middle of the string, preserving half of `truncate_length`
|
|
12081
|
+
* characters at the beginning and half at the end.
|
|
12082
|
+
*
|
|
12083
|
+
* If `string` is already short enough, this returns a copy of `string`.
|
|
12084
|
+
* If `truncate_length` is `0`, an empty string is returned.
|
|
12085
|
+
* @param string a nul-terminated UTF-8 encoded string
|
|
12086
|
+
* @param truncate_length the new size of `string,` in characters, including the ellipsis character
|
|
12087
|
+
* @returns a newly-allocated copy of @string ellipsized in the middle
|
|
12088
|
+
*/
|
|
12089
|
+
export function utf8_truncate_middle(string: string | null, truncate_length: number): string | null
|
|
12000
12090
|
/**
|
|
12001
12091
|
* Validates UTF-8 encoded text. `str` is the text to validate;
|
|
12002
12092
|
* if `str` is nul-terminated, then `max_len` can be -1, otherwise
|
|
@@ -12009,7 +12099,7 @@ export function utf8_to_utf16(str: string | null, len: number): [ /* returnType
|
|
|
12009
12099
|
* Note that g_utf8_validate() returns %FALSE if `max_len` is
|
|
12010
12100
|
* positive and any of the `max_len` bytes are nul.
|
|
12011
12101
|
*
|
|
12012
|
-
* Returns %TRUE if all of `str` was valid. Many GLib and GTK
|
|
12102
|
+
* Returns %TRUE if all of `str` was valid. Many GLib and GTK
|
|
12013
12103
|
* routines require valid UTF-8 as input; so data read from a file
|
|
12014
12104
|
* or the network should be checked with g_utf8_validate() before
|
|
12015
12105
|
* doing anything else with it.
|
|
@@ -12356,7 +12446,7 @@ export interface ErrorInitFunc {
|
|
|
12356
12446
|
/**
|
|
12357
12447
|
* Declares a type of function which takes an arbitrary
|
|
12358
12448
|
* data pointer argument and has no return value. It is
|
|
12359
|
-
* not currently used in GLib or GTK
|
|
12449
|
+
* not currently used in GLib or GTK.
|
|
12360
12450
|
* @callback
|
|
12361
12451
|
* @param data a data pointer
|
|
12362
12452
|
*/
|
|
@@ -13642,7 +13732,44 @@ export interface BookmarkFile {
|
|
|
13642
13732
|
}
|
|
13643
13733
|
|
|
13644
13734
|
/**
|
|
13645
|
-
*
|
|
13735
|
+
* GBookmarkFile lets you parse, edit or create files containing bookmarks
|
|
13736
|
+
* to URI, along with some meta-data about the resource pointed by the URI
|
|
13737
|
+
* like its MIME type, the application that is registering the bookmark and
|
|
13738
|
+
* the icon that should be used to represent the bookmark. The data is stored
|
|
13739
|
+
* using the
|
|
13740
|
+
* [Desktop Bookmark Specification](http://www.gnome.org/~ebassi/bookmark-spec).
|
|
13741
|
+
*
|
|
13742
|
+
* The syntax of the bookmark files is described in detail inside the
|
|
13743
|
+
* Desktop Bookmark Specification, here is a quick summary: bookmark
|
|
13744
|
+
* files use a sub-class of the XML Bookmark Exchange Language
|
|
13745
|
+
* specification, consisting of valid UTF-8 encoded XML, under the
|
|
13746
|
+
* <xbel> root element; each bookmark is stored inside a
|
|
13747
|
+
* <bookmark> element, using its URI: no relative paths can
|
|
13748
|
+
* be used inside a bookmark file. The bookmark may have a user defined
|
|
13749
|
+
* title and description, to be used instead of the URI. Under the
|
|
13750
|
+
* <metadata> element, with its owner attribute set to
|
|
13751
|
+
* `http://freedesktop.org`, is stored the meta-data about a resource
|
|
13752
|
+
* pointed by its URI. The meta-data consists of the resource's MIME
|
|
13753
|
+
* type; the applications that have registered a bookmark; the groups
|
|
13754
|
+
* to which a bookmark belongs to; a visibility flag, used to set the
|
|
13755
|
+
* bookmark as "private" to the applications and groups that has it
|
|
13756
|
+
* registered; the URI and MIME type of an icon, to be used when
|
|
13757
|
+
* displaying the bookmark inside a GUI.
|
|
13758
|
+
*
|
|
13759
|
+
* Here is an example of a bookmark file:
|
|
13760
|
+
* [bookmarks.xbel](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/glib/tests/bookmarks.xbel)
|
|
13761
|
+
*
|
|
13762
|
+
* A bookmark file might contain more than one bookmark; each bookmark
|
|
13763
|
+
* is accessed through its URI.
|
|
13764
|
+
*
|
|
13765
|
+
* The important caveat of bookmark files is that when you add a new
|
|
13766
|
+
* bookmark you must also add the application that is registering it, using
|
|
13767
|
+
* g_bookmark_file_add_application() or g_bookmark_file_set_application_info().
|
|
13768
|
+
* If a bookmark has no applications then it won't be dumped when creating
|
|
13769
|
+
* the on disk representation, using g_bookmark_file_to_data() or
|
|
13770
|
+
* g_bookmark_file_to_file().
|
|
13771
|
+
*
|
|
13772
|
+
* The #GBookmarkFile parser was added in GLib 2.12.
|
|
13646
13773
|
* @record
|
|
13647
13774
|
*/
|
|
13648
13775
|
export class BookmarkFile {
|
|
@@ -13711,8 +13838,10 @@ export class ByteArray {
|
|
|
13711
13838
|
*/
|
|
13712
13839
|
static new(): Uint8Array
|
|
13713
13840
|
/**
|
|
13714
|
-
*
|
|
13715
|
-
*
|
|
13841
|
+
* Creates a byte array containing the `data`.
|
|
13842
|
+
* After this call, `data` belongs to the #GByteArray and may no longer be
|
|
13843
|
+
* modified by the caller. The memory of `data` has to be dynamically
|
|
13844
|
+
* allocated and will eventually be freed with g_free().
|
|
13716
13845
|
*
|
|
13717
13846
|
* Do not use it if `len` is greater than %G_MAXUINT. #GByteArray
|
|
13718
13847
|
* stores the length of its data in #guint, which may be shorter than
|
|
@@ -13959,11 +14088,9 @@ export class Bytes {
|
|
|
13959
14088
|
/**
|
|
13960
14089
|
* Creates a new #GBytes from `data`.
|
|
13961
14090
|
*
|
|
13962
|
-
* After this call, `data` belongs to the
|
|
13963
|
-
* modified by the caller.
|
|
13964
|
-
*
|
|
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).
|
|
14091
|
+
* After this call, `data` belongs to the #GBytes and may no longer be
|
|
14092
|
+
* modified by the caller. The memory of `data` has to be dynamically
|
|
14093
|
+
* allocated and will eventually be freed with g_free().
|
|
13967
14094
|
*
|
|
13968
14095
|
* For creating #GBytes with memory from other allocators, see
|
|
13969
14096
|
* g_bytes_new_with_free_func().
|
|
@@ -14866,103 +14993,103 @@ export interface DateTime {
|
|
|
14866
14993
|
* Creates a newly allocated string representing the requested `format`.
|
|
14867
14994
|
*
|
|
14868
14995
|
* The format strings understood by this function are a subset of the
|
|
14869
|
-
* strftime() format language as specified by C99. The
|
|
14870
|
-
* conversions are not supported, nor is the
|
|
14871
|
-
* extensions
|
|
14872
|
-
*
|
|
14996
|
+
* `strftime()` format language as specified by C99. The `%D`, `%U` and `%W`
|
|
14997
|
+
* conversions are not supported, nor is the `E` modifier. The GNU
|
|
14998
|
+
* extensions `%k`, `%l`, `%s` and `%P` are supported, however, as are the
|
|
14999
|
+
* `0`, `_` and `-` modifiers. The Python extension `%f` is also supported.
|
|
14873
15000
|
*
|
|
14874
|
-
* In contrast to strftime()
|
|
15001
|
+
* In contrast to `strftime()`, this function always produces a UTF-8
|
|
14875
15002
|
* string, regardless of the current locale. Note that the rendering of
|
|
14876
|
-
* many formats is locale-dependent and may not match the strftime()
|
|
15003
|
+
* many formats is locale-dependent and may not match the `strftime()`
|
|
14877
15004
|
* output exactly.
|
|
14878
15005
|
*
|
|
14879
15006
|
* The following format specifiers are supported:
|
|
14880
15007
|
*
|
|
14881
|
-
* -
|
|
14882
|
-
* -
|
|
14883
|
-
* -
|
|
14884
|
-
* -
|
|
14885
|
-
* -
|
|
14886
|
-
* -
|
|
14887
|
-
* -
|
|
14888
|
-
* -
|
|
14889
|
-
* single digits are preceded by a figure space
|
|
14890
|
-
* -
|
|
14891
|
-
* -
|
|
14892
|
-
* decimal number (00-99). This works well with
|
|
14893
|
-
* -
|
|
14894
|
-
* well with
|
|
14895
|
-
* -
|
|
14896
|
-
* -
|
|
14897
|
-
* -
|
|
14898
|
-
* -
|
|
14899
|
-
* -
|
|
14900
|
-
* single digits are preceded by a figure space
|
|
14901
|
-
* -
|
|
14902
|
-
* single digits are preceded by a figure space
|
|
14903
|
-
* -
|
|
14904
|
-
* -
|
|
14905
|
-
* -
|
|
14906
|
-
* -
|
|
15008
|
+
* - `%a`: the abbreviated weekday name according to the current locale
|
|
15009
|
+
* - `%A`: the full weekday name according to the current locale
|
|
15010
|
+
* - `%b`: the abbreviated month name according to the current locale
|
|
15011
|
+
* - `%B`: the full month name according to the current locale
|
|
15012
|
+
* - `%c`: the preferred date and time representation for the current locale
|
|
15013
|
+
* - `%C`: the century number (year/100) as a 2-digit integer (00-99)
|
|
15014
|
+
* - `%d`: the day of the month as a decimal number (range 01 to 31)
|
|
15015
|
+
* - `%e`: the day of the month as a decimal number (range 1 to 31);
|
|
15016
|
+
* single digits are preceded by a figure space (U+2007)
|
|
15017
|
+
* - `%F`: equivalent to `%Y-%m-%d` (the ISO 8601 date format)
|
|
15018
|
+
* - `%g`: the last two digits of the ISO 8601 week-based year as a
|
|
15019
|
+
* decimal number (00-99). This works well with `%V` and `%u`.
|
|
15020
|
+
* - `%G`: the ISO 8601 week-based year as a decimal number. This works
|
|
15021
|
+
* well with `%V` and `%u`.
|
|
15022
|
+
* - `%h`: equivalent to `%b`
|
|
15023
|
+
* - `%H`: the hour as a decimal number using a 24-hour clock (range 00 to 23)
|
|
15024
|
+
* - `%I`: the hour as a decimal number using a 12-hour clock (range 01 to 12)
|
|
15025
|
+
* - `%j`: the day of the year as a decimal number (range 001 to 366)
|
|
15026
|
+
* - `%k`: the hour (24-hour clock) as a decimal number (range 0 to 23);
|
|
15027
|
+
* single digits are preceded by a figure space (U+2007)
|
|
15028
|
+
* - `%l`: the hour (12-hour clock) as a decimal number (range 1 to 12);
|
|
15029
|
+
* single digits are preceded by a figure space (U+2007)
|
|
15030
|
+
* - `%m`: the month as a decimal number (range 01 to 12)
|
|
15031
|
+
* - `%M`: the minute as a decimal number (range 00 to 59)
|
|
15032
|
+
* - `%f`: the microsecond as a decimal number (range 000000 to 999999)
|
|
15033
|
+
* - `%p`: either ‘AM’ or ‘PM’ according to the given time value, or the
|
|
14907
15034
|
* corresponding strings for the current locale. Noon is treated as
|
|
14908
|
-
*
|
|
14909
|
-
* many locales have no concept of AM/PM formatting. Use
|
|
14910
|
-
* -
|
|
15035
|
+
* ‘PM’ and midnight as ‘AM’. Use of this format specifier is discouraged, as
|
|
15036
|
+
* many locales have no concept of AM/PM formatting. Use `%c` or `%X` instead.
|
|
15037
|
+
* - `%P`: like `%p` but lowercase: ‘am’ or ‘pm’ or a corresponding string for
|
|
14911
15038
|
* the current locale. Use of this format specifier is discouraged, as
|
|
14912
|
-
* many locales have no concept of AM/PM formatting. Use
|
|
14913
|
-
* -
|
|
14914
|
-
* discouraged, as many locales have no concept of AM/PM formatting. Use
|
|
14915
|
-
* or
|
|
14916
|
-
* -
|
|
14917
|
-
* -
|
|
15039
|
+
* many locales have no concept of AM/PM formatting. Use `%c` or `%X` instead.
|
|
15040
|
+
* - `%r`: the time in a.m. or p.m. notation. Use of this format specifier is
|
|
15041
|
+
* discouraged, as many locales have no concept of AM/PM formatting. Use `%c`
|
|
15042
|
+
* or `%X` instead.
|
|
15043
|
+
* - `%R`: the time in 24-hour notation (`%H:%M`)
|
|
15044
|
+
* - `%s`: the number of seconds since the Epoch, that is, since 1970-01-01
|
|
14918
15045
|
* 00:00:00 UTC
|
|
14919
|
-
* -
|
|
14920
|
-
* -
|
|
14921
|
-
* -
|
|
14922
|
-
* -
|
|
14923
|
-
* Monday being 1. This works well with
|
|
14924
|
-
* -
|
|
15046
|
+
* - `%S`: the second as a decimal number (range 00 to 60)
|
|
15047
|
+
* - `%t`: a tab character
|
|
15048
|
+
* - `%T`: the time in 24-hour notation with seconds (`%H:%M:%S`)
|
|
15049
|
+
* - `%u`: the ISO 8601 standard day of the week as a decimal, range 1 to 7,
|
|
15050
|
+
* Monday being 1. This works well with `%G` and `%V`.
|
|
15051
|
+
* - `%V`: the ISO 8601 standard week number of the current year as a decimal
|
|
14925
15052
|
* number, range 01 to 53, where week 1 is the first week that has at
|
|
14926
15053
|
* least 4 days in the new year. See g_date_time_get_week_of_year().
|
|
14927
|
-
* This works well with
|
|
14928
|
-
* -
|
|
14929
|
-
* This is not the ISO 8601 standard format
|
|
14930
|
-
* -
|
|
15054
|
+
* This works well with `%G` and `%u`.
|
|
15055
|
+
* - `%w`: the day of the week as a decimal, range 0 to 6, Sunday being 0.
|
|
15056
|
+
* This is not the ISO 8601 standard format — use `%u` instead.
|
|
15057
|
+
* - `%x`: the preferred date representation for the current locale without
|
|
14931
15058
|
* the time
|
|
14932
|
-
* -
|
|
15059
|
+
* - `%X`: the preferred time representation for the current locale without
|
|
14933
15060
|
* the date
|
|
14934
|
-
* -
|
|
14935
|
-
* -
|
|
14936
|
-
* -
|
|
14937
|
-
* -
|
|
14938
|
-
* This is a gnulib strftime() extension. Since: 2.38
|
|
14939
|
-
* -
|
|
14940
|
-
* gnulib strftime() extension. Since: 2.38
|
|
14941
|
-
* -
|
|
14942
|
-
* precision (e.g.,
|
|
14943
|
-
* -
|
|
14944
|
-
* -
|
|
15061
|
+
* - `%y`: the year as a decimal number without the century
|
|
15062
|
+
* - `%Y`: the year as a decimal number including the century
|
|
15063
|
+
* - `%z`: the time zone as an offset from UTC (`+hhmm`)
|
|
15064
|
+
* - `%:z`: the time zone as an offset from UTC (`+hh:mm`).
|
|
15065
|
+
* This is a gnulib `strftime()` extension. Since: 2.38
|
|
15066
|
+
* - `%::z`: the time zone as an offset from UTC (`+hh:mm:ss`). This is a
|
|
15067
|
+
* gnulib `strftime()` extension. Since: 2.38
|
|
15068
|
+
* - `%:::z`: the time zone as an offset from UTC, with `:` to necessary
|
|
15069
|
+
* precision (e.g., `-04`, `+05:30`). This is a gnulib `strftime()` extension. Since: 2.38
|
|
15070
|
+
* - `%Z`: the time zone or name or abbreviation
|
|
15071
|
+
* - `%%`: a literal `%` character
|
|
14945
15072
|
*
|
|
14946
15073
|
* Some conversion specifications can be modified by preceding the
|
|
14947
15074
|
* conversion specifier by one or more modifier characters. The
|
|
14948
15075
|
* following modifiers are supported for many of the numeric
|
|
14949
15076
|
* conversions:
|
|
14950
15077
|
*
|
|
14951
|
-
* - O
|
|
14952
|
-
* - _
|
|
15078
|
+
* - `O`: Use alternative numeric symbols, if the current locale supports those.
|
|
15079
|
+
* - `_`: Pad a numeric result with spaces. This overrides the default padding
|
|
14953
15080
|
* for the specifier.
|
|
14954
|
-
* -
|
|
15081
|
+
* - `-`: Do not pad a numeric result. This overrides the default padding
|
|
14955
15082
|
* for the specifier.
|
|
14956
|
-
* - 0
|
|
15083
|
+
* - `0`: Pad a numeric result with zeros. This overrides the default padding
|
|
14957
15084
|
* for the specifier.
|
|
14958
15085
|
*
|
|
14959
|
-
* Additionally, when O is used with B
|
|
15086
|
+
* Additionally, when `O` is used with `B`, `b`, or `h`, it produces the alternative
|
|
14960
15087
|
* form of a month name. The alternative form should be used when the month
|
|
14961
15088
|
* name is used without a day number (e.g., standalone). It is required in
|
|
14962
15089
|
* some languages (Baltic, Slavic, Greek, and more) due to their grammatical
|
|
14963
|
-
* rules. For other languages there is no difference.
|
|
14964
|
-
* strftime() extension expected to be added to the future POSIX specification,
|
|
14965
|
-
*
|
|
15090
|
+
* rules. For other languages there is no difference. `%OB` is a GNU and BSD
|
|
15091
|
+
* `strftime()` extension expected to be added to the future POSIX specification,
|
|
15092
|
+
* `%Ob` and `%Oh` are GNU `strftime()` extensions. Since: 2.56
|
|
14966
15093
|
* @param format a valid UTF-8 string, containing the format for the #GDateTime
|
|
14967
15094
|
* @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
15095
|
*/
|
|
@@ -17076,8 +17203,146 @@ export interface KeyFile {
|
|
|
17076
17203
|
}
|
|
17077
17204
|
|
|
17078
17205
|
/**
|
|
17079
|
-
*
|
|
17080
|
-
*
|
|
17206
|
+
* #GKeyFile lets you parse, edit or create files containing groups of
|
|
17207
|
+
* key-value pairs, which we call "key files" for lack of a better name.
|
|
17208
|
+
* Several freedesktop.org specifications use key files now, e.g the
|
|
17209
|
+
* [Desktop Entry Specification](http://freedesktop.org/Standards/desktop-entry-spec)
|
|
17210
|
+
* and the
|
|
17211
|
+
* [Icon Theme Specification](http://freedesktop.org/Standards/icon-theme-spec).
|
|
17212
|
+
*
|
|
17213
|
+
* The syntax of key files is described in detail in the
|
|
17214
|
+
* [Desktop Entry Specification](http://freedesktop.org/Standards/desktop-entry-spec),
|
|
17215
|
+
* here is a quick summary: Key files
|
|
17216
|
+
* consists of groups of key-value pairs, interspersed with comments.
|
|
17217
|
+
*
|
|
17218
|
+
*
|
|
17219
|
+
* ```
|
|
17220
|
+
* # this is just an example
|
|
17221
|
+
* # there can be comments before the first group
|
|
17222
|
+
*
|
|
17223
|
+
* [First Group]
|
|
17224
|
+
*
|
|
17225
|
+
* Name=Key File Example\tthis value shows\nescaping
|
|
17226
|
+
*
|
|
17227
|
+
* # localized strings are stored in multiple key-value pairs
|
|
17228
|
+
* Welcome=Hello
|
|
17229
|
+
* Welcome[de]=Hallo
|
|
17230
|
+
* Welcome[fr_FR]=Bonjour
|
|
17231
|
+
* Welcome[it]=Ciao
|
|
17232
|
+
* Welcome[be`latin]`=Hello
|
|
17233
|
+
*
|
|
17234
|
+
* [Another Group]
|
|
17235
|
+
*
|
|
17236
|
+
* Numbers=2;20;-200;0
|
|
17237
|
+
*
|
|
17238
|
+
* Booleans=true;false;true;true
|
|
17239
|
+
* ```
|
|
17240
|
+
*
|
|
17241
|
+
*
|
|
17242
|
+
* Lines beginning with a '#' and blank lines are considered comments.
|
|
17243
|
+
*
|
|
17244
|
+
* Groups are started by a header line containing the group name enclosed
|
|
17245
|
+
* in '[' and ']', and ended implicitly by the start of the next group or
|
|
17246
|
+
* the end of the file. Each key-value pair must be contained in a group.
|
|
17247
|
+
*
|
|
17248
|
+
* Key-value pairs generally have the form `key=value`, with the
|
|
17249
|
+
* exception of localized strings, which have the form
|
|
17250
|
+
* `key[locale]=value`, with a locale identifier of the
|
|
17251
|
+
* form `lang_COUNTRY`MODIFIER`` where `COUNTRY` and `MODIFIER`
|
|
17252
|
+
* are optional.
|
|
17253
|
+
* Space before and after the '=' character are ignored. Newline, tab,
|
|
17254
|
+
* carriage return and backslash characters in value are escaped as \n,
|
|
17255
|
+
* \t, \r, and \\\\, respectively. To preserve leading spaces in values,
|
|
17256
|
+
* these can also be escaped as \s.
|
|
17257
|
+
*
|
|
17258
|
+
* Key files can store strings (possibly with localized variants), integers,
|
|
17259
|
+
* booleans and lists of these. Lists are separated by a separator character,
|
|
17260
|
+
* typically ';' or ','. To use the list separator character in a value in
|
|
17261
|
+
* a list, it has to be escaped by prefixing it with a backslash.
|
|
17262
|
+
*
|
|
17263
|
+
* This syntax is obviously inspired by the .ini files commonly met
|
|
17264
|
+
* on Windows, but there are some important differences:
|
|
17265
|
+
*
|
|
17266
|
+
* - .ini files use the ';' character to begin comments,
|
|
17267
|
+
* key files use the '#' character.
|
|
17268
|
+
*
|
|
17269
|
+
* - Key files do not allow for ungrouped keys meaning only
|
|
17270
|
+
* comments can precede the first group.
|
|
17271
|
+
*
|
|
17272
|
+
* - Key files are always encoded in UTF-8.
|
|
17273
|
+
*
|
|
17274
|
+
* - Key and Group names are case-sensitive. For example, a group called
|
|
17275
|
+
* [GROUP] is a different from [group].
|
|
17276
|
+
*
|
|
17277
|
+
* - .ini files don't have a strongly typed boolean entry type,
|
|
17278
|
+
* they only have GetProfileInt(). In key files, only
|
|
17279
|
+
* true and false (in lower case) are allowed.
|
|
17280
|
+
*
|
|
17281
|
+
* Note that in contrast to the
|
|
17282
|
+
* [Desktop Entry Specification](http://freedesktop.org/Standards/desktop-entry-spec),
|
|
17283
|
+
* groups in key files may contain the same
|
|
17284
|
+
* key multiple times; the last entry wins. Key files may also contain
|
|
17285
|
+
* multiple groups with the same name; they are merged together.
|
|
17286
|
+
* Another difference is that keys and group names in key files are not
|
|
17287
|
+
* restricted to ASCII characters.
|
|
17288
|
+
*
|
|
17289
|
+
* Here is an example of loading a key file and reading a value:
|
|
17290
|
+
*
|
|
17291
|
+
*
|
|
17292
|
+
* ```c
|
|
17293
|
+
* g_autoptr(GError) error = NULL;
|
|
17294
|
+
* g_autoptr(GKeyFile) key_file = g_key_file_new ();
|
|
17295
|
+
*
|
|
17296
|
+
* if (!g_key_file_load_from_file (key_file, "key-file.ini", flags, &error))
|
|
17297
|
+
* {
|
|
17298
|
+
* if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
|
|
17299
|
+
* g_warning ("Error loading key file: %s", error->message);
|
|
17300
|
+
* return;
|
|
17301
|
+
* }
|
|
17302
|
+
*
|
|
17303
|
+
* g_autofree gchar *val = g_key_file_get_string (key_file, "Group Name", "SomeKey", &error);
|
|
17304
|
+
* if (val == NULL &&
|
|
17305
|
+
* !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND))
|
|
17306
|
+
* {
|
|
17307
|
+
* g_warning ("Error finding key in key file: %s", error->message);
|
|
17308
|
+
* return;
|
|
17309
|
+
* }
|
|
17310
|
+
* else if (val == NULL)
|
|
17311
|
+
* {
|
|
17312
|
+
* // Fall back to a default value.
|
|
17313
|
+
* val = g_strdup ("default-value");
|
|
17314
|
+
* }
|
|
17315
|
+
* ```
|
|
17316
|
+
*
|
|
17317
|
+
*
|
|
17318
|
+
* Here is an example of creating and saving a key file:
|
|
17319
|
+
*
|
|
17320
|
+
*
|
|
17321
|
+
* ```c
|
|
17322
|
+
* g_autoptr(GKeyFile) key_file = g_key_file_new ();
|
|
17323
|
+
* const gchar *val = …;
|
|
17324
|
+
* g_autoptr(GError) error = NULL;
|
|
17325
|
+
*
|
|
17326
|
+
* g_key_file_set_string (key_file, "Group Name", "SomeKey", val);
|
|
17327
|
+
*
|
|
17328
|
+
* // Save as a file.
|
|
17329
|
+
* if (!g_key_file_save_to_file (key_file, "key-file.ini", &error))
|
|
17330
|
+
* {
|
|
17331
|
+
* g_warning ("Error saving key file: %s", error->message);
|
|
17332
|
+
* return;
|
|
17333
|
+
* }
|
|
17334
|
+
*
|
|
17335
|
+
* // Or store to a GBytes for use elsewhere.
|
|
17336
|
+
* gsize data_len;
|
|
17337
|
+
* g_autofree guint8 *data = (guint8 *) g_key_file_to_data (key_file, &data_len, &error);
|
|
17338
|
+
* if (data == NULL)
|
|
17339
|
+
* {
|
|
17340
|
+
* g_warning ("Error saving key file: %s", error->message);
|
|
17341
|
+
* return;
|
|
17342
|
+
* }
|
|
17343
|
+
* g_autoptr(GBytes) bytes = g_bytes_new_take (g_steal_pointer (&data), data_len);
|
|
17344
|
+
* ```
|
|
17345
|
+
*
|
|
17081
17346
|
* @record
|
|
17082
17347
|
*/
|
|
17083
17348
|
export class KeyFile {
|
|
@@ -17195,7 +17460,7 @@ export interface MainContext {
|
|
|
17195
17460
|
*
|
|
17196
17461
|
* You must be the owner of a context before you
|
|
17197
17462
|
* can call g_main_context_prepare(), g_main_context_query(),
|
|
17198
|
-
* g_main_context_check(), g_main_context_dispatch().
|
|
17463
|
+
* g_main_context_check(), g_main_context_dispatch(), g_main_context_release().
|
|
17199
17464
|
*
|
|
17200
17465
|
* Since 2.76 `context` can be %NULL to use the global-default
|
|
17201
17466
|
* main context.
|
|
@@ -17391,6 +17656,9 @@ export interface MainContext {
|
|
|
17391
17656
|
* with g_main_context_acquire(). If the context was acquired multiple
|
|
17392
17657
|
* times, the ownership will be released only when g_main_context_release()
|
|
17393
17658
|
* is called as many times as it was acquired.
|
|
17659
|
+
*
|
|
17660
|
+
* You must have successfully acquired the context with
|
|
17661
|
+
* g_main_context_acquire() before you may call this function.
|
|
17394
17662
|
*/
|
|
17395
17663
|
release(): void
|
|
17396
17664
|
/**
|
|
@@ -17562,7 +17830,7 @@ export interface MainLoop {
|
|
|
17562
17830
|
|
|
17563
17831
|
/**
|
|
17564
17832
|
* The `GMainLoop` struct is an opaque data type
|
|
17565
|
-
* representing the main event loop of a GLib or GTK
|
|
17833
|
+
* representing the main event loop of a GLib or GTK application.
|
|
17566
17834
|
* @record
|
|
17567
17835
|
*/
|
|
17568
17836
|
export class MainLoop {
|
|
@@ -18660,9 +18928,165 @@ export interface OptionContext {
|
|
|
18660
18928
|
}
|
|
18661
18929
|
|
|
18662
18930
|
/**
|
|
18663
|
-
*
|
|
18664
|
-
*
|
|
18665
|
-
*
|
|
18931
|
+
* The GOption commandline parser is intended to be a simpler replacement
|
|
18932
|
+
* for the popt library. It supports short and long commandline options,
|
|
18933
|
+
* as shown in the following example:
|
|
18934
|
+
*
|
|
18935
|
+
* `testtreemodel -r 1 --max-size 20 --rand --display=:1.0 -vb -- file1 file2`
|
|
18936
|
+
*
|
|
18937
|
+
* The example demonstrates a number of features of the GOption
|
|
18938
|
+
* commandline parser:
|
|
18939
|
+
*
|
|
18940
|
+
* - Options can be single letters, prefixed by a single dash.
|
|
18941
|
+
*
|
|
18942
|
+
* - Multiple short options can be grouped behind a single dash.
|
|
18943
|
+
*
|
|
18944
|
+
* - Long options are prefixed by two consecutive dashes.
|
|
18945
|
+
*
|
|
18946
|
+
* - Options can have an extra argument, which can be a number, a string or
|
|
18947
|
+
* a filename. For long options, the extra argument can be appended with
|
|
18948
|
+
* an equals sign after the option name, which is useful if the extra
|
|
18949
|
+
* argument starts with a dash, which would otherwise cause it to be
|
|
18950
|
+
* interpreted as another option.
|
|
18951
|
+
*
|
|
18952
|
+
* - Non-option arguments are returned to the application as rest arguments.
|
|
18953
|
+
*
|
|
18954
|
+
* - An argument consisting solely of two dashes turns off further parsing,
|
|
18955
|
+
* any remaining arguments (even those starting with a dash) are returned
|
|
18956
|
+
* to the application as rest arguments.
|
|
18957
|
+
*
|
|
18958
|
+
* Another important feature of GOption is that it can automatically
|
|
18959
|
+
* generate nicely formatted help output. Unless it is explicitly turned
|
|
18960
|
+
* off with g_option_context_set_help_enabled(), GOption will recognize
|
|
18961
|
+
* the `--help`, `-?`, `--help-all` and `--help-groupname` options
|
|
18962
|
+
* (where `groupname` is the name of a #GOptionGroup) and write a text
|
|
18963
|
+
* similar to the one shown in the following example to stdout.
|
|
18964
|
+
*
|
|
18965
|
+
*
|
|
18966
|
+
* ```
|
|
18967
|
+
* Usage:
|
|
18968
|
+
* testtreemodel [OPTION...] - test tree model performance
|
|
18969
|
+
*
|
|
18970
|
+
* Help Options:
|
|
18971
|
+
* -h, --help Show help options
|
|
18972
|
+
* --help-all Show all help options
|
|
18973
|
+
* --help-gtk Show GTK Options
|
|
18974
|
+
*
|
|
18975
|
+
* Application Options:
|
|
18976
|
+
* -r, --repeats=N Average over N repetitions
|
|
18977
|
+
* -m, --max-size=M Test up to 2^M items
|
|
18978
|
+
* --display=DISPLAY X display to use
|
|
18979
|
+
* -v, --verbose Be verbose
|
|
18980
|
+
* -b, --beep Beep when done
|
|
18981
|
+
* --rand Randomize the data
|
|
18982
|
+
* ```
|
|
18983
|
+
*
|
|
18984
|
+
*
|
|
18985
|
+
* GOption groups options in #GOptionGroups, which makes it easy to
|
|
18986
|
+
* incorporate options from multiple sources. The intended use for this is
|
|
18987
|
+
* to let applications collect option groups from the libraries it uses,
|
|
18988
|
+
* add them to their #GOptionContext, and parse all options by a single call
|
|
18989
|
+
* to g_option_context_parse(). See gtk_get_option_group() for an example.
|
|
18990
|
+
*
|
|
18991
|
+
* If an option is declared to be of type string or filename, GOption takes
|
|
18992
|
+
* care of converting it to the right encoding; strings are returned in
|
|
18993
|
+
* UTF-8, filenames are returned in the GLib filename encoding. Note that
|
|
18994
|
+
* this only works if setlocale() has been called before
|
|
18995
|
+
* g_option_context_parse().
|
|
18996
|
+
*
|
|
18997
|
+
* Here is a complete example of setting up GOption to parse the example
|
|
18998
|
+
* commandline above and produce the example help output.
|
|
18999
|
+
*
|
|
19000
|
+
* ```c
|
|
19001
|
+
* static gint repeats = 2;
|
|
19002
|
+
* static gint max_size = 8;
|
|
19003
|
+
* static gboolean verbose = FALSE;
|
|
19004
|
+
* static gboolean beep = FALSE;
|
|
19005
|
+
* static gboolean randomize = FALSE;
|
|
19006
|
+
*
|
|
19007
|
+
* static GOptionEntry entries[] =
|
|
19008
|
+
* {
|
|
19009
|
+
* { "repeats", 'r', 0, G_OPTION_ARG_INT, &repeats, "Average over N repetitions", "N" },
|
|
19010
|
+
* { "max-size", 'm', 0, G_OPTION_ARG_INT, &max_size, "Test up to 2^M items", "M" },
|
|
19011
|
+
* { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL },
|
|
19012
|
+
* { "beep", 'b', 0, G_OPTION_ARG_NONE, &beep, "Beep when done", NULL },
|
|
19013
|
+
* { "rand", 0, 0, G_OPTION_ARG_NONE, &randomize, "Randomize the data", NULL },
|
|
19014
|
+
* G_OPTION_ENTRY_NULL
|
|
19015
|
+
* };
|
|
19016
|
+
*
|
|
19017
|
+
* int
|
|
19018
|
+
* main (int argc, char *argv[])
|
|
19019
|
+
* {
|
|
19020
|
+
* GError *error = NULL;
|
|
19021
|
+
* GOptionContext *context;
|
|
19022
|
+
*
|
|
19023
|
+
* context = g_option_context_new ("- test tree model performance");
|
|
19024
|
+
* g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
|
|
19025
|
+
* g_option_context_add_group (context, gtk_get_option_group (TRUE));
|
|
19026
|
+
* if (!g_option_context_parse (context, &argc, &argv, &error))
|
|
19027
|
+
* {
|
|
19028
|
+
* g_print ("option parsing failed: %s\n", error->message);
|
|
19029
|
+
* exit (1);
|
|
19030
|
+
* }
|
|
19031
|
+
*
|
|
19032
|
+
* ...
|
|
19033
|
+
*
|
|
19034
|
+
* }
|
|
19035
|
+
* ```
|
|
19036
|
+
*
|
|
19037
|
+
*
|
|
19038
|
+
* On UNIX systems, the argv that is passed to main() has no particular
|
|
19039
|
+
* encoding, even to the extent that different parts of it may have
|
|
19040
|
+
* different encodings. In general, normal arguments and flags will be
|
|
19041
|
+
* in the current locale and filenames should be considered to be opaque
|
|
19042
|
+
* byte strings. Proper use of %G_OPTION_ARG_FILENAME vs
|
|
19043
|
+
* %G_OPTION_ARG_STRING is therefore important.
|
|
19044
|
+
*
|
|
19045
|
+
* Note that on Windows, filenames do have an encoding, but using
|
|
19046
|
+
* #GOptionContext with the argv as passed to main() will result in a
|
|
19047
|
+
* program that can only accept commandline arguments with characters
|
|
19048
|
+
* from the system codepage. This can cause problems when attempting to
|
|
19049
|
+
* deal with filenames containing Unicode characters that fall outside
|
|
19050
|
+
* of the codepage.
|
|
19051
|
+
*
|
|
19052
|
+
* A solution to this is to use g_win32_get_command_line() and
|
|
19053
|
+
* g_option_context_parse_strv() which will properly handle full Unicode
|
|
19054
|
+
* filenames. If you are using #GApplication, this is done
|
|
19055
|
+
* automatically for you.
|
|
19056
|
+
*
|
|
19057
|
+
* The following example shows how you can use #GOptionContext directly
|
|
19058
|
+
* in order to correctly deal with Unicode filenames on Windows:
|
|
19059
|
+
*
|
|
19060
|
+
*
|
|
19061
|
+
* ```c
|
|
19062
|
+
* int
|
|
19063
|
+
* main (int argc, char **argv)
|
|
19064
|
+
* {
|
|
19065
|
+
* GError *error = NULL;
|
|
19066
|
+
* GOptionContext *context;
|
|
19067
|
+
* gchar **args;
|
|
19068
|
+
*
|
|
19069
|
+
* #ifdef G_OS_WIN32
|
|
19070
|
+
* args = g_win32_get_command_line ();
|
|
19071
|
+
* #else
|
|
19072
|
+
* args = g_strdupv (argv);
|
|
19073
|
+
* #endif
|
|
19074
|
+
*
|
|
19075
|
+
* // set up context
|
|
19076
|
+
*
|
|
19077
|
+
* if (!g_option_context_parse_strv (context, &args, &error))
|
|
19078
|
+
* {
|
|
19079
|
+
* // error happened
|
|
19080
|
+
* }
|
|
19081
|
+
*
|
|
19082
|
+
* ...
|
|
19083
|
+
*
|
|
19084
|
+
* g_strfreev (args);
|
|
19085
|
+
*
|
|
19086
|
+
* ...
|
|
19087
|
+
* }
|
|
19088
|
+
* ```
|
|
19089
|
+
*
|
|
18666
19090
|
* @record
|
|
18667
19091
|
*/
|
|
18668
19092
|
export class OptionContext {
|
|
@@ -21315,7 +21739,7 @@ export interface Source {
|
|
|
21315
21739
|
*
|
|
21316
21740
|
* The source name should describe in a human-readable way
|
|
21317
21741
|
* what the source does. For example, "X11 event queue"
|
|
21318
|
-
* or "GTK
|
|
21742
|
+
* or "GTK repaint idle handler" or whatever it is.
|
|
21319
21743
|
*
|
|
21320
21744
|
* It is permitted to call this function multiple times, but is not
|
|
21321
21745
|
* recommended due to the potential performance impact. For example,
|
|
@@ -21895,6 +22319,17 @@ export class String {
|
|
|
21895
22319
|
* @returns a new #GString
|
|
21896
22320
|
*/
|
|
21897
22321
|
static new_len(init: string | null, len: number): String
|
|
22322
|
+
/**
|
|
22323
|
+
* Creates a new #GString, initialized with the given string.
|
|
22324
|
+
*
|
|
22325
|
+
* After this call, `init` belongs to the #GString and may no longer be
|
|
22326
|
+
* modified by the caller. The memory of `data` has to be dynamically
|
|
22327
|
+
* allocated and will eventually be freed with g_free().
|
|
22328
|
+
* @constructor
|
|
22329
|
+
* @param init initial text used as the string. Ownership of the string is transferred to the #GString. Passing %NULL creates an empty string.
|
|
22330
|
+
* @returns the new #GString
|
|
22331
|
+
*/
|
|
22332
|
+
static new_take(init: string | null): String
|
|
21898
22333
|
/**
|
|
21899
22334
|
* Creates a new #GString, with enough space for `dfl_size`
|
|
21900
22335
|
* bytes. This is useful if you are going to add a lot of
|
|
@@ -23579,7 +24014,7 @@ export class Uri {
|
|
|
23579
24014
|
*
|
|
23580
24015
|
* When `host` is present, `path` must either be empty or begin with a slash (`/`)
|
|
23581
24016
|
* character. When `host` is not present, `path` cannot begin with two slash
|
|
23582
|
-
*
|
|
24017
|
+
* characters (`//`). See
|
|
23583
24018
|
* [RFC 3986, section 3](https://tools.ietf.org/html/rfc3986#section-3).
|
|
23584
24019
|
*
|
|
23585
24020
|
* See also g_uri_join_with_user(), which allows specifying the
|
|
@@ -25005,8 +25440,8 @@ export class Variant {
|
|
|
25005
25440
|
*/
|
|
25006
25441
|
static new_maybe(child_type: VariantType | null, child: Variant | null): Variant
|
|
25007
25442
|
/**
|
|
25008
|
-
* Creates a D-Bus object path #GVariant with the contents of `
|
|
25009
|
-
* `
|
|
25443
|
+
* Creates a D-Bus object path #GVariant with the contents of `object_path`.
|
|
25444
|
+
* `object_path` must be a valid D-Bus object path. Use
|
|
25010
25445
|
* g_variant_is_object_path() if you're not sure.
|
|
25011
25446
|
* @constructor
|
|
25012
25447
|
* @param object_path a normal C nul-terminated string
|