aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2003-10-18 06:40:17 +0800
committerChristian Persch <chpe@src.gnome.org>2003-10-18 06:40:17 +0800
commit0e078cd9825b89e128d0501d4a7b5885670c2347 (patch)
tree932814c057bd8d2c6cdee449dc6b267091cef6c5 /lib
parent4d9d732ba340aae6430bd687f0cf3252bff2217d (diff)
downloadgsoc2013-epiphany-0e078cd9825b89e128d0501d4a7b5885670c2347.tar
gsoc2013-epiphany-0e078cd9825b89e128d0501d4a7b5885670c2347.tar.gz
gsoc2013-epiphany-0e078cd9825b89e128d0501d4a7b5885670c2347.tar.bz2
gsoc2013-epiphany-0e078cd9825b89e128d0501d4a7b5885670c2347.tar.lz
gsoc2013-epiphany-0e078cd9825b89e128d0501d4a7b5885670c2347.tar.xz
gsoc2013-epiphany-0e078cd9825b89e128d0501d4a7b5885670c2347.tar.zst
gsoc2013-epiphany-0e078cd9825b89e128d0501d4a7b5885670c2347.zip
Encoding menu improvements, Part 4: The Rewrite.
2003-10-18 Christian Persch <chpe@cvs.gnome.org> Encoding menu improvements, Part 4: The Rewrite. * data/glade/epiphany.glade: * data/ui/epiphany-ui.xml: * data/ui/nautilus-epiphany-view.xml.in: * embed/Makefile.am: * embed/ephy-embed-shell.c: (ephy_embed_shell_init), (ephy_embed_shell_finalize), (ephy_embed_shell_new), (ephy_embed_shell_get_encodings): * embed/ephy-embed-shell.h: * embed/ephy-embed-utils.c: (ephy_embed_utils_save): * embed/ephy-embed-utils.h: * embed/ephy-embed.c: (ephy_embed_get_encoding_info): * embed/ephy-embed.h: * embed/ephy-encodings.c: (ephy_encodings_get_type), (ephy_encodings_finalize), (ephy_encodings_class_init), (ephy_encodings_get_node), (ephy_encodings_get_encodings), (ephy_encodings_get_detectors), (ephy_encodings_get_all), (ephy_encodings_get_categories), (ephy_encodings_add_recent), (ephy_encodings_get_recent), (ephy_encodings_init), (ephy_encoding_info_free), (ephy_encodings_new): * embed/ephy-encodings.h: * embed/mozilla/EphyWrapper.cpp: * embed/mozilla/EphyWrapper.h: * embed/mozilla/Makefile.am: * embed/mozilla/mozilla-embed.cpp: * embed/mozilla/mozilla-notifiers.cpp: * lib/Makefile.am: * lib/ephy-encodings.c: * lib/ephy-encodings.h: * lib/ephy-langs.c: (ephy_font_languages), (ephy_font_n_languages): * lib/ephy-langs.h: * src/Makefile.am: * src/ephy-encoding-dialog.c: (ephy_encoding_dialog_get_type), (setup_filter), (sync_embed_cb), (sync_active_tab), (ephy_encoding_dialog_set_window), (activate_choice), (activate_automatic), (ephy_encoding_dialog_response_cb), (category_node_selected_cb), (view_node_selected_cb), (view_node_activated_cb), (ephy_encoding_dialog_init), (ephy_encoding_dialog_finalize), (ephy_encoding_dialog_set_property), (ephy_encoding_dialog_get_property), (ephy_encoding_dialog_class_init), (ephy_encoding_dialog_new): * src/ephy-encoding-dialog.h: * src/ephy-encoding-menu.c: (ephy_encoding_menu_init), (sort_encodings), (add_menu_item), (update_encoding_menu_cb), (encoding_activate_cb), (add_action), (ephy_encoding_menu_view_dialog_cb), (ephy_encoding_menu_automatic_cb), (ephy_encoding_menu_set_window), (ephy_encoding_menu_finalize), (ephy_encoding_menu_class_init), (ephy_encoding_menu_new): * src/ephy-nautilus-view.c: (gnv_bonobo_control_activate_cb), (gnv_cmd_select_encoding), (gnv_cmd_edit_find): * src/ephy-window.c: (ephy_window_set_active_tab), (setup_notebook), (ephy_window_set_property), (ephy_window_get_property), (ephy_window_class_init): * src/language-editor.h: * src/pdm-dialog.c: (setup_passwords_treeview), (setup_cookies_treeview): * src/prefs-dialog.c: (prefs_dialog_finalize), (get_current_language_code), (fonts_language_info_cmp), (create_fonts_language_menu), (find_encoding_in_list_cmp), (sort_encodings), (create_optionmenu), (prefs_dialog_init): Made encodings menu dynamic, containing recently used items + items related to the currently active encoding. Split encodings out as a embed shell service, port all users over to that. Harvest all encoding info we can get from mozilla.
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/ephy-encodings.c183
-rw-r--r--lib/ephy-encodings.h45
-rw-r--r--lib/ephy-langs.c115
-rw-r--r--lib/ephy-langs.h47
5 files changed, 15 insertions, 377 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 64c469144..7caefb55d 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -35,7 +35,6 @@ NOINST_H_FILES = \
INST_H_FILES = \
ephy-dialog.h \
ephy-langs.h \
- ephy-encodings.h \
ephy-node.h \
ephy-node-db.h \
ephy-types.h
@@ -51,7 +50,6 @@ libephy_la_SOURCES = \
ephy-dialog.h \
ephy-dnd.c \
ephy-dnd.h \
- ephy-encodings.c \
ephy-file-helpers.c \
ephy-file-helpers.h \
ephy-glade.c \
diff --git a/lib/ephy-encodings.c b/lib/ephy-encodings.c
deleted file mode 100644
index c02705c72..000000000
--- a/lib/ephy-encodings.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (C) 2003 Marco Pesenti Gritti
- * Copyright (C) 2003 Christian Persch
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "ephy-encodings.h"
-#include "ephy-string.h"
-#include <bonobo/bonobo-i18n.h>
-#include <string.h>
-
-/**
- * translatable encodings titles
- * NOTE: if you add /change encodings, please also update the schema file
- * epiphany.schemas.in
- */
-static const
-struct
-{
- char *title;
- char *name;
- EphyLanguageGroup 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);
-
-void
-ephy_encoding_info_free (EphyEncodingInfo *info)
-{
- g_return_if_fail (info != NULL);
-
- g_free (info->title);
- g_free (info->key);
- g_free (info->encoding);
-
- g_free (info);
-}
-
-static int
-encodings_info_cmp (const EphyEncodingInfo *i1, const EphyEncodingInfo *i2)
-{
- return strcmp (i1->key, i2->key);
-}
-
-GList *
-ephy_encodings_get_list (EphyLanguageGroup group, gboolean elide_underscores)
-{
- GList *list = NULL;
- guint i;
-
- for (i = 0; i < n_encodings; i++)
- {
- if (group == LG_ALL || group == encodings[i].group)
- {
- EphyEncodingInfo *info;
- char *elided = NULL;
-
- info = g_new0 (EphyEncodingInfo, 1);
-
- info->group = encodings[i].group;
- info->encoding = g_strdup (encodings[i].name);
-
- elided = ephy_string_elide_underscores (_(encodings[i].title));
-
- /* collate without underscores */
- info->key = g_utf8_collate_key (elided, -1);
-
- if (elide_underscores)
- {
- info->title = elided;
- }
- else
- {
- g_free (elided);
-
- info->title = g_strdup (_(encodings[i].title));
- }
-
- list = g_list_prepend (list, info);
- }
- }
-
- return g_list_sort (list, (GCompareFunc) encodings_info_cmp);
-}
diff --git a/lib/ephy-encodings.h b/lib/ephy-encodings.h
deleted file mode 100644
index 59f14393e..000000000
--- a/lib/ephy-encodings.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2003 Marco Pesenti Gritti
- * Copyright (C) 2003 Christian Persch
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
- */
-
-#ifndef EPHY_ENCODINGS_H
-#define EPHY_ENCODINGS_H
-
-#include <glib.h>
-#include "ephy-langs.h"
-
-G_BEGIN_DECLS
-
-typedef struct
-{
- char *encoding;
- EphyLanguageGroup group;
- char *title;
- char *key;
-} EphyEncodingInfo;
-
-GList *ephy_encodings_get_list (EphyLanguageGroup group,
- gboolean elide_underscores);
-
-void ephy_encoding_info_free (EphyEncodingInfo *info);
-
-G_END_DECLS
-
-#endif
diff --git a/lib/ephy-langs.c b/lib/ephy-langs.c
index dee178846..5669253e0 100644
--- a/lib/ephy-langs.c
+++ b/lib/ephy-langs.c
@@ -23,11 +23,10 @@
#endif
#include "ephy-langs.h"
-#include "ephy-string.h"
+
#include <bonobo/bonobo-i18n.h>
-#include <string.h>
-static const FontsLanguageInfo font_languages[] =
+static const EphyFontsLanguageInfo font_languages [] =
{
{ N_("Arabic"), "ar" },
{ N_("Baltic"), "x-baltic" },
@@ -51,112 +50,14 @@ static const FontsLanguageInfo font_languages[] =
};
static const guint n_font_languages = G_N_ELEMENTS (font_languages);
-static const
-struct
-{
- EphyLanguageGroup group;
- char *title;
-}
-lang_group_names[] =
-{
- { LG_ARABIC, N_("_Arabic") },
- { LG_BALTIC, N_("_Baltic") },
- { LG_CENTRAL_EUROPEAN, N_("Central _European") },
- { LG_CHINESE, N_("Chi_nese") },
- { LG_CYRILLIC, N_("_Cyrillic") },
- { LG_GREEK, N_("_Greek") },
- { LG_HEBREW, N_("_Hebrew") },
- { LG_INDIAN, N_("_Indian") },
- { LG_JAPANESE, N_("_Japanese") },
- { LG_KOREAN, N_("_Korean") },
- { LG_TURKISH, N_("_Turkish") },
- { LG_UNICODE, N_("_Unicode") },
- { LG_VIETNAMESE, N_("_Vietnamese") },
- { LG_WESTERN, N_("_Western") },
- { LG_OTHER, N_("_Other") }
-};
-static const guint n_lang_group_names = G_N_ELEMENTS (lang_group_names);
-
-void
-ephy_lang_group_info_free (EphyLanguageGroupInfo *info)
-{
- g_return_if_fail (info != NULL);
-
- g_free (info->title);
- g_free (info->key);
-
- g_free (info);
-}
-
-static gint
-lang_group_info_cmp (const EphyLanguageGroupInfo *i1, const EphyLanguageGroupInfo *i2)
-{
- return strcmp (i1->key, i2->key);
-}
-
-GList *
-ephy_lang_get_group_list (void)
-{
- GList *list = NULL;
- guint i;
-
- for (i = 0; i < n_lang_group_names; i++)
- {
- EphyLanguageGroupInfo *info;
- char *elided = NULL;
-
- info = g_new0 (EphyLanguageGroupInfo, 1);
-
- info->title = g_strdup (_(lang_group_names[i].title));
- info->group = lang_group_names[i].group;
-
- /* collate without underscores */
- elided = ephy_string_elide_underscores (info->title);
- info->key = g_utf8_collate_key (elided, -1);
- g_free (elided);
-
- list = g_list_prepend (list, info);
- }
-
- return g_list_sort (list, (GCompareFunc) lang_group_info_cmp);
-}
-
-static int
-fonts_language_info_cmp (const FontsLanguageInfo *i1, const FontsLanguageInfo *i2)
-{
- return g_utf8_collate (i1->title, i2->title);
-}
-
-GList *
-ephy_font_langs_get_codes_list (void)
+const EphyFontsLanguageInfo *
+ephy_font_languages (void)
{
- guint i;
- GList *list = NULL;
-
- for (i=0; i < n_font_languages; i++)
- {
- list = g_list_prepend (list, font_languages[i].code);
- }
-
- return list;
+ return font_languages;
}
-GList *
-ephy_font_langs_get_list (void)
+guint
+ephy_font_n_languages (void)
{
- GList *list = NULL;
- guint i;
-
- for (i = 0; i < n_font_languages; i++)
- {
- FontsLanguageInfo *info;
-
- info = g_new0 (FontsLanguageInfo, 1);
- info->title = _(font_languages[i].title);
- info->code = font_languages[i].code;
-
- list = g_list_prepend (list, info);
- }
-
- return g_list_sort (list, (GCompareFunc) fonts_language_info_cmp);
+ return n_font_languages;
}
diff --git a/lib/ephy-langs.h b/lib/ephy-langs.h
index c4007dd73..4715801f4 100644
--- a/lib/ephy-langs.h
+++ b/lib/ephy-langs.h
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2000 Marco Pesenti Gritti
+ * Copyright (C) 2000, 2003 Marco Pesenti Gritti
+ * Copyright (C) 2003 Christian Persc
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -14,60 +15,26 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
*/
#ifndef EPHY_LANGS_H
#define EPHY_LANGS_H
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include <glib.h>
G_BEGIN_DECLS
-/* language groups */
-typedef enum
-{
- LG_ARABIC,
- LG_BALTIC,
- LG_CENTRAL_EUROPEAN,
- LG_CHINESE,
- LG_CYRILLIC,
- LG_GREEK,
- LG_HEBREW,
- LG_INDIAN,
- LG_JAPANESE,
- LG_KOREAN,
- LG_TURKISH,
- LG_UNICODE,
- LG_VIETNAMESE,
- LG_WESTERN,
- LG_OTHER,
- LG_ALL
-} EphyLanguageGroup;
-
-typedef struct
-{
- EphyLanguageGroup group;
- char *title;
- char *key;
-} EphyLanguageGroupInfo;
-
typedef struct
{
char *title;
char *code;
-} FontsLanguageInfo;
-
-GList *ephy_font_langs_get_list (void);
-
-GList *ephy_font_langs_get_codes_list (void);
+} EphyFontsLanguageInfo;
-GList *ephy_lang_get_group_list (void);
+const EphyFontsLanguageInfo *ephy_font_languages (void);
-void ephy_lang_group_info_free (EphyLanguageGroupInfo *info);
+guint ephy_font_n_languages (void);
G_END_DECLS