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

#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "shotwell-plugin-common.h"
#include <glib-object.h>
#include <libsoup/soup.h>
#include "shotwell-plugin-dev-1.0.h"
#include <libsecret/secret.h>
#include <gio/gio.h>
#include <json-glib/json-glib.h>
#include "shotwell-authenticator.h"

#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_OAUTH_CLIENT_ID "534227538559-hvj2e8bj0vfv2f49r7gvjoq6jibfav67.apps.googleusercontent.c" \
"om"
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_REVERSE_CLIENT_ID "com.googleusercontent.apps.534227538559-hvj2e8bj0vfv2f49r7gvjoq6jibfav" \
"67"
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_OAUTH_CLIENT_SECRET "pwpzZ7W1TCcD5uIfYCu8sM7x"
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_OAUTH_CALLBACK_URI PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_REVERSE_CLIENT_ID ":/localhost"
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_SCHEMA_KEY_PROFILE_ID "shotwell-profile-id"
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_SCHEMA_KEY_ACCOUNTNAME "accountname"
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GET_ACCESS_TOKENS_TRANSACTION_ENDPOINT_URL "https://oauth2.googleapis.com/token"
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_REFRESH_ACCESS_TOKEN_TRANSACTION_ENDPOINT_URL "https://oauth2.googleapis.com/token"
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_USERNAME_FETCH_TRANSACTION_ENDPOINT_URL "https://www.googleapis.com/oauth2/v1/userinfo"
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_PASSWORD_SCHEME "org.gnome.Shotwell.Google"
#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

#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_SESSION (publishing_authenticator_shotwell_google_session_get_type ())
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_SESSION, PublishingAuthenticatorShotwellGoogleSession))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_SESSION, PublishingAuthenticatorShotwellGoogleSessionClass))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_SESSION))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_SESSION))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_SESSION, PublishingAuthenticatorShotwellGoogleSessionClass))

typedef struct _PublishingAuthenticatorShotwellGoogleSession PublishingAuthenticatorShotwellGoogleSession;
typedef struct _PublishingAuthenticatorShotwellGoogleSessionClass PublishingAuthenticatorShotwellGoogleSessionClass;
typedef struct _PublishingAuthenticatorShotwellGoogleSessionPrivate PublishingAuthenticatorShotwellGoogleSessionPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GET_ACCESS_TOKENS_TRANSACTION (publishing_authenticator_shotwell_google_get_access_tokens_transaction_get_type ())
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GET_ACCESS_TOKENS_TRANSACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GET_ACCESS_TOKENS_TRANSACTION, PublishingAuthenticatorShotwellGoogleGetAccessTokensTransaction))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GET_ACCESS_TOKENS_TRANSACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GET_ACCESS_TOKENS_TRANSACTION, PublishingAuthenticatorShotwellGoogleGetAccessTokensTransactionClass))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_GET_ACCESS_TOKENS_TRANSACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GET_ACCESS_TOKENS_TRANSACTION))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_GET_ACCESS_TOKENS_TRANSACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GET_ACCESS_TOKENS_TRANSACTION))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GET_ACCESS_TOKENS_TRANSACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GET_ACCESS_TOKENS_TRANSACTION, PublishingAuthenticatorShotwellGoogleGetAccessTokensTransactionClass))

typedef struct _PublishingAuthenticatorShotwellGoogleGetAccessTokensTransaction PublishingAuthenticatorShotwellGoogleGetAccessTokensTransaction;
typedef struct _PublishingAuthenticatorShotwellGoogleGetAccessTokensTransactionClass PublishingAuthenticatorShotwellGoogleGetAccessTokensTransactionClass;
typedef struct _PublishingAuthenticatorShotwellGoogleGetAccessTokensTransactionPrivate PublishingAuthenticatorShotwellGoogleGetAccessTokensTransactionPrivate;

#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_REFRESH_ACCESS_TOKEN_TRANSACTION (publishing_authenticator_shotwell_google_refresh_access_token_transaction_get_type ())
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_REFRESH_ACCESS_TOKEN_TRANSACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_REFRESH_ACCESS_TOKEN_TRANSACTION, PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_REFRESH_ACCESS_TOKEN_TRANSACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_REFRESH_ACCESS_TOKEN_TRANSACTION, PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransactionClass))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_REFRESH_ACCESS_TOKEN_TRANSACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_REFRESH_ACCESS_TOKEN_TRANSACTION))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_REFRESH_ACCESS_TOKEN_TRANSACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_REFRESH_ACCESS_TOKEN_TRANSACTION))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_REFRESH_ACCESS_TOKEN_TRANSACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_REFRESH_ACCESS_TOKEN_TRANSACTION, PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransactionClass))

typedef struct _PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction;
typedef struct _PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransactionClass PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransactionClass;
typedef struct _PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransactionPrivate PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransactionPrivate;

#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_USERNAME_FETCH_TRANSACTION (publishing_authenticator_shotwell_google_username_fetch_transaction_get_type ())
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_USERNAME_FETCH_TRANSACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_USERNAME_FETCH_TRANSACTION, PublishingAuthenticatorShotwellGoogleUsernameFetchTransaction))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_USERNAME_FETCH_TRANSACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_USERNAME_FETCH_TRANSACTION, PublishingAuthenticatorShotwellGoogleUsernameFetchTransactionClass))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_USERNAME_FETCH_TRANSACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_USERNAME_FETCH_TRANSACTION))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_USERNAME_FETCH_TRANSACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_USERNAME_FETCH_TRANSACTION))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_USERNAME_FETCH_TRANSACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_USERNAME_FETCH_TRANSACTION, PublishingAuthenticatorShotwellGoogleUsernameFetchTransactionClass))

typedef struct _PublishingAuthenticatorShotwellGoogleUsernameFetchTransaction PublishingAuthenticatorShotwellGoogleUsernameFetchTransaction;
typedef struct _PublishingAuthenticatorShotwellGoogleUsernameFetchTransactionClass PublishingAuthenticatorShotwellGoogleUsernameFetchTransactionClass;
typedef struct _PublishingAuthenticatorShotwellGoogleUsernameFetchTransactionPrivate PublishingAuthenticatorShotwellGoogleUsernameFetchTransactionPrivate;

#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GOOGLE (publishing_authenticator_shotwell_google_google_get_type ())
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GOOGLE, PublishingAuthenticatorShotwellGoogleGoogle))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GOOGLE, PublishingAuthenticatorShotwellGoogleGoogleClass))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_GOOGLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GOOGLE))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_GOOGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GOOGLE))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GOOGLE, PublishingAuthenticatorShotwellGoogleGoogleClass))

typedef struct _PublishingAuthenticatorShotwellGoogleGoogle PublishingAuthenticatorShotwellGoogleGoogle;
typedef struct _PublishingAuthenticatorShotwellGoogleGoogleClass PublishingAuthenticatorShotwellGoogleGoogleClass;
typedef struct _PublishingAuthenticatorShotwellGoogleGooglePrivate PublishingAuthenticatorShotwellGoogleGooglePrivate;
enum  {
	PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_0_PROPERTY,
	PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_NUM_PROPERTIES
};
static GParamSpec* publishing_authenticator_shotwell_google_google_properties[PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _publishing_rest_support_session_unref0(var) ((var == NULL) ? NULL : (var = (publishing_rest_support_session_unref (var), NULL)))
#define _secret_schema_unref0(var) ((var == NULL) ? NULL : (var = (secret_schema_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _Block2Data Block2Data;

#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_TYPE_AUTH_CALLBACK (publishing_authenticator_shotwell_google_google_auth_callback_get_type ())
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_AUTH_CALLBACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_TYPE_AUTH_CALLBACK, PublishingAuthenticatorShotwellGoogleGoogleAuthCallback))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_AUTH_CALLBACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_TYPE_AUTH_CALLBACK, PublishingAuthenticatorShotwellGoogleGoogleAuthCallbackClass))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_IS_AUTH_CALLBACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_TYPE_AUTH_CALLBACK))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_IS_AUTH_CALLBACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_TYPE_AUTH_CALLBACK))
#define PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_AUTH_CALLBACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_TYPE_AUTH_CALLBACK, PublishingAuthenticatorShotwellGoogleGoogleAuthCallbackClass))

typedef struct _PublishingAuthenticatorShotwellGoogleGoogleAuthCallback PublishingAuthenticatorShotwellGoogleGoogleAuthCallback;
typedef struct _PublishingAuthenticatorShotwellGoogleGoogleAuthCallbackClass PublishingAuthenticatorShotwellGoogleGoogleAuthCallbackClass;
typedef struct _PublishingAuthenticatorShotwellGoogleGoogleDoHostedWebAuthenticationData PublishingAuthenticatorShotwellGoogleGoogleDoHostedWebAuthenticationData;
#define _publishing_rest_support_transaction_unref0(var) ((var == NULL) ? NULL : (var = (publishing_rest_support_transaction_unref (var), NULL)))
typedef struct _PublishingAuthenticatorShotwellGoogleGoogleDoGetAccessTokensData PublishingAuthenticatorShotwellGoogleGoogleDoGetAccessTokensData;
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
typedef struct _PublishingAuthenticatorShotwellGoogleGoogleDoFetchUsernameData PublishingAuthenticatorShotwellGoogleGoogleDoFetchUsernameData;
typedef struct _PublishingAuthenticatorShotwellGoogleGoogleDoExchangeRefreshTokenForAccessTokenData PublishingAuthenticatorShotwellGoogleGoogleDoExchangeRefreshTokenForAccessTokenData;
typedef struct _PublishingAuthenticatorShotwellGoogleGoogleAuthCallbackPrivate PublishingAuthenticatorShotwellGoogleGoogleAuthCallbackPrivate;
enum  {
	PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_AUTH_CALLBACK_0_PROPERTY,
	PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_AUTH_CALLBACK_NUM_PROPERTIES
};
static GParamSpec* publishing_authenticator_shotwell_google_google_auth_callback_properties[PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_AUTH_CALLBACK_NUM_PROPERTIES];
enum  {
	PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_AUTH_CALLBACK_AUTH_SIGNAL,
	PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_AUTH_CALLBACK_NUM_SIGNALS
};
static guint publishing_authenticator_shotwell_google_google_auth_callback_signals[PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_AUTH_CALLBACK_NUM_SIGNALS] = {0};
#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 _PublishingAuthenticatorShotwellGoogleSession {
	PublishingRESTSupportSession parent_instance;
	PublishingAuthenticatorShotwellGoogleSessionPrivate * priv;
	gchar* access_token;
	gchar* refresh_token;
	gint64 expires_at;
};

struct _PublishingAuthenticatorShotwellGoogleSessionClass {
	PublishingRESTSupportSessionClass parent_class;
};

struct _PublishingAuthenticatorShotwellGoogleGetAccessTokensTransaction {
	PublishingRESTSupportTransaction parent_instance;
	PublishingAuthenticatorShotwellGoogleGetAccessTokensTransactionPrivate * priv;
};

struct _PublishingAuthenticatorShotwellGoogleGetAccessTokensTransactionClass {
	PublishingRESTSupportTransactionClass parent_class;
};

struct _PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction {
	PublishingRESTSupportTransaction parent_instance;
	PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransactionPrivate * priv;
};

struct _PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransactionClass {
	PublishingRESTSupportTransactionClass parent_class;
};

struct _PublishingAuthenticatorShotwellGoogleUsernameFetchTransaction {
	PublishingRESTSupportTransaction parent_instance;
	PublishingAuthenticatorShotwellGoogleUsernameFetchTransactionPrivate * priv;
};

struct _PublishingAuthenticatorShotwellGoogleUsernameFetchTransactionClass {
	PublishingRESTSupportTransactionClass parent_class;
};

struct _PublishingAuthenticatorShotwellGoogleGoogle {
	GObject parent_instance;
	PublishingAuthenticatorShotwellGoogleGooglePrivate * priv;
};

struct _PublishingAuthenticatorShotwellGoogleGoogleClass {
	GObjectClass parent_class;
};

struct _PublishingAuthenticatorShotwellGoogleGooglePrivate {
	gchar** scopes;
	gint scopes_length1;
	gint _scopes_size_;
	gchar* accountname;
	SpitPublishingPluginHost* host;
	GHashTable* params;
	PublishingAuthenticatorShotwellGoogleSession* session;
	gchar* welcome_message;
	SecretSchema* schema;
};

struct _Block2Data {
	int _ref_count_;
	PublishingAuthenticatorShotwellGoogleGoogle* self;
	gchar* web_auth_code;
	gpointer _async_data_;
};

struct _PublishingAuthenticatorShotwellGoogleGoogleDoHostedWebAuthenticationData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PublishingAuthenticatorShotwellGoogleGoogle* self;
	Block2Data* _data2_;
	gchar* user_authorization_url;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	PublishingAuthenticatorShotwellGoogleGoogleAuthCallback* auth_callback;
	PublishingAuthenticatorShotwellGoogleGoogleAuthCallback* _tmp28_;
	SpitPublishingPluginHost* _tmp29_;
	SpitPublishingPluginHost* _tmp30_;
	GError* err;
	SpitPublishingPluginHost* _tmp31_;
	GError* _tmp32_;
	GError* _inner_error1_;
	SpitPublishingPluginHost* _tmp33_;
	GError* _inner_error0_;
};

struct _PublishingAuthenticatorShotwellGoogleGoogleDoGetAccessTokensData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PublishingAuthenticatorShotwellGoogleGoogle* self;
	gchar* auth_code;
	SpitPublishingPluginHost* _tmp0_;
	PublishingAuthenticatorShotwellGoogleGetAccessTokensTransaction* tokens_txn;
	PublishingAuthenticatorShotwellGoogleSession* _tmp1_;
	PublishingAuthenticatorShotwellGoogleGetAccessTokensTransaction* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GError* err;
	gchar* _tmp5_;
	gchar* _tmp6_;
	SpitPublishingPluginHost* _tmp7_;
	GError* _tmp8_;
	GError* _inner_error0_;
};

struct _PublishingAuthenticatorShotwellGoogleGoogleDoFetchUsernameData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PublishingAuthenticatorShotwellGoogleGoogle* self;
	SpitPublishingPluginHost* _tmp0_;
	SpitPublishingPluginHost* _tmp1_;
	PublishingAuthenticatorShotwellGoogleUsernameFetchTransaction* txn;
	PublishingAuthenticatorShotwellGoogleSession* _tmp2_;
	PublishingAuthenticatorShotwellGoogleUsernameFetchTransaction* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GError* err;
	SpitPublishingPluginHost* _tmp6_;
	GError* _tmp7_;
	GError* _inner_error0_;
};

struct _PublishingAuthenticatorShotwellGoogleGoogleDoExchangeRefreshTokenForAccessTokenData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PublishingAuthenticatorShotwellGoogleGoogle* self;
	SpitPublishingPluginHost* _tmp0_;
	PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction* txn;
	PublishingAuthenticatorShotwellGoogleSession* _tmp1_;
	PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction* _tmp2_;
	PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction* _tmp3_;
	PublishingAuthenticatorShotwellGoogleSession* _tmp4_;
	PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GError* err;
	PublishingAuthenticatorShotwellGoogleSession* _tmp8_;
	gboolean _tmp9_;
	PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction* _tmp10_;
	PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction* _tmp11_;
	SecretSchema* _tmp12_;
	SpitPublishingPluginHost* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	GError* _vala1_err;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	GError* _tmp22_;
	const gchar* _tmp23_;
	SpitPublishingPluginHost* _tmp24_;
	GError* _tmp25_;
	GError* _inner_error0_;
};

struct _PublishingAuthenticatorShotwellGoogleGoogleAuthCallback {
	GObject parent_instance;
	PublishingAuthenticatorShotwellGoogleGoogleAuthCallbackPrivate * priv;
};

struct _PublishingAuthenticatorShotwellGoogleGoogleAuthCallbackClass {
	GObjectClass parent_class;
};

static gpointer publishing_authenticator_shotwell_google_session_parent_class = NULL;
static gpointer publishing_authenticator_shotwell_google_get_access_tokens_transaction_parent_class = NULL;
static gpointer publishing_authenticator_shotwell_google_refresh_access_token_transaction_parent_class = NULL;
static gpointer publishing_authenticator_shotwell_google_username_fetch_transaction_parent_class = NULL;
static gint PublishingAuthenticatorShotwellGoogleGoogle_private_offset;
static gpointer publishing_authenticator_shotwell_google_google_parent_class = NULL;
static gpointer publishing_authenticator_shotwell_google_google_auth_callback_parent_class = NULL;
static SpitPublishingAuthenticatedCallbackIface * publishing_authenticator_shotwell_google_google_auth_callback_spit_publishing_authenticated_callback_parent_iface = NULL;
static SpitPublishingAuthenticatorIface * publishing_authenticator_shotwell_google_google_spit_publishing_authenticator_parent_iface = NULL;

VALA_EXTERN GType publishing_authenticator_shotwell_google_session_get_type (void) G_GNUC_CONST ;
static gboolean publishing_authenticator_shotwell_google_session_real_is_authenticated (PublishingRESTSupportSession* base);
VALA_EXTERN void publishing_authenticator_shotwell_google_session_deauthenticate (PublishingAuthenticatorShotwellGoogleSession* self);
VALA_EXTERN PublishingAuthenticatorShotwellGoogleSession* publishing_authenticator_shotwell_google_session_new (void);
VALA_EXTERN PublishingAuthenticatorShotwellGoogleSession* publishing_authenticator_shotwell_google_session_construct (GType object_type);
static void publishing_authenticator_shotwell_google_session_finalize (PublishingRESTSupportSession * obj);
static GType publishing_authenticator_shotwell_google_session_get_type_once (void);
VALA_EXTERN GType publishing_authenticator_shotwell_google_get_access_tokens_transaction_get_type (void) G_GNUC_CONST ;
VALA_EXTERN PublishingAuthenticatorShotwellGoogleGetAccessTokensTransaction* publishing_authenticator_shotwell_google_get_access_tokens_transaction_new (PublishingAuthenticatorShotwellGoogleSession* session,
                                                                                                                                             const gchar* auth_code);
VALA_EXTERN PublishingAuthenticatorShotwellGoogleGetAccessTokensTransaction* publishing_authenticator_shotwell_google_get_access_tokens_transaction_construct (GType object_type,
                                                                                                                                                   PublishingAuthenticatorShotwellGoogleSession* session,
                                                                                                                                                   const gchar* auth_code);
static GType publishing_authenticator_shotwell_google_get_access_tokens_transaction_get_type_once (void);
VALA_EXTERN GType publishing_authenticator_shotwell_google_refresh_access_token_transaction_get_type (void) G_GNUC_CONST ;
VALA_EXTERN PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction* publishing_authenticator_shotwell_google_refresh_access_token_transaction_new (PublishingAuthenticatorShotwellGoogleSession* session);
VALA_EXTERN PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction* publishing_authenticator_shotwell_google_refresh_access_token_transaction_construct (GType object_type,
                                                                                                                                                         PublishingAuthenticatorShotwellGoogleSession* session);
static GType publishing_authenticator_shotwell_google_refresh_access_token_transaction_get_type_once (void);
VALA_EXTERN GType publishing_authenticator_shotwell_google_username_fetch_transaction_get_type (void) G_GNUC_CONST ;
VALA_EXTERN PublishingAuthenticatorShotwellGoogleUsernameFetchTransaction* publishing_authenticator_shotwell_google_username_fetch_transaction_new (PublishingAuthenticatorShotwellGoogleSession* session);
VALA_EXTERN PublishingAuthenticatorShotwellGoogleUsernameFetchTransaction* publishing_authenticator_shotwell_google_username_fetch_transaction_construct (GType object_type,
                                                                                                                                              PublishingAuthenticatorShotwellGoogleSession* session);
static GType publishing_authenticator_shotwell_google_username_fetch_transaction_get_type_once (void);
VALA_EXTERN GType publishing_authenticator_shotwell_google_google_get_type (void) G_GNUC_CONST ;
VALA_EXTERN PublishingAuthenticatorShotwellGoogleGoogle* publishing_authenticator_shotwell_google_google_new (gchar** scopes,
                                                                                                  gint scopes_length1,
                                                                                                  const gchar* welcome_message,
                                                                                                  SpitPublishingPluginHost* host);
VALA_EXTERN PublishingAuthenticatorShotwellGoogleGoogle* publishing_authenticator_shotwell_google_google_construct (GType object_type,
                                                                                                        gchar** scopes,
                                                                                                        gint scopes_length1,
                                                                                                        const gchar* welcome_message,
                                                                                                        SpitPublishingPluginHost* host);
static void _g_free0_ (gpointer var);
static void _g_variant_unref0_ (gpointer var);
static gchar** _vala_array_dup1 (gchar** self,
                          gssize length);
static void publishing_authenticator_shotwell_google_google_real_authenticate (SpitPublishingAuthenticator* base);
VALA_EXTERN gchar* publishing_authenticator_shotwell_google_google_get_scopes (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                   const gchar* separator);
static void publishing_authenticator_shotwell_google_google_on_refresh_token_available (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                                 const gchar* token);
static void publishing_authenticator_shotwell_google_google_do_exchange_refresh_token_for_access_token (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                                                 GAsyncReadyCallback _callback_,
                                                                                                 gpointer _user_data_);
static void publishing_authenticator_shotwell_google_google_do_exchange_refresh_token_for_access_token_finish (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                                                        GAsyncResult* _res_);
static void publishing_authenticator_shotwell_google_google_do_show_service_welcome_pane (PublishingAuthenticatorShotwellGoogleGoogle* self);
static gboolean publishing_authenticator_shotwell_google_google_real_can_logout (SpitPublishingAuthenticator* base);
static GHashTable* publishing_authenticator_shotwell_google_google_real_get_authentication_parameter (SpitPublishingAuthenticator* base);
static void publishing_authenticator_shotwell_google_google_real_logout (SpitPublishingAuthenticator* base);
static void publishing_authenticator_shotwell_google_google_real_refresh (SpitPublishingAuthenticator* base);
static void publishing_authenticator_shotwell_google_google_real_set_accountname (SpitPublishingAuthenticator* base,
                                                                           const gchar* accountname);
static void publishing_authenticator_shotwell_google_google_do_hosted_web_authentication_data_free (gpointer _data);
static void publishing_authenticator_shotwell_google_google_do_hosted_web_authentication (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                                   GAsyncReadyCallback _callback_,
                                                                                   gpointer _user_data_);
static void publishing_authenticator_shotwell_google_google_do_hosted_web_authentication_finish (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                                          GAsyncResult* _res_);
static gboolean publishing_authenticator_shotwell_google_google_do_hosted_web_authentication_co (PublishingAuthenticatorShotwellGoogleGoogleDoHostedWebAuthenticationData* _data_);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (void * _userdata_);
static GType publishing_authenticator_shotwell_google_google_auth_callback_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static PublishingAuthenticatorShotwellGoogleGoogleAuthCallback* publishing_authenticator_shotwell_google_google_auth_callback_new (void);
static PublishingAuthenticatorShotwellGoogleGoogleAuthCallback* publishing_authenticator_shotwell_google_google_auth_callback_construct (GType object_type);
static void __lambda6_ (Block2Data* _data2_,
                 GHashTable* prm);
static void ___lambda6__publishing_authenticator_shotwell_google_google_auth_callback_auth (PublishingAuthenticatorShotwellGoogleGoogleAuthCallback* _sender,
                                                                                     GHashTable* params,
                                                                                     gpointer self);
static void publishing_authenticator_shotwell_google_google_do_get_access_tokens (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                           const gchar* auth_code,
                                                                           GAsyncReadyCallback _callback_,
                                                                           gpointer _user_data_);
static void publishing_authenticator_shotwell_google_google_do_get_access_tokens_finish (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                                  GAsyncResult* _res_);
static void publishing_authenticator_shotwell_google_google_do_hosted_web_authentication_ready (GObject* source_object,
                                                                                         GAsyncResult* _res_,
                                                                                         gpointer _user_data_);
static void publishing_authenticator_shotwell_google_google_do_get_access_tokens_data_free (gpointer _data);
static gboolean publishing_authenticator_shotwell_google_google_do_get_access_tokens_co (PublishingAuthenticatorShotwellGoogleGoogleDoGetAccessTokensData* _data_);
static void publishing_authenticator_shotwell_google_google_do_get_access_tokens_ready (GObject* source_object,
                                                                                 GAsyncResult* _res_,
                                                                                 gpointer _user_data_);
static void publishing_authenticator_shotwell_google_google_do_extract_tokens (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                        const gchar* response_body);
static void publishing_authenticator_shotwell_google_google_on_expiry_time_avilable (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                              gint64 abs_time);
static void publishing_authenticator_shotwell_google_google_on_access_token_available (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                                const gchar* token);
static void publishing_authenticator_shotwell_google_google_do_fetch_username (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                        GAsyncReadyCallback _callback_,
                                                                        gpointer _user_data_);
static void publishing_authenticator_shotwell_google_google_do_fetch_username_finish (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                               GAsyncResult* _res_);
static void publishing_authenticator_shotwell_google_google_do_fetch_username_data_free (gpointer _data);
static gboolean publishing_authenticator_shotwell_google_google_do_fetch_username_co (PublishingAuthenticatorShotwellGoogleGoogleDoFetchUsernameData* _data_);
static void publishing_authenticator_shotwell_google_google_do_fetch_username_ready (GObject* source_object,
                                                                              GAsyncResult* _res_,
                                                                              gpointer _user_data_);
static void publishing_authenticator_shotwell_google_google_do_extract_username (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                          const gchar* response_body);
static void publishing_authenticator_shotwell_google_google_do_exchange_refresh_token_for_access_token_data_free (gpointer _data);
static gboolean publishing_authenticator_shotwell_google_google_do_exchange_refresh_token_for_access_token_co (PublishingAuthenticatorShotwellGoogleGoogleDoExchangeRefreshTokenForAccessTokenData* _data_);
static void publishing_authenticator_shotwell_google_google_do_exchange_refresh_token_for_access_token_ready (GObject* source_object,
                                                                                                       GAsyncResult* _res_,
                                                                                                       gpointer _user_data_);
static gboolean ____lambda5_ (PublishingAuthenticatorShotwellGoogleGoogle* self);
static gboolean _____lambda5__gsource_func (gpointer self);
static void publishing_authenticator_shotwell_google_google_on_service_welcome_login (PublishingAuthenticatorShotwellGoogleGoogle* self);
static void _publishing_authenticator_shotwell_google_google_on_service_welcome_login_spit_publishing_login_callback (gpointer self);
static void publishing_authenticator_shotwell_google_google_auth_callback_real_authenticated (SpitPublishingAuthenticatedCallback* base,
                                                                                       GHashTable* params);
static GType publishing_authenticator_shotwell_google_google_auth_callback_get_type_once (void);
static void publishing_authenticator_shotwell_google_google_finalize (GObject * obj);
static GType publishing_authenticator_shotwell_google_google_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static gboolean
publishing_authenticator_shotwell_google_session_real_is_authenticated (PublishingRESTSupportSession* base)
{
	PublishingAuthenticatorShotwellGoogleSession * self;
	const gchar* _tmp0_;
	gboolean result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_SESSION, PublishingAuthenticatorShotwellGoogleSession);
	_tmp0_ = self->access_token;
	result = _tmp0_ != NULL;
	return result;
}

void
publishing_authenticator_shotwell_google_session_deauthenticate (PublishingAuthenticatorShotwellGoogleSession* self)
{
	g_return_if_fail (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_SESSION (self));
	_g_free0 (self->access_token);
	self->access_token = NULL;
	_g_free0 (self->refresh_token);
	self->refresh_token = NULL;
	self->expires_at = (gint64) -1;
}

PublishingAuthenticatorShotwellGoogleSession*
publishing_authenticator_shotwell_google_session_construct (GType object_type)
{
	PublishingAuthenticatorShotwellGoogleSession* self = NULL;
	SoupSessionFeature** _tmp0_;
	SoupSessionFeature** _tmp1_;
	gint _tmp1__length1;
	_tmp0_ = g_new0 (SoupSessionFeature*, 0 + 1);
	_tmp1_ = _tmp0_;
	_tmp1__length1 = 0;
	self = (PublishingAuthenticatorShotwellGoogleSession*) publishing_rest_support_session_construct (object_type, NULL, _tmp1_, (gint) 0);
	_tmp1_ = (_vala_array_free (_tmp1_, _tmp1__length1, (GDestroyNotify) g_object_unref), NULL);
	return self;
}

PublishingAuthenticatorShotwellGoogleSession*
publishing_authenticator_shotwell_google_session_new (void)
{
	return publishing_authenticator_shotwell_google_session_construct (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_SESSION);
}

static void
publishing_authenticator_shotwell_google_session_class_init (PublishingAuthenticatorShotwellGoogleSessionClass * klass,
                                                             gpointer klass_data)
{
	publishing_authenticator_shotwell_google_session_parent_class = g_type_class_peek_parent (klass);
	((PublishingRESTSupportSessionClass *) klass)->finalize = publishing_authenticator_shotwell_google_session_finalize;
	((PublishingRESTSupportSessionClass *) klass)->is_authenticated = (gboolean (*) (PublishingRESTSupportSession*)) publishing_authenticator_shotwell_google_session_real_is_authenticated;
}

static void
publishing_authenticator_shotwell_google_session_instance_init (PublishingAuthenticatorShotwellGoogleSession * self,
                                                                gpointer klass)
{
	self->access_token = NULL;
	self->refresh_token = NULL;
	self->expires_at = (gint64) -1;
}

static void
publishing_authenticator_shotwell_google_session_finalize (PublishingRESTSupportSession * obj)
{
	PublishingAuthenticatorShotwellGoogleSession * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_SESSION, PublishingAuthenticatorShotwellGoogleSession);
	_g_free0 (self->access_token);
	_g_free0 (self->refresh_token);
	PUBLISHING_REST_SUPPORT_SESSION_CLASS (publishing_authenticator_shotwell_google_session_parent_class)->finalize (obj);
}

static GType
publishing_authenticator_shotwell_google_session_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PublishingAuthenticatorShotwellGoogleSessionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) publishing_authenticator_shotwell_google_session_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PublishingAuthenticatorShotwellGoogleSession), 0, (GInstanceInitFunc) publishing_authenticator_shotwell_google_session_instance_init, NULL };
	GType publishing_authenticator_shotwell_google_session_type_id;
	publishing_authenticator_shotwell_google_session_type_id = g_type_register_static (PUBLISHING_REST_SUPPORT_TYPE_SESSION, "PublishingAuthenticatorShotwellGoogleSession", &g_define_type_info, 0);
	return publishing_authenticator_shotwell_google_session_type_id;
}

GType
publishing_authenticator_shotwell_google_session_get_type (void)
{
	static volatile gsize publishing_authenticator_shotwell_google_session_type_id__once = 0;
	if (g_once_init_enter (&publishing_authenticator_shotwell_google_session_type_id__once)) {
		GType publishing_authenticator_shotwell_google_session_type_id;
		publishing_authenticator_shotwell_google_session_type_id = publishing_authenticator_shotwell_google_session_get_type_once ();
		g_once_init_leave (&publishing_authenticator_shotwell_google_session_type_id__once, publishing_authenticator_shotwell_google_session_type_id);
	}
	return publishing_authenticator_shotwell_google_session_type_id__once;
}

PublishingAuthenticatorShotwellGoogleGetAccessTokensTransaction*
publishing_authenticator_shotwell_google_get_access_tokens_transaction_construct (GType object_type,
                                                                                  PublishingAuthenticatorShotwellGoogleSession* session,
                                                                                  const gchar* auth_code)
{
	PublishingAuthenticatorShotwellGoogleGetAccessTokensTransaction* self = NULL;
	g_return_val_if_fail (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_SESSION (session), NULL);
	g_return_val_if_fail (auth_code != NULL, NULL);
	self = (PublishingAuthenticatorShotwellGoogleGetAccessTokensTransaction*) publishing_rest_support_transaction_construct_with_endpoint_url (object_type, G_TYPE_CHECK_INSTANCE_CAST (session, PUBLISHING_REST_SUPPORT_TYPE_SESSION, PublishingRESTSupportSession), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GET_ACCESS_TOKENS_TRANSACTION_ENDPOINT_URL, PUBLISHING_REST_SUPPORT_HTTP_METHOD_POST);
	publishing_rest_support_transaction_add_argument (G_TYPE_CHECK_INSTANCE_CAST (self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), "code", auth_code);
	publishing_rest_support_transaction_add_argument (G_TYPE_CHECK_INSTANCE_CAST (self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), "client_id", PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_OAUTH_CLIENT_ID);
	publishing_rest_support_transaction_add_argument (G_TYPE_CHECK_INSTANCE_CAST (self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), "client_secret", PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_OAUTH_CLIENT_SECRET);
	publishing_rest_support_transaction_add_argument (G_TYPE_CHECK_INSTANCE_CAST (self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), "redirect_uri", PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_OAUTH_CALLBACK_URI);
	publishing_rest_support_transaction_add_argument (G_TYPE_CHECK_INSTANCE_CAST (self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), "grant_type", "authorization_code");
	return self;
}

PublishingAuthenticatorShotwellGoogleGetAccessTokensTransaction*
publishing_authenticator_shotwell_google_get_access_tokens_transaction_new (PublishingAuthenticatorShotwellGoogleSession* session,
                                                                            const gchar* auth_code)
{
	return publishing_authenticator_shotwell_google_get_access_tokens_transaction_construct (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GET_ACCESS_TOKENS_TRANSACTION, session, auth_code);
}

static void
publishing_authenticator_shotwell_google_get_access_tokens_transaction_class_init (PublishingAuthenticatorShotwellGoogleGetAccessTokensTransactionClass * klass,
                                                                                   gpointer klass_data)
{
	publishing_authenticator_shotwell_google_get_access_tokens_transaction_parent_class = g_type_class_peek_parent (klass);
}

static void
publishing_authenticator_shotwell_google_get_access_tokens_transaction_instance_init (PublishingAuthenticatorShotwellGoogleGetAccessTokensTransaction * self,
                                                                                      gpointer klass)
{
}

static GType
publishing_authenticator_shotwell_google_get_access_tokens_transaction_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PublishingAuthenticatorShotwellGoogleGetAccessTokensTransactionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) publishing_authenticator_shotwell_google_get_access_tokens_transaction_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PublishingAuthenticatorShotwellGoogleGetAccessTokensTransaction), 0, (GInstanceInitFunc) publishing_authenticator_shotwell_google_get_access_tokens_transaction_instance_init, NULL };
	GType publishing_authenticator_shotwell_google_get_access_tokens_transaction_type_id;
	publishing_authenticator_shotwell_google_get_access_tokens_transaction_type_id = g_type_register_static (PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, "PublishingAuthenticatorShotwellGoogleGetAccessTokensTransaction", &g_define_type_info, 0);
	return publishing_authenticator_shotwell_google_get_access_tokens_transaction_type_id;
}

GType
publishing_authenticator_shotwell_google_get_access_tokens_transaction_get_type (void)
{
	static volatile gsize publishing_authenticator_shotwell_google_get_access_tokens_transaction_type_id__once = 0;
	if (g_once_init_enter (&publishing_authenticator_shotwell_google_get_access_tokens_transaction_type_id__once)) {
		GType publishing_authenticator_shotwell_google_get_access_tokens_transaction_type_id;
		publishing_authenticator_shotwell_google_get_access_tokens_transaction_type_id = publishing_authenticator_shotwell_google_get_access_tokens_transaction_get_type_once ();
		g_once_init_leave (&publishing_authenticator_shotwell_google_get_access_tokens_transaction_type_id__once, publishing_authenticator_shotwell_google_get_access_tokens_transaction_type_id);
	}
	return publishing_authenticator_shotwell_google_get_access_tokens_transaction_type_id__once;
}

PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction*
publishing_authenticator_shotwell_google_refresh_access_token_transaction_construct (GType object_type,
                                                                                     PublishingAuthenticatorShotwellGoogleSession* session)
{
	PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction* self = NULL;
	const gchar* _tmp0_;
	g_return_val_if_fail (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_SESSION (session), NULL);
	self = (PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction*) publishing_rest_support_transaction_construct_with_endpoint_url (object_type, G_TYPE_CHECK_INSTANCE_CAST (session, PUBLISHING_REST_SUPPORT_TYPE_SESSION, PublishingRESTSupportSession), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_REFRESH_ACCESS_TOKEN_TRANSACTION_ENDPOINT_URL, PUBLISHING_REST_SUPPORT_HTTP_METHOD_POST);
	publishing_rest_support_transaction_add_argument (G_TYPE_CHECK_INSTANCE_CAST (self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), "client_id", PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_OAUTH_CLIENT_ID);
	publishing_rest_support_transaction_add_argument (G_TYPE_CHECK_INSTANCE_CAST (self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), "client_secret", PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_OAUTH_CLIENT_SECRET);
	_tmp0_ = session->refresh_token;
	publishing_rest_support_transaction_add_argument (G_TYPE_CHECK_INSTANCE_CAST (self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), "refresh_token", _tmp0_);
	publishing_rest_support_transaction_add_argument (G_TYPE_CHECK_INSTANCE_CAST (self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), "grant_type", "refresh_token");
	return self;
}

PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction*
publishing_authenticator_shotwell_google_refresh_access_token_transaction_new (PublishingAuthenticatorShotwellGoogleSession* session)
{
	return publishing_authenticator_shotwell_google_refresh_access_token_transaction_construct (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_REFRESH_ACCESS_TOKEN_TRANSACTION, session);
}

static void
publishing_authenticator_shotwell_google_refresh_access_token_transaction_class_init (PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransactionClass * klass,
                                                                                      gpointer klass_data)
{
	publishing_authenticator_shotwell_google_refresh_access_token_transaction_parent_class = g_type_class_peek_parent (klass);
}

static void
publishing_authenticator_shotwell_google_refresh_access_token_transaction_instance_init (PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction * self,
                                                                                         gpointer klass)
{
}

static GType
publishing_authenticator_shotwell_google_refresh_access_token_transaction_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransactionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) publishing_authenticator_shotwell_google_refresh_access_token_transaction_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction), 0, (GInstanceInitFunc) publishing_authenticator_shotwell_google_refresh_access_token_transaction_instance_init, NULL };
	GType publishing_authenticator_shotwell_google_refresh_access_token_transaction_type_id;
	publishing_authenticator_shotwell_google_refresh_access_token_transaction_type_id = g_type_register_static (PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, "PublishingAuthenticatorShotwellGoogleRefreshAccessTokenTransaction", &g_define_type_info, 0);
	return publishing_authenticator_shotwell_google_refresh_access_token_transaction_type_id;
}

GType
publishing_authenticator_shotwell_google_refresh_access_token_transaction_get_type (void)
{
	static volatile gsize publishing_authenticator_shotwell_google_refresh_access_token_transaction_type_id__once = 0;
	if (g_once_init_enter (&publishing_authenticator_shotwell_google_refresh_access_token_transaction_type_id__once)) {
		GType publishing_authenticator_shotwell_google_refresh_access_token_transaction_type_id;
		publishing_authenticator_shotwell_google_refresh_access_token_transaction_type_id = publishing_authenticator_shotwell_google_refresh_access_token_transaction_get_type_once ();
		g_once_init_leave (&publishing_authenticator_shotwell_google_refresh_access_token_transaction_type_id__once, publishing_authenticator_shotwell_google_refresh_access_token_transaction_type_id);
	}
	return publishing_authenticator_shotwell_google_refresh_access_token_transaction_type_id__once;
}

PublishingAuthenticatorShotwellGoogleUsernameFetchTransaction*
publishing_authenticator_shotwell_google_username_fetch_transaction_construct (GType object_type,
                                                                               PublishingAuthenticatorShotwellGoogleSession* session)
{
	PublishingAuthenticatorShotwellGoogleUsernameFetchTransaction* self = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_val_if_fail (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_SESSION (session), NULL);
	self = (PublishingAuthenticatorShotwellGoogleUsernameFetchTransaction*) publishing_rest_support_transaction_construct_with_endpoint_url (object_type, G_TYPE_CHECK_INSTANCE_CAST (session, PUBLISHING_REST_SUPPORT_TYPE_SESSION, PublishingRESTSupportSession), PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_USERNAME_FETCH_TRANSACTION_ENDPOINT_URL, PUBLISHING_REST_SUPPORT_HTTP_METHOD_GET);
	_tmp0_ = session->access_token;
	_tmp1_ = g_strconcat ("Bearer ", _tmp0_, NULL);
	_tmp2_ = _tmp1_;
	publishing_rest_support_transaction_add_header (G_TYPE_CHECK_INSTANCE_CAST (self, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), "Authorization", _tmp2_);
	_g_free0 (_tmp2_);
	return self;
}

PublishingAuthenticatorShotwellGoogleUsernameFetchTransaction*
publishing_authenticator_shotwell_google_username_fetch_transaction_new (PublishingAuthenticatorShotwellGoogleSession* session)
{
	return publishing_authenticator_shotwell_google_username_fetch_transaction_construct (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_USERNAME_FETCH_TRANSACTION, session);
}

static void
publishing_authenticator_shotwell_google_username_fetch_transaction_class_init (PublishingAuthenticatorShotwellGoogleUsernameFetchTransactionClass * klass,
                                                                                gpointer klass_data)
{
	publishing_authenticator_shotwell_google_username_fetch_transaction_parent_class = g_type_class_peek_parent (klass);
}

static void
publishing_authenticator_shotwell_google_username_fetch_transaction_instance_init (PublishingAuthenticatorShotwellGoogleUsernameFetchTransaction * self,
                                                                                   gpointer klass)
{
}

static GType
publishing_authenticator_shotwell_google_username_fetch_transaction_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PublishingAuthenticatorShotwellGoogleUsernameFetchTransactionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) publishing_authenticator_shotwell_google_username_fetch_transaction_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PublishingAuthenticatorShotwellGoogleUsernameFetchTransaction), 0, (GInstanceInitFunc) publishing_authenticator_shotwell_google_username_fetch_transaction_instance_init, NULL };
	GType publishing_authenticator_shotwell_google_username_fetch_transaction_type_id;
	publishing_authenticator_shotwell_google_username_fetch_transaction_type_id = g_type_register_static (PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, "PublishingAuthenticatorShotwellGoogleUsernameFetchTransaction", &g_define_type_info, 0);
	return publishing_authenticator_shotwell_google_username_fetch_transaction_type_id;
}

GType
publishing_authenticator_shotwell_google_username_fetch_transaction_get_type (void)
{
	static volatile gsize publishing_authenticator_shotwell_google_username_fetch_transaction_type_id__once = 0;
	if (g_once_init_enter (&publishing_authenticator_shotwell_google_username_fetch_transaction_type_id__once)) {
		GType publishing_authenticator_shotwell_google_username_fetch_transaction_type_id;
		publishing_authenticator_shotwell_google_username_fetch_transaction_type_id = publishing_authenticator_shotwell_google_username_fetch_transaction_get_type_once ();
		g_once_init_leave (&publishing_authenticator_shotwell_google_username_fetch_transaction_type_id__once, publishing_authenticator_shotwell_google_username_fetch_transaction_type_id);
	}
	return publishing_authenticator_shotwell_google_username_fetch_transaction_type_id__once;
}

static inline gpointer
publishing_authenticator_shotwell_google_google_get_instance_private (PublishingAuthenticatorShotwellGoogleGoogle* self)
{
	return G_STRUCT_MEMBER_P (self, PublishingAuthenticatorShotwellGoogleGoogle_private_offset);
}

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

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

static void
_g_variant_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_variant_unref (var), NULL));
}

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

PublishingAuthenticatorShotwellGoogleGoogle*
publishing_authenticator_shotwell_google_google_construct (GType object_type,
                                                           gchar** scopes,
                                                           gint scopes_length1,
                                                           const gchar* welcome_message,
                                                           SpitPublishingPluginHost* host)
{
	PublishingAuthenticatorShotwellGoogleGoogle * self = NULL;
	SpitPublishingPluginHost* _tmp0_;
	GHashFunc _tmp1_;
	GEqualFunc _tmp2_;
	GHashTable* _tmp3_;
	gchar** _tmp4_;
	gint _tmp4__length1;
	PublishingAuthenticatorShotwellGoogleSession* _tmp5_;
	gchar* _tmp6_;
	SecretSchema* _tmp7_;
	g_return_val_if_fail (welcome_message != NULL, NULL);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (host, SPIT_PUBLISHING_TYPE_PLUGIN_HOST), NULL);
	self = (PublishingAuthenticatorShotwellGoogleGoogle*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (host);
	_g_object_unref0 (self->priv->host);
	self->priv->host = _tmp0_;
	_tmp1_ = g_str_hash;
	_tmp2_ = g_str_equal;
	_tmp3_ = g_hash_table_new_full (_tmp1_, _tmp2_, _g_free0_, _g_variant_unref0_);
	_g_hash_table_unref0 (self->priv->params);
	self->priv->params = _tmp3_;
	_tmp4_ = (scopes != NULL) ? _vala_array_dup1 (scopes, scopes_length1) : scopes;
	_tmp4__length1 = scopes_length1;
	self->priv->scopes = (_vala_array_free (self->priv->scopes, self->priv->scopes_length1, (GDestroyNotify) g_free), NULL);
	self->priv->scopes = _tmp4_;
	self->priv->scopes_length1 = _tmp4__length1;
	self->priv->_scopes_size_ = self->priv->scopes_length1;
	_tmp5_ = publishing_authenticator_shotwell_google_session_new ();
	_publishing_rest_support_session_unref0 (self->priv->session);
	self->priv->session = _tmp5_;
	_tmp6_ = g_strdup (welcome_message);
	_g_free0 (self->priv->welcome_message);
	self->priv->welcome_message = _tmp6_;
	_tmp7_ = secret_schema_new (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_PASSWORD_SCHEME, SECRET_SCHEMA_NONE, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_SCHEMA_KEY_PROFILE_ID, SECRET_SCHEMA_ATTRIBUTE_STRING, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_SCHEMA_KEY_ACCOUNTNAME, SECRET_SCHEMA_ATTRIBUTE_STRING, "scope", SECRET_SCHEMA_ATTRIBUTE_STRING, NULL);
	_secret_schema_unref0 (self->priv->schema);
	self->priv->schema = _tmp7_;
	return self;
}

PublishingAuthenticatorShotwellGoogleGoogle*
publishing_authenticator_shotwell_google_google_new (gchar** scopes,
                                                     gint scopes_length1,
                                                     const gchar* welcome_message,
                                                     SpitPublishingPluginHost* host)
{
	return publishing_authenticator_shotwell_google_google_construct (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GOOGLE, scopes, scopes_length1, welcome_message, host);
}

static void
publishing_authenticator_shotwell_google_google_real_authenticate (SpitPublishingAuthenticator* base)
{
	PublishingAuthenticatorShotwellGoogleGoogle * self;
	gchar* refresh_token = NULL;
	gboolean _tmp13_ = FALSE;
	const gchar* _tmp14_;
	GError* _inner_error0_ = NULL;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GOOGLE, PublishingAuthenticatorShotwellGoogleGoogle);
	refresh_token = NULL;
	{
		gchar* _tmp0_ = NULL;
		SecretSchema* _tmp1_;
		SpitPublishingPluginHost* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp1_ = self->priv->schema;
		_tmp2_ = self->priv->host;
		_tmp3_ = spit_publishing_plugin_host_get_current_profile_id (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = self->priv->accountname;
		_tmp6_ = publishing_authenticator_shotwell_google_google_get_scopes (self, ",");
		_tmp7_ = _tmp6_;
		_tmp8_ = secret_password_lookup_sync (_tmp1_, NULL, &_inner_error0_, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_SCHEMA_KEY_PROFILE_ID, _tmp4_, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_SCHEMA_KEY_ACCOUNTNAME, _tmp5_, "scope", _tmp7_, NULL);
		_tmp9_ = _tmp8_;
		_g_free0 (_tmp7_);
		_g_free0 (_tmp4_);
		_tmp0_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp10_ = _tmp0_;
		_tmp0_ = NULL;
		_g_free0 (refresh_token);
		refresh_token = _tmp10_;
		_g_free0 (_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		GError* _tmp11_;
		const gchar* _tmp12_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp11_ = err;
		_tmp12_ = _tmp11_->message;
		g_critical ("GoogleAuthenticator.vala:98: Failed to lookup refresh_token from passw" \
"ord store: %s", _tmp12_);
		_g_error_free0 (err);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (refresh_token);
		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;
	}
	_tmp14_ = refresh_token;
	if (_tmp14_ != NULL) {
		const gchar* _tmp15_;
		_tmp15_ = refresh_token;
		_tmp13_ = g_strcmp0 (_tmp15_, "") != 0;
	} else {
		_tmp13_ = FALSE;
	}
	if (_tmp13_) {
		const gchar* _tmp16_;
		_tmp16_ = refresh_token;
		publishing_authenticator_shotwell_google_google_on_refresh_token_available (self, _tmp16_);
		publishing_authenticator_shotwell_google_google_do_exchange_refresh_token_for_access_token (self, NULL, NULL);
		_g_free0 (refresh_token);
		return;
	}
	publishing_authenticator_shotwell_google_google_do_show_service_welcome_pane (self);
	_g_free0 (refresh_token);
}

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;
	}
}

gchar*
publishing_authenticator_shotwell_google_google_get_scopes (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                            const gchar* separator)
{
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar* _tmp1_;
	gchar* result;
	g_return_val_if_fail (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_GOOGLE (self), NULL);
	g_return_val_if_fail (separator != NULL, NULL);
	_tmp0_ = self->priv->scopes;
	_tmp0__length1 = self->priv->scopes_length1;
	_tmp1_ = _vala_g_strjoinv (separator, _tmp0_, (gint) _tmp0__length1);
	result = _tmp1_;
	return result;
}

static gboolean
publishing_authenticator_shotwell_google_google_real_can_logout (SpitPublishingAuthenticator* base)
{
	PublishingAuthenticatorShotwellGoogleGoogle * self;
	gboolean result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GOOGLE, PublishingAuthenticatorShotwellGoogleGoogle);
	result = TRUE;
	return result;
}

static gpointer
_g_hash_table_ref0 (gpointer self)
{
	return self ? g_hash_table_ref (self) : NULL;
}

static GHashTable*
publishing_authenticator_shotwell_google_google_real_get_authentication_parameter (SpitPublishingAuthenticator* base)
{
	PublishingAuthenticatorShotwellGoogleGoogle * self;
	GHashTable* _tmp0_;
	GHashTable* _tmp1_;
	GHashTable* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GOOGLE, PublishingAuthenticatorShotwellGoogleGoogle);
	_tmp0_ = self->priv->params;
	_tmp1_ = _g_hash_table_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
publishing_authenticator_shotwell_google_google_real_logout (SpitPublishingAuthenticator* base)
{
	PublishingAuthenticatorShotwellGoogleGoogle * self;
	PublishingAuthenticatorShotwellGoogleSession* _tmp0_;
	GError* _inner_error0_ = NULL;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GOOGLE, PublishingAuthenticatorShotwellGoogleGoogle);
	_tmp0_ = self->priv->session;
	publishing_authenticator_shotwell_google_session_deauthenticate (_tmp0_);
	{
		SecretSchema* _tmp1_;
		SpitPublishingPluginHost* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		_tmp1_ = self->priv->schema;
		_tmp2_ = self->priv->host;
		_tmp3_ = spit_publishing_plugin_host_get_current_profile_id (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = self->priv->accountname;
		_tmp6_ = publishing_authenticator_shotwell_google_google_get_scopes (self, ",");
		_tmp7_ = _tmp6_;
		secret_password_clear_sync (_tmp1_, NULL, &_inner_error0_, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_SCHEMA_KEY_PROFILE_ID, _tmp4_, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_SCHEMA_KEY_ACCOUNTNAME, _tmp5_, "scope", _tmp7_, NULL);
		_g_free0 (_tmp7_);
		_g_free0 (_tmp4_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		gchar* _tmp8_;
		gchar* _tmp9_;
		GError* _tmp10_;
		const gchar* _tmp11_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp8_ = publishing_authenticator_shotwell_google_google_get_scopes (self, ",");
		_tmp9_ = _tmp8_;
		_tmp10_ = err;
		_tmp11_ = _tmp10_->message;
		g_critical ("GoogleAuthenticator.vala:128: Failed to remove password for scope %s: " \
"%s", _tmp9_, _tmp11_);
		_g_free0 (_tmp9_);
		_g_error_free0 (err);
	}
	__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;
	}
}

static void
publishing_authenticator_shotwell_google_google_real_refresh (SpitPublishingAuthenticator* base)
{
	PublishingAuthenticatorShotwellGoogleGoogle * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GOOGLE, PublishingAuthenticatorShotwellGoogleGoogle);
}

static void
publishing_authenticator_shotwell_google_google_real_set_accountname (SpitPublishingAuthenticator* base,
                                                                      const gchar* accountname)
{
	PublishingAuthenticatorShotwellGoogleGoogle * self;
	gchar* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GOOGLE, PublishingAuthenticatorShotwellGoogleGoogle);
	g_return_if_fail (accountname != NULL);
	_tmp0_ = g_strdup (accountname);
	_g_free0 (self->priv->accountname);
	self->priv->accountname = _tmp0_;
}

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

static void
publishing_authenticator_shotwell_google_google_do_hosted_web_authentication (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                              GAsyncReadyCallback _callback_,
                                                                              gpointer _user_data_)
{
	PublishingAuthenticatorShotwellGoogleGoogleDoHostedWebAuthenticationData* _data_;
	PublishingAuthenticatorShotwellGoogleGoogle* _tmp0_;
	g_return_if_fail (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_GOOGLE (self));
	_data_ = g_slice_new0 (PublishingAuthenticatorShotwellGoogleGoogleDoHostedWebAuthenticationData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, publishing_authenticator_shotwell_google_google_do_hosted_web_authentication_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	publishing_authenticator_shotwell_google_google_do_hosted_web_authentication_co (_data_);
}

static void
publishing_authenticator_shotwell_google_google_do_hosted_web_authentication_finish (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                                     GAsyncResult* _res_)
{
	PublishingAuthenticatorShotwellGoogleGoogleDoHostedWebAuthenticationData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static Block2Data*
block2_data_ref (Block2Data* _data2_)
{
	g_atomic_int_inc (&_data2_->_ref_count_);
	return _data2_;
}

static void
block2_data_unref (void * _userdata_)
{
	Block2Data* _data2_;
	_data2_ = (Block2Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
		PublishingAuthenticatorShotwellGoogleGoogle* self;
		self = _data2_->self;
		_g_free0 (_data2_->web_auth_code);
		_g_object_unref0 (self);
		g_slice_free (Block2Data, _data2_);
	}
}

static void
__lambda6_ (Block2Data* _data2_,
            GHashTable* prm)
{
	PublishingAuthenticatorShotwellGoogleGoogle* self;
	self = _data2_->self;
	g_return_if_fail (prm != NULL);
	if (g_hash_table_contains (prm, "code")) {
		gconstpointer _tmp0_;
		gchar* _tmp1_;
		_tmp0_ = g_hash_table_lookup (prm, "code");
		_tmp1_ = g_strdup ((const gchar*) _tmp0_);
		_g_free0 (_data2_->web_auth_code);
		_data2_->web_auth_code = _tmp1_;
	}
	if (g_hash_table_contains (prm, "scope")) {
		gconstpointer _tmp2_;
		_tmp2_ = g_hash_table_lookup (prm, "scope");
		g_debug ("GoogleAuthenticator.vala:168: Effective scopes as returned from login:" \
" %s", (const gchar*) _tmp2_);
	}
	publishing_authenticator_shotwell_google_google_do_hosted_web_authentication_co (_data2_->_async_data_);
}

static void
___lambda6__publishing_authenticator_shotwell_google_google_auth_callback_auth (PublishingAuthenticatorShotwellGoogleGoogleAuthCallback* _sender,
                                                                                GHashTable* params,
                                                                                gpointer self)
{
	__lambda6_ (self, params);
}

static void
publishing_authenticator_shotwell_google_google_do_hosted_web_authentication_ready (GObject* source_object,
                                                                                    GAsyncResult* _res_,
                                                                                    gpointer _user_data_)
{
	PublishingAuthenticatorShotwellGoogleGoogleDoHostedWebAuthenticationData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	publishing_authenticator_shotwell_google_google_do_hosted_web_authentication_co (_data_);
}

static gboolean
publishing_authenticator_shotwell_google_google_do_hosted_web_authentication_co (PublishingAuthenticatorShotwellGoogleGoogleDoHostedWebAuthenticationData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data2_ = g_slice_new0 (Block2Data);
	_data_->_data2_->_ref_count_ = 1;
	_data_->_data2_->self = g_object_ref (_data_->self);
	_data_->_data2_->_async_data_ = _data_;
	g_debug ("GoogleAuthenticator.vala:148: ACTION: running OAuth authentication flo" \
"w in hosted web pane.");
	_data_->_tmp0_ = g_uri_escape_string (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_OAUTH_CALLBACK_URI, NULL, TRUE);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = g_strconcat ("https://accounts.google.com/o/oauth2/auth?" "response_type=code&" "client_id=" PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_OAUTH_CLIENT_ID "&" "redirect_uri=", _data_->_tmp1_, NULL);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = g_strconcat (_data_->_tmp3_, "&", NULL);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = g_strconcat (_data_->_tmp5_, "scope=", NULL);
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = publishing_authenticator_shotwell_google_google_get_scopes (_data_->self, " ");
	_data_->_tmp9_ = _data_->_tmp8_;
	_data_->_tmp10_ = g_uri_escape_string (_data_->_tmp9_, NULL, TRUE);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_tmp12_ = g_strconcat (_data_->_tmp7_, _data_->_tmp11_, NULL);
	_data_->_tmp13_ = _data_->_tmp12_;
	_data_->_tmp14_ = g_strconcat (_data_->_tmp13_, "+", NULL);
	_data_->_tmp15_ = _data_->_tmp14_;
	_data_->_tmp16_ = g_uri_escape_string ("https://www.googleapis.com/auth/userinfo.profile", NULL, TRUE);
	_data_->_tmp17_ = _data_->_tmp16_;
	_data_->_tmp18_ = g_strconcat (_data_->_tmp15_, _data_->_tmp17_, NULL);
	_data_->_tmp19_ = _data_->_tmp18_;
	_data_->_tmp20_ = g_strconcat (_data_->_tmp19_, "&", NULL);
	_data_->_tmp21_ = _data_->_tmp20_;
	_data_->_tmp22_ = g_strconcat (_data_->_tmp21_, "state=connect&", NULL);
	_data_->_tmp23_ = _data_->_tmp22_;
	_data_->_tmp24_ = g_strconcat (_data_->_tmp23_, "access_type=offline&", NULL);
	_data_->_tmp25_ = _data_->_tmp24_;
	_data_->_tmp26_ = g_strconcat (_data_->_tmp25_, "approval_prompt=force", NULL);
	_data_->_tmp27_ = _data_->_tmp26_;
	_g_free0 (_data_->_tmp25_);
	_g_free0 (_data_->_tmp23_);
	_g_free0 (_data_->_tmp21_);
	_g_free0 (_data_->_tmp19_);
	_g_free0 (_data_->_tmp17_);
	_g_free0 (_data_->_tmp15_);
	_g_free0 (_data_->_tmp13_);
	_g_free0 (_data_->_tmp11_);
	_g_free0 (_data_->_tmp9_);
	_g_free0 (_data_->_tmp7_);
	_g_free0 (_data_->_tmp5_);
	_g_free0 (_data_->_tmp3_);
	_g_free0 (_data_->_tmp1_);
	_data_->user_authorization_url = _data_->_tmp27_;
	_data_->_tmp28_ = publishing_authenticator_shotwell_google_google_auth_callback_new ();
	_data_->auth_callback = _data_->_tmp28_;
	_data_->_data2_->web_auth_code = NULL;
	g_signal_connect_data (_data_->auth_callback, "auth", (GCallback) ___lambda6__publishing_authenticator_shotwell_google_google_auth_callback_auth, block2_data_ref (_data_->_data2_), (GClosureNotify) block2_data_unref, 0);
	_data_->_tmp29_ = _data_->self->priv->host;
	spit_publishing_plugin_host_register_auth_callback (_data_->_tmp29_, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_REVERSE_CLIENT_ID, G_TYPE_CHECK_INSTANCE_CAST (_data_->auth_callback, SPIT_PUBLISHING_TYPE_AUTHENTICATED_CALLBACK, SpitPublishingAuthenticatedCallback));
	{
		g_debug ("GoogleAuthenticator.vala:174: Launching external authentication on URI" \
" %s", _data_->user_authorization_url);
		g_app_info_launch_default_for_uri (_data_->user_authorization_url, NULL, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp30_ = _data_->self->priv->host;
		spit_publishing_plugin_host_install_login_wait_pane (_data_->_tmp30_);
		_data_->_state_ = 1;
		return FALSE;
		_state_1:
		;
		_data_->_state_ = 2;
		publishing_authenticator_shotwell_google_google_do_get_access_tokens (_data_->self, _data_->_data2_->web_auth_code, publishing_authenticator_shotwell_google_google_do_hosted_web_authentication_ready, _data_);
		return FALSE;
		_state_2:
		publishing_authenticator_shotwell_google_google_do_get_access_tokens_finish (_data_->self, _data_->_res_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->err = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp31_ = _data_->self->priv->host;
		_data_->_tmp32_ = _data_->err;
		spit_publishing_plugin_host_post_error (_data_->_tmp31_, _data_->_tmp32_);
		_g_error_free0 (_data_->err);
	}
	__finally0:
	{
		_data_->_tmp33_ = _data_->self->priv->host;
		spit_publishing_plugin_host_unregister_auth_callback (_data_->_tmp33_, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_REVERSE_CLIENT_ID);
	}
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->auth_callback);
		_g_free0 (_data_->user_authorization_url);
		block2_data_unref (_data_->_data2_);
		_data_->_data2_ = NULL;
		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_->auth_callback);
	_g_free0 (_data_->user_authorization_url);
	block2_data_unref (_data_->_data2_);
	_data_->_data2_ = NULL;
	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_authenticator_shotwell_google_google_do_get_access_tokens_data_free (gpointer _data)
{
	PublishingAuthenticatorShotwellGoogleGoogleDoGetAccessTokensData* _data_;
	_data_ = _data;
	_g_free0 (_data_->auth_code);
	_g_object_unref0 (_data_->self);
	g_slice_free (PublishingAuthenticatorShotwellGoogleGoogleDoGetAccessTokensData, _data_);
}

static void
publishing_authenticator_shotwell_google_google_do_get_access_tokens (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                      const gchar* auth_code,
                                                                      GAsyncReadyCallback _callback_,
                                                                      gpointer _user_data_)
{
	PublishingAuthenticatorShotwellGoogleGoogleDoGetAccessTokensData* _data_;
	PublishingAuthenticatorShotwellGoogleGoogle* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_GOOGLE (self));
	g_return_if_fail (auth_code != NULL);
	_data_ = g_slice_new0 (PublishingAuthenticatorShotwellGoogleGoogleDoGetAccessTokensData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, publishing_authenticator_shotwell_google_google_do_get_access_tokens_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (auth_code);
	_g_free0 (_data_->auth_code);
	_data_->auth_code = _tmp1_;
	publishing_authenticator_shotwell_google_google_do_get_access_tokens_co (_data_);
}

static void
publishing_authenticator_shotwell_google_google_do_get_access_tokens_finish (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                             GAsyncResult* _res_)
{
	PublishingAuthenticatorShotwellGoogleGoogleDoGetAccessTokensData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
publishing_authenticator_shotwell_google_google_do_get_access_tokens_ready (GObject* source_object,
                                                                            GAsyncResult* _res_,
                                                                            gpointer _user_data_)
{
	PublishingAuthenticatorShotwellGoogleGoogleDoGetAccessTokensData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	publishing_authenticator_shotwell_google_google_do_get_access_tokens_co (_data_);
}

static gboolean
publishing_authenticator_shotwell_google_google_do_get_access_tokens_co (PublishingAuthenticatorShotwellGoogleGoogleDoGetAccessTokensData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	g_debug ("GoogleAuthenticator.vala:190: ACTION: exchanging authorization code fo" \
"r access & refresh tokens");
	_data_->_tmp0_ = _data_->self->priv->host;
	spit_publishing_plugin_host_install_login_wait_pane (_data_->_tmp0_);
	_data_->_tmp1_ = _data_->self->priv->session;
	_data_->_tmp2_ = publishing_authenticator_shotwell_google_get_access_tokens_transaction_new (_data_->_tmp1_, _data_->auth_code);
	_data_->tokens_txn = _data_->_tmp2_;
	{
		_data_->_state_ = 1;
		publishing_rest_support_transaction_execute_async (G_TYPE_CHECK_INSTANCE_CAST (_data_->tokens_txn, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), publishing_authenticator_shotwell_google_google_do_get_access_tokens_ready, _data_);
		return FALSE;
		_state_1:
		publishing_rest_support_transaction_execute_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->tokens_txn, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		g_debug ("GoogleAuthenticator.vala:198: %s", "EVENT: network transaction to exchange authorization code for access t" \
"okens " "completed successfully.");
		_data_->_tmp3_ = publishing_rest_support_transaction_get_response (G_TYPE_CHECK_INSTANCE_CAST (_data_->tokens_txn, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction));
		_data_->_tmp4_ = _data_->_tmp3_;
		publishing_authenticator_shotwell_google_google_do_extract_tokens (_data_->self, _data_->_tmp4_);
		_g_free0 (_data_->_tmp4_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->err = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp5_ = publishing_rest_support_transaction_get_response (G_TYPE_CHECK_INSTANCE_CAST (_data_->tokens_txn, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction));
		_data_->_tmp6_ = _data_->_tmp5_;
		g_debug ("EVENT: network transaction to exchange authorization code for access t" \
"okens " "failed; response = '%s'", _data_->_tmp6_);
		_g_free0 (_data_->_tmp6_);
		_data_->_tmp7_ = _data_->self->priv->host;
		_data_->_tmp8_ = _data_->err;
		spit_publishing_plugin_host_post_error (_data_->_tmp7_, _data_->_tmp8_);
		_g_error_free0 (_data_->err);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_publishing_rest_support_transaction_unref0 (_data_->tokens_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_->tokens_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 void
publishing_authenticator_shotwell_google_google_do_extract_tokens (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                   const gchar* response_body)
{
	JsonParser* parser = NULL;
	JsonParser* _tmp0_;
	JsonObject* response_obj = NULL;
	JsonParser* _tmp9_;
	JsonNode* _tmp10_;
	JsonObject* _tmp11_;
	JsonObject* _tmp12_;
	gboolean _tmp13_ = FALSE;
	JsonObject* _tmp14_;
	JsonObject* _tmp19_;
	JsonObject* _tmp21_;
	JsonObject* _tmp27_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_GOOGLE (self));
	g_return_if_fail (response_body != NULL);
	g_debug ("GoogleAuthenticator.vala:210: ACTION: extracting OAuth tokens from bod" \
"y of server response");
	_tmp0_ = json_parser_new ();
	parser = _tmp0_;
	{
		JsonParser* _tmp1_;
		_tmp1_ = parser;
		json_parser_load_from_data (_tmp1_, response_body, (gssize) -1, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		SpitPublishingPluginHost* _tmp2_;
		GError* _tmp3_;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		GError* _tmp7_;
		GError* _tmp8_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp2_ = self->priv->host;
		_tmp3_ = err;
		_tmp4_ = _tmp3_->message;
		_tmp5_ = g_strconcat ("Couldn't parse JSON response: ", _tmp4_, NULL);
		_tmp6_ = _tmp5_;
		_tmp7_ = g_error_new_literal (SPIT_PUBLISHING_PUBLISHING_ERROR, SPIT_PUBLISHING_PUBLISHING_ERROR_MALFORMED_RESPONSE, _tmp6_);
		_tmp8_ = _tmp7_;
		spit_publishing_plugin_host_post_error (_tmp2_, _tmp8_);
		_g_error_free0 (_tmp8_);
		_g_free0 (_tmp6_);
		_g_error_free0 (err);
		_g_object_unref0 (parser);
		return;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (parser);
		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;
	}
	_tmp9_ = parser;
	_tmp10_ = json_parser_get_root (_tmp9_);
	_tmp11_ = json_node_get_object (_tmp10_);
	_tmp12_ = _json_object_ref0 (_tmp11_);
	response_obj = _tmp12_;
	_tmp14_ = response_obj;
	if (!json_object_has_member (_tmp14_, "access_token")) {
		JsonObject* _tmp15_;
		_tmp15_ = response_obj;
		_tmp13_ = !json_object_has_member (_tmp15_, "refresh_token");
	} else {
		_tmp13_ = FALSE;
	}
	if (_tmp13_) {
		SpitPublishingPluginHost* _tmp16_;
		GError* _tmp17_;
		GError* _tmp18_;
		_tmp16_ = self->priv->host;
		_tmp17_ = g_error_new_literal (SPIT_PUBLISHING_PUBLISHING_ERROR, SPIT_PUBLISHING_PUBLISHING_ERROR_MALFORMED_RESPONSE, "neither access_token nor refresh_token not present in server response");
		_tmp18_ = _tmp17_;
		spit_publishing_plugin_host_post_error (_tmp16_, _tmp18_);
		_g_error_free0 (_tmp18_);
		_json_object_unref0 (response_obj);
		_g_object_unref0 (parser);
		return;
	}
	_tmp19_ = response_obj;
	if (json_object_has_member (_tmp19_, "expires_in")) {
		gint64 duration = 0LL;
		JsonObject* _tmp20_;
		gint64 abs_time = 0LL;
		_tmp20_ = response_obj;
		duration = json_object_get_int_member (_tmp20_, "expires_in");
		abs_time = g_get_real_time () + ((duration * 1000L) * 1000L);
		publishing_authenticator_shotwell_google_google_on_expiry_time_avilable (self, abs_time);
	}
	_tmp21_ = response_obj;
	if (json_object_has_member (_tmp21_, "refresh_token")) {
		gchar* refresh_token = NULL;
		JsonObject* _tmp22_;
		const gchar* _tmp23_;
		gchar* _tmp24_;
		const gchar* _tmp25_;
		_tmp22_ = response_obj;
		_tmp23_ = json_object_get_string_member (_tmp22_, "refresh_token");
		_tmp24_ = g_strdup (_tmp23_);
		refresh_token = _tmp24_;
		_tmp25_ = refresh_token;
		if (g_strcmp0 (_tmp25_, "") != 0) {
			const gchar* _tmp26_;
			_tmp26_ = refresh_token;
			publishing_authenticator_shotwell_google_google_on_refresh_token_available (self, _tmp26_);
		}
		_g_free0 (refresh_token);
	}
	_tmp27_ = response_obj;
	if (json_object_has_member (_tmp27_, "access_token")) {
		gchar* access_token = NULL;
		JsonObject* _tmp28_;
		const gchar* _tmp29_;
		gchar* _tmp30_;
		const gchar* _tmp31_;
		_tmp28_ = response_obj;
		_tmp29_ = json_object_get_string_member (_tmp28_, "access_token");
		_tmp30_ = g_strdup (_tmp29_);
		access_token = _tmp30_;
		_tmp31_ = access_token;
		if (g_strcmp0 (_tmp31_, "") != 0) {
			const gchar* _tmp32_;
			_tmp32_ = access_token;
			publishing_authenticator_shotwell_google_google_on_access_token_available (self, _tmp32_);
		}
		_g_free0 (access_token);
	}
	_json_object_unref0 (response_obj);
	_g_object_unref0 (parser);
}

static void
publishing_authenticator_shotwell_google_google_on_refresh_token_available (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                            const gchar* token)
{
	GHashTable* _tmp0_;
	gchar* _tmp1_;
	GVariant* _tmp2_;
	PublishingAuthenticatorShotwellGoogleSession* _tmp3_;
	gchar* _tmp4_;
	g_return_if_fail (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_GOOGLE (self));
	g_return_if_fail (token != NULL);
	g_debug ("GoogleAuthenticator.vala:252: EVENT: an OAuth refresh token has become" \
" available; token = '%s'.", token);
	_tmp0_ = self->priv->params;
	_tmp1_ = g_strdup ("RefreshToken");
	_tmp2_ = g_variant_new_string (token);
	g_variant_ref_sink (_tmp2_);
	g_hash_table_insert (_tmp0_, _tmp1_, _tmp2_);
	_tmp3_ = self->priv->session;
	_tmp4_ = g_strdup (token);
	_g_free0 (_tmp3_->refresh_token);
	_tmp3_->refresh_token = _tmp4_;
}

static void
publishing_authenticator_shotwell_google_google_on_expiry_time_avilable (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                         gint64 abs_time)
{
	PublishingAuthenticatorShotwellGoogleSession* _tmp0_;
	GHashTable* _tmp1_;
	gchar* _tmp2_;
	GVariant* _tmp3_;
	g_return_if_fail (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_GOOGLE (self));
	g_debug ("EVENT: an OAuth access token expiry time became available; time = %'" G_GINT64_FORMAT "'.", abs_time);
	_tmp0_ = self->priv->session;
	_tmp0_->expires_at = abs_time;
	_tmp1_ = self->priv->params;
	_tmp2_ = g_strdup ("ExpiryTime");
	_tmp3_ = g_variant_new_int64 (abs_time);
	g_variant_ref_sink (_tmp3_);
	g_hash_table_insert (_tmp1_, _tmp2_, _tmp3_);
}

static void
publishing_authenticator_shotwell_google_google_on_access_token_available (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                           const gchar* token)
{
	PublishingAuthenticatorShotwellGoogleSession* _tmp0_;
	gchar* _tmp1_;
	GHashTable* _tmp2_;
	gchar* _tmp3_;
	GVariant* _tmp4_;
	g_return_if_fail (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_GOOGLE (self));
	g_return_if_fail (token != NULL);
	g_debug ("GoogleAuthenticator.vala:268: EVENT: an OAuth access token has become " \
"available; token = '%s'.", token);
	_tmp0_ = self->priv->session;
	_tmp1_ = g_strdup (token);
	_g_free0 (_tmp0_->access_token);
	_tmp0_->access_token = _tmp1_;
	_tmp2_ = self->priv->params;
	_tmp3_ = g_strdup ("AccessToken");
	_tmp4_ = g_variant_new_string (token);
	g_variant_ref_sink (_tmp4_);
	g_hash_table_insert (_tmp2_, _tmp3_, _tmp4_);
	publishing_authenticator_shotwell_google_google_do_fetch_username (self, NULL, NULL);
}

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

static void
publishing_authenticator_shotwell_google_google_do_fetch_username (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                   GAsyncReadyCallback _callback_,
                                                                   gpointer _user_data_)
{
	PublishingAuthenticatorShotwellGoogleGoogleDoFetchUsernameData* _data_;
	PublishingAuthenticatorShotwellGoogleGoogle* _tmp0_;
	g_return_if_fail (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_GOOGLE (self));
	_data_ = g_slice_new0 (PublishingAuthenticatorShotwellGoogleGoogleDoFetchUsernameData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, publishing_authenticator_shotwell_google_google_do_fetch_username_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	publishing_authenticator_shotwell_google_google_do_fetch_username_co (_data_);
}

static void
publishing_authenticator_shotwell_google_google_do_fetch_username_finish (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                          GAsyncResult* _res_)
{
	PublishingAuthenticatorShotwellGoogleGoogleDoFetchUsernameData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
publishing_authenticator_shotwell_google_google_do_fetch_username_ready (GObject* source_object,
                                                                         GAsyncResult* _res_,
                                                                         gpointer _user_data_)
{
	PublishingAuthenticatorShotwellGoogleGoogleDoFetchUsernameData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	publishing_authenticator_shotwell_google_google_do_fetch_username_co (_data_);
}

static gboolean
publishing_authenticator_shotwell_google_google_do_fetch_username_co (PublishingAuthenticatorShotwellGoogleGoogleDoFetchUsernameData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	g_debug ("GoogleAuthenticator.vala:277: ACTION: running network transaction to f" \
"etch username.");
	_data_->_tmp0_ = _data_->self->priv->host;
	spit_publishing_plugin_host_install_login_wait_pane (_data_->_tmp0_);
	_data_->_tmp1_ = _data_->self->priv->host;
	spit_publishing_plugin_host_set_service_locked (_data_->_tmp1_, TRUE);
	_data_->_tmp2_ = _data_->self->priv->session;
	_data_->_tmp3_ = publishing_authenticator_shotwell_google_username_fetch_transaction_new (_data_->_tmp2_);
	_data_->txn = _data_->_tmp3_;
	{
		_data_->_state_ = 1;
		publishing_rest_support_transaction_execute_async (G_TYPE_CHECK_INSTANCE_CAST (_data_->txn, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), publishing_authenticator_shotwell_google_google_do_fetch_username_ready, _data_);
		return FALSE;
		_state_1:
		publishing_rest_support_transaction_execute_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->txn, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		g_debug ("GoogleAuthenticator.vala:286: EVENT: username fetch transaction comple" \
"ted successfully.");
		_data_->_tmp4_ = publishing_rest_support_transaction_get_response (G_TYPE_CHECK_INSTANCE_CAST (_data_->txn, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction));
		_data_->_tmp5_ = _data_->_tmp4_;
		publishing_authenticator_shotwell_google_google_do_extract_username (_data_->self, _data_->_tmp5_);
		_g_free0 (_data_->_tmp5_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->err = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		g_debug ("GoogleAuthenticator.vala:289: EVENT: username fetch transaction caused" \
" a network error");
		_data_->_tmp6_ = _data_->self->priv->host;
		_data_->_tmp7_ = _data_->err;
		spit_publishing_plugin_host_post_error (_data_->_tmp6_, _data_->_tmp7_);
		_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 void
publishing_authenticator_shotwell_google_google_do_extract_username (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                     const gchar* response_body)
{
	JsonParser* parser = NULL;
	JsonParser* _tmp0_;
	JsonObject* response_obj = NULL;
	JsonParser* _tmp9_;
	JsonNode* _tmp10_;
	JsonObject* _tmp11_;
	JsonObject* _tmp12_;
	JsonObject* _tmp13_;
	JsonObject* _tmp22_;
	PublishingAuthenticatorShotwellGoogleSession* _tmp31_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_GOOGLE (self));
	g_return_if_fail (response_body != NULL);
	g_debug ("GoogleAuthenticator.vala:296: ACTION: extracting username from body of" \
" server response");
	_tmp0_ = json_parser_new ();
	parser = _tmp0_;
	{
		JsonParser* _tmp1_;
		_tmp1_ = parser;
		json_parser_load_from_data (_tmp1_, response_body, (gssize) -1, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		SpitPublishingPluginHost* _tmp2_;
		GError* _tmp3_;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		GError* _tmp7_;
		GError* _tmp8_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp2_ = self->priv->host;
		_tmp3_ = err;
		_tmp4_ = _tmp3_->message;
		_tmp5_ = g_strconcat ("Couldn't parse JSON response: ", _tmp4_, NULL);
		_tmp6_ = _tmp5_;
		_tmp7_ = g_error_new_literal (SPIT_PUBLISHING_PUBLISHING_ERROR, SPIT_PUBLISHING_PUBLISHING_ERROR_MALFORMED_RESPONSE, _tmp6_);
		_tmp8_ = _tmp7_;
		spit_publishing_plugin_host_post_error (_tmp2_, _tmp8_);
		_g_error_free0 (_tmp8_);
		_g_free0 (_tmp6_);
		_g_error_free0 (err);
		_g_object_unref0 (parser);
		return;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (parser);
		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;
	}
	_tmp9_ = parser;
	_tmp10_ = json_parser_get_root (_tmp9_);
	_tmp11_ = json_node_get_object (_tmp10_);
	_tmp12_ = _json_object_ref0 (_tmp11_);
	response_obj = _tmp12_;
	_tmp13_ = response_obj;
	if (json_object_has_member (_tmp13_, "name")) {
		gchar* username = NULL;
		JsonObject* _tmp14_;
		const gchar* _tmp15_;
		gchar* _tmp16_;
		const gchar* _tmp17_;
		_tmp14_ = response_obj;
		_tmp15_ = json_object_get_string_member (_tmp14_, "name");
		_tmp16_ = g_strdup (_tmp15_);
		username = _tmp16_;
		_tmp17_ = username;
		if (g_strcmp0 (_tmp17_, "") != 0) {
			GHashTable* _tmp18_;
			gchar* _tmp19_;
			const gchar* _tmp20_;
			GVariant* _tmp21_;
			_tmp18_ = self->priv->params;
			_tmp19_ = g_strdup ("UserName");
			_tmp20_ = username;
			_tmp21_ = g_variant_new_string (_tmp20_);
			g_variant_ref_sink (_tmp21_);
			g_hash_table_insert (_tmp18_, _tmp19_, _tmp21_);
		}
		_g_free0 (username);
	}
	_tmp22_ = response_obj;
	if (json_object_has_member (_tmp22_, "access_token")) {
		gchar* access_token = NULL;
		JsonObject* _tmp23_;
		const gchar* _tmp24_;
		gchar* _tmp25_;
		const gchar* _tmp26_;
		_tmp23_ = response_obj;
		_tmp24_ = json_object_get_string_member (_tmp23_, "access_token");
		_tmp25_ = g_strdup (_tmp24_);
		access_token = _tmp25_;
		_tmp26_ = access_token;
		if (g_strcmp0 (_tmp26_, "") != 0) {
			GHashTable* _tmp27_;
			gchar* _tmp28_;
			const gchar* _tmp29_;
			GVariant* _tmp30_;
			_tmp27_ = self->priv->params;
			_tmp28_ = g_strdup ("AccessToken");
			_tmp29_ = access_token;
			_tmp30_ = g_variant_new_string (_tmp29_);
			g_variant_ref_sink (_tmp30_);
			g_hash_table_insert (_tmp27_, _tmp28_, _tmp30_);
		}
		_g_free0 (access_token);
	}
	_tmp31_ = self->priv->session;
	_vala_assert (publishing_rest_support_session_is_authenticated (G_TYPE_CHECK_INSTANCE_CAST (_tmp31_, PUBLISHING_REST_SUPPORT_TYPE_SESSION, PublishingRESTSupportSession)), "session.is_authenticated()");
	{
		SecretSchema* _tmp32_;
		const gchar* _tmp33_;
		gchar* _tmp34_;
		gchar* _tmp35_;
		gchar* _tmp36_;
		gchar* _tmp37_;
		PublishingAuthenticatorShotwellGoogleSession* _tmp38_;
		const gchar* _tmp39_;
		SpitPublishingPluginHost* _tmp40_;
		gchar* _tmp41_;
		gchar* _tmp42_;
		const gchar* _tmp43_;
		gchar* _tmp44_;
		gchar* _tmp45_;
		_tmp32_ = self->priv->schema;
		_tmp33_ = self->priv->accountname;
		_tmp34_ = publishing_authenticator_shotwell_google_google_get_scopes (self, ",");
		_tmp35_ = _tmp34_;
		_tmp36_ = g_strdup_printf ("Shotwell publishing (Google account scope %s@%s)", _tmp33_, _tmp35_);
		_tmp37_ = _tmp36_;
		_tmp38_ = self->priv->session;
		_tmp39_ = _tmp38_->refresh_token;
		_tmp40_ = self->priv->host;
		_tmp41_ = spit_publishing_plugin_host_get_current_profile_id (_tmp40_);
		_tmp42_ = _tmp41_;
		_tmp43_ = self->priv->accountname;
		_tmp44_ = publishing_authenticator_shotwell_google_google_get_scopes (self, ",");
		_tmp45_ = _tmp44_;
		secret_password_store_sync (_tmp32_, SECRET_COLLECTION_DEFAULT, _tmp37_, _tmp39_, NULL, &_inner_error0_, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_SCHEMA_KEY_PROFILE_ID, _tmp42_, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_SCHEMA_KEY_ACCOUNTNAME, _tmp43_, "scope", _tmp45_, NULL);
		_g_free0 (_tmp45_);
		_g_free0 (_tmp42_);
		_g_free0 (_tmp37_);
		_g_free0 (_tmp35_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch1_g_error;
		}
	}
	goto __finally1;
	__catch1_g_error:
	{
		GError* err = NULL;
		gchar* _tmp46_;
		gchar* _tmp47_;
		GError* _tmp48_;
		const gchar* _tmp49_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp46_ = publishing_authenticator_shotwell_google_google_get_scopes (self, ",");
		_tmp47_ = _tmp46_;
		_tmp48_ = err;
		_tmp49_ = _tmp48_->message;
		g_critical ("GoogleAuthenticator.vala:334: Failed to look up password for scope %s:" \
" %s", _tmp47_, _tmp49_);
		_g_free0 (_tmp47_);
		_g_error_free0 (err);
	}
	__finally1:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_json_object_unref0 (response_obj);
		_g_object_unref0 (parser);
		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;
	}
	g_signal_emit_by_name (G_TYPE_CHECK_INSTANCE_CAST (self, SPIT_PUBLISHING_TYPE_AUTHENTICATOR, SpitPublishingAuthenticator), "authenticated");
	_json_object_unref0 (response_obj);
	_g_object_unref0 (parser);
}

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

static void
publishing_authenticator_shotwell_google_google_do_exchange_refresh_token_for_access_token (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                                            GAsyncReadyCallback _callback_,
                                                                                            gpointer _user_data_)
{
	PublishingAuthenticatorShotwellGoogleGoogleDoExchangeRefreshTokenForAccessTokenData* _data_;
	PublishingAuthenticatorShotwellGoogleGoogle* _tmp0_;
	g_return_if_fail (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_GOOGLE (self));
	_data_ = g_slice_new0 (PublishingAuthenticatorShotwellGoogleGoogleDoExchangeRefreshTokenForAccessTokenData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, publishing_authenticator_shotwell_google_google_do_exchange_refresh_token_for_access_token_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	publishing_authenticator_shotwell_google_google_do_exchange_refresh_token_for_access_token_co (_data_);
}

static void
publishing_authenticator_shotwell_google_google_do_exchange_refresh_token_for_access_token_finish (PublishingAuthenticatorShotwellGoogleGoogle* self,
                                                                                                   GAsyncResult* _res_)
{
	PublishingAuthenticatorShotwellGoogleGoogleDoExchangeRefreshTokenForAccessTokenData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
publishing_authenticator_shotwell_google_google_do_exchange_refresh_token_for_access_token_ready (GObject* source_object,
                                                                                                  GAsyncResult* _res_,
                                                                                                  gpointer _user_data_)
{
	PublishingAuthenticatorShotwellGoogleGoogleDoExchangeRefreshTokenForAccessTokenData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	publishing_authenticator_shotwell_google_google_do_exchange_refresh_token_for_access_token_co (_data_);
}

static gboolean
____lambda5_ (PublishingAuthenticatorShotwellGoogleGoogle* self)
{
	gboolean result;
	spit_publishing_authenticator_authenticate (G_TYPE_CHECK_INSTANCE_CAST (self, SPIT_PUBLISHING_TYPE_AUTHENTICATOR, SpitPublishingAuthenticator));
	result = FALSE;
	return result;
}

static gboolean
_____lambda5__gsource_func (gpointer self)
{
	gboolean result;
	result = ____lambda5_ ((PublishingAuthenticatorShotwellGoogleGoogle*) self);
	return result;
}

static gboolean
publishing_authenticator_shotwell_google_google_do_exchange_refresh_token_for_access_token_co (PublishingAuthenticatorShotwellGoogleGoogleDoExchangeRefreshTokenForAccessTokenData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	g_debug ("GoogleAuthenticator.vala:341: ACTION: exchanging OAuth refresh token f" \
"or OAuth access token.");
	_data_->_tmp0_ = _data_->self->priv->host;
	spit_publishing_plugin_host_install_login_wait_pane (_data_->_tmp0_);
	_data_->_tmp1_ = _data_->self->priv->session;
	_data_->_tmp2_ = publishing_authenticator_shotwell_google_refresh_access_token_transaction_new (_data_->_tmp1_);
	_data_->txn = _data_->_tmp2_;
	{
		_data_->_tmp3_ = _data_->txn;
		_data_->_state_ = 1;
		publishing_rest_support_transaction_execute_async (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp3_, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), publishing_authenticator_shotwell_google_google_do_exchange_refresh_token_for_access_token_ready, _data_);
		return FALSE;
		_state_1:
		publishing_rest_support_transaction_execute_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp3_, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction), _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		g_debug ("GoogleAuthenticator.vala:348: EVENT: refresh access token transaction " \
"completed successfully.");
		_data_->_tmp4_ = _data_->self->priv->session;
		if (publishing_rest_support_session_is_authenticated (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp4_, PUBLISHING_REST_SUPPORT_TYPE_SESSION, PublishingRESTSupportSession))) {
			_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_->_tmp5_ = _data_->txn;
		_data_->_tmp6_ = publishing_rest_support_transaction_get_response (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp5_, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction));
		_data_->_tmp7_ = _data_->_tmp6_;
		publishing_authenticator_shotwell_google_google_do_extract_tokens (_data_->self, _data_->_tmp7_);
		_g_free0 (_data_->_tmp7_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->err = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		g_debug ("GoogleAuthenticator.vala:355: EVENT: refresh access token transaction " \
"caused a network error.");
		_data_->_tmp8_ = _data_->self->priv->session;
		if (publishing_rest_support_session_is_authenticated (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp8_, PUBLISHING_REST_SUPPORT_TYPE_SESSION, PublishingRESTSupportSession))) {
			_g_error_free0 (_data_->err);
			_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_->_tmp10_ = _data_->txn;
		if (publishing_rest_support_transaction_get_status_code (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp10_, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction)) == ((guint) SOUP_STATUS_BAD_REQUEST)) {
			_data_->_tmp9_ = TRUE;
		} else {
			_data_->_tmp11_ = _data_->txn;
			_data_->_tmp9_ = publishing_rest_support_transaction_get_status_code (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp11_, PUBLISHING_REST_SUPPORT_TYPE_TRANSACTION, PublishingRESTSupportTransaction)) == ((guint) SOUP_STATUS_UNAUTHORIZED);
		}
		if (_data_->_tmp9_) {
			{
				_data_->_tmp12_ = _data_->self->priv->schema;
				_data_->_tmp13_ = _data_->self->priv->host;
				_data_->_tmp14_ = spit_publishing_plugin_host_get_current_profile_id (_data_->_tmp13_);
				_data_->_tmp15_ = _data_->_tmp14_;
				_data_->_tmp16_ = _data_->self->priv->accountname;
				_data_->_tmp17_ = publishing_authenticator_shotwell_google_google_get_scopes (_data_->self, ",");
				_data_->_tmp18_ = _data_->_tmp17_;
				secret_password_clear_sync (_data_->_tmp12_, NULL, &_data_->_inner_error0_, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_SCHEMA_KEY_PROFILE_ID, _data_->_tmp15_, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_SCHEMA_KEY_ACCOUNTNAME, _data_->_tmp16_, "scope", _data_->_tmp18_, NULL);
				_g_free0 (_data_->_tmp18_);
				_g_free0 (_data_->_tmp15_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					goto __catch1_g_error;
				}
			}
			goto __finally1;
			__catch1_g_error:
			{
				_data_->_vala1_err = _data_->_inner_error0_;
				_data_->_inner_error0_ = NULL;
				_data_->_tmp19_ = _data_->self->priv->accountname;
				_data_->_tmp20_ = publishing_authenticator_shotwell_google_google_get_scopes (_data_->self, ",");
				_data_->_tmp21_ = _data_->_tmp20_;
				_data_->_tmp22_ = _data_->_vala1_err;
				_data_->_tmp23_ = _data_->_tmp22_->message;
				g_critical ("GoogleAuthenticator.vala:368: Failed to remove password for accountnam" \
"e@scope %s@%s: %s", _data_->_tmp19_, _data_->_tmp21_, _data_->_tmp23_);
				_g_free0 (_data_->_tmp21_);
				_g_error_free0 (_data_->_vala1_err);
			}
			__finally1:
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_error_free0 (_data_->err);
				_publishing_rest_support_transaction_unref0 (_data_->txn);
				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;
			}
			g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _____lambda5__gsource_func, g_object_ref (_data_->self), g_object_unref);
		}
		_data_->_tmp24_ = _data_->self->priv->host;
		_data_->_tmp25_ = _data_->err;
		spit_publishing_plugin_host_post_error (_data_->_tmp24_, _data_->_tmp25_);
		_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 void
_publishing_authenticator_shotwell_google_google_on_service_welcome_login_spit_publishing_login_callback (gpointer self)
{
	publishing_authenticator_shotwell_google_google_on_service_welcome_login ((PublishingAuthenticatorShotwellGoogleGoogle*) self);
}

static void
publishing_authenticator_shotwell_google_google_do_show_service_welcome_pane (PublishingAuthenticatorShotwellGoogleGoogle* self)
{
	SpitPublishingPluginHost* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_GOOGLE (self));
	g_debug ("GoogleAuthenticator.vala:379: ACTION: showing service welcome pane.");
	_tmp0_ = self->priv->host;
	_tmp1_ = self->priv->welcome_message;
	spit_publishing_plugin_host_install_welcome_pane (_tmp0_, _tmp1_, _publishing_authenticator_shotwell_google_google_on_service_welcome_login_spit_publishing_login_callback, self);
}

static void
publishing_authenticator_shotwell_google_google_on_service_welcome_login (PublishingAuthenticatorShotwellGoogleGoogle* self)
{
	g_return_if_fail (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_IS_GOOGLE (self));
	g_debug ("GoogleAuthenticator.vala:385: EVENT: user clicked 'Login' in welcome p" \
"ane.");
	publishing_authenticator_shotwell_google_google_do_hosted_web_authentication (self, NULL, NULL);
}

static void
publishing_authenticator_shotwell_google_google_auth_callback_real_authenticated (SpitPublishingAuthenticatedCallback* base,
                                                                                  GHashTable* params)
{
	PublishingAuthenticatorShotwellGoogleGoogleAuthCallback * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_TYPE_AUTH_CALLBACK, PublishingAuthenticatorShotwellGoogleGoogleAuthCallback);
	g_return_if_fail (params != NULL);
	g_signal_emit (self, publishing_authenticator_shotwell_google_google_auth_callback_signals[PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_AUTH_CALLBACK_AUTH_SIGNAL], 0, params);
}

static PublishingAuthenticatorShotwellGoogleGoogleAuthCallback*
publishing_authenticator_shotwell_google_google_auth_callback_construct (GType object_type)
{
	PublishingAuthenticatorShotwellGoogleGoogleAuthCallback * self = NULL;
	self = (PublishingAuthenticatorShotwellGoogleGoogleAuthCallback*) g_object_new (object_type, NULL);
	return self;
}

static PublishingAuthenticatorShotwellGoogleGoogleAuthCallback*
publishing_authenticator_shotwell_google_google_auth_callback_new (void)
{
	return publishing_authenticator_shotwell_google_google_auth_callback_construct (PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_TYPE_AUTH_CALLBACK);
}

static void
publishing_authenticator_shotwell_google_google_auth_callback_class_init (PublishingAuthenticatorShotwellGoogleGoogleAuthCallbackClass * klass,
                                                                          gpointer klass_data)
{
	publishing_authenticator_shotwell_google_google_auth_callback_parent_class = g_type_class_peek_parent (klass);
	publishing_authenticator_shotwell_google_google_auth_callback_signals[PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_AUTH_CALLBACK_AUTH_SIGNAL] = g_signal_new ("auth", PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_GOOGLE_TYPE_AUTH_CALLBACK, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOXED, G_TYPE_NONE, 1, G_TYPE_HASH_TABLE);
}

static void
publishing_authenticator_shotwell_google_google_auth_callback_spit_publishing_authenticated_callback_interface_init (SpitPublishingAuthenticatedCallbackIface * iface,
                                                                                                                     gpointer iface_data)
{
	publishing_authenticator_shotwell_google_google_auth_callback_spit_publishing_authenticated_callback_parent_iface = g_type_interface_peek_parent (iface);
	iface->authenticated = (void (*) (SpitPublishingAuthenticatedCallback*, GHashTable*)) publishing_authenticator_shotwell_google_google_auth_callback_real_authenticated;
}

static void
publishing_authenticator_shotwell_google_google_auth_callback_instance_init (PublishingAuthenticatorShotwellGoogleGoogleAuthCallback * self,
                                                                             gpointer klass)
{
}

static GType
publishing_authenticator_shotwell_google_google_auth_callback_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PublishingAuthenticatorShotwellGoogleGoogleAuthCallbackClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) publishing_authenticator_shotwell_google_google_auth_callback_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PublishingAuthenticatorShotwellGoogleGoogleAuthCallback), 0, (GInstanceInitFunc) publishing_authenticator_shotwell_google_google_auth_callback_instance_init, NULL };
	static const GInterfaceInfo spit_publishing_authenticated_callback_info = { (GInterfaceInitFunc) publishing_authenticator_shotwell_google_google_auth_callback_spit_publishing_authenticated_callback_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType publishing_authenticator_shotwell_google_google_auth_callback_type_id;
	publishing_authenticator_shotwell_google_google_auth_callback_type_id = g_type_register_static (G_TYPE_OBJECT, "PublishingAuthenticatorShotwellGoogleGoogleAuthCallback", &g_define_type_info, 0);
	g_type_add_interface_static (publishing_authenticator_shotwell_google_google_auth_callback_type_id, SPIT_PUBLISHING_TYPE_AUTHENTICATED_CALLBACK, &spit_publishing_authenticated_callback_info);
	return publishing_authenticator_shotwell_google_google_auth_callback_type_id;
}

static GType
publishing_authenticator_shotwell_google_google_auth_callback_get_type (void)
{
	static volatile gsize publishing_authenticator_shotwell_google_google_auth_callback_type_id__once = 0;
	if (g_once_init_enter (&publishing_authenticator_shotwell_google_google_auth_callback_type_id__once)) {
		GType publishing_authenticator_shotwell_google_google_auth_callback_type_id;
		publishing_authenticator_shotwell_google_google_auth_callback_type_id = publishing_authenticator_shotwell_google_google_auth_callback_get_type_once ();
		g_once_init_leave (&publishing_authenticator_shotwell_google_google_auth_callback_type_id__once, publishing_authenticator_shotwell_google_google_auth_callback_type_id);
	}
	return publishing_authenticator_shotwell_google_google_auth_callback_type_id__once;
}

static void
publishing_authenticator_shotwell_google_google_class_init (PublishingAuthenticatorShotwellGoogleGoogleClass * klass,
                                                            gpointer klass_data)
{
	publishing_authenticator_shotwell_google_google_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PublishingAuthenticatorShotwellGoogleGoogle_private_offset);
	G_OBJECT_CLASS (klass)->finalize = publishing_authenticator_shotwell_google_google_finalize;
}

static void
publishing_authenticator_shotwell_google_google_spit_publishing_authenticator_interface_init (SpitPublishingAuthenticatorIface * iface,
                                                                                              gpointer iface_data)
{
	publishing_authenticator_shotwell_google_google_spit_publishing_authenticator_parent_iface = g_type_interface_peek_parent (iface);
	iface->authenticate = (void (*) (SpitPublishingAuthenticator*)) publishing_authenticator_shotwell_google_google_real_authenticate;
	iface->can_logout = (gboolean (*) (SpitPublishingAuthenticator*)) publishing_authenticator_shotwell_google_google_real_can_logout;
	iface->get_authentication_parameter = (GHashTable* (*) (SpitPublishingAuthenticator*)) publishing_authenticator_shotwell_google_google_real_get_authentication_parameter;
	iface->logout = (void (*) (SpitPublishingAuthenticator*)) publishing_authenticator_shotwell_google_google_real_logout;
	iface->refresh = (void (*) (SpitPublishingAuthenticator*)) publishing_authenticator_shotwell_google_google_real_refresh;
	iface->set_accountname = (void (*) (SpitPublishingAuthenticator*, const gchar*)) publishing_authenticator_shotwell_google_google_real_set_accountname;
}

static void
publishing_authenticator_shotwell_google_google_instance_init (PublishingAuthenticatorShotwellGoogleGoogle * self,
                                                               gpointer klass)
{
	gchar* _tmp0_;
	self->priv = publishing_authenticator_shotwell_google_google_get_instance_private (self);
	self->priv->scopes = NULL;
	self->priv->scopes_length1 = 0;
	self->priv->_scopes_size_ = self->priv->scopes_length1;
	_tmp0_ = g_strdup ("default");
	self->priv->accountname = _tmp0_;
	self->priv->host = NULL;
	self->priv->params = NULL;
	self->priv->session = NULL;
	self->priv->welcome_message = NULL;
	self->priv->schema = NULL;
}

static void
publishing_authenticator_shotwell_google_google_finalize (GObject * obj)
{
	PublishingAuthenticatorShotwellGoogleGoogle * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PUBLISHING_AUTHENTICATOR_SHOTWELL_GOOGLE_TYPE_GOOGLE, PublishingAuthenticatorShotwellGoogleGoogle);
	self->priv->scopes = (_vala_array_free (self->priv->scopes, self->priv->scopes_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (self->priv->accountname);
	_g_object_unref0 (self->priv->host);
	_g_hash_table_unref0 (self->priv->params);
	_publishing_rest_support_session_unref0 (self->priv->session);
	_g_free0 (self->priv->welcome_message);
	_secret_schema_unref0 (self->priv->schema);
	G_OBJECT_CLASS (publishing_authenticator_shotwell_google_google_parent_class)->finalize (obj);
}

static GType
publishing_authenticator_shotwell_google_google_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PublishingAuthenticatorShotwellGoogleGoogleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) publishing_authenticator_shotwell_google_google_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PublishingAuthenticatorShotwellGoogleGoogle), 0, (GInstanceInitFunc) publishing_authenticator_shotwell_google_google_instance_init, NULL };
	static const GInterfaceInfo spit_publishing_authenticator_info = { (GInterfaceInitFunc) publishing_authenticator_shotwell_google_google_spit_publishing_authenticator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType publishing_authenticator_shotwell_google_google_type_id;
	publishing_authenticator_shotwell_google_google_type_id = g_type_register_static (G_TYPE_OBJECT, "PublishingAuthenticatorShotwellGoogleGoogle", &g_define_type_info, 0);
	g_type_add_interface_static (publishing_authenticator_shotwell_google_google_type_id, SPIT_PUBLISHING_TYPE_AUTHENTICATOR, &spit_publishing_authenticator_info);
	PublishingAuthenticatorShotwellGoogleGoogle_private_offset = g_type_add_instance_private (publishing_authenticator_shotwell_google_google_type_id, sizeof (PublishingAuthenticatorShotwellGoogleGooglePrivate));
	return publishing_authenticator_shotwell_google_google_type_id;
}

GType
publishing_authenticator_shotwell_google_google_get_type (void)
{
	static volatile gsize publishing_authenticator_shotwell_google_google_type_id__once = 0;
	if (g_once_init_enter (&publishing_authenticator_shotwell_google_google_type_id__once)) {
		GType publishing_authenticator_shotwell_google_google_type_id;
		publishing_authenticator_shotwell_google_google_type_id = publishing_authenticator_shotwell_google_google_get_type_once ();
		g_once_init_leave (&publishing_authenticator_shotwell_google_google_type_id__once, publishing_authenticator_shotwell_google_google_type_id);
	}
	return publishing_authenticator_shotwell_google_google_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);
}

