[nautilus-actions] Write all available locales in .desktop file
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Write all available locales in .desktop file
- Date: Sun, 15 Aug 2010 16:52:51 +0000 (UTC)
commit f0dab745799b5abb8493a2255e5ac09c5b7943c0
Author: Pierre Wieser <pwieser trychlos org>
Date: Sat Aug 14 00:50:45 2010 +0200
Write all available locales in .desktop file
ChangeLog | 3 +++
src/io-desktop/nadp-desktop-file.c | 12 +++++++++++-
2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 51733ab..674b35a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2010-08-13 Pierre Wieser <pwieser trychlos org>
+ * src/io-desktop/nadp-desktop-file.c (nadp_desktop_file_set_locale_string):
+ Write all available locales to have a chance another locale can get it.
+
* Makefile.am:
Build doc after src so that libraries are available when documenting them.
diff --git a/src/io-desktop/nadp-desktop-file.c b/src/io-desktop/nadp-desktop-file.c
index a6726cb..a2e761f 100644
--- a/src/io-desktop/nadp-desktop-file.c
+++ b/src/io-desktop/nadp-desktop-file.c
@@ -923,6 +923,7 @@ void
nadp_desktop_file_set_locale_string( const NadpDesktopFile *ndf, const gchar *group, const gchar *key, const gchar *value )
{
char **locales;
+ guint i;
g_return_if_fail( NADP_IS_DESKTOP_FILE( ndf ));
@@ -936,7 +937,16 @@ nadp_desktop_file_set_locale_string( const NadpDesktopFile *ndf, const gchar *gr
en
C
*/
- g_key_file_set_locale_string( ndf->private->key_file, group, key, locales[0], value );
+
+ /* using locales[0] writes a string with, e.g. Label[en_US.UTF-8]
+ * after thatn trying to read the same key with another locale, even en_US.utf-8,
+ * fails ans returns an empty string.
+ * so write all available locales for the string, so that there is a chance at
+ * least one of these will be used as default
+ */
+ for( i = 0 ; i < g_strv_length( locales ) ; ++i ){
+ g_key_file_set_locale_string( ndf->private->key_file, group, key, locales[i], value );
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]