diff --git a/debian/changelog b/debian/changelog index 8c18238..ec2b374 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,33 @@ +shotwell (0.26.1-0ubuntu1) UNRELEASED; urgency=medium + + * Sync with Debian git packaging (LP: #1581180). Remaining changes: + - debian/control, debian/test/*: + + Add autopilot autopkgtest to check import from a libgphoto2 + camera (simulated with umockdev, recorded from a Canon + PowerShot SX200). + debian/tests/import will run under a local session D-BUS + and xvfb, but you can also run the test interactively with + "cd debian/tests; autopilot run autopilot_tests". + - debian/control, debian/rules: + + Build-depend on and run dh-translations + + Build with Unity support. + + Build-Depends on libunity-dev. + + configure --disable-icon-update + + Build with scour for SVG optimization. + + Build-Depends on python-scour. + - clean out thumbnailer hacks, that's not user friendly and not + something that should be recommended doing + * Don't clutter up debian/ with old, disabled patches + * Drop obsolete Ubuntu patches: + - no_headerbar.patch (applied in new release) + - 02_desktop-translations.patch + - update_translation_list.patch + * Disable 06_uoa.patch since it need to be rewritten or dropped + * Drop Ubuntu Online Accounts (UOA) dependencies since this package no + longer supports it. + + -- Jeremy Bicha Fri, 03 Mar 2017 22:25:10 -0500 + shotwell (0.26.1-1) UNRELEASED; urgency=medium * New upstream release. diff --git a/debian/control b/debian/control index 02d320a..d1cef9d 100644 --- a/debian/control +++ b/debian/control @@ -1,11 +1,13 @@ Source: shotwell Section: gnome Priority: optional -Maintainer: Jörg Frings-Fürst +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Jörg Frings-Fürst Build-Depends: appstream-util, debhelper (>= 10), desktop-file-utils, + dh-translations, gnome-doc-utils, itstool, libappstream-glib-dev, @@ -28,6 +30,8 @@ Build-Depends: libsqlite3-dev (>= 3.5.9), libwebkit2gtk-4.0-dev, libxml2 (>= 2.6.32), + libunity-dev, + python-scour, m4, valac (>= 0.22.0) Standards-Version: 3.9.8 diff --git a/debian/patches/0001-buildflags.patch b/debian/patches/0001-buildflags.patch deleted file mode 100644 index 91ca3a0..0000000 --- a/debian/patches/0001-buildflags.patch +++ /dev/null @@ -1,20 +0,0 @@ -Description: Poke requested Debian buildflags for hardening into Makefile -Author: Jörg Frings-Fürst -Last-Update: 2015-01-07 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: trunk/Makefile -=================================================================== ---- trunk.orig/Makefile -+++ trunk/Makefile -@@ -385,8 +385,8 @@ PLUGIN_CFLAGS = -O2 -g -pipe - endif - endif - --CFLAGS += $(PROFILE_FLAGS) $(REQUIRED_CFLAGS) --PLUGIN_CFLAGS += $(PROFILE_FLAGS) $(REQUIRED_CFLAGS) -+CFLAGS += $(PROFILE_FLAGS) $(REQUIRED_CFLAGS) -fstack-protector-strong -+PLUGIN_CFLAGS += $(PROFILE_FLAGS) $(REQUIRED_CFLAGS) -fPIC -fno-stack-protector - - # Required for gudev-1.0 - CFLAGS += -DG_UDEV_API_IS_SUBJECT_TO_CHANGE diff --git a/debian/patches/0005-hardening.patch b/debian/patches/0005-hardening.patch deleted file mode 100644 index c8abeea..0000000 --- a/debian/patches/0005-hardening.patch +++ /dev/null @@ -1,38 +0,0 @@ -Description: pass compiler flags set in debian/rules to compiler -Author: Devid Antonio Filoni - -Index: trunk/Makefile -=================================================================== ---- trunk.orig/Makefile -+++ trunk/Makefile -@@ -35,7 +35,7 @@ CORE_SUPPORTED_LANGUAGES=$(shell cat po/ - LOCAL_LANG_DIR=locale-langpack - SYSTEM_LANG_DIR := $(DESTDIR)$(PREFIX)/share/locale - --VALAFLAGS := -g --enable-checking --target-glib=2.32 --thread --fatal-warnings --enable-experimental --enable-deprecated $(USER_VALAFLAGS) -+VALAFLAGS := $(foreach w,$(CPPFLAGS) $(CFLAGS) $(LDFLAGS),-X $(w)) --enable-checking --target-glib=2.32 --thread --enable-experimental --enable-deprecated $(USER_VALAFLAGS) - ifdef UNITY_SUPPORT - VALAFLAGS := $(VALAFLAGS) --define UNITY_SUPPORT - endif -@@ -661,7 +661,7 @@ $(EXPANDED_C_FILES): $(VALA_STAMP) - @ - - $(EXPANDED_OBJ_FILES): %.o: %.c $(CONFIG_IN) Makefile -- $(CC) -c $(VALA_CFLAGS) $(CFLAGS) -o $@ $< -+ $(CC) -c $(VALA_CFLAGS) $(CPPFLAGS) $(CFLAGS) -o $@ $< - - $(PROGRAM): $(EXPANDED_OBJ_FILES) $(RESOURCES) $(LANG_STAMP) $(THUMBNAILER_BIN) misc/gschemas.compiled $(DOC_LANG_STAMP) - $(CC) $(EXPANDED_OBJ_FILES) $(CFLAGS) $(LDFLAGS) $(RESOURCES) $(VALA_LDFLAGS) $(EXPORT_FLAGS) -o $@ -Index: trunk/plugins/Makefile.plugin.mk -=================================================================== ---- trunk.orig/plugins/Makefile.plugin.mk -+++ trunk/plugins/Makefile.plugin.mk -@@ -42,7 +42,7 @@ PLUGIN_EXTRAFLAGS ?= --vapidir=../common - PLUGIN_EXTRALINKFLAGS ?= -L../common/ -lshotwell-plugin-common - - .stamp: $(SRC_FILES) $(MAKE_FILES) $(HEADER_FILES) -- $(VALAC) --target-glib=$(MIN_GLIB_VERSION) -g --enable-checking --fatal-warnings --ccode --enable-deprecated \ -+ $(VALAC) --target-glib=$(MIN_GLIB_VERSION) -g --enable-checking --ccode --enable-deprecated \ - --vapidir=../ $(foreach pkg,$(PKGS),--pkg=$(pkg)) $(foreach pkg,$(CUSTOM_VAPI_PKGS),--pkg=$(pkg)) \ - $(USER_VALAFLAGS) \ - $(PLUGIN_EXTRAFLAGS) \ diff --git a/debian/patches/0010-libexec.patch b/debian/patches/0010-libexec.patch deleted file mode 100644 index 0e06218..0000000 --- a/debian/patches/0010-libexec.patch +++ /dev/null @@ -1,16 +0,0 @@ -Description: do not install files in libexec directory -Author: Luca Falavigna - -Index: shotwell-0.15.0/Makefile -=================================================================== ---- shotwell-0.15.0.orig/Makefile 2013-10-13 09:51:58.893357001 +0200 -+++ shotwell-0.15.0/Makefile 2013-10-13 09:54:33.885361749 +0200 -@@ -27,7 +27,7 @@ - - -include configure.mk - ifndef LIBEXECDIR --LIBEXECDIR=$(PREFIX)/libexec/shotwell -+LIBEXECDIR=$(PREFIX)/share/shotwell - endif - - CORE_SUPPORTED_LANGUAGES=$(shell cat po/LINGUAS) diff --git a/debian/patches/0500-Port-to-webkit2gtk-40.patch b/debian/patches/0500-Port-to-webkit2gtk-40.patch deleted file mode 100644 index 51cd8de..0000000 --- a/debian/patches/0500-Port-to-webkit2gtk-40.patch +++ /dev/null @@ -1,1026 +0,0 @@ -From afc5e103d2dd414f0d028565097d86c7e85fadbc Mon Sep 17 00:00:00 2001 -From: Iain Lane -Date: Tue, 30 Jun 2015 10:43:15 +0100 -Subject: [PATCH] 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 | 67 ++- - .../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, 97 insertions(+), 705 deletions(-) - delete mode 100644 vapi/webkitgtk-3.0.deps - delete mode 100644 vapi/webkitgtk-3.0.vapi - -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/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 \ -diff --git a/vapi/webkitgtk-3.0.deps b/vapi/webkitgtk-3.0.deps -deleted file mode 100644 -index 91b1dfe..0000000 ---- a/vapi/webkitgtk-3.0.deps -+++ /dev/null -@@ -1,8 +0,0 @@ --atk --gio-2.0 --cairo --pango --gdk-pixbuf-2.0 --gdk-3.0 --gtk+-3.0 --libsoup-2.4 -diff --git a/vapi/webkitgtk-3.0.vapi b/vapi/webkitgtk-3.0.vapi -deleted file mode 100644 -index 9e0d347..0000000 ---- a/vapi/webkitgtk-3.0.vapi -+++ /dev/null -@@ -1,653 +0,0 @@ --/* webkit-1.0.vapi generated by vapigen, do not modify. */ -- --[CCode (cprefix = "WebKit", lower_case_cprefix = "webkit_")] --namespace WebKit { -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class Download : GLib.Object { -- [CCode (has_construct_function = false)] -- public Download (WebKit.NetworkRequest request); -- public void cancel (); -- public uint64 get_current_size (); -- public unowned string get_destination_uri (); -- public double get_elapsed_time (); -- public unowned WebKit.NetworkRequest get_network_request (); -- public unowned WebKit.NetworkResponse get_network_response (); -- public double get_progress (); -- public WebKit.DownloadStatus get_status (); -- public unowned string get_suggested_filename (); -- public uint64 get_total_size (); -- public unowned string get_uri (); -- public void set_destination_uri (string destination_uri); -- public void start (); -- public uint64 current_size { get; } -- public string destination_uri { get; set; } -- public WebKit.NetworkRequest network_request { get; construct; } -- public WebKit.NetworkResponse network_response { get; construct; } -- public double progress { get; } -- public WebKit.DownloadStatus status { get; } -- public string suggested_filename { get; } -- public uint64 total_size { get; } -- public virtual signal bool error (int p0, int p1, string p2); -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class GeolocationPolicyDecision : GLib.Object { -- [CCode (has_construct_function = false)] -- protected GeolocationPolicyDecision (); -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class HitTestResult : GLib.Object { -- [CCode (has_construct_function = false)] -- protected HitTestResult (); -- [NoAccessorMethod] -- public WebKit.HitTestResultContext context { get; construct; } -- [NoAccessorMethod] -- public string image_uri { owned get; construct; } -- [NoAccessorMethod] -- public string link_uri { owned get; construct; } -- [NoAccessorMethod] -- public string media_uri { owned get; construct; } -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class NetworkRequest : GLib.Object { -- [CCode (has_construct_function = false)] -- public NetworkRequest (string uri); -- public unowned Soup.Message get_message (); -- public unowned string get_uri (); -- public void set_uri (string uri); -- public Soup.Message message { get; construct; } -- public string uri { get; set; } -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class NetworkResponse : GLib.Object { -- [CCode (has_construct_function = false)] -- public NetworkResponse (string uri); -- public unowned Soup.Message get_message (); -- public unowned string get_uri (); -- public void set_uri (string uri); -- public Soup.Message message { get; construct; } -- public string uri { get; set; } -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class SecurityOrigin : GLib.Object { -- [CCode (has_construct_function = false)] -- protected SecurityOrigin (); -- public unowned GLib.List get_all_web_databases (); -- public unowned string get_host (); -- public uint get_port (); -- public unowned string get_protocol (); -- public uint64 get_web_database_quota (); -- public uint64 get_web_database_usage (); -- public void set_web_database_quota (uint64 quota); -- public string host { get; } -- public uint port { get; } -- public string protocol { get; } -- public uint64 web_database_quota { get; set; } -- public uint64 web_database_usage { get; } -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class SoupAuthDialog : GLib.Object, Soup.SessionFeature { -- [CCode (has_construct_function = false)] -- protected SoupAuthDialog (); -- public virtual signal unowned Gtk.Widget current_toplevel (Soup.Message message); -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class WebBackForwardList : GLib.Object { -- [CCode (has_construct_function = false)] -- protected WebBackForwardList (); -- public void add_item (WebKit.WebHistoryItem history_item); -- public void clear (); -- public bool contains_item (WebKit.WebHistoryItem history_item); -- public unowned WebKit.WebHistoryItem get_back_item (); -- public int get_back_length (); -- public unowned GLib.List get_back_list_with_limit (int limit); -- public unowned WebKit.WebHistoryItem get_current_item (); -- public unowned WebKit.WebHistoryItem get_forward_item (); -- public int get_forward_length (); -- public unowned GLib.List get_forward_list_with_limit (int limit); -- public int get_limit (); -- public unowned WebKit.WebHistoryItem get_nth_item (int index); -- public void go_back (); -- public void go_forward (); -- public void go_to_item (WebKit.WebHistoryItem history_item); -- public void set_limit (int limit); -- [CCode (has_construct_function = false)] -- public WebBackForwardList.with_web_view (WebKit.WebView web_view); -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class WebDataSource : GLib.Object { -- [CCode (has_construct_function = false)] -- public WebDataSource (); -- public unowned GLib.StringBuilder get_data (); -- public unowned string get_encoding (); -- public unowned WebKit.NetworkRequest get_initial_request (); -- public unowned WebKit.WebResource get_main_resource (); -- public unowned WebKit.NetworkRequest get_request (); -- public unowned GLib.List get_subresources (); -- public unowned string get_unreachable_uri (); -- public unowned WebKit.WebFrame get_web_frame (); -- public bool is_loading (); -- [CCode (has_construct_function = false)] -- public WebDataSource.with_request (WebKit.NetworkRequest request); -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class WebDatabase : GLib.Object { -- [CCode (has_construct_function = false)] -- protected WebDatabase (); -- public unowned string get_display_name (); -- public uint64 get_expected_size (); -- public unowned string get_filename (); -- public unowned string get_name (); -- public unowned WebKit.SecurityOrigin get_security_origin (); -- public uint64 get_size (); -- public void remove (); -- public string display_name { get; } -- public uint64 expected_size { get; } -- public string filename { get; } -- public string name { get; construct; } -- public WebKit.SecurityOrigin security_origin { get; construct; } -- public uint64 size { get; } -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class WebFrame : GLib.Object { -- [CCode (has_construct_function = false)] -- public WebFrame (WebKit.WebView web_view); -- public unowned WebKit.WebFrame find_frame (string name); -- public unowned WebKit.WebDataSource get_data_source (); -- public Gtk.PolicyType get_horizontal_scrollbar_policy (); -- public WebKit.LoadStatus get_load_status (); -- public unowned string get_name (); -- public unowned WebKit.NetworkResponse get_network_response (); -- public unowned WebKit.WebFrame get_parent (); -- public unowned WebKit.WebDataSource get_provisional_data_source (); -- public unowned WebKit.SecurityOrigin get_security_origin (); -- public unowned string get_title (); -- public unowned string get_uri (); -- public Gtk.PolicyType get_vertical_scrollbar_policy (); -- public unowned WebKit.WebView get_web_view (); -- public void load_alternate_string (string content, string base_url, string unreachable_url); -- public void load_request (WebKit.NetworkRequest request); -- public void load_string (string content, string mime_type, string encoding, string base_uri); -- public void load_uri (string uri); -- public void print (); -- public Gtk.PrintOperationResult print_full (Gtk.PrintOperation operation, Gtk.PrintOperationAction action) throws GLib.Error; -- public void reload (); -- public void stop_loading (); -- public Gtk.PolicyType horizontal_scrollbar_policy { get; } -- public WebKit.LoadStatus load_status { get; } -- public string name { get; } -- public string title { get; } -- public string uri { get; } -- public Gtk.PolicyType vertical_scrollbar_policy { get; } -- public virtual signal void cleared (); -- public virtual signal void hovering_over_link (string p0, string p1); -- public virtual signal void load_committed (); -- public virtual signal void load_done (bool p0); -- public virtual signal bool scrollbars_policy_changed (); -- public virtual signal void title_changed (string p0); -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class WebHistoryItem : GLib.Object { -- [CCode (has_construct_function = false)] -- public WebHistoryItem (); -- public unowned WebKit.WebHistoryItem copy (); -- public unowned string get_alternate_title (); -- public double get_last_visited_time (); -- public unowned string get_original_uri (); -- public unowned string get_title (); -- public unowned string get_uri (); -- public void set_alternate_title (string title); -- [CCode (has_construct_function = false)] -- public WebHistoryItem.with_data (string uri, string title); -- public string alternate_title { get; set; } -- public double last_visited_time { get; } -- public string original_uri { get; } -- public string title { get; } -- public string uri { get; } -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class WebInspector : GLib.Object { -- [CCode (has_construct_function = false)] -- protected WebInspector (); -- public void close (); -- public unowned string get_inspected_uri (); -- public unowned WebKit.WebView get_web_view (); -- public void inspect_coordinates (double x, double y); -- public void show (); -- public string inspected_uri { get; } -- [NoAccessorMethod] -- public bool javascript_profiling_enabled { get; set; } -- [NoAccessorMethod] -- public bool timeline_profiling_enabled { get; set; } -- public WebKit.WebView web_view { get; } -- public virtual signal bool attach_window (); -- public virtual signal bool close_window (); -- public virtual signal bool detach_window (); -- public virtual signal void finished (); -- public virtual signal unowned WebKit.WebView inspect_web_view (WebKit.WebView p0); -- public virtual signal bool show_window (); -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class WebNavigationAction : GLib.Object { -- [CCode (has_construct_function = false)] -- protected WebNavigationAction (); -- public int get_button (); -- public int get_modifier_state (); -- public unowned string get_original_uri (); -- public WebKit.WebNavigationReason get_reason (); -- public unowned string get_target_frame (); -- public void set_original_uri (string originalUri); -- public void set_reason (WebKit.WebNavigationReason reason); -- public int button { get; construct; } -- public int modifier_state { get; construct; } -- public string original_uri { get; set construct; } -- public WebKit.WebNavigationReason reason { get; set construct; } -- public string target_frame { get; construct; } -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class WebPolicyDecision : GLib.Object { -- [CCode (has_construct_function = false)] -- protected WebPolicyDecision (); -- public void download (); -- public void ignore (); -- public void use (); -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class WebResource : GLib.Object { -- [CCode (has_construct_function = false)] -- public WebResource (string data, ssize_t size, string uri, string mime_type, string encoding, string frame_name); -- public unowned GLib.StringBuilder get_data (); -- public unowned string get_encoding (); -- public unowned string get_frame_name (); -- public unowned string get_mime_type (); -- public unowned string get_uri (); -- public string encoding { get; } -- public string frame_name { get; } -- public string mime_type { get; } -- public string uri { get; construct; } -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class WebSettings : GLib.Object { -- [CCode (has_construct_function = false)] -- public WebSettings (); -- public WebKit.WebSettings copy (); -- public unowned string get_user_agent (); -- [NoAccessorMethod] -- public bool auto_load_images { get; set construct; } -- [NoAccessorMethod] -- public bool auto_resize_window { get; set construct; } -- [NoAccessorMethod] -- public bool auto_shrink_images { get; set construct; } -- [NoAccessorMethod] -- public string cursive_font_family { owned get; set construct; } -- [NoAccessorMethod] -- public string default_encoding { owned get; set construct; } -- [NoAccessorMethod] -- public string default_font_family { owned get; set construct; } -- [NoAccessorMethod] -- public int default_font_size { get; set construct; } -- [NoAccessorMethod] -- public int default_monospace_font_size { get; set construct; } -- [NoAccessorMethod] -- public WebKit.EditingBehavior editing_behavior { get; set construct; } -- [NoAccessorMethod] -- public bool enable_caret_browsing { get; set construct; } -- [NoAccessorMethod] -- public bool enable_default_context_menu { get; set construct; } -- [NoAccessorMethod] -- public bool enable_developer_extras { get; set construct; } -- [NoAccessorMethod] -- public bool enable_dom_paste { get; set construct; } -- [NoAccessorMethod] -- public bool enable_file_access_from_file_uris { get; set construct; } -- [NoAccessorMethod] -- public bool enable_html5_database { get; set construct; } -- [NoAccessorMethod] -- public bool enable_html5_local_storage { get; set construct; } -- [NoAccessorMethod] -- public bool enable_java_applet { get; set construct; } -- [NoAccessorMethod] -- public bool enable_offline_web_application_cache { get; set construct; } -- [NoAccessorMethod] -- public bool enable_page_cache { get; set construct; } -- [NoAccessorMethod] -- public bool enable_plugins { get; set construct; } -- [NoAccessorMethod] -- public bool enable_private_browsing { get; set construct; } -- [NoAccessorMethod] -- public bool enable_scripts { get; set construct; } -- [NoAccessorMethod] -- public bool enable_site_specific_quirks { get; set construct; } -- [NoAccessorMethod] -- public bool enable_spatial_navigation { get; set construct; } -- [NoAccessorMethod] -- public bool enable_spell_checking { get; set construct; } -- [NoAccessorMethod] -- public bool enable_universal_access_from_file_uris { get; set construct; } -- [NoAccessorMethod] -- public bool enable_xss_auditor { get; set construct; } -- [NoAccessorMethod] -- public bool enforce_96_dpi { get; set construct; } -- [NoAccessorMethod] -- public string fantasy_font_family { owned get; set construct; } -- [NoAccessorMethod] -- public bool javascript_can_access_clipboard { get; set construct; } -- [NoAccessorMethod] -- public bool javascript_can_open_windows_automatically { get; set construct; } -- [NoAccessorMethod] -- public int minimum_font_size { get; set construct; } -- [NoAccessorMethod] -- public int minimum_logical_font_size { get; set construct; } -- [NoAccessorMethod] -- public string monospace_font_family { owned get; set construct; } -- [NoAccessorMethod] -- public bool print_backgrounds { get; set construct; } -- [NoAccessorMethod] -- public bool resizable_text_areas { get; set construct; } -- [NoAccessorMethod] -- public string sans_serif_font_family { owned get; set construct; } -- [NoAccessorMethod] -- public string serif_font_family { owned get; set construct; } -- [NoAccessorMethod] -- public string spell_checking_languages { owned get; set construct; } -- [NoAccessorMethod] -- public bool tab_key_cycles_through_elements { get; set construct; } -- [NoAccessorMethod] -- public string user_agent { owned get; set construct; } -- [NoAccessorMethod] -- public string user_stylesheet_uri { owned get; set construct; } -- [NoAccessorMethod] -- public float zoom_step { get; set construct; } -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class WebView : Gtk.Container, Atk.Implementor, Gtk.Buildable { -- [CCode (type = "GtkWidget*", has_construct_function = false)] -- public WebView (); -- public bool can_copy_clipboard (); -- public bool can_cut_clipboard (); -- public bool can_go_back (); -- public bool can_go_back_or_forward (int steps); -- public bool can_go_forward (); -- public bool can_paste_clipboard (); -- public bool can_redo (); -- public bool can_show_mime_type (string mime_type); -- public bool can_undo (); -- [NoWrapper] -- public virtual unowned string choose_file (WebKit.WebFrame frame, string old_file); -- public void delete_selection (); -- public void execute_script (string script); -- public unowned WebKit.WebBackForwardList get_back_forward_list (); -- public unowned Gtk.TargetList get_copy_target_list (); -- public unowned string get_custom_encoding (); -- public bool get_editable (); -- public unowned string get_encoding (); -- public unowned WebKit.WebFrame get_focused_frame (); -- public bool get_full_content_zoom (); -- public unowned WebKit.HitTestResult get_hit_test_result (Gdk.EventButton event); -- public unowned string get_icon_uri (); -- public unowned WebKit.WebInspector get_inspector (); -- public WebKit.LoadStatus get_load_status (); -- public unowned WebKit.WebFrame get_main_frame (); -- public unowned Gtk.TargetList get_paste_target_list (); -- public double get_progress (); -- public unowned WebKit.WebSettings get_settings (); -- public unowned string get_title (); -- public bool get_transparent (); -- public unowned string get_uri (); -- public bool get_view_source_mode (); -- public unowned WebKit.WebWindowFeatures get_window_features (); -- public float get_zoom_level (); -- public void go_back (); -- public void go_back_or_forward (int steps); -- public void go_forward (); -- public bool go_to_back_forward_item (WebKit.WebHistoryItem item); -- public bool has_selection (); -- public void load_html_string (string content, string base_uri); -- public void load_request (WebKit.NetworkRequest request); -- public void load_string (string content, string mime_type, string encoding, string base_uri); -- public void load_uri (string uri); -- public uint mark_text_matches (string str, bool case_sensitive, uint limit); -- public void open (string uri); -- public void reload (); -- public void reload_bypass_cache (); -- public bool search_text (string text, bool case_sensitive, bool forward, bool wrap); -- public void set_custom_encoding (string encoding); -- public void set_editable (bool flag); -- public void set_full_content_zoom (bool full_content_zoom); -- public void set_highlight_text_matches (bool highlight); -- public void set_maintains_back_forward_list (bool flag); -- public void set_settings (WebKit.WebSettings settings); -- public void set_transparent (bool flag); -- public void set_view_source_mode (bool view_source_mode); -- public void set_zoom_level (float zoom_level); -- public void stop_loading (); -- public void unmark_text_matches (); -- public void zoom_in (); -- public void zoom_out (); -- public Gtk.TargetList copy_target_list { get; } -- public string custom_encoding { get; set; } -- public bool editable { get; set; } -- public string encoding { get; } -- public bool full_content_zoom { get; set; } -- public string icon_uri { get; } -- [NoAccessorMethod] -- public Gtk.IMContext im_context { owned get; } -- public WebKit.LoadStatus load_status { get; } -- public Gtk.TargetList paste_target_list { get; } -- public double progress { get; } -- public WebKit.WebSettings settings { get; set; } -- public string title { get; } -- public bool transparent { get; set; } -- public string uri { get; } -- [NoAccessorMethod] -- public WebKit.WebInspector web_inspector { owned get; } -- [NoAccessorMethod] -- public WebKit.WebWindowFeatures window_features { owned get; set; } -- public float zoom_level { get; set; } -- public virtual signal bool close_web_view (); -- public virtual signal bool console_message (string message, int line_number, string source_id); -- [HasEmitter] -- public virtual signal void copy_clipboard (); -- public virtual signal unowned Gtk.Widget create_plugin_widget (string p0, string p1, GLib.HashTable p2); -- public virtual signal WebKit.WebView create_web_view (WebKit.WebFrame web_frame); -- [HasEmitter] -- public virtual signal void cut_clipboard (); -- public virtual signal void database_quota_exceeded (GLib.Object p0, GLib.Object p1); -- public virtual signal void document_load_finished (WebKit.WebFrame p0); -- public virtual signal bool download_requested (GLib.Object p0); -- public virtual signal void geolocation_policy_decision_cancelled (WebKit.WebFrame p0); -- public virtual signal bool geolocation_policy_decision_requested (WebKit.WebFrame p0, WebKit.GeolocationPolicyDecision p1); -- public virtual signal void hovering_over_link (string? p0, string p1); -- public virtual signal void icon_loaded (string p0); -- public virtual signal void load_committed (WebKit.WebFrame p0); -- public virtual signal bool load_error (WebKit.WebFrame p0, string p1, GLib.Error p2); -- public virtual signal void load_finished (WebKit.WebFrame p0); -- public virtual signal void load_progress_changed (int p0); -- public virtual signal void load_started (WebKit.WebFrame p0); -- public virtual signal bool mime_type_policy_decision_requested (WebKit.WebFrame p0, WebKit.NetworkRequest p1, string p2, WebKit.WebPolicyDecision p3); -- [HasEmitter] -- public virtual signal bool move_cursor (Gtk.MovementStep step, int count); -- public virtual signal bool navigation_policy_decision_requested (WebKit.WebFrame p0, WebKit.NetworkRequest p1, WebKit.WebNavigationAction p2, WebKit.WebPolicyDecision p3); -- public virtual signal WebKit.NavigationResponse navigation_requested (WebKit.WebFrame frame, WebKit.NetworkRequest request); -- public virtual signal bool new_window_policy_decision_requested (WebKit.WebFrame p0, WebKit.NetworkRequest p1, WebKit.WebNavigationAction p2, WebKit.WebPolicyDecision p3); -- [HasEmitter] -- public virtual signal void paste_clipboard (); -- public virtual signal void populate_popup (Gtk.Menu p0); -- public virtual signal bool print_requested (WebKit.WebFrame p0); -- [HasEmitter] -- public virtual signal void redo (); -- public virtual signal void resource_request_starting (WebKit.WebFrame p0, WebKit.WebResource p1, WebKit.NetworkRequest p2, WebKit.NetworkResponse p3); -- public virtual signal bool script_alert (WebKit.WebFrame frame, string alert_message); -- public virtual signal bool script_confirm (WebKit.WebFrame frame, string confirm_message, void* did_confirm); -- public virtual signal bool script_prompt (WebKit.WebFrame frame, string message, string default_value, void* value); -- [HasEmitter] -- public virtual signal void select_all (); -- public virtual signal void selection_changed (); -- public virtual signal void set_scroll_adjustments (Gtk.Adjustment hadjustment, Gtk.Adjustment vadjustment); -- public virtual signal void status_bar_text_changed (string p0); -- public virtual signal void title_changed (WebKit.WebFrame p0, string p1); -- [HasEmitter] -- public virtual signal void undo (); -- public virtual signal bool web_view_ready (); -- public virtual signal void window_object_cleared (WebKit.WebFrame frame, void* context, void* window_object); -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public class WebWindowFeatures : GLib.Object { -- [CCode (has_construct_function = false)] -- public WebWindowFeatures (); -- public bool equal (WebKit.WebWindowFeatures features2); -- [NoAccessorMethod] -- public bool fullscreen { get; set construct; } -- [NoAccessorMethod] -- public int height { get; set construct; } -- [NoAccessorMethod] -- public bool locationbar_visible { get; set construct; } -- [NoAccessorMethod] -- public bool menubar_visible { get; set construct; } -- [NoAccessorMethod] -- public bool scrollbar_visible { get; set construct; } -- [NoAccessorMethod] -- public bool statusbar_visible { get; set construct; } -- [NoAccessorMethod] -- public bool toolbar_visible { get; set construct; } -- [NoAccessorMethod] -- public int width { get; set construct; } -- [NoAccessorMethod] -- public int x { get; set construct; } -- [NoAccessorMethod] -- public int y { get; set construct; } -- } -- [CCode (cprefix = "WEBKIT_CACHE_MODEL_", cheader_filename = "webkit/webkit.h")] -- public enum CacheModel { -- DOCUMENT_VIEWER, -- WEB_BROWSER -- } -- [CCode (cprefix = "WEBKIT_DOWNLOAD_ERROR_", cheader_filename = "webkit/webkit.h")] -- public enum DownloadError { -- CANCELLED_BY_USER, -- DESTINATION, -- NETWORK -- } -- [CCode (cprefix = "WEBKIT_DOWNLOAD_STATUS_", cheader_filename = "webkit/webkit.h")] -- public enum DownloadStatus { -- ERROR, -- CREATED, -- STARTED, -- CANCELLED, -- FINISHED -- } -- [CCode (cprefix = "WEBKIT_EDITING_BEHAVIOR_", cheader_filename = "webkit/webkit.h")] -- public enum EditingBehavior { -- MAC, -- WINDOWS -- } -- [CCode (cprefix = "WEBKIT_HIT_TEST_RESULT_CONTEXT_", cheader_filename = "webkit/webkit.h")] -- [Flags] -- public enum HitTestResultContext { -- DOCUMENT, -- LINK, -- IMAGE, -- MEDIA, -- SELECTION, -- EDITABLE -- } -- [CCode (cprefix = "WEBKIT_LOAD_", cheader_filename = "webkit/webkit.h")] -- public enum LoadStatus { -- PROVISIONAL, -- COMMITTED, -- FINISHED, -- FIRST_VISUALLY_NON_EMPTY_LAYOUT, -- FAILED -- } -- [CCode (cprefix = "WEBKIT_NAVIGATION_RESPONSE_", cheader_filename = "webkit/webkit.h")] -- public enum NavigationResponse { -- ACCEPT, -- IGNORE, -- DOWNLOAD -- } -- [CCode (cprefix = "WEBKIT_NETWORK_ERROR_", cheader_filename = "webkit/webkit.h")] -- public enum NetworkError { -- FAILED, -- TRANSPORT, -- UNKNOWN_PROTOCOL, -- CANCELLED, -- FILE_DOES_NOT_EXIST -- } -- [CCode (cprefix = "WEBKIT_PLUGIN_ERROR_", cheader_filename = "webkit/webkit.h")] -- public enum PluginError { -- FAILED, -- CANNOT_FIND_PLUGIN, -- CANNOT_LOAD_PLUGIN, -- JAVA_UNAVAILABLE, -- CONNECTION_CANCELLED, -- WILL_HANDLE_LOAD -- } -- [CCode (cprefix = "WEBKIT_POLICY_ERROR_", cheader_filename = "webkit/webkit.h")] -- public enum PolicyError { -- FAILED, -- CANNOT_SHOW_MIME_TYPE, -- CANNOT_SHOW_URL, -- FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE, -- CANNOT_USE_RESTRICTED_PORT -- } -- [CCode (cprefix = "WEBKIT_WEB_NAVIGATION_REASON_", cheader_filename = "webkit/webkit.h")] -- public enum WebNavigationReason { -- LINK_CLICKED, -- FORM_SUBMITTED, -- BACK_FORWARD, -- RELOAD, -- FORM_RESUBMITTED, -- OTHER -- } -- [CCode (cprefix = "WEBKIT_WEB_VIEW_TARGET_INFO_", cheader_filename = "webkit/webkit.h")] -- public enum WebViewTargetInfo { -- HTML, -- TEXT, -- IMAGE, -- URI_LIST, -- NETSCAPE_URL -- } -- [CCode (cheader_filename = "webkit/webkit.h")] -- public const int MAJOR_VERSION; -- [CCode (cheader_filename = "webkit/webkit.h")] -- public const int MICRO_VERSION; -- [CCode (cheader_filename = "webkit/webkit.h")] -- public const int MINOR_VERSION; -- [CCode (cheader_filename = "webkit/webkit.h")] -- public const int USER_AGENT_MAJOR_VERSION; -- [CCode (cheader_filename = "webkit/webkit.h")] -- public const int USER_AGENT_MINOR_VERSION; -- [CCode (cheader_filename = "webkit/webkit.h")] -- public static bool check_version (uint major, uint minor, uint micro); -- [CCode (cheader_filename = "webkit/webkit.h")] -- public static void geolocation_policy_allow (WebKit.GeolocationPolicyDecision decision); -- [CCode (cheader_filename = "webkit/webkit.h")] -- public static void geolocation_policy_deny (WebKit.GeolocationPolicyDecision decision); -- [CCode (cheader_filename = "webkit/webkit.h")] -- public static WebKit.CacheModel get_cache_model (); -- [CCode (cheader_filename = "webkit/webkit.h")] -- public static unowned Soup.Session get_default_session (); -- [CCode (cheader_filename = "webkit/webkit.h")] -- public static uint64 get_default_web_database_quota (); -- [CCode (cheader_filename = "webkit/webkit.h")] -- public static unowned string get_web_database_directory_path (); -- [CCode (cheader_filename = "webkit/webkit.h")] -- public static uint major_version (); -- [CCode (cheader_filename = "webkit/webkit.h")] -- public static uint micro_version (); -- [CCode (cheader_filename = "webkit/webkit.h")] -- public static uint minor_version (); -- [CCode (cheader_filename = "webkit/webkit.h")] -- public static GLib.Quark network_error_quark (); -- [CCode (cheader_filename = "webkit/webkit.h")] -- public static GLib.Quark plugin_error_quark (); -- [CCode (cheader_filename = "webkit/webkit.h")] -- public static GLib.Quark policy_error_quark (); -- [CCode (cheader_filename = "webkit/webkit.h")] -- public static void remove_all_web_databases (); -- [CCode (cheader_filename = "webkit/webkit.h")] -- public static void set_cache_model (WebKit.CacheModel cache_model); -- [CCode (cheader_filename = "webkit/webkit.h")] -- public static void set_default_web_database_quota (uint64 defaultQuota); -- [CCode (cheader_filename = "webkit/webkit.h")] -- public static void set_web_database_directory_path (string path); --} --- -2.5.0 \ No newline at end of file diff --git a/debian/patches/0501-Dont-pack-webview-into-a-scrolled-window.patch b/debian/patches/0501-Dont-pack-webview-into-a-scrolled-window.patch deleted file mode 100644 index a5820dd..0000000 --- a/debian/patches/0501-Dont-pack-webview-into-a-scrolled-window.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 130ebe6f1eda9564e89ab617bdfa30a50f828e47 Mon Sep 17 00:00:00 2001 -From: Michael Catanzaro -Date: Fri, 4 Dec 2015 17:33:43 +0100 -Subject: [PATCH] Don't pack webview into a scrolled window - -The scrollbar is drawn by WebKitWebView in WK2. - -https://bugzilla.gnome.org/show_bug.cgi?id=751709 ---- - plugins/common/RESTSupport.vala | 8 +------- - 1 file changed, 1 insertion(+), 7 deletions(-) - -Index: trunk/plugins/common/RESTSupport.vala -=================================================================== ---- trunk.orig/plugins/common/RESTSupport.vala -+++ trunk/plugins/common/RESTSupport.vala -@@ -725,7 +725,6 @@ public abstract class GooglePublisher : - - private WebKit.WebView webview; - private Gtk.Box pane_widget; -- private Gtk.ScrolledWindow webview_frame; - private string auth_sequence_start_url; - - public signal void authorized(string auth_code); -@@ -735,18 +734,13 @@ public abstract class GooglePublisher : - - pane_widget = new Gtk.Box(Gtk.Orientation.VERTICAL, 0); - -- webview_frame = new Gtk.ScrolledWindow(null, null); -- webview_frame.set_shadow_type(Gtk.ShadowType.ETCHED_IN); -- webview_frame.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC); -- - webview = new WebKit.WebView(); - webview.get_settings().enable_plugins = false; - - 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); -+ pane_widget.pack_start(webview, true, true, 0); - } - - public static bool is_cache_dirty() { diff --git a/debian/patches/0502-Have-all-soup-sessions-validate-TLS-certificates.patch b/debian/patches/0502-Have-all-soup-sessions-validate-TLS-certificates.patch deleted file mode 100644 index df24283..0000000 --- a/debian/patches/0502-Have-all-soup-sessions-validate-TLS-certificates.patch +++ /dev/null @@ -1,39 +0,0 @@ -From ac6efab13554d1ef39eb8b86744234d72773c2da Mon Sep 17 00:00:00 2001 -From: Michael Catanzaro -Date: Fri, 4 Dec 2015 17:34:17 +0100 -Subject: [PATCH] Have all soup sessions validate TLS certificates - -Note that this commit is *not* sufficient to fix certificate verification -on its own. The port to WK2 is also required, else WebKit's soup session -will not verify certificates. - -https://bugzilla.gnome.org/show_bug.cgi?id=751709 ---- - plugins/common/RESTSupport.vala | 1 + - plugins/shotwell-publishing/FacebookPublishing.vala | 1 + - 2 files changed, 2 insertions(+) - -Index: trunk/plugins/common/RESTSupport.vala -=================================================================== ---- trunk.orig/plugins/common/RESTSupport.vala -+++ trunk/plugins/common/RESTSupport.vala -@@ -20,6 +20,7 @@ public abstract class Session { - public Session(string? endpoint_url = null) { - this.endpoint_url = endpoint_url; - soup_session = new Soup.SessionAsync(); -+ this.soup_session.ssl_use_system_ca_file = true; - } - - protected void notify_wire_message_unqueued(Soup.Message message) { -Index: trunk/plugins/shotwell-publishing/FacebookPublishing.vala -=================================================================== ---- trunk.orig/plugins/shotwell-publishing/FacebookPublishing.vala -+++ trunk/plugins/shotwell-publishing/FacebookPublishing.vala -@@ -1473,6 +1473,7 @@ internal class GraphSession { - this.soup_session.timeout = 15; - this.access_token = null; - this.current_message = null; -+ this.soup_session.ssl_use_system_ca_file = true; - } - - ~GraphSession() { diff --git a/debian/patches/0503-facebook-Dont-disable-XSS-auditor.patch b/debian/patches/0503-facebook-Dont-disable-XSS-auditor.patch deleted file mode 100644 index 976b6ec..0000000 --- a/debian/patches/0503-facebook-Dont-disable-XSS-auditor.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 2a1dd48e702b0e8524a4ed212252aa4c49c6b0f0 Mon Sep 17 00:00:00 2001 -From: Michael Catanzaro -Date: Fri, 4 Dec 2015 18:08:54 +0100 -Subject: [PATCH] facebook: Don't disable XSS auditor - -This is a separate commit to make it possible to revert easily, as -I don't know why it was disabled. - -https://bugzilla.gnome.org/show_bug.cgi?id=751709 ---- - plugins/shotwell-publishing/FacebookPublishing.vala | 1 - - 1 file changed, 1 deletion(-) - -Index: trunk/plugins/shotwell-publishing/FacebookPublishing.vala -=================================================================== ---- trunk.orig/plugins/shotwell-publishing/FacebookPublishing.vala -+++ trunk/plugins/shotwell-publishing/FacebookPublishing.vala -@@ -829,7 +829,6 @@ internal class WebAuthenticationPane : S - - webview = new WebKit.WebView(); - webview.get_settings().enable_plugins = false; -- webview.get_settings().enable_xss_auditor = false; - - webview.load_changed.connect(on_page_load_changed); - webview.context_menu.connect(() => { return true; }); diff --git a/debian/patches/0510-Delay_size_request.patch b/debian/patches/0510-Delay_size_request.patch deleted file mode 100644 index 7c03791..0000000 --- a/debian/patches/0510-Delay_size_request.patch +++ /dev/null @@ -1,26 +0,0 @@ -Description: Delay size_request -Author: Jens Georg -Origin: https://git.gnome.org/browse/shotwell/commit/?id=4a70d87 -Bug: https://bugzilla.gnome.org/show_bug.cgi?id=766864 -Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823835 -Forwarded: not-needed -Last-Update: 2015-06-05 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: trunk/src/CheckerboardLayout.vala -=================================================================== ---- trunk.orig/src/CheckerboardLayout.vala -+++ trunk/src/CheckerboardLayout.vala -@@ -911,7 +911,11 @@ public class CheckerboardLayout : Gtk.Dr - debug("on_viewport_resized: due_to_reflow=%s set_size_request %dx%d", - size_allocate_due_to_reflow.to_string(), parent_allocation.width, req.height); - #endif -- set_size_request(parent_allocation.width - SCROLLBAR_PLACEHOLDER_WIDTH, req.height); -+ // But if the current height is 0, don't request a size yet. Delay -+ // it to do_reflow (bgo#766864) -+ if (req.height != 0) { -+ set_size_request(parent_allocation.width - SCROLLBAR_PLACEHOLDER_WIDTH, req.height); -+ } - } else { - // set the layout's width and height to always match the parent's - set_size_request(parent_allocation.width, parent_allocation.height); diff --git a/debian/patches/0515-Fix_background_color_drawing.patch b/debian/patches/0515-Fix_background_color_drawing.patch deleted file mode 100644 index 04a1adb..0000000 --- a/debian/patches/0515-Fix_background_color_drawing.patch +++ /dev/null @@ -1,32 +0,0 @@ -Description: Fix background color drawing -Author: Jens Georg -Origin: https://git.gnome.org/browse/shotwell/commit/?id=7361b3f -Bug: https://bugzilla.gnome.org/show_bug.cgi?id=766864 -Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823835 -Forwarded: not-needed -Last-Update: 2015-06-05 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: trunk/src/CheckerboardLayout.vala -=================================================================== ---- trunk.orig/src/CheckerboardLayout.vala -+++ trunk/src/CheckerboardLayout.vala -@@ -1812,6 +1812,10 @@ public class CheckerboardLayout : Gtk.Dr - // we want switched_to() to be the final call in the process (indicating that the page is - // now in place and should do its thing to update itself), have to be be prepared for - // GTK/GDK calls between the widgets being actually present on the screen and "switched to" -+ -+ Gtk.Allocation allocation; -+ get_allocation(out allocation); -+ get_style_context().render_background (ctx, 0, 0, allocation.width, allocation.height); - - // watch for message mode - if (message == null) { -@@ -1833,7 +1837,6 @@ public class CheckerboardLayout : Gtk.Dr - int text_width, text_height; - pango_layout.get_pixel_size(out text_width, out text_height); - -- Gtk.Allocation allocation; - get_allocation(out allocation); - - int x = allocation.width - text_width; diff --git a/debian/patches/0600-remove_wrong_marco.patch b/debian/patches/0600-remove_wrong_marco.patch deleted file mode 100644 index 42ec942..0000000 --- a/debian/patches/0600-remove_wrong_marco.patch +++ /dev/null @@ -1,19 +0,0 @@ -Description: Remove wrong macro 'R' from manpage -Author: Jörg Frings-Fürst -Last-Update: 2016-08-20 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: trunk/help/shotwell.1 -=================================================================== ---- trunk.orig/help/shotwell.1 -+++ trunk/help/shotwell.1 -@@ -13,7 +13,8 @@ import photos from disk or camera, organ - - .SH "OPTIONS" - .B \-h, \-\-help --.R Show help options -+Show help options -+.RE - - .B \-d, \-\-datadir=DIRECTORY - .RS diff --git a/debian/patches/06_uoa.patch b/debian/patches/06_uoa.patch new file mode 100644 index 0000000..08ece96 --- /dev/null +++ b/debian/patches/06_uoa.patch @@ -0,0 +1,2492 @@ +Description: Use Ubuntu Online Accounts for Picasa, Facebook and Flickr export plugins. +Author: Alberto Mardegan + +--- +Index: b/Makefile +=================================================================== +--- a/Makefile ++++ b/Makefile +@@ -161,7 +161,11 @@ + + SYS_INTEGRATION_FILES = \ + shotwell.appdata.xml \ ++ shotwell.application \ + shotwell.desktop.head \ ++ shotwell-sharing-facebook.service \ ++ shotwell-sharing-flickr.service \ ++ shotwell-sharing-picasa.service \ + shotwell-viewer.desktop.head \ + org.yorba.shotwell.gschema.xml \ + org.yorba.shotwell-extras.gschema.xml \ +@@ -252,6 +256,7 @@ + EXT_PKGS = \ + atk \ + gdk-3.0 \ ++ gdk-x11-3.0 \ + gee-0.8 \ + gexiv2 \ + gio-unix-2.0 \ +@@ -513,6 +518,12 @@ + mkdir -p $(DESTDIR)$(LIBEXECDIR) + $(INSTALL_PROGRAM) $(THUMBNAILER_BIN) $(DESTDIR)$(LIBEXECDIR) + $(INSTALL_PROGRAM) $(MIGRATOR_BIN) $(DESTDIR)$(LIBEXECDIR) ++ mkdir -p $(DESTDIR)$(PREFIX)/share/accounts/applications ++ $(INSTALL_DATA) misc/shotwell.application $(DESTDIR)$(PREFIX)/share/accounts/applications ++ mkdir -p $(DESTDIR)$(PREFIX)/share/accounts/services ++ $(INSTALL_DATA) misc/shotwell-sharing-facebook.service $(DESTDIR)$(PREFIX)/share/accounts/services ++ $(INSTALL_DATA) misc/shotwell-sharing-flickr.service $(DESTDIR)$(PREFIX)/share/accounts/services ++ $(INSTALL_DATA) misc/shotwell-sharing-picasa.service $(DESTDIR)$(PREFIX)/share/accounts/services + mkdir -p $(DESTDIR)$(PREFIX)/share/shotwell/icons + $(INSTALL_DATA) icons/* $(DESTDIR)$(PREFIX)/share/shotwell/icons + mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps +Index: b/misc/shotwell.application +=================================================================== +--- /dev/null ++++ b/misc/shotwell.application +@@ -0,0 +1,19 @@ ++ ++ ++ Shotwell ++ shotwell.desktop ++ shotwell ++ ++ ++ ++ Publish your pictures to Picasa ++ ++ ++ Publish your pictures to Facebook ++ ++ ++ Publish your pictures to Flickr ++ ++ ++ ++ +Index: b/plugins/Makefile +=================================================================== +--- a/plugins/Makefile ++++ b/plugins/Makefile +@@ -4,7 +4,10 @@ + DIST_FILES := \ + Makefile \ + Makefile.plugin.mk \ +- plugins.mk ++ plugins.mk \ ++ Accounts.vapi \ ++ Accounts.deps \ ++ Signon.vapi + + .PHONY: all + all: $(ALL_PLUGINS) +Index: b/plugins/Makefile.plugin.mk +=================================================================== +--- a/plugins/Makefile.plugin.mk ++++ b/plugins/Makefile.plugin.mk +@@ -27,6 +27,8 @@ + # automatically include the shotwell-plugin-dev-1.0 package as a local dependency + EXT_PKGS := $(PKGS) + PKGS := shotwell-plugin-dev-1.0 $(PKGS) $(PLUGIN_PKGS) ++EXT_PKGS := libsignon-glib libaccounts-glib $(EXT_PKGS) ++PKGS := signon libaccounts-glib $(PKGS) + + # automatically include the Resources.vala common file + SRC_FILES := ../common/Resources.vala $(SRC_FILES) +Index: b/plugins/common/RESTSupport.vala +=================================================================== +--- a/plugins/common/RESTSupport.vala ++++ b/plugins/common/RESTSupport.vala +@@ -312,7 +312,7 @@ + old_url = message.get_uri().to_string(false); + url_with_query = get_endpoint_url() + "?" + formdata_string; + message.set_uri(new Soup.URI(url_with_query)); +- } else { ++ } else if (get_method() == HttpMethod.POST) { + message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, + formdata_string.data); + } +@@ -875,6 +875,21 @@ + do_get_access_tokens(auth_code); + } + ++ protected void on_authenticator_authenticated(owned Variant session_data) { ++ host.install_account_fetch_wait_pane(); ++ ++ Variant? v_token = session_data.lookup_value("AccessToken", null); ++ if (v_token != null) { ++ string token = v_token.get_string(); ++ debug("OAuth Access Token: %s", token); ++ session.access_token = token; ++ ++ do_fetch_username(); ++ } else { ++ debug("Access token not present!"); ++ } ++ } ++ + private void on_get_access_tokens_complete(Publishing.RESTSupport.Transaction txn) { + txn.completed.disconnect(on_get_access_tokens_complete); + txn.network_error.disconnect(on_get_access_tokens_error); +Index: b/plugins/common/accounts.vala +=================================================================== +--- /dev/null ++++ b/plugins/common/accounts.vala +@@ -0,0 +1,238 @@ ++/* Copyright 2009-2011 Yorba Foundation ++ * ++ * This software is licensed under the GNU Lesser General Public License ++ * (version 2.1 or later). See the COPYING file in this distribution. ++ */ ++ ++namespace Publishing.Accounts { ++ ++public class SharingAccount { ++ private Ag.AccountService account_service = null; ++ ++ public SharingAccount(Ag.AccountService account_service) { ++ this.account_service = account_service; ++ } ++ ++ public Signon.AuthSession create_auth_session() throws GLib.Error { ++ var auth_data = account_service.get_auth_data(); ++ debug("Signon-id: %u", auth_data.get_credentials_id()); ++ ++ return new Signon.AuthSession(auth_data.get_credentials_id(), ++ auth_data.get_method()); ++ } ++ ++ public Variant get_session_parameters(Variant? extra, out string mechanism) { ++ var auth_data = account_service.get_auth_data(); ++ mechanism = auth_data.get_mechanism(); ++ Variant data = auth_data.get_login_parameters(extra); ++ return data; ++ } ++} ++ ++public class SharingAccounts { ++ private static Ag.Manager manager = null; ++ private string provider_name; ++ private Ag.AccountService[] all_accounts; ++ ++ public SharingAccounts(string provider_name) { ++ if (manager == null) { ++ manager = new Ag.Manager.for_service_type("shotwell-sharing"); ++ } ++ manager.enabled_event.connect(on_account_enabled); ++ ++ this.provider_name = provider_name; ++ all_accounts = get_accounts(); ++ } ++ ++ private void on_account_enabled(uint account_id) { ++ /* To keep the implementation simple, just rebuild the account ++ * list from scratch */ ++ all_accounts = get_accounts(); ++ } ++ ++ private Ag.AccountService[] get_accounts() { ++ GLib.List accounts = ++ manager.get_enabled_account_services(); ++ ++ Ag.AccountService[] list = {}; ++ ++ foreach (Ag.AccountService account_service in accounts) { ++ Ag.Account account = account_service.get_account(); ++ if (account.get_provider_name() == provider_name) { ++ list += account_service; ++ } ++ } ++ return list; ++ } ++ ++ public bool has_enabled_accounts() { ++ return all_accounts.length > 0; ++ } ++ ++ public string[] list_account_names() { ++ string[] names = {}; ++ foreach (Ag.AccountService account_service in all_accounts) { ++ names += account_service.get_account().get_display_name(); ++ } ++ return names; ++ } ++ ++ public SharingAccount? find_account(string? account_name) { ++ foreach (Ag.AccountService account_service in all_accounts) ++ if (account_service.get_account().get_display_name() == account_name) { ++ return new SharingAccount(account_service); ++ } ++ ++ return null; ++ } ++} ++ ++public abstract class UOAPublishingService : Object, Spit.Pluggable, Spit.Publishing.Service { ++ private SharingAccounts account_manager; ++ ++ public UOAPublishingService(string provider_name) { ++ account_manager = new SharingAccounts(provider_name); ++ } ++ ++ public virtual int get_pluggable_interface(int min_host_interface, int max_host_interface) { ++ return Spit.negotiate_interfaces(min_host_interface, max_host_interface, ++ Spit.Publishing.CURRENT_INTERFACE); ++ } ++ ++ public abstract unowned string get_id(); ++ ++ public abstract unowned string get_pluggable_name(); ++ ++ public abstract void get_info(ref Spit.PluggableInfo info); ++ ++ public virtual void activation(bool enabled) { ++ } ++ ++ public abstract Spit.Publishing.Publisher create_publisher(string? account_name, Spit.Publishing.PluginHost host); ++ ++ public abstract Spit.Publishing.Publisher.MediaType get_supported_media(); ++ ++ public SharingAccount? find_account(string? account_name) { ++ return account_manager.find_account(account_name); ++ } ++ ++ public bool is_enabled() { ++ return account_manager.has_enabled_accounts(); ++ } ++ ++ public string[] list_account_names() { ++ return account_manager.list_account_names(); ++ } ++} ++ ++public class UOAPublisherAuthenticator : Object { ++ private weak Spit.Publishing.PluginHost host = null; ++ private Signon.AuthSession auth_session = null; ++ private SharingAccount account = null; ++ private bool firstLoginAttempt = true; ++ private bool invalidate_session = false; ++ private string welcome_message = null; ++ ++ public UOAPublisherAuthenticator(SharingAccount account, ++ Spit.Publishing.PluginHost host, ++ string welcome_message) ++ { ++ this.host = host; ++ this.account = account; ++ this.welcome_message = welcome_message; ++ } ++ ++ public signal void authenticated(owned Variant session_data); ++ ++ public void authenticate() { ++ debug("ACTION: authentication requested."); ++ ++ do_authentication(); ++ } ++ ++ public Variant? get_authentication_data() { ++ if (account == null) return null; ++ string mechanism = null; ++ return account.get_session_parameters(null, out mechanism); ++ } ++ ++ public void invalidate_persistent_session() { ++ this.invalidate_session = true; ++ } ++ ++ private void do_authentication() { ++ debug("ACTION: authenticating."); ++ ++ if (account != null) { ++ try { ++ auth_session = account.create_auth_session(); ++ } catch (GLib.Error e) { ++ warning("EVENT: couldn't create session for account: %s", ++ e.message); ++ } ++ } ++ ++ VariantBuilder builder = new VariantBuilder(new VariantType("a{sv}")); ++ ++ if (firstLoginAttempt) { ++ firstLoginAttempt = false; ++ builder.add ("{sv}", "UiPolicy", ++ new Variant.int32((int)Signon.SessionDataUiPolicy.NO_USER_INTERACTION)); ++ } else { ++ var windowId = host.get_dialog_xid(); ++ if (windowId != 0) { ++ builder.add ("{sv}", "WindowId", ++ new Variant.uint32((uint)windowId)); ++ } ++ } ++ ++ if (invalidate_session) { ++ invalidate_session = false; ++ builder.add("{sv}", "ForceTokenRefresh", new Variant.boolean(true)); ++ } ++ ++ string mechanism = null; ++ Variant data = account.get_session_parameters(builder.end(), out mechanism); ++ if (data == null) { ++ warning ("No account authentication data"); ++ host.post_error(new Spit.Publishing.PublishingError.SERVICE_ERROR( ++ "Error while accessing the account")); ++ return; ++ } ++ ++ debug("Got account data"); ++ ++ host.set_service_locked(true); ++ auth_session.process_async.begin(data, mechanism, null, ++ (obj, res) => { ++ host.set_service_locked(false); ++ try { ++ Variant reply = auth_session.process_async.end(res); ++ authenticated(reply); ++ } catch (GLib.Error error) { ++ debug("got error: %s", error.message); ++ if (error is Signon.Error.USER_INTERACTION) { ++ debug("User interaction!"); ++ do_show_service_welcome_pane(); ++ } else { ++ host.post_error(new Spit.Publishing.PublishingError.SERVICE_ERROR("Authentication failed")); ++ } ++ } ++ }); ++ } ++ ++ private void do_show_service_welcome_pane() { ++ debug("ACTION: showing service welcome pane."); ++ ++ host.install_welcome_pane(welcome_message, on_service_welcome_login); ++ } ++ ++ private void on_service_welcome_login() { ++ debug("EVENT: user clicked 'Login' in welcome pane."); ++ ++ do_authentication(); ++ } ++} ++ ++} ++ +Index: b/plugins/shotwell-publishing-extras/TumblrPublishing.vala +=================================================================== +--- a/plugins/shotwell-publishing-extras/TumblrPublishing.vala ++++ b/plugins/shotwell-publishing-extras/TumblrPublishing.vala +@@ -45,7 +45,7 @@ + public void activation(bool enabled) { + } + +- public Spit.Publishing.Publisher create_publisher(Spit.Publishing.PluginHost host) { ++ public Spit.Publishing.Publisher create_publisher(string? account, Spit.Publishing.PluginHost host) { + return new Publishing.Tumblr.TumblrPublisher(this, host); + } + +Index: b/plugins/shotwell-publishing-extras/YandexPublishing.vala +=================================================================== +--- a/plugins/shotwell-publishing-extras/YandexPublishing.vala ++++ b/plugins/shotwell-publishing-extras/YandexPublishing.vala +@@ -28,7 +28,7 @@ + info.license = Resources.LICENSE; + } + +- public Spit.Publishing.Publisher create_publisher(Spit.Publishing.PluginHost host) { ++ public Spit.Publishing.Publisher create_publisher(string? account, Spit.Publishing.PluginHost host) { + return new Publishing.Yandex.YandexPublisher(this, host); + } + +Index: b/plugins/shotwell-publishing/FacebookPublishing.vala +=================================================================== +--- a/plugins/shotwell-publishing/FacebookPublishing.vala ++++ b/plugins/shotwell-publishing/FacebookPublishing.vala +@@ -4,30 +4,28 @@ + * (version 2.1 or later). See the COPYING file in this distribution. + */ + +-public class FacebookService : Object, Spit.Pluggable, Spit.Publishing.Service { ++using Publishing.Accounts; ++ ++public class FacebookService : UOAPublishingService { + private const string ICON_FILENAME = "facebook.png"; + + private static Gdk.Pixbuf[] icon_pixbuf_set = null; + + public FacebookService(GLib.File resource_directory) { ++ base("facebook"); + if (icon_pixbuf_set == null) + icon_pixbuf_set = Resources.load_icon_set(resource_directory.get_child(ICON_FILENAME)); + } + +- public int get_pluggable_interface(int min_host_interface, int max_host_interface) { +- return Spit.negotiate_interfaces(min_host_interface, max_host_interface, +- Spit.Publishing.CURRENT_INTERFACE); +- } +- +- public unowned string get_id() { ++ public override unowned string get_id() { + return "org.yorba.shotwell.publishing.facebook"; + } + +- public unowned string get_pluggable_name() { ++ public override unowned string get_pluggable_name() { + return "Facebook"; + } + +- public void get_info(ref Spit.PluggableInfo info) { ++ public override void get_info(ref Spit.PluggableInfo info) { + info.authors = "Lucas Beeler"; + info.copyright = _("Copyright 2009-2015 Yorba Foundation"); + info.translators = Resources.TRANSLATORS; +@@ -39,14 +37,12 @@ + info.icons = icon_pixbuf_set; + } + +- public void activation(bool enabled) { +- } +- +- public Spit.Publishing.Publisher create_publisher(Spit.Publishing.PluginHost host) { +- return new Publishing.Facebook.FacebookPublisher(this, host); ++ public override Spit.Publishing.Publisher create_publisher(string? account_name, Spit.Publishing.PluginHost host) { ++ SharingAccount account = find_account(account_name); ++ return new Publishing.Facebook.FacebookPublisher(this, account, host); + } + +- public Spit.Publishing.Publisher.MediaType get_supported_media() { ++ public override Spit.Publishing.Publisher.MediaType get_supported_media() { + return (Spit.Publishing.Publisher.MediaType.PHOTO | + Spit.Publishing.Publisher.MediaType.VIDEO); + } +@@ -57,12 +53,9 @@ + // truly, deep-down know what you're doing) + public const string SERVICE_NAME = "facebook"; + internal const string USER_VISIBLE_NAME = "Facebook"; +-internal const string APPLICATION_ID = "162702932093"; + internal const string DEFAULT_ALBUM_NAME = _("Shotwell Connect"); + internal const string SERVICE_WELCOME_MESSAGE = + _("You are not currently logged into Facebook.\n\nIf you don't yet have a Facebook account, you can create one during the login process. During login, Shotwell Connect may ask you for permission to upload photos and publish to your feed. These permissions are required for Shotwell Connect to function."); +-internal const string RESTART_ERROR_MESSAGE = +- _("You have already logged in and out of Facebook during this Shotwell session.\nTo continue publishing to Facebook, quit and restart Shotwell, then try publishing again."); + internal const string USER_AGENT = "Java/1.6.0_16"; + internal const int EXPIRED_SESSION_STATUS_CODE = 400; + +@@ -173,7 +166,6 @@ + public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object { + private PublishingParameters publishing_params; + private weak Spit.Publishing.PluginHost host = null; +- private WebAuthenticationPane web_auth_pane = null; + private Spit.Publishing.ProgressCallback progress_reporter = null; + private weak Spit.Publishing.Service service = null; + private bool running = false; +@@ -182,8 +174,10 @@ + private Uploader? uploader = null; + private string? uid = null; + private string? username = null; ++ private UOAPublisherAuthenticator authenticator = null; + + public FacebookPublisher(Spit.Publishing.Service service, ++ SharingAccount account, + Spit.Publishing.PluginHost host) { + debug("FacebookPublisher instantiated."); + +@@ -194,32 +188,16 @@ + + this.graph_session = new GraphSession(); + graph_session.authenticated.connect(on_session_authenticated); +- } +- +- private bool is_persistent_session_valid() { +- string? token = get_persistent_access_token(); + +- if (token != null) +- debug("existing Facebook session found in configuration database (access_token = %s).", +- token); +- else +- debug("no existing Facebook session available."); +- +- return token != null; ++ authenticator = new UOAPublisherAuthenticator(account, host, ++ SERVICE_WELCOME_MESSAGE); ++ authenticator.authenticated.connect(on_authenticator_authenticated); + } + +- private string? get_persistent_access_token() { +- return host.get_config_string("access_token", null); +- } +- + private bool get_persistent_strip_metadata() { + return host.get_config_bool("strip_metadata", false); + } + +- private void set_persistent_access_token(string access_token) { +- host.set_config_string("access_token", access_token); +- } +- + private void set_persistent_strip_metadata(bool strip_metadata) { + host.set_config_bool("strip_metadata", strip_metadata); + } +@@ -237,29 +215,9 @@ + private void invalidate_persistent_session() { + debug("invalidating saved Facebook session."); + +- set_persistent_access_token(""); ++ authenticator.invalidate_persistent_session(); + } + +- private void do_show_service_welcome_pane() { +- debug("ACTION: showing service welcome pane."); +- +- host.install_welcome_pane(SERVICE_WELCOME_MESSAGE, on_login_clicked); +- host.set_service_locked(false); +- } +- +- private void do_test_connection_to_endpoint() { +- debug("ACTION: testing connection to Facebook endpoint."); +- host.set_service_locked(true); +- +- host.install_static_message_pane(_("Testing connection to Facebook...")); +- +- GraphMessage endpoint_test_message = graph_session.new_endpoint_test(); +- endpoint_test_message.completed.connect(on_endpoint_test_completed); +- endpoint_test_message.failed.connect(on_endpoint_test_error); +- +- graph_session.send_message(endpoint_test_message); +- } +- + private void do_fetch_user_info() { + debug("ACTION: fetching user information."); + +@@ -377,7 +335,6 @@ + + publishing_options_pane = new PublishingOptionsPane(username, publishing_params.albums, + host.get_publishable_media_type(), this, builder, get_persistent_strip_metadata()); +- publishing_options_pane.logout.connect(on_publishing_options_pane_logout); + publishing_options_pane.publish.connect(on_publishing_options_pane_publish); + host.install_dialog_pane(publishing_options_pane, + Spit.Publishing.PluginHost.ButtonMode.CANCEL); +@@ -411,60 +368,14 @@ + do_upload(); + } + +- private void do_hosted_web_authentication() { +- debug("ACTION: doing hosted web authentication."); +- +- host.set_service_locked(false); +- +- web_auth_pane = new WebAuthenticationPane(); +- web_auth_pane.login_succeeded.connect(on_web_auth_pane_login_succeeded); +- web_auth_pane.login_failed.connect(on_web_auth_pane_login_failed); +- +- host.install_dialog_pane(web_auth_pane, +- Spit.Publishing.PluginHost.ButtonMode.CANCEL); +- +- } +- +- private void do_authenticate_session(string good_login_uri) { +- debug("ACTION: preparing to extract session information encoded in uri = '%s'", +- good_login_uri); +- +- // the raw uri is percent-encoded, so decode it +- string decoded_uri = Soup.URI.decode(good_login_uri); +- +- // locate the access token within the URI +- string? access_token = null; +- int index = decoded_uri.index_of("#access_token="); +- if (index >= 0) +- access_token = decoded_uri[index:decoded_uri.length]; +- if (access_token == null) { +- host.post_error(new Spit.Publishing.PublishingError.MALFORMED_RESPONSE( +- "Server redirect URL contained no access token")); +- return; +- } +- +- // remove any trailing parameters from the session description string +- string? trailing_params = null; +- index = access_token.index_of_char('&'); +- if (index >= 0) +- trailing_params = access_token[index:access_token.length]; +- if (trailing_params != null) +- access_token = access_token.replace(trailing_params, ""); +- +- // remove the key from the session description string +- access_token = access_token.replace("#access_token=", ""); +- +- // we've got an access token! ++ public void on_authenticator_authenticated(owned Variant session_data) { + graph_session.authenticated.connect(on_session_authenticated); ++ string access_token = ++ session_data.lookup_value("AccessToken", null).get_string(); ++ debug("Access Token: %s", access_token); + graph_session.authenticate(access_token); + } + +- private void do_save_session_information() { +- debug("ACTION: saving session information to configuration system."); +- +- set_persistent_access_token(graph_session.get_access_token()); +- } +- + private void do_upload() { + debug("ACTION: uploading photos to album '%s'", + publishing_params.target_album == PublishingParameters.UNKNOWN_ALBUM ? "(none)" : +@@ -505,67 +416,6 @@ + host.post_error(error); + } + +- private void on_login_clicked() { +- if (!is_running()) +- return; +- +- debug("EVENT: user clicked 'Login' on welcome pane."); +- +- do_test_connection_to_endpoint(); +- } +- +- private void on_endpoint_test_completed(GraphMessage message) { +- message.completed.disconnect(on_endpoint_test_completed); +- message.failed.disconnect(on_endpoint_test_error); +- +- if (!is_running()) +- return; +- +- debug("EVENT: endpoint test transaction detected that the Facebook endpoint is alive."); +- +- do_hosted_web_authentication(); +- } +- +- private void on_endpoint_test_error(GraphMessage message, +- Spit.Publishing.PublishingError error) { +- message.completed.disconnect(on_endpoint_test_completed); +- message.failed.disconnect(on_endpoint_test_error); +- +- if (!is_running()) +- return; +- +- debug("EVENT: endpoint test transaction failed to detect a connection to the Facebook " + +- "endpoint" + error.message); +- +- on_generic_error(error); +- } +- +- private void on_web_auth_pane_login_succeeded(string success_url) { +- if (!is_running()) +- return; +- +- debug("EVENT: hosted web login succeeded."); +- +- do_authenticate_session(success_url); +- } +- +- +- +- private void on_web_auth_pane_login_failed() { +- if (!is_running()) +- return; +- +- debug("EVENT: hosted web login failed."); +- +- // In this case, "failed" doesn't mean that the user didn't enter the right username and +- // password -- Facebook handles that case inside the Facebook Connect web control. Instead, +- // it means that no session was initiated in response to our login request. The only +- // way this happens is if the user clicks the "Cancel" button that appears inside +- // the web control. In this case, the correct behavior is to return the user to the +- // service welcome pane so that they can start the web interaction again. +- do_show_service_welcome_pane(); +- } +- + private void on_session_authenticated() { + graph_session.authenticated.disconnect(on_session_authenticated); + +@@ -575,7 +425,6 @@ + assert(graph_session.is_authenticated()); + debug("EVENT: an authenticated session has become available."); + +- do_save_session_information(); + do_fetch_user_info(); + } + +@@ -649,22 +498,9 @@ + do_show_publishing_options_pane(); + } + +- private void on_publishing_options_pane_logout() { +- publishing_options_pane.publish.disconnect(on_publishing_options_pane_publish); +- publishing_options_pane.logout.disconnect(on_publishing_options_pane_logout); +- +- if (!is_running()) +- return; +- +- debug("EVENT: user clicked 'Logout' in publishing options pane."); +- +- do_logout(); +- } +- + private void on_publishing_options_pane_publish(string? target_album, string privacy_setting, + Resolution resolution, bool strip_metadata) { + publishing_options_pane.publish.disconnect(on_publishing_options_pane_publish); +- publishing_options_pane.logout.disconnect(on_publishing_options_pane_logout); + + if (!is_running()) + return; +@@ -780,20 +616,7 @@ + // actually a restart + publishing_params = new PublishingParameters(); + +- // Do we have saved user credentials? If so, go ahead and authenticate the session +- // with the saved credentials and proceed with the publishing interaction. Otherwise, show +- // the Welcome pane +- if (is_persistent_session_valid()) { +- graph_session.authenticate(get_persistent_access_token()); +- } else { +- if (WebAuthenticationPane.is_cache_dirty()) { +- host.set_service_locked(false); +- host.install_static_message_pane(RESTART_ERROR_MESSAGE, +- Spit.Publishing.PluginHost.ButtonMode.CANCEL); +- } else { +- do_show_service_welcome_pane(); +- } +- } ++ authenticator.authenticate(); + } + + public void stop() { +@@ -811,204 +634,6 @@ + } + } + +-internal class WebAuthenticationPane : Spit.Publishing.DialogPane, Object { +- private WebKit.WebView webview = null; +- private Gtk.Box pane_widget = null; +- private Gtk.ScrolledWindow webview_frame = null; +- private static bool cache_dirty = false; +- +- public signal void login_succeeded(string success_url); +- public signal void login_failed(); +- +- public WebAuthenticationPane() { +- pane_widget = new Gtk.Box(Gtk.Orientation.VERTICAL, 0); +- +- webview_frame = new Gtk.ScrolledWindow(null, null); +- webview_frame.set_shadow_type(Gtk.ShadowType.ETCHED_IN); +- webview_frame.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC); +- +- webview = new WebKit.WebView(); +- webview.get_settings().enable_plugins = false; +- +- 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; +- public string? exception_code; +- public string? exception_translation; +- public string? exception_code_2; +- public string? exception_translation_2; +- +- public LocaleLookup(string prefix, string translation, string? exception_code = null, +- string? exception_translation = null, string? exception_code_2 = null, +- string? exception_translation_2 = null) { +- this.prefix = prefix; +- this.translation = translation; +- this.exception_code = exception_code; +- this.exception_translation = exception_translation; +- this.exception_code_2 = exception_code_2; +- this.exception_translation_2 = exception_translation_2; +- } +- +- } +- +- private LocaleLookup[] locale_lookup_table = { +- new LocaleLookup( "es", "es-la", "ES", "es-es" ), +- new LocaleLookup( "en", "en-gb", "US", "en-us" ), +- new LocaleLookup( "fr", "fr-fr", "CA", "fr-ca" ), +- new LocaleLookup( "pt", "pt-br", "PT", "pt-pt" ), +- new LocaleLookup( "zh", "zh-cn", "HK", "zh-hk", "TW", "zh-tw" ), +- new LocaleLookup( "af", "af-za" ), +- new LocaleLookup( "ar", "ar-ar" ), +- new LocaleLookup( "nb", "nb-no" ), +- new LocaleLookup( "no", "nb-no" ), +- new LocaleLookup( "id", "id-id" ), +- new LocaleLookup( "ms", "ms-my" ), +- new LocaleLookup( "ca", "ca-es" ), +- new LocaleLookup( "cs", "cs-cz" ), +- new LocaleLookup( "cy", "cy-gb" ), +- new LocaleLookup( "da", "da-dk" ), +- new LocaleLookup( "de", "de-de" ), +- new LocaleLookup( "tl", "tl-ph" ), +- new LocaleLookup( "ko", "ko-kr" ), +- new LocaleLookup( "hr", "hr-hr" ), +- new LocaleLookup( "it", "it-it" ), +- new LocaleLookup( "lt", "lt-lt" ), +- new LocaleLookup( "hu", "hu-hu" ), +- new LocaleLookup( "nl", "nl-nl" ), +- new LocaleLookup( "ja", "ja-jp" ), +- new LocaleLookup( "nb", "nb-no" ), +- new LocaleLookup( "no", "nb-no" ), +- new LocaleLookup( "pl", "pl-pl" ), +- new LocaleLookup( "ro", "ro-ro" ), +- new LocaleLookup( "ru", "ru-ru" ), +- new LocaleLookup( "sk", "sk-sk" ), +- new LocaleLookup( "sl", "sl-si" ), +- new LocaleLookup( "sv", "sv-se" ), +- new LocaleLookup( "th", "th-th" ), +- new LocaleLookup( "vi", "vi-vn" ), +- new LocaleLookup( "tr", "tr-tr" ), +- new LocaleLookup( "el", "el-gr" ), +- new LocaleLookup( "bg", "bg-bg" ), +- new LocaleLookup( "sr", "sr-rs" ), +- new LocaleLookup( "he", "he-il" ), +- new LocaleLookup( "hi", "hi-in" ), +- new LocaleLookup( "bn", "bn-in" ), +- new LocaleLookup( "pa", "pa-in" ), +- new LocaleLookup( "ta", "ta-in" ), +- new LocaleLookup( "te", "te-in" ), +- new LocaleLookup( "ml", "ml-in" ) +- }; +- +- private string get_system_locale_as_facebook_locale() { +- unowned string? raw_system_locale = Intl.setlocale(LocaleCategory.ALL, ""); +- if (raw_system_locale == null || raw_system_locale == "") +- return "www"; +- +- string system_locale = raw_system_locale.split(".")[0]; +- +- foreach (LocaleLookup locale_lookup in locale_lookup_table) { +- if (!system_locale.has_prefix(locale_lookup.prefix)) +- continue; +- +- if (locale_lookup.exception_code != null) { +- assert(locale_lookup.exception_translation != null); +- +- if (system_locale.contains(locale_lookup.exception_code)) +- return locale_lookup.exception_translation; +- } +- +- if (locale_lookup.exception_code_2 != null) { +- assert(locale_lookup.exception_translation_2 != null); +- +- if (system_locale.contains(locale_lookup.exception_code_2)) +- return locale_lookup.exception_translation_2; +- } +- +- return locale_lookup.translation; +- } +- +- // default +- return "www"; +- } +- +- 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); +- } +- +- private void on_page_load() { +- pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.LEFT_PTR)); +- +- string loaded_url = webview.uri.dup(); +- debug("loaded url: " + loaded_url); +- +- // strip parameters from the loaded url +- if (loaded_url.contains("?")) { +- int index = loaded_url.index_of_char('?'); +- string params = loaded_url[index:loaded_url.length]; +- loaded_url = loaded_url.replace(params, ""); +- } +- +- // were we redirected to the facebook login success page? +- if (loaded_url.contains("login_success")) { +- cache_dirty = true; +- login_succeeded(webview.uri); +- return; +- } +- +- // were we redirected to the login total failure page? +- if (loaded_url.contains("login_failure")) { +- login_failed(); +- return; +- } +- } +- +- 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; +- } +- +- public Gtk.Widget get_widget() { +- return pane_widget; +- } +- +- public Spit.Publishing.DialogPane.GeometryOptions get_preferred_geometry() { +- return Spit.Publishing.DialogPane.GeometryOptions.NONE; +- } +- +- public void on_pane_installed() { +- webview.load_uri(get_login_url()); +- } +- +- public void on_pane_uninstalled() { +- } +-} +- + internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object { + private Gtk.Builder builder; + private Gtk.Box pane_widget = null; +@@ -1019,7 +644,6 @@ + private Gtk.Entry new_album_entry = null; + private Gtk.CheckButton strip_metadata_check = null; + private Gtk.Button publish_button = null; +- private Gtk.Button logout_button = null; + private Gtk.Label how_to_label = null; + private Album[] albums = null; + private FacebookPublisher publisher = null; +@@ -1036,7 +660,6 @@ + private const int CONTENT_GROUP_SPACING = 32; + private const int STANDARD_ACTION_BUTTON_WIDTH = 128; + +- public signal void logout(); + public signal void publish(string? target_album, string privacy_setting, + Resolution target_resolution, bool strip_metadata); + +@@ -1075,7 +698,6 @@ + existing_albums_combo = (Gtk.ComboBoxText) this.builder.get_object("existing_albums_combo"); + visibility_combo = (Gtk.ComboBoxText) this.builder.get_object("visibility_combo"); + publish_button = (Gtk.Button) this.builder.get_object("publish_button"); +- logout_button = (Gtk.Button) this.builder.get_object("logout_button"); + new_album_entry = (Gtk.Entry) this.builder.get_object("new_album_entry"); + resolution_combo = (Gtk.ComboBoxText) this.builder.get_object("resolution_combo"); + how_to_label = (Gtk.Label) this.builder.get_object("how_to_label"); +@@ -1094,7 +716,6 @@ + visibility_combo.set_active(0); + + publish_button.clicked.connect(on_publish_button_clicked); +- logout_button.clicked.connect(on_logout_button_clicked); + + setup_resolution_combo(); + resolution_combo.set_active(publisher.get_persistent_default_size()); +@@ -1163,10 +784,6 @@ + publisher.set_persistent_default_size(resolution_combo.get_active()); + } + +- private void on_logout_button_clicked() { +- logout(); +- } +- + private void on_publish_button_clicked() { + string album_name; + string privacy_setting = privacy_descriptions[visibility_combo.get_active()].privacy_setting; +@@ -1240,10 +857,6 @@ + publish_button.grab_focus(); + } + +- private void notify_logout() { +- logout(); +- } +- + private void notify_publish(string? target_album, string privacy_setting, Resolution target_resolution) { + publish(target_album, privacy_setting, target_resolution, strip_metadata_check.get_active()); + } +@@ -1257,14 +870,12 @@ + } + + public void on_pane_installed() { +- logout.connect(notify_logout); + publish.connect(notify_publish); + + installed(); + } + + public void on_pane_uninstalled() { +- logout.disconnect(notify_logout); + publish.disconnect(notify_publish); + } + } +@@ -1571,15 +1182,6 @@ + return access_token != null; + } + +- public string get_access_token() { +- assert(is_authenticated()); +- return access_token; +- } +- +- public GraphMessage new_endpoint_test() { +- return new GraphEndpointProbeMessage(this); +- } +- + public GraphMessage new_query(string resource_path) { + return new GraphQueryMessage(this, resource_path, access_token); + } +Index: b/plugins/shotwell-publishing/FlickrPublishing.vala +=================================================================== +--- a/plugins/shotwell-publishing/FlickrPublishing.vala ++++ b/plugins/shotwell-publishing/FlickrPublishing.vala +@@ -4,32 +4,30 @@ + * (version 2.1 or later). See the COPYING file in this distribution. + */ + ++using Publishing.Accounts; ++ + extern string hmac_sha1(string key, string message); + +-public class FlickrService : Object, Spit.Pluggable, Spit.Publishing.Service { ++public class FlickrService : UOAPublishingService { + private const string ICON_FILENAME = "flickr.png"; + + private static Gdk.Pixbuf[] icon_pixbuf_set = null; + + public FlickrService(GLib.File resource_directory) { ++ base("flickr"); + if (icon_pixbuf_set == null) + icon_pixbuf_set = Resources.load_icon_set(resource_directory.get_child(ICON_FILENAME)); + } + +- public int get_pluggable_interface(int min_host_interface, int max_host_interface) { +- return Spit.negotiate_interfaces(min_host_interface, max_host_interface, +- Spit.Publishing.CURRENT_INTERFACE); +- } +- +- public unowned string get_id() { ++ public override unowned string get_id() { + return "org.yorba.shotwell.publishing.flickr"; + } + +- public unowned string get_pluggable_name() { ++ public override unowned string get_pluggable_name() { + return "Flickr"; + } + +- public void get_info(ref Spit.PluggableInfo info) { ++ public override void get_info(ref Spit.PluggableInfo info) { + info.authors = "Lucas Beeler"; + info.copyright = _("Copyright 2009-2015 Yorba Foundation"); + info.translators = Resources.TRANSLATORS; +@@ -41,14 +39,12 @@ + info.icons = icon_pixbuf_set; + } + +- public void activation(bool enabled) { +- } +- +- public Spit.Publishing.Publisher create_publisher(Spit.Publishing.PluginHost host) { +- return new Publishing.Flickr.FlickrPublisher(this, host); ++ public override Spit.Publishing.Publisher create_publisher(string? account_name, Spit.Publishing.PluginHost host) { ++ SharingAccount account = find_account(account_name); ++ return new Publishing.Flickr.FlickrPublisher(this, account, host); + } + +- public Spit.Publishing.Publisher.MediaType get_supported_media() { ++ public override Spit.Publishing.Publisher.MediaType get_supported_media() { + return (Spit.Publishing.Publisher.MediaType.PHOTO | + Spit.Publishing.Publisher.MediaType.VIDEO); + } +@@ -62,8 +58,6 @@ + internal const string RESTART_ERROR_MESSAGE = + _("You have already logged in and out of Flickr during this Shotwell session.\nTo continue publishing to Flickr, quit and restart Shotwell, then try publishing again."); + internal const string ENDPOINT_URL = "https://api.flickr.com/services/rest"; +-internal const string API_KEY = "60dd96d4a2ad04888b09c9e18d82c26f"; +-internal const string API_SECRET = "d0960565e03547c1"; + internal const int ORIGINAL_SIZE = -1; + internal const string EXPIRED_SESSION_ERROR_CODE = "98"; + internal const string ENCODE_RFC_3986_EXTRA = "!*'();:@&=+$,/?%#[] \\"; +@@ -105,60 +99,32 @@ + private bool was_started = false; + private Session session = null; + private PublishingOptionsPane publishing_options_pane = null; ++ private UOAPublisherAuthenticator authenticator = null; + + private PublishingParameters parameters = null; + + public FlickrPublisher(Spit.Publishing.Service service, ++ SharingAccount account, + Spit.Publishing.PluginHost host) { + debug("FlickrPublisher instantiated."); + this.service = service; + this.host = host; + this.session = new Session(); ++ authenticator = new UOAPublisherAuthenticator(account, host, ++ SERVICE_WELCOME_MESSAGE); + this.parameters = new PublishingParameters(); + + session.authenticated.connect(on_session_authenticated); ++ Variant data = authenticator.get_authentication_data(); ++ session.set_api_credentials(data.lookup_value("ConsumerKey", null).get_string(), ++ data.lookup_value("ConsumerSecret", null).get_string()); ++ authenticator.authenticated.connect(on_authenticator_authenticated); + } + + ~FlickrPublisher() { + session.authenticated.disconnect(on_session_authenticated); + } + +- private void invalidate_persistent_session() { +- set_persistent_access_phase_token(""); +- set_persistent_access_phase_token_secret(""); +- set_persistent_access_phase_username(""); +- } +- +- private bool is_persistent_session_valid() { +- return (get_persistent_access_phase_username() != null && +- get_persistent_access_phase_token() != null && +- get_persistent_access_phase_token_secret() != null); +- } +- +- private string? get_persistent_access_phase_username() { +- return host.get_config_string("access_phase_username", null); +- } +- +- private void set_persistent_access_phase_username(string username) { +- host.set_config_string("access_phase_username", username); +- } +- +- private string? get_persistent_access_phase_token() { +- return host.get_config_string("access_phase_token", null); +- } +- +- private void set_persistent_access_phase_token(string token) { +- host.set_config_string("access_phase_token", token); +- } +- +- private string? get_persistent_access_phase_token_secret() { +- return host.get_config_string("access_phase_token_secret", null); +- } +- +- private void set_persistent_access_phase_token_secret(string secret) { +- host.set_config_string("access_phase_token_secret", secret); +- } +- + private bool get_persistent_strip_metadata() { + return host.get_config_bool("strip_metadata", false); + } +@@ -167,94 +133,17 @@ + host.set_config_bool("strip_metadata", strip_metadata); + } + +- private void on_welcome_pane_login_clicked() { +- if (!running) +- return; +- +- debug("EVENT: user clicked 'Login' button in the welcome pane"); +- +- do_run_authentication_request_transaction(); +- } +- +- private void on_auth_request_txn_completed(Publishing.RESTSupport.Transaction txn) { +- txn.completed.disconnect(on_auth_request_txn_completed); +- txn.network_error.disconnect(on_auth_request_txn_error); +- +- if (!is_running()) +- return; +- +- debug("EVENT: OAuth authentication request transaction completed; response = '%s'", +- txn.get_response()); +- +- do_parse_token_info_from_auth_request(txn.get_response()); +- } +- +- private void on_auth_request_txn_error(Publishing.RESTSupport.Transaction txn, +- Spit.Publishing.PublishingError err) { +- txn.completed.disconnect(on_auth_request_txn_completed); +- txn.network_error.disconnect(on_auth_request_txn_error); +- +- if (!is_running()) +- return; +- +- debug("EVENT: OAuth authentication request transaction caused a network error"); +- host.post_error(err); +- } +- +- private void on_authentication_token_available(string token, string token_secret) { +- debug("EVENT: OAuth authentication token (%s) and token secret (%s) available", +- token, token_secret); +- +- session.set_request_phase_credentials(token, token_secret); +- +- do_launch_system_browser(token); +- } +- +- private void on_system_browser_launched() { +- if (!is_running()) +- return; +- +- debug("EVENT: system browser launched."); +- +- do_show_pin_entry_pane(); +- } +- +- private void on_pin_entry_proceed(PinEntryPane sender, string pin) { +- sender.proceed.disconnect(on_pin_entry_proceed); +- +- if (!is_running()) +- return; +- +- debug("EVENT: user clicked 'Continue' in PIN entry pane."); +- +- do_verify_pin(pin); +- } ++ public void on_authenticator_authenticated(owned Variant session_data) { ++ host.set_service_locked(true); ++ host.install_account_fetch_wait_pane(); + +- private void on_access_token_fetch_txn_completed(Publishing.RESTSupport.Transaction txn) { +- txn.completed.disconnect(on_access_token_fetch_txn_completed); +- txn.network_error.disconnect(on_access_token_fetch_error); +- +- if (!is_running()) +- return; +- +- debug("EVENT: fetching OAuth access token over the network succeeded"); +- +- do_extract_access_phase_credentials_from_reponse(txn.get_response()); ++ string token = session_data.lookup_value("AccessToken", null).get_string(); ++ string token_secret = session_data.lookup_value("TokenSecret", null).get_string(); ++ string username = session_data.lookup_value("username", null).get_string(); ++ debug("Access Token: %s, %s, %s", token, token_secret, username); ++ session.set_access_phase_credentials(token, token_secret, username); + } + +- private void on_access_token_fetch_error(Publishing.RESTSupport.Transaction txn, +- Spit.Publishing.PublishingError err) { +- txn.completed.disconnect(on_access_token_fetch_txn_completed); +- txn.network_error.disconnect(on_access_token_fetch_error); +- +- if (!is_running()) +- return; +- +- debug("EVENT: fetching OAuth access token over the network caused an error."); +- +- host.post_error(err); +- } +- + private void on_session_authenticated() { + if (!is_running()) + return; +@@ -263,10 +152,6 @@ + + parameters.username = session.get_username(); + +- set_persistent_access_phase_token(session.get_access_phase_token()); +- set_persistent_access_phase_token_secret(session.get_access_phase_token_secret()); +- set_persistent_access_phase_username(session.get_username()); +- + do_fetch_account_info(); + } + +@@ -303,7 +188,6 @@ + + private void on_publishing_options_pane_publish(bool strip_metadata) { + publishing_options_pane.publish.disconnect(on_publishing_options_pane_publish); +- publishing_options_pane.logout.disconnect(on_publishing_options_pane_logout); + + if (!is_running()) + return; +@@ -312,18 +196,6 @@ + do_publish(strip_metadata); + } + +- private void on_publishing_options_pane_logout() { +- publishing_options_pane.publish.disconnect(on_publishing_options_pane_publish); +- publishing_options_pane.logout.disconnect(on_publishing_options_pane_logout); +- +- if (!is_running()) +- return; +- +- debug("EVENT: user clicked the 'Logout' button in the publishing options pane"); +- +- do_logout(); +- } +- + private void on_upload_status_updated(int file_number, double completed_fraction) { + if (!is_running()) + return; +@@ -361,148 +233,6 @@ + host.post_error(err); + } + +- private void do_show_login_welcome_pane() { +- debug("ACTION: installing login welcome pane"); +- +- host.set_service_locked(false); +- host.install_welcome_pane(SERVICE_WELCOME_MESSAGE, on_welcome_pane_login_clicked); +- } +- +- private void do_run_authentication_request_transaction() { +- debug("ACTION: running authentication request transaction"); +- +- host.set_service_locked(true); +- host.install_static_message_pane(_("Preparing for login...")); +- +- AuthenticationRequestTransaction txn = new AuthenticationRequestTransaction(session); +- txn.completed.connect(on_auth_request_txn_completed); +- txn.network_error.connect(on_auth_request_txn_error); +- +- try { +- txn.execute(); +- } catch (Spit.Publishing.PublishingError err) { +- host.post_error(err); +- } +- } +- +- private void do_parse_token_info_from_auth_request(string response) { +- debug("ACTION: parsing authorization request response '%s' into token and secret", response); +- +- string? oauth_token = null; +- string? oauth_token_secret = null; +- +- string[] key_value_pairs = response.split("&"); +- foreach (string pair in key_value_pairs) { +- string[] split_pair = pair.split("="); +- +- if (split_pair.length != 2) +- host.post_error(new Spit.Publishing.PublishingError.MALFORMED_RESPONSE( +- "'%s' isn't a valid response to an OAuth authentication request", response)); +- +- if (split_pair[0] == "oauth_token") +- oauth_token = split_pair[1]; +- else if (split_pair[0] == "oauth_token_secret") +- oauth_token_secret = split_pair[1]; +- } +- +- if (oauth_token == null || oauth_token_secret == null) +- host.post_error(new Spit.Publishing.PublishingError.MALFORMED_RESPONSE( +- "'%s' isn't a valid response to an OAuth authentication request", response)); +- +- +- on_authentication_token_available(oauth_token, oauth_token_secret); +- } +- +- private void do_launch_system_browser(string token) { +- string login_uri = "https://www.flickr.com/services/oauth/authorize?oauth_token=" + token + +- "&perms=write"; +- +- debug("ACTION: launching system browser with uri = '%s'", login_uri); +- +- try { +- Process.spawn_command_line_async("xdg-open " + login_uri); +- } catch (SpawnError e) { +- host.post_error(new Spit.Publishing.PublishingError.LOCAL_FILE_ERROR( +- "couldn't launch system web browser to complete Flickr login")); +- return; +- } +- +- on_system_browser_launched(); +- } +- +- private void do_show_pin_entry_pane() { +- debug("ACTION: showing PIN entry pane"); +- +- Gtk.Builder builder = new Gtk.Builder(); +- +- try { +- builder.add_from_file(host.get_module_file().get_parent().get_child("flickr_pin_entry_pane.glade").get_path()); +- } catch (Error e) { +- warning("Could not parse UI file! Error: %s.", e.message); +- host.post_error( +- new Spit.Publishing.PublishingError.LOCAL_FILE_ERROR( +- _("A file required for publishing is unavailable. Publishing to Flickr can't continue."))); +- return; +- } +- +- PinEntryPane pin_entry_pane = new PinEntryPane(builder); +- pin_entry_pane.proceed.connect(on_pin_entry_proceed); +- host.install_dialog_pane(pin_entry_pane); +- } +- +- private void do_verify_pin(string pin) { +- debug("ACTION: validating authorization PIN %s", pin); +- +- host.set_service_locked(true); +- host.install_static_message_pane(_("Verifying authorization...")); +- +- AccessTokenFetchTransaction txn = new AccessTokenFetchTransaction(session, pin); +- txn.completed.connect(on_access_token_fetch_txn_completed); +- txn.network_error.connect(on_access_token_fetch_error); +- +- try { +- txn.execute(); +- } catch (Spit.Publishing.PublishingError err) { +- host.post_error(err); +- } +- } +- +- private void do_extract_access_phase_credentials_from_reponse(string response) { +- debug("ACTION: extracting access phase credentials from '%s'", response); +- +- string[] key_value_pairs = response.split("&"); +- +- string? token = null; +- string? token_secret = null; +- string? username = null; +- foreach (string key_value_pair in key_value_pairs) { +- string[] split_pair = key_value_pair.split("="); +- +- if (split_pair.length != 2) +- continue; +- +- string key = split_pair[0]; +- string value = split_pair[1]; +- +- if (key == "oauth_token") +- token = value; +- else if (key == "oauth_token_secret") +- token_secret = value; +- else if (key == "username") +- username = value; +- } +- +- debug("access phase credentials: { token = '%s'; token_secret = '%s'; username = '%s' }", +- token, token_secret, username); +- +- if (token == null || token_secret == null || username == null) +- host.post_error(new Spit.Publishing.PublishingError.MALFORMED_RESPONSE("expected " + +- "access phase credentials to contain token, token secret, and username but at " + +- "least one of these is absent")); +- +- session.set_access_phase_credentials(token, token_secret, username); +- } +- + private void do_fetch_account_info() { + debug("ACTION: running network transaction to fetch account information"); + +@@ -568,7 +298,6 @@ + debug("ACTION: logging user out, deauthenticating session, and erasing stored credentials"); + + session.deauthenticate(); +- invalidate_persistent_session(); + + running = false; + +@@ -599,7 +328,6 @@ + publishing_options_pane = new PublishingOptionsPane(this, parameters, + host.get_publishable_media_type(), builder, get_persistent_strip_metadata()); + publishing_options_pane.publish.connect(on_publishing_options_pane_publish); +- publishing_options_pane.logout.connect(on_publishing_options_pane_logout); + host.install_dialog_pane(publishing_options_pane); + } + +@@ -674,16 +402,7 @@ + running = true; + was_started = true; + +- if (is_persistent_session_valid()) { +- debug("attempt start: a persistent session is available; using it"); +- +- session.authenticate_from_persistent_credentials(get_persistent_access_phase_token(), +- get_persistent_access_phase_token_secret(), get_persistent_access_phase_username()); +- } else { +- debug("attempt start: no persistent session available; showing login welcome pane"); +- +- do_show_login_welcome_pane(); +- } ++ authenticator.authenticate(); + } + + public void start() { +@@ -772,7 +491,7 @@ + add_argument("oauth_version", "1.0"); + add_argument("oauth_callback", "oob"); + add_argument("oauth_timestamp", session.get_oauth_timestamp()); +- add_argument("oauth_consumer_key", API_KEY); ++ add_argument("oauth_consumer_key", session.get_api_key()); + } + + public Transaction.with_uri(Session session, string uri, +@@ -784,7 +503,7 @@ + add_argument("oauth_version", "1.0"); + add_argument("oauth_callback", "oob"); + add_argument("oauth_timestamp", session.get_oauth_timestamp()); +- add_argument("oauth_consumer_key", API_KEY); ++ add_argument("oauth_consumer_key", session.get_api_key()); + } + + public override void execute() throws Spit.Publishing.PublishingError { +@@ -842,22 +561,6 @@ + } + } + +-internal class AuthenticationRequestTransaction : Transaction { +- public AuthenticationRequestTransaction(Session session) { +- base.with_uri(session, "https://www.flickr.com/services/oauth/request_token", +- Publishing.RESTSupport.HttpMethod.GET); +- } +-} +- +-internal class AccessTokenFetchTransaction : Transaction { +- public AccessTokenFetchTransaction(Session session, string user_verifier) { +- base.with_uri(session, "https://www.flickr.com/services/oauth/access_token", +- Publishing.RESTSupport.HttpMethod.GET); +- add_argument("oauth_verifier", user_verifier); +- add_argument("oauth_token", session.get_request_phase_token()); +- } +-} +- + internal class AccountInfoFetchTransaction : Transaction { + public AccountInfoFetchTransaction(Session session) { + base(session, Publishing.RESTSupport.HttpMethod.GET); +@@ -884,7 +587,7 @@ + add_authorization_header_field("oauth_version", "1.0"); + add_authorization_header_field("oauth_callback", "oob"); + add_authorization_header_field("oauth_timestamp", session.get_oauth_timestamp()); +- add_authorization_header_field("oauth_consumer_key", API_KEY); ++ add_authorization_header_field("oauth_consumer_key", session.get_api_key()); + add_authorization_header_field("oauth_token", session.get_access_phase_token()); + + add_argument("is_public", ("%d".printf(parameters.visibility_specification.everyone_level))); +@@ -944,11 +647,11 @@ + } + + internal class Session : Publishing.RESTSupport.Session { +- private string? request_phase_token = null; +- private string? request_phase_token_secret = null; + private string? access_phase_token = null; + private string? access_phase_token_secret = null; + private string? username = null; ++ private string? api_key = null; ++ private string? api_secret = null; + + public Session() { + base(ENDPOINT_URL); +@@ -959,15 +662,6 @@ + username != null); + } + +- public void authenticate_from_persistent_credentials(string token, string secret, +- string username) { +- this.access_phase_token = token; +- this.access_phase_token_secret = secret; +- this.username = username; +- +- authenticated(); +- } +- + public void deauthenticate() { + access_phase_token = null; + access_phase_token_secret = null; +@@ -1008,16 +702,12 @@ + if (access_phase_token_secret != null) { + debug("access phase token secret available; using it as signing key"); + +- signing_key = API_SECRET + "&" + access_phase_token_secret; +- } else if (request_phase_token_secret != null) { +- debug("request phase token secret available; using it as signing key"); +- +- signing_key = API_SECRET + "&" + request_phase_token_secret; ++ signing_key = api_secret + "&" + access_phase_token_secret; + } else { +- debug("neither access phase nor request phase token secrets available; using API " + ++ debug("access token secret not available; using API " + + "key as signing key"); + +- signing_key = API_SECRET + "&"; ++ signing_key = api_secret + "&"; + } + + string signature_base_string = http_method + "&" + Soup.URI.encode( +@@ -1040,11 +730,11 @@ + txn.add_argument("oauth_signature", signature); + } + +- public void set_request_phase_credentials(string token, string secret) { +- this.request_phase_token = token; +- this.request_phase_token_secret = secret; ++ public void set_api_credentials(string api_key, string api_secret) { ++ this.api_key = api_key; ++ this.api_secret = api_secret; + } +- ++ + public void set_access_phase_credentials(string token, string secret, string username) { + this.access_phase_token = token; + this.access_phase_token_secret = secret; +@@ -1065,21 +755,16 @@ + return GLib.get_real_time().to_string().substring(0, 10); + } + +- public string get_request_phase_token() { +- assert(request_phase_token != null); +- return request_phase_token; ++ public string get_api_key() { ++ assert(api_key != null); ++ return api_key; + } +- ++ + public string get_access_phase_token() { + assert(access_phase_token != null); + return access_phase_token; + } + +- public string get_access_phase_token_secret() { +- assert(access_phase_token_secret != null); +- return access_phase_token_secret; +- } +- + public string get_username() { + assert(is_authenticated()); + return username; +@@ -1112,7 +797,6 @@ + private Gtk.Label visibility_label = null; + private Gtk.Label upload_info_label = null; + private Gtk.Label size_label = null; +- private Gtk.Button logout_button = null; + private Gtk.Button publish_button = null; + private Gtk.ComboBoxText visibility_combo = null; + private Gtk.ComboBoxText size_combo = null; +@@ -1124,7 +808,6 @@ + private Spit.Publishing.Publisher.MediaType media_type; + + public signal void publish(bool strip_metadata); +- public signal void logout(); + + public PublishingOptionsPane(FlickrPublisher publisher, PublishingParameters parameters, + Spit.Publishing.Publisher.MediaType media_type, Gtk.Builder builder, bool strip_metadata) { +@@ -1136,7 +819,6 @@ + pane_widget = (Gtk.Box) this.builder.get_object("flickr_pane"); + visibility_label = (Gtk.Label) this.builder.get_object("visibility_label"); + upload_info_label = (Gtk.Label) this.builder.get_object("upload_info_label"); +- logout_button = (Gtk.Button) this.builder.get_object("logout_button"); + publish_button = (Gtk.Button) this.builder.get_object("publish_button"); + visibility_combo = (Gtk.ComboBoxText) this.builder.get_object("visibility_combo"); + size_combo = (Gtk.ComboBoxText) this.builder.get_object("size_combo"); +@@ -1186,14 +868,9 @@ + + strip_metadata_check.set_active(strip_metadata); + +- logout_button.clicked.connect(on_logout_clicked); + publish_button.clicked.connect(on_publish_clicked); + } + +- private void on_logout_clicked() { +- logout(); +- } +- + private void on_publish_clicked() { + parameters.visibility_specification = + visibilities[visibility_combo.get_active()].specification; +@@ -1260,10 +937,6 @@ + publish(strip_metadata_check.get_active()); + } + +- protected void notify_logout() { +- logout(); +- } +- + public Gtk.Widget get_widget() { + return pane_widget; + } +@@ -1274,12 +947,10 @@ + + public void on_pane_installed() { + publish.connect(notify_publish); +- logout.connect(notify_logout); + } + + public void on_pane_uninstalled() { + publish.disconnect(notify_publish); +- logout.disconnect(notify_logout); + } + } + +Index: b/plugins/shotwell-publishing/Makefile +=================================================================== +--- a/plugins/shotwell-publishing/Makefile ++++ b/plugins/shotwell-publishing/Makefile +@@ -18,6 +18,7 @@ + FlickrPublishing.vala \ + YouTubePublishing.vala \ + PiwigoPublishing.vala \ ++ ../common/accounts.vala \ + ../../src/util/string.vala \ + ../common/RESTSupport.vala + +Index: b/plugins/shotwell-publishing/PicasaPublishing.vala +=================================================================== +--- a/plugins/shotwell-publishing/PicasaPublishing.vala ++++ b/plugins/shotwell-publishing/PicasaPublishing.vala +@@ -4,30 +4,28 @@ + * (version 2.1 or later). See the COPYING file in this distribution. + */ + +-public class PicasaService : Object, Spit.Pluggable, Spit.Publishing.Service { ++using Publishing.Accounts; ++ ++public class PicasaService : UOAPublishingService { + private const string ICON_FILENAME = "picasa.png"; + + private static Gdk.Pixbuf[] icon_pixbuf_set = null; + + public PicasaService(GLib.File resource_directory) { ++ base("google"); + if (icon_pixbuf_set == null) + icon_pixbuf_set = Resources.load_icon_set(resource_directory.get_child(ICON_FILENAME)); + } + +- public int get_pluggable_interface(int min_host_interface, int max_host_interface) { +- return Spit.negotiate_interfaces(min_host_interface, max_host_interface, +- Spit.Publishing.CURRENT_INTERFACE); +- } +- +- public unowned string get_id() { ++ public override unowned string get_id() { + return "org.yorba.shotwell.publishing.picasa"; + } + +- public unowned string get_pluggable_name() { ++ public override unowned string get_pluggable_name() { + return "Picasa Web Albums"; + } + +- public void get_info(ref Spit.PluggableInfo info) { ++ public override void get_info(ref Spit.PluggableInfo info) { + info.authors = "Lucas Beeler"; + info.copyright = _("Copyright 2009-2015 Yorba Foundation"); + info.translators = Resources.TRANSLATORS; +@@ -39,17 +37,15 @@ + info.icons = icon_pixbuf_set; + } + +- public Spit.Publishing.Publisher create_publisher(Spit.Publishing.PluginHost host) { +- return new Publishing.Picasa.PicasaPublisher(this, host); ++ public override Spit.Publishing.Publisher create_publisher(string? account_name, Spit.Publishing.PluginHost host) { ++ SharingAccount account = find_account(account_name); ++ return new Publishing.Picasa.PicasaPublisher(this, account, host); + } + +- public Spit.Publishing.Publisher.MediaType get_supported_media() { ++ public override Spit.Publishing.Publisher.MediaType get_supported_media() { + return (Spit.Publishing.Publisher.MediaType.PHOTO | + Spit.Publishing.Publisher.MediaType.VIDEO); + } +- +- public void activation(bool enabled) { +- } + } + + namespace Publishing.Picasa { +@@ -62,21 +58,25 @@ + private bool running; + private Spit.Publishing.ProgressCallback progress_reporter; + private PublishingParameters publishing_parameters; +- private string? refresh_token; ++ private UOAPublisherAuthenticator authenticator = null; + + public PicasaPublisher(Spit.Publishing.Service service, ++ SharingAccount account, + Spit.Publishing.PluginHost host) { + base(service, host, "http://picasaweb.google.com/data/"); + + this.publishing_parameters = new PublishingParameters(); + load_parameters_from_configuration_system(publishing_parameters); + ++ authenticator = new UOAPublisherAuthenticator(account, host, ++ SERVICE_WELCOME_MESSAGE); ++ authenticator.authenticated.connect(on_authenticator_authenticated); ++ + Spit.Publishing.Publisher.MediaType media_type = Spit.Publishing.Publisher.MediaType.NONE; + foreach(Spit.Publishing.Publishable p in host.get_publishables()) + media_type |= p.get_media_type(); + publishing_parameters.set_media_type(media_type); + +- this.refresh_token = host.get_config_string("refresh_token", null); + this.progress_reporter = null; + } + +@@ -131,20 +131,9 @@ + get_host().set_config_string("last-album", parameters.get_target_album_name()); + } + +- private void on_service_welcome_login() { +- debug("EVENT: user clicked 'Login' in welcome pane."); +- +- if (!is_running()) +- return; +- +- start_oauth_flow(refresh_token); +- } +- + protected override void on_login_flow_complete() { + debug("EVENT: OAuth login flow complete."); + +- get_host().set_config_string("refresh_token", get_session().get_refresh_token()); +- + publishing_parameters.set_user_name(get_session().get_user_name()); + + do_fetch_account_information(); +@@ -173,21 +162,7 @@ + debug("EVENT: fetching account and album information failed; response = '%s'.", + bad_txn.get_response()); + +- if (bad_txn.get_status_code() == 403 || bad_txn.get_status_code() == 404) { +- do_logout(); +- } else { +- // If we get any other kind of error, we can't recover, so just post it to the user +- get_host().post_error(err); +- } +- } +- +- private void on_publishing_options_logout() { +- if (!is_running()) +- return; +- +- debug("EVENT: user clicked 'Logout' in the publishing options pane."); +- +- do_logout(); ++ get_host().post_error(err); + } + + private void on_publishing_options_publish() { +@@ -295,12 +270,6 @@ + get_host().post_error(err); + } + +- private void do_show_service_welcome_pane() { +- debug("ACTION: showing service welcome pane."); +- +- get_host().install_welcome_pane(SERVICE_WELCOME_MESSAGE, on_service_welcome_login); +- } +- + private void do_fetch_account_information() { + debug("ACTION: fetching account and album information."); + +@@ -364,7 +333,6 @@ + + PublishingOptionsPane opts_pane = new PublishingOptionsPane(builder, publishing_parameters); + opts_pane.publish.connect(on_publishing_options_publish); +- opts_pane.logout.connect(on_publishing_options_logout); + get_host().install_dialog_pane(opts_pane); + + get_host().set_service_locked(false); +@@ -425,13 +393,6 @@ + + protected override void do_logout() { + debug("ACTION: logging out user."); +- +- get_session().deauthenticate(); +- refresh_token = null; +- get_host().unset_config_key("refresh_token"); +- +- +- do_show_service_welcome_pane(); + } + + public override bool is_running() { +@@ -446,10 +407,7 @@ + + running = true; + +- if (refresh_token == null) +- do_show_service_welcome_pane(); +- else +- start_oauth_flow(refresh_token); ++ authenticator.authenticate(); + } + + public override void stop() { +@@ -625,7 +583,6 @@ + private Gtk.ComboBoxText size_combo = null; + private Gtk.CheckButton strip_metadata_check = null; + private Gtk.Button publish_button = null; +- private Gtk.Button logout_button = null; + private SizeDescription[] size_descriptions; + private PublishingParameters parameters; + +@@ -653,7 +610,6 @@ + size_combo = (Gtk.ComboBoxText) builder.get_object("size_combo"); + strip_metadata_check = (Gtk.CheckButton) this.builder.get_object("strip_metadata_check"); + publish_button = (Gtk.Button) builder.get_object("publish_button"); +- logout_button = (Gtk.Button) builder.get_object("logout_button"); + + // populate any widgets whose contents are programmatically-generated. + login_identity_label.set_label(_("You are logged into Picasa Web Albums as %s.").printf( +@@ -680,7 +636,6 @@ + use_existing_radio.clicked.connect(on_use_existing_radio_clicked); + create_new_radio.clicked.connect(on_create_new_radio_clicked); + new_album_entry.changed.connect(on_new_album_entry_changed); +- logout_button.clicked.connect(on_logout_clicked); + publish_button.clicked.connect(on_publish_clicked); + } + +@@ -726,10 +681,6 @@ + public_check.set_sensitive(true); + } + +- private void on_logout_clicked() { +- logout(); +- } +- + private void update_publish_button_sensitivity() { + string album_name = new_album_entry.get_text(); + publish_button.set_sensitive(!(album_name.strip() == "" && +Index: b/plugins/shotwell-publishing/PiwigoPublishing.vala +=================================================================== +--- a/plugins/shotwell-publishing/PiwigoPublishing.vala ++++ b/plugins/shotwell-publishing/PiwigoPublishing.vala +@@ -42,7 +42,7 @@ + public void activation(bool enabled) { + } + +- public Spit.Publishing.Publisher create_publisher(Spit.Publishing.PluginHost host) { ++ public Spit.Publishing.Publisher create_publisher(string? account, Spit.Publishing.PluginHost host) { + return new Publishing.Piwigo.PiwigoPublisher(this, host); + } + +Index: b/plugins/shotwell-publishing/YouTubePublishing.vala +=================================================================== +--- a/plugins/shotwell-publishing/YouTubePublishing.vala ++++ b/plugins/shotwell-publishing/YouTubePublishing.vala +@@ -39,7 +39,7 @@ + info.icons = icon_pixbuf_set; + } + +- public Spit.Publishing.Publisher create_publisher(Spit.Publishing.PluginHost host) { ++ public Spit.Publishing.Publisher create_publisher(string? account, Spit.Publishing.PluginHost host) { + return new Publishing.YouTube.YouTubePublisher(this, host); + } + +Index: b/plugins/shotwell-publishing/facebook_publishing_options_pane.glade +=================================================================== +--- a/plugins/shotwell-publishing/facebook_publishing_options_pane.glade ++++ b/plugins/shotwell-publishing/facebook_publishing_options_pane.glade +@@ -190,42 +190,29 @@ + + True + False ++ center + 32 + True + +- +- _Logout +- True +- True +- True +- True +- +- +- False +- True +- 80 +- 0 +- +- +- + + _Publish + True + True + True + True ++ 96 + + + False + True + 80 +- 1 ++ 0 + + + + + False +- True ++ False + 2 + 3 + +Index: b/plugins/shotwell-publishing/picasa_publishing_options_pane.glade +=================================================================== +--- a/plugins/shotwell-publishing/picasa_publishing_options_pane.glade ++++ b/plugins/shotwell-publishing/picasa_publishing_options_pane.glade +@@ -218,28 +218,14 @@ + + True + False +- 112 +- 112 ++ center + 48 + 24 + 128 + True + +- +- _Logout +- True +- True +- True +- True +- +- +- False +- True +- 0 +- +- +- + ++ 96 + _Publish + True + True +@@ -249,13 +235,13 @@ + + False + True +- 1 ++ 0 + + + + + False +- True ++ False + 4 + + +Index: b/src/plugins/PublishingInterfaces.vala +=================================================================== +--- a/src/plugins/PublishingInterfaces.vala ++++ b/src/plugins/PublishingInterfaces.vala +@@ -494,6 +494,7 @@ + */ + public abstract Spit.Publishing.Publisher.MediaType get_publishable_media_type(); + ++ public abstract ulong get_dialog_xid(); + // + // For future expansion. + // +@@ -581,18 +582,26 @@ + * A factory method that instantiates and returns a new {@link Publisher} object that + * encapsulates a connection to the remote publishing service that this Service describes. + */ +- public abstract Spit.Publishing.Publisher create_publisher(Spit.Publishing.PluginHost host); ++ public abstract Spit.Publishing.Publisher create_publisher(string? account, Spit.Publishing.PluginHost host); + + /** + * Returns the kinds of media that this service can work with. + */ + public abstract Spit.Publishing.Publisher.MediaType get_supported_media(); + ++ /** ++ * Checks whether the service is enabled. ++ */ ++ public virtual bool is_enabled() { return true; } ++ ++ /** ++ * List the accounts available for this service. ++ */ ++ public virtual string[] list_account_names() { return {}; } ++ + // + // For future expansion. + // +- protected virtual void reserved0() {} +- protected virtual void reserved1() {} + protected virtual void reserved2() {} + protected virtual void reserved3() {} + protected virtual void reserved4() {} +Index: b/src/publishing/PublishingPluginHost.vala +=================================================================== +--- a/src/publishing/PublishingPluginHost.vala ++++ b/src/publishing/PublishingPluginHost.vala +@@ -21,7 +21,8 @@ + private Spit.Publishing.Publisher.MediaType media_type = + Spit.Publishing.Publisher.MediaType.NONE; + +- public ConcretePublishingHost(Service service, PublishingUI.PublishingDialog dialog, ++ public ConcretePublishingHost(Service service, string? account, ++ PublishingUI.PublishingDialog dialog, + Publishable[] publishables) { + base(service, "sharing"); + this.dialog = dialog; +@@ -30,7 +31,7 @@ + foreach (Publishable curr_publishable in publishables) + this.media_type |= curr_publishable.get_media_type(); + +- this.active_publisher = service.create_publisher(this); ++ this.active_publisher = service.create_publisher(account, this); + } + + private void on_login_clicked() { +@@ -232,6 +233,13 @@ + + return report_plugin_upload_progress; + } ++ ++ public ulong get_dialog_xid() { ++ if (dialog == null) return 0; ++ ++ Gdk.Window window = dialog.get_window(); ++ return Gdk.X11Window.get_xid(window); ++ } + } + + } +Index: b/src/publishing/PublishingUI.vala +=================================================================== +--- a/src/publishing/PublishingUI.vala ++++ b/src/publishing/PublishingUI.vala +@@ -130,6 +130,11 @@ + } + + public class PublishingDialog : Gtk.Dialog { ++ private struct AccountService { ++ Spit.Publishing.Service service; ++ string? account; ++ } ++ + private const int LARGE_WINDOW_WIDTH = 860; + private const int LARGE_WINDOW_HEIGHT = 688; + private const int COLOSSAL_WINDOW_WIDTH = 1024; +@@ -152,6 +157,7 @@ + private Spit.Publishing.Publishable[] publishables; + private Spit.Publishing.ConcretePublishingHost host; + private Spit.PluggableInfo info; ++ private Gee.HashMap services; + + protected PublishingDialog(Gee.Collection to_publish) { + assert(to_publish.size > 0); +@@ -162,6 +168,8 @@ + resizable = false; + delete_event.connect(on_window_close); + ++ services = new Gee.HashMap(); ++ + publishables = new Spit.Publishing.Publishable[0]; + bool has_photos = false; + bool has_videos = false; +@@ -209,38 +217,61 @@ + // get the name of the service the user last used + string? last_used_service = Config.Facade.get_instance().get_last_used_service(); + +- Spit.Publishing.Service[] loaded_services = load_services(has_photos, has_videos); ++ Spit.Publishing.Service[] loaded_services = load_services(has_photos, has_videos, null); + + Gtk.TreeIter iter; + + foreach (Spit.Publishing.Service service in loaded_services) { +- service_selector_box_model.append(out iter); +- + string curr_service_id = service.get_id(); + + service.get_info(ref info); + +- if (null != info.icons && 0 < info.icons.length) { +- // check if the icons object is set -- if set use that icon +- service_selector_box_model.set(iter, 0, info.icons[0], 1, +- service.get_pluggable_name()); +- +- // in case the icons object is not set on the next iteration +- info.icons[0] = Resources.get_icon(Resources.ICON_GENERIC_PLUGIN); +- } else { +- // if icons object is null or zero length use a generic icon +- service_selector_box_model.set(iter, 0, Resources.get_icon( +- Resources.ICON_GENERIC_PLUGIN), 1, service.get_pluggable_name()); ++ var account_names = service.list_account_names(); ++ if (account_names.length == 0) { ++ account_names += null; + } ++ ++ foreach (string? account_name in account_names) { ++ service_selector_box_model.append(out iter); ++ ++ string service_name = service.get_pluggable_name(); ++ if (account_name != null) { ++ service_name += " (%s)".printf(account_name); ++ } ++ ++ AccountService account_service = { ++ service: service, ++ account: account_name ++ }; ++ services.set(service_name, account_service); ++ ++ if (null != info.icons && 0 < info.icons.length) { ++ // check if the icons object is set -- if set use that icon ++ service_selector_box_model.set(iter, 0, info.icons[0], 1, ++ service_name); ++ ++ // in case the icons object is not set on the next iteration ++ info.icons[0] = Resources.get_icon(Resources.ICON_GENERIC_PLUGIN); ++ } else { ++ // if icons object is null or zero length use a generic icon ++ service_selector_box_model.set(iter, 0, Resources.get_icon( ++ Resources.ICON_GENERIC_PLUGIN), 1, service_name); ++ } + +- if (last_used_service == null) { +- service_selector_box.set_active_iter(iter); +- last_used_service = service.get_id(); +- } else if (last_used_service == curr_service_id) { +- service_selector_box.set_active_iter(iter); ++ if (last_used_service == null) { ++ service_selector_box.set_active_iter(iter); ++ last_used_service = service.get_id(); ++ } else if (last_used_service == curr_service_id) { ++ service_selector_box.set_active_iter(iter); ++ } + } + } + ++ service_selector_box_model.append(out iter); ++ service_selector_box_model.set(iter, ++ 0, Resources.get_icon(Resources.ICON_GENERIC_PLUGIN), ++ 1, _("Add more accounts...")); ++ + service_selector_box.changed.connect(on_service_changed); + + central_area_layouter = new Gtk.Box(Gtk.Orientation.VERTICAL, 0); +@@ -295,24 +326,35 @@ + return loaded_services; + } + +- private static Spit.Publishing.Service[] load_services(bool has_photos, bool has_videos) { ++ private static Spit.Publishing.Service[] load_services(bool has_photos, bool has_videos, ++ out bool has_disabled_services) { + assert (has_photos || has_videos); + + Spit.Publishing.Service[] filtered_services = new Spit.Publishing.Service[0]; + Spit.Publishing.Service[] all_services = load_all_services(); + ++ has_disabled_services = false; + foreach (Spit.Publishing.Service service in all_services) { ++ bool supports_media = false; + + if (has_photos && !has_videos) { + if ((service.get_supported_media() & Spit.Publishing.Publisher.MediaType.PHOTO) != 0) +- filtered_services += service; ++ supports_media = true; + } else if (!has_photos && has_videos) { + if ((service.get_supported_media() & Spit.Publishing.Publisher.MediaType.VIDEO) != 0) +- filtered_services += service; ++ supports_media = true; + } else { + if (((service.get_supported_media() & Spit.Publishing.Publisher.MediaType.PHOTO) != 0) && + ((service.get_supported_media() & Spit.Publishing.Publisher.MediaType.VIDEO) != 0)) ++ supports_media = true; ++ } ++ ++ if (supports_media) { ++ if (service.is_enabled()) { + filtered_services += service; ++ } else { ++ has_disabled_services = true; ++ } + } + } + +@@ -351,15 +393,26 @@ + Gee.ArrayList