Read keyboard type from GSettings.
This commit is contained in:
@ -1,6 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<schemalist>
|
||||
<schema id="org.fedorahosted.eekboard" path="/org/fedorahosted/eekboard/">
|
||||
<key name="keyboard" type="s">
|
||||
<default>'us'</default>
|
||||
<summary>Keyboard types</summary>
|
||||
<description>keyboard types (comma separated).</description>
|
||||
</key>
|
||||
<key name="ui-toolkit" type="s">
|
||||
<default>'gtk'</default>
|
||||
<summary>GUI toolkit used to render keyboard</summary>
|
||||
|
||||
@ -38,12 +38,9 @@ static gboolean opt_system = FALSE;
|
||||
static gboolean opt_session = FALSE;
|
||||
static gchar *opt_address = NULL;
|
||||
|
||||
static gboolean opt_use_system_layout = FALSE;
|
||||
static gboolean opt_focus = FALSE;
|
||||
static gboolean opt_keystroke = FALSE;
|
||||
|
||||
static gchar *opt_keyboard = NULL;
|
||||
|
||||
static gboolean opt_fullscreen = FALSE;
|
||||
|
||||
static const GOptionEntry options[] = {
|
||||
@ -53,8 +50,6 @@ static const GOptionEntry options[] = {
|
||||
N_("Connect to the session bus")},
|
||||
{"address", 'a', 0, G_OPTION_ARG_STRING, &opt_address,
|
||||
N_("Connect to the given D-Bus address")},
|
||||
{"use-system-layout", 'x', 0, G_OPTION_ARG_NONE, &opt_use_system_layout,
|
||||
N_("Use system keyboard layout")},
|
||||
#if ENABLE_FOCUS_LISTENER
|
||||
{"listen-focus", 'f', 0, G_OPTION_ARG_NONE, &opt_focus,
|
||||
N_("Listen focus change events")},
|
||||
@ -63,8 +58,6 @@ static const GOptionEntry options[] = {
|
||||
{"listen-keystroke", 's', 0, G_OPTION_ARG_NONE, &opt_keystroke,
|
||||
N_("Listen keystroke events with AT-SPI")},
|
||||
#endif /* HAVE_ATSPI */
|
||||
{"keyboard", 'k', 0, G_OPTION_ARG_STRING, &opt_keyboard,
|
||||
N_("Specify keyboard")},
|
||||
{"fullscreen", 'F', 0, G_OPTION_ARG_NONE, &opt_fullscreen,
|
||||
N_("Create window in fullscreen mode")},
|
||||
{NULL}
|
||||
@ -122,6 +115,7 @@ main (int argc, char **argv)
|
||||
GMainLoop *loop;
|
||||
gint focus;
|
||||
GSettings *settings;
|
||||
gchar *keyboard;
|
||||
|
||||
if (!gtk_init_check (&argc, &argv)) {
|
||||
g_printerr ("Can't init GTK\n");
|
||||
@ -251,12 +245,6 @@ main (int argc, char **argv)
|
||||
}
|
||||
#endif /* HAVE_IBUS */
|
||||
|
||||
if (opt_use_system_layout && opt_keyboard) {
|
||||
g_printerr ("Can't use --use-system-layout option with keyboard options\n");
|
||||
g_object_unref (client);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (!eekboard_client_enable_xkl (client)) {
|
||||
g_printerr ("Can't register xklavier event listeners\n");
|
||||
g_object_unref (client);
|
||||
@ -271,7 +259,9 @@ main (int argc, char **argv)
|
||||
}
|
||||
#endif /* HAVE_XTEST */
|
||||
|
||||
eekboard_client_set_keyboard (client, opt_keyboard ? opt_keyboard : DEFAULT_KEYBOARD);
|
||||
keyboard = g_settings_get_string (settings, "keyboard");
|
||||
eekboard_client_set_keyboard (client, keyboard);
|
||||
g_free (keyboard);
|
||||
|
||||
loop = g_main_loop_new (NULL, FALSE);
|
||||
if (!opt_focus) {
|
||||
|
||||
@ -562,32 +562,17 @@ server_context_init (ServerContext *context)
|
||||
GdkScreen *screen;
|
||||
GError *error;
|
||||
|
||||
context->connection = NULL;
|
||||
error = NULL;
|
||||
context->introspection_data =
|
||||
g_dbus_node_info_new_for_xml (introspection_xml, &error);
|
||||
g_assert (context->introspection_data != NULL);
|
||||
context->registration_id = 0;
|
||||
context->object_path = NULL;
|
||||
|
||||
context->enabled = FALSE;
|
||||
context->last_keyboard_visible = FALSE;
|
||||
|
||||
context->keyboard = NULL;
|
||||
context->keyboard_hash =
|
||||
g_hash_table_new_full (g_direct_hash,
|
||||
g_direct_equal,
|
||||
NULL,
|
||||
(GDestroyNotify)g_object_unref);
|
||||
|
||||
context->widget = NULL;
|
||||
context->window = NULL;
|
||||
context->key_pressed_handler = 0;
|
||||
context->key_released_handler = 0;
|
||||
|
||||
context->repeat_key = NULL;
|
||||
context->repeat_timeout_id = 0;
|
||||
|
||||
context->ui_toolkit = UI_TOOLKIT_DEFAULT;
|
||||
|
||||
context->settings = g_settings_new ("org.fedorahosted.eekboard");
|
||||
@ -883,7 +868,7 @@ handle_method_call (GDBusConnection *connection,
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, NULL);
|
||||
|
||||
eek_element_get_group (EEK_ELEMENT(context->keyboard));
|
||||
group = eek_element_get_group (EEK_ELEMENT(context->keyboard));
|
||||
emit_group_changed_signal (context, group);
|
||||
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user