From 781e8b984aea05d4a02f326ed8a99a62bf52996e Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Sat, 10 May 2003 16:39:11 +0000 Subject: Use sys language as default 2003-05-10 Marco Pesenti Gritti * 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 --- ChangeLog | 20 +++++ data/epiphany.schemas.in | 2 +- data/glade/prefs-dialog.glade | 158 ++++++++++++++++++++++++++++++++++++ data/glade/print.glade | 1 - embed/mozilla/mozilla-notifiers.cpp | 74 +++++++++++------ src/prefs-dialog.c | 1 + 6 files changed, 227 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index e232920d5..43fe474a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2003-05-10 Marco Pesenti Gritti + + * 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 + 2003-05-10 Marco Pesenti Gritti * data/epiphany.schemas.in: diff --git a/data/epiphany.schemas.in b/data/epiphany.schemas.in index 883f244de..41d7f0a2d 100644 --- a/data/epiphany.schemas.in +++ b/data/epiphany.schemas.in @@ -358,7 +358,7 @@ epiphany list string - [en] + [system,en] Languages Preferred languages, two letter codes. diff --git a/data/glade/prefs-dialog.glade b/data/glade/prefs-dialog.glade index f97a22444..d6392065f 100644 --- a/data/glade/prefs-dialog.glade +++ b/data/glade/prefs-dialog.glade @@ -2727,4 +2727,162 @@ + + 6 + 300 + Languages editor + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + False + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-add + True + GTK_RELIEF_NORMAL + 0 + + + + + + True + True + True + gtk-remove + True + GTK_RELIEF_NORMAL + 0 + + + + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + -7 + + + + + + 0 + False + True + GTK_PACK_END + + + + + + 6 + True + False + 6 + + + + True + False + 6 + + + + True + Language + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + True + -1 + + + 0 + True + True + + + + + 0 + False + True + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + diff --git a/data/glade/print.glade b/data/glade/print.glade index 14af228f8..1e3b71707 100644 --- a/data/glade/print.glade +++ b/data/glade/print.glade @@ -6,7 +6,6 @@ 7 - True Print GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE 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[] = diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index 0c02b7fbf..e5dc28c19 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.c @@ -99,6 +99,7 @@ struct } languages [] = { + { N_("System language"), "system" }, { N_("Afrikaans"), "ak" }, { N_("Albanian"), "sq" }, { N_("Arabic"), "ar" }, -- cgit v1.2.3