From f5519ff8f096e470780e70bfe6fcd5d24ecc2d0c Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Thu, 7 Jan 2010 14:39:18 +0800 Subject: [PATCH] Add ibus_input_context_property_activate by Yusuke --- bus/inputcontext.c | 42 ++++++++++++++++++++++++++++++++++++++++++ src/ibusinputcontext.h | 15 +++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/bus/inputcontext.c b/bus/inputcontext.c index ee47da2..393c094 100644 --- a/bus/inputcontext.c +++ b/bus/inputcontext.c @@ -593,6 +593,10 @@ _ibus_introspect (BusInputContext *context, " \n" " \n" " \n" + " \n" + " \n" + " \n" + " \n" " \n" " \n" " \n" @@ -898,6 +902,43 @@ _ic_set_capabilities (BusInputContext *context, } static IBusMessage * +_ic_property_activate (BusInputContext *context, + IBusMessage *message, + BusConnection *connection) +{ + g_assert (BUS_IS_INPUT_CONTEXT (context)); + g_assert (message != NULL); + g_assert (BUS_IS_CONNECTION (connection)); + + IBusMessage *reply; + gchar *prop_name; + gint prop_state; + gboolean retval; + IBusError *error; + + retval = ibus_message_get_args (message, + &error, + G_TYPE_STRING, &prop_name, + G_TYPE_INT, &prop_state, + G_TYPE_INVALID); + + if (!retval) { + reply = ibus_message_new_error (message, + error->name, + error->message); + ibus_error_free (error); + return reply; + } + + if (context->engine) { + bus_engine_proxy_property_activate (context->engine, prop_name, prop_state); + } + + reply = ibus_message_new_method_return (message); + return reply; +} + +static IBusMessage * _ic_enable (BusInputContext *context, IBusMessage *message, BusConnection *connection) @@ -1069,6 +1110,7 @@ bus_input_context_ibus_message (BusInputContext *context, { IBUS_INTERFACE_INPUT_CONTEXT, "FocusOut", _ic_focus_out }, { IBUS_INTERFACE_INPUT_CONTEXT, "Reset", _ic_reset }, { IBUS_INTERFACE_INPUT_CONTEXT, "SetCapabilities", _ic_set_capabilities }, + { IBUS_INTERFACE_INPUT_CONTEXT, "PropertyActivate", _ic_property_activate }, { IBUS_INTERFACE_INPUT_CONTEXT, "Enable", _ic_enable }, { IBUS_INTERFACE_INPUT_CONTEXT, "Disable", _ic_disable }, { IBUS_INTERFACE_INPUT_CONTEXT, "IsEnabled", _ic_is_enabled }, diff --git a/src/ibusinputcontext.h b/src/ibusinputcontext.h index 5d7094d..9adda95 100644 --- a/src/ibusinputcontext.h +++ b/src/ibusinputcontext.h @@ -171,6 +171,21 @@ void ibus_input_context_set_capabilities guint32 capabilities); /** + * ibus_input_context_property_activate + * @context: An IBusInputContext. + * @prop_name: A property name (e.g. "InputMode.WideLatin") + * @state: A status of the property (e.g. PROP_STATE_CHECKED) + * + * Activate the property. + * + * @see_also: #IBusEngine::property_activate + */ +void ibus_input_context_property_activate + (IBusInputContext *context, + const gchar *prop_name, + gint32 state); + +/** * ibus_input_context_focus_in: * @context: An IBusInputContext. * -- 2.7.4