IBusService

## IBusService IBusService — IBus service back-end. |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

                        IBusService;
                        IBusServiceClass;
    gboolean            (*ServiceIBusMessageFunc)           (IBusService *service,
                                                             IBusConnection *connection,
                                                             IBusMessage *message);
    gboolean            (*ServiceIBusSignalFunc)            (IBusService *service,
                                                             IBusConnection *connection,
                                                             IBusMessage *message);
    IBusService *       ibus_service_new                    (const gchar *path);
    const gchar *       ibus_service_get_path               (IBusService *service);
    gboolean            ibus_service_handle_message         (IBusService *service,
                                                             IBusConnection *connection,
                                                             IBusMessage *message);
    gboolean            ibus_service_add_to_connection      (IBusService *service,
                                                             IBusConnection *connection);
    GList *             ibus_service_get_connections        (IBusService *service);
    gboolean            ibus_service_remove_from_connection (IBusService *service,
                                                             IBusConnection *connection);
    gboolean            ibus_service_remove_from_all_connections
                                                            (IBusService *service);
    gboolean            ibus_service_send_signal            (IBusService *service,
                                                             const gchar *interface,
                                                             const gchar *name,
                                                             GType first_arg_type,
                                                             ...);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----IBusObject
                   +----IBusService
                         +----IBusFactory
                         +----IBusConfigService
                         +----IBusEngine
                         +----IBusPanelService

## Properties

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

## Signals

      "ibus-message"                                   : Run Last
      "ibus-signal"                                    : Run Last

## Description

An IBusService is a base class for services.

## Details

### IBusService

    typedef struct _IBusService IBusService;

An opaque data type representing an IBusService.

### IBusServiceClass

    typedef struct {
        IBusObjectClass parent;

        /* signals */
        gboolean  (* ibus_message)      (IBusService    *service,
                                         IBusConnection *connection,
                                         IBusMessage    *message);
        gboolean  (* ibus_signal)       (IBusService    *service,
                                         IBusConnection *connection,
                                         IBusMessage    *message);
    } IBusServiceClass;

### ServiceIBusMessageFunc ()

    gboolean            (*ServiceIBusMessageFunc)           (IBusService *service,
                                                             IBusConnection *connection,
                                                             IBusMessage *message);

Prototype of IBus service message sending callback function.

`service` : | An IBsService.
`connection` : | Connection to IBus daemon.
`message` : | IBusMessage to be sent.
Returns : | `TRUE` if succeed; `FALSE` if failed.

### ServiceIBusSignalFunc ()

    gboolean            (*ServiceIBusSignalFunc)            (IBusService *service,
                                                             IBusConnection *connection,
                                                             IBusMessage *message);

Prototype of IBus service signal sending callback function.

`service` : | An IBsService.
`connection` : | Connection to IBus daemon.
`message` : | IBusMessage to be sent.
Returns : | `TRUE` if succeed; `FALSE` if failed.

### ibus_service_new ()

    IBusService *       ibus_service_new                    (const gchar *path);

New an IBusService.

`path` : | Object path.
Returns : | A newly allocated IBusService

### ibus_service_get_path ()

    const gchar *       ibus_service_get_path               (IBusService *service);

Returns the object path of an IBusService.

`service` : | An IBusService.
Returns : | The object path of `service`

### ibus_service_handle_message ()

    gboolean            ibus_service_handle_message         (IBusService *service,
                                                             IBusConnection *connection,
                                                             IBusMessage *message);

Emit an IBusMessage on an IBusConnection.

`service` : | An IBusService.
`connection` : | Corresponding IBusCOnnection
`message` : | IBusMessage to be handled.
Returns : | TRUE if succeed; FALSE otherwise.

### ibus_service_add_to_connection ()

    gboolean            ibus_service_add_to_connection      (IBusService *service,
                                                             IBusConnection *connection);

Add an IBus Service to an IBusConnection. This function also connects the service to the signal IBusConnection::destroy of the connection.

`service` : | An IBusService.
`connection` : | Corresponding IBusCOnnection
Returns : | TRUE if succeed; FALSE otherwise.

### ibus_service_get_connections ()

    GList *             ibus_service_get_connections        (IBusService *service);

Returns a copy of list of connections, but the caller does not own the element.

`service` : | An IBusService.
Returns : | A newly allocated list of connections. [transfer container][element-type IBusConnection]

### ibus_service_remove_from_connection ()

    gboolean            ibus_service_remove_from_connection (IBusService *service,
                                                             IBusConnection *connection);

Remove an IBusService from an IBusConnection. This function also disconnects the signal IBusConnection::destroy.

`service` : | An IBusService.
`connection` : | Corresponding IBusCOnnection
Returns : | TRUE if succeed; FALSE otherwise.

### ibus_service_remove_from_all_connections ()

    gboolean            ibus_service_remove_from_all_connections
                                                            (IBusService *service);

Remove an IBusService from all connections. This function also disconnects the signal IBusConnection::destroy.

`service` : | An IBusService.
Returns : | TRUE if succeed; FALSE otherwise.

### ibus_service_send_signal ()

    gboolean            ibus_service_send_signal            (IBusService *service,
                                                             const gchar *interface,
                                                             const gchar *name,
                                                             GType first_arg_type,
                                                             ...);

Send signal to all the IBusConnections of an IBusService.

`see_also`: `ibus_connection_send_signal()`

`service` : | An IBusService.
`interface` : | The interface the signal is emitted from.
`name` : | Name of the signal.
`first_arg_type` : | Type of first argument.
`...` : | Rest of arguments, NULL to mark the end.
Returns : | TRUE if succeed; FALSE otherwise.

## Property Details

### The `"path"` property

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

The path of service object.

Default value: NULL

## Signal Details

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

    gboolean            user_function                      (IBusService *service,
                                                            gpointer     connection,
                                                            gpointer     message,
                                                            gpointer     user_data)       : Run Last

Send a message as IBusMessage though the `connection`.

`service` : | An IBusService.
`connection` : | Corresponding IBusConnection.
`message` : | An IBusMessage to be sent.
`user_data` : | user data set when the signal handler was connected.
Returns : | TRUE if succeed; FALSE otherwise. ### Note Argument `user_data` is ignored in this function.

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

    gboolean            user_function                      (IBusService *service,
                                                            gpointer     connection,
                                                            gpointer     message,
                                                            gpointer     user_data)       : Run Last

Send a signal as IBusMessage though the `connection`.

`service` : | An IBusService.
`connection` : | Corresponding IBusConnection.
`message` : | An IBusMessage to be sent.
`user_data` : | user data set when the signal handler was connected.
Returns : | TRUE if succeed; FALSE otherwise. ### Note Argument `user_data` is ignored in this function.