@girs/malcontent-0 0.0.0-4.0.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 +104 -0
- package/malcontent-0-ambient.d.ts +12 -0
- package/malcontent-0-ambient.js +2 -0
- package/malcontent-0-import.d.ts +12 -0
- package/malcontent-0-import.js +3 -0
- package/malcontent-0.d.ts +825 -0
- package/malcontent-0.js +6 -0
- package/package.json +55 -0
- package/tsconfig.json +23 -0
- package/typedoc.json +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
|
|
2
|
+
# Malcontent-0
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
GJS TypeScript type definitions for Malcontent-0, generated from library version 0.0.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
To use this type definitions, install them with NPM:
|
|
14
|
+
```bash
|
|
15
|
+
npm install @girs/malcontent-0
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
You can import this package into your project like this:
|
|
21
|
+
```ts
|
|
22
|
+
import Malcontent from '@girs/malcontent-0';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or if you prefer CommonJS, you can also use this:
|
|
26
|
+
```ts
|
|
27
|
+
const Malcontent = require('@girs/malcontent-0');
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Ambient Modules
|
|
31
|
+
|
|
32
|
+
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.
|
|
33
|
+
For this you need to include `@girs/malcontent-0` or `@girs/malcontent-0/ambient` in your `tsconfig` or entry point Typescript file:
|
|
34
|
+
|
|
35
|
+
`index.ts`:
|
|
36
|
+
```ts
|
|
37
|
+
import '@girs/malcontent-0'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`tsconfig.json`:
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"compilerOptions": {
|
|
44
|
+
...
|
|
45
|
+
},
|
|
46
|
+
"include": ["@girs/malcontent-0"],
|
|
47
|
+
...
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Now you can import the ambient module with TypeScript support:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import Malcontent from 'gi://Malcontent?version=0';
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Global import
|
|
58
|
+
|
|
59
|
+
You can also import the module with Typescript support using the global `imports.gi` object of GJS.
|
|
60
|
+
For this you need to include `@girs/malcontent-0` or `@girs/malcontent-0/import` in your `tsconfig` or entry point Typescript file:
|
|
61
|
+
|
|
62
|
+
`index.ts`:
|
|
63
|
+
```ts
|
|
64
|
+
import '@girs/malcontent-0'
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`tsconfig.json`:
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"compilerOptions": {
|
|
71
|
+
...
|
|
72
|
+
},
|
|
73
|
+
"include": ["@girs/malcontent-0"],
|
|
74
|
+
...
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Now you have also type support for this, too:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
const Malcontent = imports.gi.Malcontent;
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
### ESM vs. CommonJS
|
|
86
|
+
|
|
87
|
+
GJS supports two different import syntaxes. The new modern ESM syntax and the old global imports syntax.
|
|
88
|
+
|
|
89
|
+
In TypeScript projects for GJS and GNOME Shell extensions, you have the flexibility to use `ESM` syntax and then decide the import syntax for your bundled file. If your bundler is configured to use `CommonJS`, it will convert to the GJS-specific global imports syntax, like `const moduleName = imports.gi[moduleName]`. This is different from the traditional `require` syntax seen in Node.js. The global imports syntax is chosen because it aligns with the CommonJS format supported by NPM, which is used for the generated type definitions and this package.
|
|
90
|
+
|
|
91
|
+
On the other hand, if you configure your bundler to use ESM, it will retain the ESM import syntax. It's crucial to ensure that your bundler is set up to correctly translate and bundle these imports into either CommonJS or ESM format, depending on your project's requirements.
|
|
92
|
+
|
|
93
|
+
This approach is particularly important due to the `@girs` types, which include both `*.cjs `files, using the GJS global imports syntax, and `*.js` files, which utilize the ESM syntax. By appropriately setting up your bundler, you can control which syntax—CommonJS or ESM—is used in your project. The choice of CommonJS in this context is also due to the similarity between the GJS-specific global imports and CommonJS syntax, allowing for easier management and bundling in these specific types of projects.
|
|
94
|
+
|
|
95
|
+
Since GNOME Shell 45, you should only use ESM, even for GNOME Shell extensions. Before that, extensions had to use the global import syntax, unlike normal GJS applications, where ESM has been available for some time.
|
|
96
|
+
|
|
97
|
+
### Bundle
|
|
98
|
+
|
|
99
|
+
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).
|
|
100
|
+
|
|
101
|
+
## Other packages
|
|
102
|
+
|
|
103
|
+
All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
|
|
104
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
declare module 'gi://Malcontent?version=0' {
|
|
3
|
+
import Malcontent from '@girs/malcontent-0';
|
|
4
|
+
export default Malcontent;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare module 'gi://Malcontent' {
|
|
8
|
+
import Malcontent0 from 'gi://Malcontent?version=0';
|
|
9
|
+
export default Malcontent0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
@@ -0,0 +1,825 @@
|
|
|
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 './malcontent-0-ambient.d.ts';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Malcontent-0
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type Gio from '@girs/gio-2.0';
|
|
15
|
+
import type GObject from '@girs/gobject-2.0';
|
|
16
|
+
import type GLib from '@girs/glib-2.0';
|
|
17
|
+
|
|
18
|
+
export namespace Malcontent {
|
|
19
|
+
/**
|
|
20
|
+
* Different semantics for interpreting an application list.
|
|
21
|
+
*/
|
|
22
|
+
enum AppFilterListType {
|
|
23
|
+
/**
|
|
24
|
+
* Any program in the list is not allowed to
|
|
25
|
+
* be run.
|
|
26
|
+
*/
|
|
27
|
+
BLOCKLIST,
|
|
28
|
+
/**
|
|
29
|
+
* Any program not in the list is not allowed
|
|
30
|
+
* to be run.
|
|
31
|
+
*/
|
|
32
|
+
ALLOWLIST,
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Rating values of the intensity of a given section in an app or game.
|
|
36
|
+
* These are directly equivalent to the values in the #AsContentRatingValue
|
|
37
|
+
* enumeration in libappstream.
|
|
38
|
+
*/
|
|
39
|
+
enum AppFilterOarsValue {
|
|
40
|
+
/**
|
|
41
|
+
* Unknown value for the given
|
|
42
|
+
* section.
|
|
43
|
+
*/
|
|
44
|
+
UNKNOWN,
|
|
45
|
+
/**
|
|
46
|
+
* No rating for the given section.
|
|
47
|
+
*/
|
|
48
|
+
NONE,
|
|
49
|
+
/**
|
|
50
|
+
* Mild rating for the given section.
|
|
51
|
+
*/
|
|
52
|
+
MILD,
|
|
53
|
+
/**
|
|
54
|
+
* Moderate rating for the given
|
|
55
|
+
* section.
|
|
56
|
+
*/
|
|
57
|
+
MODERATE,
|
|
58
|
+
/**
|
|
59
|
+
* Intense rating for the given
|
|
60
|
+
* section.
|
|
61
|
+
*/
|
|
62
|
+
INTENSE,
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Errors relating to get/set operations on an #MctManager instance.
|
|
66
|
+
*/
|
|
67
|
+
class ManagerError extends GLib.Error {
|
|
68
|
+
static $gtype: GObject.GType<ManagerError>;
|
|
69
|
+
|
|
70
|
+
// Static fields of Malcontent.ManagerError
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Given user ID doesn’t exist
|
|
74
|
+
*/
|
|
75
|
+
static INVALID_USER: number;
|
|
76
|
+
/**
|
|
77
|
+
* Not authorized to query properties of
|
|
78
|
+
* the given user
|
|
79
|
+
*/
|
|
80
|
+
static PERMISSION_DENIED: number;
|
|
81
|
+
/**
|
|
82
|
+
* The data stored in a property of the given
|
|
83
|
+
* user is inconsistent or invalid
|
|
84
|
+
*/
|
|
85
|
+
static INVALID_DATA: number;
|
|
86
|
+
/**
|
|
87
|
+
* Parental controls are disabled for all users
|
|
88
|
+
*/
|
|
89
|
+
static DISABLED: number;
|
|
90
|
+
|
|
91
|
+
// Constructors of Malcontent.ManagerError
|
|
92
|
+
|
|
93
|
+
constructor(options: { message: string; code: number });
|
|
94
|
+
_init(...args: any[]): void;
|
|
95
|
+
|
|
96
|
+
// Own static methods of Malcontent.ManagerError
|
|
97
|
+
|
|
98
|
+
static quark(): GLib.Quark;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Types of session limit which can be imposed on an account. Additional types
|
|
103
|
+
* may be added in future.
|
|
104
|
+
*/
|
|
105
|
+
enum SessionLimitsType {
|
|
106
|
+
/**
|
|
107
|
+
* No session limits are imposed.
|
|
108
|
+
*/
|
|
109
|
+
NONE,
|
|
110
|
+
/**
|
|
111
|
+
* Sessions are limited to between a
|
|
112
|
+
* pair of given times each day.
|
|
113
|
+
*/
|
|
114
|
+
DAILY_SCHEDULE,
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Deserialize an app filter previously serialized with
|
|
118
|
+
* mct_app_filter_serialize(). This function guarantees to be able to
|
|
119
|
+
* deserialize any serialized form from this version or older versions of
|
|
120
|
+
* libmalcontent.
|
|
121
|
+
*
|
|
122
|
+
* If deserialization fails, %MCT_MANAGER_ERROR_INVALID_DATA will be returned.
|
|
123
|
+
* @param variant a serialized app filter variant
|
|
124
|
+
* @param user_id the ID of the user the app filter relates to
|
|
125
|
+
* @returns deserialized app filter
|
|
126
|
+
*/
|
|
127
|
+
function app_filter_deserialize(variant: GLib.Variant, user_id: number): AppFilter;
|
|
128
|
+
function app_filter_error_quark(): GLib.Quark;
|
|
129
|
+
function manager_error_quark(): GLib.Quark;
|
|
130
|
+
/**
|
|
131
|
+
* Deserialize a set of session limits previously serialized with
|
|
132
|
+
* mct_session_limits_serialize(). This function guarantees to be able to
|
|
133
|
+
* deserialize any serialized form from this version or older versions of
|
|
134
|
+
* libmalcontent.
|
|
135
|
+
*
|
|
136
|
+
* If deserialization fails, %MCT_MANAGER_ERROR_INVALID_DATA will be returned.
|
|
137
|
+
* @param variant a serialized session limits variant
|
|
138
|
+
* @param user_id the ID of the user the session limits relate to
|
|
139
|
+
* @returns deserialized session limits
|
|
140
|
+
*/
|
|
141
|
+
function session_limits_deserialize(variant: GLib.Variant, user_id: number): SessionLimits;
|
|
142
|
+
/**
|
|
143
|
+
* Flags to control the behaviour of getter functions like
|
|
144
|
+
* mct_manager_get_app_filter() and mct_manager_get_app_filter_async().
|
|
145
|
+
*/
|
|
146
|
+
enum ManagerGetValueFlags {
|
|
147
|
+
/**
|
|
148
|
+
* No flags set.
|
|
149
|
+
*/
|
|
150
|
+
NONE,
|
|
151
|
+
/**
|
|
152
|
+
* Allow interactive polkit dialogs
|
|
153
|
+
* when requesting authorization.
|
|
154
|
+
*/
|
|
155
|
+
INTERACTIVE,
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Flags to control the behaviour of setter functions like
|
|
159
|
+
* mct_manager_set_app_filter() and mct_manager_set_app_filter_async().
|
|
160
|
+
*/
|
|
161
|
+
enum ManagerSetValueFlags {
|
|
162
|
+
/**
|
|
163
|
+
* No flags set.
|
|
164
|
+
*/
|
|
165
|
+
NONE,
|
|
166
|
+
/**
|
|
167
|
+
* Allow interactive polkit dialogs
|
|
168
|
+
* when requesting authorization.
|
|
169
|
+
*/
|
|
170
|
+
INTERACTIVE,
|
|
171
|
+
}
|
|
172
|
+
module Manager {
|
|
173
|
+
// Signal callback interfaces
|
|
174
|
+
|
|
175
|
+
interface AppFilterChanged {
|
|
176
|
+
(user_id: number): void;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Constructor properties interface
|
|
180
|
+
|
|
181
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
182
|
+
connection: Gio.DBusConnection;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* #MctManager is a top-level management object which is used to query and
|
|
188
|
+
* monitor #MctAppFilters for different users.
|
|
189
|
+
*/
|
|
190
|
+
class Manager extends GObject.Object {
|
|
191
|
+
static $gtype: GObject.GType<Manager>;
|
|
192
|
+
|
|
193
|
+
// Own properties of Malcontent.Manager
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* A connection to the system bus, where accounts-service runs. It’s provided
|
|
197
|
+
* mostly for testing purposes, or to allow an existing connection to be
|
|
198
|
+
* re-used.
|
|
199
|
+
*/
|
|
200
|
+
get connection(): Gio.DBusConnection;
|
|
201
|
+
|
|
202
|
+
// Constructors of Malcontent.Manager
|
|
203
|
+
|
|
204
|
+
constructor(properties?: Partial<Manager.ConstructorProps>, ...args: any[]);
|
|
205
|
+
|
|
206
|
+
_init(...args: any[]): void;
|
|
207
|
+
|
|
208
|
+
static ['new'](connection: Gio.DBusConnection): Manager;
|
|
209
|
+
|
|
210
|
+
// Own signals of Malcontent.Manager
|
|
211
|
+
|
|
212
|
+
connect(id: string, callback: (...args: any[]) => any): number;
|
|
213
|
+
connect_after(id: string, callback: (...args: any[]) => any): number;
|
|
214
|
+
emit(id: string, ...args: any[]): void;
|
|
215
|
+
connect(signal: 'app-filter-changed', callback: (_source: this, user_id: number) => void): number;
|
|
216
|
+
connect_after(signal: 'app-filter-changed', callback: (_source: this, user_id: number) => void): number;
|
|
217
|
+
emit(signal: 'app-filter-changed', user_id: number): void;
|
|
218
|
+
|
|
219
|
+
// Own methods of Malcontent.Manager
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Synchronous version of mct_manager_get_app_filter_async().
|
|
223
|
+
* @param user_id ID of the user to query, typically coming from getuid()
|
|
224
|
+
* @param flags flags to affect the behaviour of the call
|
|
225
|
+
* @param cancellable a #GCancellable, or %NULL
|
|
226
|
+
* @returns app filter for the queried user
|
|
227
|
+
*/
|
|
228
|
+
get_app_filter(user_id: number, flags: ManagerGetValueFlags, cancellable?: Gio.Cancellable | null): AppFilter;
|
|
229
|
+
/**
|
|
230
|
+
* Asynchronously get a snapshot of the app filter settings for the given
|
|
231
|
+
* `user_id`.
|
|
232
|
+
*
|
|
233
|
+
* On failure, an #MctManagerError, a #GDBusError or a #GIOError will be
|
|
234
|
+
* returned.
|
|
235
|
+
* @param user_id ID of the user to query, typically coming from getuid()
|
|
236
|
+
* @param flags flags to affect the behaviour of the call
|
|
237
|
+
* @param cancellable a #GCancellable, or %NULL
|
|
238
|
+
* @param callback a #GAsyncReadyCallback
|
|
239
|
+
*/
|
|
240
|
+
get_app_filter_async(
|
|
241
|
+
user_id: number,
|
|
242
|
+
flags: ManagerGetValueFlags,
|
|
243
|
+
cancellable?: Gio.Cancellable | null,
|
|
244
|
+
callback?: Gio.AsyncReadyCallback<this> | null,
|
|
245
|
+
): void;
|
|
246
|
+
/**
|
|
247
|
+
* Finish an asynchronous operation to get the app filter for a user, started
|
|
248
|
+
* with mct_manager_get_app_filter_async().
|
|
249
|
+
* @param result a #GAsyncResult
|
|
250
|
+
* @returns app filter for the queried user
|
|
251
|
+
*/
|
|
252
|
+
get_app_filter_finish(result: Gio.AsyncResult): AppFilter;
|
|
253
|
+
/**
|
|
254
|
+
* Synchronous version of mct_manager_get_session_limits_async().
|
|
255
|
+
* @param user_id ID of the user to query, typically coming from getuid()
|
|
256
|
+
* @param flags flags to affect the behaviour of the call
|
|
257
|
+
* @param cancellable a #GCancellable, or %NULL
|
|
258
|
+
* @returns session limits for the queried user
|
|
259
|
+
*/
|
|
260
|
+
get_session_limits(
|
|
261
|
+
user_id: number,
|
|
262
|
+
flags: ManagerGetValueFlags,
|
|
263
|
+
cancellable?: Gio.Cancellable | null,
|
|
264
|
+
): SessionLimits;
|
|
265
|
+
/**
|
|
266
|
+
* Asynchronously get a snapshot of the session limit settings for the given
|
|
267
|
+
* `user_id`.
|
|
268
|
+
*
|
|
269
|
+
* On failure, an #MctManagerError, a #GDBusError or a #GIOError will be
|
|
270
|
+
* returned via mct_manager_get_session_limits_finish().
|
|
271
|
+
* @param user_id ID of the user to query, typically coming from getuid()
|
|
272
|
+
* @param flags flags to affect the behaviour of the call
|
|
273
|
+
* @param cancellable a #GCancellable, or %NULL
|
|
274
|
+
* @param callback a #GAsyncReadyCallback
|
|
275
|
+
*/
|
|
276
|
+
get_session_limits_async(
|
|
277
|
+
user_id: number,
|
|
278
|
+
flags: ManagerGetValueFlags,
|
|
279
|
+
cancellable?: Gio.Cancellable | null,
|
|
280
|
+
callback?: Gio.AsyncReadyCallback<this> | null,
|
|
281
|
+
): void;
|
|
282
|
+
/**
|
|
283
|
+
* Finish an asynchronous operation to get the session limits for a user,
|
|
284
|
+
* started with mct_manager_get_session_limits_async().
|
|
285
|
+
* @param result a #GAsyncResult
|
|
286
|
+
* @returns session limits for the queried user
|
|
287
|
+
*/
|
|
288
|
+
get_session_limits_finish(result: Gio.AsyncResult): SessionLimits;
|
|
289
|
+
/**
|
|
290
|
+
* Synchronous version of mct_manager_set_app_filter_async().
|
|
291
|
+
* @param user_id ID of the user to set the filter for, typically coming from getuid()
|
|
292
|
+
* @param app_filter the app filter to set for the user
|
|
293
|
+
* @param flags flags to affect the behaviour of the call
|
|
294
|
+
* @param cancellable a #GCancellable, or %NULL
|
|
295
|
+
* @returns %TRUE on success, %FALSE otherwise
|
|
296
|
+
*/
|
|
297
|
+
set_app_filter(
|
|
298
|
+
user_id: number,
|
|
299
|
+
app_filter: AppFilter,
|
|
300
|
+
flags: ManagerSetValueFlags,
|
|
301
|
+
cancellable?: Gio.Cancellable | null,
|
|
302
|
+
): boolean;
|
|
303
|
+
/**
|
|
304
|
+
* Asynchronously set the app filter settings for the given `user_id` to the
|
|
305
|
+
* given `app_filter` instance. This will set all fields of the app filter.
|
|
306
|
+
*
|
|
307
|
+
* On failure, an #MctManagerError, a #GDBusError or a #GIOError will be
|
|
308
|
+
* returned. The user’s app filter settings will be left in an undefined state.
|
|
309
|
+
* @param user_id ID of the user to set the filter for, typically coming from getuid()
|
|
310
|
+
* @param app_filter the app filter to set for the user
|
|
311
|
+
* @param flags flags to affect the behaviour of the call
|
|
312
|
+
* @param cancellable a #GCancellable, or %NULL
|
|
313
|
+
* @param callback a #GAsyncReadyCallback
|
|
314
|
+
*/
|
|
315
|
+
set_app_filter_async(
|
|
316
|
+
user_id: number,
|
|
317
|
+
app_filter: AppFilter,
|
|
318
|
+
flags: ManagerSetValueFlags,
|
|
319
|
+
cancellable?: Gio.Cancellable | null,
|
|
320
|
+
callback?: Gio.AsyncReadyCallback<this> | null,
|
|
321
|
+
): void;
|
|
322
|
+
/**
|
|
323
|
+
* Finish an asynchronous operation to set the app filter for a user, started
|
|
324
|
+
* with mct_manager_set_app_filter_async().
|
|
325
|
+
* @param result a #GAsyncResult
|
|
326
|
+
* @returns %TRUE on success, %FALSE otherwise
|
|
327
|
+
*/
|
|
328
|
+
set_app_filter_finish(result: Gio.AsyncResult): boolean;
|
|
329
|
+
/**
|
|
330
|
+
* Synchronous version of mct_manager_set_session_limits_async().
|
|
331
|
+
* @param user_id ID of the user to set the limits for, typically coming from getuid()
|
|
332
|
+
* @param session_limits the session limits to set for the user
|
|
333
|
+
* @param flags flags to affect the behaviour of the call
|
|
334
|
+
* @param cancellable a #GCancellable, or %NULL
|
|
335
|
+
* @returns %TRUE on success, %FALSE otherwise
|
|
336
|
+
*/
|
|
337
|
+
set_session_limits(
|
|
338
|
+
user_id: number,
|
|
339
|
+
session_limits: SessionLimits,
|
|
340
|
+
flags: ManagerSetValueFlags,
|
|
341
|
+
cancellable?: Gio.Cancellable | null,
|
|
342
|
+
): boolean;
|
|
343
|
+
/**
|
|
344
|
+
* Asynchronously set the session limits settings for the given `user_id` to the
|
|
345
|
+
* given `session_limits` instance.
|
|
346
|
+
*
|
|
347
|
+
* On failure, an #MctManagerError, a #GDBusError or a #GIOError will be
|
|
348
|
+
* returned via mct_manager_set_session_limits_finish(). The user’s session
|
|
349
|
+
* limits settings will be left in an undefined state.
|
|
350
|
+
* @param user_id ID of the user to set the limits for, typically coming from getuid()
|
|
351
|
+
* @param session_limits the session limits to set for the user
|
|
352
|
+
* @param flags flags to affect the behaviour of the call
|
|
353
|
+
* @param cancellable a #GCancellable, or %NULL
|
|
354
|
+
* @param callback a #GAsyncReadyCallback
|
|
355
|
+
*/
|
|
356
|
+
set_session_limits_async(
|
|
357
|
+
user_id: number,
|
|
358
|
+
session_limits: SessionLimits,
|
|
359
|
+
flags: ManagerSetValueFlags,
|
|
360
|
+
cancellable?: Gio.Cancellable | null,
|
|
361
|
+
callback?: Gio.AsyncReadyCallback<this> | null,
|
|
362
|
+
): void;
|
|
363
|
+
/**
|
|
364
|
+
* Finish an asynchronous operation to set the session limits for a user,
|
|
365
|
+
* started with mct_manager_set_session_limits_async().
|
|
366
|
+
* @param result a #GAsyncResult
|
|
367
|
+
* @returns %TRUE on success, %FALSE otherwise
|
|
368
|
+
*/
|
|
369
|
+
set_session_limits_finish(result: Gio.AsyncResult): boolean;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* #MctAppFilter is an opaque, immutable structure which contains a snapshot of
|
|
374
|
+
* the app filtering settings for a user at a given time. This includes a list
|
|
375
|
+
* of apps which are explicitly banned or allowed to be run by that user.
|
|
376
|
+
*
|
|
377
|
+
* Typically, app filter settings can only be changed by the administrator, and
|
|
378
|
+
* are read-only for non-administrative users. The precise policy is set using
|
|
379
|
+
* polkit.
|
|
380
|
+
*/
|
|
381
|
+
class AppFilter {
|
|
382
|
+
static $gtype: GObject.GType<AppFilter>;
|
|
383
|
+
|
|
384
|
+
// Own fields of Malcontent.AppFilter
|
|
385
|
+
|
|
386
|
+
ref_count: number;
|
|
387
|
+
user_id: number;
|
|
388
|
+
app_list: string;
|
|
389
|
+
app_list_type: AppFilterListType;
|
|
390
|
+
allow_user_installation: boolean;
|
|
391
|
+
allow_system_installation: boolean;
|
|
392
|
+
|
|
393
|
+
// Constructors of Malcontent.AppFilter
|
|
394
|
+
|
|
395
|
+
_init(...args: any[]): void;
|
|
396
|
+
|
|
397
|
+
// Own static methods of Malcontent.AppFilter
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Deserialize an app filter previously serialized with
|
|
401
|
+
* mct_app_filter_serialize(). This function guarantees to be able to
|
|
402
|
+
* deserialize any serialized form from this version or older versions of
|
|
403
|
+
* libmalcontent.
|
|
404
|
+
*
|
|
405
|
+
* If deserialization fails, %MCT_MANAGER_ERROR_INVALID_DATA will be returned.
|
|
406
|
+
* @param variant a serialized app filter variant
|
|
407
|
+
* @param user_id the ID of the user the app filter relates to
|
|
408
|
+
*/
|
|
409
|
+
static deserialize(variant: GLib.Variant, user_id: number): AppFilter;
|
|
410
|
+
static error_quark(): GLib.Quark;
|
|
411
|
+
|
|
412
|
+
// Own methods of Malcontent.AppFilter
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Check whether app filters `a` and `b` are equal.
|
|
416
|
+
* @param b an #MctAppFilter
|
|
417
|
+
* @returns %TRUE if @a and @b are equal, %FALSE otherwise
|
|
418
|
+
*/
|
|
419
|
+
equal(b: AppFilter): boolean;
|
|
420
|
+
/**
|
|
421
|
+
* List the OARS sections present in this app filter. The sections are returned
|
|
422
|
+
* in lexicographic order. A section will be listed even if its stored value is
|
|
423
|
+
* %MCT_APP_FILTER_OARS_VALUE_UNKNOWN. The returned list may be empty.
|
|
424
|
+
* @returns %NULL-terminated array of OARS sections
|
|
425
|
+
*/
|
|
426
|
+
get_oars_sections(): string[];
|
|
427
|
+
/**
|
|
428
|
+
* Get the value assigned to the given `oars_section` in the OARS filter stored
|
|
429
|
+
* within `filter`. If that section has no value explicitly defined,
|
|
430
|
+
* %MCT_APP_FILTER_OARS_VALUE_UNKNOWN is returned.
|
|
431
|
+
*
|
|
432
|
+
* This value is the most intense value allowed for apps to have in this
|
|
433
|
+
* section, inclusive. Any app with a more intense value for this section must
|
|
434
|
+
* be hidden from the user whose `filter` this is.
|
|
435
|
+
*
|
|
436
|
+
* This does not factor in mct_app_filter_is_system_installation_allowed().
|
|
437
|
+
* @param oars_section name of the OARS section to get the value from
|
|
438
|
+
* @returns an #MctAppFilterOarsValue
|
|
439
|
+
*/
|
|
440
|
+
get_oars_value(oars_section: string): AppFilterOarsValue;
|
|
441
|
+
/**
|
|
442
|
+
* Get the user ID of the user this #MctAppFilter is for.
|
|
443
|
+
* @returns user ID of the relevant user, or `(uid_t) -1` if unknown
|
|
444
|
+
*/
|
|
445
|
+
get_user_id(): number;
|
|
446
|
+
/**
|
|
447
|
+
* Check whether the app with the given `app_info` is allowed to be run
|
|
448
|
+
* according to this app filter. This matches on multiple keys potentially
|
|
449
|
+
* present in the #GAppInfo, including the path of the executable.
|
|
450
|
+
* @param app_info application information
|
|
451
|
+
* @returns %TRUE if the user this @filter corresponds to is allowed to run the app represented by @app_info according to the @filter policy; %FALSE otherwise
|
|
452
|
+
*/
|
|
453
|
+
is_appinfo_allowed(app_info: Gio.AppInfo): boolean;
|
|
454
|
+
/**
|
|
455
|
+
* Check whether apps handling the given `content_type` are allowed to be run
|
|
456
|
+
* according to this app filter.
|
|
457
|
+
*
|
|
458
|
+
* Note that this method doesn’t match content subtypes. For example, if
|
|
459
|
+
* `application/xml` is added to the blocklist but `application/xspf+xml` is not,
|
|
460
|
+
* a check for whether `application/xspf+xml` is blocklisted would return false.
|
|
461
|
+
* @param content_type content type to check
|
|
462
|
+
* @returns %TRUE if the user this @filter corresponds to is allowed to run programs handling @content_type according to the @filter policy; %FALSE otherwise
|
|
463
|
+
*/
|
|
464
|
+
is_content_type_allowed(content_type: string): boolean;
|
|
465
|
+
/**
|
|
466
|
+
* Check whether the app filter is enabled and is going to impose at least one
|
|
467
|
+
* restriction on the user. This gives a high level view of whether app filter
|
|
468
|
+
* parental controls are ‘enabled’ for the given user.
|
|
469
|
+
* @returns %TRUE if the app filter contains at least one non-default value, %FALSE if it’s entirely default
|
|
470
|
+
*/
|
|
471
|
+
is_enabled(): boolean;
|
|
472
|
+
/**
|
|
473
|
+
* Check whether the flatpak app with the given `app_id` is allowed to be run
|
|
474
|
+
* according to this app filter. This is a globbing match, matching `app_id`
|
|
475
|
+
* against potentially multiple entries in the blocklist, as the blocklist
|
|
476
|
+
* contains flatpak refs (for example, `app/org.gnome.Builder/x86_64/master`)
|
|
477
|
+
* which contain architecture and branch information. App IDs (for example,
|
|
478
|
+
* `org.gnome.Builder`) do not contain architecture or branch information.
|
|
479
|
+
* @param app_id flatpak ID for the app, for example `org.gnome.Builder`
|
|
480
|
+
* @returns %TRUE if the user this @filter corresponds to is allowed to run the flatpak called @app_id according to the @filter policy; %FALSE otherwise
|
|
481
|
+
*/
|
|
482
|
+
is_flatpak_app_allowed(app_id: string): boolean;
|
|
483
|
+
/**
|
|
484
|
+
* Check whether the flatpak app with the given `app_ref` is allowed to be run
|
|
485
|
+
* according to this app filter.
|
|
486
|
+
* @param app_ref flatpak ref for the app, for example `app/org.gnome.Builder/x86_64/master`
|
|
487
|
+
* @returns %TRUE if the user this @filter corresponds to is allowed to run the flatpak called @app_ref according to the @filter policy; %FALSE otherwise
|
|
488
|
+
*/
|
|
489
|
+
is_flatpak_ref_allowed(app_ref: string): boolean;
|
|
490
|
+
/**
|
|
491
|
+
* Check whether the program at `path` is allowed to be run according to this
|
|
492
|
+
* app filter. `path` will be canonicalised without doing any I/O.
|
|
493
|
+
* @param path absolute path of a program to check
|
|
494
|
+
* @returns %TRUE if the user this @filter corresponds to is allowed to run the program at @path according to the @filter policy; %FALSE otherwise
|
|
495
|
+
*/
|
|
496
|
+
is_path_allowed(path: string): boolean;
|
|
497
|
+
/**
|
|
498
|
+
* Get whether the user is allowed to install to the flatpak system repository.
|
|
499
|
+
* This should be queried in addition to the OARS values
|
|
500
|
+
* (mct_app_filter_get_oars_value()) — if it returns %FALSE, the OARS values
|
|
501
|
+
* should be ignored and app installation should be unconditionally disallowed.
|
|
502
|
+
* @returns %TRUE if app installation is allowed to the system repository for this user; %FALSE if it is unconditionally disallowed for this user
|
|
503
|
+
*/
|
|
504
|
+
is_system_installation_allowed(): boolean;
|
|
505
|
+
/**
|
|
506
|
+
* Get whether the user is allowed to install to their flatpak user repository.
|
|
507
|
+
* This should be queried in addition to the OARS values
|
|
508
|
+
* (mct_app_filter_get_oars_value()) — if it returns %FALSE, the OARS values
|
|
509
|
+
* should be ignored and app installation should be unconditionally disallowed.
|
|
510
|
+
* @returns %TRUE if app installation is allowed to the user repository for this user; %FALSE if it is unconditionally disallowed for this user
|
|
511
|
+
*/
|
|
512
|
+
is_user_installation_allowed(): boolean;
|
|
513
|
+
/**
|
|
514
|
+
* Increment the reference count of `filter,` and return the same pointer to it.
|
|
515
|
+
* @returns the same pointer as @filter
|
|
516
|
+
*/
|
|
517
|
+
ref(): AppFilter;
|
|
518
|
+
/**
|
|
519
|
+
* Build a #GVariant which contains the app filter from `filter,` in an opaque
|
|
520
|
+
* variant format. This format may change in future, but
|
|
521
|
+
* mct_app_filter_deserialize() is guaranteed to always be able to load any
|
|
522
|
+
* variant produced by the current or any previous version of
|
|
523
|
+
* mct_app_filter_serialize().
|
|
524
|
+
* @returns a new, floating #GVariant containing the app filter
|
|
525
|
+
*/
|
|
526
|
+
serialize(): GLib.Variant;
|
|
527
|
+
/**
|
|
528
|
+
* Decrement the reference count of `filter`. If the reference count reaches
|
|
529
|
+
* zero, free the `filter` and all its resources.
|
|
530
|
+
*/
|
|
531
|
+
unref(): void;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* #MctAppFilterBuilder is a stack-allocated mutable structure used to build an
|
|
536
|
+
* #MctAppFilter instance. Use mct_app_filter_builder_init(), various method
|
|
537
|
+
* calls to set properties of the app filter, and then
|
|
538
|
+
* mct_app_filter_builder_end(), to construct an #MctAppFilter.
|
|
539
|
+
*/
|
|
540
|
+
class AppFilterBuilder {
|
|
541
|
+
static $gtype: GObject.GType<AppFilterBuilder>;
|
|
542
|
+
|
|
543
|
+
// Constructors of Malcontent.AppFilterBuilder
|
|
544
|
+
|
|
545
|
+
constructor(properties?: Partial<{}>);
|
|
546
|
+
_init(...args: any[]): void;
|
|
547
|
+
|
|
548
|
+
static ['new'](): AppFilterBuilder;
|
|
549
|
+
|
|
550
|
+
// Own methods of Malcontent.AppFilterBuilder
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Add `content_type` to the blocklist of content types in the filter under
|
|
554
|
+
* construction. The `content_type` will not be added again if it’s already been
|
|
555
|
+
* added.
|
|
556
|
+
*
|
|
557
|
+
* Note that this method doesn’t handle content subtypes. For example, if
|
|
558
|
+
* `application/xml` is added to the blocklist but `application/xspf+xml` is not,
|
|
559
|
+
* a check for whether `application/xspf+xml` is blocklisted would return false.
|
|
560
|
+
* @param content_type a content type to blocklist
|
|
561
|
+
*/
|
|
562
|
+
blocklist_content_type(content_type: string): void;
|
|
563
|
+
/**
|
|
564
|
+
* Add `app_ref` to the blocklist of flatpak refs in the filter under
|
|
565
|
+
* construction. The `app_ref` will not be added again if it’s already been
|
|
566
|
+
* added.
|
|
567
|
+
* @param app_ref a flatpak app ref to blocklist
|
|
568
|
+
*/
|
|
569
|
+
blocklist_flatpak_ref(app_ref: string): void;
|
|
570
|
+
/**
|
|
571
|
+
* Add `path` to the blocklist of app paths in the filter under construction. It
|
|
572
|
+
* will be canonicalised (without doing any I/O) before being added.
|
|
573
|
+
* The canonicalised `path` will not be added again if it’s already been added.
|
|
574
|
+
* @param path an absolute path to blocklist
|
|
575
|
+
*/
|
|
576
|
+
blocklist_path(path: string): void;
|
|
577
|
+
/**
|
|
578
|
+
* Clear `builder,` freeing any internal state in it. This will not free the
|
|
579
|
+
* top-level storage for `builder` itself, which is assumed to be allocated on
|
|
580
|
+
* the stack.
|
|
581
|
+
*
|
|
582
|
+
* If called on an already-cleared #MctAppFilterBuilder, this function is
|
|
583
|
+
* idempotent.
|
|
584
|
+
*/
|
|
585
|
+
clear(): void;
|
|
586
|
+
/**
|
|
587
|
+
* Copy the given `builder` to a newly-allocated #MctAppFilterBuilder on the
|
|
588
|
+
* heap. This is safe to use with cleared, stack-allocated
|
|
589
|
+
* #MctAppFilterBuilders.
|
|
590
|
+
* @returns a copy of @builder
|
|
591
|
+
*/
|
|
592
|
+
copy(): AppFilterBuilder;
|
|
593
|
+
/**
|
|
594
|
+
* Finish constructing an #MctAppFilter with the given `builder,` and return it.
|
|
595
|
+
* The #MctAppFilterBuilder will be cleared as if mct_app_filter_builder_clear()
|
|
596
|
+
* had been called.
|
|
597
|
+
* @returns a newly constructed #MctAppFilter
|
|
598
|
+
*/
|
|
599
|
+
end(): AppFilter;
|
|
600
|
+
/**
|
|
601
|
+
* Free an #MctAppFilterBuilder originally allocated using
|
|
602
|
+
* mct_app_filter_builder_new(). This must not be called on stack-allocated
|
|
603
|
+
* builders initialised using mct_app_filter_builder_init().
|
|
604
|
+
*/
|
|
605
|
+
free(): void;
|
|
606
|
+
/**
|
|
607
|
+
* Initialise the given `builder` so it can be used to construct a new
|
|
608
|
+
* #MctAppFilter. `builder` must have been allocated on the stack, and must not
|
|
609
|
+
* already be initialised.
|
|
610
|
+
*
|
|
611
|
+
* Construct the #MctAppFilter by calling methods on `builder,` followed by
|
|
612
|
+
* mct_app_filter_builder_end(). To abort construction, use
|
|
613
|
+
* mct_app_filter_builder_clear().
|
|
614
|
+
*/
|
|
615
|
+
init(): void;
|
|
616
|
+
/**
|
|
617
|
+
* Set whether the user is allowed to install to the flatpak system repository.
|
|
618
|
+
* If this is %TRUE, app installation is still subject to the OARS values
|
|
619
|
+
* (mct_app_filter_builder_set_oars_value()). If it is %FALSE, app installation
|
|
620
|
+
* is unconditionally disallowed for this user.
|
|
621
|
+
* @param allow_system_installation %TRUE to allow app installation; %FALSE to unconditionally disallow it
|
|
622
|
+
*/
|
|
623
|
+
set_allow_system_installation(allow_system_installation: boolean): void;
|
|
624
|
+
/**
|
|
625
|
+
* Set whether the user is allowed to install to their flatpak user repository.
|
|
626
|
+
* If this is %TRUE, app installation is still subject to the OARS values
|
|
627
|
+
* (mct_app_filter_builder_set_oars_value()). If it is %FALSE, app installation
|
|
628
|
+
* is unconditionally disallowed for this user.
|
|
629
|
+
* @param allow_user_installation %TRUE to allow app installation; %FALSE to unconditionally disallow it
|
|
630
|
+
*/
|
|
631
|
+
set_allow_user_installation(allow_user_installation: boolean): void;
|
|
632
|
+
/**
|
|
633
|
+
* Set the OARS value for the given `oars_section,` indicating the intensity of
|
|
634
|
+
* content covered by that section which the user is allowed to see (inclusive).
|
|
635
|
+
* Any apps which have more intense content in this section should not be usable
|
|
636
|
+
* by the user.
|
|
637
|
+
* @param oars_section name of the OARS section to set the value for
|
|
638
|
+
* @param value value to set for the @oars_section
|
|
639
|
+
*/
|
|
640
|
+
set_oars_value(oars_section: string, value: AppFilterOarsValue): void;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
type ManagerClass = typeof Manager;
|
|
644
|
+
/**
|
|
645
|
+
* #MctSessionLimits is an opaque, immutable structure which contains a snapshot
|
|
646
|
+
* of the session limits settings for a user at a given time. This includes
|
|
647
|
+
* whether session limits are being enforced, and the limit policy — for
|
|
648
|
+
* example, the times of day when a user is allowed to use the computer.
|
|
649
|
+
*
|
|
650
|
+
* Typically, session limits settings can only be changed by the administrator,
|
|
651
|
+
* and are read-only for non-administrative users. The precise policy is set
|
|
652
|
+
* using polkit.
|
|
653
|
+
*/
|
|
654
|
+
class SessionLimits {
|
|
655
|
+
static $gtype: GObject.GType<SessionLimits>;
|
|
656
|
+
|
|
657
|
+
// Own fields of Malcontent.SessionLimits
|
|
658
|
+
|
|
659
|
+
ref_count: number;
|
|
660
|
+
user_id: number;
|
|
661
|
+
limit_type: SessionLimitsType;
|
|
662
|
+
daily_start_time: number;
|
|
663
|
+
daily_end_time: number;
|
|
664
|
+
|
|
665
|
+
// Constructors of Malcontent.SessionLimits
|
|
666
|
+
|
|
667
|
+
_init(...args: any[]): void;
|
|
668
|
+
|
|
669
|
+
// Own static methods of Malcontent.SessionLimits
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Deserialize a set of session limits previously serialized with
|
|
673
|
+
* mct_session_limits_serialize(). This function guarantees to be able to
|
|
674
|
+
* deserialize any serialized form from this version or older versions of
|
|
675
|
+
* libmalcontent.
|
|
676
|
+
*
|
|
677
|
+
* If deserialization fails, %MCT_MANAGER_ERROR_INVALID_DATA will be returned.
|
|
678
|
+
* @param variant a serialized session limits variant
|
|
679
|
+
* @param user_id the ID of the user the session limits relate to
|
|
680
|
+
*/
|
|
681
|
+
static deserialize(variant: GLib.Variant, user_id: number): SessionLimits;
|
|
682
|
+
|
|
683
|
+
// Own methods of Malcontent.SessionLimits
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* Check whether the user has time remaining in which they are allowed to use
|
|
687
|
+
* the computer, assuming that `now_usecs` is the current time, and applying the
|
|
688
|
+
* session limit policy from `limits` to it.
|
|
689
|
+
*
|
|
690
|
+
* This will return whether the user is allowed to use the computer now; further
|
|
691
|
+
* information about the policy and remaining time is provided in
|
|
692
|
+
* `time_remaining_secs_out` and `time_limit_enabled_out`.
|
|
693
|
+
* @param now_usecs current time as microseconds since the Unix epoch (UTC), typically queried using g_get_real_time()
|
|
694
|
+
* @returns %TRUE if the user this @limits corresponds to is allowed to be in an active session at the given time; %FALSE otherwise
|
|
695
|
+
*/
|
|
696
|
+
check_time_remaining(now_usecs: number): [boolean, number, boolean];
|
|
697
|
+
/**
|
|
698
|
+
* Get the user ID of the user this #MctSessionLimits is for.
|
|
699
|
+
* @returns user ID of the relevant user, or `(uid_t) -1` if unknown
|
|
700
|
+
*/
|
|
701
|
+
get_user_id(): number;
|
|
702
|
+
/**
|
|
703
|
+
* Check whether any session limits are enabled and are going to impose at least
|
|
704
|
+
* one restriction on the user. This gives a high level view of whether session
|
|
705
|
+
* limit parental controls are ‘enabled’ for the given user.
|
|
706
|
+
*
|
|
707
|
+
* This function is equivalent to the value returned by the
|
|
708
|
+
* `time_limit_enabled_out` argument of
|
|
709
|
+
* mct_session_limits_check_time_remaining().
|
|
710
|
+
* @returns %TRUE if the session limits object contains at least one restrictive session limit, %FALSE if there are no limits in place
|
|
711
|
+
*/
|
|
712
|
+
is_enabled(): boolean;
|
|
713
|
+
/**
|
|
714
|
+
* Increment the reference count of `limits,` and return the same pointer to it.
|
|
715
|
+
* @returns the same pointer as @limits
|
|
716
|
+
*/
|
|
717
|
+
ref(): SessionLimits;
|
|
718
|
+
/**
|
|
719
|
+
* Build a #GVariant which contains the session limits from `limits,` in an
|
|
720
|
+
* opaque variant format. This format may change in future, but
|
|
721
|
+
* mct_session_limits_deserialize() is guaranteed to always be able to load any
|
|
722
|
+
* variant produced by the current or any previous version of
|
|
723
|
+
* mct_session_limits_serialize().
|
|
724
|
+
* @returns a new, floating #GVariant containing the session limits
|
|
725
|
+
*/
|
|
726
|
+
serialize(): GLib.Variant;
|
|
727
|
+
/**
|
|
728
|
+
* Decrement the reference count of `limits`. If the reference count reaches
|
|
729
|
+
* zero, free the `limits` and all its resources.
|
|
730
|
+
*/
|
|
731
|
+
unref(): void;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* #MctSessionLimitsBuilder is a stack-allocated mutable structure used to build
|
|
736
|
+
* an #MctSessionLimits instance. Use mct_session_limits_builder_init(), various
|
|
737
|
+
* method calls to set properties of the session limits, and then
|
|
738
|
+
* mct_session_limits_builder_end(), to construct an #MctSessionLimits.
|
|
739
|
+
*/
|
|
740
|
+
class SessionLimitsBuilder {
|
|
741
|
+
static $gtype: GObject.GType<SessionLimitsBuilder>;
|
|
742
|
+
|
|
743
|
+
// Constructors of Malcontent.SessionLimitsBuilder
|
|
744
|
+
|
|
745
|
+
constructor(properties?: Partial<{}>);
|
|
746
|
+
_init(...args: any[]): void;
|
|
747
|
+
|
|
748
|
+
static ['new'](): SessionLimitsBuilder;
|
|
749
|
+
|
|
750
|
+
// Own methods of Malcontent.SessionLimitsBuilder
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* Clear `builder,` freeing any internal state in it. This will not free the
|
|
754
|
+
* top-level storage for `builder` itself, which is assumed to be allocated on
|
|
755
|
+
* the stack.
|
|
756
|
+
*
|
|
757
|
+
* If called on an already-cleared #MctSessionLimitsBuilder, this function is
|
|
758
|
+
* idempotent.
|
|
759
|
+
*/
|
|
760
|
+
clear(): void;
|
|
761
|
+
/**
|
|
762
|
+
* Copy the given `builder` to a newly-allocated #MctSessionLimitsBuilder on the
|
|
763
|
+
* heap. This is safe to use with cleared, stack-allocated
|
|
764
|
+
* #MctSessionLimitsBuilders.
|
|
765
|
+
* @returns a copy of @builder
|
|
766
|
+
*/
|
|
767
|
+
copy(): SessionLimitsBuilder;
|
|
768
|
+
/**
|
|
769
|
+
* Finish constructing an #MctSessionLimits with the given `builder,` and return
|
|
770
|
+
* it. The #MctSessionLimitsBuilder will be cleared as if
|
|
771
|
+
* mct_session_limits_builder_clear() had been called.
|
|
772
|
+
* @returns a newly constructed #MctSessionLimits
|
|
773
|
+
*/
|
|
774
|
+
end(): SessionLimits;
|
|
775
|
+
/**
|
|
776
|
+
* Free an #MctSessionLimitsBuilder originally allocated using
|
|
777
|
+
* mct_session_limits_builder_new(). This must not be called on stack-allocated
|
|
778
|
+
* builders initialised using mct_session_limits_builder_init().
|
|
779
|
+
*/
|
|
780
|
+
free(): void;
|
|
781
|
+
/**
|
|
782
|
+
* Initialise the given `builder` so it can be used to construct a new
|
|
783
|
+
* #MctSessionLimits. `builder` must have been allocated on the stack, and must
|
|
784
|
+
* not already be initialised.
|
|
785
|
+
*
|
|
786
|
+
* Construct the #MctSessionLimits by calling methods on `builder,` followed by
|
|
787
|
+
* mct_session_limits_builder_end(). To abort construction, use
|
|
788
|
+
* mct_session_limits_builder_clear().
|
|
789
|
+
*/
|
|
790
|
+
init(): void;
|
|
791
|
+
/**
|
|
792
|
+
* Set the session limits in `builder` to be a daily schedule, where sessions are
|
|
793
|
+
* allowed between `start_time_secs` and `end_time_secs` every day.
|
|
794
|
+
* `start_time_secs` and `end_time_secs` are given as offsets from the start of
|
|
795
|
+
* the day, in seconds. `end_time_secs` must be greater than `start_time_secs`.
|
|
796
|
+
* `end_time_secs` must be at most `24 * 60 * 60`.
|
|
797
|
+
*
|
|
798
|
+
* This will overwrite any other session limits.
|
|
799
|
+
* @param start_time_secs number of seconds since midnight when the user’s session can first start
|
|
800
|
+
* @param end_time_secs number of seconds since midnight when the user’s session can last end
|
|
801
|
+
*/
|
|
802
|
+
set_daily_schedule(start_time_secs: number, end_time_secs: number): void;
|
|
803
|
+
/**
|
|
804
|
+
* Unset any session limits currently set in the `builder`.
|
|
805
|
+
*/
|
|
806
|
+
set_none(): void;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
type AppFilterError = ManagerError;
|
|
810
|
+
type GetAppFilterFlags = ManagerGetValueFlags;
|
|
811
|
+
type SetAppFilterFlags = ManagerSetValueFlags;
|
|
812
|
+
/**
|
|
813
|
+
* Name of the imported GIR library
|
|
814
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
815
|
+
*/
|
|
816
|
+
const __name__: string;
|
|
817
|
+
/**
|
|
818
|
+
* Version of the imported GIR library
|
|
819
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
820
|
+
*/
|
|
821
|
+
const __version__: string;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
export default Malcontent;
|
|
825
|
+
// END
|
package/malcontent-0.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@girs/malcontent-0",
|
|
3
|
+
"version": "0.0.0-4.0.0",
|
|
4
|
+
"description": "GJS TypeScript type definitions for Malcontent-0, generated from library version 0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "malcontent-0.js",
|
|
7
|
+
"main": "malcontent-0.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./ambient": {
|
|
10
|
+
"types": "./malcontent-0-ambient.d.ts",
|
|
11
|
+
"import": "./malcontent-0-ambient.js",
|
|
12
|
+
"default": "./malcontent-0-ambient.js"
|
|
13
|
+
},
|
|
14
|
+
"./import": {
|
|
15
|
+
"types": "./malcontent-0-import.d.ts",
|
|
16
|
+
"import": "./malcontent-0-import.js",
|
|
17
|
+
"default": "./malcontent-0-import.js"
|
|
18
|
+
},
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./malcontent-0.d.ts",
|
|
21
|
+
"import": "./malcontent-0.js",
|
|
22
|
+
"default": "./malcontent-0.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"test": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit malcontent-0.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@girs/gio-2.0": "^2.77.0-4.0.0-beta.1",
|
|
30
|
+
"@girs/gjs": "^4.0.0-beta.1",
|
|
31
|
+
"@girs/glib-2.0": "^2.77.0-4.0.0-beta.1",
|
|
32
|
+
"@girs/gobject-2.0": "^2.77.0-4.0.0-beta.1"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"typescript": "*"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"Gir",
|
|
39
|
+
"TypeScript",
|
|
40
|
+
"types",
|
|
41
|
+
"GObject-Introspection",
|
|
42
|
+
"GJS",
|
|
43
|
+
"Malcontent-0"
|
|
44
|
+
],
|
|
45
|
+
"author": "ts-for-gir",
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+https://github.com/gjsify/ts-for-gir.git"
|
|
50
|
+
},
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/gjsify/ts-for-gir/issues"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://github.com/gjsify/types/tree/main/malcontent-0#readme"
|
|
55
|
+
}
|
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": ["./malcontent-0.d.ts"]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|