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. --- src/ephy-window.c | 94 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 73 insertions(+), 21 deletions(-) (limited to 'src/ephy-window.c') diff --git a/src/ephy-window.c b/src/ephy-window.c index 5462ae72e..c36a1c541 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti + * Copyright (C) 2000, 2001, 2002, 2003 Marco Pesenti Gritti * * 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 @@ -19,7 +19,7 @@ */ #ifdef HAVE_CONFIG_H -#include +#include "config.h" #endif #include "ephy-window.h" @@ -139,7 +139,9 @@ static GtkActionEntry ephy_menu_entries [] = { { "ViewZoomNormal", GTK_STOCK_ZOOM_100, N_("_Normal Size"), NULL, N_("Use the normal text size"), G_CALLBACK (window_cmd_view_zoom_normal) }, - { "ViewEncoding", NULL, N_("_Encoding") }, + { "ViewEncoding", NULL, N_("Text _Encoding"), NULL, + N_("Change the text encoding"), + NULL }, { "ViewPageSource", EPHY_STOCK_VIEWSOURCE, N_("_Page Source"), "U", N_("View the source code of the page"), G_CALLBACK (window_cmd_view_page_source) }, @@ -304,6 +306,12 @@ ephy_window_notebook_switch_page_cb (GtkNotebook *notebook, guint page_num, EphyWindow *window); +enum +{ + PROP_0, + PROP_ACTIVE_TAB +}; + static GObjectClass *parent_class = NULL; GType @@ -367,24 +375,6 @@ ephy_window_destroy (GtkObject *gtkobject) GTK_OBJECT_CLASS (parent_class)->destroy (gtkobject); } -static void -ephy_window_class_init (EphyWindowClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->finalize = ephy_window_finalize; - - widget_class->show = ephy_window_show; - - gtkobject_class->destroy = ephy_window_destroy; - - g_type_class_add_private (object_class, sizeof(EphyWindowPrivate)); -} - static void ephy_window_selection_received_cb (GtkWidget *widget, GtkSelectionData *selection_data, @@ -1184,6 +1174,8 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab) action = GTK_TOGGLE_ACTION (ephy_tab_get_action (new_tab)); gtk_toggle_action_set_active (action, TRUE); + + g_object_notify (G_OBJECT (window), "active-tab"); } } @@ -1311,6 +1303,66 @@ setup_notebook (EphyWindow *window) return notebook; } +static void +ephy_window_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + EphyWindow *window = EPHY_WINDOW (object); + + switch (prop_id) + { + case PROP_ACTIVE_TAB: + ephy_window_set_active_tab (window, g_value_get_object (value)); + break; + } +} + +static void +ephy_window_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + EphyWindow *window = EPHY_WINDOW (object); + + switch (prop_id) + { + case PROP_ACTIVE_TAB: + g_value_set_object (value, window->priv->active_tab); + break; + } +} + +static void +ephy_window_class_init (EphyWindowClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = ephy_window_finalize; + object_class->get_property = ephy_window_get_property; + object_class->set_property = ephy_window_set_property; + + gtkobject_class->destroy = ephy_window_destroy; + + widget_class->show = ephy_window_show; + + g_object_class_install_property (object_class, + PROP_ACTIVE_TAB, + g_param_spec_object ("active-tab", + "active-tab", + "Active tab", + EPHY_TYPE_TAB, + G_PARAM_READWRITE)); + + g_type_class_add_private (object_class, sizeof(EphyWindowPrivate)); +} + static void ephy_window_init (EphyWindow *window) { -- cgit v1.2.3