From 0e078cd9825b89e128d0501d4a7b5885670c2347 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Fri, 17 Oct 2003 22:40:17 +0000 Subject: Encoding menu improvements, Part 4: The Rewrite. 2003-10-18 Christian Persch 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. --- embed/ephy-embed-utils.c | 81 ------------------------------------------------ 1 file changed, 81 deletions(-) (limited to 'embed/ephy-embed-utils.c') diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c index c6e113042..0bcd6bb52 100644 --- a/embed/ephy-embed-utils.c +++ b/embed/ephy-embed-utils.c @@ -29,7 +29,6 @@ #include "ephy-gui.h" #include "ephy-debug.h" #include "ephy-langs.h" -#include "ephy-encodings.h" #include #include @@ -188,86 +187,6 @@ ephy_embed_utils_save (GtkWidget *window, g_free (target); } -/** - * ephy_embed_utils_build_encodings_submenu: - * @ui_component: the parent #BonoboUIComponent - * @path: the bonoboui path where to create the submenu. - * It's recommended to use a - * @fn: callback to report the selected encodings - * @data: the data passed to the callback - * - * Create a encoding submenu using bonobo ui. - **/ -void -ephy_embed_utils_build_encodings_submenu (BonoboUIComponent *ui_component, - const char *path, - BonoboUIVerbFn fn, - gpointer view) -{ - gchar *tmp, *verb; - GString *xml_string; - GList *groups, *gl, *encodings, *l; - GList *verbs = NULL; - - START_PROFILER ("Encodings menu") - - xml_string = g_string_new (NULL); - g_string_append (xml_string, ""); - - groups = ephy_lang_get_group_list (); - for (gl = groups; gl != NULL; gl = gl->next) - { - const EphyLanguageGroupInfo *lang_info = (EphyLanguageGroupInfo *) gl->data; - - tmp = g_strdup_printf ("\n", - lang_info->title, lang_info->group); - xml_string = g_string_append (xml_string, tmp); - g_free (tmp); - - encodings = ephy_encodings_get_list (lang_info->group, FALSE); - for (l = encodings; l != NULL; l = l->next) - { - const EphyEncodingInfo *info = (EphyEncodingInfo *) l->data; - - verb = g_strdup_printf ("Encoding%s", info->encoding); - tmp = g_strdup_printf ("\n", - info->title, verb, verb); - xml_string = g_string_append (xml_string, tmp); - - verbs = g_list_prepend (verbs, verb); - - g_free (tmp); - } - - g_list_foreach (encodings, (GFunc) ephy_encoding_info_free, NULL); - g_list_free (encodings); - - g_string_append (xml_string, ""); - } - - g_list_foreach (groups, (GFunc) ephy_lang_group_info_free, NULL); - g_list_free (groups); - - g_string_append (xml_string, ""); - - bonobo_ui_component_set_translate (ui_component, path, - xml_string->str, NULL); - - for (l = verbs; l != NULL; l = l->next) - { - bonobo_ui_component_add_verb (ui_component, - (const char *) l->data, - fn, view); - } - - g_list_foreach (verbs, (GFunc) g_free, NULL); - g_list_free (verbs); - - g_string_free (xml_string, TRUE); - - STOP_PROFILER ("Encodings menu") -} - /** * ephy_embed_utils_handlernotfound_dialog_run: * @parent: the dialog parent window -- cgit v1.2.3