From eb98806722b272b136b8ce211256996820d21c29 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Mon, 22 Jun 2009 22:18:16 +0200 Subject: [PATCH] Add Encoding menu to the context menu --- midori/midori-view.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/midori/midori-view.c b/midori/midori-view.c index 5ee83414..c7fa4d16 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -1322,6 +1322,34 @@ webkit_web_view_populate_popup_cb (WebKitWebView* web_view, gtk_action_group_get_action (actions, "ZoomNormal")); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + menuitem = sokoke_action_create_popup_menu_item ( + gtk_action_group_get_action (actions, "Encoding")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + if (GTK_WIDGET_IS_SENSITIVE (menuitem)) + { + GtkWidget* sub_menu; + static const GtkActionEntry encodings[] = { + { "EncodingAutomatic" }, + { "EncodingChinese" }, + { "EncodingJapanese" }, + { "EncodingRussian" }, + { "EncodingUnicode" }, + { "EncodingWestern" }, + { "EncodingCustom" }, + }; + guint i; + + sub_menu = gtk_menu_new (); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), sub_menu); + + for (i = 0; i < G_N_ELEMENTS (encodings); i++) + { + menuitem = sokoke_action_create_popup_menu_item ( + gtk_action_group_get_action (actions, encodings[i].name)); + gtk_menu_shell_append (GTK_MENU_SHELL (sub_menu), menuitem); + } + } + menuitem = gtk_separator_menu_item_new (); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_widget_show (menuitem); -- 2.39.5