v0.2.1 c0399be

gthreadedsocketservice.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/glib"
12	"github.com/bnema/puregotk/v4/gobject"
13	"github.com/bnema/puregotk/v4/gobject/types"
14)
15
16type ThreadedSocketServiceClass struct {
17	_ structs.HostLayout
18
19	ParentClass SocketServiceClass
20
21	xRun uintptr
22
23	xGReserved1 uintptr
24
25	xGReserved2 uintptr
26
27	xGReserved3 uintptr
28
29	xGReserved4 uintptr
30
31	xGReserved5 uintptr
32}
33
34func (x *ThreadedSocketServiceClass) GoPointer() uintptr {
35	return uintptr(unsafe.Pointer(x))
36}
37
38// OverrideRun sets the "run" callback function.
39func (x *ThreadedSocketServiceClass) OverrideRun(cb func(*ThreadedSocketService, *SocketConnection, *gobject.Object) bool) {
40	if cb == nil {
41		x.xRun = 0
42	} else {
43		x.xRun = purego.NewCallback(func(ServiceVarp uintptr, ConnectionVarp uintptr, SourceObjectVarp uintptr) bool {
44			return cb(ThreadedSocketServiceNewFromInternalPtr(ServiceVarp), SocketConnectionNewFromInternalPtr(ConnectionVarp), gobject.ObjectNewFromInternalPtr(SourceObjectVarp))
45		})
46	}
47}
48
49// GetRun gets the "run" callback function.
50func (x *ThreadedSocketServiceClass) GetRun() func(*ThreadedSocketService, *SocketConnection, *gobject.Object) bool {
51	if x.xRun == 0 {
52		return nil
53	}
54	var rawCallback func(ServiceVarp uintptr, ConnectionVarp uintptr, SourceObjectVarp uintptr) bool
55	purego.RegisterFunc(&rawCallback, x.xRun)
56	return func(ServiceVar *ThreadedSocketService, ConnectionVar *SocketConnection, SourceObjectVar *gobject.Object) bool {
57		return rawCallback(ServiceVar.GoPointer(), ConnectionVar.GoPointer(), SourceObjectVar.GoPointer())
58	}
59}
60
61// OverrideGReserved1 sets the "_g_reserved1" callback function.
62func (x *ThreadedSocketServiceClass) OverrideGReserved1(cb func()) {
63	if cb == nil {
64		x.xGReserved1 = 0
65	} else {
66		x.xGReserved1 = purego.NewCallback(func() {
67			cb()
68		})
69	}
70}
71
72// GetGReserved1 gets the "_g_reserved1" callback function.
73func (x *ThreadedSocketServiceClass) GetGReserved1() func() {
74	if x.xGReserved1 == 0 {
75		return nil
76	}
77	var rawCallback func()
78	purego.RegisterFunc(&rawCallback, x.xGReserved1)
79	return func() {
80		rawCallback()
81	}
82}
83
84// OverrideGReserved2 sets the "_g_reserved2" callback function.
85func (x *ThreadedSocketServiceClass) OverrideGReserved2(cb func()) {
86	if cb == nil {
87		x.xGReserved2 = 0
88	} else {
89		x.xGReserved2 = purego.NewCallback(func() {
90			cb()
91		})
92	}
93}
94
95// GetGReserved2 gets the "_g_reserved2" callback function.
96func (x *ThreadedSocketServiceClass) GetGReserved2() func() {
97	if x.xGReserved2 == 0 {
98		return nil
99	}
100	var rawCallback func()
101	purego.RegisterFunc(&rawCallback, x.xGReserved2)
102	return func() {
103		rawCallback()
104	}
105}
106
107// OverrideGReserved3 sets the "_g_reserved3" callback function.
108func (x *ThreadedSocketServiceClass) OverrideGReserved3(cb func()) {
109	if cb == nil {
110		x.xGReserved3 = 0
111	} else {
112		x.xGReserved3 = purego.NewCallback(func() {
113			cb()
114		})
115	}
116}
117
118// GetGReserved3 gets the "_g_reserved3" callback function.
119func (x *ThreadedSocketServiceClass) GetGReserved3() func() {
120	if x.xGReserved3 == 0 {
121		return nil
122	}
123	var rawCallback func()
124	purego.RegisterFunc(&rawCallback, x.xGReserved3)
125	return func() {
126		rawCallback()
127	}
128}
129
130// OverrideGReserved4 sets the "_g_reserved4" callback function.
131func (x *ThreadedSocketServiceClass) OverrideGReserved4(cb func()) {
132	if cb == nil {
133		x.xGReserved4 = 0
134	} else {
135		x.xGReserved4 = purego.NewCallback(func() {
136			cb()
137		})
138	}
139}
140
141// GetGReserved4 gets the "_g_reserved4" callback function.
142func (x *ThreadedSocketServiceClass) GetGReserved4() func() {
143	if x.xGReserved4 == 0 {
144		return nil
145	}
146	var rawCallback func()
147	purego.RegisterFunc(&rawCallback, x.xGReserved4)
148	return func() {
149		rawCallback()
150	}
151}
152
153// OverrideGReserved5 sets the "_g_reserved5" callback function.
154func (x *ThreadedSocketServiceClass) OverrideGReserved5(cb func()) {
155	if cb == nil {
156		x.xGReserved5 = 0
157	} else {
158		x.xGReserved5 = purego.NewCallback(func() {
159			cb()
160		})
161	}
162}
163
164// GetGReserved5 gets the "_g_reserved5" callback function.
165func (x *ThreadedSocketServiceClass) GetGReserved5() func() {
166	if x.xGReserved5 == 0 {
167		return nil
168	}
169	var rawCallback func()
170	purego.RegisterFunc(&rawCallback, x.xGReserved5)
171	return func() {
172		rawCallback()
173	}
174}
175
176type ThreadedSocketServicePrivate struct {
177	_ structs.HostLayout
178}
179
180func (x *ThreadedSocketServicePrivate) GoPointer() uintptr {
181	return uintptr(unsafe.Pointer(x))
182}
183
184// A `GThreadedSocketService` is a simple subclass of [class@Gio.SocketService]
185// that handles incoming connections by creating a worker thread and
186// dispatching the connection to it by emitting the
187// [signal@Gio.ThreadedSocketService::run signal] in the new thread.
188//
189// The signal handler may perform blocking I/O and need not return
190// until the connection is closed.
191//
192// The service is implemented using a thread pool, so there is a
193// limited amount of threads available to serve incoming requests.
194// The service automatically stops the [class@Gio.SocketService] from accepting
195// new connections when all threads are busy.
196//
197// As with [class@Gio.SocketService], you may connect to
198// [signal@Gio.ThreadedSocketService::run], or subclass and override the default
199// handler.
200type ThreadedSocketService struct {
201	SocketService
202}
203
204var xThreadedSocketServiceGLibType func() types.GType
205
206func ThreadedSocketServiceGLibType() types.GType {
207	return xThreadedSocketServiceGLibType()
208}
209
210func ThreadedSocketServiceNewFromInternalPtr(ptr uintptr) *ThreadedSocketService {
211	cls := &ThreadedSocketService{}
212	cls.Ptr = ptr
213	return cls
214}
215
216var xNewThreadedSocketService func(int) uintptr
217
218// Creates a new #GThreadedSocketService with no listeners. Listeners
219// must be added with one of the #GSocketListener "add" methods.
220func NewThreadedSocketService(MaxThreadsVar int) *ThreadedSocketService {
221	var cls *ThreadedSocketService
222
223	cret := xNewThreadedSocketService(MaxThreadsVar)
224
225	if cret == 0 {
226		return nil
227	}
228	cls = &ThreadedSocketService{}
229	cls.Ptr = cret
230	return cls
231}
232
233func (c *ThreadedSocketService) GoPointer() uintptr {
234	if c == nil {
235		return 0
236	}
237	return c.Ptr
238}
239
240func (c *ThreadedSocketService) SetGoPointer(ptr uintptr) {
241	c.Ptr = ptr
242}
243
244// SetPropertyMaxThreads sets the "max-threads" property.
245// The maximum number of threads handling clients for this service.
246func (x *ThreadedSocketService) SetPropertyMaxThreads(value int) {
247	var v gobject.Value
248	v.Init(gobject.TypeIntVal)
249	v.SetInt(value)
250	x.SetProperty("max-threads", &v)
251}
252
253// GetPropertyMaxThreads gets the "max-threads" property.
254// The maximum number of threads handling clients for this service.
255func (x *ThreadedSocketService) GetPropertyMaxThreads() int {
256	var v gobject.Value
257	x.GetProperty("max-threads", &v)
258	return v.GetInt()
259}
260
261// The ::run signal is emitted in a worker thread in response to an
262// incoming connection. This thread is dedicated to handling
263// @connection and may perform blocking IO. The signal handler need
264// not return until the connection is closed.
265func (x *ThreadedSocketService) ConnectRun(cb *func(ThreadedSocketService, uintptr, uintptr) bool) uint {
266	cbPtr := uintptr(unsafe.Pointer(cb))
267	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
268		handlerID := gobject.SignalConnect(x.GoPointer(), "run", cbRefPtr)
269		glib.SaveHandlerMapping(handlerID, cbPtr)
270		return handlerID
271	}
272
273	fcb := func(clsPtr uintptr, ConnectionVarp uintptr, SourceObjectVarp uintptr) bool {
274		fa := ThreadedSocketService{}
275		fa.Ptr = clsPtr
276		cbFn := *cb
277
278		return cbFn(fa, ConnectionVarp, SourceObjectVarp)
279
280	}
281	cbRefPtr := purego.NewCallback(fcb)
282	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
283	handlerID := gobject.SignalConnect(x.GoPointer(), "run", cbRefPtr)
284	glib.SaveHandlerMapping(handlerID, cbPtr)
285	return handlerID
286}
287
288func init() {
289	core.SetPackageName("GIO", "gio-2.0")
290	core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
291	var libs []uintptr
292	for _, libPath := range core.GetPaths("GIO") {
293		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
294		if err != nil {
295			panic(err)
296		}
297		libs = append(libs, lib)
298	}
299
300	core.PuregoSafeRegister(&xThreadedSocketServiceGLibType, libs, "g_threaded_socket_service_get_type")
301
302	core.PuregoSafeRegister(&xNewThreadedSocketService, libs, "g_threaded_socket_service_new")
303
304}

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