EggDBusProperties

EggDBusProperties — Properties interface

Functions

Signals

void egg-dbus-changed Run Last

Types and Values

Object Hierarchy

    GInterface
    ╰── EggDBusProperties

Prerequisites

EggDBusProperties requires GObject.

Description

Many native APIs will have a concept of object properties or attributes. These can be exposed via the EggDBusProperties interface. The available properties and whether they are writable can be determined by using the EggDBusIntrospectable interface.

Functions

EGG_DBUS_QUERY_INTERFACE_PROPERTIES()

#define EGG_DBUS_QUERY_INTERFACE_PROPERTIES(object_proxy) (EGG_DBUS_PROPERTIES (egg_dbus_object_proxy_query_interface (object_proxy, EGG_DBUS_TYPE_PROPERTIES)))

Convenience macro to get an interface proxy for the remote object represented by object_proxy . See egg_dbus_object_proxy_query_interface() for details.

Parameters

object_proxy

A EggDBusObjectProxy.

 

Returns

An instance derived from EggDBusInterfaceProxy that implements the EggDBusProperties interface. This instance can be used to access the

org.freedesktop.DBus.Properties D-Bus interface on the remote

object represented by object_proxy . Do not ref or unref the returned instance, it is owned by object_proxy .


egg_dbus_properties_get_sync ()

gboolean
egg_dbus_properties_get_sync (EggDBusProperties *instance,
                              EggDBusCallFlags call_flags,
                              const gchar *interface_name,
                              const gchar *property_name,
                              EggDBusVariant **out_value,
                              GCancellable *cancellable,
                              GError **error);

Gets the value of the property with name property_name on the interface with name interface_name .

This function synchronously invokes the Get() method on the org.freedesktop.DBus.Properties interface on the object represented by instance . See egg_dbus_properties_get() for the asynchronous version of this function.

Parameters

instance

A EggDBusProperties.

 

call_flags

Flags from EggDBusCallFlags detailing how the method should be invoked.

 

interface_name

The name of the D-Bus interface.

 

property_name

The name of the property.

 

out_value

The value of the property. Free with g_object_unref().

 

cancellable

A GCancellable or NULL.

 

error

Return location for error.

 

Returns

TRUE if the method call succeeded, FALSE if error is set.


egg_dbus_properties_get_all_sync ()

gboolean
egg_dbus_properties_get_all_sync (EggDBusProperties *instance,
                                  EggDBusCallFlags call_flags,
                                  const gchar *interface_name,
                                  EggDBusHashMap **out_properties,
                                  GCancellable *cancellable,
                                  GError **error);

Gets all properties on the interface with the name interface_name .

This function synchronously invokes the GetAll() method on the org.freedesktop.DBus.Properties interface on the object represented by instance . See egg_dbus_properties_get_all() for the asynchronous version of this function.

Parameters

instance

A EggDBusProperties.

 

call_flags

Flags from EggDBusCallFlags detailing how the method should be invoked.

 

interface_name

The name of the D-Bus interface.

 

out_properties

A dictionary containing all the properties. Free with g_object_unref().

 

cancellable

A GCancellable or NULL.

 

error

Return location for error.

 

Returns

TRUE if the method call succeeded, FALSE if error is set.


egg_dbus_properties_set_sync ()

gboolean
egg_dbus_properties_set_sync (EggDBusProperties *instance,
                              EggDBusCallFlags call_flags,
                              const gchar *interface_name,
                              const gchar *property_name,
                              EggDBusVariant *value,
                              GCancellable *cancellable,
                              GError **error);

Sets the value of the property with name property_name on the interface with name interface_name to value .

This function synchronously invokes the Set() method on the org.freedesktop.DBus.Properties interface on the object represented by instance . See egg_dbus_properties_set() for the asynchronous version of this function.

Parameters

instance

A EggDBusProperties.

 

call_flags

Flags from EggDBusCallFlags detailing how the method should be invoked.

 

interface_name

The name of the D-Bus interface.

 

property_name

The name of the property.

 

value

The value to set.

 

cancellable

A GCancellable or NULL.

 

error

Return location for error.

 

Returns

TRUE if the method call succeeded, FALSE if error is set.


egg_dbus_properties_get ()

guint
egg_dbus_properties_get (EggDBusProperties *instance,
                         EggDBusCallFlags call_flags,
                         const gchar *interface_name,
                         const gchar *property_name,
                         GCancellable *cancellable,
                         GAsyncReadyCallback callback,
                         gpointer user_data);

Gets the value of the property with name property_name on the interface with name interface_name .

This function asynchronously invokes the Get() method on the org.freedesktop.DBus.Properties interface on the object represented by instance . When the reply is ready, callback will be called (on the main thread). You can then call egg_dbus_properties_get_finish() to get the result. See egg_dbus_properties_get_sync() for the synchronous version of this function.

Parameters

instance

A EggDBusProperties.

 

call_flags

Flags from EggDBusCallFlags detailing how the method should be invoked.

 

interface_name

The name of the D-Bus interface.

 

property_name

The name of the property.

 

cancellable

A GCancellable or NULL.

 

callback

Callback to invoke when the reply is ready.

 

user_data

User data to pass to callback .

 

Returns

A pending call id (never zero) that can be used with egg_dbus_connection_pending_call_cancel() or egg_dbus_connection_pending_call_block().


egg_dbus_properties_get_finish ()

gboolean
egg_dbus_properties_get_finish (EggDBusProperties *instance,
                                EggDBusVariant **out_value,
                                GAsyncResult *res,
                                GError **error);

Finishes an asynchronous method invocation started with egg_dbus_properties_get().

Parameters

instance

A EggDBusProperties.

 

out_value

The value of the property. Free with g_object_unref().

 

res

A GAsyncResult obtained from the GAsyncReadyCallback function passed to egg_dbus_properties_get().

 

error

Return location for error.

 

Returns

TRUE if the method call succeeded, FALSE if error is set.


egg_dbus_properties_get_all ()

guint
egg_dbus_properties_get_all (EggDBusProperties *instance,
                             EggDBusCallFlags call_flags,
                             const gchar *interface_name,
                             GCancellable *cancellable,
                             GAsyncReadyCallback callback,
                             gpointer user_data);

Gets all properties on the interface with the name interface_name .

This function asynchronously invokes the GetAll() method on the org.freedesktop.DBus.Properties interface on the object represented by instance . When the reply is ready, callback will be called (on the main thread). You can then call egg_dbus_properties_get_all_finish() to get the result. See egg_dbus_properties_get_all_sync() for the synchronous version of this function.

Parameters

instance

A EggDBusProperties.

 

call_flags

Flags from EggDBusCallFlags detailing how the method should be invoked.

 

interface_name

The name of the D-Bus interface.

 

cancellable

A GCancellable or NULL.

 

callback

Callback to invoke when the reply is ready.

 

user_data

User data to pass to callback .

 

Returns

A pending call id (never zero) that can be used with egg_dbus_connection_pending_call_cancel() or egg_dbus_connection_pending_call_block().


egg_dbus_properties_get_all_finish ()

gboolean
egg_dbus_properties_get_all_finish (EggDBusProperties *instance,
                                    EggDBusHashMap **out_properties,
                                    GAsyncResult *res,
                                    GError **error);

Finishes an asynchronous method invocation started with egg_dbus_properties_get_all().

Parameters

instance

A EggDBusProperties.

 

out_properties

A dictionary containing all the properties. Free with g_object_unref().

 

res

A GAsyncResult obtained from the GAsyncReadyCallback function passed to egg_dbus_properties_get_all().

 

error

Return location for error.

 

Returns

TRUE if the method call succeeded, FALSE if error is set.


egg_dbus_properties_set ()

guint
egg_dbus_properties_set (EggDBusProperties *instance,
                         EggDBusCallFlags call_flags,
                         const gchar *interface_name,
                         const gchar *property_name,
                         EggDBusVariant *value,
                         GCancellable *cancellable,
                         GAsyncReadyCallback callback,
                         gpointer user_data);

Sets the value of the property with name property_name on the interface with name interface_name to value .

This function asynchronously invokes the Set() method on the org.freedesktop.DBus.Properties interface on the object represented by instance . When the reply is ready, callback will be called (on the main thread). You can then call egg_dbus_properties_set_finish() to get the result. See egg_dbus_properties_set_sync() for the synchronous version of this function.

Parameters

instance

A EggDBusProperties.

 

call_flags

Flags from EggDBusCallFlags detailing how the method should be invoked.

 

interface_name

The name of the D-Bus interface.

 

property_name

The name of the property.

 

value

The value to set.

 

cancellable

A GCancellable or NULL.

 

callback

Callback to invoke when the reply is ready.

 

user_data

User data to pass to callback .

 

Returns

A pending call id (never zero) that can be used with egg_dbus_connection_pending_call_cancel() or egg_dbus_connection_pending_call_block().


egg_dbus_properties_set_finish ()

gboolean
egg_dbus_properties_set_finish (EggDBusProperties *instance,
                                GAsyncResult *res,
                                GError **error);

Finishes an asynchronous method invocation started with egg_dbus_properties_set().

Parameters

instance

A EggDBusProperties.

 

res

A GAsyncResult obtained from the GAsyncReadyCallback function passed to egg_dbus_properties_set().

 

error

Return location for error.

 

Returns

TRUE if the method call succeeded, FALSE if error is set.


egg_dbus_properties_handle_get_finish ()

void
egg_dbus_properties_handle_get_finish (EggDBusMethodInvocation *method_invocation,
                                       EggDBusVariant *out_value);

Function to be called by implementers of the

org.freedesktop.DBus.Properties

D-Bus interface to finish handling the

Get() method.

Parameters

value

The value of the property.

 

method_invocation

A EggDBusMethodInvocation.

 

egg_dbus_properties_handle_get_all_finish ()

void
egg_dbus_properties_handle_get_all_finish
                               (EggDBusMethodInvocation *method_invocation,
                                EggDBusHashMap *out_properties);

Function to be called by implementers of the

org.freedesktop.DBus.Properties

D-Bus interface to finish handling the

GetAll() method.

Parameters

properties

A dictionary containing all the properties.

 

method_invocation

A EggDBusMethodInvocation.

 

egg_dbus_properties_handle_set_finish ()

void
egg_dbus_properties_handle_set_finish (EggDBusMethodInvocation *method_invocation);

Function to be called by implementers of the

org.freedesktop.DBus.Properties

D-Bus interface to finish handling the

Set() method.

Parameters

method_invocation

A EggDBusMethodInvocation.

 

egg_dbus_properties_emit_signal_egg_dbus_changed ()

void
egg_dbus_properties_emit_signal_egg_dbus_changed
                               (EggDBusProperties *instance,
                                const gchar *destination,
                                const gchar *interface_name,
                                EggDBusHashMap *changed_properties);

Type safe wrapper for emitting the “egg-dbus-changed” signal.

Parameters

instance

A GObject derived type implementing the EggDBusProperties interface.

 

destination

The destination of the signal or NULL to emit signals to all listeners.

 

interface_name

The name of the D-Bus interface.

 

changed_properties

A dictionary containing the changed properties.

 

Types and Values

EggDBusProperties

typedef struct _EggDBusProperties EggDBusProperties;

struct EggDBusPropertiesIface

struct EggDBusPropertiesIface {
  EggDBusInterfaceIface g_iface;

  void (* handle_get) (
      EggDBusProperties *instance,
      const gchar *interface_name,
      const gchar *property_name,
      EggDBusMethodInvocation *method_invocation);

  void (* handle_get_all) (
      EggDBusProperties *instance,
      const gchar *interface_name,
      EggDBusMethodInvocation *method_invocation);

  void (* handle_set) (
      EggDBusProperties *instance,
      const gchar *interface_name,
      const gchar *property_name,
      EggDBusVariant *value,
      EggDBusMethodInvocation *method_invocation);
};

Interface VTable for implementing the org.freedesktop.DBus.Properties D-Bus interface.

Members

handle_get ()

Gets the value of the property with name property_name on the interface with name interface_name .

 

handle_get_all ()

Gets all properties on the interface with the name interface_name .

 

handle_set ()

Sets the value of the property with name property_name on the interface with name interface_name to value .

 

Signal Details

The “egg-dbus-changed” signal

void
user_function (EggDBusProperties *instance,
               char              *interface_name,
               EggDBusHashMap    *changed_properties,
               gpointer           user_data)

Emitted when one or more properties change on an interface. Note: this signal is proprietary to EggDBus; no other D-Bus implementation will emit it.

Parameters

instance

A EggDBusProperties.

 

interface_name

The name of the D-Bus interface.

 

changed_properties

A dictionary containing the changed properties.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last