@girs/cmenu-3.0 3.0.0-4.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -0
- package/cmenu-3.0-ambient.d.ts +12 -0
- package/cmenu-3.0-ambient.js +2 -0
- package/cmenu-3.0-import.d.ts +12 -0
- package/cmenu-3.0-import.js +3 -0
- package/cmenu-3.0.d.ts +1270 -0
- package/cmenu-3.0.js +6 -0
- package/package.json +55 -0
- package/tsconfig.json +23 -0
- package/typedoc.json +7 -0
package/cmenu-3.0.d.ts
ADDED
|
@@ -0,0 +1,1270 @@
|
|
|
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 './cmenu-3.0-ambient.d.ts';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* CMenu-3.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 CMenu {
|
|
19
|
+
enum TreeItemType {
|
|
20
|
+
INVALID,
|
|
21
|
+
DIRECTORY,
|
|
22
|
+
ENTRY,
|
|
23
|
+
SEPARATOR,
|
|
24
|
+
HEADER,
|
|
25
|
+
ALIAS,
|
|
26
|
+
}
|
|
27
|
+
const DESKTOPAPPINFO_FLATPAK_SUFFIX: string;
|
|
28
|
+
enum TreeFlags {
|
|
29
|
+
NONE,
|
|
30
|
+
INCLUDE_EXCLUDED,
|
|
31
|
+
SHOW_EMPTY,
|
|
32
|
+
INCLUDE_NODISPLAY,
|
|
33
|
+
SHOW_ALL_SEPARATORS,
|
|
34
|
+
SORT_DISPLAY_NAME,
|
|
35
|
+
INCLUDE_UNALLOCATED,
|
|
36
|
+
}
|
|
37
|
+
module DesktopAppInfo {
|
|
38
|
+
// Constructor properties interface
|
|
39
|
+
|
|
40
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps, Gio.AppInfo.ConstructorProps {}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
class DesktopAppInfo extends GObject.Object implements Gio.AppInfo {
|
|
44
|
+
static $gtype: GObject.GType<DesktopAppInfo>;
|
|
45
|
+
|
|
46
|
+
// Constructors of CMenu.DesktopAppInfo
|
|
47
|
+
|
|
48
|
+
constructor(properties?: Partial<DesktopAppInfo.ConstructorProps>, ...args: any[]);
|
|
49
|
+
|
|
50
|
+
_init(...args: any[]): void;
|
|
51
|
+
|
|
52
|
+
static ['new'](desktop_id: string): DesktopAppInfo;
|
|
53
|
+
|
|
54
|
+
static new_from_filename(filename: string): DesktopAppInfo;
|
|
55
|
+
|
|
56
|
+
static new_from_keyfile(key_file: GLib.KeyFile): DesktopAppInfo;
|
|
57
|
+
|
|
58
|
+
// Own methods of CMenu.DesktopAppInfo
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Gets the user-visible display name of the "additional application
|
|
62
|
+
* action" specified by `action_name`.
|
|
63
|
+
*
|
|
64
|
+
* This corresponds to the "Name" key within the keyfile group for the
|
|
65
|
+
* action.
|
|
66
|
+
* @param action_name the name of the action as from gmenu_desktopappinfo_list_actions()
|
|
67
|
+
* @returns the locale-specific action name
|
|
68
|
+
*/
|
|
69
|
+
get_action_name(action_name: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* Looks up a boolean value in the keyfile backing `info`.
|
|
72
|
+
*
|
|
73
|
+
* The `key` is looked up in the "Desktop Entry" group.
|
|
74
|
+
* @param key the key to look up
|
|
75
|
+
* @returns the boolean value, or %FALSE if the key is not found
|
|
76
|
+
*/
|
|
77
|
+
get_boolean(key: string): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Gets the categories from the desktop file.
|
|
80
|
+
* @returns The unparsed Categories key from the desktop file; i.e. no attempt is made to split it by ';' or validate it.
|
|
81
|
+
*/
|
|
82
|
+
get_categories(): string;
|
|
83
|
+
/**
|
|
84
|
+
* When `info` was created from a known filename, return it. In some
|
|
85
|
+
* situations such as the #GMenuDesktopAppInfo returned from
|
|
86
|
+
* gmenu_desktopappinfo_new_from_keyfile(), this function will return %NULL.
|
|
87
|
+
* @returns The full path to the file for @info, or %NULL if not known.
|
|
88
|
+
*/
|
|
89
|
+
get_filename(): string;
|
|
90
|
+
/**
|
|
91
|
+
* This function looks up the "X-Flatpak" key of the [Desktop Entry] group,
|
|
92
|
+
* which contains the Flatpak App ID
|
|
93
|
+
* @returns the flatpak app id or %NULL
|
|
94
|
+
*/
|
|
95
|
+
get_flatpak_app_id(): string | null;
|
|
96
|
+
/**
|
|
97
|
+
* Gets the generic name from the destkop file.
|
|
98
|
+
* @returns The value of the GenericName key
|
|
99
|
+
*/
|
|
100
|
+
get_generic_name(): string;
|
|
101
|
+
get_is_flatpak(): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* A desktop file is hidden if the Hidden key in it is
|
|
104
|
+
* set to True.
|
|
105
|
+
* @returns %TRUE if hidden, %FALSE otherwise.
|
|
106
|
+
*/
|
|
107
|
+
get_is_hidden(): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Gets the keywords from the desktop file.
|
|
110
|
+
* @returns The value of the Keywords key
|
|
111
|
+
*/
|
|
112
|
+
get_keywords(): string[];
|
|
113
|
+
/**
|
|
114
|
+
* Looks up a localized string value in the keyfile backing `info`
|
|
115
|
+
* translated to the current locale.
|
|
116
|
+
*
|
|
117
|
+
* The `key` is looked up in the "Desktop Entry" group.
|
|
118
|
+
* @param key the key to look up
|
|
119
|
+
* @returns a newly allocated string, or %NULL if the key is not found
|
|
120
|
+
*/
|
|
121
|
+
get_locale_string(key: string): string | null;
|
|
122
|
+
/**
|
|
123
|
+
* Gets the value of the NoDisplay key, which helps determine if the
|
|
124
|
+
* application info should be shown in menus. See
|
|
125
|
+
* #G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY and g_app_info_should_show().
|
|
126
|
+
* @returns The value of the NoDisplay key
|
|
127
|
+
*/
|
|
128
|
+
get_nodisplay(): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Checks if the application info should be shown in menus that list available
|
|
131
|
+
* applications for a specific name of the desktop, based on the
|
|
132
|
+
* `OnlyShowIn` and `NotShowIn` keys.
|
|
133
|
+
*
|
|
134
|
+
* `desktop_env` should typically be given as %NULL, in which case the
|
|
135
|
+
* `XDG_CURRENT_DESKTOP` environment variable is consulted. If you want
|
|
136
|
+
* to override the default mechanism then you may specify `desktop_env,`
|
|
137
|
+
* but this is not recommended.
|
|
138
|
+
*
|
|
139
|
+
* Note that g_app_info_should_show() for `info` will include this check (with
|
|
140
|
+
* %NULL for `desktop_env)` as well as additional checks.
|
|
141
|
+
* @param desktop_env a string specifying a desktop name
|
|
142
|
+
* @returns %TRUE if the @info should be shown in @desktop_env according to the `OnlyShowIn` and `NotShowIn` keys, %FALSE otherwise.
|
|
143
|
+
*/
|
|
144
|
+
get_show_in(desktop_env?: string | null): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Retrieves the StartupWMClass field from `info`. This represents the
|
|
147
|
+
* WM_CLASS property of the main window of the application, if launched
|
|
148
|
+
* through `info`.
|
|
149
|
+
*
|
|
150
|
+
* Note: The returned value contain the suffix ":flatpak" if `info` specifies a flatpak app
|
|
151
|
+
* and if the desktop file has a StartupWMClass
|
|
152
|
+
* @returns the startup WM class, or %NULL if none is set in the desktop file.
|
|
153
|
+
*/
|
|
154
|
+
get_startup_wm_class(): string;
|
|
155
|
+
/**
|
|
156
|
+
* Looks up a string value in the keyfile backing `info`.
|
|
157
|
+
*
|
|
158
|
+
* The `key` is looked up in the "Desktop Entry" group.
|
|
159
|
+
* @param key the key to look up
|
|
160
|
+
* @returns a newly allocated string, or %NULL if the key is not found
|
|
161
|
+
*/
|
|
162
|
+
get_string(key: string): string;
|
|
163
|
+
/**
|
|
164
|
+
* Returns whether `key` exists in the "Desktop Entry" group
|
|
165
|
+
* of the keyfile backing `info`.
|
|
166
|
+
* @param key the key to look up
|
|
167
|
+
* @returns %TRUE if the @key exists
|
|
168
|
+
*/
|
|
169
|
+
has_key(key: string): boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Activates the named application action.
|
|
172
|
+
*
|
|
173
|
+
* You may only call this function on action names that were
|
|
174
|
+
* returned from g_desktop_app_info_list_actions().
|
|
175
|
+
*
|
|
176
|
+
* Note that if the main entry of the desktop file indicates that the
|
|
177
|
+
* application supports startup notification, and `launch_context` is
|
|
178
|
+
* non-%NULL, then startup notification will be used when activating the
|
|
179
|
+
* action (and as such, invocation of the action on the receiving side
|
|
180
|
+
* must signal the end of startup notification when it is completed).
|
|
181
|
+
* This is the expected behaviour of applications declaring additional
|
|
182
|
+
* actions, as per the desktop file specification.
|
|
183
|
+
*
|
|
184
|
+
* As with g_app_info_launch() there is no way to detect failures that
|
|
185
|
+
* occur while using this function.
|
|
186
|
+
* @param action_name the name of the action as from g_desktop_app_info_list_actions()
|
|
187
|
+
* @param launch_context a #GAppLaunchContext
|
|
188
|
+
*/
|
|
189
|
+
launch_action(action_name: string, launch_context?: Gio.AppLaunchContext | null): void;
|
|
190
|
+
/**
|
|
191
|
+
* This function performs the equivalent of g_app_info_launch_uris(),
|
|
192
|
+
* but is intended primarily for operating system components that
|
|
193
|
+
* launch applications. Ordinary applications should use
|
|
194
|
+
* g_app_info_launch_uris().
|
|
195
|
+
*
|
|
196
|
+
* If the application is launched via GSpawn, then `spawn_flags,` `user_setup`
|
|
197
|
+
* and `user_setup_data` are used for the call to g_spawn_async().
|
|
198
|
+
* Additionally, `pid_callback` (with `pid_callback_data)` will be called to
|
|
199
|
+
* inform about the PID of the created process. See g_spawn_async_with_pipes()
|
|
200
|
+
* for information on certain parameter conditions that can enable an
|
|
201
|
+
* optimized posix_spawn() codepath to be used.
|
|
202
|
+
*
|
|
203
|
+
* If application launching occurs via some other mechanism (eg: D-Bus
|
|
204
|
+
* activation) then `spawn_flags,` `user_setup,` `user_setup_data,`
|
|
205
|
+
* `pid_callback` and `pid_callback_data` are ignored.
|
|
206
|
+
* @param uris List of URIs
|
|
207
|
+
* @param launch_context a #GAppLaunchContext
|
|
208
|
+
* @param spawn_flags #GSpawnFlags, used for each process
|
|
209
|
+
* @returns %TRUE on successful launch, %FALSE otherwise.
|
|
210
|
+
*/
|
|
211
|
+
launch_uris_as_manager(
|
|
212
|
+
uris: string[],
|
|
213
|
+
launch_context: Gio.AppLaunchContext | null,
|
|
214
|
+
spawn_flags: GLib.SpawnFlags,
|
|
215
|
+
): boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Returns the list of "additional application actions" supported on the
|
|
218
|
+
* desktop file, as per the desktop file specification.
|
|
219
|
+
*
|
|
220
|
+
* As per the specification, this is the list of actions that are
|
|
221
|
+
* explicitly listed in the "Actions" key of the [Desktop Entry] group.
|
|
222
|
+
* @returns a list of strings, always non-%NULL
|
|
223
|
+
*/
|
|
224
|
+
list_actions(): string[];
|
|
225
|
+
|
|
226
|
+
// Inherited methods
|
|
227
|
+
/**
|
|
228
|
+
* Adds a content type to the application information to indicate the
|
|
229
|
+
* application is capable of opening files with the given content type.
|
|
230
|
+
* @param content_type a string.
|
|
231
|
+
* @returns %TRUE on success, %FALSE on error.
|
|
232
|
+
*/
|
|
233
|
+
add_supports_type(content_type: string): boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Obtains the information whether the #GAppInfo can be deleted.
|
|
236
|
+
* See g_app_info_delete().
|
|
237
|
+
* @returns %TRUE if @appinfo can be deleted
|
|
238
|
+
*/
|
|
239
|
+
can_delete(): boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Checks if a supported content type can be removed from an application.
|
|
242
|
+
* @returns %TRUE if it is possible to remove supported content types from a given @appinfo, %FALSE if not.
|
|
243
|
+
*/
|
|
244
|
+
can_remove_supports_type(): boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Tries to delete a #GAppInfo.
|
|
247
|
+
*
|
|
248
|
+
* On some platforms, there may be a difference between user-defined
|
|
249
|
+
* #GAppInfos which can be deleted, and system-wide ones which cannot.
|
|
250
|
+
* See g_app_info_can_delete().
|
|
251
|
+
* @returns %TRUE if @appinfo has been deleted
|
|
252
|
+
*/
|
|
253
|
+
['delete'](): boolean;
|
|
254
|
+
/**
|
|
255
|
+
* Creates a duplicate of a #GAppInfo.
|
|
256
|
+
* @returns a duplicate of @appinfo.
|
|
257
|
+
*/
|
|
258
|
+
dup(): Gio.AppInfo;
|
|
259
|
+
/**
|
|
260
|
+
* Checks if two #GAppInfos are equal.
|
|
261
|
+
*
|
|
262
|
+
* Note that the check *may not* compare each individual
|
|
263
|
+
* field, and only does an identity check. In case detecting changes in the
|
|
264
|
+
* contents is needed, program code must additionally compare relevant fields.
|
|
265
|
+
* @param appinfo2 the second #GAppInfo.
|
|
266
|
+
* @returns %TRUE if @appinfo1 is equal to @appinfo2. %FALSE otherwise.
|
|
267
|
+
*/
|
|
268
|
+
equal(appinfo2: Gio.AppInfo): boolean;
|
|
269
|
+
/**
|
|
270
|
+
* Gets the commandline with which the application will be
|
|
271
|
+
* started.
|
|
272
|
+
* @returns a string containing the @appinfo's commandline, or %NULL if this information is not available
|
|
273
|
+
*/
|
|
274
|
+
get_commandline(): string | null;
|
|
275
|
+
/**
|
|
276
|
+
* Gets a human-readable description of an installed application.
|
|
277
|
+
* @returns a string containing a description of the application @appinfo, or %NULL if none.
|
|
278
|
+
*/
|
|
279
|
+
get_description(): string | null;
|
|
280
|
+
/**
|
|
281
|
+
* Gets the display name of the application. The display name is often more
|
|
282
|
+
* descriptive to the user than the name itself.
|
|
283
|
+
* @returns the display name of the application for @appinfo, or the name if no display name is available.
|
|
284
|
+
*/
|
|
285
|
+
get_display_name(): string;
|
|
286
|
+
/**
|
|
287
|
+
* Gets the executable's name for the installed application.
|
|
288
|
+
*
|
|
289
|
+
* This is intended to be used for debugging or labelling what program is going
|
|
290
|
+
* to be run. To launch the executable, use g_app_info_launch() and related
|
|
291
|
+
* functions, rather than spawning the return value from this function.
|
|
292
|
+
* @returns a string containing the @appinfo's application binaries name
|
|
293
|
+
*/
|
|
294
|
+
get_executable(): string;
|
|
295
|
+
/**
|
|
296
|
+
* Gets the icon for the application.
|
|
297
|
+
* @returns the default #GIcon for @appinfo or %NULL if there is no default icon.
|
|
298
|
+
*/
|
|
299
|
+
get_icon(): Gio.Icon | null;
|
|
300
|
+
/**
|
|
301
|
+
* Gets the ID of an application. An id is a string that
|
|
302
|
+
* identifies the application. The exact format of the id is
|
|
303
|
+
* platform dependent. For instance, on Unix this is the
|
|
304
|
+
* desktop file id from the xdg menu specification.
|
|
305
|
+
*
|
|
306
|
+
* Note that the returned ID may be %NULL, depending on how
|
|
307
|
+
* the `appinfo` has been constructed.
|
|
308
|
+
* @returns a string containing the application's ID.
|
|
309
|
+
*/
|
|
310
|
+
get_id(): string | null;
|
|
311
|
+
/**
|
|
312
|
+
* Gets the installed name of the application.
|
|
313
|
+
* @returns the name of the application for @appinfo.
|
|
314
|
+
*/
|
|
315
|
+
get_name(): string;
|
|
316
|
+
/**
|
|
317
|
+
* Retrieves the list of content types that `app_info` claims to support.
|
|
318
|
+
* If this information is not provided by the environment, this function
|
|
319
|
+
* will return %NULL.
|
|
320
|
+
* This function does not take in consideration associations added with
|
|
321
|
+
* g_app_info_add_supports_type(), but only those exported directly by
|
|
322
|
+
* the application.
|
|
323
|
+
* @returns a list of content types.
|
|
324
|
+
*/
|
|
325
|
+
get_supported_types(): string[];
|
|
326
|
+
/**
|
|
327
|
+
* Launches the application. Passes `files` to the launched application
|
|
328
|
+
* as arguments, using the optional `context` to get information
|
|
329
|
+
* about the details of the launcher (like what screen it is on).
|
|
330
|
+
* On error, `error` will be set accordingly.
|
|
331
|
+
*
|
|
332
|
+
* To launch the application without arguments pass a %NULL `files` list.
|
|
333
|
+
*
|
|
334
|
+
* Note that even if the launch is successful the application launched
|
|
335
|
+
* can fail to start if it runs into problems during startup. There is
|
|
336
|
+
* no way to detect this.
|
|
337
|
+
*
|
|
338
|
+
* Some URIs can be changed when passed through a GFile (for instance
|
|
339
|
+
* unsupported URIs with strange formats like mailto:), so if you have
|
|
340
|
+
* a textual URI you want to pass in as argument, consider using
|
|
341
|
+
* g_app_info_launch_uris() instead.
|
|
342
|
+
*
|
|
343
|
+
* The launched application inherits the environment of the launching
|
|
344
|
+
* process, but it can be modified with g_app_launch_context_setenv()
|
|
345
|
+
* and g_app_launch_context_unsetenv().
|
|
346
|
+
*
|
|
347
|
+
* On UNIX, this function sets the `GIO_LAUNCHED_DESKTOP_FILE`
|
|
348
|
+
* environment variable with the path of the launched desktop file and
|
|
349
|
+
* `GIO_LAUNCHED_DESKTOP_FILE_PID` to the process id of the launched
|
|
350
|
+
* process. This can be used to ignore `GIO_LAUNCHED_DESKTOP_FILE`,
|
|
351
|
+
* should it be inherited by further processes. The `DISPLAY`,
|
|
352
|
+
* `XDG_ACTIVATION_TOKEN` and `DESKTOP_STARTUP_ID` environment
|
|
353
|
+
* variables are also set, based on information provided in `context`.
|
|
354
|
+
* @param files a #GList of #GFile objects
|
|
355
|
+
* @param context a #GAppLaunchContext or %NULL
|
|
356
|
+
* @returns %TRUE on successful launch, %FALSE otherwise.
|
|
357
|
+
*/
|
|
358
|
+
launch(files?: Gio.File[] | null, context?: Gio.AppLaunchContext | null): boolean;
|
|
359
|
+
/**
|
|
360
|
+
* Launches the application. This passes the `uris` to the launched application
|
|
361
|
+
* as arguments, using the optional `context` to get information
|
|
362
|
+
* about the details of the launcher (like what screen it is on).
|
|
363
|
+
* On error, `error` will be set accordingly. If the application only supports
|
|
364
|
+
* one URI per invocation as part of their command-line, multiple instances
|
|
365
|
+
* of the application will be spawned.
|
|
366
|
+
*
|
|
367
|
+
* To launch the application without arguments pass a %NULL `uris` list.
|
|
368
|
+
*
|
|
369
|
+
* Note that even if the launch is successful the application launched
|
|
370
|
+
* can fail to start if it runs into problems during startup. There is
|
|
371
|
+
* no way to detect this.
|
|
372
|
+
* @param uris a #GList containing URIs to launch.
|
|
373
|
+
* @param context a #GAppLaunchContext or %NULL
|
|
374
|
+
* @returns %TRUE on successful launch, %FALSE otherwise.
|
|
375
|
+
*/
|
|
376
|
+
launch_uris(uris?: string[] | null, context?: Gio.AppLaunchContext | null): boolean;
|
|
377
|
+
/**
|
|
378
|
+
* Async version of g_app_info_launch_uris().
|
|
379
|
+
*
|
|
380
|
+
* The `callback` is invoked immediately after the application launch, but it
|
|
381
|
+
* waits for activation in case of D-Bus–activated applications and also provides
|
|
382
|
+
* extended error information for sandboxed applications, see notes for
|
|
383
|
+
* g_app_info_launch_default_for_uri_async().
|
|
384
|
+
* @param uris a #GList containing URIs to launch.
|
|
385
|
+
* @param context a #GAppLaunchContext or %NULL
|
|
386
|
+
* @param cancellable a #GCancellable
|
|
387
|
+
* @param callback a #GAsyncReadyCallback to call when the request is done
|
|
388
|
+
*/
|
|
389
|
+
launch_uris_async(
|
|
390
|
+
uris?: string[] | null,
|
|
391
|
+
context?: Gio.AppLaunchContext | null,
|
|
392
|
+
cancellable?: Gio.Cancellable | null,
|
|
393
|
+
callback?: Gio.AsyncReadyCallback<this> | null,
|
|
394
|
+
): void;
|
|
395
|
+
/**
|
|
396
|
+
* Finishes a g_app_info_launch_uris_async() operation.
|
|
397
|
+
* @param result a #GAsyncResult
|
|
398
|
+
* @returns %TRUE on successful launch, %FALSE otherwise.
|
|
399
|
+
*/
|
|
400
|
+
launch_uris_finish(result: Gio.AsyncResult): boolean;
|
|
401
|
+
/**
|
|
402
|
+
* Removes a supported type from an application, if possible.
|
|
403
|
+
* @param content_type a string.
|
|
404
|
+
* @returns %TRUE on success, %FALSE on error.
|
|
405
|
+
*/
|
|
406
|
+
remove_supports_type(content_type: string): boolean;
|
|
407
|
+
/**
|
|
408
|
+
* Sets the application as the default handler for the given file extension.
|
|
409
|
+
* @param extension a string containing the file extension (without the dot).
|
|
410
|
+
* @returns %TRUE on success, %FALSE on error.
|
|
411
|
+
*/
|
|
412
|
+
set_as_default_for_extension(extension: string): boolean;
|
|
413
|
+
/**
|
|
414
|
+
* Sets the application as the default handler for a given type.
|
|
415
|
+
* @param content_type the content type.
|
|
416
|
+
* @returns %TRUE on success, %FALSE on error.
|
|
417
|
+
*/
|
|
418
|
+
set_as_default_for_type(content_type: string): boolean;
|
|
419
|
+
/**
|
|
420
|
+
* Sets the application as the last used application for a given type.
|
|
421
|
+
* This will make the application appear as first in the list returned
|
|
422
|
+
* by g_app_info_get_recommended_for_type(), regardless of the default
|
|
423
|
+
* application for that content type.
|
|
424
|
+
* @param content_type the content type.
|
|
425
|
+
* @returns %TRUE on success, %FALSE on error.
|
|
426
|
+
*/
|
|
427
|
+
set_as_last_used_for_type(content_type: string): boolean;
|
|
428
|
+
/**
|
|
429
|
+
* Checks if the application info should be shown in menus that
|
|
430
|
+
* list available applications.
|
|
431
|
+
* @returns %TRUE if the @appinfo should be shown, %FALSE otherwise.
|
|
432
|
+
*/
|
|
433
|
+
should_show(): boolean;
|
|
434
|
+
/**
|
|
435
|
+
* Checks if the application accepts files as arguments.
|
|
436
|
+
* @returns %TRUE if the @appinfo supports files.
|
|
437
|
+
*/
|
|
438
|
+
supports_files(): boolean;
|
|
439
|
+
/**
|
|
440
|
+
* Checks if the application supports reading files and directories from URIs.
|
|
441
|
+
* @returns %TRUE if the @appinfo supports URIs.
|
|
442
|
+
*/
|
|
443
|
+
supports_uris(): boolean;
|
|
444
|
+
/**
|
|
445
|
+
* Adds a content type to the application information to indicate the
|
|
446
|
+
* application is capable of opening files with the given content type.
|
|
447
|
+
* @param content_type a string.
|
|
448
|
+
*/
|
|
449
|
+
vfunc_add_supports_type(content_type: string): boolean;
|
|
450
|
+
/**
|
|
451
|
+
* Obtains the information whether the #GAppInfo can be deleted.
|
|
452
|
+
* See g_app_info_delete().
|
|
453
|
+
*/
|
|
454
|
+
vfunc_can_delete(): boolean;
|
|
455
|
+
/**
|
|
456
|
+
* Checks if a supported content type can be removed from an application.
|
|
457
|
+
*/
|
|
458
|
+
vfunc_can_remove_supports_type(): boolean;
|
|
459
|
+
/**
|
|
460
|
+
* Tries to delete a #GAppInfo.
|
|
461
|
+
*
|
|
462
|
+
* On some platforms, there may be a difference between user-defined
|
|
463
|
+
* #GAppInfos which can be deleted, and system-wide ones which cannot.
|
|
464
|
+
* See g_app_info_can_delete().
|
|
465
|
+
*/
|
|
466
|
+
vfunc_do_delete(): boolean;
|
|
467
|
+
/**
|
|
468
|
+
* Creates a duplicate of a #GAppInfo.
|
|
469
|
+
*/
|
|
470
|
+
vfunc_dup(): Gio.AppInfo;
|
|
471
|
+
/**
|
|
472
|
+
* Checks if two #GAppInfos are equal.
|
|
473
|
+
*
|
|
474
|
+
* Note that the check *may not* compare each individual
|
|
475
|
+
* field, and only does an identity check. In case detecting changes in the
|
|
476
|
+
* contents is needed, program code must additionally compare relevant fields.
|
|
477
|
+
* @param appinfo2 the second #GAppInfo.
|
|
478
|
+
*/
|
|
479
|
+
vfunc_equal(appinfo2: Gio.AppInfo): boolean;
|
|
480
|
+
/**
|
|
481
|
+
* Gets the commandline with which the application will be
|
|
482
|
+
* started.
|
|
483
|
+
*/
|
|
484
|
+
vfunc_get_commandline(): string | null;
|
|
485
|
+
/**
|
|
486
|
+
* Gets a human-readable description of an installed application.
|
|
487
|
+
*/
|
|
488
|
+
vfunc_get_description(): string | null;
|
|
489
|
+
/**
|
|
490
|
+
* Gets the display name of the application. The display name is often more
|
|
491
|
+
* descriptive to the user than the name itself.
|
|
492
|
+
*/
|
|
493
|
+
vfunc_get_display_name(): string;
|
|
494
|
+
/**
|
|
495
|
+
* Gets the executable's name for the installed application.
|
|
496
|
+
*
|
|
497
|
+
* This is intended to be used for debugging or labelling what program is going
|
|
498
|
+
* to be run. To launch the executable, use g_app_info_launch() and related
|
|
499
|
+
* functions, rather than spawning the return value from this function.
|
|
500
|
+
*/
|
|
501
|
+
vfunc_get_executable(): string;
|
|
502
|
+
/**
|
|
503
|
+
* Gets the icon for the application.
|
|
504
|
+
*/
|
|
505
|
+
vfunc_get_icon(): Gio.Icon | null;
|
|
506
|
+
/**
|
|
507
|
+
* Gets the ID of an application. An id is a string that
|
|
508
|
+
* identifies the application. The exact format of the id is
|
|
509
|
+
* platform dependent. For instance, on Unix this is the
|
|
510
|
+
* desktop file id from the xdg menu specification.
|
|
511
|
+
*
|
|
512
|
+
* Note that the returned ID may be %NULL, depending on how
|
|
513
|
+
* the `appinfo` has been constructed.
|
|
514
|
+
*/
|
|
515
|
+
vfunc_get_id(): string | null;
|
|
516
|
+
/**
|
|
517
|
+
* Gets the installed name of the application.
|
|
518
|
+
*/
|
|
519
|
+
vfunc_get_name(): string;
|
|
520
|
+
/**
|
|
521
|
+
* Retrieves the list of content types that `app_info` claims to support.
|
|
522
|
+
* If this information is not provided by the environment, this function
|
|
523
|
+
* will return %NULL.
|
|
524
|
+
* This function does not take in consideration associations added with
|
|
525
|
+
* g_app_info_add_supports_type(), but only those exported directly by
|
|
526
|
+
* the application.
|
|
527
|
+
*/
|
|
528
|
+
vfunc_get_supported_types(): string[];
|
|
529
|
+
/**
|
|
530
|
+
* Launches the application. Passes `files` to the launched application
|
|
531
|
+
* as arguments, using the optional `context` to get information
|
|
532
|
+
* about the details of the launcher (like what screen it is on).
|
|
533
|
+
* On error, `error` will be set accordingly.
|
|
534
|
+
*
|
|
535
|
+
* To launch the application without arguments pass a %NULL `files` list.
|
|
536
|
+
*
|
|
537
|
+
* Note that even if the launch is successful the application launched
|
|
538
|
+
* can fail to start if it runs into problems during startup. There is
|
|
539
|
+
* no way to detect this.
|
|
540
|
+
*
|
|
541
|
+
* Some URIs can be changed when passed through a GFile (for instance
|
|
542
|
+
* unsupported URIs with strange formats like mailto:), so if you have
|
|
543
|
+
* a textual URI you want to pass in as argument, consider using
|
|
544
|
+
* g_app_info_launch_uris() instead.
|
|
545
|
+
*
|
|
546
|
+
* The launched application inherits the environment of the launching
|
|
547
|
+
* process, but it can be modified with g_app_launch_context_setenv()
|
|
548
|
+
* and g_app_launch_context_unsetenv().
|
|
549
|
+
*
|
|
550
|
+
* On UNIX, this function sets the `GIO_LAUNCHED_DESKTOP_FILE`
|
|
551
|
+
* environment variable with the path of the launched desktop file and
|
|
552
|
+
* `GIO_LAUNCHED_DESKTOP_FILE_PID` to the process id of the launched
|
|
553
|
+
* process. This can be used to ignore `GIO_LAUNCHED_DESKTOP_FILE`,
|
|
554
|
+
* should it be inherited by further processes. The `DISPLAY`,
|
|
555
|
+
* `XDG_ACTIVATION_TOKEN` and `DESKTOP_STARTUP_ID` environment
|
|
556
|
+
* variables are also set, based on information provided in `context`.
|
|
557
|
+
* @param files a #GList of #GFile objects
|
|
558
|
+
* @param context a #GAppLaunchContext or %NULL
|
|
559
|
+
*/
|
|
560
|
+
vfunc_launch(files?: Gio.File[] | null, context?: Gio.AppLaunchContext | null): boolean;
|
|
561
|
+
/**
|
|
562
|
+
* Launches the application. This passes the `uris` to the launched application
|
|
563
|
+
* as arguments, using the optional `context` to get information
|
|
564
|
+
* about the details of the launcher (like what screen it is on).
|
|
565
|
+
* On error, `error` will be set accordingly. If the application only supports
|
|
566
|
+
* one URI per invocation as part of their command-line, multiple instances
|
|
567
|
+
* of the application will be spawned.
|
|
568
|
+
*
|
|
569
|
+
* To launch the application without arguments pass a %NULL `uris` list.
|
|
570
|
+
*
|
|
571
|
+
* Note that even if the launch is successful the application launched
|
|
572
|
+
* can fail to start if it runs into problems during startup. There is
|
|
573
|
+
* no way to detect this.
|
|
574
|
+
* @param uris a #GList containing URIs to launch.
|
|
575
|
+
* @param context a #GAppLaunchContext or %NULL
|
|
576
|
+
*/
|
|
577
|
+
vfunc_launch_uris(uris?: string[] | null, context?: Gio.AppLaunchContext | null): boolean;
|
|
578
|
+
/**
|
|
579
|
+
* Async version of g_app_info_launch_uris().
|
|
580
|
+
*
|
|
581
|
+
* The `callback` is invoked immediately after the application launch, but it
|
|
582
|
+
* waits for activation in case of D-Bus–activated applications and also provides
|
|
583
|
+
* extended error information for sandboxed applications, see notes for
|
|
584
|
+
* g_app_info_launch_default_for_uri_async().
|
|
585
|
+
* @param uris a #GList containing URIs to launch.
|
|
586
|
+
* @param context a #GAppLaunchContext or %NULL
|
|
587
|
+
* @param cancellable a #GCancellable
|
|
588
|
+
* @param callback a #GAsyncReadyCallback to call when the request is done
|
|
589
|
+
*/
|
|
590
|
+
vfunc_launch_uris_async(
|
|
591
|
+
uris?: string[] | null,
|
|
592
|
+
context?: Gio.AppLaunchContext | null,
|
|
593
|
+
cancellable?: Gio.Cancellable | null,
|
|
594
|
+
callback?: Gio.AsyncReadyCallback<this> | null,
|
|
595
|
+
): void;
|
|
596
|
+
/**
|
|
597
|
+
* Finishes a g_app_info_launch_uris_async() operation.
|
|
598
|
+
* @param result a #GAsyncResult
|
|
599
|
+
*/
|
|
600
|
+
vfunc_launch_uris_finish(result: Gio.AsyncResult): boolean;
|
|
601
|
+
/**
|
|
602
|
+
* Removes a supported type from an application, if possible.
|
|
603
|
+
* @param content_type a string.
|
|
604
|
+
*/
|
|
605
|
+
vfunc_remove_supports_type(content_type: string): boolean;
|
|
606
|
+
/**
|
|
607
|
+
* Sets the application as the default handler for the given file extension.
|
|
608
|
+
* @param extension a string containing the file extension (without the dot).
|
|
609
|
+
*/
|
|
610
|
+
vfunc_set_as_default_for_extension(extension: string): boolean;
|
|
611
|
+
/**
|
|
612
|
+
* Sets the application as the default handler for a given type.
|
|
613
|
+
* @param content_type the content type.
|
|
614
|
+
*/
|
|
615
|
+
vfunc_set_as_default_for_type(content_type: string): boolean;
|
|
616
|
+
/**
|
|
617
|
+
* Sets the application as the last used application for a given type.
|
|
618
|
+
* This will make the application appear as first in the list returned
|
|
619
|
+
* by g_app_info_get_recommended_for_type(), regardless of the default
|
|
620
|
+
* application for that content type.
|
|
621
|
+
* @param content_type the content type.
|
|
622
|
+
*/
|
|
623
|
+
vfunc_set_as_last_used_for_type(content_type: string): boolean;
|
|
624
|
+
/**
|
|
625
|
+
* Checks if the application info should be shown in menus that
|
|
626
|
+
* list available applications.
|
|
627
|
+
*/
|
|
628
|
+
vfunc_should_show(): boolean;
|
|
629
|
+
/**
|
|
630
|
+
* Checks if the application accepts files as arguments.
|
|
631
|
+
*/
|
|
632
|
+
vfunc_supports_files(): boolean;
|
|
633
|
+
/**
|
|
634
|
+
* Checks if the application supports reading files and directories from URIs.
|
|
635
|
+
*/
|
|
636
|
+
vfunc_supports_uris(): boolean;
|
|
637
|
+
/**
|
|
638
|
+
* Creates a binding between `source_property` on `source` and `target_property`
|
|
639
|
+
* on `target`.
|
|
640
|
+
*
|
|
641
|
+
* Whenever the `source_property` is changed the `target_property` is
|
|
642
|
+
* updated using the same value. For instance:
|
|
643
|
+
*
|
|
644
|
+
*
|
|
645
|
+
* ```c
|
|
646
|
+
* g_object_bind_property (action, "active", widget, "sensitive", 0);
|
|
647
|
+
* ```
|
|
648
|
+
*
|
|
649
|
+
*
|
|
650
|
+
* Will result in the "sensitive" property of the widget #GObject instance to be
|
|
651
|
+
* updated with the same value of the "active" property of the action #GObject
|
|
652
|
+
* instance.
|
|
653
|
+
*
|
|
654
|
+
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
|
|
655
|
+
* if `target_property` on `target` changes then the `source_property` on `source`
|
|
656
|
+
* will be updated as well.
|
|
657
|
+
*
|
|
658
|
+
* The binding will automatically be removed when either the `source` or the
|
|
659
|
+
* `target` instances are finalized. To remove the binding without affecting the
|
|
660
|
+
* `source` and the `target` you can just call g_object_unref() on the returned
|
|
661
|
+
* #GBinding instance.
|
|
662
|
+
*
|
|
663
|
+
* Removing the binding by calling g_object_unref() on it must only be done if
|
|
664
|
+
* the binding, `source` and `target` are only used from a single thread and it
|
|
665
|
+
* is clear that both `source` and `target` outlive the binding. Especially it
|
|
666
|
+
* is not safe to rely on this if the binding, `source` or `target` can be
|
|
667
|
+
* finalized from different threads. Keep another reference to the binding and
|
|
668
|
+
* use g_binding_unbind() instead to be on the safe side.
|
|
669
|
+
*
|
|
670
|
+
* A #GObject can have multiple bindings.
|
|
671
|
+
* @param source_property the property on @source to bind
|
|
672
|
+
* @param target the target #GObject
|
|
673
|
+
* @param target_property the property on @target to bind
|
|
674
|
+
* @param flags flags to pass to #GBinding
|
|
675
|
+
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
|
|
676
|
+
*/
|
|
677
|
+
bind_property(
|
|
678
|
+
source_property: string,
|
|
679
|
+
target: GObject.Object,
|
|
680
|
+
target_property: string,
|
|
681
|
+
flags: GObject.BindingFlags,
|
|
682
|
+
): GObject.Binding;
|
|
683
|
+
/**
|
|
684
|
+
* Complete version of g_object_bind_property().
|
|
685
|
+
*
|
|
686
|
+
* Creates a binding between `source_property` on `source` and `target_property`
|
|
687
|
+
* on `target,` allowing you to set the transformation functions to be used by
|
|
688
|
+
* the binding.
|
|
689
|
+
*
|
|
690
|
+
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
|
|
691
|
+
* if `target_property` on `target` changes then the `source_property` on `source`
|
|
692
|
+
* will be updated as well. The `transform_from` function is only used in case
|
|
693
|
+
* of bidirectional bindings, otherwise it will be ignored
|
|
694
|
+
*
|
|
695
|
+
* The binding will automatically be removed when either the `source` or the
|
|
696
|
+
* `target` instances are finalized. This will release the reference that is
|
|
697
|
+
* being held on the #GBinding instance; if you want to hold on to the
|
|
698
|
+
* #GBinding instance, you will need to hold a reference to it.
|
|
699
|
+
*
|
|
700
|
+
* To remove the binding, call g_binding_unbind().
|
|
701
|
+
*
|
|
702
|
+
* A #GObject can have multiple bindings.
|
|
703
|
+
*
|
|
704
|
+
* The same `user_data` parameter will be used for both `transform_to`
|
|
705
|
+
* and `transform_from` transformation functions; the `notify` function will
|
|
706
|
+
* be called once, when the binding is removed. If you need different data
|
|
707
|
+
* for each transformation function, please use
|
|
708
|
+
* g_object_bind_property_with_closures() instead.
|
|
709
|
+
* @param source_property the property on @source to bind
|
|
710
|
+
* @param target the target #GObject
|
|
711
|
+
* @param target_property the property on @target to bind
|
|
712
|
+
* @param flags flags to pass to #GBinding
|
|
713
|
+
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
|
|
714
|
+
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
|
|
715
|
+
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
|
|
716
|
+
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
|
|
717
|
+
*/
|
|
718
|
+
bind_property_full(
|
|
719
|
+
source_property: string,
|
|
720
|
+
target: GObject.Object,
|
|
721
|
+
target_property: string,
|
|
722
|
+
flags: GObject.BindingFlags,
|
|
723
|
+
transform_to?: GObject.BindingTransformFunc | null,
|
|
724
|
+
transform_from?: GObject.BindingTransformFunc | null,
|
|
725
|
+
notify?: GLib.DestroyNotify | null,
|
|
726
|
+
): GObject.Binding;
|
|
727
|
+
// Conflicted with GObject.Object.bind_property_full
|
|
728
|
+
bind_property_full(...args: never[]): any;
|
|
729
|
+
/**
|
|
730
|
+
* This function is intended for #GObject implementations to re-enforce
|
|
731
|
+
* a [floating][floating-ref] object reference. Doing this is seldom
|
|
732
|
+
* required: all #GInitiallyUnowneds are created with a floating reference
|
|
733
|
+
* which usually just needs to be sunken by calling g_object_ref_sink().
|
|
734
|
+
*/
|
|
735
|
+
force_floating(): void;
|
|
736
|
+
/**
|
|
737
|
+
* Increases the freeze count on `object`. If the freeze count is
|
|
738
|
+
* non-zero, the emission of "notify" signals on `object` is
|
|
739
|
+
* stopped. The signals are queued until the freeze count is decreased
|
|
740
|
+
* to zero. Duplicate notifications are squashed so that at most one
|
|
741
|
+
* #GObject::notify signal is emitted for each property modified while the
|
|
742
|
+
* object is frozen.
|
|
743
|
+
*
|
|
744
|
+
* This is necessary for accessors that modify multiple properties to prevent
|
|
745
|
+
* premature notification while the object is still being modified.
|
|
746
|
+
*/
|
|
747
|
+
freeze_notify(): void;
|
|
748
|
+
/**
|
|
749
|
+
* Gets a named field from the objects table of associations (see g_object_set_data()).
|
|
750
|
+
* @param key name of the key for that association
|
|
751
|
+
* @returns the data if found, or %NULL if no such data exists.
|
|
752
|
+
*/
|
|
753
|
+
get_data(key: string): any | null;
|
|
754
|
+
get_property(property_name: string): any;
|
|
755
|
+
/**
|
|
756
|
+
* This function gets back user data pointers stored via
|
|
757
|
+
* g_object_set_qdata().
|
|
758
|
+
* @param quark A #GQuark, naming the user data pointer
|
|
759
|
+
* @returns The user data pointer set, or %NULL
|
|
760
|
+
*/
|
|
761
|
+
get_qdata(quark: GLib.Quark): any | null;
|
|
762
|
+
/**
|
|
763
|
+
* Gets `n_properties` properties for an `object`.
|
|
764
|
+
* Obtained properties will be set to `values`. All properties must be valid.
|
|
765
|
+
* Warnings will be emitted and undefined behaviour may result if invalid
|
|
766
|
+
* properties are passed in.
|
|
767
|
+
* @param names the names of each property to get
|
|
768
|
+
* @param values the values of each property to get
|
|
769
|
+
*/
|
|
770
|
+
getv(names: string[], values: (GObject.Value | any)[]): void;
|
|
771
|
+
/**
|
|
772
|
+
* Checks whether `object` has a [floating][floating-ref] reference.
|
|
773
|
+
* @returns %TRUE if @object has a floating reference
|
|
774
|
+
*/
|
|
775
|
+
is_floating(): boolean;
|
|
776
|
+
/**
|
|
777
|
+
* Emits a "notify" signal for the property `property_name` on `object`.
|
|
778
|
+
*
|
|
779
|
+
* When possible, eg. when signaling a property change from within the class
|
|
780
|
+
* that registered the property, you should use g_object_notify_by_pspec()
|
|
781
|
+
* instead.
|
|
782
|
+
*
|
|
783
|
+
* Note that emission of the notify signal may be blocked with
|
|
784
|
+
* g_object_freeze_notify(). In this case, the signal emissions are queued
|
|
785
|
+
* and will be emitted (in reverse order) when g_object_thaw_notify() is
|
|
786
|
+
* called.
|
|
787
|
+
* @param property_name the name of a property installed on the class of @object.
|
|
788
|
+
*/
|
|
789
|
+
notify(property_name: string): void;
|
|
790
|
+
/**
|
|
791
|
+
* Emits a "notify" signal for the property specified by `pspec` on `object`.
|
|
792
|
+
*
|
|
793
|
+
* This function omits the property name lookup, hence it is faster than
|
|
794
|
+
* g_object_notify().
|
|
795
|
+
*
|
|
796
|
+
* One way to avoid using g_object_notify() from within the
|
|
797
|
+
* class that registered the properties, and using g_object_notify_by_pspec()
|
|
798
|
+
* instead, is to store the GParamSpec used with
|
|
799
|
+
* g_object_class_install_property() inside a static array, e.g.:
|
|
800
|
+
*
|
|
801
|
+
*
|
|
802
|
+
* ```c
|
|
803
|
+
* typedef enum
|
|
804
|
+
* {
|
|
805
|
+
* PROP_FOO = 1,
|
|
806
|
+
* PROP_LAST
|
|
807
|
+
* } MyObjectProperty;
|
|
808
|
+
*
|
|
809
|
+
* static GParamSpec *properties[PROP_LAST];
|
|
810
|
+
*
|
|
811
|
+
* static void
|
|
812
|
+
* my_object_class_init (MyObjectClass *klass)
|
|
813
|
+
* {
|
|
814
|
+
* properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
|
|
815
|
+
* 0, 100,
|
|
816
|
+
* 50,
|
|
817
|
+
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
|
818
|
+
* g_object_class_install_property (gobject_class,
|
|
819
|
+
* PROP_FOO,
|
|
820
|
+
* properties[PROP_FOO]);
|
|
821
|
+
* }
|
|
822
|
+
* ```
|
|
823
|
+
*
|
|
824
|
+
*
|
|
825
|
+
* and then notify a change on the "foo" property with:
|
|
826
|
+
*
|
|
827
|
+
*
|
|
828
|
+
* ```c
|
|
829
|
+
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
|
|
830
|
+
* ```
|
|
831
|
+
*
|
|
832
|
+
* @param pspec the #GParamSpec of a property installed on the class of @object.
|
|
833
|
+
*/
|
|
834
|
+
notify_by_pspec(pspec: GObject.ParamSpec): void;
|
|
835
|
+
/**
|
|
836
|
+
* Increases the reference count of `object`.
|
|
837
|
+
*
|
|
838
|
+
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
|
|
839
|
+
* of `object` will be propagated to the return type (using the GCC typeof()
|
|
840
|
+
* extension), so any casting the caller needs to do on the return type must be
|
|
841
|
+
* explicit.
|
|
842
|
+
* @returns the same @object
|
|
843
|
+
*/
|
|
844
|
+
ref(): GObject.Object;
|
|
845
|
+
/**
|
|
846
|
+
* Increase the reference count of `object,` and possibly remove the
|
|
847
|
+
* [floating][floating-ref] reference, if `object` has a floating reference.
|
|
848
|
+
*
|
|
849
|
+
* In other words, if the object is floating, then this call "assumes
|
|
850
|
+
* ownership" of the floating reference, converting it to a normal
|
|
851
|
+
* reference by clearing the floating flag while leaving the reference
|
|
852
|
+
* count unchanged. If the object is not floating, then this call
|
|
853
|
+
* adds a new normal reference increasing the reference count by one.
|
|
854
|
+
*
|
|
855
|
+
* Since GLib 2.56, the type of `object` will be propagated to the return type
|
|
856
|
+
* under the same conditions as for g_object_ref().
|
|
857
|
+
* @returns @object
|
|
858
|
+
*/
|
|
859
|
+
ref_sink(): GObject.Object;
|
|
860
|
+
/**
|
|
861
|
+
* Releases all references to other objects. This can be used to break
|
|
862
|
+
* reference cycles.
|
|
863
|
+
*
|
|
864
|
+
* This function should only be called from object system implementations.
|
|
865
|
+
*/
|
|
866
|
+
run_dispose(): void;
|
|
867
|
+
/**
|
|
868
|
+
* Each object carries around a table of associations from
|
|
869
|
+
* strings to pointers. This function lets you set an association.
|
|
870
|
+
*
|
|
871
|
+
* If the object already had an association with that name,
|
|
872
|
+
* the old association will be destroyed.
|
|
873
|
+
*
|
|
874
|
+
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
|
|
875
|
+
* This means a copy of `key` is kept permanently (even after `object` has been
|
|
876
|
+
* finalized) — so it is recommended to only use a small, bounded set of values
|
|
877
|
+
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
|
|
878
|
+
* @param key name of the key
|
|
879
|
+
* @param data data to associate with that key
|
|
880
|
+
*/
|
|
881
|
+
set_data(key: string, data?: any | null): void;
|
|
882
|
+
set_property(property_name: string, value: any): void;
|
|
883
|
+
/**
|
|
884
|
+
* Remove a specified datum from the object's data associations,
|
|
885
|
+
* without invoking the association's destroy handler.
|
|
886
|
+
* @param key name of the key
|
|
887
|
+
* @returns the data if found, or %NULL if no such data exists.
|
|
888
|
+
*/
|
|
889
|
+
steal_data(key: string): any | null;
|
|
890
|
+
/**
|
|
891
|
+
* This function gets back user data pointers stored via
|
|
892
|
+
* g_object_set_qdata() and removes the `data` from object
|
|
893
|
+
* without invoking its destroy() function (if any was
|
|
894
|
+
* set).
|
|
895
|
+
* Usually, calling this function is only required to update
|
|
896
|
+
* user data pointers with a destroy notifier, for example:
|
|
897
|
+
*
|
|
898
|
+
* ```c
|
|
899
|
+
* void
|
|
900
|
+
* object_add_to_user_list (GObject *object,
|
|
901
|
+
* const gchar *new_string)
|
|
902
|
+
* {
|
|
903
|
+
* // the quark, naming the object data
|
|
904
|
+
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
|
|
905
|
+
* // retrieve the old string list
|
|
906
|
+
* GList *list = g_object_steal_qdata (object, quark_string_list);
|
|
907
|
+
*
|
|
908
|
+
* // prepend new string
|
|
909
|
+
* list = g_list_prepend (list, g_strdup (new_string));
|
|
910
|
+
* // this changed 'list', so we need to set it again
|
|
911
|
+
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
|
|
912
|
+
* }
|
|
913
|
+
* static void
|
|
914
|
+
* free_string_list (gpointer data)
|
|
915
|
+
* {
|
|
916
|
+
* GList *node, *list = data;
|
|
917
|
+
*
|
|
918
|
+
* for (node = list; node; node = node->next)
|
|
919
|
+
* g_free (node->data);
|
|
920
|
+
* g_list_free (list);
|
|
921
|
+
* }
|
|
922
|
+
* ```
|
|
923
|
+
*
|
|
924
|
+
* Using g_object_get_qdata() in the above example, instead of
|
|
925
|
+
* g_object_steal_qdata() would have left the destroy function set,
|
|
926
|
+
* and thus the partial string list would have been freed upon
|
|
927
|
+
* g_object_set_qdata_full().
|
|
928
|
+
* @param quark A #GQuark, naming the user data pointer
|
|
929
|
+
* @returns The user data pointer set, or %NULL
|
|
930
|
+
*/
|
|
931
|
+
steal_qdata(quark: GLib.Quark): any | null;
|
|
932
|
+
/**
|
|
933
|
+
* Reverts the effect of a previous call to
|
|
934
|
+
* g_object_freeze_notify(). The freeze count is decreased on `object`
|
|
935
|
+
* and when it reaches zero, queued "notify" signals are emitted.
|
|
936
|
+
*
|
|
937
|
+
* Duplicate notifications for each property are squashed so that at most one
|
|
938
|
+
* #GObject::notify signal is emitted for each property, in the reverse order
|
|
939
|
+
* in which they have been queued.
|
|
940
|
+
*
|
|
941
|
+
* It is an error to call this function when the freeze count is zero.
|
|
942
|
+
*/
|
|
943
|
+
thaw_notify(): void;
|
|
944
|
+
/**
|
|
945
|
+
* Decreases the reference count of `object`. When its reference count
|
|
946
|
+
* drops to 0, the object is finalized (i.e. its memory is freed).
|
|
947
|
+
*
|
|
948
|
+
* If the pointer to the #GObject may be reused in future (for example, if it is
|
|
949
|
+
* an instance variable of another object), it is recommended to clear the
|
|
950
|
+
* pointer to %NULL rather than retain a dangling pointer to a potentially
|
|
951
|
+
* invalid #GObject instance. Use g_clear_object() for this.
|
|
952
|
+
*/
|
|
953
|
+
unref(): void;
|
|
954
|
+
/**
|
|
955
|
+
* This function essentially limits the life time of the `closure` to
|
|
956
|
+
* the life time of the object. That is, when the object is finalized,
|
|
957
|
+
* the `closure` is invalidated by calling g_closure_invalidate() on
|
|
958
|
+
* it, in order to prevent invocations of the closure with a finalized
|
|
959
|
+
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
|
|
960
|
+
* added as marshal guards to the `closure,` to ensure that an extra
|
|
961
|
+
* reference count is held on `object` during invocation of the
|
|
962
|
+
* `closure`. Usually, this function will be called on closures that
|
|
963
|
+
* use this `object` as closure data.
|
|
964
|
+
* @param closure #GClosure to watch
|
|
965
|
+
*/
|
|
966
|
+
watch_closure(closure: GObject.Closure): void;
|
|
967
|
+
vfunc_constructed(): void;
|
|
968
|
+
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
|
|
969
|
+
vfunc_dispose(): void;
|
|
970
|
+
vfunc_finalize(): void;
|
|
971
|
+
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
|
|
972
|
+
/**
|
|
973
|
+
* Emits a "notify" signal for the property `property_name` on `object`.
|
|
974
|
+
*
|
|
975
|
+
* When possible, eg. when signaling a property change from within the class
|
|
976
|
+
* that registered the property, you should use g_object_notify_by_pspec()
|
|
977
|
+
* instead.
|
|
978
|
+
*
|
|
979
|
+
* Note that emission of the notify signal may be blocked with
|
|
980
|
+
* g_object_freeze_notify(). In this case, the signal emissions are queued
|
|
981
|
+
* and will be emitted (in reverse order) when g_object_thaw_notify() is
|
|
982
|
+
* called.
|
|
983
|
+
* @param pspec
|
|
984
|
+
*/
|
|
985
|
+
vfunc_notify(pspec: GObject.ParamSpec): void;
|
|
986
|
+
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
|
|
987
|
+
disconnect(id: number): void;
|
|
988
|
+
set(properties: { [key: string]: any }): void;
|
|
989
|
+
block_signal_handler(id: number): any;
|
|
990
|
+
unblock_signal_handler(id: number): any;
|
|
991
|
+
stop_emission_by_name(detailedName: string): any;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
module Tree {
|
|
995
|
+
// Signal callback interfaces
|
|
996
|
+
|
|
997
|
+
interface Changed {
|
|
998
|
+
(): void;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
// Constructor properties interface
|
|
1002
|
+
|
|
1003
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
1004
|
+
flags: TreeFlags;
|
|
1005
|
+
menu_basename: string;
|
|
1006
|
+
menuBasename: string;
|
|
1007
|
+
menu_path: string;
|
|
1008
|
+
menuPath: string;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
class Tree extends GObject.Object {
|
|
1013
|
+
static $gtype: GObject.GType<Tree>;
|
|
1014
|
+
|
|
1015
|
+
// Own properties of CMenu.Tree
|
|
1016
|
+
|
|
1017
|
+
/**
|
|
1018
|
+
* Flags controlling the content of the menu.
|
|
1019
|
+
*/
|
|
1020
|
+
get flags(): TreeFlags;
|
|
1021
|
+
/**
|
|
1022
|
+
* The name of the menu file; must be a basename or a relative path. The file
|
|
1023
|
+
* will be looked up in $XDG_CONFIG_DIRS/menus/. See the Desktop Menu
|
|
1024
|
+
* specification.
|
|
1025
|
+
*/
|
|
1026
|
+
get menu_basename(): string;
|
|
1027
|
+
/**
|
|
1028
|
+
* The name of the menu file; must be a basename or a relative path. The file
|
|
1029
|
+
* will be looked up in $XDG_CONFIG_DIRS/menus/. See the Desktop Menu
|
|
1030
|
+
* specification.
|
|
1031
|
+
*/
|
|
1032
|
+
get menuBasename(): string;
|
|
1033
|
+
/**
|
|
1034
|
+
* The full path of the menu file. If set, GMenuTree:menu-basename will get
|
|
1035
|
+
* ignored.
|
|
1036
|
+
*/
|
|
1037
|
+
get menu_path(): string;
|
|
1038
|
+
/**
|
|
1039
|
+
* The full path of the menu file. If set, GMenuTree:menu-basename will get
|
|
1040
|
+
* ignored.
|
|
1041
|
+
*/
|
|
1042
|
+
get menuPath(): string;
|
|
1043
|
+
|
|
1044
|
+
// Constructors of CMenu.Tree
|
|
1045
|
+
|
|
1046
|
+
constructor(properties?: Partial<Tree.ConstructorProps>, ...args: any[]);
|
|
1047
|
+
|
|
1048
|
+
_init(...args: any[]): void;
|
|
1049
|
+
|
|
1050
|
+
static ['new'](menu_basename: string, flags: TreeFlags): Tree;
|
|
1051
|
+
|
|
1052
|
+
static new_for_path(menu_path: string, flags: TreeFlags): Tree;
|
|
1053
|
+
|
|
1054
|
+
// Own signals of CMenu.Tree
|
|
1055
|
+
|
|
1056
|
+
connect(id: string, callback: (...args: any[]) => any): number;
|
|
1057
|
+
connect_after(id: string, callback: (...args: any[]) => any): number;
|
|
1058
|
+
emit(id: string, ...args: any[]): void;
|
|
1059
|
+
connect(signal: 'changed', callback: (_source: this) => void): number;
|
|
1060
|
+
connect_after(signal: 'changed', callback: (_source: this) => void): number;
|
|
1061
|
+
emit(signal: 'changed'): void;
|
|
1062
|
+
|
|
1063
|
+
// Own static methods of CMenu.Tree
|
|
1064
|
+
|
|
1065
|
+
static item_ref(item?: any | null): any | null;
|
|
1066
|
+
static item_unref(item?: any | null): void;
|
|
1067
|
+
|
|
1068
|
+
// Own methods of CMenu.Tree
|
|
1069
|
+
|
|
1070
|
+
/**
|
|
1071
|
+
* This function is only available if the tree has been loaded via
|
|
1072
|
+
* gmenu_tree_load_sync() or a variant thereof.
|
|
1073
|
+
* @returns The absolute and canonicalized path to the loaded menu file
|
|
1074
|
+
*/
|
|
1075
|
+
get_canonical_menu_path(): string;
|
|
1076
|
+
get_directory_from_path(path: string): TreeDirectory;
|
|
1077
|
+
/**
|
|
1078
|
+
* Look up the entry corresponding to the given "desktop file id".
|
|
1079
|
+
* @param id a desktop file ID
|
|
1080
|
+
* @returns A newly referenced #GMenuTreeEntry, or %NULL if none
|
|
1081
|
+
*/
|
|
1082
|
+
get_entry_by_id(id: string): TreeEntry;
|
|
1083
|
+
/**
|
|
1084
|
+
* Get the root directory; you must have loaded the tree first (at
|
|
1085
|
+
* least once) via gmenu_tree_load_sync() or a variant thereof.
|
|
1086
|
+
* @returns Root of the tree
|
|
1087
|
+
*/
|
|
1088
|
+
get_root_directory(): TreeDirectory;
|
|
1089
|
+
/**
|
|
1090
|
+
* Synchronously load the menu contents. This function
|
|
1091
|
+
* performs a significant amount of blocking I/O if the
|
|
1092
|
+
* tree has not been loaded yet.
|
|
1093
|
+
* @returns %TRUE on success, %FALSE on error
|
|
1094
|
+
*/
|
|
1095
|
+
load_sync(): boolean;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
type DesktopAppInfoClass = typeof DesktopAppInfo;
|
|
1099
|
+
abstract class TreeAlias {
|
|
1100
|
+
static $gtype: GObject.GType<TreeAlias>;
|
|
1101
|
+
|
|
1102
|
+
// Constructors of CMenu.TreeAlias
|
|
1103
|
+
|
|
1104
|
+
_init(...args: any[]): void;
|
|
1105
|
+
|
|
1106
|
+
// Own methods of CMenu.TreeAlias
|
|
1107
|
+
|
|
1108
|
+
get_aliased_directory(): TreeDirectory;
|
|
1109
|
+
get_aliased_entry(): TreeEntry;
|
|
1110
|
+
get_aliased_item_type(): TreeItemType;
|
|
1111
|
+
get_directory(): TreeDirectory;
|
|
1112
|
+
get_parent(): TreeDirectory;
|
|
1113
|
+
/**
|
|
1114
|
+
* Grab the tree associated with a #GMenuTreeAlias.
|
|
1115
|
+
* @returns The #GMenuTree
|
|
1116
|
+
*/
|
|
1117
|
+
get_tree(): Tree;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
type TreeClass = typeof Tree;
|
|
1121
|
+
abstract class TreeDirectory {
|
|
1122
|
+
static $gtype: GObject.GType<TreeDirectory>;
|
|
1123
|
+
|
|
1124
|
+
// Constructors of CMenu.TreeDirectory
|
|
1125
|
+
|
|
1126
|
+
_init(...args: any[]): void;
|
|
1127
|
+
|
|
1128
|
+
// Own methods of CMenu.TreeDirectory
|
|
1129
|
+
|
|
1130
|
+
get_comment(): string;
|
|
1131
|
+
get_desktop_file_path(): string;
|
|
1132
|
+
get_generic_name(): string;
|
|
1133
|
+
/**
|
|
1134
|
+
* Gets the icon for the directory.
|
|
1135
|
+
* @returns The #GIcon for this directory
|
|
1136
|
+
*/
|
|
1137
|
+
get_icon(): Gio.Icon;
|
|
1138
|
+
get_is_nodisplay(): boolean;
|
|
1139
|
+
get_menu_id(): string;
|
|
1140
|
+
get_name(): string;
|
|
1141
|
+
get_parent(): TreeDirectory;
|
|
1142
|
+
/**
|
|
1143
|
+
* Grab the tree associated with a #GMenuTreeItem.
|
|
1144
|
+
* @returns The #GMenuTree
|
|
1145
|
+
*/
|
|
1146
|
+
get_tree(): Tree;
|
|
1147
|
+
iter(): TreeIter;
|
|
1148
|
+
make_path(entry: TreeEntry): string;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
abstract class TreeEntry {
|
|
1152
|
+
static $gtype: GObject.GType<TreeEntry>;
|
|
1153
|
+
|
|
1154
|
+
// Constructors of CMenu.TreeEntry
|
|
1155
|
+
|
|
1156
|
+
_init(...args: any[]): void;
|
|
1157
|
+
|
|
1158
|
+
// Own methods of CMenu.TreeEntry
|
|
1159
|
+
|
|
1160
|
+
get_app_info(): DesktopAppInfo;
|
|
1161
|
+
get_desktop_file_id(): string;
|
|
1162
|
+
get_desktop_file_path(): string;
|
|
1163
|
+
get_is_excluded(): boolean;
|
|
1164
|
+
get_is_flatpak(): boolean;
|
|
1165
|
+
get_is_nodisplay_recurse(): boolean;
|
|
1166
|
+
get_is_unallocated(): boolean;
|
|
1167
|
+
get_parent(): TreeDirectory;
|
|
1168
|
+
/**
|
|
1169
|
+
* Grab the tree associated with a #GMenuTreeEntry.
|
|
1170
|
+
* @returns The #GMenuTree
|
|
1171
|
+
*/
|
|
1172
|
+
get_tree(): Tree;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
abstract class TreeHeader {
|
|
1176
|
+
static $gtype: GObject.GType<TreeHeader>;
|
|
1177
|
+
|
|
1178
|
+
// Constructors of CMenu.TreeHeader
|
|
1179
|
+
|
|
1180
|
+
_init(...args: any[]): void;
|
|
1181
|
+
|
|
1182
|
+
// Own methods of CMenu.TreeHeader
|
|
1183
|
+
|
|
1184
|
+
get_directory(): TreeDirectory;
|
|
1185
|
+
get_parent(): TreeDirectory;
|
|
1186
|
+
/**
|
|
1187
|
+
* Grab the tree associated with a #GMenuTreeHeader.
|
|
1188
|
+
* @returns The #GMenuTree
|
|
1189
|
+
*/
|
|
1190
|
+
get_tree(): Tree;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
abstract class TreeIter {
|
|
1194
|
+
static $gtype: GObject.GType<TreeIter>;
|
|
1195
|
+
|
|
1196
|
+
// Constructors of CMenu.TreeIter
|
|
1197
|
+
|
|
1198
|
+
_init(...args: any[]): void;
|
|
1199
|
+
|
|
1200
|
+
// Own methods of CMenu.TreeIter
|
|
1201
|
+
|
|
1202
|
+
/**
|
|
1203
|
+
* This method may only be called if gmenu_tree_iter_next()
|
|
1204
|
+
* returned GMENU_TREE_ITEM_ALIAS.
|
|
1205
|
+
* @returns An alias
|
|
1206
|
+
*/
|
|
1207
|
+
get_alias(): TreeAlias;
|
|
1208
|
+
/**
|
|
1209
|
+
* This method may only be called if gmenu_tree_iter_next()
|
|
1210
|
+
* returned GMENU_TREE_ITEM_DIRECTORY.
|
|
1211
|
+
* @returns A directory
|
|
1212
|
+
*/
|
|
1213
|
+
get_directory(): TreeDirectory;
|
|
1214
|
+
/**
|
|
1215
|
+
* This method may only be called if gmenu_tree_iter_next()
|
|
1216
|
+
* returned GMENU_TREE_ITEM_ENTRY.
|
|
1217
|
+
* @returns An entry
|
|
1218
|
+
*/
|
|
1219
|
+
get_entry(): TreeEntry;
|
|
1220
|
+
/**
|
|
1221
|
+
* This method may only be called if gmenu_tree_iter_next()
|
|
1222
|
+
* returned GMENU_TREE_ITEM_HEADER.
|
|
1223
|
+
* @returns A header
|
|
1224
|
+
*/
|
|
1225
|
+
get_header(): TreeHeader;
|
|
1226
|
+
/**
|
|
1227
|
+
* This method may only be called if gmenu_tree_iter_next()
|
|
1228
|
+
* returned #GMENU_TREE_ITEM_SEPARATOR.
|
|
1229
|
+
* @returns A separator
|
|
1230
|
+
*/
|
|
1231
|
+
get_separator(): TreeSeparator;
|
|
1232
|
+
/**
|
|
1233
|
+
* Change the iterator to the next item, and return its type. If
|
|
1234
|
+
* there are no more items, %GMENU_TREE_ITEM_INVALID is returned.
|
|
1235
|
+
* @returns The type of the next item that can be retrived from the iterator
|
|
1236
|
+
*/
|
|
1237
|
+
next(): TreeItemType;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
abstract class TreeSeparator {
|
|
1241
|
+
static $gtype: GObject.GType<TreeSeparator>;
|
|
1242
|
+
|
|
1243
|
+
// Constructors of CMenu.TreeSeparator
|
|
1244
|
+
|
|
1245
|
+
_init(...args: any[]): void;
|
|
1246
|
+
|
|
1247
|
+
// Own methods of CMenu.TreeSeparator
|
|
1248
|
+
|
|
1249
|
+
get_parent(): TreeDirectory;
|
|
1250
|
+
/**
|
|
1251
|
+
* Grab the tree associated with a #GMenuTreeSeparator.
|
|
1252
|
+
* @returns The #GMenuTree
|
|
1253
|
+
*/
|
|
1254
|
+
get_tree(): Tree;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
/**
|
|
1258
|
+
* Name of the imported GIR library
|
|
1259
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
1260
|
+
*/
|
|
1261
|
+
const __name__: string;
|
|
1262
|
+
/**
|
|
1263
|
+
* Version of the imported GIR library
|
|
1264
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
1265
|
+
*/
|
|
1266
|
+
const __version__: string;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
export default CMenu;
|
|
1270
|
+
// END
|