diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-10-14 01:38:16 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-10-14 01:38:16 +0800 |
commit | 442741fc4fb9b63c78c37f305d443f8aa57ff67e (patch) | |
tree | 834a2350618ff9378d1aaea422e1db9e0e9a304b /src/ephy-encoding-menu.c | |
parent | ab827f639671b79f2b802b19f86e937a92612ad7 (diff) | |
download | gsoc2013-epiphany-442741fc4fb9b63c78c37f305d443f8aa57ff67e.tar gsoc2013-epiphany-442741fc4fb9b63c78c37f305d443f8aa57ff67e.tar.gz gsoc2013-epiphany-442741fc4fb9b63c78c37f305d443f8aa57ff67e.tar.bz2 gsoc2013-epiphany-442741fc4fb9b63c78c37f305d443f8aa57ff67e.tar.lz gsoc2013-epiphany-442741fc4fb9b63c78c37f305d443f8aa57ff67e.tar.xz gsoc2013-epiphany-442741fc4fb9b63c78c37f305d443f8aa57ff67e.tar.zst gsoc2013-epiphany-442741fc4fb9b63c78c37f305d443f8aa57ff67e.zip |
Encodings menu improvements, part 3: Refactored the encodings list; it no
2003-10-13 Christian Persch <chpe@cvs.gnome.org>
* embed/ephy-embed-single.c: (ephy_embed_single_free_passwords):
* embed/ephy-embed-single.h:
* embed/ephy-embed-utils.c:
(ephy_embed_utils_build_encodings_submenu):
* embed/mozilla/mozilla-embed-single.cpp:
* embed/mozilla/mozilla-notifiers.cpp:
* lib/Makefile.am:
* lib/ephy-encodings.c: (ephy_encoding_info_free),
(encodings_info_cmp), (ephy_encodings_get_list):
* lib/ephy-encodings.h:
* lib/ephy-langs.c: (ephy_lang_group_info_free),
(lang_group_info_cmp), (ephy_lang_get_group_list),
(fonts_language_info_cmp), (ephy_font_langs_get_codes_list),
(ephy_font_langs_get_list):
* lib/ephy-langs.h:
* po/POTFILES.in:
* src/ephy-encoding-menu.c: (ephy_encoding_menu_set_window),
(ephy_encoding_menu_rebuild):
* src/prefs-dialog.c: (prefs_dialog_finalize),
(get_current_language_code), (create_fonts_language_menu),
(default_encoding_menu_changed_cb), (find_encoding_in_list_cmp),
(create_default_encoding_menu):
Encodings menu improvements, part 3: Refactored the encodings
list; it no longer is neccessary to have it in the embed single.
Ported all callers to new infrastructure.
Diffstat (limited to 'src/ephy-encoding-menu.c')
-rw-r--r-- | src/ephy-encoding-menu.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/src/ephy-encoding-menu.c b/src/ephy-encoding-menu.c index 2f3596c23..0773a9fc5 100644 --- a/src/ephy-encoding-menu.c +++ b/src/ephy-encoding-menu.c @@ -25,8 +25,9 @@ #endif #include "ephy-encoding-menu.h" +#include "ephy-langs.h" +#include "ephy-encodings.h" #include "ephy-string.h" -#include "ephy-shell.h" #include "ephy-debug.h" #include <bonobo/bonobo-i18n.h> @@ -174,7 +175,6 @@ update_encoding_menu_cb (GtkAction *dummy, EphyEncodingMenu *menu) static void ephy_encoding_menu_set_window (EphyEncodingMenu *menu, EphyWindow *window) { - EphyEmbedSingle *single; GtkActionGroup *action_group; GtkAction *action; GList *encodings, *groups, *l; @@ -188,14 +188,10 @@ ephy_encoding_menu_set_window (EphyEncodingMenu *menu, EphyWindow *window) action_group = gtk_action_group_new ("EncodingActions"); menu->priv->action_group = action_group; - single = ephy_embed_shell_get_embed_single (EPHY_EMBED_SHELL (ephy_shell)); - g_return_if_fail (single != NULL); - - ephy_embed_single_get_encodings (single, LG_ALL, FALSE, &encodings); - + encodings = ephy_encodings_get_list (LG_ALL, FALSE); for (l = encodings; l != NULL; l = l->next) { - const EncodingInfo *info = (EncodingInfo *) l->data; + const EphyEncodingInfo *info = (EphyEncodingInfo *) l->data; char name[32]; g_snprintf (name, 32, "Encoding%s", info->encoding); @@ -215,14 +211,13 @@ ephy_encoding_menu_set_window (EphyEncodingMenu *menu, EphyWindow *window) g_object_unref (action); } - g_list_foreach (encodings, (GFunc) encoding_info_free, NULL); + g_list_foreach (encodings, (GFunc) ephy_encoding_info_free, NULL); g_list_free (encodings); - ephy_embed_single_get_language_groups (single, &groups); - + groups = ephy_lang_get_group_list (); for (l = groups; l != NULL; l = l->next) { - const LanguageGroupInfo *info = (LanguageGroupInfo *) l->data; + const EphyLanguageGroupInfo *info = (EphyLanguageGroupInfo *) l->data; char name[32]; g_snprintf (name, 32, "EncodingGroup%d", info->group); @@ -235,7 +230,7 @@ ephy_encoding_menu_set_window (EphyEncodingMenu *menu, EphyWindow *window) g_object_unref (action); } - g_list_foreach (groups, (GFunc) language_group_info_free, NULL); + g_list_foreach (groups, (GFunc) ephy_lang_group_info_free, NULL); g_list_free (groups); gtk_ui_manager_insert_action_group (menu->priv->manager, @@ -319,12 +314,8 @@ ephy_encoding_menu_new (EphyWindow *window) static void ephy_encoding_menu_rebuild (EphyEncodingMenu *menu) { - EphyEmbedSingle *single; EphyEncodingMenuPrivate *p = menu->priv; - GList *encodings, *groups, *l; - - single = ephy_embed_shell_get_embed_single (EPHY_EMBED_SHELL (ephy_shell)); - ephy_embed_single_get_language_groups (single, &groups); + GList *groups, *l; if (p->merge_id > 0) { @@ -338,11 +329,12 @@ ephy_encoding_menu_rebuild (EphyEncodingMenu *menu) "ViewEncodingMenu", "ViewEncoding", GTK_UI_MANAGER_MENU, FALSE); + groups = ephy_lang_get_group_list (); for (l = groups; l != NULL; l = l->next) { - const LanguageGroupInfo *info = (LanguageGroupInfo *) l->data; + const EphyLanguageGroupInfo *info = (EphyLanguageGroupInfo *) l->data; char name[32], action[36], path[128]; - GList *enc; + GList *encodings, *enc; g_snprintf (action, 32, "EncodingGroup%d", info->group); g_snprintf (name, 36, "%sMenu", action); @@ -353,12 +345,10 @@ ephy_encoding_menu_rebuild (EphyEncodingMenu *menu) name, action, GTK_UI_MANAGER_MENU, FALSE); - ephy_embed_single_get_encodings (single, info->group, - FALSE, &encodings); - + encodings = ephy_encodings_get_list (info->group, FALSE); for (enc = encodings; enc != NULL; enc = enc->next) { - const EncodingInfo *info = (EncodingInfo *) enc->data; + const EphyEncodingInfo *info = (EphyEncodingInfo *) enc->data; g_snprintf (action, 32, "Encoding%s", info->encoding); g_snprintf (name, 36, "%sItem", action); @@ -368,10 +358,10 @@ ephy_encoding_menu_rebuild (EphyEncodingMenu *menu) GTK_UI_MANAGER_MENUITEM, FALSE); } - g_list_foreach (encodings, (GFunc) encoding_info_free, NULL); + g_list_foreach (encodings, (GFunc) ephy_encoding_info_free, NULL); g_list_free (encodings); } - g_list_foreach (groups, (GFunc) language_group_info_free, NULL); + g_list_foreach (groups, (GFunc) ephy_lang_group_info_free, NULL); g_list_free (groups); } |