## GDBusObject

GDBusObject — Base type for D-Bus objects

## Synopsis

    #include <gio/gio.h>

                        GDBusObject;
    struct              GDBusObjectIface;
    const gchar *       g_dbus_object_get_object_path       (GDBusObject *object);
    GList *             g_dbus_object_get_interfaces        (GDBusObject *object);
    GDBusInterface *    g_dbus_object_get_interface         (GDBusObject *object,
                                                             const gchar *interface_name);

## Object Hierarchy

      GInterface
       +----GDBusObject

## Prerequisites

GDBusObject requires GObject.

## Known Implementations

GDBusObject is implemented by GDBusObjectProxy and GDBusObjectSkeleton.

## Signals

      "interface-added"                                : Run Last
      "interface-removed"                              : Run Last

## Description

The GDBusObject type is the base type for D-Bus objects on both the service side (see GDBusObjectSkeleton) and the client side (see GDBusObjectProxy). It is essentially just a container of interfaces.

## Details

### GDBusObject

    typedef struct _GDBusObject GDBusObject;

### struct GDBusObjectIface

    struct GDBusObjectIface {
      GTypeInterface parent_iface;

      /* Virtual Functions */
      const gchar     *(*get_object_path) (GDBusObject  *object);
      GList           *(*get_interfaces)  (GDBusObject  *object);
      GDBusInterface  *(*get_interface)   (GDBusObject  *object,
                                           const gchar  *interface_name);

      /* Signals */
      void (*interface_added)   (GDBusObject     *object,
                                 GDBusInterface  *interface_);
      void (*interface_removed) (GDBusObject     *object,
                                 GDBusInterface  *interface_);
    };

Base object type for D-Bus objects.

GTypeInterface `parent_iface`; | The parent interface.
`get_object_path` () | Returns the object path. See `g_dbus_object_get_object_path()`.
`get_interfaces` () | Returns all interfaces. See `g_dbus_object_get_interfaces()`.
`get_interface` () | Returns an interface by name. See `g_dbus_object_get_interface()`.
`interface_added` () | Signal handler for the "interface-added" signal.
`interface_removed` () | Signal handler for the "interface-removed" signal.

Since 2.30

### g_dbus_object_get_object_path ()

    const gchar *       g_dbus_object_get_object_path       (GDBusObject *object);

Gets the object path for `object`.

`object` : | A GDBusObject.
Returns : | A string owned by `object`. Do not free.

Since 2.30

### g_dbus_object_get_interfaces ()

    GList *             g_dbus_object_get_interfaces        (GDBusObject *object);

Gets the D-Bus interfaces associated with `object`.

`object` : | A GDBusObject.
Returns : | (element-type GDBusInterface) (transfer full) : A list of GDBusInterface instances. The returned list must be freed by `g_list_free()` after each element has been freed with `g_object_unref()`.

Since 2.30

### g_dbus_object_get_interface ()

    GDBusInterface *    g_dbus_object_get_interface         (GDBusObject *object,
                                                             const gchar *interface_name);

Gets the D-Bus interface with name `interface_name` associated with `object`, if any.

`object` : | A GDBusObject.
`interface_name` : | A D-Bus interface name.
Returns : | `NULL` if not found, otherwise a GDBusInterface that must be freed with `g_object_unref()`. [transfer full]

Since 2.30

## Signal Details

### The `"interface-added"` signal

    void                user_function                      (GDBusObject    *object,
                                                            GDBusInterface *interface,
                                                            gpointer        user_data)      : Run Last

Emitted when `interface` is added to `object`.

`object` : | The GDBusObject emitting the signal.
`interface` : | The GDBusInterface that was added.
`user_data` : | user data set when the signal handler was connected.

Since 2.30

### The `"interface-removed"` signal

    void                user_function                      (GDBusObject    *object,
                                                            GDBusInterface *interface,
                                                            gpointer        user_data)      : Run Last

Emitted when `interface` is removed from `object`.

`object` : | The GDBusObject emitting the signal.
`interface` : | The GDBusInterface that was removed.
`user_data` : | user data set when the signal handler was connected.

Since 2.30