cleanup: Remove Context dbus interface remains
This commit is contained in:
@ -150,13 +150,6 @@ static void emit_visibility_changed_signal
|
|||||||
(EekboardContextService *context,
|
(EekboardContextService *context,
|
||||||
gboolean visible);
|
gboolean visible);
|
||||||
|
|
||||||
static const GDBusInterfaceVTable interface_vtable =
|
|
||||||
{
|
|
||||||
handle_method_call,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static Display *display = NULL;
|
static Display *display = NULL;
|
||||||
|
|
||||||
static EekKeyboard *
|
static EekKeyboard *
|
||||||
@ -816,146 +809,6 @@ connect_keyboard_signals (EekboardContextService *context)
|
|||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
handle_method_call (GDBusConnection *connection,
|
|
||||||
const gchar *sender,
|
|
||||||
const gchar *object_path,
|
|
||||||
const gchar *interface_name,
|
|
||||||
const gchar *method_name,
|
|
||||||
GVariant *parameters,
|
|
||||||
GDBusMethodInvocation *invocation,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
EekboardContextService *context = user_data;
|
|
||||||
EekboardContextServiceClass *klass = EEKBOARD_CONTEXT_SERVICE_GET_CLASS(context);
|
|
||||||
|
|
||||||
if (context->priv->repeat_timeout_id) {
|
|
||||||
g_source_remove (context->priv->repeat_timeout_id);
|
|
||||||
context->priv->repeat_timeout_id = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_strcmp0 (method_name, "RemoveKeyboard") == 0) {
|
|
||||||
guint keyboard_id, current_keyboard_id;
|
|
||||||
|
|
||||||
g_variant_get (parameters, "(u)", &keyboard_id);
|
|
||||||
|
|
||||||
if (context->priv->keyboard != NULL) {
|
|
||||||
current_keyboard_id =
|
|
||||||
GPOINTER_TO_UINT (g_object_get_data (G_OBJECT(context->priv->keyboard),
|
|
||||||
"keyboard-id"));
|
|
||||||
if (keyboard_id == current_keyboard_id) {
|
|
||||||
disconnect_keyboard_signals (context);
|
|
||||||
context->priv->keyboard = NULL;
|
|
||||||
g_object_notify (G_OBJECT(context), "keyboard");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_hash_table_remove (context->priv->keyboard_hash,
|
|
||||||
GUINT_TO_POINTER(keyboard_id));
|
|
||||||
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_strcmp0 (method_name, "SetFullscreen") == 0) {
|
|
||||||
gboolean fullscreen;
|
|
||||||
|
|
||||||
g_variant_get (parameters, "(b)", &fullscreen);
|
|
||||||
|
|
||||||
if (context->priv->fullscreen == fullscreen) {
|
|
||||||
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
context->priv->fullscreen = fullscreen;
|
|
||||||
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
||||||
|
|
||||||
g_object_notify (G_OBJECT(context), "fullscreen");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_strcmp0 (method_name, "SetGroup") == 0) {
|
|
||||||
gint group;
|
|
||||||
|
|
||||||
if (!context->priv->keyboard) {
|
|
||||||
g_dbus_method_invocation_return_error (invocation,
|
|
||||||
G_IO_ERROR,
|
|
||||||
G_IO_ERROR_FAILED_HANDLED,
|
|
||||||
"keyboard is not set");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_variant_get (parameters, "(i)", &group);
|
|
||||||
eek_element_set_group (EEK_ELEMENT(context->priv->keyboard), group);
|
|
||||||
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
||||||
emit_group_changed_signal (context, group);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_strcmp0 (method_name, "ShowKeyboard") == 0) {
|
|
||||||
if (!context->priv->keyboard) {
|
|
||||||
g_dbus_method_invocation_return_error (invocation,
|
|
||||||
G_IO_ERROR,
|
|
||||||
G_IO_ERROR_FAILED_HANDLED,
|
|
||||||
"keyboard is not set");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
eekboard_context_service_show_keyboard (context);
|
|
||||||
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_strcmp0 (method_name, "HideKeyboard") == 0) {
|
|
||||||
eekboard_context_service_hide_keyboard (context);
|
|
||||||
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_strcmp0 (method_name, "PressKeycode") == 0 ||
|
|
||||||
g_strcmp0 (method_name, "ReleaseKeycode") == 0) {
|
|
||||||
EekKey *key;
|
|
||||||
guint keycode;
|
|
||||||
|
|
||||||
if (!context->priv->keyboard) {
|
|
||||||
g_dbus_method_invocation_return_error (invocation,
|
|
||||||
G_IO_ERROR,
|
|
||||||
G_IO_ERROR_FAILED_HANDLED,
|
|
||||||
"keyboard is not set");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_variant_get (parameters, "(u)", &keycode);
|
|
||||||
key = eek_keyboard_find_key_by_keycode (context->priv->keyboard, keycode);
|
|
||||||
|
|
||||||
if (!key) {
|
|
||||||
g_dbus_method_invocation_return_error (invocation,
|
|
||||||
G_IO_ERROR,
|
|
||||||
G_IO_ERROR_FAILED_HANDLED,
|
|
||||||
"key for %u is not found",
|
|
||||||
keycode);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_strcmp0 (method_name, "PressKeycode") == 0) {
|
|
||||||
g_signal_handler_block (context->priv->keyboard,
|
|
||||||
context->priv->key_pressed_handler);
|
|
||||||
g_signal_emit_by_name (key, "pressed");
|
|
||||||
g_signal_handler_unblock (context->priv->keyboard,
|
|
||||||
context->priv->key_pressed_handler);
|
|
||||||
} else {
|
|
||||||
g_signal_handler_block (context->priv->keyboard,
|
|
||||||
context->priv->key_released_handler);
|
|
||||||
g_signal_emit_by_name (key, "released");
|
|
||||||
g_signal_handler_unblock (context->priv->keyboard,
|
|
||||||
context->priv->key_released_handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_return_if_reached ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* eekboard_context_service_enable:
|
* eekboard_context_service_enable:
|
||||||
* @context: an #EekboardContextService
|
* @context: an #EekboardContextService
|
||||||
|
|||||||
Reference in New Issue
Block a user