[shotwell] Port to webkit2gtk-4.0
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell] Port to webkit2gtk-4.0
- Date: Tue, 8 Dec 2015 16:42:42 +0000 (UTC)
commit 3ae27fc3f41ceb7820f365244e6ae6a4dc65fcaa
Author: Iain Lane <iain orangesquash org uk>
Date: Tue Jun 30 10:43:15 2015 +0100
Port to webkit2gtk-4.0
https://bugzilla.gnome.org/show_bug.cgi?id=751709
Makefile | 8 +-
debian/control | 2 +-
plugins/common/RESTSupport.vala | 24 +-
plugins/shotwell-publishing-extras/Makefile | 2 +-
.../YandexPublishing.vala | 73 ++-
.../shotwell-publishing/FacebookPublishing.vala | 36 +-
plugins/shotwell-publishing/Makefile | 2 +-
vapi/webkitgtk-3.0.deps | 8 -
vapi/webkitgtk-3.0.vapi | 653 --------------------
9 files changed, 100 insertions(+), 708 deletions(-)
---
diff --git a/Makefile b/Makefile
index fe354a7..1ce5668 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ VALAC := $(shell which $(VALAC))
endif
VALAC_VERSION := `$(VALAC) --version | awk '{print $$2}'`
-MIN_VALAC_VERSION := 0.20.1
+MIN_VALAC_VERSION := 0.28.0
INSTALL_PROGRAM := install
INSTALL_DATA := install -m 644
@@ -120,12 +120,10 @@ VAPI_FILES = \
LConv.vapi \
libexif.vapi \
libraw.vapi \
- webkitgtk-3.0.vapi \
unique-3.0.vapi \
unity.vapi
DEPS_FILES = \
- webkitgtk-3.0.deps \
unique-3.0.deps \
unity.deps
@@ -271,7 +269,7 @@ EXT_PKGS = \
libsoup-2.4 \
libxml-2.0 \
sqlite3 \
- webkitgtk-3.0
+ webkit2gtk-4.0
ifdef UNITY_SUPPORT
EXT_PKGS += unity
endif
@@ -303,7 +301,7 @@ EXT_PKG_VERSIONS = \
libxml-2.0 >= 2.6.32 \
rest-0.7 >= 0.7 \
sqlite3 >= 3.5.9 \
- webkitgtk-3.0 >= 1.4.0 \
+ webkit2gtk-4.0 \
gnome-doc-utils
DIRECT_LIBS_VERSIONS =
diff --git a/debian/control b/debian/control
index 2b72a69..99b278a 100644
--- a/debian/control
+++ b/debian/control
@@ -20,7 +20,7 @@ Build-Depends: debhelper (>= 7),
libsoup2.4-dev (>= 2.26.0),
libsqlite3-dev (>= 3.5.9),
libunity-dev (>= 5.10.0),
- libwebkitgtk-3.0-dev (>= 1.4.3),
+ libwebkit2gtk-4.0-dev,
libxml2 (>= 2.6.32),
m4 (>= 1.4.13),
valac (>= 0.20.1),
diff --git a/plugins/common/RESTSupport.vala b/plugins/common/RESTSupport.vala
index fdde409..a4a0621 100644
--- a/plugins/common/RESTSupport.vala
+++ b/plugins/common/RESTSupport.vala
@@ -741,10 +741,9 @@ public abstract class GooglePublisher : Object, Spit.Publishing.Publisher {
webview = new WebKit.WebView();
webview.get_settings().enable_plugins = false;
- webview.get_settings().enable_default_context_menu = false;
- webview.load_finished.connect(on_page_load);
- webview.load_started.connect(on_load_started);
+ webview.load_changed.connect(on_page_load_changed);
+ webview.context_menu.connect(() => { return false; });
webview_frame.add(webview);
pane_widget.pack_start(webview_frame, true, true, 0);
@@ -754,7 +753,7 @@ public abstract class GooglePublisher : Object, Spit.Publishing.Publisher {
return cache_dirty;
}
- private void on_page_load(WebKit.WebFrame origin_frame) {
+ private void on_page_load() {
pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.LEFT_PTR));
string page_title = webview.get_title();
@@ -772,9 +771,22 @@ public abstract class GooglePublisher : Object, Spit.Publishing.Publisher {
}
}
- private void on_load_started(WebKit.WebFrame frame) {
+ private void on_load_started() {
pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.WATCH));
}
+
+ private void on_page_load_changed (WebKit.LoadEvent load_event) {
+ switch (load_event) {
+ case WebKit.LoadEvent.STARTED:
+ on_load_started();
+ break;
+ case WebKit.LoadEvent.FINISHED:
+ on_page_load();
+ break;
+ }
+
+ return;
+ }
public Spit.Publishing.DialogPane.GeometryOptions get_preferred_geometry() {
return Spit.Publishing.DialogPane.GeometryOptions.NONE;
@@ -785,7 +797,7 @@ public abstract class GooglePublisher : Object, Spit.Publishing.Publisher {
}
public void on_pane_installed() {
- webview.open(auth_sequence_start_url);
+ webview.load_uri(auth_sequence_start_url);
}
public void on_pane_uninstalled() {
diff --git a/plugins/shotwell-publishing-extras/Makefile b/plugins/shotwell-publishing-extras/Makefile
index 9259fbb..91452cf 100644
--- a/plugins/shotwell-publishing-extras/Makefile
+++ b/plugins/shotwell-publishing-extras/Makefile
@@ -5,7 +5,7 @@ PLUGIN_PKGS := \
gtk+-3.0 \
libsoup-2.4 \
libxml-2.0 \
- webkitgtk-3.0 \
+ webkit2gtk-4.0 \
gee-0.8 \
rest-0.7 \
json-glib-1.0
diff --git a/plugins/shotwell-publishing-extras/YandexPublishing.vala
b/plugins/shotwell-publishing-extras/YandexPublishing.vala
index 36a3ede..ec99c2b 100644
--- a/plugins/shotwell-publishing-extras/YandexPublishing.vala
+++ b/plugins/shotwell-publishing-extras/YandexPublishing.vala
@@ -120,43 +120,70 @@ internal class WebAuthPane : Spit.Publishing.DialogPane, GLib.Object {
webview = new WebKit.WebView();
webview.get_settings().enable_plugins = false;
- webview.get_settings().enable_default_context_menu = false;
- webview.load_finished.connect(on_page_load);
- webview.load_started.connect(on_load_started);
- webview.navigation_requested.connect(navigation_requested);
+ webview.load_changed.connect(on_page_load_changed);
+ webview.decide_policy.connect(on_decide_policy);
+ webview.context_menu.connect(() => { return false; });
webview_frame.add(webview);
pane_widget.pack_start(webview_frame, true, true, 0);
}
- private void on_page_load(WebKit.WebFrame origin_frame) {
+ private void on_page_load() {
pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.LEFT_PTR));
}
- private WebKit.NavigationResponse navigation_requested (WebKit.WebFrame frame, WebKit.NetworkRequest
req) {
- debug("Navigating to '%s'", req.uri);
+ private bool on_decide_policy (WebKit.PolicyDecision decision,
+ WebKit.PolicyDecisionType type) {
+ switch (type) {
+ case WebKit.PolicyDecisionType.NAVIGATION_ACTION:
+ WebKit.NavigationPolicyDecision n_decision = (WebKit.NavigationPolicyDecision) decision;
+ WebKit.NavigationAction action = n_decision.navigation_action;
+ string uri = action.get_request().uri;
+ debug("Navigating to '%s'", uri);
- MatchInfo info = null;
+ MatchInfo info = null;
- if (re.match(req.uri, 0, out info)) {
- string access_token = info.fetch_all()[2];
+ if (re.match(uri, 0, out info)) {
+ string access_token = info.fetch_all()[2];
- debug("Load completed: %s", access_token);
- pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.LEFT_PTR));
- if (access_token != null) {
- login_succeeded(access_token);
- return WebKit.NavigationResponse.IGNORE;
- } else
- login_failed();
+ debug("Load completed: %s", access_token);
+ pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.LEFT_PTR));
+ if (access_token != null) {
+ login_succeeded(access_token);
+ decision.ignore();
+ break;
+ } else
+ login_failed();
+ }
+ decision.use();
+ break;
+ case WebKit.PolicyDecisionType.RESPONSE:
+ decision.use();
+ break;
+ default:
+ return false;
}
- return WebKit.NavigationResponse.ACCEPT;
+ return true;
}
- private void on_load_started(WebKit.WebFrame frame) {
+ private void on_load_started() {
pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.WATCH));
}
+ private void on_page_load_changed (WebKit.LoadEvent load_event) {
+ switch (load_event) {
+ case WebKit.LoadEvent.STARTED:
+ on_load_started();
+ break;
+ case WebKit.LoadEvent.FINISHED:
+ on_page_load();
+ break;
+ }
+
+ return;
+ }
+
public Gtk.Widget get_widget() {
return pane_widget;
}
@@ -166,7 +193,7 @@ internal class WebAuthPane : Spit.Publishing.DialogPane, GLib.Object {
}
public void on_pane_installed() {
- webview.open(login_url);
+ webview.load_uri(login_url);
}
public void on_pane_uninstalled() {
diff --git a/plugins/shotwell-publishing/FacebookPublishing.vala
b/plugins/shotwell-publishing/FacebookPublishing.vala
index 1dd793d..4efe7f7 100644
--- a/plugins/shotwell-publishing/FacebookPublishing.vala
+++ b/plugins/shotwell-publishing/FacebookPublishing.vala
@@ -535,7 +535,7 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
return;
debug("EVENT: endpoint test transaction failed to detect a connection to the Facebook " +
- "endpoint");
+ "endpoint" + error.message);
on_generic_error(error);
}
@@ -829,15 +829,15 @@ internal class WebAuthenticationPane : Spit.Publishing.DialogPane, Object {
webview = new WebKit.WebView();
webview.get_settings().enable_plugins = false;
- webview.get_settings().enable_default_context_menu = false;
+ webview.get_settings().enable_xss_auditor = false;
- webview.load_finished.connect(on_page_load);
- webview.load_started.connect(on_load_started);
+ webview.load_changed.connect(on_page_load_changed);
+ webview.context_menu.connect(() => { return true; });
webview_frame.add(webview);
pane_widget.pack_start(webview_frame, true, true, 0);
}
-
+
private class LocaleLookup {
public string prefix;
public string translation;
@@ -945,10 +945,11 @@ internal class WebAuthenticationPane : Spit.Publishing.DialogPane, Object {
return
"https://%s.facebook.com/dialog/oauth?client_id=%s&redirect_uri=https://www.facebook.com/connect/login_success.html&scope=publish_actions,user_photos,user_videos&response_type=token".printf(facebook_locale,
APPLICATION_ID);
}
- private void on_page_load(WebKit.WebFrame origin_frame) {
+ private void on_page_load() {
pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.LEFT_PTR));
- string loaded_url = origin_frame.get_uri().dup();
+ string loaded_url = webview.uri.dup();
+ debug("loaded url: " + loaded_url);
// strip parameters from the loaded url
if (loaded_url.contains("?")) {
@@ -960,7 +961,7 @@ internal class WebAuthenticationPane : Spit.Publishing.DialogPane, Object {
// were we redirected to the facebook login success page?
if (loaded_url.contains("login_success")) {
cache_dirty = true;
- login_succeeded(origin_frame.get_uri());
+ login_succeeded(webview.uri);
return;
}
@@ -971,10 +972,24 @@ internal class WebAuthenticationPane : Spit.Publishing.DialogPane, Object {
}
}
- private void on_load_started(WebKit.WebFrame frame) {
+ private void on_load_started() {
pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.WATCH));
}
+ private void on_page_load_changed (WebKit.LoadEvent load_event) {
+ switch (load_event) {
+ case WebKit.LoadEvent.STARTED:
+ case WebKit.LoadEvent.REDIRECTED:
+ on_load_started();
+ break;
+ case WebKit.LoadEvent.FINISHED:
+ on_page_load();
+ break;
+ }
+
+ return;
+ }
+
public static bool is_cache_dirty() {
return cache_dirty;
}
@@ -988,7 +1003,7 @@ internal class WebAuthenticationPane : Spit.Publishing.DialogPane, Object {
}
public void on_pane_installed() {
- webview.open(get_login_url());
+ webview.load_uri(get_login_url());
}
public void on_pane_uninstalled() {
@@ -1527,6 +1542,7 @@ internal class GraphSession {
"Service %s returned HTTP status code %u %s", real_message.get_uri(),
msg.status_code, msg.reason_phrase);
} else {
+ debug(msg.reason_phrase);
error = new Spit.Publishing.PublishingError.NO_ANSWER(
"Failure communicating with %s (error code %u)", real_message.get_uri(),
msg.status_code);
diff --git a/plugins/shotwell-publishing/Makefile b/plugins/shotwell-publishing/Makefile
index 639fa88..6b3945b 100644
--- a/plugins/shotwell-publishing/Makefile
+++ b/plugins/shotwell-publishing/Makefile
@@ -5,7 +5,7 @@ PLUGIN_PKGS := \
gtk+-3.0 \
libsoup-2.4 \
libxml-2.0 \
- webkitgtk-3.0 \
+ webkit2gtk-4.0 \
gexiv2 \
rest-0.7 \
gee-0.8 \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]