1// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package glib
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/gobject/types"
12)
13
14// `GBookmarkFile` lets you parse, edit or create files containing bookmarks.
15//
16// Bookmarks refer to a URI, along with some meta-data about the resource
17// pointed by the URI like its MIME type, the application that is registering
18// the bookmark and the icon that should be used to represent the bookmark.
19// The data is stored using the
20// [Desktop Bookmark Specification](https://www.freedesktop.org/wiki/Specifications/desktop-bookmark-spec/).
21//
22// The syntax of the bookmark files is described in detail inside the
23// Desktop Bookmark Specification, here is a quick summary: bookmark
24// files use a sub-class of the XML Bookmark Exchange Language
25// specification, consisting of valid UTF-8 encoded XML, under the
26// `<xbel>` root element; each bookmark is stored inside a
27// `<bookmark>` element, using its URI: no relative paths can
28// be used inside a bookmark file. The bookmark may have a user defined
29// title and description, to be used instead of the URI. Under the
30// `<metadata>` element, with its owner attribute set to
31// `http://freedesktop.org`, is stored the meta-data about a resource
32// pointed by its URI. The meta-data consists of the resource's MIME
33// type; the applications that have registered a bookmark; the groups
34// to which a bookmark belongs to; a visibility flag, used to set the
35// bookmark as "private" to the applications and groups that has it
36// registered; the URI and MIME type of an icon, to be used when
37// displaying the bookmark inside a GUI.
38//
39// Here is an example of a bookmark file:
40// [bookmarks.xbel](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/glib/tests/bookmarks.xbel)
41//
42// A bookmark file might contain more than one bookmark; each bookmark
43// is accessed through its URI.
44//
45// The important caveat of bookmark files is that when you add a new
46// bookmark you must also add the application that is registering it, using
47// [method@GLib.BookmarkFile.add_application] or [method@GLib.BookmarkFile.set_application_info].
48// If a bookmark has no applications then it won't be dumped when creating
49// the on disk representation, using [method@GLib.BookmarkFile.to_data] or
50// [method@GLib.BookmarkFile.to_file].
51type BookmarkFile struct {
52 _ structs.HostLayout
53}
54
55var xBookmarkFileGLibType func() types.GType
56
57func BookmarkFileGLibType() types.GType {
58 return xBookmarkFileGLibType()
59}
60
61func (x *BookmarkFile) GoPointer() uintptr {
62 return uintptr(unsafe.Pointer(x))
63}
64
65var xNewBookmarkFile func() *BookmarkFile
66
67// Creates a new empty #GBookmarkFile object.
68//
69// Use g_bookmark_file_load_from_file(), g_bookmark_file_load_from_data()
70// or g_bookmark_file_load_from_data_dirs() to read an existing bookmark
71// file.
72func NewBookmarkFile() *BookmarkFile {
73
74 cret := xNewBookmarkFile()
75 return cret
76}
77
78var xBookmarkFileAddApplication func(uintptr, string, uintptr, uintptr)
79
80// Adds the application with @name and @exec to the list of
81// applications that have registered a bookmark for @uri into
82// @bookmark.
83//
84// Every bookmark inside a #GBookmarkFile must have at least an
85// application registered. Each application must provide a name, a
86// command line useful for launching the bookmark, the number of times
87// the bookmark has been registered by the application and the last
88// time the application registered this bookmark.
89//
90// If @name is %NULL, the name of the application will be the
91// same returned by g_get_application_name(); if @exec is %NULL, the
92// command line will be a composition of the program name as
93// returned by g_get_prgname() and the "\%u" modifier, which will be
94// expanded to the bookmark's URI.
95//
96// This function will automatically take care of updating the
97// registrations count and timestamping in case an application
98// with the same @name had already registered a bookmark for
99// @uri inside @bookmark.
100//
101// If no bookmark for @uri is found, one is created.
102func (x *BookmarkFile) AddApplication(UriVar string, NameVar *string, ExecVar *string) {
103
104 NameVarPtr := core.GStrdupNullable(NameVar)
105 defer core.GFreeNullable(NameVarPtr)
106
107 ExecVarPtr := core.GStrdupNullable(ExecVar)
108 defer core.GFreeNullable(ExecVarPtr)
109
110 xBookmarkFileAddApplication(x.GoPointer(), UriVar, NameVarPtr, ExecVarPtr)
111
112}
113
114var xBookmarkFileAddGroup func(uintptr, string, string)
115
116// Adds @group to the list of groups to which the bookmark for @uri
117// belongs to.
118//
119// If no bookmark for @uri is found then it is created.
120func (x *BookmarkFile) AddGroup(UriVar string, GroupVar string) {
121
122 xBookmarkFileAddGroup(x.GoPointer(), UriVar, GroupVar)
123
124}
125
126var xBookmarkFileCopy func(uintptr) *BookmarkFile
127
128// Deeply copies a @bookmark #GBookmarkFile object to a new one.
129func (x *BookmarkFile) Copy() *BookmarkFile {
130
131 cret := xBookmarkFileCopy(x.GoPointer())
132 return cret
133}
134
135var xBookmarkFileFree func(uintptr)
136
137// Frees a #GBookmarkFile.
138func (x *BookmarkFile) Free() {
139
140 xBookmarkFileFree(x.GoPointer())
141
142}
143
144var xBookmarkFileGetAdded func(uintptr, string, **Error) int
145
146// Gets the time the bookmark for @uri was added to @bookmark
147//
148// In the event the URI cannot be found, -1 is returned and
149// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
150func (x *BookmarkFile) GetAdded(UriVar string) (int, error) {
151 var cerr *Error
152
153 cret := xBookmarkFileGetAdded(x.GoPointer(), UriVar, &cerr)
154 if cerr == nil {
155 return cret, nil
156 }
157 return cret, cerr
158
159}
160
161var xBookmarkFileGetAddedDateTime func(uintptr, string, **Error) *DateTime
162
163// Gets the time the bookmark for @uri was added to @bookmark
164//
165// In the event the URI cannot be found, %NULL is returned and
166// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
167func (x *BookmarkFile) GetAddedDateTime(UriVar string) (*DateTime, error) {
168 var cerr *Error
169
170 cret := xBookmarkFileGetAddedDateTime(x.GoPointer(), UriVar, &cerr)
171 if cerr == nil {
172 return cret, nil
173 }
174 return cret, cerr
175
176}
177
178var xBookmarkFileGetAppInfo func(uintptr, string, string, *string, *uint, *int, **Error) bool
179
180// Gets the registration information of @app_name for the bookmark for
181// @uri. See g_bookmark_file_set_application_info() for more information about
182// the returned data.
183//
184// The string returned in @app_exec must be freed.
185//
186// In the event the URI cannot be found, %FALSE is returned and
187// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the
188// event that no application with name @app_name has registered a bookmark
189// for @uri, %FALSE is returned and error is set to
190// %G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. In the event that unquoting
191// the command line fails, an error of the %G_SHELL_ERROR domain is
192// set and %FALSE is returned.
193func (x *BookmarkFile) GetAppInfo(UriVar string, NameVar string, ExecVar *string, CountVar *uint, StampVar *int) (bool, error) {
194 var cerr *Error
195
196 cret := xBookmarkFileGetAppInfo(x.GoPointer(), UriVar, NameVar, ExecVar, CountVar, StampVar, &cerr)
197 if cerr == nil {
198 return cret, nil
199 }
200 return cret, cerr
201
202}
203
204var xBookmarkFileGetApplicationInfo func(uintptr, string, string, *string, *uint, **DateTime, **Error) bool
205
206// Gets the registration information of @app_name for the bookmark for
207// @uri. See g_bookmark_file_set_application_info() for more information about
208// the returned data.
209//
210// The string returned in @app_exec must be freed.
211//
212// In the event the URI cannot be found, %FALSE is returned and
213// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the
214// event that no application with name @app_name has registered a bookmark
215// for @uri, %FALSE is returned and error is set to
216// %G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. In the event that unquoting
217// the command line fails, an error of the %G_SHELL_ERROR domain is
218// set and %FALSE is returned.
219func (x *BookmarkFile) GetApplicationInfo(UriVar string, NameVar string, ExecVar *string, CountVar *uint, StampVar **DateTime) (bool, error) {
220 var cerr *Error
221
222 cret := xBookmarkFileGetApplicationInfo(x.GoPointer(), UriVar, NameVar, ExecVar, CountVar, StampVar, &cerr)
223 if cerr == nil {
224 return cret, nil
225 }
226 return cret, cerr
227
228}
229
230var xBookmarkFileGetApplications func(uintptr, string, *uint, **Error) []string
231
232// Retrieves the names of the applications that have registered the
233// bookmark for @uri.
234//
235// In the event the URI cannot be found, %NULL is returned and
236// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
237func (x *BookmarkFile) GetApplications(UriVar string, LengthVar *uint) ([]string, error) {
238 var cerr *Error
239
240 cret := xBookmarkFileGetApplications(x.GoPointer(), UriVar, LengthVar, &cerr)
241 if cerr == nil {
242 return cret, nil
243 }
244 return cret, cerr
245
246}
247
248var xBookmarkFileGetDescription func(uintptr, string, **Error) string
249
250// Retrieves the description of the bookmark for @uri.
251//
252// In the event the URI cannot be found, %NULL is returned and
253// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
254func (x *BookmarkFile) GetDescription(UriVar string) (string, error) {
255 var cerr *Error
256
257 cret := xBookmarkFileGetDescription(x.GoPointer(), UriVar, &cerr)
258 if cerr == nil {
259 return cret, nil
260 }
261 return cret, cerr
262
263}
264
265var xBookmarkFileGetGroups func(uintptr, string, *uint, **Error) []string
266
267// Retrieves the list of group names of the bookmark for @uri.
268//
269// In the event the URI cannot be found, %NULL is returned and
270// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
271//
272// The returned array is %NULL terminated, so @length may optionally
273// be %NULL.
274func (x *BookmarkFile) GetGroups(UriVar string, LengthVar *uint) ([]string, error) {
275 var cerr *Error
276
277 cret := xBookmarkFileGetGroups(x.GoPointer(), UriVar, LengthVar, &cerr)
278 if cerr == nil {
279 return cret, nil
280 }
281 return cret, cerr
282
283}
284
285var xBookmarkFileGetIcon func(uintptr, string, *string, *string, **Error) bool
286
287// Gets the icon of the bookmark for @uri.
288//
289// In the event the URI cannot be found, %FALSE is returned and
290// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
291func (x *BookmarkFile) GetIcon(UriVar string, HrefVar *string, MimeTypeVar *string) (bool, error) {
292 var cerr *Error
293
294 cret := xBookmarkFileGetIcon(x.GoPointer(), UriVar, HrefVar, MimeTypeVar, &cerr)
295 if cerr == nil {
296 return cret, nil
297 }
298 return cret, cerr
299
300}
301
302var xBookmarkFileGetIsPrivate func(uintptr, string, **Error) bool
303
304// Gets whether the private flag of the bookmark for @uri is set.
305//
306// In the event the URI cannot be found, %FALSE is returned and
307// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the
308// event that the private flag cannot be found, %FALSE is returned and
309// @error is set to %G_BOOKMARK_FILE_ERROR_INVALID_VALUE.
310func (x *BookmarkFile) GetIsPrivate(UriVar string) (bool, error) {
311 var cerr *Error
312
313 cret := xBookmarkFileGetIsPrivate(x.GoPointer(), UriVar, &cerr)
314 if cerr == nil {
315 return cret, nil
316 }
317 return cret, cerr
318
319}
320
321var xBookmarkFileGetMimeType func(uintptr, string, **Error) string
322
323// Retrieves the MIME type of the resource pointed by @uri.
324//
325// In the event the URI cannot be found, %NULL is returned and
326// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the
327// event that the MIME type cannot be found, %NULL is returned and
328// @error is set to %G_BOOKMARK_FILE_ERROR_INVALID_VALUE.
329func (x *BookmarkFile) GetMimeType(UriVar string) (string, error) {
330 var cerr *Error
331
332 cret := xBookmarkFileGetMimeType(x.GoPointer(), UriVar, &cerr)
333 if cerr == nil {
334 return cret, nil
335 }
336 return cret, cerr
337
338}
339
340var xBookmarkFileGetModified func(uintptr, string, **Error) int
341
342// Gets the time when the bookmark for @uri was last modified.
343//
344// In the event the URI cannot be found, -1 is returned and
345// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
346func (x *BookmarkFile) GetModified(UriVar string) (int, error) {
347 var cerr *Error
348
349 cret := xBookmarkFileGetModified(x.GoPointer(), UriVar, &cerr)
350 if cerr == nil {
351 return cret, nil
352 }
353 return cret, cerr
354
355}
356
357var xBookmarkFileGetModifiedDateTime func(uintptr, string, **Error) *DateTime
358
359// Gets the time when the bookmark for @uri was last modified.
360//
361// In the event the URI cannot be found, %NULL is returned and
362// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
363func (x *BookmarkFile) GetModifiedDateTime(UriVar string) (*DateTime, error) {
364 var cerr *Error
365
366 cret := xBookmarkFileGetModifiedDateTime(x.GoPointer(), UriVar, &cerr)
367 if cerr == nil {
368 return cret, nil
369 }
370 return cret, cerr
371
372}
373
374var xBookmarkFileGetSize func(uintptr) int
375
376// Gets the number of bookmarks inside @bookmark.
377func (x *BookmarkFile) GetSize() int {
378
379 cret := xBookmarkFileGetSize(x.GoPointer())
380 return cret
381}
382
383var xBookmarkFileGetTitle func(uintptr, uintptr, **Error) string
384
385// Returns the title of the bookmark for @uri.
386//
387// If @uri is %NULL, the title of @bookmark is returned.
388//
389// In the event the URI cannot be found, %NULL is returned and
390// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
391func (x *BookmarkFile) GetTitle(UriVar *string) (string, error) {
392 var cerr *Error
393
394 UriVarPtr := core.GStrdupNullable(UriVar)
395 defer core.GFreeNullable(UriVarPtr)
396
397 cret := xBookmarkFileGetTitle(x.GoPointer(), UriVarPtr, &cerr)
398 if cerr == nil {
399 return cret, nil
400 }
401 return cret, cerr
402
403}
404
405var xBookmarkFileGetUris func(uintptr, *uint) []string
406
407// Returns all URIs of the bookmarks in the bookmark file @bookmark.
408// The array of returned URIs will be %NULL-terminated, so @length may
409// optionally be %NULL.
410func (x *BookmarkFile) GetUris(LengthVar *uint) []string {
411
412 cret := xBookmarkFileGetUris(x.GoPointer(), LengthVar)
413 return cret
414}
415
416var xBookmarkFileGetVisited func(uintptr, string, **Error) int
417
418// Gets the time the bookmark for @uri was last visited.
419//
420// In the event the URI cannot be found, -1 is returned and
421// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
422func (x *BookmarkFile) GetVisited(UriVar string) (int, error) {
423 var cerr *Error
424
425 cret := xBookmarkFileGetVisited(x.GoPointer(), UriVar, &cerr)
426 if cerr == nil {
427 return cret, nil
428 }
429 return cret, cerr
430
431}
432
433var xBookmarkFileGetVisitedDateTime func(uintptr, string, **Error) *DateTime
434
435// Gets the time the bookmark for @uri was last visited.
436//
437// In the event the URI cannot be found, %NULL is returned and
438// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
439func (x *BookmarkFile) GetVisitedDateTime(UriVar string) (*DateTime, error) {
440 var cerr *Error
441
442 cret := xBookmarkFileGetVisitedDateTime(x.GoPointer(), UriVar, &cerr)
443 if cerr == nil {
444 return cret, nil
445 }
446 return cret, cerr
447
448}
449
450var xBookmarkFileHasApplication func(uintptr, string, string, **Error) bool
451
452// Checks whether the bookmark for @uri inside @bookmark has been
453// registered by application @name.
454//
455// In the event the URI cannot be found, %FALSE is returned and
456// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
457func (x *BookmarkFile) HasApplication(UriVar string, NameVar string) (bool, error) {
458 var cerr *Error
459
460 cret := xBookmarkFileHasApplication(x.GoPointer(), UriVar, NameVar, &cerr)
461 if cerr == nil {
462 return cret, nil
463 }
464 return cret, cerr
465
466}
467
468var xBookmarkFileHasGroup func(uintptr, string, string, **Error) bool
469
470// Checks whether @group appears in the list of groups to which
471// the bookmark for @uri belongs to.
472//
473// In the event the URI cannot be found, %FALSE is returned and
474// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
475func (x *BookmarkFile) HasGroup(UriVar string, GroupVar string) (bool, error) {
476 var cerr *Error
477
478 cret := xBookmarkFileHasGroup(x.GoPointer(), UriVar, GroupVar, &cerr)
479 if cerr == nil {
480 return cret, nil
481 }
482 return cret, cerr
483
484}
485
486var xBookmarkFileHasItem func(uintptr, string) bool
487
488// Looks whether the desktop bookmark has an item with its URI set to @uri.
489func (x *BookmarkFile) HasItem(UriVar string) bool {
490
491 cret := xBookmarkFileHasItem(x.GoPointer(), UriVar)
492 return cret
493}
494
495var xBookmarkFileLoadFromData func(uintptr, []byte, uint, **Error) bool
496
497// Loads a bookmark file from memory into an empty #GBookmarkFile
498// structure. If the object cannot be created then @error is set to a
499// #GBookmarkFileError.
500func (x *BookmarkFile) LoadFromData(DataVar []byte, LengthVar uint) (bool, error) {
501 var cerr *Error
502
503 cret := xBookmarkFileLoadFromData(x.GoPointer(), DataVar, LengthVar, &cerr)
504 if cerr == nil {
505 return cret, nil
506 }
507 return cret, cerr
508
509}
510
511var xBookmarkFileLoadFromDataDirs func(uintptr, string, *string, **Error) bool
512
513// This function looks for a desktop bookmark file named @file in the
514// paths returned from g_get_user_data_dir() and g_get_system_data_dirs(),
515// loads the file into @bookmark and returns the file's full path in
516// @full_path. If the file could not be loaded then @error is
517// set to either a #GFileError or #GBookmarkFileError.
518func (x *BookmarkFile) LoadFromDataDirs(FileVar string, FullPathVar *string) (bool, error) {
519 var cerr *Error
520
521 cret := xBookmarkFileLoadFromDataDirs(x.GoPointer(), FileVar, FullPathVar, &cerr)
522 if cerr == nil {
523 return cret, nil
524 }
525 return cret, cerr
526
527}
528
529var xBookmarkFileLoadFromFile func(uintptr, string, **Error) bool
530
531// Loads a desktop bookmark file into an empty #GBookmarkFile structure.
532// If the file could not be loaded then @error is set to either a #GFileError
533// or #GBookmarkFileError.
534func (x *BookmarkFile) LoadFromFile(FilenameVar string) (bool, error) {
535 var cerr *Error
536
537 cret := xBookmarkFileLoadFromFile(x.GoPointer(), FilenameVar, &cerr)
538 if cerr == nil {
539 return cret, nil
540 }
541 return cret, cerr
542
543}
544
545var xBookmarkFileMoveItem func(uintptr, string, uintptr, **Error) bool
546
547// Changes the URI of a bookmark item from @old_uri to @new_uri. Any
548// existing bookmark for @new_uri will be overwritten. If @new_uri is
549// %NULL, then the bookmark is removed.
550//
551// In the event the URI cannot be found, %FALSE is returned and
552// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
553func (x *BookmarkFile) MoveItem(OldUriVar string, NewUriVar *string) (bool, error) {
554 var cerr *Error
555
556 NewUriVarPtr := core.GStrdupNullable(NewUriVar)
557 defer core.GFreeNullable(NewUriVarPtr)
558
559 cret := xBookmarkFileMoveItem(x.GoPointer(), OldUriVar, NewUriVarPtr, &cerr)
560 if cerr == nil {
561 return cret, nil
562 }
563 return cret, cerr
564
565}
566
567var xBookmarkFileRemoveApplication func(uintptr, string, string, **Error) bool
568
569// Removes application registered with @name from the list of applications
570// that have registered a bookmark for @uri inside @bookmark.
571//
572// In the event the URI cannot be found, %FALSE is returned and
573// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
574// In the event that no application with name @app_name has registered
575// a bookmark for @uri, %FALSE is returned and error is set to
576// %G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED.
577func (x *BookmarkFile) RemoveApplication(UriVar string, NameVar string) (bool, error) {
578 var cerr *Error
579
580 cret := xBookmarkFileRemoveApplication(x.GoPointer(), UriVar, NameVar, &cerr)
581 if cerr == nil {
582 return cret, nil
583 }
584 return cret, cerr
585
586}
587
588var xBookmarkFileRemoveGroup func(uintptr, string, string, **Error) bool
589
590// Removes @group from the list of groups to which the bookmark
591// for @uri belongs to.
592//
593// In the event the URI cannot be found, %FALSE is returned and
594// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
595// In the event no group was defined, %FALSE is returned and
596// @error is set to %G_BOOKMARK_FILE_ERROR_INVALID_VALUE.
597func (x *BookmarkFile) RemoveGroup(UriVar string, GroupVar string) (bool, error) {
598 var cerr *Error
599
600 cret := xBookmarkFileRemoveGroup(x.GoPointer(), UriVar, GroupVar, &cerr)
601 if cerr == nil {
602 return cret, nil
603 }
604 return cret, cerr
605
606}
607
608var xBookmarkFileRemoveItem func(uintptr, string, **Error) bool
609
610// Removes the bookmark for @uri from the bookmark file @bookmark.
611func (x *BookmarkFile) RemoveItem(UriVar string) (bool, error) {
612 var cerr *Error
613
614 cret := xBookmarkFileRemoveItem(x.GoPointer(), UriVar, &cerr)
615 if cerr == nil {
616 return cret, nil
617 }
618 return cret, cerr
619
620}
621
622var xBookmarkFileSetAdded func(uintptr, string, int)
623
624// Sets the time the bookmark for @uri was added into @bookmark.
625//
626// If no bookmark for @uri is found then it is created.
627func (x *BookmarkFile) SetAdded(UriVar string, AddedVar int) {
628
629 xBookmarkFileSetAdded(x.GoPointer(), UriVar, AddedVar)
630
631}
632
633var xBookmarkFileSetAddedDateTime func(uintptr, string, *DateTime)
634
635// Sets the time the bookmark for @uri was added into @bookmark.
636//
637// If no bookmark for @uri is found then it is created.
638func (x *BookmarkFile) SetAddedDateTime(UriVar string, AddedVar *DateTime) {
639
640 xBookmarkFileSetAddedDateTime(x.GoPointer(), UriVar, AddedVar)
641
642}
643
644var xBookmarkFileSetAppInfo func(uintptr, string, string, string, int, int, **Error) bool
645
646// Sets the meta-data of application @name inside the list of
647// applications that have registered a bookmark for @uri inside
648// @bookmark.
649//
650// You should rarely use this function; use g_bookmark_file_add_application()
651// and g_bookmark_file_remove_application() instead.
652//
653// @name can be any UTF-8 encoded string used to identify an
654// application.
655// @exec can have one of these two modifiers: "\%f", which will
656// be expanded as the local file name retrieved from the bookmark's
657// URI; "\%u", which will be expanded as the bookmark's URI.
658// The expansion is done automatically when retrieving the stored
659// command line using the g_bookmark_file_get_application_info() function.
660// @count is the number of times the application has registered the
661// bookmark; if is < 0, the current registration count will be increased
662// by one, if is 0, the application with @name will be removed from
663// the list of registered applications.
664// @stamp is the Unix time of the last registration; if it is -1, the
665// current time will be used.
666//
667// If you try to remove an application by setting its registration count to
668// zero, and no bookmark for @uri is found, %FALSE is returned and
669// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND; similarly,
670// in the event that no application @name has registered a bookmark
671// for @uri, %FALSE is returned and error is set to
672// %G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. Otherwise, if no bookmark
673// for @uri is found, one is created.
674func (x *BookmarkFile) SetAppInfo(UriVar string, NameVar string, ExecVar string, CountVar int, StampVar int) (bool, error) {
675 var cerr *Error
676
677 cret := xBookmarkFileSetAppInfo(x.GoPointer(), UriVar, NameVar, ExecVar, CountVar, StampVar, &cerr)
678 if cerr == nil {
679 return cret, nil
680 }
681 return cret, cerr
682
683}
684
685var xBookmarkFileSetApplicationInfo func(uintptr, string, string, string, int, *DateTime, **Error) bool
686
687// Sets the meta-data of application @name inside the list of
688// applications that have registered a bookmark for @uri inside
689// @bookmark.
690//
691// You should rarely use this function; use g_bookmark_file_add_application()
692// and g_bookmark_file_remove_application() instead.
693//
694// @name can be any UTF-8 encoded string used to identify an
695// application.
696// @exec can have one of these two modifiers: "\%f", which will
697// be expanded as the local file name retrieved from the bookmark's
698// URI; "\%u", which will be expanded as the bookmark's URI.
699// The expansion is done automatically when retrieving the stored
700// command line using the g_bookmark_file_get_application_info() function.
701// @count is the number of times the application has registered the
702// bookmark; if is < 0, the current registration count will be increased
703// by one, if is 0, the application with @name will be removed from
704// the list of registered applications.
705// @stamp is the Unix time of the last registration.
706//
707// If you try to remove an application by setting its registration count to
708// zero, and no bookmark for @uri is found, %FALSE is returned and
709// @error is set to %G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND; similarly,
710// in the event that no application @name has registered a bookmark
711// for @uri, %FALSE is returned and error is set to
712// %G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. Otherwise, if no bookmark
713// for @uri is found, one is created.
714func (x *BookmarkFile) SetApplicationInfo(UriVar string, NameVar string, ExecVar string, CountVar int, StampVar *DateTime) (bool, error) {
715 var cerr *Error
716
717 cret := xBookmarkFileSetApplicationInfo(x.GoPointer(), UriVar, NameVar, ExecVar, CountVar, StampVar, &cerr)
718 if cerr == nil {
719 return cret, nil
720 }
721 return cret, cerr
722
723}
724
725var xBookmarkFileSetDescription func(uintptr, uintptr, string)
726
727// Sets @description as the description of the bookmark for @uri.
728//
729// If @uri is %NULL, the description of @bookmark is set.
730//
731// If a bookmark for @uri cannot be found then it is created.
732func (x *BookmarkFile) SetDescription(UriVar *string, DescriptionVar string) {
733
734 UriVarPtr := core.GStrdupNullable(UriVar)
735 defer core.GFreeNullable(UriVarPtr)
736
737 xBookmarkFileSetDescription(x.GoPointer(), UriVarPtr, DescriptionVar)
738
739}
740
741var xBookmarkFileSetGroups func(uintptr, string, []string, uint)
742
743// Sets a list of group names for the item with URI @uri. Each previously
744// set group name list is removed.
745//
746// If @uri cannot be found then an item for it is created.
747func (x *BookmarkFile) SetGroups(UriVar string, GroupsVar []string, LengthVar uint) {
748
749 xBookmarkFileSetGroups(x.GoPointer(), UriVar, GroupsVar, LengthVar)
750
751}
752
753var xBookmarkFileSetIcon func(uintptr, string, uintptr, string)
754
755// Sets the icon for the bookmark for @uri. If @href is %NULL, unsets
756// the currently set icon. @href can either be a full URL for the icon
757// file or the icon name following the Icon Naming specification.
758//
759// If no bookmark for @uri is found one is created.
760func (x *BookmarkFile) SetIcon(UriVar string, HrefVar *string, MimeTypeVar string) {
761
762 HrefVarPtr := core.GStrdupNullable(HrefVar)
763 defer core.GFreeNullable(HrefVarPtr)
764
765 xBookmarkFileSetIcon(x.GoPointer(), UriVar, HrefVarPtr, MimeTypeVar)
766
767}
768
769var xBookmarkFileSetIsPrivate func(uintptr, string, bool)
770
771// Sets the private flag of the bookmark for @uri.
772//
773// If a bookmark for @uri cannot be found then it is created.
774func (x *BookmarkFile) SetIsPrivate(UriVar string, IsPrivateVar bool) {
775
776 xBookmarkFileSetIsPrivate(x.GoPointer(), UriVar, IsPrivateVar)
777
778}
779
780var xBookmarkFileSetMimeType func(uintptr, string, string)
781
782// Sets @mime_type as the MIME type of the bookmark for @uri.
783//
784// If a bookmark for @uri cannot be found then it is created.
785func (x *BookmarkFile) SetMimeType(UriVar string, MimeTypeVar string) {
786
787 xBookmarkFileSetMimeType(x.GoPointer(), UriVar, MimeTypeVar)
788
789}
790
791var xBookmarkFileSetModified func(uintptr, string, int)
792
793// Sets the last time the bookmark for @uri was last modified.
794//
795// If no bookmark for @uri is found then it is created.
796//
797// The "modified" time should only be set when the bookmark's meta-data
798// was actually changed. Every function of #GBookmarkFile that
799// modifies a bookmark also changes the modification time, except for
800// g_bookmark_file_set_visited_date_time().
801func (x *BookmarkFile) SetModified(UriVar string, ModifiedVar int) {
802
803 xBookmarkFileSetModified(x.GoPointer(), UriVar, ModifiedVar)
804
805}
806
807var xBookmarkFileSetModifiedDateTime func(uintptr, string, *DateTime)
808
809// Sets the last time the bookmark for @uri was last modified.
810//
811// If no bookmark for @uri is found then it is created.
812//
813// The "modified" time should only be set when the bookmark's meta-data
814// was actually changed. Every function of #GBookmarkFile that
815// modifies a bookmark also changes the modification time, except for
816// g_bookmark_file_set_visited_date_time().
817func (x *BookmarkFile) SetModifiedDateTime(UriVar string, ModifiedVar *DateTime) {
818
819 xBookmarkFileSetModifiedDateTime(x.GoPointer(), UriVar, ModifiedVar)
820
821}
822
823var xBookmarkFileSetTitle func(uintptr, uintptr, string)
824
825// Sets @title as the title of the bookmark for @uri inside the
826// bookmark file @bookmark.
827//
828// If @uri is %NULL, the title of @bookmark is set.
829//
830// If a bookmark for @uri cannot be found then it is created.
831func (x *BookmarkFile) SetTitle(UriVar *string, TitleVar string) {
832
833 UriVarPtr := core.GStrdupNullable(UriVar)
834 defer core.GFreeNullable(UriVarPtr)
835
836 xBookmarkFileSetTitle(x.GoPointer(), UriVarPtr, TitleVar)
837
838}
839
840var xBookmarkFileSetVisited func(uintptr, string, int)
841
842// Sets the time the bookmark for @uri was last visited.
843//
844// If no bookmark for @uri is found then it is created.
845//
846// The "visited" time should only be set if the bookmark was launched,
847// either using the command line retrieved by g_bookmark_file_get_application_info()
848// or by the default application for the bookmark's MIME type, retrieved
849// using g_bookmark_file_get_mime_type(). Changing the "visited" time
850// does not affect the "modified" time.
851func (x *BookmarkFile) SetVisited(UriVar string, VisitedVar int) {
852
853 xBookmarkFileSetVisited(x.GoPointer(), UriVar, VisitedVar)
854
855}
856
857var xBookmarkFileSetVisitedDateTime func(uintptr, string, *DateTime)
858
859// Sets the time the bookmark for @uri was last visited.
860//
861// If no bookmark for @uri is found then it is created.
862//
863// The "visited" time should only be set if the bookmark was launched,
864// either using the command line retrieved by g_bookmark_file_get_application_info()
865// or by the default application for the bookmark's MIME type, retrieved
866// using g_bookmark_file_get_mime_type(). Changing the "visited" time
867// does not affect the "modified" time.
868func (x *BookmarkFile) SetVisitedDateTime(UriVar string, VisitedVar *DateTime) {
869
870 xBookmarkFileSetVisitedDateTime(x.GoPointer(), UriVar, VisitedVar)
871
872}
873
874var xBookmarkFileToData func(uintptr, *uint, **Error) uintptr
875
876// This function outputs @bookmark as a string.
877func (x *BookmarkFile) ToData(LengthVar *uint) (uintptr, error) {
878 var cerr *Error
879
880 cret := xBookmarkFileToData(x.GoPointer(), LengthVar, &cerr)
881 if cerr == nil {
882 return cret, nil
883 }
884 return cret, cerr
885
886}
887
888var xBookmarkFileToFile func(uintptr, string, **Error) bool
889
890// This function outputs @bookmark into a file. The write process is
891// guaranteed to be atomic by using g_file_set_contents() internally.
892func (x *BookmarkFile) ToFile(FilenameVar string) (bool, error) {
893 var cerr *Error
894
895 cret := xBookmarkFileToFile(x.GoPointer(), FilenameVar, &cerr)
896 if cerr == nil {
897 return cret, nil
898 }
899 return cret, cerr
900
901}
902
903// Error codes returned by bookmark file parsing.
904type BookmarkFileError int
905
906const (
907
908 // URI was ill-formed
909 GBookmarkFileErrorInvalidUriValue BookmarkFileError = 0
910 // a requested field was not found
911 GBookmarkFileErrorInvalidValueValue BookmarkFileError = 1
912 // a requested application did
913 // not register a bookmark
914 GBookmarkFileErrorAppNotRegisteredValue BookmarkFileError = 2
915 // a requested URI was not found
916 GBookmarkFileErrorUriNotFoundValue BookmarkFileError = 3
917 // document was ill formed
918 GBookmarkFileErrorReadValue BookmarkFileError = 4
919 // the text being parsed was
920 // in an unknown encoding
921 GBookmarkFileErrorUnknownEncodingValue BookmarkFileError = 5
922 // an error occurred while writing
923 GBookmarkFileErrorWriteValue BookmarkFileError = 6
924 // requested file was not found
925 GBookmarkFileErrorFileNotFoundValue BookmarkFileError = 7
926)
927
928func init() {
929 core.SetPackageName("GLIB", "glib-2.0")
930 core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
931 var libs []uintptr
932 for _, libPath := range core.GetPaths("GLIB") {
933 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
934 if err != nil {
935 panic(err)
936 }
937 libs = append(libs, lib)
938 }
939
940 core.PuregoSafeRegister(&xBookmarkFileGLibType, libs, "g_bookmark_file_get_type")
941
942 core.PuregoSafeRegister(&xNewBookmarkFile, libs, "g_bookmark_file_new")
943
944 core.PuregoSafeRegister(&xBookmarkFileAddApplication, libs, "g_bookmark_file_add_application")
945 core.PuregoSafeRegister(&xBookmarkFileAddGroup, libs, "g_bookmark_file_add_group")
946 core.PuregoSafeRegister(&xBookmarkFileCopy, libs, "g_bookmark_file_copy")
947 core.PuregoSafeRegister(&xBookmarkFileFree, libs, "g_bookmark_file_free")
948 core.PuregoSafeRegister(&xBookmarkFileGetAdded, libs, "g_bookmark_file_get_added")
949 core.PuregoSafeRegister(&xBookmarkFileGetAddedDateTime, libs, "g_bookmark_file_get_added_date_time")
950 core.PuregoSafeRegister(&xBookmarkFileGetAppInfo, libs, "g_bookmark_file_get_app_info")
951 core.PuregoSafeRegister(&xBookmarkFileGetApplicationInfo, libs, "g_bookmark_file_get_application_info")
952 core.PuregoSafeRegister(&xBookmarkFileGetApplications, libs, "g_bookmark_file_get_applications")
953 core.PuregoSafeRegister(&xBookmarkFileGetDescription, libs, "g_bookmark_file_get_description")
954 core.PuregoSafeRegister(&xBookmarkFileGetGroups, libs, "g_bookmark_file_get_groups")
955 core.PuregoSafeRegister(&xBookmarkFileGetIcon, libs, "g_bookmark_file_get_icon")
956 core.PuregoSafeRegister(&xBookmarkFileGetIsPrivate, libs, "g_bookmark_file_get_is_private")
957 core.PuregoSafeRegister(&xBookmarkFileGetMimeType, libs, "g_bookmark_file_get_mime_type")
958 core.PuregoSafeRegister(&xBookmarkFileGetModified, libs, "g_bookmark_file_get_modified")
959 core.PuregoSafeRegister(&xBookmarkFileGetModifiedDateTime, libs, "g_bookmark_file_get_modified_date_time")
960 core.PuregoSafeRegister(&xBookmarkFileGetSize, libs, "g_bookmark_file_get_size")
961 core.PuregoSafeRegister(&xBookmarkFileGetTitle, libs, "g_bookmark_file_get_title")
962 core.PuregoSafeRegister(&xBookmarkFileGetUris, libs, "g_bookmark_file_get_uris")
963 core.PuregoSafeRegister(&xBookmarkFileGetVisited, libs, "g_bookmark_file_get_visited")
964 core.PuregoSafeRegister(&xBookmarkFileGetVisitedDateTime, libs, "g_bookmark_file_get_visited_date_time")
965 core.PuregoSafeRegister(&xBookmarkFileHasApplication, libs, "g_bookmark_file_has_application")
966 core.PuregoSafeRegister(&xBookmarkFileHasGroup, libs, "g_bookmark_file_has_group")
967 core.PuregoSafeRegister(&xBookmarkFileHasItem, libs, "g_bookmark_file_has_item")
968 core.PuregoSafeRegister(&xBookmarkFileLoadFromData, libs, "g_bookmark_file_load_from_data")
969 core.PuregoSafeRegister(&xBookmarkFileLoadFromDataDirs, libs, "g_bookmark_file_load_from_data_dirs")
970 core.PuregoSafeRegister(&xBookmarkFileLoadFromFile, libs, "g_bookmark_file_load_from_file")
971 core.PuregoSafeRegister(&xBookmarkFileMoveItem, libs, "g_bookmark_file_move_item")
972 core.PuregoSafeRegister(&xBookmarkFileRemoveApplication, libs, "g_bookmark_file_remove_application")
973 core.PuregoSafeRegister(&xBookmarkFileRemoveGroup, libs, "g_bookmark_file_remove_group")
974 core.PuregoSafeRegister(&xBookmarkFileRemoveItem, libs, "g_bookmark_file_remove_item")
975 core.PuregoSafeRegister(&xBookmarkFileSetAdded, libs, "g_bookmark_file_set_added")
976 core.PuregoSafeRegister(&xBookmarkFileSetAddedDateTime, libs, "g_bookmark_file_set_added_date_time")
977 core.PuregoSafeRegister(&xBookmarkFileSetAppInfo, libs, "g_bookmark_file_set_app_info")
978 core.PuregoSafeRegister(&xBookmarkFileSetApplicationInfo, libs, "g_bookmark_file_set_application_info")
979 core.PuregoSafeRegister(&xBookmarkFileSetDescription, libs, "g_bookmark_file_set_description")
980 core.PuregoSafeRegister(&xBookmarkFileSetGroups, libs, "g_bookmark_file_set_groups")
981 core.PuregoSafeRegister(&xBookmarkFileSetIcon, libs, "g_bookmark_file_set_icon")
982 core.PuregoSafeRegister(&xBookmarkFileSetIsPrivate, libs, "g_bookmark_file_set_is_private")
983 core.PuregoSafeRegister(&xBookmarkFileSetMimeType, libs, "g_bookmark_file_set_mime_type")
984 core.PuregoSafeRegister(&xBookmarkFileSetModified, libs, "g_bookmark_file_set_modified")
985 core.PuregoSafeRegister(&xBookmarkFileSetModifiedDateTime, libs, "g_bookmark_file_set_modified_date_time")
986 core.PuregoSafeRegister(&xBookmarkFileSetTitle, libs, "g_bookmark_file_set_title")
987 core.PuregoSafeRegister(&xBookmarkFileSetVisited, libs, "g_bookmark_file_set_visited")
988 core.PuregoSafeRegister(&xBookmarkFileSetVisitedDateTime, libs, "g_bookmark_file_set_visited_date_time")
989 core.PuregoSafeRegister(&xBookmarkFileToData, libs, "g_bookmark_file_to_data")
990 core.PuregoSafeRegister(&xBookmarkFileToFile, libs, "g_bookmark_file_to_file")
991
992}