Пример #1
0
IBusEngineDesc *
ibus_input_context_get_engine (IBusInputContext *context)
{
    g_assert (IBUS_IS_INPUT_CONTEXT (context));
    IBusMessage *reply_message;
    IBusError *error = NULL;
    IBusSerializable *object = NULL;

    reply_message = ibus_proxy_call_with_reply_and_block ((IBusProxy *) context,
                                                          "GetEngine",
                                                          -1,
                                                          &error,
                                                          G_TYPE_INVALID);
    if (!reply_message) {
        g_debug ("%s: %s", error->name, error->message);
        ibus_error_free (error);
        return NULL;
    }

    if (!ibus_message_get_args (reply_message,
                                &error,
                                IBUS_TYPE_ENGINE_DESC, &object,
                                G_TYPE_INVALID)) {
        g_debug ("%s: %s", error->name, error->message);
        ibus_error_free (error);
        ibus_message_unref (reply_message);
        return NULL;
    }
    ibus_message_unref (reply_message);

    return IBUS_ENGINE_DESC (object);
}
Пример #2
0
gboolean
ibus_input_context_is_enabled (IBusInputContext *context)
{
    g_assert (IBUS_IS_INPUT_CONTEXT (context));
    gboolean retval = FALSE;

    IBusMessage *reply_message;
    IBusError *error = NULL;

    reply_message = ibus_proxy_call_with_reply_and_block ((IBusProxy *) context,
                                                          "IsEnabled",
                                                          -1,
                                                          &error,
                                                          G_TYPE_INVALID);
    if (!reply_message) {
        g_debug ("%s: %s", error->name, error->message);
        ibus_error_free (error);
        return FALSE;
    }

    if (!ibus_message_get_args (reply_message,
                                &error,
                                G_TYPE_BOOLEAN, &retval,
                                G_TYPE_INVALID)) {
        g_debug ("%s: %s", error->name, error->message);
        ibus_error_free (error);
        retval = FALSE;
    }
    ibus_message_unref (reply_message);

    return retval;
}
Пример #3
0
gboolean
ibus_config_get_value (IBusConfig  *config,
                       const gchar *section,
                       const gchar *name,
                       GValue      *value)
{
    g_assert (IBUS_IS_CONFIG (config));
    g_assert (section != NULL);
    g_assert (name != NULL);
    g_assert (value != NULL);

    IBusMessage *reply;
    IBusError *error;
    gboolean retval;

    reply = ibus_proxy_call_with_reply_and_block ((IBusProxy *) config,
                                                  "GetValue",
                                                  -1,
                                                  &error,
                                                  G_TYPE_STRING, &section,
                                                  G_TYPE_STRING, &name,
                                                  G_TYPE_INVALID);
    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;
    }

    retval = ibus_message_get_args (reply,
                                    &error,
                                    G_TYPE_VALUE, value,
                                    G_TYPE_INVALID);
    ibus_message_unref (reply);
    if (!retval) {
        g_warning ("%s: %s", error->name, error->message);
        return FALSE;
    }

    return TRUE;
}