@girs/gplugin-1.0 0.42.1-4.0.0-beta.3
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 +86 -0
- package/gplugin-1.0-ambient.d.ts +12 -0
- package/gplugin-1.0-ambient.js +2 -0
- package/gplugin-1.0-import.d.ts +12 -0
- package/gplugin-1.0-import.js +3 -0
- package/gplugin-1.0.d.ts +1093 -0
- package/gplugin-1.0.js +6 -0
- package/package.json +54 -0
- package/tsconfig.json +23 -0
- package/typedoc.json +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
|
|
2
|
+
# GPlugin-1.0
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
GJS TypeScript type definitions for GPlugin-1.0, generated from library version 0.42.1 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.3.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
To use this type definitions, install them with NPM:
|
|
14
|
+
```bash
|
|
15
|
+
npm install @girs/gplugin-1.0
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
You can import this package into your project like this:
|
|
21
|
+
```ts
|
|
22
|
+
import GPlugin from '@girs/gplugin-1.0';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Ambient Modules
|
|
26
|
+
|
|
27
|
+
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.
|
|
28
|
+
For this you need to include `@girs/gplugin-1.0` or `@girs/gplugin-1.0/ambient` in your `tsconfig` or entry point Typescript file:
|
|
29
|
+
|
|
30
|
+
`index.ts`:
|
|
31
|
+
```ts
|
|
32
|
+
import '@girs/gplugin-1.0'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`tsconfig.json`:
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"compilerOptions": {
|
|
39
|
+
...
|
|
40
|
+
},
|
|
41
|
+
"include": ["@girs/gplugin-1.0"],
|
|
42
|
+
...
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Now you can import the ambient module with TypeScript support:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import GPlugin from 'gi://GPlugin?version=1.0';
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Global import
|
|
53
|
+
|
|
54
|
+
You can also import the module with Typescript support using the global `imports.gi` object of GJS.
|
|
55
|
+
For this you need to include `@girs/gplugin-1.0` or `@girs/gplugin-1.0/import` in your `tsconfig` or entry point Typescript file:
|
|
56
|
+
|
|
57
|
+
`index.ts`:
|
|
58
|
+
```ts
|
|
59
|
+
import '@girs/gplugin-1.0'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`tsconfig.json`:
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"compilerOptions": {
|
|
66
|
+
...
|
|
67
|
+
},
|
|
68
|
+
"include": ["@girs/gplugin-1.0"],
|
|
69
|
+
...
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Now you have also type support for this, too:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
const GPlugin = imports.gi.GPlugin;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Bundle
|
|
80
|
+
|
|
81
|
+
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).
|
|
82
|
+
|
|
83
|
+
## Other packages
|
|
84
|
+
|
|
85
|
+
All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
|
|
86
|
+
|
package/gplugin-1.0.d.ts
ADDED
|
@@ -0,0 +1,1093 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Type Definitions for Gjs (https://gjs.guide/)
|
|
3
|
+
*
|
|
4
|
+
* These type definitions are automatically generated, do not edit them by hand.
|
|
5
|
+
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import './gplugin-1.0-ambient.d.ts';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* GPlugin-1.0
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type GObject from '@girs/gobject-2.0';
|
|
15
|
+
import type GLib from '@girs/glib-2.0';
|
|
16
|
+
|
|
17
|
+
export namespace GPlugin {
|
|
18
|
+
/**
|
|
19
|
+
* The known states of a plugin.
|
|
20
|
+
*/
|
|
21
|
+
enum PluginState {
|
|
22
|
+
/**
|
|
23
|
+
* The state of the plugin is unknown.
|
|
24
|
+
*/
|
|
25
|
+
UNKNOWN,
|
|
26
|
+
/**
|
|
27
|
+
* There was an error loading or unloading the
|
|
28
|
+
* plugin.
|
|
29
|
+
*/
|
|
30
|
+
ERROR,
|
|
31
|
+
/**
|
|
32
|
+
* The plugin has been queried but not loaded.
|
|
33
|
+
*/
|
|
34
|
+
QUERIED,
|
|
35
|
+
/**
|
|
36
|
+
* The plugin should be re-queried.
|
|
37
|
+
*/
|
|
38
|
+
REQUERY,
|
|
39
|
+
/**
|
|
40
|
+
* The plugin is loaded.
|
|
41
|
+
*/
|
|
42
|
+
LOADED,
|
|
43
|
+
/**
|
|
44
|
+
* The plugin failed to load.
|
|
45
|
+
*/
|
|
46
|
+
LOAD_FAILED,
|
|
47
|
+
/**
|
|
48
|
+
* The plugin failed to unload.
|
|
49
|
+
*/
|
|
50
|
+
UNLOAD_FAILED,
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* This is the extra version string of GPlugin that was compiled against.
|
|
54
|
+
*/
|
|
55
|
+
const EXTRA_VERSION: string;
|
|
56
|
+
/**
|
|
57
|
+
* This is the major version number of GPlugin that was compiled against.
|
|
58
|
+
*/
|
|
59
|
+
const MAJOR_VERSION: number;
|
|
60
|
+
/**
|
|
61
|
+
* This is the micro version number of GPlugin that was compiled against.
|
|
62
|
+
*/
|
|
63
|
+
const MICRO_VERSION: number;
|
|
64
|
+
/**
|
|
65
|
+
* This is the minor version number of GPlugin that was compiled against.
|
|
66
|
+
*/
|
|
67
|
+
const MINOR_VERSION: number;
|
|
68
|
+
/**
|
|
69
|
+
* This is the string version number of GPlugin that was compiled against.
|
|
70
|
+
*/
|
|
71
|
+
const VERSION: string;
|
|
72
|
+
const VERSION_MIN_REQUIRED: number;
|
|
73
|
+
/**
|
|
74
|
+
* Gets the core flags that were passed to [func`GPlugin`.init].
|
|
75
|
+
* @returns The core flags that GPlugin was initialized with.
|
|
76
|
+
*/
|
|
77
|
+
function get_flags(): CoreFlags;
|
|
78
|
+
/**
|
|
79
|
+
* Returns an option group for the commandline arguments recognized by GPlugin.
|
|
80
|
+
*
|
|
81
|
+
* You should add this option group to your [struct`GLib`.OptionContext] with
|
|
82
|
+
* [method`GLib`.OptionContext.add_group], if you are using
|
|
83
|
+
* [method`GLib`.OptionContext.parse] to parse your commandline arguments.
|
|
84
|
+
*
|
|
85
|
+
* If [func`GPlugin`.init] has yet to be called before
|
|
86
|
+
* [method`GLib`.OptionContext.parse] is called, [func`GPlugin`.init] will be
|
|
87
|
+
* called automatically.
|
|
88
|
+
* @returns An option group for the commandline arguments recognized by GPlugin.
|
|
89
|
+
*/
|
|
90
|
+
function get_option_group(): GLib.OptionGroup;
|
|
91
|
+
/**
|
|
92
|
+
* Initializes the GPlugin library.
|
|
93
|
+
*
|
|
94
|
+
* This function *MUST* be called before interacting with any other GPlugin
|
|
95
|
+
* API. The one exception is [func`GPlugin`.get_option_group]. Parsing options
|
|
96
|
+
* with the [struct`GLib`.OptionGroup] from [func`GPlugin`.get_option_group]
|
|
97
|
+
* internally calls [func`GPlugin`.init].
|
|
98
|
+
* @param flags The core flags to set.
|
|
99
|
+
*/
|
|
100
|
+
function init(flags: CoreFlags): void;
|
|
101
|
+
/**
|
|
102
|
+
* Gets a string representation of `state`.
|
|
103
|
+
* @param state The #GPluginPluginState.
|
|
104
|
+
* @returns The string representation of @state.
|
|
105
|
+
*/
|
|
106
|
+
function plugin_state_to_string(state: PluginState): string;
|
|
107
|
+
/**
|
|
108
|
+
* Uninitializes the GPlugin library
|
|
109
|
+
*/
|
|
110
|
+
function uninit(): void;
|
|
111
|
+
/**
|
|
112
|
+
* Checks that the GPlugin library in use is compatible with the given version.
|
|
113
|
+
*
|
|
114
|
+
* Generally you would pass in the constants [const`GPlugin`.MAJOR_VERSION],
|
|
115
|
+
* [const`GPlugin`.MINOR_VERSION], [const`GPlugin`.MICRO_VERSION] as the three
|
|
116
|
+
* arguments to this function; that produces a check that the library in use is
|
|
117
|
+
* compatible with the version of GPlugin the application or module was
|
|
118
|
+
* compiled against.
|
|
119
|
+
*
|
|
120
|
+
* Compatibility is defined by two things: first the version of the running
|
|
121
|
+
* library is newer than the version `major`.`minor`.`micro`. Second the running
|
|
122
|
+
* library must be binary compatible with the version `major`.`minor`.`micro`
|
|
123
|
+
* (same major version).
|
|
124
|
+
* @param major The required major version.
|
|
125
|
+
* @param minor The required minor version.
|
|
126
|
+
* @param micro The required micro version.
|
|
127
|
+
* @returns %NULL if the GPlugin library is compatible with the given version, or a string describing the version mismatch. The returned string is owned by GPlugin and must not be modified or freed.
|
|
128
|
+
*/
|
|
129
|
+
function version_check(major: number, minor: number, micro: number): string;
|
|
130
|
+
/**
|
|
131
|
+
* A semantic version checker which ignores any characters after the micro
|
|
132
|
+
* version.
|
|
133
|
+
* @param v1 The first version to compare.
|
|
134
|
+
* @param v2 The second version to compare.
|
|
135
|
+
* @returns less than 0 if @v1 is less than @v2, 0 if @v1 is equal to @v1, and greater than 0 if @v1 is greater than @v2.
|
|
136
|
+
*/
|
|
137
|
+
function version_compare(v1: string, v2: string): number;
|
|
138
|
+
interface ManagerForeachFunc {
|
|
139
|
+
(id: string, plugins: Plugin[], data?: any | null): void;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Flags to configure behaviors in GPlugin.
|
|
143
|
+
*/
|
|
144
|
+
enum CoreFlags {
|
|
145
|
+
/**
|
|
146
|
+
* No flags.
|
|
147
|
+
*/
|
|
148
|
+
NONE,
|
|
149
|
+
/**
|
|
150
|
+
* Disable the native plugin loader.
|
|
151
|
+
*/
|
|
152
|
+
DISABLE_NATIVE_LOADER,
|
|
153
|
+
/**
|
|
154
|
+
* Log plugin state changes with
|
|
155
|
+
* g_message. Since: 0.34.0
|
|
156
|
+
*/
|
|
157
|
+
LOG_PLUGIN_STATE_CHANGES,
|
|
158
|
+
}
|
|
159
|
+
module Loader {
|
|
160
|
+
// Constructor properties interface
|
|
161
|
+
|
|
162
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
163
|
+
id: string;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* An abstract class that should not be accessed directly.
|
|
169
|
+
*/
|
|
170
|
+
abstract class Loader extends GObject.Object {
|
|
171
|
+
static $gtype: GObject.GType<Loader>;
|
|
172
|
+
|
|
173
|
+
// Own properties of GPlugin.Loader
|
|
174
|
+
|
|
175
|
+
get id(): string;
|
|
176
|
+
|
|
177
|
+
// Constructors of GPlugin.Loader
|
|
178
|
+
|
|
179
|
+
constructor(properties?: Partial<Loader.ConstructorProps>, ...args: any[]);
|
|
180
|
+
|
|
181
|
+
_init(...args: any[]): void;
|
|
182
|
+
|
|
183
|
+
// Own virtual methods of GPlugin.Loader
|
|
184
|
+
|
|
185
|
+
vfunc_load(plugin: Plugin): boolean;
|
|
186
|
+
vfunc_unload(plugin: Plugin, shutdown: boolean): boolean;
|
|
187
|
+
|
|
188
|
+
// Own methods of GPlugin.Loader
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Gets the identifier of `loader`.
|
|
192
|
+
* @returns The ID of @loader.
|
|
193
|
+
*/
|
|
194
|
+
get_id(): string;
|
|
195
|
+
/**
|
|
196
|
+
* Returns a [struct`GLib`.SList] of strings containing the extensions that the
|
|
197
|
+
* loader supports. Each extension should not include the dot. For example:
|
|
198
|
+
* so, dll, py, etc.
|
|
199
|
+
* @returns A [struct@GLib.SList] of extensions that the loader supports.
|
|
200
|
+
*/
|
|
201
|
+
get_supported_extensions(): string[];
|
|
202
|
+
/**
|
|
203
|
+
* This function is called by the plugin manager to ask `loader` to load
|
|
204
|
+
* `plugin`.
|
|
205
|
+
* @param plugin The plugin instance to load.
|
|
206
|
+
* @returns %TRUE if @plugin was loaded successfully, %FALSE otherwise.
|
|
207
|
+
*/
|
|
208
|
+
load_plugin(plugin: Plugin): boolean;
|
|
209
|
+
/**
|
|
210
|
+
* This function is called by the plugin manager to ask `loader` to query
|
|
211
|
+
* `filename` and determine if it's a usable plugin.
|
|
212
|
+
* @param filename The filename to query.
|
|
213
|
+
* @returns A plugin instance or %NULL on failure.
|
|
214
|
+
*/
|
|
215
|
+
query_plugin(filename: string): Plugin;
|
|
216
|
+
/**
|
|
217
|
+
* This function is called by the plugin manager to ask `loader` to unload
|
|
218
|
+
* `plugin`.
|
|
219
|
+
* @param plugin The plugin instance to unload.
|
|
220
|
+
* @param shutdown Whether or not GPlugin is shutting down.
|
|
221
|
+
* @returns %TRUE if @plugin was unloaded successfully, %FALSE otherwise.
|
|
222
|
+
*/
|
|
223
|
+
unload_plugin(plugin: Plugin, shutdown: boolean): boolean;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
module Manager {
|
|
227
|
+
// Signal callback interfaces
|
|
228
|
+
|
|
229
|
+
interface LoadPluginFailed {
|
|
230
|
+
(plugin: GObject.Object, error: GLib.Error): void;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
interface LoadedPlugin {
|
|
234
|
+
(plugin: GObject.Object): void;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
interface LoaderRegistered {
|
|
238
|
+
(loader: Loader): void;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
interface LoaderUnregistered {
|
|
242
|
+
(loader: Loader): void;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
interface LoadingPlugin {
|
|
246
|
+
(plugin: GObject.Object, error?: any | null): boolean;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
interface UnloadPluginFailed {
|
|
250
|
+
(plugin: GObject.Object, error: GLib.Error): void;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
interface UnloadedPlugin {
|
|
254
|
+
(plugin: GObject.Object): void;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
interface UnloadingPlugin {
|
|
258
|
+
(plugin: GObject.Object, error?: any | null): boolean;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Constructor properties interface
|
|
262
|
+
|
|
263
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* The manager is responsible for querying plugins as well as telling loaders
|
|
268
|
+
* when to load and unload plugins. It also keeps track of paths that should be
|
|
269
|
+
* searched for plugins.
|
|
270
|
+
*/
|
|
271
|
+
class Manager extends GObject.Object {
|
|
272
|
+
static $gtype: GObject.GType<Manager>;
|
|
273
|
+
|
|
274
|
+
// Constructors of GPlugin.Manager
|
|
275
|
+
|
|
276
|
+
constructor(properties?: Partial<Manager.ConstructorProps>, ...args: any[]);
|
|
277
|
+
|
|
278
|
+
_init(...args: any[]): void;
|
|
279
|
+
|
|
280
|
+
// Own signals of GPlugin.Manager
|
|
281
|
+
|
|
282
|
+
connect(id: string, callback: (...args: any[]) => any): number;
|
|
283
|
+
connect_after(id: string, callback: (...args: any[]) => any): number;
|
|
284
|
+
emit(id: string, ...args: any[]): void;
|
|
285
|
+
connect(
|
|
286
|
+
signal: 'load-plugin-failed',
|
|
287
|
+
callback: (_source: this, plugin: GObject.Object, error: GLib.Error) => void,
|
|
288
|
+
): number;
|
|
289
|
+
connect_after(
|
|
290
|
+
signal: 'load-plugin-failed',
|
|
291
|
+
callback: (_source: this, plugin: GObject.Object, error: GLib.Error) => void,
|
|
292
|
+
): number;
|
|
293
|
+
emit(signal: 'load-plugin-failed', plugin: GObject.Object, error: GLib.Error): void;
|
|
294
|
+
connect(signal: 'loaded-plugin', callback: (_source: this, plugin: GObject.Object) => void): number;
|
|
295
|
+
connect_after(signal: 'loaded-plugin', callback: (_source: this, plugin: GObject.Object) => void): number;
|
|
296
|
+
emit(signal: 'loaded-plugin', plugin: GObject.Object): void;
|
|
297
|
+
connect(signal: 'loader-registered', callback: (_source: this, loader: Loader) => void): number;
|
|
298
|
+
connect_after(signal: 'loader-registered', callback: (_source: this, loader: Loader) => void): number;
|
|
299
|
+
emit(signal: 'loader-registered', loader: Loader): void;
|
|
300
|
+
connect(signal: 'loader-unregistered', callback: (_source: this, loader: Loader) => void): number;
|
|
301
|
+
connect_after(signal: 'loader-unregistered', callback: (_source: this, loader: Loader) => void): number;
|
|
302
|
+
emit(signal: 'loader-unregistered', loader: Loader): void;
|
|
303
|
+
connect(
|
|
304
|
+
signal: 'loading-plugin',
|
|
305
|
+
callback: (_source: this, plugin: GObject.Object, error: any | null) => boolean,
|
|
306
|
+
): number;
|
|
307
|
+
connect_after(
|
|
308
|
+
signal: 'loading-plugin',
|
|
309
|
+
callback: (_source: this, plugin: GObject.Object, error: any | null) => boolean,
|
|
310
|
+
): number;
|
|
311
|
+
emit(signal: 'loading-plugin', plugin: GObject.Object, error?: any | null): void;
|
|
312
|
+
connect(
|
|
313
|
+
signal: 'unload-plugin-failed',
|
|
314
|
+
callback: (_source: this, plugin: GObject.Object, error: GLib.Error) => void,
|
|
315
|
+
): number;
|
|
316
|
+
connect_after(
|
|
317
|
+
signal: 'unload-plugin-failed',
|
|
318
|
+
callback: (_source: this, plugin: GObject.Object, error: GLib.Error) => void,
|
|
319
|
+
): number;
|
|
320
|
+
emit(signal: 'unload-plugin-failed', plugin: GObject.Object, error: GLib.Error): void;
|
|
321
|
+
connect(signal: 'unloaded-plugin', callback: (_source: this, plugin: GObject.Object) => void): number;
|
|
322
|
+
connect_after(signal: 'unloaded-plugin', callback: (_source: this, plugin: GObject.Object) => void): number;
|
|
323
|
+
emit(signal: 'unloaded-plugin', plugin: GObject.Object): void;
|
|
324
|
+
connect(
|
|
325
|
+
signal: 'unloading-plugin',
|
|
326
|
+
callback: (_source: this, plugin: GObject.Object, error: any | null) => boolean,
|
|
327
|
+
): number;
|
|
328
|
+
connect_after(
|
|
329
|
+
signal: 'unloading-plugin',
|
|
330
|
+
callback: (_source: this, plugin: GObject.Object, error: any | null) => boolean,
|
|
331
|
+
): number;
|
|
332
|
+
emit(signal: 'unloading-plugin', plugin: GObject.Object, error?: any | null): void;
|
|
333
|
+
|
|
334
|
+
// Own static methods of GPlugin.Manager
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Gets the default plugin manager in GPlugin.
|
|
338
|
+
*/
|
|
339
|
+
static get_default(): Manager;
|
|
340
|
+
|
|
341
|
+
// Own methods of GPlugin.Manager
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Adds the application installation path for `appname`.
|
|
345
|
+
*
|
|
346
|
+
* This will add `{prefix}/{appname}/plugins` to the list as well as
|
|
347
|
+
* `${XDG_CONFIG_HOME}/{appname}/plugins`.
|
|
348
|
+
* @param prefix The installation prefix for the application.
|
|
349
|
+
* @param appname The name of the application whose paths to add.
|
|
350
|
+
*/
|
|
351
|
+
add_app_paths(prefix: string, appname: string): void;
|
|
352
|
+
/**
|
|
353
|
+
* Adds the path that GPlugin was installed to to the plugin search path, as
|
|
354
|
+
* well as `${XDG_CONFIG_HOME}/gplugin` so users can install additional loaders
|
|
355
|
+
* themselves.
|
|
356
|
+
*/
|
|
357
|
+
add_default_paths(): void;
|
|
358
|
+
/**
|
|
359
|
+
* Adds `path` to the end of the list of paths to search for plugins.
|
|
360
|
+
* @param path A path to add to the end of the plugin search paths.
|
|
361
|
+
*/
|
|
362
|
+
append_path(path: string): void;
|
|
363
|
+
/**
|
|
364
|
+
* Append the paths held in the environment variable `name` to the list.
|
|
365
|
+
* @param name The name of the environment variable containing the paths to add.
|
|
366
|
+
*/
|
|
367
|
+
append_paths_from_environment(name: string): void;
|
|
368
|
+
/**
|
|
369
|
+
* Finds the first plugin matching `id`.
|
|
370
|
+
*
|
|
371
|
+
* This function uses [method`GPlugin`.Manager.find_plugins] and returns the
|
|
372
|
+
* first plugin in the list.
|
|
373
|
+
* @param id The ID of the plugin to find.
|
|
374
|
+
* @returns A plugin instance or %NULL if no plugin matching @id was found.
|
|
375
|
+
*/
|
|
376
|
+
find_plugin(id: string): Plugin;
|
|
377
|
+
/**
|
|
378
|
+
* Calls [method`GPlugin`.Manager.find_plugins] with `id,` and then returns the
|
|
379
|
+
* plugins with the highest version number or %NULL if no plugins with `id` are
|
|
380
|
+
* found.
|
|
381
|
+
* @param id The ID of the plugin to find.
|
|
382
|
+
* @returns The plugin with an ID of @id that has the highest version number, or %NULL if no plugins were found with @id.
|
|
383
|
+
*/
|
|
384
|
+
find_plugin_with_newest_version(id: string): Plugin;
|
|
385
|
+
/**
|
|
386
|
+
* Finds all plugins matching `id`.
|
|
387
|
+
* @param id The ID of the plugin to find.
|
|
388
|
+
* @returns A [struct@GLib.SList] of plugins matching @id.
|
|
389
|
+
*/
|
|
390
|
+
find_plugins(id: string): Plugin[];
|
|
391
|
+
/**
|
|
392
|
+
* Finds all plugins that currently have a state of `state`.
|
|
393
|
+
* @param state The state to look for.
|
|
394
|
+
* @returns A [struct@GLib.SList] of plugins whose state is @state.
|
|
395
|
+
*/
|
|
396
|
+
find_plugins_with_state(state: PluginState): Plugin[];
|
|
397
|
+
/**
|
|
398
|
+
* Similar to [method`GPlugin`.Manager.find_plugins] but only returns plugins
|
|
399
|
+
* whose versions match `op` and `version`.
|
|
400
|
+
*
|
|
401
|
+
* This is primarily used for dependency loading where a plugin may depend on a
|
|
402
|
+
* specific range of versions of another plugin.
|
|
403
|
+
* @param id The ID of the plugin to find.
|
|
404
|
+
* @param op one of <, <=, =, ==, >=, >.
|
|
405
|
+
* @param version The version to compare against.
|
|
406
|
+
* @returns A [struct@GLib.SList] of plugins matching @id and the version constraint.
|
|
407
|
+
*/
|
|
408
|
+
find_plugins_with_version(id: string, op: string, version: string): Plugin[];
|
|
409
|
+
/**
|
|
410
|
+
* Calls `func` for each plugin that is known.
|
|
411
|
+
* @param func The function to call with each plugin.
|
|
412
|
+
*/
|
|
413
|
+
foreach(func: ManagerForeachFunc): void;
|
|
414
|
+
/**
|
|
415
|
+
* Returns a list of all registered loaders.
|
|
416
|
+
* @returns Returns a list of all registered loaders.
|
|
417
|
+
*/
|
|
418
|
+
get_loaders(): Loader[];
|
|
419
|
+
/**
|
|
420
|
+
* Gets the list of paths which will be searched for plugins.
|
|
421
|
+
* @returns The [type@GLib.List] of paths which will be searched for plugins.
|
|
422
|
+
*/
|
|
423
|
+
get_paths(): string[];
|
|
424
|
+
/**
|
|
425
|
+
* Returns a list of all the plugins that `plugin` depends on.
|
|
426
|
+
* @param plugin The plugin whose dependencies to get.
|
|
427
|
+
* @returns A [struct@GLib.SList] of plugins that @plugin depends on, or %NULL on error with @error set.
|
|
428
|
+
*/
|
|
429
|
+
get_plugin_dependencies(plugin: Plugin): Plugin[];
|
|
430
|
+
/**
|
|
431
|
+
* Returns a list of all plugin IDs.
|
|
432
|
+
*
|
|
433
|
+
* Each id should be queried directly for more information.
|
|
434
|
+
* @returns A [struct@GLib.List] of each unique plugin ID.
|
|
435
|
+
*/
|
|
436
|
+
list_plugins(): string[];
|
|
437
|
+
/**
|
|
438
|
+
* Loads `plugin` and all of its dependencies.
|
|
439
|
+
*
|
|
440
|
+
* If a dependency can not be loaded, `plugin` will not be loaded either.
|
|
441
|
+
* However, any other plugins that `plugin` depends on that were loaded from
|
|
442
|
+
* this call, will not be unloaded.
|
|
443
|
+
* @param plugin The plugin instance.
|
|
444
|
+
* @returns %TRUE if @plugin was loaded successfully or already loaded, %FALSE otherwise.
|
|
445
|
+
*/
|
|
446
|
+
load_plugin(plugin: Plugin): boolean;
|
|
447
|
+
/**
|
|
448
|
+
* Adds `path` to the beginning of the list of paths to search for plugins.
|
|
449
|
+
* @param path A path to add to the beginning of the plugin search paths.
|
|
450
|
+
*/
|
|
451
|
+
prepend_path(path: string): void;
|
|
452
|
+
/**
|
|
453
|
+
* Prepends the paths held in the environment variable `name` to the list.
|
|
454
|
+
* @param name The name of the environment variable containing the paths to add.
|
|
455
|
+
*/
|
|
456
|
+
prepend_paths_from_environment(name: string): void;
|
|
457
|
+
/**
|
|
458
|
+
* Forces a refresh of all plugins found in the search paths.
|
|
459
|
+
*/
|
|
460
|
+
refresh(): void;
|
|
461
|
+
/**
|
|
462
|
+
* Registers `loader` as an available loader.
|
|
463
|
+
* @param loader The loader instance to register.
|
|
464
|
+
* @returns %TRUE if the loader was successfully register, %FALSE otherwise with @error set.
|
|
465
|
+
*/
|
|
466
|
+
register_loader(loader: Loader): boolean;
|
|
467
|
+
/**
|
|
468
|
+
* Removes `path` from the list of paths to search for plugins.
|
|
469
|
+
* @param path A path to remove from the plugin search paths.
|
|
470
|
+
*/
|
|
471
|
+
remove_path(path: string): void;
|
|
472
|
+
/**
|
|
473
|
+
* Clears all paths that are set to search for plugins.
|
|
474
|
+
*/
|
|
475
|
+
remove_paths(): void;
|
|
476
|
+
/**
|
|
477
|
+
* Unloads `plugin`.
|
|
478
|
+
*
|
|
479
|
+
* If `plugin` has dependencies, they are not unloaded.
|
|
480
|
+
* @param plugin The plugin instance.
|
|
481
|
+
* @returns %TRUE if @plugin was unloaded successfully or not loaded, %FALSE otherwise.
|
|
482
|
+
*/
|
|
483
|
+
unload_plugin(plugin: Plugin): boolean;
|
|
484
|
+
/**
|
|
485
|
+
* Unregisters `loader` as an available loader.
|
|
486
|
+
* @param loader The loader instance to unregister.
|
|
487
|
+
* @returns %TRUE if the loader was successfully unregistered, %FALSE otherwise with @error set.
|
|
488
|
+
*/
|
|
489
|
+
unregister_loader(loader: Loader): boolean;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
module PluginInfo {
|
|
493
|
+
// Constructor properties interface
|
|
494
|
+
|
|
495
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
496
|
+
abi_version: number;
|
|
497
|
+
abiVersion: number;
|
|
498
|
+
authors: string[];
|
|
499
|
+
auto_load: boolean;
|
|
500
|
+
autoLoad: boolean;
|
|
501
|
+
bind_global: boolean;
|
|
502
|
+
bindGlobal: boolean;
|
|
503
|
+
category: string;
|
|
504
|
+
dependencies: string[];
|
|
505
|
+
description: string;
|
|
506
|
+
icon_name: string;
|
|
507
|
+
iconName: string;
|
|
508
|
+
id: string;
|
|
509
|
+
internal: boolean;
|
|
510
|
+
license_id: string;
|
|
511
|
+
licenseId: string;
|
|
512
|
+
license_text: string;
|
|
513
|
+
licenseText: string;
|
|
514
|
+
license_url: string;
|
|
515
|
+
licenseUrl: string;
|
|
516
|
+
load_on_query: boolean;
|
|
517
|
+
loadOnQuery: boolean;
|
|
518
|
+
name: string;
|
|
519
|
+
priority: number;
|
|
520
|
+
provides: string[];
|
|
521
|
+
settings_schema: string;
|
|
522
|
+
settingsSchema: string;
|
|
523
|
+
summary: string;
|
|
524
|
+
unloadable: boolean;
|
|
525
|
+
version: string;
|
|
526
|
+
website: string;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* #GPluginPluginInfo holds all of the data about a plugin. It is created when
|
|
532
|
+
* a plugin is queried.
|
|
533
|
+
*/
|
|
534
|
+
class PluginInfo extends GObject.Object {
|
|
535
|
+
static $gtype: GObject.GType<PluginInfo>;
|
|
536
|
+
|
|
537
|
+
// Own properties of GPlugin.PluginInfo
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* The GPlugin ABI version that the plugin was compiled against.
|
|
541
|
+
*
|
|
542
|
+
* GPlugin only uses the first byte (`0xff000000`) of this value. The
|
|
543
|
+
* remaining 3 bytes are available for the application to use.
|
|
544
|
+
*
|
|
545
|
+
* Take the following example from an application:
|
|
546
|
+
*
|
|
547
|
+
*
|
|
548
|
+
* ```c
|
|
549
|
+
* #define ABI_VERSION (GPLUGIN_NATIVE_ABI_VERSION |
|
|
550
|
+
* (APPLICATION_MAJOR_VERSION << 8) |
|
|
551
|
+
* (APPLICATION_MINOR_VERSION))
|
|
552
|
+
* ```
|
|
553
|
+
*
|
|
554
|
+
*
|
|
555
|
+
* The application here uses the third and fourth bytes, but could use
|
|
556
|
+
* the second as well.
|
|
557
|
+
*/
|
|
558
|
+
get abi_version(): number;
|
|
559
|
+
/**
|
|
560
|
+
* The GPlugin ABI version that the plugin was compiled against.
|
|
561
|
+
*
|
|
562
|
+
* GPlugin only uses the first byte (`0xff000000`) of this value. The
|
|
563
|
+
* remaining 3 bytes are available for the application to use.
|
|
564
|
+
*
|
|
565
|
+
* Take the following example from an application:
|
|
566
|
+
*
|
|
567
|
+
*
|
|
568
|
+
* ```c
|
|
569
|
+
* #define ABI_VERSION (GPLUGIN_NATIVE_ABI_VERSION |
|
|
570
|
+
* (APPLICATION_MAJOR_VERSION << 8) |
|
|
571
|
+
* (APPLICATION_MINOR_VERSION))
|
|
572
|
+
* ```
|
|
573
|
+
*
|
|
574
|
+
*
|
|
575
|
+
* The application here uses the third and fourth bytes, but could use
|
|
576
|
+
* the second as well.
|
|
577
|
+
*/
|
|
578
|
+
get abiVersion(): number;
|
|
579
|
+
/**
|
|
580
|
+
* A list of the names and email addresses of the authors.
|
|
581
|
+
*
|
|
582
|
+
* It is recommended to use the RFC 822, 2822 format of:
|
|
583
|
+
* `"First Last <user`domain`.com>"`.
|
|
584
|
+
*/
|
|
585
|
+
get authors(): string[];
|
|
586
|
+
/**
|
|
587
|
+
* Whether or not the plugin should be loaded when it's queried.
|
|
588
|
+
*
|
|
589
|
+
* This is used by the loaders and may be useful to your application as
|
|
590
|
+
* well.
|
|
591
|
+
*
|
|
592
|
+
* Defaults to %FALSE.
|
|
593
|
+
*/
|
|
594
|
+
get auto_load(): boolean;
|
|
595
|
+
/**
|
|
596
|
+
* Whether or not the plugin should be loaded when it's queried.
|
|
597
|
+
*
|
|
598
|
+
* This is used by the loaders and may be useful to your application as
|
|
599
|
+
* well.
|
|
600
|
+
*
|
|
601
|
+
* Defaults to %FALSE.
|
|
602
|
+
*/
|
|
603
|
+
get autoLoad(): boolean;
|
|
604
|
+
/**
|
|
605
|
+
* Determines whether the plugin should be have its symbols bound globally.
|
|
606
|
+
*
|
|
607
|
+
* Note: This should only be used by the native plugin loader.
|
|
608
|
+
*/
|
|
609
|
+
get bind_global(): boolean;
|
|
610
|
+
/**
|
|
611
|
+
* Determines whether the plugin should be have its symbols bound globally.
|
|
612
|
+
*
|
|
613
|
+
* Note: This should only be used by the native plugin loader.
|
|
614
|
+
*/
|
|
615
|
+
get bindGlobal(): boolean;
|
|
616
|
+
/**
|
|
617
|
+
* The category of this plugin.
|
|
618
|
+
*
|
|
619
|
+
* This property is used to organize plugins into categories in a user
|
|
620
|
+
* interface. It is recommended that an application has a well defined
|
|
621
|
+
* set of categories that plugin authors should use, and put all plugins
|
|
622
|
+
* that don't match this category into an "Other" category.
|
|
623
|
+
*/
|
|
624
|
+
get category(): string;
|
|
625
|
+
/**
|
|
626
|
+
* A comma separated list of plugin id's that this plugin depends on.
|
|
627
|
+
*/
|
|
628
|
+
get dependencies(): string[];
|
|
629
|
+
/**
|
|
630
|
+
* The full description of the plugin that will be used in a "more
|
|
631
|
+
* information" section in a user interface.
|
|
632
|
+
*/
|
|
633
|
+
get description(): string;
|
|
634
|
+
/**
|
|
635
|
+
* A XDG icon name for the plugin. The actual use of this is determined by
|
|
636
|
+
* the application/library using GPlugin.
|
|
637
|
+
*/
|
|
638
|
+
get icon_name(): string;
|
|
639
|
+
/**
|
|
640
|
+
* A XDG icon name for the plugin. The actual use of this is determined by
|
|
641
|
+
* the application/library using GPlugin.
|
|
642
|
+
*/
|
|
643
|
+
get iconName(): string;
|
|
644
|
+
/**
|
|
645
|
+
* The id of the plugin.
|
|
646
|
+
*
|
|
647
|
+
* While not required, the recommended convention is to use the following
|
|
648
|
+
* format: <application or library>/<name of the plugin>.
|
|
649
|
+
*
|
|
650
|
+
* For example, the Python3 loader in GPlugin has an id of
|
|
651
|
+
* "gplugin/python3-loader".
|
|
652
|
+
*/
|
|
653
|
+
get id(): string;
|
|
654
|
+
/**
|
|
655
|
+
* Whether or not the plugin is considered an "internal" plugin.
|
|
656
|
+
*
|
|
657
|
+
* Defaults to %FALSE.
|
|
658
|
+
*/
|
|
659
|
+
get internal(): boolean;
|
|
660
|
+
/**
|
|
661
|
+
* The short name of the license.
|
|
662
|
+
*
|
|
663
|
+
* It is recommended to use the identifier of the license from
|
|
664
|
+
* https://spdx.org/licenses/ and should be "Other" for licenses that are
|
|
665
|
+
* not listed.
|
|
666
|
+
*
|
|
667
|
+
* If a plugin has multiple license, they should be separated by a pipe
|
|
668
|
+
* (|). In the odd case that you have multiple licenses that are used at
|
|
669
|
+
* the same time, they should be separated by an ampersand (&).
|
|
670
|
+
*/
|
|
671
|
+
get license_id(): string;
|
|
672
|
+
/**
|
|
673
|
+
* The short name of the license.
|
|
674
|
+
*
|
|
675
|
+
* It is recommended to use the identifier of the license from
|
|
676
|
+
* https://spdx.org/licenses/ and should be "Other" for licenses that are
|
|
677
|
+
* not listed.
|
|
678
|
+
*
|
|
679
|
+
* If a plugin has multiple license, they should be separated by a pipe
|
|
680
|
+
* (|). In the odd case that you have multiple licenses that are used at
|
|
681
|
+
* the same time, they should be separated by an ampersand (&).
|
|
682
|
+
*/
|
|
683
|
+
get licenseId(): string;
|
|
684
|
+
/**
|
|
685
|
+
* The text of the license for this plugin. This should only be used when
|
|
686
|
+
* the plugin is licensed under a license that is not listed at spdx.org.
|
|
687
|
+
*/
|
|
688
|
+
get license_text(): string;
|
|
689
|
+
/**
|
|
690
|
+
* The text of the license for this plugin. This should only be used when
|
|
691
|
+
* the plugin is licensed under a license that is not listed at spdx.org.
|
|
692
|
+
*/
|
|
693
|
+
get licenseText(): string;
|
|
694
|
+
/**
|
|
695
|
+
* The url to the text of the license. This should primarily only be used
|
|
696
|
+
* for licenses not listed at spdx.org.
|
|
697
|
+
*/
|
|
698
|
+
get license_url(): string;
|
|
699
|
+
/**
|
|
700
|
+
* The url to the text of the license. This should primarily only be used
|
|
701
|
+
* for licenses not listed at spdx.org.
|
|
702
|
+
*/
|
|
703
|
+
get licenseUrl(): string;
|
|
704
|
+
/**
|
|
705
|
+
* Whether or not the plugin should be loaded when it's queried.
|
|
706
|
+
*
|
|
707
|
+
* This is used by the loaders and may be useful to your application as
|
|
708
|
+
* well.
|
|
709
|
+
*
|
|
710
|
+
* Defaults to %FALSE.
|
|
711
|
+
*/
|
|
712
|
+
get load_on_query(): boolean;
|
|
713
|
+
/**
|
|
714
|
+
* Whether or not the plugin should be loaded when it's queried.
|
|
715
|
+
*
|
|
716
|
+
* This is used by the loaders and may be useful to your application as
|
|
717
|
+
* well.
|
|
718
|
+
*
|
|
719
|
+
* Defaults to %FALSE.
|
|
720
|
+
*/
|
|
721
|
+
get loadOnQuery(): boolean;
|
|
722
|
+
/**
|
|
723
|
+
* The display name of the plugin. This should be a translated string.
|
|
724
|
+
*/
|
|
725
|
+
get name(): string;
|
|
726
|
+
/**
|
|
727
|
+
* The priority that this plugin should have when determining which plugin
|
|
728
|
+
* to use when multiple plugins have the same id or provides. Higher values
|
|
729
|
+
* take precedence over lower values. If two plugins have the same id and
|
|
730
|
+
* priority, the first one found will be used.
|
|
731
|
+
*/
|
|
732
|
+
get priority(): number;
|
|
733
|
+
/**
|
|
734
|
+
* A list of additional plugin ids and versions that this plugin can
|
|
735
|
+
* provide. This mechanism is used so that plugins can replace and extend
|
|
736
|
+
* the behavior of other plugins.
|
|
737
|
+
*
|
|
738
|
+
* The format fields should either be <literal><plugin-id></literal>
|
|
739
|
+
* or <literal><plugin-id>=<plugin-version></literal>. The
|
|
740
|
+
* optional version is used to help resolve dependencies that are based
|
|
741
|
+
* on a specific version.
|
|
742
|
+
*/
|
|
743
|
+
get provides(): string[];
|
|
744
|
+
/**
|
|
745
|
+
* The ID of the [class`Gio`.Settings] schema for the plugin.
|
|
746
|
+
*/
|
|
747
|
+
get settings_schema(): string;
|
|
748
|
+
/**
|
|
749
|
+
* The ID of the [class`Gio`.Settings] schema for the plugin.
|
|
750
|
+
*/
|
|
751
|
+
get settingsSchema(): string;
|
|
752
|
+
/**
|
|
753
|
+
* A short description of the plugin that can be listed with the name in a
|
|
754
|
+
* user interface.
|
|
755
|
+
*/
|
|
756
|
+
get summary(): string;
|
|
757
|
+
/**
|
|
758
|
+
* Sets whether or not a plugin is unloadable. See
|
|
759
|
+
* [method`GPlugin`.PluginInfo.get_unloadable] for more information.
|
|
760
|
+
*/
|
|
761
|
+
get unloadable(): boolean;
|
|
762
|
+
/**
|
|
763
|
+
* The version of the plugin. Preferably a semantic version.
|
|
764
|
+
*/
|
|
765
|
+
get version(): string;
|
|
766
|
+
/**
|
|
767
|
+
* The url of the plugin that can be represented in a user interface.
|
|
768
|
+
*/
|
|
769
|
+
get website(): string;
|
|
770
|
+
|
|
771
|
+
// Constructors of GPlugin.PluginInfo
|
|
772
|
+
|
|
773
|
+
constructor(properties?: Partial<PluginInfo.ConstructorProps>, ...args: any[]);
|
|
774
|
+
|
|
775
|
+
_init(...args: any[]): void;
|
|
776
|
+
|
|
777
|
+
// Own methods of GPlugin.PluginInfo
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Returns the ABI or Application Binary Interface version that the plugin
|
|
781
|
+
* is supposed to work against.
|
|
782
|
+
* @returns The abi_version from @info.
|
|
783
|
+
*/
|
|
784
|
+
get_abi_version(): number;
|
|
785
|
+
/**
|
|
786
|
+
* Returns the authors of the plugin as specified in `info`.
|
|
787
|
+
* @returns The authors from @info.
|
|
788
|
+
*/
|
|
789
|
+
get_authors(): string[];
|
|
790
|
+
/**
|
|
791
|
+
* Returns whether or not this plugin should be loaded when queried. This is
|
|
792
|
+
* useful for internal plugins that are adding functionality and should always
|
|
793
|
+
* be turned on. The plugin loaders use this to make sure all plugins can
|
|
794
|
+
* always be loaded.
|
|
795
|
+
* @returns %TRUE if the plugin should be loaded when queried, %FALSE otherwise.
|
|
796
|
+
*/
|
|
797
|
+
get_auto_load(): boolean;
|
|
798
|
+
/**
|
|
799
|
+
* This property and therefore function is only used by the native plugin
|
|
800
|
+
* loader.
|
|
801
|
+
* @returns %TRUE if the plugin has requested to be loaded with its symbols bound global, %FALSE if they should be bound locally.
|
|
802
|
+
*/
|
|
803
|
+
get_bind_global(): boolean;
|
|
804
|
+
/**
|
|
805
|
+
* Returns the category of the plugin as specified in `info`.
|
|
806
|
+
* @returns The category from @info.
|
|
807
|
+
*/
|
|
808
|
+
get_category(): string;
|
|
809
|
+
/**
|
|
810
|
+
* Returns the dependencies of the plugins as specified in `info`.
|
|
811
|
+
* @returns The list of dependencies from @info.
|
|
812
|
+
*/
|
|
813
|
+
get_dependencies(): string[];
|
|
814
|
+
/**
|
|
815
|
+
* Returns the description for the plugin as specified in `info`.
|
|
816
|
+
* @returns The description from @info.
|
|
817
|
+
*/
|
|
818
|
+
get_description(): string;
|
|
819
|
+
/**
|
|
820
|
+
* Returns the name of the icon for the plugin as specified in `info`.
|
|
821
|
+
* @returns The icon name from @info.
|
|
822
|
+
*/
|
|
823
|
+
get_icon_name(): string;
|
|
824
|
+
/**
|
|
825
|
+
* Returns the id that the plugin identifies itself as.
|
|
826
|
+
* @returns The id from @info.
|
|
827
|
+
*/
|
|
828
|
+
get_id(): string;
|
|
829
|
+
/**
|
|
830
|
+
* Gets the normalized version of the id from `info`. That is, a version where
|
|
831
|
+
* only alphanumeric and -'s are in the id.
|
|
832
|
+
* @returns The normalized id of @info.
|
|
833
|
+
*/
|
|
834
|
+
get_id_normalized(): string;
|
|
835
|
+
/**
|
|
836
|
+
* Returns where or not this plugin is is considered an internal plugin. An
|
|
837
|
+
* internal plugin would be something like a plugin loader or another plugin
|
|
838
|
+
* that should not be shown to users.
|
|
839
|
+
* @returns %TRUE if the plugin is internal, %FALSE otherwise.
|
|
840
|
+
*/
|
|
841
|
+
get_internal(): boolean;
|
|
842
|
+
/**
|
|
843
|
+
* Returns the liences id for the plugin as specified in `info`.
|
|
844
|
+
* @returns The license-id from @info.
|
|
845
|
+
*/
|
|
846
|
+
get_license_id(): string;
|
|
847
|
+
/**
|
|
848
|
+
* Returns the license text for the plugin as specified in `info`.
|
|
849
|
+
* @returns The text of the license from @info.
|
|
850
|
+
*/
|
|
851
|
+
get_license_text(): string;
|
|
852
|
+
/**
|
|
853
|
+
* Returns the url of the license for the plugin as specified in `info`
|
|
854
|
+
* @returns The url of the license from @info.
|
|
855
|
+
*/
|
|
856
|
+
get_license_url(): string;
|
|
857
|
+
/**
|
|
858
|
+
* Returns whether or not this plugin should be loaded when queried. This is
|
|
859
|
+
* useful for internal plugins that are adding functionality and should always
|
|
860
|
+
* be turned on. The plugin loaders use this to make sure all plugins can
|
|
861
|
+
* always be loaded.
|
|
862
|
+
* @returns %TRUE if the plugin should be loaded when queried, %FALSE otherwise.
|
|
863
|
+
*/
|
|
864
|
+
get_load_on_query(): boolean;
|
|
865
|
+
/**
|
|
866
|
+
* Returns the name of the plugin as specified in `info`.
|
|
867
|
+
* @returns The name from @info.
|
|
868
|
+
*/
|
|
869
|
+
get_name(): string;
|
|
870
|
+
/**
|
|
871
|
+
* Gets the priority of the plugin as specified in `info`.
|
|
872
|
+
* @returns The priority from @info.
|
|
873
|
+
*/
|
|
874
|
+
get_priority(): number;
|
|
875
|
+
/**
|
|
876
|
+
* Gets the provides of the plugin as specified in `info`.
|
|
877
|
+
* @returns The list of dependencies from @info.
|
|
878
|
+
*/
|
|
879
|
+
get_provides(): string[];
|
|
880
|
+
/**
|
|
881
|
+
* Returns the ID of the [class`Gio`.Settings] schema as specified in `info`.
|
|
882
|
+
* @returns The schema ID from @info.
|
|
883
|
+
*/
|
|
884
|
+
get_settings_schema(): string;
|
|
885
|
+
/**
|
|
886
|
+
* Returns the summery for the plugin as specified in `info`.
|
|
887
|
+
* @returns The summary from @info.
|
|
888
|
+
*/
|
|
889
|
+
get_summary(): string;
|
|
890
|
+
/**
|
|
891
|
+
* Gets whether or not the plugin is unloadable. Certain libraries can not be
|
|
892
|
+
* shutdown cleanly and then re-enabled during the life time of a program. A
|
|
893
|
+
* plugin using one of these libraries should set the
|
|
894
|
+
* [property`GPlugin`.PluginInfo:unloadable] property to %FALSE to tell
|
|
895
|
+
* [class`GPlugin`.Manager] to not even attempt to unload it.
|
|
896
|
+
* @returns %TRUE if the plugin is unloadable, otherwise %FALSE.
|
|
897
|
+
*/
|
|
898
|
+
get_unloadable(): boolean;
|
|
899
|
+
/**
|
|
900
|
+
* Returns the version of the plugin as specified in `info`.
|
|
901
|
+
* @returns The version from @info.
|
|
902
|
+
*/
|
|
903
|
+
get_version(): string;
|
|
904
|
+
/**
|
|
905
|
+
* Returns the website for the plugin as specified in `info`.
|
|
906
|
+
* @returns The website from @info.
|
|
907
|
+
*/
|
|
908
|
+
get_website(): string;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
type LoaderClass = typeof Loader;
|
|
912
|
+
type ManagerClass = typeof Manager;
|
|
913
|
+
type PluginInfoClass = typeof PluginInfo;
|
|
914
|
+
type PluginInterface = typeof Plugin;
|
|
915
|
+
type SourceInterface = typeof Source;
|
|
916
|
+
module Plugin {
|
|
917
|
+
// Constructor properties interface
|
|
918
|
+
|
|
919
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
920
|
+
desired_state: PluginState;
|
|
921
|
+
desiredState: PluginState;
|
|
922
|
+
error: GLib.Error;
|
|
923
|
+
filename: string;
|
|
924
|
+
info: PluginInfo;
|
|
925
|
+
loader: Loader;
|
|
926
|
+
state: PluginState;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
export interface PluginNamespace {
|
|
931
|
+
$gtype: GObject.GType<Plugin>;
|
|
932
|
+
prototype: Plugin;
|
|
933
|
+
}
|
|
934
|
+
interface Plugin extends GObject.Object {
|
|
935
|
+
// Own properties of GPlugin.Plugin
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* The desired state of the plugin. Typically this just mirrors the state
|
|
939
|
+
* property, but if a state change failed this will remain set to the state
|
|
940
|
+
* that was attempted.
|
|
941
|
+
*
|
|
942
|
+
* See [method`GPlugin`.Plugin.get_desired_state] for more information.
|
|
943
|
+
*/
|
|
944
|
+
get desired_state(): PluginState;
|
|
945
|
+
set desired_state(val: PluginState);
|
|
946
|
+
/**
|
|
947
|
+
* The desired state of the plugin. Typically this just mirrors the state
|
|
948
|
+
* property, but if a state change failed this will remain set to the state
|
|
949
|
+
* that was attempted.
|
|
950
|
+
*
|
|
951
|
+
* See [method`GPlugin`.Plugin.get_desired_state] for more information.
|
|
952
|
+
*/
|
|
953
|
+
get desiredState(): PluginState;
|
|
954
|
+
set desiredState(val: PluginState);
|
|
955
|
+
/**
|
|
956
|
+
* An error that was returned if the plugin failed to load or unload.
|
|
957
|
+
*/
|
|
958
|
+
get error(): GLib.Error;
|
|
959
|
+
set error(val: GLib.Error);
|
|
960
|
+
/**
|
|
961
|
+
* The absolute path to the plugin on disk.
|
|
962
|
+
*/
|
|
963
|
+
get filename(): string;
|
|
964
|
+
/**
|
|
965
|
+
* The plugin info from this plugin.
|
|
966
|
+
*/
|
|
967
|
+
get info(): PluginInfo;
|
|
968
|
+
/**
|
|
969
|
+
* The loader that loaded this plugin.
|
|
970
|
+
*/
|
|
971
|
+
get loader(): Loader;
|
|
972
|
+
/**
|
|
973
|
+
* The plugin state that this plugin is in.
|
|
974
|
+
*/
|
|
975
|
+
get state(): PluginState;
|
|
976
|
+
set state(val: PluginState);
|
|
977
|
+
|
|
978
|
+
// Own methods of GPlugin.Plugin
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* Gets the desired state of the plugin. Typically this will hold the same
|
|
982
|
+
* value of [property`GPlugin`.Plugin:state], but if a state change failed this
|
|
983
|
+
* will remain set to the state that was attempted.
|
|
984
|
+
*
|
|
985
|
+
* For example, say a user wants to unload a plugin but the plugin can't be
|
|
986
|
+
* unloaded for some reason. The state will be set to loaded, but the
|
|
987
|
+
* desired state will be set to unloaded.
|
|
988
|
+
*
|
|
989
|
+
* This behavior can be used to give the user the ability to disable a
|
|
990
|
+
* plugin that normally isn't unloadabled from being loaded during the next
|
|
991
|
+
* run of program.
|
|
992
|
+
* @returns The desired state that the user has requested the plugin to be in.
|
|
993
|
+
*/
|
|
994
|
+
get_desired_state(): PluginState;
|
|
995
|
+
/**
|
|
996
|
+
* Gets the [struct`GLib`.Error], if any, that the plugin returned during load or
|
|
997
|
+
* unload.
|
|
998
|
+
* @returns The error the plugin returned during load or unload, or %NULL if no error occurred.
|
|
999
|
+
*/
|
|
1000
|
+
get_error(): GLib.Error;
|
|
1001
|
+
/**
|
|
1002
|
+
* Returns the filename that `plugin` was loaded from.
|
|
1003
|
+
* @returns The filename of @plugin.
|
|
1004
|
+
*/
|
|
1005
|
+
get_filename(): string;
|
|
1006
|
+
/**
|
|
1007
|
+
* Returns the plugin info for `plugin`.
|
|
1008
|
+
* @returns The plugin info instance for @plugin.
|
|
1009
|
+
*/
|
|
1010
|
+
get_info(): PluginInfo;
|
|
1011
|
+
/**
|
|
1012
|
+
* Returns the loader that loaded `plugin`.
|
|
1013
|
+
* @returns The #GPluginLoader that loaded @plugin.
|
|
1014
|
+
*/
|
|
1015
|
+
get_loader(): Loader;
|
|
1016
|
+
/**
|
|
1017
|
+
* Gets the current state of `plugin`.
|
|
1018
|
+
* @returns The current state of @plugin.
|
|
1019
|
+
*/
|
|
1020
|
+
get_state(): PluginState;
|
|
1021
|
+
/**
|
|
1022
|
+
* Sets the desired state of the plugin. This shouldn't need to be called by
|
|
1023
|
+
* anyone except [class`GPlugin`.Loader] which manages the state of plugins.
|
|
1024
|
+
* @param state The desired state.
|
|
1025
|
+
*/
|
|
1026
|
+
set_desired_state(state: PluginState): void;
|
|
1027
|
+
/**
|
|
1028
|
+
* Changes the state of `plugin` to `state`. This function should only be called
|
|
1029
|
+
* by loaders.
|
|
1030
|
+
* @param state The new state for @plugin.
|
|
1031
|
+
*/
|
|
1032
|
+
set_state(state: PluginState): void;
|
|
1033
|
+
|
|
1034
|
+
// Own virtual methods of GPlugin.Plugin
|
|
1035
|
+
|
|
1036
|
+
vfunc_state_changed(oldstate: PluginState, newstate: PluginState): void;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
export const Plugin: PluginNamespace;
|
|
1040
|
+
|
|
1041
|
+
module Source {
|
|
1042
|
+
// Constructor properties interface
|
|
1043
|
+
|
|
1044
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {}
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
export interface SourceNamespace {
|
|
1048
|
+
$gtype: GObject.GType<Source>;
|
|
1049
|
+
prototype: Source;
|
|
1050
|
+
}
|
|
1051
|
+
interface Source extends GObject.Object {
|
|
1052
|
+
// Own methods of GPlugin.Source
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* This method is called when [method`GPlugin`.Manager.refresh] is running. The
|
|
1056
|
+
* source should scan its available sources for plugins. For the filesystem
|
|
1057
|
+
* source, this is paths that have been registered with the manager.
|
|
1058
|
+
*
|
|
1059
|
+
* The implementation should return TRUE if it found a new unqueried plugin,
|
|
1060
|
+
* which will tell the manager to continue scanning.
|
|
1061
|
+
* @returns %TRUE if an unqueried plugin was found, %FALSE otherwise.
|
|
1062
|
+
*/
|
|
1063
|
+
scan(): boolean;
|
|
1064
|
+
|
|
1065
|
+
// Own virtual methods of GPlugin.Source
|
|
1066
|
+
|
|
1067
|
+
/**
|
|
1068
|
+
* This method is called when [method`GPlugin`.Manager.refresh] is running. The
|
|
1069
|
+
* source should scan its available sources for plugins. For the filesystem
|
|
1070
|
+
* source, this is paths that have been registered with the manager.
|
|
1071
|
+
*
|
|
1072
|
+
* The implementation should return TRUE if it found a new unqueried plugin,
|
|
1073
|
+
* which will tell the manager to continue scanning.
|
|
1074
|
+
*/
|
|
1075
|
+
vfunc_scan(): boolean;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
export const Source: SourceNamespace;
|
|
1079
|
+
|
|
1080
|
+
/**
|
|
1081
|
+
* Name of the imported GIR library
|
|
1082
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
1083
|
+
*/
|
|
1084
|
+
const __name__: string;
|
|
1085
|
+
/**
|
|
1086
|
+
* Version of the imported GIR library
|
|
1087
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
1088
|
+
*/
|
|
1089
|
+
const __version__: string;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
export default GPlugin;
|
|
1093
|
+
// END
|
package/gplugin-1.0.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@girs/gplugin-1.0",
|
|
3
|
+
"version": "0.42.1-4.0.0-beta.3",
|
|
4
|
+
"description": "GJS TypeScript type definitions for GPlugin-1.0, generated from library version 0.42.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "gplugin-1.0.js",
|
|
7
|
+
"main": "gplugin-1.0.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./ambient": {
|
|
10
|
+
"types": "./gplugin-1.0-ambient.d.ts",
|
|
11
|
+
"import": "./gplugin-1.0-ambient.js",
|
|
12
|
+
"default": "./gplugin-1.0-ambient.js"
|
|
13
|
+
},
|
|
14
|
+
"./import": {
|
|
15
|
+
"types": "./gplugin-1.0-import.d.ts",
|
|
16
|
+
"import": "./gplugin-1.0-import.js",
|
|
17
|
+
"default": "./gplugin-1.0-import.js"
|
|
18
|
+
},
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./gplugin-1.0.d.ts",
|
|
21
|
+
"import": "./gplugin-1.0.js",
|
|
22
|
+
"default": "./gplugin-1.0.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"test": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit gplugin-1.0.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@girs/gjs": "^4.0.0-beta.3",
|
|
30
|
+
"@girs/glib-2.0": "^2.80.0-4.0.0-beta.3",
|
|
31
|
+
"@girs/gobject-2.0": "^2.80.0-4.0.0-beta.3"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"typescript": "*"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"Gir",
|
|
38
|
+
"TypeScript",
|
|
39
|
+
"types",
|
|
40
|
+
"GObject-Introspection",
|
|
41
|
+
"GJS",
|
|
42
|
+
"GPlugin-1.0"
|
|
43
|
+
],
|
|
44
|
+
"author": "ts-for-gir",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "git+https://github.com/gjsify/ts-for-gir.git"
|
|
49
|
+
},
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/gjsify/ts-for-gir/issues"
|
|
52
|
+
},
|
|
53
|
+
"homepage": "https://github.com/gjsify/types/tree/main/gplugin-1.0#readme"
|
|
54
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// General settings for code interpretation
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"lib": ["ESNext"],
|
|
7
|
+
"types": [],
|
|
8
|
+
"experimentalDecorators": true,
|
|
9
|
+
"moduleResolution": "node",
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"noEmitOnError": false,
|
|
12
|
+
"baseUrl": "./",
|
|
13
|
+
"rootDir": ".",
|
|
14
|
+
// General settings for code generation
|
|
15
|
+
"removeComments": false,
|
|
16
|
+
"inlineSourceMap": false,
|
|
17
|
+
"inlineSources": false,
|
|
18
|
+
"newLine": "LF"
|
|
19
|
+
},
|
|
20
|
+
"include": ["./gplugin-1.0.d.ts"]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|