@girs/gepub-0.7 0.7.0-4.0.0-beta.1
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/gepub-0.7-ambient.d.ts +12 -0
- package/gepub-0.7-ambient.js +2 -0
- package/gepub-0.7-import.d.ts +12 -0
- package/gepub-0.7-import.js +3 -0
- package/gepub-0.7.d.ts +1161 -0
- package/gepub-0.7.js +6 -0
- package/package.json +69 -0
- package/tsconfig.json +23 -0
- package/typedoc.json +7 -0
package/gepub-0.7.d.ts
ADDED
|
@@ -0,0 +1,1161 @@
|
|
|
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 './gepub-0.7-ambient.d.ts';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Gepub-0.7
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type libxml2 from '@girs/libxml2-2.0';
|
|
15
|
+
import type WebKit2 from '@girs/webkit2-4.1';
|
|
16
|
+
import type Soup from '@girs/soup-3.0';
|
|
17
|
+
import type Gio from '@girs/gio-2.0';
|
|
18
|
+
import type GObject from '@girs/gobject-2.0';
|
|
19
|
+
import type GLib from '@girs/glib-2.0';
|
|
20
|
+
import type JavaScriptCore from '@girs/javascriptcore-4.1';
|
|
21
|
+
import type Gtk from '@girs/gtk-3.0';
|
|
22
|
+
import type xlib from '@girs/xlib-2.0';
|
|
23
|
+
import type Gdk from '@girs/gdk-3.0';
|
|
24
|
+
import type cairo from '@girs/cairo-1.0';
|
|
25
|
+
import type Pango from '@girs/pango-1.0';
|
|
26
|
+
import type HarfBuzz from '@girs/harfbuzz-0.0';
|
|
27
|
+
import type freetype2 from '@girs/freetype2-2.0';
|
|
28
|
+
import type GdkPixbuf from '@girs/gdkpixbuf-2.0';
|
|
29
|
+
import type GModule from '@girs/gmodule-2.0';
|
|
30
|
+
import type Atk from '@girs/atk-1.0';
|
|
31
|
+
|
|
32
|
+
export namespace Gepub {
|
|
33
|
+
enum TextChunkType {
|
|
34
|
+
EPUBTEXTHEADER,
|
|
35
|
+
EPUBTEXTBOLD,
|
|
36
|
+
EPUBTEXTITALIC,
|
|
37
|
+
EPUBTEXTNORMAL,
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The book author.
|
|
41
|
+
*/
|
|
42
|
+
const META_AUTHOR: string;
|
|
43
|
+
/**
|
|
44
|
+
* The book description.
|
|
45
|
+
*/
|
|
46
|
+
const META_DESC: string;
|
|
47
|
+
/**
|
|
48
|
+
* The book id.
|
|
49
|
+
*/
|
|
50
|
+
const META_ID: string;
|
|
51
|
+
/**
|
|
52
|
+
* The book lang.
|
|
53
|
+
*/
|
|
54
|
+
const META_LANG: string;
|
|
55
|
+
/**
|
|
56
|
+
* The book title.
|
|
57
|
+
*/
|
|
58
|
+
const META_TITLE: string;
|
|
59
|
+
function utils_get_prop(node: libxml2.Node, prop: string): string;
|
|
60
|
+
function utils_get_text_elements(node: libxml2.Node): TextChunk[];
|
|
61
|
+
/**
|
|
62
|
+
* Replacing epub media paths, for css, image and svg files, to be
|
|
63
|
+
* able to provide these files to webkit from the epub file.
|
|
64
|
+
* @param content a #GBytes containing the XML data
|
|
65
|
+
* @param path The path to replace
|
|
66
|
+
* @returns a new #GBytes containing the updated XML data
|
|
67
|
+
*/
|
|
68
|
+
function utils_replace_resources(content: GLib.Bytes | Uint8Array, path: string): GLib.Bytes;
|
|
69
|
+
module Archive {
|
|
70
|
+
// Constructor properties interface
|
|
71
|
+
|
|
72
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
class Archive extends GObject.Object {
|
|
76
|
+
static $gtype: GObject.GType<Archive>;
|
|
77
|
+
|
|
78
|
+
// Constructors of Gepub.Archive
|
|
79
|
+
|
|
80
|
+
constructor(properties?: Partial<Archive.ConstructorProps>, ...args: any[]);
|
|
81
|
+
|
|
82
|
+
_init(...args: any[]): void;
|
|
83
|
+
|
|
84
|
+
static ['new'](path: string): Archive;
|
|
85
|
+
|
|
86
|
+
// Own methods of Gepub.Archive
|
|
87
|
+
|
|
88
|
+
get_root_file(): string;
|
|
89
|
+
list_files(): string[];
|
|
90
|
+
read_entry(path: string): GLib.Bytes;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
module Doc {
|
|
94
|
+
// Constructor properties interface
|
|
95
|
+
|
|
96
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps, Gio.Initable.ConstructorProps {
|
|
97
|
+
chapter: number;
|
|
98
|
+
path: string;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
class Doc extends GObject.Object implements Gio.Initable {
|
|
103
|
+
static $gtype: GObject.GType<Doc>;
|
|
104
|
+
|
|
105
|
+
// Own properties of Gepub.Doc
|
|
106
|
+
|
|
107
|
+
get chapter(): number;
|
|
108
|
+
set chapter(val: number);
|
|
109
|
+
get path(): string;
|
|
110
|
+
|
|
111
|
+
// Constructors of Gepub.Doc
|
|
112
|
+
|
|
113
|
+
constructor(properties?: Partial<Doc.ConstructorProps>, ...args: any[]);
|
|
114
|
+
|
|
115
|
+
_init(...args: any[]): void;
|
|
116
|
+
|
|
117
|
+
static ['new'](path: string): Doc;
|
|
118
|
+
|
|
119
|
+
// Own methods of Gepub.Doc
|
|
120
|
+
|
|
121
|
+
get_chapter(): number;
|
|
122
|
+
get_content(): GLib.Bytes;
|
|
123
|
+
get_cover(): string;
|
|
124
|
+
get_current(): GLib.Bytes;
|
|
125
|
+
get_current_id(): string;
|
|
126
|
+
get_current_mime(): string;
|
|
127
|
+
get_current_path(): string;
|
|
128
|
+
get_current_with_epub_uris(): GLib.Bytes;
|
|
129
|
+
get_metadata(mdata: string): string;
|
|
130
|
+
get_n_chapters(): number;
|
|
131
|
+
get_resource(path: string): GLib.Bytes;
|
|
132
|
+
get_resource_by_id(id: string): GLib.Bytes;
|
|
133
|
+
get_resource_mime(path: string): string;
|
|
134
|
+
get_resource_mime_by_id(id: string): string;
|
|
135
|
+
get_resource_path(id: string): string;
|
|
136
|
+
get_resources(): GLib.HashTable<string, Resource>;
|
|
137
|
+
get_text(): TextChunk[];
|
|
138
|
+
get_text_by_id(id: string): TextChunk[];
|
|
139
|
+
get_toc(): NavPoint[];
|
|
140
|
+
go_next(): boolean;
|
|
141
|
+
go_prev(): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* This method tries to find the resource by id in the doc spine and
|
|
144
|
+
* will return the index in that list. If the resourse isn't there this method
|
|
145
|
+
* will return -1.
|
|
146
|
+
* @param id The resource id
|
|
147
|
+
* @returns the chapter index to use with gepub_doc_set_chapter or -1 if the resource isn't found
|
|
148
|
+
*/
|
|
149
|
+
resource_id_to_chapter(id: string): number;
|
|
150
|
+
/**
|
|
151
|
+
* This method tries to find the resource by path in the doc spine and
|
|
152
|
+
* will return the index in that list. If the resourse isn't there this method
|
|
153
|
+
* will return -1.
|
|
154
|
+
* @param uri The resource path
|
|
155
|
+
* @returns the chapter index to use with gepub_doc_set_chapter or -1 if the resource isn't found
|
|
156
|
+
*/
|
|
157
|
+
resource_uri_to_chapter(uri: string): number;
|
|
158
|
+
/**
|
|
159
|
+
* Sets the document current chapter to `index`.
|
|
160
|
+
* @param index the index of the new chapter
|
|
161
|
+
*/
|
|
162
|
+
set_chapter(index: number): void;
|
|
163
|
+
|
|
164
|
+
// Inherited methods
|
|
165
|
+
/**
|
|
166
|
+
* Initializes the object implementing the interface.
|
|
167
|
+
*
|
|
168
|
+
* This method is intended for language bindings. If writing in C,
|
|
169
|
+
* g_initable_new() should typically be used instead.
|
|
170
|
+
*
|
|
171
|
+
* The object must be initialized before any real use after initial
|
|
172
|
+
* construction, either with this function or g_async_initable_init_async().
|
|
173
|
+
*
|
|
174
|
+
* Implementations may also support cancellation. If `cancellable` is not %NULL,
|
|
175
|
+
* then initialization can be cancelled by triggering the cancellable object
|
|
176
|
+
* from another thread. If the operation was cancelled, the error
|
|
177
|
+
* %G_IO_ERROR_CANCELLED will be returned. If `cancellable` is not %NULL and
|
|
178
|
+
* the object doesn't support cancellable initialization the error
|
|
179
|
+
* %G_IO_ERROR_NOT_SUPPORTED will be returned.
|
|
180
|
+
*
|
|
181
|
+
* If the object is not initialized, or initialization returns with an
|
|
182
|
+
* error, then all operations on the object except g_object_ref() and
|
|
183
|
+
* g_object_unref() are considered to be invalid, and have undefined
|
|
184
|
+
* behaviour. See the [introduction][ginitable] for more details.
|
|
185
|
+
*
|
|
186
|
+
* Callers should not assume that a class which implements #GInitable can be
|
|
187
|
+
* initialized multiple times, unless the class explicitly documents itself as
|
|
188
|
+
* supporting this. Generally, a class’ implementation of init() can assume
|
|
189
|
+
* (and assert) that it will only be called once. Previously, this documentation
|
|
190
|
+
* recommended all #GInitable implementations should be idempotent; that
|
|
191
|
+
* recommendation was relaxed in GLib 2.54.
|
|
192
|
+
*
|
|
193
|
+
* If a class explicitly supports being initialized multiple times, it is
|
|
194
|
+
* recommended that the method is idempotent: multiple calls with the same
|
|
195
|
+
* arguments should return the same results. Only the first call initializes
|
|
196
|
+
* the object; further calls return the result of the first call.
|
|
197
|
+
*
|
|
198
|
+
* One reason why a class might need to support idempotent initialization is if
|
|
199
|
+
* it is designed to be used via the singleton pattern, with a
|
|
200
|
+
* #GObjectClass.constructor that sometimes returns an existing instance.
|
|
201
|
+
* In this pattern, a caller would expect to be able to call g_initable_init()
|
|
202
|
+
* on the result of g_object_new(), regardless of whether it is in fact a new
|
|
203
|
+
* instance.
|
|
204
|
+
* @param cancellable optional #GCancellable object, %NULL to ignore.
|
|
205
|
+
* @returns %TRUE if successful. If an error has occurred, this function will return %FALSE and set @error appropriately if present.
|
|
206
|
+
*/
|
|
207
|
+
init(cancellable?: Gio.Cancellable | null): boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Initializes the object implementing the interface.
|
|
210
|
+
*
|
|
211
|
+
* This method is intended for language bindings. If writing in C,
|
|
212
|
+
* g_initable_new() should typically be used instead.
|
|
213
|
+
*
|
|
214
|
+
* The object must be initialized before any real use after initial
|
|
215
|
+
* construction, either with this function or g_async_initable_init_async().
|
|
216
|
+
*
|
|
217
|
+
* Implementations may also support cancellation. If `cancellable` is not %NULL,
|
|
218
|
+
* then initialization can be cancelled by triggering the cancellable object
|
|
219
|
+
* from another thread. If the operation was cancelled, the error
|
|
220
|
+
* %G_IO_ERROR_CANCELLED will be returned. If `cancellable` is not %NULL and
|
|
221
|
+
* the object doesn't support cancellable initialization the error
|
|
222
|
+
* %G_IO_ERROR_NOT_SUPPORTED will be returned.
|
|
223
|
+
*
|
|
224
|
+
* If the object is not initialized, or initialization returns with an
|
|
225
|
+
* error, then all operations on the object except g_object_ref() and
|
|
226
|
+
* g_object_unref() are considered to be invalid, and have undefined
|
|
227
|
+
* behaviour. See the [introduction][ginitable] for more details.
|
|
228
|
+
*
|
|
229
|
+
* Callers should not assume that a class which implements #GInitable can be
|
|
230
|
+
* initialized multiple times, unless the class explicitly documents itself as
|
|
231
|
+
* supporting this. Generally, a class’ implementation of init() can assume
|
|
232
|
+
* (and assert) that it will only be called once. Previously, this documentation
|
|
233
|
+
* recommended all #GInitable implementations should be idempotent; that
|
|
234
|
+
* recommendation was relaxed in GLib 2.54.
|
|
235
|
+
*
|
|
236
|
+
* If a class explicitly supports being initialized multiple times, it is
|
|
237
|
+
* recommended that the method is idempotent: multiple calls with the same
|
|
238
|
+
* arguments should return the same results. Only the first call initializes
|
|
239
|
+
* the object; further calls return the result of the first call.
|
|
240
|
+
*
|
|
241
|
+
* One reason why a class might need to support idempotent initialization is if
|
|
242
|
+
* it is designed to be used via the singleton pattern, with a
|
|
243
|
+
* #GObjectClass.constructor that sometimes returns an existing instance.
|
|
244
|
+
* In this pattern, a caller would expect to be able to call g_initable_init()
|
|
245
|
+
* on the result of g_object_new(), regardless of whether it is in fact a new
|
|
246
|
+
* instance.
|
|
247
|
+
* @param cancellable optional #GCancellable object, %NULL to ignore.
|
|
248
|
+
*/
|
|
249
|
+
vfunc_init(cancellable?: Gio.Cancellable | null): boolean;
|
|
250
|
+
/**
|
|
251
|
+
* Creates a binding between `source_property` on `source` and `target_property`
|
|
252
|
+
* on `target`.
|
|
253
|
+
*
|
|
254
|
+
* Whenever the `source_property` is changed the `target_property` is
|
|
255
|
+
* updated using the same value. For instance:
|
|
256
|
+
*
|
|
257
|
+
*
|
|
258
|
+
* ```c
|
|
259
|
+
* g_object_bind_property (action, "active", widget, "sensitive", 0);
|
|
260
|
+
* ```
|
|
261
|
+
*
|
|
262
|
+
*
|
|
263
|
+
* Will result in the "sensitive" property of the widget #GObject instance to be
|
|
264
|
+
* updated with the same value of the "active" property of the action #GObject
|
|
265
|
+
* instance.
|
|
266
|
+
*
|
|
267
|
+
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
|
|
268
|
+
* if `target_property` on `target` changes then the `source_property` on `source`
|
|
269
|
+
* will be updated as well.
|
|
270
|
+
*
|
|
271
|
+
* The binding will automatically be removed when either the `source` or the
|
|
272
|
+
* `target` instances are finalized. To remove the binding without affecting the
|
|
273
|
+
* `source` and the `target` you can just call g_object_unref() on the returned
|
|
274
|
+
* #GBinding instance.
|
|
275
|
+
*
|
|
276
|
+
* Removing the binding by calling g_object_unref() on it must only be done if
|
|
277
|
+
* the binding, `source` and `target` are only used from a single thread and it
|
|
278
|
+
* is clear that both `source` and `target` outlive the binding. Especially it
|
|
279
|
+
* is not safe to rely on this if the binding, `source` or `target` can be
|
|
280
|
+
* finalized from different threads. Keep another reference to the binding and
|
|
281
|
+
* use g_binding_unbind() instead to be on the safe side.
|
|
282
|
+
*
|
|
283
|
+
* A #GObject can have multiple bindings.
|
|
284
|
+
* @param source_property the property on @source to bind
|
|
285
|
+
* @param target the target #GObject
|
|
286
|
+
* @param target_property the property on @target to bind
|
|
287
|
+
* @param flags flags to pass to #GBinding
|
|
288
|
+
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
|
|
289
|
+
*/
|
|
290
|
+
bind_property(
|
|
291
|
+
source_property: string,
|
|
292
|
+
target: GObject.Object,
|
|
293
|
+
target_property: string,
|
|
294
|
+
flags: GObject.BindingFlags,
|
|
295
|
+
): GObject.Binding;
|
|
296
|
+
/**
|
|
297
|
+
* Complete version of g_object_bind_property().
|
|
298
|
+
*
|
|
299
|
+
* Creates a binding between `source_property` on `source` and `target_property`
|
|
300
|
+
* on `target,` allowing you to set the transformation functions to be used by
|
|
301
|
+
* the binding.
|
|
302
|
+
*
|
|
303
|
+
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
|
|
304
|
+
* if `target_property` on `target` changes then the `source_property` on `source`
|
|
305
|
+
* will be updated as well. The `transform_from` function is only used in case
|
|
306
|
+
* of bidirectional bindings, otherwise it will be ignored
|
|
307
|
+
*
|
|
308
|
+
* The binding will automatically be removed when either the `source` or the
|
|
309
|
+
* `target` instances are finalized. This will release the reference that is
|
|
310
|
+
* being held on the #GBinding instance; if you want to hold on to the
|
|
311
|
+
* #GBinding instance, you will need to hold a reference to it.
|
|
312
|
+
*
|
|
313
|
+
* To remove the binding, call g_binding_unbind().
|
|
314
|
+
*
|
|
315
|
+
* A #GObject can have multiple bindings.
|
|
316
|
+
*
|
|
317
|
+
* The same `user_data` parameter will be used for both `transform_to`
|
|
318
|
+
* and `transform_from` transformation functions; the `notify` function will
|
|
319
|
+
* be called once, when the binding is removed. If you need different data
|
|
320
|
+
* for each transformation function, please use
|
|
321
|
+
* g_object_bind_property_with_closures() instead.
|
|
322
|
+
* @param source_property the property on @source to bind
|
|
323
|
+
* @param target the target #GObject
|
|
324
|
+
* @param target_property the property on @target to bind
|
|
325
|
+
* @param flags flags to pass to #GBinding
|
|
326
|
+
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
|
|
327
|
+
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
|
|
328
|
+
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
|
|
329
|
+
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
|
|
330
|
+
*/
|
|
331
|
+
bind_property_full(
|
|
332
|
+
source_property: string,
|
|
333
|
+
target: GObject.Object,
|
|
334
|
+
target_property: string,
|
|
335
|
+
flags: GObject.BindingFlags,
|
|
336
|
+
transform_to?: GObject.BindingTransformFunc | null,
|
|
337
|
+
transform_from?: GObject.BindingTransformFunc | null,
|
|
338
|
+
notify?: GLib.DestroyNotify | null,
|
|
339
|
+
): GObject.Binding;
|
|
340
|
+
// Conflicted with GObject.Object.bind_property_full
|
|
341
|
+
bind_property_full(...args: never[]): any;
|
|
342
|
+
/**
|
|
343
|
+
* This function is intended for #GObject implementations to re-enforce
|
|
344
|
+
* a [floating][floating-ref] object reference. Doing this is seldom
|
|
345
|
+
* required: all #GInitiallyUnowneds are created with a floating reference
|
|
346
|
+
* which usually just needs to be sunken by calling g_object_ref_sink().
|
|
347
|
+
*/
|
|
348
|
+
force_floating(): void;
|
|
349
|
+
/**
|
|
350
|
+
* Increases the freeze count on `object`. If the freeze count is
|
|
351
|
+
* non-zero, the emission of "notify" signals on `object` is
|
|
352
|
+
* stopped. The signals are queued until the freeze count is decreased
|
|
353
|
+
* to zero. Duplicate notifications are squashed so that at most one
|
|
354
|
+
* #GObject::notify signal is emitted for each property modified while the
|
|
355
|
+
* object is frozen.
|
|
356
|
+
*
|
|
357
|
+
* This is necessary for accessors that modify multiple properties to prevent
|
|
358
|
+
* premature notification while the object is still being modified.
|
|
359
|
+
*/
|
|
360
|
+
freeze_notify(): void;
|
|
361
|
+
/**
|
|
362
|
+
* Gets a named field from the objects table of associations (see g_object_set_data()).
|
|
363
|
+
* @param key name of the key for that association
|
|
364
|
+
* @returns the data if found, or %NULL if no such data exists.
|
|
365
|
+
*/
|
|
366
|
+
get_data(key: string): any | null;
|
|
367
|
+
get_property(property_name: string): any;
|
|
368
|
+
/**
|
|
369
|
+
* This function gets back user data pointers stored via
|
|
370
|
+
* g_object_set_qdata().
|
|
371
|
+
* @param quark A #GQuark, naming the user data pointer
|
|
372
|
+
* @returns The user data pointer set, or %NULL
|
|
373
|
+
*/
|
|
374
|
+
get_qdata(quark: GLib.Quark): any | null;
|
|
375
|
+
/**
|
|
376
|
+
* Gets `n_properties` properties for an `object`.
|
|
377
|
+
* Obtained properties will be set to `values`. All properties must be valid.
|
|
378
|
+
* Warnings will be emitted and undefined behaviour may result if invalid
|
|
379
|
+
* properties are passed in.
|
|
380
|
+
* @param names the names of each property to get
|
|
381
|
+
* @param values the values of each property to get
|
|
382
|
+
*/
|
|
383
|
+
getv(names: string[], values: (GObject.Value | any)[]): void;
|
|
384
|
+
/**
|
|
385
|
+
* Checks whether `object` has a [floating][floating-ref] reference.
|
|
386
|
+
* @returns %TRUE if @object has a floating reference
|
|
387
|
+
*/
|
|
388
|
+
is_floating(): boolean;
|
|
389
|
+
/**
|
|
390
|
+
* Emits a "notify" signal for the property `property_name` on `object`.
|
|
391
|
+
*
|
|
392
|
+
* When possible, eg. when signaling a property change from within the class
|
|
393
|
+
* that registered the property, you should use g_object_notify_by_pspec()
|
|
394
|
+
* instead.
|
|
395
|
+
*
|
|
396
|
+
* Note that emission of the notify signal may be blocked with
|
|
397
|
+
* g_object_freeze_notify(). In this case, the signal emissions are queued
|
|
398
|
+
* and will be emitted (in reverse order) when g_object_thaw_notify() is
|
|
399
|
+
* called.
|
|
400
|
+
* @param property_name the name of a property installed on the class of @object.
|
|
401
|
+
*/
|
|
402
|
+
notify(property_name: string): void;
|
|
403
|
+
/**
|
|
404
|
+
* Emits a "notify" signal for the property specified by `pspec` on `object`.
|
|
405
|
+
*
|
|
406
|
+
* This function omits the property name lookup, hence it is faster than
|
|
407
|
+
* g_object_notify().
|
|
408
|
+
*
|
|
409
|
+
* One way to avoid using g_object_notify() from within the
|
|
410
|
+
* class that registered the properties, and using g_object_notify_by_pspec()
|
|
411
|
+
* instead, is to store the GParamSpec used with
|
|
412
|
+
* g_object_class_install_property() inside a static array, e.g.:
|
|
413
|
+
*
|
|
414
|
+
*
|
|
415
|
+
* ```c
|
|
416
|
+
* typedef enum
|
|
417
|
+
* {
|
|
418
|
+
* PROP_FOO = 1,
|
|
419
|
+
* PROP_LAST
|
|
420
|
+
* } MyObjectProperty;
|
|
421
|
+
*
|
|
422
|
+
* static GParamSpec *properties[PROP_LAST];
|
|
423
|
+
*
|
|
424
|
+
* static void
|
|
425
|
+
* my_object_class_init (MyObjectClass *klass)
|
|
426
|
+
* {
|
|
427
|
+
* properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
|
|
428
|
+
* 0, 100,
|
|
429
|
+
* 50,
|
|
430
|
+
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
|
431
|
+
* g_object_class_install_property (gobject_class,
|
|
432
|
+
* PROP_FOO,
|
|
433
|
+
* properties[PROP_FOO]);
|
|
434
|
+
* }
|
|
435
|
+
* ```
|
|
436
|
+
*
|
|
437
|
+
*
|
|
438
|
+
* and then notify a change on the "foo" property with:
|
|
439
|
+
*
|
|
440
|
+
*
|
|
441
|
+
* ```c
|
|
442
|
+
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
|
|
443
|
+
* ```
|
|
444
|
+
*
|
|
445
|
+
* @param pspec the #GParamSpec of a property installed on the class of @object.
|
|
446
|
+
*/
|
|
447
|
+
notify_by_pspec(pspec: GObject.ParamSpec): void;
|
|
448
|
+
/**
|
|
449
|
+
* Increases the reference count of `object`.
|
|
450
|
+
*
|
|
451
|
+
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
|
|
452
|
+
* of `object` will be propagated to the return type (using the GCC typeof()
|
|
453
|
+
* extension), so any casting the caller needs to do on the return type must be
|
|
454
|
+
* explicit.
|
|
455
|
+
* @returns the same @object
|
|
456
|
+
*/
|
|
457
|
+
ref(): GObject.Object;
|
|
458
|
+
/**
|
|
459
|
+
* Increase the reference count of `object,` and possibly remove the
|
|
460
|
+
* [floating][floating-ref] reference, if `object` has a floating reference.
|
|
461
|
+
*
|
|
462
|
+
* In other words, if the object is floating, then this call "assumes
|
|
463
|
+
* ownership" of the floating reference, converting it to a normal
|
|
464
|
+
* reference by clearing the floating flag while leaving the reference
|
|
465
|
+
* count unchanged. If the object is not floating, then this call
|
|
466
|
+
* adds a new normal reference increasing the reference count by one.
|
|
467
|
+
*
|
|
468
|
+
* Since GLib 2.56, the type of `object` will be propagated to the return type
|
|
469
|
+
* under the same conditions as for g_object_ref().
|
|
470
|
+
* @returns @object
|
|
471
|
+
*/
|
|
472
|
+
ref_sink(): GObject.Object;
|
|
473
|
+
/**
|
|
474
|
+
* Releases all references to other objects. This can be used to break
|
|
475
|
+
* reference cycles.
|
|
476
|
+
*
|
|
477
|
+
* This function should only be called from object system implementations.
|
|
478
|
+
*/
|
|
479
|
+
run_dispose(): void;
|
|
480
|
+
/**
|
|
481
|
+
* Each object carries around a table of associations from
|
|
482
|
+
* strings to pointers. This function lets you set an association.
|
|
483
|
+
*
|
|
484
|
+
* If the object already had an association with that name,
|
|
485
|
+
* the old association will be destroyed.
|
|
486
|
+
*
|
|
487
|
+
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
|
|
488
|
+
* This means a copy of `key` is kept permanently (even after `object` has been
|
|
489
|
+
* finalized) — so it is recommended to only use a small, bounded set of values
|
|
490
|
+
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
|
|
491
|
+
* @param key name of the key
|
|
492
|
+
* @param data data to associate with that key
|
|
493
|
+
*/
|
|
494
|
+
set_data(key: string, data?: any | null): void;
|
|
495
|
+
set_property(property_name: string, value: any): void;
|
|
496
|
+
/**
|
|
497
|
+
* Remove a specified datum from the object's data associations,
|
|
498
|
+
* without invoking the association's destroy handler.
|
|
499
|
+
* @param key name of the key
|
|
500
|
+
* @returns the data if found, or %NULL if no such data exists.
|
|
501
|
+
*/
|
|
502
|
+
steal_data(key: string): any | null;
|
|
503
|
+
/**
|
|
504
|
+
* This function gets back user data pointers stored via
|
|
505
|
+
* g_object_set_qdata() and removes the `data` from object
|
|
506
|
+
* without invoking its destroy() function (if any was
|
|
507
|
+
* set).
|
|
508
|
+
* Usually, calling this function is only required to update
|
|
509
|
+
* user data pointers with a destroy notifier, for example:
|
|
510
|
+
*
|
|
511
|
+
* ```c
|
|
512
|
+
* void
|
|
513
|
+
* object_add_to_user_list (GObject *object,
|
|
514
|
+
* const gchar *new_string)
|
|
515
|
+
* {
|
|
516
|
+
* // the quark, naming the object data
|
|
517
|
+
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
|
|
518
|
+
* // retrieve the old string list
|
|
519
|
+
* GList *list = g_object_steal_qdata (object, quark_string_list);
|
|
520
|
+
*
|
|
521
|
+
* // prepend new string
|
|
522
|
+
* list = g_list_prepend (list, g_strdup (new_string));
|
|
523
|
+
* // this changed 'list', so we need to set it again
|
|
524
|
+
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
|
|
525
|
+
* }
|
|
526
|
+
* static void
|
|
527
|
+
* free_string_list (gpointer data)
|
|
528
|
+
* {
|
|
529
|
+
* GList *node, *list = data;
|
|
530
|
+
*
|
|
531
|
+
* for (node = list; node; node = node->next)
|
|
532
|
+
* g_free (node->data);
|
|
533
|
+
* g_list_free (list);
|
|
534
|
+
* }
|
|
535
|
+
* ```
|
|
536
|
+
*
|
|
537
|
+
* Using g_object_get_qdata() in the above example, instead of
|
|
538
|
+
* g_object_steal_qdata() would have left the destroy function set,
|
|
539
|
+
* and thus the partial string list would have been freed upon
|
|
540
|
+
* g_object_set_qdata_full().
|
|
541
|
+
* @param quark A #GQuark, naming the user data pointer
|
|
542
|
+
* @returns The user data pointer set, or %NULL
|
|
543
|
+
*/
|
|
544
|
+
steal_qdata(quark: GLib.Quark): any | null;
|
|
545
|
+
/**
|
|
546
|
+
* Reverts the effect of a previous call to
|
|
547
|
+
* g_object_freeze_notify(). The freeze count is decreased on `object`
|
|
548
|
+
* and when it reaches zero, queued "notify" signals are emitted.
|
|
549
|
+
*
|
|
550
|
+
* Duplicate notifications for each property are squashed so that at most one
|
|
551
|
+
* #GObject::notify signal is emitted for each property, in the reverse order
|
|
552
|
+
* in which they have been queued.
|
|
553
|
+
*
|
|
554
|
+
* It is an error to call this function when the freeze count is zero.
|
|
555
|
+
*/
|
|
556
|
+
thaw_notify(): void;
|
|
557
|
+
/**
|
|
558
|
+
* Decreases the reference count of `object`. When its reference count
|
|
559
|
+
* drops to 0, the object is finalized (i.e. its memory is freed).
|
|
560
|
+
*
|
|
561
|
+
* If the pointer to the #GObject may be reused in future (for example, if it is
|
|
562
|
+
* an instance variable of another object), it is recommended to clear the
|
|
563
|
+
* pointer to %NULL rather than retain a dangling pointer to a potentially
|
|
564
|
+
* invalid #GObject instance. Use g_clear_object() for this.
|
|
565
|
+
*/
|
|
566
|
+
unref(): void;
|
|
567
|
+
/**
|
|
568
|
+
* This function essentially limits the life time of the `closure` to
|
|
569
|
+
* the life time of the object. That is, when the object is finalized,
|
|
570
|
+
* the `closure` is invalidated by calling g_closure_invalidate() on
|
|
571
|
+
* it, in order to prevent invocations of the closure with a finalized
|
|
572
|
+
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
|
|
573
|
+
* added as marshal guards to the `closure,` to ensure that an extra
|
|
574
|
+
* reference count is held on `object` during invocation of the
|
|
575
|
+
* `closure`. Usually, this function will be called on closures that
|
|
576
|
+
* use this `object` as closure data.
|
|
577
|
+
* @param closure #GClosure to watch
|
|
578
|
+
*/
|
|
579
|
+
watch_closure(closure: GObject.Closure): void;
|
|
580
|
+
vfunc_constructed(): void;
|
|
581
|
+
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
|
|
582
|
+
vfunc_dispose(): void;
|
|
583
|
+
vfunc_finalize(): void;
|
|
584
|
+
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
|
|
585
|
+
/**
|
|
586
|
+
* Emits a "notify" signal for the property `property_name` on `object`.
|
|
587
|
+
*
|
|
588
|
+
* When possible, eg. when signaling a property change from within the class
|
|
589
|
+
* that registered the property, you should use g_object_notify_by_pspec()
|
|
590
|
+
* instead.
|
|
591
|
+
*
|
|
592
|
+
* Note that emission of the notify signal may be blocked with
|
|
593
|
+
* g_object_freeze_notify(). In this case, the signal emissions are queued
|
|
594
|
+
* and will be emitted (in reverse order) when g_object_thaw_notify() is
|
|
595
|
+
* called.
|
|
596
|
+
* @param pspec
|
|
597
|
+
*/
|
|
598
|
+
vfunc_notify(pspec: GObject.ParamSpec): void;
|
|
599
|
+
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
|
|
600
|
+
disconnect(id: number): void;
|
|
601
|
+
set(properties: { [key: string]: any }): void;
|
|
602
|
+
block_signal_handler(id: number): any;
|
|
603
|
+
unblock_signal_handler(id: number): any;
|
|
604
|
+
stop_emission_by_name(detailedName: string): any;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
module TextChunk {
|
|
608
|
+
// Constructor properties interface
|
|
609
|
+
|
|
610
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {}
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
class TextChunk extends GObject.Object {
|
|
614
|
+
static $gtype: GObject.GType<TextChunk>;
|
|
615
|
+
|
|
616
|
+
// Constructors of Gepub.TextChunk
|
|
617
|
+
|
|
618
|
+
constructor(properties?: Partial<TextChunk.ConstructorProps>, ...args: any[]);
|
|
619
|
+
|
|
620
|
+
_init(...args: any[]): void;
|
|
621
|
+
|
|
622
|
+
static ['new'](type: TextChunkType, text: string): TextChunk;
|
|
623
|
+
|
|
624
|
+
// Own methods of Gepub.TextChunk
|
|
625
|
+
|
|
626
|
+
text(): string;
|
|
627
|
+
type(): TextChunkType;
|
|
628
|
+
type_str(): string;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
module Widget {
|
|
632
|
+
// Constructor properties interface
|
|
633
|
+
|
|
634
|
+
interface ConstructorProps
|
|
635
|
+
extends WebKit2.WebView.ConstructorProps,
|
|
636
|
+
Atk.ImplementorIface.ConstructorProps,
|
|
637
|
+
Gtk.Buildable.ConstructorProps {
|
|
638
|
+
chapter: number;
|
|
639
|
+
chapter_pos: number;
|
|
640
|
+
chapterPos: number;
|
|
641
|
+
doc: Doc;
|
|
642
|
+
nchapters: number;
|
|
643
|
+
paginate: boolean;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
class Widget extends WebKit2.WebView implements Atk.ImplementorIface, Gtk.Buildable {
|
|
648
|
+
static $gtype: GObject.GType<Widget>;
|
|
649
|
+
|
|
650
|
+
// Own properties of Gepub.Widget
|
|
651
|
+
|
|
652
|
+
get chapter(): number;
|
|
653
|
+
set chapter(val: number);
|
|
654
|
+
get chapter_pos(): number;
|
|
655
|
+
set chapter_pos(val: number);
|
|
656
|
+
get chapterPos(): number;
|
|
657
|
+
set chapterPos(val: number);
|
|
658
|
+
get doc(): Doc;
|
|
659
|
+
set doc(val: Doc);
|
|
660
|
+
get nchapters(): number;
|
|
661
|
+
get paginate(): boolean;
|
|
662
|
+
set paginate(val: boolean);
|
|
663
|
+
|
|
664
|
+
// Constructors of Gepub.Widget
|
|
665
|
+
|
|
666
|
+
constructor(properties?: Partial<Widget.ConstructorProps>, ...args: any[]);
|
|
667
|
+
|
|
668
|
+
_init(...args: any[]): void;
|
|
669
|
+
|
|
670
|
+
static ['new'](): Widget;
|
|
671
|
+
|
|
672
|
+
// Own methods of Gepub.Widget
|
|
673
|
+
|
|
674
|
+
chapter_next(): boolean;
|
|
675
|
+
chapter_prev(): boolean;
|
|
676
|
+
get_chapter(): number;
|
|
677
|
+
get_chapter_length(): number;
|
|
678
|
+
get_doc(): Doc;
|
|
679
|
+
/**
|
|
680
|
+
* Gets the widget custom font family
|
|
681
|
+
*/
|
|
682
|
+
get_fontfamily(): string;
|
|
683
|
+
/**
|
|
684
|
+
* Gets the widget custom font size in pt, if 0, it's not set
|
|
685
|
+
*/
|
|
686
|
+
get_fontsize(): number;
|
|
687
|
+
/**
|
|
688
|
+
* Gets the widget custom line height, if 0, it's not set
|
|
689
|
+
*/
|
|
690
|
+
get_lineheight(): number;
|
|
691
|
+
/**
|
|
692
|
+
* Gets the widget left and right margin
|
|
693
|
+
*/
|
|
694
|
+
get_margin(): number;
|
|
695
|
+
get_n_chapters(): number;
|
|
696
|
+
/**
|
|
697
|
+
* Returns whether pagination is enabled or disabled
|
|
698
|
+
*/
|
|
699
|
+
get_paginate(): boolean;
|
|
700
|
+
get_pos(): number;
|
|
701
|
+
page_next(): boolean;
|
|
702
|
+
page_prev(): boolean;
|
|
703
|
+
/**
|
|
704
|
+
* Sets the current chapter in the doc
|
|
705
|
+
* @param index the new chapter
|
|
706
|
+
*/
|
|
707
|
+
set_chapter(index: number): void;
|
|
708
|
+
/**
|
|
709
|
+
* Sets `doc` as the document displayed by the widget.
|
|
710
|
+
* @param doc a #GepubDoc
|
|
711
|
+
*/
|
|
712
|
+
set_doc(doc?: Doc | null): void;
|
|
713
|
+
/**
|
|
714
|
+
* Sets the widget custom font family
|
|
715
|
+
* @param family the custom font family name
|
|
716
|
+
*/
|
|
717
|
+
set_fontfamily(family: string): void;
|
|
718
|
+
/**
|
|
719
|
+
* Sets the widget custom font size, use 0 to show book's styles
|
|
720
|
+
* @param size the custom font size in pt
|
|
721
|
+
*/
|
|
722
|
+
set_fontsize(size: number): void;
|
|
723
|
+
/**
|
|
724
|
+
* Sets the widget custom line height, the real size will be this
|
|
725
|
+
* number multiplied by the font size.
|
|
726
|
+
* Use 0 to show book's styles
|
|
727
|
+
* @param size the custom line height
|
|
728
|
+
*/
|
|
729
|
+
set_lineheight(size: number): void;
|
|
730
|
+
/**
|
|
731
|
+
* Sets the widget left and right margin
|
|
732
|
+
* @param margin the margin in pixels
|
|
733
|
+
*/
|
|
734
|
+
set_margin(margin: number): void;
|
|
735
|
+
/**
|
|
736
|
+
* Enable or disable pagination
|
|
737
|
+
* @param p true if the widget should paginate
|
|
738
|
+
*/
|
|
739
|
+
set_paginate(p: boolean): void;
|
|
740
|
+
/**
|
|
741
|
+
* Sets the current position in the chapter
|
|
742
|
+
* @param index the new pos
|
|
743
|
+
*/
|
|
744
|
+
set_pos(index: number): void;
|
|
745
|
+
|
|
746
|
+
// Inherited methods
|
|
747
|
+
/**
|
|
748
|
+
* Creates a binding between `source_property` on `source` and `target_property`
|
|
749
|
+
* on `target`.
|
|
750
|
+
*
|
|
751
|
+
* Whenever the `source_property` is changed the `target_property` is
|
|
752
|
+
* updated using the same value. For instance:
|
|
753
|
+
*
|
|
754
|
+
*
|
|
755
|
+
* ```c
|
|
756
|
+
* g_object_bind_property (action, "active", widget, "sensitive", 0);
|
|
757
|
+
* ```
|
|
758
|
+
*
|
|
759
|
+
*
|
|
760
|
+
* Will result in the "sensitive" property of the widget #GObject instance to be
|
|
761
|
+
* updated with the same value of the "active" property of the action #GObject
|
|
762
|
+
* instance.
|
|
763
|
+
*
|
|
764
|
+
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
|
|
765
|
+
* if `target_property` on `target` changes then the `source_property` on `source`
|
|
766
|
+
* will be updated as well.
|
|
767
|
+
*
|
|
768
|
+
* The binding will automatically be removed when either the `source` or the
|
|
769
|
+
* `target` instances are finalized. To remove the binding without affecting the
|
|
770
|
+
* `source` and the `target` you can just call g_object_unref() on the returned
|
|
771
|
+
* #GBinding instance.
|
|
772
|
+
*
|
|
773
|
+
* Removing the binding by calling g_object_unref() on it must only be done if
|
|
774
|
+
* the binding, `source` and `target` are only used from a single thread and it
|
|
775
|
+
* is clear that both `source` and `target` outlive the binding. Especially it
|
|
776
|
+
* is not safe to rely on this if the binding, `source` or `target` can be
|
|
777
|
+
* finalized from different threads. Keep another reference to the binding and
|
|
778
|
+
* use g_binding_unbind() instead to be on the safe side.
|
|
779
|
+
*
|
|
780
|
+
* A #GObject can have multiple bindings.
|
|
781
|
+
* @param source_property the property on @source to bind
|
|
782
|
+
* @param target the target #GObject
|
|
783
|
+
* @param target_property the property on @target to bind
|
|
784
|
+
* @param flags flags to pass to #GBinding
|
|
785
|
+
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
|
|
786
|
+
*/
|
|
787
|
+
bind_property(
|
|
788
|
+
source_property: string,
|
|
789
|
+
target: GObject.Object,
|
|
790
|
+
target_property: string,
|
|
791
|
+
flags: GObject.BindingFlags,
|
|
792
|
+
): GObject.Binding;
|
|
793
|
+
/**
|
|
794
|
+
* Complete version of g_object_bind_property().
|
|
795
|
+
*
|
|
796
|
+
* Creates a binding between `source_property` on `source` and `target_property`
|
|
797
|
+
* on `target,` allowing you to set the transformation functions to be used by
|
|
798
|
+
* the binding.
|
|
799
|
+
*
|
|
800
|
+
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
|
|
801
|
+
* if `target_property` on `target` changes then the `source_property` on `source`
|
|
802
|
+
* will be updated as well. The `transform_from` function is only used in case
|
|
803
|
+
* of bidirectional bindings, otherwise it will be ignored
|
|
804
|
+
*
|
|
805
|
+
* The binding will automatically be removed when either the `source` or the
|
|
806
|
+
* `target` instances are finalized. This will release the reference that is
|
|
807
|
+
* being held on the #GBinding instance; if you want to hold on to the
|
|
808
|
+
* #GBinding instance, you will need to hold a reference to it.
|
|
809
|
+
*
|
|
810
|
+
* To remove the binding, call g_binding_unbind().
|
|
811
|
+
*
|
|
812
|
+
* A #GObject can have multiple bindings.
|
|
813
|
+
*
|
|
814
|
+
* The same `user_data` parameter will be used for both `transform_to`
|
|
815
|
+
* and `transform_from` transformation functions; the `notify` function will
|
|
816
|
+
* be called once, when the binding is removed. If you need different data
|
|
817
|
+
* for each transformation function, please use
|
|
818
|
+
* g_object_bind_property_with_closures() instead.
|
|
819
|
+
* @param source_property the property on @source to bind
|
|
820
|
+
* @param target the target #GObject
|
|
821
|
+
* @param target_property the property on @target to bind
|
|
822
|
+
* @param flags flags to pass to #GBinding
|
|
823
|
+
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
|
|
824
|
+
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
|
|
825
|
+
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
|
|
826
|
+
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
|
|
827
|
+
*/
|
|
828
|
+
bind_property_full(
|
|
829
|
+
source_property: string,
|
|
830
|
+
target: GObject.Object,
|
|
831
|
+
target_property: string,
|
|
832
|
+
flags: GObject.BindingFlags,
|
|
833
|
+
transform_to?: GObject.BindingTransformFunc | null,
|
|
834
|
+
transform_from?: GObject.BindingTransformFunc | null,
|
|
835
|
+
notify?: GLib.DestroyNotify | null,
|
|
836
|
+
): GObject.Binding;
|
|
837
|
+
// Conflicted with GObject.Object.bind_property_full
|
|
838
|
+
bind_property_full(...args: never[]): any;
|
|
839
|
+
/**
|
|
840
|
+
* This function is intended for #GObject implementations to re-enforce
|
|
841
|
+
* a [floating][floating-ref] object reference. Doing this is seldom
|
|
842
|
+
* required: all #GInitiallyUnowneds are created with a floating reference
|
|
843
|
+
* which usually just needs to be sunken by calling g_object_ref_sink().
|
|
844
|
+
*/
|
|
845
|
+
force_floating(): void;
|
|
846
|
+
/**
|
|
847
|
+
* Increases the freeze count on `object`. If the freeze count is
|
|
848
|
+
* non-zero, the emission of "notify" signals on `object` is
|
|
849
|
+
* stopped. The signals are queued until the freeze count is decreased
|
|
850
|
+
* to zero. Duplicate notifications are squashed so that at most one
|
|
851
|
+
* #GObject::notify signal is emitted for each property modified while the
|
|
852
|
+
* object is frozen.
|
|
853
|
+
*
|
|
854
|
+
* This is necessary for accessors that modify multiple properties to prevent
|
|
855
|
+
* premature notification while the object is still being modified.
|
|
856
|
+
*/
|
|
857
|
+
freeze_notify(): void;
|
|
858
|
+
/**
|
|
859
|
+
* Gets a named field from the objects table of associations (see g_object_set_data()).
|
|
860
|
+
* @param key name of the key for that association
|
|
861
|
+
* @returns the data if found, or %NULL if no such data exists.
|
|
862
|
+
*/
|
|
863
|
+
get_data(key: string): any | null;
|
|
864
|
+
get_property(property_name: string): any;
|
|
865
|
+
/**
|
|
866
|
+
* This function gets back user data pointers stored via
|
|
867
|
+
* g_object_set_qdata().
|
|
868
|
+
* @param quark A #GQuark, naming the user data pointer
|
|
869
|
+
* @returns The user data pointer set, or %NULL
|
|
870
|
+
*/
|
|
871
|
+
get_qdata(quark: GLib.Quark): any | null;
|
|
872
|
+
/**
|
|
873
|
+
* Gets `n_properties` properties for an `object`.
|
|
874
|
+
* Obtained properties will be set to `values`. All properties must be valid.
|
|
875
|
+
* Warnings will be emitted and undefined behaviour may result if invalid
|
|
876
|
+
* properties are passed in.
|
|
877
|
+
* @param names the names of each property to get
|
|
878
|
+
* @param values the values of each property to get
|
|
879
|
+
*/
|
|
880
|
+
getv(names: string[], values: (GObject.Value | any)[]): void;
|
|
881
|
+
/**
|
|
882
|
+
* Checks whether `object` has a [floating][floating-ref] reference.
|
|
883
|
+
* @returns %TRUE if @object has a floating reference
|
|
884
|
+
*/
|
|
885
|
+
is_floating(): boolean;
|
|
886
|
+
/**
|
|
887
|
+
* Emits a "notify" signal for the property `property_name` on `object`.
|
|
888
|
+
*
|
|
889
|
+
* When possible, eg. when signaling a property change from within the class
|
|
890
|
+
* that registered the property, you should use g_object_notify_by_pspec()
|
|
891
|
+
* instead.
|
|
892
|
+
*
|
|
893
|
+
* Note that emission of the notify signal may be blocked with
|
|
894
|
+
* g_object_freeze_notify(). In this case, the signal emissions are queued
|
|
895
|
+
* and will be emitted (in reverse order) when g_object_thaw_notify() is
|
|
896
|
+
* called.
|
|
897
|
+
* @param property_name the name of a property installed on the class of @object.
|
|
898
|
+
*/
|
|
899
|
+
notify(property_name: string): void;
|
|
900
|
+
/**
|
|
901
|
+
* Emits a "notify" signal for the property specified by `pspec` on `object`.
|
|
902
|
+
*
|
|
903
|
+
* This function omits the property name lookup, hence it is faster than
|
|
904
|
+
* g_object_notify().
|
|
905
|
+
*
|
|
906
|
+
* One way to avoid using g_object_notify() from within the
|
|
907
|
+
* class that registered the properties, and using g_object_notify_by_pspec()
|
|
908
|
+
* instead, is to store the GParamSpec used with
|
|
909
|
+
* g_object_class_install_property() inside a static array, e.g.:
|
|
910
|
+
*
|
|
911
|
+
*
|
|
912
|
+
* ```c
|
|
913
|
+
* typedef enum
|
|
914
|
+
* {
|
|
915
|
+
* PROP_FOO = 1,
|
|
916
|
+
* PROP_LAST
|
|
917
|
+
* } MyObjectProperty;
|
|
918
|
+
*
|
|
919
|
+
* static GParamSpec *properties[PROP_LAST];
|
|
920
|
+
*
|
|
921
|
+
* static void
|
|
922
|
+
* my_object_class_init (MyObjectClass *klass)
|
|
923
|
+
* {
|
|
924
|
+
* properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
|
|
925
|
+
* 0, 100,
|
|
926
|
+
* 50,
|
|
927
|
+
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
|
928
|
+
* g_object_class_install_property (gobject_class,
|
|
929
|
+
* PROP_FOO,
|
|
930
|
+
* properties[PROP_FOO]);
|
|
931
|
+
* }
|
|
932
|
+
* ```
|
|
933
|
+
*
|
|
934
|
+
*
|
|
935
|
+
* and then notify a change on the "foo" property with:
|
|
936
|
+
*
|
|
937
|
+
*
|
|
938
|
+
* ```c
|
|
939
|
+
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
|
|
940
|
+
* ```
|
|
941
|
+
*
|
|
942
|
+
* @param pspec the #GParamSpec of a property installed on the class of @object.
|
|
943
|
+
*/
|
|
944
|
+
notify_by_pspec(pspec: GObject.ParamSpec): void;
|
|
945
|
+
/**
|
|
946
|
+
* Increases the reference count of `object`.
|
|
947
|
+
*
|
|
948
|
+
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
|
|
949
|
+
* of `object` will be propagated to the return type (using the GCC typeof()
|
|
950
|
+
* extension), so any casting the caller needs to do on the return type must be
|
|
951
|
+
* explicit.
|
|
952
|
+
* @returns the same @object
|
|
953
|
+
*/
|
|
954
|
+
ref(): GObject.Object;
|
|
955
|
+
/**
|
|
956
|
+
* Increase the reference count of `object,` and possibly remove the
|
|
957
|
+
* [floating][floating-ref] reference, if `object` has a floating reference.
|
|
958
|
+
*
|
|
959
|
+
* In other words, if the object is floating, then this call "assumes
|
|
960
|
+
* ownership" of the floating reference, converting it to a normal
|
|
961
|
+
* reference by clearing the floating flag while leaving the reference
|
|
962
|
+
* count unchanged. If the object is not floating, then this call
|
|
963
|
+
* adds a new normal reference increasing the reference count by one.
|
|
964
|
+
*
|
|
965
|
+
* Since GLib 2.56, the type of `object` will be propagated to the return type
|
|
966
|
+
* under the same conditions as for g_object_ref().
|
|
967
|
+
* @returns @object
|
|
968
|
+
*/
|
|
969
|
+
ref_sink(): GObject.Object;
|
|
970
|
+
/**
|
|
971
|
+
* Releases all references to other objects. This can be used to break
|
|
972
|
+
* reference cycles.
|
|
973
|
+
*
|
|
974
|
+
* This function should only be called from object system implementations.
|
|
975
|
+
*/
|
|
976
|
+
run_dispose(): void;
|
|
977
|
+
/**
|
|
978
|
+
* Each object carries around a table of associations from
|
|
979
|
+
* strings to pointers. This function lets you set an association.
|
|
980
|
+
*
|
|
981
|
+
* If the object already had an association with that name,
|
|
982
|
+
* the old association will be destroyed.
|
|
983
|
+
*
|
|
984
|
+
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
|
|
985
|
+
* This means a copy of `key` is kept permanently (even after `object` has been
|
|
986
|
+
* finalized) — so it is recommended to only use a small, bounded set of values
|
|
987
|
+
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
|
|
988
|
+
* @param key name of the key
|
|
989
|
+
* @param data data to associate with that key
|
|
990
|
+
*/
|
|
991
|
+
set_data(key: string, data?: any | null): void;
|
|
992
|
+
set_property(property_name: string, value: any): void;
|
|
993
|
+
/**
|
|
994
|
+
* Remove a specified datum from the object's data associations,
|
|
995
|
+
* without invoking the association's destroy handler.
|
|
996
|
+
* @param key name of the key
|
|
997
|
+
* @returns the data if found, or %NULL if no such data exists.
|
|
998
|
+
*/
|
|
999
|
+
steal_data(key: string): any | null;
|
|
1000
|
+
/**
|
|
1001
|
+
* This function gets back user data pointers stored via
|
|
1002
|
+
* g_object_set_qdata() and removes the `data` from object
|
|
1003
|
+
* without invoking its destroy() function (if any was
|
|
1004
|
+
* set).
|
|
1005
|
+
* Usually, calling this function is only required to update
|
|
1006
|
+
* user data pointers with a destroy notifier, for example:
|
|
1007
|
+
*
|
|
1008
|
+
* ```c
|
|
1009
|
+
* void
|
|
1010
|
+
* object_add_to_user_list (GObject *object,
|
|
1011
|
+
* const gchar *new_string)
|
|
1012
|
+
* {
|
|
1013
|
+
* // the quark, naming the object data
|
|
1014
|
+
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
|
|
1015
|
+
* // retrieve the old string list
|
|
1016
|
+
* GList *list = g_object_steal_qdata (object, quark_string_list);
|
|
1017
|
+
*
|
|
1018
|
+
* // prepend new string
|
|
1019
|
+
* list = g_list_prepend (list, g_strdup (new_string));
|
|
1020
|
+
* // this changed 'list', so we need to set it again
|
|
1021
|
+
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
|
|
1022
|
+
* }
|
|
1023
|
+
* static void
|
|
1024
|
+
* free_string_list (gpointer data)
|
|
1025
|
+
* {
|
|
1026
|
+
* GList *node, *list = data;
|
|
1027
|
+
*
|
|
1028
|
+
* for (node = list; node; node = node->next)
|
|
1029
|
+
* g_free (node->data);
|
|
1030
|
+
* g_list_free (list);
|
|
1031
|
+
* }
|
|
1032
|
+
* ```
|
|
1033
|
+
*
|
|
1034
|
+
* Using g_object_get_qdata() in the above example, instead of
|
|
1035
|
+
* g_object_steal_qdata() would have left the destroy function set,
|
|
1036
|
+
* and thus the partial string list would have been freed upon
|
|
1037
|
+
* g_object_set_qdata_full().
|
|
1038
|
+
* @param quark A #GQuark, naming the user data pointer
|
|
1039
|
+
* @returns The user data pointer set, or %NULL
|
|
1040
|
+
*/
|
|
1041
|
+
steal_qdata(quark: GLib.Quark): any | null;
|
|
1042
|
+
/**
|
|
1043
|
+
* Reverts the effect of a previous call to
|
|
1044
|
+
* g_object_freeze_notify(). The freeze count is decreased on `object`
|
|
1045
|
+
* and when it reaches zero, queued "notify" signals are emitted.
|
|
1046
|
+
*
|
|
1047
|
+
* Duplicate notifications for each property are squashed so that at most one
|
|
1048
|
+
* #GObject::notify signal is emitted for each property, in the reverse order
|
|
1049
|
+
* in which they have been queued.
|
|
1050
|
+
*
|
|
1051
|
+
* It is an error to call this function when the freeze count is zero.
|
|
1052
|
+
*/
|
|
1053
|
+
thaw_notify(): void;
|
|
1054
|
+
/**
|
|
1055
|
+
* Decreases the reference count of `object`. When its reference count
|
|
1056
|
+
* drops to 0, the object is finalized (i.e. its memory is freed).
|
|
1057
|
+
*
|
|
1058
|
+
* If the pointer to the #GObject may be reused in future (for example, if it is
|
|
1059
|
+
* an instance variable of another object), it is recommended to clear the
|
|
1060
|
+
* pointer to %NULL rather than retain a dangling pointer to a potentially
|
|
1061
|
+
* invalid #GObject instance. Use g_clear_object() for this.
|
|
1062
|
+
*/
|
|
1063
|
+
unref(): void;
|
|
1064
|
+
/**
|
|
1065
|
+
* This function essentially limits the life time of the `closure` to
|
|
1066
|
+
* the life time of the object. That is, when the object is finalized,
|
|
1067
|
+
* the `closure` is invalidated by calling g_closure_invalidate() on
|
|
1068
|
+
* it, in order to prevent invocations of the closure with a finalized
|
|
1069
|
+
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
|
|
1070
|
+
* added as marshal guards to the `closure,` to ensure that an extra
|
|
1071
|
+
* reference count is held on `object` during invocation of the
|
|
1072
|
+
* `closure`. Usually, this function will be called on closures that
|
|
1073
|
+
* use this `object` as closure data.
|
|
1074
|
+
* @param closure #GClosure to watch
|
|
1075
|
+
*/
|
|
1076
|
+
watch_closure(closure: GObject.Closure): void;
|
|
1077
|
+
vfunc_constructed(): void;
|
|
1078
|
+
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
|
|
1079
|
+
vfunc_dispose(): void;
|
|
1080
|
+
vfunc_finalize(): void;
|
|
1081
|
+
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
|
|
1082
|
+
/**
|
|
1083
|
+
* Emits a "notify" signal for the property `property_name` on `object`.
|
|
1084
|
+
*
|
|
1085
|
+
* When possible, eg. when signaling a property change from within the class
|
|
1086
|
+
* that registered the property, you should use g_object_notify_by_pspec()
|
|
1087
|
+
* instead.
|
|
1088
|
+
*
|
|
1089
|
+
* Note that emission of the notify signal may be blocked with
|
|
1090
|
+
* g_object_freeze_notify(). In this case, the signal emissions are queued
|
|
1091
|
+
* and will be emitted (in reverse order) when g_object_thaw_notify() is
|
|
1092
|
+
* called.
|
|
1093
|
+
* @param pspec
|
|
1094
|
+
*/
|
|
1095
|
+
vfunc_notify(pspec: GObject.ParamSpec): void;
|
|
1096
|
+
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
|
|
1097
|
+
disconnect(id: number): void;
|
|
1098
|
+
set(properties: { [key: string]: any }): void;
|
|
1099
|
+
block_signal_handler(id: number): any;
|
|
1100
|
+
unblock_signal_handler(id: number): any;
|
|
1101
|
+
stop_emission_by_name(detailedName: string): any;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
type ArchiveClass = typeof Archive;
|
|
1105
|
+
type DocClass = typeof Doc;
|
|
1106
|
+
class NavPoint {
|
|
1107
|
+
static $gtype: GObject.GType<NavPoint>;
|
|
1108
|
+
|
|
1109
|
+
// Own fields of Gepub.NavPoint
|
|
1110
|
+
|
|
1111
|
+
label: string;
|
|
1112
|
+
content: string;
|
|
1113
|
+
playorder: number;
|
|
1114
|
+
|
|
1115
|
+
// Constructors of Gepub.NavPoint
|
|
1116
|
+
|
|
1117
|
+
constructor(
|
|
1118
|
+
properties?: Partial<{
|
|
1119
|
+
label: string;
|
|
1120
|
+
content: string;
|
|
1121
|
+
playorder: number;
|
|
1122
|
+
}>,
|
|
1123
|
+
);
|
|
1124
|
+
_init(...args: any[]): void;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
class Resource {
|
|
1128
|
+
static $gtype: GObject.GType<Resource>;
|
|
1129
|
+
|
|
1130
|
+
// Own fields of Gepub.Resource
|
|
1131
|
+
|
|
1132
|
+
mime: string;
|
|
1133
|
+
uri: string;
|
|
1134
|
+
|
|
1135
|
+
// Constructors of Gepub.Resource
|
|
1136
|
+
|
|
1137
|
+
constructor(
|
|
1138
|
+
properties?: Partial<{
|
|
1139
|
+
mime: string;
|
|
1140
|
+
uri: string;
|
|
1141
|
+
}>,
|
|
1142
|
+
);
|
|
1143
|
+
_init(...args: any[]): void;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
type TextChunkClass = typeof TextChunk;
|
|
1147
|
+
type WidgetClass = typeof Widget;
|
|
1148
|
+
/**
|
|
1149
|
+
* Name of the imported GIR library
|
|
1150
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
1151
|
+
*/
|
|
1152
|
+
const __name__: string;
|
|
1153
|
+
/**
|
|
1154
|
+
* Version of the imported GIR library
|
|
1155
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
1156
|
+
*/
|
|
1157
|
+
const __version__: string;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
export default Gepub;
|
|
1161
|
+
// END
|