summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/web-view-schemes/normal.c20
1 files changed, 18 insertions, 2 deletions
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 <inttypes.h>
#include <string.h>
#include <glib.h>
@@ -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) \