&& !webkit_web_view_can_paste_clipboard (WEBKIT_WEB_VIEW (focus)))
{
/* Space at the bottom of the page: Go to next page */
+ MidoriView* view = midori_view_get_for_widget (focus);
GtkScrolledWindow* scrolled = GTK_SCROLLED_WINDOW (gtk_widget_get_parent (focus));
- MidoriView* view = MIDORI_VIEW (gtk_widget_get_parent (GTK_WIDGET (scrolled)));
GtkAdjustment* vadjust = gtk_scrolled_window_get_vadjustment (scrolled);
if (gtk_adjustment_get_value (vadjust)
== (gtk_adjustment_get_upper (vadjust) - gtk_adjustment_get_page_size (vadjust)))
webkit_web_view_web_view_ready_cb (GtkWidget* web_view,
MidoriView* view)
{
- #if GTK_CHECK_VERSION(3, 2, 0)
- GtkWidget* new_view = gtk_widget_get_parent (gtk_widget_get_parent (gtk_widget_get_parent (web_view)));
- #else
- GtkWidget* new_view = gtk_widget_get_parent (gtk_widget_get_parent (web_view));
- #endif
MidoriNewView where = MIDORI_NEW_VIEW_TAB;
+ GtkWidget* new_view = GTK_WIDGET (midori_view_get_for_widget (web_view));
/* FIXME: Open windows opened by scripts in tabs if they otherwise
would be replacing the page the user opened. */
return view->web_view;
}
+/**
+ * midori_view_get_for_widget:
+ * @widget: a #GtkWidget
+ *
+ * Determines the view appropriate for the specified widget.
+ *
+ * Return value: a #MidoriView
+ *
+ * Since 0.4.5
+ **/
+MidoriView*
+midori_view_get_for_widget (GtkWidget* web_view)
+{
+ GtkWidget* scrolled = gtk_widget_get_parent (web_view);
+ #if GTK_CHECK_VERSION(3, 2, 0)
+ GtkWidget* overlay = gtk_widget_get_parent (scrolled);
+ GtkWidget* view = gtk_widget_get_parent (overlay);
+ #else
+ GtkWidget* view = gtk_widget_get_parent (scrolled);
+ #endif
+ return MIDORI_VIEW (view);
+}
+
/**
* midori_view_get_security
* @view: a #MidoriView