@girs/cmenu-3.0 4.3.0 → 4.5.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.
- package/README.md +36 -41
- package/cmenu-3.0.d.ts +43 -13
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -4,82 +4,77 @@
|
|
|
4
4
|

|
|
5
5
|

|
|
6
6
|
|
|
7
|
+
GJS TypeScript type definitions for CMenu-3.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.5.0.
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
This package contains type declarations only. It ships no runtime code, so it adds
|
|
10
|
+
nothing to your program and works with any bundler or none at all.
|
|
9
11
|
|
|
10
12
|
## Install
|
|
11
13
|
|
|
12
|
-
Install the type definitions with npm:
|
|
13
14
|
```bash
|
|
14
15
|
npm install @girs/cmenu-3.0
|
|
15
16
|
```
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
Any package manager works. The package has no dependencies beyond other `@girs/*`
|
|
19
|
+
type packages.
|
|
20
|
+
|
|
21
|
+
## What it exports
|
|
22
|
+
|
|
23
|
+
| Import | What you get |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `@girs/cmenu-3.0` | the namespace as a default export, plus the ambient and global declarations |
|
|
26
|
+
| `@girs/cmenu-3.0/ambient` | only the `gi://` module declarations |
|
|
27
|
+
| `@girs/cmenu-3.0/import` | only the `imports.gi` declarations |
|
|
28
|
+
| `@girs/cmenu-3.0/cmenu-3.0` | the namespace, without the side-effecting declarations |
|
|
29
|
+
|
|
30
|
+
## Three ways to import
|
|
31
|
+
|
|
32
|
+
Which one you use depends on how you write imports elsewhere, not on your toolchain.
|
|
33
|
+
|
|
34
|
+
### As a module
|
|
18
35
|
|
|
19
|
-
Import it like any other module:
|
|
20
36
|
```ts
|
|
21
37
|
import CMenu from '@girs/cmenu-3.0';
|
|
22
38
|
```
|
|
23
39
|
|
|
24
|
-
###
|
|
40
|
+
### As `gi://`
|
|
25
41
|
|
|
26
|
-
|
|
27
|
-
|
|
42
|
+
GJS resolves `gi://` at runtime. To give it types, reference the package once, either
|
|
43
|
+
from your entry point or from `tsconfig.json`:
|
|
28
44
|
|
|
29
|
-
`index.ts`:
|
|
30
45
|
```ts
|
|
31
|
-
import '@girs/cmenu-3.0'
|
|
46
|
+
import '@girs/cmenu-3.0';
|
|
32
47
|
```
|
|
33
48
|
|
|
34
|
-
`tsconfig.json`:
|
|
35
49
|
```json
|
|
36
|
-
{
|
|
37
|
-
"compilerOptions": {
|
|
38
|
-
...
|
|
39
|
-
},
|
|
40
|
-
"include": ["@girs/cmenu-3.0"],
|
|
41
|
-
...
|
|
42
|
-
}
|
|
50
|
+
{ "include": ["@girs/cmenu-3.0"] }
|
|
43
51
|
```
|
|
44
52
|
|
|
45
|
-
|
|
53
|
+
Then the runtime spelling type-checks:
|
|
46
54
|
|
|
47
55
|
```ts
|
|
48
56
|
import CMenu from 'gi://CMenu?version=3.0';
|
|
49
57
|
```
|
|
50
58
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
GJS's global `imports.gi` works too, with types.
|
|
54
|
-
For this you need to include `@girs/cmenu-3.0` or `@girs/cmenu-3.0/import` in your `tsconfig` or entry point Typescript file:
|
|
59
|
+
Referencing `@girs/cmenu-3.0/ambient` instead pulls in these declarations
|
|
60
|
+
alone. See [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules).
|
|
55
61
|
|
|
56
|
-
`
|
|
57
|
-
```ts
|
|
58
|
-
import '@girs/cmenu-3.0'
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
`tsconfig.json`:
|
|
62
|
-
```json
|
|
63
|
-
{
|
|
64
|
-
"compilerOptions": {
|
|
65
|
-
...
|
|
66
|
-
},
|
|
67
|
-
"include": ["@girs/cmenu-3.0"],
|
|
68
|
-
...
|
|
69
|
-
}
|
|
70
|
-
```
|
|
62
|
+
### As `imports.gi`
|
|
71
63
|
|
|
72
|
-
|
|
64
|
+
GJS's global object works the same way, via `@girs/cmenu-3.0/import`:
|
|
73
65
|
|
|
74
66
|
```ts
|
|
75
67
|
const CMenu = imports.gi.CMenu;
|
|
76
68
|
```
|
|
77
69
|
|
|
78
|
-
|
|
70
|
+
## Building
|
|
79
71
|
|
|
80
|
-
|
|
72
|
+
The declarations need no build step. If you bundle, every bundler works, since there is
|
|
73
|
+
no runtime code to resolve. The [examples](https://github.com/gjsify/ts-for-gir/tree/main/examples)
|
|
74
|
+
show working setups for several.
|
|
81
75
|
|
|
82
76
|
## Other packages
|
|
83
77
|
|
|
84
|
-
|
|
78
|
+
Every pre-generated package is at [gjsify/types](https://github.com/gjsify/types).
|
|
79
|
+
|
|
85
80
|
|
package/cmenu-3.0.d.ts
CHANGED
|
@@ -27,15 +27,18 @@ export namespace CMenu {
|
|
|
27
27
|
* @gir-type Enum
|
|
28
28
|
*/
|
|
29
29
|
enum TreeItemType {
|
|
30
|
-
INVALID,
|
|
31
|
-
DIRECTORY,
|
|
32
|
-
ENTRY,
|
|
33
|
-
SEPARATOR,
|
|
34
|
-
HEADER,
|
|
35
|
-
ALIAS,
|
|
30
|
+
INVALID = 0,
|
|
31
|
+
DIRECTORY = 1,
|
|
32
|
+
ENTRY = 2,
|
|
33
|
+
SEPARATOR = 3,
|
|
34
|
+
HEADER = 4,
|
|
35
|
+
ALIAS = 5,
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @default :flatpak
|
|
41
|
+
*/
|
|
39
42
|
const DESKTOPAPPINFO_FLATPAK_SUFFIX: string;
|
|
40
43
|
|
|
41
44
|
/**
|
|
@@ -49,13 +52,13 @@ export namespace CMenu {
|
|
|
49
52
|
* @gir-type Flags
|
|
50
53
|
*/
|
|
51
54
|
enum TreeFlags {
|
|
52
|
-
NONE,
|
|
53
|
-
INCLUDE_EXCLUDED,
|
|
54
|
-
SHOW_EMPTY,
|
|
55
|
-
INCLUDE_NODISPLAY,
|
|
56
|
-
SHOW_ALL_SEPARATORS,
|
|
57
|
-
SORT_DISPLAY_NAME,
|
|
58
|
-
INCLUDE_UNALLOCATED,
|
|
55
|
+
NONE = 0,
|
|
56
|
+
INCLUDE_EXCLUDED = 1,
|
|
57
|
+
SHOW_EMPTY = 256,
|
|
58
|
+
INCLUDE_NODISPLAY = 2,
|
|
59
|
+
SHOW_ALL_SEPARATORS = 512,
|
|
60
|
+
SORT_DISPLAY_NAME = 65536,
|
|
61
|
+
INCLUDE_UNALLOCATED = 4,
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
|
|
@@ -115,6 +118,7 @@ export namespace CMenu {
|
|
|
115
118
|
* action.
|
|
116
119
|
* @param action_name the name of the action as from `gmenu_desktopappinfo_list_actions()`
|
|
117
120
|
* @returns the locale-specific action name
|
|
121
|
+
* @since 2.38
|
|
118
122
|
*/
|
|
119
123
|
get_action_name(action_name: string): string;
|
|
120
124
|
|
|
@@ -138,6 +142,7 @@ export namespace CMenu {
|
|
|
138
142
|
* situations such as the {@link CMenu.DesktopAppInfo} returned from
|
|
139
143
|
* `gmenu_desktopappinfo_new_from_keyfile()`, this function will return `null`.
|
|
140
144
|
* @returns The full path to the file for `info`, or `null` if not known.
|
|
145
|
+
* @since 2.24
|
|
141
146
|
*/
|
|
142
147
|
get_filename(): string;
|
|
143
148
|
|
|
@@ -271,6 +276,7 @@ export namespace CMenu {
|
|
|
271
276
|
* application is capable of opening files with the given content type.
|
|
272
277
|
* @param content_type a string.
|
|
273
278
|
* @returns `TRUE` on success, `FALSE` on error.
|
|
279
|
+
* @throws GLib.Error
|
|
274
280
|
*/
|
|
275
281
|
add_supports_type(content_type: string): boolean;
|
|
276
282
|
|
|
@@ -278,6 +284,7 @@ export namespace CMenu {
|
|
|
278
284
|
* Obtains the information whether the {@link Gio.AppInfo} can be deleted.
|
|
279
285
|
* See {@link Gio.AppInfo.delete}.
|
|
280
286
|
* @returns `TRUE` if `appinfo` can be deleted
|
|
287
|
+
* @since 2.20
|
|
281
288
|
*/
|
|
282
289
|
can_delete(): boolean;
|
|
283
290
|
|
|
@@ -294,6 +301,7 @@ export namespace CMenu {
|
|
|
294
301
|
* {@link Gio.AppInfo}s which can be deleted, and system-wide ones which cannot.
|
|
295
302
|
* See {@link Gio.AppInfo.can_delete}.
|
|
296
303
|
* @returns `TRUE` if `appinfo` has been deleted
|
|
304
|
+
* @since 2.20
|
|
297
305
|
*/
|
|
298
306
|
["delete"](): boolean;
|
|
299
307
|
|
|
@@ -318,6 +326,7 @@ export namespace CMenu {
|
|
|
318
326
|
* Gets the commandline with which the application will be
|
|
319
327
|
* started.
|
|
320
328
|
* @returns a string containing the `appinfo`’s commandline, or `NULL` if this information is not available
|
|
329
|
+
* @since 2.20
|
|
321
330
|
*/
|
|
322
331
|
get_commandline(): string | null;
|
|
323
332
|
|
|
@@ -331,6 +340,7 @@ export namespace CMenu {
|
|
|
331
340
|
* Gets the display name of the application. The display name is often more
|
|
332
341
|
* descriptive to the user than the name itself.
|
|
333
342
|
* @returns the display name of the application for `appinfo`, or the name if no display name is available.
|
|
343
|
+
* @since 2.24
|
|
334
344
|
*/
|
|
335
345
|
get_display_name(): string;
|
|
336
346
|
|
|
@@ -376,6 +386,7 @@ export namespace CMenu {
|
|
|
376
386
|
* {@link Gio.AppInfo.add_supports_type}, but only those exported directly by
|
|
377
387
|
* the application.
|
|
378
388
|
* @returns a list of content types.
|
|
389
|
+
* @since 2.34
|
|
379
390
|
*/
|
|
380
391
|
get_supported_types(): string[] | null;
|
|
381
392
|
|
|
@@ -410,6 +421,7 @@ export namespace CMenu {
|
|
|
410
421
|
* @param files a list of {@link Gio.File} objects
|
|
411
422
|
* @param context the launch context
|
|
412
423
|
* @returns `TRUE` on successful launch, `FALSE` otherwise.
|
|
424
|
+
* @throws GLib.Error
|
|
413
425
|
*/
|
|
414
426
|
launch(files: Gio.File[] | null, context: Gio.AppLaunchContext | null): boolean;
|
|
415
427
|
|
|
@@ -429,6 +441,7 @@ export namespace CMenu {
|
|
|
429
441
|
* @param uris a list of URIs to launch.
|
|
430
442
|
* @param context the launch context
|
|
431
443
|
* @returns `TRUE` on successful launch, `FALSE` otherwise.
|
|
444
|
+
* @throws GLib.Error
|
|
432
445
|
*/
|
|
433
446
|
launch_uris(uris: string[] | null, context: Gio.AppLaunchContext | null): boolean;
|
|
434
447
|
|
|
@@ -442,6 +455,7 @@ export namespace CMenu {
|
|
|
442
455
|
* @param uris a list of URIs to launch.
|
|
443
456
|
* @param context the launch context
|
|
444
457
|
* @param cancellable a {@link Gio.Cancellable}
|
|
458
|
+
* @since 2.60
|
|
445
459
|
*/
|
|
446
460
|
launch_uris_async(uris: string[] | null, context: Gio.AppLaunchContext | null, cancellable: Gio.Cancellable | null): globalThis.Promise<boolean>;
|
|
447
461
|
|
|
@@ -456,6 +470,7 @@ export namespace CMenu {
|
|
|
456
470
|
* @param context the launch context
|
|
457
471
|
* @param cancellable a {@link Gio.Cancellable}
|
|
458
472
|
* @param callback a {@link Gio.AsyncReadyCallback} to call when the request is done
|
|
473
|
+
* @since 2.60
|
|
459
474
|
*/
|
|
460
475
|
launch_uris_async(uris: string[] | null, context: Gio.AppLaunchContext | null, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void;
|
|
461
476
|
|
|
@@ -470,6 +485,7 @@ export namespace CMenu {
|
|
|
470
485
|
* @param context the launch context
|
|
471
486
|
* @param cancellable a {@link Gio.Cancellable}
|
|
472
487
|
* @param callback a {@link Gio.AsyncReadyCallback} to call when the request is done
|
|
488
|
+
* @since 2.60
|
|
473
489
|
*/
|
|
474
490
|
launch_uris_async(uris: string[] | null, context: Gio.AppLaunchContext | null, cancellable: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback<this> | null): globalThis.Promise<boolean> | void;
|
|
475
491
|
|
|
@@ -477,6 +493,8 @@ export namespace CMenu {
|
|
|
477
493
|
* Finishes a {@link Gio.AppInfo.launch_uris_async} operation.
|
|
478
494
|
* @param result the async result
|
|
479
495
|
* @returns `TRUE` on successful launch, `FALSE` otherwise.
|
|
496
|
+
* @since 2.60
|
|
497
|
+
* @throws GLib.Error
|
|
480
498
|
*/
|
|
481
499
|
launch_uris_finish(result: Gio.AsyncResult): boolean;
|
|
482
500
|
|
|
@@ -484,6 +502,7 @@ export namespace CMenu {
|
|
|
484
502
|
* Removes a supported type from an application, if possible.
|
|
485
503
|
* @param content_type a string.
|
|
486
504
|
* @returns `TRUE` on success, `FALSE` on error.
|
|
505
|
+
* @throws GLib.Error
|
|
487
506
|
*/
|
|
488
507
|
remove_supports_type(content_type: string): boolean;
|
|
489
508
|
|
|
@@ -491,6 +510,7 @@ export namespace CMenu {
|
|
|
491
510
|
* Sets the application as the default handler for the given file extension.
|
|
492
511
|
* @param extension a string containing the file extension (without the dot).
|
|
493
512
|
* @returns `TRUE` on success, `FALSE` on error.
|
|
513
|
+
* @throws GLib.Error
|
|
494
514
|
*/
|
|
495
515
|
set_as_default_for_extension(extension: string): boolean;
|
|
496
516
|
|
|
@@ -498,6 +518,7 @@ export namespace CMenu {
|
|
|
498
518
|
* Sets the application as the default handler for a given type.
|
|
499
519
|
* @param content_type the content type.
|
|
500
520
|
* @returns `TRUE` on success, `FALSE` on error.
|
|
521
|
+
* @throws GLib.Error
|
|
501
522
|
*/
|
|
502
523
|
set_as_default_for_type(content_type: string): boolean;
|
|
503
524
|
|
|
@@ -508,6 +529,7 @@ export namespace CMenu {
|
|
|
508
529
|
* application for that content type.
|
|
509
530
|
* @param content_type the content type.
|
|
510
531
|
* @returns `TRUE` on success, `FALSE` on error.
|
|
532
|
+
* @throws GLib.Error
|
|
511
533
|
*/
|
|
512
534
|
set_as_last_used_for_type(content_type: string): boolean;
|
|
513
535
|
|
|
@@ -541,6 +563,7 @@ export namespace CMenu {
|
|
|
541
563
|
/**
|
|
542
564
|
* Obtains the information whether the {@link Gio.AppInfo} can be deleted.
|
|
543
565
|
* See {@link Gio.AppInfo.delete}.
|
|
566
|
+
* @since 2.20
|
|
544
567
|
* @virtual
|
|
545
568
|
*/
|
|
546
569
|
vfunc_can_delete(): boolean;
|
|
@@ -557,6 +580,7 @@ export namespace CMenu {
|
|
|
557
580
|
* On some platforms, there may be a difference between user-defined
|
|
558
581
|
* {@link Gio.AppInfo}s which can be deleted, and system-wide ones which cannot.
|
|
559
582
|
* See {@link Gio.AppInfo.can_delete}.
|
|
583
|
+
* @since 2.20
|
|
560
584
|
* @virtual
|
|
561
585
|
*/
|
|
562
586
|
vfunc_do_delete(): boolean;
|
|
@@ -581,6 +605,7 @@ export namespace CMenu {
|
|
|
581
605
|
/**
|
|
582
606
|
* Gets the commandline with which the application will be
|
|
583
607
|
* started.
|
|
608
|
+
* @since 2.20
|
|
584
609
|
* @virtual
|
|
585
610
|
*/
|
|
586
611
|
vfunc_get_commandline(): string | null;
|
|
@@ -594,6 +619,7 @@ export namespace CMenu {
|
|
|
594
619
|
/**
|
|
595
620
|
* Gets the display name of the application. The display name is often more
|
|
596
621
|
* descriptive to the user than the name itself.
|
|
622
|
+
* @since 2.24
|
|
597
623
|
* @virtual
|
|
598
624
|
*/
|
|
599
625
|
vfunc_get_display_name(): string;
|
|
@@ -639,6 +665,7 @@ export namespace CMenu {
|
|
|
639
665
|
* This function does not take in consideration associations added with
|
|
640
666
|
* {@link Gio.AppInfo.add_supports_type}, but only those exported directly by
|
|
641
667
|
* the application.
|
|
668
|
+
* @since 2.34
|
|
642
669
|
* @virtual
|
|
643
670
|
*/
|
|
644
671
|
vfunc_get_supported_types(): string[] | null;
|
|
@@ -707,6 +734,7 @@ export namespace CMenu {
|
|
|
707
734
|
* @param context the launch context
|
|
708
735
|
* @param cancellable a {@link Gio.Cancellable}
|
|
709
736
|
* @param callback a {@link Gio.AsyncReadyCallback} to call when the request is done
|
|
737
|
+
* @since 2.60
|
|
710
738
|
* @virtual
|
|
711
739
|
*/
|
|
712
740
|
vfunc_launch_uris_async(uris: string[] | null, context: Gio.AppLaunchContext | null, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void;
|
|
@@ -714,6 +742,7 @@ export namespace CMenu {
|
|
|
714
742
|
/**
|
|
715
743
|
* Finishes a {@link Gio.AppInfo.launch_uris_async} operation.
|
|
716
744
|
* @param result the async result
|
|
745
|
+
* @since 2.60
|
|
717
746
|
* @virtual
|
|
718
747
|
*/
|
|
719
748
|
vfunc_launch_uris_finish(result: Gio.AsyncResult): boolean;
|
|
@@ -915,6 +944,7 @@ export namespace CMenu {
|
|
|
915
944
|
* performs a significant amount of blocking I/O if the
|
|
916
945
|
* tree has not been loaded yet.
|
|
917
946
|
* @returns `true` on success, `false` on error
|
|
947
|
+
* @throws GLib.Error
|
|
918
948
|
*/
|
|
919
949
|
load_sync(): boolean;
|
|
920
950
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@girs/cmenu-3.0",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "GJS TypeScript type definitions for CMenu-3.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "cmenu-3.0.js",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"test": "tsc --project tsconfig.json"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@girs/gjs": "^4.
|
|
35
|
-
"@girs/gio-2.0": "^4.
|
|
36
|
-
"@girs/gobject-2.0": "^4.
|
|
37
|
-
"@girs/glib-2.0": "^4.
|
|
38
|
-
"@girs/gmodule-2.0": "^4.
|
|
34
|
+
"@girs/gjs": "^4.5.0",
|
|
35
|
+
"@girs/gio-2.0": "^4.5.0",
|
|
36
|
+
"@girs/gobject-2.0": "^4.5.0",
|
|
37
|
+
"@girs/glib-2.0": "^4.5.0",
|
|
38
|
+
"@girs/gmodule-2.0": "^4.5.0" },
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"typescript": "*"
|
|
41
41
|
},
|