Exemplo n.º 1
0
gboolean
ibus_bus_name_has_owner (IBusBus        *bus,
                         const gchar    *name)
{
    g_assert (IBUS_IS_BUS (bus));

    IBusMessage *reply = NULL;
    IBusError *error = NULL;
    gboolean retval = FALSE;

    reply = ibus_bus_call_with_reply (bus,
                                      DBUS_SERVICE_DBUS,
                                      DBUS_PATH_DBUS,
                                      DBUS_INTERFACE_DBUS,
                                      "NameHasOwner",
                                      G_TYPE_STRING, &name,
                                      G_TYPE_INVALID);

    if (reply) {
        if (!ibus_message_get_args (reply, &error, G_TYPE_BOOLEAN, &retval,
                                    G_TYPE_INVALID)) {
            g_warning ("%s: %s", error->name, error->message);
            ibus_error_free (error);
        }

        ibus_message_unref (reply);
    }

    return retval;
}
Exemplo n.º 2
0
Arquivo: ibusbus.c Projeto: BBIO/ibus
IBusInputContext *
ibus_bus_create_input_context (IBusBus      *bus,
                               const gchar  *client_name)
{
    g_assert (IBUS_IS_BUS (bus));
    g_assert (client_name != NULL);

    g_return_val_if_fail (ibus_bus_is_connected (bus), NULL);

    gchar *path;
    DBusMessage *call = NULL;
    DBusMessage *reply = NULL;
    IBusError *error;
    IBusInputContext *context = NULL;
    IBusBusPrivate *priv;
    priv = IBUS_BUS_GET_PRIVATE (bus);

    call = ibus_message_new_method_call (IBUS_SERVICE_IBUS,
                                         IBUS_PATH_IBUS,
                                         IBUS_INTERFACE_IBUS,
                                         "CreateInputContext");
    ibus_message_append_args (call,
                              G_TYPE_STRING, &client_name,
                              G_TYPE_INVALID);

    reply = ibus_connection_send_with_reply_and_block (priv->connection,
                                                       call,
                                                       -1,
                                                       &error);
    ibus_message_unref (call);

    if (reply == NULL) {
        g_warning ("%s: %s", error->name, error->message);
        ibus_error_free (error);
        return NULL;
    }

    if ((error = ibus_error_new_from_message (reply)) != NULL) {
        g_warning ("%s: %s", error->name, error->message);
        ibus_message_unref (reply);
        ibus_error_free (error);
        return NULL;
    }

    if (!ibus_message_get_args (reply,
                                &error,
                                IBUS_TYPE_OBJECT_PATH, &path,
                                G_TYPE_INVALID)) {
        g_warning ("%s: %s", error->name, error->message);
        ibus_message_unref (reply);
        ibus_error_free (error);

        return NULL;
    }

    context = ibus_input_context_new (path, priv->connection);
    ibus_message_unref (reply);

    return context;
}
Exemplo n.º 3
0
guint
ibus_bus_release_name (IBusBus      *bus,
                       const gchar  *name)
{
    g_assert (IBUS_IS_BUS (bus));

    IBusMessage *reply = NULL;
    IBusError *error = NULL;
    guint retval = 0;

    reply = ibus_bus_call_with_reply (bus,
                                      DBUS_SERVICE_DBUS,
                                      DBUS_PATH_DBUS,
                                      DBUS_INTERFACE_DBUS,
                                      "ReleaseName",
                                      G_TYPE_STRING, &name,
                                      G_TYPE_INVALID);

    if (reply) {
        if (!ibus_message_get_args (reply, &error, G_TYPE_UINT, &retval,
                                    G_TYPE_INVALID)) {
            g_warning ("%s: %s", error->name, error->message);
            ibus_error_free (error);
        }

        ibus_message_unref (reply);
    }

    return retval;
}
Exemplo n.º 4
0
Arquivo: ibusbus.c Projeto: BBIO/ibus
guint
ibus_bus_request_name (IBusBus      *bus,
                       const gchar  *name,
                       guint         flags)
{
    g_assert (IBUS_IS_BUS (bus));

    guint retval;
    gboolean result;

    result = ibus_bus_call (bus,
                            DBUS_SERVICE_DBUS,
                            DBUS_PATH_DBUS,
                            DBUS_INTERFACE_DBUS,
                            "RequestName",
                            G_TYPE_STRING, &name,
                            G_TYPE_UINT, &flags,
                            G_TYPE_INVALID,
                            G_TYPE_UINT, &retval,
                            G_TYPE_INVALID);

    if (result)
        return retval;

    return 0;
}
Exemplo n.º 5
0
gchar *
ibus_bus_current_input_context(IBusBus      *bus)
{
    g_assert (IBUS_IS_BUS (bus));
    g_return_val_if_fail (ibus_bus_is_connected (bus), NULL);

    gchar *path = NULL;
    IBusMessage *reply = NULL;
    IBusError *error = NULL;

    reply = ibus_bus_call_with_reply (bus,
                                      IBUS_SERVICE_IBUS,
                                      IBUS_PATH_IBUS,
                                      IBUS_INTERFACE_IBUS,
                                      "CurrentInputContext",
                                      G_TYPE_INVALID);

    if (reply) {
        if (ibus_message_get_args (reply, &error,
                                   IBUS_TYPE_OBJECT_PATH, &path,
                                   G_TYPE_INVALID)) {
            path = g_strdup (path);
        } else {
            g_warning ("%s: %s", error->name, error->message);
            ibus_error_free (error);
        }

        ibus_message_unref (reply);
    }

    return path;
}
Exemplo n.º 6
0
static void
_connection_destroy_cb (IBusConnection  *connection,
                        IBusBus         *bus)
{
    g_assert (IBUS_IS_BUS (bus));
    g_assert (IBUS_IS_CONNECTION (connection));

    IBusBusPrivate *priv;
    priv = IBUS_BUS_GET_PRIVATE (bus);

    g_assert (priv->connection == connection);
    g_signal_handlers_disconnect_by_func (priv->connection,
                                          G_CALLBACK (_connection_destroy_cb),
                                          bus);
    g_signal_handlers_disconnect_by_func (priv->connection,
                                          G_CALLBACK (_connection_ibus_signal_cb),
                                          bus);
    g_object_unref (priv->connection);
    priv->connection = NULL;

    g_free (priv->unique_name);
    priv->unique_name = NULL;

    g_signal_emit (bus, bus_signals[DISCONNECTED], 0);
}
Exemplo n.º 7
0
Arquivo: ibusbus.c Projeto: BBIO/ibus
gboolean
ibus_bus_register_component (IBusBus       *bus,
                             IBusComponent *component)
{
    g_assert (IBUS_IS_BUS (bus));
    g_assert (IBUS_IS_COMPONENT (component));

    gboolean result;

    result = ibus_bus_call (bus,
                            IBUS_SERVICE_IBUS,
                            IBUS_PATH_IBUS,
                            IBUS_INTERFACE_IBUS,
                            "RegisterComponent",
                            IBUS_TYPE_COMPONENT, &component,
                            G_TYPE_INVALID,
                            G_TYPE_INVALID);

    return result;


#if 0
    IBusMessage *message, *reply;
    IBusError *error;

    IBusBusPrivate *priv;
    priv = IBUS_BUS_GET_PRIVATE (bus);

    message = ibus_message_new_method_call (IBUS_SERVICE_IBUS,
                                            IBUS_PATH_IBUS,
                                            IBUS_INTERFACE_IBUS,
                                            "RegisterComponent");

    ibus_message_append_args (message,
                              IBUS_TYPE_COMPONENT, &component,
                              G_TYPE_INVALID);

    reply = ibus_connection_send_with_reply_and_block (
                                        priv->connection,
                                        message,
                                        -1,
                                        &error);
    ibus_message_unref (message);

    if (reply == NULL) {
        g_warning ("%s : %s", error->name, error->message);
        ibus_error_free (error);
        return FALSE;
    }

    if ((error = ibus_error_from_message (reply)) != NULL) {
        g_warning ("%s : %s", error->name, error->message);
        ibus_error_free (error);
        ibus_message_unref (reply);
        return FALSE;
    }

    return TRUE;
#endif
}
Exemplo n.º 8
0
IBusEngineDesc *
ibus_bus_get_global_engine (IBusBus *bus)
{
    g_assert (IBUS_IS_BUS (bus));

    IBusMessage *reply = NULL;
    IBusError *error = NULL;
    IBusEngineDesc *global_engine = NULL;

    reply = ibus_bus_call_with_reply (bus,
                                      IBUS_SERVICE_IBUS,
                                      IBUS_PATH_IBUS,
                                      IBUS_INTERFACE_IBUS,
                                      "GetGlobalEngine",
                                      G_TYPE_INVALID);
    if (reply) {
        if (!ibus_message_get_args (reply, &error, IBUS_TYPE_ENGINE_DESC,
                                    &global_engine, G_TYPE_INVALID)) {
            g_warning ("%s: %s", error->name, error->message);
            ibus_error_free (error);
        }

        ibus_message_unref (reply);
    }

    return global_engine;
}
Exemplo n.º 9
0
gchar *
ibus_bus_get_name_owner (IBusBus        *bus,
                         const gchar    *name)
{
    g_assert (IBUS_IS_BUS (bus));

    gchar *owner = NULL;
    IBusMessage *reply = NULL;
    IBusError *error = NULL;

    reply = ibus_bus_call_with_reply (bus,
                                      DBUS_SERVICE_DBUS,
                                      DBUS_PATH_DBUS,
                                      DBUS_INTERFACE_DBUS,
                                      "GetNameOwner",
                                      G_TYPE_STRING, &name,
                                      G_TYPE_INVALID);

    if (reply) {
        if (ibus_message_get_args (reply, &error, G_TYPE_STRING, &owner,
                                   G_TYPE_INVALID)) {
            owner = g_strdup (owner);
        } else {
            g_warning ("%s: %s", error->name, error->message);
            ibus_error_free (error);
        }

        ibus_message_unref (reply);
    }

    return owner;
}
Exemplo n.º 10
0
gboolean
ibus_bus_get_use_global_engine (IBusBus *bus)
{
    g_assert (IBUS_IS_BUS (bus));

    IBusMessage *reply = NULL;
    IBusError *error = NULL;
    gboolean use_global_engine = FALSE;

    reply = ibus_bus_call_with_reply (bus,
                                      IBUS_SERVICE_IBUS,
                                      IBUS_PATH_IBUS,
                                      IBUS_INTERFACE_IBUS,
                                      "GetUseGlobalEngine",
                                      G_TYPE_INVALID);
    if (reply) {
        if (!ibus_message_get_args (reply, &error, G_TYPE_BOOLEAN,
                                    &use_global_engine, G_TYPE_INVALID)) {
            g_warning ("%s: %s", error->name, error->message);
            ibus_error_free (error);
        }

        ibus_message_unref (reply);
    }

    return use_global_engine;
}
Exemplo n.º 11
0
static void
_bus_disconnected_cb (IBusBus   *ibusbus,
                      BusTestClient *client)
{
    g_assert (IBUS_IS_BUS (ibusbus));
    g_assert (BUS_IS_TEST_CLIENT (client));
    IDEBUG ("%s", __FUNCTION__);
    client->connected = FALSE;
    IDEBUG ("Disconnected ibus daemon");
}
Exemplo n.º 12
0
Arquivo: ibusbus.c Projeto: BBIO/ibus
IBusConnection *
ibus_bus_get_connection (IBusBus *bus)
{
    g_assert (IBUS_IS_BUS (bus));

    IBusBusPrivate *priv;
    priv = IBUS_BUS_GET_PRIVATE (bus);

    return priv->connection;
}
Exemplo n.º 13
0
Arquivo: ibusbus.c Projeto: BBIO/ibus
static void
ibus_bus_unwatch_dbus_signal (IBusBus *bus)
{
    g_assert (IBUS_IS_BUS (bus));

    const gchar *rule;

    rule = "type='signal'," \
           "path='" DBUS_PATH_DBUS "'," \
           "interface='" DBUS_INTERFACE_DBUS "'";

    ibus_bus_remove_match (bus, rule);
}
Exemplo n.º 14
0
Arquivo: ibusbus.c Projeto: BBIO/ibus
gboolean
ibus_bus_is_connected (IBusBus *bus)
{
    g_assert (IBUS_IS_BUS (bus));

    IBusBusPrivate *priv;
    priv = IBUS_BUS_GET_PRIVATE (bus);

    if (priv->connection) {
        return ibus_connection_is_connected (priv->connection);
    }

    return FALSE;
}
Exemplo n.º 15
0
void
ibus_bus_remove_match (IBusBus      *bus,
                       const gchar  *rule)
{
    g_assert (IBUS_IS_BUS (bus));

    ibus_bus_call (bus,
                   DBUS_SERVICE_DBUS,
                   DBUS_PATH_DBUS,
                   DBUS_INTERFACE_DBUS,
                   "RemoveMatch",
                   G_TYPE_STRING, &rule,
                   G_TYPE_INVALID);
}
Exemplo n.º 16
0
IBusMessage *
ibus_bus_call_with_reply_valist (IBusBus      *bus,
                                 const gchar  *name,
                                 const gchar  *path,
                                 const gchar  *interface,
                                 const gchar  *member,
                                 GType         first_arg_type,
                                 va_list       va_args)
{
    g_assert (IBUS_IS_BUS (bus));
    g_assert (name != NULL);
    g_assert (path != NULL);
    g_assert (interface != NULL);
    g_assert (member);

    IBusMessage *message, *reply;
    IBusError *error;
    IBusBusPrivate *priv;

    g_return_val_if_fail (ibus_bus_is_connected (bus), FALSE);

    priv = IBUS_BUS_GET_PRIVATE (bus);

    message = ibus_message_new_method_call (name, path, interface, member);

    ibus_message_append_args_valist (message, first_arg_type, va_args);

    reply = ibus_connection_send_with_reply_and_block (
                                        priv->connection,
                                        message,
                                        -1,
                                        &error);
    ibus_message_unref (message);

    if (reply == NULL) {
        g_warning ("%s : %s", error->name, error->message);
        ibus_error_free (error);
        return NULL;
    }

    if ((error = ibus_error_new_from_message (reply)) != NULL) {
        g_warning ("%s : %s", error->name, error->message);
        ibus_error_free (error);
        ibus_message_unref (reply);
        return NULL;
    }

    return reply;
}
Exemplo n.º 17
0
Arquivo: ibusbus.c Projeto: BBIO/ibus
void
ibus_bus_add_match (IBusBus     *bus,
                    const gchar *rule)
{
    g_assert (IBUS_IS_BUS (bus));

    gboolean result;

    result = ibus_bus_call (bus,
                            DBUS_SERVICE_DBUS,
                            DBUS_PATH_DBUS,
                            DBUS_INTERFACE_DBUS,
                            "AddMatch",
                            G_TYPE_STRING, &rule,
                            G_TYPE_INVALID,
                            G_TYPE_INVALID);
}
Exemplo n.º 18
0
gboolean
ibus_bus_set_global_engine (IBusBus     *bus,
                            const gchar *global_engine)
{
    g_assert (IBUS_IS_BUS (bus));

    gboolean result;
    result = ibus_bus_call (bus,
                            IBUS_SERVICE_IBUS,
                            IBUS_PATH_IBUS,
                            IBUS_INTERFACE_IBUS,
                            "SetGlobalEngine",
                            G_TYPE_STRING, &global_engine,
                            G_TYPE_INVALID);

    return result;
}
Exemplo n.º 19
0
Arquivo: ibusbus.c Projeto: BBIO/ibus
IBusConfig *
ibus_bus_get_config (IBusBus *bus)
{
    g_assert (IBUS_IS_BUS (bus));
    g_return_val_if_fail (ibus_bus_is_connected (bus), NULL);

    IBusBusPrivate *priv;
    priv = IBUS_BUS_GET_PRIVATE (bus);

    if (priv->config == NULL && priv->connection) {
        priv->config = ibus_config_new (priv->connection);
        if (priv->config) {
            g_signal_connect (priv->config, "destroy", G_CALLBACK (_config_destroy_cb), bus);
        }
    }

    return priv->config;
}
Exemplo n.º 20
0
gboolean
ibus_bus_register_component (IBusBus       *bus,
                             IBusComponent *component)
{
    g_assert (IBUS_IS_BUS (bus));
    g_assert (IBUS_IS_COMPONENT (component));

    gboolean result;

    result = ibus_bus_call (bus,
                            IBUS_SERVICE_IBUS,
                            IBUS_PATH_IBUS,
                            IBUS_INTERFACE_IBUS,
                            "RegisterComponent",
                            IBUS_TYPE_COMPONENT, &component,
                            G_TYPE_INVALID);

    return result;
}
Exemplo n.º 21
0
gboolean
ibus_bus_exit (IBusBus *bus,
               gboolean restart)
{
    g_assert (IBUS_IS_BUS (bus));

    IBusBusPrivate *priv;
    priv = IBUS_BUS_GET_PRIVATE (bus);

    gboolean result;
    result = ibus_bus_call (bus,
                            IBUS_SERVICE_IBUS,
                            IBUS_PATH_IBUS,
                            IBUS_INTERFACE_IBUS,
                            "Exit",
                            G_TYPE_BOOLEAN, &restart,
                            G_TYPE_INVALID);
    return result;
}
Exemplo n.º 22
0
Arquivo: ibusbus.c Projeto: BBIO/ibus
const gchar *
ibus_bus_hello (IBusBus *bus)
{
    g_assert (IBUS_IS_BUS (bus));

    gchar *unique_name = NULL;
    gboolean result;

    result = ibus_bus_call (bus,
                            DBUS_SERVICE_DBUS,
                            DBUS_PATH_DBUS,
                            DBUS_INTERFACE_DBUS,
                            "Hello",
                            G_TYPE_INVALID,
                            G_TYPE_STRING, &unique_name,
                            G_TYPE_INVALID);

    if (result)
        return unique_name;

    return NULL;
}
Exemplo n.º 23
0
Arquivo: ibusbus.c Projeto: BBIO/ibus
const gchar *
ibus_bus_current_input_context(IBusBus      *bus)
{
    g_assert (IBUS_IS_BUS (bus));

    gchar *name = NULL;
    gboolean result;

    result = ibus_bus_call (bus,
                            DBUS_SERVICE_DBUS,
                            DBUS_PATH_DBUS,
                            DBUS_INTERFACE_DBUS,
                            "CurrentInputContext",
                            G_TYPE_INVALID,
                            G_TYPE_STRING, &name,
                            G_TYPE_INVALID);

    if (result)
        return name;

    return NULL;
}
Exemplo n.º 24
0
Arquivo: ibusbus.c Projeto: BBIO/ibus
void
ibus_bus_set_watch_dbus_signal (IBusBus        *bus,
                                gboolean        watch)
{
    g_assert (IBUS_IS_BUS (bus));

    IBusBusPrivate *priv;
    priv = IBUS_BUS_GET_PRIVATE (bus);

    if (priv->watch_dbus_signal == watch)
        return;

    priv->watch_dbus_signal = watch;

    if (ibus_bus_is_connected (bus)) {
        if (watch) {
            ibus_bus_watch_dbus_signal (bus);
        }
        else {
            ibus_bus_unwatch_dbus_signal (bus);
        }
    }
}
Exemplo n.º 25
0
gboolean
ibus_bus_name_has_owner (IBusBus        *bus,
                         const gchar    *name)
{
    g_assert (IBUS_IS_BUS (bus));

    gboolean retval;
    gboolean result;

    result = ibus_bus_call (bus,
                            DBUS_SERVICE_DBUS,
                            DBUS_PATH_DBUS,
                            DBUS_INTERFACE_DBUS,
                            "NameHasOwner",
                            G_TYPE_STRING, &name,
                            G_TYPE_INVALID,
                            G_TYPE_BOOLEAN, &retval,
                            G_TYPE_INVALID);

    if (result)
        return retval;

    return FALSE;
}
Exemplo n.º 26
0
Arquivo: ibusbus.c Projeto: BBIO/ibus
const gchar *
ibus_bus_get_name_owner (IBusBus        *bus,
                         const gchar    *name)
{
    g_assert (IBUS_IS_BUS (bus));

    gchar *owner = NULL;
    gboolean result;

    result = ibus_bus_call (bus,
                            DBUS_SERVICE_DBUS,
                            DBUS_PATH_DBUS,
                            DBUS_INTERFACE_DBUS,
                            "GetNameOwner",
                            G_TYPE_STRING, &name,
                            G_TYPE_INVALID,
                            G_TYPE_STRING, &owner,
                            G_TYPE_INVALID);

    if (result)
        return owner;

    return NULL;
}
Exemplo n.º 27
0
const gchar *
ibus_bus_hello (IBusBus *bus)
{
    g_assert (IBUS_IS_BUS (bus));

    gchar *unique_name = NULL;
    IBusMessage *reply = NULL;
    IBusError *error = NULL;
    IBusBusPrivate *priv;

    priv = IBUS_BUS_GET_PRIVATE (bus);

    g_free (priv->unique_name);
    priv->unique_name = NULL;

    reply = ibus_bus_call_with_reply (bus,
                                      DBUS_SERVICE_DBUS,
                                      DBUS_PATH_DBUS,
                                      DBUS_INTERFACE_DBUS,
                                      "Hello",
                                      G_TYPE_INVALID);

    if (reply) {
        if (ibus_message_get_args (reply, &error, G_TYPE_STRING, &unique_name,
                                   G_TYPE_INVALID)) {
            priv->unique_name = g_strdup (unique_name);
        } else {
            g_warning ("%s: %s", error->name, error->message);
            ibus_error_free (error);
        }

        ibus_message_unref (reply);
    }

    return priv->unique_name;
}
Exemplo n.º 28
0
Arquivo: ibusbus.c Projeto: BBIO/ibus
static GList *
ibus_bus_do_list_engines (IBusBus *bus, gboolean active_engines_only)
{
    g_assert (IBUS_IS_BUS (bus));

    IBusMessage *message, *reply;
    IBusError *error;
    gboolean retval;
    IBusBusPrivate *priv;
    IBusMessageIter iter, subiter;
    GList *engines;
    const gchar* member = active_engines_only ? "ListActiveEngines" : "ListEngines";

    priv = IBUS_BUS_GET_PRIVATE (bus);
    message = ibus_message_new_method_call (IBUS_SERVICE_IBUS,
                                            IBUS_PATH_IBUS,
                                            IBUS_INTERFACE_IBUS,
                                            member);
    reply = ibus_connection_send_with_reply_and_block (priv->connection,
                                                       message,
                                                       -1,
                                                       &error);
    ibus_message_unref (message);

    if (reply == NULL) {
        g_warning ("%s : %s", error->name, error->message);
        ibus_error_free (error);
        return NULL;
    }

    if ((error = ibus_error_new_from_message (reply)) != NULL) {
        g_warning ("%s : %s", error->name, error->message);
        ibus_error_free (error);
        ibus_message_unref (reply);
        return NULL;
    }

    retval = ibus_message_iter_init (reply, &iter);
    if (!retval) {
        error = ibus_error_new_from_printf (DBUS_ERROR_INVALID_ARGS,
                                            "Message does not have arguments!");
        g_warning ("%s : %s", error->name, error->message);
        ibus_error_free (error);
        ibus_message_unref (reply);
        return NULL;
    }

    if (!ibus_message_iter_recurse (&iter, IBUS_TYPE_ARRAY, &subiter)) {
        ibus_message_unref (reply);
        return NULL;
    }

    engines = NULL;
    while (ibus_message_iter_get_arg_type (&subiter) != G_TYPE_INVALID) {
        IBusSerializable *object = NULL;
        if (!ibus_message_iter_get (&subiter, IBUS_TYPE_ENGINE_DESC, &object) || !object) {
            g_warning ("Unexpected type is returned from %s", member);
            continue;
        }
        engines = g_list_append (engines, object);
        ibus_message_iter_next (&subiter);
    };

    ibus_message_unref (reply);
    return engines;
}
Exemplo n.º 29
0
Arquivo: ibusbus.c Projeto: BBIO/ibus
static gboolean
ibus_bus_call (IBusBus      *bus,
               const gchar  *name,
               const gchar  *path,
               const gchar  *interface,
               const gchar  *member,
               GType         first_arg_type,
               ...)
{
    g_assert (IBUS_IS_BUS (bus));
    g_assert (name != NULL);
    g_assert (path != NULL);
    g_assert (interface != NULL);
    g_assert (member);

    IBusMessage *message, *reply;
    IBusError *error;
    va_list args;
    GType type;
    gboolean retval;
    IBusBusPrivate *priv;

    g_return_val_if_fail (ibus_bus_is_connected (bus), FALSE);

    priv = IBUS_BUS_GET_PRIVATE (bus);

    message = ibus_message_new_method_call (name, path, interface, member);

    va_start (args, first_arg_type);
    ibus_message_append_args_valist (message, first_arg_type, args);
    va_end (args);

    reply = ibus_connection_send_with_reply_and_block (
                                        priv->connection,
                                        message,
                                        -1,
                                        &error);
    ibus_message_unref (message);

    if (reply == NULL) {
        g_warning ("%s : %s", error->name, error->message);
        ibus_error_free (error);
        return FALSE;
    }

    if ((error = ibus_error_new_from_message (reply)) != NULL) {
        g_warning ("%s : %s", error->name, error->message);
        ibus_error_free (error);
        ibus_message_unref (reply);
        return FALSE;
    }

    va_start (args, first_arg_type);

    type = first_arg_type;

    while (type != G_TYPE_INVALID) {
        va_arg (args, gpointer);
        type = va_arg (args, GType);
    }

    type = va_arg (args, GType);
    if (type != G_TYPE_INVALID) {
        retval = ibus_message_get_args_valist (reply, &error, type, args);
    }
    else {
        retval = TRUE;
    }
    va_end (args);

    ibus_message_unref (reply);

    if (!retval) {
        g_warning ("%s: %s", error->name, error->message);
        ibus_error_free (error);
        return FALSE;
    }

    return TRUE;
}