Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dorota Czaplejewicz
squeekboard
Commits
ef3ea618
Commit
ef3ea618
authored
Sep 12, 2011
by
Daiki Ueno
Browse files
Change the type of gsettings key "keyboard" from s to as.
Also rename it to "keyboards".
parent
362b210a
Changes
5
Hide whitespace changes
Inline
Side-by-side
data/org.fedorahosted.eekboard.gschema.xml.in
View file @
ef3ea618
<?xml version="1.0"?>
<schemalist>
<schema
id=
"org.fedorahosted.eekboard"
path=
"/org/fedorahosted/eekboard/"
>
<key
name=
"keyboard"
type=
"s"
>
<default>
'us'
</default>
<key
name=
"keyboard
s
"
type=
"
a
s"
>
<default>
[
'us'
]
</default>
<summary>
Keyboard types
</summary>
<description>
keyboard types
(comma separated)
.
</description>
<description>
keyboard types.
</description>
</key>
<key
name=
"ui-toolkit"
type=
"s"
>
<default>
'gtk'
</default>
...
...
src/client-main.c
View file @
ef3ea618
...
...
@@ -103,17 +103,19 @@ enum FocusListenerType {
};
static
gboolean
set_keyboard
(
Client
*
client
,
const
gchar
*
keyboard
)
set_keyboard
s
(
Client
*
client
,
gchar
*
*
keyboard
s
)
{
if
(
g_str
cmp0
(
keyboard
,
"system"
)
==
0
)
{
if
(
g_str
v_length
(
keyboard
s
)
==
0
)
{
if
(
!
client_enable_xkl
(
client
))
{
g_printerr
(
"Can't register xklavier event listeners
\n
"
);
return
FALSE
;
}
}
else
{
if
(
!
client_set_keyboard
(
client
,
keyboard
))
{
g_printerr
(
"Can't set keyboard
\"
%s
\"\n
"
,
keyboard
);
if
(
!
client_set_keyboards
(
client
,
keyboards
))
{
gchar
*
str
=
g_strjoinv
(
", "
,
keyboards
);
g_printerr
(
"Can't set keyboards
\"
%s
\"\n
"
,
str
);
g_free
(
str
);
return
FALSE
;
}
}
...
...
@@ -133,7 +135,7 @@ main (int argc, char **argv)
GMainLoop
*
loop
=
NULL
;
gint
focus
;
GSettings
*
settings
=
NULL
;
gchar
*
keyboard
;
gchar
*
*
keyboard
s
;
gint
retval
=
0
;
if
(
!
gtk_init_check
(
&
argc
,
&
argv
))
{
...
...
@@ -312,13 +314,13 @@ main (int argc, char **argv)
G_CALLBACK
(
on_destroyed
),
loop
);
g_object_unref
(
eekboard
);
keyboard
=
g_settings_get_str
ing
(
settings
,
"keyboard"
);
if
(
!
set_keyboard
(
client
,
keyboard
))
{
g_free
(
keyboard
);
keyboard
s
=
g_settings_get_str
v
(
settings
,
"keyboard
s
"
);
if
(
!
set_keyboard
s
(
client
,
keyboard
s
))
{
g_
str
free
v
(
keyboard
s
);
retval
=
1
;
goto
out
;
}
g_free
(
keyboard
);
g_
str
free
v
(
keyboard
s
);
g_main_loop_run
(
loop
);
...
...
src/client.c
View file @
ef3ea618
...
...
@@ -127,12 +127,13 @@ static void focus_listener_cb (const AtspiEvent *event,
static
gboolean
keystroke_listener_cb
(
const
AtspiDeviceEvent
*
stroke
,
void
*
user_data
);
#endif
/* HAVE_ATSPI */
static
gboolean
set_keyboard
(
Client
*
client
,
const
gchar
*
keyboard
);
static
gboolean
set_keyboard_from_xkl
(
Client
*
client
);
static
gboolean
set_keyboards
(
Client
*
client
,
const
gchar
**
keyboard
);
static
gboolean
set_keyboards_from_xkl
(
Client
*
client
);
#ifdef HAVE_XTEST
static
void
update_modifier_keycodes
(
Client
*
client
);
(
Client
*
client
);
#endif
/* HAVE_XTEST */
static
void
...
...
@@ -297,11 +298,11 @@ client_init (Client *client)
}
gboolean
client_set_keyboard
(
Client
*
client
,
const
gchar
*
keyboard
)
client_set_keyboard
s
(
Client
*
client
,
const
gchar
*
*
keyboard
s
)
{
gboolean
retval
;
retval
=
set_keyboard
(
client
,
keyboard
);
retval
=
set_keyboard
s
(
client
,
keyboard
s
);
if
(
retval
&&
IS_KEYBOARD_VISIBLE
(
client
))
eekboard_context_show_keyboard
(
client
->
context
,
NULL
);
return
retval
;
...
...
@@ -343,7 +344,7 @@ client_enable_xkl (Client *client)
xkl_engine_start_listen
(
client
->
xkl_engine
,
XKLL_TRACK_KEYBOARD_STATE
);
retval
=
set_keyboard_from_xkl
(
client
);
retval
=
set_keyboard
s
_from_xkl
(
client
);
if
(
IS_KEYBOARD_VISIBLE
(
client
))
eekboard_context_show_keyboard
(
client
->
context
,
NULL
);
...
...
@@ -697,7 +698,7 @@ on_xkl_config_changed (XklEngine *xklengine,
Client
*
client
=
user_data
;
gboolean
retval
;
retval
=
set_keyboard_from_xkl
(
client
);
retval
=
set_keyboard
s
_from_xkl
(
client
);
g_return_if_fail
(
retval
);
#ifdef HAVE_XTEST
...
...
@@ -706,46 +707,39 @@ on_xkl_config_changed (XklEngine *xklengine,
}
static
gboolean
set_keyboard
(
Client
*
client
,
const
gchar
*
keyboard
)
set_keyboard
s
(
Client
*
client
,
const
gchar
*
*
keyboard
s
)
{
GSList
*
keyboards
=
NULL
;
gchar
**
strv
,
**
p
;
g_return_val_if_fail
(
keyboard
!=
NULL
,
FALSE
);
g_return_val_if_fail
(
*
keyboard
!=
'\0'
,
FALSE
);
guint
keyboard_id
;
gchar
**
p
;
GSList
*
head
=
NULL
;
if
(
client
->
keyboards
)
g_slist_free
(
client
->
keyboards
);
strv
=
g_strsplit
(
keyboard
,
","
,
-
1
);
for
(
p
=
strv
;
*
p
!=
NULL
;
p
++
)
{
guint
keyboard_id
;
keyboard_id
=
eekboard_context_add_keyboard
(
client
->
context
,
*
p
,
NULL
);
if
(
keyboard_id
==
0
)
for
(
p
=
keyboards
;
*
p
!=
NULL
;
p
++
)
{
keyboard_id
=
eekboard_context_add_keyboard
(
client
->
context
,
*
p
,
NULL
);
if
(
keyboard_id
==
0
)
{
g_slist_free
(
head
);
return
FALSE
;
keyboards
=
g_slist_prepend
(
keyboards
,
GUINT_TO_POINTER
(
keyboard_id
));
}
head
=
g_slist_prepend
(
head
,
GUINT_TO_POINTER
(
keyboard_id
));
}
g_strfreev
(
strv
);
/* make a cycle */
keyboards
=
g_slist_reverse
(
keyboards
);
g_slist_last
(
keyboards
)
->
next
=
keyboards
;
client
->
keyboards
=
keyboards
;
head
=
g_slist_reverse
(
head
);
g_slist_last
(
head
)
->
next
=
head
;
client
->
keyboards
=
head
;
/* select the first keyboard */
eekboard_context_set_keyboard
(
client
->
context
,
GPOINTER_TO_UINT
(
keyboards
->
data
),
GPOINTER_TO_UINT
(
head
->
data
),
NULL
);
return
TRUE
;
}
static
gboolean
set_keyboard_from_xkl
(
Client
*
client
)
set_keyboard
s
_from_xkl
(
Client
*
client
)
{
XklConfigRec
*
rec
;
gchar
*
layout
,
*
keyboard
;
...
...
src/client.h
View file @
ef3ea618
...
...
@@ -33,8 +33,8 @@ typedef struct _Client Client;
Client
*
client_new
(
GDBusConnection
*
connection
);
gboolean
client_set_keyboard
(
Client
*
client
,
const
gchar
*
keyboard
);
gboolean
client_set_keyboard
s
(
Client
*
client
,
const
gchar
*
*
keyboard
);
gboolean
client_enable_xkl
(
Client
*
client
);
void
client_disable_xkl
(
Client
*
client
);
...
...
src/preferences-dialog.c
View file @
ef3ea618
...
...
@@ -62,6 +62,35 @@ set_rate (const GValue *value,
return
g_variant_new_uint32
(
msecs
);
}
static
gboolean
get_strv
(
GValue
*
value
,
GVariant
*
variant
,
gpointer
user_data
)
{
gchar
*
strv
=
g_variant_get_strv
(
variant
,
NULL
);
gchar
*
text
=
g_strjoinv
(
", "
,
strv
);
g_free
(
strv
);
g_value_set_string
(
value
,
text
);
return
TRUE
;
}
static
GVariant
*
set_strv
(
const
GValue
*
value
,
const
GVariantType
*
expected_type
,
gpointer
user_data
)
{
gchar
*
text
=
g_value_get_string
(
value
);
gchar
**
strv
=
g_strsplit
(
text
,
","
,
-
1
),
**
p
;
GVariant
*
variant
;
for
(
p
=
strv
;
*
p
!=
NULL
;
p
++
)
g_strstrip
(
*
p
);
variant
=
g_variant_new_strv
(
strv
,
-
1
);
g_strfreev
(
strv
);
return
variant
;
}
PreferencesDialog
*
preferences_dialog_new
(
void
)
{
...
...
@@ -138,9 +167,10 @@ preferences_dialog_new (void)
gtk_builder_get_object
(
builder
,
"keyboard_entry"
);
dialog
->
keyboard_entry
=
GTK_WIDGET
(
object
);
g_settings_bind
(
dialog
->
settings
,
"keyboard"
,
GTK_ENTRY
(
dialog
->
keyboard_entry
),
"text"
,
G_SETTINGS_BIND_DEFAULT
);
g_settings_bind_with_mapping
(
dialog
->
settings
,
"keyboards"
,
GTK_ENTRY
(
dialog
->
keyboard_entry
),
"text"
,
G_SETTINGS_BIND_DEFAULT
,
get_strv
,
set_strv
,
NULL
,
NULL
);
return
dialog
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment