- if (g_strcmp0 (name, "CandidateClicked") == 0) {
- guint index, button, state;
-
- retval = ibus_message_get_args (message,
- &error,
- G_TYPE_UINT, &index,
- G_TYPE_UINT, &button,
- G_TYPE_UINT, &state,
- G_TYPE_INVALID);
-
- if (!retval) {
- reply = ibus_message_new_error_printf (message,
- DBUS_ERROR_INVALID_ARGS,
- "%s.%s: Can not match signature (uuu) of method",
- IBUS_INTERFACE_ENGINE, "CandidateClicked");
- ibus_error_free (error);
- }
- else {
- g_signal_emit (engine,
- engine_signals[CANDIDATE_CLICKED],
- 0,
- index,
- button,
- state);
- reply = ibus_message_new_method_return (message);
- }
- }
- else if (g_strcmp0 (name, "PropertyActivate") == 0) {
- gchar *name;
- guint state;
-
- retval = ibus_message_get_args (message,
- &error,
- G_TYPE_STRING, &name,
- G_TYPE_UINT, &state,
- G_TYPE_INVALID);
-
- if (!retval) {
- reply = ibus_message_new_error_printf (message,
- DBUS_ERROR_INVALID_ARGS,
- "%s.%s: Can not match signature (si) of method",
- IBUS_INTERFACE_ENGINE,
- "PropertyActivate");
- ibus_error_free (error);
- }
- else {
- g_signal_emit (engine,
- engine_signals[PROPERTY_ACTIVATE],
- 0,
- name,
- state);
-
- reply = ibus_message_new_method_return (message);
- }
- }
- else if (g_strcmp0 (name, "PropertyShow") == 0) {
- gchar *name;
-
- retval = ibus_message_get_args (message,
- &error,
- G_TYPE_STRING, &name,
- G_TYPE_INVALID);
-
- if (!retval) {
- reply = ibus_message_new_error_printf (message,
- DBUS_ERROR_INVALID_ARGS,
- "%s.%s: Can not match signature (s) of method",
- IBUS_INTERFACE_ENGINE,
- "PropertyShow");
- ibus_error_free (error);
- }
- else {
- g_signal_emit (engine,
- engine_signals[PROPERTY_SHOW],
- 0,
- name);
-
- reply = ibus_message_new_method_return (message);
- }
- }
- else if (g_strcmp0 (name, "PropertyHide") == 0) {
- gchar *name;
-
- retval = ibus_message_get_args (message,
- &error,
- G_TYPE_STRING, &name,
- G_TYPE_INVALID);
- if (!retval) {
- reply = ibus_message_new_error_printf (message,
- DBUS_ERROR_INVALID_ARGS,
- "%s.%s: Can not match signature (s) of method",
- IBUS_INTERFACE_ENGINE, "PropertyHide");
- ibus_error_free (error);
- }
- else {
- g_signal_emit (engine, engine_signals[PROPERTY_HIDE], 0, name);
- reply = ibus_message_new_method_return (message);
- }
- }
- else if (g_strcmp0 (name, "SetCursorLocation") == 0) {
- gint x, y, w, h;
-
- retval = ibus_message_get_args (message,
- &error,
- G_TYPE_INT, &x,
- G_TYPE_INT, &y,
- G_TYPE_INT, &w,
- G_TYPE_INT, &h,
- G_TYPE_INVALID);
- if (!retval) {
- reply = ibus_message_new_error_printf (message,
- DBUS_ERROR_INVALID_ARGS,
- "%s.%s: Can not match signature (iiii) of method",
- IBUS_INTERFACE_ENGINE,
- "SetCursorLocation");
- ibus_error_free (error);
- }
- else {
- engine->cursor_area.x = x;
- engine->cursor_area.y = y;
- engine->cursor_area.width = w;
- engine->cursor_area.height = h;
-
- g_signal_emit (engine,
- engine_signals[SET_CURSOR_LOCATION],
- 0,
- x, y, w, h);
-
- reply = ibus_message_new_method_return (message);
- }
- }
- else if (g_strcmp0 (name, "SetCapabilities") == 0) {
- guint caps;
-
- retval = ibus_message_get_args (message,
- &error,
- G_TYPE_UINT, &caps,
- G_TYPE_INVALID);
-
- if (!retval) {
- reply = ibus_message_new_error_printf (message,
- DBUS_ERROR_INVALID_ARGS,
- "%s.%s: Can not match signature (u) of method",
- IBUS_INTERFACE_ENGINE, "SetCapabilities");
- ibus_error_free (error);
- }
- else {
- engine->client_capabilities = caps;
- g_signal_emit (engine, engine_signals[SET_CAPABILITIES], 0, caps);
- reply = ibus_message_new_method_return (message);
- }
- }
- else if (g_strcmp0 (name, "Destroy") == 0) {
- reply = ibus_message_new_method_return (message);
- ibus_connection_send (connection, reply);
- ibus_message_unref (reply);
- ibus_object_destroy ((IBusObject *) engine);
- return TRUE;
- }
- else {
- reply = ibus_message_new_error_printf (message,
- DBUS_ERROR_UNKNOWN_METHOD,
- "%s.%s",
- IBUS_INTERFACE_ENGINE, name);
- g_warn_if_reached ();
+ if (g_strcmp0 (method_name, "PropertyActivate") == 0) {
+ gchar *name;
+ guint state;
+ g_variant_get (parameters, "(&su)", &name, &state);
+ g_signal_emit (engine,
+ engine_signals[PROPERTY_ACTIVATE],
+ 0,
+ name,
+ state);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ return;
+ }
+
+ if (g_strcmp0 (method_name, "PropertyShow") == 0) {
+ gchar *name;
+ g_variant_get (parameters, "(&s)", &name);
+ g_signal_emit (engine,
+ engine_signals[PROPERTY_SHOW],
+ 0,
+ name);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ return;
+ }
+
+ if (g_strcmp0 (method_name, "PropertyHide") == 0) {
+ gchar *name;
+ g_variant_get (parameters, "(&s)", &name);
+ g_signal_emit (engine,
+ engine_signals[PROPERTY_HIDE],
+ 0,
+ name);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ return;
+ }
+
+ if (g_strcmp0 (method_name, "SetCursorLocation") == 0) {
+ gint x, y, w, h;
+ g_variant_get (parameters, "(iiii)", &x, &y, &w, &h);
+ engine->cursor_area.x = x;
+ engine->cursor_area.y = y;
+ engine->cursor_area.width = w;
+ engine->cursor_area.height = h;
+
+ g_signal_emit (engine,
+ engine_signals[SET_CURSOR_LOCATION],
+ 0,
+ x, y, w, h);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ return;
+ }
+
+ if (g_strcmp0 (method_name, "SetCapabilities") == 0) {
+ guint caps;
+ g_variant_get (parameters, "(u)", &caps);
+ engine->client_capabilities = caps;
+ g_signal_emit (engine, engine_signals[SET_CAPABILITIES], 0, caps);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ return;
+ }
+
+ if (g_strcmp0 (method_name, "SetSurroundingText") == 0) {
+ GVariant *variant = NULL;
+ IBusText *text;
+ guint cursor_pos;
+ guint anchor_pos;
+
+ g_variant_get (parameters,
+ "(vuu)",
+ &variant,
+ &cursor_pos,
+ &anchor_pos);
+ text = IBUS_TEXT (ibus_serializable_deserialize (variant));
+ g_variant_unref (variant);
+
+ g_signal_emit (engine, engine_signals[SET_SURROUNDING_TEXT],
+ 0,
+ text,
+ cursor_pos,
+ anchor_pos);
+ if (g_object_is_floating (text)) {
+ g_object_unref (text);