1// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gio
3
4import (
5 "unsafe"
6
7 "github.com/ebitengine/purego"
8
9 "github.com/bnema/puregotk/pkg/core"
10 "github.com/bnema/puregotk/v4/glib"
11)
12
13var xDbusAddressEscapeValue func(string) string
14
15// Escape @string so it can appear in a D-Bus address as the value
16// part of a key-value pair.
17//
18// For instance, if @string is `/run/bus-for-:0`,
19// this function would return `/run/bus-for-%3A0`,
20// which could be used in a D-Bus address like
21// `unix:nonce-tcp:host=127.0.0.1,port=42,noncefile=/run/bus-for-%3A0`.
22func DbusAddressEscapeValue(StringVar string) string {
23
24 cret := xDbusAddressEscapeValue(StringVar)
25 return cret
26}
27
28var xDbusAddressGetForBusSync func(BusType, uintptr, **glib.Error) string
29
30// Synchronously looks up the D-Bus address for the well-known message
31// bus instance specified by @bus_type. This may involve using various
32// platform specific mechanisms.
33//
34// The returned address will be in the
35// [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
36func DbusAddressGetForBusSync(BusTypeVar BusType, CancellableVar *Cancellable) (string, error) {
37 var cerr *glib.Error
38
39 cret := xDbusAddressGetForBusSync(BusTypeVar, CancellableVar.GoPointer(), &cerr)
40 if cerr == nil {
41 return cret, nil
42 }
43 return cret, cerr
44
45}
46
47var xDbusAddressGetStream func(string, uintptr, uintptr, uintptr)
48
49// Asynchronously connects to an endpoint specified by @address and
50// sets up the connection so it is in a state to run the client-side
51// of the D-Bus authentication conversation. @address must be in the
52// [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
53//
54// When the operation is finished, @callback will be invoked. You can
55// then call g_dbus_address_get_stream_finish() to get the result of
56// the operation.
57//
58// This is an asynchronous failable function. See
59// g_dbus_address_get_stream_sync() for the synchronous version.
60func DbusAddressGetStream(AddressVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
61
62 var CallbackVarRef uintptr
63 if CallbackVar != nil {
64 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
65 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
66 CallbackVarRef = cbRefPtr
67 } else {
68 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
69 cbFn := *CallbackVar
70 cbFn(arg0, arg1, arg2)
71 }
72 CallbackVarRef = purego.NewCallback(fcb)
73 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
74 }
75 }
76
77 xDbusAddressGetStream(AddressVar, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
78
79}
80
81var xDbusAddressGetStreamFinish func(uintptr, *string, **glib.Error) uintptr
82
83// Finishes an operation started with g_dbus_address_get_stream().
84//
85// A server is not required to set a GUID, so @out_guid may be set to %NULL
86// even on success.
87func DbusAddressGetStreamFinish(ResVar AsyncResult, OutGuidVar *string) (*IOStream, error) {
88 var cls *IOStream
89 var cerr *glib.Error
90
91 cret := xDbusAddressGetStreamFinish(ResVar.GoPointer(), OutGuidVar, &cerr)
92
93 if cret == 0 {
94 return nil, cerr
95 }
96 cls = &IOStream{}
97 cls.Ptr = cret
98 if cerr == nil {
99 return cls, nil
100 }
101 return cls, cerr
102
103}
104
105var xDbusAddressGetStreamSync func(string, *string, uintptr, **glib.Error) uintptr
106
107// Synchronously connects to an endpoint specified by @address and
108// sets up the connection so it is in a state to run the client-side
109// of the D-Bus authentication conversation. @address must be in the
110// [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
111//
112// A server is not required to set a GUID, so @out_guid may be set to %NULL
113// even on success.
114//
115// This is a synchronous failable function. See
116// g_dbus_address_get_stream() for the asynchronous version.
117func DbusAddressGetStreamSync(AddressVar string, OutGuidVar *string, CancellableVar *Cancellable) (*IOStream, error) {
118 var cls *IOStream
119 var cerr *glib.Error
120
121 cret := xDbusAddressGetStreamSync(AddressVar, OutGuidVar, CancellableVar.GoPointer(), &cerr)
122
123 if cret == 0 {
124 return nil, cerr
125 }
126 cls = &IOStream{}
127 cls.Ptr = cret
128 if cerr == nil {
129 return cls, nil
130 }
131 return cls, cerr
132
133}
134
135var xDbusIsAddress func(string) bool
136
137// Checks if @string is a
138// [D-Bus address](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
139//
140// This doesn't check if @string is actually supported by #GDBusServer
141// or #GDBusConnection - use g_dbus_is_supported_address() to do more
142// checks.
143func DbusIsAddress(StringVar string) bool {
144
145 cret := xDbusIsAddress(StringVar)
146 return cret
147}
148
149var xDbusIsSupportedAddress func(string, **glib.Error) bool
150
151// Like g_dbus_is_address() but also checks if the library supports the
152// transports in @string and that key/value pairs for each transport
153// are valid. See the specification of the
154// [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses).
155func DbusIsSupportedAddress(StringVar string) (bool, error) {
156 var cerr *glib.Error
157
158 cret := xDbusIsSupportedAddress(StringVar, &cerr)
159 if cerr == nil {
160 return cret, nil
161 }
162 return cret, cerr
163
164}
165
166func init() {
167 core.SetPackageName("GIO", "gio-2.0")
168 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
169 var libs []uintptr
170 for _, libPath := range core.GetPaths("GIO") {
171 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
172 if err != nil {
173 panic(err)
174 }
175 libs = append(libs, lib)
176 }
177
178 core.PuregoSafeRegister(&xDbusAddressEscapeValue, libs, "g_dbus_address_escape_value")
179 core.PuregoSafeRegister(&xDbusAddressGetForBusSync, libs, "g_dbus_address_get_for_bus_sync")
180 core.PuregoSafeRegister(&xDbusAddressGetStream, libs, "g_dbus_address_get_stream")
181 core.PuregoSafeRegister(&xDbusAddressGetStreamFinish, libs, "g_dbus_address_get_stream_finish")
182 core.PuregoSafeRegister(&xDbusAddressGetStreamSync, libs, "g_dbus_address_get_stream_sync")
183 core.PuregoSafeRegister(&xDbusIsAddress, libs, "g_dbus_is_address")
184 core.PuregoSafeRegister(&xDbusIsSupportedAddress, libs, "g_dbus_is_supported_address")
185
186}