## DBus GObject related functions DBus GObject related functions — Exporting a GObject remotely |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    #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);

## Description

FIXME

## Details

### struct DBusGObjectInfo

    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.

int `format_version`; | Allows us to change the rest of this struct by adding DBusGObjectInfo2, DBusGObjectInfo3, etc.
const DBusGMethodInfo *`method_infos`; | Array of method pointers
int `n_method_infos`; | Length of the infos array
const char *`data`; | Introspection data
const char *`exported_signals`; | Exported signals
const char *`exported_properties`; | Exported properties

### dbus_g_object_type_install_info ()

    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.

`object_type` : | GType for the object
`info` : | introspection data generated by dbus-glib-tool

### dbus_g_object_type_register_shadow_property ()

    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.

`iface_type` : | GType for the GInterface
`dbus_prop_name` : | 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)
`shadow_prop_name` : | property name which should override the shadow property

### dbus_g_object_path_get_g_type ()

    GType               dbus_g_object_path_get_g_type       (void);

### dbus_g_object_register_marshaller ()

    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.

`marshaller` : | a GClosureMarshal to be used for invocation
`rettype` : | a GType for the return type of the function
`...` : | The parameter GTypes, followed by `G_TYPE_INVALID`

### dbus_g_object_register_marshaller_array ()

    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()`

`marshaller` : | a GClosureMarshal to be used for invocation
`rettype` : | a GType for the return type of the function
`n_types` : | number of function parameters
`types` : | a C array of GTypes values

### dbus_glib_global_set_disable_legacy_property_access ()

    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

## See Also

GObject