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
16// Virtual function table for #GApplication.
17type ApplicationClass struct {
18 _ structs.HostLayout
19
20 ParentClass gobject.ObjectClass
21
22 xStartup uintptr
23
24 xActivate uintptr
25
26 xOpen uintptr
27
28 xCommandLine uintptr
29
30 xLocalCommandLine uintptr
31
32 xBeforeEmit uintptr
33
34 xAfterEmit uintptr
35
36 xAddPlatformData uintptr
37
38 xQuitMainloop uintptr
39
40 xRunMainloop uintptr
41
42 xShutdown uintptr
43
44 xDbusRegister uintptr
45
46 xDbusUnregister uintptr
47
48 xHandleLocalOptions uintptr
49
50 xNameLost uintptr
51
52 Padding [7]uintptr
53}
54
55func (x *ApplicationClass) GoPointer() uintptr {
56 return uintptr(unsafe.Pointer(x))
57}
58
59// OverrideStartup sets the "startup" callback function.
60// invoked on the primary instance immediately after registration
61func (x *ApplicationClass) OverrideStartup(cb func(*Application)) {
62 if cb == nil {
63 x.xStartup = 0
64 } else {
65 x.xStartup = purego.NewCallback(func(ApplicationVarp uintptr) {
66 cb(ApplicationNewFromInternalPtr(ApplicationVarp))
67 })
68 }
69}
70
71// GetStartup gets the "startup" callback function.
72// invoked on the primary instance immediately after registration
73func (x *ApplicationClass) GetStartup() func(*Application) {
74 if x.xStartup == 0 {
75 return nil
76 }
77 var rawCallback func(ApplicationVarp uintptr)
78 purego.RegisterFunc(&rawCallback, x.xStartup)
79 return func(ApplicationVar *Application) {
80 rawCallback(ApplicationVar.GoPointer())
81 }
82}
83
84// OverrideActivate sets the "activate" callback function.
85// invoked on the primary instance when an activation occurs
86func (x *ApplicationClass) OverrideActivate(cb func(*Application)) {
87 if cb == nil {
88 x.xActivate = 0
89 } else {
90 x.xActivate = purego.NewCallback(func(ApplicationVarp uintptr) {
91 cb(ApplicationNewFromInternalPtr(ApplicationVarp))
92 })
93 }
94}
95
96// GetActivate gets the "activate" callback function.
97// invoked on the primary instance when an activation occurs
98func (x *ApplicationClass) GetActivate() func(*Application) {
99 if x.xActivate == 0 {
100 return nil
101 }
102 var rawCallback func(ApplicationVarp uintptr)
103 purego.RegisterFunc(&rawCallback, x.xActivate)
104 return func(ApplicationVar *Application) {
105 rawCallback(ApplicationVar.GoPointer())
106 }
107}
108
109// OverrideOpen sets the "open" callback function.
110// invoked on the primary instance when there are files to open
111func (x *ApplicationClass) OverrideOpen(cb func(*Application, uintptr, int, string)) {
112 if cb == nil {
113 x.xOpen = 0
114 } else {
115 x.xOpen = purego.NewCallback(func(ApplicationVarp uintptr, FilesVarp uintptr, NFilesVarp int, HintVarp string) {
116 cb(ApplicationNewFromInternalPtr(ApplicationVarp), FilesVarp, NFilesVarp, HintVarp)
117 })
118 }
119}
120
121// GetOpen gets the "open" callback function.
122// invoked on the primary instance when there are files to open
123func (x *ApplicationClass) GetOpen() func(*Application, uintptr, int, string) {
124 if x.xOpen == 0 {
125 return nil
126 }
127 var rawCallback func(ApplicationVarp uintptr, FilesVarp uintptr, NFilesVarp int, HintVarp string)
128 purego.RegisterFunc(&rawCallback, x.xOpen)
129 return func(ApplicationVar *Application, FilesVar uintptr, NFilesVar int, HintVar string) {
130 rawCallback(ApplicationVar.GoPointer(), FilesVar, NFilesVar, HintVar)
131 }
132}
133
134// OverrideCommandLine sets the "command_line" callback function.
135// invoked on the primary instance when a command-line is
136//
137// not handled locally
138func (x *ApplicationClass) OverrideCommandLine(cb func(*Application, *ApplicationCommandLine) int) {
139 if cb == nil {
140 x.xCommandLine = 0
141 } else {
142 x.xCommandLine = purego.NewCallback(func(ApplicationVarp uintptr, CommandLineVarp uintptr) int {
143 return cb(ApplicationNewFromInternalPtr(ApplicationVarp), ApplicationCommandLineNewFromInternalPtr(CommandLineVarp))
144 })
145 }
146}
147
148// GetCommandLine gets the "command_line" callback function.
149// invoked on the primary instance when a command-line is
150//
151// not handled locally
152func (x *ApplicationClass) GetCommandLine() func(*Application, *ApplicationCommandLine) int {
153 if x.xCommandLine == 0 {
154 return nil
155 }
156 var rawCallback func(ApplicationVarp uintptr, CommandLineVarp uintptr) int
157 purego.RegisterFunc(&rawCallback, x.xCommandLine)
158 return func(ApplicationVar *Application, CommandLineVar *ApplicationCommandLine) int {
159 return rawCallback(ApplicationVar.GoPointer(), CommandLineVar.GoPointer())
160 }
161}
162
163// OverrideLocalCommandLine sets the "local_command_line" callback function.
164// invoked (locally). The virtual function has the chance
165//
166// to inspect (and possibly replace) command line arguments. See
167// g_application_run() for more information. Also see the
168// #GApplication::handle-local-options signal, which is a simpler
169// alternative to handling some commandline options locally
170func (x *ApplicationClass) OverrideLocalCommandLine(cb func(*Application, *[]string, *int) bool) {
171 if cb == nil {
172 x.xLocalCommandLine = 0
173 } else {
174 x.xLocalCommandLine = purego.NewCallback(func(ApplicationVarp uintptr, ArgumentsVarp *[]string, ExitStatusVarp *int) bool {
175 return cb(ApplicationNewFromInternalPtr(ApplicationVarp), ArgumentsVarp, ExitStatusVarp)
176 })
177 }
178}
179
180// GetLocalCommandLine gets the "local_command_line" callback function.
181// invoked (locally). The virtual function has the chance
182//
183// to inspect (and possibly replace) command line arguments. See
184// g_application_run() for more information. Also see the
185// #GApplication::handle-local-options signal, which is a simpler
186// alternative to handling some commandline options locally
187func (x *ApplicationClass) GetLocalCommandLine() func(*Application, *[]string, *int) bool {
188 if x.xLocalCommandLine == 0 {
189 return nil
190 }
191 var rawCallback func(ApplicationVarp uintptr, ArgumentsVarp *[]string, ExitStatusVarp *int) bool
192 purego.RegisterFunc(&rawCallback, x.xLocalCommandLine)
193 return func(ApplicationVar *Application, ArgumentsVar *[]string, ExitStatusVar *int) bool {
194 return rawCallback(ApplicationVar.GoPointer(), ArgumentsVar, ExitStatusVar)
195 }
196}
197
198// OverrideBeforeEmit sets the "before_emit" callback function.
199// invoked on the primary instance before 'activate', 'open',
200//
201// 'command-line' or any action invocation, gets the 'platform data' from
202// the calling instance. Must chain up
203func (x *ApplicationClass) OverrideBeforeEmit(cb func(*Application, *glib.Variant)) {
204 if cb == nil {
205 x.xBeforeEmit = 0
206 } else {
207 x.xBeforeEmit = purego.NewCallback(func(ApplicationVarp uintptr, PlatformDataVarp *glib.Variant) {
208 cb(ApplicationNewFromInternalPtr(ApplicationVarp), PlatformDataVarp)
209 })
210 }
211}
212
213// GetBeforeEmit gets the "before_emit" callback function.
214// invoked on the primary instance before 'activate', 'open',
215//
216// 'command-line' or any action invocation, gets the 'platform data' from
217// the calling instance. Must chain up
218func (x *ApplicationClass) GetBeforeEmit() func(*Application, *glib.Variant) {
219 if x.xBeforeEmit == 0 {
220 return nil
221 }
222 var rawCallback func(ApplicationVarp uintptr, PlatformDataVarp *glib.Variant)
223 purego.RegisterFunc(&rawCallback, x.xBeforeEmit)
224 return func(ApplicationVar *Application, PlatformDataVar *glib.Variant) {
225 rawCallback(ApplicationVar.GoPointer(), PlatformDataVar)
226 }
227}
228
229// OverrideAfterEmit sets the "after_emit" callback function.
230// invoked on the primary instance after 'activate', 'open',
231//
232// 'command-line' or any action invocation, gets the 'platform data' from
233// the calling instance. Must chain up
234func (x *ApplicationClass) OverrideAfterEmit(cb func(*Application, *glib.Variant)) {
235 if cb == nil {
236 x.xAfterEmit = 0
237 } else {
238 x.xAfterEmit = purego.NewCallback(func(ApplicationVarp uintptr, PlatformDataVarp *glib.Variant) {
239 cb(ApplicationNewFromInternalPtr(ApplicationVarp), PlatformDataVarp)
240 })
241 }
242}
243
244// GetAfterEmit gets the "after_emit" callback function.
245// invoked on the primary instance after 'activate', 'open',
246//
247// 'command-line' or any action invocation, gets the 'platform data' from
248// the calling instance. Must chain up
249func (x *ApplicationClass) GetAfterEmit() func(*Application, *glib.Variant) {
250 if x.xAfterEmit == 0 {
251 return nil
252 }
253 var rawCallback func(ApplicationVarp uintptr, PlatformDataVarp *glib.Variant)
254 purego.RegisterFunc(&rawCallback, x.xAfterEmit)
255 return func(ApplicationVar *Application, PlatformDataVar *glib.Variant) {
256 rawCallback(ApplicationVar.GoPointer(), PlatformDataVar)
257 }
258}
259
260// OverrideAddPlatformData sets the "add_platform_data" callback function.
261// invoked (locally) to add 'platform data' to be sent to
262//
263// the primary instance when activating, opening or invoking actions. Must chain up
264func (x *ApplicationClass) OverrideAddPlatformData(cb func(*Application, *glib.VariantBuilder)) {
265 if cb == nil {
266 x.xAddPlatformData = 0
267 } else {
268 x.xAddPlatformData = purego.NewCallback(func(ApplicationVarp uintptr, BuilderVarp *glib.VariantBuilder) {
269 cb(ApplicationNewFromInternalPtr(ApplicationVarp), BuilderVarp)
270 })
271 }
272}
273
274// GetAddPlatformData gets the "add_platform_data" callback function.
275// invoked (locally) to add 'platform data' to be sent to
276//
277// the primary instance when activating, opening or invoking actions. Must chain up
278func (x *ApplicationClass) GetAddPlatformData() func(*Application, *glib.VariantBuilder) {
279 if x.xAddPlatformData == 0 {
280 return nil
281 }
282 var rawCallback func(ApplicationVarp uintptr, BuilderVarp *glib.VariantBuilder)
283 purego.RegisterFunc(&rawCallback, x.xAddPlatformData)
284 return func(ApplicationVar *Application, BuilderVar *glib.VariantBuilder) {
285 rawCallback(ApplicationVar.GoPointer(), BuilderVar)
286 }
287}
288
289// OverrideQuitMainloop sets the "quit_mainloop" callback function.
290// Used to be invoked on the primary instance when the use
291//
292// count of the application drops to zero (and after any inactivity
293// timeout, if requested). Not used anymore since 2.32
294func (x *ApplicationClass) OverrideQuitMainloop(cb func(*Application)) {
295 if cb == nil {
296 x.xQuitMainloop = 0
297 } else {
298 x.xQuitMainloop = purego.NewCallback(func(ApplicationVarp uintptr) {
299 cb(ApplicationNewFromInternalPtr(ApplicationVarp))
300 })
301 }
302}
303
304// GetQuitMainloop gets the "quit_mainloop" callback function.
305// Used to be invoked on the primary instance when the use
306//
307// count of the application drops to zero (and after any inactivity
308// timeout, if requested). Not used anymore since 2.32
309func (x *ApplicationClass) GetQuitMainloop() func(*Application) {
310 if x.xQuitMainloop == 0 {
311 return nil
312 }
313 var rawCallback func(ApplicationVarp uintptr)
314 purego.RegisterFunc(&rawCallback, x.xQuitMainloop)
315 return func(ApplicationVar *Application) {
316 rawCallback(ApplicationVar.GoPointer())
317 }
318}
319
320// OverrideRunMainloop sets the "run_mainloop" callback function.
321// Used to be invoked on the primary instance from
322//
323// g_application_run() if the use-count is non-zero. Since 2.32,
324// GApplication is iterating the main context directly and is not
325// using @run_mainloop anymore
326func (x *ApplicationClass) OverrideRunMainloop(cb func(*Application)) {
327 if cb == nil {
328 x.xRunMainloop = 0
329 } else {
330 x.xRunMainloop = purego.NewCallback(func(ApplicationVarp uintptr) {
331 cb(ApplicationNewFromInternalPtr(ApplicationVarp))
332 })
333 }
334}
335
336// GetRunMainloop gets the "run_mainloop" callback function.
337// Used to be invoked on the primary instance from
338//
339// g_application_run() if the use-count is non-zero. Since 2.32,
340// GApplication is iterating the main context directly and is not
341// using @run_mainloop anymore
342func (x *ApplicationClass) GetRunMainloop() func(*Application) {
343 if x.xRunMainloop == 0 {
344 return nil
345 }
346 var rawCallback func(ApplicationVarp uintptr)
347 purego.RegisterFunc(&rawCallback, x.xRunMainloop)
348 return func(ApplicationVar *Application) {
349 rawCallback(ApplicationVar.GoPointer())
350 }
351}
352
353// OverrideShutdown sets the "shutdown" callback function.
354// invoked only on the registered primary instance immediately
355//
356// after the main loop terminates
357func (x *ApplicationClass) OverrideShutdown(cb func(*Application)) {
358 if cb == nil {
359 x.xShutdown = 0
360 } else {
361 x.xShutdown = purego.NewCallback(func(ApplicationVarp uintptr) {
362 cb(ApplicationNewFromInternalPtr(ApplicationVarp))
363 })
364 }
365}
366
367// GetShutdown gets the "shutdown" callback function.
368// invoked only on the registered primary instance immediately
369//
370// after the main loop terminates
371func (x *ApplicationClass) GetShutdown() func(*Application) {
372 if x.xShutdown == 0 {
373 return nil
374 }
375 var rawCallback func(ApplicationVarp uintptr)
376 purego.RegisterFunc(&rawCallback, x.xShutdown)
377 return func(ApplicationVar *Application) {
378 rawCallback(ApplicationVar.GoPointer())
379 }
380}
381
382// OverrideDbusRegister sets the "dbus_register" callback function.
383// invoked locally during registration, if the application is
384//
385// using its D-Bus backend. You can use this to export extra objects on the
386// bus, that need to exist before the application tries to own the bus name.
387// The function is passed the #GDBusConnection to to session bus, and the
388// object path that #GApplication will use to export its D-Bus API.
389// If this function returns %TRUE, registration will proceed; otherwise
390// registration will abort. Since: 2.34
391func (x *ApplicationClass) OverrideDbusRegister(cb func(*Application, *DBusConnection, string) bool) {
392 if cb == nil {
393 x.xDbusRegister = 0
394 } else {
395 x.xDbusRegister = purego.NewCallback(func(ApplicationVarp uintptr, ConnectionVarp uintptr, ObjectPathVarp string) bool {
396 return cb(ApplicationNewFromInternalPtr(ApplicationVarp), DBusConnectionNewFromInternalPtr(ConnectionVarp), ObjectPathVarp)
397 })
398 }
399}
400
401// GetDbusRegister gets the "dbus_register" callback function.
402// invoked locally during registration, if the application is
403//
404// using its D-Bus backend. You can use this to export extra objects on the
405// bus, that need to exist before the application tries to own the bus name.
406// The function is passed the #GDBusConnection to to session bus, and the
407// object path that #GApplication will use to export its D-Bus API.
408// If this function returns %TRUE, registration will proceed; otherwise
409// registration will abort. Since: 2.34
410func (x *ApplicationClass) GetDbusRegister() func(*Application, *DBusConnection, string) bool {
411 if x.xDbusRegister == 0 {
412 return nil
413 }
414 var rawCallback func(ApplicationVarp uintptr, ConnectionVarp uintptr, ObjectPathVarp string) bool
415 purego.RegisterFunc(&rawCallback, x.xDbusRegister)
416 return func(ApplicationVar *Application, ConnectionVar *DBusConnection, ObjectPathVar string) bool {
417 return rawCallback(ApplicationVar.GoPointer(), ConnectionVar.GoPointer(), ObjectPathVar)
418 }
419}
420
421// OverrideDbusUnregister sets the "dbus_unregister" callback function.
422// invoked locally during unregistration, if the application
423//
424// is using its D-Bus backend. Use this to undo anything done by
425// the @dbus_register vfunc. Since: 2.34
426func (x *ApplicationClass) OverrideDbusUnregister(cb func(*Application, *DBusConnection, string)) {
427 if cb == nil {
428 x.xDbusUnregister = 0
429 } else {
430 x.xDbusUnregister = purego.NewCallback(func(ApplicationVarp uintptr, ConnectionVarp uintptr, ObjectPathVarp string) {
431 cb(ApplicationNewFromInternalPtr(ApplicationVarp), DBusConnectionNewFromInternalPtr(ConnectionVarp), ObjectPathVarp)
432 })
433 }
434}
435
436// GetDbusUnregister gets the "dbus_unregister" callback function.
437// invoked locally during unregistration, if the application
438//
439// is using its D-Bus backend. Use this to undo anything done by
440// the @dbus_register vfunc. Since: 2.34
441func (x *ApplicationClass) GetDbusUnregister() func(*Application, *DBusConnection, string) {
442 if x.xDbusUnregister == 0 {
443 return nil
444 }
445 var rawCallback func(ApplicationVarp uintptr, ConnectionVarp uintptr, ObjectPathVarp string)
446 purego.RegisterFunc(&rawCallback, x.xDbusUnregister)
447 return func(ApplicationVar *Application, ConnectionVar *DBusConnection, ObjectPathVar string) {
448 rawCallback(ApplicationVar.GoPointer(), ConnectionVar.GoPointer(), ObjectPathVar)
449 }
450}
451
452// OverrideHandleLocalOptions sets the "handle_local_options" callback function.
453// invoked locally after the parsing of the commandline
454//
455// options has occurred. Since: 2.40
456func (x *ApplicationClass) OverrideHandleLocalOptions(cb func(*Application, *glib.VariantDict) int) {
457 if cb == nil {
458 x.xHandleLocalOptions = 0
459 } else {
460 x.xHandleLocalOptions = purego.NewCallback(func(ApplicationVarp uintptr, OptionsVarp *glib.VariantDict) int {
461 return cb(ApplicationNewFromInternalPtr(ApplicationVarp), OptionsVarp)
462 })
463 }
464}
465
466// GetHandleLocalOptions gets the "handle_local_options" callback function.
467// invoked locally after the parsing of the commandline
468//
469// options has occurred. Since: 2.40
470func (x *ApplicationClass) GetHandleLocalOptions() func(*Application, *glib.VariantDict) int {
471 if x.xHandleLocalOptions == 0 {
472 return nil
473 }
474 var rawCallback func(ApplicationVarp uintptr, OptionsVarp *glib.VariantDict) int
475 purego.RegisterFunc(&rawCallback, x.xHandleLocalOptions)
476 return func(ApplicationVar *Application, OptionsVar *glib.VariantDict) int {
477 return rawCallback(ApplicationVar.GoPointer(), OptionsVar)
478 }
479}
480
481// OverrideNameLost sets the "name_lost" callback function.
482// invoked when another instance is taking over the name. Since: 2.60
483func (x *ApplicationClass) OverrideNameLost(cb func(*Application) bool) {
484 if cb == nil {
485 x.xNameLost = 0
486 } else {
487 x.xNameLost = purego.NewCallback(func(ApplicationVarp uintptr) bool {
488 return cb(ApplicationNewFromInternalPtr(ApplicationVarp))
489 })
490 }
491}
492
493// GetNameLost gets the "name_lost" callback function.
494// invoked when another instance is taking over the name. Since: 2.60
495func (x *ApplicationClass) GetNameLost() func(*Application) bool {
496 if x.xNameLost == 0 {
497 return nil
498 }
499 var rawCallback func(ApplicationVarp uintptr) bool
500 purego.RegisterFunc(&rawCallback, x.xNameLost)
501 return func(ApplicationVar *Application) bool {
502 return rawCallback(ApplicationVar.GoPointer())
503 }
504}
505
506type ApplicationPrivate struct {
507 _ structs.HostLayout
508}
509
510func (x *ApplicationPrivate) GoPointer() uintptr {
511 return uintptr(unsafe.Pointer(x))
512}
513
514// `GApplication` is the core class for application support.
515//
516// A `GApplication` is the foundation of an application. It wraps some
517// low-level platform-specific services and is intended to act as the
518// foundation for higher-level application classes such as
519// `GtkApplication` or `MxApplication`. In general, you should not use
520// this class outside of a higher level framework.
521//
522// `GApplication` provides convenient life-cycle management by maintaining
523// a "use count" for the primary application instance. The use count can
524// be changed using [method@Gio.Application.hold] and
525// [method@Gio.Application.release]. If it drops to zero, the application
526// exits. Higher-level classes such as `GtkApplication` employ the use count
527// to ensure that the application stays alive as long as it has any opened
528// windows.
529//
530// Another feature that `GApplication` (optionally) provides is process
531// uniqueness. Applications can make use of this functionality by
532// providing a unique application ID. If given, only one application
533// with this ID can be running at a time per session. The session
534// concept is platform-dependent, but corresponds roughly to a graphical
535// desktop login. When your application is launched again, its
536// arguments are passed through platform communication to the already
537// running program. The already running instance of the program is
538// called the "primary instance"; for non-unique applications this is
539// always the current instance. On Linux, the D-Bus session bus
540// is used for communication.
541//
542// The use of `GApplication` differs from some other commonly-used
543// uniqueness libraries (such as libunique) in important ways. The
544// application is not expected to manually register itself and check
545// if it is the primary instance. Instead, the main() function of a
546// `GApplication` should do very little more than instantiating the
547// application instance, possibly connecting signal handlers, then
548// calling [method@Gio.Application.run]. All checks for uniqueness are done
549// internally. If the application is the primary instance then the
550// startup signal is emitted and the mainloop runs. If the application
551// is not the primary instance then a signal is sent to the primary
552// instance and [method@Gio.Application.run] promptly returns. See the code
553// examples below.
554//
555// If used, the expected form of an application identifier is the
556// same as that of a
557// [D-Bus well-known bus name](https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus).
558// Examples include: `com.example.MyApp`, `org.example.internal_apps.Calculator`,
559// `org._7_zip.Archiver`.
560// For details on valid application identifiers, see [func@Gio.Application.id_is_valid].
561//
562// On Linux, the application identifier is claimed as a well-known bus name
563// on the user's session bus. This means that the uniqueness of your
564// application is scoped to the current session. It also means that your
565// application may provide additional services (through registration of other
566// object paths) at that bus name. The registration of these object paths
567// should be done with the shared GDBus session bus. Note that due to the
568// internal architecture of GDBus, method calls can be dispatched at any time
569// (even if a main loop is not running). For this reason, you must ensure that
570// any object paths that you wish to register are registered before #GApplication
571// attempts to acquire the bus name of your application (which happens in
572// [method@Gio.Application.register]). Unfortunately, this means that you cannot
573// use [property@Gio.Application:is-remote] to decide if you want to register
574// object paths.
575//
576// `GApplication` also implements the [iface@Gio.ActionGroup] and [iface@Gio.ActionMap]
577// interfaces and lets you easily export actions by adding them with
578// [method@Gio.ActionMap.add_action]. When invoking an action by calling
579// [method@Gio.ActionGroup.activate_action] on the application, it is always
580// invoked in the primary instance. The actions are also exported on
581// the session bus, and GIO provides the [class@Gio.DBusActionGroup] wrapper to
582// conveniently access them remotely. GIO provides a [class@Gio.DBusMenuModel] wrapper
583// for remote access to exported [class@Gio.MenuModel]s.
584//
585// Note: Due to the fact that actions are exported on the session bus,
586// using `maybe` parameters is not supported, since D-Bus does not support
587// `maybe` types.
588//
589// There is a number of different entry points into a `GApplication`:
590//
591// - via 'Activate' (i.e. just starting the application)
592//
593// - via 'Open' (i.e. opening some files)
594//
595// - by handling a command-line
596//
597// - via activating an action
598//
599// The [signal@Gio.Application::startup] signal lets you handle the application
600// initialization for all of these in a single place.
601//
602// Regardless of which of these entry points is used to start the
603// application, `GApplication` passes some ‘platform data’ from the
604// launching instance to the primary instance, in the form of a
605// [struct@GLib.Variant] dictionary mapping strings to variants. To use platform
606// data, override the [vfunc@Gio.Application.before_emit] or
607// [vfunc@Gio.Application.after_emit] virtual functions
608// in your `GApplication` subclass. When dealing with
609// [class@Gio.ApplicationCommandLine] objects, the platform data is
610// directly available via [method@Gio.ApplicationCommandLine.get_cwd],
611// [method@Gio.ApplicationCommandLine.get_environ] and
612// [method@Gio.ApplicationCommandLine.get_platform_data].
613//
614// As the name indicates, the platform data may vary depending on the
615// operating system, but it always includes the current directory (key
616// `cwd`), and optionally the environment (ie the set of environment
617// variables and their values) of the calling process (key `environ`).
618// The environment is only added to the platform data if the
619// `G_APPLICATION_SEND_ENVIRONMENT` flag is set. `GApplication` subclasses
620// can add their own platform data by overriding the
621// [vfunc@Gio.Application.add_platform_data] virtual function. For instance,
622// `GtkApplication` adds startup notification data in this way.
623//
624// To parse commandline arguments you may handle the
625// [signal@Gio.Application::command-line] signal or override the
626// [vfunc@Gio.Application.local_command_line] virtual function, to parse them in
627// either the primary instance or the local instance, respectively.
628//
629// For an example of opening files with a `GApplication`, see
630// [gapplication-example-open.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-open.c).
631//
632// For an example of using actions with `GApplication`, see
633// [gapplication-example-actions.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-actions.c).
634//
635// For an example of using extra D-Bus hooks with `GApplication`, see
636// [gapplication-example-dbushooks.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-dbushooks.c).
637type Application struct {
638 gobject.Object
639}
640
641var xApplicationGLibType func() types.GType
642
643func ApplicationGLibType() types.GType {
644 return xApplicationGLibType()
645}
646
647func ApplicationNewFromInternalPtr(ptr uintptr) *Application {
648 cls := &Application{}
649 cls.Ptr = ptr
650 return cls
651}
652
653var xNewApplication func(uintptr, ApplicationFlags) uintptr
654
655// Creates a new #GApplication instance.
656//
657// If non-%NULL, the application id must be valid. See
658// g_application_id_is_valid().
659//
660// If no application ID is given then some features of #GApplication
661// (most notably application uniqueness) will be disabled.
662func NewApplication(ApplicationIdVar *string, FlagsVar ApplicationFlags) *Application {
663 var cls *Application
664
665 ApplicationIdVarPtr := core.GStrdupNullable(ApplicationIdVar)
666 defer core.GFreeNullable(ApplicationIdVarPtr)
667
668 cret := xNewApplication(ApplicationIdVarPtr, FlagsVar)
669
670 if cret == 0 {
671 return nil
672 }
673 cls = &Application{}
674 cls.Ptr = cret
675 return cls
676}
677
678var xApplicationActivate func(uintptr)
679
680// Activates the application.
681//
682// In essence, this results in the #GApplication::activate signal being
683// emitted in the primary instance.
684//
685// The application must be registered before calling this function.
686func (x *Application) Activate() {
687
688 xApplicationActivate(x.GoPointer())
689
690}
691
692var xApplicationAddMainOption func(uintptr, string, byte, glib.OptionFlags, glib.OptionArg, string, uintptr)
693
694// Add an option to be handled by @application.
695//
696// Calling this function is the equivalent of calling
697// g_application_add_main_option_entries() with a single #GOptionEntry
698// that has its arg_data member set to %NULL.
699//
700// The parsed arguments will be packed into a #GVariantDict which
701// is passed to #GApplication::handle-local-options. If
702// %G_APPLICATION_HANDLES_COMMAND_LINE is set, then it will also
703// be sent to the primary instance. See
704// g_application_add_main_option_entries() for more details.
705//
706// See #GOptionEntry for more documentation of the arguments.
707func (x *Application) AddMainOption(LongNameVar string, ShortNameVar byte, FlagsVar glib.OptionFlags, ArgVar glib.OptionArg, DescriptionVar string, ArgDescriptionVar *string) {
708
709 ArgDescriptionVarPtr := core.GStrdupNullable(ArgDescriptionVar)
710 defer core.GFreeNullable(ArgDescriptionVarPtr)
711
712 xApplicationAddMainOption(x.GoPointer(), LongNameVar, ShortNameVar, FlagsVar, ArgVar, DescriptionVar, ArgDescriptionVarPtr)
713
714}
715
716var xApplicationAddMainOptionEntries func(uintptr, []glib.OptionEntry)
717
718// Adds main option entries to be handled by @application.
719//
720// This function is comparable to g_option_context_add_main_entries().
721//
722// After the commandline arguments are parsed, the
723// #GApplication::handle-local-options signal will be emitted. At this
724// point, the application can inspect the values pointed to by @arg_data
725// in the given #GOptionEntrys.
726//
727// Unlike #GOptionContext, #GApplication supports giving a %NULL
728// @arg_data for a non-callback #GOptionEntry. This results in the
729// argument in question being packed into a #GVariantDict which is also
730// passed to #GApplication::handle-local-options, where it can be
731// inspected and modified. If %G_APPLICATION_HANDLES_COMMAND_LINE is
732// set, then the resulting dictionary is sent to the primary instance,
733// where g_application_command_line_get_options_dict() will return it.
734// As it has been passed outside the process at this point, the types of all
735// values in the options dict must be checked before being used.
736// This "packing" is done according to the type of the argument --
737// booleans for normal flags, strings for strings, bytestrings for
738// filenames, etc. The packing only occurs if the flag is given (ie: we
739// do not pack a "false" #GVariant in the case that a flag is missing).
740//
741// In general, it is recommended that all commandline arguments are
742// parsed locally. The options dictionary should then be used to
743// transmit the result of the parsing to the primary instance, where
744// g_variant_dict_lookup() can be used. For local options, it is
745// possible to either use @arg_data in the usual way, or to consult (and
746// potentially remove) the option from the options dictionary.
747//
748// This function is new in GLib 2.40. Before then, the only real choice
749// was to send all of the commandline arguments (options and all) to the
750// primary instance for handling. #GApplication ignored them completely
751// on the local side. Calling this function "opts in" to the new
752// behaviour, and in particular, means that unrecognized options will be
753// treated as errors. Unrecognized options have never been ignored when
754// %G_APPLICATION_HANDLES_COMMAND_LINE is unset.
755//
756// If #GApplication::handle-local-options needs to see the list of
757// filenames, then the use of %G_OPTION_REMAINING is recommended. If
758// @arg_data is %NULL then %G_OPTION_REMAINING can be used as a key into
759// the options dictionary. If you do use %G_OPTION_REMAINING then you
760// need to handle these arguments for yourself because once they are
761// consumed, they will no longer be visible to the default handling
762// (which treats them as filenames to be opened).
763//
764// It is important to use the proper GVariant format when retrieving
765// the options with g_variant_dict_lookup():
766// - for %G_OPTION_ARG_NONE, use `b`
767// - for %G_OPTION_ARG_STRING, use `&s`
768// - for %G_OPTION_ARG_INT, use `i`
769// - for %G_OPTION_ARG_INT64, use `x`
770// - for %G_OPTION_ARG_DOUBLE, use `d`
771// - for %G_OPTION_ARG_FILENAME, use `^&ay`
772// - for %G_OPTION_ARG_STRING_ARRAY, use `^a&s`
773// - for %G_OPTION_ARG_FILENAME_ARRAY, use `^a&ay`
774func (x *Application) AddMainOptionEntries(EntriesVar []glib.OptionEntry) {
775
776 xApplicationAddMainOptionEntries(x.GoPointer(), EntriesVar)
777
778}
779
780var xApplicationAddOptionGroup func(uintptr, *glib.OptionGroup)
781
782// Adds a #GOptionGroup to the commandline handling of @application.
783//
784// This function is comparable to g_option_context_add_group().
785//
786// Unlike g_application_add_main_option_entries(), this function does
787// not deal with %NULL @arg_data and never transmits options to the
788// primary instance.
789//
790// The reason for that is because, by the time the options arrive at the
791// primary instance, it is typically too late to do anything with them.
792// Taking the GTK option group as an example: GTK will already have been
793// initialised by the time the #GApplication::command-line handler runs.
794// In the case that this is not the first-running instance of the
795// application, the existing instance may already have been running for
796// a very long time.
797//
798// This means that the options from #GOptionGroup are only really usable
799// in the case that the instance of the application being run is the
800// first instance. Passing options like `--display=` or `--gdk-debug=`
801// on future runs will have no effect on the existing primary instance.
802//
803// Calling this function will cause the options in the supplied option
804// group to be parsed, but it does not cause you to be "opted in" to the
805// new functionality whereby unrecognized options are rejected even if
806// %G_APPLICATION_HANDLES_COMMAND_LINE was given.
807func (x *Application) AddOptionGroup(GroupVar *glib.OptionGroup) {
808
809 xApplicationAddOptionGroup(x.GoPointer(), GroupVar)
810
811}
812
813var xApplicationBindBusyProperty func(uintptr, uintptr, string)
814
815// Marks @application as busy (see g_application_mark_busy()) while
816// @property on @object is %TRUE.
817//
818// The binding holds a reference to @application while it is active, but
819// not to @object. Instead, the binding is destroyed when @object is
820// finalized.
821func (x *Application) BindBusyProperty(ObjectVar *gobject.Object, PropertyVar string) {
822
823 xApplicationBindBusyProperty(x.GoPointer(), ObjectVar.GoPointer(), PropertyVar)
824
825}
826
827var xApplicationGetApplicationId func(uintptr) string
828
829// Gets the unique identifier for @application.
830func (x *Application) GetApplicationId() string {
831
832 cret := xApplicationGetApplicationId(x.GoPointer())
833 return cret
834}
835
836var xApplicationGetDbusConnection func(uintptr) uintptr
837
838// Gets the #GDBusConnection being used by the application, or %NULL.
839//
840// If #GApplication is using its D-Bus backend then this function will
841// return the #GDBusConnection being used for uniqueness and
842// communication with the desktop environment and other instances of the
843// application.
844//
845// If #GApplication is not using D-Bus then this function will return
846// %NULL. This includes the situation where the D-Bus backend would
847// normally be in use but we were unable to connect to the bus.
848//
849// This function must not be called before the application has been
850// registered. See g_application_get_is_registered().
851func (x *Application) GetDbusConnection() *DBusConnection {
852 var cls *DBusConnection
853
854 cret := xApplicationGetDbusConnection(x.GoPointer())
855
856 if cret == 0 {
857 return nil
858 }
859 gobject.IncreaseRef(cret)
860 cls = &DBusConnection{}
861 cls.Ptr = cret
862 return cls
863}
864
865var xApplicationGetDbusObjectPath func(uintptr) string
866
867// Gets the D-Bus object path being used by the application, or %NULL.
868//
869// If #GApplication is using its D-Bus backend then this function will
870// return the D-Bus object path that #GApplication is using. If the
871// application is the primary instance then there is an object published
872// at this path. If the application is not the primary instance then
873// the result of this function is undefined.
874//
875// If #GApplication is not using D-Bus then this function will return
876// %NULL. This includes the situation where the D-Bus backend would
877// normally be in use but we were unable to connect to the bus.
878//
879// This function must not be called before the application has been
880// registered. See g_application_get_is_registered().
881func (x *Application) GetDbusObjectPath() string {
882
883 cret := xApplicationGetDbusObjectPath(x.GoPointer())
884 return cret
885}
886
887var xApplicationGetFlags func(uintptr) ApplicationFlags
888
889// Gets the flags for @application.
890//
891// See #GApplicationFlags.
892func (x *Application) GetFlags() ApplicationFlags {
893
894 cret := xApplicationGetFlags(x.GoPointer())
895 return cret
896}
897
898var xApplicationGetInactivityTimeout func(uintptr) uint
899
900// Gets the current inactivity timeout for the application.
901//
902// This is the amount of time (in milliseconds) after the last call to
903// g_application_release() before the application stops running.
904func (x *Application) GetInactivityTimeout() uint {
905
906 cret := xApplicationGetInactivityTimeout(x.GoPointer())
907 return cret
908}
909
910var xApplicationGetIsBusy func(uintptr) bool
911
912// Gets the application's current busy state, as set through
913// g_application_mark_busy() or g_application_bind_busy_property().
914func (x *Application) GetIsBusy() bool {
915
916 cret := xApplicationGetIsBusy(x.GoPointer())
917 return cret
918}
919
920var xApplicationGetIsRegistered func(uintptr) bool
921
922// Checks if @application is registered.
923//
924// An application is registered if g_application_register() has been
925// successfully called.
926func (x *Application) GetIsRegistered() bool {
927
928 cret := xApplicationGetIsRegistered(x.GoPointer())
929 return cret
930}
931
932var xApplicationGetIsRemote func(uintptr) bool
933
934// Checks if @application is remote.
935//
936// If @application is remote then it means that another instance of
937// application already exists (the 'primary' instance). Calls to
938// perform actions on @application will result in the actions being
939// performed by the primary instance.
940//
941// The value of this property cannot be accessed before
942// g_application_register() has been called. See
943// g_application_get_is_registered().
944func (x *Application) GetIsRemote() bool {
945
946 cret := xApplicationGetIsRemote(x.GoPointer())
947 return cret
948}
949
950var xApplicationGetResourceBasePath func(uintptr) string
951
952// Gets the resource base path of @application.
953//
954// See g_application_set_resource_base_path() for more information.
955func (x *Application) GetResourceBasePath() string {
956
957 cret := xApplicationGetResourceBasePath(x.GoPointer())
958 return cret
959}
960
961var xApplicationGetVersion func(uintptr) string
962
963// Gets the version of @application.
964func (x *Application) GetVersion() string {
965
966 cret := xApplicationGetVersion(x.GoPointer())
967 return cret
968}
969
970var xApplicationHold func(uintptr)
971
972// Increases the use count of @application.
973//
974// Use this function to indicate that the application has a reason to
975// continue to run. For example, g_application_hold() is called by GTK
976// when a toplevel window is on the screen.
977//
978// To cancel the hold, call g_application_release().
979func (x *Application) Hold() {
980
981 xApplicationHold(x.GoPointer())
982
983}
984
985var xApplicationMarkBusy func(uintptr)
986
987// Increases the busy count of @application.
988//
989// Use this function to indicate that the application is busy, for instance
990// while a long running operation is pending.
991//
992// The busy state will be exposed to other processes, so a session shell will
993// use that information to indicate the state to the user (e.g. with a
994// spinner).
995//
996// To cancel the busy indication, use g_application_unmark_busy().
997//
998// The application must be registered before calling this function.
999func (x *Application) MarkBusy() {
1000
1001 xApplicationMarkBusy(x.GoPointer())
1002
1003}
1004
1005var xApplicationOpen func(uintptr, uintptr, int, string)
1006
1007// Opens the given files.
1008//
1009// In essence, this results in the #GApplication::open signal being emitted
1010// in the primary instance.
1011//
1012// @n_files must be greater than zero.
1013//
1014// @hint is simply passed through to the ::open signal. It is
1015// intended to be used by applications that have multiple modes for
1016// opening files (eg: "view" vs "edit", etc). Unless you have a need
1017// for this functionality, you should use "".
1018//
1019// The application must be registered before calling this function
1020// and it must have the %G_APPLICATION_HANDLES_OPEN flag set.
1021func (x *Application) Open(FilesVar uintptr, NFilesVar int, HintVar string) {
1022
1023 xApplicationOpen(x.GoPointer(), FilesVar, NFilesVar, HintVar)
1024
1025}
1026
1027var xApplicationQuit func(uintptr)
1028
1029// Immediately quits the application.
1030//
1031// Upon return to the mainloop, g_application_run() will return,
1032// calling only the 'shutdown' function before doing so.
1033//
1034// The hold count is ignored.
1035// Take care if your code has called g_application_hold() on the application and
1036// is therefore still expecting it to exist.
1037// (Note that you may have called g_application_hold() indirectly, for example
1038// through gtk_application_add_window().)
1039//
1040// The result of calling g_application_run() again after it returns is
1041// unspecified.
1042func (x *Application) Quit() {
1043
1044 xApplicationQuit(x.GoPointer())
1045
1046}
1047
1048var xApplicationRegister func(uintptr, uintptr, **glib.Error) bool
1049
1050// Attempts registration of the application.
1051//
1052// This is the point at which the application discovers if it is the
1053// primary instance or merely acting as a remote for an already-existing
1054// primary instance. This is implemented by attempting to acquire the
1055// application identifier as a unique bus name on the session bus using
1056// GDBus.
1057//
1058// If there is no application ID or if %G_APPLICATION_NON_UNIQUE was
1059// given, then this process will always become the primary instance.
1060//
1061// Due to the internal architecture of GDBus, method calls can be
1062// dispatched at any time (even if a main loop is not running). For
1063// this reason, you must ensure that any object paths that you wish to
1064// register are registered before calling this function.
1065//
1066// If the application has already been registered then %TRUE is
1067// returned with no work performed.
1068//
1069// The #GApplication::startup signal is emitted if registration succeeds
1070// and @application is the primary instance (including the non-unique
1071// case).
1072//
1073// In the event of an error (such as @cancellable being cancelled, or a
1074// failure to connect to the session bus), %FALSE is returned and @error
1075// is set appropriately.
1076//
1077// Note: the return value of this function is not an indicator that this
1078// instance is or is not the primary instance of the application. See
1079// g_application_get_is_remote() for that.
1080func (x *Application) Register(CancellableVar *Cancellable) (bool, error) {
1081 var cerr *glib.Error
1082
1083 cret := xApplicationRegister(x.GoPointer(), CancellableVar.GoPointer(), &cerr)
1084 if cerr == nil {
1085 return cret, nil
1086 }
1087 return cret, cerr
1088
1089}
1090
1091var xApplicationRelease func(uintptr)
1092
1093// Decrease the use count of @application.
1094//
1095// When the use count reaches zero, the application will stop running.
1096//
1097// Never call this function except to cancel the effect of a previous
1098// call to g_application_hold().
1099func (x *Application) Release() {
1100
1101 xApplicationRelease(x.GoPointer())
1102
1103}
1104
1105var xApplicationRun func(uintptr, int, []string) int
1106
1107// Runs the application.
1108//
1109// This function is intended to be run from main() and its return value
1110// is intended to be returned by main(). Although you are expected to pass
1111// the @argc, @argv parameters from main() to this function, it is possible
1112// to pass %NULL if @argv is not available or commandline handling is not
1113// required. Note that on Windows, @argc and @argv are ignored, and
1114// g_win32_get_command_line() is called internally (for proper support
1115// of Unicode commandline arguments).
1116//
1117// #GApplication will attempt to parse the commandline arguments. You
1118// can add commandline flags to the list of recognised options by way of
1119// g_application_add_main_option_entries(). After this, the
1120// #GApplication::handle-local-options signal is emitted, from which the
1121// application can inspect the values of its #GOptionEntrys.
1122//
1123// #GApplication::handle-local-options is a good place to handle options
1124// such as `--version`, where an immediate reply from the local process is
1125// desired (instead of communicating with an already-running instance).
1126// A #GApplication::handle-local-options handler can stop further processing
1127// by returning a non-negative value, which then becomes the exit status of
1128// the process.
1129//
1130// What happens next depends on the flags: if
1131// %G_APPLICATION_HANDLES_COMMAND_LINE was specified then the remaining
1132// commandline arguments are sent to the primary instance, where a
1133// #GApplication::command-line signal is emitted. Otherwise, the
1134// remaining commandline arguments are assumed to be a list of files.
1135// If there are no files listed, the application is activated via the
1136// #GApplication::activate signal. If there are one or more files, and
1137// %G_APPLICATION_HANDLES_OPEN was specified then the files are opened
1138// via the #GApplication::open signal.
1139//
1140// If you are interested in doing more complicated local handling of the
1141// commandline then you should implement your own #GApplication subclass
1142// and override local_command_line(). In this case, you most likely want
1143// to return %TRUE from your local_command_line() implementation to
1144// suppress the default handling. See
1145// [gapplication-example-cmdline2.c][https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-cmdline2.c]
1146// for an example.
1147//
1148// If, after the above is done, the use count of the application is zero
1149// then the exit status is returned immediately. If the use count is
1150// non-zero then the default main context is iterated until the use count
1151// falls to zero, at which point 0 is returned.
1152//
1153// If the %G_APPLICATION_IS_SERVICE flag is set, then the service will
1154// run for as much as 10 seconds with a use count of zero while waiting
1155// for the message that caused the activation to arrive. After that,
1156// if the use count falls to zero the application will exit immediately,
1157// except in the case that g_application_set_inactivity_timeout() is in
1158// use.
1159//
1160// This function sets the prgname (g_set_prgname()), if not already set,
1161// to the basename of argv[0].
1162//
1163// Much like g_main_loop_run(), this function will acquire the main context
1164// for the duration that the application is running.
1165//
1166// Since 2.40, applications that are not explicitly flagged as services
1167// or launchers (ie: neither %G_APPLICATION_IS_SERVICE or
1168// %G_APPLICATION_IS_LAUNCHER are given as flags) will check (from the
1169// default handler for local_command_line) if "--gapplication-service"
1170// was given in the command line. If this flag is present then normal
1171// commandline processing is interrupted and the
1172// %G_APPLICATION_IS_SERVICE flag is set. This provides a "compromise"
1173// solution whereby running an application directly from the commandline
1174// will invoke it in the normal way (which can be useful for debugging)
1175// while still allowing applications to be D-Bus activated in service
1176// mode. The D-Bus service file should invoke the executable with
1177// "--gapplication-service" as the sole commandline argument. This
1178// approach is suitable for use by most graphical applications but
1179// should not be used from applications like editors that need precise
1180// control over when processes invoked via the commandline will exit and
1181// what their exit status will be.
1182func (x *Application) Run(ArgcVar int, ArgvVar []string) int {
1183
1184 cret := xApplicationRun(x.GoPointer(), ArgcVar, ArgvVar)
1185 return cret
1186}
1187
1188var xApplicationSendNotification func(uintptr, uintptr, uintptr)
1189
1190// Sends a notification on behalf of @application to the desktop shell.
1191// There is no guarantee that the notification is displayed immediately,
1192// or even at all.
1193//
1194// Notifications may persist after the application exits. It will be
1195// D-Bus-activated when the notification or one of its actions is
1196// activated.
1197//
1198// Modifying @notification after this call has no effect. However, the
1199// object can be reused for a later call to this function.
1200//
1201// @id may be any string that uniquely identifies the event for the
1202// application. It does not need to be in any special format. For
1203// example, "new-message" might be appropriate for a notification about
1204// new messages.
1205//
1206// If a previous notification was sent with the same @id, it will be
1207// replaced with @notification and shown again as if it was a new
1208// notification. This works even for notifications sent from a previous
1209// execution of the application, as long as @id is the same string.
1210//
1211// @id may be `NULL`, but it is impossible to replace or withdraw
1212// notifications without an id.
1213//
1214// If @notification is no longer relevant, it can be withdrawn with
1215// [method@Gio.Application.withdraw_notification].
1216//
1217// It is an error to call this function if @application has no
1218// application ID.
1219func (x *Application) SendNotification(IdVar *string, NotificationVar *Notification) {
1220
1221 IdVarPtr := core.GStrdupNullable(IdVar)
1222 defer core.GFreeNullable(IdVarPtr)
1223
1224 xApplicationSendNotification(x.GoPointer(), IdVarPtr, NotificationVar.GoPointer())
1225
1226}
1227
1228var xApplicationSetActionGroup func(uintptr, uintptr)
1229
1230// This used to be how actions were associated with a #GApplication.
1231// Now there is #GActionMap for that.
1232func (x *Application) SetActionGroup(ActionGroupVar ActionGroup) {
1233
1234 xApplicationSetActionGroup(x.GoPointer(), ActionGroupVar.GoPointer())
1235
1236}
1237
1238var xApplicationSetApplicationId func(uintptr, uintptr)
1239
1240// Sets the unique identifier for @application.
1241//
1242// The application id can only be modified if @application has not yet
1243// been registered.
1244//
1245// If non-%NULL, the application id must be valid. See
1246// g_application_id_is_valid().
1247func (x *Application) SetApplicationId(ApplicationIdVar *string) {
1248
1249 ApplicationIdVarPtr := core.GStrdupNullable(ApplicationIdVar)
1250 defer core.GFreeNullable(ApplicationIdVarPtr)
1251
1252 xApplicationSetApplicationId(x.GoPointer(), ApplicationIdVarPtr)
1253
1254}
1255
1256var xApplicationSetDefault func(uintptr)
1257
1258// Sets or unsets the default application for the process, as returned
1259// by g_application_get_default().
1260//
1261// This function does not take its own reference on @application. If
1262// @application is destroyed then the default application will revert
1263// back to %NULL.
1264func (x *Application) SetDefault() {
1265
1266 xApplicationSetDefault(x.GoPointer())
1267
1268}
1269
1270var xApplicationSetFlags func(uintptr, ApplicationFlags)
1271
1272// Sets the flags for @application.
1273//
1274// The flags can only be modified if @application has not yet been
1275// registered.
1276//
1277// See #GApplicationFlags.
1278func (x *Application) SetFlags(FlagsVar ApplicationFlags) {
1279
1280 xApplicationSetFlags(x.GoPointer(), FlagsVar)
1281
1282}
1283
1284var xApplicationSetInactivityTimeout func(uintptr, uint)
1285
1286// Sets the current inactivity timeout for the application.
1287//
1288// This is the amount of time (in milliseconds) after the last call to
1289// g_application_release() before the application stops running.
1290//
1291// This call has no side effects of its own. The value set here is only
1292// used for next time g_application_release() drops the use count to
1293// zero. Any timeouts currently in progress are not impacted.
1294func (x *Application) SetInactivityTimeout(InactivityTimeoutVar uint) {
1295
1296 xApplicationSetInactivityTimeout(x.GoPointer(), InactivityTimeoutVar)
1297
1298}
1299
1300var xApplicationSetOptionContextDescription func(uintptr, uintptr)
1301
1302// Adds a description to the @application option context.
1303//
1304// See g_option_context_set_description() for more information.
1305func (x *Application) SetOptionContextDescription(DescriptionVar *string) {
1306
1307 DescriptionVarPtr := core.GStrdupNullable(DescriptionVar)
1308 defer core.GFreeNullable(DescriptionVarPtr)
1309
1310 xApplicationSetOptionContextDescription(x.GoPointer(), DescriptionVarPtr)
1311
1312}
1313
1314var xApplicationSetOptionContextParameterString func(uintptr, uintptr)
1315
1316// Sets the parameter string to be used by the commandline handling of @application.
1317//
1318// This function registers the argument to be passed to g_option_context_new()
1319// when the internal #GOptionContext of @application is created.
1320//
1321// See g_option_context_new() for more information about @parameter_string.
1322func (x *Application) SetOptionContextParameterString(ParameterStringVar *string) {
1323
1324 ParameterStringVarPtr := core.GStrdupNullable(ParameterStringVar)
1325 defer core.GFreeNullable(ParameterStringVarPtr)
1326
1327 xApplicationSetOptionContextParameterString(x.GoPointer(), ParameterStringVarPtr)
1328
1329}
1330
1331var xApplicationSetOptionContextSummary func(uintptr, uintptr)
1332
1333// Adds a summary to the @application option context.
1334//
1335// See g_option_context_set_summary() for more information.
1336func (x *Application) SetOptionContextSummary(SummaryVar *string) {
1337
1338 SummaryVarPtr := core.GStrdupNullable(SummaryVar)
1339 defer core.GFreeNullable(SummaryVarPtr)
1340
1341 xApplicationSetOptionContextSummary(x.GoPointer(), SummaryVarPtr)
1342
1343}
1344
1345var xApplicationSetResourceBasePath func(uintptr, uintptr)
1346
1347// Sets (or unsets) the base resource path of @application.
1348//
1349// The path is used to automatically load various
1350// [application resources][struct@Gio.Resource] such as menu layouts and
1351// action descriptions. The various types of resources will be found at
1352// fixed names relative to the given base path.
1353//
1354// By default, the resource base path is determined from the application
1355// ID by prefixing '/' and replacing each '.' with '/'. This is done at
1356// the time that the #GApplication object is constructed. Changes to
1357// the application ID after that point will not have an impact on the
1358// resource base path.
1359//
1360// As an example, if the application has an ID of "org.example.app" then
1361// the default resource base path will be "/org/example/app". If this
1362// is a #GtkApplication (and you have not manually changed the path)
1363// then Gtk will then search for the menus of the application at
1364// "/org/example/app/gtk/menus.ui".
1365//
1366// See #GResource for more information about adding resources to your
1367// application.
1368//
1369// You can disable automatic resource loading functionality by setting
1370// the path to %NULL.
1371//
1372// Changing the resource base path once the application is running is
1373// not recommended. The point at which the resource path is consulted
1374// for forming paths for various purposes is unspecified. When writing
1375// a sub-class of #GApplication you should either set the
1376// #GApplication:resource-base-path property at construction time, or call
1377// this function during the instance initialization. Alternatively, you
1378// can call this function in the #GApplicationClass.startup virtual function,
1379// before chaining up to the parent implementation.
1380func (x *Application) SetResourceBasePath(ResourcePathVar *string) {
1381
1382 ResourcePathVarPtr := core.GStrdupNullable(ResourcePathVar)
1383 defer core.GFreeNullable(ResourcePathVarPtr)
1384
1385 xApplicationSetResourceBasePath(x.GoPointer(), ResourcePathVarPtr)
1386
1387}
1388
1389var xApplicationSetVersion func(uintptr, string)
1390
1391// Sets the version number of @application. This will be used to implement
1392// a `--version` command line argument
1393//
1394// The application version can only be modified if @application has not yet
1395// been registered.
1396func (x *Application) SetVersion(VersionVar string) {
1397
1398 xApplicationSetVersion(x.GoPointer(), VersionVar)
1399
1400}
1401
1402var xApplicationUnbindBusyProperty func(uintptr, uintptr, string)
1403
1404// Destroys a binding between @property and the busy state of
1405// @application that was previously created with
1406// g_application_bind_busy_property().
1407func (x *Application) UnbindBusyProperty(ObjectVar *gobject.Object, PropertyVar string) {
1408
1409 xApplicationUnbindBusyProperty(x.GoPointer(), ObjectVar.GoPointer(), PropertyVar)
1410
1411}
1412
1413var xApplicationUnmarkBusy func(uintptr)
1414
1415// Decreases the busy count of @application.
1416//
1417// When the busy count reaches zero, the new state will be propagated
1418// to other processes.
1419//
1420// This function must only be called to cancel the effect of a previous
1421// call to g_application_mark_busy().
1422func (x *Application) UnmarkBusy() {
1423
1424 xApplicationUnmarkBusy(x.GoPointer())
1425
1426}
1427
1428var xApplicationWithdrawNotification func(uintptr, string)
1429
1430// Withdraws a notification that was sent with
1431// g_application_send_notification().
1432//
1433// This call does nothing if a notification with @id doesn't exist or
1434// the notification was never sent.
1435//
1436// This function works even for notifications sent in previous
1437// executions of this application, as long @id is the same as it was for
1438// the sent notification.
1439//
1440// Note that notifications are dismissed when the user clicks on one
1441// of the buttons in a notification or triggers its default action, so
1442// there is no need to explicitly withdraw the notification in that case.
1443func (x *Application) WithdrawNotification(IdVar string) {
1444
1445 xApplicationWithdrawNotification(x.GoPointer(), IdVar)
1446
1447}
1448
1449func (c *Application) GoPointer() uintptr {
1450 if c == nil {
1451 return 0
1452 }
1453 return c.Ptr
1454}
1455
1456func (c *Application) SetGoPointer(ptr uintptr) {
1457 c.Ptr = ptr
1458}
1459
1460// SetPropertyApplicationId sets the "application-id" property.
1461// The unique identifier for the application.
1462func (x *Application) SetPropertyApplicationId(value string) {
1463 var v gobject.Value
1464 v.Init(gobject.TypeStringVal)
1465 v.SetString(&value)
1466 x.SetProperty("application-id", &v)
1467}
1468
1469// GetPropertyApplicationId gets the "application-id" property.
1470// The unique identifier for the application.
1471func (x *Application) GetPropertyApplicationId() string {
1472 var v gobject.Value
1473 x.GetProperty("application-id", &v)
1474 return v.GetString()
1475}
1476
1477// SetPropertyInactivityTimeout sets the "inactivity-timeout" property.
1478// Time (in milliseconds) to stay alive after becoming idle.
1479func (x *Application) SetPropertyInactivityTimeout(value uint) {
1480 var v gobject.Value
1481 v.Init(gobject.TypeUintVal)
1482 v.SetUint(value)
1483 x.SetProperty("inactivity-timeout", &v)
1484}
1485
1486// GetPropertyInactivityTimeout gets the "inactivity-timeout" property.
1487// Time (in milliseconds) to stay alive after becoming idle.
1488func (x *Application) GetPropertyInactivityTimeout() uint {
1489 var v gobject.Value
1490 x.GetProperty("inactivity-timeout", &v)
1491 return v.GetUint()
1492}
1493
1494// GetPropertyIsBusy gets the "is-busy" property.
1495// Whether the application is currently marked as busy through
1496// g_application_mark_busy() or g_application_bind_busy_property().
1497func (x *Application) GetPropertyIsBusy() bool {
1498 var v gobject.Value
1499 x.GetProperty("is-busy", &v)
1500 return v.GetBoolean()
1501}
1502
1503// GetPropertyIsRegistered gets the "is-registered" property.
1504// Whether [method@Gio.Application.register] has been called.
1505func (x *Application) GetPropertyIsRegistered() bool {
1506 var v gobject.Value
1507 x.GetProperty("is-registered", &v)
1508 return v.GetBoolean()
1509}
1510
1511// GetPropertyIsRemote gets the "is-remote" property.
1512// Whether this application instance is remote.
1513func (x *Application) GetPropertyIsRemote() bool {
1514 var v gobject.Value
1515 x.GetProperty("is-remote", &v)
1516 return v.GetBoolean()
1517}
1518
1519// SetPropertyResourceBasePath sets the "resource-base-path" property.
1520// The base resource path for the application.
1521func (x *Application) SetPropertyResourceBasePath(value string) {
1522 var v gobject.Value
1523 v.Init(gobject.TypeStringVal)
1524 v.SetString(&value)
1525 x.SetProperty("resource-base-path", &v)
1526}
1527
1528// GetPropertyResourceBasePath gets the "resource-base-path" property.
1529// The base resource path for the application.
1530func (x *Application) GetPropertyResourceBasePath() string {
1531 var v gobject.Value
1532 x.GetProperty("resource-base-path", &v)
1533 return v.GetString()
1534}
1535
1536// SetPropertyVersion sets the "version" property.
1537// The human-readable version number of the application.
1538func (x *Application) SetPropertyVersion(value string) {
1539 var v gobject.Value
1540 v.Init(gobject.TypeStringVal)
1541 v.SetString(&value)
1542 x.SetProperty("version", &v)
1543}
1544
1545// GetPropertyVersion gets the "version" property.
1546// The human-readable version number of the application.
1547func (x *Application) GetPropertyVersion() string {
1548 var v gobject.Value
1549 x.GetProperty("version", &v)
1550 return v.GetString()
1551}
1552
1553// The ::activate signal is emitted on the primary instance when an
1554// activation occurs. See g_application_activate().
1555func (x *Application) ConnectActivate(cb *func(Application)) uint {
1556 cbPtr := uintptr(unsafe.Pointer(cb))
1557 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1558 handlerID := gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr)
1559 glib.SaveHandlerMapping(handlerID, cbPtr)
1560 return handlerID
1561 }
1562
1563 fcb := func(clsPtr uintptr) {
1564 fa := Application{}
1565 fa.Ptr = clsPtr
1566 cbFn := *cb
1567
1568 cbFn(fa)
1569
1570 }
1571 cbRefPtr := purego.NewCallback(fcb)
1572 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1573 handlerID := gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr)
1574 glib.SaveHandlerMapping(handlerID, cbPtr)
1575 return handlerID
1576}
1577
1578// The ::command-line signal is emitted on the primary instance when
1579// a commandline is not handled locally. See g_application_run() and
1580// the #GApplicationCommandLine documentation for more information.
1581func (x *Application) ConnectCommandLine(cb *func(Application, uintptr) int) uint {
1582 cbPtr := uintptr(unsafe.Pointer(cb))
1583 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1584 handlerID := gobject.SignalConnect(x.GoPointer(), "command-line", cbRefPtr)
1585 glib.SaveHandlerMapping(handlerID, cbPtr)
1586 return handlerID
1587 }
1588
1589 fcb := func(clsPtr uintptr, CommandLineVarp uintptr) int {
1590 fa := Application{}
1591 fa.Ptr = clsPtr
1592 cbFn := *cb
1593
1594 return cbFn(fa, CommandLineVarp)
1595
1596 }
1597 cbRefPtr := purego.NewCallback(fcb)
1598 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1599 handlerID := gobject.SignalConnect(x.GoPointer(), "command-line", cbRefPtr)
1600 glib.SaveHandlerMapping(handlerID, cbPtr)
1601 return handlerID
1602}
1603
1604// The ::handle-local-options signal is emitted on the local instance
1605// after the parsing of the commandline options has occurred.
1606//
1607// You can add options to be recognised during commandline option
1608// parsing using g_application_add_main_option_entries() and
1609// g_application_add_option_group().
1610//
1611// Signal handlers can inspect @options (along with values pointed to
1612// from the @arg_data of an installed #GOptionEntrys) in order to
1613// decide to perform certain actions, including direct local handling
1614// (which may be useful for options like --version).
1615//
1616// In the event that the application is marked
1617// %G_APPLICATION_HANDLES_COMMAND_LINE the "normal processing" will
1618// send the @options dictionary to the primary instance where it can be
1619// read with g_application_command_line_get_options_dict(). The signal
1620// handler can modify the dictionary before returning, and the
1621// modified dictionary will be sent.
1622//
1623// In the event that %G_APPLICATION_HANDLES_COMMAND_LINE is not set,
1624// "normal processing" will treat the remaining uncollected command
1625// line arguments as filenames or URIs. If there are no arguments,
1626// the application is activated by g_application_activate(). One or
1627// more arguments results in a call to g_application_open().
1628//
1629// If you want to handle the local commandline arguments for yourself
1630// by converting them to calls to g_application_open() or
1631// g_action_group_activate_action() then you must be sure to register
1632// the application first. You should probably not call
1633// g_application_activate() for yourself, however: just return -1 and
1634// allow the default handler to do it for you. This will ensure that
1635// the `--gapplication-service` switch works properly (i.e. no activation
1636// in that case).
1637//
1638// Note that this signal is emitted from the default implementation of
1639// local_command_line(). If you override that function and don't
1640// chain up then this signal will never be emitted.
1641//
1642// You can override local_command_line() if you need more powerful
1643// capabilities than what is provided here, but this should not
1644// normally be required.
1645func (x *Application) ConnectHandleLocalOptions(cb *func(Application, uintptr) int) uint {
1646 cbPtr := uintptr(unsafe.Pointer(cb))
1647 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1648 handlerID := gobject.SignalConnect(x.GoPointer(), "handle-local-options", cbRefPtr)
1649 glib.SaveHandlerMapping(handlerID, cbPtr)
1650 return handlerID
1651 }
1652
1653 fcb := func(clsPtr uintptr, OptionsVarp uintptr) int {
1654 fa := Application{}
1655 fa.Ptr = clsPtr
1656 cbFn := *cb
1657
1658 return cbFn(fa, OptionsVarp)
1659
1660 }
1661 cbRefPtr := purego.NewCallback(fcb)
1662 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1663 handlerID := gobject.SignalConnect(x.GoPointer(), "handle-local-options", cbRefPtr)
1664 glib.SaveHandlerMapping(handlerID, cbPtr)
1665 return handlerID
1666}
1667
1668// The ::name-lost signal is emitted only on the registered primary instance
1669// when a new instance has taken over. This can only happen if the application
1670// is using the %G_APPLICATION_ALLOW_REPLACEMENT flag.
1671//
1672// The default handler for this signal calls g_application_quit().
1673func (x *Application) ConnectNameLost(cb *func(Application) bool) uint {
1674 cbPtr := uintptr(unsafe.Pointer(cb))
1675 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1676 handlerID := gobject.SignalConnect(x.GoPointer(), "name-lost", cbRefPtr)
1677 glib.SaveHandlerMapping(handlerID, cbPtr)
1678 return handlerID
1679 }
1680
1681 fcb := func(clsPtr uintptr) bool {
1682 fa := Application{}
1683 fa.Ptr = clsPtr
1684 cbFn := *cb
1685
1686 return cbFn(fa)
1687
1688 }
1689 cbRefPtr := purego.NewCallback(fcb)
1690 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1691 handlerID := gobject.SignalConnect(x.GoPointer(), "name-lost", cbRefPtr)
1692 glib.SaveHandlerMapping(handlerID, cbPtr)
1693 return handlerID
1694}
1695
1696// The ::open signal is emitted on the primary instance when there are
1697// files to open. See g_application_open() for more information.
1698func (x *Application) ConnectOpen(cb *func(Application, uintptr, int, string)) uint {
1699 cbPtr := uintptr(unsafe.Pointer(cb))
1700 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1701 handlerID := gobject.SignalConnect(x.GoPointer(), "open", cbRefPtr)
1702 glib.SaveHandlerMapping(handlerID, cbPtr)
1703 return handlerID
1704 }
1705
1706 fcb := func(clsPtr uintptr, FilesVarp uintptr, NFilesVarp int, HintVarp uintptr) {
1707 fa := Application{}
1708 fa.Ptr = clsPtr
1709 cbFn := *cb
1710
1711 cbFn(fa, FilesVarp, NFilesVarp, core.GoString(HintVarp))
1712
1713 }
1714 cbRefPtr := purego.NewCallback(fcb)
1715 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1716 handlerID := gobject.SignalConnect(x.GoPointer(), "open", cbRefPtr)
1717 glib.SaveHandlerMapping(handlerID, cbPtr)
1718 return handlerID
1719}
1720
1721// The ::shutdown signal is emitted only on the registered primary instance
1722// immediately after the main loop terminates.
1723func (x *Application) ConnectShutdown(cb *func(Application)) uint {
1724 cbPtr := uintptr(unsafe.Pointer(cb))
1725 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1726 handlerID := gobject.SignalConnect(x.GoPointer(), "shutdown", cbRefPtr)
1727 glib.SaveHandlerMapping(handlerID, cbPtr)
1728 return handlerID
1729 }
1730
1731 fcb := func(clsPtr uintptr) {
1732 fa := Application{}
1733 fa.Ptr = clsPtr
1734 cbFn := *cb
1735
1736 cbFn(fa)
1737
1738 }
1739 cbRefPtr := purego.NewCallback(fcb)
1740 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1741 handlerID := gobject.SignalConnect(x.GoPointer(), "shutdown", cbRefPtr)
1742 glib.SaveHandlerMapping(handlerID, cbPtr)
1743 return handlerID
1744}
1745
1746// The ::startup signal is emitted on the primary instance immediately
1747// after registration. See g_application_register().
1748func (x *Application) ConnectStartup(cb *func(Application)) uint {
1749 cbPtr := uintptr(unsafe.Pointer(cb))
1750 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1751 handlerID := gobject.SignalConnect(x.GoPointer(), "startup", cbRefPtr)
1752 glib.SaveHandlerMapping(handlerID, cbPtr)
1753 return handlerID
1754 }
1755
1756 fcb := func(clsPtr uintptr) {
1757 fa := Application{}
1758 fa.Ptr = clsPtr
1759 cbFn := *cb
1760
1761 cbFn(fa)
1762
1763 }
1764 cbRefPtr := purego.NewCallback(fcb)
1765 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1766 handlerID := gobject.SignalConnect(x.GoPointer(), "startup", cbRefPtr)
1767 glib.SaveHandlerMapping(handlerID, cbPtr)
1768 return handlerID
1769}
1770
1771// Emits the [signal@Gio.ActionGroup::action-added] signal on @action_group.
1772//
1773// This function should only be called by [type@Gio.ActionGroup] implementations.
1774func (x *Application) ActionAdded(ActionNameVar string) {
1775
1776 XGActionGroupActionAdded(x.GoPointer(), ActionNameVar)
1777
1778}
1779
1780// Emits the [signal@Gio.ActionGroup::action-enabled-changed] signal on @action_group.
1781//
1782// This function should only be called by [type@Gio.ActionGroup] implementations.
1783func (x *Application) ActionEnabledChanged(ActionNameVar string, EnabledVar bool) {
1784
1785 XGActionGroupActionEnabledChanged(x.GoPointer(), ActionNameVar, EnabledVar)
1786
1787}
1788
1789// Emits the [signal@Gio.ActionGroup::action-removed] signal on @action_group.
1790//
1791// This function should only be called by [type@Gio.ActionGroup] implementations.
1792func (x *Application) ActionRemoved(ActionNameVar string) {
1793
1794 XGActionGroupActionRemoved(x.GoPointer(), ActionNameVar)
1795
1796}
1797
1798// Emits the [signal@Gio.ActionGroup::action-state-changed] signal on @action_group.
1799//
1800// This function should only be called by [type@Gio.ActionGroup] implementations.
1801func (x *Application) ActionStateChanged(ActionNameVar string, StateVar *glib.Variant) {
1802
1803 XGActionGroupActionStateChanged(x.GoPointer(), ActionNameVar, StateVar)
1804
1805}
1806
1807// Activate the named action within @action_group.
1808//
1809// If the action is expecting a parameter, then the correct type of
1810// parameter must be given as @parameter. If the action is expecting no
1811// parameters then @parameter must be `NULL`. See
1812// [method@Gio.ActionGroup.get_action_parameter_type].
1813//
1814// If the [type@Gio.ActionGroup] implementation supports asynchronous remote
1815// activation over D-Bus, this call may return before the relevant
1816// D-Bus traffic has been sent, or any replies have been received. In
1817// order to block on such asynchronous activation calls,
1818// [method@Gio.DBusConnection.flush] should be called prior to the code, which
1819// depends on the result of the action activation. Without flushing
1820// the D-Bus connection, there is no guarantee that the action would
1821// have been activated.
1822//
1823// The following code which runs in a remote app instance, shows an
1824// example of a ‘quit’ action being activated on the primary app
1825// instance over D-Bus. Here [method@Gio.DBusConnection.flush] is called
1826// before `exit()`. Without `g_dbus_connection_flush()`, the ‘quit’ action
1827// may fail to be activated on the primary instance.
1828//
1829// ```c
1830// // call ‘quit’ action on primary instance
1831// g_action_group_activate_action (G_ACTION_GROUP (app), "quit", NULL);
1832//
1833// // make sure the action is activated now
1834// g_dbus_connection_flush (…);
1835//
1836// g_debug ("Application has been terminated. Exiting.");
1837//
1838// exit (0);
1839// ```
1840func (x *Application) ActivateAction(ActionNameVar string, ParameterVar *glib.Variant) {
1841
1842 XGActionGroupActivateAction(x.GoPointer(), ActionNameVar, ParameterVar)
1843
1844}
1845
1846// Request for the state of the named action within @action_group to be
1847// changed to @value.
1848//
1849// The action must be stateful and @value must be of the correct type.
1850// See [method@Gio.ActionGroup.get_action_state_type].
1851//
1852// This call merely requests a change. The action may refuse to change
1853// its state or may change its state to something other than @value.
1854// See [method@Gio.ActionGroup.get_action_state_hint].
1855//
1856// If the @value GVariant is floating, it is consumed.
1857func (x *Application) ChangeActionState(ActionNameVar string, ValueVar *glib.Variant) {
1858
1859 XGActionGroupChangeActionState(x.GoPointer(), ActionNameVar, ValueVar)
1860
1861}
1862
1863// Checks if the named action within @action_group is currently enabled.
1864//
1865// An action must be enabled in order to be activated or in order to
1866// have its state changed from outside callers.
1867func (x *Application) GetActionEnabled(ActionNameVar string) bool {
1868
1869 cret := XGActionGroupGetActionEnabled(x.GoPointer(), ActionNameVar)
1870 return cret
1871}
1872
1873// Queries the type of the parameter that must be given when activating
1874// the named action within @action_group.
1875//
1876// When activating the action using [method@Gio.ActionGroup.activate_action],
1877// the [type@GLib.Variant] given to that function must be of the type returned
1878// by this function.
1879//
1880// In the case that this function returns `NULL`, you must not give any
1881// [type@GLib.Variant], but `NULL` instead.
1882//
1883// The parameter type of a particular action will never change but it is
1884// possible for an action to be removed and for a new action to be added
1885// with the same name but a different parameter type.
1886func (x *Application) GetActionParameterType(ActionNameVar string) *glib.VariantType {
1887
1888 cret := XGActionGroupGetActionParameterType(x.GoPointer(), ActionNameVar)
1889 return cret
1890}
1891
1892// Queries the current state of the named action within @action_group.
1893//
1894// If the action is not stateful then `NULL` will be returned. If the
1895// action is stateful then the type of the return value is the type
1896// given by [method@Gio.ActionGroup.get_action_state_type].
1897//
1898// The return value (if non-`NULL`) should be freed with
1899// [method@GLib.Variant.unref] when it is no longer required.
1900func (x *Application) GetActionState(ActionNameVar string) *glib.Variant {
1901
1902 cret := XGActionGroupGetActionState(x.GoPointer(), ActionNameVar)
1903 return cret
1904}
1905
1906// Requests a hint about the valid range of values for the state of the
1907// named action within @action_group.
1908//
1909// If `NULL` is returned it either means that the action is not stateful
1910// or that there is no hint about the valid range of values for the
1911// state of the action.
1912//
1913// If a [type@GLib.Variant] array is returned then each item in the array is a
1914// possible value for the state. If a [type@GLib.Variant] pair (ie: two-tuple) is
1915// returned then the tuple specifies the inclusive lower and upper bound
1916// of valid values for the state.
1917//
1918// In any case, the information is merely a hint. It may be possible to
1919// have a state value outside of the hinted range and setting a value
1920// within the range may fail.
1921//
1922// The return value (if non-`NULL`) should be freed with
1923// [method@GLib.Variant.unref] when it is no longer required.
1924func (x *Application) GetActionStateHint(ActionNameVar string) *glib.Variant {
1925
1926 cret := XGActionGroupGetActionStateHint(x.GoPointer(), ActionNameVar)
1927 return cret
1928}
1929
1930// Queries the type of the state of the named action within
1931// @action_group.
1932//
1933// If the action is stateful then this function returns the
1934// [type@GLib.VariantType] of the state. All calls to
1935// [method@Gio.ActionGroup.change_action_state] must give a [type@GLib.Variant] of this
1936// type and [method@Gio.ActionGroup.get_action_state] will return a [type@GLib.Variant]
1937// of the same type.
1938//
1939// If the action is not stateful then this function will return `NULL`.
1940// In that case, [method@Gio.ActionGroup.get_action_state] will return `NULL`
1941// and you must not call [method@Gio.ActionGroup.change_action_state].
1942//
1943// The state type of a particular action will never change but it is
1944// possible for an action to be removed and for a new action to be added
1945// with the same name but a different state type.
1946func (x *Application) GetActionStateType(ActionNameVar string) *glib.VariantType {
1947
1948 cret := XGActionGroupGetActionStateType(x.GoPointer(), ActionNameVar)
1949 return cret
1950}
1951
1952// Checks if the named action exists within @action_group.
1953func (x *Application) HasAction(ActionNameVar string) bool {
1954
1955 cret := XGActionGroupHasAction(x.GoPointer(), ActionNameVar)
1956 return cret
1957}
1958
1959// Lists the actions contained within @action_group.
1960//
1961// The caller is responsible for freeing the list with [func@GLib.strfreev] when
1962// it is no longer required.
1963func (x *Application) ListActions() []string {
1964
1965 cret := XGActionGroupListActions(x.GoPointer())
1966 return cret
1967}
1968
1969// Queries all aspects of the named action within an @action_group.
1970//
1971// This function acquires the information available from
1972// [method@Gio.ActionGroup.has_action], [method@Gio.ActionGroup.get_action_enabled],
1973// [method@Gio.ActionGroup.get_action_parameter_type],
1974// [method@Gio.ActionGroup.get_action_state_type],
1975// [method@Gio.ActionGroup.get_action_state_hint] and
1976// [method@Gio.ActionGroup.get_action_state] with a single function call.
1977//
1978// This provides two main benefits.
1979//
1980// The first is the improvement in efficiency that comes with not having
1981// to perform repeated lookups of the action in order to discover
1982// different things about it. The second is that implementing
1983// [type@Gio.ActionGroup] can now be done by only overriding this one virtual
1984// function.
1985//
1986// The interface provides a default implementation of this function that
1987// calls the individual functions, as required, to fetch the
1988// information. The interface also provides default implementations of
1989// those functions that call this function. All implementations,
1990// therefore, must override either this function or all of the others.
1991//
1992// If the action exists, `TRUE` is returned and any of the requested
1993// fields (as indicated by having a non-`NULL` reference passed in) are
1994// filled. If the action doesn’t exist, `FALSE` is returned and the
1995// fields may or may not have been modified.
1996func (x *Application) QueryAction(ActionNameVar string, EnabledVar *bool, ParameterTypeVar **glib.VariantType, StateTypeVar **glib.VariantType, StateHintVar **glib.Variant, StateVar **glib.Variant) bool {
1997
1998 cret := XGActionGroupQueryAction(x.GoPointer(), ActionNameVar, EnabledVar, ParameterTypeVar, StateTypeVar, StateHintVar, StateVar)
1999 return cret
2000}
2001
2002// Adds an action to the @action_map.
2003//
2004// If the action map already contains an action with the same name
2005// as @action then the old action is dropped from the action map.
2006//
2007// The action map takes its own reference on @action.
2008func (x *Application) AddAction(ActionVar Action) {
2009
2010 XGActionMapAddAction(x.GoPointer(), ActionVar.GoPointer())
2011
2012}
2013
2014// A convenience function for creating multiple [class@Gio.SimpleAction]
2015// instances and adding them to a [iface@Gio.ActionMap].
2016//
2017// Each action is constructed as per one [struct@Gio.ActionEntry].
2018//
2019// ```c
2020// static void
2021// activate_quit (GSimpleAction *simple,
2022//
2023// GVariant *parameter,
2024// gpointer user_data)
2025//
2026// {
2027// exit (0);
2028// }
2029//
2030// static void
2031// activate_print_string (GSimpleAction *simple,
2032//
2033// GVariant *parameter,
2034// gpointer user_data)
2035//
2036// {
2037// g_print ("%s\n", g_variant_get_string (parameter, NULL));
2038// }
2039//
2040// static GActionGroup *
2041// create_action_group (void)
2042//
2043// {
2044// const GActionEntry entries[] = {
2045// { "quit", activate_quit },
2046// { "print-string", activate_print_string, "s" }
2047// };
2048// GSimpleActionGroup *group;
2049//
2050// group = g_simple_action_group_new ();
2051// g_action_map_add_action_entries (G_ACTION_MAP (group), entries, G_N_ELEMENTS (entries), NULL);
2052//
2053// return G_ACTION_GROUP (group);
2054// }
2055//
2056// ```
2057func (x *Application) AddActionEntries(EntriesVar []ActionEntry, NEntriesVar int, UserDataVar uintptr) {
2058
2059 XGActionMapAddActionEntries(x.GoPointer(), EntriesVar, NEntriesVar, UserDataVar)
2060
2061}
2062
2063// Looks up the action with the name @action_name in @action_map.
2064//
2065// If no such action exists, returns `NULL`.
2066func (x *Application) LookupAction(ActionNameVar string) *ActionBase {
2067 var cls *ActionBase
2068
2069 cret := XGActionMapLookupAction(x.GoPointer(), ActionNameVar)
2070
2071 if cret == 0 {
2072 return nil
2073 }
2074 gobject.IncreaseRef(cret)
2075 cls = &ActionBase{}
2076 cls.Ptr = cret
2077 return cls
2078}
2079
2080// Removes the named action from the action map.
2081//
2082// If no action of this name is in the map then nothing happens.
2083func (x *Application) RemoveAction(ActionNameVar string) {
2084
2085 XGActionMapRemoveAction(x.GoPointer(), ActionNameVar)
2086
2087}
2088
2089// Remove actions from a [iface@Gio.ActionMap]. This is meant as the reverse of
2090// [method@Gio.ActionMap.add_action_entries].
2091//
2092// ```c
2093//
2094// static const GActionEntry entries[] = {
2095// { "quit", activate_quit },
2096// { "print-string", activate_print_string, "s" }
2097// };
2098//
2099// void
2100// add_actions (GActionMap *map)
2101//
2102// {
2103// g_action_map_add_action_entries (map, entries, G_N_ELEMENTS (entries), NULL);
2104// }
2105//
2106// void
2107// remove_actions (GActionMap *map)
2108//
2109// {
2110// g_action_map_remove_action_entries (map, entries, G_N_ELEMENTS (entries));
2111// }
2112//
2113// ```
2114func (x *Application) RemoveActionEntries(EntriesVar []ActionEntry, NEntriesVar int) {
2115
2116 XGActionMapRemoveActionEntries(x.GoPointer(), EntriesVar, NEntriesVar)
2117
2118}
2119
2120var xApplicationGetDefault func() uintptr
2121
2122// Returns the default #GApplication instance for this process.
2123//
2124// Normally there is only one #GApplication per process and it becomes
2125// the default when it is created. You can exercise more control over
2126// this by using g_application_set_default().
2127//
2128// If there is no default application then %NULL is returned.
2129func ApplicationGetDefault() *Application {
2130 var cls *Application
2131
2132 cret := xApplicationGetDefault()
2133
2134 if cret == 0 {
2135 return nil
2136 }
2137 gobject.IncreaseRef(cret)
2138 cls = &Application{}
2139 cls.Ptr = cret
2140 return cls
2141}
2142
2143var xApplicationIdIsValid func(string) bool
2144
2145// Checks if @application_id is a valid application identifier.
2146//
2147// A valid ID is required for calls to g_application_new() and
2148// g_application_set_application_id().
2149//
2150// Application identifiers follow the same format as
2151// [D-Bus well-known bus names](https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus).
2152// For convenience, the restrictions on application identifiers are
2153// reproduced here:
2154//
2155// - Application identifiers are composed of 1 or more elements separated by a
2156// period (`.`) character. All elements must contain at least one character.
2157//
2158// - Each element must only contain the ASCII characters `[A-Z][a-z][0-9]_-`,
2159// with `-` discouraged in new application identifiers. Each element must not
2160// begin with a digit.
2161//
2162// - Application identifiers must contain at least one `.` (period) character
2163// (and thus at least two elements).
2164//
2165// - Application identifiers must not begin with a `.` (period) character.
2166//
2167// - Application identifiers must not exceed 255 characters.
2168//
2169// Note that the hyphen (`-`) character is allowed in application identifiers,
2170// but is problematic or not allowed in various specifications and APIs that
2171// refer to D-Bus, such as
2172// [Flatpak application IDs](http://docs.flatpak.org/en/latest/introduction.html#identifiers),
2173// the
2174// [`DBusActivatable` interface in the Desktop Entry Specification](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#dbus),
2175// and the convention that an application's "main" interface and object path
2176// resemble its application identifier and bus name. To avoid situations that
2177// require special-case handling, it is recommended that new application
2178// identifiers consistently replace hyphens with underscores.
2179//
2180// Like D-Bus interface names, application identifiers should start with the
2181// reversed DNS domain name of the author of the interface (in lower-case), and
2182// it is conventional for the rest of the application identifier to consist of
2183// words run together, with initial capital letters.
2184//
2185// As with D-Bus interface names, if the author's DNS domain name contains
2186// hyphen/minus characters they should be replaced by underscores, and if it
2187// contains leading digits they should be escaped by prepending an underscore.
2188// For example, if the owner of 7-zip.org used an application identifier for an
2189// archiving application, it might be named `org._7_zip.Archiver`.
2190func ApplicationIdIsValid(ApplicationIdVar string) bool {
2191
2192 cret := xApplicationIdIsValid(ApplicationIdVar)
2193 return cret
2194}
2195
2196func init() {
2197 core.SetPackageName("GIO", "gio-2.0")
2198 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
2199 var libs []uintptr
2200 for _, libPath := range core.GetPaths("GIO") {
2201 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
2202 if err != nil {
2203 panic(err)
2204 }
2205 libs = append(libs, lib)
2206 }
2207
2208 core.PuregoSafeRegister(&xApplicationGLibType, libs, "g_application_get_type")
2209
2210 core.PuregoSafeRegister(&xNewApplication, libs, "g_application_new")
2211
2212 core.PuregoSafeRegister(&xApplicationActivate, libs, "g_application_activate")
2213 core.PuregoSafeRegister(&xApplicationAddMainOption, libs, "g_application_add_main_option")
2214 core.PuregoSafeRegister(&xApplicationAddMainOptionEntries, libs, "g_application_add_main_option_entries")
2215 core.PuregoSafeRegister(&xApplicationAddOptionGroup, libs, "g_application_add_option_group")
2216 core.PuregoSafeRegister(&xApplicationBindBusyProperty, libs, "g_application_bind_busy_property")
2217 core.PuregoSafeRegister(&xApplicationGetApplicationId, libs, "g_application_get_application_id")
2218 core.PuregoSafeRegister(&xApplicationGetDbusConnection, libs, "g_application_get_dbus_connection")
2219 core.PuregoSafeRegister(&xApplicationGetDbusObjectPath, libs, "g_application_get_dbus_object_path")
2220 core.PuregoSafeRegister(&xApplicationGetFlags, libs, "g_application_get_flags")
2221 core.PuregoSafeRegister(&xApplicationGetInactivityTimeout, libs, "g_application_get_inactivity_timeout")
2222 core.PuregoSafeRegister(&xApplicationGetIsBusy, libs, "g_application_get_is_busy")
2223 core.PuregoSafeRegister(&xApplicationGetIsRegistered, libs, "g_application_get_is_registered")
2224 core.PuregoSafeRegister(&xApplicationGetIsRemote, libs, "g_application_get_is_remote")
2225 core.PuregoSafeRegister(&xApplicationGetResourceBasePath, libs, "g_application_get_resource_base_path")
2226 core.PuregoSafeRegister(&xApplicationGetVersion, libs, "g_application_get_version")
2227 core.PuregoSafeRegister(&xApplicationHold, libs, "g_application_hold")
2228 core.PuregoSafeRegister(&xApplicationMarkBusy, libs, "g_application_mark_busy")
2229 core.PuregoSafeRegister(&xApplicationOpen, libs, "g_application_open")
2230 core.PuregoSafeRegister(&xApplicationQuit, libs, "g_application_quit")
2231 core.PuregoSafeRegister(&xApplicationRegister, libs, "g_application_register")
2232 core.PuregoSafeRegister(&xApplicationRelease, libs, "g_application_release")
2233 core.PuregoSafeRegister(&xApplicationRun, libs, "g_application_run")
2234 core.PuregoSafeRegister(&xApplicationSendNotification, libs, "g_application_send_notification")
2235 core.PuregoSafeRegister(&xApplicationSetActionGroup, libs, "g_application_set_action_group")
2236 core.PuregoSafeRegister(&xApplicationSetApplicationId, libs, "g_application_set_application_id")
2237 core.PuregoSafeRegister(&xApplicationSetDefault, libs, "g_application_set_default")
2238 core.PuregoSafeRegister(&xApplicationSetFlags, libs, "g_application_set_flags")
2239 core.PuregoSafeRegister(&xApplicationSetInactivityTimeout, libs, "g_application_set_inactivity_timeout")
2240 core.PuregoSafeRegister(&xApplicationSetOptionContextDescription, libs, "g_application_set_option_context_description")
2241 core.PuregoSafeRegister(&xApplicationSetOptionContextParameterString, libs, "g_application_set_option_context_parameter_string")
2242 core.PuregoSafeRegister(&xApplicationSetOptionContextSummary, libs, "g_application_set_option_context_summary")
2243 core.PuregoSafeRegister(&xApplicationSetResourceBasePath, libs, "g_application_set_resource_base_path")
2244 core.PuregoSafeRegister(&xApplicationSetVersion, libs, "g_application_set_version")
2245 core.PuregoSafeRegister(&xApplicationUnbindBusyProperty, libs, "g_application_unbind_busy_property")
2246 core.PuregoSafeRegister(&xApplicationUnmarkBusy, libs, "g_application_unmark_busy")
2247 core.PuregoSafeRegister(&xApplicationWithdrawNotification, libs, "g_application_withdraw_notification")
2248
2249 core.PuregoSafeRegister(&xApplicationGetDefault, libs, "g_application_get_default")
2250 core.PuregoSafeRegister(&xApplicationIdIsValid, libs, "g_application_id_is_valid")
2251
2252}