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 FilenameCompleterClass struct {
17 _ structs.HostLayout
18
19 ParentClass gobject.ObjectClass
20
21 xGotCompletionData uintptr
22
23 xGReserved1 uintptr
24
25 xGReserved2 uintptr
26
27 xGReserved3 uintptr
28}
29
30func (x *FilenameCompleterClass) GoPointer() uintptr {
31 return uintptr(unsafe.Pointer(x))
32}
33
34// OverrideGotCompletionData sets the "got_completion_data" callback function.
35func (x *FilenameCompleterClass) OverrideGotCompletionData(cb func(*FilenameCompleter)) {
36 if cb == nil {
37 x.xGotCompletionData = 0
38 } else {
39 x.xGotCompletionData = purego.NewCallback(func(FilenameCompleterVarp uintptr) {
40 cb(FilenameCompleterNewFromInternalPtr(FilenameCompleterVarp))
41 })
42 }
43}
44
45// GetGotCompletionData gets the "got_completion_data" callback function.
46func (x *FilenameCompleterClass) GetGotCompletionData() func(*FilenameCompleter) {
47 if x.xGotCompletionData == 0 {
48 return nil
49 }
50 var rawCallback func(FilenameCompleterVarp uintptr)
51 purego.RegisterFunc(&rawCallback, x.xGotCompletionData)
52 return func(FilenameCompleterVar *FilenameCompleter) {
53 rawCallback(FilenameCompleterVar.GoPointer())
54 }
55}
56
57// OverrideGReserved1 sets the "_g_reserved1" callback function.
58func (x *FilenameCompleterClass) OverrideGReserved1(cb func()) {
59 if cb == nil {
60 x.xGReserved1 = 0
61 } else {
62 x.xGReserved1 = purego.NewCallback(func() {
63 cb()
64 })
65 }
66}
67
68// GetGReserved1 gets the "_g_reserved1" callback function.
69func (x *FilenameCompleterClass) GetGReserved1() func() {
70 if x.xGReserved1 == 0 {
71 return nil
72 }
73 var rawCallback func()
74 purego.RegisterFunc(&rawCallback, x.xGReserved1)
75 return func() {
76 rawCallback()
77 }
78}
79
80// OverrideGReserved2 sets the "_g_reserved2" callback function.
81func (x *FilenameCompleterClass) OverrideGReserved2(cb func()) {
82 if cb == nil {
83 x.xGReserved2 = 0
84 } else {
85 x.xGReserved2 = purego.NewCallback(func() {
86 cb()
87 })
88 }
89}
90
91// GetGReserved2 gets the "_g_reserved2" callback function.
92func (x *FilenameCompleterClass) GetGReserved2() func() {
93 if x.xGReserved2 == 0 {
94 return nil
95 }
96 var rawCallback func()
97 purego.RegisterFunc(&rawCallback, x.xGReserved2)
98 return func() {
99 rawCallback()
100 }
101}
102
103// OverrideGReserved3 sets the "_g_reserved3" callback function.
104func (x *FilenameCompleterClass) OverrideGReserved3(cb func()) {
105 if cb == nil {
106 x.xGReserved3 = 0
107 } else {
108 x.xGReserved3 = purego.NewCallback(func() {
109 cb()
110 })
111 }
112}
113
114// GetGReserved3 gets the "_g_reserved3" callback function.
115func (x *FilenameCompleterClass) GetGReserved3() func() {
116 if x.xGReserved3 == 0 {
117 return nil
118 }
119 var rawCallback func()
120 purego.RegisterFunc(&rawCallback, x.xGReserved3)
121 return func() {
122 rawCallback()
123 }
124}
125
126// Completes partial file and directory names given a partial string by
127// looking in the file system for clues. Can return a list of possible
128// completion strings for widget implementations.
129type FilenameCompleter struct {
130 gobject.Object
131}
132
133var xFilenameCompleterGLibType func() types.GType
134
135func FilenameCompleterGLibType() types.GType {
136 return xFilenameCompleterGLibType()
137}
138
139func FilenameCompleterNewFromInternalPtr(ptr uintptr) *FilenameCompleter {
140 cls := &FilenameCompleter{}
141 cls.Ptr = ptr
142 return cls
143}
144
145var xNewFilenameCompleter func() uintptr
146
147// Creates a new filename completer.
148func NewFilenameCompleter() *FilenameCompleter {
149 var cls *FilenameCompleter
150
151 cret := xNewFilenameCompleter()
152
153 if cret == 0 {
154 return nil
155 }
156 cls = &FilenameCompleter{}
157 cls.Ptr = cret
158 return cls
159}
160
161var xFilenameCompleterGetCompletionSuffix func(uintptr, string) string
162
163// Obtains a suffix completion for @initial_text from @completer.
164//
165// Suffix will be an empty string if there's no shared suffix among matching
166// completions. If there's no matching completions anyway, `NULL` is returned.
167func (x *FilenameCompleter) GetCompletionSuffix(InitialTextVar string) string {
168
169 cret := xFilenameCompleterGetCompletionSuffix(x.GoPointer(), InitialTextVar)
170 return cret
171}
172
173var xFilenameCompleterGetCompletions func(uintptr, string) []string
174
175// Gets an array of completion strings for a given initial text.
176func (x *FilenameCompleter) GetCompletions(InitialTextVar string) []string {
177
178 cret := xFilenameCompleterGetCompletions(x.GoPointer(), InitialTextVar)
179 return cret
180}
181
182var xFilenameCompleterSetDirsOnly func(uintptr, bool)
183
184// If @dirs_only is %TRUE, @completer will only
185// complete directory names, and not file names.
186//
187// This function needs to be called before waiting for results from the
188// completer to be populated.
189func (x *FilenameCompleter) SetDirsOnly(DirsOnlyVar bool) {
190
191 xFilenameCompleterSetDirsOnly(x.GoPointer(), DirsOnlyVar)
192
193}
194
195func (c *FilenameCompleter) GoPointer() uintptr {
196 if c == nil {
197 return 0
198 }
199 return c.Ptr
200}
201
202func (c *FilenameCompleter) SetGoPointer(ptr uintptr) {
203 c.Ptr = ptr
204}
205
206// Emitted when the file name completion information comes available.
207func (x *FilenameCompleter) ConnectGotCompletionData(cb *func(FilenameCompleter)) uint {
208 cbPtr := uintptr(unsafe.Pointer(cb))
209 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
210 handlerID := gobject.SignalConnect(x.GoPointer(), "got-completion-data", cbRefPtr)
211 glib.SaveHandlerMapping(handlerID, cbPtr)
212 return handlerID
213 }
214
215 fcb := func(clsPtr uintptr) {
216 fa := FilenameCompleter{}
217 fa.Ptr = clsPtr
218 cbFn := *cb
219
220 cbFn(fa)
221
222 }
223 cbRefPtr := purego.NewCallback(fcb)
224 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
225 handlerID := gobject.SignalConnect(x.GoPointer(), "got-completion-data", cbRefPtr)
226 glib.SaveHandlerMapping(handlerID, cbPtr)
227 return handlerID
228}
229
230func init() {
231 core.SetPackageName("GIO", "gio-2.0")
232 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
233 var libs []uintptr
234 for _, libPath := range core.GetPaths("GIO") {
235 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
236 if err != nil {
237 panic(err)
238 }
239 libs = append(libs, lib)
240 }
241
242 core.PuregoSafeRegister(&xFilenameCompleterGLibType, libs, "g_filename_completer_get_type")
243
244 core.PuregoSafeRegister(&xNewFilenameCompleter, libs, "g_filename_completer_new")
245
246 core.PuregoSafeRegister(&xFilenameCompleterGetCompletionSuffix, libs, "g_filename_completer_get_completion_suffix")
247 core.PuregoSafeRegister(&xFilenameCompleterGetCompletions, libs, "g_filename_completer_get_completions")
248 core.PuregoSafeRegister(&xFilenameCompleterSetDirsOnly, libs, "g_filename_completer_set_dirs_only")
249
250}