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// The class for #GTlsInteraction. Derived classes implement the various
17// virtual interaction methods to handle TLS interactions.
18//
19// Derived classes can choose to implement whichever interactions methods they'd
20// like to support by overriding those virtual methods in their class
21// initialization function. If a derived class implements an async method,
22// it must also implement the corresponding finish method.
23//
24// The synchronous interaction methods should implement to display modal dialogs,
25// and the asynchronous methods to display modeless dialogs.
26//
27// If the user cancels an interaction, then the result should be
28// %G_TLS_INTERACTION_FAILED and the error should be set with a domain of
29// %G_IO_ERROR and code of %G_IO_ERROR_CANCELLED.
30type TlsInteractionClass struct {
31 _ structs.HostLayout
32
33 ParentClass gobject.ObjectClass
34
35 xAskPassword uintptr
36
37 xAskPasswordAsync uintptr
38
39 xAskPasswordFinish uintptr
40
41 xRequestCertificate uintptr
42
43 xRequestCertificateAsync uintptr
44
45 xRequestCertificateFinish uintptr
46
47 Padding [21]uintptr
48}
49
50func (x *TlsInteractionClass) GoPointer() uintptr {
51 return uintptr(unsafe.Pointer(x))
52}
53
54// OverrideAskPassword sets the "ask_password" callback function.
55// ask for a password synchronously. If the implementation
56//
57// returns %G_TLS_INTERACTION_HANDLED, then the password argument should
58// have been filled in by using g_tls_password_set_value() or a similar
59// function.
60func (x *TlsInteractionClass) OverrideAskPassword(cb func(*TlsInteraction, *TlsPassword, *Cancellable) TlsInteractionResult) {
61 if cb == nil {
62 x.xAskPassword = 0
63 } else {
64 x.xAskPassword = purego.NewCallback(func(InteractionVarp uintptr, PasswordVarp uintptr, CancellableVarp uintptr) TlsInteractionResult {
65 return cb(TlsInteractionNewFromInternalPtr(InteractionVarp), TlsPasswordNewFromInternalPtr(PasswordVarp), CancellableNewFromInternalPtr(CancellableVarp))
66 })
67 }
68}
69
70// GetAskPassword gets the "ask_password" callback function.
71// ask for a password synchronously. If the implementation
72//
73// returns %G_TLS_INTERACTION_HANDLED, then the password argument should
74// have been filled in by using g_tls_password_set_value() or a similar
75// function.
76func (x *TlsInteractionClass) GetAskPassword() func(*TlsInteraction, *TlsPassword, *Cancellable) TlsInteractionResult {
77 if x.xAskPassword == 0 {
78 return nil
79 }
80 var rawCallback func(InteractionVarp uintptr, PasswordVarp uintptr, CancellableVarp uintptr) TlsInteractionResult
81 purego.RegisterFunc(&rawCallback, x.xAskPassword)
82 return func(InteractionVar *TlsInteraction, PasswordVar *TlsPassword, CancellableVar *Cancellable) TlsInteractionResult {
83 return rawCallback(InteractionVar.GoPointer(), PasswordVar.GoPointer(), CancellableVar.GoPointer())
84 }
85}
86
87// OverrideAskPasswordAsync sets the "ask_password_async" callback function.
88// ask for a password asynchronously.
89func (x *TlsInteractionClass) OverrideAskPasswordAsync(cb func(*TlsInteraction, *TlsPassword, *Cancellable, *AsyncReadyCallback, uintptr)) {
90 if cb == nil {
91 x.xAskPasswordAsync = 0
92 } else {
93 x.xAskPasswordAsync = purego.NewCallback(func(InteractionVarp uintptr, PasswordVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
94 cb(TlsInteractionNewFromInternalPtr(InteractionVarp), TlsPasswordNewFromInternalPtr(PasswordVarp), CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
95 })
96 }
97}
98
99// GetAskPasswordAsync gets the "ask_password_async" callback function.
100// ask for a password asynchronously.
101func (x *TlsInteractionClass) GetAskPasswordAsync() func(*TlsInteraction, *TlsPassword, *Cancellable, *AsyncReadyCallback, uintptr) {
102 if x.xAskPasswordAsync == 0 {
103 return nil
104 }
105 var rawCallback func(InteractionVarp uintptr, PasswordVarp uintptr, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
106 purego.RegisterFunc(&rawCallback, x.xAskPasswordAsync)
107 return func(InteractionVar *TlsInteraction, PasswordVar *TlsPassword, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
108 rawCallback(InteractionVar.GoPointer(), PasswordVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
109 }
110}
111
112// OverrideAskPasswordFinish sets the "ask_password_finish" callback function.
113// complete operation to ask for a password asynchronously.
114//
115// If the implementation returns %G_TLS_INTERACTION_HANDLED, then the
116// password argument of the async method should have been filled in by using
117// g_tls_password_set_value() or a similar function.
118func (x *TlsInteractionClass) OverrideAskPasswordFinish(cb func(*TlsInteraction, AsyncResult) TlsInteractionResult) {
119 if cb == nil {
120 x.xAskPasswordFinish = 0
121 } else {
122 x.xAskPasswordFinish = purego.NewCallback(func(InteractionVarp uintptr, ResultVarp uintptr) TlsInteractionResult {
123 return cb(TlsInteractionNewFromInternalPtr(InteractionVarp), &AsyncResultBase{Ptr: ResultVarp})
124 })
125 }
126}
127
128// GetAskPasswordFinish gets the "ask_password_finish" callback function.
129// complete operation to ask for a password asynchronously.
130//
131// If the implementation returns %G_TLS_INTERACTION_HANDLED, then the
132// password argument of the async method should have been filled in by using
133// g_tls_password_set_value() or a similar function.
134func (x *TlsInteractionClass) GetAskPasswordFinish() func(*TlsInteraction, AsyncResult) TlsInteractionResult {
135 if x.xAskPasswordFinish == 0 {
136 return nil
137 }
138 var rawCallback func(InteractionVarp uintptr, ResultVarp uintptr) TlsInteractionResult
139 purego.RegisterFunc(&rawCallback, x.xAskPasswordFinish)
140 return func(InteractionVar *TlsInteraction, ResultVar AsyncResult) TlsInteractionResult {
141 return rawCallback(InteractionVar.GoPointer(), ResultVar.GoPointer())
142 }
143}
144
145// OverrideRequestCertificate sets the "request_certificate" callback function.
146// ask for a certificate synchronously. If the
147//
148// implementation returns %G_TLS_INTERACTION_HANDLED, then the connection
149// argument should have been filled in by using
150// g_tls_connection_set_certificate().
151func (x *TlsInteractionClass) OverrideRequestCertificate(cb func(*TlsInteraction, *TlsConnection, TlsCertificateRequestFlags, *Cancellable) TlsInteractionResult) {
152 if cb == nil {
153 x.xRequestCertificate = 0
154 } else {
155 x.xRequestCertificate = purego.NewCallback(func(InteractionVarp uintptr, ConnectionVarp uintptr, FlagsVarp TlsCertificateRequestFlags, CancellableVarp uintptr) TlsInteractionResult {
156 return cb(TlsInteractionNewFromInternalPtr(InteractionVarp), TlsConnectionNewFromInternalPtr(ConnectionVarp), FlagsVarp, CancellableNewFromInternalPtr(CancellableVarp))
157 })
158 }
159}
160
161// GetRequestCertificate gets the "request_certificate" callback function.
162// ask for a certificate synchronously. If the
163//
164// implementation returns %G_TLS_INTERACTION_HANDLED, then the connection
165// argument should have been filled in by using
166// g_tls_connection_set_certificate().
167func (x *TlsInteractionClass) GetRequestCertificate() func(*TlsInteraction, *TlsConnection, TlsCertificateRequestFlags, *Cancellable) TlsInteractionResult {
168 if x.xRequestCertificate == 0 {
169 return nil
170 }
171 var rawCallback func(InteractionVarp uintptr, ConnectionVarp uintptr, FlagsVarp TlsCertificateRequestFlags, CancellableVarp uintptr) TlsInteractionResult
172 purego.RegisterFunc(&rawCallback, x.xRequestCertificate)
173 return func(InteractionVar *TlsInteraction, ConnectionVar *TlsConnection, FlagsVar TlsCertificateRequestFlags, CancellableVar *Cancellable) TlsInteractionResult {
174 return rawCallback(InteractionVar.GoPointer(), ConnectionVar.GoPointer(), FlagsVar, CancellableVar.GoPointer())
175 }
176}
177
178// OverrideRequestCertificateAsync sets the "request_certificate_async" callback function.
179// ask for a certificate asynchronously.
180func (x *TlsInteractionClass) OverrideRequestCertificateAsync(cb func(*TlsInteraction, *TlsConnection, TlsCertificateRequestFlags, *Cancellable, *AsyncReadyCallback, uintptr)) {
181 if cb == nil {
182 x.xRequestCertificateAsync = 0
183 } else {
184 x.xRequestCertificateAsync = purego.NewCallback(func(InteractionVarp uintptr, ConnectionVarp uintptr, FlagsVarp TlsCertificateRequestFlags, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
185 cb(TlsInteractionNewFromInternalPtr(InteractionVarp), TlsConnectionNewFromInternalPtr(ConnectionVarp), FlagsVarp, CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
186 })
187 }
188}
189
190// GetRequestCertificateAsync gets the "request_certificate_async" callback function.
191// ask for a certificate asynchronously.
192func (x *TlsInteractionClass) GetRequestCertificateAsync() func(*TlsInteraction, *TlsConnection, TlsCertificateRequestFlags, *Cancellable, *AsyncReadyCallback, uintptr) {
193 if x.xRequestCertificateAsync == 0 {
194 return nil
195 }
196 var rawCallback func(InteractionVarp uintptr, ConnectionVarp uintptr, FlagsVarp TlsCertificateRequestFlags, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
197 purego.RegisterFunc(&rawCallback, x.xRequestCertificateAsync)
198 return func(InteractionVar *TlsInteraction, ConnectionVar *TlsConnection, FlagsVar TlsCertificateRequestFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
199 rawCallback(InteractionVar.GoPointer(), ConnectionVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
200 }
201}
202
203// OverrideRequestCertificateFinish sets the "request_certificate_finish" callback function.
204// complete operation to ask for a certificate
205//
206// asynchronously. If the implementation returns %G_TLS_INTERACTION_HANDLED,
207// then the connection argument of the async method should have been
208// filled in by using g_tls_connection_set_certificate().
209func (x *TlsInteractionClass) OverrideRequestCertificateFinish(cb func(*TlsInteraction, AsyncResult) TlsInteractionResult) {
210 if cb == nil {
211 x.xRequestCertificateFinish = 0
212 } else {
213 x.xRequestCertificateFinish = purego.NewCallback(func(InteractionVarp uintptr, ResultVarp uintptr) TlsInteractionResult {
214 return cb(TlsInteractionNewFromInternalPtr(InteractionVarp), &AsyncResultBase{Ptr: ResultVarp})
215 })
216 }
217}
218
219// GetRequestCertificateFinish gets the "request_certificate_finish" callback function.
220// complete operation to ask for a certificate
221//
222// asynchronously. If the implementation returns %G_TLS_INTERACTION_HANDLED,
223// then the connection argument of the async method should have been
224// filled in by using g_tls_connection_set_certificate().
225func (x *TlsInteractionClass) GetRequestCertificateFinish() func(*TlsInteraction, AsyncResult) TlsInteractionResult {
226 if x.xRequestCertificateFinish == 0 {
227 return nil
228 }
229 var rawCallback func(InteractionVarp uintptr, ResultVarp uintptr) TlsInteractionResult
230 purego.RegisterFunc(&rawCallback, x.xRequestCertificateFinish)
231 return func(InteractionVar *TlsInteraction, ResultVar AsyncResult) TlsInteractionResult {
232 return rawCallback(InteractionVar.GoPointer(), ResultVar.GoPointer())
233 }
234}
235
236type TlsInteractionPrivate struct {
237 _ structs.HostLayout
238}
239
240func (x *TlsInteractionPrivate) GoPointer() uintptr {
241 return uintptr(unsafe.Pointer(x))
242}
243
244// `GTlsInteraction` provides a mechanism for the TLS connection and database
245// code to interact with the user. It can be used to ask the user for passwords.
246//
247// To use a `GTlsInteraction` with a TLS connection use
248// [method@Gio.TlsConnection.set_interaction].
249//
250// Callers should instantiate a derived class that implements the various
251// interaction methods to show the required dialogs.
252//
253// Callers should use the 'invoke' functions like
254// [method@Gio.TlsInteraction.invoke_ask_password] to run interaction methods.
255// These functions make sure that the interaction is invoked in the main loop
256// and not in the current thread, if the current thread is not running the
257// main loop.
258//
259// Derived classes can choose to implement whichever interactions methods they’d
260// like to support by overriding those virtual methods in their class
261// initialization function. Any interactions not implemented will return
262// `G_TLS_INTERACTION_UNHANDLED`. If a derived class implements an async method,
263// it must also implement the corresponding finish method.
264type TlsInteraction struct {
265 gobject.Object
266}
267
268var xTlsInteractionGLibType func() types.GType
269
270func TlsInteractionGLibType() types.GType {
271 return xTlsInteractionGLibType()
272}
273
274func TlsInteractionNewFromInternalPtr(ptr uintptr) *TlsInteraction {
275 cls := &TlsInteraction{}
276 cls.Ptr = ptr
277 return cls
278}
279
280var xTlsInteractionAskPassword func(uintptr, uintptr, uintptr, **glib.Error) TlsInteractionResult
281
282// Run synchronous interaction to ask the user for a password. In general,
283// g_tls_interaction_invoke_ask_password() should be used instead of this
284// function.
285//
286// Derived subclasses usually implement a password prompt, although they may
287// also choose to provide a password from elsewhere. The @password value will
288// be filled in and then @callback will be called. Alternatively the user may
289// abort this password request, which will usually abort the TLS connection.
290//
291// If the interaction is cancelled by the cancellation object, or by the
292// user then %G_TLS_INTERACTION_FAILED will be returned with an error that
293// contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may
294// not support immediate cancellation.
295func (x *TlsInteraction) AskPassword(PasswordVar *TlsPassword, CancellableVar *Cancellable) (TlsInteractionResult, error) {
296 var cerr *glib.Error
297
298 cret := xTlsInteractionAskPassword(x.GoPointer(), PasswordVar.GoPointer(), CancellableVar.GoPointer(), &cerr)
299 if cerr == nil {
300 return cret, nil
301 }
302 return cret, cerr
303
304}
305
306var xTlsInteractionAskPasswordAsync func(uintptr, uintptr, uintptr, uintptr, uintptr)
307
308// Run asynchronous interaction to ask the user for a password. In general,
309// g_tls_interaction_invoke_ask_password() should be used instead of this
310// function.
311//
312// Derived subclasses usually implement a password prompt, although they may
313// also choose to provide a password from elsewhere. The @password value will
314// be filled in and then @callback will be called. Alternatively the user may
315// abort this password request, which will usually abort the TLS connection.
316//
317// If the interaction is cancelled by the cancellation object, or by the
318// user then %G_TLS_INTERACTION_FAILED will be returned with an error that
319// contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may
320// not support immediate cancellation.
321//
322// Certain implementations may not support immediate cancellation.
323func (x *TlsInteraction) AskPasswordAsync(PasswordVar *TlsPassword, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
324
325 var CallbackVarRef uintptr
326 if CallbackVar != nil {
327 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
328 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
329 CallbackVarRef = cbRefPtr
330 } else {
331 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
332 cbFn := *CallbackVar
333 cbFn(arg0, arg1, arg2)
334 }
335 CallbackVarRef = purego.NewCallback(fcb)
336 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
337 }
338 }
339
340 xTlsInteractionAskPasswordAsync(x.GoPointer(), PasswordVar.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
341
342}
343
344var xTlsInteractionAskPasswordFinish func(uintptr, uintptr, **glib.Error) TlsInteractionResult
345
346// Complete an ask password user interaction request. This should be once
347// the g_tls_interaction_ask_password_async() completion callback is called.
348//
349// If %G_TLS_INTERACTION_HANDLED is returned, then the #GTlsPassword passed
350// to g_tls_interaction_ask_password() will have its password filled in.
351//
352// If the interaction is cancelled by the cancellation object, or by the
353// user then %G_TLS_INTERACTION_FAILED will be returned with an error that
354// contains a %G_IO_ERROR_CANCELLED error code.
355func (x *TlsInteraction) AskPasswordFinish(ResultVar AsyncResult) (TlsInteractionResult, error) {
356 var cerr *glib.Error
357
358 cret := xTlsInteractionAskPasswordFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
359 if cerr == nil {
360 return cret, nil
361 }
362 return cret, cerr
363
364}
365
366var xTlsInteractionInvokeAskPassword func(uintptr, uintptr, uintptr, **glib.Error) TlsInteractionResult
367
368// Invoke the interaction to ask the user for a password. It invokes this
369// interaction in the main loop, specifically the #GMainContext returned by
370// g_main_context_get_thread_default() when the interaction is created. This
371// is called by called by #GTlsConnection or #GTlsDatabase to ask the user
372// for a password.
373//
374// Derived subclasses usually implement a password prompt, although they may
375// also choose to provide a password from elsewhere. The @password value will
376// be filled in and then @callback will be called. Alternatively the user may
377// abort this password request, which will usually abort the TLS connection.
378//
379// The implementation can either be a synchronous (eg: modal dialog) or an
380// asynchronous one (eg: modeless dialog). This function will take care of
381// calling which ever one correctly.
382//
383// If the interaction is cancelled by the cancellation object, or by the
384// user then %G_TLS_INTERACTION_FAILED will be returned with an error that
385// contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may
386// not support immediate cancellation.
387func (x *TlsInteraction) InvokeAskPassword(PasswordVar *TlsPassword, CancellableVar *Cancellable) (TlsInteractionResult, error) {
388 var cerr *glib.Error
389
390 cret := xTlsInteractionInvokeAskPassword(x.GoPointer(), PasswordVar.GoPointer(), CancellableVar.GoPointer(), &cerr)
391 if cerr == nil {
392 return cret, nil
393 }
394 return cret, cerr
395
396}
397
398var xTlsInteractionInvokeRequestCertificate func(uintptr, uintptr, TlsCertificateRequestFlags, uintptr, **glib.Error) TlsInteractionResult
399
400// Invoke the interaction to ask the user to choose a certificate to
401// use with the connection. It invokes this interaction in the main
402// loop, specifically the #GMainContext returned by
403// g_main_context_get_thread_default() when the interaction is
404// created. This is called by called by #GTlsConnection when the peer
405// requests a certificate during the handshake.
406//
407// Derived subclasses usually implement a certificate selector,
408// although they may also choose to provide a certificate from
409// elsewhere. Alternatively the user may abort this certificate
410// request, which may or may not abort the TLS connection.
411//
412// The implementation can either be a synchronous (eg: modal dialog) or an
413// asynchronous one (eg: modeless dialog). This function will take care of
414// calling which ever one correctly.
415//
416// If the interaction is cancelled by the cancellation object, or by the
417// user then %G_TLS_INTERACTION_FAILED will be returned with an error that
418// contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may
419// not support immediate cancellation.
420func (x *TlsInteraction) InvokeRequestCertificate(ConnectionVar *TlsConnection, FlagsVar TlsCertificateRequestFlags, CancellableVar *Cancellable) (TlsInteractionResult, error) {
421 var cerr *glib.Error
422
423 cret := xTlsInteractionInvokeRequestCertificate(x.GoPointer(), ConnectionVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), &cerr)
424 if cerr == nil {
425 return cret, nil
426 }
427 return cret, cerr
428
429}
430
431var xTlsInteractionRequestCertificate func(uintptr, uintptr, TlsCertificateRequestFlags, uintptr, **glib.Error) TlsInteractionResult
432
433// Run synchronous interaction to ask the user to choose a certificate to use
434// with the connection. In general, g_tls_interaction_invoke_request_certificate()
435// should be used instead of this function.
436//
437// Derived subclasses usually implement a certificate selector, although they may
438// also choose to provide a certificate from elsewhere. Alternatively the user may
439// abort this certificate request, which will usually abort the TLS connection.
440//
441// If %G_TLS_INTERACTION_HANDLED is returned, then the #GTlsConnection
442// passed to g_tls_interaction_request_certificate() will have had its
443// #GTlsConnection:certificate filled in.
444//
445// If the interaction is cancelled by the cancellation object, or by the
446// user then %G_TLS_INTERACTION_FAILED will be returned with an error that
447// contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may
448// not support immediate cancellation.
449func (x *TlsInteraction) RequestCertificate(ConnectionVar *TlsConnection, FlagsVar TlsCertificateRequestFlags, CancellableVar *Cancellable) (TlsInteractionResult, error) {
450 var cerr *glib.Error
451
452 cret := xTlsInteractionRequestCertificate(x.GoPointer(), ConnectionVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), &cerr)
453 if cerr == nil {
454 return cret, nil
455 }
456 return cret, cerr
457
458}
459
460var xTlsInteractionRequestCertificateAsync func(uintptr, uintptr, TlsCertificateRequestFlags, uintptr, uintptr, uintptr)
461
462// Run asynchronous interaction to ask the user for a certificate to use with
463// the connection. In general, g_tls_interaction_invoke_request_certificate() should
464// be used instead of this function.
465//
466// Derived subclasses usually implement a certificate selector, although they may
467// also choose to provide a certificate from elsewhere. @callback will be called
468// when the operation completes. Alternatively the user may abort this certificate
469// request, which will usually abort the TLS connection.
470func (x *TlsInteraction) RequestCertificateAsync(ConnectionVar *TlsConnection, FlagsVar TlsCertificateRequestFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
471
472 var CallbackVarRef uintptr
473 if CallbackVar != nil {
474 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
475 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
476 CallbackVarRef = cbRefPtr
477 } else {
478 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
479 cbFn := *CallbackVar
480 cbFn(arg0, arg1, arg2)
481 }
482 CallbackVarRef = purego.NewCallback(fcb)
483 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
484 }
485 }
486
487 xTlsInteractionRequestCertificateAsync(x.GoPointer(), ConnectionVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
488
489}
490
491var xTlsInteractionRequestCertificateFinish func(uintptr, uintptr, **glib.Error) TlsInteractionResult
492
493// Complete a request certificate user interaction request. This should be once
494// the g_tls_interaction_request_certificate_async() completion callback is called.
495//
496// If %G_TLS_INTERACTION_HANDLED is returned, then the #GTlsConnection
497// passed to g_tls_interaction_request_certificate_async() will have had its
498// #GTlsConnection:certificate filled in.
499//
500// If the interaction is cancelled by the cancellation object, or by the
501// user then %G_TLS_INTERACTION_FAILED will be returned with an error that
502// contains a %G_IO_ERROR_CANCELLED error code.
503func (x *TlsInteraction) RequestCertificateFinish(ResultVar AsyncResult) (TlsInteractionResult, error) {
504 var cerr *glib.Error
505
506 cret := xTlsInteractionRequestCertificateFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
507 if cerr == nil {
508 return cret, nil
509 }
510 return cret, cerr
511
512}
513
514func (c *TlsInteraction) GoPointer() uintptr {
515 if c == nil {
516 return 0
517 }
518 return c.Ptr
519}
520
521func (c *TlsInteraction) SetGoPointer(ptr uintptr) {
522 c.Ptr = ptr
523}
524
525func init() {
526 core.SetPackageName("GIO", "gio-2.0")
527 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
528 var libs []uintptr
529 for _, libPath := range core.GetPaths("GIO") {
530 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
531 if err != nil {
532 panic(err)
533 }
534 libs = append(libs, lib)
535 }
536
537 core.PuregoSafeRegister(&xTlsInteractionGLibType, libs, "g_tls_interaction_get_type")
538
539 core.PuregoSafeRegister(&xTlsInteractionAskPassword, libs, "g_tls_interaction_ask_password")
540 core.PuregoSafeRegister(&xTlsInteractionAskPasswordAsync, libs, "g_tls_interaction_ask_password_async")
541 core.PuregoSafeRegister(&xTlsInteractionAskPasswordFinish, libs, "g_tls_interaction_ask_password_finish")
542 core.PuregoSafeRegister(&xTlsInteractionInvokeAskPassword, libs, "g_tls_interaction_invoke_ask_password")
543 core.PuregoSafeRegister(&xTlsInteractionInvokeRequestCertificate, libs, "g_tls_interaction_invoke_request_certificate")
544 core.PuregoSafeRegister(&xTlsInteractionRequestCertificate, libs, "g_tls_interaction_request_certificate")
545 core.PuregoSafeRegister(&xTlsInteractionRequestCertificateAsync, libs, "g_tls_interaction_request_certificate_async")
546 core.PuregoSafeRegister(&xTlsInteractionRequestCertificateFinish, libs, "g_tls_interaction_request_certificate_finish")
547
548}