summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2019-08-15 09:42:33 +0200
committerJörg Frings-Fürst <debian@jff.email>2019-08-15 09:42:33 +0200
commitb57c8088c3dad237b04bb792c6dade9c470ce9fd (patch)
treebcf0e22d1a26313488a3fb37e30c479dcfa8537d /plugins
parent6710aa856175300e598b23b701c0d2741f2cb6b3 (diff)
New upstream version 0.30.5upstream/0.30.5
Diffstat (limited to 'plugins')
-rw-r--r--plugins/authenticator/shotwell/FlickrPublishingAuthenticator.vala14
-rw-r--r--plugins/authenticator/shotwell/GoogleAuthenticator.vala11
-rw-r--r--plugins/common/WebAuthenticationPane.vala15
-rw-r--r--plugins/shotwell-publishing/PhotosPublisher.vala5
-rw-r--r--plugins/shotwell-publishing/PiwigoPublishing.vala48
5 files changed, 68 insertions, 25 deletions
diff --git a/plugins/authenticator/shotwell/FlickrPublishingAuthenticator.vala b/plugins/authenticator/shotwell/FlickrPublishingAuthenticator.vala
index 5188ed6..ea4d9ce 100644
--- a/plugins/authenticator/shotwell/FlickrPublishingAuthenticator.vala
+++ b/plugins/authenticator/shotwell/FlickrPublishingAuthenticator.vala
@@ -54,6 +54,12 @@ namespace Publishing.Authenticator.Shotwell.Flickr {
}
public override void on_page_load() {
+ if (this.load_error != null) {
+ this.error();
+
+ return;
+ }
+
var uri = new Soup.URI(get_view().get_uri());
if (uri.scheme == "shotwell-auth" && this.auth_code == null) {
var form_data = Soup.Form.decode (uri.query);
@@ -77,6 +83,8 @@ namespace Publishing.Authenticator.Shotwell.Flickr {
}
internal class Flickr : Publishing.Authenticator.Shotwell.OAuth1.Authenticator {
+ private WebAuthenticationPane pane;
+
public Flickr(Spit.Publishing.PluginHost host) {
base(API_KEY, API_SECRET, host);
}
@@ -185,13 +193,17 @@ namespace Publishing.Authenticator.Shotwell.Flickr {
}
private void do_web_authentication(string token) {
- var pane = new WebAuthenticationPane(token);
+ pane = new WebAuthenticationPane(token);
host.install_dialog_pane(pane);
pane.authorized.connect(this.do_verify_pin);
pane.error.connect(this.on_web_login_error);
}
private void on_web_login_error() {
+ if (pane.load_error != null) {
+ host.post_error(pane.load_error);
+ return;
+ }
host.post_error(new Spit.Publishing.PublishingError.PROTOCOL_ERROR(_("Flickr authorization failed")));
}
diff --git a/plugins/authenticator/shotwell/GoogleAuthenticator.vala b/plugins/authenticator/shotwell/GoogleAuthenticator.vala
index 75d8f37..5b38ee6 100644
--- a/plugins/authenticator/shotwell/GoogleAuthenticator.vala
+++ b/plugins/authenticator/shotwell/GoogleAuthenticator.vala
@@ -21,6 +21,12 @@ namespace Publishing.Authenticator.Shotwell.Google {
}
public override void on_page_load() {
+ if (this.load_error != null) {
+ this.error ();
+
+ return;
+ }
+
var uri = new Soup.URI(get_view().get_uri());
if (uri.scheme == REVERSE_CLIENT_ID && this.auth_code == null) {
var form_data = Soup.Form.decode (uri.query);
@@ -173,6 +179,7 @@ namespace Publishing.Authenticator.Shotwell.Google {
web_auth_pane = new WebAuthenticationPane(user_authorization_url);
web_auth_pane.authorized.connect(on_web_auth_pane_authorized);
+ web_auth_pane.error.connect(on_web_auth_pane_error);
host.install_dialog_pane(web_auth_pane);
}
@@ -185,6 +192,10 @@ namespace Publishing.Authenticator.Shotwell.Google {
do_get_access_tokens(auth_code);
}
+ private void on_web_auth_pane_error() {
+ host.post_error(web_auth_pane.load_error);
+ }
+
private void do_get_access_tokens(string auth_code) {
debug("ACTION: exchanging authorization code for access & refresh tokens");
diff --git a/plugins/common/WebAuthenticationPane.vala b/plugins/common/WebAuthenticationPane.vala
index c537748..1704780 100644
--- a/plugins/common/WebAuthenticationPane.vala
+++ b/plugins/common/WebAuthenticationPane.vala
@@ -12,6 +12,7 @@ namespace Shotwell.Plugins.Common {
}
public string login_uri { owned get; construct; }
+ public Error load_error { get; private set; default = null; }
private WebKit.WebView webview;
@@ -22,6 +23,7 @@ namespace Shotwell.Plugins.Common {
this.webview.get_settings ().enable_plugins = false;
this.webview.load_changed.connect (this.on_page_load_changed);
+ this.webview.load_failed.connect (this.on_page_load_failed);
this.webview.context_menu.connect ( () => { return false; });
}
@@ -29,11 +31,24 @@ namespace Shotwell.Plugins.Common {
protected void set_cursor (Gdk.CursorType type) {
var window = webview.get_window ();
+ if (window == null)
+ return;
+
var display = window.get_display ();
+ if (display == null)
+ return;
+
var cursor = new Gdk.Cursor.for_display (display, type);
window.set_cursor (cursor);
}
+ private bool on_page_load_failed (WebKit.LoadEvent load_event, string uri, Error error) {
+ critical ("Failed to load uri %s: %s", uri, error.message);
+ this.load_error = error;
+
+ return false;
+ }
+
private void on_page_load_changed (WebKit.LoadEvent load_event) {
switch (load_event) {
case WebKit.LoadEvent.STARTED:
diff --git a/plugins/shotwell-publishing/PhotosPublisher.vala b/plugins/shotwell-publishing/PhotosPublisher.vala
index d878158..ce5e505 100644
--- a/plugins/shotwell-publishing/PhotosPublisher.vala
+++ b/plugins/shotwell-publishing/PhotosPublisher.vala
@@ -203,9 +203,10 @@ private class AlbumDirectoryTransaction : Publishing.RESTSupport.GooglePublisher
var response_albums = object.get_member ("albums").get_array();
response_albums.foreach_element( (a, b, element) => {
var album = element.get_object();
+ var title = album.get_member("title");
var is_writable = album.get_member("isWriteable");
- if (is_writable != null && is_writable.get_boolean())
- albums += new Album(album.get_string_member("title"), album.get_string_member("id"));
+ if (title != null && is_writable != null && is_writable.get_boolean())
+ albums += new Album(title.get_string(), album.get_string_member("id"));
});
if (pagination_token_node != null) {
diff --git a/plugins/shotwell-publishing/PiwigoPublishing.vala b/plugins/shotwell-publishing/PiwigoPublishing.vala
index 649f135..f177789 100644
--- a/plugins/shotwell-publishing/PiwigoPublishing.vala
+++ b/plugins/shotwell-publishing/PiwigoPublishing.vala
@@ -1010,7 +1010,7 @@ internal class SSLErrorPane : Shotwell.Plugins.Common.BuilderPane {
public signal void proceed ();
public string host { owned get; construct; }
- public TlsCertificate cert { private get; construct; }
+ public TlsCertificate? cert { private get; construct; }
public string error_text { owned get; construct; }
public SSLErrorPane (SessionLoginTransaction transaction,
@@ -1037,28 +1037,32 @@ internal class SSLErrorPane : Shotwell.Plugins.Common.BuilderPane {
label.set_text (error_text);
var info = this.get_builder ().get_object ("default") as Gtk.Button;
- info.clicked.connect (() => {
- var simple_cert = new Gcr.SimpleCertificate (cert.certificate.data);
- var widget = new Gcr.CertificateWidget (simple_cert);
- bool use_header = true;
- Gtk.Settings.get_default ().get ("gtk-dialogs-use-header", out use_header);
- var flags = (Gtk.DialogFlags) 0;
- if (use_header) {
- flags |= Gtk.DialogFlags.USE_HEADER_BAR;
- }
+ if (cert != null) {
+ info.clicked.connect (() => {
+ var simple_cert = new Gcr.SimpleCertificate (cert.certificate.data);
+ var widget = new Gcr.CertificateWidget (simple_cert);
+ bool use_header = true;
+ Gtk.Settings.get_default ().get ("gtk-dialogs-use-header", out use_header);
+ var flags = (Gtk.DialogFlags) 0;
+ if (use_header) {
+ flags |= Gtk.DialogFlags.USE_HEADER_BAR;
+ }
- var dialog = new Gtk.Dialog.with_buttons (
- _("Certificate of %s").printf (host),
- null,
- flags,
- _("_OK"), Gtk.ResponseType.OK);
- dialog.get_content_area ().add (widget);
- dialog.set_default_response (Gtk.ResponseType.OK);
- dialog.set_default_size (640, -1);
- dialog.show_all ();
- dialog.run ();
- dialog.destroy ();
- });
+ var dialog = new Gtk.Dialog.with_buttons (
+ _("Certificate of %s").printf (host),
+ null,
+ flags,
+ _("_OK"), Gtk.ResponseType.OK);
+ dialog.get_content_area ().add (widget);
+ dialog.set_default_response (Gtk.ResponseType.OK);
+ dialog.set_default_size (640, -1);
+ dialog.show_all ();
+ dialog.run ();
+ dialog.destroy ();
+ });
+ } else {
+ info.get_parent().remove(info);
+ }
var proceed = this.get_builder ().get_object ("proceed_button") as Gtk.Button;
proceed.clicked.connect (() => { this.proceed (); });