/* PublishingPluginHost.c generated by valac 0.56.19, the Vala compiler
 * generated from PublishingPluginHost.vala, do not modify */

/* Copyright 2016 Software Freedom Conservancy Inc.
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */

#include <glib-object.h>
#include "shotwell-plugin-dev-1.0.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <float.h>
#include <math.h>
#include "shotwell-internal-publishing-gui.h"
#include <gio/gio.h>

#define SPIT_PUBLISHING_CONCRETE_PUBLISHING_HOST_PREPARE_STATUS_DESCRIPTION _ ("Preparing for upload")
#define SPIT_PUBLISHING_CONCRETE_PUBLISHING_HOST_UPLOAD_STATUS_DESCRIPTION _ ("Uploading %d of %d")
#define SPIT_PUBLISHING_CONCRETE_PUBLISHING_HOST_STATUS_PREPARATION_FRACTION 0.3
#define SPIT_PUBLISHING_CONCRETE_PUBLISHING_HOST_STATUS_UPLOAD_FRACTION 0.7
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define PLUGINS_TYPE_STANDARD_HOST_INTERFACE (plugins_standard_host_interface_get_type ())
#define PLUGINS_STANDARD_HOST_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PLUGINS_TYPE_STANDARD_HOST_INTERFACE, PluginsStandardHostInterface))
#define PLUGINS_STANDARD_HOST_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PLUGINS_TYPE_STANDARD_HOST_INTERFACE, PluginsStandardHostInterfaceClass))
#define PLUGINS_IS_STANDARD_HOST_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PLUGINS_TYPE_STANDARD_HOST_INTERFACE))
#define PLUGINS_IS_STANDARD_HOST_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLUGINS_TYPE_STANDARD_HOST_INTERFACE))
#define PLUGINS_STANDARD_HOST_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PLUGINS_TYPE_STANDARD_HOST_INTERFACE, PluginsStandardHostInterfaceClass))

typedef struct _PluginsStandardHostInterface PluginsStandardHostInterface;
typedef struct _PluginsStandardHostInterfaceClass PluginsStandardHostInterfaceClass;
typedef struct _PluginsStandardHostInterfacePrivate PluginsStandardHostInterfacePrivate;

#define SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST (spit_publishing_concrete_publishing_host_get_type ())
#define SPIT_PUBLISHING_CONCRETE_PUBLISHING_HOST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost))
#define SPIT_PUBLISHING_CONCRETE_PUBLISHING_HOST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHostClass))
#define SPIT_PUBLISHING_IS_CONCRETE_PUBLISHING_HOST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST))
#define SPIT_PUBLISHING_IS_CONCRETE_PUBLISHING_HOST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST))
#define SPIT_PUBLISHING_CONCRETE_PUBLISHING_HOST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHostClass))

typedef struct _SpitPublishingConcretePublishingHost SpitPublishingConcretePublishingHost;
typedef struct _SpitPublishingConcretePublishingHostClass SpitPublishingConcretePublishingHostClass;
typedef struct _SpitPublishingConcretePublishingHostPrivate SpitPublishingConcretePublishingHostPrivate;

#define PUBLISHING_UI_TYPE_PUBLISHING_DIALOG (publishing_ui_publishing_dialog_get_type ())
#define PUBLISHING_UI_PUBLISHING_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PUBLISHING_UI_TYPE_PUBLISHING_DIALOG, PublishingUIPublishingDialog))
#define PUBLISHING_UI_PUBLISHING_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PUBLISHING_UI_TYPE_PUBLISHING_DIALOG, PublishingUIPublishingDialogClass))
#define PUBLISHING_UI_IS_PUBLISHING_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PUBLISHING_UI_TYPE_PUBLISHING_DIALOG))
#define PUBLISHING_UI_IS_PUBLISHING_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PUBLISHING_UI_TYPE_PUBLISHING_DIALOG))
#define PUBLISHING_UI_PUBLISHING_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PUBLISHING_UI_TYPE_PUBLISHING_DIALOG, PublishingUIPublishingDialogClass))

typedef struct _PublishingUIPublishingDialog PublishingUIPublishingDialog;
typedef struct _PublishingUIPublishingDialogClass PublishingUIPublishingDialogClass;
enum  {
	SPIT_PUBLISHING_CONCRETE_PUBLISHING_HOST_0_PROPERTY,
	SPIT_PUBLISHING_CONCRETE_PUBLISHING_HOST_NUM_PROPERTIES
};
static GParamSpec* spit_publishing_concrete_publishing_host_properties[SPIT_PUBLISHING_CONCRETE_PUBLISHING_HOST_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define SHOTWELL_TYPE_PROFILE_MANAGER (shotwell_profile_manager_get_type ())
#define SHOTWELL_PROFILE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHOTWELL_TYPE_PROFILE_MANAGER, ShotwellProfileManager))
#define SHOTWELL_PROFILE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHOTWELL_TYPE_PROFILE_MANAGER, ShotwellProfileManagerClass))
#define SHOTWELL_IS_PROFILE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SHOTWELL_TYPE_PROFILE_MANAGER))
#define SHOTWELL_IS_PROFILE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHOTWELL_TYPE_PROFILE_MANAGER))
#define SHOTWELL_PROFILE_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHOTWELL_TYPE_PROFILE_MANAGER, ShotwellProfileManagerClass))

typedef struct _ShotwellProfileManager ShotwellProfileManager;
typedef struct _ShotwellProfileManagerClass ShotwellProfileManagerClass;

#define PUBLISHING_GLUE_TYPE_MEDIA_SOURCE_PUBLISHABLE_WRAPPER (publishing_glue_media_source_publishable_wrapper_get_type ())
#define PUBLISHING_GLUE_MEDIA_SOURCE_PUBLISHABLE_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PUBLISHING_GLUE_TYPE_MEDIA_SOURCE_PUBLISHABLE_WRAPPER, PublishingGlueMediaSourcePublishableWrapper))
#define PUBLISHING_GLUE_MEDIA_SOURCE_PUBLISHABLE_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PUBLISHING_GLUE_TYPE_MEDIA_SOURCE_PUBLISHABLE_WRAPPER, PublishingGlueMediaSourcePublishableWrapperClass))
#define PUBLISHING_GLUE_IS_MEDIA_SOURCE_PUBLISHABLE_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PUBLISHING_GLUE_TYPE_MEDIA_SOURCE_PUBLISHABLE_WRAPPER))
#define PUBLISHING_GLUE_IS_MEDIA_SOURCE_PUBLISHABLE_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PUBLISHING_GLUE_TYPE_MEDIA_SOURCE_PUBLISHABLE_WRAPPER))
#define PUBLISHING_GLUE_MEDIA_SOURCE_PUBLISHABLE_WRAPPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PUBLISHING_GLUE_TYPE_MEDIA_SOURCE_PUBLISHABLE_WRAPPER, PublishingGlueMediaSourcePublishableWrapperClass))

typedef struct _PublishingGlueMediaSourcePublishableWrapper PublishingGlueMediaSourcePublishableWrapper;
typedef struct _PublishingGlueMediaSourcePublishableWrapperClass PublishingGlueMediaSourcePublishableWrapperClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _PluginsStandardHostInterface {
	GObject parent_instance;
	PluginsStandardHostInterfacePrivate * priv;
};

struct _PluginsStandardHostInterfaceClass {
	GObjectClass parent_class;
};

struct _SpitPublishingConcretePublishingHost {
	PluginsStandardHostInterface parent_instance;
	SpitPublishingConcretePublishingHostPrivate * priv;
};

struct _SpitPublishingConcretePublishingHostClass {
	PluginsStandardHostInterfaceClass parent_class;
};

struct _SpitPublishingConcretePublishingHostPrivate {
	PublishingUIPublishingDialog* dialog;
	SpitPublishingPublisher* active_publisher;
	SpitPublishingPublishable** publishables;
	gint publishables_length1;
	gint _publishables_size_;
	SpitPublishingLoginCallback current_login_callback;
	gpointer current_login_callback_target;
	gboolean publishing_halted;
	SpitPublishingPublisherMediaType media_type;
};

static gint SpitPublishingConcretePublishingHost_private_offset;
static gpointer spit_publishing_concrete_publishing_host_parent_class = NULL;
static SpitPublishingPluginHostIface * spit_publishing_concrete_publishing_host_spit_publishing_plugin_host_parent_iface = NULL;

VALA_EXTERN GType plugins_standard_host_interface_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PluginsStandardHostInterface, g_object_unref)
VALA_EXTERN GType spit_publishing_concrete_publishing_host_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpitPublishingConcretePublishingHost, g_object_unref)
VALA_EXTERN GType publishing_ui_publishing_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PublishingUIPublishingDialog, g_object_unref)
VALA_EXTERN SpitPublishingConcretePublishingHost* spit_publishing_concrete_publishing_host_new (SpitPublishingService* service,
                                                                                    PublishingUIPublishingDialog* dialog,
                                                                                    SpitPublishingPublishable** publishables,
                                                                                    gint publishables_length1,
                                                                                    SpitPublishingAccount* account);
VALA_EXTERN SpitPublishingConcretePublishingHost* spit_publishing_concrete_publishing_host_construct (GType object_type,
                                                                                          SpitPublishingService* service,
                                                                                          PublishingUIPublishingDialog* dialog,
                                                                                          SpitPublishingPublishable** publishables,
                                                                                          gint publishables_length1,
                                                                                          SpitPublishingAccount* account);
VALA_EXTERN PluginsStandardHostInterface* plugins_standard_host_interface_new (SpitPluggable* pluggable,
                                                                   const gchar* config_domain);
VALA_EXTERN PluginsStandardHostInterface* plugins_standard_host_interface_construct (GType object_type,
                                                                         SpitPluggable* pluggable,
                                                                         const gchar* config_domain);
static SpitPublishingPublishable** _vala_array_dup27 (SpitPublishingPublishable** self,
                                               gssize length);
static void spit_publishing_concrete_publishing_host_real_register_auth_callback (SpitPublishingPluginHost* base,
                                                                           const gchar* cookie,
                                                                           SpitPublishingAuthenticatedCallback* callback);
VALA_EXTERN void application_register_auth_callback (const gchar* cookie,
                                         SpitPublishingAuthenticatedCallback* cb);
static void spit_publishing_concrete_publishing_host_real_unregister_auth_callback (SpitPublishingPluginHost* base,
                                                                             const gchar* cookie);
VALA_EXTERN void application_unregister_auth_callback (const gchar* cookie);
static gchar* spit_publishing_concrete_publishing_host_real_get_current_profile_id (SpitPublishingPluginHost* base);
VALA_EXTERN GType shotwell_profile_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ShotwellProfileManager, g_object_unref)
VALA_EXTERN ShotwellProfileManager* shotwell_profile_manager_get_instance (void);
VALA_EXTERN gchar* shotwell_profile_manager_id (ShotwellProfileManager* self);
static void spit_publishing_concrete_publishing_host_on_login_clicked (SpitPublishingConcretePublishingHost* self);
static void spit_publishing_concrete_publishing_host_clean_up (SpitPublishingConcretePublishingHost* self);
VALA_EXTERN GType publishing_glue_media_source_publishable_wrapper_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PublishingGlueMediaSourcePublishableWrapper, g_object_unref)
VALA_EXTERN void publishing_glue_media_source_publishable_wrapper_clean_up (PublishingGlueMediaSourcePublishableWrapper* self);
static void spit_publishing_concrete_publishing_host_report_plugin_upload_progress (SpitPublishingConcretePublishingHost* self,
                                                                             gint file_number,
                                                                             gdouble fraction_complete);
VALA_EXTERN SpitPublishingDialogPane* publishing_ui_publishing_dialog_get_active_pane (PublishingUIPublishingDialog* self);
static void spit_publishing_concrete_publishing_host_install_progress_pane (SpitPublishingConcretePublishingHost* self);
VALA_EXTERN void publishing_ui_publishing_dialog_install_pane (PublishingUIPublishingDialog* self,
                                                   SpitPublishingDialogPane* pane);
VALA_EXTERN void spit_publishing_concrete_publishing_host_set_button_mode (SpitPublishingConcretePublishingHost* self,
                                                               SpitPublishingPluginHostButtonMode mode);
static void spit_publishing_concrete_publishing_host_real_install_dialog_pane (SpitPublishingPluginHost* base,
                                                                        SpitPublishingDialogPane* pane,
                                                                        SpitPublishingPluginHostButtonMode button_mode);
static void spit_publishing_concrete_publishing_host_real_post_error (SpitPublishingPluginHost* base,
                                                               GError* err);
VALA_EXTERN void publishing_ui_publishing_dialog_set_close_button_mode (PublishingUIPublishingDialog* self);
VALA_EXTERN void publishing_ui_publishing_dialog_unlock_service (PublishingUIPublishingDialog* self);
static void spit_publishing_concrete_publishing_host_real_stop_publishing (SpitPublishingPluginHost* base);
VALA_EXTERN void spit_publishing_concrete_publishing_host_start_publishing (SpitPublishingConcretePublishingHost* self);
static SpitPublishingPublisher* spit_publishing_concrete_publishing_host_real_get_publisher (SpitPublishingPluginHost* base);
static void spit_publishing_concrete_publishing_host_real_install_static_message_pane (SpitPublishingPluginHost* base,
                                                                                const gchar* message,
                                                                                SpitPublishingPluginHostButtonMode button_mode);
static void spit_publishing_concrete_publishing_host_real_install_pango_message_pane (SpitPublishingPluginHost* base,
                                                                               const gchar* markup,
                                                                               SpitPublishingPluginHostButtonMode button_mode);
static void spit_publishing_concrete_publishing_host_real_install_success_pane (SpitPublishingPluginHost* base);
static void spit_publishing_concrete_publishing_host_real_install_account_fetch_wait_pane (SpitPublishingPluginHost* base);
static void spit_publishing_concrete_publishing_host_real_install_login_wait_pane (SpitPublishingPluginHost* base);
static void spit_publishing_concrete_publishing_host_real_install_welcome_pane (SpitPublishingPluginHost* base,
                                                                         const gchar* welcome_message,
                                                                         SpitPublishingLoginCallback login_clicked_callback,
                                                                         gpointer login_clicked_callback_target);
static void _spit_publishing_concrete_publishing_host_on_login_clicked_publishing_ui_login_welcome_pane_login_requested (PublishingUILoginWelcomePane* _sender,
                                                                                                                  gpointer self);
static void spit_publishing_concrete_publishing_host_real_set_service_locked (SpitPublishingPluginHost* base,
                                                                       gboolean locked);
VALA_EXTERN void publishing_ui_publishing_dialog_lock_service (PublishingUIPublishingDialog* self);
VALA_EXTERN void publishing_ui_publishing_dialog_set_cancel_button_mode (PublishingUIPublishingDialog* self);
static void spit_publishing_concrete_publishing_host_real_set_dialog_default_widget (SpitPublishingPluginHost* base,
                                                                              GtkWidget* widget);
static SpitPublishingPublisherMediaType spit_publishing_concrete_publishing_host_real_get_publishable_media_type (SpitPublishingPluginHost* base);
static SpitPublishingPublishable** spit_publishing_concrete_publishing_host_real_get_publishables (SpitPublishingPluginHost* base,
                                                                                            gint* result_length1);
static SpitPublishingPublishable** _vala_array_dup28 (SpitPublishingPublishable** self,
                                               gssize length);
static SpitPublishingProgressCallback spit_publishing_concrete_publishing_host_real_serialize_publishables (SpitPublishingPluginHost* base,
                                                                                                     gint content_major_axis,
                                                                                                     gboolean strip_metadata,
                                                                                                     gpointer* result_target,
                                                                                                     GDestroyNotify* result_target_destroy_notify);
VALA_EXTERN void spin_event_loop (void);
VALA_EXTERN GFile* publishing_glue_media_source_publishable_wrapper_serialize_for_publishing (PublishingGlueMediaSourcePublishableWrapper* self,
                                                                                  gint content_major_axis,
                                                                                  gboolean strip_metadata,
                                                                                  GError** error);
static void _spit_publishing_concrete_publishing_host_report_plugin_upload_progress_spit_publishing_progress_callback (gint file_number,
                                                                                                                gdouble fraction_complete,
                                                                                                                gpointer self);
static void spit_publishing_concrete_publishing_host_finalize (GObject * obj);
static GType spit_publishing_concrete_publishing_host_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
spit_publishing_concrete_publishing_host_get_instance_private (SpitPublishingConcretePublishingHost* self)
{
	return G_STRUCT_MEMBER_P (self, SpitPublishingConcretePublishingHost_private_offset);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static SpitPublishingPublishable**
_vala_array_dup27 (SpitPublishingPublishable** self,
                   gssize length)
{
	if (length >= 0) {
		SpitPublishingPublishable** result;
		gssize i;
		result = g_new0 (SpitPublishingPublishable*, length + 1);
		for (i = 0; i < length; i++) {
			SpitPublishingPublishable* _tmp0_;
			_tmp0_ = _g_object_ref0 (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

SpitPublishingConcretePublishingHost*
spit_publishing_concrete_publishing_host_construct (GType object_type,
                                                    SpitPublishingService* service,
                                                    PublishingUIPublishingDialog* dialog,
                                                    SpitPublishingPublishable** publishables,
                                                    gint publishables_length1,
                                                    SpitPublishingAccount* account)
{
	SpitPublishingConcretePublishingHost * self = NULL;
	SpitPublishingPublishable** _tmp0_;
	gint _tmp0__length1;
	SpitPublishingPublisher* _tmp3_;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (service, SPIT_PUBLISHING_TYPE_SERVICE), NULL);
	g_return_val_if_fail (PUBLISHING_UI_IS_PUBLISHING_DIALOG (dialog), NULL);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (account, SPIT_PUBLISHING_TYPE_ACCOUNT), NULL);
	self = (SpitPublishingConcretePublishingHost*) plugins_standard_host_interface_construct (object_type, G_TYPE_CHECK_INSTANCE_CAST (service, SPIT_TYPE_PLUGGABLE, SpitPluggable), "sharing");
	self->priv->dialog = dialog;
	_tmp0_ = (publishables != NULL) ? _vala_array_dup27 (publishables, publishables_length1) : publishables;
	_tmp0__length1 = publishables_length1;
	self->priv->publishables = (_vala_array_free (self->priv->publishables, self->priv->publishables_length1, (GDestroyNotify) g_object_unref), NULL);
	self->priv->publishables = _tmp0_;
	self->priv->publishables_length1 = _tmp0__length1;
	self->priv->_publishables_size_ = self->priv->publishables_length1;
	{
		SpitPublishingPublishable** curr_publishable_collection = NULL;
		gint curr_publishable_collection_length1 = 0;
		gint _curr_publishable_collection_size_ = 0;
		gint curr_publishable_it = 0;
		curr_publishable_collection = publishables;
		curr_publishable_collection_length1 = publishables_length1;
		for (curr_publishable_it = 0; curr_publishable_it < curr_publishable_collection_length1; curr_publishable_it = curr_publishable_it + 1) {
			SpitPublishingPublishable* _tmp1_;
			SpitPublishingPublishable* curr_publishable = NULL;
			_tmp1_ = _g_object_ref0 (curr_publishable_collection[curr_publishable_it]);
			curr_publishable = _tmp1_;
			{
				SpitPublishingPublishable* _tmp2_;
				_tmp2_ = curr_publishable;
				self->priv->media_type = self->priv->media_type | spit_publishing_publishable_get_media_type (_tmp2_);
				_g_object_unref0 (curr_publishable);
			}
		}
	}
	_tmp3_ = spit_publishing_service_create_publisher_with_account (service, G_TYPE_CHECK_INSTANCE_CAST (self, SPIT_PUBLISHING_TYPE_PLUGIN_HOST, SpitPublishingPluginHost), account);
	_g_object_unref0 (self->priv->active_publisher);
	self->priv->active_publisher = _tmp3_;
	return self;
}

SpitPublishingConcretePublishingHost*
spit_publishing_concrete_publishing_host_new (SpitPublishingService* service,
                                              PublishingUIPublishingDialog* dialog,
                                              SpitPublishingPublishable** publishables,
                                              gint publishables_length1,
                                              SpitPublishingAccount* account)
{
	return spit_publishing_concrete_publishing_host_construct (SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, service, dialog, publishables, publishables_length1, account);
}

static void
spit_publishing_concrete_publishing_host_real_register_auth_callback (SpitPublishingPluginHost* base,
                                                                      const gchar* cookie,
                                                                      SpitPublishingAuthenticatedCallback* callback)
{
	SpitPublishingConcretePublishingHost * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	g_return_if_fail (cookie != NULL);
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (callback, SPIT_PUBLISHING_TYPE_AUTHENTICATED_CALLBACK));
	application_register_auth_callback (cookie, callback);
}

static void
spit_publishing_concrete_publishing_host_real_unregister_auth_callback (SpitPublishingPluginHost* base,
                                                                        const gchar* cookie)
{
	SpitPublishingConcretePublishingHost * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	g_return_if_fail (cookie != NULL);
	application_unregister_auth_callback (cookie);
}

static gchar*
spit_publishing_concrete_publishing_host_real_get_current_profile_id (SpitPublishingPluginHost* base)
{
	SpitPublishingConcretePublishingHost * self;
	ShotwellProfileManager* _tmp0_;
	ShotwellProfileManager* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	_tmp0_ = shotwell_profile_manager_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = shotwell_profile_manager_id (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	result = _tmp3_;
	return result;
}

static void
spit_publishing_concrete_publishing_host_on_login_clicked (SpitPublishingConcretePublishingHost* self)
{
	SpitPublishingLoginCallback _tmp0_;
	gpointer _tmp0__target;
	g_return_if_fail (SPIT_PUBLISHING_IS_CONCRETE_PUBLISHING_HOST (self));
	_tmp0_ = self->priv->current_login_callback;
	_tmp0__target = self->priv->current_login_callback_target;
	if (_tmp0_ != NULL) {
		SpitPublishingLoginCallback _tmp1_;
		gpointer _tmp1__target;
		_tmp1_ = self->priv->current_login_callback;
		_tmp1__target = self->priv->current_login_callback_target;
		_tmp1_ (_tmp1__target);
	}
}

static void
spit_publishing_concrete_publishing_host_clean_up (SpitPublishingConcretePublishingHost* self)
{
	SpitPublishingPublishable** _tmp0_;
	gint _tmp0__length1;
	g_return_if_fail (SPIT_PUBLISHING_IS_CONCRETE_PUBLISHING_HOST (self));
	_tmp0_ = self->priv->publishables;
	_tmp0__length1 = self->priv->publishables_length1;
	{
		SpitPublishingPublishable** publishable_collection = NULL;
		gint publishable_collection_length1 = 0;
		gint _publishable_collection_size_ = 0;
		gint publishable_it = 0;
		publishable_collection = _tmp0_;
		publishable_collection_length1 = _tmp0__length1;
		for (publishable_it = 0; publishable_it < publishable_collection_length1; publishable_it = publishable_it + 1) {
			SpitPublishingPublishable* _tmp1_;
			SpitPublishingPublishable* publishable = NULL;
			_tmp1_ = _g_object_ref0 (publishable_collection[publishable_it]);
			publishable = _tmp1_;
			{
				SpitPublishingPublishable* _tmp2_;
				_tmp2_ = publishable;
				publishing_glue_media_source_publishable_wrapper_clean_up (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, PUBLISHING_GLUE_TYPE_MEDIA_SOURCE_PUBLISHABLE_WRAPPER, PublishingGlueMediaSourcePublishableWrapper));
				_g_object_unref0 (publishable);
			}
		}
	}
}

static void
spit_publishing_concrete_publishing_host_report_plugin_upload_progress (SpitPublishingConcretePublishingHost* self,
                                                                        gint file_number,
                                                                        gdouble fraction_complete)
{
	PublishingUIPublishingDialog* _tmp0_;
	SpitPublishingDialogPane* _tmp1_;
	SpitPublishingDialogPane* _tmp2_;
	gboolean _tmp3_;
	PublishingUIProgressPane* pane = NULL;
	PublishingUIPublishingDialog* _tmp4_;
	SpitPublishingDialogPane* _tmp5_;
	gchar* status_string = NULL;
	SpitPublishingPublishable** _tmp6_;
	gint _tmp6__length1;
	gchar* _tmp7_;
	gdouble status_fraction = 0.0;
	PublishingUIProgressPane* _tmp8_;
	const gchar* _tmp9_;
	g_return_if_fail (SPIT_PUBLISHING_IS_CONCRETE_PUBLISHING_HOST (self));
	_tmp0_ = self->priv->dialog;
	_tmp1_ = publishing_ui_publishing_dialog_get_active_pane (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = !G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, PUBLISHING_UI_TYPE_PROGRESS_PANE);
	_g_object_unref0 (_tmp2_);
	if (_tmp3_) {
		return;
	}
	_tmp4_ = self->priv->dialog;
	_tmp5_ = publishing_ui_publishing_dialog_get_active_pane (_tmp4_);
	pane = G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, PUBLISHING_UI_TYPE_PROGRESS_PANE, PublishingUIProgressPane);
	_tmp6_ = self->priv->publishables;
	_tmp6__length1 = self->priv->publishables_length1;
	_tmp7_ = g_strdup_printf (SPIT_PUBLISHING_CONCRETE_PUBLISHING_HOST_UPLOAD_STATUS_DESCRIPTION, file_number, _tmp6__length1);
	status_string = _tmp7_;
	status_fraction = SPIT_PUBLISHING_CONCRETE_PUBLISHING_HOST_STATUS_PREPARATION_FRACTION + (SPIT_PUBLISHING_CONCRETE_PUBLISHING_HOST_STATUS_UPLOAD_FRACTION * fraction_complete);
	_tmp8_ = pane;
	_tmp9_ = status_string;
	publishing_ui_progress_pane_set_status (_tmp8_, _tmp9_, status_fraction);
	_g_free0 (status_string);
	_g_object_unref0 (pane);
}

static void
spit_publishing_concrete_publishing_host_install_progress_pane (SpitPublishingConcretePublishingHost* self)
{
	PublishingUIProgressPane* progress_pane = NULL;
	PublishingUIProgressPane* _tmp0_;
	PublishingUIPublishingDialog* _tmp1_;
	g_return_if_fail (SPIT_PUBLISHING_IS_CONCRETE_PUBLISHING_HOST (self));
	_tmp0_ = publishing_ui_progress_pane_new ();
	g_object_ref_sink (_tmp0_);
	progress_pane = _tmp0_;
	_tmp1_ = self->priv->dialog;
	publishing_ui_publishing_dialog_install_pane (_tmp1_, G_TYPE_CHECK_INSTANCE_CAST (progress_pane, SPIT_PUBLISHING_TYPE_DIALOG_PANE, SpitPublishingDialogPane));
	spit_publishing_concrete_publishing_host_set_button_mode (self, SPIT_PUBLISHING_PLUGIN_HOST_BUTTON_MODE_CANCEL);
	_g_object_unref0 (progress_pane);
}

static void
spit_publishing_concrete_publishing_host_real_install_dialog_pane (SpitPublishingPluginHost* base,
                                                                   SpitPublishingDialogPane* pane,
                                                                   SpitPublishingPluginHostButtonMode button_mode)
{
	SpitPublishingConcretePublishingHost * self;
	gboolean _tmp0_ = FALSE;
	SpitPublishingPublisher* _tmp1_;
	PublishingUIPublishingDialog* _tmp3_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (pane, SPIT_PUBLISHING_TYPE_DIALOG_PANE));
	g_debug ("PublishingPluginHost.vala:82: Publishing.PluginHost: install_dialog_pa" \
"ne( ): invoked.");
	_tmp1_ = self->priv->active_publisher;
	if (_tmp1_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		SpitPublishingPublisher* _tmp2_;
		_tmp2_ = self->priv->active_publisher;
		_tmp0_ = !spit_publishing_publisher_is_running (_tmp2_);
	}
	if (_tmp0_) {
		return;
	}
	_tmp3_ = self->priv->dialog;
	publishing_ui_publishing_dialog_install_pane (_tmp3_, pane);
	spit_publishing_concrete_publishing_host_set_button_mode (self, button_mode);
}

static void
spit_publishing_concrete_publishing_host_real_post_error (SpitPublishingPluginHost* base,
                                                          GError* err)
{
	SpitPublishingConcretePublishingHost * self;
	gchar* msg = NULL;
	SpitPublishingPublisher* _tmp0_;
	SpitPublishingService* _tmp1_;
	SpitPublishingService* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	PublishingUIPublishingDialog* _tmp13_;
	const gchar* _tmp14_;
	PublishingUIStaticMessagePane* _tmp15_;
	PublishingUIStaticMessagePane* _tmp16_;
	PublishingUIPublishingDialog* _tmp17_;
	PublishingUIPublishingDialog* _tmp18_;
	SpitPublishingPublisher* _tmp19_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	g_return_if_fail (err != NULL);
	_tmp0_ = self->priv->active_publisher;
	_tmp1_ = spit_publishing_publisher_get_service (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = spit_pluggable_get_pluggable_name (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, SPIT_TYPE_PLUGGABLE, SpitPluggable));
	_tmp4_ = g_strdup_printf (_ ("Publishing to %s can’t continue because an error occurred:"), _tmp3_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp2_);
	msg = _tmp5_;
	_tmp6_ = msg;
	_tmp7_ = err->message;
	_tmp8_ = g_markup_printf_escaped ("\n\n<i>%s</i>\n\n", _tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = g_strconcat (_tmp6_, _tmp9_, NULL);
	_g_free0 (msg);
	msg = _tmp10_;
	_g_free0 (_tmp9_);
	_tmp11_ = msg;
	_tmp12_ = g_strconcat (_tmp11_, _ ("To try publishing to another service, select one from the above menu."), NULL);
	_g_free0 (msg);
	msg = _tmp12_;
	_tmp13_ = self->priv->dialog;
	_tmp14_ = msg;
	_tmp15_ = publishing_ui_static_message_pane_new (_tmp14_, TRUE, FALSE);
	g_object_ref_sink (_tmp15_);
	_tmp16_ = _tmp15_;
	publishing_ui_publishing_dialog_install_pane (_tmp13_, G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, SPIT_PUBLISHING_TYPE_DIALOG_PANE, SpitPublishingDialogPane));
	_g_object_unref0 (_tmp16_);
	_tmp17_ = self->priv->dialog;
	publishing_ui_publishing_dialog_set_close_button_mode (_tmp17_);
	_tmp18_ = self->priv->dialog;
	publishing_ui_publishing_dialog_unlock_service (_tmp18_);
	_tmp19_ = self->priv->active_publisher;
	spit_publishing_publisher_stop (_tmp19_);
	spit_publishing_concrete_publishing_host_clean_up (self);
	_g_free0 (msg);
}

static void
spit_publishing_concrete_publishing_host_real_stop_publishing (SpitPublishingPluginHost* base)
{
	SpitPublishingConcretePublishingHost * self;
	SpitPublishingPublisher* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	g_debug ("PublishingPluginHost.vala:111: ConcretePublishingHost.stop_publishing(" \
" ): invoked.");
	_tmp0_ = self->priv->active_publisher;
	if (spit_publishing_publisher_is_running (_tmp0_)) {
		SpitPublishingPublisher* _tmp1_;
		_tmp1_ = self->priv->active_publisher;
		spit_publishing_publisher_stop (_tmp1_);
	}
	spit_publishing_concrete_publishing_host_clean_up (self);
	self->priv->publishing_halted = TRUE;
}

void
spit_publishing_concrete_publishing_host_start_publishing (SpitPublishingConcretePublishingHost* self)
{
	SpitPublishingPublisher* _tmp0_;
	SpitPublishingPublisher* _tmp1_;
	g_return_if_fail (SPIT_PUBLISHING_IS_CONCRETE_PUBLISHING_HOST (self));
	_tmp0_ = self->priv->active_publisher;
	if (spit_publishing_publisher_is_running (_tmp0_)) {
		return;
	}
	g_debug ("PublishingPluginHost.vala:125: ConcretePublishingHost.start_publishing" \
"( ): invoked.");
	_tmp1_ = self->priv->active_publisher;
	spit_publishing_publisher_start (_tmp1_);
}

static SpitPublishingPublisher*
spit_publishing_concrete_publishing_host_real_get_publisher (SpitPublishingPluginHost* base)
{
	SpitPublishingConcretePublishingHost * self;
	SpitPublishingPublisher* _tmp0_;
	SpitPublishingPublisher* _tmp1_;
	SpitPublishingPublisher* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	_tmp0_ = self->priv->active_publisher;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
spit_publishing_concrete_publishing_host_real_install_static_message_pane (SpitPublishingPluginHost* base,
                                                                           const gchar* message,
                                                                           SpitPublishingPluginHostButtonMode button_mode)
{
	SpitPublishingConcretePublishingHost * self;
	PublishingUIPublishingDialog* _tmp0_;
	PublishingUIStaticMessagePane* _tmp1_;
	PublishingUIStaticMessagePane* _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	g_return_if_fail (message != NULL);
	spit_publishing_concrete_publishing_host_set_button_mode (self, button_mode);
	_tmp0_ = self->priv->dialog;
	_tmp1_ = publishing_ui_static_message_pane_new (message, FALSE, FALSE);
	g_object_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	publishing_ui_publishing_dialog_install_pane (_tmp0_, G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, SPIT_PUBLISHING_TYPE_DIALOG_PANE, SpitPublishingDialogPane));
	_g_object_unref0 (_tmp2_);
}

static void
spit_publishing_concrete_publishing_host_real_install_pango_message_pane (SpitPublishingPluginHost* base,
                                                                          const gchar* markup,
                                                                          SpitPublishingPluginHostButtonMode button_mode)
{
	SpitPublishingConcretePublishingHost * self;
	PublishingUIPublishingDialog* _tmp0_;
	PublishingUIStaticMessagePane* _tmp1_;
	PublishingUIStaticMessagePane* _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	g_return_if_fail (markup != NULL);
	spit_publishing_concrete_publishing_host_set_button_mode (self, button_mode);
	_tmp0_ = self->priv->dialog;
	_tmp1_ = publishing_ui_static_message_pane_new (markup, TRUE, FALSE);
	g_object_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	publishing_ui_publishing_dialog_install_pane (_tmp0_, G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, SPIT_PUBLISHING_TYPE_DIALOG_PANE, SpitPublishingDialogPane));
	_g_object_unref0 (_tmp2_);
}

static void
spit_publishing_concrete_publishing_host_real_install_success_pane (SpitPublishingPluginHost* base)
{
	SpitPublishingConcretePublishingHost * self;
	PublishingUIPublishingDialog* _tmp0_;
	SpitPublishingPublishable** _tmp1_;
	gint _tmp1__length1;
	PublishingUISuccessPane* _tmp2_;
	PublishingUISuccessPane* _tmp3_;
	PublishingUIPublishingDialog* _tmp4_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	_tmp0_ = self->priv->dialog;
	_tmp1_ = self->priv->publishables;
	_tmp1__length1 = self->priv->publishables_length1;
	_tmp2_ = publishing_ui_success_pane_new (spit_publishing_plugin_host_get_publishable_media_type (G_TYPE_CHECK_INSTANCE_CAST (self, SPIT_PUBLISHING_TYPE_PLUGIN_HOST, SpitPublishingPluginHost)), _tmp1__length1);
	g_object_ref_sink (_tmp2_);
	_tmp3_ = _tmp2_;
	publishing_ui_publishing_dialog_install_pane (_tmp0_, G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, SPIT_PUBLISHING_TYPE_DIALOG_PANE, SpitPublishingDialogPane));
	_g_object_unref0 (_tmp3_);
	_tmp4_ = self->priv->dialog;
	publishing_ui_publishing_dialog_set_close_button_mode (_tmp4_);
	spit_publishing_concrete_publishing_host_clean_up (self);
}

static void
spit_publishing_concrete_publishing_host_real_install_account_fetch_wait_pane (SpitPublishingPluginHost* base)
{
	SpitPublishingConcretePublishingHost * self;
	PublishingUIPublishingDialog* _tmp0_;
	PublishingUIAccountFetchWaitPane* _tmp1_;
	PublishingUIAccountFetchWaitPane* _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	_tmp0_ = self->priv->dialog;
	_tmp1_ = publishing_ui_account_fetch_wait_pane_new ();
	g_object_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	publishing_ui_publishing_dialog_install_pane (_tmp0_, G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, SPIT_PUBLISHING_TYPE_DIALOG_PANE, SpitPublishingDialogPane));
	_g_object_unref0 (_tmp2_);
	spit_publishing_concrete_publishing_host_set_button_mode (self, SPIT_PUBLISHING_PLUGIN_HOST_BUTTON_MODE_CANCEL);
}

static void
spit_publishing_concrete_publishing_host_real_install_login_wait_pane (SpitPublishingPluginHost* base)
{
	SpitPublishingConcretePublishingHost * self;
	PublishingUIPublishingDialog* _tmp0_;
	PublishingUILoginWaitPane* _tmp1_;
	PublishingUILoginWaitPane* _tmp2_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	_tmp0_ = self->priv->dialog;
	_tmp1_ = publishing_ui_login_wait_pane_new ();
	g_object_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	publishing_ui_publishing_dialog_install_pane (_tmp0_, G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, SPIT_PUBLISHING_TYPE_DIALOG_PANE, SpitPublishingDialogPane));
	_g_object_unref0 (_tmp2_);
}

static void
_spit_publishing_concrete_publishing_host_on_login_clicked_publishing_ui_login_welcome_pane_login_requested (PublishingUILoginWelcomePane* _sender,
                                                                                                             gpointer self)
{
	spit_publishing_concrete_publishing_host_on_login_clicked ((SpitPublishingConcretePublishingHost*) self);
}

static void
spit_publishing_concrete_publishing_host_real_install_welcome_pane (SpitPublishingPluginHost* base,
                                                                    const gchar* welcome_message,
                                                                    SpitPublishingLoginCallback login_clicked_callback,
                                                                    gpointer login_clicked_callback_target)
{
	SpitPublishingConcretePublishingHost * self;
	PublishingUILoginWelcomePane* login_pane = NULL;
	PublishingUILoginWelcomePane* _tmp0_;
	PublishingUIPublishingDialog* _tmp1_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	g_return_if_fail (welcome_message != NULL);
	_tmp0_ = publishing_ui_login_welcome_pane_new (welcome_message);
	g_object_ref_sink (_tmp0_);
	login_pane = _tmp0_;
	self->priv->current_login_callback = login_clicked_callback;
	self->priv->current_login_callback_target = login_clicked_callback_target;
	g_signal_connect_object (login_pane, "login-requested", (GCallback) _spit_publishing_concrete_publishing_host_on_login_clicked_publishing_ui_login_welcome_pane_login_requested, self, 0);
	spit_publishing_concrete_publishing_host_set_button_mode (self, SPIT_PUBLISHING_PLUGIN_HOST_BUTTON_MODE_CLOSE);
	_tmp1_ = self->priv->dialog;
	publishing_ui_publishing_dialog_install_pane (_tmp1_, G_TYPE_CHECK_INSTANCE_CAST (login_pane, SPIT_PUBLISHING_TYPE_DIALOG_PANE, SpitPublishingDialogPane));
	_g_object_unref0 (login_pane);
}

static void
spit_publishing_concrete_publishing_host_real_set_service_locked (SpitPublishingPluginHost* base,
                                                                  gboolean locked)
{
	SpitPublishingConcretePublishingHost * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	if (locked) {
		PublishingUIPublishingDialog* _tmp0_;
		_tmp0_ = self->priv->dialog;
		publishing_ui_publishing_dialog_lock_service (_tmp0_);
	} else {
		PublishingUIPublishingDialog* _tmp1_;
		_tmp1_ = self->priv->dialog;
		publishing_ui_publishing_dialog_unlock_service (_tmp1_);
	}
}

void
spit_publishing_concrete_publishing_host_set_button_mode (SpitPublishingConcretePublishingHost* self,
                                                          SpitPublishingPluginHostButtonMode mode)
{
	g_return_if_fail (SPIT_PUBLISHING_IS_CONCRETE_PUBLISHING_HOST (self));
	if (mode == SPIT_PUBLISHING_PLUGIN_HOST_BUTTON_MODE_CLOSE) {
		PublishingUIPublishingDialog* _tmp0_;
		_tmp0_ = self->priv->dialog;
		publishing_ui_publishing_dialog_set_close_button_mode (_tmp0_);
	} else {
		if (mode == SPIT_PUBLISHING_PLUGIN_HOST_BUTTON_MODE_CANCEL) {
			PublishingUIPublishingDialog* _tmp1_;
			_tmp1_ = self->priv->dialog;
			publishing_ui_publishing_dialog_set_cancel_button_mode (_tmp1_);
		} else {
			g_error ("PublishingPluginHost.vala:192: unrecognized button mode enumeration va" \
"lue");
		}
	}
}

static void
spit_publishing_concrete_publishing_host_real_set_dialog_default_widget (SpitPublishingPluginHost* base,
                                                                         GtkWidget* widget)
{
	SpitPublishingConcretePublishingHost * self;
	PublishingUIPublishingDialog* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (widget, gtk_widget_get_type ()));
	gtk_widget_set_can_default (widget, TRUE);
	_tmp0_ = self->priv->dialog;
	gtk_window_set_default (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gtk_window_get_type (), GtkWindow), widget);
}

static SpitPublishingPublisherMediaType
spit_publishing_concrete_publishing_host_real_get_publishable_media_type (SpitPublishingPluginHost* base)
{
	SpitPublishingConcretePublishingHost * self;
	SpitPublishingPublisherMediaType result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	result = self->priv->media_type;
	return result;
}

static SpitPublishingPublishable**
_vala_array_dup28 (SpitPublishingPublishable** self,
                   gssize length)
{
	if (length >= 0) {
		SpitPublishingPublishable** result;
		gssize i;
		result = g_new0 (SpitPublishingPublishable*, length + 1);
		for (i = 0; i < length; i++) {
			SpitPublishingPublishable* _tmp0_;
			_tmp0_ = _g_object_ref0 (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

static SpitPublishingPublishable**
spit_publishing_concrete_publishing_host_real_get_publishables (SpitPublishingPluginHost* base,
                                                                gint* result_length1)
{
	SpitPublishingConcretePublishingHost * self;
	SpitPublishingPublishable** _tmp0_;
	gint _tmp0__length1;
	SpitPublishingPublishable** _tmp1_;
	gint _tmp1__length1;
	SpitPublishingPublishable** _tmp2_;
	gint _tmp2__length1;
	SpitPublishingPublishable** result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	_tmp0_ = self->priv->publishables;
	_tmp0__length1 = self->priv->publishables_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup28 (_tmp0_, _tmp0__length1) : _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

static void
_spit_publishing_concrete_publishing_host_report_plugin_upload_progress_spit_publishing_progress_callback (gint file_number,
                                                                                                           gdouble fraction_complete,
                                                                                                           gpointer self)
{
	spit_publishing_concrete_publishing_host_report_plugin_upload_progress ((SpitPublishingConcretePublishingHost*) self, file_number, fraction_complete);
}

static SpitPublishingProgressCallback
spit_publishing_concrete_publishing_host_real_serialize_publishables (SpitPublishingPluginHost* base,
                                                                      gint content_major_axis,
                                                                      gboolean strip_metadata,
                                                                      gpointer* result_target,
                                                                      GDestroyNotify* result_target_destroy_notify)
{
	SpitPublishingConcretePublishingHost * self;
	PublishingUIProgressPane* progress_pane = NULL;
	PublishingUIPublishingDialog* _tmp0_;
	SpitPublishingDialogPane* _tmp1_;
	gint i = 0;
	SpitPublishingPublishable** _tmp2_;
	gint _tmp2__length1;
	SpitPublishingProgressCallback _tmp17_;
	gpointer _tmp17__target;
	GDestroyNotify _tmp17__target_destroy_notify;
	GError* _inner_error0_ = NULL;
	SpitPublishingProgressCallback result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	spit_publishing_concrete_publishing_host_install_progress_pane (self);
	_tmp0_ = self->priv->dialog;
	_tmp1_ = publishing_ui_publishing_dialog_get_active_pane (_tmp0_);
	progress_pane = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, PUBLISHING_UI_TYPE_PROGRESS_PANE, PublishingUIProgressPane);
	spin_event_loop ();
	i = 0;
	_tmp2_ = self->priv->publishables;
	_tmp2__length1 = self->priv->publishables_length1;
	{
		SpitPublishingPublishable** publishable_collection = NULL;
		gint publishable_collection_length1 = 0;
		gint _publishable_collection_size_ = 0;
		gint publishable_it = 0;
		publishable_collection = _tmp2_;
		publishable_collection_length1 = _tmp2__length1;
		for (publishable_it = 0; publishable_it < publishable_collection_length1; publishable_it = publishable_it + 1) {
			SpitPublishingPublishable* _tmp3_;
			SpitPublishingPublishable* publishable = NULL;
			_tmp3_ = _g_object_ref0 (publishable_collection[publishable_it]);
			publishable = _tmp3_;
			{
				gboolean _tmp4_ = FALSE;
				gdouble phase_fraction_complete = 0.0;
				SpitPublishingPublishable** _tmp14_;
				gint _tmp14__length1;
				gdouble fraction_complete = 0.0;
				PublishingUIProgressPane* _tmp15_;
				gint _tmp16_;
				if (self->priv->publishing_halted) {
					_tmp4_ = TRUE;
				} else {
					SpitPublishingPublisher* _tmp5_;
					_tmp5_ = self->priv->active_publisher;
					_tmp4_ = !spit_publishing_publisher_is_running (_tmp5_);
				}
				if (_tmp4_) {
					SpitPublishingProgressCallback _tmp6_;
					gpointer _tmp6__target;
					GDestroyNotify _tmp6__target_destroy_notify;
					_tmp6_ = NULL;
					_tmp6__target = NULL;
					_tmp6__target_destroy_notify = NULL;
					*result_target = _tmp6__target;
					*result_target_destroy_notify = _tmp6__target_destroy_notify;
					result = _tmp6_;
					_g_object_unref0 (publishable);
					_g_object_unref0 (progress_pane);
					return result;
				}
				{
					PublishingGlueMediaSourcePublishableWrapper* wrapper = NULL;
					SpitPublishingPublishable* _tmp7_;
					PublishingGlueMediaSourcePublishableWrapper* _tmp8_;
					PublishingGlueMediaSourcePublishableWrapper* _tmp9_;
					GFile* _tmp10_;
					GFile* _tmp11_;
					_tmp7_ = publishable;
					_tmp8_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, PUBLISHING_GLUE_TYPE_MEDIA_SOURCE_PUBLISHABLE_WRAPPER, PublishingGlueMediaSourcePublishableWrapper));
					wrapper = _tmp8_;
					_tmp9_ = wrapper;
					_tmp10_ = publishing_glue_media_source_publishable_wrapper_serialize_for_publishing (_tmp9_, content_major_axis, strip_metadata, &_inner_error0_);
					_tmp11_ = _tmp10_;
					_g_object_unref0 (_tmp11_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						_g_object_unref0 (wrapper);
						if (_inner_error0_->domain == SPIT_PUBLISHING_PUBLISHING_ERROR) {
							goto __catch0_spit_publishing_publishing_error;
						}
						_g_object_unref0 (publishable);
						_g_object_unref0 (progress_pane);
						g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
						g_clear_error (&_inner_error0_);
						return NULL;
					}
					_g_object_unref0 (wrapper);
				}
				goto __finally0;
				__catch0_spit_publishing_publishing_error:
				{
					GError* err = NULL;
					GError* _tmp12_;
					SpitPublishingProgressCallback _tmp13_;
					gpointer _tmp13__target;
					GDestroyNotify _tmp13__target_destroy_notify;
					err = _inner_error0_;
					_inner_error0_ = NULL;
					_tmp12_ = err;
					spit_publishing_plugin_host_post_error (G_TYPE_CHECK_INSTANCE_CAST (self, SPIT_PUBLISHING_TYPE_PLUGIN_HOST, SpitPublishingPluginHost), _tmp12_);
					_tmp13_ = NULL;
					_tmp13__target = NULL;
					_tmp13__target_destroy_notify = NULL;
					*result_target = _tmp13__target;
					*result_target_destroy_notify = _tmp13__target_destroy_notify;
					result = _tmp13_;
					_g_error_free0 (err);
					_g_object_unref0 (publishable);
					_g_object_unref0 (progress_pane);
					return result;
				}
				__finally0:
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					_g_object_unref0 (publishable);
					_g_object_unref0 (progress_pane);
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
					g_clear_error (&_inner_error0_);
					return NULL;
				}
				_tmp14_ = self->priv->publishables;
				_tmp14__length1 = self->priv->publishables_length1;
				phase_fraction_complete = ((gdouble) (i + 1)) / ((gdouble) _tmp14__length1);
				fraction_complete = phase_fraction_complete * SPIT_PUBLISHING_CONCRETE_PUBLISHING_HOST_STATUS_PREPARATION_FRACTION;
				g_debug ("PublishingPluginHost.vala:236: serialize_publishables( ): fraction_com" \
"plete = %f.", fraction_complete);
				_tmp15_ = progress_pane;
				publishing_ui_progress_pane_set_status (_tmp15_, SPIT_PUBLISHING_CONCRETE_PUBLISHING_HOST_PREPARE_STATUS_DESCRIPTION, fraction_complete);
				spin_event_loop ();
				_tmp16_ = i;
				i = _tmp16_ + 1;
				_g_object_unref0 (publishable);
			}
		}
	}
	_tmp17_ = _spit_publishing_concrete_publishing_host_report_plugin_upload_progress_spit_publishing_progress_callback;
	_tmp17__target = g_object_ref (self);
	_tmp17__target_destroy_notify = g_object_unref;
	*result_target = _tmp17__target;
	*result_target_destroy_notify = _tmp17__target_destroy_notify;
	result = _tmp17_;
	_g_object_unref0 (progress_pane);
	return result;
}

static void
spit_publishing_concrete_publishing_host_class_init (SpitPublishingConcretePublishingHostClass * klass,
                                                     gpointer klass_data)
{
	spit_publishing_concrete_publishing_host_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SpitPublishingConcretePublishingHost_private_offset);
	G_OBJECT_CLASS (klass)->finalize = spit_publishing_concrete_publishing_host_finalize;
}

static void
spit_publishing_concrete_publishing_host_spit_publishing_plugin_host_interface_init (SpitPublishingPluginHostIface * iface,
                                                                                     gpointer iface_data)
{
	spit_publishing_concrete_publishing_host_spit_publishing_plugin_host_parent_iface = g_type_interface_peek_parent (iface);
	iface->register_auth_callback = (void (*) (SpitPublishingPluginHost*, const gchar*, SpitPublishingAuthenticatedCallback*)) spit_publishing_concrete_publishing_host_real_register_auth_callback;
	iface->unregister_auth_callback = (void (*) (SpitPublishingPluginHost*, const gchar*)) spit_publishing_concrete_publishing_host_real_unregister_auth_callback;
	iface->get_current_profile_id = (gchar* (*) (SpitPublishingPluginHost*)) spit_publishing_concrete_publishing_host_real_get_current_profile_id;
	iface->install_dialog_pane = (void (*) (SpitPublishingPluginHost*, SpitPublishingDialogPane*, SpitPublishingPluginHostButtonMode)) spit_publishing_concrete_publishing_host_real_install_dialog_pane;
	iface->post_error = (void (*) (SpitPublishingPluginHost*, GError*)) spit_publishing_concrete_publishing_host_real_post_error;
	iface->stop_publishing = (void (*) (SpitPublishingPluginHost*)) spit_publishing_concrete_publishing_host_real_stop_publishing;
	iface->get_publisher = (SpitPublishingPublisher* (*) (SpitPublishingPluginHost*)) spit_publishing_concrete_publishing_host_real_get_publisher;
	iface->install_static_message_pane = (void (*) (SpitPublishingPluginHost*, const gchar*, SpitPublishingPluginHostButtonMode)) spit_publishing_concrete_publishing_host_real_install_static_message_pane;
	iface->install_pango_message_pane = (void (*) (SpitPublishingPluginHost*, const gchar*, SpitPublishingPluginHostButtonMode)) spit_publishing_concrete_publishing_host_real_install_pango_message_pane;
	iface->install_success_pane = (void (*) (SpitPublishingPluginHost*)) spit_publishing_concrete_publishing_host_real_install_success_pane;
	iface->install_account_fetch_wait_pane = (void (*) (SpitPublishingPluginHost*)) spit_publishing_concrete_publishing_host_real_install_account_fetch_wait_pane;
	iface->install_login_wait_pane = (void (*) (SpitPublishingPluginHost*)) spit_publishing_concrete_publishing_host_real_install_login_wait_pane;
	iface->install_welcome_pane = (void (*) (SpitPublishingPluginHost*, const gchar*, SpitPublishingLoginCallback, gpointer)) spit_publishing_concrete_publishing_host_real_install_welcome_pane;
	iface->set_service_locked = (void (*) (SpitPublishingPluginHost*, gboolean)) spit_publishing_concrete_publishing_host_real_set_service_locked;
	iface->set_dialog_default_widget = (void (*) (SpitPublishingPluginHost*, GtkWidget*)) spit_publishing_concrete_publishing_host_real_set_dialog_default_widget;
	iface->get_publishable_media_type = (SpitPublishingPublisherMediaType (*) (SpitPublishingPluginHost*)) spit_publishing_concrete_publishing_host_real_get_publishable_media_type;
	iface->get_publishables = (SpitPublishingPublishable** (*) (SpitPublishingPluginHost*, gint*)) spit_publishing_concrete_publishing_host_real_get_publishables;
	iface->serialize_publishables = (SpitPublishingProgressCallback (*) (SpitPublishingPluginHost*, gint, gboolean, gpointer*, GDestroyNotify*)) spit_publishing_concrete_publishing_host_real_serialize_publishables;
}

static void
spit_publishing_concrete_publishing_host_instance_init (SpitPublishingConcretePublishingHost * self,
                                                        gpointer klass)
{
	self->priv = spit_publishing_concrete_publishing_host_get_instance_private (self);
	self->priv->dialog = NULL;
	self->priv->active_publisher = NULL;
	self->priv->publishables = NULL;
	self->priv->publishables_length1 = 0;
	self->priv->_publishables_size_ = self->priv->publishables_length1;
	self->priv->current_login_callback = NULL;
	self->priv->current_login_callback_target = NULL;
	self->priv->publishing_halted = FALSE;
	self->priv->media_type = SPIT_PUBLISHING_PUBLISHER_MEDIA_TYPE_NONE;
}

static void
spit_publishing_concrete_publishing_host_finalize (GObject * obj)
{
	SpitPublishingConcretePublishingHost * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SPIT_PUBLISHING_TYPE_CONCRETE_PUBLISHING_HOST, SpitPublishingConcretePublishingHost);
	_g_object_unref0 (self->priv->active_publisher);
	self->priv->publishables = (_vala_array_free (self->priv->publishables, self->priv->publishables_length1, (GDestroyNotify) g_object_unref), NULL);
	G_OBJECT_CLASS (spit_publishing_concrete_publishing_host_parent_class)->finalize (obj);
}

static GType
spit_publishing_concrete_publishing_host_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SpitPublishingConcretePublishingHostClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) spit_publishing_concrete_publishing_host_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SpitPublishingConcretePublishingHost), 0, (GInstanceInitFunc) spit_publishing_concrete_publishing_host_instance_init, NULL };
	static const GInterfaceInfo spit_publishing_plugin_host_info = { (GInterfaceInitFunc) spit_publishing_concrete_publishing_host_spit_publishing_plugin_host_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType spit_publishing_concrete_publishing_host_type_id;
	spit_publishing_concrete_publishing_host_type_id = g_type_register_static (PLUGINS_TYPE_STANDARD_HOST_INTERFACE, "SpitPublishingConcretePublishingHost", &g_define_type_info, 0);
	g_type_add_interface_static (spit_publishing_concrete_publishing_host_type_id, SPIT_PUBLISHING_TYPE_PLUGIN_HOST, &spit_publishing_plugin_host_info);
	SpitPublishingConcretePublishingHost_private_offset = g_type_add_instance_private (spit_publishing_concrete_publishing_host_type_id, sizeof (SpitPublishingConcretePublishingHostPrivate));
	return spit_publishing_concrete_publishing_host_type_id;
}

GType
spit_publishing_concrete_publishing_host_get_type (void)
{
	static volatile gsize spit_publishing_concrete_publishing_host_type_id__once = 0;
	if (g_once_init_enter (&spit_publishing_concrete_publishing_host_type_id__once)) {
		GType spit_publishing_concrete_publishing_host_type_id;
		spit_publishing_concrete_publishing_host_type_id = spit_publishing_concrete_publishing_host_get_type_once ();
		g_once_init_leave (&spit_publishing_concrete_publishing_host_type_id__once, spit_publishing_concrete_publishing_host_type_id);
	}
	return spit_publishing_concrete_publishing_host_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

