From a678c7f38c7798dd215194cca42e0916577b9340 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Tue, 31 Oct 2017 02:19:11 -0400 Subject: mq_web_view_normal_scheme_methods.context_menu(): Add "View Page So_urce" item --- (limited to 'src/web-view-schemes/normal.c') diff --git a/src/web-view-schemes/normal.c b/src/web-view-schemes/normal.c index 5641a9c..84ecb50 100644 --- a/src/web-view-schemes/normal.c +++ b/src/web-view-schemes/normal.c @@ -21,6 +21,7 @@ #include "schemes.h" +#include #include #include @@ -248,6 +249,21 @@ menu_open_audio_win_activate_cb(GtkAction G_GNUC_UNUSED *action, uris); } +static void +menu_view_source_activate_cb(GtkAction G_GNUC_UNUSED *action, + MqWebView *web_view) +{ + mq_notebook_insert_child( + MQ_NOTEBOOK(gtk_widget_get_parent(GTK_WIDGET( + mq_web_view_get_tab_page(web_view)))), + g_strdup_printf("view-source:origin-tab=%" PRId64 "&uri=%s", + mq_tab_page_get_id(mq_web_view_get_tab_page(web_view)), + mq_web_view_get_uri(web_view)), + mq_web_view_get_tab_page(web_view), + !mq_config_get_boolean(mq_web_view_get_config(web_view), + "tabs.background")); +} + #define ITEM_DECLS \ GtkAction *action; \ WebKitContextMenuItem *menu_item; @@ -363,13 +379,13 @@ static void context_menu_document_cb(WebKitContextMenu *context_menu, GList *nav_items, MqWebView G_GNUC_UNUSED *web_view) { - ITEM_DECLS_NO_CUSTOM + ITEM_DECLS RESTORE_ITEMS(nav_items); /* _Back, _Forward, _Stop, _Reload */ NEW_SEPARATOR_ITEM(); /* --- */ NEW_STOCK_ITEM(SELECT_ALL); /* Select _All */ NEW_SEPARATOR_ITEM(); /* --- */ - /* TODO: View Page Source */ + NEW_CUSTOM_ITEM(view_source, "View Page So_urce"); } #define PRESERVE_ITEM(ITEMS) \ -- cgit v0.9.1