@girs/gpaste-2 4.2.0 → 4.3.0

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.
Files changed (3) hide show
  1. package/README.md +8 -8
  2. package/gpaste-2.d.ts +196 -8
  3. package/package.json +6 -6
package/README.md CHANGED
@@ -5,25 +5,25 @@
5
5
  ![downloads/week](https://img.shields.io/npm/dw/@girs/gpaste-2)
6
6
 
7
7
 
8
- GJS TypeScript type definitions for GPaste-2 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.2.0.
8
+ GJS TypeScript type definitions for GPaste-2 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.3.0.
9
9
 
10
10
  ## Install
11
11
 
12
- To use this type definitions, install them with NPM:
12
+ Install the type definitions with npm:
13
13
  ```bash
14
14
  npm install @girs/gpaste-2
15
15
  ```
16
16
 
17
17
  ## Usage
18
18
 
19
- You can import this package into your project like this:
19
+ Import it like any other module:
20
20
  ```ts
21
21
  import GPaste from '@girs/gpaste-2';
22
22
  ```
23
23
 
24
24
  ### Ambient Modules
25
25
 
26
- You can also use [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) to import this module like you would do this in JavaScript.
26
+ [Ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) let you write the same import you would in plain JavaScript.
27
27
  For this you need to include `@girs/gpaste-2` or `@girs/gpaste-2/ambient` in your `tsconfig` or entry point Typescript file:
28
28
 
29
29
  `index.ts`:
@@ -42,7 +42,7 @@ import '@girs/gpaste-2'
42
42
  }
43
43
  ```
44
44
 
45
- Now you can import the ambient module with TypeScript support:
45
+ The ambient module now resolves with types:
46
46
 
47
47
  ```ts
48
48
  import GPaste from 'gi://GPaste?version=2';
@@ -50,7 +50,7 @@ import GPaste from 'gi://GPaste?version=2';
50
50
 
51
51
  ### Global import
52
52
 
53
- You can also import the module with Typescript support using the global `imports.gi` object of GJS.
53
+ GJS's global `imports.gi` works too, with types.
54
54
  For this you need to include `@girs/gpaste-2` or `@girs/gpaste-2/import` in your `tsconfig` or entry point Typescript file:
55
55
 
56
56
  `index.ts`:
@@ -69,7 +69,7 @@ import '@girs/gpaste-2'
69
69
  }
70
70
  ```
71
71
 
72
- Now you have also type support for this, too:
72
+ That form carries types as well:
73
73
 
74
74
  ```ts
75
75
  const GPaste = imports.gi.GPaste;
@@ -77,7 +77,7 @@ const GPaste = imports.gi.GPaste;
77
77
 
78
78
  ### Bundle
79
79
 
80
- Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
80
+ Most projects want a bundler. [esbuild](https://esbuild.github.io/) is the smallest thing that works; the [examples directory](https://github.com/gjsify/ts-for-gir/tree/main/examples) has setups for several others.
81
81
 
82
82
  ## Other packages
83
83
 
package/gpaste-2.d.ts CHANGED
@@ -171,6 +171,10 @@ export namespace GPaste {
171
171
 
172
172
  const HISTORY_NAME_SETTING: string;
173
173
 
174
+ const IMAGES_PREVIEW_SETTING: string;
175
+
176
+ const IMAGES_PREVIEW_SIZE_SETTING: string;
177
+
174
178
  const IMAGES_SUPPORT_SETTING: string;
175
179
 
176
180
  const LAUNCH_UI_SETTING: string;
@@ -1824,9 +1828,14 @@ export namespace GPaste {
1824
1828
  /**
1825
1829
  * Gets D-Bus introspection information for the D-Bus interface
1826
1830
  * implemented by `interface_`.
1831
+ *
1832
+ * This can return `null` if no {@link Gio.DBusInterfaceInfo} was provided during
1833
+ * construction of `interface_` and is also not made available otherwise.
1834
+ * For example, {@link Gio.DBusProxy} implements {@link Gio.DBusInterface} but allows for a `null`
1835
+ * {@link Gio.DBusInterfaceInfo}.
1827
1836
  * @returns A {@link Gio.DBusInterfaceInfo}. Do not free.
1828
1837
  */
1829
- get_info(): Gio.DBusInterfaceInfo;
1838
+ get_info(): Gio.DBusInterfaceInfo | null;
1830
1839
 
1831
1840
  /**
1832
1841
  * Sets the {@link Gio.DBusObject} for `interface_` to `object`.
@@ -1845,9 +1854,14 @@ export namespace GPaste {
1845
1854
  /**
1846
1855
  * Gets D-Bus introspection information for the D-Bus interface
1847
1856
  * implemented by `interface_`.
1857
+ *
1858
+ * This can return `null` if no {@link Gio.DBusInterfaceInfo} was provided during
1859
+ * construction of `interface_` and is also not made available otherwise.
1860
+ * For example, {@link Gio.DBusProxy} implements {@link Gio.DBusInterface} but allows for a `null`
1861
+ * {@link Gio.DBusInterfaceInfo}.
1848
1862
  * @virtual
1849
1863
  */
1850
- vfunc_get_info(): Gio.DBusInterfaceInfo;
1864
+ vfunc_get_info(): Gio.DBusInterfaceInfo | null;
1851
1865
 
1852
1866
  /**
1853
1867
  * Sets the {@link Gio.DBusObject} for `interface_` to `object`.
@@ -2026,13 +2040,13 @@ export namespace GPaste {
2026
2040
  }
2027
2041
 
2028
2042
  // Constructor properties interface
2029
- interface ConstructorProps extends Gio.DBusProxy.ConstructorProps, Gio.AsyncInitable.ConstructorProps, Gio.DBusInterface.ConstructorProps, Gio.Initable.ConstructorProps {}
2043
+ interface ConstructorProps extends Gio.DBusProxy.ConstructorProps, KeybindingProvider.ConstructorProps, Gio.AsyncInitable.ConstructorProps, Gio.DBusInterface.ConstructorProps, Gio.Initable.ConstructorProps {}
2030
2044
  }
2031
2045
 
2032
2046
  /**
2033
2047
  * @gir-type Class
2034
2048
  */
2035
- class GnomeShellClient extends Gio.DBusProxy implements Gio.AsyncInitable<GnomeShellClient>, Gio.DBusInterface, Gio.Initable {
2049
+ class GnomeShellClient extends Gio.DBusProxy implements KeybindingProvider, Gio.AsyncInitable<GnomeShellClient>, Gio.DBusInterface, Gio.Initable {
2036
2050
  static $gtype: GObject.GType<GnomeShellClient>;
2037
2051
 
2038
2052
  /**
@@ -2185,6 +2199,36 @@ export namespace GPaste {
2185
2199
  */
2186
2200
  ungrab_accelerator_sync(action: number): boolean;
2187
2201
 
2202
+ /**
2203
+ * Emit the "keybinding-activated" signal on `self`.
2204
+ * @param id the id of the activated shortcut (its dconf key)
2205
+ */
2206
+ emit_keybinding_activated(id: string): void;
2207
+
2208
+ /**
2209
+ * Replace all currently registered shortcuts with `accels`.
2210
+ * @param accels a `null`-terminated (by id) array of {@link GPaste.KeybindingAccelerator}
2211
+ */
2212
+ grab_all(accels: KeybindingAccelerator[]): void;
2213
+
2214
+ /**
2215
+ * Release all currently registered shortcuts.
2216
+ */
2217
+ ungrab_all(): void;
2218
+
2219
+ /**
2220
+ * Replace all currently registered shortcuts with `accels`.
2221
+ * @param accels a `null`-terminated (by id) array of {@link GPaste.KeybindingAccelerator}
2222
+ * @virtual
2223
+ */
2224
+ vfunc_grab_all(accels: KeybindingAccelerator[]): void;
2225
+
2226
+ /**
2227
+ * Release all currently registered shortcuts.
2228
+ * @virtual
2229
+ */
2230
+ vfunc_ungrab_all(): void;
2231
+
2188
2232
  /**
2189
2233
  * Starts asynchronous initialization of the object implementing the
2190
2234
  * interface. This must be done before any real use of the object after
@@ -2396,9 +2440,14 @@ export namespace GPaste {
2396
2440
  /**
2397
2441
  * Gets D-Bus introspection information for the D-Bus interface
2398
2442
  * implemented by `interface_`.
2443
+ *
2444
+ * This can return `null` if no {@link Gio.DBusInterfaceInfo} was provided during
2445
+ * construction of `interface_` and is also not made available otherwise.
2446
+ * For example, {@link Gio.DBusProxy} implements {@link Gio.DBusInterface} but allows for a `null`
2447
+ * {@link Gio.DBusInterfaceInfo}.
2399
2448
  * @returns A {@link Gio.DBusInterfaceInfo}. Do not free.
2400
2449
  */
2401
- get_info(): Gio.DBusInterfaceInfo;
2450
+ get_info(): Gio.DBusInterfaceInfo | null;
2402
2451
 
2403
2452
  /**
2404
2453
  * Sets the {@link Gio.DBusObject} for `interface_` to `object`.
@@ -2417,9 +2466,14 @@ export namespace GPaste {
2417
2466
  /**
2418
2467
  * Gets D-Bus introspection information for the D-Bus interface
2419
2468
  * implemented by `interface_`.
2469
+ *
2470
+ * This can return `null` if no {@link Gio.DBusInterfaceInfo} was provided during
2471
+ * construction of `interface_` and is also not made available otherwise.
2472
+ * For example, {@link Gio.DBusProxy} implements {@link Gio.DBusInterface} but allows for a `null`
2473
+ * {@link Gio.DBusInterfaceInfo}.
2420
2474
  * @virtual
2421
2475
  */
2422
- vfunc_get_info(): Gio.DBusInterfaceInfo;
2476
+ vfunc_get_info(): Gio.DBusInterfaceInfo | null;
2423
2477
 
2424
2478
  /**
2425
2479
  * Sets the {@link Gio.DBusObject} for `interface_` to `object`.
@@ -2808,9 +2862,14 @@ export namespace GPaste {
2808
2862
  /**
2809
2863
  * Gets D-Bus introspection information for the D-Bus interface
2810
2864
  * implemented by `interface_`.
2865
+ *
2866
+ * This can return `null` if no {@link Gio.DBusInterfaceInfo} was provided during
2867
+ * construction of `interface_` and is also not made available otherwise.
2868
+ * For example, {@link Gio.DBusProxy} implements {@link Gio.DBusInterface} but allows for a `null`
2869
+ * {@link Gio.DBusInterfaceInfo}.
2811
2870
  * @returns A {@link Gio.DBusInterfaceInfo}. Do not free.
2812
2871
  */
2813
- get_info(): Gio.DBusInterfaceInfo;
2872
+ get_info(): Gio.DBusInterfaceInfo | null;
2814
2873
 
2815
2874
  /**
2816
2875
  * Sets the {@link Gio.DBusObject} for `interface_` to `object`.
@@ -2829,9 +2888,14 @@ export namespace GPaste {
2829
2888
  /**
2830
2889
  * Gets D-Bus introspection information for the D-Bus interface
2831
2890
  * implemented by `interface_`.
2891
+ *
2892
+ * This can return `null` if no {@link Gio.DBusInterfaceInfo} was provided during
2893
+ * construction of `interface_` and is also not made available otherwise.
2894
+ * For example, {@link Gio.DBusProxy} implements {@link Gio.DBusInterface} but allows for a `null`
2895
+ * {@link Gio.DBusInterfaceInfo}.
2832
2896
  * @virtual
2833
2897
  */
2834
- vfunc_get_info(): Gio.DBusInterfaceInfo;
2898
+ vfunc_get_info(): Gio.DBusInterfaceInfo | null;
2835
2899
 
2836
2900
  /**
2837
2901
  * Sets the {@link Gio.DBusObject} for `interface_` to `object`.
@@ -3048,6 +3112,18 @@ export namespace GPaste {
3048
3112
  */
3049
3113
  get_history_name(): string;
3050
3114
 
3115
+ /**
3116
+ * Get the "images-preview" setting
3117
+ * @returns the value of the "images-preview" setting
3118
+ */
3119
+ get_images_preview(): boolean;
3120
+
3121
+ /**
3122
+ * Get the "images-preview-size" setting
3123
+ * @returns the value of the "images-preview-size" setting
3124
+ */
3125
+ get_images_preview_size(): number;
3126
+
3051
3127
  /**
3052
3128
  * Get the "images-support" setting
3053
3129
  * @returns the value of the "images-support" setting
@@ -3199,6 +3275,16 @@ export namespace GPaste {
3199
3275
  */
3200
3276
  reset_history_name(): void;
3201
3277
 
3278
+ /**
3279
+ * Reset the "images-preview" setting
3280
+ */
3281
+ reset_images_preview(): void;
3282
+
3283
+ /**
3284
+ * Reset the "images-preview-size" setting
3285
+ */
3286
+ reset_images_preview_size(): void;
3287
+
3202
3288
  /**
3203
3289
  * Reset the "images-support" setting
3204
3290
  */
@@ -3340,6 +3426,18 @@ export namespace GPaste {
3340
3426
  */
3341
3427
  set_history_name(value: string): void;
3342
3428
 
3429
+ /**
3430
+ * Change the "images-preview" setting
3431
+ * @param value whether to enable or not image previews
3432
+ */
3433
+ set_images_preview(value: boolean): void;
3434
+
3435
+ /**
3436
+ * Change the "images-preview-size" setting
3437
+ * @param value the size of image previews in pixels
3438
+ */
3439
+ set_images_preview_size(value: bigint | number): void;
3440
+
3343
3441
  /**
3344
3442
  * Change the "images-support" setting
3345
3443
  * @param value the new history name
@@ -3498,6 +3596,36 @@ export namespace GPaste {
3498
3596
  */
3499
3597
  type GnomeShellClientClass = typeof GnomeShellClient;
3500
3598
 
3599
+ /**
3600
+ * Represents a global shortcut to be registered with a {@link GPaste.KeybindingProvider}.
3601
+ * Terminate an array of these with an entry whose `id` is `null`.
3602
+ * @gir-type Struct
3603
+ */
3604
+ class KeybindingAccelerator {
3605
+ static $gtype: GObject.GType<KeybindingAccelerator>;
3606
+
3607
+ // Fields
3608
+ id: string;
3609
+
3610
+ accelerator: string;
3611
+
3612
+ description: string;
3613
+
3614
+ // Constructors
3615
+
3616
+ constructor(properties?: Partial<{
3617
+ id: string;
3618
+ accelerator: string;
3619
+ description: string;
3620
+ }>);
3621
+ }
3622
+
3623
+
3624
+ /**
3625
+ * @gir-type Alias
3626
+ */
3627
+ type KeybindingProviderInterface = typeof KeybindingProvider;
3628
+
3501
3629
  /**
3502
3630
  * @gir-type Alias
3503
3631
  */
@@ -3508,6 +3636,66 @@ export namespace GPaste {
3508
3636
  */
3509
3637
  type SettingsClass = typeof Settings;
3510
3638
 
3639
+ namespace KeybindingProvider {
3640
+ /**
3641
+ * Interface for implementing KeybindingProvider.
3642
+ * Contains only the virtual methods that need to be implemented.
3643
+ */
3644
+ interface Interface {
3645
+
3646
+ // Virtual methods
3647
+ /**
3648
+ * Replace all currently registered shortcuts with `accels`.
3649
+ * @param accels a `null`-terminated (by id) array of {@link GPaste.KeybindingAccelerator}
3650
+ * @virtual
3651
+ */
3652
+ vfunc_grab_all(accels: KeybindingAccelerator[]): void;
3653
+
3654
+ /**
3655
+ * Release all currently registered shortcuts.
3656
+ * @virtual
3657
+ */
3658
+ vfunc_ungrab_all(): void;
3659
+ }
3660
+
3661
+
3662
+ // Constructor properties interface
3663
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
3664
+ }
3665
+
3666
+ export interface KeybindingProviderNamespace {
3667
+ $gtype: GObject.GType<KeybindingProvider>;
3668
+ prototype: KeybindingProvider;
3669
+ }
3670
+ /**
3671
+ * @gir-type Interface
3672
+ */
3673
+ interface KeybindingProvider extends GObject.Object, KeybindingProvider.Interface {
3674
+
3675
+ // Methods
3676
+ /**
3677
+ * Emit the "keybinding-activated" signal on `self`.
3678
+ * @param id the id of the activated shortcut (its dconf key)
3679
+ */
3680
+ emit_keybinding_activated(id: string): void;
3681
+
3682
+ /**
3683
+ * Replace all currently registered shortcuts with `accels`.
3684
+ * @param accels a `null`-terminated (by id) array of {@link GPaste.KeybindingAccelerator}
3685
+ */
3686
+ grab_all(accels: KeybindingAccelerator[]): void;
3687
+
3688
+ /**
3689
+ * Release all currently registered shortcuts.
3690
+ */
3691
+ ungrab_all(): void;
3692
+ }
3693
+
3694
+
3695
+ export const KeybindingProvider: KeybindingProviderNamespace & {
3696
+ new (): KeybindingProvider; // This allows `obj instanceof KeybindingProvider`
3697
+ };
3698
+
3511
3699
  /**
3512
3700
  * Name of the imported GIR library
3513
3701
  * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@girs/gpaste-2",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "GJS TypeScript type definitions for GPaste-2",
5
5
  "type": "module",
6
6
  "module": "gpaste-2.js",
@@ -31,11 +31,11 @@
31
31
  "test": "tsc --project tsconfig.json"
32
32
  },
33
33
  "dependencies": {
34
- "@girs/gjs": "^4.2.0",
35
- "@girs/gio-2.0": "^4.2.0",
36
- "@girs/gobject-2.0": "^4.2.0",
37
- "@girs/glib-2.0": "^4.2.0",
38
- "@girs/gmodule-2.0": "^4.2.0" },
34
+ "@girs/gjs": "^4.3.0",
35
+ "@girs/gio-2.0": "^4.3.0",
36
+ "@girs/gobject-2.0": "^4.3.0",
37
+ "@girs/glib-2.0": "^4.3.0",
38
+ "@girs/gmodule-2.0": "^4.3.0" },
39
39
  "devDependencies": {
40
40
  "typescript": "*"
41
41
  },