Commit 8f71b010 authored by Dorota Czaplejewicz's avatar Dorota Czaplejewicz

settings: Removed custom settings schema

parent b817c618
Pipeline #5185 passed with stage
in 1 minute and 20 seconds
<?xml version="1.0"?>
<schemalist>
<schema id="org.fedorahosted.eekboard" path="/org/fedorahosted/eekboard/">
<key name="keyboards" type="as">
<default>['us']</default>
<summary>Keyboard types</summary>
<description>keyboard types.</description>
</key>
<key name="focus-listener" type="s">
<default>'atspi'</default>
<summary>Use the given focus listener</summary>
<description>The name of the focus listener (either 'atspi' or 'ibus') used to detect focus events.</description>
</key>
<key name="auto-hide" type="b">
<default>true</default>
<summary>Hide keyboard automatically when focus is out</summary>
<description>If true, hide keyboard automatically when focus is out.</description>
</key>
<key name="auto-hide-delay" type="u">
<default>500</default>
<summary>Delay before hiding keyboard</summary>
<description>Delay before hiding keyboard in milliseconds. This is useful when focus listener is enabled.</description>
</key>
<key type="b" name="repeat">
<default>true</default>
<summary>Key repeat</summary>
<description>Generate key-press/release event repeatedly while a key is held down</description>
</key>
<key type="u" name="repeat-interval">
<default>100</default>
<summary>Key repeat interval</summary>
<description>Delay between repeats in milliseconds.</description>
</key>
<key type="u" name="repeat-delay">
<default>1000</default>
<summary>Initial key repeat delay</summary>
<description>Initial key repeat delay in milliseconds.</description>
</key>
<key name="start-fullscreen" type="b">
<default>false</default>
<summary>Switch to fullscreen mode when startup</summary>
<description>If true, switch to fullscreen mode when startup.</description>
</key>
<key name="size-constraint-landscape" type="(dd)">
<default>(1.0, 0.3)</default>
<summary>Constraint of the maximum window size on landscape screen</summary>
<description>Constraint of maximum window size on landscape screen</description>
</key>
<key name="size-constraint-portrait" type="(dd)">
<default>(1.0, 0.5)</default>
<summary>Constraint of the maximum window size on portrait screen</summary>
<description>Constraint of maximum window size on portrait screen</description>
</key>
<key name="theme" type="s">
<default>'default'</default>
<summary>Theme</summary>
<description>Base name of the theme to apply.</description>
</key>
</schema>
</schemalist>
......@@ -355,16 +355,50 @@ static void
emit_group_changed_signal (EekboardContextService *context,
gint group);
static void
settings_get_layout(GSettings *settings, char **type, char **layout)
{
GVariant *inputs = g_settings_get_value(settings, "sources");
guint32 index;
g_settings_get(settings, "current", "u", &index);
GVariantIter *iter;
g_variant_get(inputs, "a(ss)", &iter);
for (unsigned i = 0;
g_variant_iter_loop(iter, "(ss)", type, layout);
i++) {
if (i == index) {
//printf("Found layout %s %s\n", *type, *layout);
break;
}
}
g_variant_iter_free(iter);
}
static void
eekboard_context_service_constructed (GObject *object)
{
EekboardContextService *context = EEKBOARD_CONTEXT_SERVICE (object);
EekboardContextServiceClass *klass = EEKBOARD_CONTEXT_SERVICE_GET_CLASS(context);
static guint keyboard_id = 0;
const gchar *keyboard_type = "us"; // TODO: fetch from gsettings
g_autofree gchar *keyboard_type = NULL;
g_autofree gchar *keyboard_layout = NULL;
settings_get_layout(context->priv->settings, &keyboard_type, &keyboard_layout);
if (!keyboard_type) {
keyboard_type = g_strdup("us");
}
if (!keyboard_layout) {
keyboard_layout = g_strdup("undefined");
}
EekKeyboard *keyboard;
// create a keyboard
keyboard = klass->create_keyboard (context, keyboard_type);
keyboard = klass->create_keyboard (context, keyboard_layout);
eek_keyboard_set_modifier_behavior (keyboard,
EEK_MODIFIER_BEHAVIOR_LATCH);
......@@ -564,7 +598,7 @@ eekboard_context_service_init (EekboardContextService *self)
NULL,
(GDestroyNotify)g_object_unref);
self->priv->settings = g_settings_new ("org.fedorahosted.eekboard");
self->priv->settings = g_settings_new ("org.gnome.desktop.input-sources");
}
static void
......@@ -668,9 +702,11 @@ static gboolean on_repeat_timeout (EekboardContextService *context);
static gboolean
on_repeat_timeout (EekboardContextService *context)
{
guint delay;
guint delay = 500; // ms
g_settings_get (context->priv->settings, "repeat-interval", "u", &delay);
// hardcoding; needs to connect to yet another settings path because
// org.gnome.desktop.input-sources doesn't control repeating
//g_settings_get (context->priv->settings, "repeat-interval", "u", &delay);
emit_key_activated_dbus_signal (context, context->priv->repeat_key);
......@@ -692,6 +728,10 @@ on_repeat_timeout_init (EekboardContextService *context)
eek_keyboard_set_modifiers (context->priv->keyboard, 0);
/* reschedule repeat timeout only when "repeat" option is set */
/* TODO: org.gnome.desktop.input-sources doesn't have repeat info.
* In addition, repeat is only useful when the keyboard is not in text
* input mode */
/*
if (g_settings_get_boolean (context->priv->settings, "repeat")) {
guint delay;
......@@ -700,7 +740,7 @@ on_repeat_timeout_init (EekboardContextService *context)
g_timeout_add (delay,
(GSourceFunc)on_repeat_timeout,
context);
} else
} else */
context->priv->repeat_timeout_id = 0;
return FALSE;
......@@ -712,9 +752,10 @@ on_key_pressed (EekKeyboard *keyboard,
gpointer user_data)
{
EekboardContextService *context = user_data;
guint delay;
guint delay = 500;
g_settings_get (context->priv->settings, "repeat-delay", "u", &delay);
// org.gnome.desktop.input-sources doesn't have delay info
//g_settings_get (context->priv->settings, "repeat-delay", "u", &delay);
if (context->priv->repeat_timeout_id) {
g_source_remove (context->priv->repeat_timeout_id);
......@@ -919,8 +960,6 @@ handle_method_call (GDBusConnection *connection,
void
eekboard_context_service_enable (EekboardContextService *context)
{
GError *error;
g_return_if_fail (EEKBOARD_IS_CONTEXT_SERVICE(context));
g_return_if_fail (context->priv->connection);
......
......@@ -48,7 +48,6 @@ struct _ServerContextService {
gulong notify_visible_handler;
GSettings *settings;
gdouble size_constraint_landscape[2];
gdouble size_constraint_portrait[2];
};
......@@ -277,7 +276,7 @@ update_widget (ServerContextService *context)
EekKeyboard *keyboard;
const gchar *client_name;
EekBounds bounds;
gchar *theme_name, *theme_filename, *theme_path;
gchar *theme_path;
EekTheme *theme;
if (context->widget) {
......@@ -285,12 +284,7 @@ update_widget (ServerContextService *context)
context->widget = NULL;
}
theme_name = g_settings_get_string (context->settings, "theme");
theme_filename = g_strdup_printf ("%s.css", theme_name);
g_free (theme_name);
theme_path = g_build_filename (THEMESDIR, theme_filename, NULL);
g_free (theme_filename);
theme_path = g_build_filename (THEMESDIR, "default.css", NULL);
theme = eek_theme_new (theme_path, NULL, NULL);
g_free (theme_path);
......@@ -472,22 +466,6 @@ server_context_service_init (ServerContextService *context)
"notify::fullscreen",
G_CALLBACK(on_notify_fullscreen),
context);
context->settings = g_settings_new ("org.fedorahosted.eekboard");
g_settings_bind_with_mapping (context->settings, "size-constraint-landscape",
context, "size-constraint-landscape",
G_SETTINGS_BIND_GET,
(GSettingsBindGetMapping)g_value_set_variant,
NULL,
NULL,
NULL);
g_settings_bind_with_mapping (context->settings, "size-constraint-portrait",
context, "size-constraint-portrait",
G_SETTINGS_BIND_GET,
(GSettingsBindGetMapping)g_value_set_variant,
NULL,
NULL,
NULL);
}
ServerContextService *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment