| D-Bus GLib bindings - Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
DBus GObject related functionsDBus GObject related functions — Exporting a GObject remotely |
#include <dbus/dbus-glib.h> struct DBusGObjectInfo; void dbus_g_object_type_install_info (GType object_type,const DBusGObjectInfo *info); void dbus_g_object_type_register_shadow_property (GType iface_type,const char *dbus_prop_name,const char *shadow_prop_name); GType dbus_g_object_path_get_g_type (void); void dbus_g_object_register_marshaller (GClosureMarshal marshaller,GType rettype,...); void dbus_g_object_register_marshaller_array (GClosureMarshal marshaller,GType rettype,guint n_types,const GType *types); void dbus_glib_global_set_disable_legacy_property_access (void);
struct DBusGObjectInfo {
int format_version;
const DBusGMethodInfo *method_infos;
int n_method_infos;
const char *data;
const char *exported_signals;
const char *exported_properties;
};
Introspection data for a GObject, normally autogenerated by a tool such as dbus-binding-tool.
| Allows us to change the rest of this struct by adding DBusGObjectInfo2, DBusGObjectInfo3, etc. | |
const DBusGMethodInfo * |
Array of method pointers |
| Length of the infos array | |
| Introspection data | |
| Exported signals | |
| Exported properties |
void dbus_g_object_type_install_info (GType object_type,const DBusGObjectInfo *info);
Install introspection information about the given object GType
sufficient to allow methods on the object to be invoked by name.
The introspection information is normally generated by
dbus-glib-tool, then this function is called in the
class_init() for the object class.
Once introspection information has been installed, instances of the
object registered with dbus_g_connection_register_g_object() can have
their methods invoked remotely.
|
GType for the object |
|
introspection data generated by dbus-glib-tool |
void dbus_g_object_type_register_shadow_property (GType iface_type,const char *dbus_prop_name,const char *shadow_prop_name);
Registers a new property name shadow_prop_name that overrides the
dbus_prop_name in D-Bus property get/set requests. Since all properties for
all interfaces implemented by a GObject exist in the same namespace, this
allows implementations to use the same property name in two or more D-Bus
interfaces implemented by the same GObject, as long as one of those D-Bus
interface properties is registered with a shadow property name.
For example, if both org.foobar.Baz.InterfaceA and org.foobar.Baz.InterfaceB
have a D-Bus property called "Bork", the developer assigns a shadow property
name to the conflicting property name in one or both of these GInterfaces to
resolve the conflict. Assume the GInterface implementing
org.foobar.Baz.InterfaceA registers a shadow property called "a-bork", while
the GInterface implementing org.foobar.Baz.InterfaceB registers a shadow
property called "b-bork". The GObject implementing both these GInterfaces
would then use #g_object_class_override_property() to implement both
"a-bork" and "b-bork" and D-Bus requests for "Bork" on either D-Bus interface
will not conflict.
|
GType for the GInterface |
|
D-Bus property name (as specified in the introspection data) to override with the shadow property name (as specified in the GType's initialization function, ie glib-style) |
|
property name which should override the shadow property |
void dbus_g_object_register_marshaller (GClosureMarshal marshaller,GType rettype,...);
Register a GClosureMarshal to be used for signal invocations,
giving its return type and a list of parameter types,
followed by G_TYPE_INVALID.
This function will not be needed once GLib includes libffi.
|
a GClosureMarshal to be used for invocation |
|
a GType for the return type of the function |
|
The parameter GTypes, followed by G_TYPE_INVALID
|
void dbus_g_object_register_marshaller_array (GClosureMarshal marshaller,GType rettype,guint n_types,const GType *types);
Register a GClosureMarshal to be used for signal invocations.
see_also dbus_g_object_register_marshaller()
|
a GClosureMarshal to be used for invocation |
|
a GType for the return type of the function |
|
number of function parameters |
|
a C array of GTypes values |
void dbus_glib_global_set_disable_legacy_property_access
(void);
For historical reasons, DBus-GLib will allow read-only
access to every GObject property of an object exported
to the bus, regardless of whether or not the property
is listed in the type info installed with
dbus_g_object_type_install_info(). (Write access is
denied however).
If you wish to restrict even read-only access, you can call this method to globally change the behavior for the entire process.
Since 0.88