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// Class structure for #GDBusObjectManagerServer.
17type DBusObjectManagerServerClass struct {
18 _ structs.HostLayout
19
20 ParentClass gobject.ObjectClass
21
22 Padding [8]uintptr
23}
24
25func (x *DBusObjectManagerServerClass) GoPointer() uintptr {
26 return uintptr(unsafe.Pointer(x))
27}
28
29type DBusObjectManagerServerPrivate struct {
30 _ structs.HostLayout
31}
32
33func (x *DBusObjectManagerServerPrivate) GoPointer() uintptr {
34 return uintptr(unsafe.Pointer(x))
35}
36
37// `GDBusObjectManagerServer` is used to export [iface@Gio.DBusObject] instances
38// using the standardized
39// [`org.freedesktop.DBus.ObjectManager`](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager)
40// interface. For example, remote D-Bus clients can get all objects
41// and properties in a single call. Additionally, any change in the
42// object hierarchy is broadcast using signals. This means that D-Bus
43// clients can keep caches up to date by only listening to D-Bus
44// signals.
45//
46// The recommended path to export an object manager at is the path form of the
47// well-known name of a D-Bus service, or below. For example, if a D-Bus service
48// is available at the well-known name `net.example.ExampleService1`, the object
49// manager should typically be exported at `/net/example/ExampleService1`, or
50// below (to allow for multiple object managers in a service).
51//
52// It is supported, but not recommended, to export an object manager at the root
53// path, `/`.
54//
55// See [class@Gio.DBusObjectManagerClient] for the client-side code that is
56// intended to be used with `GDBusObjectManagerServer` or any D-Bus
57// object implementing the `org.freedesktop.DBus.ObjectManager` interface.
58type DBusObjectManagerServer struct {
59 gobject.Object
60}
61
62var xDBusObjectManagerServerGLibType func() types.GType
63
64func DBusObjectManagerServerGLibType() types.GType {
65 return xDBusObjectManagerServerGLibType()
66}
67
68func DBusObjectManagerServerNewFromInternalPtr(ptr uintptr) *DBusObjectManagerServer {
69 cls := &DBusObjectManagerServer{}
70 cls.Ptr = ptr
71 return cls
72}
73
74var xNewDBusObjectManagerServer func(string) uintptr
75
76// Creates a new #GDBusObjectManagerServer object.
77//
78// The returned server isn't yet exported on any connection. To do so,
79// use g_dbus_object_manager_server_set_connection(). Normally you
80// want to export all of your objects before doing so to avoid
81// [InterfacesAdded](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager)
82// signals being emitted.
83func NewDBusObjectManagerServer(ObjectPathVar string) *DBusObjectManagerServer {
84 var cls *DBusObjectManagerServer
85
86 cret := xNewDBusObjectManagerServer(ObjectPathVar)
87
88 if cret == 0 {
89 return nil
90 }
91 cls = &DBusObjectManagerServer{}
92 cls.Ptr = cret
93 return cls
94}
95
96var xDBusObjectManagerServerExport func(uintptr, uintptr)
97
98// Exports @object on @manager.
99//
100// If there is already a #GDBusObject exported at the object path,
101// then the old object is removed.
102//
103// The object path for @object must be in the hierarchy rooted by the
104// object path for @manager.
105//
106// Note that @manager will take a reference on @object for as long as
107// it is exported.
108func (x *DBusObjectManagerServer) Export(ObjectVar *DBusObjectSkeleton) {
109
110 xDBusObjectManagerServerExport(x.GoPointer(), ObjectVar.GoPointer())
111
112}
113
114var xDBusObjectManagerServerExportUniquely func(uintptr, uintptr)
115
116// Like g_dbus_object_manager_server_export() but appends a string of
117// the form _N (with N being a natural number) to @object's object path
118// if an object with the given path already exists. As such, the
119// #GDBusObjectProxy:g-object-path property of @object may be modified.
120func (x *DBusObjectManagerServer) ExportUniquely(ObjectVar *DBusObjectSkeleton) {
121
122 xDBusObjectManagerServerExportUniquely(x.GoPointer(), ObjectVar.GoPointer())
123
124}
125
126var xDBusObjectManagerServerGetConnection func(uintptr) uintptr
127
128// Gets the #GDBusConnection used by @manager.
129func (x *DBusObjectManagerServer) GetConnection() *DBusConnection {
130 var cls *DBusConnection
131
132 cret := xDBusObjectManagerServerGetConnection(x.GoPointer())
133
134 if cret == 0 {
135 return nil
136 }
137 cls = &DBusConnection{}
138 cls.Ptr = cret
139 return cls
140}
141
142var xDBusObjectManagerServerIsExported func(uintptr, uintptr) bool
143
144// Returns whether @object is currently exported on @manager.
145func (x *DBusObjectManagerServer) IsExported(ObjectVar *DBusObjectSkeleton) bool {
146
147 cret := xDBusObjectManagerServerIsExported(x.GoPointer(), ObjectVar.GoPointer())
148 return cret
149}
150
151var xDBusObjectManagerServerSetConnection func(uintptr, uintptr)
152
153// Exports all objects managed by @manager on @connection. If
154// @connection is %NULL, stops exporting objects.
155func (x *DBusObjectManagerServer) SetConnection(ConnectionVar *DBusConnection) {
156
157 xDBusObjectManagerServerSetConnection(x.GoPointer(), ConnectionVar.GoPointer())
158
159}
160
161var xDBusObjectManagerServerUnexport func(uintptr, string) bool
162
163// If @manager has an object at @path, removes the object. Otherwise
164// does nothing.
165//
166// Note that @object_path must be in the hierarchy rooted by the
167// object path for @manager.
168func (x *DBusObjectManagerServer) Unexport(ObjectPathVar string) bool {
169
170 cret := xDBusObjectManagerServerUnexport(x.GoPointer(), ObjectPathVar)
171 return cret
172}
173
174func (c *DBusObjectManagerServer) GoPointer() uintptr {
175 if c == nil {
176 return 0
177 }
178 return c.Ptr
179}
180
181func (c *DBusObjectManagerServer) SetGoPointer(ptr uintptr) {
182 c.Ptr = ptr
183}
184
185// SetPropertyObjectPath sets the "object-path" property.
186// The object path to register the manager object at.
187func (x *DBusObjectManagerServer) SetPropertyObjectPath(value string) {
188 var v gobject.Value
189 v.Init(gobject.TypeStringVal)
190 v.SetString(&value)
191 x.SetProperty("object-path", &v)
192}
193
194// GetPropertyObjectPath gets the "object-path" property.
195// The object path to register the manager object at.
196func (x *DBusObjectManagerServer) GetPropertyObjectPath() string {
197 var v gobject.Value
198 x.GetProperty("object-path", &v)
199 return v.GetString()
200}
201
202// Gets the interface proxy for @interface_name at @object_path, if
203// any.
204func (x *DBusObjectManagerServer) GetInterface(ObjectPathVar string, InterfaceNameVar string) *DBusInterfaceBase {
205 var cls *DBusInterfaceBase
206
207 cret := XGDbusObjectManagerGetInterface(x.GoPointer(), ObjectPathVar, InterfaceNameVar)
208
209 if cret == 0 {
210 return nil
211 }
212 cls = &DBusInterfaceBase{}
213 cls.Ptr = cret
214 return cls
215}
216
217// Gets the #GDBusObject at @object_path, if any.
218func (x *DBusObjectManagerServer) GetObject(ObjectPathVar string) *DBusObjectBase {
219 var cls *DBusObjectBase
220
221 cret := XGDbusObjectManagerGetObject(x.GoPointer(), ObjectPathVar)
222
223 if cret == 0 {
224 return nil
225 }
226 cls = &DBusObjectBase{}
227 cls.Ptr = cret
228 return cls
229}
230
231// Gets the object path that @manager is for.
232func (x *DBusObjectManagerServer) GetObjectPath() string {
233
234 cret := XGDbusObjectManagerGetObjectPath(x.GoPointer())
235 return cret
236}
237
238// Gets all #GDBusObject objects known to @manager.
239func (x *DBusObjectManagerServer) GetObjects() *glib.List {
240
241 cret := XGDbusObjectManagerGetObjects(x.GoPointer())
242 return cret
243}
244
245func init() {
246 core.SetPackageName("GIO", "gio-2.0")
247 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
248 var libs []uintptr
249 for _, libPath := range core.GetPaths("GIO") {
250 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
251 if err != nil {
252 panic(err)
253 }
254 libs = append(libs, lib)
255 }
256
257 core.PuregoSafeRegister(&xDBusObjectManagerServerGLibType, libs, "g_dbus_object_manager_server_get_type")
258
259 core.PuregoSafeRegister(&xNewDBusObjectManagerServer, libs, "g_dbus_object_manager_server_new")
260
261 core.PuregoSafeRegister(&xDBusObjectManagerServerExport, libs, "g_dbus_object_manager_server_export")
262 core.PuregoSafeRegister(&xDBusObjectManagerServerExportUniquely, libs, "g_dbus_object_manager_server_export_uniquely")
263 core.PuregoSafeRegister(&xDBusObjectManagerServerGetConnection, libs, "g_dbus_object_manager_server_get_connection")
264 core.PuregoSafeRegister(&xDBusObjectManagerServerIsExported, libs, "g_dbus_object_manager_server_is_exported")
265 core.PuregoSafeRegister(&xDBusObjectManagerServerSetConnection, libs, "g_dbus_object_manager_server_set_connection")
266 core.PuregoSafeRegister(&xDBusObjectManagerServerUnexport, libs, "g_dbus_object_manager_server_unexport")
267
268}