v0.2.1 c0399be

gfilemonitor.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 FileMonitorClass struct {
17	_ structs.HostLayout
18
19	ParentClass gobject.ObjectClass
20
21	xChanged uintptr
22
23	xCancel uintptr
24
25	xGReserved1 uintptr
26
27	xGReserved2 uintptr
28
29	xGReserved3 uintptr
30
31	xGReserved4 uintptr
32
33	xGReserved5 uintptr
34}
35
36func (x *FileMonitorClass) GoPointer() uintptr {
37	return uintptr(unsafe.Pointer(x))
38}
39
40// OverrideChanged sets the "changed" callback function.
41func (x *FileMonitorClass) OverrideChanged(cb func(*FileMonitor, File, File, FileMonitorEvent)) {
42	if cb == nil {
43		x.xChanged = 0
44	} else {
45		x.xChanged = purego.NewCallback(func(MonitorVarp uintptr, FileVarp uintptr, OtherFileVarp uintptr, EventTypeVarp FileMonitorEvent) {
46			cb(FileMonitorNewFromInternalPtr(MonitorVarp), &FileBase{Ptr: FileVarp}, &FileBase{Ptr: OtherFileVarp}, EventTypeVarp)
47		})
48	}
49}
50
51// GetChanged gets the "changed" callback function.
52func (x *FileMonitorClass) GetChanged() func(*FileMonitor, File, File, FileMonitorEvent) {
53	if x.xChanged == 0 {
54		return nil
55	}
56	var rawCallback func(MonitorVarp uintptr, FileVarp uintptr, OtherFileVarp uintptr, EventTypeVarp FileMonitorEvent)
57	purego.RegisterFunc(&rawCallback, x.xChanged)
58	return func(MonitorVar *FileMonitor, FileVar File, OtherFileVar File, EventTypeVar FileMonitorEvent) {
59		rawCallback(MonitorVar.GoPointer(), FileVar.GoPointer(), OtherFileVar.GoPointer(), EventTypeVar)
60	}
61}
62
63// OverrideCancel sets the "cancel" callback function.
64func (x *FileMonitorClass) OverrideCancel(cb func(*FileMonitor) bool) {
65	if cb == nil {
66		x.xCancel = 0
67	} else {
68		x.xCancel = purego.NewCallback(func(MonitorVarp uintptr) bool {
69			return cb(FileMonitorNewFromInternalPtr(MonitorVarp))
70		})
71	}
72}
73
74// GetCancel gets the "cancel" callback function.
75func (x *FileMonitorClass) GetCancel() func(*FileMonitor) bool {
76	if x.xCancel == 0 {
77		return nil
78	}
79	var rawCallback func(MonitorVarp uintptr) bool
80	purego.RegisterFunc(&rawCallback, x.xCancel)
81	return func(MonitorVar *FileMonitor) bool {
82		return rawCallback(MonitorVar.GoPointer())
83	}
84}
85
86// OverrideGReserved1 sets the "_g_reserved1" callback function.
87func (x *FileMonitorClass) OverrideGReserved1(cb func()) {
88	if cb == nil {
89		x.xGReserved1 = 0
90	} else {
91		x.xGReserved1 = purego.NewCallback(func() {
92			cb()
93		})
94	}
95}
96
97// GetGReserved1 gets the "_g_reserved1" callback function.
98func (x *FileMonitorClass) GetGReserved1() func() {
99	if x.xGReserved1 == 0 {
100		return nil
101	}
102	var rawCallback func()
103	purego.RegisterFunc(&rawCallback, x.xGReserved1)
104	return func() {
105		rawCallback()
106	}
107}
108
109// OverrideGReserved2 sets the "_g_reserved2" callback function.
110func (x *FileMonitorClass) OverrideGReserved2(cb func()) {
111	if cb == nil {
112		x.xGReserved2 = 0
113	} else {
114		x.xGReserved2 = purego.NewCallback(func() {
115			cb()
116		})
117	}
118}
119
120// GetGReserved2 gets the "_g_reserved2" callback function.
121func (x *FileMonitorClass) GetGReserved2() func() {
122	if x.xGReserved2 == 0 {
123		return nil
124	}
125	var rawCallback func()
126	purego.RegisterFunc(&rawCallback, x.xGReserved2)
127	return func() {
128		rawCallback()
129	}
130}
131
132// OverrideGReserved3 sets the "_g_reserved3" callback function.
133func (x *FileMonitorClass) OverrideGReserved3(cb func()) {
134	if cb == nil {
135		x.xGReserved3 = 0
136	} else {
137		x.xGReserved3 = purego.NewCallback(func() {
138			cb()
139		})
140	}
141}
142
143// GetGReserved3 gets the "_g_reserved3" callback function.
144func (x *FileMonitorClass) GetGReserved3() func() {
145	if x.xGReserved3 == 0 {
146		return nil
147	}
148	var rawCallback func()
149	purego.RegisterFunc(&rawCallback, x.xGReserved3)
150	return func() {
151		rawCallback()
152	}
153}
154
155// OverrideGReserved4 sets the "_g_reserved4" callback function.
156func (x *FileMonitorClass) OverrideGReserved4(cb func()) {
157	if cb == nil {
158		x.xGReserved4 = 0
159	} else {
160		x.xGReserved4 = purego.NewCallback(func() {
161			cb()
162		})
163	}
164}
165
166// GetGReserved4 gets the "_g_reserved4" callback function.
167func (x *FileMonitorClass) GetGReserved4() func() {
168	if x.xGReserved4 == 0 {
169		return nil
170	}
171	var rawCallback func()
172	purego.RegisterFunc(&rawCallback, x.xGReserved4)
173	return func() {
174		rawCallback()
175	}
176}
177
178// OverrideGReserved5 sets the "_g_reserved5" callback function.
179func (x *FileMonitorClass) OverrideGReserved5(cb func()) {
180	if cb == nil {
181		x.xGReserved5 = 0
182	} else {
183		x.xGReserved5 = purego.NewCallback(func() {
184			cb()
185		})
186	}
187}
188
189// GetGReserved5 gets the "_g_reserved5" callback function.
190func (x *FileMonitorClass) GetGReserved5() func() {
191	if x.xGReserved5 == 0 {
192		return nil
193	}
194	var rawCallback func()
195	purego.RegisterFunc(&rawCallback, x.xGReserved5)
196	return func() {
197		rawCallback()
198	}
199}
200
201type FileMonitorPrivate struct {
202	_ structs.HostLayout
203}
204
205func (x *FileMonitorPrivate) GoPointer() uintptr {
206	return uintptr(unsafe.Pointer(x))
207}
208
209// Monitors a file or directory for changes.
210//
211// To obtain a `GFileMonitor` for a file or directory, use
212// [method@Gio.File.monitor], [method@Gio.File.monitor_file], or
213// [method@Gio.File.monitor_directory].
214//
215// To get informed about changes to the file or directory you are
216// monitoring, connect to the [signal@Gio.FileMonitor::changed] signal. The
217// signal will be emitted in the thread-default main context (see
218// [method@GLib.MainContext.push_thread_default]) of the thread that the monitor
219// was created in (though if the global default main context is blocked, this
220// may cause notifications to be blocked even if the thread-default
221// context is still running).
222type FileMonitor struct {
223	gobject.Object
224}
225
226var xFileMonitorGLibType func() types.GType
227
228func FileMonitorGLibType() types.GType {
229	return xFileMonitorGLibType()
230}
231
232func FileMonitorNewFromInternalPtr(ptr uintptr) *FileMonitor {
233	cls := &FileMonitor{}
234	cls.Ptr = ptr
235	return cls
236}
237
238var xFileMonitorCancel func(uintptr) bool
239
240// Cancels a file monitor.
241func (x *FileMonitor) Cancel() bool {
242
243	cret := xFileMonitorCancel(x.GoPointer())
244	return cret
245}
246
247var xFileMonitorEmitEvent func(uintptr, uintptr, uintptr, FileMonitorEvent)
248
249// Emits the #GFileMonitor::changed signal if a change
250// has taken place. Should be called from file monitor
251// implementations only.
252//
253// Implementations are responsible to call this method from the
254// thread-default main context (see [method@GLib.MainContext.push_thread_default])
255// of the thread that the monitor was created in.
256func (x *FileMonitor) EmitEvent(ChildVar File, OtherFileVar File, EventTypeVar FileMonitorEvent) {
257
258	xFileMonitorEmitEvent(x.GoPointer(), ChildVar.GoPointer(), OtherFileVar.GoPointer(), EventTypeVar)
259
260}
261
262var xFileMonitorIsCancelled func(uintptr) bool
263
264// Returns whether the monitor is canceled.
265func (x *FileMonitor) IsCancelled() bool {
266
267	cret := xFileMonitorIsCancelled(x.GoPointer())
268	return cret
269}
270
271var xFileMonitorSetRateLimit func(uintptr, int)
272
273// Sets the rate limit to which the @monitor will report
274// consecutive change events to the same file.
275func (x *FileMonitor) SetRateLimit(LimitMsecsVar int) {
276
277	xFileMonitorSetRateLimit(x.GoPointer(), LimitMsecsVar)
278
279}
280
281func (c *FileMonitor) GoPointer() uintptr {
282	if c == nil {
283		return 0
284	}
285	return c.Ptr
286}
287
288func (c *FileMonitor) SetGoPointer(ptr uintptr) {
289	c.Ptr = ptr
290}
291
292// GetPropertyCancelled gets the "cancelled" property.
293// Whether the monitor has been cancelled.
294func (x *FileMonitor) GetPropertyCancelled() bool {
295	var v gobject.Value
296	x.GetProperty("cancelled", &v)
297	return v.GetBoolean()
298}
299
300// SetPropertyRateLimit sets the "rate-limit" property.
301// The limit of the monitor to watch for changes, in milliseconds.
302func (x *FileMonitor) SetPropertyRateLimit(value int) {
303	var v gobject.Value
304	v.Init(gobject.TypeIntVal)
305	v.SetInt(value)
306	x.SetProperty("rate-limit", &v)
307}
308
309// GetPropertyRateLimit gets the "rate-limit" property.
310// The limit of the monitor to watch for changes, in milliseconds.
311func (x *FileMonitor) GetPropertyRateLimit() int {
312	var v gobject.Value
313	x.GetProperty("rate-limit", &v)
314	return v.GetInt()
315}
316
317// Emitted when @file has been changed.
318//
319// If using %G_FILE_MONITOR_WATCH_MOVES on a directory monitor, and
320// the information is available (and if supported by the backend),
321// @event_type may be %G_FILE_MONITOR_EVENT_RENAMED,
322// %G_FILE_MONITOR_EVENT_MOVED_IN or %G_FILE_MONITOR_EVENT_MOVED_OUT.
323//
324// In all cases @file will be a child of the monitored directory.  For
325// renames, @file will be the old name and @other_file is the new
326// name.  For "moved in" events, @file is the name of the file that
327// appeared and @other_file is the old name that it was moved from (in
328// another directory).  For "moved out" events, @file is the name of
329// the file that used to be in this directory and @other_file is the
330// name of the file at its new location.
331//
332// It makes sense to treat %G_FILE_MONITOR_EVENT_MOVED_IN as
333// equivalent to %G_FILE_MONITOR_EVENT_CREATED and
334// %G_FILE_MONITOR_EVENT_MOVED_OUT as equivalent to
335// %G_FILE_MONITOR_EVENT_DELETED, with extra information.
336// %G_FILE_MONITOR_EVENT_RENAMED is equivalent to a delete/create
337// pair.  This is exactly how the events will be reported in the case
338// that the %G_FILE_MONITOR_WATCH_MOVES flag is not in use.
339//
340// If using the deprecated flag %G_FILE_MONITOR_SEND_MOVED flag and @event_type is
341// %G_FILE_MONITOR_EVENT_MOVED, @file will be set to a #GFile containing the
342// old path, and @other_file will be set to a #GFile containing the new path.
343//
344// In all the other cases, @other_file will be set to #NULL.
345func (x *FileMonitor) ConnectChanged(cb *func(FileMonitor, uintptr, uintptr, FileMonitorEvent)) uint {
346	cbPtr := uintptr(unsafe.Pointer(cb))
347	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
348		handlerID := gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr)
349		glib.SaveHandlerMapping(handlerID, cbPtr)
350		return handlerID
351	}
352
353	fcb := func(clsPtr uintptr, FileVarp uintptr, OtherFileVarp uintptr, EventTypeVarp FileMonitorEvent) {
354		fa := FileMonitor{}
355		fa.Ptr = clsPtr
356		cbFn := *cb
357
358		cbFn(fa, FileVarp, OtherFileVarp, EventTypeVarp)
359
360	}
361	cbRefPtr := purego.NewCallback(fcb)
362	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
363	handlerID := gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr)
364	glib.SaveHandlerMapping(handlerID, cbPtr)
365	return handlerID
366}
367
368func init() {
369	core.SetPackageName("GIO", "gio-2.0")
370	core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
371	var libs []uintptr
372	for _, libPath := range core.GetPaths("GIO") {
373		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
374		if err != nil {
375			panic(err)
376		}
377		libs = append(libs, lib)
378	}
379
380	core.PuregoSafeRegister(&xFileMonitorGLibType, libs, "g_file_monitor_get_type")
381
382	core.PuregoSafeRegister(&xFileMonitorCancel, libs, "g_file_monitor_cancel")
383	core.PuregoSafeRegister(&xFileMonitorEmitEvent, libs, "g_file_monitor_emit_event")
384	core.PuregoSafeRegister(&xFileMonitorIsCancelled, libs, "g_file_monitor_is_cancelled")
385	core.PuregoSafeRegister(&xFileMonitorSetRateLimit, libs, "g_file_monitor_set_rate_limit")
386
387}

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