// 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 ThemedIconClass struct { _ structs.HostLayout } func (x *ThemedIconClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // `GThemedIcon` is an implementation of [iface@Gio.Icon] that supports icon // themes. // // `GThemedIcon` contains a list of all of the icons present in an icon // theme, so that icons can be looked up quickly. `GThemedIcon` does // not provide actual pixmaps for icons, just the icon names. // Ideally something like [method@Gtk.IconTheme.choose_icon] should be used to // resolve the list of names so that fallback icons work nicely with // themes that inherit other themes. type ThemedIcon struct { gobject.Object } var xThemedIconGLibType func() types.GType func ThemedIconGLibType() types.GType { return xThemedIconGLibType() } func ThemedIconNewFromInternalPtr(ptr uintptr) *ThemedIcon { cls := &ThemedIcon{} cls.Ptr = ptr return cls } var xNewThemedIcon func(string) uintptr // Creates a new themed icon for @iconname. func NewThemedIcon(IconnameVar string) *ThemedIcon { var cls *ThemedIcon cret := xNewThemedIcon(IconnameVar) if cret == 0 { return nil } cls = &ThemedIcon{} cls.Ptr = cret return cls } var xNewThemedIconFromNames func([]string, int) uintptr // Creates a new themed icon for @iconnames. func NewThemedIconFromNames(IconnamesVar []string, LenVar int) *ThemedIcon { var cls *ThemedIcon cret := xNewThemedIconFromNames(IconnamesVar, LenVar) if cret == 0 { return nil } cls = &ThemedIcon{} cls.Ptr = cret return cls } var xNewThemedIconWithDefaultFallbacks func(string) uintptr // Creates a new themed icon for @iconname, and all the names // that can be created by shortening @iconname at '-' characters. // // In the following example, @icon1 and @icon2 are equivalent: // |[<!-- language="C" --> // // const char *names[] = { // "gnome-dev-cdrom-audio", // "gnome-dev-cdrom", // "gnome-dev", // "gnome" // }; // // icon1 = g_themed_icon_new_from_names (names, 4); // icon2 = g_themed_icon_new_with_default_fallbacks ("gnome-dev-cdrom-audio"); // ]| func NewThemedIconWithDefaultFallbacks(IconnameVar string) *ThemedIcon { var cls *ThemedIcon cret := xNewThemedIconWithDefaultFallbacks(IconnameVar) if cret == 0 { return nil } cls = &ThemedIcon{} cls.Ptr = cret return cls } var xThemedIconAppendName func(uintptr, string) // Append a name to the list of icons from within @icon. // // Note that doing so invalidates the hash computed by prior calls // to g_icon_hash(). func (x *ThemedIcon) AppendName(IconnameVar string) { xThemedIconAppendName(x.GoPointer(), IconnameVar) } var xThemedIconGetNames func(uintptr) []string // Gets the names of icons from within @icon. func (x *ThemedIcon) GetNames() []string { cret := xThemedIconGetNames(x.GoPointer()) return cret } var xThemedIconPrependName func(uintptr, string) // Prepend a name to the list of icons from within @icon. // // Note that doing so invalidates the hash computed by prior calls // to g_icon_hash(). func (x *ThemedIcon) PrependName(IconnameVar string) { xThemedIconPrependName(x.GoPointer(), IconnameVar) } func (c *ThemedIcon) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *ThemedIcon) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyName sets the "name" property. // The icon name. func (x *ThemedIcon) SetPropertyName(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("name", &v) } // SetPropertyNames sets the "names" property. // A %NULL-terminated array of icon names. func (x *ThemedIcon) SetPropertyNames(value []string) { var v gobject.Value v.Init(glib.StrvGetType()) v.SetBoxed(uintptr(unsafe.Pointer(core.ByteSlice(value)))) x.SetProperty("names", &v) } // GetPropertyNames gets the "names" property. // A %NULL-terminated array of icon names. func (x *ThemedIcon) GetPropertyNames() []string { var v gobject.Value x.GetProperty("names", &v) return core.GoStringSlice(v.GetBoxed()) } // SetPropertyUseDefaultFallbacks sets the "use-default-fallbacks" property. // Whether to use the default fallbacks found by shortening the icon name // at '-' characters. If the "names" array has more than one element, // ignores any past the first. // // For example, if the icon name was "gnome-dev-cdrom-audio", the array // would become // |[<!-- language="C" --> // // { // "gnome-dev-cdrom-audio", // "gnome-dev-cdrom", // "gnome-dev", // "gnome", // NULL // }; // // ]| func (x *ThemedIcon) SetPropertyUseDefaultFallbacks(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("use-default-fallbacks", &v) } // GetPropertyUseDefaultFallbacks gets the "use-default-fallbacks" property. // Whether to use the default fallbacks found by shortening the icon name // at '-' characters. If the "names" array has more than one element, // ignores any past the first. // // For example, if the icon name was "gnome-dev-cdrom-audio", the array // would become // |[<!-- language="C" --> // // { // "gnome-dev-cdrom-audio", // "gnome-dev-cdrom", // "gnome-dev", // "gnome", // NULL // }; // // ]| func (x *ThemedIcon) GetPropertyUseDefaultFallbacks() bool { var v gobject.Value x.GetProperty("use-default-fallbacks", &v) return v.GetBoolean() } // Checks if two icons are equal. func (x *ThemedIcon) Equal(Icon2Var Icon) bool { cret := XGIconEqual(x.GoPointer(), Icon2Var.GoPointer()) return cret } // Gets a hash for an icon. func (x *ThemedIcon) 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 *ThemedIcon) 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 *ThemedIcon) ToString() string { cret := XGIconToString(x.GoPointer()) return cret } 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(&xThemedIconGLibType, libs, "g_themed_icon_get_type") core.PuregoSafeRegister(&xNewThemedIcon, libs, "g_themed_icon_new") core.PuregoSafeRegister(&xNewThemedIconFromNames, libs, "g_themed_icon_new_from_names") core.PuregoSafeRegister(&xNewThemedIconWithDefaultFallbacks, libs, "g_themed_icon_new_with_default_fallbacks") core.PuregoSafeRegister(&xThemedIconAppendName, libs, "g_themed_icon_append_name") core.PuregoSafeRegister(&xThemedIconGetNames, libs, "g_themed_icon_get_names") core.PuregoSafeRegister(&xThemedIconPrependName, libs, "g_themed_icon_prepend_name") }