1// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gio
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/glib"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16// Application Information interface, for operating system portability.
17type AppInfoIface struct {
18 _ structs.HostLayout
19
20 GIface uintptr
21
22 xDup uintptr
23
24 xEqual uintptr
25
26 xGetId uintptr
27
28 xGetName uintptr
29
30 xGetDescription uintptr
31
32 xGetExecutable uintptr
33
34 xGetIcon uintptr
35
36 xLaunch uintptr
37
38 xSupportsUris uintptr
39
40 xSupportsFiles uintptr
41
42 xLaunchUris uintptr
43
44 xShouldShow uintptr
45
46 xSetAsDefaultForType uintptr
47
48 xSetAsDefaultForExtension uintptr
49
50 xAddSupportsType uintptr
51
52 xCanRemoveSupportsType uintptr
53
54 xRemoveSupportsType uintptr
55
56 xCanDelete uintptr
57
58 xDoDelete uintptr
59
60 xGetCommandline uintptr
61
62 xGetDisplayName uintptr
63
64 xSetAsLastUsedForType uintptr
65
66 xGetSupportedTypes uintptr
67
68 xLaunchUrisAsync uintptr
69
70 xLaunchUrisFinish uintptr
71}
72
73func (x *AppInfoIface) GoPointer() uintptr {
74 return uintptr(unsafe.Pointer(x))
75}
76
77// OverrideDup sets the "dup" callback function.
78// Copies a [iface@Gio.AppInfo].
79func (x *AppInfoIface) OverrideDup(cb func(AppInfo) *AppInfoBase) {
80 if cb == nil {
81 x.xDup = 0
82 } else {
83 x.xDup = purego.NewCallback(func(AppinfoVarp uintptr) uintptr {
84 ret := cb(&AppInfoBase{Ptr: AppinfoVarp})
85 if ret == nil {
86 return 0
87 }
88 return ret.GoPointer()
89 })
90 }
91}
92
93// GetDup gets the "dup" callback function.
94// Copies a [iface@Gio.AppInfo].
95func (x *AppInfoIface) GetDup() func(AppInfo) *AppInfoBase {
96 if x.xDup == 0 {
97 return nil
98 }
99 var rawCallback func(AppinfoVarp uintptr) uintptr
100 purego.RegisterFunc(&rawCallback, x.xDup)
101 return func(AppinfoVar AppInfo) *AppInfoBase {
102 rawRet := rawCallback(AppinfoVar.GoPointer())
103 if rawRet == 0 {
104 return nil
105 }
106 ret := &AppInfoBase{}
107 ret.Ptr = rawRet
108 return ret
109 }
110}
111
112// OverrideEqual sets the "equal" callback function.
113// Checks two [iface@Gio.AppInfo]s for equality.
114func (x *AppInfoIface) OverrideEqual(cb func(AppInfo, AppInfo) bool) {
115 if cb == nil {
116 x.xEqual = 0
117 } else {
118 x.xEqual = purego.NewCallback(func(Appinfo1Varp uintptr, Appinfo2Varp uintptr) bool {
119 return cb(&AppInfoBase{Ptr: Appinfo1Varp}, &AppInfoBase{Ptr: Appinfo2Varp})
120 })
121 }
122}
123
124// GetEqual gets the "equal" callback function.
125// Checks two [iface@Gio.AppInfo]s for equality.
126func (x *AppInfoIface) GetEqual() func(AppInfo, AppInfo) bool {
127 if x.xEqual == 0 {
128 return nil
129 }
130 var rawCallback func(Appinfo1Varp uintptr, Appinfo2Varp uintptr) bool
131 purego.RegisterFunc(&rawCallback, x.xEqual)
132 return func(Appinfo1Var AppInfo, Appinfo2Var AppInfo) bool {
133 return rawCallback(Appinfo1Var.GoPointer(), Appinfo2Var.GoPointer())
134 }
135}
136
137// OverrideGetId sets the "get_id" callback function.
138// Gets a string identifier for a [iface@Gio.AppInfo].
139func (x *AppInfoIface) OverrideGetId(cb func(AppInfo) string) {
140 if cb == nil {
141 x.xGetId = 0
142 } else {
143 x.xGetId = purego.NewCallback(func(AppinfoVarp uintptr) string {
144 return cb(&AppInfoBase{Ptr: AppinfoVarp})
145 })
146 }
147}
148
149// GetGetId gets the "get_id" callback function.
150// Gets a string identifier for a [iface@Gio.AppInfo].
151func (x *AppInfoIface) GetGetId() func(AppInfo) string {
152 if x.xGetId == 0 {
153 return nil
154 }
155 var rawCallback func(AppinfoVarp uintptr) string
156 purego.RegisterFunc(&rawCallback, x.xGetId)
157 return func(AppinfoVar AppInfo) string {
158 return rawCallback(AppinfoVar.GoPointer())
159 }
160}
161
162// OverrideGetName sets the "get_name" callback function.
163// Gets the name of the application for a [iface@Gio.AppInfo].
164func (x *AppInfoIface) OverrideGetName(cb func(AppInfo) string) {
165 if cb == nil {
166 x.xGetName = 0
167 } else {
168 x.xGetName = purego.NewCallback(func(AppinfoVarp uintptr) string {
169 return cb(&AppInfoBase{Ptr: AppinfoVarp})
170 })
171 }
172}
173
174// GetGetName gets the "get_name" callback function.
175// Gets the name of the application for a [iface@Gio.AppInfo].
176func (x *AppInfoIface) GetGetName() func(AppInfo) string {
177 if x.xGetName == 0 {
178 return nil
179 }
180 var rawCallback func(AppinfoVarp uintptr) string
181 purego.RegisterFunc(&rawCallback, x.xGetName)
182 return func(AppinfoVar AppInfo) string {
183 return rawCallback(AppinfoVar.GoPointer())
184 }
185}
186
187// OverrideGetDescription sets the "get_description" callback function.
188// Gets a short description for the application described by
189//
190// the [iface@Gio.AppInfo].
191func (x *AppInfoIface) OverrideGetDescription(cb func(AppInfo) string) {
192 if cb == nil {
193 x.xGetDescription = 0
194 } else {
195 x.xGetDescription = purego.NewCallback(func(AppinfoVarp uintptr) string {
196 return cb(&AppInfoBase{Ptr: AppinfoVarp})
197 })
198 }
199}
200
201// GetGetDescription gets the "get_description" callback function.
202// Gets a short description for the application described by
203//
204// the [iface@Gio.AppInfo].
205func (x *AppInfoIface) GetGetDescription() func(AppInfo) string {
206 if x.xGetDescription == 0 {
207 return nil
208 }
209 var rawCallback func(AppinfoVarp uintptr) string
210 purego.RegisterFunc(&rawCallback, x.xGetDescription)
211 return func(AppinfoVar AppInfo) string {
212 return rawCallback(AppinfoVar.GoPointer())
213 }
214}
215
216// OverrideGetExecutable sets the "get_executable" callback function.
217// Gets the executable name for the [iface@Gio.AppInfo].
218func (x *AppInfoIface) OverrideGetExecutable(cb func(AppInfo) string) {
219 if cb == nil {
220 x.xGetExecutable = 0
221 } else {
222 x.xGetExecutable = purego.NewCallback(func(AppinfoVarp uintptr) string {
223 return cb(&AppInfoBase{Ptr: AppinfoVarp})
224 })
225 }
226}
227
228// GetGetExecutable gets the "get_executable" callback function.
229// Gets the executable name for the [iface@Gio.AppInfo].
230func (x *AppInfoIface) GetGetExecutable() func(AppInfo) string {
231 if x.xGetExecutable == 0 {
232 return nil
233 }
234 var rawCallback func(AppinfoVarp uintptr) string
235 purego.RegisterFunc(&rawCallback, x.xGetExecutable)
236 return func(AppinfoVar AppInfo) string {
237 return rawCallback(AppinfoVar.GoPointer())
238 }
239}
240
241// OverrideGetIcon sets the "get_icon" callback function.
242// Gets the [iface@Gio.Icon] for the [iface@Gio.AppInfo].
243func (x *AppInfoIface) OverrideGetIcon(cb func(AppInfo) *IconBase) {
244 if cb == nil {
245 x.xGetIcon = 0
246 } else {
247 x.xGetIcon = purego.NewCallback(func(AppinfoVarp uintptr) uintptr {
248 ret := cb(&AppInfoBase{Ptr: AppinfoVarp})
249 if ret == nil {
250 return 0
251 }
252 return ret.GoPointer()
253 })
254 }
255}
256
257// GetGetIcon gets the "get_icon" callback function.
258// Gets the [iface@Gio.Icon] for the [iface@Gio.AppInfo].
259func (x *AppInfoIface) GetGetIcon() func(AppInfo) *IconBase {
260 if x.xGetIcon == 0 {
261 return nil
262 }
263 var rawCallback func(AppinfoVarp uintptr) uintptr
264 purego.RegisterFunc(&rawCallback, x.xGetIcon)
265 return func(AppinfoVar AppInfo) *IconBase {
266 rawRet := rawCallback(AppinfoVar.GoPointer())
267 if rawRet == 0 {
268 return nil
269 }
270 ret := &IconBase{}
271 ret.Ptr = rawRet
272 return ret
273 }
274}
275
276// OverrideLaunch sets the "launch" callback function.
277// Launches an application specified by the [iface@Gio.AppInfo].
278func (x *AppInfoIface) OverrideLaunch(cb func(AppInfo, *glib.List, *AppLaunchContext) bool) {
279 if cb == nil {
280 x.xLaunch = 0
281 } else {
282 x.xLaunch = purego.NewCallback(func(AppinfoVarp uintptr, FilesVarp *glib.List, ContextVarp uintptr) bool {
283 return cb(&AppInfoBase{Ptr: AppinfoVarp}, FilesVarp, AppLaunchContextNewFromInternalPtr(ContextVarp))
284 })
285 }
286}
287
288// GetLaunch gets the "launch" callback function.
289// Launches an application specified by the [iface@Gio.AppInfo].
290func (x *AppInfoIface) GetLaunch() func(AppInfo, *glib.List, *AppLaunchContext) bool {
291 if x.xLaunch == 0 {
292 return nil
293 }
294 var rawCallback func(AppinfoVarp uintptr, FilesVarp *glib.List, ContextVarp uintptr) bool
295 purego.RegisterFunc(&rawCallback, x.xLaunch)
296 return func(AppinfoVar AppInfo, FilesVar *glib.List, ContextVar *AppLaunchContext) bool {
297 return rawCallback(AppinfoVar.GoPointer(), FilesVar, ContextVar.GoPointer())
298 }
299}
300
301// OverrideSupportsUris sets the "supports_uris" callback function.
302// Indicates whether the application specified supports
303//
304// launching URIs.
305func (x *AppInfoIface) OverrideSupportsUris(cb func(AppInfo) bool) {
306 if cb == nil {
307 x.xSupportsUris = 0
308 } else {
309 x.xSupportsUris = purego.NewCallback(func(AppinfoVarp uintptr) bool {
310 return cb(&AppInfoBase{Ptr: AppinfoVarp})
311 })
312 }
313}
314
315// GetSupportsUris gets the "supports_uris" callback function.
316// Indicates whether the application specified supports
317//
318// launching URIs.
319func (x *AppInfoIface) GetSupportsUris() func(AppInfo) bool {
320 if x.xSupportsUris == 0 {
321 return nil
322 }
323 var rawCallback func(AppinfoVarp uintptr) bool
324 purego.RegisterFunc(&rawCallback, x.xSupportsUris)
325 return func(AppinfoVar AppInfo) bool {
326 return rawCallback(AppinfoVar.GoPointer())
327 }
328}
329
330// OverrideSupportsFiles sets the "supports_files" callback function.
331// Indicates whether the application specified accepts
332//
333// filename arguments.
334func (x *AppInfoIface) OverrideSupportsFiles(cb func(AppInfo) bool) {
335 if cb == nil {
336 x.xSupportsFiles = 0
337 } else {
338 x.xSupportsFiles = purego.NewCallback(func(AppinfoVarp uintptr) bool {
339 return cb(&AppInfoBase{Ptr: AppinfoVarp})
340 })
341 }
342}
343
344// GetSupportsFiles gets the "supports_files" callback function.
345// Indicates whether the application specified accepts
346//
347// filename arguments.
348func (x *AppInfoIface) GetSupportsFiles() func(AppInfo) bool {
349 if x.xSupportsFiles == 0 {
350 return nil
351 }
352 var rawCallback func(AppinfoVarp uintptr) bool
353 purego.RegisterFunc(&rawCallback, x.xSupportsFiles)
354 return func(AppinfoVar AppInfo) bool {
355 return rawCallback(AppinfoVar.GoPointer())
356 }
357}
358
359// OverrideLaunchUris sets the "launch_uris" callback function.
360// Launches an application with a list of URIs.
361func (x *AppInfoIface) OverrideLaunchUris(cb func(AppInfo, *glib.List, *AppLaunchContext) bool) {
362 if cb == nil {
363 x.xLaunchUris = 0
364 } else {
365 x.xLaunchUris = purego.NewCallback(func(AppinfoVarp uintptr, UrisVarp *glib.List, ContextVarp uintptr) bool {
366 return cb(&AppInfoBase{Ptr: AppinfoVarp}, UrisVarp, AppLaunchContextNewFromInternalPtr(ContextVarp))
367 })
368 }
369}
370
371// GetLaunchUris gets the "launch_uris" callback function.
372// Launches an application with a list of URIs.
373func (x *AppInfoIface) GetLaunchUris() func(AppInfo, *glib.List, *AppLaunchContext) bool {
374 if x.xLaunchUris == 0 {
375 return nil
376 }
377 var rawCallback func(AppinfoVarp uintptr, UrisVarp *glib.List, ContextVarp uintptr) bool
378 purego.RegisterFunc(&rawCallback, x.xLaunchUris)
379 return func(AppinfoVar AppInfo, UrisVar *glib.List, ContextVar *AppLaunchContext) bool {
380 return rawCallback(AppinfoVar.GoPointer(), UrisVar, ContextVar.GoPointer())
381 }
382}
383
384// OverrideShouldShow sets the "should_show" callback function.
385// Returns whether an application should be shown (e.g. when
386//
387// getting a list of installed applications).
388// [FreeDesktop.Org Startup Notification Specification](http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt).
389func (x *AppInfoIface) OverrideShouldShow(cb func(AppInfo) bool) {
390 if cb == nil {
391 x.xShouldShow = 0
392 } else {
393 x.xShouldShow = purego.NewCallback(func(AppinfoVarp uintptr) bool {
394 return cb(&AppInfoBase{Ptr: AppinfoVarp})
395 })
396 }
397}
398
399// GetShouldShow gets the "should_show" callback function.
400// Returns whether an application should be shown (e.g. when
401//
402// getting a list of installed applications).
403// [FreeDesktop.Org Startup Notification Specification](http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt).
404func (x *AppInfoIface) GetShouldShow() func(AppInfo) bool {
405 if x.xShouldShow == 0 {
406 return nil
407 }
408 var rawCallback func(AppinfoVarp uintptr) bool
409 purego.RegisterFunc(&rawCallback, x.xShouldShow)
410 return func(AppinfoVar AppInfo) bool {
411 return rawCallback(AppinfoVar.GoPointer())
412 }
413}
414
415// OverrideSetAsDefaultForType sets the "set_as_default_for_type" callback function.
416// Sets an application as default for a given content
417//
418// type.
419func (x *AppInfoIface) OverrideSetAsDefaultForType(cb func(AppInfo, string) bool) {
420 if cb == nil {
421 x.xSetAsDefaultForType = 0
422 } else {
423 x.xSetAsDefaultForType = purego.NewCallback(func(AppinfoVarp uintptr, ContentTypeVarp string) bool {
424 return cb(&AppInfoBase{Ptr: AppinfoVarp}, ContentTypeVarp)
425 })
426 }
427}
428
429// GetSetAsDefaultForType gets the "set_as_default_for_type" callback function.
430// Sets an application as default for a given content
431//
432// type.
433func (x *AppInfoIface) GetSetAsDefaultForType() func(AppInfo, string) bool {
434 if x.xSetAsDefaultForType == 0 {
435 return nil
436 }
437 var rawCallback func(AppinfoVarp uintptr, ContentTypeVarp string) bool
438 purego.RegisterFunc(&rawCallback, x.xSetAsDefaultForType)
439 return func(AppinfoVar AppInfo, ContentTypeVar string) bool {
440 return rawCallback(AppinfoVar.GoPointer(), ContentTypeVar)
441 }
442}
443
444// OverrideSetAsDefaultForExtension sets the "set_as_default_for_extension" callback function.
445// Sets an application as default for a given
446//
447// file extension.
448func (x *AppInfoIface) OverrideSetAsDefaultForExtension(cb func(AppInfo, string) bool) {
449 if cb == nil {
450 x.xSetAsDefaultForExtension = 0
451 } else {
452 x.xSetAsDefaultForExtension = purego.NewCallback(func(AppinfoVarp uintptr, ExtensionVarp string) bool {
453 return cb(&AppInfoBase{Ptr: AppinfoVarp}, ExtensionVarp)
454 })
455 }
456}
457
458// GetSetAsDefaultForExtension gets the "set_as_default_for_extension" callback function.
459// Sets an application as default for a given
460//
461// file extension.
462func (x *AppInfoIface) GetSetAsDefaultForExtension() func(AppInfo, string) bool {
463 if x.xSetAsDefaultForExtension == 0 {
464 return nil
465 }
466 var rawCallback func(AppinfoVarp uintptr, ExtensionVarp string) bool
467 purego.RegisterFunc(&rawCallback, x.xSetAsDefaultForExtension)
468 return func(AppinfoVar AppInfo, ExtensionVar string) bool {
469 return rawCallback(AppinfoVar.GoPointer(), ExtensionVar)
470 }
471}
472
473// OverrideAddSupportsType sets the "add_supports_type" callback function.
474// Adds to the [iface@Gio.AppInfo] information about
475//
476// supported file types.
477func (x *AppInfoIface) OverrideAddSupportsType(cb func(AppInfo, string) bool) {
478 if cb == nil {
479 x.xAddSupportsType = 0
480 } else {
481 x.xAddSupportsType = purego.NewCallback(func(AppinfoVarp uintptr, ContentTypeVarp string) bool {
482 return cb(&AppInfoBase{Ptr: AppinfoVarp}, ContentTypeVarp)
483 })
484 }
485}
486
487// GetAddSupportsType gets the "add_supports_type" callback function.
488// Adds to the [iface@Gio.AppInfo] information about
489//
490// supported file types.
491func (x *AppInfoIface) GetAddSupportsType() func(AppInfo, string) bool {
492 if x.xAddSupportsType == 0 {
493 return nil
494 }
495 var rawCallback func(AppinfoVarp uintptr, ContentTypeVarp string) bool
496 purego.RegisterFunc(&rawCallback, x.xAddSupportsType)
497 return func(AppinfoVar AppInfo, ContentTypeVar string) bool {
498 return rawCallback(AppinfoVar.GoPointer(), ContentTypeVar)
499 }
500}
501
502// OverrideCanRemoveSupportsType sets the "can_remove_supports_type" callback function.
503// Checks for support for removing supported file
504//
505// types from a [iface@Gio.AppInfo].
506func (x *AppInfoIface) OverrideCanRemoveSupportsType(cb func(AppInfo) bool) {
507 if cb == nil {
508 x.xCanRemoveSupportsType = 0
509 } else {
510 x.xCanRemoveSupportsType = purego.NewCallback(func(AppinfoVarp uintptr) bool {
511 return cb(&AppInfoBase{Ptr: AppinfoVarp})
512 })
513 }
514}
515
516// GetCanRemoveSupportsType gets the "can_remove_supports_type" callback function.
517// Checks for support for removing supported file
518//
519// types from a [iface@Gio.AppInfo].
520func (x *AppInfoIface) GetCanRemoveSupportsType() func(AppInfo) bool {
521 if x.xCanRemoveSupportsType == 0 {
522 return nil
523 }
524 var rawCallback func(AppinfoVarp uintptr) bool
525 purego.RegisterFunc(&rawCallback, x.xCanRemoveSupportsType)
526 return func(AppinfoVar AppInfo) bool {
527 return rawCallback(AppinfoVar.GoPointer())
528 }
529}
530
531// OverrideRemoveSupportsType sets the "remove_supports_type" callback function.
532// Removes a supported application type from a
533//
534// [iface@Gio.AppInfo].
535func (x *AppInfoIface) OverrideRemoveSupportsType(cb func(AppInfo, string) bool) {
536 if cb == nil {
537 x.xRemoveSupportsType = 0
538 } else {
539 x.xRemoveSupportsType = purego.NewCallback(func(AppinfoVarp uintptr, ContentTypeVarp string) bool {
540 return cb(&AppInfoBase{Ptr: AppinfoVarp}, ContentTypeVarp)
541 })
542 }
543}
544
545// GetRemoveSupportsType gets the "remove_supports_type" callback function.
546// Removes a supported application type from a
547//
548// [iface@Gio.AppInfo].
549func (x *AppInfoIface) GetRemoveSupportsType() func(AppInfo, string) bool {
550 if x.xRemoveSupportsType == 0 {
551 return nil
552 }
553 var rawCallback func(AppinfoVarp uintptr, ContentTypeVarp string) bool
554 purego.RegisterFunc(&rawCallback, x.xRemoveSupportsType)
555 return func(AppinfoVar AppInfo, ContentTypeVar string) bool {
556 return rawCallback(AppinfoVar.GoPointer(), ContentTypeVar)
557 }
558}
559
560// OverrideCanDelete sets the "can_delete" callback function.
561// Checks if a [iface@Gio.AppInfo] can be deleted. (Since 2.20)
562func (x *AppInfoIface) OverrideCanDelete(cb func(AppInfo) bool) {
563 if cb == nil {
564 x.xCanDelete = 0
565 } else {
566 x.xCanDelete = purego.NewCallback(func(AppinfoVarp uintptr) bool {
567 return cb(&AppInfoBase{Ptr: AppinfoVarp})
568 })
569 }
570}
571
572// GetCanDelete gets the "can_delete" callback function.
573// Checks if a [iface@Gio.AppInfo] can be deleted. (Since 2.20)
574func (x *AppInfoIface) GetCanDelete() func(AppInfo) bool {
575 if x.xCanDelete == 0 {
576 return nil
577 }
578 var rawCallback func(AppinfoVarp uintptr) bool
579 purego.RegisterFunc(&rawCallback, x.xCanDelete)
580 return func(AppinfoVar AppInfo) bool {
581 return rawCallback(AppinfoVar.GoPointer())
582 }
583}
584
585// OverrideDoDelete sets the "do_delete" callback function.
586// Deletes a [iface@Gio.AppInfo]. (Since 2.20)
587func (x *AppInfoIface) OverrideDoDelete(cb func(AppInfo) bool) {
588 if cb == nil {
589 x.xDoDelete = 0
590 } else {
591 x.xDoDelete = purego.NewCallback(func(AppinfoVarp uintptr) bool {
592 return cb(&AppInfoBase{Ptr: AppinfoVarp})
593 })
594 }
595}
596
597// GetDoDelete gets the "do_delete" callback function.
598// Deletes a [iface@Gio.AppInfo]. (Since 2.20)
599func (x *AppInfoIface) GetDoDelete() func(AppInfo) bool {
600 if x.xDoDelete == 0 {
601 return nil
602 }
603 var rawCallback func(AppinfoVarp uintptr) bool
604 purego.RegisterFunc(&rawCallback, x.xDoDelete)
605 return func(AppinfoVar AppInfo) bool {
606 return rawCallback(AppinfoVar.GoPointer())
607 }
608}
609
610// OverrideGetCommandline sets the "get_commandline" callback function.
611// Gets the commandline for the [iface@Gio.AppInfo].
612//
613// (Since 2.20)
614func (x *AppInfoIface) OverrideGetCommandline(cb func(AppInfo) string) {
615 if cb == nil {
616 x.xGetCommandline = 0
617 } else {
618 x.xGetCommandline = purego.NewCallback(func(AppinfoVarp uintptr) string {
619 return cb(&AppInfoBase{Ptr: AppinfoVarp})
620 })
621 }
622}
623
624// GetGetCommandline gets the "get_commandline" callback function.
625// Gets the commandline for the [iface@Gio.AppInfo].
626//
627// (Since 2.20)
628func (x *AppInfoIface) GetGetCommandline() func(AppInfo) string {
629 if x.xGetCommandline == 0 {
630 return nil
631 }
632 var rawCallback func(AppinfoVarp uintptr) string
633 purego.RegisterFunc(&rawCallback, x.xGetCommandline)
634 return func(AppinfoVar AppInfo) string {
635 return rawCallback(AppinfoVar.GoPointer())
636 }
637}
638
639// OverrideGetDisplayName sets the "get_display_name" callback function.
640// Gets the display name for the [iface@Gio.AppInfo].
641//
642// (Since 2.24)
643func (x *AppInfoIface) OverrideGetDisplayName(cb func(AppInfo) string) {
644 if cb == nil {
645 x.xGetDisplayName = 0
646 } else {
647 x.xGetDisplayName = purego.NewCallback(func(AppinfoVarp uintptr) string {
648 return cb(&AppInfoBase{Ptr: AppinfoVarp})
649 })
650 }
651}
652
653// GetGetDisplayName gets the "get_display_name" callback function.
654// Gets the display name for the [iface@Gio.AppInfo].
655//
656// (Since 2.24)
657func (x *AppInfoIface) GetGetDisplayName() func(AppInfo) string {
658 if x.xGetDisplayName == 0 {
659 return nil
660 }
661 var rawCallback func(AppinfoVarp uintptr) string
662 purego.RegisterFunc(&rawCallback, x.xGetDisplayName)
663 return func(AppinfoVar AppInfo) string {
664 return rawCallback(AppinfoVar.GoPointer())
665 }
666}
667
668// OverrideSetAsLastUsedForType sets the "set_as_last_used_for_type" callback function.
669// Sets the application as the last used. See
670//
671// [method@Gio.AppInfo.set_as_last_used_for_type].
672func (x *AppInfoIface) OverrideSetAsLastUsedForType(cb func(AppInfo, string) bool) {
673 if cb == nil {
674 x.xSetAsLastUsedForType = 0
675 } else {
676 x.xSetAsLastUsedForType = purego.NewCallback(func(AppinfoVarp uintptr, ContentTypeVarp string) bool {
677 return cb(&AppInfoBase{Ptr: AppinfoVarp}, ContentTypeVarp)
678 })
679 }
680}
681
682// GetSetAsLastUsedForType gets the "set_as_last_used_for_type" callback function.
683// Sets the application as the last used. See
684//
685// [method@Gio.AppInfo.set_as_last_used_for_type].
686func (x *AppInfoIface) GetSetAsLastUsedForType() func(AppInfo, string) bool {
687 if x.xSetAsLastUsedForType == 0 {
688 return nil
689 }
690 var rawCallback func(AppinfoVarp uintptr, ContentTypeVarp string) bool
691 purego.RegisterFunc(&rawCallback, x.xSetAsLastUsedForType)
692 return func(AppinfoVar AppInfo, ContentTypeVar string) bool {
693 return rawCallback(AppinfoVar.GoPointer(), ContentTypeVar)
694 }
695}
696
697// OverrideGetSupportedTypes sets the "get_supported_types" callback function.
698// Retrieves the list of content types that @app_info
699//
700// claims to support.
701func (x *AppInfoIface) OverrideGetSupportedTypes(cb func(AppInfo) []string) {
702 if cb == nil {
703 x.xGetSupportedTypes = 0
704 } else {
705 x.xGetSupportedTypes = purego.NewCallback(func(AppinfoVarp uintptr) []string {
706 return cb(&AppInfoBase{Ptr: AppinfoVarp})
707 })
708 }
709}
710
711// GetGetSupportedTypes gets the "get_supported_types" callback function.
712// Retrieves the list of content types that @app_info
713//
714// claims to support.
715func (x *AppInfoIface) GetGetSupportedTypes() func(AppInfo) []string {
716 if x.xGetSupportedTypes == 0 {
717 return nil
718 }
719 var rawCallback func(AppinfoVarp uintptr) []string
720 purego.RegisterFunc(&rawCallback, x.xGetSupportedTypes)
721 return func(AppinfoVar AppInfo) []string {
722 return rawCallback(AppinfoVar.GoPointer())
723 }
724}
725
726// OverrideLaunchUrisAsync sets the "launch_uris_async" callback function.
727// Asynchronously launches an application with a list of
728//
729// URIs. (Since: 2.60)
730func (x *AppInfoIface) OverrideLaunchUrisAsync(cb func(AppInfo, *glib.List, *AppLaunchContext, *Cancellable, *AsyncReadyCallback, uintptr)) {
731 if cb == nil {
732 x.xLaunchUrisAsync = 0
733 } else {
734 x.xLaunchUrisAsync = purego.NewCallback(func(AppinfoVarp uintptr, UrisVarp *glib.List, ContextVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
735 cb(&AppInfoBase{Ptr: AppinfoVarp}, UrisVarp, AppLaunchContextNewFromInternalPtr(ContextVarp), CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
736 })
737 }
738}
739
740// GetLaunchUrisAsync gets the "launch_uris_async" callback function.
741// Asynchronously launches an application with a list of
742//
743// URIs. (Since: 2.60)
744func (x *AppInfoIface) GetLaunchUrisAsync() func(AppInfo, *glib.List, *AppLaunchContext, *Cancellable, *AsyncReadyCallback, uintptr) {
745 if x.xLaunchUrisAsync == 0 {
746 return nil
747 }
748 var rawCallback func(AppinfoVarp uintptr, UrisVarp *glib.List, ContextVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
749 purego.RegisterFunc(&rawCallback, x.xLaunchUrisAsync)
750 return func(AppinfoVar AppInfo, UrisVar *glib.List, ContextVar *AppLaunchContext, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
751 rawCallback(AppinfoVar.GoPointer(), UrisVar, ContextVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
752 }
753}
754
755// OverrideLaunchUrisFinish sets the "launch_uris_finish" callback function.
756// Finishes an operation started with @launch_uris_async.
757//
758// (Since: 2.60)
759func (x *AppInfoIface) OverrideLaunchUrisFinish(cb func(AppInfo, AsyncResult) bool) {
760 if cb == nil {
761 x.xLaunchUrisFinish = 0
762 } else {
763 x.xLaunchUrisFinish = purego.NewCallback(func(AppinfoVarp uintptr, ResultVarp uintptr) bool {
764 return cb(&AppInfoBase{Ptr: AppinfoVarp}, &AsyncResultBase{Ptr: ResultVarp})
765 })
766 }
767}
768
769// GetLaunchUrisFinish gets the "launch_uris_finish" callback function.
770// Finishes an operation started with @launch_uris_async.
771//
772// (Since: 2.60)
773func (x *AppInfoIface) GetLaunchUrisFinish() func(AppInfo, AsyncResult) bool {
774 if x.xLaunchUrisFinish == 0 {
775 return nil
776 }
777 var rawCallback func(AppinfoVarp uintptr, ResultVarp uintptr) bool
778 purego.RegisterFunc(&rawCallback, x.xLaunchUrisFinish)
779 return func(AppinfoVar AppInfo, ResultVar AsyncResult) bool {
780 return rawCallback(AppinfoVar.GoPointer(), ResultVar.GoPointer())
781 }
782}
783
784type AppLaunchContextClass struct {
785 _ structs.HostLayout
786
787 ParentClass gobject.ObjectClass
788
789 xGetDisplay uintptr
790
791 xGetStartupNotifyId uintptr
792
793 xLaunchFailed uintptr
794
795 xLaunched uintptr
796
797 xLaunchStarted uintptr
798
799 xGReserved1 uintptr
800
801 xGReserved2 uintptr
802
803 xGReserved3 uintptr
804}
805
806func (x *AppLaunchContextClass) GoPointer() uintptr {
807 return uintptr(unsafe.Pointer(x))
808}
809
810// OverrideGetDisplay sets the "get_display" callback function.
811func (x *AppLaunchContextClass) OverrideGetDisplay(cb func(*AppLaunchContext, AppInfo, *glib.List) string) {
812 if cb == nil {
813 x.xGetDisplay = 0
814 } else {
815 x.xGetDisplay = purego.NewCallback(func(ContextVarp uintptr, InfoVarp uintptr, FilesVarp *glib.List) string {
816 return cb(AppLaunchContextNewFromInternalPtr(ContextVarp), &AppInfoBase{Ptr: InfoVarp}, FilesVarp)
817 })
818 }
819}
820
821// GetGetDisplay gets the "get_display" callback function.
822func (x *AppLaunchContextClass) GetGetDisplay() func(*AppLaunchContext, AppInfo, *glib.List) string {
823 if x.xGetDisplay == 0 {
824 return nil
825 }
826 var rawCallback func(ContextVarp uintptr, InfoVarp uintptr, FilesVarp *glib.List) string
827 purego.RegisterFunc(&rawCallback, x.xGetDisplay)
828 return func(ContextVar *AppLaunchContext, InfoVar AppInfo, FilesVar *glib.List) string {
829 return rawCallback(ContextVar.GoPointer(), InfoVar.GoPointer(), FilesVar)
830 }
831}
832
833// OverrideGetStartupNotifyId sets the "get_startup_notify_id" callback function.
834func (x *AppLaunchContextClass) OverrideGetStartupNotifyId(cb func(*AppLaunchContext, AppInfo, *glib.List) string) {
835 if cb == nil {
836 x.xGetStartupNotifyId = 0
837 } else {
838 x.xGetStartupNotifyId = purego.NewCallback(func(ContextVarp uintptr, InfoVarp uintptr, FilesVarp *glib.List) string {
839 return cb(AppLaunchContextNewFromInternalPtr(ContextVarp), &AppInfoBase{Ptr: InfoVarp}, FilesVarp)
840 })
841 }
842}
843
844// GetGetStartupNotifyId gets the "get_startup_notify_id" callback function.
845func (x *AppLaunchContextClass) GetGetStartupNotifyId() func(*AppLaunchContext, AppInfo, *glib.List) string {
846 if x.xGetStartupNotifyId == 0 {
847 return nil
848 }
849 var rawCallback func(ContextVarp uintptr, InfoVarp uintptr, FilesVarp *glib.List) string
850 purego.RegisterFunc(&rawCallback, x.xGetStartupNotifyId)
851 return func(ContextVar *AppLaunchContext, InfoVar AppInfo, FilesVar *glib.List) string {
852 return rawCallback(ContextVar.GoPointer(), InfoVar.GoPointer(), FilesVar)
853 }
854}
855
856// OverrideLaunchFailed sets the "launch_failed" callback function.
857func (x *AppLaunchContextClass) OverrideLaunchFailed(cb func(*AppLaunchContext, string)) {
858 if cb == nil {
859 x.xLaunchFailed = 0
860 } else {
861 x.xLaunchFailed = purego.NewCallback(func(ContextVarp uintptr, StartupNotifyIdVarp string) {
862 cb(AppLaunchContextNewFromInternalPtr(ContextVarp), StartupNotifyIdVarp)
863 })
864 }
865}
866
867// GetLaunchFailed gets the "launch_failed" callback function.
868func (x *AppLaunchContextClass) GetLaunchFailed() func(*AppLaunchContext, string) {
869 if x.xLaunchFailed == 0 {
870 return nil
871 }
872 var rawCallback func(ContextVarp uintptr, StartupNotifyIdVarp string)
873 purego.RegisterFunc(&rawCallback, x.xLaunchFailed)
874 return func(ContextVar *AppLaunchContext, StartupNotifyIdVar string) {
875 rawCallback(ContextVar.GoPointer(), StartupNotifyIdVar)
876 }
877}
878
879// OverrideLaunched sets the "launched" callback function.
880func (x *AppLaunchContextClass) OverrideLaunched(cb func(*AppLaunchContext, AppInfo, *glib.Variant)) {
881 if cb == nil {
882 x.xLaunched = 0
883 } else {
884 x.xLaunched = purego.NewCallback(func(ContextVarp uintptr, InfoVarp uintptr, PlatformDataVarp *glib.Variant) {
885 cb(AppLaunchContextNewFromInternalPtr(ContextVarp), &AppInfoBase{Ptr: InfoVarp}, PlatformDataVarp)
886 })
887 }
888}
889
890// GetLaunched gets the "launched" callback function.
891func (x *AppLaunchContextClass) GetLaunched() func(*AppLaunchContext, AppInfo, *glib.Variant) {
892 if x.xLaunched == 0 {
893 return nil
894 }
895 var rawCallback func(ContextVarp uintptr, InfoVarp uintptr, PlatformDataVarp *glib.Variant)
896 purego.RegisterFunc(&rawCallback, x.xLaunched)
897 return func(ContextVar *AppLaunchContext, InfoVar AppInfo, PlatformDataVar *glib.Variant) {
898 rawCallback(ContextVar.GoPointer(), InfoVar.GoPointer(), PlatformDataVar)
899 }
900}
901
902// OverrideLaunchStarted sets the "launch_started" callback function.
903func (x *AppLaunchContextClass) OverrideLaunchStarted(cb func(*AppLaunchContext, AppInfo, *glib.Variant)) {
904 if cb == nil {
905 x.xLaunchStarted = 0
906 } else {
907 x.xLaunchStarted = purego.NewCallback(func(ContextVarp uintptr, InfoVarp uintptr, PlatformDataVarp *glib.Variant) {
908 cb(AppLaunchContextNewFromInternalPtr(ContextVarp), &AppInfoBase{Ptr: InfoVarp}, PlatformDataVarp)
909 })
910 }
911}
912
913// GetLaunchStarted gets the "launch_started" callback function.
914func (x *AppLaunchContextClass) GetLaunchStarted() func(*AppLaunchContext, AppInfo, *glib.Variant) {
915 if x.xLaunchStarted == 0 {
916 return nil
917 }
918 var rawCallback func(ContextVarp uintptr, InfoVarp uintptr, PlatformDataVarp *glib.Variant)
919 purego.RegisterFunc(&rawCallback, x.xLaunchStarted)
920 return func(ContextVar *AppLaunchContext, InfoVar AppInfo, PlatformDataVar *glib.Variant) {
921 rawCallback(ContextVar.GoPointer(), InfoVar.GoPointer(), PlatformDataVar)
922 }
923}
924
925// OverrideGReserved1 sets the "_g_reserved1" callback function.
926func (x *AppLaunchContextClass) OverrideGReserved1(cb func()) {
927 if cb == nil {
928 x.xGReserved1 = 0
929 } else {
930 x.xGReserved1 = purego.NewCallback(func() {
931 cb()
932 })
933 }
934}
935
936// GetGReserved1 gets the "_g_reserved1" callback function.
937func (x *AppLaunchContextClass) GetGReserved1() func() {
938 if x.xGReserved1 == 0 {
939 return nil
940 }
941 var rawCallback func()
942 purego.RegisterFunc(&rawCallback, x.xGReserved1)
943 return func() {
944 rawCallback()
945 }
946}
947
948// OverrideGReserved2 sets the "_g_reserved2" callback function.
949func (x *AppLaunchContextClass) OverrideGReserved2(cb func()) {
950 if cb == nil {
951 x.xGReserved2 = 0
952 } else {
953 x.xGReserved2 = purego.NewCallback(func() {
954 cb()
955 })
956 }
957}
958
959// GetGReserved2 gets the "_g_reserved2" callback function.
960func (x *AppLaunchContextClass) GetGReserved2() func() {
961 if x.xGReserved2 == 0 {
962 return nil
963 }
964 var rawCallback func()
965 purego.RegisterFunc(&rawCallback, x.xGReserved2)
966 return func() {
967 rawCallback()
968 }
969}
970
971// OverrideGReserved3 sets the "_g_reserved3" callback function.
972func (x *AppLaunchContextClass) OverrideGReserved3(cb func()) {
973 if cb == nil {
974 x.xGReserved3 = 0
975 } else {
976 x.xGReserved3 = purego.NewCallback(func() {
977 cb()
978 })
979 }
980}
981
982// GetGReserved3 gets the "_g_reserved3" callback function.
983func (x *AppLaunchContextClass) GetGReserved3() func() {
984 if x.xGReserved3 == 0 {
985 return nil
986 }
987 var rawCallback func()
988 purego.RegisterFunc(&rawCallback, x.xGReserved3)
989 return func() {
990 rawCallback()
991 }
992}
993
994type AppLaunchContextPrivate struct {
995 _ structs.HostLayout
996}
997
998func (x *AppLaunchContextPrivate) GoPointer() uintptr {
999 return uintptr(unsafe.Pointer(x))
1000}
1001
1002// Information about an installed application and methods to launch
1003// it (with file arguments).
1004//
1005// `GAppInfo` and `GAppLaunchContext` are used for describing and launching
1006// applications installed on the system.
1007//
1008// As of GLib 2.20, URIs will always be converted to POSIX paths
1009// (using [method@Gio.File.get_path]) when using [method@Gio.AppInfo.launch]
1010// even if the application requested an URI and not a POSIX path. For example
1011// for a desktop-file based application with the following Exec key:
1012//
1013// ```
1014// Exec=totem %U
1015// ```
1016//
1017// and a single URI, `sftp://foo/file.avi`, then
1018// `/home/user/.gvfs/sftp on foo/file.avi` will be passed. This will only work
1019// if a set of suitable GIO extensions (such as GVfs 2.26 compiled with FUSE
1020// support), is available and operational; if this is not the case, the URI
1021// will be passed unmodified to the application. Some URIs, such as `mailto:`,
1022// of course cannot be mapped to a POSIX path (in GVfs there’s no FUSE mount
1023// for it); such URIs will be passed unmodified to the application.
1024//
1025// Specifically for GVfs 2.26 and later, the POSIX URI will be mapped
1026// back to the GIO URI in the [iface@Gio.File] constructors (since GVfs
1027// implements the GVfs extension point). As such, if the application
1028// needs to examine the URI, it needs to use [method@Gio.File.get_uri]
1029// or similar on [iface@Gio.File]. In other words, an application cannot
1030// assume that the URI passed to e.g. [func@Gio.File.new_for_commandline_arg]
1031// is equal to the result of [method@Gio.File.get_uri]. The following snippet
1032// illustrates this:
1033//
1034// ```c
1035// GFile *f;
1036// char *uri;
1037//
1038// file = g_file_new_for_commandline_arg (uri_from_commandline);
1039//
1040// uri = g_file_get_uri (file);
1041// strcmp (uri, uri_from_commandline) == 0;
1042// g_free (uri);
1043//
1044// if (g_file_has_uri_scheme (file, "cdda"))
1045//
1046// {
1047// // do something special with uri
1048// }
1049//
1050// g_object_unref (file);
1051// ```
1052//
1053// This code will work when both `cdda://sr0/Track 1.wav` and
1054// `/home/user/.gvfs/cdda on sr0/Track 1.wav` is passed to the
1055// application. It should be noted that it’s generally not safe
1056// for applications to rely on the format of a particular URIs.
1057// Different launcher applications (e.g. file managers) may have
1058// different ideas of what a given URI means.
1059type AppInfo interface {
1060 GoPointer() uintptr
1061 SetGoPointer(uintptr)
1062 AddSupportsType(ContentTypeVar string) (bool, error)
1063 CanDelete() bool
1064 CanRemoveSupportsType() bool
1065 Delete() bool
1066 Dup() *AppInfoBase
1067 Equal(Appinfo2Var AppInfo) bool
1068 GetCommandline() string
1069 GetDescription() string
1070 GetDisplayName() string
1071 GetExecutable() string
1072 GetIcon() *IconBase
1073 GetId() string
1074 GetName() string
1075 GetSupportedTypes() []string
1076 Launch(FilesVar *glib.List, ContextVar *AppLaunchContext) (bool, error)
1077 LaunchUris(UrisVar *glib.List, ContextVar *AppLaunchContext) (bool, error)
1078 LaunchUrisAsync(UrisVar *glib.List, ContextVar *AppLaunchContext, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr)
1079 LaunchUrisFinish(ResultVar AsyncResult) (bool, error)
1080 RemoveSupportsType(ContentTypeVar string) (bool, error)
1081 SetAsDefaultForExtension(ExtensionVar string) (bool, error)
1082 SetAsDefaultForType(ContentTypeVar string) (bool, error)
1083 SetAsLastUsedForType(ContentTypeVar string) (bool, error)
1084 ShouldShow() bool
1085 SupportsFiles() bool
1086 SupportsUris() bool
1087}
1088
1089var xAppInfoGLibType func() types.GType
1090
1091func AppInfoGLibType() types.GType {
1092 return xAppInfoGLibType()
1093}
1094
1095type AppInfoBase struct {
1096 Ptr uintptr
1097}
1098
1099func (x *AppInfoBase) GoPointer() uintptr {
1100 if x == nil {
1101 return 0
1102 }
1103 return x.Ptr
1104}
1105
1106func (x *AppInfoBase) SetGoPointer(ptr uintptr) {
1107 x.Ptr = ptr
1108}
1109
1110// Adds a content type to the application information to indicate the
1111// application is capable of opening files with the given content type.
1112func (x *AppInfoBase) AddSupportsType(ContentTypeVar string) (bool, error) {
1113 var cerr *glib.Error
1114
1115 cret := XGAppInfoAddSupportsType(x.GoPointer(), ContentTypeVar, &cerr)
1116 if cerr == nil {
1117 return cret, nil
1118 }
1119 return cret, cerr
1120
1121}
1122
1123// Obtains the information whether the [iface@Gio.AppInfo] can be deleted.
1124// See [method@Gio.AppInfo.delete].
1125func (x *AppInfoBase) CanDelete() bool {
1126
1127 cret := XGAppInfoCanDelete(x.GoPointer())
1128 return cret
1129}
1130
1131// Checks if a supported content type can be removed from an application.
1132func (x *AppInfoBase) CanRemoveSupportsType() bool {
1133
1134 cret := XGAppInfoCanRemoveSupportsType(x.GoPointer())
1135 return cret
1136}
1137
1138// Tries to delete a [iface@Gio.AppInfo].
1139//
1140// On some platforms, there may be a difference between user-defined
1141// [iface@Gio.AppInfo]s which can be deleted, and system-wide ones which cannot.
1142// See [method@Gio.AppInfo.can_delete].
1143func (x *AppInfoBase) Delete() bool {
1144
1145 cret := XGAppInfoDelete(x.GoPointer())
1146 return cret
1147}
1148
1149// Creates a duplicate of a [iface@Gio.AppInfo].
1150func (x *AppInfoBase) Dup() *AppInfoBase {
1151 var cls *AppInfoBase
1152
1153 cret := XGAppInfoDup(x.GoPointer())
1154
1155 if cret == 0 {
1156 return nil
1157 }
1158 cls = &AppInfoBase{}
1159 cls.Ptr = cret
1160 return cls
1161}
1162
1163// Checks if two [iface@Gio.AppInfo]s are equal.
1164//
1165// Note that the check *may not* compare each individual field, and only does
1166// an identity check. In case detecting changes in the contents is needed,
1167// program code must additionally compare relevant fields.
1168func (x *AppInfoBase) Equal(Appinfo2Var AppInfo) bool {
1169
1170 cret := XGAppInfoEqual(x.GoPointer(), Appinfo2Var.GoPointer())
1171 return cret
1172}
1173
1174// Gets the commandline with which the application will be
1175// started.
1176func (x *AppInfoBase) GetCommandline() string {
1177
1178 cret := XGAppInfoGetCommandline(x.GoPointer())
1179 return cret
1180}
1181
1182// Gets a human-readable description of an installed application.
1183func (x *AppInfoBase) GetDescription() string {
1184
1185 cret := XGAppInfoGetDescription(x.GoPointer())
1186 return cret
1187}
1188
1189// Gets the display name of the application. The display name is often more
1190// descriptive to the user than the name itself.
1191func (x *AppInfoBase) GetDisplayName() string {
1192
1193 cret := XGAppInfoGetDisplayName(x.GoPointer())
1194 return cret
1195}
1196
1197// Gets the executable’s name for the installed application.
1198//
1199// This is intended to be used for debugging or labelling what program is going
1200// to be run. To launch the executable, use [method@Gio.AppInfo.launch] and related
1201// functions, rather than spawning the return value from this function.
1202func (x *AppInfoBase) GetExecutable() string {
1203
1204 cret := XGAppInfoGetExecutable(x.GoPointer())
1205 return cret
1206}
1207
1208// Gets the icon for the application.
1209func (x *AppInfoBase) GetIcon() *IconBase {
1210 var cls *IconBase
1211
1212 cret := XGAppInfoGetIcon(x.GoPointer())
1213
1214 if cret == 0 {
1215 return nil
1216 }
1217 gobject.IncreaseRef(cret)
1218 cls = &IconBase{}
1219 cls.Ptr = cret
1220 return cls
1221}
1222
1223// Gets the ID of an application. An id is a string that identifies the
1224// application. The exact format of the id is platform dependent. For instance,
1225// on Unix this is the desktop file id from the xdg menu specification.
1226//
1227// Note that the returned ID may be `NULL`, depending on how the @appinfo has
1228// been constructed.
1229func (x *AppInfoBase) GetId() string {
1230
1231 cret := XGAppInfoGetId(x.GoPointer())
1232 return cret
1233}
1234
1235// Gets the installed name of the application.
1236func (x *AppInfoBase) GetName() string {
1237
1238 cret := XGAppInfoGetName(x.GoPointer())
1239 return cret
1240}
1241
1242// Retrieves the list of content types that @app_info claims to support.
1243// If this information is not provided by the environment, this function
1244// will return `NULL`.
1245//
1246// This function does not take in consideration associations added with
1247// [method@Gio.AppInfo.add_supports_type], but only those exported directly by
1248// the application.
1249func (x *AppInfoBase) GetSupportedTypes() []string {
1250
1251 cret := XGAppInfoGetSupportedTypes(x.GoPointer())
1252 return cret
1253}
1254
1255// Launches the application. Passes @files to the launched application
1256// as arguments, using the optional @context to get information
1257// about the details of the launcher (like what screen it is on).
1258// On error, @error will be set accordingly.
1259//
1260// To launch the application without arguments pass a `NULL` @files list.
1261//
1262// Note that even if the launch is successful the application launched
1263// can fail to start if it runs into problems during startup. There is
1264// no way to detect this.
1265//
1266// Some URIs can be changed when passed through a GFile (for instance
1267// unsupported URIs with strange formats like mailto:), so if you have
1268// a textual URI you want to pass in as argument, consider using
1269// [method@Gio.AppInfo.launch_uris] instead.
1270//
1271// The launched application inherits the environment of the launching
1272// process, but it can be modified with [method@Gio.AppLaunchContext.setenv]
1273// and [method@Gio.AppLaunchContext.unsetenv].
1274//
1275// On UNIX, this function sets the `GIO_LAUNCHED_DESKTOP_FILE`
1276// environment variable with the path of the launched desktop file and
1277// `GIO_LAUNCHED_DESKTOP_FILE_PID` to the process id of the launched
1278// process. This can be used to ignore `GIO_LAUNCHED_DESKTOP_FILE`,
1279// should it be inherited by further processes. The `DISPLAY`,
1280// `XDG_ACTIVATION_TOKEN` and `DESKTOP_STARTUP_ID` environment
1281// variables are also set, based on information provided in @context.
1282func (x *AppInfoBase) Launch(FilesVar *glib.List, ContextVar *AppLaunchContext) (bool, error) {
1283 var cerr *glib.Error
1284
1285 cret := XGAppInfoLaunch(x.GoPointer(), FilesVar, ContextVar.GoPointer(), &cerr)
1286 if cerr == nil {
1287 return cret, nil
1288 }
1289 return cret, cerr
1290
1291}
1292
1293// Launches the application. This passes the @uris to the launched application
1294// as arguments, using the optional @context to get information
1295// about the details of the launcher (like what screen it is on).
1296// On error, @error will be set accordingly. If the application only supports
1297// one URI per invocation as part of their command-line, multiple instances
1298// of the application will be spawned.
1299//
1300// To launch the application without arguments pass a `NULL` @uris list.
1301//
1302// Note that even if the launch is successful the application launched
1303// can fail to start if it runs into problems during startup. There is
1304// no way to detect this.
1305func (x *AppInfoBase) LaunchUris(UrisVar *glib.List, ContextVar *AppLaunchContext) (bool, error) {
1306 var cerr *glib.Error
1307
1308 cret := XGAppInfoLaunchUris(x.GoPointer(), UrisVar, ContextVar.GoPointer(), &cerr)
1309 if cerr == nil {
1310 return cret, nil
1311 }
1312 return cret, cerr
1313
1314}
1315
1316// Async version of [method@Gio.AppInfo.launch_uris].
1317//
1318// The @callback is invoked immediately after the application launch, but it
1319// waits for activation in case of D-Bus–activated applications and also provides
1320// extended error information for sandboxed applications, see notes for
1321// [func@Gio.AppInfo.launch_default_for_uri_async].
1322func (x *AppInfoBase) LaunchUrisAsync(UrisVar *glib.List, ContextVar *AppLaunchContext, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
1323
1324 XGAppInfoLaunchUrisAsync(x.GoPointer(), UrisVar, ContextVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
1325
1326}
1327
1328// Finishes a [method@Gio.AppInfo.launch_uris_async] operation.
1329func (x *AppInfoBase) LaunchUrisFinish(ResultVar AsyncResult) (bool, error) {
1330 var cerr *glib.Error
1331
1332 cret := XGAppInfoLaunchUrisFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
1333 if cerr == nil {
1334 return cret, nil
1335 }
1336 return cret, cerr
1337
1338}
1339
1340// Removes a supported type from an application, if possible.
1341func (x *AppInfoBase) RemoveSupportsType(ContentTypeVar string) (bool, error) {
1342 var cerr *glib.Error
1343
1344 cret := XGAppInfoRemoveSupportsType(x.GoPointer(), ContentTypeVar, &cerr)
1345 if cerr == nil {
1346 return cret, nil
1347 }
1348 return cret, cerr
1349
1350}
1351
1352// Sets the application as the default handler for the given file extension.
1353func (x *AppInfoBase) SetAsDefaultForExtension(ExtensionVar string) (bool, error) {
1354 var cerr *glib.Error
1355
1356 cret := XGAppInfoSetAsDefaultForExtension(x.GoPointer(), ExtensionVar, &cerr)
1357 if cerr == nil {
1358 return cret, nil
1359 }
1360 return cret, cerr
1361
1362}
1363
1364// Sets the application as the default handler for a given type.
1365func (x *AppInfoBase) SetAsDefaultForType(ContentTypeVar string) (bool, error) {
1366 var cerr *glib.Error
1367
1368 cret := XGAppInfoSetAsDefaultForType(x.GoPointer(), ContentTypeVar, &cerr)
1369 if cerr == nil {
1370 return cret, nil
1371 }
1372 return cret, cerr
1373
1374}
1375
1376// Sets the application as the last used application for a given type. This
1377// will make the application appear as first in the list returned by
1378// [func@Gio.AppInfo.get_recommended_for_type], regardless of the default
1379// application for that content type.
1380func (x *AppInfoBase) SetAsLastUsedForType(ContentTypeVar string) (bool, error) {
1381 var cerr *glib.Error
1382
1383 cret := XGAppInfoSetAsLastUsedForType(x.GoPointer(), ContentTypeVar, &cerr)
1384 if cerr == nil {
1385 return cret, nil
1386 }
1387 return cret, cerr
1388
1389}
1390
1391// Checks if the application info should be shown in menus that
1392// list available applications.
1393func (x *AppInfoBase) ShouldShow() bool {
1394
1395 cret := XGAppInfoShouldShow(x.GoPointer())
1396 return cret
1397}
1398
1399// Checks if the application accepts files as arguments.
1400func (x *AppInfoBase) SupportsFiles() bool {
1401
1402 cret := XGAppInfoSupportsFiles(x.GoPointer())
1403 return cret
1404}
1405
1406// Checks if the application supports reading files and directories from URIs.
1407func (x *AppInfoBase) SupportsUris() bool {
1408
1409 cret := XGAppInfoSupportsUris(x.GoPointer())
1410 return cret
1411}
1412
1413var XGAppInfoAddSupportsType func(uintptr, string, **glib.Error) bool
1414var XGAppInfoCanDelete func(uintptr) bool
1415var XGAppInfoCanRemoveSupportsType func(uintptr) bool
1416var XGAppInfoDelete func(uintptr) bool
1417var XGAppInfoDup func(uintptr) uintptr
1418var XGAppInfoEqual func(uintptr, uintptr) bool
1419var XGAppInfoGetCommandline func(uintptr) string
1420var XGAppInfoGetDescription func(uintptr) string
1421var XGAppInfoGetDisplayName func(uintptr) string
1422var XGAppInfoGetExecutable func(uintptr) string
1423var XGAppInfoGetIcon func(uintptr) uintptr
1424var XGAppInfoGetId func(uintptr) string
1425var XGAppInfoGetName func(uintptr) string
1426var XGAppInfoGetSupportedTypes func(uintptr) []string
1427var XGAppInfoLaunch func(uintptr, *glib.List, uintptr, **glib.Error) bool
1428var XGAppInfoLaunchUris func(uintptr, *glib.List, uintptr, **glib.Error) bool
1429var XGAppInfoLaunchUrisAsync func(uintptr, *glib.List, uintptr, uintptr, uintptr, uintptr)
1430var XGAppInfoLaunchUrisFinish func(uintptr, uintptr, **glib.Error) bool
1431var XGAppInfoRemoveSupportsType func(uintptr, string, **glib.Error) bool
1432var XGAppInfoSetAsDefaultForExtension func(uintptr, string, **glib.Error) bool
1433var XGAppInfoSetAsDefaultForType func(uintptr, string, **glib.Error) bool
1434var XGAppInfoSetAsLastUsedForType func(uintptr, string, **glib.Error) bool
1435var XGAppInfoShouldShow func(uintptr) bool
1436var XGAppInfoSupportsFiles func(uintptr) bool
1437var XGAppInfoSupportsUris func(uintptr) bool
1438
1439var xAppInfoCreateFromCommandline func(string, uintptr, AppInfoCreateFlags, **glib.Error) uintptr
1440
1441// Creates a new [iface@Gio.AppInfo] from the given information.
1442//
1443// Note that for @commandline, the quoting rules of the `Exec` key of the
1444// [freedesktop.org Desktop Entry Specification](http://freedesktop.org/Standards/desktop-entry-spec)
1445// are applied. For example, if the @commandline contains
1446// percent-encoded URIs, the percent-character must be doubled in order to prevent it from
1447// being swallowed by `Exec` key unquoting. See
1448// [the specification](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s07.html)
1449// for exact quoting rules.
1450func AppInfoCreateFromCommandline(CommandlineVar string, ApplicationNameVar *string, FlagsVar AppInfoCreateFlags) (*AppInfoBase, error) {
1451 var cls *AppInfoBase
1452 var cerr *glib.Error
1453
1454 ApplicationNameVarPtr := core.GStrdupNullable(ApplicationNameVar)
1455 defer core.GFreeNullable(ApplicationNameVarPtr)
1456
1457 cret := xAppInfoCreateFromCommandline(CommandlineVar, ApplicationNameVarPtr, FlagsVar, &cerr)
1458
1459 if cret == 0 {
1460 return nil, cerr
1461 }
1462 cls = &AppInfoBase{}
1463 cls.Ptr = cret
1464 if cerr == nil {
1465 return cls, nil
1466 }
1467 return cls, cerr
1468
1469}
1470
1471var xAppInfoGetAll func() *glib.List
1472
1473// Gets a list of all of the applications currently registered
1474// on this system.
1475//
1476// For desktop files, this includes applications that have
1477// [`NoDisplay=true`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-nodisplay)
1478// set or are excluded from display by means of
1479// [`OnlyShowIn`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-onlyshowin)
1480// or [`NotShowIn`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-notshowin).
1481// See [method@Gio.AppInfo.should_show].
1482//
1483// The returned list does not include applications which have the
1484// [`Hidden` key](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-hidden)
1485// set.
1486func AppInfoGetAll() *glib.List {
1487
1488 cret := xAppInfoGetAll()
1489 return cret
1490}
1491
1492var xAppInfoGetAllForType func(string) *glib.List
1493
1494// Gets a list of all [iface@Gio.AppInfo]s for a given content type,
1495// including the recommended and fallback [iface@Gio.AppInfo]s. See
1496// [func@Gio.AppInfo.get_recommended_for_type] and
1497// [func@Gio.AppInfo.get_fallback_for_type].
1498func AppInfoGetAllForType(ContentTypeVar string) *glib.List {
1499
1500 cret := xAppInfoGetAllForType(ContentTypeVar)
1501 return cret
1502}
1503
1504var xAppInfoGetDefaultForType func(string, bool) uintptr
1505
1506// Gets the default [iface@Gio.AppInfo] for a given content type.
1507func AppInfoGetDefaultForType(ContentTypeVar string, MustSupportUrisVar bool) *AppInfoBase {
1508 var cls *AppInfoBase
1509
1510 cret := xAppInfoGetDefaultForType(ContentTypeVar, MustSupportUrisVar)
1511
1512 if cret == 0 {
1513 return nil
1514 }
1515 cls = &AppInfoBase{}
1516 cls.Ptr = cret
1517 return cls
1518}
1519
1520var xAppInfoGetDefaultForTypeAsync func(string, bool, uintptr, uintptr, uintptr)
1521
1522// Asynchronously gets the default [iface@Gio.AppInfo] for a given content
1523// type.
1524func AppInfoGetDefaultForTypeAsync(ContentTypeVar string, MustSupportUrisVar bool, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
1525
1526 var CallbackVarRef uintptr
1527 if CallbackVar != nil {
1528 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
1529 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
1530 CallbackVarRef = cbRefPtr
1531 } else {
1532 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
1533 cbFn := *CallbackVar
1534 cbFn(arg0, arg1, arg2)
1535 }
1536 CallbackVarRef = purego.NewCallback(fcb)
1537 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
1538 }
1539 }
1540
1541 xAppInfoGetDefaultForTypeAsync(ContentTypeVar, MustSupportUrisVar, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
1542
1543}
1544
1545var xAppInfoGetDefaultForTypeFinish func(uintptr, **glib.Error) uintptr
1546
1547// Finishes a default [iface@Gio.AppInfo] lookup started by
1548// [func@Gio.AppInfo.get_default_for_type_async].
1549//
1550// If no #[iface@Gio.AppInfo] is found, then @error will be set to
1551// [error@Gio.IOErrorEnum.NOT_FOUND].
1552func AppInfoGetDefaultForTypeFinish(ResultVar AsyncResult) (*AppInfoBase, error) {
1553 var cls *AppInfoBase
1554 var cerr *glib.Error
1555
1556 cret := xAppInfoGetDefaultForTypeFinish(ResultVar.GoPointer(), &cerr)
1557
1558 if cret == 0 {
1559 return nil, cerr
1560 }
1561 cls = &AppInfoBase{}
1562 cls.Ptr = cret
1563 if cerr == nil {
1564 return cls, nil
1565 }
1566 return cls, cerr
1567
1568}
1569
1570var xAppInfoGetDefaultForUriScheme func(string) uintptr
1571
1572// Gets the default application for handling URIs with the given URI scheme.
1573//
1574// A URI scheme is the initial part of the URI, up to but not including the `:`.
1575// For example, `http`, `ftp` or `sip`.
1576func AppInfoGetDefaultForUriScheme(UriSchemeVar string) *AppInfoBase {
1577 var cls *AppInfoBase
1578
1579 cret := xAppInfoGetDefaultForUriScheme(UriSchemeVar)
1580
1581 if cret == 0 {
1582 return nil
1583 }
1584 cls = &AppInfoBase{}
1585 cls.Ptr = cret
1586 return cls
1587}
1588
1589var xAppInfoGetDefaultForUriSchemeAsync func(string, uintptr, uintptr, uintptr)
1590
1591// Asynchronously gets the default application for handling URIs with
1592// the given URI scheme. A URI scheme is the initial part
1593// of the URI, up to but not including the `:`, e.g. `http`,
1594// `ftp` or `sip`.
1595func AppInfoGetDefaultForUriSchemeAsync(UriSchemeVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
1596
1597 var CallbackVarRef uintptr
1598 if CallbackVar != nil {
1599 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
1600 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
1601 CallbackVarRef = cbRefPtr
1602 } else {
1603 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
1604 cbFn := *CallbackVar
1605 cbFn(arg0, arg1, arg2)
1606 }
1607 CallbackVarRef = purego.NewCallback(fcb)
1608 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
1609 }
1610 }
1611
1612 xAppInfoGetDefaultForUriSchemeAsync(UriSchemeVar, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
1613
1614}
1615
1616var xAppInfoGetDefaultForUriSchemeFinish func(uintptr, **glib.Error) uintptr
1617
1618// Finishes a default [iface@Gio.AppInfo] lookup started by
1619// [func@Gio.AppInfo.get_default_for_uri_scheme_async].
1620//
1621// If no [iface@Gio.AppInfo] is found, then @error will be set to
1622// [error@Gio.IOErrorEnum.NOT_FOUND].
1623func AppInfoGetDefaultForUriSchemeFinish(ResultVar AsyncResult) (*AppInfoBase, error) {
1624 var cls *AppInfoBase
1625 var cerr *glib.Error
1626
1627 cret := xAppInfoGetDefaultForUriSchemeFinish(ResultVar.GoPointer(), &cerr)
1628
1629 if cret == 0 {
1630 return nil, cerr
1631 }
1632 cls = &AppInfoBase{}
1633 cls.Ptr = cret
1634 if cerr == nil {
1635 return cls, nil
1636 }
1637 return cls, cerr
1638
1639}
1640
1641var xAppInfoGetFallbackForType func(string) *glib.List
1642
1643// Gets a list of fallback [iface@Gio.AppInfo]s for a given content type, i.e.
1644// those applications which claim to support the given content type by MIME
1645// type subclassing and not directly.
1646func AppInfoGetFallbackForType(ContentTypeVar string) *glib.List {
1647
1648 cret := xAppInfoGetFallbackForType(ContentTypeVar)
1649 return cret
1650}
1651
1652var xAppInfoGetRecommendedForType func(string) *glib.List
1653
1654// Gets a list of recommended [iface@Gio.AppInfo]s for a given content type,
1655// i.e. those applications which claim to support the given content type
1656// exactly, and not by MIME type subclassing.
1657//
1658// Note that the first application of the list is the last used one, i.e.
1659// the last one for which [method@Gio.AppInfo.set_as_last_used_for_type] has
1660// been called.
1661func AppInfoGetRecommendedForType(ContentTypeVar string) *glib.List {
1662
1663 cret := xAppInfoGetRecommendedForType(ContentTypeVar)
1664 return cret
1665}
1666
1667var xAppInfoLaunchDefaultForUri func(string, uintptr, **glib.Error) bool
1668
1669// Utility function that launches the default application registered to handle
1670// the specified uri. Synchronous I/O is done on the uri to detect the type of
1671// the file if required.
1672//
1673// The D-Bus–activated applications don’t have to be started if your application
1674// terminates too soon after this function. To prevent this, use
1675// [func@Gio.AppInfo.launch_default_for_uri_async] instead.
1676func AppInfoLaunchDefaultForUri(UriVar string, ContextVar *AppLaunchContext) (bool, error) {
1677 var cerr *glib.Error
1678
1679 cret := xAppInfoLaunchDefaultForUri(UriVar, ContextVar.GoPointer(), &cerr)
1680 if cerr == nil {
1681 return cret, nil
1682 }
1683 return cret, cerr
1684
1685}
1686
1687var xAppInfoLaunchDefaultForUriAsync func(string, uintptr, uintptr, uintptr, uintptr)
1688
1689// Async version of [func@Gio.AppInfo.launch_default_for_uri].
1690//
1691// This version is useful if you are interested in receiving error information
1692// in the case where the application is sandboxed and the portal may present an
1693// application chooser dialog to the user.
1694//
1695// This is also useful if you want to be sure that the D-Bus–activated
1696// applications are really started before termination and if you are interested
1697// in receiving error information from their activation.
1698func AppInfoLaunchDefaultForUriAsync(UriVar string, ContextVar *AppLaunchContext, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
1699
1700 var CallbackVarRef uintptr
1701 if CallbackVar != nil {
1702 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
1703 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
1704 CallbackVarRef = cbRefPtr
1705 } else {
1706 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
1707 cbFn := *CallbackVar
1708 cbFn(arg0, arg1, arg2)
1709 }
1710 CallbackVarRef = purego.NewCallback(fcb)
1711 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
1712 }
1713 }
1714
1715 xAppInfoLaunchDefaultForUriAsync(UriVar, ContextVar.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
1716
1717}
1718
1719var xAppInfoLaunchDefaultForUriFinish func(uintptr, **glib.Error) bool
1720
1721// Finishes an asynchronous launch-default-for-uri operation.
1722func AppInfoLaunchDefaultForUriFinish(ResultVar AsyncResult) (bool, error) {
1723 var cerr *glib.Error
1724
1725 cret := xAppInfoLaunchDefaultForUriFinish(ResultVar.GoPointer(), &cerr)
1726 if cerr == nil {
1727 return cret, nil
1728 }
1729 return cret, cerr
1730
1731}
1732
1733var xAppInfoResetTypeAssociations func(string)
1734
1735// Removes all changes to the type associations done by
1736// [method@Gio.AppInfo.set_as_default_for_type],
1737// [method@Gio.AppInfo.set_as_default_for_extension],
1738// [method@Gio.AppInfo.add_supports_type] or
1739// [method@Gio.AppInfo.remove_supports_type].
1740func AppInfoResetTypeAssociations(ContentTypeVar string) {
1741
1742 xAppInfoResetTypeAssociations(ContentTypeVar)
1743
1744}
1745
1746// `GAppInfoMonitor` monitors application information for changes.
1747//
1748// `GAppInfoMonitor` is a very simple object used for monitoring the app
1749// info database for changes (newly installed or removed applications).
1750//
1751// Call [func@Gio.AppInfoMonitor.get] to get a `GAppInfoMonitor` and connect
1752// to the [signal@Gio.AppInfoMonitor::changed] signal. The signal will be emitted once when
1753// the app info database changes, and will not be emitted again until after the
1754// next call to [func@Gio.AppInfo.get_all] or another `g_app_info_*()` function.
1755// This is because monitoring the app info database for changes is expensive.
1756//
1757// The following functions will re-arm the [signal@Gio.AppInfoMonitor::changed]
1758// signal so it can be emitted again:
1759//
1760// - [func@Gio.AppInfo.get_all]
1761// - [func@Gio.AppInfo.get_all_for_type]
1762// - [func@Gio.AppInfo.get_default_for_type]
1763// - [func@Gio.AppInfo.get_fallback_for_type]
1764// - [func@Gio.AppInfo.get_recommended_for_type]
1765// - [`g_desktop_app_info_get_implementations()`](../gio-unix/type_func.DesktopAppInfo.get_implementation.html)
1766// - [`g_desktop_app_info_new()`](../gio-unix/ctor.DesktopAppInfo.new.html)
1767// - [`g_desktop_app_info_new_from_filename()`](../gio-unix/ctor.DesktopAppInfo.new_from_filename.html)
1768// - [`g_desktop_app_info_new_from_keyfile()`](../gio-unix/ctor.DesktopAppInfo.new_from_keyfile.html)
1769// - [`g_desktop_app_info_search()`](../gio-unix/type_func.DesktopAppInfo.search.html)
1770//
1771// The latter functions are available if using
1772// [`GDesktopAppInfo`](../gio-unix/class.DesktopAppInfo.html) from
1773// `gio-unix-2.0.pc` (GIR namespace `GioUnix-2.0`).
1774//
1775// In the usual case, applications should try to make note of the change
1776// (doing things like invalidating caches) but not act on it. In
1777// particular, applications should avoid making calls to `GAppInfo` APIs
1778// in response to the change signal, deferring these until the time that
1779// the updated data is actually required. The exception to this case is when
1780// application information is actually being displayed on the screen
1781// (for example, during a search or when the list of all applications is shown).
1782// The reason for this is that changes to the list of installed applications
1783// often come in groups (like during system updates) and rescanning the list
1784// on every change is pointless and expensive.
1785type AppInfoMonitor struct {
1786 gobject.Object
1787}
1788
1789var xAppInfoMonitorGLibType func() types.GType
1790
1791func AppInfoMonitorGLibType() types.GType {
1792 return xAppInfoMonitorGLibType()
1793}
1794
1795func AppInfoMonitorNewFromInternalPtr(ptr uintptr) *AppInfoMonitor {
1796 cls := &AppInfoMonitor{}
1797 cls.Ptr = ptr
1798 return cls
1799}
1800
1801func (c *AppInfoMonitor) GoPointer() uintptr {
1802 if c == nil {
1803 return 0
1804 }
1805 return c.Ptr
1806}
1807
1808func (c *AppInfoMonitor) SetGoPointer(ptr uintptr) {
1809 c.Ptr = ptr
1810}
1811
1812// Signal emitted when the app info database changes, when applications are
1813// installed or removed.
1814func (x *AppInfoMonitor) ConnectChanged(cb *func(AppInfoMonitor)) uint {
1815 cbPtr := uintptr(unsafe.Pointer(cb))
1816 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1817 handlerID := gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr)
1818 glib.SaveHandlerMapping(handlerID, cbPtr)
1819 return handlerID
1820 }
1821
1822 fcb := func(clsPtr uintptr) {
1823 fa := AppInfoMonitor{}
1824 fa.Ptr = clsPtr
1825 cbFn := *cb
1826
1827 cbFn(fa)
1828
1829 }
1830 cbRefPtr := purego.NewCallback(fcb)
1831 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1832 handlerID := gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr)
1833 glib.SaveHandlerMapping(handlerID, cbPtr)
1834 return handlerID
1835}
1836
1837var xAppInfoMonitorGet func() uintptr
1838
1839// Gets the #GAppInfoMonitor for the current thread-default main
1840// context.
1841//
1842// The #GAppInfoMonitor will emit a “changed” signal in the
1843// thread-default main context whenever the list of installed
1844// applications (as reported by g_app_info_get_all()) may have changed.
1845//
1846// The #GAppInfoMonitor::changed signal will only be emitted once until
1847// g_app_info_get_all() (or another `g_app_info_*()` function) is called. Doing
1848// so will re-arm the signal ready to notify about the next change.
1849//
1850// You must only call g_object_unref() on the return value from under
1851// the same main context as you created it.
1852func AppInfoMonitorGet() *AppInfoMonitor {
1853 var cls *AppInfoMonitor
1854
1855 cret := xAppInfoMonitorGet()
1856
1857 if cret == 0 {
1858 return nil
1859 }
1860 cls = &AppInfoMonitor{}
1861 cls.Ptr = cret
1862 return cls
1863}
1864
1865// Integrating the launch with the launching application. This is used to
1866// handle for instance startup notification and launching the new application
1867// on the same screen as the launching window.
1868type AppLaunchContext struct {
1869 gobject.Object
1870}
1871
1872var xAppLaunchContextGLibType func() types.GType
1873
1874func AppLaunchContextGLibType() types.GType {
1875 return xAppLaunchContextGLibType()
1876}
1877
1878func AppLaunchContextNewFromInternalPtr(ptr uintptr) *AppLaunchContext {
1879 cls := &AppLaunchContext{}
1880 cls.Ptr = ptr
1881 return cls
1882}
1883
1884var xNewAppLaunchContext func() uintptr
1885
1886// Creates a new application launch context. This is not normally used,
1887// instead you instantiate a subclass of this, such as
1888// [`GdkAppLaunchContext`](https://docs.gtk.org/gdk4/class.AppLaunchContext.html).
1889func NewAppLaunchContext() *AppLaunchContext {
1890 var cls *AppLaunchContext
1891
1892 cret := xNewAppLaunchContext()
1893
1894 if cret == 0 {
1895 return nil
1896 }
1897 cls = &AppLaunchContext{}
1898 cls.Ptr = cret
1899 return cls
1900}
1901
1902var xAppLaunchContextGetDisplay func(uintptr, uintptr, *glib.List) string
1903
1904// Gets the display string for the @context. This is used to ensure new
1905// applications are started on the same display as the launching
1906// application, by setting the `DISPLAY` environment variable.
1907func (x *AppLaunchContext) GetDisplay(InfoVar AppInfo, FilesVar *glib.List) string {
1908
1909 cret := xAppLaunchContextGetDisplay(x.GoPointer(), InfoVar.GoPointer(), FilesVar)
1910 return cret
1911}
1912
1913var xAppLaunchContextGetEnvironment func(uintptr) []string
1914
1915// Gets the complete environment variable list to be passed to
1916// the child process when @context is used to launch an application.
1917// This is a `NULL`-terminated array of strings, where each string has
1918// the form `KEY=VALUE`.
1919func (x *AppLaunchContext) GetEnvironment() []string {
1920
1921 cret := xAppLaunchContextGetEnvironment(x.GoPointer())
1922 return cret
1923}
1924
1925var xAppLaunchContextGetStartupNotifyId func(uintptr, uintptr, *glib.List) string
1926
1927// Initiates startup notification for the application and returns the
1928// `XDG_ACTIVATION_TOKEN` or `DESKTOP_STARTUP_ID` for the launched operation,
1929// if supported.
1930//
1931// The returned token may be referred to equivalently as an ‘activation token’
1932// (using Wayland terminology) or a ‘startup sequence ID’ (using X11 terminology).
1933// The two [are interoperable](https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/x11-interoperation.rst).
1934//
1935// Activation tokens are defined in the [XDG Activation Protocol](https://wayland.app/protocols/xdg-activation-v1),
1936// and startup notification IDs are defined in the
1937// [freedesktop.org Startup Notification Protocol](http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt).
1938//
1939// Support for the XDG Activation Protocol was added in GLib 2.76.
1940// Since GLib 2.82 @info and @files can be `NULL`. If that’s not supported by the backend,
1941// the returned token will be `NULL`.
1942func (x *AppLaunchContext) GetStartupNotifyId(InfoVar AppInfo, FilesVar *glib.List) string {
1943
1944 cret := xAppLaunchContextGetStartupNotifyId(x.GoPointer(), InfoVar.GoPointer(), FilesVar)
1945 return cret
1946}
1947
1948var xAppLaunchContextLaunchFailed func(uintptr, string)
1949
1950// Called when an application has failed to launch, so that it can cancel
1951// the application startup notification started in
1952// [method@Gio.AppLaunchContext.get_startup_notify_id].
1953func (x *AppLaunchContext) LaunchFailed(StartupNotifyIdVar string) {
1954
1955 xAppLaunchContextLaunchFailed(x.GoPointer(), StartupNotifyIdVar)
1956
1957}
1958
1959var xAppLaunchContextSetenv func(uintptr, string, string)
1960
1961// Arranges for @variable to be set to @value in the child’s environment when
1962// @context is used to launch an application.
1963func (x *AppLaunchContext) Setenv(VariableVar string, ValueVar string) {
1964
1965 xAppLaunchContextSetenv(x.GoPointer(), VariableVar, ValueVar)
1966
1967}
1968
1969var xAppLaunchContextUnsetenv func(uintptr, string)
1970
1971// Arranges for @variable to be unset in the child’s environment when @context
1972// is used to launch an application.
1973func (x *AppLaunchContext) Unsetenv(VariableVar string) {
1974
1975 xAppLaunchContextUnsetenv(x.GoPointer(), VariableVar)
1976
1977}
1978
1979func (c *AppLaunchContext) GoPointer() uintptr {
1980 if c == nil {
1981 return 0
1982 }
1983 return c.Ptr
1984}
1985
1986func (c *AppLaunchContext) SetGoPointer(ptr uintptr) {
1987 c.Ptr = ptr
1988}
1989
1990// The [signal@Gio.AppLaunchContext::launch-failed] signal is emitted when a
1991// [iface@Gio.AppInfo] launch fails. The startup notification id is provided,
1992// so that the launcher can cancel the startup notification.
1993//
1994// Because a launch operation may involve spawning multiple instances of the
1995// target application, you should expect this signal to be emitted multiple
1996// times, one for each spawned instance.
1997func (x *AppLaunchContext) ConnectLaunchFailed(cb *func(AppLaunchContext, string)) uint {
1998 cbPtr := uintptr(unsafe.Pointer(cb))
1999 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
2000 handlerID := gobject.SignalConnect(x.GoPointer(), "launch-failed", cbRefPtr)
2001 glib.SaveHandlerMapping(handlerID, cbPtr)
2002 return handlerID
2003 }
2004
2005 fcb := func(clsPtr uintptr, StartupNotifyIdVarp uintptr) {
2006 fa := AppLaunchContext{}
2007 fa.Ptr = clsPtr
2008 cbFn := *cb
2009
2010 cbFn(fa, core.GoString(StartupNotifyIdVarp))
2011
2012 }
2013 cbRefPtr := purego.NewCallback(fcb)
2014 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
2015 handlerID := gobject.SignalConnect(x.GoPointer(), "launch-failed", cbRefPtr)
2016 glib.SaveHandlerMapping(handlerID, cbPtr)
2017 return handlerID
2018}
2019
2020// The [signal@Gio.AppLaunchContext::launch-started] signal is emitted when a
2021// [iface@Gio.AppInfo] is about to be launched. If non-null the
2022// @platform_data is an GVariant dictionary mapping strings to variants
2023// (ie `a{sv}`), which contains additional, platform-specific data about this
2024// launch. On UNIX, at least the `startup-notification-id` keys will be
2025// present.
2026//
2027// The value of the `startup-notification-id` key (type `s`) is a startup
2028// notification ID corresponding to the format from the [startup-notification
2029// specification](https://specifications.freedesktop.org/startup-notification-spec/startup-notification-0.1.txt).
2030// It allows tracking the progress of the launchee through startup.
2031//
2032// It is guaranteed that this signal is followed by either a
2033// [signal@Gio.AppLaunchContext::launched] or
2034// [signal@Gio.AppLaunchContext::launch-failed] signal.
2035//
2036// Because a launch operation may involve spawning multiple instances of the
2037// target application, you should expect this signal to be emitted multiple
2038// times, one for each spawned instance.
2039func (x *AppLaunchContext) ConnectLaunchStarted(cb *func(AppLaunchContext, uintptr, uintptr)) uint {
2040 cbPtr := uintptr(unsafe.Pointer(cb))
2041 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
2042 handlerID := gobject.SignalConnect(x.GoPointer(), "launch-started", cbRefPtr)
2043 glib.SaveHandlerMapping(handlerID, cbPtr)
2044 return handlerID
2045 }
2046
2047 fcb := func(clsPtr uintptr, InfoVarp uintptr, PlatformDataVarp uintptr) {
2048 fa := AppLaunchContext{}
2049 fa.Ptr = clsPtr
2050 cbFn := *cb
2051
2052 cbFn(fa, InfoVarp, PlatformDataVarp)
2053
2054 }
2055 cbRefPtr := purego.NewCallback(fcb)
2056 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
2057 handlerID := gobject.SignalConnect(x.GoPointer(), "launch-started", cbRefPtr)
2058 glib.SaveHandlerMapping(handlerID, cbPtr)
2059 return handlerID
2060}
2061
2062// The [signal@Gio.AppLaunchContext::launched] signal is emitted when a
2063// [iface@Gio.AppInfo] is successfully launched.
2064//
2065// Because a launch operation may involve spawning multiple instances of the
2066// target application, you should expect this signal to be emitted multiple
2067// times, one time for each spawned instance.
2068//
2069// The @platform_data is an GVariant dictionary mapping
2070// strings to variants (ie `a{sv}`), which contains additional,
2071// platform-specific data about this launch. On UNIX, at least the
2072// `pid` and `startup-notification-id` keys will be present.
2073//
2074// Since 2.72 the `pid` may be 0 if the process id wasn’t known (for
2075// example if the process was launched via D-Bus). The `pid` may not be
2076// set at all in subsequent releases.
2077//
2078// On Windows, `pid` is guaranteed to be valid only for the duration of the
2079// [signal@Gio.AppLaunchContext::launched] signal emission; after the signal
2080// is emitted, GLib will call [func@GLib.spawn_close_pid]. If you need to
2081// keep the [alias@GLib.Pid] after the signal has been emitted, then you can
2082// duplicate `pid` using `DuplicateHandle()`.
2083func (x *AppLaunchContext) ConnectLaunched(cb *func(AppLaunchContext, uintptr, uintptr)) uint {
2084 cbPtr := uintptr(unsafe.Pointer(cb))
2085 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
2086 handlerID := gobject.SignalConnect(x.GoPointer(), "launched", cbRefPtr)
2087 glib.SaveHandlerMapping(handlerID, cbPtr)
2088 return handlerID
2089 }
2090
2091 fcb := func(clsPtr uintptr, InfoVarp uintptr, PlatformDataVarp uintptr) {
2092 fa := AppLaunchContext{}
2093 fa.Ptr = clsPtr
2094 cbFn := *cb
2095
2096 cbFn(fa, InfoVarp, PlatformDataVarp)
2097
2098 }
2099 cbRefPtr := purego.NewCallback(fcb)
2100 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
2101 handlerID := gobject.SignalConnect(x.GoPointer(), "launched", cbRefPtr)
2102 glib.SaveHandlerMapping(handlerID, cbPtr)
2103 return handlerID
2104}
2105
2106func init() {
2107 core.SetPackageName("GIO", "gio-2.0")
2108 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
2109 var libs []uintptr
2110 for _, libPath := range core.GetPaths("GIO") {
2111 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
2112 if err != nil {
2113 panic(err)
2114 }
2115 libs = append(libs, lib)
2116 }
2117
2118 core.PuregoSafeRegister(&xAppInfoCreateFromCommandline, libs, "g_app_info_create_from_commandline")
2119 core.PuregoSafeRegister(&xAppInfoGetAll, libs, "g_app_info_get_all")
2120 core.PuregoSafeRegister(&xAppInfoGetAllForType, libs, "g_app_info_get_all_for_type")
2121 core.PuregoSafeRegister(&xAppInfoGetDefaultForType, libs, "g_app_info_get_default_for_type")
2122 core.PuregoSafeRegister(&xAppInfoGetDefaultForTypeAsync, libs, "g_app_info_get_default_for_type_async")
2123 core.PuregoSafeRegister(&xAppInfoGetDefaultForTypeFinish, libs, "g_app_info_get_default_for_type_finish")
2124 core.PuregoSafeRegister(&xAppInfoGetDefaultForUriScheme, libs, "g_app_info_get_default_for_uri_scheme")
2125 core.PuregoSafeRegister(&xAppInfoGetDefaultForUriSchemeAsync, libs, "g_app_info_get_default_for_uri_scheme_async")
2126 core.PuregoSafeRegister(&xAppInfoGetDefaultForUriSchemeFinish, libs, "g_app_info_get_default_for_uri_scheme_finish")
2127 core.PuregoSafeRegister(&xAppInfoGetFallbackForType, libs, "g_app_info_get_fallback_for_type")
2128 core.PuregoSafeRegister(&xAppInfoGetRecommendedForType, libs, "g_app_info_get_recommended_for_type")
2129 core.PuregoSafeRegister(&xAppInfoLaunchDefaultForUri, libs, "g_app_info_launch_default_for_uri")
2130 core.PuregoSafeRegister(&xAppInfoLaunchDefaultForUriAsync, libs, "g_app_info_launch_default_for_uri_async")
2131 core.PuregoSafeRegister(&xAppInfoLaunchDefaultForUriFinish, libs, "g_app_info_launch_default_for_uri_finish")
2132 core.PuregoSafeRegister(&xAppInfoResetTypeAssociations, libs, "g_app_info_reset_type_associations")
2133
2134 core.PuregoSafeRegister(&xAppInfoMonitorGLibType, libs, "g_app_info_monitor_get_type")
2135
2136 core.PuregoSafeRegister(&xAppInfoMonitorGet, libs, "g_app_info_monitor_get")
2137
2138 core.PuregoSafeRegister(&xAppLaunchContextGLibType, libs, "g_app_launch_context_get_type")
2139
2140 core.PuregoSafeRegister(&xNewAppLaunchContext, libs, "g_app_launch_context_new")
2141
2142 core.PuregoSafeRegister(&xAppLaunchContextGetDisplay, libs, "g_app_launch_context_get_display")
2143 core.PuregoSafeRegister(&xAppLaunchContextGetEnvironment, libs, "g_app_launch_context_get_environment")
2144 core.PuregoSafeRegister(&xAppLaunchContextGetStartupNotifyId, libs, "g_app_launch_context_get_startup_notify_id")
2145 core.PuregoSafeRegister(&xAppLaunchContextLaunchFailed, libs, "g_app_launch_context_launch_failed")
2146 core.PuregoSafeRegister(&xAppLaunchContextSetenv, libs, "g_app_launch_context_setenv")
2147 core.PuregoSafeRegister(&xAppLaunchContextUnsetenv, libs, "g_app_launch_context_unsetenv")
2148
2149 core.PuregoSafeRegister(&xAppInfoGLibType, libs, "g_app_info_get_type")
2150
2151 core.PuregoSafeRegister(&XGAppInfoAddSupportsType, libs, "g_app_info_add_supports_type")
2152 core.PuregoSafeRegister(&XGAppInfoCanDelete, libs, "g_app_info_can_delete")
2153 core.PuregoSafeRegister(&XGAppInfoCanRemoveSupportsType, libs, "g_app_info_can_remove_supports_type")
2154 core.PuregoSafeRegister(&XGAppInfoDelete, libs, "g_app_info_delete")
2155 core.PuregoSafeRegister(&XGAppInfoDup, libs, "g_app_info_dup")
2156 core.PuregoSafeRegister(&XGAppInfoEqual, libs, "g_app_info_equal")
2157 core.PuregoSafeRegister(&XGAppInfoGetCommandline, libs, "g_app_info_get_commandline")
2158 core.PuregoSafeRegister(&XGAppInfoGetDescription, libs, "g_app_info_get_description")
2159 core.PuregoSafeRegister(&XGAppInfoGetDisplayName, libs, "g_app_info_get_display_name")
2160 core.PuregoSafeRegister(&XGAppInfoGetExecutable, libs, "g_app_info_get_executable")
2161 core.PuregoSafeRegister(&XGAppInfoGetIcon, libs, "g_app_info_get_icon")
2162 core.PuregoSafeRegister(&XGAppInfoGetId, libs, "g_app_info_get_id")
2163 core.PuregoSafeRegister(&XGAppInfoGetName, libs, "g_app_info_get_name")
2164 core.PuregoSafeRegister(&XGAppInfoGetSupportedTypes, libs, "g_app_info_get_supported_types")
2165 core.PuregoSafeRegister(&XGAppInfoLaunch, libs, "g_app_info_launch")
2166 core.PuregoSafeRegister(&XGAppInfoLaunchUris, libs, "g_app_info_launch_uris")
2167 core.PuregoSafeRegister(&XGAppInfoLaunchUrisAsync, libs, "g_app_info_launch_uris_async")
2168 core.PuregoSafeRegister(&XGAppInfoLaunchUrisFinish, libs, "g_app_info_launch_uris_finish")
2169 core.PuregoSafeRegister(&XGAppInfoRemoveSupportsType, libs, "g_app_info_remove_supports_type")
2170 core.PuregoSafeRegister(&XGAppInfoSetAsDefaultForExtension, libs, "g_app_info_set_as_default_for_extension")
2171 core.PuregoSafeRegister(&XGAppInfoSetAsDefaultForType, libs, "g_app_info_set_as_default_for_type")
2172 core.PuregoSafeRegister(&XGAppInfoSetAsLastUsedForType, libs, "g_app_info_set_as_last_used_for_type")
2173 core.PuregoSafeRegister(&XGAppInfoShouldShow, libs, "g_app_info_should_show")
2174 core.PuregoSafeRegister(&XGAppInfoSupportsFiles, libs, "g_app_info_supports_files")
2175 core.PuregoSafeRegister(&XGAppInfoSupportsUris, libs, "g_app_info_supports_uris")
2176
2177}