Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
Characters
Commits
395159ea
Commit
395159ea
authored
Jun 16, 2015
by
Daiki Ueno
Browse files
libgc: Fix setlocale calls in gc_*_for_locale
parent
235720c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/gc.c
View file @
395159ea
...
...
@@ -949,25 +949,29 @@ GList *
gc_get_scripts_for_locale
(
const
gchar
*
locale
)
{
gchar
*
old_locale
;
GSettings
*
settings
;
GVariant
*
value
;
GList
*
result
=
NULL
;
old_locale
=
g_strdup
(
setlocale
(
LC_MESSAGES
,
locale
));
old_locale
=
g_strdup
(
setlocale
(
LC_MESSAGES
,
NULL
));
if
(
!
old_locale
)
return
NULL
;
settings
=
g_settings_new
(
"org.gnome.Characters"
);
value
=
g_settings_get_default_value
(
settings
,
"local-scripts"
);
if
(
value
)
if
(
setlocale
(
LC_MESSAGES
,
locale
))
{
G
VariantIter
iter
;
gchar
*
script
;
G
Settings
*
settings
;
GVariant
*
value
;
g_variant_iter_init
(
&
iter
,
value
);
while
(
g_variant_iter_next
(
&
iter
,
"s"
,
&
script
))
result
=
g_list_append
(
result
,
script
);
g_variant_unref
(
value
);
settings
=
g_settings_new
(
"org.gnome.Characters"
);
value
=
g_settings_get_default_value
(
settings
,
"local-scripts"
);
if
(
value
)
{
GVariantIter
iter
;
gchar
*
script
;
g_variant_iter_init
(
&
iter
,
value
);
while
(
g_variant_iter_next
(
&
iter
,
"s"
,
&
script
))
result
=
g_list_append
(
result
,
script
);
g_variant_unref
(
value
);
}
}
setlocale
(
LC_MESSAGES
,
old_locale
);
...
...
@@ -986,24 +990,29 @@ gchar *
gc_get_character_for_locale
(
const
gchar
*
locale
)
{
gchar
*
old_locale
;
GSettings
*
settings
;
GVariant
*
value
;
gchar
*
result
=
NULL
;
old_locale
=
g_strdup
(
setlocale
(
LC_MESSAGES
,
locale
));
old_locale
=
g_strdup
(
setlocale
(
LC_MESSAGES
,
NULL
));
if
(
!
old_locale
)
return
g_strdup
(
"?"
);
settings
=
g_settings_new
(
"org.gnome.Characters"
);
value
=
g_settings_get_default_value
(
settings
,
"local-scripts-character"
);
setlocale
(
LC_MESSAGES
,
old_locale
);
g_free
(
old_locale
);
if
(
value
)
if
(
setlocale
(
LC_MESSAGES
,
locale
))
{
result
=
g_variant_dup_string
(
value
,
NULL
);
g_variant_unref
(
value
);
GSettings
*
settings
;
GVariant
*
value
;
settings
=
g_settings_new
(
"org.gnome.Characters"
);
value
=
g_settings_get_default_value
(
settings
,
"local-scripts-character"
);
if
(
value
)
{
result
=
g_variant_dup_string
(
value
,
NULL
);
g_variant_unref
(
value
);
}
}
setlocale
(
LC_MESSAGES
,
old_locale
);
g_free
(
old_locale
);
return
result
;
}
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