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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  ![downloads/week](https://img.shields.io/npm/dw/@girs/gobject-2.0)
6
6
 
7
7
 
8
- GJS TypeScript type definitions for GObject-2.0, generated from library version 2.76.1 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v3.2.3.
8
+ GJS TypeScript type definitions for GObject-2.0, generated from library version 2.78.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v3.2.4.
9
9
 
10
10
  GObject provides the object system used for Pango and GTK+.
11
11
 
package/gobject-2.0.d.cts CHANGED
@@ -238,7 +238,7 @@ export enum SignalMatchType {
238
238
  * These flags used to be passed to g_type_init_with_debug_flags() which
239
239
  * is now deprecated.
240
240
  *
241
- * If you need to enable debugging features, use the GOBJECT_DEBUG
241
+ * If you need to enable debugging features, use the `GOBJECT_DEBUG`
242
242
  * environment variable.
243
243
  * @bitfield
244
244
  */
@@ -1329,12 +1329,18 @@ export function signal_handler_is_connected(instance: Object, handler_id: number
1329
1329
  export function signal_handler_unblock(instance: Object, handler_id: number): void
1330
1330
  /**
1331
1331
  * Blocks all handlers on an instance that match a certain selection criteria.
1332
- * The criteria mask is passed as an OR-ed combination of #GSignalMatchType
1333
- * flags, and the criteria values are passed as arguments.
1334
- * Passing at least one of the %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC
1332
+ *
1333
+ * The criteria mask is passed as a combination of #GSignalMatchType flags, and
1334
+ * the criteria values are passed as arguments. A handler must match on all
1335
+ * flags set in `mask` to be blocked (i.e. the match is conjunctive).
1336
+ *
1337
+ * Passing at least one of the %G_SIGNAL_MATCH_ID, %G_SIGNAL_MATCH_CLOSURE,
1338
+ * %G_SIGNAL_MATCH_FUNC
1335
1339
  * or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
1336
1340
  * If no handlers were found, 0 is returned, the number of blocked handlers
1337
1341
  * otherwise.
1342
+ *
1343
+ * Support for %G_SIGNAL_MATCH_ID was added in GLib 2.78.
1338
1344
  * @param instance The instance to block handlers from.
1339
1345
  * @param mask Mask indicating which of `signal_id,` `detail,` `closure,` `func` and/or `data` the handlers have to match.
1340
1346
  * @param signal_id Signal the handlers have to be connected to.
@@ -1353,13 +1359,19 @@ export function signal_handlers_block_matched(instance: Object, mask: SignalMatc
1353
1359
  export function signal_handlers_destroy(instance: Object): void
1354
1360
  /**
1355
1361
  * Disconnects all handlers on an instance that match a certain
1356
- * selection criteria. The criteria mask is passed as an OR-ed
1357
- * combination of #GSignalMatchType flags, and the criteria values are
1358
- * passed as arguments. Passing at least one of the
1359
- * %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC or
1362
+ * selection criteria.
1363
+ *
1364
+ * The criteria mask is passed as a combination of #GSignalMatchType flags, and
1365
+ * the criteria values are passed as arguments. A handler must match on all
1366
+ * flags set in `mask` to be disconnected (i.e. the match is conjunctive).
1367
+ *
1368
+ * Passing at least one of the %G_SIGNAL_MATCH_ID, %G_SIGNAL_MATCH_CLOSURE,
1369
+ * %G_SIGNAL_MATCH_FUNC or
1360
1370
  * %G_SIGNAL_MATCH_DATA match flags is required for successful
1361
1371
  * matches. If no handlers were found, 0 is returned, the number of
1362
1372
  * disconnected handlers otherwise.
1373
+ *
1374
+ * Support for %G_SIGNAL_MATCH_ID was added in GLib 2.78.
1363
1375
  * @param instance The instance to remove handlers from.
1364
1376
  * @param mask Mask indicating which of `signal_id,` `detail,` `closure,` `func` and/or `data` the handlers have to match.
1365
1377
  * @param signal_id Signal the handlers have to be connected to.
@@ -1371,13 +1383,20 @@ export function signal_handlers_destroy(instance: Object): void
1371
1383
  export function signal_handlers_disconnect_matched(instance: Object, mask: SignalMatchType, signal_id: number, detail: GLib.Quark, func: any | null, data: any | null): number
1372
1384
  /**
1373
1385
  * Unblocks all handlers on an instance that match a certain selection
1374
- * criteria. The criteria mask is passed as an OR-ed combination of
1375
- * #GSignalMatchType flags, and the criteria values are passed as arguments.
1376
- * Passing at least one of the %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC
1386
+ * criteria.
1387
+ *
1388
+ * The criteria mask is passed as a combination of #GSignalMatchType flags, and
1389
+ * the criteria values are passed as arguments. A handler must match on all
1390
+ * flags set in `mask` to be unblocked (i.e. the match is conjunctive).
1391
+ *
1392
+ * Passing at least one of the %G_SIGNAL_MATCH_ID, %G_SIGNAL_MATCH_CLOSURE,
1393
+ * %G_SIGNAL_MATCH_FUNC
1377
1394
  * or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
1378
1395
  * If no handlers were found, 0 is returned, the number of unblocked handlers
1379
1396
  * otherwise. The match criteria should not apply to any handlers that are
1380
1397
  * not currently blocked.
1398
+ *
1399
+ * Support for %G_SIGNAL_MATCH_ID was added in GLib 2.78.
1381
1400
  * @param instance The instance to unblock handlers from.
1382
1401
  * @param mask Mask indicating which of `signal_id,` `detail,` `closure,` `func` and/or `data` the handlers have to match.
1383
1402
  * @param signal_id Signal the handlers have to be connected to.
@@ -1737,8 +1756,8 @@ export function type_fundamental_next(): GType
1737
1756
  /**
1738
1757
  * Returns the number of instances allocated of the particular type;
1739
1758
  * this is only available if GLib is built with debugging support and
1740
- * the instance_count debug flag is set (by setting the GOBJECT_DEBUG
1741
- * variable to include instance-count).
1759
+ * the `instance-count` debug flag is set (by setting the `GOBJECT_DEBUG`
1760
+ * variable to include `instance-count`).
1742
1761
  * @param type a #GType
1743
1762
  * @returns the number of instances allocated of the given type; if instance counts are not available, returns 0.
1744
1763
  */
@@ -1781,7 +1800,7 @@ export function type_init(): void
1781
1800
  * flags. Since GLib 2.36, the type system is initialised automatically
1782
1801
  * and this function does nothing.
1783
1802
  *
1784
- * If you need to enable debugging features, use the GOBJECT_DEBUG
1803
+ * If you need to enable debugging features, use the `GOBJECT_DEBUG`
1785
1804
  * environment variable.
1786
1805
  * @param debug_flags bitwise combination of #GTypeDebugFlags values for debugging purposes
1787
1806
  */
@@ -1887,11 +1906,15 @@ export function type_parent(type: GType): GType
1887
1906
  export function type_qname(type: GType): GLib.Quark
1888
1907
  /**
1889
1908
  * Queries the type system for information about a specific type.
1909
+ *
1890
1910
  * This function will fill in a user-provided structure to hold
1891
1911
  * type-specific information. If an invalid #GType is passed in, the
1892
1912
  * `type` member of the #GTypeQuery is 0. All members filled into the
1893
1913
  * #GTypeQuery structure should be considered constant and have to be
1894
1914
  * left untouched.
1915
+ *
1916
+ * Since GLib 2.78, this function allows queries on dynamic types. Previously
1917
+ * it only supported static types.
1895
1918
  * @param type #GType of a static, classed type
1896
1919
  */
1897
1920
  export function type_query(type: GType): /* query */ TypeQuery
@@ -2388,6 +2411,226 @@ export interface TypePluginUnuse {
2388
2411
  export interface TypePluginUse {
2389
2412
  (plugin: TypePlugin): void
2390
2413
  }
2414
+ /**
2415
+ * This function is responsible for converting the values collected from
2416
+ * a variadic argument list into contents suitable for storage in a #GValue.
2417
+ *
2418
+ * This function should setup `value` similar to #GTypeValueInitFunc; e.g.
2419
+ * for a string value that does not allow `NULL` pointers, it needs to either
2420
+ * emit an error, or do an implicit conversion by storing an empty string.
2421
+ *
2422
+ * The `value` passed in to this function has a zero-filled data array, so
2423
+ * just like for #GTypeValueInitFunc it is guaranteed to not contain any old
2424
+ * contents that might need freeing.
2425
+ *
2426
+ * The `n_collect_values` argument is the string length of the `collect_format`
2427
+ * field of #GTypeValueTable, and `collect_values` is an array of #GTypeCValue
2428
+ * with length of `n_collect_values,` containing the collected values according
2429
+ * to `collect_format`.
2430
+ *
2431
+ * The `collect_flags` argument provided as a hint by the caller. It may
2432
+ * contain the flag %G_VALUE_NOCOPY_CONTENTS indicating that the collected
2433
+ * value contents may be considered ‘static’ for the duration of the `value`
2434
+ * lifetime. Thus an extra copy of the contents stored in `collect_values` is
2435
+ * not required for assignment to `value`.
2436
+ *
2437
+ * For our above string example, we continue with:
2438
+ *
2439
+ *
2440
+ * ```c
2441
+ * if (!collect_values[0].v_pointer)
2442
+ * value->data[0].v_pointer = g_strdup ("");
2443
+ * else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
2444
+ * {
2445
+ * value->data[0].v_pointer = collect_values[0].v_pointer;
2446
+ * // keep a flag for the value_free() implementation to not free this string
2447
+ * value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
2448
+ * }
2449
+ * else
2450
+ * value->data[0].v_pointer = g_strdup (collect_values[0].v_pointer);
2451
+ * return NULL;
2452
+ * ```
2453
+ *
2454
+ *
2455
+ * It should be noted, that it is generally a bad idea to follow the
2456
+ * %G_VALUE_NOCOPY_CONTENTS hint for reference counted types. Due to
2457
+ * reentrancy requirements and reference count assertions performed
2458
+ * by the signal emission code, reference counts should always be
2459
+ * incremented for reference counted contents stored in the `value->data`
2460
+ * array. To deviate from our string example for a moment, and taking
2461
+ * a look at an exemplary implementation for `GTypeValueTable.collect_value()`
2462
+ * of `GObject`:
2463
+ *
2464
+ *
2465
+ * ```c
2466
+ * GObject *object = G_OBJECT (collect_values[0].v_pointer);
2467
+ * g_return_val_if_fail (object != NULL,
2468
+ * g_strdup_printf ("Object %p passed as invalid NULL pointer", object));
2469
+ * // never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types
2470
+ * value->data[0].v_pointer = g_object_ref (object);
2471
+ * return NULL;
2472
+ * ```
2473
+ *
2474
+ *
2475
+ * The reference count for valid objects is always incremented, regardless
2476
+ * of `collect_flags`. For invalid objects, the example returns a newly
2477
+ * allocated string without altering `value`.
2478
+ *
2479
+ * Upon success, `collect_value()` needs to return `NULL`. If, however,
2480
+ * an error condition occurred, `collect_value()` should return a newly
2481
+ * allocated string containing an error diagnostic.
2482
+ *
2483
+ * The calling code makes no assumptions about the `value` contents being
2484
+ * valid upon error returns, `value` is simply thrown away without further
2485
+ * freeing. As such, it is a good idea to not allocate `GValue` contents
2486
+ * prior to returning an error; however, `collect_values()` is not obliged
2487
+ * to return a correctly setup `value` for error returns, simply because
2488
+ * any non-`NULL` return is considered a fatal programming error, and
2489
+ * further program behaviour is undefined.
2490
+ * @callback
2491
+ * @param value the value to initialize
2492
+ * @param collect_values the collected values
2493
+ * @param collect_flags optional flags
2494
+ * @returns `NULL` on success, otherwise a newly allocated error string on failure
2495
+ */
2496
+ export interface TypeValueCollectFunc {
2497
+ (value: any, collect_values: TypeCValue[], collect_flags: number): string | null
2498
+ }
2499
+ /**
2500
+ * Copies the content of a #GValue into another.
2501
+ *
2502
+ * The `dest_value` is a #GValue with zero-filled data section and `src_value`
2503
+ * is a properly initialized #GValue of same type, or derived type.
2504
+ *
2505
+ * The purpose of this function is to copy the contents of `src_value`
2506
+ * into `dest_value` in a way, that even after `src_value` has been freed, the
2507
+ * contents of `dest_value` remain valid. String type example:
2508
+ *
2509
+ *
2510
+ * ```c
2511
+ * dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
2512
+ * ```
2513
+ *
2514
+ * @callback
2515
+ * @param src_value the value to copy
2516
+ */
2517
+ export interface TypeValueCopyFunc {
2518
+ (src_value: any): void
2519
+ }
2520
+ /**
2521
+ * Frees any old contents that might be left in the `value->data` array of
2522
+ * the given value.
2523
+ *
2524
+ * No resources may remain allocated through the #GValue contents after this
2525
+ * function returns. E.g. for our above string type:
2526
+ *
2527
+ *
2528
+ * ```c
2529
+ * // only free strings without a specific flag for static storage
2530
+ * if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
2531
+ * g_free (value->data[0].v_pointer);
2532
+ * ```
2533
+ *
2534
+ * @callback
2535
+ * @param value the value to free
2536
+ */
2537
+ export interface TypeValueFreeFunc {
2538
+ (value: any): void
2539
+ }
2540
+ /**
2541
+ * Initializes the value contents by setting the fields of the `value->data`
2542
+ * array.
2543
+ *
2544
+ * The data array of the #GValue passed into this function was zero-filled
2545
+ * with `memset()`, so no care has to be taken to free any old contents.
2546
+ * For example, in the case of a string value that may never be %NULL, the
2547
+ * implementation might look like:
2548
+ *
2549
+ *
2550
+ * ```c
2551
+ * value->data[0].v_pointer = g_strdup ("");
2552
+ * ```
2553
+ *
2554
+ * @callback
2555
+ * @param value the value to initialize
2556
+ */
2557
+ export interface TypeValueInitFunc {
2558
+ (value: any): void
2559
+ }
2560
+ /**
2561
+ * This function is responsible for storing the `value`
2562
+ * contents into arguments passed through a variadic argument list which
2563
+ * got collected into `collect_values` according to `lcopy_format`.
2564
+ *
2565
+ * The `n_collect_values` argument equals the string length of
2566
+ * `lcopy_format`, and `collect_flags` may contain %G_VALUE_NOCOPY_CONTENTS.
2567
+ *
2568
+ * In contrast to #GTypeValueCollectFunc, this function is obliged to always
2569
+ * properly support %G_VALUE_NOCOPY_CONTENTS.
2570
+ *
2571
+ * Similar to #GTypeValueCollectFunc the function may prematurely abort by
2572
+ * returning a newly allocated string describing an error condition. To
2573
+ * complete the string example:
2574
+ *
2575
+ *
2576
+ * ```c
2577
+ * gchar **string_p = collect_values[0].v_pointer;
2578
+ * g_return_val_if_fail (string_p != NULL,
2579
+ * g_strdup ("string location passed as NULL"));
2580
+ *
2581
+ * if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
2582
+ * *string_p = value->data[0].v_pointer;
2583
+ * else
2584
+ * *string_p = g_strdup (value->data[0].v_pointer);
2585
+ * ```
2586
+ *
2587
+ *
2588
+ * And an illustrative version of this function for reference-counted
2589
+ * types:
2590
+ *
2591
+ *
2592
+ * ```c
2593
+ * GObject **object_p = collect_values[0].v_pointer;
2594
+ * g_return_val_if_fail (object_p != NULL,
2595
+ * g_strdup ("object location passed as NULL"));
2596
+ *
2597
+ * if (value->data[0].v_pointer == NULL)
2598
+ * *object_p = NULL;
2599
+ * else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) // always honour
2600
+ * *object_p = value->data[0].v_pointer;
2601
+ * else
2602
+ * *object_p = g_object_ref (value->data[0].v_pointer);
2603
+ *
2604
+ * return NULL;
2605
+ * ```
2606
+ *
2607
+ * @callback
2608
+ * @param value the value to lcopy
2609
+ * @param collect_values the collected locations for storage
2610
+ * @param collect_flags optional flags
2611
+ * @returns `NULL` on success, otherwise a newly allocated error string on failure
2612
+ */
2613
+ export interface TypeValueLCopyFunc {
2614
+ (value: any, collect_values: TypeCValue[], collect_flags: number): string | null
2615
+ }
2616
+ /**
2617
+ * If the value contents fit into a pointer, such as objects or strings,
2618
+ * return this pointer, so the caller can peek at the current contents.
2619
+ *
2620
+ * To extend on our above string example:
2621
+ *
2622
+ *
2623
+ * ```c
2624
+ * return value->data[0].v_pointer;
2625
+ * ```
2626
+ *
2627
+ * @callback
2628
+ * @param value the value to peek
2629
+ * @returns a pointer to the value contents
2630
+ */
2631
+ export interface TypeValuePeekPointerFunc {
2632
+ (value: any): any | null
2633
+ }
2391
2634
  /**
2392
2635
  * The type of value transformation functions which can be registered with
2393
2636
  * g_value_register_transform_func().
@@ -6647,35 +6890,62 @@ export interface TypeValueTable {
6647
6890
 
6648
6891
  // Own fields of GObject-2.0.GObject.TypeValueTable
6649
6892
 
6650
- value_init: (value: any) => void
6651
- value_free: (value: any) => void
6652
- value_copy: (src_value: any, dest_value: any) => void
6653
- value_peek_pointer: (value: any) => any
6893
+ /**
6894
+ * Function to initialize a GValue
6895
+ * @field
6896
+ */
6897
+ value_init: TypeValueInitFunc
6898
+ /**
6899
+ * Function to free a GValue
6900
+ * @field
6901
+ */
6902
+ value_free: TypeValueFreeFunc
6903
+ /**
6904
+ * Function to copy a GValue
6905
+ * @field
6906
+ */
6907
+ value_copy: TypeValueCopyFunc
6908
+ /**
6909
+ * Function to peek the contents of a GValue if they fit
6910
+ * into a pointer
6911
+ * @field
6912
+ */
6913
+ value_peek_pointer: TypeValuePeekPointerFunc
6654
6914
  /**
6655
6915
  * A string format describing how to collect the contents of
6656
- * this value bit-by-bit. Each character in the format represents
6657
- * an argument to be collected, and the characters themselves indicate
6658
- * the type of the argument. Currently supported arguments are:
6659
- * - 'i' - Integers. passed as collect_values[].v_int.
6660
- * - 'l' - Longs. passed as collect_values[].v_long.
6661
- * - 'd' - Doubles. passed as collect_values[].v_double.
6662
- * - 'p' - Pointers. passed as collect_values[].v_pointer.
6663
- * It should be noted that for variable argument list construction,
6664
- * ANSI C promotes every type smaller than an integer to an int, and
6665
- * floats to doubles. So for collection of short int or char, 'i'
6666
- * needs to be used, and for collection of floats 'd'.
6916
+ * this value bit-by-bit. Each character in the format represents
6917
+ * an argument to be collected, and the characters themselves indicate
6918
+ * the type of the argument. Currently supported arguments are:
6919
+ * - `'i'`: Integers, passed as `collect_values[].v_int`
6920
+ * - `'l'`: Longs, passed as `collect_values[].v_long`
6921
+ * - `'d'`: Doubles, passed as `collect_values[].v_double`
6922
+ * - `'p'`: Pointers, passed as `collect_values[].v_pointer`
6923
+ * It should be noted that for variable argument list construction,
6924
+ * ANSI C promotes every type smaller than an integer to an int, and
6925
+ * floats to doubles. So for collection of short int or char, `'i'`
6926
+ * needs to be used, and for collection of floats `'d'`.
6667
6927
  * @field
6668
6928
  */
6669
6929
  collect_format: string | null
6670
- collect_value: (value: any, n_collect_values: number, collect_values: TypeCValue, collect_flags: number) => string | null
6930
+ /**
6931
+ * Function to initialize a GValue from the values
6932
+ * collected from variadic arguments
6933
+ * @field
6934
+ */
6935
+ collect_value: TypeValueCollectFunc
6671
6936
  /**
6672
6937
  * Format description of the arguments to collect for `lcopy_value,`
6673
- * analogous to `collect_format`. Usually, `lcopy_format` string consists
6674
- * only of 'p's to provide lcopy_value() with pointers to storage locations.
6938
+ * analogous to `collect_format`. Usually, `lcopy_format` string consists
6939
+ * only of `'p'`s to provide lcopy_value() with pointers to storage locations.
6675
6940
  * @field
6676
6941
  */
6677
6942
  lcopy_format: string | null
6678
- lcopy_value: (value: any, n_collect_values: number, collect_values: TypeCValue, collect_flags: number) => string | null
6943
+ /**
6944
+ * Function to store the contents of a value into the
6945
+ * locations collected from variadic arguments
6946
+ * @field
6947
+ */
6948
+ lcopy_value: TypeValueLCopyFunc
6679
6949
  }
6680
6950
 
6681
6951
  /**
package/gobject-2.0.d.ts CHANGED
@@ -240,7 +240,7 @@ enum SignalMatchType {
240
240
  * These flags used to be passed to g_type_init_with_debug_flags() which
241
241
  * is now deprecated.
242
242
  *
243
- * If you need to enable debugging features, use the GOBJECT_DEBUG
243
+ * If you need to enable debugging features, use the `GOBJECT_DEBUG`
244
244
  * environment variable.
245
245
  * @bitfield
246
246
  */
@@ -1331,12 +1331,18 @@ function signal_handler_is_connected(instance: Object, handler_id: number): bool
1331
1331
  function signal_handler_unblock(instance: Object, handler_id: number): void
1332
1332
  /**
1333
1333
  * Blocks all handlers on an instance that match a certain selection criteria.
1334
- * The criteria mask is passed as an OR-ed combination of #GSignalMatchType
1335
- * flags, and the criteria values are passed as arguments.
1336
- * Passing at least one of the %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC
1334
+ *
1335
+ * The criteria mask is passed as a combination of #GSignalMatchType flags, and
1336
+ * the criteria values are passed as arguments. A handler must match on all
1337
+ * flags set in `mask` to be blocked (i.e. the match is conjunctive).
1338
+ *
1339
+ * Passing at least one of the %G_SIGNAL_MATCH_ID, %G_SIGNAL_MATCH_CLOSURE,
1340
+ * %G_SIGNAL_MATCH_FUNC
1337
1341
  * or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
1338
1342
  * If no handlers were found, 0 is returned, the number of blocked handlers
1339
1343
  * otherwise.
1344
+ *
1345
+ * Support for %G_SIGNAL_MATCH_ID was added in GLib 2.78.
1340
1346
  * @param instance The instance to block handlers from.
1341
1347
  * @param mask Mask indicating which of `signal_id,` `detail,` `closure,` `func` and/or `data` the handlers have to match.
1342
1348
  * @param signal_id Signal the handlers have to be connected to.
@@ -1355,13 +1361,19 @@ function signal_handlers_block_matched(instance: Object, mask: SignalMatchType,
1355
1361
  function signal_handlers_destroy(instance: Object): void
1356
1362
  /**
1357
1363
  * Disconnects all handlers on an instance that match a certain
1358
- * selection criteria. The criteria mask is passed as an OR-ed
1359
- * combination of #GSignalMatchType flags, and the criteria values are
1360
- * passed as arguments. Passing at least one of the
1361
- * %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC or
1364
+ * selection criteria.
1365
+ *
1366
+ * The criteria mask is passed as a combination of #GSignalMatchType flags, and
1367
+ * the criteria values are passed as arguments. A handler must match on all
1368
+ * flags set in `mask` to be disconnected (i.e. the match is conjunctive).
1369
+ *
1370
+ * Passing at least one of the %G_SIGNAL_MATCH_ID, %G_SIGNAL_MATCH_CLOSURE,
1371
+ * %G_SIGNAL_MATCH_FUNC or
1362
1372
  * %G_SIGNAL_MATCH_DATA match flags is required for successful
1363
1373
  * matches. If no handlers were found, 0 is returned, the number of
1364
1374
  * disconnected handlers otherwise.
1375
+ *
1376
+ * Support for %G_SIGNAL_MATCH_ID was added in GLib 2.78.
1365
1377
  * @param instance The instance to remove handlers from.
1366
1378
  * @param mask Mask indicating which of `signal_id,` `detail,` `closure,` `func` and/or `data` the handlers have to match.
1367
1379
  * @param signal_id Signal the handlers have to be connected to.
@@ -1373,13 +1385,20 @@ function signal_handlers_destroy(instance: Object): void
1373
1385
  function signal_handlers_disconnect_matched(instance: Object, mask: SignalMatchType, signal_id: number, detail: GLib.Quark, func: any | null, data: any | null): number
1374
1386
  /**
1375
1387
  * Unblocks all handlers on an instance that match a certain selection
1376
- * criteria. The criteria mask is passed as an OR-ed combination of
1377
- * #GSignalMatchType flags, and the criteria values are passed as arguments.
1378
- * Passing at least one of the %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC
1388
+ * criteria.
1389
+ *
1390
+ * The criteria mask is passed as a combination of #GSignalMatchType flags, and
1391
+ * the criteria values are passed as arguments. A handler must match on all
1392
+ * flags set in `mask` to be unblocked (i.e. the match is conjunctive).
1393
+ *
1394
+ * Passing at least one of the %G_SIGNAL_MATCH_ID, %G_SIGNAL_MATCH_CLOSURE,
1395
+ * %G_SIGNAL_MATCH_FUNC
1379
1396
  * or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
1380
1397
  * If no handlers were found, 0 is returned, the number of unblocked handlers
1381
1398
  * otherwise. The match criteria should not apply to any handlers that are
1382
1399
  * not currently blocked.
1400
+ *
1401
+ * Support for %G_SIGNAL_MATCH_ID was added in GLib 2.78.
1383
1402
  * @param instance The instance to unblock handlers from.
1384
1403
  * @param mask Mask indicating which of `signal_id,` `detail,` `closure,` `func` and/or `data` the handlers have to match.
1385
1404
  * @param signal_id Signal the handlers have to be connected to.
@@ -1739,8 +1758,8 @@ function type_fundamental_next(): GType
1739
1758
  /**
1740
1759
  * Returns the number of instances allocated of the particular type;
1741
1760
  * this is only available if GLib is built with debugging support and
1742
- * the instance_count debug flag is set (by setting the GOBJECT_DEBUG
1743
- * variable to include instance-count).
1761
+ * the `instance-count` debug flag is set (by setting the `GOBJECT_DEBUG`
1762
+ * variable to include `instance-count`).
1744
1763
  * @param type a #GType
1745
1764
  * @returns the number of instances allocated of the given type; if instance counts are not available, returns 0.
1746
1765
  */
@@ -1783,7 +1802,7 @@ function type_init(): void
1783
1802
  * flags. Since GLib 2.36, the type system is initialised automatically
1784
1803
  * and this function does nothing.
1785
1804
  *
1786
- * If you need to enable debugging features, use the GOBJECT_DEBUG
1805
+ * If you need to enable debugging features, use the `GOBJECT_DEBUG`
1787
1806
  * environment variable.
1788
1807
  * @param debug_flags bitwise combination of #GTypeDebugFlags values for debugging purposes
1789
1808
  */
@@ -1889,11 +1908,15 @@ function type_parent(type: GType): GType
1889
1908
  function type_qname(type: GType): GLib.Quark
1890
1909
  /**
1891
1910
  * Queries the type system for information about a specific type.
1911
+ *
1892
1912
  * This function will fill in a user-provided structure to hold
1893
1913
  * type-specific information. If an invalid #GType is passed in, the
1894
1914
  * `type` member of the #GTypeQuery is 0. All members filled into the
1895
1915
  * #GTypeQuery structure should be considered constant and have to be
1896
1916
  * left untouched.
1917
+ *
1918
+ * Since GLib 2.78, this function allows queries on dynamic types. Previously
1919
+ * it only supported static types.
1897
1920
  * @param type #GType of a static, classed type
1898
1921
  */
1899
1922
  function type_query(type: GType): /* query */ TypeQuery
@@ -2390,6 +2413,226 @@ interface TypePluginUnuse {
2390
2413
  interface TypePluginUse {
2391
2414
  (plugin: TypePlugin): void
2392
2415
  }
2416
+ /**
2417
+ * This function is responsible for converting the values collected from
2418
+ * a variadic argument list into contents suitable for storage in a #GValue.
2419
+ *
2420
+ * This function should setup `value` similar to #GTypeValueInitFunc; e.g.
2421
+ * for a string value that does not allow `NULL` pointers, it needs to either
2422
+ * emit an error, or do an implicit conversion by storing an empty string.
2423
+ *
2424
+ * The `value` passed in to this function has a zero-filled data array, so
2425
+ * just like for #GTypeValueInitFunc it is guaranteed to not contain any old
2426
+ * contents that might need freeing.
2427
+ *
2428
+ * The `n_collect_values` argument is the string length of the `collect_format`
2429
+ * field of #GTypeValueTable, and `collect_values` is an array of #GTypeCValue
2430
+ * with length of `n_collect_values,` containing the collected values according
2431
+ * to `collect_format`.
2432
+ *
2433
+ * The `collect_flags` argument provided as a hint by the caller. It may
2434
+ * contain the flag %G_VALUE_NOCOPY_CONTENTS indicating that the collected
2435
+ * value contents may be considered ‘static’ for the duration of the `value`
2436
+ * lifetime. Thus an extra copy of the contents stored in `collect_values` is
2437
+ * not required for assignment to `value`.
2438
+ *
2439
+ * For our above string example, we continue with:
2440
+ *
2441
+ *
2442
+ * ```c
2443
+ * if (!collect_values[0].v_pointer)
2444
+ * value->data[0].v_pointer = g_strdup ("");
2445
+ * else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
2446
+ * {
2447
+ * value->data[0].v_pointer = collect_values[0].v_pointer;
2448
+ * // keep a flag for the value_free() implementation to not free this string
2449
+ * value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
2450
+ * }
2451
+ * else
2452
+ * value->data[0].v_pointer = g_strdup (collect_values[0].v_pointer);
2453
+ * return NULL;
2454
+ * ```
2455
+ *
2456
+ *
2457
+ * It should be noted, that it is generally a bad idea to follow the
2458
+ * %G_VALUE_NOCOPY_CONTENTS hint for reference counted types. Due to
2459
+ * reentrancy requirements and reference count assertions performed
2460
+ * by the signal emission code, reference counts should always be
2461
+ * incremented for reference counted contents stored in the `value->data`
2462
+ * array. To deviate from our string example for a moment, and taking
2463
+ * a look at an exemplary implementation for `GTypeValueTable.collect_value()`
2464
+ * of `GObject`:
2465
+ *
2466
+ *
2467
+ * ```c
2468
+ * GObject *object = G_OBJECT (collect_values[0].v_pointer);
2469
+ * g_return_val_if_fail (object != NULL,
2470
+ * g_strdup_printf ("Object %p passed as invalid NULL pointer", object));
2471
+ * // never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types
2472
+ * value->data[0].v_pointer = g_object_ref (object);
2473
+ * return NULL;
2474
+ * ```
2475
+ *
2476
+ *
2477
+ * The reference count for valid objects is always incremented, regardless
2478
+ * of `collect_flags`. For invalid objects, the example returns a newly
2479
+ * allocated string without altering `value`.
2480
+ *
2481
+ * Upon success, `collect_value()` needs to return `NULL`. If, however,
2482
+ * an error condition occurred, `collect_value()` should return a newly
2483
+ * allocated string containing an error diagnostic.
2484
+ *
2485
+ * The calling code makes no assumptions about the `value` contents being
2486
+ * valid upon error returns, `value` is simply thrown away without further
2487
+ * freeing. As such, it is a good idea to not allocate `GValue` contents
2488
+ * prior to returning an error; however, `collect_values()` is not obliged
2489
+ * to return a correctly setup `value` for error returns, simply because
2490
+ * any non-`NULL` return is considered a fatal programming error, and
2491
+ * further program behaviour is undefined.
2492
+ * @callback
2493
+ * @param value the value to initialize
2494
+ * @param collect_values the collected values
2495
+ * @param collect_flags optional flags
2496
+ * @returns `NULL` on success, otherwise a newly allocated error string on failure
2497
+ */
2498
+ interface TypeValueCollectFunc {
2499
+ (value: any, collect_values: TypeCValue[], collect_flags: number): string | null
2500
+ }
2501
+ /**
2502
+ * Copies the content of a #GValue into another.
2503
+ *
2504
+ * The `dest_value` is a #GValue with zero-filled data section and `src_value`
2505
+ * is a properly initialized #GValue of same type, or derived type.
2506
+ *
2507
+ * The purpose of this function is to copy the contents of `src_value`
2508
+ * into `dest_value` in a way, that even after `src_value` has been freed, the
2509
+ * contents of `dest_value` remain valid. String type example:
2510
+ *
2511
+ *
2512
+ * ```c
2513
+ * dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
2514
+ * ```
2515
+ *
2516
+ * @callback
2517
+ * @param src_value the value to copy
2518
+ */
2519
+ interface TypeValueCopyFunc {
2520
+ (src_value: any): void
2521
+ }
2522
+ /**
2523
+ * Frees any old contents that might be left in the `value->data` array of
2524
+ * the given value.
2525
+ *
2526
+ * No resources may remain allocated through the #GValue contents after this
2527
+ * function returns. E.g. for our above string type:
2528
+ *
2529
+ *
2530
+ * ```c
2531
+ * // only free strings without a specific flag for static storage
2532
+ * if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
2533
+ * g_free (value->data[0].v_pointer);
2534
+ * ```
2535
+ *
2536
+ * @callback
2537
+ * @param value the value to free
2538
+ */
2539
+ interface TypeValueFreeFunc {
2540
+ (value: any): void
2541
+ }
2542
+ /**
2543
+ * Initializes the value contents by setting the fields of the `value->data`
2544
+ * array.
2545
+ *
2546
+ * The data array of the #GValue passed into this function was zero-filled
2547
+ * with `memset()`, so no care has to be taken to free any old contents.
2548
+ * For example, in the case of a string value that may never be %NULL, the
2549
+ * implementation might look like:
2550
+ *
2551
+ *
2552
+ * ```c
2553
+ * value->data[0].v_pointer = g_strdup ("");
2554
+ * ```
2555
+ *
2556
+ * @callback
2557
+ * @param value the value to initialize
2558
+ */
2559
+ interface TypeValueInitFunc {
2560
+ (value: any): void
2561
+ }
2562
+ /**
2563
+ * This function is responsible for storing the `value`
2564
+ * contents into arguments passed through a variadic argument list which
2565
+ * got collected into `collect_values` according to `lcopy_format`.
2566
+ *
2567
+ * The `n_collect_values` argument equals the string length of
2568
+ * `lcopy_format`, and `collect_flags` may contain %G_VALUE_NOCOPY_CONTENTS.
2569
+ *
2570
+ * In contrast to #GTypeValueCollectFunc, this function is obliged to always
2571
+ * properly support %G_VALUE_NOCOPY_CONTENTS.
2572
+ *
2573
+ * Similar to #GTypeValueCollectFunc the function may prematurely abort by
2574
+ * returning a newly allocated string describing an error condition. To
2575
+ * complete the string example:
2576
+ *
2577
+ *
2578
+ * ```c
2579
+ * gchar **string_p = collect_values[0].v_pointer;
2580
+ * g_return_val_if_fail (string_p != NULL,
2581
+ * g_strdup ("string location passed as NULL"));
2582
+ *
2583
+ * if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
2584
+ * *string_p = value->data[0].v_pointer;
2585
+ * else
2586
+ * *string_p = g_strdup (value->data[0].v_pointer);
2587
+ * ```
2588
+ *
2589
+ *
2590
+ * And an illustrative version of this function for reference-counted
2591
+ * types:
2592
+ *
2593
+ *
2594
+ * ```c
2595
+ * GObject **object_p = collect_values[0].v_pointer;
2596
+ * g_return_val_if_fail (object_p != NULL,
2597
+ * g_strdup ("object location passed as NULL"));
2598
+ *
2599
+ * if (value->data[0].v_pointer == NULL)
2600
+ * *object_p = NULL;
2601
+ * else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) // always honour
2602
+ * *object_p = value->data[0].v_pointer;
2603
+ * else
2604
+ * *object_p = g_object_ref (value->data[0].v_pointer);
2605
+ *
2606
+ * return NULL;
2607
+ * ```
2608
+ *
2609
+ * @callback
2610
+ * @param value the value to lcopy
2611
+ * @param collect_values the collected locations for storage
2612
+ * @param collect_flags optional flags
2613
+ * @returns `NULL` on success, otherwise a newly allocated error string on failure
2614
+ */
2615
+ interface TypeValueLCopyFunc {
2616
+ (value: any, collect_values: TypeCValue[], collect_flags: number): string | null
2617
+ }
2618
+ /**
2619
+ * If the value contents fit into a pointer, such as objects or strings,
2620
+ * return this pointer, so the caller can peek at the current contents.
2621
+ *
2622
+ * To extend on our above string example:
2623
+ *
2624
+ *
2625
+ * ```c
2626
+ * return value->data[0].v_pointer;
2627
+ * ```
2628
+ *
2629
+ * @callback
2630
+ * @param value the value to peek
2631
+ * @returns a pointer to the value contents
2632
+ */
2633
+ interface TypeValuePeekPointerFunc {
2634
+ (value: any): any | null
2635
+ }
2393
2636
  /**
2394
2637
  * The type of value transformation functions which can be registered with
2395
2638
  * g_value_register_transform_func().
@@ -6649,35 +6892,62 @@ interface TypeValueTable {
6649
6892
 
6650
6893
  // Own fields of GObject-2.0.GObject.TypeValueTable
6651
6894
 
6652
- value_init: (value: any) => void
6653
- value_free: (value: any) => void
6654
- value_copy: (src_value: any, dest_value: any) => void
6655
- value_peek_pointer: (value: any) => any
6895
+ /**
6896
+ * Function to initialize a GValue
6897
+ * @field
6898
+ */
6899
+ value_init: TypeValueInitFunc
6900
+ /**
6901
+ * Function to free a GValue
6902
+ * @field
6903
+ */
6904
+ value_free: TypeValueFreeFunc
6905
+ /**
6906
+ * Function to copy a GValue
6907
+ * @field
6908
+ */
6909
+ value_copy: TypeValueCopyFunc
6910
+ /**
6911
+ * Function to peek the contents of a GValue if they fit
6912
+ * into a pointer
6913
+ * @field
6914
+ */
6915
+ value_peek_pointer: TypeValuePeekPointerFunc
6656
6916
  /**
6657
6917
  * A string format describing how to collect the contents of
6658
- * this value bit-by-bit. Each character in the format represents
6659
- * an argument to be collected, and the characters themselves indicate
6660
- * the type of the argument. Currently supported arguments are:
6661
- * - 'i' - Integers. passed as collect_values[].v_int.
6662
- * - 'l' - Longs. passed as collect_values[].v_long.
6663
- * - 'd' - Doubles. passed as collect_values[].v_double.
6664
- * - 'p' - Pointers. passed as collect_values[].v_pointer.
6665
- * It should be noted that for variable argument list construction,
6666
- * ANSI C promotes every type smaller than an integer to an int, and
6667
- * floats to doubles. So for collection of short int or char, 'i'
6668
- * needs to be used, and for collection of floats 'd'.
6918
+ * this value bit-by-bit. Each character in the format represents
6919
+ * an argument to be collected, and the characters themselves indicate
6920
+ * the type of the argument. Currently supported arguments are:
6921
+ * - `'i'`: Integers, passed as `collect_values[].v_int`
6922
+ * - `'l'`: Longs, passed as `collect_values[].v_long`
6923
+ * - `'d'`: Doubles, passed as `collect_values[].v_double`
6924
+ * - `'p'`: Pointers, passed as `collect_values[].v_pointer`
6925
+ * It should be noted that for variable argument list construction,
6926
+ * ANSI C promotes every type smaller than an integer to an int, and
6927
+ * floats to doubles. So for collection of short int or char, `'i'`
6928
+ * needs to be used, and for collection of floats `'d'`.
6669
6929
  * @field
6670
6930
  */
6671
6931
  collect_format: string | null
6672
- collect_value: (value: any, n_collect_values: number, collect_values: TypeCValue, collect_flags: number) => string | null
6932
+ /**
6933
+ * Function to initialize a GValue from the values
6934
+ * collected from variadic arguments
6935
+ * @field
6936
+ */
6937
+ collect_value: TypeValueCollectFunc
6673
6938
  /**
6674
6939
  * Format description of the arguments to collect for `lcopy_value,`
6675
- * analogous to `collect_format`. Usually, `lcopy_format` string consists
6676
- * only of 'p's to provide lcopy_value() with pointers to storage locations.
6940
+ * analogous to `collect_format`. Usually, `lcopy_format` string consists
6941
+ * only of `'p'`s to provide lcopy_value() with pointers to storage locations.
6677
6942
  * @field
6678
6943
  */
6679
6944
  lcopy_format: string | null
6680
- lcopy_value: (value: any, n_collect_values: number, collect_values: TypeCValue, collect_flags: number) => string | null
6945
+ /**
6946
+ * Function to store the contents of a value into the
6947
+ * locations collected from variadic arguments
6948
+ * @field
6949
+ */
6950
+ lcopy_value: TypeValueLCopyFunc
6681
6951
  }
6682
6952
 
6683
6953
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@girs/gobject-2.0",
3
- "version": "2.76.1-3.2.3",
4
- "description": "GJS TypeScript type definitions for GObject-2.0, generated from library version 2.76.1",
3
+ "version": "2.78.0-3.2.4",
4
+ "description": "GJS TypeScript type definitions for GObject-2.0, generated from library version 2.78.0",
5
5
  "type": "module",
6
6
  "module": "gobject-2.0.js",
7
7
  "main": "gobject-2.0.js",
@@ -25,8 +25,8 @@
25
25
  "test:cjs": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit gobject-2.0.d.cts"
26
26
  },
27
27
  "dependencies": {
28
- "@girs/gjs": "^3.2.3",
29
- "@girs/glib-2.0": "^2.76.1-3.2.3"
28
+ "@girs/gjs": "^3.2.4",
29
+ "@girs/glib-2.0": "^2.78.0-3.2.4"
30
30
  },
31
31
  "devDependencies": {
32
32
  "typescript": "*"