v0.2.2 9100209

gsocketconnectable.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/gobject/types"
12)
13
14// Provides an interface for returning a #GSocketAddressEnumerator
15// and #GProxyAddressEnumerator
16type SocketConnectableIface struct {
17	_ structs.HostLayout
18
19	GIface uintptr
20
21	xEnumerate uintptr
22
23	xProxyEnumerate uintptr
24
25	xToString uintptr
26}
27
28func (x *SocketConnectableIface) GoPointer() uintptr {
29	return uintptr(unsafe.Pointer(x))
30}
31
32// OverrideEnumerate sets the "enumerate" callback function.
33// Creates a #GSocketAddressEnumerator
34func (x *SocketConnectableIface) OverrideEnumerate(cb func(SocketConnectable) *SocketAddressEnumerator) {
35	if cb == nil {
36		x.xEnumerate = 0
37	} else {
38		x.xEnumerate = purego.NewCallback(func(ConnectableVarp uintptr) uintptr {
39			ret := cb(&SocketConnectableBase{Ptr: ConnectableVarp})
40			if ret == nil {
41				return 0
42			}
43			return ret.GoPointer()
44		})
45	}
46}
47
48// GetEnumerate gets the "enumerate" callback function.
49// Creates a #GSocketAddressEnumerator
50func (x *SocketConnectableIface) GetEnumerate() func(SocketConnectable) *SocketAddressEnumerator {
51	if x.xEnumerate == 0 {
52		return nil
53	}
54	var rawCallback func(ConnectableVarp uintptr) uintptr
55	purego.RegisterFunc(&rawCallback, x.xEnumerate)
56	return func(ConnectableVar SocketConnectable) *SocketAddressEnumerator {
57		rawRet := rawCallback(ConnectableVar.GoPointer())
58		if rawRet == 0 {
59			return nil
60		}
61		ret := &SocketAddressEnumerator{}
62		ret.Ptr = rawRet
63		return ret
64	}
65}
66
67// OverrideProxyEnumerate sets the "proxy_enumerate" callback function.
68// Creates a #GProxyAddressEnumerator
69func (x *SocketConnectableIface) OverrideProxyEnumerate(cb func(SocketConnectable) *SocketAddressEnumerator) {
70	if cb == nil {
71		x.xProxyEnumerate = 0
72	} else {
73		x.xProxyEnumerate = purego.NewCallback(func(ConnectableVarp uintptr) uintptr {
74			ret := cb(&SocketConnectableBase{Ptr: ConnectableVarp})
75			if ret == nil {
76				return 0
77			}
78			return ret.GoPointer()
79		})
80	}
81}
82
83// GetProxyEnumerate gets the "proxy_enumerate" callback function.
84// Creates a #GProxyAddressEnumerator
85func (x *SocketConnectableIface) GetProxyEnumerate() func(SocketConnectable) *SocketAddressEnumerator {
86	if x.xProxyEnumerate == 0 {
87		return nil
88	}
89	var rawCallback func(ConnectableVarp uintptr) uintptr
90	purego.RegisterFunc(&rawCallback, x.xProxyEnumerate)
91	return func(ConnectableVar SocketConnectable) *SocketAddressEnumerator {
92		rawRet := rawCallback(ConnectableVar.GoPointer())
93		if rawRet == 0 {
94			return nil
95		}
96		ret := &SocketAddressEnumerator{}
97		ret.Ptr = rawRet
98		return ret
99	}
100}
101
102// OverrideToString sets the "to_string" callback function.
103// Format the connectable’s address as a string for debugging.
104//
105//	Implementing this is optional. (Since: 2.48)
106func (x *SocketConnectableIface) OverrideToString(cb func(SocketConnectable) string) {
107	if cb == nil {
108		x.xToString = 0
109	} else {
110		x.xToString = purego.NewCallback(func(ConnectableVarp uintptr) string {
111			return cb(&SocketConnectableBase{Ptr: ConnectableVarp})
112		})
113	}
114}
115
116// GetToString gets the "to_string" callback function.
117// Format the connectable’s address as a string for debugging.
118//
119//	Implementing this is optional. (Since: 2.48)
120func (x *SocketConnectableIface) GetToString() func(SocketConnectable) string {
121	if x.xToString == 0 {
122		return nil
123	}
124	var rawCallback func(ConnectableVarp uintptr) string
125	purego.RegisterFunc(&rawCallback, x.xToString)
126	return func(ConnectableVar SocketConnectable) string {
127		return rawCallback(ConnectableVar.GoPointer())
128	}
129}
130
131// Objects that describe one or more potential socket endpoints
132// implement `GSocketConnectable`. Callers can then use
133// [method@Gio.SocketConnectable.enumerate] to get a
134// [class@Gio.SocketAddressEnumerator] to try out each socket address in turn
135// until one succeeds, as shown in the sample code below.
136//
137// ```c
138// MyConnectionType *
139// connect_to_host (const char    *hostname,
140//
141//	guint16        port,
142//	GCancellable  *cancellable,
143//	GError       **error)
144//
145//	{
146//	  MyConnection *conn = NULL;
147//	  GSocketConnectable *addr;
148//	  GSocketAddressEnumerator *enumerator;
149//	  GSocketAddress *sockaddr;
150//	  GError *conn_error = NULL;
151//
152//	  addr = g_network_address_new (hostname, port);
153//	  enumerator = g_socket_connectable_enumerate (addr);
154//	  g_object_unref (addr);
155//
156//	  // Try each sockaddr until we succeed. Record the first connection error,
157//	  // but not any further ones (since they'll probably be basically the same
158//	  // as the first).
159//	  while (!conn && (sockaddr = g_socket_address_enumerator_next (enumerator, cancellable, error))
160//	    {
161//	      conn = connect_to_sockaddr (sockaddr, conn_error ? NULL : &conn_error);
162//	      g_object_unref (sockaddr);
163//	    }
164//	  g_object_unref (enumerator);
165//
166//	  if (conn)
167//	    {
168//	      if (conn_error)
169//	        {
170//	          // We couldn't connect to the first address, but we succeeded
171//	          // in connecting to a later address.
172//	          g_error_free (conn_error);
173//	        }
174//	      return conn;
175//	    }
176//	  else if (error)
177//	    {
178//	      /// Either initial lookup failed, or else the caller cancelled us.
179//	      if (conn_error)
180//	        g_error_free (conn_error);
181//	      return NULL;
182//	    }
183//	  else
184//	    {
185//	      g_error_propagate (error, conn_error);
186//	      return NULL;
187//	    }
188//	}
189//
190// ```
191type SocketConnectable interface {
192	GoPointer() uintptr
193	SetGoPointer(uintptr)
194	Enumerate() *SocketAddressEnumerator
195	ProxyEnumerate() *SocketAddressEnumerator
196	ToString() string
197}
198
199var xSocketConnectableGLibType func() types.GType
200
201func SocketConnectableGLibType() types.GType {
202	return xSocketConnectableGLibType()
203}
204
205type SocketConnectableBase struct {
206	Ptr uintptr
207}
208
209func (x *SocketConnectableBase) GoPointer() uintptr {
210	if x == nil {
211		return 0
212	}
213	return x.Ptr
214}
215
216func (x *SocketConnectableBase) SetGoPointer(ptr uintptr) {
217	x.Ptr = ptr
218}
219
220// Creates a #GSocketAddressEnumerator for @connectable.
221func (x *SocketConnectableBase) Enumerate() *SocketAddressEnumerator {
222	var cls *SocketAddressEnumerator
223
224	cret := XGSocketConnectableEnumerate(x.GoPointer())
225
226	if cret == 0 {
227		return nil
228	}
229	cls = &SocketAddressEnumerator{}
230	cls.Ptr = cret
231	return cls
232}
233
234// Creates a #GSocketAddressEnumerator for @connectable that will
235// return a #GProxyAddress for each of its addresses that you must connect
236// to via a proxy.
237//
238// If @connectable does not implement
239// g_socket_connectable_proxy_enumerate(), this will fall back to
240// calling g_socket_connectable_enumerate().
241func (x *SocketConnectableBase) ProxyEnumerate() *SocketAddressEnumerator {
242	var cls *SocketAddressEnumerator
243
244	cret := XGSocketConnectableProxyEnumerate(x.GoPointer())
245
246	if cret == 0 {
247		return nil
248	}
249	cls = &SocketAddressEnumerator{}
250	cls.Ptr = cret
251	return cls
252}
253
254// Format a #GSocketConnectable as a string. This is a human-readable format for
255// use in debugging output, and is not a stable serialization format. It is not
256// suitable for use in user interfaces as it exposes too much information for a
257// user.
258//
259// If the #GSocketConnectable implementation does not support string formatting,
260// the implementation’s type name will be returned as a fallback.
261func (x *SocketConnectableBase) ToString() string {
262
263	cret := XGSocketConnectableToString(x.GoPointer())
264	return cret
265}
266
267var XGSocketConnectableEnumerate func(uintptr) uintptr
268var XGSocketConnectableProxyEnumerate func(uintptr) uintptr
269var XGSocketConnectableToString func(uintptr) string
270
271func init() {
272	core.SetPackageName("GIO", "gio-2.0")
273	core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
274	var libs []uintptr
275	for _, libPath := range core.GetPaths("GIO") {
276		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
277		if err != nil {
278			panic(err)
279		}
280		libs = append(libs, lib)
281	}
282
283	core.PuregoSafeRegister(&xSocketConnectableGLibType, libs, "g_socket_connectable_get_type")
284
285	core.PuregoSafeRegister(&XGSocketConnectableEnumerate, libs, "g_socket_connectable_enumerate")
286	core.PuregoSafeRegister(&XGSocketConnectableProxyEnumerate, libs, "g_socket_connectable_proxy_enumerate")
287	core.PuregoSafeRegister(&XGSocketConnectableToString, libs, "g_socket_connectable_to_string")
288
289}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close