diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-06-26 08:39:49 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-06-26 08:39:49 +0200 |
commit | 29a7aef998e975b42401cfa96d1b750d91eadf06 (patch) | |
tree | eda2bdff398789ea2358cc39986dd1f7ee9d027a /plugins/shotwell-publishing | |
parent | 4e10e30c2f99d552239871aa1b27a08a6c18f1a4 (diff) |
Imported Upstream version 0.23.2upstream/0.23.2
Diffstat (limited to 'plugins/shotwell-publishing')
-rw-r--r-- | plugins/shotwell-publishing/FacebookPublishing.vala | 3 | ||||
-rw-r--r-- | plugins/shotwell-publishing/Makefile | 4 | ||||
-rw-r--r-- | plugins/shotwell-publishing/PicasaPublishing.vala | 2 | ||||
-rw-r--r-- | plugins/shotwell-publishing/PiwigoPublishing.vala | 56 | ||||
-rw-r--r-- | plugins/shotwell-publishing/YouTubePublishing.vala | 2 |
5 files changed, 23 insertions, 44 deletions
diff --git a/plugins/shotwell-publishing/FacebookPublishing.vala b/plugins/shotwell-publishing/FacebookPublishing.vala index 04dc51f..f6cccb6 100644 --- a/plugins/shotwell-publishing/FacebookPublishing.vala +++ b/plugins/shotwell-publishing/FacebookPublishing.vala @@ -940,8 +940,7 @@ internal class WebAuthenticationPane : Spit.Publishing.DialogPane, Object { private string get_login_url() { string facebook_locale = get_system_locale_as_facebook_locale(); - - 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); + return "https://%s.facebook.com/dialog/oauth?client_id=%s&redirect_uri=https://www.facebook.com/connect/login_success.html&display=popup&scope=publish_actions,user_photos,user_videos&response_type=token".printf(facebook_locale, APPLICATION_ID); } private void on_page_load() { diff --git a/plugins/shotwell-publishing/Makefile b/plugins/shotwell-publishing/Makefile index 6b3945b..607bc6b 100644 --- a/plugins/shotwell-publishing/Makefile +++ b/plugins/shotwell-publishing/Makefile @@ -17,9 +17,7 @@ SRC_FILES := \ PicasaPublishing.vala \ FlickrPublishing.vala \ YouTubePublishing.vala \ - PiwigoPublishing.vala \ - ../../src/util/string.vala \ - ../common/RESTSupport.vala + PiwigoPublishing.vala RC_FILES := \ facebook.png \ diff --git a/plugins/shotwell-publishing/PicasaPublishing.vala b/plugins/shotwell-publishing/PicasaPublishing.vala index d1af942..cb6352c 100644 --- a/plugins/shotwell-publishing/PicasaPublishing.vala +++ b/plugins/shotwell-publishing/PicasaPublishing.vala @@ -588,7 +588,7 @@ internal class UploadTransaction : // create a message that can be sent over the wire whose payload is the multipart container // that we've been building up Soup.Message outbound_message = - soup_form_request_new_from_multipart(get_endpoint_url(), message_parts); + Soup.Form.request_new_from_multipart(get_endpoint_url(), message_parts); outbound_message.request_headers.append("Authorization", "Bearer " + session.get_access_token()); set_message(outbound_message); diff --git a/plugins/shotwell-publishing/PiwigoPublishing.vala b/plugins/shotwell-publishing/PiwigoPublishing.vala index d7b972b..7dd9090 100644 --- a/plugins/shotwell-publishing/PiwigoPublishing.vala +++ b/plugins/shotwell-publishing/PiwigoPublishing.vala @@ -937,29 +937,18 @@ public class PiwigoPublisher : Spit.Publishing.Publisher, GLib.Object { * @param txn the received transaction * @return the value of pwg_id if present or null if not found */ - private new string? get_pwg_id_from_transaction(Publishing.RESTSupport.Transaction txn) { - string cookie = txn.get_response_headers().get_list("Set-Cookie"); - string pwg_id = null; - debug("Full cookie string: %s".printf(cookie)); - if (!is_string_empty(cookie)) { - string[] cookie_segments = cookie.split(";"); - debug("Split full string into %d individual segments".printf(cookie_segments.length)); - foreach(string cookie_segment in cookie_segments) { - debug("Individual cookie segment: %s".printf(cookie_segment)); - string[] cookie_sub_segments = cookie_segment.split(","); - debug("Split segment into %d individual sub-segments".printf(cookie_sub_segments.length)); - foreach(string cookie_sub_segment in cookie_sub_segments) { - debug("Individual cookie sub-segment: %s".printf(cookie_sub_segment)); - string[] cookie_kv = cookie_sub_segment.split("="); - debug("Split sub-segment into %d chunks".printf(cookie_kv.length)); - if (cookie_kv.length > 1 && cookie_kv[0].strip() == "pwg_id") { - debug("Found pwg_id: %s".printf(cookie_kv[1].strip())); - pwg_id = cookie_kv[1].strip(); - } - } + private string? get_pwg_id_from_transaction(Publishing.RESTSupport.Transaction txn) { + string? pwg_id = null; + + foreach (var cookie in Soup.cookies_from_response(txn.get_message())) { + if (cookie.get_name() == "pwg_id") { + // Collect all ids, last one is the one to use. First one is + // for Guest apparently + pwg_id = cookie.get_value(); + debug ("Found pwg_id %s", pwg_id); } } - + return pwg_id; } } @@ -1093,11 +1082,9 @@ internal class AuthenticationPane : Spit.Publishing.DialogPane, Object { } private void update_login_button_sensitivity() { - login_button.set_sensitive( - !is_string_empty(url_entry.get_text()) && - !is_string_empty(username_entry.get_text()) && - !is_string_empty(password_entry.get_text()) - ); + login_button.set_sensitive(url_entry.text_length != 0 && + username_entry.text_length != 0 && + password_entry.text_length != 0); } public Gtk.Widget get_widget() { @@ -1325,7 +1312,7 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, Object { !( create_new_radio.get_active() && ( - is_string_empty(category_name) || + category_name != "" || category_already_exists(search_name) ) ) @@ -1669,12 +1656,7 @@ private class ImagesAddTransaction : Publishing.RESTSupport.UploadTransaction { string[] keywords = publishable.get_publishing_keywords(); string tags = ""; if (keywords != null) { - foreach (string tag in keywords) { - if (!is_string_empty(tags)) { - tags += ","; - } - tags += tag; - } + tags = string.joinv (",", keywords); } debug("PiwigoConnector: Uploading photo %s to category id %d with perm level %d", @@ -1683,16 +1665,16 @@ private class ImagesAddTransaction : Publishing.RESTSupport.UploadTransaction { string name = publishable.get_publishing_name(); string comment = publishable.get_param_string( Spit.Publishing.Publishable.PARAM_STRING_COMMENT); - if (is_string_empty(name)) { + if (name != "") { name = publishable.get_param_string( Spit.Publishing.Publishable.PARAM_STRING_BASENAME); add_argument("name", name); - if (!is_string_empty(comment)) { + if (comment != null && comment != "") { add_argument("comment", comment); } } else { // name is set - if (!is_string_empty(comment)) { + if (comment != null && comment != "") { add_argument("name", name); add_argument("comment", comment); } else { @@ -1710,7 +1692,7 @@ private class ImagesAddTransaction : Publishing.RESTSupport.UploadTransaction { add_argument("category", parameters.category.id.to_string()); add_argument("level", parameters.perm_level.id.to_string()); if (!parameters.no_upload_tags) - if (!is_string_empty(tags)) + if (tags != "") add_argument("tags", tags); // TODO: update the Publishable interface so that it gives access to // the image's meta-data where the author (artist) is kept diff --git a/plugins/shotwell-publishing/YouTubePublishing.vala b/plugins/shotwell-publishing/YouTubePublishing.vala index ccb835f..15f283f 100644 --- a/plugins/shotwell-publishing/YouTubePublishing.vala +++ b/plugins/shotwell-publishing/YouTubePublishing.vala @@ -592,7 +592,7 @@ internal class UploadTransaction : Publishing.RESTSupport.GooglePublisher.Authen // create a message that can be sent over the wire whose payload is the multipart container // that we've been building up Soup.Message outbound_message = - soup_form_request_new_from_multipart(get_endpoint_url(), message_parts); + Soup.Form.request_new_from_multipart(get_endpoint_url(), message_parts); outbound_message.request_headers.append("X-GData-Key", "key=%s".printf(DEVELOPER_KEY)); outbound_message.request_headers.append("Slug", publishable.get_param_string(Spit.Publishing.Publishable.PARAM_STRING_BASENAME)); |