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

/* Copyright 2012 BJA Electronics
 * Author: Jeroen Arnoldus (b.j.arnoldus@bja-electronics.nl)
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */

#include "shotwell-publishing.h"
#include <glib-object.h>
#include <glib.h>
#include "shotwell-plugin-dev-1.0.h"
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <gobject/gvaluecollector.h>
#include "shotwell-plugin-common.h"
#include "shotwell-authenticator.h"
#include <gio/gio.h>
#include <json-glib/json-glib.h>
#include <gee.h>
#include <float.h>
#include <math.h>
#include <gtk/gtk.h>
#include <glib/gstdio.h>
#include <libsoup/soup.h>

#define PUBLISHING_TUMBLR_SERVICE_NAME "Tumblr"
#define PUBLISHING_TUMBLR_ENDPOINT_URL "https://www.tumblr.com/"
#define PUBLISHING_TUMBLR_ENCODE_RFC_3986_EXTRA "!*'();:@&=+$,/?%#[] \\"
#define PUBLISHING_TUMBLR_ORIGINAL_SIZE -1
#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

enum  {
	TUMBLR_SERVICE_0_PROPERTY,
	TUMBLR_SERVICE_NUM_PROPERTIES
};
static GParamSpec* tumblr_service_properties[TUMBLR_SERVICE_NUM_PROPERTIES];

#define PUBLISHING_TUMBLR_TYPE_BLOG_ENTRY (publishing_tumblr_blog_entry_get_type ())
#define PUBLISHING_TUMBLR_BLOG_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PUBLISHING_TUMBLR_TYPE_BLOG_ENTRY, PublishingTumblrBlogEntry))
#define PUBLISHING_TUMBLR_BLOG_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PUBLISHING_TUMBLR_TYPE_BLOG_ENTRY, PublishingTumblrBlogEntryClass))
#define PUBLISHING_TUMBLR_IS_BLOG_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PUBLISHING_TUMBLR_TYPE_BLOG_ENTRY))
#define PUBLISHING_TUMBLR_IS_BLOG_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PUBLISHING_TUMBLR_TYPE_BLOG_ENTRY))
#define PUBLISHING_TUMBLR_BLOG_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PUBLISHING_TUMBLR_TYPE_BLOG_ENTRY, PublishingTumblrBlogEntryClass))

typedef struct _PublishingTumblrBlogEntry PublishingTumblrBlogEntry;
typedef struct _PublishingTumblrBlogEntryClass PublishingTumblrBlogEntryClass;
typedef struct _PublishingTumblrBlogEntryPrivate PublishingTumblrBlogEntryPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _PublishingTumblrParamSpecBlogEntry PublishingTumblrParamSpecBlogEntry;

#define PUBLISHING_TUMBLR_TYPE_SIZE_ENTRY (publishing_tumblr_size_entry_get_type ())
#define PUBLISHING_TUMBLR_SIZE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PUBLISHING_TUMBLR_TYPE_SIZE_ENTRY, PublishingTumblrSizeEntry))
#define PUBLISHING_TUMBLR_SIZE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PUBLISHING_TUMBLR_TYPE_SIZE_ENTRY, PublishingTumblrSizeEntryClass))
#define PUBLISHING_TUMBLR_IS_SIZE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PUBLISHING_TUMBLR_TYPE_SIZE_ENTRY))
#define PUBLISHING_TUMBLR_IS_SIZE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PUBLISHING_TUMBLR_TYPE_SIZE_ENTRY))
#define PUBLISHING_TUMBLR_SIZE_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PUBLISHING_TUMBLR_TYPE_SIZE_ENTRY, PublishingTumblrSizeEntryClass))

typedef struct _PublishingTumblrSizeEntry PublishingTumblrSizeEntry;
typedef struct _PublishingTumblrSizeEntryClass PublishingTumblrSizeEntryClass;
typedef struct _PublishingTumblrSizeEntryPrivate PublishingTumblrSizeEntryPrivate;
typedef struct _PublishingTumblrParamSpecSizeEntry PublishingTumblrParamSpecSizeEntry;

#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE (publishing_tumblr_tumblr_publisher_publishing_options_pane_get_type ())
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_PUBLISHING_OPTIONS_PANE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE, PublishingTumblrTumblrPublisherPublishingOptionsPane))
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_PUBLISHING_OPTIONS_PANE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE, PublishingTumblrTumblrPublisherPublishingOptionsPaneClass))
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_IS_PUBLISHING_OPTIONS_PANE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE))
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_IS_PUBLISHING_OPTIONS_PANE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE))
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_PUBLISHING_OPTIONS_PANE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE, PublishingTumblrTumblrPublisherPublishingOptionsPaneClass))

typedef struct _PublishingTumblrTumblrPublisherPublishingOptionsPane PublishingTumblrTumblrPublisherPublishingOptionsPane;
typedef struct _PublishingTumblrTumblrPublisherPublishingOptionsPaneClass PublishingTumblrTumblrPublisherPublishingOptionsPaneClass;
enum  {
	PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_0_PROPERTY,
	PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_NUM_PROPERTIES
};
static GParamSpec* publishing_tumblr_tumblr_publisher_properties[PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _publishing_rest_support_session_unref0(var) ((var == NULL) ? NULL : (var = (publishing_rest_support_session_unref (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))

#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_USER_INFO_FETCH_TRANSACTION (publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_get_type ())
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_USER_INFO_FETCH_TRANSACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_USER_INFO_FETCH_TRANSACTION, PublishingTumblrTumblrPublisherUserInfoFetchTransaction))
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_USER_INFO_FETCH_TRANSACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_USER_INFO_FETCH_TRANSACTION, PublishingTumblrTumblrPublisherUserInfoFetchTransactionClass))
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_IS_USER_INFO_FETCH_TRANSACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_USER_INFO_FETCH_TRANSACTION))
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_IS_USER_INFO_FETCH_TRANSACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_USER_INFO_FETCH_TRANSACTION))
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_USER_INFO_FETCH_TRANSACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_USER_INFO_FETCH_TRANSACTION, PublishingTumblrTumblrPublisherUserInfoFetchTransactionClass))

typedef struct _PublishingTumblrTumblrPublisherUserInfoFetchTransaction PublishingTumblrTumblrPublisherUserInfoFetchTransaction;
typedef struct _PublishingTumblrTumblrPublisherUserInfoFetchTransactionClass PublishingTumblrTumblrPublisherUserInfoFetchTransactionClass;
#define _publishing_rest_support_transaction_unref0(var) ((var == NULL) ? NULL : (var = (publishing_rest_support_transaction_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _PublishingTumblrTumblrPublisherDoGetBlogsData PublishingTumblrTumblrPublisherDoGetBlogsData;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))

#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_UPLOADER (publishing_tumblr_tumblr_publisher_uploader_get_type ())
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_UPLOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_UPLOADER, PublishingTumblrTumblrPublisherUploader))
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_UPLOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_UPLOADER, PublishingTumblrTumblrPublisherUploaderClass))
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_IS_UPLOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_UPLOADER))
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_IS_UPLOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_UPLOADER))
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_UPLOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_UPLOADER, PublishingTumblrTumblrPublisherUploaderClass))

typedef struct _PublishingTumblrTumblrPublisherUploader PublishingTumblrTumblrPublisherUploader;
typedef struct _PublishingTumblrTumblrPublisherUploaderClass PublishingTumblrTumblrPublisherUploaderClass;
#define _publishing_rest_support_batch_uploader_unref0(var) ((var == NULL) ? NULL : (var = (publishing_rest_support_batch_uploader_unref (var), NULL)))
typedef struct _PublishingTumblrTumblrPublisherPublishingOptionsPanePrivate PublishingTumblrTumblrPublisherPublishingOptionsPanePrivate;
enum  {
	PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_PUBLISHING_OPTIONS_PANE_0_PROPERTY,
	PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_PUBLISHING_OPTIONS_PANE_NUM_PROPERTIES
};
static GParamSpec* publishing_tumblr_tumblr_publisher_publishing_options_pane_properties[PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_PUBLISHING_OPTIONS_PANE_NUM_PROPERTIES];
#define _publishing_tumblr_blog_entry_unref0(var) ((var == NULL) ? NULL : (var = (publishing_tumblr_blog_entry_unref (var), NULL)))
#define _publishing_tumblr_size_entry_unref0(var) ((var == NULL) ? NULL : (var = (publishing_tumblr_size_entry_unref (var), NULL)))
enum  {
	PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_PUBLISHING_OPTIONS_PANE_PUBLISH_SIGNAL,
	PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_PUBLISHING_OPTIONS_PANE_LOGOUT_SIGNAL,
	PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_PUBLISHING_OPTIONS_PANE_NUM_SIGNALS
};
static guint publishing_tumblr_tumblr_publisher_publishing_options_pane_signals[PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_PUBLISHING_OPTIONS_PANE_NUM_SIGNALS] = {0};
typedef struct _PublishingTumblrTumblrPublisherUserInfoFetchTransactionPrivate PublishingTumblrTumblrPublisherUserInfoFetchTransactionPrivate;

#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_UPLOAD_TRANSACTION (publishing_tumblr_tumblr_publisher_upload_transaction_get_type ())
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_UPLOAD_TRANSACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_UPLOAD_TRANSACTION, PublishingTumblrTumblrPublisherUploadTransaction))
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_UPLOAD_TRANSACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_UPLOAD_TRANSACTION, PublishingTumblrTumblrPublisherUploadTransactionClass))
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_IS_UPLOAD_TRANSACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_UPLOAD_TRANSACTION))
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_IS_UPLOAD_TRANSACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_UPLOAD_TRANSACTION))
#define PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_UPLOAD_TRANSACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_UPLOAD_TRANSACTION, PublishingTumblrTumblrPublisherUploadTransactionClass))

typedef struct _PublishingTumblrTumblrPublisherUploadTransaction PublishingTumblrTumblrPublisherUploadTransaction;
typedef struct _PublishingTumblrTumblrPublisherUploadTransactionClass PublishingTumblrTumblrPublisherUploadTransactionClass;
typedef struct _PublishingTumblrTumblrPublisherUploadTransactionPrivate PublishingTumblrTumblrPublisherUploadTransactionPrivate;
#define _publishing_rest_support_argument_unref0(var) ((var == NULL) ? NULL : (var = (publishing_rest_support_argument_unref (var), NULL)))
#define _g_bytes_unref0(var) ((var == NULL) ? NULL : (var = (g_bytes_unref (var), NULL)))
typedef struct _PublishingTumblrTumblrPublisherUploadTransactionExecuteAsyncData PublishingTumblrTumblrPublisherUploadTransactionExecuteAsyncData;
typedef struct _PublishingTumblrTumblrPublisherUploaderPrivate PublishingTumblrTumblrPublisherUploaderPrivate;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _PublishingTumblrBlogEntry {
	GTypeInstance parent_instance;
	volatile int ref_count;
	PublishingTumblrBlogEntryPrivate * priv;
	gchar* blog;
	gchar* url;
};

struct _PublishingTumblrBlogEntryClass {
	GTypeClass parent_class;
	void (*finalize) (PublishingTumblrBlogEntry *self);
};

struct _PublishingTumblrParamSpecBlogEntry {
	GParamSpec parent_instance;
};

struct _PublishingTumblrSizeEntry {
	GTypeInstance parent_instance;
	volatile int ref_count;
	PublishingTumblrSizeEntryPrivate * priv;
	gchar* title;
	gint size;
};

struct _PublishingTumblrSizeEntryClass {
	GTypeClass parent_class;
	void (*finalize) (PublishingTumblrSizeEntry *self);
};

struct _PublishingTumblrParamSpecSizeEntry {
	GParamSpec parent_instance;
};

struct _PublishingTumblrTumblrPublisherPrivate {
	SpitPublishingService* service;
	SpitPublishingPluginHost* host;
	SpitPublishingProgressCallback progress_reporter;
	gpointer progress_reporter_target;
	GDestroyNotify progress_reporter_target_destroy_notify;
	gboolean running;
	gboolean was_started;
	PublishingRESTSupportOAuth1Session* session;
	PublishingTumblrTumblrPublisherPublishingOptionsPane* publishing_options_pane;
	PublishingTumblrSizeEntry** sizes;
	gint sizes_length1;
	gint _sizes_size_;
	PublishingTumblrBlogEntry** blogs;
	gint blogs_length1;
	gint _blogs_size_;
	gchar* username;
	SpitPublishingAuthenticator* authenticator;
};

struct _PublishingTumblrTumblrPublisherDoGetBlogsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PublishingTumblrTumblrPublisher* self;
	PublishingTumblrTumblrPublisherUserInfoFetchTransaction* txn;
	PublishingRESTSupportOAuth1Session* _tmp0_;
	PublishingTumblrTumblrPublisherUserInfoFetchTransaction* _tmp1_;
	PublishingTumblrTumblrPublisherUserInfoFetchTransaction* _tmp2_;
	PublishingTumblrTumblrPublisherUserInfoFetchTransaction* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	PublishingTumblrTumblrPublisherUserInfoFetchTransaction* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	GError* err;
	PublishingRESTSupportOAuth1Session* _tmp9_;
	SpitPublishingPluginHost* _tmp10_;
	GError* _tmp11_;
	GError* _inner_error0_;
};

struct _PublishingTumblrTumblrPublisherPublishingOptionsPane {
	GObject parent_instance;
	PublishingTumblrTumblrPublisherPublishingOptionsPanePrivate * priv;
};

struct _PublishingTumblrTumblrPublisherPublishingOptionsPaneClass {
	GObjectClass parent_class;
};

struct _PublishingTumblrTumblrPublisherPublishingOptionsPanePrivate {
	GtkBuilder* builder;
	GtkBox* pane_widget;
	GtkLabel* upload_info_label;
	GtkLabel* size_label;
	GtkLabel* blog_label;
	GtkButton* logout_button;
	GtkButton* publish_button;
	GtkComboBoxText* size_combo;
	GtkComboBoxText* blog_combo;
	PublishingTumblrSizeEntry** sizes;
	gint sizes_length1;
	gint _sizes_size_;
	PublishingTumblrBlogEntry** blogs;
	gint blogs_length1;
	gint _blogs_size_;
	gchar* username;
	PublishingTumblrTumblrPublisher* publisher;
	SpitPublishingPublisherMediaType media_type;
};

struct _PublishingTumblrTumblrPublisherUserInfoFetchTransaction {
	PublishingRESTSupportOAuth1Transaction parent_instance;
	PublishingTumblrTumblrPublisherUserInfoFetchTransactionPrivate * priv;
};

struct _PublishingTumblrTumblrPublisherUserInfoFetchTransactionClass {
	PublishingRESTSupportOAuth1TransactionClass parent_class;
};

struct _PublishingTumblrTumblrPublisherUploadTransaction {
	PublishingRESTSupportOAuth1UploadTransaction parent_instance;
	PublishingTumblrTumblrPublisherUploadTransactionPrivate * priv;
};

struct _PublishingTumblrTumblrPublisherUploadTransactionClass {
	PublishingRESTSupportOAuth1UploadTransactionClass parent_class;
};

struct _PublishingTumblrTumblrPublisherUploadTransactionExecuteAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PublishingTumblrTumblrPublisherUploadTransaction* self;
	gchar* payload;
	gsize payload_length;
	SpitPublishingPublishable* _tmp0_;
	GFile* _tmp1_;
	GFile* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gsize _tmp6_;
	const gchar* _tmp7_;
	guint8* _tmp8_;
	gint _tmp8__length1;
	gint _tmp9_;
	guint8* _tmp10_;
	gint _tmp10__length1;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar** keywords;
	SpitPublishingPublishable* _tmp13_;
	gint _tmp14_;
	gchar** _tmp15_;
	gint keywords_length1;
	gint _keywords_size_;
	gchar* tags;
	gchar* _tmp16_;
	gchar** _tmp17_;
	gint _tmp17__length1;
	gchar** _tmp18_;
	gint _tmp18__length1;
	gchar* _tmp19_;
	const gchar* _tmp20_;
	GError* _tmp21_;
	GHashTable* form;
	GHashFunc _tmp22_;
	GEqualFunc _tmp23_;
	GHashTable* _tmp24_;
	gint _tmp25_;
	PublishingRESTSupportArgument** _tmp26_;
	PublishingRESTSupportArgument** arg_collection;
	gint arg_collection_length1;
	gint _arg_collection_size_;
	gint arg_it;
	PublishingRESTSupportArgument* _tmp27_;
	PublishingRESTSupportArgument* arg;
	GHashTable* _tmp28_;
	PublishingRESTSupportArgument* _tmp29_;
	const gchar* _tmp30_;
	gchar* _tmp31_;
	PublishingRESTSupportArgument* _tmp32_;
	const gchar* _tmp33_;
	gchar* _tmp34_;
	GHashTable* _tmp35_;
	SoupMessage* outbound_message;
	gchar* _tmp36_;
	gchar* _tmp37_;
	SoupMessage* _tmp38_;
	SoupMessage* _tmp39_;
	GBytes* body;
	GHashTable* _tmp40_;
	gchar* _tmp41_;
	gchar* _tmp42_;
	guint8* _tmp43_;
	gint _tmp43__length1;
	gint _tmp44_;
	guint8* _tmp45_;
	gint _tmp45__length1;
	GBytes* _tmp46_;
	GBytes* _tmp47_;
	SoupMessage* _tmp48_;
	GBytes* _tmp49_;
	GeeMapIterator* i;
	GeeHashMap* _tmp50_;
	GeeMapIterator* _tmp51_;
	gboolean cont;
	GeeMapIterator* _tmp52_;
	SoupMessage* _tmp53_;
	SoupMessageHeaders* _tmp54_;
	SoupMessageHeaders* _tmp55_;
	GeeMapIterator* _tmp56_;
	gpointer _tmp57_;
	gchar* _tmp58_;
	GeeMapIterator* _tmp59_;
	gpointer _tmp60_;
	gchar* _tmp61_;
	GeeMapIterator* _tmp62_;
	SoupMessage* _tmp63_;
	GBytes* _tmp64_;
	gint _tmp65_;
	gint _tmp66_;
	GError* _inner_error0_;
};

struct _PublishingTumblrTumblrPublisherUploader {
	PublishingRESTSupportBatchUploader parent_instance;
	PublishingTumblrTumblrPublisherUploaderPrivate * priv;
};

struct _PublishingTumblrTumblrPublisherUploaderClass {
	PublishingRESTSupportBatchUploaderClass parent_class;
};

struct _PublishingTumblrTumblrPublisherUploaderPrivate {
	gchar* blog_url;
};

static gpointer tumblr_service_parent_class = NULL;
static SpitPluggableIface * tumblr_service_spit_pluggable_parent_iface = NULL;
static SpitPublishingServiceIface * tumblr_service_spit_publishing_service_parent_iface = NULL;
static gpointer publishing_tumblr_blog_entry_parent_class = NULL;
static gpointer publishing_tumblr_size_entry_parent_class = NULL;
static gint PublishingTumblrTumblrPublisher_private_offset;
static gpointer publishing_tumblr_tumblr_publisher_parent_class = NULL;
static gint PublishingTumblrTumblrPublisherPublishingOptionsPane_private_offset;
static gpointer publishing_tumblr_tumblr_publisher_publishing_options_pane_parent_class = NULL;
static SpitPublishingDialogPaneIface * publishing_tumblr_tumblr_publisher_publishing_options_pane_spit_publishing_dialog_pane_parent_iface = NULL;
static gpointer publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_parent_class = NULL;
static gpointer publishing_tumblr_tumblr_publisher_upload_transaction_parent_class = NULL;
static gint PublishingTumblrTumblrPublisherUploader_private_offset;
static gpointer publishing_tumblr_tumblr_publisher_uploader_parent_class = NULL;
static SpitPublishingPublisherIface * publishing_tumblr_tumblr_publisher_spit_publishing_publisher_parent_iface = NULL;

static gint tumblr_service_real_get_pluggable_interface (SpitPluggable* base,
                                                  gint min_host_interface,
                                                  gint max_host_interface);
static const gchar* tumblr_service_real_get_id (SpitPluggable* base);
static const gchar* tumblr_service_real_get_pluggable_name (SpitPluggable* base);
static SpitPluggableInfo* tumblr_service_real_get_info (SpitPluggable* base);
static void tumblr_service_real_activation (SpitPluggable* base,
                                     gboolean enabled);
static SpitPublishingPublisher* tumblr_service_real_create_publisher (SpitPublishingService* base,
                                                               SpitPublishingPluginHost* host);
static SpitPublishingPublisherMediaType tumblr_service_real_get_supported_media (SpitPublishingService* base);
static GType tumblr_service_get_type_once (void);
VALA_EXTERN gpointer publishing_tumblr_blog_entry_ref (gpointer instance);
VALA_EXTERN void publishing_tumblr_blog_entry_unref (gpointer instance);
VALA_EXTERN GParamSpec* publishing_tumblr_param_spec_blog_entry (const gchar* name,
                                                     const gchar* nick,
                                                     const gchar* blurb,
                                                     GType object_type,
                                                     GParamFlags flags);
VALA_EXTERN void publishing_tumblr_value_set_blog_entry (GValue* value,
                                             gpointer v_object);
VALA_EXTERN void publishing_tumblr_value_take_blog_entry (GValue* value,
                                              gpointer v_object);
VALA_EXTERN gpointer publishing_tumblr_value_get_blog_entry (const GValue* value);
VALA_EXTERN GType publishing_tumblr_blog_entry_get_type (void) G_GNUC_CONST ;
VALA_EXTERN PublishingTumblrBlogEntry* publishing_tumblr_blog_entry_new (const gchar* creator_blog,
                                                             const gchar* creator_url);
VALA_EXTERN PublishingTumblrBlogEntry* publishing_tumblr_blog_entry_construct (GType object_type,
                                                                   const gchar* creator_blog,
                                                                   const gchar* creator_url);
static void publishing_tumblr_blog_entry_finalize (PublishingTumblrBlogEntry * obj);
static GType publishing_tumblr_blog_entry_get_type_once (void);
VALA_EXTERN gpointer publishing_tumblr_size_entry_ref (gpointer instance);
VALA_EXTERN void publishing_tumblr_size_entry_unref (gpointer instance);
VALA_EXTERN GParamSpec* publishing_tumblr_param_spec_size_entry (const gchar* name,
                                                     const gchar* nick,
                                                     const gchar* blurb,
                                                     GType object_type,
                                                     GParamFlags flags);
VALA_EXTERN void publishing_tumblr_value_set_size_entry (GValue* value,
                                             gpointer v_object);
VALA_EXTERN void publishing_tumblr_value_take_size_entry (GValue* value,
                                              gpointer v_object);
VALA_EXTERN gpointer publishing_tumblr_value_get_size_entry (const GValue* value);
VALA_EXTERN GType publishing_tumblr_size_entry_get_type (void) G_GNUC_CONST ;
VALA_EXTERN PublishingTumblrSizeEntry* publishing_tumblr_size_entry_new (const gchar* creator_title,
                                                             gint creator_size);
VALA_EXTERN PublishingTumblrSizeEntry* publishing_tumblr_size_entry_construct (GType object_type,
                                                                   const gchar* creator_title,
                                                                   gint creator_size);
static void publishing_tumblr_size_entry_finalize (PublishingTumblrSizeEntry * obj);
static GType publishing_tumblr_size_entry_get_type_once (void);
VALA_EXTERN GType publishing_tumblr_tumblr_publisher_publishing_options_pane_get_type (void) G_GNUC_CONST ;
static void publishing_tumblr_tumblr_publisher_on_authenticator_authenticated (PublishingTumblrTumblrPublisher* self);
static void _publishing_tumblr_tumblr_publisher_on_authenticator_authenticated_spit_publishing_authenticator_authenticated (SpitPublishingAuthenticator* _sender,
                                                                                                                     gpointer self);
static PublishingTumblrSizeEntry** publishing_tumblr_tumblr_publisher_create_sizes (PublishingTumblrTumblrPublisher* self,
                                                                             gint* result_length1);
static void _vala_array_add17 (PublishingTumblrSizeEntry** * array,
                        gint* length,
                        gint* size,
                        PublishingTumblrSizeEntry* value);
static void _vala_array_add18 (PublishingTumblrSizeEntry** * array,
                        gint* length,
                        gint* size,
                        PublishingTumblrSizeEntry* value);
static void _vala_array_add19 (PublishingTumblrSizeEntry** * array,
                        gint* length,
                        gint* size,
                        PublishingTumblrSizeEntry* value);
static PublishingTumblrBlogEntry** publishing_tumblr_tumblr_publisher_create_blogs (PublishingTumblrTumblrPublisher* self,
                                                                             gint* result_length1);
static SpitPublishingService* publishing_tumblr_tumblr_publisher_real_get_service (SpitPublishingPublisher* base);
static gboolean publishing_tumblr_tumblr_publisher_real_is_running (SpitPublishingPublisher* base);
VALA_EXTERN gint publishing_tumblr_tumblr_publisher_get_persistent_default_size (PublishingTumblrTumblrPublisher* self);
VALA_EXTERN void publishing_tumblr_tumblr_publisher_set_persistent_default_size (PublishingTumblrTumblrPublisher* self,
                                                                     gint size);
VALA_EXTERN gint publishing_tumblr_tumblr_publisher_get_persistent_default_blog (PublishingTumblrTumblrPublisher* self);
VALA_EXTERN void publishing_tumblr_tumblr_publisher_set_persistent_default_blog (PublishingTumblrTumblrPublisher* self,
                                                                     gint blog);
static void publishing_tumblr_tumblr_publisher_do_get_blogs (PublishingTumblrTumblrPublisher* self,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_);
static void publishing_tumblr_tumblr_publisher_do_get_blogs_finish (PublishingTumblrTumblrPublisher* self,
                                                             GAsyncResult* _res_);
static void publishing_tumblr_tumblr_publisher_do_get_blogs_data_free (gpointer _data);
static gboolean publishing_tumblr_tumblr_publisher_do_get_blogs_co (PublishingTumblrTumblrPublisherDoGetBlogsData* _data_);
VALA_EXTERN GType publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_get_type (void) G_GNUC_CONST ;
VALA_EXTERN PublishingTumblrTumblrPublisherUserInfoFetchTransaction* publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_new (PublishingRESTSupportOAuth1Session* session);
VALA_EXTERN PublishingTumblrTumblrPublisherUserInfoFetchTransaction* publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_construct (GType object_type,
                                                                                                                                   PublishingRESTSupportOAuth1Session* session);
static void publishing_tumblr_tumblr_publisher_do_get_blogs_ready (GObject* source_object,
                                                            GAsyncResult* _res_,
                                                            gpointer _user_data_);
static void publishing_tumblr_tumblr_publisher_do_parse_token_info_from_user_request (PublishingTumblrTumblrPublisher* self,
                                                                               const gchar* response,
                                                                               GError** error);
static void publishing_tumblr_tumblr_publisher_do_show_publishing_options_pane (PublishingTumblrTumblrPublisher* self);
static void _vala_array_add20 (PublishingTumblrBlogEntry** * array,
                        gint* length,
                        gint* size,
                        PublishingTumblrBlogEntry* value);
VALA_EXTERN PublishingTumblrTumblrPublisherPublishingOptionsPane* publishing_tumblr_tumblr_publisher_publishing_options_pane_new (PublishingTumblrTumblrPublisher* publisher,
                                                                                                                      SpitPublishingPublisherMediaType media_type,
                                                                                                                      PublishingTumblrSizeEntry** sizes,
                                                                                                                      gint sizes_length1,
                                                                                                                      PublishingTumblrBlogEntry** blogs,
                                                                                                                      gint blogs_length1,
                                                                                                                      const gchar* username);
VALA_EXTERN PublishingTumblrTumblrPublisherPublishingOptionsPane* publishing_tumblr_tumblr_publisher_publishing_options_pane_construct (GType object_type,
                                                                                                                            PublishingTumblrTumblrPublisher* publisher,
                                                                                                                            SpitPublishingPublisherMediaType media_type,
                                                                                                                            PublishingTumblrSizeEntry** sizes,
                                                                                                                            gint sizes_length1,
                                                                                                                            PublishingTumblrBlogEntry** blogs,
                                                                                                                            gint blogs_length1,
                                                                                                                            const gchar* username);
static void publishing_tumblr_tumblr_publisher_on_publishing_options_pane_publish (PublishingTumblrTumblrPublisher* self);
static void _publishing_tumblr_tumblr_publisher_on_publishing_options_pane_publish_publishing_tumblr_tumblr_publisher_publishing_options_pane_publish (PublishingTumblrTumblrPublisherPublishingOptionsPane* _sender,
                                                                                                                                                gpointer self);
static void publishing_tumblr_tumblr_publisher_on_publishing_options_pane_logout (PublishingTumblrTumblrPublisher* self);
static void _publishing_tumblr_tumblr_publisher_on_publishing_options_pane_logout_publishing_tumblr_tumblr_publisher_publishing_options_pane_logout (PublishingTumblrTumblrPublisherPublishingOptionsPane* _sender,
                                                                                                                                              gpointer self);
static void publishing_tumblr_tumblr_publisher_do_publish (PublishingTumblrTumblrPublisher* self);
static void publishing_tumblr_tumblr_publisher_do_logout (PublishingTumblrTumblrPublisher* self);
static gint _publishing_tumblr_tumblr_publisher_tumblr_date_time_compare_func_gcompare_data_func (gconstpointer a,
                                                                                           gconstpointer b,
                                                                                           gpointer self);
VALA_EXTERN GType publishing_tumblr_tumblr_publisher_uploader_get_type (void) G_GNUC_CONST ;
VALA_EXTERN PublishingTumblrTumblrPublisherUploader* publishing_tumblr_tumblr_publisher_uploader_new (PublishingRESTSupportOAuth1Session* session,
                                                                                          SpitPublishingPublishable** publishables,
                                                                                          gint publishables_length1,
                                                                                          const gchar* blog_url);
VALA_EXTERN PublishingTumblrTumblrPublisherUploader* publishing_tumblr_tumblr_publisher_uploader_construct (GType object_type,
                                                                                                PublishingRESTSupportOAuth1Session* session,
                                                                                                SpitPublishingPublishable** publishables,
                                                                                                gint publishables_length1,
                                                                                                const gchar* blog_url);
static void publishing_tumblr_tumblr_publisher_on_upload_complete (PublishingTumblrTumblrPublisher* self,
                                                            PublishingRESTSupportBatchUploader* uploader,
                                                            gint num_published);
static void _publishing_tumblr_tumblr_publisher_on_upload_complete_publishing_rest_support_batch_uploader_upload_complete (PublishingRESTSupportBatchUploader* _sender,
                                                                                                                    gint num_photos_published,
                                                                                                                    gpointer self);
static void publishing_tumblr_tumblr_publisher_on_upload_error (PublishingTumblrTumblrPublisher* self,
                                                         PublishingRESTSupportBatchUploader* uploader,
                                                         GError* err);
static void _publishing_tumblr_tumblr_publisher_on_upload_error_publishing_rest_support_batch_uploader_upload_error (PublishingRESTSupportBatchUploader* _sender,
                                                                                                              GError* err,
                                                                                                              gpointer self);
static void publishing_tumblr_tumblr_publisher_on_upload_status_updated (PublishingTumblrTumblrPublisher* self,
                                                                  gint file_number,
                                                                  gdouble completed_fraction);
static void _publishing_tumblr_tumblr_publisher_on_upload_status_updated_spit_publishing_progress_callback (gint file_number,
                                                                                                     gdouble fraction_complete,
                                                                                                     gpointer self);
static void publishing_tumblr_tumblr_publisher_do_show_success_pane (PublishingTumblrTumblrPublisher* self);
static void publishing_tumblr_tumblr_publisher_real_start (SpitPublishingPublisher* base);
static void publishing_tumblr_tumblr_publisher_real_stop (SpitPublishingPublisher* base);
static PublishingTumblrSizeEntry** _vala_array_dup1 (PublishingTumblrSizeEntry** self,
                                              gssize length);
static PublishingTumblrBlogEntry** _vala_array_dup2 (PublishingTumblrBlogEntry** self,
                                              gssize length);
static void publishing_tumblr_tumblr_publisher_publishing_options_pane_populate_blog_combo (PublishingTumblrTumblrPublisherPublishingOptionsPane* self);
static void publishing_tumblr_tumblr_publisher_publishing_options_pane_on_blog_changed (PublishingTumblrTumblrPublisherPublishingOptionsPane* self);
static void _publishing_tumblr_tumblr_publisher_publishing_options_pane_on_blog_changed_gtk_combo_box_changed (GtkComboBox* _sender,
                                                                                                        gpointer self);
static void publishing_tumblr_tumblr_publisher_publishing_options_pane_populate_size_combo (PublishingTumblrTumblrPublisherPublishingOptionsPane* self);
static void publishing_tumblr_tumblr_publisher_publishing_options_pane_on_size_changed (PublishingTumblrTumblrPublisherPublishingOptionsPane* self);
static void _publishing_tumblr_tumblr_publisher_publishing_options_pane_on_size_changed_gtk_combo_box_changed (GtkComboBox* _sender,
                                                                                                        gpointer self);
static void publishing_tumblr_tumblr_publisher_publishing_options_pane_on_logout_clicked (PublishingTumblrTumblrPublisherPublishingOptionsPane* self);
static void _publishing_tumblr_tumblr_publisher_publishing_options_pane_on_logout_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                                       gpointer self);
static void publishing_tumblr_tumblr_publisher_publishing_options_pane_on_publish_clicked (PublishingTumblrTumblrPublisherPublishingOptionsPane* self);
static void _publishing_tumblr_tumblr_publisher_publishing_options_pane_on_publish_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                                        gpointer self);
VALA_EXTERN void publishing_tumblr_tumblr_publisher_publishing_options_pane_notify_publish (PublishingTumblrTumblrPublisherPublishingOptionsPane* self);
VALA_EXTERN void publishing_tumblr_tumblr_publisher_publishing_options_pane_notify_logout (PublishingTumblrTumblrPublisherPublishingOptionsPane* self);
static GtkWidget* publishing_tumblr_tumblr_publisher_publishing_options_pane_real_get_widget (SpitPublishingDialogPane* base);
static SpitPublishingDialogPaneGeometryOptions publishing_tumblr_tumblr_publisher_publishing_options_pane_real_get_preferred_geometry (SpitPublishingDialogPane* base);
static void publishing_tumblr_tumblr_publisher_publishing_options_pane_real_on_pane_installed (SpitPublishingDialogPane* base);
static void _publishing_tumblr_tumblr_publisher_publishing_options_pane_notify_publish_publishing_tumblr_tumblr_publisher_publishing_options_pane_publish (PublishingTumblrTumblrPublisherPublishingOptionsPane* _sender,
                                                                                                                                                    gpointer self);
static void _publishing_tumblr_tumblr_publisher_publishing_options_pane_notify_logout_publishing_tumblr_tumblr_publisher_publishing_options_pane_logout (PublishingTumblrTumblrPublisherPublishingOptionsPane* _sender,
                                                                                                                                                  gpointer self);
static void publishing_tumblr_tumblr_publisher_publishing_options_pane_real_on_pane_uninstalled (SpitPublishingDialogPane* base);
static void publishing_tumblr_tumblr_publisher_publishing_options_pane_finalize (GObject * obj);
static GType publishing_tumblr_tumblr_publisher_publishing_options_pane_get_type_once (void);
static GType publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_get_type_once (void);
VALA_EXTERN GType publishing_tumblr_tumblr_publisher_upload_transaction_get_type (void) G_GNUC_CONST ;
VALA_EXTERN PublishingTumblrTumblrPublisherUploadTransaction* publishing_tumblr_tumblr_publisher_upload_transaction_new (PublishingRESTSupportOAuth1Session* session,
                                                                                                             SpitPublishingPublishable* publishable,
                                                                                                             const gchar* blog_url);
VALA_EXTERN PublishingTumblrTumblrPublisherUploadTransaction* publishing_tumblr_tumblr_publisher_upload_transaction_construct (GType object_type,
                                                                                                                   PublishingRESTSupportOAuth1Session* session,
                                                                                                                   SpitPublishingPublishable* publishable,
                                                                                                                   const gchar* blog_url);
static void publishing_tumblr_tumblr_publisher_upload_transaction_real_execute_async_data_free (gpointer _data);
static void publishing_tumblr_tumblr_publisher_upload_transaction_real_execute_async (PublishingRESTSupportTransaction* base,
                                                                               GAsyncReadyCallback _callback_,
                                                                               gpointer _user_data_);
static gboolean publishing_tumblr_tumblr_publisher_upload_transaction_real_execute_async_co (PublishingTumblrTumblrPublisherUploadTransactionExecuteAsyncData* _data_);
static void _g_free0_ (gpointer var);
static void publishing_tumblr_tumblr_publisher_upload_transaction_execute_async_ready (GObject* source_object,
                                                                                GAsyncResult* _res_,
                                                                                gpointer _user_data_);
static GType publishing_tumblr_tumblr_publisher_upload_transaction_get_type_once (void);
static PublishingRESTSupportTransaction* publishing_tumblr_tumblr_publisher_uploader_real_create_transaction (PublishingRESTSupportBatchUploader* base,
                                                                                                       SpitPublishingPublishable* publishable);
static void publishing_tumblr_tumblr_publisher_uploader_finalize (PublishingRESTSupportBatchUploader * obj);
static GType publishing_tumblr_tumblr_publisher_uploader_get_type_once (void);
static void publishing_tumblr_tumblr_publisher_finalize (GObject * obj);
static GType publishing_tumblr_tumblr_publisher_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);

TumblrService*
tumblr_service_construct (GType object_type)
{
	TumblrService * self = NULL;
	self = (TumblrService*) g_object_new (object_type, NULL);
	return self;
}

TumblrService*
tumblr_service_new (void)
{
	return tumblr_service_construct (TYPE_TUMBLR_SERVICE);
}

static gint
tumblr_service_real_get_pluggable_interface (SpitPluggable* base,
                                             gint min_host_interface,
                                             gint max_host_interface)
{
	TumblrService * self;
	gint result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_TUMBLR_SERVICE, TumblrService);
	result = spit_negotiate_interfaces (min_host_interface, max_host_interface, SPIT_PUBLISHING_CURRENT_INTERFACE);
	return result;
}

static const gchar*
tumblr_service_real_get_id (SpitPluggable* base)
{
	TumblrService * self;
	const gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_TUMBLR_SERVICE, TumblrService);
	result = "org.gnome.shotwell.publishing.tumblr";
	return result;
}

static const gchar*
tumblr_service_real_get_pluggable_name (SpitPluggable* base)
{
	TumblrService * self;
	const gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_TUMBLR_SERVICE, TumblrService);
	result = "Tumblr";
	return result;
}

static SpitPluggableInfo*
tumblr_service_real_get_info (SpitPluggable* base)
{
	TumblrService * self;
	SpitPluggableInfo* info = NULL;
	SpitPluggableInfo* _tmp0_;
	SpitPluggableInfo* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_TUMBLR_SERVICE, TumblrService);
	_tmp0_ = spit_pluggable_info_new ();
	info = _tmp0_;
	spit_pluggable_info_set_authors (info, "Jeroen Arnoldus");
	spit_pluggable_info_set_copyright (info, _ ("Copyright 2012 BJA Electronics"));
	spit_pluggable_info_set_icon_name (info, "tumblr");
	result = info;
	return result;
}

static void
tumblr_service_real_activation (SpitPluggable* base,
                                gboolean enabled)
{
	TumblrService * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_TUMBLR_SERVICE, TumblrService);
}

static SpitPublishingPublisher*
tumblr_service_real_create_publisher (SpitPublishingService* base,
                                      SpitPublishingPluginHost* host)
{
	TumblrService * self;
	PublishingTumblrTumblrPublisher* _tmp0_;
	SpitPublishingPublisher* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_TUMBLR_SERVICE, TumblrService);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (host, SPIT_PUBLISHING_TYPE_PLUGIN_HOST), NULL);
	_tmp0_ = publishing_tumblr_tumblr_publisher_new (G_TYPE_CHECK_INSTANCE_CAST (self, SPIT_PUBLISHING_TYPE_SERVICE, SpitPublishingService), host);
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, SPIT_PUBLISHING_TYPE_PUBLISHER, SpitPublishingPublisher);
	return result;
}

static SpitPublishingPublisherMediaType
tumblr_service_real_get_supported_media (SpitPublishingService* base)
{
	TumblrService * self;
	SpitPublishingPublisherMediaType result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_TUMBLR_SERVICE, TumblrService);
	result = SPIT_PUBLISHING_PUBLISHER_MEDIA_TYPE_PHOTO | SPIT_PUBLISHING_PUBLISHER_MEDIA_TYPE_VIDEO;
	return result;
}

static void
tumblr_service_class_init (TumblrServiceClass * klass,
                           gpointer klass_data)
{
	tumblr_service_parent_class = g_type_class_peek_parent (klass);
}

static void
tumblr_service_spit_pluggable_interface_init (SpitPluggableIface * iface,
                                              gpointer iface_data)
{
	tumblr_service_spit_pluggable_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_pluggable_interface = (gint (*) (SpitPluggable*, gint, gint)) tumblr_service_real_get_pluggable_interface;
	iface->get_id = (const gchar* (*) (SpitPluggable*)) tumblr_service_real_get_id;
	iface->get_pluggable_name = (const gchar* (*) (SpitPluggable*)) tumblr_service_real_get_pluggable_name;
	iface->get_info = (SpitPluggableInfo* (*) (SpitPluggable*)) tumblr_service_real_get_info;
	iface->activation = (void (*) (SpitPluggable*, gboolean)) tumblr_service_real_activation;
}

static void
tumblr_service_spit_publishing_service_interface_init (SpitPublishingServiceIface * iface,
                                                       gpointer iface_data)
{
	tumblr_service_spit_publishing_service_parent_iface = g_type_interface_peek_parent (iface);
	iface->create_publisher = (SpitPublishingPublisher* (*) (SpitPublishingService*, SpitPublishingPluginHost*)) tumblr_service_real_create_publisher;
	iface->get_supported_media = (SpitPublishingPublisherMediaType (*) (SpitPublishingService*)) tumblr_service_real_get_supported_media;
}

static void
tumblr_service_instance_init (TumblrService * self,
                              gpointer klass)
{
}

static GType
tumblr_service_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TumblrServiceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tumblr_service_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TumblrService), 0, (GInstanceInitFunc) tumblr_service_instance_init, NULL };
	static const GInterfaceInfo spit_pluggable_info = { (GInterfaceInitFunc) tumblr_service_spit_pluggable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo spit_publishing_service_info = { (GInterfaceInitFunc) tumblr_service_spit_publishing_service_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType tumblr_service_type_id;
	tumblr_service_type_id = g_type_register_static (G_TYPE_OBJECT, "TumblrService", &g_define_type_info, 0);
	g_type_add_interface_static (tumblr_service_type_id, SPIT_TYPE_PLUGGABLE, &spit_pluggable_info);
	g_type_add_interface_static (tumblr_service_type_id, SPIT_PUBLISHING_TYPE_SERVICE, &spit_publishing_service_info);
	return tumblr_service_type_id;
}

GType
tumblr_service_get_type (void)
{
	static volatile gsize tumblr_service_type_id__once = 0;
	if (g_once_init_enter (&tumblr_service_type_id__once)) {
		GType tumblr_service_type_id;
		tumblr_service_type_id = tumblr_service_get_type_once ();
		g_once_init_leave (&tumblr_service_type_id__once, tumblr_service_type_id);
	}
	return tumblr_service_type_id__once;
}

PublishingTumblrBlogEntry*
publishing_tumblr_blog_entry_construct (GType object_type,
                                        const gchar* creator_blog,
                                        const gchar* creator_url)
{
	PublishingTumblrBlogEntry* self = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (creator_blog != NULL, NULL);
	g_return_val_if_fail (creator_url != NULL, NULL);
	self = (PublishingTumblrBlogEntry*) g_type_create_instance (object_type);
	_tmp0_ = g_strdup (creator_blog);
	_g_free0 (self->blog);
	self->blog = _tmp0_;
	_tmp1_ = g_strdup (creator_url);
	_g_free0 (self->url);
	self->url = _tmp1_;
	return self;
}

PublishingTumblrBlogEntry*
publishing_tumblr_blog_entry_new (const gchar* creator_blog,
                                  const gchar* creator_url)
{
	return publishing_tumblr_blog_entry_construct (PUBLISHING_TUMBLR_TYPE_BLOG_ENTRY, creator_blog, creator_url);
}

static void
publishing_tumblr_value_blog_entry_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
publishing_tumblr_value_blog_entry_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		publishing_tumblr_blog_entry_unref (value->data[0].v_pointer);
	}
}

static void
publishing_tumblr_value_blog_entry_copy_value (const GValue* src_value,
                                               GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = publishing_tumblr_blog_entry_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
publishing_tumblr_value_blog_entry_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
publishing_tumblr_value_blog_entry_collect_value (GValue* value,
                                                  guint n_collect_values,
                                                  GTypeCValue* collect_values,
                                                  guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		PublishingTumblrBlogEntry * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = publishing_tumblr_blog_entry_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
publishing_tumblr_value_blog_entry_lcopy_value (const GValue* value,
                                                guint n_collect_values,
                                                GTypeCValue* collect_values,
                                                guint collect_flags)
{
	PublishingTumblrBlogEntry ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = publishing_tumblr_blog_entry_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
publishing_tumblr_param_spec_blog_entry (const gchar* name,
                                         const gchar* nick,
                                         const gchar* blurb,
                                         GType object_type,
                                         GParamFlags flags)
{
	PublishingTumblrParamSpecBlogEntry* spec;
	g_return_val_if_fail (g_type_is_a (object_type, PUBLISHING_TUMBLR_TYPE_BLOG_ENTRY), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
publishing_tumblr_value_get_blog_entry (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PUBLISHING_TUMBLR_TYPE_BLOG_ENTRY), NULL);
	return value->data[0].v_pointer;
}

void
publishing_tumblr_value_set_blog_entry (GValue* value,
                                        gpointer v_object)
{
	PublishingTumblrBlogEntry * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PUBLISHING_TUMBLR_TYPE_BLOG_ENTRY));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PUBLISHING_TUMBLR_TYPE_BLOG_ENTRY));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		publishing_tumblr_blog_entry_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		publishing_tumblr_blog_entry_unref (old);
	}
}

void
publishing_tumblr_value_take_blog_entry (GValue* value,
                                         gpointer v_object)
{
	PublishingTumblrBlogEntry * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PUBLISHING_TUMBLR_TYPE_BLOG_ENTRY));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PUBLISHING_TUMBLR_TYPE_BLOG_ENTRY));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		publishing_tumblr_blog_entry_unref (old);
	}
}

static void
publishing_tumblr_blog_entry_class_init (PublishingTumblrBlogEntryClass * klass,
                                         gpointer klass_data)
{
	publishing_tumblr_blog_entry_parent_class = g_type_class_peek_parent (klass);
	((PublishingTumblrBlogEntryClass *) klass)->finalize = publishing_tumblr_blog_entry_finalize;
}

static void
publishing_tumblr_blog_entry_instance_init (PublishingTumblrBlogEntry * self,
                                            gpointer klass)
{
	self->ref_count = 1;
}

static void
publishing_tumblr_blog_entry_finalize (PublishingTumblrBlogEntry * obj)
{
	PublishingTumblrBlogEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PUBLISHING_TUMBLR_TYPE_BLOG_ENTRY, PublishingTumblrBlogEntry);
	g_signal_handlers_destroy (self);
	_g_free0 (self->blog);
	_g_free0 (self->url);
}

static GType
publishing_tumblr_blog_entry_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { publishing_tumblr_value_blog_entry_init, publishing_tumblr_value_blog_entry_free_value, publishing_tumblr_value_blog_entry_copy_value, publishing_tumblr_value_blog_entry_peek_pointer, "p", publishing_tumblr_value_blog_entry_collect_value, "p", publishing_tumblr_value_blog_entry_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (PublishingTumblrBlogEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) publishing_tumblr_blog_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PublishingTumblrBlogEntry), 0, (GInstanceInitFunc) publishing_tumblr_blog_entry_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType publishing_tumblr_blog_entry_type_id;
	publishing_tumblr_blog_entry_type_id = g_type_register_fundamental (g_type_fundamental_next (), "PublishingTumblrBlogEntry", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return publishing_tumblr_blog_entry_type_id;
}

GType
publishing_tumblr_blog_entry_get_type (void)
{
	static volatile gsize publishing_tumblr_blog_entry_type_id__once = 0;
	if (g_once_init_enter (&publishing_tumblr_blog_entry_type_id__once)) {
		GType publishing_tumblr_blog_entry_type_id;
		publishing_tumblr_blog_entry_type_id = publishing_tumblr_blog_entry_get_type_once ();
		g_once_init_leave (&publishing_tumblr_blog_entry_type_id__once, publishing_tumblr_blog_entry_type_id);
	}
	return publishing_tumblr_blog_entry_type_id__once;
}

gpointer
publishing_tumblr_blog_entry_ref (gpointer instance)
{
	PublishingTumblrBlogEntry * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
publishing_tumblr_blog_entry_unref (gpointer instance)
{
	PublishingTumblrBlogEntry * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		PUBLISHING_TUMBLR_BLOG_ENTRY_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

PublishingTumblrSizeEntry*
publishing_tumblr_size_entry_construct (GType object_type,
                                        const gchar* creator_title,
                                        gint creator_size)
{
	PublishingTumblrSizeEntry* self = NULL;
	gchar* _tmp0_;
	g_return_val_if_fail (creator_title != NULL, NULL);
	self = (PublishingTumblrSizeEntry*) g_type_create_instance (object_type);
	_tmp0_ = g_strdup (creator_title);
	_g_free0 (self->title);
	self->title = _tmp0_;
	self->size = creator_size;
	return self;
}

PublishingTumblrSizeEntry*
publishing_tumblr_size_entry_new (const gchar* creator_title,
                                  gint creator_size)
{
	return publishing_tumblr_size_entry_construct (PUBLISHING_TUMBLR_TYPE_SIZE_ENTRY, creator_title, creator_size);
}

static void
publishing_tumblr_value_size_entry_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
publishing_tumblr_value_size_entry_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		publishing_tumblr_size_entry_unref (value->data[0].v_pointer);
	}
}

static void
publishing_tumblr_value_size_entry_copy_value (const GValue* src_value,
                                               GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = publishing_tumblr_size_entry_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
publishing_tumblr_value_size_entry_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
publishing_tumblr_value_size_entry_collect_value (GValue* value,
                                                  guint n_collect_values,
                                                  GTypeCValue* collect_values,
                                                  guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		PublishingTumblrSizeEntry * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = publishing_tumblr_size_entry_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
publishing_tumblr_value_size_entry_lcopy_value (const GValue* value,
                                                guint n_collect_values,
                                                GTypeCValue* collect_values,
                                                guint collect_flags)
{
	PublishingTumblrSizeEntry ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = publishing_tumblr_size_entry_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
publishing_tumblr_param_spec_size_entry (const gchar* name,
                                         const gchar* nick,
                                         const gchar* blurb,
                                         GType object_type,
                                         GParamFlags flags)
{
	PublishingTumblrParamSpecSizeEntry* spec;
	g_return_val_if_fail (g_type_is_a (object_type, PUBLISHING_TUMBLR_TYPE_SIZE_ENTRY), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
publishing_tumblr_value_get_size_entry (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PUBLISHING_TUMBLR_TYPE_SIZE_ENTRY), NULL);
	return value->data[0].v_pointer;
}

void
publishing_tumblr_value_set_size_entry (GValue* value,
                                        gpointer v_object)
{
	PublishingTumblrSizeEntry * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PUBLISHING_TUMBLR_TYPE_SIZE_ENTRY));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PUBLISHING_TUMBLR_TYPE_SIZE_ENTRY));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		publishing_tumblr_size_entry_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		publishing_tumblr_size_entry_unref (old);
	}
}

void
publishing_tumblr_value_take_size_entry (GValue* value,
                                         gpointer v_object)
{
	PublishingTumblrSizeEntry * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PUBLISHING_TUMBLR_TYPE_SIZE_ENTRY));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PUBLISHING_TUMBLR_TYPE_SIZE_ENTRY));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		publishing_tumblr_size_entry_unref (old);
	}
}

static void
publishing_tumblr_size_entry_class_init (PublishingTumblrSizeEntryClass * klass,
                                         gpointer klass_data)
{
	publishing_tumblr_size_entry_parent_class = g_type_class_peek_parent (klass);
	((PublishingTumblrSizeEntryClass *) klass)->finalize = publishing_tumblr_size_entry_finalize;
}

static void
publishing_tumblr_size_entry_instance_init (PublishingTumblrSizeEntry * self,
                                            gpointer klass)
{
	self->ref_count = 1;
}

static void
publishing_tumblr_size_entry_finalize (PublishingTumblrSizeEntry * obj)
{
	PublishingTumblrSizeEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PUBLISHING_TUMBLR_TYPE_SIZE_ENTRY, PublishingTumblrSizeEntry);
	g_signal_handlers_destroy (self);
	_g_free0 (self->title);
}

static GType
publishing_tumblr_size_entry_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { publishing_tumblr_value_size_entry_init, publishing_tumblr_value_size_entry_free_value, publishing_tumblr_value_size_entry_copy_value, publishing_tumblr_value_size_entry_peek_pointer, "p", publishing_tumblr_value_size_entry_collect_value, "p", publishing_tumblr_value_size_entry_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (PublishingTumblrSizeEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) publishing_tumblr_size_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PublishingTumblrSizeEntry), 0, (GInstanceInitFunc) publishing_tumblr_size_entry_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType publishing_tumblr_size_entry_type_id;
	publishing_tumblr_size_entry_type_id = g_type_register_fundamental (g_type_fundamental_next (), "PublishingTumblrSizeEntry", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return publishing_tumblr_size_entry_type_id;
}

GType
publishing_tumblr_size_entry_get_type (void)
{
	static volatile gsize publishing_tumblr_size_entry_type_id__once = 0;
	if (g_once_init_enter (&publishing_tumblr_size_entry_type_id__once)) {
		GType publishing_tumblr_size_entry_type_id;
		publishing_tumblr_size_entry_type_id = publishing_tumblr_size_entry_get_type_once ();
		g_once_init_leave (&publishing_tumblr_size_entry_type_id__once, publishing_tumblr_size_entry_type_id);
	}
	return publishing_tumblr_size_entry_type_id__once;
}

gpointer
publishing_tumblr_size_entry_ref (gpointer instance)
{
	PublishingTumblrSizeEntry * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
publishing_tumblr_size_entry_unref (gpointer instance)
{
	PublishingTumblrSizeEntry * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		PUBLISHING_TUMBLR_SIZE_ENTRY_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static inline gpointer
publishing_tumblr_tumblr_publisher_get_instance_private (PublishingTumblrTumblrPublisher* self)
{
	return G_STRUCT_MEMBER_P (self, PublishingTumblrTumblrPublisher_private_offset);
}

static void
_publishing_tumblr_tumblr_publisher_on_authenticator_authenticated_spit_publishing_authenticator_authenticated (SpitPublishingAuthenticator* _sender,
                                                                                                                gpointer self)
{
	publishing_tumblr_tumblr_publisher_on_authenticator_authenticated ((PublishingTumblrTumblrPublisher*) self);
}

static void
_vala_array_add17 (PublishingTumblrSizeEntry** * array,
                   gint* length,
                   gint* size,
                   PublishingTumblrSizeEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (PublishingTumblrSizeEntry*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add18 (PublishingTumblrSizeEntry** * array,
                   gint* length,
                   gint* size,
                   PublishingTumblrSizeEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (PublishingTumblrSizeEntry*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add19 (PublishingTumblrSizeEntry** * array,
                   gint* length,
                   gint* size,
                   PublishingTumblrSizeEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (PublishingTumblrSizeEntry*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static PublishingTumblrSizeEntry**
publishing_tumblr_tumblr_publisher_create_sizes (PublishingTumblrTumblrPublisher* self,
                                                 gint* result_length1)
{
	PublishingTumblrSizeEntry** _result_ = NULL;
	PublishingTumblrSizeEntry** _tmp0_;
	gint _result__length1;
	gint __result__size_;
	PublishingTumblrSizeEntry* _tmp1_;
	PublishingTumblrSizeEntry* _tmp2_;
	PublishingTumblrSizeEntry* _tmp3_;
	PublishingTumblrSizeEntry** _tmp4_;
	gint _tmp4__length1;
	PublishingTumblrSizeEntry** result;
	g_return_val_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self), NULL);
	_tmp0_ = g_new0 (PublishingTumblrSizeEntry*, 0 + 1);
	_result_ = _tmp0_;
	_result__length1 = 0;
	__result__size_ = _result__length1;
	_tmp1_ = publishing_tumblr_size_entry_new (_ ("500 × 375 pixels"), 500);
	_vala_array_add17 (&_result_, &_result__length1, &__result__size_, _tmp1_);
	_tmp2_ = publishing_tumblr_size_entry_new (_ ("1024 × 768 pixels"), 1024);
	_vala_array_add18 (&_result_, &_result__length1, &__result__size_, _tmp2_);
	_tmp3_ = publishing_tumblr_size_entry_new (_ ("1280 × 853 pixels"), 1280);
	_vala_array_add19 (&_result_, &_result__length1, &__result__size_, _tmp3_);
	_tmp4_ = _result_;
	_tmp4__length1 = _result__length1;
	if (result_length1) {
		*result_length1 = _tmp4__length1;
	}
	result = _tmp4_;
	return result;
}

static PublishingTumblrBlogEntry**
publishing_tumblr_tumblr_publisher_create_blogs (PublishingTumblrTumblrPublisher* self,
                                                 gint* result_length1)
{
	PublishingTumblrBlogEntry** _result_ = NULL;
	PublishingTumblrBlogEntry** _tmp0_;
	gint _result__length1;
	gint __result__size_;
	PublishingTumblrBlogEntry** _tmp1_;
	gint _tmp1__length1;
	PublishingTumblrBlogEntry** result;
	g_return_val_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self), NULL);
	_tmp0_ = g_new0 (PublishingTumblrBlogEntry*, 0 + 1);
	_result_ = _tmp0_;
	_result__length1 = 0;
	__result__size_ = _result__length1;
	_tmp1_ = _result_;
	_tmp1__length1 = _result__length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	return result;
}

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

PublishingTumblrTumblrPublisher*
publishing_tumblr_tumblr_publisher_construct (GType object_type,
                                              SpitPublishingService* service,
                                              SpitPublishingPluginHost* host)
{
	PublishingTumblrTumblrPublisher * self = NULL;
	SpitPublishingService* _tmp0_;
	SpitPublishingPluginHost* _tmp1_;
	PublishingRESTSupportOAuth1Session* _tmp2_;
	gint _tmp3_ = 0;
	PublishingTumblrSizeEntry** _tmp4_;
	gint _tmp5_ = 0;
	PublishingTumblrBlogEntry** _tmp6_;
	PublishingAuthenticatorFactory* _tmp7_;
	PublishingAuthenticatorFactory* _tmp8_;
	SpitPublishingAuthenticator* _tmp9_;
	SpitPublishingAuthenticator* _tmp10_;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (service, SPIT_PUBLISHING_TYPE_SERVICE), NULL);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (host, SPIT_PUBLISHING_TYPE_PLUGIN_HOST), NULL);
	self = (PublishingTumblrTumblrPublisher*) g_object_new (object_type, NULL);
	g_debug ("TumblrPublishing.vala:112: TumblrPublisher instantiated.");
	_tmp0_ = _g_object_ref0 (service);
	_g_object_unref0 (self->priv->service);
	self->priv->service = _tmp0_;
	_tmp1_ = _g_object_ref0 (host);
	_g_object_unref0 (self->priv->host);
	self->priv->host = _tmp1_;
	_tmp2_ = publishing_rest_support_oauth1_session_new (PUBLISHING_TUMBLR_ENDPOINT_URL);
	_publishing_rest_support_session_unref0 (self->priv->session);
	self->priv->session = _tmp2_;
	_tmp4_ = publishing_tumblr_tumblr_publisher_create_sizes (self, &_tmp3_);
	self->priv->sizes = (_vala_array_free (self->priv->sizes, self->priv->sizes_length1, (GDestroyNotify) publishing_tumblr_size_entry_unref), NULL);
	self->priv->sizes = _tmp4_;
	self->priv->sizes_length1 = _tmp3_;
	self->priv->_sizes_size_ = self->priv->sizes_length1;
	_tmp6_ = publishing_tumblr_tumblr_publisher_create_blogs (self, &_tmp5_);
	self->priv->blogs = (_vala_array_free (self->priv->blogs, self->priv->blogs_length1, (GDestroyNotify) publishing_tumblr_blog_entry_unref), NULL);
	self->priv->blogs = _tmp6_;
	self->priv->blogs_length1 = _tmp5_;
	self->priv->_blogs_size_ = self->priv->blogs_length1;
	_tmp7_ = publishing_authenticator_factory_get_instance ();
	_tmp8_ = _tmp7_;
	_tmp9_ = spit_publishing_authenticator_factory_create (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, SPIT_PUBLISHING_TYPE_AUTHENTICATOR_FACTORY, SpitPublishingAuthenticatorFactory), "tumblr", host);
	_g_object_unref0 (self->priv->authenticator);
	self->priv->authenticator = _tmp9_;
	_g_object_unref0 (_tmp8_);
	_tmp10_ = self->priv->authenticator;
	g_signal_connect_object (_tmp10_, "authenticated", (GCallback) _publishing_tumblr_tumblr_publisher_on_authenticator_authenticated_spit_publishing_authenticator_authenticated, self, 0);
	return self;
}

PublishingTumblrTumblrPublisher*
publishing_tumblr_tumblr_publisher_new (SpitPublishingService* service,
                                        SpitPublishingPluginHost* host)
{
	return publishing_tumblr_tumblr_publisher_construct (PUBLISHING_TUMBLR_TYPE_TUMBLR_PUBLISHER, service, host);
}

static SpitPublishingService*
publishing_tumblr_tumblr_publisher_real_get_service (SpitPublishingPublisher* base)
{
	PublishingTumblrTumblrPublisher * self;
	SpitPublishingService* _tmp0_;
	SpitPublishingService* _tmp1_;
	SpitPublishingService* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_TUMBLR_TYPE_TUMBLR_PUBLISHER, PublishingTumblrTumblrPublisher);
	_tmp0_ = self->priv->service;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

SpitPublishingPluginHost*
publishing_tumblr_tumblr_publisher_get_host (PublishingTumblrTumblrPublisher* self)
{
	SpitPublishingPluginHost* _tmp0_;
	SpitPublishingPluginHost* _tmp1_;
	SpitPublishingPluginHost* result;
	g_return_val_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self), NULL);
	_tmp0_ = self->priv->host;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static gboolean
publishing_tumblr_tumblr_publisher_real_is_running (SpitPublishingPublisher* base)
{
	PublishingTumblrTumblrPublisher * self;
	gboolean result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_TUMBLR_TYPE_TUMBLR_PUBLISHER, PublishingTumblrTumblrPublisher);
	result = self->priv->running;
	return result;
}

gint
publishing_tumblr_tumblr_publisher_get_persistent_default_size (PublishingTumblrTumblrPublisher* self)
{
	SpitPublishingPluginHost* _tmp0_;
	gint result;
	g_return_val_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self), -1);
	_tmp0_ = self->priv->host;
	result = spit_host_interface_get_config_int (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, SPIT_TYPE_HOST_INTERFACE, SpitHostInterface), "default_size", 1);
	return result;
}

void
publishing_tumblr_tumblr_publisher_set_persistent_default_size (PublishingTumblrTumblrPublisher* self,
                                                                gint size)
{
	SpitPublishingPluginHost* _tmp0_;
	g_return_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self));
	_tmp0_ = self->priv->host;
	spit_host_interface_set_config_int (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, SPIT_TYPE_HOST_INTERFACE, SpitHostInterface), "default_size", size);
}

gint
publishing_tumblr_tumblr_publisher_get_persistent_default_blog (PublishingTumblrTumblrPublisher* self)
{
	SpitPublishingPluginHost* _tmp0_;
	gint result;
	g_return_val_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self), -1);
	_tmp0_ = self->priv->host;
	result = spit_host_interface_get_config_int (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, SPIT_TYPE_HOST_INTERFACE, SpitHostInterface), "default_blog", 0);
	return result;
}

void
publishing_tumblr_tumblr_publisher_set_persistent_default_blog (PublishingTumblrTumblrPublisher* self,
                                                                gint blog)
{
	SpitPublishingPluginHost* _tmp0_;
	g_return_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self));
	_tmp0_ = self->priv->host;
	spit_host_interface_set_config_int (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, SPIT_TYPE_HOST_INTERFACE, SpitHostInterface), "default_blog", blog);
}

static gpointer
_g_variant_ref0 (gpointer self)
{
	return self ? g_variant_ref (self) : NULL;
}

static void
publishing_tumblr_tumblr_publisher_on_authenticator_authenticated (PublishingTumblrTumblrPublisher* self)
{
	GHashTable* params = NULL;
	SpitPublishingAuthenticator* _tmp0_;
	GHashTable* _tmp1_;
	GVariant* consumer_key = NULL;
	GVariant* consumer_secret = NULL;
	GVariant* auth_token = NULL;
	GVariant* auth_token_secret = NULL;
	GHashTable* _tmp2_;
	gconstpointer _tmp3_ = NULL;
	GVariant* _tmp4_;
	GHashTable* _tmp5_;
	gconstpointer _tmp6_ = NULL;
	GVariant* _tmp7_;
	PublishingRESTSupportOAuth1Session* _tmp8_;
	GVariant* _tmp9_;
	const gchar* _tmp10_;
	GVariant* _tmp11_;
	const gchar* _tmp12_;
	GHashTable* _tmp13_;
	gconstpointer _tmp14_ = NULL;
	GVariant* _tmp15_;
	GHashTable* _tmp16_;
	gconstpointer _tmp17_ = NULL;
	GVariant* _tmp18_;
	PublishingRESTSupportOAuth1Session* _tmp19_;
	GVariant* _tmp20_;
	const gchar* _tmp21_;
	GVariant* _tmp22_;
	const gchar* _tmp23_;
	g_return_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self));
	if (!spit_publishing_publisher_is_running (G_TYPE_CHECK_INSTANCE_CAST (self, SPIT_PUBLISHING_TYPE_PUBLISHER, SpitPublishingPublisher))) {
		return;
	}
	g_debug ("TumblrPublishing.vala:163: EVENT: a fully authenticated session has be" \
"come available");
	_tmp0_ = self->priv->authenticator;
	_tmp1_ = spit_publishing_authenticator_get_authentication_parameter (_tmp0_);
	params = _tmp1_;
	consumer_key = NULL;
	consumer_secret = NULL;
	auth_token = NULL;
	auth_token_secret = NULL;
	_tmp2_ = params;
	g_hash_table_lookup_extended (_tmp2_, "ConsumerKey", NULL, &_tmp3_);
	_g_variant_unref0 (consumer_key);
	_tmp4_ = _g_variant_ref0 ((GVariant*) _tmp3_);
	consumer_key = _tmp4_;
	_tmp5_ = params;
	g_hash_table_lookup_extended (_tmp5_, "ConsumerSecret", NULL, &_tmp6_);
	_g_variant_unref0 (consumer_secret);
	_tmp7_ = _g_variant_ref0 ((GVariant*) _tmp6_);
	consumer_secret = _tmp7_;
	_tmp8_ = self->priv->session;
	_tmp9_ = consumer_key;
	_tmp10_ = g_variant_get_string (_tmp9_, NULL);
	_tmp11_ = consumer_secret;
	_tmp12_ = g_variant_get_string (_tmp11_, NULL);
	publishing_rest_support_oauth1_session_set_api_credentials (_tmp8_, _tmp10_, _tmp12_);
	_tmp13_ = params;
	g_hash_table_lookup_extended (_tmp13_, "AuthToken", NULL, &_tmp14_);
	_g_variant_unref0 (auth_token);
	_tmp15_ = _g_variant_ref0 ((GVariant*) _tmp14_);
	auth_token = _tmp15_;
	_tmp16_ = params;
	g_hash_table_lookup_extended (_tmp16_, "AuthTokenSecret", NULL, &_tmp17_);
	_g_variant_unref0 (auth_token_secret);
	_tmp18_ = _g_variant_ref0 ((GVariant*) _tmp17_);
	auth_token_secret = _tmp18_;
	_tmp19_ = self->priv->session;
	_tmp20_ = auth_token;
	_tmp21_ = g_variant_get_string (_tmp20_, NULL);
	_tmp22_ = auth_token_secret;
	_tmp23_ = g_variant_get_string (_tmp22_, NULL);
	publishing_rest_support_oauth1_session_set_access_phase_credentials (_tmp19_, _tmp21_, _tmp23_, "");
	publishing_tumblr_tumblr_publisher_do_get_blogs (self, NULL, NULL);
	_g_variant_unref0 (auth_token_secret);
	_g_variant_unref0 (auth_token);
	_g_variant_unref0 (consumer_secret);
	_g_variant_unref0 (consumer_key);
	_g_hash_table_unref0 (params);
}

static void
publishing_tumblr_tumblr_publisher_do_get_blogs_data_free (gpointer _data)
{
	PublishingTumblrTumblrPublisherDoGetBlogsData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (PublishingTumblrTumblrPublisherDoGetBlogsData, _data_);
}

static void
publishing_tumblr_tumblr_publisher_do_get_blogs (PublishingTumblrTumblrPublisher* self,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_)
{
	PublishingTumblrTumblrPublisherDoGetBlogsData* _data_;
	PublishingTumblrTumblrPublisher* _tmp0_;
	g_return_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self));
	_data_ = g_slice_new0 (PublishingTumblrTumblrPublisherDoGetBlogsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, publishing_tumblr_tumblr_publisher_do_get_blogs_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	publishing_tumblr_tumblr_publisher_do_get_blogs_co (_data_);
}

static void
publishing_tumblr_tumblr_publisher_do_get_blogs_finish (PublishingTumblrTumblrPublisher* self,
                                                        GAsyncResult* _res_)
{
	PublishingTumblrTumblrPublisherDoGetBlogsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
publishing_tumblr_tumblr_publisher_do_get_blogs_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_)
{
	PublishingTumblrTumblrPublisherDoGetBlogsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	publishing_tumblr_tumblr_publisher_do_get_blogs_co (_data_);
}

static gboolean
publishing_tumblr_tumblr_publisher_do_get_blogs_co (PublishingTumblrTumblrPublisherDoGetBlogsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	g_debug ("TumblrPublishing.vala:185: ACTION: obtain all blogs of the tumblr user");
	_data_->_tmp0_ = _data_->self->priv->session;
	_data_->_tmp1_ = publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_new (_data_->_tmp0_);
	_data_->txn = _data_->_tmp1_;
	{
		_data_->_tmp2_ = _data_->txn;
		_data_->_state_ = 1;
		publishing_rest_support_transaction_execute_async (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp2_, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), publishing_tumblr_tumblr_publisher_do_get_blogs_ready, _data_);
		return FALSE;
		_state_1:
		publishing_rest_support_transaction_execute_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp2_, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (!spit_publishing_publisher_is_running (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, SPIT_PUBLISHING_TYPE_PUBLISHER, SpitPublishingPublisher))) {
			_publishing_rest_support_transaction_unref0 (_data_->txn);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp3_ = _data_->txn;
		_data_->_tmp4_ = publishing_rest_support_transaction_get_response (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp3_, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction));
		_data_->_tmp5_ = _data_->_tmp4_;
		g_debug ("TumblrPublishing.vala:193: EVENT: user info request transaction comple" \
"ted; response = '%s'", _data_->_tmp5_);
		_g_free0 (_data_->_tmp5_);
		_data_->_tmp6_ = _data_->txn;
		_data_->_tmp7_ = publishing_rest_support_transaction_get_response (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp6_, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction));
		_data_->_tmp8_ = _data_->_tmp7_;
		publishing_tumblr_tumblr_publisher_do_parse_token_info_from_user_request (_data_->self, _data_->_tmp8_, &_data_->_inner_error0_);
		_g_free0 (_data_->_tmp8_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		publishing_tumblr_tumblr_publisher_do_show_publishing_options_pane (_data_->self);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->err = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp9_ = _data_->self->priv->session;
		publishing_rest_support_oauth1_session_deauthenticate (_data_->_tmp9_);
		g_debug ("TumblrPublishing.vala:200: EVENT: user info request transaction caused" \
" a network error");
		_data_->_tmp10_ = _data_->self->priv->host;
		_data_->_tmp11_ = _data_->err;
		spit_publishing_plugin_host_post_error (_data_->_tmp10_, _data_->_tmp11_);
		_g_error_free0 (_data_->err);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_publishing_rest_support_transaction_unref0 (_data_->txn);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_publishing_rest_support_transaction_unref0 (_data_->txn);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static gpointer
_json_object_ref0 (gpointer self)
{
	return self ? json_object_ref (self) : NULL;
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			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;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			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;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	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;
}

static void
_vala_array_add20 (PublishingTumblrBlogEntry** * array,
                   gint* length,
                   gint* size,
                   PublishingTumblrBlogEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (PublishingTumblrBlogEntry*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
publishing_tumblr_tumblr_publisher_do_parse_token_info_from_user_request (PublishingTumblrTumblrPublisher* self,
                                                                          const gchar* response,
                                                                          GError** error)
{
	JsonParser* parser = NULL;
	JsonParser* _tmp0_;
	JsonObject* root_object = NULL;
	JsonNode* _tmp1_;
	JsonObject* _tmp2_;
	JsonObject* _tmp3_;
	JsonObject* _tmp4_;
	JsonObject* _tmp5_;
	JsonObject* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	const gchar* _tmp9_;
	JsonObject* _tmp10_;
	JsonObject* _tmp11_;
	JsonObject* _tmp12_;
	JsonArray* _tmp13_;
	GList* _tmp14_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self));
	g_return_if_fail (response != NULL);
	g_debug ("TumblrPublishing.vala:206: ACTION: parsing info request response '%s' " \
"into list of available blogs", response);
	_tmp0_ = json_parser_new ();
	parser = _tmp0_;
	json_parser_load_from_data (parser, response, (gssize) -1, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		return;
	}
	_tmp1_ = json_parser_get_root (parser);
	_tmp2_ = json_node_get_object (_tmp1_);
	_tmp3_ = _json_object_ref0 (_tmp2_);
	root_object = _tmp3_;
	_tmp4_ = root_object;
	_tmp5_ = json_object_get_object_member (_tmp4_, "response");
	_tmp6_ = json_object_get_object_member (_tmp5_, "user");
	_tmp7_ = json_object_get_string_member (_tmp6_, "name");
	_tmp8_ = g_strdup (_tmp7_);
	_g_free0 (self->priv->username);
	self->priv->username = _tmp8_;
	_tmp9_ = self->priv->username;
	g_debug ("TumblrPublishing.vala:212: Got user name: %s", _tmp9_);
	_tmp10_ = root_object;
	_tmp11_ = json_object_get_object_member (_tmp10_, "response");
	_tmp12_ = json_object_get_object_member (_tmp11_, "user");
	_tmp13_ = json_object_get_array_member (_tmp12_, "blogs");
	_tmp14_ = json_array_get_elements (_tmp13_);
	{
		GList* blognode_collection = NULL;
		GList* blognode_it = NULL;
		blognode_collection = _tmp14_;
		for (blognode_it = blognode_collection; blognode_it != NULL; blognode_it = blognode_it->next) {
			JsonNode* blognode = NULL;
			blognode = (JsonNode*) blognode_it->data;
			{
				JsonObject* blog = NULL;
				JsonNode* _tmp15_;
				JsonObject* _tmp16_;
				JsonObject* _tmp17_;
				gchar* name = NULL;
				JsonObject* _tmp18_;
				const gchar* _tmp19_;
				gchar* _tmp20_;
				gchar* url = NULL;
				JsonObject* _tmp21_;
				const gchar* _tmp22_;
				gchar* _tmp23_;
				gchar* _tmp24_;
				gchar* _tmp25_;
				gchar* _tmp26_;
				gchar* _tmp27_;
				gchar* _tmp28_;
				const gchar* _tmp29_;
				const gchar* _tmp30_;
				const gchar* _tmp31_;
				const gchar* _tmp32_;
				PublishingTumblrBlogEntry* _tmp33_;
				_tmp15_ = blognode;
				_tmp16_ = json_node_get_object (_tmp15_);
				_tmp17_ = _json_object_ref0 (_tmp16_);
				blog = _tmp17_;
				_tmp18_ = blog;
				_tmp19_ = json_object_get_string_member (_tmp18_, "name");
				_tmp20_ = g_strdup (_tmp19_);
				name = _tmp20_;
				_tmp21_ = blog;
				_tmp22_ = json_object_get_string_member (_tmp21_, "url");
				_tmp23_ = string_replace (_tmp22_, "http://", "");
				_tmp24_ = _tmp23_;
				_tmp25_ = string_replace (_tmp24_, "https://", "");
				_tmp26_ = _tmp25_;
				_tmp27_ = string_replace (_tmp26_, "/", "");
				_tmp28_ = _tmp27_;
				_g_free0 (_tmp26_);
				_g_free0 (_tmp24_);
				url = _tmp28_;
				_tmp29_ = name;
				_tmp30_ = url;
				g_debug ("TumblrPublishing.vala:217: Got blog name: %s and url: %s", _tmp29_, _tmp30_);
				_tmp31_ = name;
				_tmp32_ = url;
				_tmp33_ = publishing_tumblr_blog_entry_new (_tmp31_, _tmp32_);
				_vala_array_add20 (&self->priv->blogs, &self->priv->blogs_length1, &self->priv->_blogs_size_, _tmp33_);
				_g_free0 (url);
				_g_free0 (name);
				_json_object_unref0 (blog);
			}
		}
		(blognode_collection == NULL) ? NULL : (blognode_collection = (g_list_free (blognode_collection), NULL));
	}
	_json_object_unref0 (root_object);
	_g_object_unref0 (parser);
}

static void
_publishing_tumblr_tumblr_publisher_on_publishing_options_pane_publish_publishing_tumblr_tumblr_publisher_publishing_options_pane_publish (PublishingTumblrTumblrPublisherPublishingOptionsPane* _sender,
                                                                                                                                           gpointer self)
{
	publishing_tumblr_tumblr_publisher_on_publishing_options_pane_publish ((PublishingTumblrTumblrPublisher*) self);
}

static void
_publishing_tumblr_tumblr_publisher_on_publishing_options_pane_logout_publishing_tumblr_tumblr_publisher_publishing_options_pane_logout (PublishingTumblrTumblrPublisherPublishingOptionsPane* _sender,
                                                                                                                                         gpointer self)
{
	publishing_tumblr_tumblr_publisher_on_publishing_options_pane_logout ((PublishingTumblrTumblrPublisher*) self);
}

static void
publishing_tumblr_tumblr_publisher_do_show_publishing_options_pane (PublishingTumblrTumblrPublisher* self)
{
	SpitPublishingPluginHost* _tmp0_;
	PublishingTumblrTumblrPublisherPublishingOptionsPane* publishing_options_pane = NULL;
	SpitPublishingPluginHost* _tmp1_;
	PublishingTumblrSizeEntry** _tmp2_;
	gint _tmp2__length1;
	PublishingTumblrBlogEntry** _tmp3_;
	gint _tmp3__length1;
	const gchar* _tmp4_;
	PublishingTumblrTumblrPublisherPublishingOptionsPane* _tmp5_;
	SpitPublishingPluginHost* _tmp6_;
	g_return_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self));
	g_debug ("TumblrPublishing.vala:224: ACTION: displaying publishing options pane");
	_tmp0_ = self->priv->host;
	spit_publishing_plugin_host_set_service_locked (_tmp0_, FALSE);
	_tmp1_ = self->priv->host;
	_tmp2_ = self->priv->sizes;
	_tmp2__length1 = self->priv->sizes_length1;
	_tmp3_ = self->priv->blogs;
	_tmp3__length1 = self->priv->blogs_length1;
	_tmp4_ = self->priv->username;
	_tmp5_ = publishing_tumblr_tumblr_publisher_publishing_options_pane_new (self, spit_publishing_plugin_host_get_publishable_media_type (_tmp1_), _tmp2_, _tmp2__length1, _tmp3_, _tmp3__length1, _tmp4_);
	publishing_options_pane = _tmp5_;
	g_signal_connect_object (publishing_options_pane, "publish", (GCallback) _publishing_tumblr_tumblr_publisher_on_publishing_options_pane_publish_publishing_tumblr_tumblr_publisher_publishing_options_pane_publish, self, 0);
	g_signal_connect_object (publishing_options_pane, "logout", (GCallback) _publishing_tumblr_tumblr_publisher_on_publishing_options_pane_logout_publishing_tumblr_tumblr_publisher_publishing_options_pane_logout, self, 0);
	_tmp6_ = self->priv->host;
	spit_publishing_plugin_host_install_dialog_pane (_tmp6_, G_TYPE_CHECK_INSTANCE_CAST (publishing_options_pane, SPIT_PUBLISHING_TYPE_DIALOG_PANE, SpitPublishingDialogPane), SPIT_PUBLISHING_PLUGIN_HOST_BUTTON_MODE_CANCEL);
	_g_object_unref0 (publishing_options_pane);
}

static void
publishing_tumblr_tumblr_publisher_on_publishing_options_pane_publish (PublishingTumblrTumblrPublisher* self)
{
	PublishingTumblrTumblrPublisherPublishingOptionsPane* _tmp0_;
	g_return_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self));
	_tmp0_ = self->priv->publishing_options_pane;
	if (_tmp0_ != NULL) {
		PublishingTumblrTumblrPublisherPublishingOptionsPane* _tmp1_;
		guint _tmp2_;
		PublishingTumblrTumblrPublisherPublishingOptionsPane* _tmp3_;
		guint _tmp4_;
		_tmp1_ = self->priv->publishing_options_pane;
		g_signal_parse_name ("publish", PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE, &_tmp2_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _publishing_tumblr_tumblr_publisher_on_publishing_options_pane_publish_publishing_tumblr_tumblr_publisher_publishing_options_pane_publish, self);
		_tmp3_ = self->priv->publishing_options_pane;
		g_signal_parse_name ("logout", PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE, &_tmp4_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp4_, 0, NULL, (GCallback) _publishing_tumblr_tumblr_publisher_on_publishing_options_pane_logout_publishing_tumblr_tumblr_publisher_publishing_options_pane_logout, self);
	}
	if (!spit_publishing_publisher_is_running (G_TYPE_CHECK_INSTANCE_CAST (self, SPIT_PUBLISHING_TYPE_PUBLISHER, SpitPublishingPublisher))) {
		return;
	}
	g_debug ("TumblrPublishing.vala:244: EVENT: user clicked the 'Publish' button in" \
" the publishing options pane");
	publishing_tumblr_tumblr_publisher_do_publish (self);
}

static void
publishing_tumblr_tumblr_publisher_on_publishing_options_pane_logout (PublishingTumblrTumblrPublisher* self)
{
	PublishingTumblrTumblrPublisherPublishingOptionsPane* _tmp0_;
	g_return_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self));
	_tmp0_ = self->priv->publishing_options_pane;
	if (_tmp0_ != NULL) {
		PublishingTumblrTumblrPublisherPublishingOptionsPane* _tmp1_;
		guint _tmp2_;
		PublishingTumblrTumblrPublisherPublishingOptionsPane* _tmp3_;
		guint _tmp4_;
		_tmp1_ = self->priv->publishing_options_pane;
		g_signal_parse_name ("publish", PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE, &_tmp2_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _publishing_tumblr_tumblr_publisher_on_publishing_options_pane_publish_publishing_tumblr_tumblr_publisher_publishing_options_pane_publish, self);
		_tmp3_ = self->priv->publishing_options_pane;
		g_signal_parse_name ("logout", PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE, &_tmp4_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp4_, 0, NULL, (GCallback) _publishing_tumblr_tumblr_publisher_on_publishing_options_pane_logout_publishing_tumblr_tumblr_publisher_publishing_options_pane_logout, self);
	}
	if (!spit_publishing_publisher_is_running (G_TYPE_CHECK_INSTANCE_CAST (self, SPIT_PUBLISHING_TYPE_PUBLISHER, SpitPublishingPublisher))) {
		return;
	}
	g_debug ("TumblrPublishing.vala:257: EVENT: user clicked the 'Logout' button in " \
"the publishing options pane");
	publishing_tumblr_tumblr_publisher_do_logout (self);
}

gint
publishing_tumblr_tumblr_publisher_tumblr_date_time_compare_func (SpitPublishingPublishable* a,
                                                                  SpitPublishingPublishable* b)
{
	GDateTime* _tmp0_;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	GDateTime* _tmp3_;
	gint _tmp4_;
	gint result;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (a, SPIT_PUBLISHING_TYPE_PUBLISHABLE), -1);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (b, SPIT_PUBLISHING_TYPE_PUBLISHABLE), -1);
	_tmp0_ = spit_publishing_publishable_get_exposure_date_time (a);
	_tmp1_ = _tmp0_;
	_tmp2_ = spit_publishing_publishable_get_exposure_date_time (b);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_date_time_compare (_tmp1_, _tmp3_);
	_g_date_time_unref0 (_tmp3_);
	_g_date_time_unref0 (_tmp1_);
	result = _tmp4_;
	return result;
}

static gint
_publishing_tumblr_tumblr_publisher_tumblr_date_time_compare_func_gcompare_data_func (gconstpointer a,
                                                                                      gconstpointer b,
                                                                                      gpointer self)
{
	gint result;
	result = publishing_tumblr_tumblr_publisher_tumblr_date_time_compare_func ((SpitPublishingPublishable*) a, (SpitPublishingPublishable*) b);
	return result;
}

static void
_publishing_tumblr_tumblr_publisher_on_upload_complete_publishing_rest_support_batch_uploader_upload_complete (PublishingRESTSupportBatchUploader* _sender,
                                                                                                               gint num_photos_published,
                                                                                                               gpointer self)
{
	publishing_tumblr_tumblr_publisher_on_upload_complete ((PublishingTumblrTumblrPublisher*) self, _sender, num_photos_published);
}

static void
_publishing_tumblr_tumblr_publisher_on_upload_error_publishing_rest_support_batch_uploader_upload_error (PublishingRESTSupportBatchUploader* _sender,
                                                                                                         GError* err,
                                                                                                         gpointer self)
{
	publishing_tumblr_tumblr_publisher_on_upload_error ((PublishingTumblrTumblrPublisher*) self, _sender, err);
}

static void
_publishing_tumblr_tumblr_publisher_on_upload_status_updated_spit_publishing_progress_callback (gint file_number,
                                                                                                gdouble fraction_complete,
                                                                                                gpointer self)
{
	publishing_tumblr_tumblr_publisher_on_upload_status_updated ((PublishingTumblrTumblrPublisher*) self, file_number, fraction_complete);
}

static void
publishing_tumblr_tumblr_publisher_do_publish (PublishingTumblrTumblrPublisher* self)
{
	SpitPublishingPluginHost* _tmp0_;
	SpitPublishingPluginHost* _tmp1_;
	PublishingTumblrSizeEntry** _tmp2_;
	gint _tmp2__length1;
	PublishingTumblrSizeEntry* _tmp3_;
	gpointer _tmp4_ = NULL;
	GDestroyNotify _tmp5_ = NULL;
	SpitPublishingProgressCallback _tmp6_;
	SpitPublishingPublishable** publishables = NULL;
	SpitPublishingPluginHost* _tmp7_;
	gint _tmp8_ = 0;
	SpitPublishingPublishable** _tmp9_;
	gint publishables_length1;
	gint _publishables_size_;
	GeeArrayList* sorted_list = NULL;
	GeeArrayList* _tmp10_;
	SpitPublishingPublishable** _tmp11_;
	gint _tmp11__length1;
	GeeArrayList* _tmp15_;
	gchar* blog_url = NULL;
	PublishingTumblrBlogEntry** _tmp16_;
	gint _tmp16__length1;
	PublishingTumblrBlogEntry* _tmp17_;
	const gchar* _tmp18_;
	gchar* _tmp19_;
	PublishingTumblrTumblrPublisherUploader* uploader = NULL;
	PublishingRESTSupportOAuth1Session* _tmp20_;
	GeeArrayList* _tmp21_;
	gint _tmp22_ = 0;
	gpointer* _tmp23_;
	SpitPublishingPublishable** _tmp24_;
	gint _tmp24__length1;
	const gchar* _tmp25_;
	PublishingTumblrTumblrPublisherUploader* _tmp26_;
	PublishingTumblrTumblrPublisherUploader* _tmp27_;
	PublishingTumblrTumblrPublisherUploader* _tmp28_;
	PublishingTumblrTumblrPublisherUploader* _tmp29_;
	PublishingTumblrTumblrPublisherUploader* _tmp30_;
	g_return_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self));
	g_debug ("TumblrPublishing.vala:268: ACTION: uploading media items to remote ser" \
"ver.");
	_tmp0_ = self->priv->host;
	spit_publishing_plugin_host_set_service_locked (_tmp0_, TRUE);
	_tmp1_ = self->priv->host;
	_tmp2_ = self->priv->sizes;
	_tmp2__length1 = self->priv->sizes_length1;
	_tmp3_ = _tmp2_[publishing_tumblr_tumblr_publisher_get_persistent_default_size (self)];
	_tmp6_ = spit_publishing_plugin_host_serialize_publishables (_tmp1_, _tmp3_->size, FALSE, &_tmp4_, &_tmp5_);
	(self->priv->progress_reporter_target_destroy_notify == NULL) ? NULL : (self->priv->progress_reporter_target_destroy_notify (self->priv->progress_reporter_target), NULL);
	self->priv->progress_reporter = NULL;
	self->priv->progress_reporter_target = NULL;
	self->priv->progress_reporter_target_destroy_notify = NULL;
	self->priv->progress_reporter = _tmp6_;
	self->priv->progress_reporter_target = _tmp4_;
	self->priv->progress_reporter_target_destroy_notify = _tmp5_;
	if (!spit_publishing_publisher_is_running (G_TYPE_CHECK_INSTANCE_CAST (self, SPIT_PUBLISHING_TYPE_PUBLISHER, SpitPublishingPublisher))) {
		return;
	}
	_tmp7_ = self->priv->host;
	_tmp9_ = spit_publishing_plugin_host_get_publishables (_tmp7_, &_tmp8_);
	publishables = _tmp9_;
	publishables_length1 = _tmp8_;
	_publishables_size_ = publishables_length1;
	_tmp10_ = gee_array_list_new (SPIT_PUBLISHING_TYPE_PUBLISHABLE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	sorted_list = _tmp10_;
	_tmp11_ = publishables;
	_tmp11__length1 = publishables_length1;
	{
		SpitPublishingPublishable** p_collection = NULL;
		gint p_collection_length1 = 0;
		gint _p_collection_size_ = 0;
		gint p_it = 0;
		p_collection = _tmp11_;
		p_collection_length1 = _tmp11__length1;
		for (p_it = 0; p_it < p_collection_length1; p_it = p_it + 1) {
			SpitPublishingPublishable* _tmp12_;
			SpitPublishingPublishable* p = NULL;
			_tmp12_ = _g_object_ref0 (p_collection[p_it]);
			p = _tmp12_;
			{
				GeeArrayList* _tmp13_;
				SpitPublishingPublishable* _tmp14_;
				g_debug ("TumblrPublishing.vala:286: ACTION: add publishable");
				_tmp13_ = sorted_list;
				_tmp14_ = p;
				gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), _tmp14_);
				_g_object_unref0 (p);
			}
		}
	}
	_tmp15_ = sorted_list;
	gee_list_sort (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, GEE_TYPE_LIST, GeeList), _publishing_tumblr_tumblr_publisher_tumblr_date_time_compare_func_gcompare_data_func, NULL, NULL);
	_tmp16_ = self->priv->blogs;
	_tmp16__length1 = self->priv->blogs_length1;
	_tmp17_ = _tmp16_[publishing_tumblr_tumblr_publisher_get_persistent_default_blog (self)];
	_tmp18_ = _tmp17_->url;
	_tmp19_ = g_strdup (_tmp18_);
	blog_url = _tmp19_;
	_tmp20_ = self->priv->session;
	_tmp21_ = sorted_list;
	_tmp23_ = gee_collection_to_array (G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, GEE_TYPE_COLLECTION, GeeCollection), &_tmp22_);
	_tmp24_ = _tmp23_;
	_tmp24__length1 = _tmp22_;
	_tmp25_ = blog_url;
	_tmp26_ = publishing_tumblr_tumblr_publisher_uploader_new (_tmp20_, _tmp24_, _tmp22_, _tmp25_);
	_tmp27_ = _tmp26_;
	_tmp24_ = (_vala_array_free (_tmp24_, _tmp24__length1, (GDestroyNotify) g_object_unref), NULL);
	uploader = _tmp27_;
	_tmp28_ = uploader;
	g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (_tmp28_, PUBLISHING_REST_SUPPORT_TYPE_BATCH_UPLOADER, PublishingRESTSupportBatchUploader), "upload-complete", (GCallback) _publishing_tumblr_tumblr_publisher_on_upload_complete_publishing_rest_support_batch_uploader_upload_complete, self, 0);
	_tmp29_ = uploader;
	g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (_tmp29_, PUBLISHING_REST_SUPPORT_TYPE_BATCH_UPLOADER, PublishingRESTSupportBatchUploader), "upload-error", (GCallback) _publishing_tumblr_tumblr_publisher_on_upload_error_publishing_rest_support_batch_uploader_upload_error, self, 0);
	_tmp30_ = uploader;
	publishing_rest_support_batch_uploader_upload_async (G_TYPE_CHECK_INSTANCE_CAST (_tmp30_, PUBLISHING_REST_SUPPORT_TYPE_BATCH_UPLOADER, PublishingRESTSupportBatchUploader), _publishing_tumblr_tumblr_publisher_on_upload_status_updated_spit_publishing_progress_callback, self, NULL, NULL);
	_publishing_rest_support_batch_uploader_unref0 (uploader);
	_g_free0 (blog_url);
	_g_object_unref0 (sorted_list);
	publishables = (_vala_array_free (publishables, publishables_length1, (GDestroyNotify) g_object_unref), NULL);
}

static void
publishing_tumblr_tumblr_publisher_do_show_success_pane (PublishingTumblrTumblrPublisher* self)
{
	SpitPublishingPluginHost* _tmp0_;
	SpitPublishingPluginHost* _tmp1_;
	g_return_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self));
	g_debug ("TumblrPublishing.vala:299: ACTION: showing success pane.");
	_tmp0_ = self->priv->host;
	spit_publishing_plugin_host_set_service_locked (_tmp0_, FALSE);
	_tmp1_ = self->priv->host;
	spit_publishing_plugin_host_install_success_pane (_tmp1_);
}

static void
publishing_tumblr_tumblr_publisher_on_upload_status_updated (PublishingTumblrTumblrPublisher* self,
                                                             gint file_number,
                                                             gdouble completed_fraction)
{
	SpitPublishingProgressCallback _tmp0_;
	gpointer _tmp0__target;
	SpitPublishingProgressCallback _tmp1_;
	gpointer _tmp1__target;
	g_return_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self));
	if (!spit_publishing_publisher_is_running (G_TYPE_CHECK_INSTANCE_CAST (self, SPIT_PUBLISHING_TYPE_PUBLISHER, SpitPublishingPublisher))) {
		return;
	}
	g_debug ("TumblrPublishing.vala:310: EVENT: uploader reports upload %.2f percent" \
" complete.", 100.0 * completed_fraction);
	_tmp0_ = self->priv->progress_reporter;
	_tmp0__target = self->priv->progress_reporter_target;
	_vala_assert (_tmp0_ != NULL, "progress_reporter != null");
	_tmp1_ = self->priv->progress_reporter;
	_tmp1__target = self->priv->progress_reporter_target;
	_tmp1_ (file_number, completed_fraction, _tmp1__target);
}

static void
publishing_tumblr_tumblr_publisher_on_upload_complete (PublishingTumblrTumblrPublisher* self,
                                                       PublishingRESTSupportBatchUploader* uploader,
                                                       gint num_published)
{
	guint _tmp0_;
	guint _tmp1_;
	g_return_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (uploader, PUBLISHING_REST_SUPPORT_TYPE_BATCH_UPLOADER));
	if (!spit_publishing_publisher_is_running (G_TYPE_CHECK_INSTANCE_CAST (self, SPIT_PUBLISHING_TYPE_PUBLISHER, SpitPublishingPublisher))) {
		return;
	}
	g_debug ("TumblrPublishing.vala:322: EVENT: uploader reports upload complete; %d" \
" items published.", num_published);
	g_signal_parse_name ("upload-complete", PUBLISHING_REST_SUPPORT_TYPE_BATCH_UPLOADER, &_tmp0_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (uploader, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _publishing_tumblr_tumblr_publisher_on_upload_complete_publishing_rest_support_batch_uploader_upload_complete, self);
	g_signal_parse_name ("upload-error", PUBLISHING_REST_SUPPORT_TYPE_BATCH_UPLOADER, &_tmp1_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (uploader, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _publishing_tumblr_tumblr_publisher_on_upload_error_publishing_rest_support_batch_uploader_upload_error, self);
	publishing_tumblr_tumblr_publisher_do_show_success_pane (self);
}

static void
publishing_tumblr_tumblr_publisher_on_upload_error (PublishingTumblrTumblrPublisher* self,
                                                    PublishingRESTSupportBatchUploader* uploader,
                                                    GError* err)
{
	const gchar* _tmp0_;
	guint _tmp1_;
	guint _tmp2_;
	SpitPublishingPluginHost* _tmp3_;
	g_return_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (uploader, PUBLISHING_REST_SUPPORT_TYPE_BATCH_UPLOADER));
	if (!spit_publishing_publisher_is_running (G_TYPE_CHECK_INSTANCE_CAST (self, SPIT_PUBLISHING_TYPE_PUBLISHER, SpitPublishingPublisher))) {
		return;
	}
	_tmp0_ = err->message;
	g_debug ("TumblrPublishing.vala:335: EVENT: uploader reports upload error = '%s'" \
".", _tmp0_);
	g_signal_parse_name ("upload-complete", PUBLISHING_REST_SUPPORT_TYPE_BATCH_UPLOADER, &_tmp1_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (uploader, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _publishing_tumblr_tumblr_publisher_on_upload_complete_publishing_rest_support_batch_uploader_upload_complete, self);
	g_signal_parse_name ("upload-error", PUBLISHING_REST_SUPPORT_TYPE_BATCH_UPLOADER, &_tmp2_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (uploader, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _publishing_tumblr_tumblr_publisher_on_upload_error_publishing_rest_support_batch_uploader_upload_error, self);
	_tmp3_ = self->priv->host;
	spit_publishing_plugin_host_post_error (_tmp3_, err);
}

static void
publishing_tumblr_tumblr_publisher_do_logout (PublishingTumblrTumblrPublisher* self)
{
	SpitPublishingAuthenticator* _tmp0_;
	g_return_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self));
	g_debug ("TumblrPublishing.vala:345: ACTION: logging user out, deauthenticating " \
"session, and erasing stored credentials");
	_tmp0_ = self->priv->authenticator;
	if (spit_publishing_authenticator_can_logout (_tmp0_)) {
		SpitPublishingAuthenticator* _tmp1_;
		_tmp1_ = self->priv->authenticator;
		spit_publishing_authenticator_logout (_tmp1_);
	}
	self->priv->running = FALSE;
	publishing_tumblr_tumblr_publisher_attempt_start (self);
}

void
publishing_tumblr_tumblr_publisher_attempt_start (PublishingTumblrTumblrPublisher* self)
{
	SpitPublishingAuthenticator* _tmp0_;
	g_return_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (self));
	if (spit_publishing_publisher_is_running (G_TYPE_CHECK_INSTANCE_CAST (self, SPIT_PUBLISHING_TYPE_PUBLISHER, SpitPublishingPublisher))) {
		return;
	}
	g_debug ("TumblrPublishing.vala:360: TumblrPublisher: starting interaction.");
	self->priv->running = TRUE;
	_tmp0_ = self->priv->authenticator;
	spit_publishing_authenticator_authenticate (_tmp0_);
}

static void
publishing_tumblr_tumblr_publisher_real_start (SpitPublishingPublisher* base)
{
	PublishingTumblrTumblrPublisher * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_TUMBLR_TYPE_TUMBLR_PUBLISHER, PublishingTumblrTumblrPublisher);
	if (spit_publishing_publisher_is_running (G_TYPE_CHECK_INSTANCE_CAST (self, SPIT_PUBLISHING_TYPE_PUBLISHER, SpitPublishingPublisher))) {
		return;
	}
	if (self->priv->was_started) {
		g_error ("TumblrPublishing.vala:371: %s", _ ("TumblrPublisher: start( ): can’t start; this publisher is not restarta" \
"ble."));
	}
	g_debug ("TumblrPublishing.vala:373: TumblrPublisher: starting interaction.");
	publishing_tumblr_tumblr_publisher_attempt_start (self);
}

static void
publishing_tumblr_tumblr_publisher_real_stop (SpitPublishingPublisher* base)
{
	PublishingTumblrTumblrPublisher * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_TUMBLR_TYPE_TUMBLR_PUBLISHER, PublishingTumblrTumblrPublisher);
	g_debug ("TumblrPublishing.vala:379: TumblrPublisher: stop( ) invoked.");
	self->priv->running = FALSE;
}

static inline gpointer
publishing_tumblr_tumblr_publisher_publishing_options_pane_get_instance_private (PublishingTumblrTumblrPublisherPublishingOptionsPane* self)
{
	return G_STRUCT_MEMBER_P (self, PublishingTumblrTumblrPublisherPublishingOptionsPane_private_offset);
}

static gpointer
_publishing_tumblr_size_entry_ref0 (gpointer self)
{
	return self ? publishing_tumblr_size_entry_ref (self) : NULL;
}

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

static gpointer
_publishing_tumblr_blog_entry_ref0 (gpointer self)
{
	return self ? publishing_tumblr_blog_entry_ref (self) : NULL;
}

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

static void
_publishing_tumblr_tumblr_publisher_publishing_options_pane_on_blog_changed_gtk_combo_box_changed (GtkComboBox* _sender,
                                                                                                   gpointer self)
{
	publishing_tumblr_tumblr_publisher_publishing_options_pane_on_blog_changed ((PublishingTumblrTumblrPublisherPublishingOptionsPane*) self);
}

static void
_publishing_tumblr_tumblr_publisher_publishing_options_pane_on_size_changed_gtk_combo_box_changed (GtkComboBox* _sender,
                                                                                                   gpointer self)
{
	publishing_tumblr_tumblr_publisher_publishing_options_pane_on_size_changed ((PublishingTumblrTumblrPublisherPublishingOptionsPane*) self);
}

static void
_publishing_tumblr_tumblr_publisher_publishing_options_pane_on_logout_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                                  gpointer self)
{
	publishing_tumblr_tumblr_publisher_publishing_options_pane_on_logout_clicked ((PublishingTumblrTumblrPublisherPublishingOptionsPane*) self);
}

static void
_publishing_tumblr_tumblr_publisher_publishing_options_pane_on_publish_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                                   gpointer self)
{
	publishing_tumblr_tumblr_publisher_publishing_options_pane_on_publish_clicked ((PublishingTumblrTumblrPublisherPublishingOptionsPane*) self);
}

PublishingTumblrTumblrPublisherPublishingOptionsPane*
publishing_tumblr_tumblr_publisher_publishing_options_pane_construct (GType object_type,
                                                                      PublishingTumblrTumblrPublisher* publisher,
                                                                      SpitPublishingPublisherMediaType media_type,
                                                                      PublishingTumblrSizeEntry** sizes,
                                                                      gint sizes_length1,
                                                                      PublishingTumblrBlogEntry** blogs,
                                                                      gint blogs_length1,
                                                                      const gchar* username)
{
	PublishingTumblrTumblrPublisherPublishingOptionsPane * self = NULL;
	GtkBox* _tmp0_;
	gchar* _tmp1_;
	PublishingTumblrTumblrPublisher* _tmp2_;
	PublishingTumblrSizeEntry** _tmp3_;
	gint _tmp3__length1;
	PublishingTumblrBlogEntry** _tmp4_;
	gint _tmp4__length1;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (PUBLISHING_TUMBLR_IS_TUMBLR_PUBLISHER (publisher), NULL);
	g_return_val_if_fail (username != NULL, NULL);
	self = (PublishingTumblrTumblrPublisherPublishingOptionsPane*) g_object_new (object_type, NULL);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->pane_widget);
	self->priv->pane_widget = _tmp0_;
	_tmp1_ = g_strdup (username);
	_g_free0 (self->priv->username);
	self->priv->username = _tmp1_;
	_tmp2_ = _g_object_ref0 (publisher);
	_g_object_unref0 (self->priv->publisher);
	self->priv->publisher = _tmp2_;
	self->priv->media_type = media_type;
	_tmp3_ = (sizes != NULL) ? _vala_array_dup1 (sizes, sizes_length1) : sizes;
	_tmp3__length1 = sizes_length1;
	self->priv->sizes = (_vala_array_free (self->priv->sizes, self->priv->sizes_length1, (GDestroyNotify) publishing_tumblr_size_entry_unref), NULL);
	self->priv->sizes = _tmp3_;
	self->priv->sizes_length1 = _tmp3__length1;
	self->priv->_sizes_size_ = self->priv->sizes_length1;
	_tmp4_ = (blogs != NULL) ? _vala_array_dup2 (blogs, blogs_length1) : blogs;
	_tmp4__length1 = blogs_length1;
	self->priv->blogs = (_vala_array_free (self->priv->blogs, self->priv->blogs_length1, (GDestroyNotify) publishing_tumblr_blog_entry_unref), NULL);
	self->priv->blogs = _tmp4_;
	self->priv->blogs_length1 = _tmp4__length1;
	self->priv->_blogs_size_ = self->priv->blogs_length1;
	{
		GtkBuilder* _tmp5_;
		GtkBuilder* _tmp6_;
		GtkBuilder* _tmp7_;
		GtkBuilder* _tmp8_;
		GObject* _tmp9_;
		GtkBox* _tmp10_;
		GtkBuilder* _tmp11_;
		GObject* _tmp12_;
		GtkLabel* _tmp13_;
		GtkBuilder* _tmp14_;
		GObject* _tmp15_;
		GtkButton* _tmp16_;
		GtkBuilder* _tmp17_;
		GObject* _tmp18_;
		GtkButton* _tmp19_;
		GtkBuilder* _tmp20_;
		GObject* _tmp21_;
		GtkComboBoxText* _tmp22_;
		GtkBuilder* _tmp23_;
		GObject* _tmp24_;
		GtkLabel* _tmp25_;
		GtkBuilder* _tmp26_;
		GObject* _tmp27_;
		GtkComboBoxText* _tmp28_;
		GtkBuilder* _tmp29_;
		GObject* _tmp30_;
		GtkLabel* _tmp31_;
		gchar* upload_label_text = NULL;
		const gchar* _tmp32_;
		gchar* _tmp33_;
		GtkLabel* _tmp34_;
		const gchar* _tmp35_;
		GtkComboBoxText* _tmp36_;
		GtkButton* _tmp40_;
		GtkButton* _tmp41_;
		_tmp5_ = gtk_builder_new ();
		_g_object_unref0 (self->priv->builder);
		self->priv->builder = _tmp5_;
		_tmp6_ = self->priv->builder;
		gtk_builder_add_from_resource (_tmp6_, PLUGIN_RESOURCE_PATH "/tumblr_publishing_options_pane.ui", &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp7_ = self->priv->builder;
		gtk_builder_connect_signals (_tmp7_, NULL);
		_tmp8_ = self->priv->builder;
		_tmp9_ = gtk_builder_get_object (_tmp8_, "tumblr_pane");
		_tmp10_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, gtk_box_get_type (), GtkBox));
		_g_object_unref0 (self->priv->pane_widget);
		self->priv->pane_widget = _tmp10_;
		_tmp11_ = self->priv->builder;
		_tmp12_ = gtk_builder_get_object (_tmp11_, "upload_info_label");
		_tmp13_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, gtk_label_get_type (), GtkLabel));
		_g_object_unref0 (self->priv->upload_info_label);
		self->priv->upload_info_label = _tmp13_;
		_tmp14_ = self->priv->builder;
		_tmp15_ = gtk_builder_get_object (_tmp14_, "logout_button");
		_tmp16_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, gtk_button_get_type (), GtkButton));
		_g_object_unref0 (self->priv->logout_button);
		self->priv->logout_button = _tmp16_;
		_tmp17_ = self->priv->builder;
		_tmp18_ = gtk_builder_get_object (_tmp17_, "publish_button");
		_tmp19_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, gtk_button_get_type (), GtkButton));
		_g_object_unref0 (self->priv->publish_button);
		self->priv->publish_button = _tmp19_;
		_tmp20_ = self->priv->builder;
		_tmp21_ = gtk_builder_get_object (_tmp20_, "size_combo");
		_tmp22_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, gtk_combo_box_text_get_type (), GtkComboBoxText));
		_g_object_unref0 (self->priv->size_combo);
		self->priv->size_combo = _tmp22_;
		_tmp23_ = self->priv->builder;
		_tmp24_ = gtk_builder_get_object (_tmp23_, "size_label");
		_tmp25_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp24_, gtk_label_get_type (), GtkLabel));
		_g_object_unref0 (self->priv->size_label);
		self->priv->size_label = _tmp25_;
		_tmp26_ = self->priv->builder;
		_tmp27_ = gtk_builder_get_object (_tmp26_, "blog_combo");
		_tmp28_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp27_, gtk_combo_box_text_get_type (), GtkComboBoxText));
		_g_object_unref0 (self->priv->blog_combo);
		self->priv->blog_combo = _tmp28_;
		_tmp29_ = self->priv->builder;
		_tmp30_ = gtk_builder_get_object (_tmp29_, "blog_label");
		_tmp31_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp30_, gtk_label_get_type (), GtkLabel));
		_g_object_unref0 (self->priv->blog_label);
		self->priv->blog_label = _tmp31_;
		_tmp32_ = self->priv->username;
		_tmp33_ = g_strdup_printf (_ ("You are logged into Tumblr as %s.\n\n"), _tmp32_);
		upload_label_text = _tmp33_;
		_tmp34_ = self->priv->upload_info_label;
		_tmp35_ = upload_label_text;
		gtk_label_set_label (_tmp34_, _tmp35_);
		publishing_tumblr_tumblr_publisher_publishing_options_pane_populate_blog_combo (self);
		_tmp36_ = self->priv->blog_combo;
		g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (_tmp36_, gtk_combo_box_get_type (), GtkComboBox), "changed", (GCallback) _publishing_tumblr_tumblr_publisher_publishing_options_pane_on_blog_changed_gtk_combo_box_changed, self, 0);
		if (media_type != SPIT_PUBLISHING_PUBLISHER_MEDIA_TYPE_VIDEO) {
			GtkComboBoxText* _tmp37_;
			publishing_tumblr_tumblr_publisher_publishing_options_pane_populate_size_combo (self);
			_tmp37_ = self->priv->size_combo;
			g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (_tmp37_, gtk_combo_box_get_type (), GtkComboBox), "changed", (GCallback) _publishing_tumblr_tumblr_publisher_publishing_options_pane_on_size_changed_gtk_combo_box_changed, self, 0);
		} else {
			GtkComboBoxText* _tmp38_;
			GtkLabel* _tmp39_;
			_tmp38_ = self->priv->size_combo;
			gtk_widget_set_sensitive (G_TYPE_CHECK_INSTANCE_CAST (_tmp38_, gtk_widget_get_type (), GtkWidget), FALSE);
			_tmp39_ = self->priv->size_label;
			gtk_widget_set_sensitive (G_TYPE_CHECK_INSTANCE_CAST (_tmp39_, gtk_widget_get_type (), GtkWidget), FALSE);
		}
		_tmp40_ = self->priv->logout_button;
		g_signal_connect_object (_tmp40_, "clicked", (GCallback) _publishing_tumblr_tumblr_publisher_publishing_options_pane_on_logout_clicked_gtk_button_clicked, self, 0);
		_tmp41_ = self->priv->publish_button;
		g_signal_connect_object (_tmp41_, "clicked", (GCallback) _publishing_tumblr_tumblr_publisher_publishing_options_pane_on_publish_clicked_gtk_button_clicked, self, 0);
		_g_free0 (upload_label_text);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp42_;
		const gchar* _tmp43_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp42_ = e;
		_tmp43_ = _tmp42_->message;
		g_warning (_ ("Could not load UI: %s"), _tmp43_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
	return self;
}

PublishingTumblrTumblrPublisherPublishingOptionsPane*
publishing_tumblr_tumblr_publisher_publishing_options_pane_new (PublishingTumblrTumblrPublisher* publisher,
                                                                SpitPublishingPublisherMediaType media_type,
                                                                PublishingTumblrSizeEntry** sizes,
                                                                gint sizes_length1,
                                                                PublishingTumblrBlogEntry** blogs,
                                                                gint blogs_length1,
                                                                const gchar* username)
{
	return publishing_tumblr_tumblr_publisher_publishing_options_pane_construct (PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE, publisher, media_type, sizes, sizes_length1, blogs, blogs_length1, username);
}

static void
publishing_tumblr_tumblr_publisher_publishing_options_pane_on_logout_clicked (PublishingTumblrTumblrPublisherPublishingOptionsPane* self)
{
	g_return_if_fail (PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_IS_PUBLISHING_OPTIONS_PANE (self));
	g_signal_emit (self, publishing_tumblr_tumblr_publisher_publishing_options_pane_signals[PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_PUBLISHING_OPTIONS_PANE_LOGOUT_SIGNAL], 0);
}

static void
publishing_tumblr_tumblr_publisher_publishing_options_pane_on_publish_clicked (PublishingTumblrTumblrPublisherPublishingOptionsPane* self)
{
	g_return_if_fail (PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_IS_PUBLISHING_OPTIONS_PANE (self));
	g_signal_emit (self, publishing_tumblr_tumblr_publisher_publishing_options_pane_signals[PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_PUBLISHING_OPTIONS_PANE_PUBLISH_SIGNAL], 0);
}

static void
publishing_tumblr_tumblr_publisher_publishing_options_pane_populate_blog_combo (PublishingTumblrTumblrPublisherPublishingOptionsPane* self)
{
	PublishingTumblrBlogEntry** _tmp0_;
	gint _tmp0__length1;
	g_return_if_fail (PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_IS_PUBLISHING_OPTIONS_PANE (self));
	_tmp0_ = self->priv->blogs;
	_tmp0__length1 = self->priv->blogs_length1;
	if (_tmp0_ != NULL) {
		PublishingTumblrBlogEntry** _tmp1_;
		gint _tmp1__length1;
		GtkComboBoxText* _tmp6_;
		PublishingTumblrTumblrPublisher* _tmp7_;
		_tmp1_ = self->priv->blogs;
		_tmp1__length1 = self->priv->blogs_length1;
		{
			PublishingTumblrBlogEntry** b_collection = NULL;
			gint b_collection_length1 = 0;
			gint _b_collection_size_ = 0;
			gint b_it = 0;
			b_collection = _tmp1_;
			b_collection_length1 = _tmp1__length1;
			for (b_it = 0; b_it < b_collection_length1; b_it = b_it + 1) {
				PublishingTumblrBlogEntry* _tmp2_;
				PublishingTumblrBlogEntry* b = NULL;
				_tmp2_ = _publishing_tumblr_blog_entry_ref0 (b_collection[b_it]);
				b = _tmp2_;
				{
					GtkComboBoxText* _tmp3_;
					PublishingTumblrBlogEntry* _tmp4_;
					const gchar* _tmp5_;
					_tmp3_ = self->priv->blog_combo;
					_tmp4_ = b;
					_tmp5_ = _tmp4_->blog;
					gtk_combo_box_text_append_text (_tmp3_, _tmp5_);
					_publishing_tumblr_blog_entry_unref0 (b);
				}
			}
		}
		_tmp6_ = self->priv->blog_combo;
		_tmp7_ = self->priv->publisher;
		gtk_combo_box_set_active (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, gtk_combo_box_get_type (), GtkComboBox), publishing_tumblr_tumblr_publisher_get_persistent_default_blog (_tmp7_));
	}
}

static void
publishing_tumblr_tumblr_publisher_publishing_options_pane_on_blog_changed (PublishingTumblrTumblrPublisherPublishingOptionsPane* self)
{
	PublishingTumblrTumblrPublisher* _tmp0_;
	GtkComboBoxText* _tmp1_;
	g_return_if_fail (PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_IS_PUBLISHING_OPTIONS_PANE (self));
	_tmp0_ = self->priv->publisher;
	_tmp1_ = self->priv->blog_combo;
	publishing_tumblr_tumblr_publisher_set_persistent_default_blog (_tmp0_, gtk_combo_box_get_active (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_combo_box_get_type (), GtkComboBox)));
}

static void
publishing_tumblr_tumblr_publisher_publishing_options_pane_populate_size_combo (PublishingTumblrTumblrPublisherPublishingOptionsPane* self)
{
	PublishingTumblrSizeEntry** _tmp0_;
	gint _tmp0__length1;
	g_return_if_fail (PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_IS_PUBLISHING_OPTIONS_PANE (self));
	_tmp0_ = self->priv->sizes;
	_tmp0__length1 = self->priv->sizes_length1;
	if (_tmp0_ != NULL) {
		PublishingTumblrSizeEntry** _tmp1_;
		gint _tmp1__length1;
		GtkComboBoxText* _tmp6_;
		PublishingTumblrTumblrPublisher* _tmp7_;
		_tmp1_ = self->priv->sizes;
		_tmp1__length1 = self->priv->sizes_length1;
		{
			PublishingTumblrSizeEntry** e_collection = NULL;
			gint e_collection_length1 = 0;
			gint _e_collection_size_ = 0;
			gint e_it = 0;
			e_collection = _tmp1_;
			e_collection_length1 = _tmp1__length1;
			for (e_it = 0; e_it < e_collection_length1; e_it = e_it + 1) {
				PublishingTumblrSizeEntry* _tmp2_;
				PublishingTumblrSizeEntry* e = NULL;
				_tmp2_ = _publishing_tumblr_size_entry_ref0 (e_collection[e_it]);
				e = _tmp2_;
				{
					GtkComboBoxText* _tmp3_;
					PublishingTumblrSizeEntry* _tmp4_;
					const gchar* _tmp5_;
					_tmp3_ = self->priv->size_combo;
					_tmp4_ = e;
					_tmp5_ = _tmp4_->title;
					gtk_combo_box_text_append_text (_tmp3_, _tmp5_);
					_publishing_tumblr_size_entry_unref0 (e);
				}
			}
		}
		_tmp6_ = self->priv->size_combo;
		_tmp7_ = self->priv->publisher;
		gtk_combo_box_set_active (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, gtk_combo_box_get_type (), GtkComboBox), publishing_tumblr_tumblr_publisher_get_persistent_default_size (_tmp7_));
	}
}

static void
publishing_tumblr_tumblr_publisher_publishing_options_pane_on_size_changed (PublishingTumblrTumblrPublisherPublishingOptionsPane* self)
{
	PublishingTumblrTumblrPublisher* _tmp0_;
	GtkComboBoxText* _tmp1_;
	g_return_if_fail (PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_IS_PUBLISHING_OPTIONS_PANE (self));
	_tmp0_ = self->priv->publisher;
	_tmp1_ = self->priv->size_combo;
	publishing_tumblr_tumblr_publisher_set_persistent_default_size (_tmp0_, gtk_combo_box_get_active (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_combo_box_get_type (), GtkComboBox)));
}

void
publishing_tumblr_tumblr_publisher_publishing_options_pane_notify_publish (PublishingTumblrTumblrPublisherPublishingOptionsPane* self)
{
	g_return_if_fail (PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_IS_PUBLISHING_OPTIONS_PANE (self));
	g_signal_emit (self, publishing_tumblr_tumblr_publisher_publishing_options_pane_signals[PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_PUBLISHING_OPTIONS_PANE_PUBLISH_SIGNAL], 0);
}

void
publishing_tumblr_tumblr_publisher_publishing_options_pane_notify_logout (PublishingTumblrTumblrPublisherPublishingOptionsPane* self)
{
	g_return_if_fail (PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_IS_PUBLISHING_OPTIONS_PANE (self));
	g_signal_emit (self, publishing_tumblr_tumblr_publisher_publishing_options_pane_signals[PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_PUBLISHING_OPTIONS_PANE_LOGOUT_SIGNAL], 0);
}

static GtkWidget*
publishing_tumblr_tumblr_publisher_publishing_options_pane_real_get_widget (SpitPublishingDialogPane* base)
{
	PublishingTumblrTumblrPublisherPublishingOptionsPane * self;
	GtkBox* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE, PublishingTumblrTumblrPublisherPublishingOptionsPane);
	_tmp0_ = self->priv->pane_widget;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gtk_widget_get_type (), GtkWidget));
	result = _tmp1_;
	return result;
}

static SpitPublishingDialogPaneGeometryOptions
publishing_tumblr_tumblr_publisher_publishing_options_pane_real_get_preferred_geometry (SpitPublishingDialogPane* base)
{
	PublishingTumblrTumblrPublisherPublishingOptionsPane * self;
	SpitPublishingDialogPaneGeometryOptions result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE, PublishingTumblrTumblrPublisherPublishingOptionsPane);
	result = SPIT_PUBLISHING_DIALOG_PANE_GEOMETRY_OPTIONS_NONE;
	return result;
}

static void
_publishing_tumblr_tumblr_publisher_publishing_options_pane_notify_publish_publishing_tumblr_tumblr_publisher_publishing_options_pane_publish (PublishingTumblrTumblrPublisherPublishingOptionsPane* _sender,
                                                                                                                                               gpointer self)
{
	publishing_tumblr_tumblr_publisher_publishing_options_pane_notify_publish ((PublishingTumblrTumblrPublisherPublishingOptionsPane*) self);
}

static void
_publishing_tumblr_tumblr_publisher_publishing_options_pane_notify_logout_publishing_tumblr_tumblr_publisher_publishing_options_pane_logout (PublishingTumblrTumblrPublisherPublishingOptionsPane* _sender,
                                                                                                                                             gpointer self)
{
	publishing_tumblr_tumblr_publisher_publishing_options_pane_notify_logout ((PublishingTumblrTumblrPublisherPublishingOptionsPane*) self);
}

static void
publishing_tumblr_tumblr_publisher_publishing_options_pane_real_on_pane_installed (SpitPublishingDialogPane* base)
{
	PublishingTumblrTumblrPublisherPublishingOptionsPane * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE, PublishingTumblrTumblrPublisherPublishingOptionsPane);
	g_signal_connect_object (self, "publish", (GCallback) _publishing_tumblr_tumblr_publisher_publishing_options_pane_notify_publish_publishing_tumblr_tumblr_publisher_publishing_options_pane_publish, self, 0);
	g_signal_connect_object (self, "logout", (GCallback) _publishing_tumblr_tumblr_publisher_publishing_options_pane_notify_logout_publishing_tumblr_tumblr_publisher_publishing_options_pane_logout, self, 0);
}

static void
publishing_tumblr_tumblr_publisher_publishing_options_pane_real_on_pane_uninstalled (SpitPublishingDialogPane* base)
{
	PublishingTumblrTumblrPublisherPublishingOptionsPane * self;
	guint _tmp0_;
	guint _tmp1_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE, PublishingTumblrTumblrPublisherPublishingOptionsPane);
	g_signal_parse_name ("publish", PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE, &_tmp0_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _publishing_tumblr_tumblr_publisher_publishing_options_pane_notify_publish_publishing_tumblr_tumblr_publisher_publishing_options_pane_publish, self);
	g_signal_parse_name ("logout", PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE, &_tmp1_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _publishing_tumblr_tumblr_publisher_publishing_options_pane_notify_logout_publishing_tumblr_tumblr_publisher_publishing_options_pane_logout, self);
}

static void
publishing_tumblr_tumblr_publisher_publishing_options_pane_class_init (PublishingTumblrTumblrPublisherPublishingOptionsPaneClass * klass,
                                                                       gpointer klass_data)
{
	publishing_tumblr_tumblr_publisher_publishing_options_pane_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PublishingTumblrTumblrPublisherPublishingOptionsPane_private_offset);
	G_OBJECT_CLASS (klass)->finalize = publishing_tumblr_tumblr_publisher_publishing_options_pane_finalize;
	publishing_tumblr_tumblr_publisher_publishing_options_pane_signals[PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_PUBLISHING_OPTIONS_PANE_PUBLISH_SIGNAL] = g_signal_new ("publish", PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	publishing_tumblr_tumblr_publisher_publishing_options_pane_signals[PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_PUBLISHING_OPTIONS_PANE_LOGOUT_SIGNAL] = g_signal_new ("logout", PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
publishing_tumblr_tumblr_publisher_publishing_options_pane_spit_publishing_dialog_pane_interface_init (SpitPublishingDialogPaneIface * iface,
                                                                                                       gpointer iface_data)
{
	publishing_tumblr_tumblr_publisher_publishing_options_pane_spit_publishing_dialog_pane_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_widget = (GtkWidget* (*) (SpitPublishingDialogPane*)) publishing_tumblr_tumblr_publisher_publishing_options_pane_real_get_widget;
	iface->get_preferred_geometry = (SpitPublishingDialogPaneGeometryOptions (*) (SpitPublishingDialogPane*)) publishing_tumblr_tumblr_publisher_publishing_options_pane_real_get_preferred_geometry;
	iface->on_pane_installed = (void (*) (SpitPublishingDialogPane*)) publishing_tumblr_tumblr_publisher_publishing_options_pane_real_on_pane_installed;
	iface->on_pane_uninstalled = (void (*) (SpitPublishingDialogPane*)) publishing_tumblr_tumblr_publisher_publishing_options_pane_real_on_pane_uninstalled;
}

static void
publishing_tumblr_tumblr_publisher_publishing_options_pane_instance_init (PublishingTumblrTumblrPublisherPublishingOptionsPane * self,
                                                                          gpointer klass)
{
	gchar* _tmp0_;
	self->priv = publishing_tumblr_tumblr_publisher_publishing_options_pane_get_instance_private (self);
	self->priv->pane_widget = NULL;
	self->priv->upload_info_label = NULL;
	self->priv->size_label = NULL;
	self->priv->blog_label = NULL;
	self->priv->logout_button = NULL;
	self->priv->publish_button = NULL;
	self->priv->size_combo = NULL;
	self->priv->blog_combo = NULL;
	self->priv->sizes = NULL;
	self->priv->sizes_length1 = 0;
	self->priv->_sizes_size_ = self->priv->sizes_length1;
	self->priv->blogs = NULL;
	self->priv->blogs_length1 = 0;
	self->priv->_blogs_size_ = self->priv->blogs_length1;
	_tmp0_ = g_strdup ("");
	self->priv->username = _tmp0_;
	self->priv->publisher = NULL;
}

static void
publishing_tumblr_tumblr_publisher_publishing_options_pane_finalize (GObject * obj)
{
	PublishingTumblrTumblrPublisherPublishingOptionsPane * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_PUBLISHING_OPTIONS_PANE, PublishingTumblrTumblrPublisherPublishingOptionsPane);
	_g_object_unref0 (self->priv->builder);
	_g_object_unref0 (self->priv->pane_widget);
	_g_object_unref0 (self->priv->upload_info_label);
	_g_object_unref0 (self->priv->size_label);
	_g_object_unref0 (self->priv->blog_label);
	_g_object_unref0 (self->priv->logout_button);
	_g_object_unref0 (self->priv->publish_button);
	_g_object_unref0 (self->priv->size_combo);
	_g_object_unref0 (self->priv->blog_combo);
	self->priv->sizes = (_vala_array_free (self->priv->sizes, self->priv->sizes_length1, (GDestroyNotify) publishing_tumblr_size_entry_unref), NULL);
	self->priv->blogs = (_vala_array_free (self->priv->blogs, self->priv->blogs_length1, (GDestroyNotify) publishing_tumblr_blog_entry_unref), NULL);
	_g_free0 (self->priv->username);
	_g_object_unref0 (self->priv->publisher);
	G_OBJECT_CLASS (publishing_tumblr_tumblr_publisher_publishing_options_pane_parent_class)->finalize (obj);
}

/**
         * The publishing options pane.
         */
static GType
publishing_tumblr_tumblr_publisher_publishing_options_pane_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PublishingTumblrTumblrPublisherPublishingOptionsPaneClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) publishing_tumblr_tumblr_publisher_publishing_options_pane_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PublishingTumblrTumblrPublisherPublishingOptionsPane), 0, (GInstanceInitFunc) publishing_tumblr_tumblr_publisher_publishing_options_pane_instance_init, NULL };
	static const GInterfaceInfo spit_publishing_dialog_pane_info = { (GInterfaceInitFunc) publishing_tumblr_tumblr_publisher_publishing_options_pane_spit_publishing_dialog_pane_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType publishing_tumblr_tumblr_publisher_publishing_options_pane_type_id;
	publishing_tumblr_tumblr_publisher_publishing_options_pane_type_id = g_type_register_static (G_TYPE_OBJECT, "PublishingTumblrTumblrPublisherPublishingOptionsPane", &g_define_type_info, 0);
	g_type_add_interface_static (publishing_tumblr_tumblr_publisher_publishing_options_pane_type_id, SPIT_PUBLISHING_TYPE_DIALOG_PANE, &spit_publishing_dialog_pane_info);
	PublishingTumblrTumblrPublisherPublishingOptionsPane_private_offset = g_type_add_instance_private (publishing_tumblr_tumblr_publisher_publishing_options_pane_type_id, sizeof (PublishingTumblrTumblrPublisherPublishingOptionsPanePrivate));
	return publishing_tumblr_tumblr_publisher_publishing_options_pane_type_id;
}

GType
publishing_tumblr_tumblr_publisher_publishing_options_pane_get_type (void)
{
	static volatile gsize publishing_tumblr_tumblr_publisher_publishing_options_pane_type_id__once = 0;
	if (g_once_init_enter (&publishing_tumblr_tumblr_publisher_publishing_options_pane_type_id__once)) {
		GType publishing_tumblr_tumblr_publisher_publishing_options_pane_type_id;
		publishing_tumblr_tumblr_publisher_publishing_options_pane_type_id = publishing_tumblr_tumblr_publisher_publishing_options_pane_get_type_once ();
		g_once_init_leave (&publishing_tumblr_tumblr_publisher_publishing_options_pane_type_id__once, publishing_tumblr_tumblr_publisher_publishing_options_pane_type_id);
	}
	return publishing_tumblr_tumblr_publisher_publishing_options_pane_type_id__once;
}

PublishingTumblrTumblrPublisherUserInfoFetchTransaction*
publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_construct (GType object_type,
                                                                          PublishingRESTSupportOAuth1Session* session)
{
	PublishingTumblrTumblrPublisherUserInfoFetchTransaction* self = NULL;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (session, PUBLISHING_REST_SUPPORT_OAUTH1_TYPE_SESSION), NULL);
	self = (PublishingTumblrTumblrPublisherUserInfoFetchTransaction*) publishing_rest_support_oauth1_transaction_construct_with_uri (object_type, session, "https://api.tumblr.com/v2/user/info", PUBLISHING_REST_SUPPORT_HTTP_METHOD_POST);
	return self;
}

PublishingTumblrTumblrPublisherUserInfoFetchTransaction*
publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_new (PublishingRESTSupportOAuth1Session* session)
{
	return publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_construct (PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_USER_INFO_FETCH_TRANSACTION, session);
}

static void
publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_class_init (PublishingTumblrTumblrPublisherUserInfoFetchTransactionClass * klass,
                                                                           gpointer klass_data)
{
	publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_parent_class = g_type_class_peek_parent (klass);
}

static void
publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_instance_init (PublishingTumblrTumblrPublisherUserInfoFetchTransaction * self,
                                                                              gpointer klass)
{
}

static GType
publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PublishingTumblrTumblrPublisherUserInfoFetchTransactionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PublishingTumblrTumblrPublisherUserInfoFetchTransaction), 0, (GInstanceInitFunc) publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_instance_init, NULL };
	GType publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_type_id;
	publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_type_id = g_type_register_static (PUBLISHING_REST_SUPPORT_OAUTH1_TYPE_TRANSACTION, "PublishingTumblrTumblrPublisherUserInfoFetchTransaction", &g_define_type_info, 0);
	return publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_type_id;
}

GType
publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_get_type (void)
{
	static volatile gsize publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_type_id__once = 0;
	if (g_once_init_enter (&publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_type_id__once)) {
		GType publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_type_id;
		publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_type_id = publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_get_type_once ();
		g_once_init_leave (&publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_type_id__once, publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_type_id);
	}
	return publishing_tumblr_tumblr_publisher_user_info_fetch_transaction_type_id__once;
}

PublishingTumblrTumblrPublisherUploadTransaction*
publishing_tumblr_tumblr_publisher_upload_transaction_construct (GType object_type,
                                                                 PublishingRESTSupportOAuth1Session* session,
                                                                 SpitPublishingPublishable* publishable,
                                                                 const gchar* blog_url)
{
	PublishingTumblrTumblrPublisherUploadTransaction* self = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (session, PUBLISHING_REST_SUPPORT_OAUTH1_TYPE_SESSION), NULL);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (publishable, SPIT_PUBLISHING_TYPE_PUBLISHABLE), NULL);
	g_return_val_if_fail (blog_url != NULL, NULL);
	g_debug ("TumblrPublishing.vala:544: Init upload transaction");
	_tmp0_ = g_strdup_printf ("https://api.tumblr.com/v2/blog/%s/post", blog_url);
	_tmp1_ = _tmp0_;
	self = (PublishingTumblrTumblrPublisherUploadTransaction*) publishing_rest_support_oauth1_upload_transaction_construct (object_type, session, publishable, _tmp1_);
	_g_free0 (_tmp1_);
	return self;
}

PublishingTumblrTumblrPublisherUploadTransaction*
publishing_tumblr_tumblr_publisher_upload_transaction_new (PublishingRESTSupportOAuth1Session* session,
                                                           SpitPublishingPublishable* publishable,
                                                           const gchar* blog_url)
{
	return publishing_tumblr_tumblr_publisher_upload_transaction_construct (PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_UPLOAD_TRANSACTION, session, publishable, blog_url);
}

static void
publishing_tumblr_tumblr_publisher_upload_transaction_real_execute_async_data_free (gpointer _data)
{
	PublishingTumblrTumblrPublisherUploadTransactionExecuteAsyncData* _data_;
	_data_ = _data;
	_publishing_rest_support_transaction_unref0 (_data_->self);
	g_slice_free (PublishingTumblrTumblrPublisherUploadTransactionExecuteAsyncData, _data_);
}

static gpointer
_publishing_rest_support_transaction_ref0 (gpointer self)
{
	return self ? publishing_rest_support_transaction_ref (self) : NULL;
}

static void
publishing_tumblr_tumblr_publisher_upload_transaction_real_execute_async (PublishingRESTSupportTransaction* base,
                                                                          GAsyncReadyCallback _callback_,
                                                                          gpointer _user_data_)
{
	PublishingTumblrTumblrPublisherUploadTransaction * self;
	PublishingTumblrTumblrPublisherUploadTransactionExecuteAsyncData* _data_;
	PublishingTumblrTumblrPublisherUploadTransaction* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_UPLOAD_TRANSACTION, PublishingTumblrTumblrPublisherUploadTransaction);
	_data_ = g_slice_new0 (PublishingTumblrTumblrPublisherUploadTransactionExecuteAsyncData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, publishing_tumblr_tumblr_publisher_upload_transaction_real_execute_async_data_free);
	_tmp0_ = _publishing_rest_support_transaction_ref0 (self);
	_data_->self = _tmp0_;
	publishing_tumblr_tumblr_publisher_upload_transaction_real_execute_async_co (_data_);
}

static void
publishing_tumblr_tumblr_publisher_upload_transaction_execute_finish (PublishingRESTSupportTransaction* base,
                                                                      GAsyncResult* _res_,
                                                                      GError** error)
{
	PublishingTumblrTumblrPublisherUploadTransactionExecuteAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static guint8*
string_get_data (const gchar* self,
                 gint* result_length1)
{
	guint8* result;
	guint8* res = NULL;
	gint res_length1;
	gint _res_size_;
	gint _tmp0_;
	gint _tmp1_;
	guint8* _tmp2_;
	gint _tmp2__length1;
	g_return_val_if_fail (self != NULL, NULL);
	res = (guint8*) self;
	res_length1 = -1;
	_res_size_ = res_length1;
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	res_length1 = (gint) _tmp1_;
	_tmp2_ = res;
	_tmp2__length1 = res_length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

static gchar*
_vala_g_strjoinv (const gchar* separator,
                  gchar** str_array,
                  gint str_array_length1)
{
	gboolean _tmp0_ = FALSE;
	gchar* result;
	if (separator == NULL) {
		separator = "";
	}
	if (str_array != NULL) {
		gboolean _tmp1_ = FALSE;
		if (str_array_length1 > 0) {
			_tmp1_ = TRUE;
		} else {
			gboolean _tmp2_ = FALSE;
			if (str_array_length1 == -1) {
				const gchar* _tmp3_;
				_tmp3_ = str_array[0];
				_tmp2_ = _tmp3_ != NULL;
			} else {
				_tmp2_ = FALSE;
			}
			_tmp1_ = _tmp2_;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp16_;
		gint _tmp17_;
		const gchar* res = NULL;
		void* _tmp18_;
		const gchar* _tmp19_ = NULL;
		const gchar* _tmp20_;
		void* ptr = NULL;
		const gchar* _tmp22_;
		void* _tmp23_;
		const gchar* _tmp33_;
		len = (gsize) 1;
		{
			gboolean _tmp4_ = FALSE;
			i = 0;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp6_ = FALSE;
				gboolean _tmp7_ = FALSE;
				gint _tmp10_ = 0;
				const gchar* _tmp11_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				if (str_array_length1 != -1) {
					_tmp7_ = i < str_array_length1;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					_tmp6_ = TRUE;
				} else {
					gboolean _tmp8_ = FALSE;
					if (str_array_length1 == -1) {
						const gchar* _tmp9_;
						_tmp9_ = str_array[i];
						_tmp8_ = _tmp9_ != NULL;
					} else {
						_tmp8_ = FALSE;
					}
					_tmp6_ = _tmp8_;
				}
				if (!_tmp6_) {
					break;
				}
				_tmp11_ = str_array[i];
				if (_tmp11_ != NULL) {
					const gchar* _tmp12_;
					gint _tmp13_;
					gint _tmp14_;
					_tmp12_ = str_array[i];
					_tmp13_ = strlen ((const gchar*) _tmp12_);
					_tmp14_ = _tmp13_;
					_tmp10_ = _tmp14_;
				} else {
					_tmp10_ = 0;
				}
				len += (gsize) _tmp10_;
			}
		}
		if (i == 0) {
			gchar* _tmp15_;
			_tmp15_ = g_strdup ("");
			result = _tmp15_;
			return result;
		}
		str_array_length1 = i;
		_tmp16_ = strlen ((const gchar*) separator);
		_tmp17_ = _tmp16_;
		len += (gsize) (_tmp17_ * (i - 1));
		_tmp18_ = g_malloc (len);
		res = _tmp18_;
		_tmp20_ = str_array[0];
		if (_tmp20_ != NULL) {
			const gchar* _tmp21_;
			_tmp21_ = str_array[0];
			_tmp19_ = (const gchar*) _tmp21_;
		} else {
			_tmp19_ = "";
		}
		_tmp22_ = res;
		_tmp23_ = g_stpcpy ((void*) _tmp22_, _tmp19_);
		ptr = _tmp23_;
		{
			gboolean _tmp24_ = FALSE;
			i = 1;
			_tmp24_ = TRUE;
			while (TRUE) {
				void* _tmp26_;
				void* _tmp27_;
				const gchar* _tmp28_ = NULL;
				const gchar* _tmp29_;
				void* _tmp31_;
				void* _tmp32_;
				if (!_tmp24_) {
					gint _tmp25_;
					_tmp25_ = i;
					i = _tmp25_ + 1;
				}
				_tmp24_ = FALSE;
				if (!(i < str_array_length1)) {
					break;
				}
				_tmp26_ = ptr;
				_tmp27_ = g_stpcpy (_tmp26_, (const gchar*) separator);
				ptr = _tmp27_;
				_tmp29_ = str_array[i];
				if (_tmp29_ != NULL) {
					const gchar* _tmp30_;
					_tmp30_ = str_array[i];
					_tmp28_ = (const gchar*) _tmp30_;
				} else {
					_tmp28_ = "";
				}
				_tmp31_ = ptr;
				_tmp32_ = g_stpcpy (_tmp31_, _tmp28_);
				ptr = _tmp32_;
			}
		}
		_tmp33_ = res;
		res = NULL;
		result = (gchar*) _tmp33_;
		return result;
	} else {
		gchar* _tmp34_;
		_tmp34_ = g_strdup ("");
		result = _tmp34_;
		return result;
	}
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static gpointer
_publishing_rest_support_argument_ref0 (gpointer self)
{
	return self ? publishing_rest_support_argument_ref (self) : NULL;
}

static gint
_vala_g_bytes_get_length (GBytes* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = (gint) g_bytes_get_size (self);
	return result;
}

static void
publishing_tumblr_tumblr_publisher_upload_transaction_execute_async_ready (GObject* source_object,
                                                                           GAsyncResult* _res_,
                                                                           gpointer _user_data_)
{
	PublishingTumblrTumblrPublisherUploadTransactionExecuteAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	publishing_tumblr_tumblr_publisher_upload_transaction_real_execute_async_co (_data_);
}

static gboolean
publishing_tumblr_tumblr_publisher_upload_transaction_real_execute_async_co (PublishingTumblrTumblrPublisherUploadTransactionExecuteAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, PUBLISHING_REST_SUPPORT_OAUTH1_TYPE_UPLOAD_TRANSACTION, PublishingRESTSupportOAuth1UploadTransaction), PUBLISHING_REST_SUPPORT_TYPE_UPLOAD_TRANSACTION, PublishingRESTSupportUploadTransaction)->publishable;
		_data_->_tmp1_ = spit_publishing_publishable_get_serialized_file (_data_->_tmp0_);
		_data_->_tmp2_ = _data_->_tmp1_;
		_data_->_tmp3_ = g_file_get_path (_data_->_tmp2_);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_tmp5_ = NULL;
		_data_->_tmp6_ = 0UL;
		g_file_get_contents (_data_->_tmp4_, &_data_->_tmp5_, &_data_->_tmp6_, &_data_->_inner_error0_);
		_g_free0 (_data_->payload);
		_data_->payload = _data_->_tmp5_;
		_data_->payload_length = _data_->_tmp6_;
		_g_free0 (_data_->_tmp4_);
		_g_object_unref0 (_data_->_tmp2_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			if (_data_->_inner_error0_->domain == G_FILE_ERROR) {
				goto __catch0_g_file_error;
			}
			_g_free0 (_data_->payload);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp7_ = _data_->payload;
		_data_->_tmp9_ = 0;
		_data_->_tmp8_ = string_get_data (_data_->_tmp7_, &_data_->_tmp9_);
		_data_->_tmp8__length1 = _data_->_tmp9_;
		_data_->_tmp10_ = _data_->_tmp8_;
		_data_->_tmp10__length1 = _data_->_tmp8__length1;
		_data_->_tmp11_ = g_base64_encode (_data_->_tmp10_ + 0, (gint) (((gint) _data_->payload_length) - 0));
		_data_->_tmp12_ = _data_->_tmp11_;
		publishing_rest_support_transaction_add_argument (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), "data64", _data_->_tmp12_);
		_g_free0 (_data_->_tmp12_);
		publishing_rest_support_transaction_add_argument (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), "type", "photo");
		_data_->_tmp13_ = G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, PUBLISHING_REST_SUPPORT_OAUTH1_TYPE_UPLOAD_TRANSACTION, PublishingRESTSupportOAuth1UploadTransaction), PUBLISHING_REST_SUPPORT_TYPE_UPLOAD_TRANSACTION, PublishingRESTSupportUploadTransaction)->publishable;
		_data_->_tmp14_ = 0;
		_data_->_tmp15_ = spit_publishing_publishable_get_publishing_keywords (_data_->_tmp13_, &_data_->_tmp14_);
		_data_->keywords = _data_->_tmp15_;
		_data_->keywords_length1 = _data_->_tmp14_;
		_data_->_keywords_size_ = _data_->keywords_length1;
		_data_->_tmp16_ = g_strdup ("");
		_data_->tags = _data_->_tmp16_;
		_data_->_tmp17_ = _data_->keywords;
		_data_->_tmp17__length1 = _data_->keywords_length1;
		if (_data_->_tmp17_ != NULL) {
			_data_->_tmp18_ = _data_->keywords;
			_data_->_tmp18__length1 = _data_->keywords_length1;
			_data_->_tmp19_ = _vala_g_strjoinv (",", _data_->_tmp18_, (gint) _data_->_tmp18__length1);
			_g_free0 (_data_->tags);
			_data_->tags = _data_->_tmp19_;
		}
		_data_->_tmp20_ = _data_->tags;
		publishing_rest_support_transaction_add_argument (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), "tags", _data_->_tmp20_);
		_g_free0 (_data_->tags);
		_data_->keywords = (_vala_array_free (_data_->keywords, _data_->keywords_length1, (GDestroyNotify) g_free), NULL);
	}
	goto __finally0;
	__catch0_g_file_error:
	{
		g_clear_error (&_data_->_inner_error0_);
		_data_->_tmp21_ = g_error_new_literal (SPIT_PUBLISHING_PUBLISHING_ERROR, SPIT_PUBLISHING_PUBLISHING_ERROR_LOCAL_FILE_ERROR, _ ("A temporary file needed for publishing is unavailable"));
		_data_->_inner_error0_ = _data_->_tmp21_;
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		if (_data_->_inner_error0_->domain == SPIT_PUBLISHING_PUBLISHING_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_free0 (_data_->payload);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_free0 (_data_->payload);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	publishing_rest_support_oauth1_upload_transaction_authorize (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, PUBLISHING_REST_SUPPORT_OAUTH1_TYPE_UPLOAD_TRANSACTION, PublishingRESTSupportOAuth1UploadTransaction));
	_data_->_tmp22_ = g_str_hash;
	_data_->_tmp23_ = g_str_equal;
	_data_->_tmp24_ = g_hash_table_new_full (_data_->_tmp22_, _data_->_tmp23_, _g_free0_, _g_free0_);
	_data_->form = _data_->_tmp24_;
	_data_->_tmp25_ = 0;
	_data_->_tmp26_ = publishing_rest_support_transaction_get_arguments (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), &_data_->_tmp25_);
	{
		_data_->arg_collection_length1 = 0;
		_data_->_arg_collection_size_ = 0;
		_data_->arg_collection = _data_->_tmp26_;
		_data_->arg_collection_length1 = _data_->_tmp25_;
		for (_data_->arg_it = 0; _data_->arg_it < _data_->arg_collection_length1; _data_->arg_it = _data_->arg_it + 1) {
			_data_->_tmp27_ = _publishing_rest_support_argument_ref0 (_data_->arg_collection[_data_->arg_it]);
			_data_->arg = _data_->_tmp27_;
			{
				_data_->_tmp28_ = _data_->form;
				_data_->_tmp29_ = _data_->arg;
				_data_->_tmp30_ = _data_->_tmp29_->key;
				_data_->_tmp31_ = g_strdup (_data_->_tmp30_);
				_data_->_tmp32_ = _data_->arg;
				_data_->_tmp33_ = _data_->_tmp32_->value;
				_data_->_tmp34_ = g_strdup (_data_->_tmp33_);
				g_hash_table_insert (_data_->_tmp28_, _data_->_tmp31_, _data_->_tmp34_);
				_publishing_rest_support_argument_unref0 (_data_->arg);
			}
		}
		_data_->arg_collection = (_vala_array_free (_data_->arg_collection, _data_->arg_collection_length1, (GDestroyNotify) publishing_rest_support_argument_unref), NULL);
	}
	_data_->_tmp35_ = _data_->form;
	_vala_assert (g_hash_table_size (_data_->_tmp35_) > ((guint) 0), "form.size() > 0");
	_data_->_tmp36_ = publishing_rest_support_transaction_get_endpoint_url (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction));
	_data_->_tmp37_ = _data_->_tmp36_;
	_data_->_tmp38_ = soup_message_new ("POST", _data_->_tmp37_);
	_data_->_tmp39_ = _data_->_tmp38_;
	_g_free0 (_data_->_tmp37_);
	_data_->outbound_message = _data_->_tmp39_;
	_data_->_tmp40_ = _data_->form;
	_data_->_tmp41_ = soup_form_encode_hash (_data_->_tmp40_);
	_data_->_tmp42_ = _data_->_tmp41_;
	_data_->_tmp44_ = 0;
	_data_->_tmp43_ = string_get_data (_data_->_tmp42_, &_data_->_tmp44_);
	_data_->_tmp43__length1 = _data_->_tmp44_;
	_data_->_tmp45_ = _data_->_tmp43_;
	_data_->_tmp45__length1 = _data_->_tmp43__length1;
	_data_->_tmp46_ = g_bytes_new (_data_->_tmp45_, _data_->_tmp45__length1);
	_data_->_tmp47_ = _data_->_tmp46_;
	_g_free0 (_data_->_tmp42_);
	_data_->body = _data_->_tmp47_;
	_data_->_tmp48_ = _data_->outbound_message;
	_data_->_tmp49_ = _data_->body;
	soup_message_set_request_body_from_bytes (_data_->_tmp48_, SOUP_FORM_MIME_TYPE_URLENCODED, _data_->_tmp49_);
	_data_->_tmp50_ = G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, PUBLISHING_REST_SUPPORT_OAUTH1_TYPE_UPLOAD_TRANSACTION, PublishingRESTSupportOAuth1UploadTransaction), PUBLISHING_REST_SUPPORT_TYPE_UPLOAD_TRANSACTION, PublishingRESTSupportUploadTransaction)->message_headers;
	_data_->_tmp51_ = gee_abstract_map_map_iterator (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp50_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap));
	_data_->i = _data_->_tmp51_;
	_data_->_tmp52_ = _data_->i;
	_data_->cont = gee_map_iterator_next (_data_->_tmp52_);
	while (TRUE) {
		if (!_data_->cont) {
			break;
		}
		_data_->_tmp53_ = _data_->outbound_message;
		_data_->_tmp54_ = soup_message_get_request_headers (_data_->_tmp53_);
		_data_->_tmp55_ = _data_->_tmp54_;
		_data_->_tmp56_ = _data_->i;
		_data_->_tmp57_ = gee_map_iterator_get_key (_data_->_tmp56_);
		_data_->_tmp58_ = (gchar*) _data_->_tmp57_;
		_data_->_tmp59_ = _data_->i;
		_data_->_tmp60_ = gee_map_iterator_get_value (_data_->_tmp59_);
		_data_->_tmp61_ = (gchar*) _data_->_tmp60_;
		soup_message_headers_append (_data_->_tmp55_, _data_->_tmp58_, _data_->_tmp61_);
		_g_free0 (_data_->_tmp61_);
		_g_free0 (_data_->_tmp58_);
		_data_->_tmp62_ = _data_->i;
		_data_->cont = gee_map_iterator_next (_data_->_tmp62_);
	}
	_data_->_tmp63_ = _data_->outbound_message;
	_data_->_tmp64_ = _data_->body;
	_data_->_tmp65_ = _vala_g_bytes_get_length (_data_->_tmp64_);
	_data_->_tmp66_ = _data_->_tmp65_;
	publishing_rest_support_transaction_set_message (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), _data_->_tmp63_, (gulong) _data_->_tmp66_);
	publishing_rest_support_transaction_set_is_executed (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), TRUE);
	_data_->_state_ = 1;
	publishing_rest_support_transaction_send_async (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), publishing_tumblr_tumblr_publisher_upload_transaction_execute_async_ready, _data_);
	return FALSE;
	_state_1:
	publishing_rest_support_transaction_send_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		if (_data_->_inner_error0_->domain == SPIT_PUBLISHING_PUBLISHING_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->i);
			_g_bytes_unref0 (_data_->body);
			_g_object_unref0 (_data_->outbound_message);
			_g_hash_table_unref0 (_data_->form);
			_g_free0 (_data_->payload);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->i);
			_g_bytes_unref0 (_data_->body);
			_g_object_unref0 (_data_->outbound_message);
			_g_hash_table_unref0 (_data_->form);
			_g_free0 (_data_->payload);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_g_object_unref0 (_data_->i);
	_g_bytes_unref0 (_data_->body);
	_g_object_unref0 (_data_->outbound_message);
	_g_hash_table_unref0 (_data_->form);
	_g_free0 (_data_->payload);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
publishing_tumblr_tumblr_publisher_upload_transaction_class_init (PublishingTumblrTumblrPublisherUploadTransactionClass * klass,
                                                                  gpointer klass_data)
{
	publishing_tumblr_tumblr_publisher_upload_transaction_parent_class = g_type_class_peek_parent (klass);
	((PublishingRESTSupportTransactionClass *) klass)->execute_async = (void (*) (PublishingRESTSupportTransaction*, GAsyncReadyCallback, gpointer)) publishing_tumblr_tumblr_publisher_upload_transaction_real_execute_async;
	((PublishingRESTSupportTransactionClass *) klass)->execute_finish = (void (*) (PublishingRESTSupportTransaction*, GAsyncResult*, GError**)) publishing_tumblr_tumblr_publisher_upload_transaction_execute_finish;
}

static void
publishing_tumblr_tumblr_publisher_upload_transaction_instance_init (PublishingTumblrTumblrPublisherUploadTransaction * self,
                                                                     gpointer klass)
{
}

static GType
publishing_tumblr_tumblr_publisher_upload_transaction_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PublishingTumblrTumblrPublisherUploadTransactionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) publishing_tumblr_tumblr_publisher_upload_transaction_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PublishingTumblrTumblrPublisherUploadTransaction), 0, (GInstanceInitFunc) publishing_tumblr_tumblr_publisher_upload_transaction_instance_init, NULL };
	GType publishing_tumblr_tumblr_publisher_upload_transaction_type_id;
	publishing_tumblr_tumblr_publisher_upload_transaction_type_id = g_type_register_static (PUBLISHING_REST_SUPPORT_OAUTH1_TYPE_UPLOAD_TRANSACTION, "PublishingTumblrTumblrPublisherUploadTransaction", &g_define_type_info, 0);
	return publishing_tumblr_tumblr_publisher_upload_transaction_type_id;
}

GType
publishing_tumblr_tumblr_publisher_upload_transaction_get_type (void)
{
	static volatile gsize publishing_tumblr_tumblr_publisher_upload_transaction_type_id__once = 0;
	if (g_once_init_enter (&publishing_tumblr_tumblr_publisher_upload_transaction_type_id__once)) {
		GType publishing_tumblr_tumblr_publisher_upload_transaction_type_id;
		publishing_tumblr_tumblr_publisher_upload_transaction_type_id = publishing_tumblr_tumblr_publisher_upload_transaction_get_type_once ();
		g_once_init_leave (&publishing_tumblr_tumblr_publisher_upload_transaction_type_id__once, publishing_tumblr_tumblr_publisher_upload_transaction_type_id);
	}
	return publishing_tumblr_tumblr_publisher_upload_transaction_type_id__once;
}

static inline gpointer
publishing_tumblr_tumblr_publisher_uploader_get_instance_private (PublishingTumblrTumblrPublisherUploader* self)
{
	return G_STRUCT_MEMBER_P (self, PublishingTumblrTumblrPublisherUploader_private_offset);
}

PublishingTumblrTumblrPublisherUploader*
publishing_tumblr_tumblr_publisher_uploader_construct (GType object_type,
                                                       PublishingRESTSupportOAuth1Session* session,
                                                       SpitPublishingPublishable** publishables,
                                                       gint publishables_length1,
                                                       const gchar* blog_url)
{
	PublishingTumblrTumblrPublisherUploader* self = NULL;
	gchar* _tmp0_;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (session, PUBLISHING_REST_SUPPORT_OAUTH1_TYPE_SESSION), NULL);
	g_return_val_if_fail (blog_url != NULL, NULL);
	self = (PublishingTumblrTumblrPublisherUploader*) publishing_rest_support_batch_uploader_construct (object_type, G_TYPE_CHECK_INSTANCE_CAST (session, PUBLISHING_REST_SUPPORT_TYPE_SESSION, PublishingRESTSupportSession), publishables, (gint) publishables_length1);
	_tmp0_ = g_strdup (blog_url);
	_g_free0 (self->priv->blog_url);
	self->priv->blog_url = _tmp0_;
	return self;
}

PublishingTumblrTumblrPublisherUploader*
publishing_tumblr_tumblr_publisher_uploader_new (PublishingRESTSupportOAuth1Session* session,
                                                 SpitPublishingPublishable** publishables,
                                                 gint publishables_length1,
                                                 const gchar* blog_url)
{
	return publishing_tumblr_tumblr_publisher_uploader_construct (PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_UPLOADER, session, publishables, publishables_length1, blog_url);
}

static PublishingRESTSupportTransaction*
publishing_tumblr_tumblr_publisher_uploader_real_create_transaction (PublishingRESTSupportBatchUploader* base,
                                                                     SpitPublishingPublishable* publishable)
{
	PublishingTumblrTumblrPublisherUploader * self;
	PublishingRESTSupportSession* _tmp0_;
	PublishingRESTSupportOAuth1Session* _tmp1_;
	SpitPublishingPublishable* _tmp2_;
	SpitPublishingPublishable* _tmp3_;
	const gchar* _tmp4_;
	PublishingTumblrTumblrPublisherUploadTransaction* _tmp5_;
	PublishingRESTSupportTransaction* _tmp6_;
	PublishingRESTSupportTransaction* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_UPLOADER, PublishingTumblrTumblrPublisherUploader);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (publishable, SPIT_PUBLISHING_TYPE_PUBLISHABLE), NULL);
	g_debug ("TumblrPublishing.vala:611: Create upload transaction");
	_tmp0_ = publishing_rest_support_batch_uploader_get_session (G_TYPE_CHECK_INSTANCE_CAST (self, PUBLISHING_REST_SUPPORT_TYPE_BATCH_UPLOADER, PublishingRESTSupportBatchUploader));
	_tmp1_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, PUBLISHING_REST_SUPPORT_OAUTH1_TYPE_SESSION, PublishingRESTSupportOAuth1Session);
	_tmp2_ = publishing_rest_support_batch_uploader_get_current_publishable (G_TYPE_CHECK_INSTANCE_CAST (self, PUBLISHING_REST_SUPPORT_TYPE_BATCH_UPLOADER, PublishingRESTSupportBatchUploader));
	_tmp3_ = _tmp2_;
	_tmp4_ = self->priv->blog_url;
	_tmp5_ = publishing_tumblr_tumblr_publisher_upload_transaction_new (_tmp1_, _tmp3_, _tmp4_);
	_tmp6_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction);
	_g_object_unref0 (_tmp3_);
	_publishing_rest_support_session_unref0 (_tmp1_);
	result = _tmp6_;
	return result;
}

static void
publishing_tumblr_tumblr_publisher_uploader_class_init (PublishingTumblrTumblrPublisherUploaderClass * klass,
                                                        gpointer klass_data)
{
	publishing_tumblr_tumblr_publisher_uploader_parent_class = g_type_class_peek_parent (klass);
	((PublishingRESTSupportBatchUploaderClass *) klass)->finalize = publishing_tumblr_tumblr_publisher_uploader_finalize;
	g_type_class_adjust_private_offset (klass, &PublishingTumblrTumblrPublisherUploader_private_offset);
	((PublishingRESTSupportBatchUploaderClass *) klass)->create_transaction = (PublishingRESTSupportTransaction* (*) (PublishingRESTSupportBatchUploader*, SpitPublishingPublishable*)) publishing_tumblr_tumblr_publisher_uploader_real_create_transaction;
}

static void
publishing_tumblr_tumblr_publisher_uploader_instance_init (PublishingTumblrTumblrPublisherUploader * self,
                                                           gpointer klass)
{
	gchar* _tmp0_;
	self->priv = publishing_tumblr_tumblr_publisher_uploader_get_instance_private (self);
	_tmp0_ = g_strdup ("");
	self->priv->blog_url = _tmp0_;
}

static void
publishing_tumblr_tumblr_publisher_uploader_finalize (PublishingRESTSupportBatchUploader * obj)
{
	PublishingTumblrTumblrPublisherUploader * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PUBLISHING_TUMBLR_TUMBLR_PUBLISHER_TYPE_UPLOADER, PublishingTumblrTumblrPublisherUploader);
	_g_free0 (self->priv->blog_url);
	PUBLISHING_REST_SUPPORT_BATCH_UPLOADER_CLASS (publishing_tumblr_tumblr_publisher_uploader_parent_class)->finalize (obj);
}

static GType
publishing_tumblr_tumblr_publisher_uploader_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PublishingTumblrTumblrPublisherUploaderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) publishing_tumblr_tumblr_publisher_uploader_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PublishingTumblrTumblrPublisherUploader), 0, (GInstanceInitFunc) publishing_tumblr_tumblr_publisher_uploader_instance_init, NULL };
	GType publishing_tumblr_tumblr_publisher_uploader_type_id;
	publishing_tumblr_tumblr_publisher_uploader_type_id = g_type_register_static (PUBLISHING_REST_SUPPORT_TYPE_BATCH_UPLOADER, "PublishingTumblrTumblrPublisherUploader", &g_define_type_info, 0);
	PublishingTumblrTumblrPublisherUploader_private_offset = g_type_add_instance_private (publishing_tumblr_tumblr_publisher_uploader_type_id, sizeof (PublishingTumblrTumblrPublisherUploaderPrivate));
	return publishing_tumblr_tumblr_publisher_uploader_type_id;
}

GType
publishing_tumblr_tumblr_publisher_uploader_get_type (void)
{
	static volatile gsize publishing_tumblr_tumblr_publisher_uploader_type_id__once = 0;
	if (g_once_init_enter (&publishing_tumblr_tumblr_publisher_uploader_type_id__once)) {
		GType publishing_tumblr_tumblr_publisher_uploader_type_id;
		publishing_tumblr_tumblr_publisher_uploader_type_id = publishing_tumblr_tumblr_publisher_uploader_get_type_once ();
		g_once_init_leave (&publishing_tumblr_tumblr_publisher_uploader_type_id__once, publishing_tumblr_tumblr_publisher_uploader_type_id);
	}
	return publishing_tumblr_tumblr_publisher_uploader_type_id__once;
}

static void
publishing_tumblr_tumblr_publisher_class_init (PublishingTumblrTumblrPublisherClass * klass,
                                               gpointer klass_data)
{
	publishing_tumblr_tumblr_publisher_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PublishingTumblrTumblrPublisher_private_offset);
	G_OBJECT_CLASS (klass)->finalize = publishing_tumblr_tumblr_publisher_finalize;
}

static void
publishing_tumblr_tumblr_publisher_spit_publishing_publisher_interface_init (SpitPublishingPublisherIface * iface,
                                                                             gpointer iface_data)
{
	publishing_tumblr_tumblr_publisher_spit_publishing_publisher_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_service = (SpitPublishingService* (*) (SpitPublishingPublisher*)) publishing_tumblr_tumblr_publisher_real_get_service;
	iface->is_running = (gboolean (*) (SpitPublishingPublisher*)) publishing_tumblr_tumblr_publisher_real_is_running;
	iface->start = (void (*) (SpitPublishingPublisher*)) publishing_tumblr_tumblr_publisher_real_start;
	iface->stop = (void (*) (SpitPublishingPublisher*)) publishing_tumblr_tumblr_publisher_real_stop;
}

static void
publishing_tumblr_tumblr_publisher_instance_init (PublishingTumblrTumblrPublisher * self,
                                                  gpointer klass)
{
	gchar* _tmp0_;
	self->priv = publishing_tumblr_tumblr_publisher_get_instance_private (self);
	self->priv->progress_reporter = NULL;
	self->priv->progress_reporter_target = NULL;
	self->priv->progress_reporter_target_destroy_notify = NULL;
	self->priv->running = FALSE;
	self->priv->was_started = FALSE;
	self->priv->session = NULL;
	self->priv->publishing_options_pane = NULL;
	self->priv->sizes = NULL;
	self->priv->sizes_length1 = 0;
	self->priv->_sizes_size_ = self->priv->sizes_length1;
	self->priv->blogs = NULL;
	self->priv->blogs_length1 = 0;
	self->priv->_blogs_size_ = self->priv->blogs_length1;
	_tmp0_ = g_strdup ("");
	self->priv->username = _tmp0_;
}

static void
publishing_tumblr_tumblr_publisher_finalize (GObject * obj)
{
	PublishingTumblrTumblrPublisher * self;
	SpitPublishingAuthenticator* _tmp0_;
	guint _tmp1_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PUBLISHING_TUMBLR_TYPE_TUMBLR_PUBLISHER, PublishingTumblrTumblrPublisher);
	_tmp0_ = self->priv->authenticator;
	g_signal_parse_name ("authenticated", SPIT_PUBLISHING_TYPE_AUTHENTICATOR, &_tmp1_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _publishing_tumblr_tumblr_publisher_on_authenticator_authenticated_spit_publishing_authenticator_authenticated, self);
	_g_object_unref0 (self->priv->service);
	_g_object_unref0 (self->priv->host);
	(self->priv->progress_reporter_target_destroy_notify == NULL) ? NULL : (self->priv->progress_reporter_target_destroy_notify (self->priv->progress_reporter_target), NULL);
	self->priv->progress_reporter = NULL;
	self->priv->progress_reporter_target = NULL;
	self->priv->progress_reporter_target_destroy_notify = NULL;
	_publishing_rest_support_session_unref0 (self->priv->session);
	_g_object_unref0 (self->priv->publishing_options_pane);
	self->priv->sizes = (_vala_array_free (self->priv->sizes, self->priv->sizes_length1, (GDestroyNotify) publishing_tumblr_size_entry_unref), NULL);
	self->priv->blogs = (_vala_array_free (self->priv->blogs, self->priv->blogs_length1, (GDestroyNotify) publishing_tumblr_blog_entry_unref), NULL);
	_g_free0 (self->priv->username);
	_g_object_unref0 (self->priv->authenticator);
	G_OBJECT_CLASS (publishing_tumblr_tumblr_publisher_parent_class)->finalize (obj);
}

static GType
publishing_tumblr_tumblr_publisher_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PublishingTumblrTumblrPublisherClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) publishing_tumblr_tumblr_publisher_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PublishingTumblrTumblrPublisher), 0, (GInstanceInitFunc) publishing_tumblr_tumblr_publisher_instance_init, NULL };
	static const GInterfaceInfo spit_publishing_publisher_info = { (GInterfaceInitFunc) publishing_tumblr_tumblr_publisher_spit_publishing_publisher_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType publishing_tumblr_tumblr_publisher_type_id;
	publishing_tumblr_tumblr_publisher_type_id = g_type_register_static (G_TYPE_OBJECT, "PublishingTumblrTumblrPublisher", &g_define_type_info, 0);
	g_type_add_interface_static (publishing_tumblr_tumblr_publisher_type_id, SPIT_PUBLISHING_TYPE_PUBLISHER, &spit_publishing_publisher_info);
	PublishingTumblrTumblrPublisher_private_offset = g_type_add_instance_private (publishing_tumblr_tumblr_publisher_type_id, sizeof (PublishingTumblrTumblrPublisherPrivate));
	return publishing_tumblr_tumblr_publisher_type_id;
}

GType
publishing_tumblr_tumblr_publisher_get_type (void)
{
	static volatile gsize publishing_tumblr_tumblr_publisher_type_id__once = 0;
	if (g_once_init_enter (&publishing_tumblr_tumblr_publisher_type_id__once)) {
		GType publishing_tumblr_tumblr_publisher_type_id;
		publishing_tumblr_tumblr_publisher_type_id = publishing_tumblr_tumblr_publisher_get_type_once ();
		g_once_init_leave (&publishing_tumblr_tumblr_publisher_type_id__once, publishing_tumblr_tumblr_publisher_type_id);
	}
	return publishing_tumblr_tumblr_publisher_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);
}

