// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gio import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) type FileIconClass struct { _ structs.HostLayout } func (x *FileIconClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // `GFileIcon` specifies an icon by pointing to an image file // to be used as icon. // // It implements [iface@Gio.LoadableIcon]. type FileIcon struct { gobject.Object } var xFileIconGLibType func() types.GType func FileIconGLibType() types.GType { return xFileIconGLibType() } func FileIconNewFromInternalPtr(ptr uintptr) *FileIcon { cls := &FileIcon{} cls.Ptr = ptr return cls } var xNewFileIcon func(uintptr) uintptr // Creates a new icon for a file. func NewFileIcon(FileVar File) *FileIcon { var cls *FileIcon cret := xNewFileIcon(FileVar.GoPointer()) if cret == 0 { return nil } cls = &FileIcon{} cls.Ptr = cret return cls } var xFileIconGetFile func(uintptr) uintptr // Gets the #GFile associated with the given @icon. func (x *FileIcon) GetFile() *FileBase { var cls *FileBase cret := xFileIconGetFile(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &FileBase{} cls.Ptr = cret return cls } func (c *FileIcon) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *FileIcon) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // Checks if two icons are equal. func (x *FileIcon) Equal(Icon2Var Icon) bool { cret := XGIconEqual(x.GoPointer(), Icon2Var.GoPointer()) return cret } // Gets a hash for an icon. func (x *FileIcon) Hash() uint { cret := XGIconHash(x.GoPointer()) return cret } // Serializes a #GIcon into a #GVariant. An equivalent #GIcon can be retrieved // back by calling g_icon_deserialize() on the returned value. // As serialization will avoid using raw icon data when possible, it only // makes sense to transfer the #GVariant between processes on the same machine, // (as opposed to over the network), and within the same file system namespace. func (x *FileIcon) Serialize() *glib.Variant { cret := XGIconSerialize(x.GoPointer()) return cret } // Generates a textual representation of @icon that can be used for // serialization such as when passing @icon to a different process or // saving it to persistent storage. Use g_icon_new_for_string() to // get @icon back from the returned string. // // The encoding of the returned string is proprietary to #GIcon except // in the following two cases // // - If @icon is a #GFileIcon, the returned string is a native path // (such as `/path/to/my icon.png`) without escaping // if the #GFile for @icon is a native file. If the file is not // native, the returned string is the result of g_file_get_uri() // (such as `sftp://path/to/my%20icon.png`). // // - If @icon is a #GThemedIcon with exactly one name and no fallbacks, // the encoding is simply the name (such as `network-server`). func (x *FileIcon) ToString() string { cret := XGIconToString(x.GoPointer()) return cret } // Loads a loadable icon. For the asynchronous version of this function, // see g_loadable_icon_load_async(). func (x *FileIcon) Load(SizeVar int, TypeVar *string, CancellableVar *Cancellable) (*InputStream, error) { var cls *InputStream var cerr *glib.Error cret := XGLoadableIconLoad(x.GoPointer(), SizeVar, TypeVar, CancellableVar.GoPointer(), &cerr) if cret == 0 { return nil, cerr } cls = &InputStream{} cls.Ptr = cret if cerr == nil { return cls, nil } return cls, cerr } // Loads an icon asynchronously. To finish this function, see // g_loadable_icon_load_finish(). For the synchronous, blocking // version of this function, see g_loadable_icon_load(). func (x *FileIcon) LoadAsync(SizeVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { XGLoadableIconLoadAsync(x.GoPointer(), SizeVar, CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar) } // Finishes an asynchronous icon load started in g_loadable_icon_load_async(). func (x *FileIcon) LoadFinish(ResVar AsyncResult, TypeVar *string) (*InputStream, error) { var cls *InputStream var cerr *glib.Error cret := XGLoadableIconLoadFinish(x.GoPointer(), ResVar.GoPointer(), TypeVar, &cerr) if cret == 0 { return nil, cerr } cls = &InputStream{} cls.Ptr = cret if cerr == nil { return cls, nil } return cls, cerr } func init() { core.SetPackageName("GIO", "gio-2.0") core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"}) var libs []uintptr for _, libPath := range core.GetPaths("GIO") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xFileIconGLibType, libs, "g_file_icon_get_type") core.PuregoSafeRegister(&xNewFileIcon, libs, "g_file_icon_new") core.PuregoSafeRegister(&xFileIconGetFile, libs, "g_file_icon_get_file") }