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 10 commits
Commits
File filter

Filter by extension

Filter by extension

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

GP_CHECK_GTK3([webkit_package=webkitgtk-3.0],
[webkit_package=webkit-1.0])
GP_CHECK_GTK3([webkit_package=webkit2gtk-4.0],
[webkit_package=webkit2gtk-4.0])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same that with WebHelper, webkit2gtk-4.0 is wrong for GTK2


GP_CHECK_PLUGIN_DEPS([markdown], [MARKDOWN],
[$GP_GTK_PACKAGE >= ${GTK_VERSION}
Expand Down
4 changes: 2 additions & 2 deletions build/webhelper.m4
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ AC_DEFUN([GP_CHECK_WEBHELPER],
fi
fi

GP_CHECK_GTK3([webkit_package=webkitgtk-3.0],
[webkit_package=webkit-1.0])
GP_CHECK_GTK3([webkit_package=webkit2gtk-4.0],
[webkit_package=webkit2gtk-4.0])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's wrong, webkit2gtk-4.0 don't work with GTK2

GP_CHECK_PLUGIN_DEPS([WebHelper], [WEBHELPER],
[$GP_GTK_PACKAGE >= ${GTK_VERSION}
glib-2.0 >= ${GLIB_VERSION}
Expand Down
17 changes: 8 additions & 9 deletions markdown/src/viewer.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include <webkit/webkitwebview.h>
#include <webkit2/webkit2.h>
#include <geanyplugin.h>
#ifndef FULL_PRICE
# include <mkdio.h>
Expand Down Expand Up @@ -297,15 +297,15 @@ pop_scroll_pos(MarkdownViewer *self)
}

static void
on_webview_load_status_notify(WebKitWebView *view, GParamSpec *pspec,
on_webview_is_loading_notify(WebKitWebView *view, GParamSpec *pspec,
MarkdownViewer *self)
{
WebKitLoadStatus load_status;
gboolean load_status;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, instead of using this boolean, to look for WEBKIT_LOAD_FINISHED?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks. Looks like I missed that signal while looking through the docs.


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

/* When the webkit is done loading, reset the scroll position. */
if (load_status == WEBKIT_LOAD_FINISHED) {
if (!load_status) {
pop_scroll_pos(self);
}
}
Expand Down Expand Up @@ -389,12 +389,11 @@ 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::load-status",
G_CALLBACK(on_webview_load_status_notify), self);
g_signal_connect_swapped(WEBKIT_WEB_VIEW(self), "notify::is-loading",
G_CALLBACK(on_webview_is_loading_notify), self);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of the property notification, maybe it should use load-changed?

}

webkit_web_view_load_string(WEBKIT_WEB_VIEW(self), html, "text/html",
self->priv->enc, base_uri);
webkit_web_view_load_html(WEBKIT_WEB_VIEW(self), html, base_uri);

g_free(base_uri);
g_free(html);
Expand Down
2 changes: 1 addition & 1 deletion markdown/src/viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define MARKDOWN_VIEWER_H 1

#include <gtk/gtk.h>
#include <webkit/webkitwebview.h>
#include <webkit2/webkit2.h>

G_BEGIN_DECLS

Expand Down
3 changes: 2 additions & 1 deletion webhelper/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ webhelper_la_CPPFLAGS = $(AM_CPPFLAGS) \
webhelper_la_CFLAGS = $(AM_CFLAGS) \
$(WEBHELPER_CFLAGS)
webhelper_la_LIBADD = $(COMMONLIBS) \
$(WEBHELPER_LIBS)
$(WEBHELPER_LIBS) \
-lm

# These are generated in $(srcdir) because they are part of the distribution,
# and should anyway only be regenerated if the .tpl changes, which is a
Expand Down
Loading