Commit 8beb0362 authored by Lucas Beeler's avatar Lucas Beeler

Simplifies and refines the new publishing API; at this point, the API is...

Simplifies and refines the new publishing API; at this point, the API is "stable" but not yet "frozen".
parent 2acf162a
......@@ -29,8 +29,8 @@ public class FacebookService : Object, Spit.Pluggable, Spit.Publishing.Publishin
info.website_url = "http://www.yorba.org";
}
public Spit.Publishing.Publisher create_publisher() {
return new Publishing.Facebook.FacebookPublisher();
public Spit.Publishing.Publisher create_publisher(Spit.Publishing.PluginHost host) {
return new Publishing.Facebook.FacebookPublisher(this, host);
}
}
......@@ -109,17 +109,22 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
private string privacy_setting = PRIVACY_OBJECT_JUST_ME;
private FacebookAlbum[] albums = null;
private int publish_to_album = NO_ALBUM;
private weak Spit.Publishing.PublishingInteractor interactor = null;
private weak Spit.Publishing.PluginHost host = null;
private FacebookRESTSession session = null;
private WebAuthenticationPane web_auth_pane = null;
private Spit.Publishing.ProgressCallback progress_reporter = null;
private weak Spit.Publishing.PublishingService service = null;
private bool running = false;
public FacebookPublisher() {
public FacebookPublisher(Spit.Publishing.PublishingService service,
Spit.Publishing.PluginHost host) {
debug("FacebookPublisher instantiated.");
this.service = service;
this.host = host;
}
private bool is_running() {
return (interactor != null);
return running;
}
private int lookup_album(string name) {
......@@ -148,35 +153,35 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
}
private string? get_persistent_session_key() {
return interactor.get_config_string("session_key", null);
return host.get_config_string("session_key", null);
}
private string? get_persistent_session_secret() {
return interactor.get_config_string("session_secret", null);
return host.get_config_string("session_secret", null);
}
private string? get_persistent_uid() {
return interactor.get_config_string("uid", null);
return host.get_config_string("uid", null);
}
private string? get_persistent_user_name() {
return interactor.get_config_string("user_name", null);
return host.get_config_string("user_name", null);
}
private void set_persistent_session_key(string session_key) {
interactor.set_config_string("session_key", session_key);
host.set_config_string("session_key", session_key);
}
private void set_persistent_session_secret(string session_secret) {
interactor.set_config_string("session_secret", session_secret);
host.set_config_string("session_secret", session_secret);
}
private void set_persistent_uid(string uid) {
interactor.set_config_string("uid", uid);
host.set_config_string("uid", uid);
}
private void set_persistent_user_name(string user_name) {
interactor.set_config_string("user_name", user_name);
host.set_config_string("user_name", user_name);
}
private void invalidate_persistent_session() {
......@@ -191,15 +196,14 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
private void do_show_service_welcome_pane() {
debug("ACTION: showing service welcome pane.");
interactor.install_welcome_pane(SERVICE_WELCOME_MESSAGE, on_login_clicked);
host.install_welcome_pane(SERVICE_WELCOME_MESSAGE, on_login_clicked);
}
private void do_fetch_album_descriptions() {
debug("ACTION: fetching album descriptions from remote endpoint.");
interactor.set_button_mode(Spit.Publishing.PublishingInteractor.ButtonMode.CANCEL);
interactor.set_service_locked(true);
interactor.install_account_fetch_wait_pane();
host.set_service_locked(true);
host.install_account_fetch_wait_pane();
FacebookRESTTransaction albums_transaction = new FacebookAlbumsFetchTransaction(session);
albums_transaction.completed.connect(on_fetch_album_descriptions_completed);
......@@ -213,7 +217,7 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
// only post an error if we're running; errors tend to come in groups, so it's possible
// another error has already posted and caused us to stop
if (is_running())
interactor.post_error(err);
host.post_error(err);
}
}
......@@ -258,7 +262,7 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
// only post an error if we're running; errors tend to come in groups, so it's possible
// another error has already posted and caused us to stop
if (is_running())
interactor.post_error(err);
host.post_error(err);
return;
}
......@@ -270,14 +274,15 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
private void do_show_publishing_options_pane() {
debug("ACTION: showing publishing options pane.");
interactor.set_button_mode(Spit.Publishing.PublishingInteractor.ButtonMode.CANCEL);
interactor.set_service_locked(false);
host.set_service_locked(false);
PublishingOptionsPane publishing_options_pane = new PublishingOptionsPane(
session.get_user_name(), albums, interactor.get_publishable_media_type());
session.get_user_name(), albums, host.get_publishable_media_type());
publishing_options_pane.logout.connect(on_publishing_options_pane_logout);
publishing_options_pane.publish.connect(on_publishing_options_pane_publish);
interactor.install_dialog_pane(publishing_options_pane);
host.install_dialog_pane(publishing_options_pane,
Spit.Publishing.PluginHost.ButtonMode.CANCEL);
}
private void do_logout() {
......@@ -285,31 +290,28 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
invalidate_persistent_session();
Spit.Publishing.PublishingInteractor restart_with_interactor = interactor;
stop();
start(restart_with_interactor);
start();
}
private void do_hosted_web_authentication() {
debug("ACTION: doing hosted web authentication.");
interactor.set_button_mode(Spit.Publishing.PublishingInteractor.ButtonMode.CANCEL);
interactor.set_service_locked(false);
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);
interactor.install_dialog_pane(web_auth_pane);
host.install_dialog_pane(web_auth_pane,
Spit.Publishing.PluginHost.ButtonMode.CANCEL);
}
private void do_authenticate_session(string success_url) {
debug("ACTION: preparing to extract session information encoded in url = '%s'",
success_url);
interactor.set_button_mode(Spit.Publishing.PublishingInteractor.ButtonMode.CANCEL);
interactor.set_service_locked(true);
interactor.install_account_fetch_wait_pane();
host.set_service_locked(true);
host.install_account_fetch_wait_pane();
session.authenticated.connect(on_session_authenticated);
session.authentication_failed.connect(on_session_authentication_failed);
......@@ -320,7 +322,7 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
// only post an error if we're running; errors tend to come in groups, so it's possible
// another error has already posted and caused us to stop
if (is_running())
interactor.post_error(err);
host.post_error(err);
}
}
......@@ -337,12 +339,11 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
assert(publish_to_album != NO_ALBUM);
debug("ACTION: uploading photos to album '%s'", albums[publish_to_album].name);
interactor.set_button_mode(Spit.Publishing.PublishingInteractor.ButtonMode.CANCEL);
interactor.set_service_locked(true);
host.set_service_locked(true);
progress_reporter = interactor.serialize_publishables(MAX_PHOTO_DIMENSION);
progress_reporter = host.serialize_publishables(MAX_PHOTO_DIMENSION);
Spit.Publishing.Publishable[] publishables = interactor.get_publishables();
Spit.Publishing.Publishable[] publishables = host.get_publishables();
FacebookUploader uploader = new FacebookUploader(session, albums[publish_to_album].id,
privacy_setting, publishables);
......@@ -356,10 +357,10 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
debug("ACTION: creating new photo album with name '%s'", album_name);
albums += FacebookAlbum(album_name, "");
interactor.set_button_mode(Spit.Publishing.PublishingInteractor.ButtonMode.CANCEL);
interactor.set_service_locked(true);
host.set_service_locked(true);
interactor.install_static_message_pane(_("Creating album..."));
host.install_static_message_pane(_("Creating album..."),
Spit.Publishing.PluginHost.ButtonMode.CANCEL);
FacebookRESTTransaction create_txn = new FacebookCreateAlbumTransaction(session,
album_name, privacy_setting);
......@@ -372,7 +373,7 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
// only post an error if we're running; errors tend to come in groups, so it's possible
// another error has already posted and caused us to stop
if (is_running())
interactor.post_error(err);
host.post_error(err);
}
}
......@@ -393,7 +394,7 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
// only post an error if we're running; errors tend to come in groups, so it's possible
// another error has already posted and caused us to stop
if (is_running())
interactor.post_error(err);
host.post_error(err);
return;
}
......@@ -404,10 +405,8 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
private void do_show_success_pane() {
debug("ACTION: showing success pane.");
interactor.set_service_locked(false);
interactor.set_button_mode(Spit.Publishing.PublishingInteractor.ButtonMode.CLOSE);
interactor.install_success_pane(interactor.get_publishable_media_type());
host.set_service_locked(false);
host.install_success_pane();
}
private void on_login_clicked() {
......@@ -460,7 +459,7 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
debug("EVENT: session authentication failed.");
interactor.post_error(err);
host.post_error(err);
}
private void on_fetch_album_descriptions_completed(FacebookRESTTransaction txn) {
......@@ -483,7 +482,7 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
bad_txn.completed.disconnect(on_fetch_album_descriptions_completed);
bad_txn.network_error.disconnect(on_fetch_album_descriptions_error);
interactor.post_error(err);
host.post_error(err);
}
private void on_albums_extracted() {
......@@ -541,7 +540,7 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
bad_txn.completed.disconnect(on_create_album_txn_completed);
bad_txn.network_error.disconnect(on_create_album_txn_error);
interactor.post_error(err);
host.post_error(err);
}
private void on_album_name_extracted() {
......@@ -585,7 +584,11 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
uploader.upload_complete.disconnect(on_upload_complete);
uploader.upload_error.disconnect(on_upload_error);
interactor.post_error(err);
host.post_error(err);
}
public Spit.Publishing.PublishingService get_service() {
return service;
}
public string get_service_name() {
......@@ -601,13 +604,13 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
Spit.Publishing.Publisher.MediaType.VIDEO;
}
public void start(Spit.Publishing.PublishingInteractor interactor) {
public void start() {
if (is_running())
return;
debug("FacebookPublisher: starting interaction.");
this.interactor = interactor;
running = true;
// reset all publishing parameters to their default values -- in case this start is
// actually a restart
......@@ -627,9 +630,9 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
on_session_authenticated();
} else {
if (WebAuthenticationPane.is_cache_dirty()) {
interactor.set_button_mode(Spit.Publishing.PublishingInteractor.ButtonMode.CANCEL);
interactor.set_service_locked(false);
interactor.install_static_message_pane(RESTART_ERROR_MESSAGE);
host.set_service_locked(false);
host.install_static_message_pane(RESTART_ERROR_MESSAGE,
Spit.Publishing.PluginHost.ButtonMode.CANCEL);
} else {
session = new FacebookRESTSession(PHOTO_ENDPOINT_URL, USER_AGENT);
do_show_service_welcome_pane();
......@@ -640,8 +643,10 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
public void stop() {
debug("FacebookPublisher: stop( ) invoked.");
interactor = null;
host = null;
session.stop_transactions();
running = false;
}
}
......
......@@ -25,17 +25,15 @@ public interface Publisher : GLib.Object {
VIDEO = 1 << 1
}
public abstract string get_service_name();
public abstract string get_user_visible_name();
public abstract PublishingService get_service();
public abstract MediaType get_supported_media();
public abstract void start(PublishingInteractor interactor);
public abstract void start();
public abstract bool is_running();
/* plugins must relinquish their interactor reference when stop( ) is called */
/* plugins must relinquish their host reference when stop( ) is called */
public abstract void stop();
}
......@@ -61,23 +59,28 @@ public delegate void ProgressCallback(int file_number, double fraction_complete)
public delegate void LoginCallback();
public interface PublishingInteractor : GLib.Object {
public interface PluginHost : GLib.Object, Spit.HostInterface {
public enum ButtonMode {
CLOSE,
CANCEL
}
public abstract void install_dialog_pane(Spit.Publishing.PublishingDialogPane pane);
public abstract void post_error(Error err);
public abstract void stop_publishing();
public abstract void install_static_message_pane(string message);
public abstract Publisher get_publisher();
public abstract void install_dialog_pane(Spit.Publishing.PublishingDialogPane pane,
ButtonMode mode = ButtonMode.CANCEL);
public abstract void install_static_message_pane(string message,
ButtonMode mode = ButtonMode.CANCEL);
public abstract void install_pango_message_pane(string markup);
public abstract void install_pango_message_pane(string markup,
ButtonMode mode = ButtonMode.CANCEL);
public abstract void install_success_pane(Spit.Publishing.Publisher.MediaType media_type);
public abstract void install_success_pane();
public abstract void install_account_fetch_wait_pane();
......@@ -88,26 +91,8 @@ public interface PublishingInteractor : GLib.Object {
public abstract void set_service_locked(bool locked);
public abstract void set_button_mode(ButtonMode mode);
public abstract void set_dialog_default_widget(Gtk.Widget widget);
public abstract int get_config_int(string key, int default_value);
public abstract string? get_config_string(string key, string? default_value);
public abstract bool get_config_bool(string key, bool default_value);
public abstract double get_config_double(string key, double default_value);
public abstract void set_config_int(string key, int value);
public abstract void set_config_string(string key, string value);
public abstract void set_config_bool(string key, bool value);
public abstract void set_config_double(string key, double value);
public abstract Publishable[] get_publishables();
public abstract ProgressCallback? serialize_publishables(int content_major_axis,
......@@ -117,14 +102,11 @@ public interface PublishingInteractor : GLib.Object {
}
public interface Publishable : GLib.Object {
public abstract GLib.File serialize_for_publishing(int content_major_axis,
bool strip_metadata = false) throws Spit.Publishing.PublishingError;
public abstract GLib.File? get_serialized_file();
public abstract string get_publishing_name();
public abstract string get_publishing_description();
public abstract string? get_publishing_description();
public abstract string[] get_publishing_keywords();
......@@ -132,7 +114,7 @@ public interface Publishable : GLib.Object {
}
public interface PublishingService : Object, Spit.Pluggable {
public abstract Spit.Publishing.Publisher create_publisher();
public abstract Spit.Publishing.Publisher create_publisher(Spit.Publishing.PluginHost host);
}
}
......
......@@ -7,45 +7,38 @@ namespace Publishing.Glue {
public class PublisherWrapperInteractor : ServiceInteractor, Spit.Publishing.Publisher {
private Spit.Publishing.Publisher wrapped;
private Spit.Publishing.PublishingInteractor new_api_interactor;
private Spit.Publishing.PluginHost new_api_host;
private weak PublishingDialog old_api_dialog;
public PublisherWrapperInteractor(Spit.Publishing.Publisher wrapped,
Spit.Publishing.PublishingInteractor new_api_interactor, PublishingDialog old_api_dialog) {
public PublisherWrapperInteractor(Spit.Publishing.PluginHost new_api_host,
PublishingDialog old_api_dialog) {
base(old_api_dialog);
this.wrapped = wrapped;
this.new_api_interactor = new_api_interactor;
this.wrapped = new_api_host.get_publisher();
this.new_api_host = new_api_host;
this.old_api_dialog = old_api_dialog;
}
public string get_service_name() {
return wrapped.get_service_name();
}
public string get_user_visible_name() {
return wrapped.get_user_visible_name();
public Spit.Publishing.PublishingService get_service() {
return wrapped.get_service();
}
public Spit.Publishing.Publisher.MediaType get_supported_media() {
return wrapped.get_supported_media();
}
public void start(Spit.Publishing.PublishingInteractor interactor) {
if (interactor is Spit.Publishing.PublishingHost)
((Spit.Publishing.PublishingHost) interactor).set_active_publisher(wrapped);
wrapped.start(interactor);
public void start() {
wrapped.start();
}
public void stop() {
debug("PublisherWrapperInteractor: stop( ) invoked.");
old_api_dialog = null;
new_api_interactor.stop_publishing();
new_api_host.stop_publishing();
wrapped = null;
new_api_interactor = null;
new_api_host = null;
}
public bool is_running() {
......@@ -56,12 +49,12 @@ public class PublisherWrapperInteractor : ServiceInteractor, Spit.Publishing.Pub
}
public override string get_name() {
return get_user_visible_name();
return wrapped.get_service().get_pluggable_name();
}
public override void start_interaction() {
debug("PublisherWrapperInteractor: start_interaction( ): invoked.");
start(new_api_interactor);
start();
}
public override void cancel_interaction() {
......@@ -70,8 +63,9 @@ public class PublisherWrapperInteractor : ServiceInteractor, Spit.Publishing.Pub
}
}
public class DialogInteractorWrapper : PublishingDialog, Spit.Publishing.PublishingInteractor {
Spit.Publishing.PublishingInteractor plugin_host;
public class DialogInteractorWrapper : PublishingDialog, Spit.HostInterface,
Spit.Publishing.PluginHost {
Spit.Publishing.PluginHost plugin_host;
Spit.Publishing.Publishable[] publishables;
public DialogInteractorWrapper(Gee.Collection<MediaSource> to_publish) {
......@@ -83,14 +77,15 @@ public class DialogInteractorWrapper : PublishingDialog, Spit.Publishing.Publish
publishables += new MediaSourcePublishableWrapper(current_media_item);
}
public void set_plugin_host(Spit.Publishing.PublishingInteractor plugin_host) {
public void set_plugin_host(Spit.Publishing.PluginHost plugin_host) {
this.plugin_host = plugin_host;
}
public void install_dialog_pane(Spit.Publishing.PublishingDialogPane pane) {
public void install_dialog_pane(Spit.Publishing.PublishingDialogPane pane,
Spit.Publishing.PluginHost.ButtonMode button_mode) {
debug("DialogInteractorWrapper: install_pane( ): invoked.");
plugin_host.install_dialog_pane(pane);
plugin_host.install_dialog_pane(pane, button_mode);
}
public void post_error(Error err) {
......@@ -105,16 +100,22 @@ public class DialogInteractorWrapper : PublishingDialog, Spit.Publishing.Publish
plugin_host.stop_publishing();
}
public void install_static_message_pane(string message) {
plugin_host.install_static_message_pane(message);
public Spit.Publishing.Publisher get_publisher() {
return plugin_host.get_publisher();
}
public void install_static_message_pane(string message,
Spit.Publishing.PluginHost.ButtonMode button_mode) {
plugin_host.install_static_message_pane(message, button_mode);
}
public void install_pango_message_pane(string markup) {
plugin_host.install_pango_message_pane(markup);
public void install_pango_message_pane(string markup,
Spit.Publishing.PluginHost.ButtonMode button_mode) {
plugin_host.install_pango_message_pane(markup, button_mode);
}
public void install_success_pane(Spit.Publishing.Publisher.MediaType media_type) {
plugin_host.install_success_pane(media_type);
public void install_success_pane() {
plugin_host.install_success_pane();
}
public void install_account_fetch_wait_pane() {
......@@ -133,10 +134,6 @@ public class DialogInteractorWrapper : PublishingDialog, Spit.Publishing.Publish
public void set_service_locked(bool locked) {
plugin_host.set_service_locked(locked);
}
public void set_button_mode(Spit.Publishing.PublishingInteractor.ButtonMode mode) {
plugin_host.set_button_mode(mode);
}
public void set_dialog_default_widget(Gtk.Widget widget) {
plugin_host.set_dialog_default_widget(widget);
......@@ -146,6 +143,10 @@ public class DialogInteractorWrapper : PublishingDialog, Spit.Publishing.Publish
return plugin_host.get_publishable_media_type();
}
public GLib.File get_module_file() {
return plugin_host.get_module_file();
}
public int get_config_int(string key, int default_value) {
return plugin_host.get_config_int(key, default_value);
}
......@@ -166,7 +167,7 @@ public class DialogInteractorWrapper : PublishingDialog, Spit.Publishing.Publish
plugin_host.set_config_int(key, value);
}
public void set_config_string(string key, string value) {
public void set_config_string(string key, string? value) {
plugin_host.set_config_string(key, value);
}
......@@ -177,7 +178,11 @@ public class DialogInteractorWrapper : PublishingDialog, Spit.Publishing.Publish
public void set_config_double(string key, double value) {
plugin_host.set_config_double(key, value);
}
public void unset_config_key(string key) {
plugin_host.unset_config_key(key);
}
public Spit.Publishing.Publishable[] get_publishables() {
return publishables;
}
......@@ -264,8 +269,8 @@ public class MediaSourcePublishableWrapper : Spit.Publishing.Publishable, GLib.O
return wrapped.get_name();
}
public string get_publishing_description() {
return "";
public string? get_publishing_description() {
return null;
}
public string[] get_publishing_keywords() {
......@@ -278,7 +283,7 @@ public class MediaSourcePublishableWrapper : Spit.Publishing.Publishable, GLib.O
}
}
return result;
return (result.length > 0) ? result : null;
}
public Spit.Publishing.Publisher.MediaType get_media_type() {
......@@ -291,13 +296,15 @@ public class MediaSourcePublishableWrapper : Spit.Publishing.Publishable, GLib.O
}
public GLib.File? get_serialized_file() {
assert(serialized_file != null);
return serialized_file;
}
}
public class GlueFactory {
private static GlueFactory instance = null;
private Spit.Publishing.PublishingHost publishing_host = null;
private Spit.Publishing.ConcretePublishingHost publishing_host = null;
private GlueFactory() {
}
......@@ -323,13 +330,6 @@ public class GlueFactory {
if (service_name != "facebook")
error("GlueFactory: unsupported service name");
Spit.Publishing.Publishable[] publishables =
((DialogInteractorWrapper) active_dialog).get_publishables();
debug("GlueFactory: setting up adapters to publish %d items.", publishables.length);
publishing_host = new Spit.Publishing.PublishingHost(active_dialog, publishables);
((DialogInteractorWrapper) active_dialog).set_plugin_host(publishing_host);
// load publishing services from plug-ins
Gee.Collection<Spit.Pluggable> pluggables = Plugins.get_pluggables_for_type(
typeof(Spit.Publishing.PublishingService));
......@@ -357,11 +357,18 @@ public class GlueFactory {
if (facebook_service == null)
error("Publishing API Glue: required service 'Facebook' wasn't found.'");
Spit.Publishing.Publishable[] publishables =
((DialogInteractorWrapper) active_dialog).get_publishables();
debug("GlueFactory: setting up adapters to publish %d items.", publishables.length);
publishing_host = new Spit.Publishing.ConcretePublishingHost(facebook_service, active_dialog,
publishables);
((DialogInteractorWrapper) active_dialog).set_plugin_host(publishing_host);
Spit.Publishing.Publisher real_publisher = facebook_service.create_publisher();
ServiceInteractor publisher_wrapper = new PublisherWrapperInteractor(real_publisher,
publishing_host, active_dialog);
ServiceInteractor publisher_wrapper = new PublisherWrapperInteractor(publishing_host,
active_dialog);
active_dialog = null;
......
......@@ -6,12 +6,12 @@
namespace Spit.Publishing {
public class PublishingHost : Spit.Publishing.PublishingInteractor, GLib.Object {
public class ConcretePublishingHost : Plugins.StandardHostInterface,
Spit.Publishing.PluginHost {
private const string PREPARE_STATUS_DESCRIPTION = _("Preparing for upload");
private const string UPLOAD_STATUS_DESCRIPTION = _("Uploading %d of %d");
private const double STATUS_PREPARATION_FRACTION = 0.3;
private const double STATUS_UPLOAD_FRACTION = 0.7;
private PublishingDialog dialog = null;
private Spit.Publishing.PublishingDialogPane current_pane = null;
......@@ -19,9 +19,12 @@ public class PublishingHost : Spit.Publishing.PublishingInteractor, GLib.Object
private Publishable[] publishables = null;
private LoginCallback current_login_callback = null;
public PublishingHost(PublishingDialog dialog, Publishable[] publishables) {
public ConcretePublishingHost(PublishingService service, PublishingDialog dialog,
Publishable[] publishables) {
base(service, "sharing");
this.dialog = dialog;
this.publishables = publishables;
this.active_publisher = service.create_publisher(this);
}
private void on_login_clicked() {
......@@ -57,14 +60,12 @@ public class PublishingHost : Spit.Publishing.PublishingInteractor, GLib.Object
current_pane = null;
dialog.install_pane(progress_pane);
set_button_mode(Spit.Publishing.PluginHost.ButtonMode.CANCEL);
}
public void set_active_publisher(Spit.Publishing.Publisher active_publisher) {
this.active_publisher = active_publisher;
}
public void install_dialog_pane(Spit.Publishing.PublishingDialogPane pane) {
debug("PublishingPluginHost: install_dialog_pane( ): invoked.");
public void install_dialog_pane(Spit.Publishing.PublishingDialogPane pane,
Spit.Publishing.PluginHost.ButtonMode button_mode) {
debug("Publishing.PluginHost: install_dialog_pane( ): invoked.");
if (active_publisher == null || (!active_publisher.is_running()))
return;
......@@ -86,6 +87,8 @@ public class PublishingHost : Spit.Publishing.PublishingInteractor, GLib.Object
else
dialog.clear_free_sizable_window_mode();
set_button_mode(button_mode);