[accounts-dialog] Set the current language from the locale if not set
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [accounts-dialog] Set the current language from the locale if not set
- Date: Wed, 13 Jan 2010 13:13:58 +0000 (UTC)
commit b8ed704298082cfcad8f026e9ee8268ddaa623bd
Author: Bastien Nocera <hadess hadess net>
Date: Wed Jan 13 13:08:09 2010 +0000
Set the current language from the locale if not set
src/um-language-dialog.c | 35 +++++++++++++++++++++++++++++++++--
1 files changed, 33 insertions(+), 2 deletions(-)
---
diff --git a/src/um-language-dialog.c b/src/um-language-dialog.c
index a20775d..3ab7267 100644
--- a/src/um-language-dialog.c
+++ b/src/um-language-dialog.c
@@ -305,16 +305,33 @@ add_user_languages (GtkListStore *store)
g_hash_table_insert (seen, name, GINT_TO_POINTER (TRUE));
language = gdm_get_language_from_name (name, NULL);
-
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, name, 1, language, -1);
+ g_free (name);
g_free (language);
}
g_slist_free (users);
g_hash_table_destroy (seen);
+ /* Add the current locale if we cannot get it from the
+ * user service */
+ if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) < 1) {
+ const char *locale;
+ char *name;
+
+ locale = (const char *) setlocale(LC_MESSAGES, NULL);
+ name = gdm_normalize_language_name (locale);
+
+ language = gdm_get_language_from_name (name, NULL);
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter, 0, name, 1, language, -1);
+
+ g_free (name);
+ g_free (language);
+ }
+
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, NULL, 1, _("Other..."), -1);
}
@@ -495,6 +512,8 @@ um_language_dialog_set_user (UmLanguageDialog *um,
}
um->user = user;
if (um->user) {
+ const char *language;
+
g_object_ref (user);
pixbuf = um_user_render_icon (user, FALSE, 48);
@@ -506,7 +525,19 @@ um_language_dialog_set_user (UmLanguageDialog *um,
add_user_languages (um->dialog_store);
- select_language (um, um_user_get_language (user));
+ language = um_user_get_language (user);
+ if (language) {
+ select_language (um, um_user_get_language (user));
+ } else {
+ const char *locale;
+ char *lang;
+
+ locale = (const char *) setlocale(LC_MESSAGES, NULL);
+ lang = gdm_normalize_language_name (locale);
+
+ select_language (um, lang);
+ g_free (lang);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]