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