IBusProxy

## IBusProxy IBusProxy — Base proxy object. |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

                        IBusProxy;
                        IBusProxyClass;
    IBusProxy *         ibus_proxy_new                      (const gchar *name,
                                                             const gchar *path,
                                                             IBusConnection *connection);
    gboolean            ibus_proxy_send                     (IBusProxy *proxy,
                                                             IBusMessage *message);
    gboolean            ibus_proxy_call                     (IBusProxy *proxy,
                                                             const gchar *method,
                                                             GType first_arg_type,
                                                             ...);
    gboolean            ibus_proxy_call_with_reply          (IBusProxy *proxy,
                                                             const gchar *method,
                                                             IBusPendingCall **pending,
                                                             gint timeout_milliseconds,
                                                             IBusError **error,
                                                             GType first_arg_type,
                                                             ...);
    IBusMessage *       ibus_proxy_call_with_reply_and_block
                                                            (IBusProxy *proxy,
                                                             const gchar *method,
                                                             gint timeout_milliseconds,
                                                             IBusError **error,
                                                             GType first_arg_type,
                                                             ...);
    gboolean            ibus_proxy_send_with_reply          (IBusProxy *proxy,
                                                             IBusMessage *message,
                                                             IBusPendingCall **pending,
                                                             gint timeout_milliseconds);
    IBusMessage *       ibus_proxy_send_with_reply_and_block
                                                            (IBusProxy *proxy,
                                                             IBusMessage *message);
    gboolean            ibus_proxy_handle_signal            (IBusProxy *proxy,
                                                             IBusMessage *message);
    const gchar *       ibus_proxy_get_name                 (IBusProxy *proxy);
    const gchar *       ibus_proxy_get_unique_name          (IBusProxy *proxy);
    const gchar *       ibus_proxy_get_path                 (IBusProxy *proxy);
    const gchar *       ibus_proxy_get_interface            (IBusProxy *proxy);
    IBusConnection *    ibus_proxy_get_connection           (IBusProxy *proxy);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----IBusObject
                   +----IBusProxy
                         +----IBusConfig
                         +----IBusInputContext

## Properties

      "connection"               IBusConnection*       : Read / Write / Construct Only
      "interface"                gchar*                : Read / Write / Construct Only
      "name"                     gchar*                : Read / Write / Construct Only
      "path"                     gchar*                : Read / Write / Construct Only

## Signals

      "ibus-signal"                                    : Run Last

## Description

An IBusProxy is the base of all proxy objects, which communicate the corresponding IBusServices on the other end of IBusConnection. For example, IBus clients (such as editors, web browsers) invoke the proxy object, IBusInputContext to communicate with the InputContext service of the ibus-daemon.

Almost all services have corresponding proxies, except very simple services.

## Details

### IBusProxy

    typedef struct _IBusProxy IBusProxy;

An opaque data type representing an IBusProxy.

### IBusProxyClass

    typedef struct {
        IBusObjectClass parent;

        /* class members */
        gboolean    (* ibus_signal)     (IBusProxy      *proxy,
                                         IBusMessage    *message);
    } IBusProxyClass;

### ibus_proxy_new ()

    IBusProxy *         ibus_proxy_new                      (const gchar *name,
                                                             const gchar *path,
                                                             IBusConnection *connection);

New an IBusProxy instance. Property IBusProxy:name is set as `name`, and IBusProxy:path is set as `path`.

`name` : | The service name of proxy object.
`path` : | The path of proxy object.
`connection` : | An IBusConnection.
Returns : | A newly allocated IBusProxy instance.

### ibus_proxy_send ()

    gboolean            ibus_proxy_send                     (IBusProxy *proxy,
                                                             IBusMessage *message);

Send an IBusMessage to the corresponding service.

`see_also` `ibus_proxy_call()`, `ibus_proxy_send_with_reply()`, `ibus_proxy_send_with_reply_and_block()`.

`proxy` : | An IBusProxy.
`message` : | The IBusMessage to be sent.
Returns : | TRUE if succeed; FALSE otherwise.

### ibus_proxy_call ()

    gboolean            ibus_proxy_call                     (IBusProxy *proxy,
                                                             const gchar *method,
                                                             GType first_arg_type,
                                                             ...);

Call a method of the corresponding service.

`see_also` `ibus_proxy_send()`, `ibus_proxy_call_with_reply()`, `ibus_proxy_call_with_reply_and_block()`.

`proxy` : | An IBusProxy.
`method` : | The method to be called.
`first_arg_type` : | Type of first argument.
`...` : | Rest of arguments, NULL to mark the end.
Returns : | TRUE if succeed; FALSE otherwise.

### ibus_proxy_call_with_reply ()

    gboolean            ibus_proxy_call_with_reply          (IBusProxy *proxy,
                                                             const gchar *method,
                                                             IBusPendingCall **pending,
                                                             gint timeout_milliseconds,
                                                             IBusError **error,
                                                             GType first_arg_type,
                                                             ...);

Call a method of the corresponding service, and returns an IBusPendingCall used to receive a reply to the message. This function calls `ibus_connection_send_with_reply()` to do the actual sending.

`see_also`: `ibus_connection_send_with_reply()`, `ibus_proxy_call()`, `ibus_proxy_send_with_reply()`, `ibus_proxy_call_with_reply_and_block()`.

`proxy` : | An IBusProxy.
`method` : | The method to be called.
`pending` : | Return location of a IBusPendingCall object, or NULL if connection is disconnected.
`timeout_milliseconds` : | Time out in milliseconds.
`error` : | Returned error is stored here; NULL to ignore error.
`first_arg_type` : | Type of first argument.
`...` : | Rest of arguments, NULL to mark the end.
Returns : | TRUE if succeed; FALSE otherwise.

### ibus_proxy_call_with_reply_and_block ()

    IBusMessage *       ibus_proxy_call_with_reply_and_block
                                                            (IBusProxy *proxy,
                                                             const gchar *method,
                                                             gint timeout_milliseconds,
                                                             IBusError **error,
                                                             GType first_arg_type,
                                                             ...);

Call a method of the corresponding service and blocks a certain time period while waiting for an IBusMessage as reply. If the IBusMessage is not NULL, it calls `ibus_connection_send_with_reply_and_block()` to do the actual sending.

`see_also`: `ibus_connection_send_with_reply_and_block()`, `ibus_proxy_call()`, `ibus_proxy_send_with_reply()`, `ibus_proxy_call_with_reply_and_block()`.

`proxy` : | An IBusProxy.
`method` : | The method to be called.
`timeout_milliseconds` : | Time out in milliseconds.
`error` : | Returned error is stored here; NULL to ignore error.
`first_arg_type` : | Type of first argument.
`...` : | Rest of arguments, NULL to mark the end.
Returns : | An IBusMessage that is the reply or NULL with an error code if the function fails.

### ibus_proxy_send_with_reply ()

    gboolean            ibus_proxy_send_with_reply          (IBusProxy *proxy,
                                                             IBusMessage *message,
                                                             IBusPendingCall **pending,
                                                             gint timeout_milliseconds);

Send an IBusMessage to the corresponding service and returns an IBusPendingCall used to receive a reply to the message. This function calls `ibus_connection_send_with_reply()` to do the actual sending.

`see_also`: `ibus_connection_send_with_reply()`, `ibus_proxy_send()`, `ibus_proxy_call_with_reply()`, `ibus_proxy_send_with_reply_and_block()`.

`proxy` : | An IBusProxy.
`message` : | The IBusMessage to be sent.
`pending` : | Return location of a IBusPendingCall object, or NULL if connection is disconnected.
`timeout_milliseconds` : | Time out in milliseconds.
Returns : | TRUE if succeed; FALSE otherwise.

### ibus_proxy_send_with_reply_and_block ()

    IBusMessage *       ibus_proxy_send_with_reply_and_block
                                                            (IBusProxy *proxy,
                                                             IBusMessage *message);

Send an IBusMessage to the corresponding service and blocks a certain time period while waiting for an IBusMessage as reply. If the IBusMessage is not NULL, it calls `ibus_connection_send_with_reply_and_block()` to do the actual sending.

`see_also`: `ibus_connection_send_with_reply_and_block()`, `ibus_proxy_send()`, `ibus_proxy_send_with_reply()`, `ibus_proxy_call_with_reply_and_block()`.

`proxy` : | An IBusProxy.
`message` : | The IBusMessage to be sent.
Returns : | An IBusMessage that is the reply or NULL with an error code if the function fails.

### ibus_proxy_handle_signal ()

    gboolean            ibus_proxy_handle_signal            (IBusProxy *proxy,
                                                             IBusMessage *message);

Handle a signal by emitting IBusProxy::ibus-signal.

If signal name is `NameOwnerChanged` and the service name is identical to the old name, then `proxy` will be destroyed by `ibus_object_destroy()` and FALSE is returned. Otherwise TRUE is returned.

Note that if the path of of message is not identical to the IBusProxy:path this function will not emit IBusProxy::ibus-signal.

`proxy` : | An IBusProxy.
`message` : | The IBusMessage to be sent.
Returns : | TRUE if succeed; FALSE otherwise.

### ibus_proxy_get_name ()

    const gchar *       ibus_proxy_get_name                 (IBusProxy *proxy);

Get the service name of a proxy object.

`proxy` : | An IBusProxy.
Returns : | The service name of the proxy object.

### ibus_proxy_get_unique_name ()

    const gchar *       ibus_proxy_get_unique_name          (IBusProxy *proxy);

Get the unique name of the proxy object.

`proxy` : | An IBusProxy.
Returns : | The service name of the proxy object.

### ibus_proxy_get_path ()

    const gchar *       ibus_proxy_get_path                 (IBusProxy *proxy);

Get the path of a proxy object.

`proxy` : | An IBusProxy.
Returns : | The path of proxy object.

### ibus_proxy_get_interface ()

    const gchar *       ibus_proxy_get_interface            (IBusProxy *proxy);

Get interface of a proxy object.

`proxy` : | An IBusProxy.
Returns : | The service name of the proxy object.

### ibus_proxy_get_connection ()

    IBusConnection *    ibus_proxy_get_connection           (IBusProxy *proxy);

Get the connection of a proxy object.

`proxy` : | An IBusProxy.
Returns : | The connection of the proxy object. [transfer none]

## Property Details

### The `"connection"` property

      "connection"               IBusConnection*       : Read / Write / Construct Only

The connection of the proxy object.

### The `"interface"` property

      "interface"                gchar*                : Read / Write / Construct Only

The interface of the proxy object.

Default value: NULL

### The `"name"` property

      "name"                     gchar*                : Read / Write / Construct Only

The service name of the proxy object.

Default value: NULL

### The `"path"` property

      "path"                     gchar*                : Read / Write / Construct Only

The path of the proxy object.

Default value: NULL

## Signal Details

### The `"ibus-signal"` signal

    gboolean            user_function                      (IBusProxy *proxy,
                                                            gpointer   message,
                                                            gpointer   user_data)      : Run Last

Emitted when sending a signal. Implement the member function `ibus_signal()` in extended class to receive this signal.

### Note

Argument `user_data` is ignored in this function.

`proxy` : | An IBusProxy.
`message` : | An message that contains the signal.
`user_data` : | user data set when the signal handler was connected.
Returns : | TRUE if the path of `message` is identical to IBusProxy:path and successfully handled. `see_also`: `ibus_proxy_handle_signal()`.