1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
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/gio"
12 "github.com/bnema/puregotk/v4/glib"
13 "github.com/bnema/puregotk/v4/gobject"
14 "github.com/bnema/puregotk/v4/gobject/types"
15)
16
17// Meta-data to be passed to gtk_recent_manager_add_full() when
18// registering a recently used resource.
19type RecentData struct {
20 _ structs.HostLayout
21
22 DisplayName uintptr
23
24 Description uintptr
25
26 MimeType uintptr
27
28 AppName uintptr
29
30 AppExec uintptr
31
32 Groups []string
33
34 IsPrivate bool
35}
36
37func (x *RecentData) GoPointer() uintptr {
38 return uintptr(unsafe.Pointer(x))
39}
40
41// Contains the metadata associated with an item in the
42// recently used files list.
43type RecentInfo struct {
44 _ structs.HostLayout
45}
46
47var xRecentInfoGLibType func() types.GType
48
49func RecentInfoGLibType() types.GType {
50 return xRecentInfoGLibType()
51}
52
53func (x *RecentInfo) GoPointer() uintptr {
54 return uintptr(unsafe.Pointer(x))
55}
56
57var xRecentInfoCreateAppInfo func(uintptr, uintptr, **glib.Error) uintptr
58
59// Creates a `GAppInfo` for the specified `GtkRecentInfo`
60//
61// In case of error, @error will be set either with a
62// %GTK_RECENT_MANAGER_ERROR or a %G_IO_ERROR
63func (x *RecentInfo) CreateAppInfo(AppNameVar *string) (*gio.AppInfoBase, error) {
64 var cls *gio.AppInfoBase
65 var cerr *glib.Error
66
67 AppNameVarPtr := core.GStrdupNullable(AppNameVar)
68 defer core.GFreeNullable(AppNameVarPtr)
69
70 cret := xRecentInfoCreateAppInfo(x.GoPointer(), AppNameVarPtr, &cerr)
71
72 if cret == 0 {
73 return nil, cerr
74 }
75 cls = &gio.AppInfoBase{}
76 cls.Ptr = cret
77 if cerr == nil {
78 return cls, nil
79 }
80 return cls, cerr
81
82}
83
84var xRecentInfoExists func(uintptr) bool
85
86// Checks whether the resource pointed by @info still exists.
87// At the moment this check is done only on resources pointing
88// to local files.
89func (x *RecentInfo) Exists() bool {
90
91 cret := xRecentInfoExists(x.GoPointer())
92 return cret
93}
94
95var xRecentInfoGetAdded func(uintptr) *glib.DateTime
96
97// Gets the time when the resource
98// was added to the recently used resources list.
99func (x *RecentInfo) GetAdded() *glib.DateTime {
100
101 cret := xRecentInfoGetAdded(x.GoPointer())
102 return cret
103}
104
105var xRecentInfoGetAge func(uintptr) int
106
107// Gets the number of days elapsed since the last update
108// of the resource pointed by @info.
109func (x *RecentInfo) GetAge() int {
110
111 cret := xRecentInfoGetAge(x.GoPointer())
112 return cret
113}
114
115var xRecentInfoGetApplicationInfo func(uintptr, string, *string, *uint, **glib.DateTime) bool
116
117// Gets the data regarding the application that has registered the resource
118// pointed by @info.
119//
120// If the command line contains any escape characters defined inside the
121// storage specification, they will be expanded.
122func (x *RecentInfo) GetApplicationInfo(AppNameVar string, AppExecVar *string, CountVar *uint, StampVar **glib.DateTime) bool {
123
124 cret := xRecentInfoGetApplicationInfo(x.GoPointer(), AppNameVar, AppExecVar, CountVar, StampVar)
125 return cret
126}
127
128var xRecentInfoGetApplications func(uintptr, *uint) []string
129
130// Retrieves the list of applications that have registered this resource.
131func (x *RecentInfo) GetApplications(LengthVar *uint) []string {
132
133 cret := xRecentInfoGetApplications(x.GoPointer(), LengthVar)
134 return cret
135}
136
137var xRecentInfoGetDescription func(uintptr) string
138
139// Gets the (short) description of the resource.
140func (x *RecentInfo) GetDescription() string {
141
142 cret := xRecentInfoGetDescription(x.GoPointer())
143 return cret
144}
145
146var xRecentInfoGetDisplayName func(uintptr) string
147
148// Gets the name of the resource.
149//
150// If none has been defined, the basename
151// of the resource is obtained.
152func (x *RecentInfo) GetDisplayName() string {
153
154 cret := xRecentInfoGetDisplayName(x.GoPointer())
155 return cret
156}
157
158var xRecentInfoGetGicon func(uintptr) uintptr
159
160// Retrieves the icon associated to the resource MIME type.
161func (x *RecentInfo) GetGicon() *gio.IconBase {
162 var cls *gio.IconBase
163
164 cret := xRecentInfoGetGicon(x.GoPointer())
165
166 if cret == 0 {
167 return nil
168 }
169 cls = &gio.IconBase{}
170 cls.Ptr = cret
171 return cls
172}
173
174var xRecentInfoGetGroups func(uintptr, *uint) []string
175
176// Returns all groups registered for the recently used item @info.
177//
178// The array of returned group names will be %NULL terminated, so
179// length might optionally be %NULL.
180func (x *RecentInfo) GetGroups(LengthVar *uint) []string {
181
182 cret := xRecentInfoGetGroups(x.GoPointer(), LengthVar)
183 return cret
184}
185
186var xRecentInfoGetMimeType func(uintptr) string
187
188// Gets the MIME type of the resource.
189func (x *RecentInfo) GetMimeType() string {
190
191 cret := xRecentInfoGetMimeType(x.GoPointer())
192 return cret
193}
194
195var xRecentInfoGetModified func(uintptr) *glib.DateTime
196
197// Gets the time when the meta-data
198// for the resource was last modified.
199func (x *RecentInfo) GetModified() *glib.DateTime {
200
201 cret := xRecentInfoGetModified(x.GoPointer())
202 return cret
203}
204
205var xRecentInfoGetPrivateHint func(uintptr) bool
206
207// Gets the value of the “private” flag.
208//
209// Resources in the recently used list that have this flag
210// set to %TRUE should only be displayed by the applications
211// that have registered them.
212func (x *RecentInfo) GetPrivateHint() bool {
213
214 cret := xRecentInfoGetPrivateHint(x.GoPointer())
215 return cret
216}
217
218var xRecentInfoGetShortName func(uintptr) string
219
220// Computes a valid UTF-8 string that can be used as the
221// name of the item in a menu or list.
222//
223// For example, calling this function on an item that refers
224// to “file:///foo/bar.txt” will yield “bar.txt”.
225func (x *RecentInfo) GetShortName() string {
226
227 cret := xRecentInfoGetShortName(x.GoPointer())
228 return cret
229}
230
231var xRecentInfoGetUri func(uintptr) string
232
233// Gets the URI of the resource.
234func (x *RecentInfo) GetUri() string {
235
236 cret := xRecentInfoGetUri(x.GoPointer())
237 return cret
238}
239
240var xRecentInfoGetUriDisplay func(uintptr) string
241
242// Gets a displayable version of the resource’s URI.
243//
244// If the resource is local, it returns a local path; if the
245// resource is not local, it returns the UTF-8 encoded content
246// of [method@Gtk.RecentInfo.get_uri].
247func (x *RecentInfo) GetUriDisplay() string {
248
249 cret := xRecentInfoGetUriDisplay(x.GoPointer())
250 return cret
251}
252
253var xRecentInfoGetVisited func(uintptr) *glib.DateTime
254
255// Gets the time when the meta-data
256// for the resource was last visited.
257func (x *RecentInfo) GetVisited() *glib.DateTime {
258
259 cret := xRecentInfoGetVisited(x.GoPointer())
260 return cret
261}
262
263var xRecentInfoHasApplication func(uintptr, string) bool
264
265// Checks whether an application registered this resource using @app_name.
266func (x *RecentInfo) HasApplication(AppNameVar string) bool {
267
268 cret := xRecentInfoHasApplication(x.GoPointer(), AppNameVar)
269 return cret
270}
271
272var xRecentInfoHasGroup func(uintptr, string) bool
273
274// Checks whether @group_name appears inside the groups
275// registered for the recently used item @info.
276func (x *RecentInfo) HasGroup(GroupNameVar string) bool {
277
278 cret := xRecentInfoHasGroup(x.GoPointer(), GroupNameVar)
279 return cret
280}
281
282var xRecentInfoIsLocal func(uintptr) bool
283
284// Checks whether the resource is local or not by looking at the
285// scheme of its URI.
286func (x *RecentInfo) IsLocal() bool {
287
288 cret := xRecentInfoIsLocal(x.GoPointer())
289 return cret
290}
291
292var xRecentInfoLastApplication func(uintptr) string
293
294// Gets the name of the last application that have registered the
295// recently used resource represented by @info.
296func (x *RecentInfo) LastApplication() string {
297
298 cret := xRecentInfoLastApplication(x.GoPointer())
299 return cret
300}
301
302var xRecentInfoMatch func(uintptr, *RecentInfo) bool
303
304// Checks whether two `GtkRecentInfo` point to the same resource.
305func (x *RecentInfo) Match(InfoBVar *RecentInfo) bool {
306
307 cret := xRecentInfoMatch(x.GoPointer(), InfoBVar)
308 return cret
309}
310
311var xRecentInfoRef func(uintptr) *RecentInfo
312
313// Increases the reference count of @recent_info by one.
314func (x *RecentInfo) Ref() *RecentInfo {
315
316 cret := xRecentInfoRef(x.GoPointer())
317 return cret
318}
319
320var xRecentInfoUnref func(uintptr)
321
322// Decreases the reference count of @info by one.
323//
324// If the reference count reaches zero, @info is
325// deallocated, and the memory freed.
326func (x *RecentInfo) Unref() {
327
328 xRecentInfoUnref(x.GoPointer())
329
330}
331
332// `GtkRecentManagerClass` contains only private data.
333type RecentManagerClass struct {
334 _ structs.HostLayout
335
336 ParentClass gobject.ObjectClass
337
338 xChanged uintptr
339
340 xGtkRecent1 uintptr
341
342 xGtkRecent2 uintptr
343
344 xGtkRecent3 uintptr
345
346 xGtkRecent4 uintptr
347}
348
349func (x *RecentManagerClass) GoPointer() uintptr {
350 return uintptr(unsafe.Pointer(x))
351}
352
353// OverrideChanged sets the "changed" callback function.
354func (x *RecentManagerClass) OverrideChanged(cb func(*RecentManager)) {
355 if cb == nil {
356 x.xChanged = 0
357 } else {
358 x.xChanged = purego.NewCallback(func(ManagerVarp uintptr) {
359 cb(RecentManagerNewFromInternalPtr(ManagerVarp))
360 })
361 }
362}
363
364// GetChanged gets the "changed" callback function.
365func (x *RecentManagerClass) GetChanged() func(*RecentManager) {
366 if x.xChanged == 0 {
367 return nil
368 }
369 var rawCallback func(ManagerVarp uintptr)
370 purego.RegisterFunc(&rawCallback, x.xChanged)
371 return func(ManagerVar *RecentManager) {
372 rawCallback(ManagerVar.GoPointer())
373 }
374}
375
376// OverrideGtkRecent1 sets the "_gtk_recent1" callback function.
377func (x *RecentManagerClass) OverrideGtkRecent1(cb func()) {
378 if cb == nil {
379 x.xGtkRecent1 = 0
380 } else {
381 x.xGtkRecent1 = purego.NewCallback(func() {
382 cb()
383 })
384 }
385}
386
387// GetGtkRecent1 gets the "_gtk_recent1" callback function.
388func (x *RecentManagerClass) GetGtkRecent1() func() {
389 if x.xGtkRecent1 == 0 {
390 return nil
391 }
392 var rawCallback func()
393 purego.RegisterFunc(&rawCallback, x.xGtkRecent1)
394 return func() {
395 rawCallback()
396 }
397}
398
399// OverrideGtkRecent2 sets the "_gtk_recent2" callback function.
400func (x *RecentManagerClass) OverrideGtkRecent2(cb func()) {
401 if cb == nil {
402 x.xGtkRecent2 = 0
403 } else {
404 x.xGtkRecent2 = purego.NewCallback(func() {
405 cb()
406 })
407 }
408}
409
410// GetGtkRecent2 gets the "_gtk_recent2" callback function.
411func (x *RecentManagerClass) GetGtkRecent2() func() {
412 if x.xGtkRecent2 == 0 {
413 return nil
414 }
415 var rawCallback func()
416 purego.RegisterFunc(&rawCallback, x.xGtkRecent2)
417 return func() {
418 rawCallback()
419 }
420}
421
422// OverrideGtkRecent3 sets the "_gtk_recent3" callback function.
423func (x *RecentManagerClass) OverrideGtkRecent3(cb func()) {
424 if cb == nil {
425 x.xGtkRecent3 = 0
426 } else {
427 x.xGtkRecent3 = purego.NewCallback(func() {
428 cb()
429 })
430 }
431}
432
433// GetGtkRecent3 gets the "_gtk_recent3" callback function.
434func (x *RecentManagerClass) GetGtkRecent3() func() {
435 if x.xGtkRecent3 == 0 {
436 return nil
437 }
438 var rawCallback func()
439 purego.RegisterFunc(&rawCallback, x.xGtkRecent3)
440 return func() {
441 rawCallback()
442 }
443}
444
445// OverrideGtkRecent4 sets the "_gtk_recent4" callback function.
446func (x *RecentManagerClass) OverrideGtkRecent4(cb func()) {
447 if cb == nil {
448 x.xGtkRecent4 = 0
449 } else {
450 x.xGtkRecent4 = purego.NewCallback(func() {
451 cb()
452 })
453 }
454}
455
456// GetGtkRecent4 gets the "_gtk_recent4" callback function.
457func (x *RecentManagerClass) GetGtkRecent4() func() {
458 if x.xGtkRecent4 == 0 {
459 return nil
460 }
461 var rawCallback func()
462 purego.RegisterFunc(&rawCallback, x.xGtkRecent4)
463 return func() {
464 rawCallback()
465 }
466}
467
468type RecentManagerPrivate struct {
469 _ structs.HostLayout
470}
471
472func (x *RecentManagerPrivate) GoPointer() uintptr {
473 return uintptr(unsafe.Pointer(x))
474}
475
476// Error codes for `GtkRecentManager` operations
477type RecentManagerError int
478
479var xRecentManagerErrorGLibType func() types.GType
480
481func RecentManagerErrorGLibType() types.GType {
482 return xRecentManagerErrorGLibType()
483}
484
485const (
486
487 // the URI specified does not exists in
488 // the recently used resources list.
489 RecentManagerErrorNotFoundValue RecentManagerError = 0
490 // the URI specified is not valid.
491 RecentManagerErrorInvalidUriValue RecentManagerError = 1
492 // the supplied string is not
493 // UTF-8 encoded.
494 RecentManagerErrorInvalidEncodingValue RecentManagerError = 2
495 // no application has registered
496 // the specified item.
497 RecentManagerErrorNotRegisteredValue RecentManagerError = 3
498 // failure while reading the recently used
499 // resources file.
500 RecentManagerErrorReadValue RecentManagerError = 4
501 // failure while writing the recently used
502 // resources file.
503 RecentManagerErrorWriteValue RecentManagerError = 5
504 // unspecified error.
505 RecentManagerErrorUnknownValue RecentManagerError = 6
506)
507
508var xRecentManagerErrorQuark func() glib.Quark
509
510// Registers an error quark for [class@RecentManager] errors.
511func RecentManagerErrorQuark() glib.Quark {
512
513 cret := xRecentManagerErrorQuark()
514 return cret
515}
516
517// Manages and looks up recently used files.
518//
519// Each recently used file is identified by its URI, and has meta-data
520// associated to it, like the names and command lines of the applications
521// that have registered it, the number of time each application has
522// registered the same file, the mime type of the file and whether
523// the file should be displayed only by the applications that have
524// registered it.
525//
526// The recently used files list is per user.
527//
528// `GtkRecentManager` acts like a database of all the recently
529// used files. You can create new `GtkRecentManager` objects, but
530// it is more efficient to use the default manager created by GTK.
531//
532// Adding a new recently used file is as simple as:
533//
534// ```c
535// GtkRecentManager *manager;
536//
537// manager = gtk_recent_manager_get_default ();
538// gtk_recent_manager_add_item (manager, file_uri);
539// ```
540//
541// The `GtkRecentManager` will try to gather all the needed information
542// from the file itself through GIO.
543//
544// Looking up the meta-data associated with a recently used file
545// given its URI requires calling [method@Gtk.RecentManager.lookup_item]:
546//
547// ```c
548// GtkRecentManager *manager;
549// GtkRecentInfo *info;
550// GError *error = NULL;
551//
552// manager = gtk_recent_manager_get_default ();
553// info = gtk_recent_manager_lookup_item (manager, file_uri, &error);
554// if (error)
555//
556// {
557// g_warning ("Could not find the file: %s", error->message);
558// g_error_free (error);
559// }
560//
561// else
562//
563// {
564// // Use the info object
565// gtk_recent_info_unref (info);
566// }
567//
568// ```
569//
570// In order to retrieve the list of recently used files, you can use
571// [method@Gtk.RecentManager.get_items], which returns a list of
572// [struct@Gtk.RecentInfo].
573//
574// Note that the maximum age of the recently used files list is
575// controllable through the [property@Gtk.Settings:gtk-recent-files-max-age]
576// property.
577type RecentManager struct {
578 gobject.Object
579}
580
581var xRecentManagerGLibType func() types.GType
582
583func RecentManagerGLibType() types.GType {
584 return xRecentManagerGLibType()
585}
586
587func RecentManagerNewFromInternalPtr(ptr uintptr) *RecentManager {
588 cls := &RecentManager{}
589 cls.Ptr = ptr
590 return cls
591}
592
593var xNewRecentManager func() uintptr
594
595// Creates a new recent manager object.
596//
597// Recent manager objects are used to handle the list of recently used
598// resources. A `GtkRecentManager` object monitors the recently used
599// resources list, and emits the [signal@Gtk.RecentManager::changed]
600// signal each time something inside the list changes.
601//
602// `GtkRecentManager` objects are expensive: be sure to create them
603// only when needed. You should use [func@Gtk.RecentManager.get_default]
604// instead.
605func NewRecentManager() *RecentManager {
606 var cls *RecentManager
607
608 cret := xNewRecentManager()
609
610 if cret == 0 {
611 return nil
612 }
613 cls = &RecentManager{}
614 cls.Ptr = cret
615 return cls
616}
617
618var xRecentManagerAddFull func(uintptr, string, *RecentData) bool
619
620// Adds a new resource, pointed by @uri, into the recently used
621// resources list, using the metadata specified inside the
622// `GtkRecentData` passed in @recent_data.
623//
624// The passed URI will be used to identify this resource inside the
625// list.
626//
627// In order to register the new recently used resource, metadata about
628// the resource must be passed as well as the URI; the metadata is
629// stored in a `GtkRecentData`, which must contain the MIME
630// type of the resource pointed by the URI; the name of the application
631// that is registering the item, and a command line to be used when
632// launching the item.
633//
634// Optionally, a `GtkRecentData` might contain a UTF-8 string
635// to be used when viewing the item instead of the last component of
636// the URI; a short description of the item; whether the item should
637// be considered private - that is, should be displayed only by the
638// applications that have registered it.
639func (x *RecentManager) AddFull(UriVar string, RecentDataVar *RecentData) bool {
640
641 cret := xRecentManagerAddFull(x.GoPointer(), UriVar, RecentDataVar)
642 return cret
643}
644
645var xRecentManagerAddItem func(uintptr, string) bool
646
647// Adds a new resource, pointed by @uri, into the recently used
648// resources list.
649//
650// This function automatically retrieves some of the needed
651// metadata and setting other metadata to common default values;
652// it then feeds the data to [method@Gtk.RecentManager.add_full].
653//
654// See [method@Gtk.RecentManager.add_full] if you want to explicitly
655// define the metadata for the resource pointed by @uri.
656func (x *RecentManager) AddItem(UriVar string) bool {
657
658 cret := xRecentManagerAddItem(x.GoPointer(), UriVar)
659 return cret
660}
661
662var xRecentManagerGetItems func(uintptr) *glib.List
663
664// Gets the list of recently used resources.
665func (x *RecentManager) GetItems() *glib.List {
666
667 cret := xRecentManagerGetItems(x.GoPointer())
668 return cret
669}
670
671var xRecentManagerHasItem func(uintptr, string) bool
672
673// Checks whether there is a recently used resource registered
674// with @uri inside the recent manager.
675func (x *RecentManager) HasItem(UriVar string) bool {
676
677 cret := xRecentManagerHasItem(x.GoPointer(), UriVar)
678 return cret
679}
680
681var xRecentManagerLookupItem func(uintptr, string, **glib.Error) *RecentInfo
682
683// Searches for a URI inside the recently used resources list, and
684// returns a `GtkRecentInfo` containing information about the resource
685// like its MIME type, or its display name.
686func (x *RecentManager) LookupItem(UriVar string) (*RecentInfo, error) {
687 var cerr *glib.Error
688
689 cret := xRecentManagerLookupItem(x.GoPointer(), UriVar, &cerr)
690 if cerr == nil {
691 return cret, nil
692 }
693 return cret, cerr
694
695}
696
697var xRecentManagerMoveItem func(uintptr, string, uintptr, **glib.Error) bool
698
699// Changes the location of a recently used resource from @uri to @new_uri.
700//
701// Please note that this function will not affect the resource pointed
702// by the URIs, but only the URI used in the recently used resources list.
703func (x *RecentManager) MoveItem(UriVar string, NewUriVar *string) (bool, error) {
704 var cerr *glib.Error
705
706 NewUriVarPtr := core.GStrdupNullable(NewUriVar)
707 defer core.GFreeNullable(NewUriVarPtr)
708
709 cret := xRecentManagerMoveItem(x.GoPointer(), UriVar, NewUriVarPtr, &cerr)
710 if cerr == nil {
711 return cret, nil
712 }
713 return cret, cerr
714
715}
716
717var xRecentManagerPurgeItems func(uintptr) int
718
719// Purges every item from the recently used resources list.
720func (x *RecentManager) PurgeItems() (int, error) {
721 var cerr *glib.Error
722
723 cret := xRecentManagerPurgeItems(x.GoPointer())
724 if cerr == nil {
725 return cret, nil
726 }
727 return cret, cerr
728
729}
730
731var xRecentManagerRemoveItem func(uintptr, string, **glib.Error) bool
732
733// Removes a resource pointed by @uri from the recently used resources
734// list handled by a recent manager.
735func (x *RecentManager) RemoveItem(UriVar string) (bool, error) {
736 var cerr *glib.Error
737
738 cret := xRecentManagerRemoveItem(x.GoPointer(), UriVar, &cerr)
739 if cerr == nil {
740 return cret, nil
741 }
742 return cret, cerr
743
744}
745
746func (c *RecentManager) GoPointer() uintptr {
747 if c == nil {
748 return 0
749 }
750 return c.Ptr
751}
752
753func (c *RecentManager) SetGoPointer(ptr uintptr) {
754 c.Ptr = ptr
755}
756
757// SetPropertyFilename sets the "filename" property.
758// The full path to the file to be used to store and read the
759// recently used resources list
760func (x *RecentManager) SetPropertyFilename(value string) {
761 var v gobject.Value
762 v.Init(gobject.TypeStringVal)
763 v.SetString(&value)
764 x.SetProperty("filename", &v)
765}
766
767// GetPropertyFilename gets the "filename" property.
768// The full path to the file to be used to store and read the
769// recently used resources list
770func (x *RecentManager) GetPropertyFilename() string {
771 var v gobject.Value
772 x.GetProperty("filename", &v)
773 return v.GetString()
774}
775
776// GetPropertySize gets the "size" property.
777// The size of the recently used resources list.
778func (x *RecentManager) GetPropertySize() int {
779 var v gobject.Value
780 x.GetProperty("size", &v)
781 return v.GetInt()
782}
783
784// Emitted when the current recently used resources manager changes
785// its contents.
786//
787// This can happen either by calling [method@Gtk.RecentManager.add_item]
788// or by another application.
789func (x *RecentManager) ConnectChanged(cb *func(RecentManager)) uint {
790 cbPtr := uintptr(unsafe.Pointer(cb))
791 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
792 handlerID := gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr)
793 glib.SaveHandlerMapping(handlerID, cbPtr)
794 return handlerID
795 }
796
797 fcb := func(clsPtr uintptr) {
798 fa := RecentManager{}
799 fa.Ptr = clsPtr
800 cbFn := *cb
801
802 cbFn(fa)
803
804 }
805 cbRefPtr := purego.NewCallback(fcb)
806 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
807 handlerID := gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr)
808 glib.SaveHandlerMapping(handlerID, cbPtr)
809 return handlerID
810}
811
812var xRecentManagerGetDefault func() uintptr
813
814// Gets a unique instance of `GtkRecentManager` that you can share
815// in your application without caring about memory management.
816func RecentManagerGetDefault() *RecentManager {
817 var cls *RecentManager
818
819 cret := xRecentManagerGetDefault()
820
821 if cret == 0 {
822 return nil
823 }
824 gobject.IncreaseRef(cret)
825 cls = &RecentManager{}
826 cls.Ptr = cret
827 return cls
828}
829
830func init() {
831 core.SetPackageName("GTK", "gtk4")
832 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
833 var libs []uintptr
834 for _, libPath := range core.GetPaths("GTK") {
835 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
836 if err != nil {
837 panic(err)
838 }
839 libs = append(libs, lib)
840 }
841
842 core.PuregoSafeRegister(&xRecentManagerErrorGLibType, libs, "gtk_recent_manager_error_get_type")
843
844 core.PuregoSafeRegister(&xRecentManagerErrorQuark, libs, "gtk_recent_manager_error_quark")
845
846 core.PuregoSafeRegister(&xRecentInfoGLibType, libs, "gtk_recent_info_get_type")
847
848 core.PuregoSafeRegister(&xRecentInfoCreateAppInfo, libs, "gtk_recent_info_create_app_info")
849 core.PuregoSafeRegister(&xRecentInfoExists, libs, "gtk_recent_info_exists")
850 core.PuregoSafeRegister(&xRecentInfoGetAdded, libs, "gtk_recent_info_get_added")
851 core.PuregoSafeRegister(&xRecentInfoGetAge, libs, "gtk_recent_info_get_age")
852 core.PuregoSafeRegister(&xRecentInfoGetApplicationInfo, libs, "gtk_recent_info_get_application_info")
853 core.PuregoSafeRegister(&xRecentInfoGetApplications, libs, "gtk_recent_info_get_applications")
854 core.PuregoSafeRegister(&xRecentInfoGetDescription, libs, "gtk_recent_info_get_description")
855 core.PuregoSafeRegister(&xRecentInfoGetDisplayName, libs, "gtk_recent_info_get_display_name")
856 core.PuregoSafeRegister(&xRecentInfoGetGicon, libs, "gtk_recent_info_get_gicon")
857 core.PuregoSafeRegister(&xRecentInfoGetGroups, libs, "gtk_recent_info_get_groups")
858 core.PuregoSafeRegister(&xRecentInfoGetMimeType, libs, "gtk_recent_info_get_mime_type")
859 core.PuregoSafeRegister(&xRecentInfoGetModified, libs, "gtk_recent_info_get_modified")
860 core.PuregoSafeRegister(&xRecentInfoGetPrivateHint, libs, "gtk_recent_info_get_private_hint")
861 core.PuregoSafeRegister(&xRecentInfoGetShortName, libs, "gtk_recent_info_get_short_name")
862 core.PuregoSafeRegister(&xRecentInfoGetUri, libs, "gtk_recent_info_get_uri")
863 core.PuregoSafeRegister(&xRecentInfoGetUriDisplay, libs, "gtk_recent_info_get_uri_display")
864 core.PuregoSafeRegister(&xRecentInfoGetVisited, libs, "gtk_recent_info_get_visited")
865 core.PuregoSafeRegister(&xRecentInfoHasApplication, libs, "gtk_recent_info_has_application")
866 core.PuregoSafeRegister(&xRecentInfoHasGroup, libs, "gtk_recent_info_has_group")
867 core.PuregoSafeRegister(&xRecentInfoIsLocal, libs, "gtk_recent_info_is_local")
868 core.PuregoSafeRegister(&xRecentInfoLastApplication, libs, "gtk_recent_info_last_application")
869 core.PuregoSafeRegister(&xRecentInfoMatch, libs, "gtk_recent_info_match")
870 core.PuregoSafeRegister(&xRecentInfoRef, libs, "gtk_recent_info_ref")
871 core.PuregoSafeRegister(&xRecentInfoUnref, libs, "gtk_recent_info_unref")
872
873 core.PuregoSafeRegister(&xRecentManagerGLibType, libs, "gtk_recent_manager_get_type")
874
875 core.PuregoSafeRegister(&xNewRecentManager, libs, "gtk_recent_manager_new")
876
877 core.PuregoSafeRegister(&xRecentManagerAddFull, libs, "gtk_recent_manager_add_full")
878 core.PuregoSafeRegister(&xRecentManagerAddItem, libs, "gtk_recent_manager_add_item")
879 core.PuregoSafeRegister(&xRecentManagerGetItems, libs, "gtk_recent_manager_get_items")
880 core.PuregoSafeRegister(&xRecentManagerHasItem, libs, "gtk_recent_manager_has_item")
881 core.PuregoSafeRegister(&xRecentManagerLookupItem, libs, "gtk_recent_manager_lookup_item")
882 core.PuregoSafeRegister(&xRecentManagerMoveItem, libs, "gtk_recent_manager_move_item")
883 core.PuregoSafeRegister(&xRecentManagerPurgeItems, libs, "gtk_recent_manager_purge_items")
884 core.PuregoSafeRegister(&xRecentManagerRemoveItem, libs, "gtk_recent_manager_remove_item")
885
886 core.PuregoSafeRegister(&xRecentManagerGetDefault, libs, "gtk_recent_manager_get_default")
887
888}