aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla
diff options
context:
space:
mode:
Diffstat (limited to 'embed/mozilla')
-rw-r--r--embed/mozilla/mozilla-embed-single.cpp222
-rw-r--r--embed/mozilla/mozilla-notifiers.cpp43
2 files changed, 18 insertions, 247 deletions
diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp
index 6491ce33d..8f1ce3939 100644
--- a/embed/mozilla/mozilla-embed-single.cpp
+++ b/embed/mozilla/mozilla-embed-single.cpp
@@ -23,7 +23,6 @@
#endif
#include "glib.h"
-#include "ephy-string.h"
#include "ephy-debug.h"
#include "gtkmozembed.h"
#include "mozilla-embed-single.h"
@@ -39,7 +38,6 @@
#include <time.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomevfs/gnome-vfs-utils.h>
-#include <string.h>
#include <nsICacheService.h>
#include <nsCOMPtr.h>
#include <nsIPrefService.h>
@@ -67,128 +65,6 @@
#define MOZILLA_PROFILE_FILE "prefs.js"
#define DEFAULT_PROFILE_FILE SHARE_DIR"/default-prefs.js"
-/* language groups names */
-static const
-struct
-{
- gchar *title;
- LanguageGroup group;
-}
-lang_groups[] =
-{
- { N_("_Arabic"), LG_ARABIC },
- { N_("_Baltic"), LG_BALTIC },
- { N_("Central _European"), LG_CENTRAL_EUROPEAN },
- { N_("Chi_nese"), LG_CHINESE },
- { N_("_Cyrillic"), LG_CYRILLIC },
- { N_("_Greek"), LG_GREEK },
- { N_("_Hebrew"), LG_HEBREW },
- { N_("_Indian"), LG_INDIAN },
- { N_("_Japanese"), LG_JAPANESE },
- { N_("_Korean"), LG_KOREAN },
- { N_("_Turkish"), LG_TURKISH },
- { N_("_Unicode"), LG_UNICODE },
- { N_("_Vietnamese"), LG_VIETNAMESE },
- { N_("_Western"), LG_WESTERN },
- { N_("_Other"), LG_OTHER }
-};
-static const guint n_lang_groups = G_N_ELEMENTS (lang_groups);
-
-/**
- * translatable encodings titles
- * NOTE: if you add /change encodings, please also update the schema file
- * epiphany.schemas.in
- */
-static const
-struct
-{
- gchar *title;
- gchar *name;
- LanguageGroup group;
-}
-encodings[] =
-{
- /* translators: access keys need only be unique within the same LG_group */
- { N_("Arabic (_IBM-864)"), "IBM864", LG_ARABIC },
- { N_("Arabic (ISO-_8859-6)"), "ISO-8859-6", LG_ARABIC },
- { N_("Arabic (_MacArabic)"), "x-mac-arabic", LG_ARABIC },
- { N_("Arabic (_Windows-1256)"), "windows-1256", LG_ARABIC },
- { N_("Baltic (_ISO-8859-13)"), "ISO-8859-13", LG_BALTIC },
- { N_("Baltic (I_SO-8859-4)"), "ISO-8859-4", LG_BALTIC },
- { N_("Baltic (_Windows-1257)"), "windows-1257", LG_BALTIC },
- { N_("Central European (_IBM-852)"), "IBM852", LG_CENTRAL_EUROPEAN },
- { N_("Central European (I_SO-8859-2)"), "ISO-8859-2", LG_CENTRAL_EUROPEAN },
- { N_("Central European (_MacCE)"), "x-mac-ce", LG_CENTRAL_EUROPEAN },
- { N_("Central European (_Windows-1250)"), "windows-1250", LG_CENTRAL_EUROPEAN },
- { N_("Croatian (Mac_Croatian)"), "x-mac-croatian", LG_CENTRAL_EUROPEAN },
- { N_("Chinese Simplified (_GB18030)"), "gb18030", LG_CHINESE },
- { N_("Chinese Simplified (G_B2312)"), "GB2312", LG_CHINESE },
- { N_("Chinese Simplified (GB_K)"), "x-gbk", LG_CHINESE },
- { N_("Chinese Simplified (_HZ)"), "HZ-GB-2312", LG_CHINESE },
- { N_("Chinese Simplified (_ISO-2022-CN)"), "ISO-2022-CN", LG_CHINESE },
- { N_("Chinese Traditional (Big_5)"), "Big5", LG_CHINESE },
- { N_("Chinese Traditional (Big5-HK_SCS)"), "Big5-HKSCS", LG_CHINESE },
- { N_("Chinese Traditional (_EUC-TW)"), "x-euc-tw", LG_CHINESE },
- { N_("Cyrillic (_IBM-855)"), "IBM855", LG_CYRILLIC },
- { N_("Cyrillic (I_SO-8859-5)"), "ISO-8859-5", LG_CYRILLIC },
- { N_("Cyrillic (IS_O-IR-111)"), "ISO-IR-111", LG_CYRILLIC },
- { N_("Cyrillic (_KOI8-R)"), "KOI8-R", LG_CYRILLIC },
- { N_("Cyrillic (_MacCyrillic)"), "x-mac-cyrillic", LG_CYRILLIC },
- { N_("Cyrillic (_Windows-1251)"), "windows-1251", LG_CYRILLIC },
- { N_("Cyrillic/Russian (_CP-866)"), "IBM866", LG_CYRILLIC },
- { N_("Cyrillic/Ukrainian (_KOI8-U)"), "KOI8-U", LG_CYRILLIC },
- { N_("Cyrillic/Ukrainian (Mac_Ukrainian)"), "x-mac-ukrainian", LG_CYRILLIC },
- { N_("Greek (_ISO-8859-7)"), "ISO-8859-7", LG_GREEK },
- { N_("Greek (_MacGreek)"), "x-mac-greek", LG_GREEK },
- { N_("Greek (_Windows-1253)"), "windows-1253", LG_GREEK },
- { N_("Gujarati (_MacGujarati)"), "x-mac-gujarati", LG_INDIAN },
- { N_("Gurmukhi (Mac_Gurmukhi)"), "x-mac-gurmukhi", LG_INDIAN },
- { N_("Hindi (Mac_Devanagari)"), "x-mac-devanagari", LG_INDIAN },
- { N_("Hebrew (_IBM-862)"), "IBM862", LG_HEBREW },
- { N_("Hebrew (IS_O-8859-8-I)"), "ISO-8859-8-I", LG_HEBREW },
- { N_("Hebrew (_MacHebrew)"), "x-mac-hebrew", LG_HEBREW },
- { N_("Hebrew (_Windows-1255)"), "windows-1255", LG_HEBREW },
- { N_("_Visual Hebrew (ISO-8859-8)"), "ISO-8859-8", LG_HEBREW },
- { N_("Japanese (_EUC-JP)"), "EUC-JP", LG_JAPANESE },
- { N_("Japanese (_ISO-2022-JP)"), "ISO-2022-JP", LG_JAPANESE },
- { N_("Japanese (_Shift-JIS)"), "Shift_JIS", LG_JAPANESE },
- { N_("Korean (_EUC-KR)"), "EUC-KR", LG_KOREAN },
- { N_("Korean (_ISO-2022-KR)"), "ISO-2022-KR", LG_KOREAN },
- { N_("Korean (_JOHAB)"), "x-johab", LG_KOREAN },
- { N_("Korean (_UHC)"), "x-windows-949", LG_KOREAN },
- { N_("Turkish (_IBM-857)"), "IBM857", LG_TURKISH },
- { N_("Turkish (I_SO-8859-9)"), "ISO-8859-9", LG_TURKISH },
- { N_("Turkish (_MacTurkish)"), "x-mac-turkish", LG_TURKISH },
- { N_("Turkish (_Windows-1254)"), "windows-1254", LG_TURKISH },
- { N_("Unicode (UTF-_7)"), "UTF-7", LG_UNICODE },
- { N_("Unicode (UTF-_8)"), "UTF-8", LG_UNICODE },
- { N_("Vietnamese (_TCVN)"), "x-viet-tcvn5712", LG_VIETNAMESE },
- { N_("Vietnamese (_VISCII)"), "VISCII", LG_VIETNAMESE },
- { N_("Vietnamese (V_PS)"), "x-viet-vps", LG_VIETNAMESE },
- { N_("Vietnamese (_Windows-1258)"), "windows-1258", LG_VIETNAMESE },
- { N_("Western (_IBM-850)"), "IBM850", LG_WESTERN },
- { N_("Western (I_SO-8859-1)"), "ISO-8859-1", LG_WESTERN },
- { N_("Western (IS_O-8859-15)"), "ISO-8859-15", LG_WESTERN },
- { N_("Western (_MacRoman)"), "x-mac-roman", LG_WESTERN },
- { N_("Western (_Windows-1252)"), "windows-1252", LG_WESTERN },
- { N_("_Armenian (ARMSCII-8)"), "armscii-8", LG_OTHER },
- { N_("_Celtic (ISO-8859-14)"), "ISO-8859-14", LG_OTHER },
- { N_("_Farsi (MacFarsi)"), "x-mac-farsi", LG_OTHER },
- { N_("_Georgian (GEOSTD8)"), "geostd8", LG_OTHER },
- { N_("_Icelandic (MacIcelandic)"), "x-mac-icelandic", LG_OTHER },
- { N_("_Nordic (ISO-8859-10)"), "ISO-8859-10", LG_OTHER },
- { N_("_Romanian (MacRomanian)"), "x-mac-romanian", LG_OTHER },
- { N_("R_omanian (ISO-8859-16)"), "ISO-8859-16", LG_OTHER },
- { N_("South _European (ISO-8859-3)"), "ISO-8859-3", LG_OTHER },
- { N_("Thai (TIS-_620)"), "TIS-620", LG_OTHER },
-#if MOZILLA_SNAPSHOT >= 10
- { N_("Thai (IS_O-8859-11)"), "iso-8859-11", LG_OTHER },
- { N_("_Thai (Windows-874)"), "windows-874", LG_OTHER },
-#endif
- { N_("_User Defined"), "x-user-defined", LG_OTHER },
-};
-static const guint n_encodings = G_N_ELEMENTS (encodings);
-
static void
mozilla_embed_single_class_init (MozillaEmbedSingleClass *klass);
static void
@@ -204,14 +80,6 @@ impl_set_offline_mode (EphyEmbedSingle *shell,
static gresult
impl_load_proxy_autoconf (EphyEmbedSingle *shell,
const char* url);
-static gresult
-impl_get_encodings (EphyEmbedSingle *shell,
- LanguageGroup group,
- gboolean elide_underscores,
- GList **encodings_list);
-static gresult
-impl_get_language_groups (EphyEmbedSingle *shell,
- GList **groups);
static gresult
impl_get_font_list (EphyEmbedSingle *shell,
const char *langGroup,
@@ -299,8 +167,6 @@ mozilla_embed_single_class_init (MozillaEmbedSingleClass *klass)
shell_class->clear_cache = impl_clear_cache;
shell_class->set_offline_mode = impl_set_offline_mode;
shell_class->load_proxy_autoconf = impl_load_proxy_autoconf;
- shell_class->get_encodings = impl_get_encodings;
- shell_class->get_language_groups = impl_get_language_groups;
shell_class->get_font_list = impl_get_font_list;
shell_class->list_cookies = impl_list_cookies;
shell_class->remove_cookies = impl_remove_cookies;
@@ -718,94 +584,6 @@ impl_load_proxy_autoconf (EphyEmbedSingle *shell,
return G_OK;
}
-static gint
-encoding_info_cmp (const EncodingInfo *i1, const EncodingInfo *i2)
-{
- return strcmp (i1->key, i2->key);
-}
-
-static gresult
-impl_get_encodings (EphyEmbedSingle *shell,
- LanguageGroup group,
- gboolean elide_underscores,
- GList **encodings_list)
-{
- GList *l = NULL;
- guint i;
-
- for (i = 0; i < n_encodings; i++)
- {
- if (group == LG_ALL || group == encodings[i].group)
- {
- EncodingInfo *info;
- gchar *elided = NULL;
-
- info = g_new0 (EncodingInfo, 1);
-
- info->encoding = g_strdup (encodings[i].name);
-
- elided = ephy_string_elide_underscores (_(encodings[i].title));
-
- if (elide_underscores)
- {
- info->title = g_strdup (elided);
- }
- else
- {
- info->title = g_strdup (_(encodings[i].title));
- }
-
- /* collate without underscores */
- info->key = g_utf8_collate_key (elided, -1);
-
- info->group = encodings[i].group;
-
- l = g_list_prepend (l, info);
- g_free (elided);
- }
- }
-
- *encodings_list = g_list_sort (l, (GCompareFunc) encoding_info_cmp);
-
- return G_OK;
-}
-
-static gint
-language_group_info_cmp (const LanguageGroupInfo *i1, const LanguageGroupInfo *i2)
-{
- return strcmp (i1->key, i2->key);
-}
-
-static gresult
-impl_get_language_groups (EphyEmbedSingle *shell,
- GList **groups)
-{
- GList *l = NULL;
- guint i;
-
- for (i = 0; i < n_lang_groups; i++)
- {
- LanguageGroupInfo *info;
- gchar *elided = NULL;
-
- info = g_new0 (LanguageGroupInfo, 1);
-
- info->title = g_strdup (_(lang_groups[i].title));
- info->group = lang_groups[i].group;
-
- /* collate without underscores */
- elided = ephy_string_elide_underscores (info->title);
- info->key = g_utf8_collate_key (elided, -1);
- g_free (elided);
-
- l = g_list_prepend (l, info);
- }
-
- *groups = g_list_sort (l, (GCompareFunc) language_group_info_cmp);
-
- return G_OK;
-}
-
static gresult
impl_get_font_list (EphyEmbedSingle *shell,
const char *langGroup,
diff --git a/embed/mozilla/mozilla-notifiers.cpp b/embed/mozilla/mozilla-notifiers.cpp
index 28049013b..0b170b555 100644
--- a/embed/mozilla/mozilla-notifiers.cpp
+++ b/embed/mozilla/mozilla-notifiers.cpp
@@ -387,8 +387,7 @@ mozilla_notifiers_init(EphyEmbedSingle *single)
{
GConfClient *client = eel_gconf_client_get_global ();
guint i;
- guint n_fonts_languages;
- const FontsLanguageInfo *fonts_language;
+ GList *codes, *l;
for (i = 0; conversion_table[i].gconf_key != NULL; i++)
{
@@ -426,10 +425,10 @@ mozilla_notifiers_init(EphyEmbedSingle *single)
}
/* fonts notifiers */
- n_fonts_languages = ephy_langs_get_n_font_languages ();
- fonts_language = ephy_langs_get_font_languages ();
- for (i = 0; i < n_fonts_languages; i++)
+ codes = ephy_font_langs_get_codes_list ();
+ for (l = codes; l != NULL; l = l->next)
{
+ const char *code = (char*) l->data;
guint k;
char *types [] = { "variable", "monospace" };
char key[255];
@@ -437,52 +436,46 @@ mozilla_notifiers_init(EphyEmbedSingle *single)
for (k = 0; k < G_N_ELEMENTS (types); k++)
{
- info = g_strconcat (types[k], ".", fonts_language[i].code, NULL);
+ info = g_strconcat (types[k], ".", code, NULL);
g_snprintf (key, 255, "%s_%s_%s", CONF_RENDERING_FONT,
- types[k],
- fonts_language[i].code);
+ types[k], code);
add_notification_and_notify (client, key,
(GConfClientNotifyFunc)mozilla_font_notifier,
info);
- font_infos = g_list_append (font_infos, info);
+ font_infos = g_list_prepend (font_infos, info);
}
- g_snprintf (key, 255, "%s_%s", CONF_RENDERING_FONT_MIN_SIZE, fonts_language[i].code);
- info = g_strconcat ("minimum-size", ".", fonts_language[i].code, NULL);
+ g_snprintf (key, 255, "%s_%s", CONF_RENDERING_FONT_MIN_SIZE, code);
+ info = g_strconcat ("minimum-size", ".", code, NULL);
add_notification_and_notify (client, key,
(GConfClientNotifyFunc)mozilla_font_size_notifier,
info);
- font_infos = g_list_append (font_infos, info);
+ font_infos = g_list_prepend (font_infos, info);
- g_snprintf (key, 255, "%s_%s", CONF_RENDERING_FONT_FIXED_SIZE, fonts_language[i].code);
- info = g_strconcat ("size.fixed", ".", fonts_language[i].code, NULL);
+ g_snprintf (key, 255, "%s_%s", CONF_RENDERING_FONT_FIXED_SIZE, code);
+ info = g_strconcat ("size.fixed", ".", code, NULL);
add_notification_and_notify (client, key,
(GConfClientNotifyFunc)mozilla_font_size_notifier,
info);
- font_infos = g_list_append (font_infos, info);
+ font_infos = g_list_prepend (font_infos, info);
- g_snprintf (key, 255, "%s_%s", CONF_RENDERING_FONT_VAR_SIZE, fonts_language[i].code);
- info = g_strconcat ("size.variable", ".", fonts_language[i].code, NULL);
+ g_snprintf (key, 255, "%s_%s", CONF_RENDERING_FONT_VAR_SIZE, code);
+ info = g_strconcat ("size.variable", ".", code, NULL);
add_notification_and_notify (client, key,
(GConfClientNotifyFunc)mozilla_font_size_notifier,
info);
- font_infos = g_list_append (font_infos, info);
+ font_infos = g_list_prepend (font_infos, info);
}
+ g_list_free (codes);
}
void
mozilla_notifiers_free (void)
{
- GList *l;
-
ephy_notification_remove (&mozilla_notifiers);
- for (l = font_infos; l != NULL; l = l->next)
- {
- g_free (l->data);
- }
-
+ g_list_foreach (font_infos, (GFunc) g_free, NULL);
g_list_free (font_infos);
}