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 ThemedIconClass struct {
17 _ structs.HostLayout
18}
19
20func (x *ThemedIconClass) GoPointer() uintptr {
21 return uintptr(unsafe.Pointer(x))
22}
23
24// `GThemedIcon` is an implementation of [iface@Gio.Icon] that supports icon
25// themes.
26//
27// `GThemedIcon` contains a list of all of the icons present in an icon
28// theme, so that icons can be looked up quickly. `GThemedIcon` does
29// not provide actual pixmaps for icons, just the icon names.
30// Ideally something like [method@Gtk.IconTheme.choose_icon] should be used to
31// resolve the list of names so that fallback icons work nicely with
32// themes that inherit other themes.
33type ThemedIcon struct {
34 gobject.Object
35}
36
37var xThemedIconGLibType func() types.GType
38
39func ThemedIconGLibType() types.GType {
40 return xThemedIconGLibType()
41}
42
43func ThemedIconNewFromInternalPtr(ptr uintptr) *ThemedIcon {
44 cls := &ThemedIcon{}
45 cls.Ptr = ptr
46 return cls
47}
48
49var xNewThemedIcon func(string) uintptr
50
51// Creates a new themed icon for @iconname.
52func NewThemedIcon(IconnameVar string) *ThemedIcon {
53 var cls *ThemedIcon
54
55 cret := xNewThemedIcon(IconnameVar)
56
57 if cret == 0 {
58 return nil
59 }
60 cls = &ThemedIcon{}
61 cls.Ptr = cret
62 return cls
63}
64
65var xNewThemedIconFromNames func([]string, int) uintptr
66
67// Creates a new themed icon for @iconnames.
68func NewThemedIconFromNames(IconnamesVar []string, LenVar int) *ThemedIcon {
69 var cls *ThemedIcon
70
71 cret := xNewThemedIconFromNames(IconnamesVar, LenVar)
72
73 if cret == 0 {
74 return nil
75 }
76 cls = &ThemedIcon{}
77 cls.Ptr = cret
78 return cls
79}
80
81var xNewThemedIconWithDefaultFallbacks func(string) uintptr
82
83// Creates a new themed icon for @iconname, and all the names
84// that can be created by shortening @iconname at '-' characters.
85//
86// In the following example, @icon1 and @icon2 are equivalent:
87// |[<!-- language="C" -->
88//
89// const char *names[] = {
90// "gnome-dev-cdrom-audio",
91// "gnome-dev-cdrom",
92// "gnome-dev",
93// "gnome"
94// };
95//
96// icon1 = g_themed_icon_new_from_names (names, 4);
97// icon2 = g_themed_icon_new_with_default_fallbacks ("gnome-dev-cdrom-audio");
98// ]|
99func NewThemedIconWithDefaultFallbacks(IconnameVar string) *ThemedIcon {
100 var cls *ThemedIcon
101
102 cret := xNewThemedIconWithDefaultFallbacks(IconnameVar)
103
104 if cret == 0 {
105 return nil
106 }
107 cls = &ThemedIcon{}
108 cls.Ptr = cret
109 return cls
110}
111
112var xThemedIconAppendName func(uintptr, string)
113
114// Append a name to the list of icons from within @icon.
115//
116// Note that doing so invalidates the hash computed by prior calls
117// to g_icon_hash().
118func (x *ThemedIcon) AppendName(IconnameVar string) {
119
120 xThemedIconAppendName(x.GoPointer(), IconnameVar)
121
122}
123
124var xThemedIconGetNames func(uintptr) []string
125
126// Gets the names of icons from within @icon.
127func (x *ThemedIcon) GetNames() []string {
128
129 cret := xThemedIconGetNames(x.GoPointer())
130 return cret
131}
132
133var xThemedIconPrependName func(uintptr, string)
134
135// Prepend a name to the list of icons from within @icon.
136//
137// Note that doing so invalidates the hash computed by prior calls
138// to g_icon_hash().
139func (x *ThemedIcon) PrependName(IconnameVar string) {
140
141 xThemedIconPrependName(x.GoPointer(), IconnameVar)
142
143}
144
145func (c *ThemedIcon) GoPointer() uintptr {
146 if c == nil {
147 return 0
148 }
149 return c.Ptr
150}
151
152func (c *ThemedIcon) SetGoPointer(ptr uintptr) {
153 c.Ptr = ptr
154}
155
156// SetPropertyName sets the "name" property.
157// The icon name.
158func (x *ThemedIcon) SetPropertyName(value string) {
159 var v gobject.Value
160 v.Init(gobject.TypeStringVal)
161 v.SetString(&value)
162 x.SetProperty("name", &v)
163}
164
165// SetPropertyNames sets the "names" property.
166// A %NULL-terminated array of icon names.
167func (x *ThemedIcon) SetPropertyNames(value []string) {
168 var v gobject.Value
169 v.Init(glib.StrvGetType())
170 v.SetBoxed(uintptr(unsafe.Pointer(core.ByteSlice(value))))
171 x.SetProperty("names", &v)
172}
173
174// GetPropertyNames gets the "names" property.
175// A %NULL-terminated array of icon names.
176func (x *ThemedIcon) GetPropertyNames() []string {
177 var v gobject.Value
178 x.GetProperty("names", &v)
179 return core.GoStringSlice(v.GetBoxed())
180}
181
182// SetPropertyUseDefaultFallbacks sets the "use-default-fallbacks" property.
183// Whether to use the default fallbacks found by shortening the icon name
184// at '-' characters. If the "names" array has more than one element,
185// ignores any past the first.
186//
187// For example, if the icon name was "gnome-dev-cdrom-audio", the array
188// would become
189// |[<!-- language="C" -->
190//
191// {
192// "gnome-dev-cdrom-audio",
193// "gnome-dev-cdrom",
194// "gnome-dev",
195// "gnome",
196// NULL
197// };
198//
199// ]|
200func (x *ThemedIcon) SetPropertyUseDefaultFallbacks(value bool) {
201 var v gobject.Value
202 v.Init(gobject.TypeBooleanVal)
203 v.SetBoolean(value)
204 x.SetProperty("use-default-fallbacks", &v)
205}
206
207// GetPropertyUseDefaultFallbacks gets the "use-default-fallbacks" property.
208// Whether to use the default fallbacks found by shortening the icon name
209// at '-' characters. If the "names" array has more than one element,
210// ignores any past the first.
211//
212// For example, if the icon name was "gnome-dev-cdrom-audio", the array
213// would become
214// |[<!-- language="C" -->
215//
216// {
217// "gnome-dev-cdrom-audio",
218// "gnome-dev-cdrom",
219// "gnome-dev",
220// "gnome",
221// NULL
222// };
223//
224// ]|
225func (x *ThemedIcon) GetPropertyUseDefaultFallbacks() bool {
226 var v gobject.Value
227 x.GetProperty("use-default-fallbacks", &v)
228 return v.GetBoolean()
229}
230
231// Checks if two icons are equal.
232func (x *ThemedIcon) Equal(Icon2Var Icon) bool {
233
234 cret := XGIconEqual(x.GoPointer(), Icon2Var.GoPointer())
235 return cret
236}
237
238// Gets a hash for an icon.
239func (x *ThemedIcon) Hash() uint {
240
241 cret := XGIconHash(x.GoPointer())
242 return cret
243}
244
245// Serializes a #GIcon into a #GVariant. An equivalent #GIcon can be retrieved
246// back by calling g_icon_deserialize() on the returned value.
247// As serialization will avoid using raw icon data when possible, it only
248// makes sense to transfer the #GVariant between processes on the same machine,
249// (as opposed to over the network), and within the same file system namespace.
250func (x *ThemedIcon) Serialize() *glib.Variant {
251
252 cret := XGIconSerialize(x.GoPointer())
253 return cret
254}
255
256// Generates a textual representation of @icon that can be used for
257// serialization such as when passing @icon to a different process or
258// saving it to persistent storage. Use g_icon_new_for_string() to
259// get @icon back from the returned string.
260//
261// The encoding of the returned string is proprietary to #GIcon except
262// in the following two cases
263//
264// - If @icon is a #GFileIcon, the returned string is a native path
265// (such as `/path/to/my icon.png`) without escaping
266// if the #GFile for @icon is a native file. If the file is not
267// native, the returned string is the result of g_file_get_uri()
268// (such as `sftp://path/to/my%20icon.png`).
269//
270// - If @icon is a #GThemedIcon with exactly one name and no fallbacks,
271// the encoding is simply the name (such as `network-server`).
272func (x *ThemedIcon) ToString() string {
273
274 cret := XGIconToString(x.GoPointer())
275 return cret
276}
277
278func init() {
279 core.SetPackageName("GIO", "gio-2.0")
280 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
281 var libs []uintptr
282 for _, libPath := range core.GetPaths("GIO") {
283 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
284 if err != nil {
285 panic(err)
286 }
287 libs = append(libs, lib)
288 }
289
290 core.PuregoSafeRegister(&xThemedIconGLibType, libs, "g_themed_icon_get_type")
291
292 core.PuregoSafeRegister(&xNewThemedIcon, libs, "g_themed_icon_new")
293 core.PuregoSafeRegister(&xNewThemedIconFromNames, libs, "g_themed_icon_new_from_names")
294 core.PuregoSafeRegister(&xNewThemedIconWithDefaultFallbacks, libs, "g_themed_icon_new_with_default_fallbacks")
295
296 core.PuregoSafeRegister(&xThemedIconAppendName, libs, "g_themed_icon_append_name")
297 core.PuregoSafeRegister(&xThemedIconGetNames, libs, "g_themed_icon_get_names")
298 core.PuregoSafeRegister(&xThemedIconPrependName, libs, "g_themed_icon_prepend_name")
299
300}