diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-10-31 02:19:11 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-10-31 02:19:11 (EDT) |
commit | a678c7f38c7798dd215194cca42e0916577b9340 (patch) | |
tree | cd8d389a78072764fc97bfa573c61822a4e7dfcb /src/web-view-schemes | |
parent | 0e0431879a2ed0eadd36e3823a7dcbebfc28abbe (diff) | |
download | marquee-a678c7f38c7798dd215194cca42e0916577b9340.zip marquee-a678c7f38c7798dd215194cca42e0916577b9340.tar.gz marquee-a678c7f38c7798dd215194cca42e0916577b9340.tar.bz2 |
mq_web_view_normal_scheme_methods.context_menu(): Add "View Page So_urce" item
Diffstat (limited to 'src/web-view-schemes')
-rw-r--r-- | src/web-view-schemes/normal.c | 20 |
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) \ |