@girs/gobject-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 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.0.
8
+ GJS TypeScript type definitions for GObject-2.0, generated from library version 2.77.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v3.2.2.
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
  */
@@ -2388,6 +2407,226 @@ export interface TypePluginUnuse {
2388
2407
  export interface TypePluginUse {
2389
2408
  (plugin: TypePlugin): void
2390
2409
  }
2410
+ /**
2411
+ * This function is responsible for converting the values collected from
2412
+ * a variadic argument list into contents suitable for storage in a #GValue.
2413
+ *
2414
+ * This function should setup `value` similar to #GTypeValueInitFunc; e.g.
2415
+ * for a string value that does not allow `NULL` pointers, it needs to either
2416
+ * emit an error, or do an implicit conversion by storing an empty string.
2417
+ *
2418
+ * The `value` passed in to this function has a zero-filled data array, so
2419
+ * just like for #GTypeValueInitFunc it is guaranteed to not contain any old
2420
+ * contents that might need freeing.
2421
+ *
2422
+ * The `n_collect_values` argument is the string length of the `collect_format`
2423
+ * field of #GTypeValueTable, and `collect_values` is an array of #GTypeCValue
2424
+ * with length of `n_collect_values,` containing the collected values according
2425
+ * to `collect_format`.
2426
+ *
2427
+ * The `collect_flags` argument provided as a hint by the caller. It may
2428
+ * contain the flag %G_VALUE_NOCOPY_CONTENTS indicating that the collected
2429
+ * value contents may be considered ‘static’ for the duration of the `value`
2430
+ * lifetime. Thus an extra copy of the contents stored in `collect_values` is
2431
+ * not required for assignment to `value`.
2432
+ *
2433
+ * For our above string example, we continue with:
2434
+ *
2435
+ *
2436
+ * ```c
2437
+ * if (!collect_values[0].v_pointer)
2438
+ * value->data[0].v_pointer = g_strdup ("");
2439
+ * else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
2440
+ * {
2441
+ * value->data[0].v_pointer = collect_values[0].v_pointer;
2442
+ * // keep a flag for the value_free() implementation to not free this string
2443
+ * value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
2444
+ * }
2445
+ * else
2446
+ * value->data[0].v_pointer = g_strdup (collect_values[0].v_pointer);
2447
+ * return NULL;
2448
+ * ```
2449
+ *
2450
+ *
2451
+ * It should be noted, that it is generally a bad idea to follow the
2452
+ * %G_VALUE_NOCOPY_CONTENTS hint for reference counted types. Due to
2453
+ * reentrancy requirements and reference count assertions performed
2454
+ * by the signal emission code, reference counts should always be
2455
+ * incremented for reference counted contents stored in the `value->data`
2456
+ * array. To deviate from our string example for a moment, and taking
2457
+ * a look at an exemplary implementation for `GTypeValueTable.collect_value()`
2458
+ * of `GObject`:
2459
+ *
2460
+ *
2461
+ * ```c
2462
+ * GObject *object = G_OBJECT (collect_values[0].v_pointer);
2463
+ * g_return_val_if_fail (object != NULL,
2464
+ * g_strdup_printf ("Object %p passed as invalid NULL pointer", object));
2465
+ * // never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types
2466
+ * value->data[0].v_pointer = g_object_ref (object);
2467
+ * return NULL;
2468
+ * ```
2469
+ *
2470
+ *
2471
+ * The reference count for valid objects is always incremented, regardless
2472
+ * of `collect_flags`. For invalid objects, the example returns a newly
2473
+ * allocated string without altering `value`.
2474
+ *
2475
+ * Upon success, `collect_value()` needs to return `NULL`. If, however,
2476
+ * an error condition occurred, `collect_value()` should return a newly
2477
+ * allocated string containing an error diagnostic.
2478
+ *
2479
+ * The calling code makes no assumptions about the `value` contents being
2480
+ * valid upon error returns, `value` is simply thrown away without further
2481
+ * freeing. As such, it is a good idea to not allocate `GValue` contents
2482
+ * prior to returning an error; however, `collect_values()` is not obliged
2483
+ * to return a correctly setup `value` for error returns, simply because
2484
+ * any non-`NULL` return is considered a fatal programming error, and
2485
+ * further program behaviour is undefined.
2486
+ * @callback
2487
+ * @param value the value to initialize
2488
+ * @param collect_values the collected values
2489
+ * @param collect_flags optional flags
2490
+ * @returns `NULL` on success, otherwise a newly allocated error string on failure
2491
+ */
2492
+ export interface TypeValueCollectFunc {
2493
+ (value: any, collect_values: TypeCValue[], collect_flags: number): string | null
2494
+ }
2495
+ /**
2496
+ * Copies the content of a #GValue into another.
2497
+ *
2498
+ * The `dest_value` is a #GValue with zero-filled data section and `src_value`
2499
+ * is a properly initialized #GValue of same type, or derived type.
2500
+ *
2501
+ * The purpose of this function is to copy the contents of `src_value`
2502
+ * into `dest_value` in a way, that even after `src_value` has been freed, the
2503
+ * contents of `dest_value` remain valid. String type example:
2504
+ *
2505
+ *
2506
+ * ```c
2507
+ * dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
2508
+ * ```
2509
+ *
2510
+ * @callback
2511
+ * @param src_value the value to copy
2512
+ */
2513
+ export interface TypeValueCopyFunc {
2514
+ (src_value: any): void
2515
+ }
2516
+ /**
2517
+ * Frees any old contents that might be left in the `value->data` array of
2518
+ * the given value.
2519
+ *
2520
+ * No resources may remain allocated through the #GValue contents after this
2521
+ * function returns. E.g. for our above string type:
2522
+ *
2523
+ *
2524
+ * ```c
2525
+ * // only free strings without a specific flag for static storage
2526
+ * if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
2527
+ * g_free (value->data[0].v_pointer);
2528
+ * ```
2529
+ *
2530
+ * @callback
2531
+ * @param value the value to free
2532
+ */
2533
+ export interface TypeValueFreeFunc {
2534
+ (value: any): void
2535
+ }
2536
+ /**
2537
+ * Initializes the value contents by setting the fields of the `value->data`
2538
+ * array.
2539
+ *
2540
+ * The data array of the #GValue passed into this function was zero-filled
2541
+ * with `memset()`, so no care has to be taken to free any old contents.
2542
+ * For example, in the case of a string value that may never be %NULL, the
2543
+ * implementation might look like:
2544
+ *
2545
+ *
2546
+ * ```c
2547
+ * value->data[0].v_pointer = g_strdup ("");
2548
+ * ```
2549
+ *
2550
+ * @callback
2551
+ * @param value the value to initialize
2552
+ */
2553
+ export interface TypeValueInitFunc {
2554
+ (value: any): void
2555
+ }
2556
+ /**
2557
+ * This function is responsible for storing the `value`
2558
+ * contents into arguments passed through a variadic argument list which
2559
+ * got collected into `collect_values` according to `lcopy_format`.
2560
+ *
2561
+ * The `n_collect_values` argument equals the string length of
2562
+ * `lcopy_format`, and `collect_flags` may contain %G_VALUE_NOCOPY_CONTENTS.
2563
+ *
2564
+ * In contrast to #GTypeValueCollectFunc, this function is obliged to always
2565
+ * properly support %G_VALUE_NOCOPY_CONTENTS.
2566
+ *
2567
+ * Similar to #GTypeValueCollectFunc the function may prematurely abort by
2568
+ * returning a newly allocated string describing an error condition. To
2569
+ * complete the string example:
2570
+ *
2571
+ *
2572
+ * ```c
2573
+ * gchar **string_p = collect_values[0].v_pointer;
2574
+ * g_return_val_if_fail (string_p != NULL,
2575
+ * g_strdup ("string location passed as NULL"));
2576
+ *
2577
+ * if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
2578
+ * *string_p = value->data[0].v_pointer;
2579
+ * else
2580
+ * *string_p = g_strdup (value->data[0].v_pointer);
2581
+ * ```
2582
+ *
2583
+ *
2584
+ * And an illustrative version of this function for reference-counted
2585
+ * types:
2586
+ *
2587
+ *
2588
+ * ```c
2589
+ * GObject **object_p = collect_values[0].v_pointer;
2590
+ * g_return_val_if_fail (object_p != NULL,
2591
+ * g_strdup ("object location passed as NULL"));
2592
+ *
2593
+ * if (value->data[0].v_pointer == NULL)
2594
+ * *object_p = NULL;
2595
+ * else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) // always honour
2596
+ * *object_p = value->data[0].v_pointer;
2597
+ * else
2598
+ * *object_p = g_object_ref (value->data[0].v_pointer);
2599
+ *
2600
+ * return NULL;
2601
+ * ```
2602
+ *
2603
+ * @callback
2604
+ * @param value the value to lcopy
2605
+ * @param collect_values the collected locations for storage
2606
+ * @param collect_flags optional flags
2607
+ * @returns `NULL` on success, otherwise a newly allocated error string on failure
2608
+ */
2609
+ export interface TypeValueLCopyFunc {
2610
+ (value: any, collect_values: TypeCValue[], collect_flags: number): string | null
2611
+ }
2612
+ /**
2613
+ * If the value contents fit into a pointer, such as objects or strings,
2614
+ * return this pointer, so the caller can peek at the current contents.
2615
+ *
2616
+ * To extend on our above string example:
2617
+ *
2618
+ *
2619
+ * ```c
2620
+ * return value->data[0].v_pointer;
2621
+ * ```
2622
+ *
2623
+ * @callback
2624
+ * @param value the value to peek
2625
+ * @returns a pointer to the value contents
2626
+ */
2627
+ export interface TypeValuePeekPointerFunc {
2628
+ (value: any): any | null
2629
+ }
2391
2630
  /**
2392
2631
  * The type of value transformation functions which can be registered with
2393
2632
  * g_value_register_transform_func().
@@ -6647,35 +6886,62 @@ export interface TypeValueTable {
6647
6886
 
6648
6887
  // Own fields of GObject-2.0.GObject.TypeValueTable
6649
6888
 
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
6889
+ /**
6890
+ * Function to initialize a GValue
6891
+ * @field
6892
+ */
6893
+ value_init: TypeValueInitFunc
6894
+ /**
6895
+ * Function to free a GValue
6896
+ * @field
6897
+ */
6898
+ value_free: TypeValueFreeFunc
6899
+ /**
6900
+ * Function to copy a GValue
6901
+ * @field
6902
+ */
6903
+ value_copy: TypeValueCopyFunc
6904
+ /**
6905
+ * Function to peek the contents of a GValue if they fit
6906
+ * into a pointer
6907
+ * @field
6908
+ */
6909
+ value_peek_pointer: TypeValuePeekPointerFunc
6654
6910
  /**
6655
6911
  * 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'.
6912
+ * this value bit-by-bit. Each character in the format represents
6913
+ * an argument to be collected, and the characters themselves indicate
6914
+ * the type of the argument. Currently supported arguments are:
6915
+ * - `'i'`: Integers, passed as `collect_values[].v_int`
6916
+ * - `'l'`: Longs, passed as `collect_values[].v_long`
6917
+ * - `'d'`: Doubles, passed as `collect_values[].v_double`
6918
+ * - `'p'`: Pointers, passed as `collect_values[].v_pointer`
6919
+ * It should be noted that for variable argument list construction,
6920
+ * ANSI C promotes every type smaller than an integer to an int, and
6921
+ * floats to doubles. So for collection of short int or char, `'i'`
6922
+ * needs to be used, and for collection of floats `'d'`.
6667
6923
  * @field
6668
6924
  */
6669
6925
  collect_format: string | null
6670
- collect_value: (value: any, n_collect_values: number, collect_values: TypeCValue, collect_flags: number) => string | null
6926
+ /**
6927
+ * Function to initialize a GValue from the values
6928
+ * collected from variadic arguments
6929
+ * @field
6930
+ */
6931
+ collect_value: TypeValueCollectFunc
6671
6932
  /**
6672
6933
  * 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.
6934
+ * analogous to `collect_format`. Usually, `lcopy_format` string consists
6935
+ * only of `'p'`s to provide lcopy_value() with pointers to storage locations.
6675
6936
  * @field
6676
6937
  */
6677
6938
  lcopy_format: string | null
6678
- lcopy_value: (value: any, n_collect_values: number, collect_values: TypeCValue, collect_flags: number) => string | null
6939
+ /**
6940
+ * Function to store the contents of a value into the
6941
+ * locations collected from variadic arguments
6942
+ * @field
6943
+ */
6944
+ lcopy_value: TypeValueLCopyFunc
6679
6945
  }
6680
6946
 
6681
6947
  /**
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
  */
@@ -2390,6 +2409,226 @@ interface TypePluginUnuse {
2390
2409
  interface TypePluginUse {
2391
2410
  (plugin: TypePlugin): void
2392
2411
  }
2412
+ /**
2413
+ * This function is responsible for converting the values collected from
2414
+ * a variadic argument list into contents suitable for storage in a #GValue.
2415
+ *
2416
+ * This function should setup `value` similar to #GTypeValueInitFunc; e.g.
2417
+ * for a string value that does not allow `NULL` pointers, it needs to either
2418
+ * emit an error, or do an implicit conversion by storing an empty string.
2419
+ *
2420
+ * The `value` passed in to this function has a zero-filled data array, so
2421
+ * just like for #GTypeValueInitFunc it is guaranteed to not contain any old
2422
+ * contents that might need freeing.
2423
+ *
2424
+ * The `n_collect_values` argument is the string length of the `collect_format`
2425
+ * field of #GTypeValueTable, and `collect_values` is an array of #GTypeCValue
2426
+ * with length of `n_collect_values,` containing the collected values according
2427
+ * to `collect_format`.
2428
+ *
2429
+ * The `collect_flags` argument provided as a hint by the caller. It may
2430
+ * contain the flag %G_VALUE_NOCOPY_CONTENTS indicating that the collected
2431
+ * value contents may be considered ‘static’ for the duration of the `value`
2432
+ * lifetime. Thus an extra copy of the contents stored in `collect_values` is
2433
+ * not required for assignment to `value`.
2434
+ *
2435
+ * For our above string example, we continue with:
2436
+ *
2437
+ *
2438
+ * ```c
2439
+ * if (!collect_values[0].v_pointer)
2440
+ * value->data[0].v_pointer = g_strdup ("");
2441
+ * else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
2442
+ * {
2443
+ * value->data[0].v_pointer = collect_values[0].v_pointer;
2444
+ * // keep a flag for the value_free() implementation to not free this string
2445
+ * value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
2446
+ * }
2447
+ * else
2448
+ * value->data[0].v_pointer = g_strdup (collect_values[0].v_pointer);
2449
+ * return NULL;
2450
+ * ```
2451
+ *
2452
+ *
2453
+ * It should be noted, that it is generally a bad idea to follow the
2454
+ * %G_VALUE_NOCOPY_CONTENTS hint for reference counted types. Due to
2455
+ * reentrancy requirements and reference count assertions performed
2456
+ * by the signal emission code, reference counts should always be
2457
+ * incremented for reference counted contents stored in the `value->data`
2458
+ * array. To deviate from our string example for a moment, and taking
2459
+ * a look at an exemplary implementation for `GTypeValueTable.collect_value()`
2460
+ * of `GObject`:
2461
+ *
2462
+ *
2463
+ * ```c
2464
+ * GObject *object = G_OBJECT (collect_values[0].v_pointer);
2465
+ * g_return_val_if_fail (object != NULL,
2466
+ * g_strdup_printf ("Object %p passed as invalid NULL pointer", object));
2467
+ * // never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types
2468
+ * value->data[0].v_pointer = g_object_ref (object);
2469
+ * return NULL;
2470
+ * ```
2471
+ *
2472
+ *
2473
+ * The reference count for valid objects is always incremented, regardless
2474
+ * of `collect_flags`. For invalid objects, the example returns a newly
2475
+ * allocated string without altering `value`.
2476
+ *
2477
+ * Upon success, `collect_value()` needs to return `NULL`. If, however,
2478
+ * an error condition occurred, `collect_value()` should return a newly
2479
+ * allocated string containing an error diagnostic.
2480
+ *
2481
+ * The calling code makes no assumptions about the `value` contents being
2482
+ * valid upon error returns, `value` is simply thrown away without further
2483
+ * freeing. As such, it is a good idea to not allocate `GValue` contents
2484
+ * prior to returning an error; however, `collect_values()` is not obliged
2485
+ * to return a correctly setup `value` for error returns, simply because
2486
+ * any non-`NULL` return is considered a fatal programming error, and
2487
+ * further program behaviour is undefined.
2488
+ * @callback
2489
+ * @param value the value to initialize
2490
+ * @param collect_values the collected values
2491
+ * @param collect_flags optional flags
2492
+ * @returns `NULL` on success, otherwise a newly allocated error string on failure
2493
+ */
2494
+ interface TypeValueCollectFunc {
2495
+ (value: any, collect_values: TypeCValue[], collect_flags: number): string | null
2496
+ }
2497
+ /**
2498
+ * Copies the content of a #GValue into another.
2499
+ *
2500
+ * The `dest_value` is a #GValue with zero-filled data section and `src_value`
2501
+ * is a properly initialized #GValue of same type, or derived type.
2502
+ *
2503
+ * The purpose of this function is to copy the contents of `src_value`
2504
+ * into `dest_value` in a way, that even after `src_value` has been freed, the
2505
+ * contents of `dest_value` remain valid. String type example:
2506
+ *
2507
+ *
2508
+ * ```c
2509
+ * dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
2510
+ * ```
2511
+ *
2512
+ * @callback
2513
+ * @param src_value the value to copy
2514
+ */
2515
+ interface TypeValueCopyFunc {
2516
+ (src_value: any): void
2517
+ }
2518
+ /**
2519
+ * Frees any old contents that might be left in the `value->data` array of
2520
+ * the given value.
2521
+ *
2522
+ * No resources may remain allocated through the #GValue contents after this
2523
+ * function returns. E.g. for our above string type:
2524
+ *
2525
+ *
2526
+ * ```c
2527
+ * // only free strings without a specific flag for static storage
2528
+ * if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
2529
+ * g_free (value->data[0].v_pointer);
2530
+ * ```
2531
+ *
2532
+ * @callback
2533
+ * @param value the value to free
2534
+ */
2535
+ interface TypeValueFreeFunc {
2536
+ (value: any): void
2537
+ }
2538
+ /**
2539
+ * Initializes the value contents by setting the fields of the `value->data`
2540
+ * array.
2541
+ *
2542
+ * The data array of the #GValue passed into this function was zero-filled
2543
+ * with `memset()`, so no care has to be taken to free any old contents.
2544
+ * For example, in the case of a string value that may never be %NULL, the
2545
+ * implementation might look like:
2546
+ *
2547
+ *
2548
+ * ```c
2549
+ * value->data[0].v_pointer = g_strdup ("");
2550
+ * ```
2551
+ *
2552
+ * @callback
2553
+ * @param value the value to initialize
2554
+ */
2555
+ interface TypeValueInitFunc {
2556
+ (value: any): void
2557
+ }
2558
+ /**
2559
+ * This function is responsible for storing the `value`
2560
+ * contents into arguments passed through a variadic argument list which
2561
+ * got collected into `collect_values` according to `lcopy_format`.
2562
+ *
2563
+ * The `n_collect_values` argument equals the string length of
2564
+ * `lcopy_format`, and `collect_flags` may contain %G_VALUE_NOCOPY_CONTENTS.
2565
+ *
2566
+ * In contrast to #GTypeValueCollectFunc, this function is obliged to always
2567
+ * properly support %G_VALUE_NOCOPY_CONTENTS.
2568
+ *
2569
+ * Similar to #GTypeValueCollectFunc the function may prematurely abort by
2570
+ * returning a newly allocated string describing an error condition. To
2571
+ * complete the string example:
2572
+ *
2573
+ *
2574
+ * ```c
2575
+ * gchar **string_p = collect_values[0].v_pointer;
2576
+ * g_return_val_if_fail (string_p != NULL,
2577
+ * g_strdup ("string location passed as NULL"));
2578
+ *
2579
+ * if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
2580
+ * *string_p = value->data[0].v_pointer;
2581
+ * else
2582
+ * *string_p = g_strdup (value->data[0].v_pointer);
2583
+ * ```
2584
+ *
2585
+ *
2586
+ * And an illustrative version of this function for reference-counted
2587
+ * types:
2588
+ *
2589
+ *
2590
+ * ```c
2591
+ * GObject **object_p = collect_values[0].v_pointer;
2592
+ * g_return_val_if_fail (object_p != NULL,
2593
+ * g_strdup ("object location passed as NULL"));
2594
+ *
2595
+ * if (value->data[0].v_pointer == NULL)
2596
+ * *object_p = NULL;
2597
+ * else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) // always honour
2598
+ * *object_p = value->data[0].v_pointer;
2599
+ * else
2600
+ * *object_p = g_object_ref (value->data[0].v_pointer);
2601
+ *
2602
+ * return NULL;
2603
+ * ```
2604
+ *
2605
+ * @callback
2606
+ * @param value the value to lcopy
2607
+ * @param collect_values the collected locations for storage
2608
+ * @param collect_flags optional flags
2609
+ * @returns `NULL` on success, otherwise a newly allocated error string on failure
2610
+ */
2611
+ interface TypeValueLCopyFunc {
2612
+ (value: any, collect_values: TypeCValue[], collect_flags: number): string | null
2613
+ }
2614
+ /**
2615
+ * If the value contents fit into a pointer, such as objects or strings,
2616
+ * return this pointer, so the caller can peek at the current contents.
2617
+ *
2618
+ * To extend on our above string example:
2619
+ *
2620
+ *
2621
+ * ```c
2622
+ * return value->data[0].v_pointer;
2623
+ * ```
2624
+ *
2625
+ * @callback
2626
+ * @param value the value to peek
2627
+ * @returns a pointer to the value contents
2628
+ */
2629
+ interface TypeValuePeekPointerFunc {
2630
+ (value: any): any | null
2631
+ }
2393
2632
  /**
2394
2633
  * The type of value transformation functions which can be registered with
2395
2634
  * g_value_register_transform_func().
@@ -6649,35 +6888,62 @@ interface TypeValueTable {
6649
6888
 
6650
6889
  // Own fields of GObject-2.0.GObject.TypeValueTable
6651
6890
 
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
6891
+ /**
6892
+ * Function to initialize a GValue
6893
+ * @field
6894
+ */
6895
+ value_init: TypeValueInitFunc
6896
+ /**
6897
+ * Function to free a GValue
6898
+ * @field
6899
+ */
6900
+ value_free: TypeValueFreeFunc
6901
+ /**
6902
+ * Function to copy a GValue
6903
+ * @field
6904
+ */
6905
+ value_copy: TypeValueCopyFunc
6906
+ /**
6907
+ * Function to peek the contents of a GValue if they fit
6908
+ * into a pointer
6909
+ * @field
6910
+ */
6911
+ value_peek_pointer: TypeValuePeekPointerFunc
6656
6912
  /**
6657
6913
  * 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'.
6914
+ * this value bit-by-bit. Each character in the format represents
6915
+ * an argument to be collected, and the characters themselves indicate
6916
+ * the type of the argument. Currently supported arguments are:
6917
+ * - `'i'`: Integers, passed as `collect_values[].v_int`
6918
+ * - `'l'`: Longs, passed as `collect_values[].v_long`
6919
+ * - `'d'`: Doubles, passed as `collect_values[].v_double`
6920
+ * - `'p'`: Pointers, passed as `collect_values[].v_pointer`
6921
+ * It should be noted that for variable argument list construction,
6922
+ * ANSI C promotes every type smaller than an integer to an int, and
6923
+ * floats to doubles. So for collection of short int or char, `'i'`
6924
+ * needs to be used, and for collection of floats `'d'`.
6669
6925
  * @field
6670
6926
  */
6671
6927
  collect_format: string | null
6672
- collect_value: (value: any, n_collect_values: number, collect_values: TypeCValue, collect_flags: number) => string | null
6928
+ /**
6929
+ * Function to initialize a GValue from the values
6930
+ * collected from variadic arguments
6931
+ * @field
6932
+ */
6933
+ collect_value: TypeValueCollectFunc
6673
6934
  /**
6674
6935
  * 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.
6936
+ * analogous to `collect_format`. Usually, `lcopy_format` string consists
6937
+ * only of `'p'`s to provide lcopy_value() with pointers to storage locations.
6677
6938
  * @field
6678
6939
  */
6679
6940
  lcopy_format: string | null
6680
- lcopy_value: (value: any, n_collect_values: number, collect_values: TypeCValue, collect_flags: number) => string | null
6941
+ /**
6942
+ * Function to store the contents of a value into the
6943
+ * locations collected from variadic arguments
6944
+ * @field
6945
+ */
6946
+ lcopy_value: TypeValueLCopyFunc
6681
6947
  }
6682
6948
 
6683
6949
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@girs/gobject-2.0",
3
- "version": "2.76.1-3.2.0",
4
- "description": "GJS TypeScript type definitions for GObject-2.0, generated from library version 2.76.1",
3
+ "version": "2.77.0-3.2.2",
4
+ "description": "GJS TypeScript type definitions for GObject-2.0, generated from library version 2.77.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.0",
29
- "@girs/glib-2.0": "^2.76.1-3.2.0"
28
+ "@girs/gjs": "^3.2.2",
29
+ "@girs/glib-2.0": "^2.77.0-3.2.2"
30
30
  },
31
31
  "devDependencies": {
32
32
  "typescript": "*"
package/typedoc.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "entryPoints": ["./gobject-2.0.d.ts","./gobject-2.0-ambient.d.ts","./gobject-2.0-import.d.ts"],
2
+ "entryPoints": ["./gobject-2.0.d.ts"],
3
3
  "readme": "./README.md",
4
4
  "name": "GObject-2.0",
5
5
  "tsconfig": "./tsconfig.json"