summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-10-11 22:12:36 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-10-11 23:15:57 (EDT)
commit57c2867ef748fcc32fc7773223b651b0fc8fd345 (patch)
tree976cbe3bc63ddb9ea565991271e9c2d9524328d3
parent1332804b4d020dc02249b29f5b6dc1fe14d1626c (diff)
downloadmarquee-57c2867ef748fcc32fc7773223b651b0fc8fd345.zip
marquee-57c2867ef748fcc32fc7773223b651b0fc8fd345.tar.gz
marquee-57c2867ef748fcc32fc7773223b651b0fc8fd345.tar.bz2
MqWebView: Use g_signal_connect()
-rw-r--r--src/web-view.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/web-view.c b/src/web-view.c
index f9ead49..4e686cc 100644
--- a/src/web-view.c
+++ b/src/web-view.c
@@ -345,8 +345,8 @@ context_menu_document_cb(WebKitContextMenu *context_menu, GList *nav_items,
} while (0)
static gboolean
-context_menu(WebKitWebView *wk_web_view, WebKitContextMenu *context_menu,
- GdkEvent *event, WebKitHitTestResult *hit_test_result)
+context_menu_cb(WebKitWebView *wk_web_view, WebKitContextMenu *context_menu,
+ GdkEvent G_GNUC_UNUSED *event, WebKitHitTestResult *hit_test_result)
{
MqWebView *web_view;
GList *items;
@@ -499,8 +499,7 @@ context_menu(WebKitWebView *wk_web_view, WebKitContextMenu *context_menu,
}
/* Propagate the event further and show the context menu. */
- return PARENT_CLASS->context_menu(WEBKIT_WEB_VIEW(web_view),
- context_menu, event, hit_test_result);
+ return FALSE;
}
static void
@@ -515,7 +514,7 @@ clipboard_text_recv_cb(GtkClipboard G_GNUC_UNUSED *clipboard,
* API provided webkit_web_view_get_hit_test_result() which would have been
* easier. */
static void
-mouse_target_changed(WebKitWebView *wk_web_view,
+mouse_target_changed_cb(WebKitWebView *wk_web_view,
WebKitHitTestResult *hit_test_result, guint G_GNUC_UNUSED modifiers)
{
MqWebView *web_view;
@@ -527,7 +526,7 @@ mouse_target_changed(WebKitWebView *wk_web_view,
}
static gboolean
-button_press_event(GtkWidget *widget, GdkEventButton *event)
+button_press_cb(GtkWidget *widget, GdkEventButton *event)
{
MqWebView *web_view;
WebKitHitTestResult *hit_test_result;
@@ -537,8 +536,7 @@ button_press_event(GtkWidget *widget, GdkEventButton *event)
/* Make sure this is a middle mouse button press event. */
if (event->button != 2) {
- return GTK_WIDGET_CLASS(mq_web_view_parent_class)->
- button_press_event(widget, event);
+ return FALSE;
}
hit_test_result = web_view->mouse_target_hit_test_result;
@@ -551,8 +549,7 @@ button_press_event(GtkWidget *widget, GdkEventButton *event)
/* Let WebKit handle pasting from the primary clipboard into an
* editable element. */
g_object_unref(hit_test_result);
- return GTK_WIDGET_CLASS(mq_web_view_parent_class)->
- button_press_event(widget, event);
+ return FALSE;
} else {
clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
gtk_clipboard_request_text(clipboard,
@@ -622,15 +619,11 @@ constructed(GObject *object)
static void
mq_web_view_class_init(MqWebViewClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS(klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
- object_class->constructed = constructed;
- object_class->get_property = get_property;
- object_class->set_property = set_property;
- widget_class->button_press_event = button_press_event;
- PARENT_CLASS->context_menu = context_menu;
- PARENT_CLASS->mouse_target_changed = mouse_target_changed;
+ object_class->constructed = constructed;
+ object_class->get_property = get_property;
+ object_class->set_property = set_property;
obj_properties[PROP_TAB] = g_param_spec_pointer(
"tab", "MqTab", "Parent MqTab instance",
@@ -649,6 +642,13 @@ static void
mq_web_view_init(MqWebView *web_view)
{
web_view->hit_test_result = NULL;
+
+ g_signal_connect(web_view, "context-menu",
+ G_CALLBACK(context_menu_cb), NULL);
+ g_signal_connect(web_view, "mouse-target-changed",
+ G_CALLBACK(mouse_target_changed_cb), NULL);
+ g_signal_connect(web_view, "button-press-event",
+ G_CALLBACK(button_press_cb), NULL);
}
MqWebView *