1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
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/gdk"
12 "github.com/bnema/puregotk/v4/gio"
13 "github.com/bnema/puregotk/v4/gobject"
14 "github.com/bnema/puregotk/v4/gobject/types"
15)
16
17type MountOperationClass struct {
18 _ structs.HostLayout
19
20 ParentClass gio.MountOperationClass
21
22 xGtkReserved1 uintptr
23
24 xGtkReserved2 uintptr
25
26 xGtkReserved3 uintptr
27
28 xGtkReserved4 uintptr
29}
30
31func (x *MountOperationClass) GoPointer() uintptr {
32 return uintptr(unsafe.Pointer(x))
33}
34
35// OverrideGtkReserved1 sets the "_gtk_reserved1" callback function.
36func (x *MountOperationClass) OverrideGtkReserved1(cb func()) {
37 if cb == nil {
38 x.xGtkReserved1 = 0
39 } else {
40 x.xGtkReserved1 = purego.NewCallback(func() {
41 cb()
42 })
43 }
44}
45
46// GetGtkReserved1 gets the "_gtk_reserved1" callback function.
47func (x *MountOperationClass) GetGtkReserved1() func() {
48 if x.xGtkReserved1 == 0 {
49 return nil
50 }
51 var rawCallback func()
52 purego.RegisterFunc(&rawCallback, x.xGtkReserved1)
53 return func() {
54 rawCallback()
55 }
56}
57
58// OverrideGtkReserved2 sets the "_gtk_reserved2" callback function.
59func (x *MountOperationClass) OverrideGtkReserved2(cb func()) {
60 if cb == nil {
61 x.xGtkReserved2 = 0
62 } else {
63 x.xGtkReserved2 = purego.NewCallback(func() {
64 cb()
65 })
66 }
67}
68
69// GetGtkReserved2 gets the "_gtk_reserved2" callback function.
70func (x *MountOperationClass) GetGtkReserved2() func() {
71 if x.xGtkReserved2 == 0 {
72 return nil
73 }
74 var rawCallback func()
75 purego.RegisterFunc(&rawCallback, x.xGtkReserved2)
76 return func() {
77 rawCallback()
78 }
79}
80
81// OverrideGtkReserved3 sets the "_gtk_reserved3" callback function.
82func (x *MountOperationClass) OverrideGtkReserved3(cb func()) {
83 if cb == nil {
84 x.xGtkReserved3 = 0
85 } else {
86 x.xGtkReserved3 = purego.NewCallback(func() {
87 cb()
88 })
89 }
90}
91
92// GetGtkReserved3 gets the "_gtk_reserved3" callback function.
93func (x *MountOperationClass) GetGtkReserved3() func() {
94 if x.xGtkReserved3 == 0 {
95 return nil
96 }
97 var rawCallback func()
98 purego.RegisterFunc(&rawCallback, x.xGtkReserved3)
99 return func() {
100 rawCallback()
101 }
102}
103
104// OverrideGtkReserved4 sets the "_gtk_reserved4" callback function.
105func (x *MountOperationClass) OverrideGtkReserved4(cb func()) {
106 if cb == nil {
107 x.xGtkReserved4 = 0
108 } else {
109 x.xGtkReserved4 = purego.NewCallback(func() {
110 cb()
111 })
112 }
113}
114
115// GetGtkReserved4 gets the "_gtk_reserved4" callback function.
116func (x *MountOperationClass) GetGtkReserved4() func() {
117 if x.xGtkReserved4 == 0 {
118 return nil
119 }
120 var rawCallback func()
121 purego.RegisterFunc(&rawCallback, x.xGtkReserved4)
122 return func() {
123 rawCallback()
124 }
125}
126
127type MountOperationPrivate struct {
128 _ structs.HostLayout
129}
130
131func (x *MountOperationPrivate) GoPointer() uintptr {
132 return uintptr(unsafe.Pointer(x))
133}
134
135// Asks the user for passwords and other information required to
136// mount a volume.
137//
138// `GtkMountOperation` is needed when mounting volumes:
139// It is an implementation of `GMountOperation` that can be used with
140// GIO functions for mounting volumes such as
141// [method@Gio.File.mount_enclosing_volume],
142// [method@Gio.File.mount_mountable],
143// [method@Gio.Volume.mount],
144// [method@Gio.Mount.unmount_with_operation] and others.
145//
146// When necessary, `GtkMountOperation` shows dialogs to let the user
147// enter passwords, ask questions or show processes blocking unmount.
148type MountOperation struct {
149 gio.MountOperation
150}
151
152var xMountOperationGLibType func() types.GType
153
154func MountOperationGLibType() types.GType {
155 return xMountOperationGLibType()
156}
157
158func MountOperationNewFromInternalPtr(ptr uintptr) *MountOperation {
159 cls := &MountOperation{}
160 cls.Ptr = ptr
161 return cls
162}
163
164var xNewMountOperation func(uintptr) uintptr
165
166// Creates a new `GtkMountOperation`.
167func NewMountOperation(ParentVar *Window) *MountOperation {
168 var cls *MountOperation
169
170 cret := xNewMountOperation(ParentVar.GoPointer())
171
172 if cret == 0 {
173 return nil
174 }
175 cls = &MountOperation{}
176 cls.Ptr = cret
177 return cls
178}
179
180var xMountOperationGetDisplay func(uintptr) uintptr
181
182// Gets the display on which windows of the `GtkMountOperation`
183// will be shown.
184func (x *MountOperation) GetDisplay() *gdk.Display {
185 var cls *gdk.Display
186
187 cret := xMountOperationGetDisplay(x.GoPointer())
188
189 if cret == 0 {
190 return nil
191 }
192 gobject.IncreaseRef(cret)
193 cls = &gdk.Display{}
194 cls.Ptr = cret
195 return cls
196}
197
198var xMountOperationGetParent func(uintptr) uintptr
199
200// Gets the transient parent used by the `GtkMountOperation`.
201func (x *MountOperation) GetParent() *Window {
202 var cls *Window
203
204 cret := xMountOperationGetParent(x.GoPointer())
205
206 if cret == 0 {
207 return nil
208 }
209 gobject.IncreaseRef(cret)
210 cls = &Window{}
211 cls.Ptr = cret
212 return cls
213}
214
215var xMountOperationIsShowing func(uintptr) bool
216
217// Returns whether the `GtkMountOperation` is currently displaying
218// a window.
219func (x *MountOperation) IsShowing() bool {
220
221 cret := xMountOperationIsShowing(x.GoPointer())
222 return cret
223}
224
225var xMountOperationSetDisplay func(uintptr, uintptr)
226
227// Sets the display to show windows of the `GtkMountOperation` on.
228func (x *MountOperation) SetDisplay(DisplayVar *gdk.Display) {
229
230 xMountOperationSetDisplay(x.GoPointer(), DisplayVar.GoPointer())
231
232}
233
234var xMountOperationSetParent func(uintptr, uintptr)
235
236// Sets the transient parent for windows shown by the
237// `GtkMountOperation`.
238func (x *MountOperation) SetParent(ParentVar *Window) {
239
240 xMountOperationSetParent(x.GoPointer(), ParentVar.GoPointer())
241
242}
243
244func (c *MountOperation) GoPointer() uintptr {
245 if c == nil {
246 return 0
247 }
248 return c.Ptr
249}
250
251func (c *MountOperation) SetGoPointer(ptr uintptr) {
252 c.Ptr = ptr
253}
254
255// GetPropertyIsShowing gets the "is-showing" property.
256// Whether a dialog is currently shown.
257func (x *MountOperation) GetPropertyIsShowing() bool {
258 var v gobject.Value
259 x.GetProperty("is-showing", &v)
260 return v.GetBoolean()
261}
262
263func init() {
264 core.SetPackageName("GTK", "gtk4")
265 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
266 var libs []uintptr
267 for _, libPath := range core.GetPaths("GTK") {
268 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
269 if err != nil {
270 panic(err)
271 }
272 libs = append(libs, lib)
273 }
274
275 core.PuregoSafeRegister(&xMountOperationGLibType, libs, "gtk_mount_operation_get_type")
276
277 core.PuregoSafeRegister(&xNewMountOperation, libs, "gtk_mount_operation_new")
278
279 core.PuregoSafeRegister(&xMountOperationGetDisplay, libs, "gtk_mount_operation_get_display")
280 core.PuregoSafeRegister(&xMountOperationGetParent, libs, "gtk_mount_operation_get_parent")
281 core.PuregoSafeRegister(&xMountOperationIsShowing, libs, "gtk_mount_operation_is_showing")
282 core.PuregoSafeRegister(&xMountOperationSetDisplay, libs, "gtk_mount_operation_set_display")
283 core.PuregoSafeRegister(&xMountOperationSetParent, libs, "gtk_mount_operation_set_parent")
284
285}