summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/web-view.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/src/web-view.c b/src/web-view.c
index 93e9062..f4b6eab 100644
--- a/src/web-view.c
+++ b/src/web-view.c
@@ -29,6 +29,7 @@
#include <webkit2/webkit2.h>
#include "config.h"
+#include "notebook.h"
#include "tab-page.h"
struct _MqWebView {
@@ -69,9 +70,11 @@ static void
menu_open_link_tab_activate_cb(GtkAction G_GNUC_UNUSED *action,
MqWebView *web_view)
{
- /* TODO: Use MqNotebook function. */
- mq_tab_page_new(mq_tab_page_get_window(web_view->tab_page),
- webkit_hit_test_result_get_link_uri(web_view->hit_test_result));
+ mq_notebook_insert_child(
+ MQ_NOTEBOOK(gtk_widget_get_parent(
+ GTK_WIDGET(web_view->tab_page))),
+ webkit_hit_test_result_get_link_uri(web_view->hit_test_result),
+ web_view->tab_page);
}
static void
@@ -99,10 +102,11 @@ static void
menu_open_image_tab_activate_cb(GtkAction G_GNUC_UNUSED *action,
MqWebView *web_view)
{
- /* TODO: Use MqNotebook function. */
- mq_tab_page_new(mq_tab_page_get_window(web_view->tab_page),
- webkit_hit_test_result_get_image_uri(
- web_view->hit_test_result));
+ mq_notebook_insert_child(
+ MQ_NOTEBOOK(gtk_widget_get_parent(
+ GTK_WIDGET(web_view->tab_page))),
+ webkit_hit_test_result_get_image_uri(web_view->hit_test_result),
+ web_view->tab_page);
}
static void
@@ -130,10 +134,11 @@ static void
menu_open_video_tab_activate_cb(GtkAction G_GNUC_UNUSED *action,
MqWebView *web_view)
{
- /* TODO: Use MqNotebook function. */
- mq_tab_page_new(mq_tab_page_get_window(web_view->tab_page),
- webkit_hit_test_result_get_media_uri(
- web_view->hit_test_result));
+ mq_notebook_insert_child(
+ MQ_NOTEBOOK(gtk_widget_get_parent(
+ GTK_WIDGET(web_view->tab_page))),
+ webkit_hit_test_result_get_media_uri(web_view->hit_test_result),
+ web_view->tab_page);
}
static void
@@ -161,10 +166,11 @@ static void
menu_open_audio_tab_activate_cb(GtkAction G_GNUC_UNUSED *action,
MqWebView *web_view)
{
- /* TODO: Use MqNotebook function. */
- mq_tab_page_new(mq_tab_page_get_window(web_view->tab_page),
- webkit_hit_test_result_get_media_uri(
- web_view->hit_test_result));
+ mq_notebook_insert_child(
+ MQ_NOTEBOOK(gtk_widget_get_parent(
+ GTK_WIDGET(web_view->tab_page))),
+ webkit_hit_test_result_get_media_uri(web_view->hit_test_result),
+ web_view->tab_page);
}
static void
@@ -531,9 +537,11 @@ button_press_cb(GtkWidget *widget, GdkEventButton *event)
hit_test_result = web_view->mouse_target_hit_test_result;
if (webkit_hit_test_result_context_is_link(hit_test_result)) {
- /* TODO: Use MqNotebook function. */
- mq_tab_page_new(mq_tab_page_get_window(web_view->tab_page),
- webkit_hit_test_result_get_link_uri(hit_test_result));
+ mq_notebook_insert_child(
+ MQ_NOTEBOOK(gtk_widget_get_parent(
+ GTK_WIDGET(web_view->tab_page))),
+ webkit_hit_test_result_get_link_uri(hit_test_result),
+ web_view->tab_page);
} else if (webkit_hit_test_result_context_is_editable(hit_test_result)){
/* Let WebKit handle pasting from the primary clipboard into an
* editable element. */