summaryrefslogtreecommitdiff
path: root/plugins/shotwell-publishing-extras
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2016-06-05 04:23:39 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2016-06-05 04:23:39 +0200
commit4e10e30c2f99d552239871aa1b27a08a6c18f1a4 (patch)
treefc8426e57068733d7df20fc3a963f11cd864f079 /plugins/shotwell-publishing-extras
parent0d64f78a02829282cd00dd6df691df08d29ed751 (diff)
Imported Upstream version 0.23.1upstream/0.23.1
Diffstat (limited to 'plugins/shotwell-publishing-extras')
-rw-r--r--plugins/shotwell-publishing-extras/Makefile2
-rw-r--r--plugins/shotwell-publishing-extras/YandexPublishing.vala67
-rw-r--r--plugins/shotwell-publishing-extras/shotwell-publishing-extras.vala2
3 files changed, 49 insertions, 22 deletions
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-extras/shotwell-publishing-extras.vala b/plugins/shotwell-publishing-extras/shotwell-publishing-extras.vala
index 24f7ea2..9e70d30 100644
--- a/plugins/shotwell-publishing-extras/shotwell-publishing-extras.vala
+++ b/plugins/shotwell-publishing-extras/shotwell-publishing-extras.vala
@@ -1,4 +1,4 @@
-/* Copyright 2011-2015 Yorba Foundation
+/* Copyright 2016 Software Freedom Conservancy Inc.
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.