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
16// Class structure for #GTlsPassword.
17type TlsPasswordClass struct {
18 _ structs.HostLayout
19
20 ParentClass gobject.ObjectClass
21
22 xGetValue uintptr
23
24 xSetValue uintptr
25
26 xGetDefaultWarning uintptr
27
28 Padding [4]uintptr
29}
30
31func (x *TlsPasswordClass) GoPointer() uintptr {
32 return uintptr(unsafe.Pointer(x))
33}
34
35// OverrideGetValue sets the "get_value" callback function.
36// virtual method for g_tls_password_get_value()
37func (x *TlsPasswordClass) OverrideGetValue(cb func(*TlsPassword, *uint) uintptr) {
38 if cb == nil {
39 x.xGetValue = 0
40 } else {
41 x.xGetValue = purego.NewCallback(func(PasswordVarp uintptr, LengthVarp *uint) uintptr {
42 return cb(TlsPasswordNewFromInternalPtr(PasswordVarp), LengthVarp)
43 })
44 }
45}
46
47// GetGetValue gets the "get_value" callback function.
48// virtual method for g_tls_password_get_value()
49func (x *TlsPasswordClass) GetGetValue() func(*TlsPassword, *uint) uintptr {
50 if x.xGetValue == 0 {
51 return nil
52 }
53 var rawCallback func(PasswordVarp uintptr, LengthVarp *uint) uintptr
54 purego.RegisterFunc(&rawCallback, x.xGetValue)
55 return func(PasswordVar *TlsPassword, LengthVar *uint) uintptr {
56 return rawCallback(PasswordVar.GoPointer(), LengthVar)
57 }
58}
59
60// OverrideSetValue sets the "set_value" callback function.
61// virtual method for g_tls_password_set_value()
62func (x *TlsPasswordClass) OverrideSetValue(cb func(*TlsPassword, []byte, int, *glib.DestroyNotify)) {
63 if cb == nil {
64 x.xSetValue = 0
65 } else {
66 x.xSetValue = purego.NewCallback(func(PasswordVarp uintptr, ValueVarp []byte, LengthVarp int, DestroyVarp uintptr) {
67 cb(TlsPasswordNewFromInternalPtr(PasswordVarp), ValueVarp, LengthVarp, (*glib.DestroyNotify)(unsafe.Pointer(DestroyVarp)))
68 })
69 }
70}
71
72// GetSetValue gets the "set_value" callback function.
73// virtual method for g_tls_password_set_value()
74func (x *TlsPasswordClass) GetSetValue() func(*TlsPassword, []byte, int, *glib.DestroyNotify) {
75 if x.xSetValue == 0 {
76 return nil
77 }
78 var rawCallback func(PasswordVarp uintptr, ValueVarp []byte, LengthVarp int, DestroyVarp uintptr)
79 purego.RegisterFunc(&rawCallback, x.xSetValue)
80 return func(PasswordVar *TlsPassword, ValueVar []byte, LengthVar int, DestroyVar *glib.DestroyNotify) {
81 rawCallback(PasswordVar.GoPointer(), ValueVar, LengthVar, glib.NewCallbackNullable(DestroyVar))
82 }
83}
84
85// OverrideGetDefaultWarning sets the "get_default_warning" callback function.
86// virtual method for g_tls_password_get_warning() if no
87//
88// value has been set using g_tls_password_set_warning()
89func (x *TlsPasswordClass) OverrideGetDefaultWarning(cb func(*TlsPassword) string) {
90 if cb == nil {
91 x.xGetDefaultWarning = 0
92 } else {
93 x.xGetDefaultWarning = purego.NewCallback(func(PasswordVarp uintptr) string {
94 return cb(TlsPasswordNewFromInternalPtr(PasswordVarp))
95 })
96 }
97}
98
99// GetGetDefaultWarning gets the "get_default_warning" callback function.
100// virtual method for g_tls_password_get_warning() if no
101//
102// value has been set using g_tls_password_set_warning()
103func (x *TlsPasswordClass) GetGetDefaultWarning() func(*TlsPassword) string {
104 if x.xGetDefaultWarning == 0 {
105 return nil
106 }
107 var rawCallback func(PasswordVarp uintptr) string
108 purego.RegisterFunc(&rawCallback, x.xGetDefaultWarning)
109 return func(PasswordVar *TlsPassword) string {
110 return rawCallback(PasswordVar.GoPointer())
111 }
112}
113
114type TlsPasswordPrivate struct {
115 _ structs.HostLayout
116}
117
118func (x *TlsPasswordPrivate) GoPointer() uintptr {
119 return uintptr(unsafe.Pointer(x))
120}
121
122// An abstract interface representing a password used in TLS. Often used in
123// user interaction such as unlocking a key storage token.
124type TlsPassword struct {
125 gobject.Object
126}
127
128var xTlsPasswordGLibType func() types.GType
129
130func TlsPasswordGLibType() types.GType {
131 return xTlsPasswordGLibType()
132}
133
134func TlsPasswordNewFromInternalPtr(ptr uintptr) *TlsPassword {
135 cls := &TlsPassword{}
136 cls.Ptr = ptr
137 return cls
138}
139
140var xNewTlsPassword func(TlsPasswordFlags, string) uintptr
141
142// Create a new #GTlsPassword object.
143func NewTlsPassword(FlagsVar TlsPasswordFlags, DescriptionVar string) *TlsPassword {
144 var cls *TlsPassword
145
146 cret := xNewTlsPassword(FlagsVar, DescriptionVar)
147
148 if cret == 0 {
149 return nil
150 }
151 cls = &TlsPassword{}
152 cls.Ptr = cret
153 return cls
154}
155
156var xTlsPasswordGetDescription func(uintptr) string
157
158// Get a description string about what the password will be used for.
159func (x *TlsPassword) GetDescription() string {
160
161 cret := xTlsPasswordGetDescription(x.GoPointer())
162 return cret
163}
164
165var xTlsPasswordGetFlags func(uintptr) TlsPasswordFlags
166
167// Get flags about the password.
168func (x *TlsPassword) GetFlags() TlsPasswordFlags {
169
170 cret := xTlsPasswordGetFlags(x.GoPointer())
171 return cret
172}
173
174var xTlsPasswordGetValue func(uintptr, *uint) uintptr
175
176// Get the password value. If @length is not %NULL then it will be
177// filled in with the length of the password value. (Note that the
178// password value is not nul-terminated, so you can only pass %NULL
179// for @length in contexts where you know the password will have a
180// certain fixed length.)
181func (x *TlsPassword) GetValue(LengthVar *uint) uintptr {
182
183 cret := xTlsPasswordGetValue(x.GoPointer(), LengthVar)
184 return cret
185}
186
187var xTlsPasswordGetWarning func(uintptr) string
188
189// Get a user readable translated warning. Usually this warning is a
190// representation of the password flags returned from
191// g_tls_password_get_flags().
192func (x *TlsPassword) GetWarning() string {
193
194 cret := xTlsPasswordGetWarning(x.GoPointer())
195 return cret
196}
197
198var xTlsPasswordSetDescription func(uintptr, string)
199
200// Set a description string about what the password will be used for.
201func (x *TlsPassword) SetDescription(DescriptionVar string) {
202
203 xTlsPasswordSetDescription(x.GoPointer(), DescriptionVar)
204
205}
206
207var xTlsPasswordSetFlags func(uintptr, TlsPasswordFlags)
208
209// Set flags about the password.
210func (x *TlsPassword) SetFlags(FlagsVar TlsPasswordFlags) {
211
212 xTlsPasswordSetFlags(x.GoPointer(), FlagsVar)
213
214}
215
216var xTlsPasswordSetValue func(uintptr, []byte, int)
217
218// Set the value for this password. The @value will be copied by the password
219// object.
220//
221// Specify the @length, for a non-nul-terminated password. Pass -1 as
222// @length if using a nul-terminated password, and @length will be
223// calculated automatically. (Note that the terminating nul is not
224// considered part of the password in this case.)
225func (x *TlsPassword) SetValue(ValueVar []byte, LengthVar int) {
226
227 xTlsPasswordSetValue(x.GoPointer(), ValueVar, LengthVar)
228
229}
230
231var xTlsPasswordSetValueFull func(uintptr, []byte, int, uintptr)
232
233// Provide the value for this password.
234//
235// The @value will be owned by the password object, and later freed using
236// the @destroy function callback.
237//
238// Specify the @length, for a non-nul-terminated password. Pass -1 as
239// @length if using a nul-terminated password, and @length will be
240// calculated automatically. (Note that the terminating nul is not
241// considered part of the password in this case.)
242func (x *TlsPassword) SetValueFull(ValueVar []byte, LengthVar int, DestroyVar *glib.DestroyNotify) {
243
244 var DestroyVarRef uintptr
245 if DestroyVar != nil {
246 DestroyVarPtr := uintptr(unsafe.Pointer(DestroyVar))
247 if cbRefPtr, ok := glib.GetCallback(DestroyVarPtr); ok {
248 DestroyVarRef = cbRefPtr
249 } else {
250 fcb := func(arg0 uintptr) {
251 cbFn := *DestroyVar
252 cbFn(arg0)
253 }
254 DestroyVarRef = purego.NewCallback(fcb)
255 glib.SaveCallbackWithClosure(DestroyVarPtr, DestroyVarRef, DestroyVar)
256 }
257 }
258
259 xTlsPasswordSetValueFull(x.GoPointer(), ValueVar, LengthVar, DestroyVarRef)
260
261}
262
263var xTlsPasswordSetWarning func(uintptr, string)
264
265// Set a user readable translated warning. Usually this warning is a
266// representation of the password flags returned from
267// g_tls_password_get_flags().
268func (x *TlsPassword) SetWarning(WarningVar string) {
269
270 xTlsPasswordSetWarning(x.GoPointer(), WarningVar)
271
272}
273
274func (c *TlsPassword) GoPointer() uintptr {
275 if c == nil {
276 return 0
277 }
278 return c.Ptr
279}
280
281func (c *TlsPassword) SetGoPointer(ptr uintptr) {
282 c.Ptr = ptr
283}
284
285// SetPropertyDescription sets the "description" property.
286// Description of what the password is for.
287func (x *TlsPassword) SetPropertyDescription(value string) {
288 var v gobject.Value
289 v.Init(gobject.TypeStringVal)
290 v.SetString(&value)
291 x.SetProperty("description", &v)
292}
293
294// GetPropertyDescription gets the "description" property.
295// Description of what the password is for.
296func (x *TlsPassword) GetPropertyDescription() string {
297 var v gobject.Value
298 x.GetProperty("description", &v)
299 return v.GetString()
300}
301
302// SetPropertyWarning sets the "warning" property.
303// Warning about the password.
304func (x *TlsPassword) SetPropertyWarning(value string) {
305 var v gobject.Value
306 v.Init(gobject.TypeStringVal)
307 v.SetString(&value)
308 x.SetProperty("warning", &v)
309}
310
311// GetPropertyWarning gets the "warning" property.
312// Warning about the password.
313func (x *TlsPassword) GetPropertyWarning() string {
314 var v gobject.Value
315 x.GetProperty("warning", &v)
316 return v.GetString()
317}
318
319func init() {
320 core.SetPackageName("GIO", "gio-2.0")
321 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
322 var libs []uintptr
323 for _, libPath := range core.GetPaths("GIO") {
324 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
325 if err != nil {
326 panic(err)
327 }
328 libs = append(libs, lib)
329 }
330
331 core.PuregoSafeRegister(&xTlsPasswordGLibType, libs, "g_tls_password_get_type")
332
333 core.PuregoSafeRegister(&xNewTlsPassword, libs, "g_tls_password_new")
334
335 core.PuregoSafeRegister(&xTlsPasswordGetDescription, libs, "g_tls_password_get_description")
336 core.PuregoSafeRegister(&xTlsPasswordGetFlags, libs, "g_tls_password_get_flags")
337 core.PuregoSafeRegister(&xTlsPasswordGetValue, libs, "g_tls_password_get_value")
338 core.PuregoSafeRegister(&xTlsPasswordGetWarning, libs, "g_tls_password_get_warning")
339 core.PuregoSafeRegister(&xTlsPasswordSetDescription, libs, "g_tls_password_set_description")
340 core.PuregoSafeRegister(&xTlsPasswordSetFlags, libs, "g_tls_password_set_flags")
341 core.PuregoSafeRegister(&xTlsPasswordSetValue, libs, "g_tls_password_set_value")
342 core.PuregoSafeRegister(&xTlsPasswordSetValueFull, libs, "g_tls_password_set_value_full")
343 core.PuregoSafeRegister(&xTlsPasswordSetWarning, libs, "g_tls_password_set_warning")
344
345}