]> spindle.queued.net Git - midori/commitdiff
Add Encoding menu to the context menu
authorChristian Dywan <christian@twotoasts.de>
Mon, 22 Jun 2009 20:18:16 +0000 (22:18 +0200)
committerChristian Dywan <christian@twotoasts.de>
Mon, 22 Jun 2009 20:18:16 +0000 (22:18 +0200)
midori/midori-view.c

index 5ee834149eeed580c2f18b6f05ed1a8b776ec81e..c7fa4d16f183aa224f5ef1f4de1c37b77601fb01 100644 (file)
@@ -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);