diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tab-chrome.c | 62 | ||||
-rw-r--r-- | src/tab-chrome.h | 3 |
2 files changed, 36 insertions, 29 deletions
diff --git a/src/tab-chrome.c b/src/tab-chrome.c index 427d7b4..694b2b9 100644 --- a/src/tab-chrome.c +++ b/src/tab-chrome.c @@ -31,13 +31,13 @@ static void back_clicked_cb(GtkButton G_GNUC_UNUSED *toolbutton, MqTabChrome *chrome) { - webkit_web_view_go_back(chrome->web_view); + webkit_web_view_go_back(WEBKIT_WEB_VIEW(chrome->web_view)); } static void forward_clicked_cb(GtkButton G_GNUC_UNUSED *toolbutton, MqTabChrome *chrome) { - webkit_web_view_go_forward(chrome->web_view); + webkit_web_view_go_forward(WEBKIT_WEB_VIEW(chrome->web_view)); } static GtkWidget * @@ -93,9 +93,11 @@ static void back_forward_list_box_row_activated_cb(GtkListBox G_GNUC_UNUSED *box, GtkListBoxRow *row, MqTabChrome *chrome) { - webkit_web_view_go_to_back_forward_list_item(chrome->web_view, + webkit_web_view_go_to_back_forward_list_item( + WEBKIT_WEB_VIEW(chrome->web_view), webkit_back_forward_list_get_nth_item( - webkit_web_view_get_back_forward_list(chrome->web_view), + webkit_web_view_get_back_forward_list( + WEBKIT_WEB_VIEW(chrome->web_view)), gtk_list_box_row_get_index(row) - chrome->back_items)); gtk_widget_hide(chrome->back_forward_popover); @@ -142,7 +144,7 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event, /* Get the back/forward list for the Web view. */ back_forward_list = webkit_web_view_get_back_forward_list( - chrome->web_view); + WEBKIT_WEB_VIEW(chrome->web_view)); /* Set up the list box. */ list_box = gtk_list_box_new(); @@ -287,10 +289,10 @@ static void stop_reload_clicked_cb(GtkToolButton G_GNUC_UNUSED *toolbutton, MqTabChrome *chrome) { - if (webkit_web_view_is_loading(chrome->web_view)) { - webkit_web_view_stop_loading(chrome->web_view); + if (webkit_web_view_is_loading(WEBKIT_WEB_VIEW(chrome->web_view))) { + webkit_web_view_stop_loading(WEBKIT_WEB_VIEW(chrome->web_view)); } else { - webkit_web_view_reload(chrome->web_view); + webkit_web_view_reload(WEBKIT_WEB_VIEW(chrome->web_view)); } } @@ -301,7 +303,7 @@ uri_activate_cb(GtkEntry *entry, MqTabChrome *chrome) uri = gtk_entry_get_text(GTK_ENTRY(entry)); - mq_web_view_load_uri(MQ_WEB_VIEW(chrome->web_view), uri); + mq_web_view_load_uri(chrome->web_view, uri); } static void @@ -312,28 +314,30 @@ home_clicked_cb(GtkToolButton G_GNUC_UNUSED *toolbutton, uri = mq_config_get_string(chrome->config, "tabs.home"); - mq_web_view_load_uri(MQ_WEB_VIEW(chrome->web_view), uri); + mq_web_view_load_uri(chrome->web_view, uri); } static void zoom_out_clicked_cb(GtkButton G_GNUC_UNUSED *button, MqTabChrome *chrome) { - webkit_web_view_set_zoom_level(chrome->web_view, - webkit_web_view_get_zoom_level(chrome->web_view) - 0.1); + webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(chrome->web_view), + webkit_web_view_get_zoom_level( + WEBKIT_WEB_VIEW(chrome->web_view)) - 0.1); } static void zoom_reset_clicked_cb(GtkButton G_GNUC_UNUSED *button, MqTabChrome *chrome) { - webkit_web_view_set_zoom_level(chrome->web_view, + webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(chrome->web_view), mq_config_get_double(chrome->config, "zoom.default")); } static void zoom_in_clicked_cb(GtkButton G_GNUC_UNUSED *button, MqTabChrome *chrome) { - webkit_web_view_set_zoom_level(chrome->web_view, - webkit_web_view_get_zoom_level(chrome->web_view) + 0.1); + webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(chrome->web_view), + webkit_web_view_get_zoom_level( + WEBKIT_WEB_VIEW(chrome->web_view)) + 0.1); } static void @@ -356,7 +360,7 @@ static void developer_tools_clicked_cb(GtkButton G_GNUC_UNUSED *button, MqTabChrome *chrome) { webkit_web_inspector_show(webkit_web_view_get_inspector( - chrome->web_view)); + WEBKIT_WEB_VIEW(chrome->web_view))); gtk_widget_hide(chrome->menu_popover); } @@ -765,12 +769,12 @@ mq_tab_chrome_get_container(MqTabChrome *chrome) } static gchar * -web_view_get_uri(WebKitWebView *web_view) +web_view_get_uri(MqWebView *web_view) { const gchar *uri; gchar *rw_uri; - uri = webkit_web_view_get_uri(web_view); + uri = mq_web_view_get_uri(web_view); if (g_str_has_prefix(uri, "mq-about:")) { rw_uri = g_strconcat("about:", uri + strlen("mq-about:"), NULL); @@ -782,7 +786,7 @@ web_view_get_uri(WebKitWebView *web_view) } static void -load_changed_cb(WebKitWebView *web_view, WebKitLoadEvent load_event, +load_changed_cb(MqWebView *web_view, WebKitLoadEvent load_event, MqTabChrome *chrome) { gchar *uri; @@ -817,7 +821,7 @@ load_failed_cb(WebKitWebView G_GNUC_UNUSED *web_view, /* TODO: <Esc> key in URI bar should reset to URI of current hovered link, if * any, even if different from chrome->hovered_link_uri. */ static void -mouse_target_changed_cb(WebKitWebView G_GNUC_UNUSED *web_view, +mouse_target_changed_cb(MqWebView G_GNUC_UNUSED *web_view, WebKitHitTestResult *hit_test_result, guint G_GNUC_UNUSED modifiers, MqTabChrome *chrome) { @@ -895,7 +899,7 @@ load_progress_cb(WebKitWebView *web_view, GParamSpec G_GNUC_UNUSED *paramspec, } static void -uri_cb(WebKitWebView *web_view, GParamSpec G_GNUC_UNUSED *paramspec, +uri_cb(MqWebView *web_view, GParamSpec G_GNUC_UNUSED *paramspec, MqTabChrome *chrome) { gchar *uri; @@ -907,10 +911,10 @@ uri_cb(WebKitWebView *web_view, GParamSpec G_GNUC_UNUSED *paramspec, } static void -loading_cb(WebKitWebView *web_view, GParamSpec G_GNUC_UNUSED *paramspec, +loading_cb(MqWebView *web_view, GParamSpec G_GNUC_UNUSED *paramspec, MqTabChrome *chrome) { - if (webkit_web_view_is_loading(web_view)) { + if (webkit_web_view_is_loading(WEBKIT_WEB_VIEW(web_view))) { gtk_tool_button_set_icon_widget( GTK_TOOL_BUTTON(chrome->stop_reload_button), chrome->stop_icon); @@ -939,9 +943,11 @@ back_forward_list_changed_cb( gpointer G_GNUC_UNUSED items_removed, MqTabChrome *chrome) { gtk_widget_set_sensitive(GTK_WIDGET(chrome->back_button), - webkit_web_view_can_go_back(chrome->web_view)); + webkit_web_view_can_go_back( + WEBKIT_WEB_VIEW(chrome->web_view))); gtk_widget_set_sensitive(GTK_WIDGET(chrome->forward_button), - webkit_web_view_can_go_forward(chrome->web_view)); + webkit_web_view_can_go_forward( + WEBKIT_WEB_VIEW(chrome->web_view))); } static void @@ -984,8 +990,8 @@ connect_web_view(MqTabChrome *chrome) G_CALLBACK(uri_cb), chrome); g_signal_connect(chrome->web_view, "notify::is-loading", G_CALLBACK(loading_cb), chrome); - g_signal_connect( - webkit_web_view_get_back_forward_list(chrome->web_view), + g_signal_connect(webkit_web_view_get_back_forward_list( + WEBKIT_WEB_VIEW(chrome->web_view)), "changed", G_CALLBACK(back_forward_list_changed_cb), chrome); g_signal_connect(chrome->find_controller, "found-text", @@ -997,7 +1003,7 @@ connect_web_view(MqTabChrome *chrome) void mq_tab_chrome_set_web_view(MqTabChrome *chrome, WebKitWebView *web_view) { - chrome->web_view = web_view; + chrome->web_view = MQ_WEB_VIEW(web_view); chrome->find_controller = webkit_web_view_get_find_controller(web_view); connect_web_view(chrome); } diff --git a/src/tab-chrome.h b/src/tab-chrome.h index f3bf883..2ec5139 100644 --- a/src/tab-chrome.h +++ b/src/tab-chrome.h @@ -28,6 +28,7 @@ typedef struct MqTabChrome MqTabChrome; #include <webkit2/webkit2.h> #include "tab.h" +#include "web-view.h" struct MqTabChrome { MqConfig *config; @@ -47,7 +48,7 @@ struct MqTabChrome { GtkWidget *find_matches_label; gboolean find_match_case; gboolean find_searching; - WebKitWebView *web_view; + MqWebView *web_view; WebKitFindController *find_controller; gboolean load_failed; GtkWidget *back_forward_popover; |