summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-10-18 00:23:14 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-10-18 00:26:12 (EDT)
commit748f2e2c0f3b5df9c9c55b322723c863b253a5a4 (patch)
tree9388e5249559c339191ed4261a97b0ed15ba5d1a
parent80bbf932e7eee44e7b5fa327731589d1c676e0ac (diff)
downloadmarquee-748f2e2c0f3b5df9c9c55b322723c863b253a5a4.zip
marquee-748f2e2c0f3b5df9c9c55b322723c863b253a5a4.tar.gz
marquee-748f2e2c0f3b5df9c9c55b322723c863b253a5a4.tar.bz2
MqWebView: Use MqTabPage
-rw-r--r--src/web-view.c63
-rw-r--r--src/web-view.h2
2 files changed, 35 insertions, 30 deletions
diff --git a/src/web-view.c b/src/web-view.c
index ca8e98d..b498232 100644
--- a/src/web-view.c
+++ b/src/web-view.c
@@ -29,11 +29,11 @@
#include <webkit2/webkit2.h>
#include "config.h"
-#include "tab.h"
+#include "tab-page.h"
struct _MqWebView {
WebKitWebView parent_instance;
- MqTab *tab;
+ MqTabPage *tab_page;
gchar *uri;
MqConfig *config;
WebKitHitTestResult *hit_test_result;
@@ -41,7 +41,7 @@ struct _MqWebView {
};
enum {
- PROP_TAB = 1,
+ PROP_TAB_PAGE = 1,
PROP_REWRITTEN_URI,
N_PROPERTIES
};
@@ -69,9 +69,9 @@ static void
menu_open_link_tab_activate_cb(GtkAction G_GNUC_UNUSED *action,
MqWebView *web_view)
{
- mq_tab_new_relative(
+ mq_tab_page_new_relative(
webkit_hit_test_result_get_link_uri(web_view->hit_test_result),
- web_view->tab);
+ web_view->tab_page);
}
static void
@@ -82,7 +82,8 @@ menu_open_link_win_activate_cb(GtkAction G_GNUC_UNUSED *action,
webkit_hit_test_result_get_link_uri(web_view->hit_test_result),
NULL
};
- mq_application_add_window(mq_tab_get_application(web_view->tab), uris);
+ mq_application_add_window(
+ mq_tab_page_get_application(web_view->tab_page), uris);
}
static void
@@ -98,9 +99,9 @@ static void
menu_open_image_tab_activate_cb(GtkAction G_GNUC_UNUSED *action,
MqWebView *web_view)
{
- mq_tab_new_relative(
+ mq_tab_page_new_relative(
webkit_hit_test_result_get_image_uri(web_view->hit_test_result),
- web_view->tab);
+ web_view->tab_page);
}
static void
@@ -111,7 +112,8 @@ menu_open_image_win_activate_cb(GtkAction G_GNUC_UNUSED *action,
webkit_hit_test_result_get_image_uri(web_view->hit_test_result),
NULL
};
- mq_application_add_window(mq_tab_get_application(web_view->tab), uris);
+ mq_application_add_window(
+ mq_tab_page_get_application(web_view->tab_page), uris);
}
static void
@@ -127,9 +129,9 @@ static void
menu_open_video_tab_activate_cb(GtkAction G_GNUC_UNUSED *action,
MqWebView *web_view)
{
- mq_tab_new_relative(
+ mq_tab_page_new_relative(
webkit_hit_test_result_get_media_uri(web_view->hit_test_result),
- web_view->tab);
+ web_view->tab_page);
}
static void
@@ -140,7 +142,8 @@ menu_open_video_win_activate_cb(GtkAction G_GNUC_UNUSED *action,
webkit_hit_test_result_get_media_uri(web_view->hit_test_result),
NULL
};
- mq_application_add_window(mq_tab_get_application(web_view->tab), uris);
+ mq_application_add_window(
+ mq_tab_page_get_application(web_view->tab_page), uris);
}
static void
@@ -156,9 +159,9 @@ static void
menu_open_audio_tab_activate_cb(GtkAction G_GNUC_UNUSED *action,
MqWebView *web_view)
{
- mq_tab_new_relative(
+ mq_tab_page_new_relative(
webkit_hit_test_result_get_media_uri(web_view->hit_test_result),
- web_view->tab);
+ web_view->tab_page);
}
static void
@@ -169,7 +172,8 @@ menu_open_audio_win_activate_cb(GtkAction G_GNUC_UNUSED *action,
webkit_hit_test_result_get_media_uri(web_view->hit_test_result),
NULL
};
- mq_application_add_window(mq_tab_get_application(web_view->tab), uris);
+ mq_application_add_window(
+ mq_tab_page_get_application(web_view->tab_page), uris);
}
#define ITEM_DECLS \
@@ -524,9 +528,9 @@ 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)) {
- mq_tab_new_relative(
+ mq_tab_page_new_relative(
webkit_hit_test_result_get_link_uri(hit_test_result),
- web_view->tab);
+ 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. */
@@ -558,11 +562,11 @@ constructed(GObject *object)
web_view = MQ_WEB_VIEW(object);
web_view->config = mq_application_get_config(
- mq_tab_get_application(web_view->tab));
+ mq_tab_page_get_application(web_view->tab_page));
webkit_web_view_set_settings(WEBKIT_WEB_VIEW(web_view),
mq_application_get_webkit_settings(
- mq_tab_get_application(web_view->tab)));
+ mq_tab_page_get_application(web_view->tab_page)));
if (web_view->uri) {
if (g_str_has_prefix(web_view->uri, "about:")) {
@@ -617,8 +621,8 @@ get_property(GObject *object, guint property_id, GValue *value,
web_view = MQ_WEB_VIEW(object);
switch (property_id) {
- case PROP_TAB:
- g_value_set_pointer(value, web_view->tab);
+ case PROP_TAB_PAGE:
+ g_value_set_pointer(value, web_view->tab_page);
break;
case PROP_REWRITTEN_URI:
g_value_set_string(value, web_view->uri);
@@ -639,8 +643,8 @@ set_property(GObject *object, guint property_id, const GValue *value,
web_view = MQ_WEB_VIEW(object);
switch (property_id) {
- case PROP_TAB:
- web_view->tab = g_value_get_pointer(value);
+ case PROP_TAB_PAGE:
+ web_view->tab_page = g_value_get_pointer(value);
break;
case PROP_REWRITTEN_URI:
mq_web_view_load_uri(web_view,
@@ -663,10 +667,11 @@ mq_web_view_class_init(MqWebViewClass *klass)
object_class->get_property = get_property;
object_class->set_property = set_property;
- obj_properties[PROP_TAB] = g_param_spec_pointer(
- "tab",
- "MqTab",
- "The parent MqTab instance",
+ obj_properties[PROP_TAB_PAGE] = g_param_spec_object(
+ "tab-page",
+ "MqTabPage",
+ "The parent MqTabPage instance",
+ MQ_TYPE_TAB_PAGE,
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB);
obj_properties[PROP_REWRITTEN_URI] = g_param_spec_string(
@@ -697,10 +702,10 @@ mq_web_view_init(MqWebView *web_view)
}
MqWebView *
-mq_web_view_new(MqTab *tab, const gchar *uri)
+mq_web_view_new(MqTabPage *tab_page, const gchar *uri)
{
return g_object_new(MQ_TYPE_WEB_VIEW,
- "tab", tab, /* TODO: Use gtk_widget_get_parent() instead? */
+ "tab-page", tab_page, /* TODO: Use gtk_widget_get_parent()? */
"rewritten-uri", uri,
"web-context", webkit_web_context_get_default(),
NULL);
diff --git a/src/web-view.h b/src/web-view.h
index 6724652..36e87d1 100644
--- a/src/web-view.h
+++ b/src/web-view.h
@@ -49,7 +49,7 @@ GType
mq_web_view_get_type(void);
MqWebView *
-mq_web_view_new(MqTab *tab, const gchar *uri);
+mq_web_view_new(MqTabPage *tab_page, const gchar *uri);
const gchar *
mq_web_view_get_uri(MqWebView *web_view);