Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port both webhelper and markdown to webkit2gtk #677

Merged
merged 16 commits into from May 30, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions build/markdown.m4
Expand Up @@ -49,12 +49,10 @@ AC_DEFUN([GP_CHECK_MARKDOWN],
GTK_VERSION=2.16
WEBKIT_VERSION=1.1.13

GP_CHECK_GTK3([webkit_package=webkit2gtk-4.0],
[webkit_package=webkit2gtk-4.0])

GP_CHECK_PLUGIN_GTK3_ONLY([markdown])
GP_CHECK_PLUGIN_DEPS([markdown], [MARKDOWN],
[$GP_GTK_PACKAGE >= ${GTK_VERSION}
$webkit_package >= ${WEBKIT_VERSION}
webkit2gtk-4.0 >= ${WEBKIT_VERSION}
gthread-2.0])

GP_COMMIT_PLUGIN_STATUS([Markdown])
Expand Down
5 changes: 2 additions & 3 deletions build/webhelper.m4
Expand Up @@ -19,14 +19,13 @@ AC_DEFUN([GP_CHECK_WEBHELPER],
fi
fi

GP_CHECK_GTK3([webkit_package=webkit2gtk-4.0],
[webkit_package=webkit2gtk-4.0])
GP_CHECK_PLUGIN_GTK3_ONLY([webhelper])
GP_CHECK_PLUGIN_DEPS([WebHelper], [WEBHELPER],
[$GP_GTK_PACKAGE >= ${GTK_VERSION}
glib-2.0 >= ${GLIB_VERSION}
gio-2.0 >= ${GIO_VERSION}
gdk-pixbuf-2.0 >= ${GDK_PIXBUF_VERSION}
$webkit_package >= ${WEBKIT_VERSION}
webkit2gtk-4.0 >= ${WEBKIT_VERSION}
gthread-2.0])


Expand Down
15 changes: 6 additions & 9 deletions markdown/src/viewer.c
Expand Up @@ -297,15 +297,12 @@ pop_scroll_pos(MarkdownViewer *self)
}

static void
on_webview_is_loading_notify(WebKitWebView *view, GParamSpec *pspec,
MarkdownViewer *self)
on_webview_load_changed(MarkdownViewer *self,
WebKitLoadEvent load_event,
WebKitWebView *web_view)
{
gboolean load_status;

g_object_get(view, "is-loading", &load_status, NULL);

/* When the webkit is done loading, reset the scroll position. */
if (!load_status) {
if (load_event == WEBKIT_LOAD_FINISHED) {
pop_scroll_pos(self);
}
}
Expand Down Expand Up @@ -389,8 +386,8 @@ markdown_viewer_update_view(MarkdownViewer *self)
* position once the webview is reloaded. */
if (self->priv->load_handle == 0) {
self->priv->load_handle =
g_signal_connect_swapped(WEBKIT_WEB_VIEW(self), "notify::is-loading",
G_CALLBACK(on_webview_is_loading_notify), self);
g_signal_connect_swapped(WEBKIT_WEB_VIEW(self), "load-changed",
G_CALLBACK(on_webview_load_changed), self);
}

webkit_web_view_load_html(WEBKIT_WEB_VIEW(self), html, base_uri);
Expand Down