gemblem.go RawHistoryFolder
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
16type EmblemClass struct {
17 _ structs.HostLayout
18}
19
20func (x *EmblemClass) GoPointer() uintptr {
21 return uintptr(unsafe.Pointer(x))
22}
23
24// `GEmblem` is an implementation of [iface@Gio.Icon] that supports
25// having an emblem, which is an icon with additional properties.
26// It can than be added to a [class@Gio.EmblemedIcon].
27//
28// Currently, only metainformation about the emblem's origin is
29// supported. More may be added in the future.
30type Emblem struct {
31 gobject.Object
32}
33
34var xEmblemGLibType func() types.GType
35
36func EmblemGLibType() types.GType {
37 return xEmblemGLibType()
38}
39
40func EmblemNewFromInternalPtr(ptr uintptr) *Emblem {
41 cls := &Emblem{}
42 cls.Ptr = ptr
43 return cls
44}
45
46var xNewEmblem func(uintptr) uintptr
47
48// Creates a new emblem for @icon.
49func NewEmblem(IconVar Icon) *Emblem {
50 var cls *Emblem
51
52 cret := xNewEmblem(IconVar.GoPointer())
53
54 if cret == 0 {
55 return nil
56 }
57 cls = &Emblem{}
58 cls.Ptr = cret
59 return cls
60}
61
62var xNewEmblemWithOrigin func(uintptr, EmblemOrigin) uintptr
63
64// Creates a new emblem for @icon.
65func NewEmblemWithOrigin(IconVar Icon, OriginVar EmblemOrigin) *Emblem {
66 var cls *Emblem
67
68 cret := xNewEmblemWithOrigin(IconVar.GoPointer(), OriginVar)
69
70 if cret == 0 {
71 return nil
72 }
73 cls = &Emblem{}
74 cls.Ptr = cret
75 return cls
76}
77
78var xEmblemGetIcon func(uintptr) uintptr
79
80// Gives back the icon from @emblem.
81func (x *Emblem) GetIcon() *IconBase {
82 var cls *IconBase
83
84 cret := xEmblemGetIcon(x.GoPointer())
85
86 if cret == 0 {
87 return nil
88 }
89 gobject.IncreaseRef(cret)
90 cls = &IconBase{}
91 cls.Ptr = cret
92 return cls
93}
94
95var xEmblemGetOrigin func(uintptr) EmblemOrigin
96
97// Gets the origin of the emblem.
98func (x *Emblem) GetOrigin() EmblemOrigin {
99
100 cret := xEmblemGetOrigin(x.GoPointer())
101 return cret
102}
103
104func (c *Emblem) GoPointer() uintptr {
105 if c == nil {
106 return 0
107 }
108 return c.Ptr
109}
110
111func (c *Emblem) SetGoPointer(ptr uintptr) {
112 c.Ptr = ptr
113}
114
115// Checks if two icons are equal.
116func (x *Emblem) Equal(Icon2Var Icon) bool {
117
118 cret := XGIconEqual(x.GoPointer(), Icon2Var.GoPointer())
119 return cret
120}
121
122// Gets a hash for an icon.
123func (x *Emblem) Hash() uint {
124
125 cret := XGIconHash(x.GoPointer())
126 return cret
127}
128
129// Serializes a #GIcon into a #GVariant. An equivalent #GIcon can be retrieved
130// back by calling g_icon_deserialize() on the returned value.
131// As serialization will avoid using raw icon data when possible, it only
132// makes sense to transfer the #GVariant between processes on the same machine,
133// (as opposed to over the network), and within the same file system namespace.
134func (x *Emblem) Serialize() *glib.Variant {
135
136 cret := XGIconSerialize(x.GoPointer())
137 return cret
138}
139
140// Generates a textual representation of @icon that can be used for
141// serialization such as when passing @icon to a different process or
142// saving it to persistent storage. Use g_icon_new_for_string() to
143// get @icon back from the returned string.
144//
145// The encoding of the returned string is proprietary to #GIcon except
146// in the following two cases
147//
148// - If @icon is a #GFileIcon, the returned string is a native path
149// (such as `/path/to/my icon.png`) without escaping
150// if the #GFile for @icon is a native file. If the file is not
151// native, the returned string is the result of g_file_get_uri()
152// (such as `sftp://path/to/my%20icon.png`).
153//
154// - If @icon is a #GThemedIcon with exactly one name and no fallbacks,
155// the encoding is simply the name (such as `network-server`).
156func (x *Emblem) ToString() string {
157
158 cret := XGIconToString(x.GoPointer())
159 return cret
160}
161
162func init() {
163 core.SetPackageName("GIO", "gio-2.0")
164 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
165 var libs []uintptr
166 for _, libPath := range core.GetPaths("GIO") {
167 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
168 if err != nil {
169 panic(err)
170 }
171 libs = append(libs, lib)
172 }
173
174 core.PuregoSafeRegister(&xEmblemGLibType, libs, "g_emblem_get_type")
175
176 core.PuregoSafeRegister(&xNewEmblem, libs, "g_emblem_new")
177 core.PuregoSafeRegister(&xNewEmblemWithOrigin, libs, "g_emblem_new_with_origin")
178
179 core.PuregoSafeRegister(&xEmblemGetIcon, libs, "g_emblem_get_icon")
180 core.PuregoSafeRegister(&xEmblemGetOrigin, libs, "g_emblem_get_origin")
181
182}