aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/mozilla-notifiers.cpp
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-05-11 00:39:11 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-05-11 00:39:11 +0800
commit781e8b984aea05d4a02f326ed8a99a62bf52996e (patch)
tree7c383382dab4ef2056d0a577dae1a4ee03d97383 /embed/mozilla/mozilla-notifiers.cpp
parent1a9a315b7f892116319bc5b05323f7d98bbccc36 (diff)
downloadgsoc2013-epiphany-781e8b984aea05d4a02f326ed8a99a62bf52996e.tar
gsoc2013-epiphany-781e8b984aea05d4a02f326ed8a99a62bf52996e.tar.gz
gsoc2013-epiphany-781e8b984aea05d4a02f326ed8a99a62bf52996e.tar.bz2
gsoc2013-epiphany-781e8b984aea05d4a02f326ed8a99a62bf52996e.tar.lz
gsoc2013-epiphany-781e8b984aea05d4a02f326ed8a99a62bf52996e.tar.xz
gsoc2013-epiphany-781e8b984aea05d4a02f326ed8a99a62bf52996e.tar.zst
gsoc2013-epiphany-781e8b984aea05d4a02f326ed8a99a62bf52996e.zip
Use sys language as default
2003-05-10 Marco Pesenti Gritti <marco@it.gnome.org> * data/epiphany.schemas.in: Use sys language as default * data/glade/prefs-dialog.glade: Put back stuff I accidentally removed. * data/glade/print.glade: Set it has hidden in glade, so we can set position before it's showed. * embed/mozilla/mozilla-notifiers.cpp: * src/prefs-dialog.c: Add system language
Diffstat (limited to 'embed/mozilla/mozilla-notifiers.cpp')
-rw-r--r--embed/mozilla/mozilla-notifiers.cpp74
1 files changed, 47 insertions, 27 deletions
diff --git a/embed/mozilla/mozilla-notifiers.cpp b/embed/mozilla/mozilla-notifiers.cpp
index 52b4d2560..fd480ebc0 100644
--- a/embed/mozilla/mozilla-notifiers.cpp
+++ b/embed/mozilla/mozilla-notifiers.cpp
@@ -509,45 +509,65 @@ mozilla_allow_popups_notifier(GConfClient *client,
!new_val);
}
+static char *
+get_system_language ()
+{
+ const GList *sys_langs;
+
+ sys_langs = gnome_i18n_get_language_list ("LC_MESSAGES");
+
+ if (sys_langs)
+ {
+ char *lang = (char *)sys_langs->data;
+
+ /* FIXME this probably need to be smarter */
+ if (strcmp (lang, "C") != 0)
+ {
+ return g_strndup (lang, 2);
+ }
+ }
+
+ return NULL;
+}
+
static void
mozilla_language_notifier(GConfClient *client,
guint cnxn_id,
GConfEntry *entry,
EphyEmbedSingle *single)
{
- gchar *languages;
- GSList *language_list ,*cur_lang_list;
-
- language_list = eel_gconf_get_string_list (CONF_RENDERING_LANGUAGE);
+ GSList *languages, *l;
+ GString *result;
- languages = NULL;
- cur_lang_list = language_list;
- while (cur_lang_list != NULL) {
- char *lang, *tmp;
+ result = g_string_new ("");
+ languages = eel_gconf_get_string_list (CONF_RENDERING_LANGUAGE);
- lang = g_strdup((char *)cur_lang_list->data);
-
- if (languages == NULL)
- languages = lang;
- else {
- tmp = languages;
- languages = g_strconcat(languages, ",", lang, NULL);
- g_free(lang);
- g_free(tmp);
+ for (l = languages; l != NULL; l = l->next)
+ {
+ char *lang = (char *)l->data;
+
+ if (strcmp (lang, "system") == 0)
+ {
+ char *sys_lang;
+
+ sys_lang = get_system_language ();
+ if (sys_lang)
+ {
+ g_string_append (result, sys_lang);
+ g_free (sys_lang);
+ }
+ }
+ else
+ {
+ g_string_append (result, (char *)l->data);
}
- g_free(cur_lang_list->data);
- cur_lang_list = cur_lang_list->next;
- }
- if (languages == NULL)
- {
- languages = g_strdup ("");
+ if (l->next) g_string_append (result, ",");
}
+
+ mozilla_prefs_set_string ("intl.accept_languages", result->str);
- mozilla_prefs_set_string ("intl.accept_languages", languages);
- g_free (languages);
-
- g_slist_free(language_list);
+ g_string_free (result, TRUE);
}
static char *autodetect_charset_prefs[] =