ExampleAnimal: GIO Reference Manual

## ExampleAnimal ExampleAnimal — Generated C code for the org.gtk.GDBus.Example.ObjectManager.Animal D-Bus interface |

## Functions

GDBusInterfaceInfo * | example_animal_interface_info ()
guint | example_animal_override_properties ()
void | example_animal_call_poke ()
gboolean | example_animal_call_poke_finish ()
gboolean | example_animal_call_poke_sync ()
void | example_animal_complete_poke ()
void | example_animal_emit_jumped ()
const gchar * | example_animal_get_mood ()
const gchar * | example_animal_get_foo ()
const gchar * | example_animal_get_bar ()
gchar * | example_animal_dup_mood ()
gchar * | example_animal_dup_foo ()
gchar * | example_animal_dup_bar ()
void | example_animal_set_mood ()
void | example_animal_set_foo ()
void | example_animal_set_bar ()
void | example_animal_proxy_new ()
ExampleAnimal * | example_animal_proxy_new_finish ()
ExampleAnimal * | example_animal_proxy_new_sync ()
void | example_animal_proxy_new_for_bus ()
ExampleAnimal * | example_animal_proxy_new_for_bus_finish ()
ExampleAnimal * | example_animal_proxy_new_for_bus_sync ()
ExampleAnimal * | example_animal_skeleton_new ()

## Properties

gchar * | bar | Read / Write
gchar * | foo | Read / Write
gchar * | mood | Read / Write

## Signals

gboolean | handle-poke | Run Last
void | jumped | Run Last

## Types and Values

| ExampleAnimal
struct | ExampleAnimalIface
struct | ExampleAnimalProxy
struct | ExampleAnimalProxyClass
struct | ExampleAnimalSkeleton
struct | ExampleAnimalSkeletonClass

## Object Hierarchy

        GInterface
        ╰── ExampleAnimal
        GObject
        ├── GDBusInterfaceSkeleton
        │   ╰── ExampleAnimalSkeleton
        ╰── GDBusProxy
            ╰── ExampleAnimalProxy

## Prerequisites

ExampleAnimal requires GObject.

## Implemented Interfaces

ExampleAnimalProxy implements GDBusInterface, GInitable, GAsyncInitable and ExampleAnimal.

ExampleAnimalSkeleton implements GDBusInterface and ExampleAnimal.

## Known Implementations

ExampleAnimal is implemented by ExampleAnimalProxy and ExampleAnimalSkeleton.

## Description

This section contains code for working with the org.gtk.GDBus.Example.ObjectManager.Animal D-Bus interface in C.

## Functions

### example_animal_interface_info ()

    GDBusInterfaceInfo *
    example_animal_interface_info (void);

Gets a machine-readable description of the org.gtk.GDBus.Example.ObjectManager.Animal D-Bus interface.

#### Returns

A GDBusInterfaceInfo. Do not free.

[transfer none]

Since 2.30

### example_animal_override_properties ()

    guint
    example_animal_override_properties (GObjectClass *klass,
                                        guint property_id_begin);

Overrides all GObject properties in the ExampleAnimal interface for a concrete class. The properties are overridden in the order they are defined.

#### Parameters

klass | The class structure for a GObject-derived class. |
property_id_begin | The property id to assign to the first overridden property. |

#### Returns

The last property id.

Since 2.30

### example_animal_call_poke ()

    void
    example_animal_call_poke (ExampleAnimal *proxy,
                              gboolean arg_make_sad,
                              gboolean arg_make_happy,
                              GCancellable *cancellable,
                              GAsyncReadyCallback callback,
                              gpointer user_data);

Asynchronously invokes the `Poke()` D-Bus method on `proxy` . When the operation is finished, `callback` will be invoked in the thread-default main loop of the thread you are calling this method from. You can then call `example_animal_call_poke_finish()` to get the result of the operation.

See `example_animal_call_poke_sync()` for the synchronous, blocking version of this method.

#### Parameters

proxy | A ExampleAnimalProxy. |
arg_make_sad | Argument to pass with the method invocation. |
arg_make_happy | Argument to pass with the method invocation. |
cancellable | A GCancellable or `NULL`. | [allow-none]
callback | A GAsyncReadyCallback to call when the request is satisfied or `NULL`. |
user_data | User data to pass to `callback` . |

Since 2.30

### example_animal_call_poke_finish ()

    gboolean
    example_animal_call_poke_finish (ExampleAnimal *proxy,
                                     GAsyncResult *res,
                                     GError **error);

Finishes an operation started with `example_animal_call_poke()`.

#### Parameters

proxy | A ExampleAnimalProxy. |
res | The GAsyncResult obtained from the GAsyncReadyCallback passed to `example_animal_call_poke()`. |
error | Return location for error or `NULL`. |

#### Returns

`TRUE` if the call succeded, `FALSE` if `error` is set.

[skip]

Since 2.30

### example_animal_call_poke_sync ()

    gboolean
    example_animal_call_poke_sync (ExampleAnimal *proxy,
                                   gboolean arg_make_sad,
                                   gboolean arg_make_happy,
                                   GCancellable *cancellable,
                                   GError **error);

Synchronously invokes the `Poke()` D-Bus method on `proxy` . The calling thread is blocked until a reply is received.

See `example_animal_call_poke()` for the asynchronous version of this method.

#### Parameters

proxy | A ExampleAnimalProxy. |
arg_make_sad | Argument to pass with the method invocation. |
arg_make_happy | Argument to pass with the method invocation. |
cancellable | A GCancellable or `NULL`. | [allow-none]
error | Return location for error or `NULL`. |

#### Returns

`TRUE` if the call succeded, `FALSE` if `error` is set.

[skip]

Since 2.30

### example_animal_complete_poke ()

    void
    example_animal_complete_poke (ExampleAnimal *object,
                                  GDBusMethodInvocation *invocation);

Helper function used in service implementations to finish handling invocations of the `Poke()` D-Bus method. If you instead want to finish handling an invocation by returning an error, use `g_dbus_method_invocation_return_error()` or similar.

This method will free `invocation` , you cannot use it afterwards.

#### Parameters

object | A ExampleAnimal. |
invocation | A GDBusMethodInvocation. | [transfer full]

Since 2.30

### example_animal_emit_jumped ()

    void
    example_animal_emit_jumped (ExampleAnimal *object,
                                gdouble arg_height);

Emits the "Jumped" D-Bus signal.

#### Parameters

object | A ExampleAnimal. |
arg_height | Argument to pass with the signal. |

Since 2.30

### example_animal_get_mood ()

    const gchar *
    example_animal_get_mood (ExampleAnimal *object);

Gets the value of the "Mood" D-Bus property.

Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.

The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where `object` was constructed. Use `example_animal_dup_mood()` if on another thread.

#### Parameters

object | A ExampleAnimal. |

#### Returns

The property value or `NULL` if the property is not set. Do not free the returned value, it belongs to `object` .

[transfer none]

Since 2.30

### example_animal_get_foo ()

    const gchar *
    example_animal_get_foo (ExampleAnimal *object);

Gets the value of the "Foo" D-Bus property.

Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.

The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where `object` was constructed. Use `example_animal_dup_foo()` if on another thread.

#### Parameters

object | A ExampleAnimal. |

#### Returns

The property value or `NULL` if the property is not set. Do not free the returned value, it belongs to `object` .

[transfer none]

Since 2.30

### example_animal_get_bar ()

    const gchar *
    example_animal_get_bar (ExampleAnimal *object);

Gets the value of the "Bar" D-Bus property.

Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.

The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where `object` was constructed. Use `example_animal_dup_bar()` if on another thread.

#### Parameters

object | A ExampleAnimal. |

#### Returns

The property value or `NULL` if the property is not set. Do not free the returned value, it belongs to `object` .

[transfer none]

Since 2.36

### example_animal_dup_mood ()

    gchar *
    example_animal_dup_mood (ExampleAnimal *object);

Gets a copy of the "Mood" D-Bus property.

Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.

#### Parameters

object | A ExampleAnimal. |

#### Returns

The property value or `NULL` if the property is not set. The returned value should be freed with `g_free()`.

[transfer full]

Since 2.30

### example_animal_dup_foo ()

    gchar *
    example_animal_dup_foo (ExampleAnimal *object);

Gets a copy of the "Foo" D-Bus property.

Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.

#### Parameters

object | A ExampleAnimal. |

#### Returns

The property value or `NULL` if the property is not set. The returned value should be freed with `g_free()`.

[transfer full]

Since 2.30

### example_animal_dup_bar ()

    gchar *
    example_animal_dup_bar (ExampleAnimal *object);

Gets a copy of the "Bar" D-Bus property.

Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.

#### Parameters

object | A ExampleAnimal. |

#### Returns

The property value or `NULL` if the property is not set. The returned value should be freed with `g_free()`.

[transfer full]

Since 2.36

### example_animal_set_mood ()

    void
    example_animal_set_mood (ExampleAnimal *object,
                             const gchar *value);

Sets the "Mood" D-Bus property to `value` .

Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.

#### Parameters

object | A ExampleAnimal. |
value | The value to set. |

Since 2.30

### example_animal_set_foo ()

    void
    example_animal_set_foo (ExampleAnimal *object,
                            const gchar *value);

Sets the "Foo" D-Bus property to `value` .

Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.

#### Parameters

object | A ExampleAnimal. |
value | The value to set. |

Since 2.30

### example_animal_set_bar ()

    void
    example_animal_set_bar (ExampleAnimal *object,
                            const gchar *value);

Sets the "Bar" D-Bus property to `value` .

Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.

#### Parameters

object | A ExampleAnimal. |
value | The value to set. |

Since 2.36

### example_animal_proxy_new ()

    void
    example_animal_proxy_new (GDBusConnection *connection,
                              GDBusProxyFlags flags,
                              const gchar *name,
                              const gchar *object_path,
                              GCancellable *cancellable,
                              GAsyncReadyCallback callback,
                              gpointer user_data);

Asynchronously creates a proxy for the D-Bus interface org.gtk.GDBus.Example.ObjectManager.Animal. See `g_dbus_proxy_new()` for more details.

When the operation is finished, `callback` will be invoked in the thread-default main loop of the thread you are calling this method from. You can then call `example_animal_proxy_new_finish()` to get the result of the operation.

See `example_animal_proxy_new_sync()` for the synchronous, blocking version of this constructor.

#### Parameters

connection | A GDBusConnection. |
flags | Flags from the GDBusProxyFlags enumeration. |
name | A bus name (well-known or unique) or `NULL` if `connection` is not a message bus connection. | [allow-none]
object_path | An object path. |
cancellable | A GCancellable or `NULL`. | [allow-none]
callback | A GAsyncReadyCallback to call when the request is satisfied. |
user_data | User data to pass to `callback` . |

Since 2.30

### example_animal_proxy_new_finish ()

    ExampleAnimal *
    example_animal_proxy_new_finish (GAsyncResult *res,
                                     GError **error);

Finishes an operation started with `example_animal_proxy_new()`.

#### Parameters

res | The GAsyncResult obtained from the GAsyncReadyCallback passed to `example_animal_proxy_new()`. |
error | Return location for error or `NULL` |

#### Returns

The constructed proxy object or `NULL` if `error` is set.

[transfer full][type ExampleAnimalProxy]

Since 2.30

### example_animal_proxy_new_sync ()

    ExampleAnimal *
    example_animal_proxy_new_sync (GDBusConnection *connection,
                                   GDBusProxyFlags flags,
                                   const gchar *name,
                                   const gchar *object_path,
                                   GCancellable *cancellable,
                                   GError **error);

Synchronously creates a proxy for the D-Bus interface org.gtk.GDBus.Example.ObjectManager.Animal. See `g_dbus_proxy_new_sync()` for more details.

The calling thread is blocked until a reply is received.

See `example_animal_proxy_new()` for the asynchronous version of this constructor.

#### Parameters

connection | A GDBusConnection. |
flags | Flags from the GDBusProxyFlags enumeration. |
name | A bus name (well-known or unique) or `NULL` if `connection` is not a message bus connection. | [allow-none]
object_path | An object path. |
cancellable | A GCancellable or `NULL`. | [allow-none]
error | Return location for error or `NULL` |

#### Returns

The constructed proxy object or `NULL` if `error` is set.

[transfer full][type ExampleAnimalProxy]

Since 2.30

### example_animal_proxy_new_for_bus ()

    void
    example_animal_proxy_new_for_bus (GBusType bus_type,
                                      GDBusProxyFlags flags,
                                      const gchar *name,
                                      const gchar *object_path,
                                      GCancellable *cancellable,
                                      GAsyncReadyCallback callback,
                                      gpointer user_data);

Like `example_animal_proxy_new()` but takes a GBusType instead of a GDBusConnection.

When the operation is finished, `callback` will be invoked in the thread-default main loop of the thread you are calling this method from. You can then call `example_animal_proxy_new_for_bus_finish()` to get the result of the operation.

See `example_animal_proxy_new_for_bus_sync()` for the synchronous, blocking version of this constructor.

#### Parameters

bus_type | A GBusType. |
flags | Flags from the GDBusProxyFlags enumeration. |
name | A bus name (well-known or unique). |
object_path | An object path. |
cancellable | A GCancellable or `NULL`. | [allow-none]
callback | A GAsyncReadyCallback to call when the request is satisfied. |
user_data | User data to pass to `callback` . |

Since 2.30

### example_animal_proxy_new_for_bus_finish ()

    ExampleAnimal *
    example_animal_proxy_new_for_bus_finish
                                   (GAsyncResult *res,
                                    GError **error);

Finishes an operation started with `example_animal_proxy_new_for_bus()`.

#### Parameters

res | The GAsyncResult obtained from the GAsyncReadyCallback passed to `example_animal_proxy_new_for_bus()`. |
error | Return location for error or `NULL` |

#### Returns

The constructed proxy object or `NULL` if `error` is set.

[transfer full][type ExampleAnimalProxy]

Since 2.30

### example_animal_proxy_new_for_bus_sync ()

    ExampleAnimal *
    example_animal_proxy_new_for_bus_sync (GBusType bus_type,
                                           GDBusProxyFlags flags,
                                           const gchar *name,
                                           const gchar *object_path,
                                           GCancellable *cancellable,
                                           GError **error);

Like `example_animal_proxy_new_sync()` but takes a GBusType instead of a GDBusConnection.

The calling thread is blocked until a reply is received.

See `example_animal_proxy_new_for_bus()` for the asynchronous version of this constructor.

#### Parameters

bus_type | A GBusType. |
flags | Flags from the GDBusProxyFlags enumeration. |
name | A bus name (well-known or unique). |
object_path | An object path. |
cancellable | A GCancellable or `NULL`. | [allow-none]
error | Return location for error or `NULL` |

#### Returns

The constructed proxy object or `NULL` if `error` is set.

[transfer full][type ExampleAnimalProxy]

Since 2.30

### example_animal_skeleton_new ()

    ExampleAnimal *
    example_animal_skeleton_new (void);

Creates a skeleton object for the D-Bus interface org.gtk.GDBus.Example.ObjectManager.Animal.

#### Returns

The skeleton object.

[transfer full][type ExampleAnimalSkeleton]

Since 2.30

## Types and Values

### ExampleAnimal

    typedef struct _ExampleAnimal ExampleAnimal;

Abstract interface type for the D-Bus interface org.gtk.GDBus.Example.ObjectManager.Animal.

Since 2.30

### struct ExampleAnimalIface

    struct ExampleAnimalIface {
      GTypeInterface parent_iface;

      gboolean (*handle_poke) (
        ExampleAnimal *object,
        GDBusMethodInvocation *invocation,
        gboolean arg_make_sad,
        gboolean arg_make_happy);

      const gchar * (*get_foo) (ExampleAnimal *object);

      const gchar * (*get_mood) (ExampleAnimal *object);

      void (*jumped) (
        ExampleAnimal *object,
        gdouble arg_height);

      const gchar * (*get_bar) (ExampleAnimal *object);
    };

Virtual table for the D-Bus interface org.gtk.GDBus.Example.ObjectManager.Animal.

#### Members

GTypeInterface `parent_iface`; | The parent interface. |
`handle_poke` () | Handler for the “handle-poke” signal. |
`get_foo` () | Getter for the “foo” property. |
`get_mood` () | Getter for the “mood” property. |
`jumped` () | Handler for the “jumped” signal. |
`get_bar` () | Getter for the “bar” property. |

Since 2.30

### struct ExampleAnimalProxy

    struct ExampleAnimalProxy;

The ExampleAnimalProxy structure contains only private data and should only be accessed using the provided API.

Since 2.30

### struct ExampleAnimalProxyClass

    struct ExampleAnimalProxyClass {
      GDBusProxyClass parent_class;
    };

Class structure for ExampleAnimalProxy.

#### Members

GDBusProxyClass `parent_class`; | The parent class. |

Since 2.30

### struct ExampleAnimalSkeleton

    struct ExampleAnimalSkeleton;

The ExampleAnimalSkeleton structure contains only private data and should only be accessed using the provided API.

Since 2.30

### struct ExampleAnimalSkeletonClass

    struct ExampleAnimalSkeletonClass {
      GDBusInterfaceSkeletonClass parent_class;
    };

Class structure for ExampleAnimalSkeleton.

#### Members

GDBusInterfaceSkeletonClass `parent_class`; | The parent class. |

Since 2.30

## Property Details

### The `“bar”` property

      “bar”                      gchar *

Represents the D-Bus property "Bar".

Since the D-Bus property for this GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.

Flags: Read / Write

Default value: NULL

Since 2.36

### The `“foo”` property

      “foo”                      gchar *

Represents the D-Bus property "Foo".

Since the D-Bus property for this GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.

Flags: Read / Write

Default value: NULL

Since 2.30

### The `“mood”` property

      “mood”                     gchar *

Represents the D-Bus property "Mood".

Since the D-Bus property for this GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.

Flags: Read / Write

Default value: NULL

Since 2.30

## Signal Details

### The `“handle-poke”` signal

    gboolean
    user_function (ExampleAnimal         *object,
                   GDBusMethodInvocation *invocation,
                   gboolean               arg_make_sad,
                   gboolean               arg_make_happy,
                   gpointer               user_data)

Signal emitted when a remote caller is invoking the `Poke()` D-Bus method.

If a signal handler returns `TRUE`, it means the signal handler will handle the invocation (e.g. take a reference to `invocation` and eventually call `example_animal_complete_poke()` or e.g. `g_dbus_method_invocation_return_error()` on it) and no order signal handlers will run. If no signal handler handles the invocation, the `G_DBUS_ERROR_UNKNOWN_METHOD` error is returned.

#### Parameters

object | A ExampleAnimal. |
invocation | A GDBusMethodInvocation. |
arg_make_sad | Argument passed by remote caller. |
arg_make_happy | Argument passed by remote caller. |
user_data | user data set when the signal handler was connected. |

#### Returns

`TRUE` if the invocation was handled, `FALSE` to let other signal handlers run.

Flags: Run Last

Since 2.30

### The `“jumped”` signal

    void
    user_function (ExampleAnimal *object,
                   gdouble        arg_height,
                   gpointer       user_data)

On the client-side, this signal is emitted whenever the D-Bus signal "Jumped" is received.

On the service-side, this signal can be used with e.g. `g_signal_emit_by_name()` to make the object emit the D-Bus signal.

#### Parameters

object | A ExampleAnimal. |
arg_height | Argument. |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since 2.30