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

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 2 -*- */
/*
    This file is part of Déjà Dup.
    For copyright information, see AUTHORS.

    Déjà Dup is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Déjà Dup is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Déjà Dup.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>


#define DEJA_DUP_TYPE_STATUS_PROVIDER (deja_dup_status_provider_get_type ())
#define DEJA_DUP_STATUS_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEJA_DUP_TYPE_STATUS_PROVIDER, DejaDupStatusProvider))
#define DEJA_DUP_STATUS_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEJA_DUP_TYPE_STATUS_PROVIDER, DejaDupStatusProviderClass))
#define DEJA_DUP_IS_STATUS_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEJA_DUP_TYPE_STATUS_PROVIDER))
#define DEJA_DUP_IS_STATUS_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEJA_DUP_TYPE_STATUS_PROVIDER))
#define DEJA_DUP_STATUS_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEJA_DUP_TYPE_STATUS_PROVIDER, DejaDupStatusProviderClass))

typedef struct _DejaDupStatusProvider DejaDupStatusProvider;
typedef struct _DejaDupStatusProviderClass DejaDupStatusProviderClass;
typedef struct _DejaDupStatusProviderPrivate DejaDupStatusProviderPrivate;

#define DEJA_DUP_STATUS_PROVIDER_TYPE_STATUS (deja_dup_status_provider_status_get_type ())
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _DejaDupStatusProviderCheckOwnerStatusData DejaDupStatusProviderCheckOwnerStatusData;

#define DEJA_DUP_TYPE_STATUS_NETWORK_MANAGER (deja_dup_status_network_manager_get_type ())
#define DEJA_DUP_STATUS_NETWORK_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEJA_DUP_TYPE_STATUS_NETWORK_MANAGER, DejaDupStatusNetworkManager))
#define DEJA_DUP_STATUS_NETWORK_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEJA_DUP_TYPE_STATUS_NETWORK_MANAGER, DejaDupStatusNetworkManagerClass))
#define DEJA_DUP_IS_STATUS_NETWORK_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEJA_DUP_TYPE_STATUS_NETWORK_MANAGER))
#define DEJA_DUP_IS_STATUS_NETWORK_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEJA_DUP_TYPE_STATUS_NETWORK_MANAGER))
#define DEJA_DUP_STATUS_NETWORK_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEJA_DUP_TYPE_STATUS_NETWORK_MANAGER, DejaDupStatusNetworkManagerClass))

typedef struct _DejaDupStatusNetworkManager DejaDupStatusNetworkManager;
typedef struct _DejaDupStatusNetworkManagerClass DejaDupStatusNetworkManagerClass;
typedef struct _DejaDupStatusNetworkManagerPrivate DejaDupStatusNetworkManagerPrivate;
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _DejaDupStatusNetworkManagerQueryStatusData DejaDupStatusNetworkManagerQueryStatusData;

#define DEJA_DUP_TYPE_STATUS_CONNECTION_MANAGER (deja_dup_status_connection_manager_get_type ())
#define DEJA_DUP_STATUS_CONNECTION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEJA_DUP_TYPE_STATUS_CONNECTION_MANAGER, DejaDupStatusConnectionManager))
#define DEJA_DUP_STATUS_CONNECTION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEJA_DUP_TYPE_STATUS_CONNECTION_MANAGER, DejaDupStatusConnectionManagerClass))
#define DEJA_DUP_IS_STATUS_CONNECTION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEJA_DUP_TYPE_STATUS_CONNECTION_MANAGER))
#define DEJA_DUP_IS_STATUS_CONNECTION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEJA_DUP_TYPE_STATUS_CONNECTION_MANAGER))
#define DEJA_DUP_STATUS_CONNECTION_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEJA_DUP_TYPE_STATUS_CONNECTION_MANAGER, DejaDupStatusConnectionManagerClass))

typedef struct _DejaDupStatusConnectionManager DejaDupStatusConnectionManager;
typedef struct _DejaDupStatusConnectionManagerClass DejaDupStatusConnectionManagerClass;
typedef struct _DejaDupStatusConnectionManagerPrivate DejaDupStatusConnectionManagerPrivate;
typedef struct _DejaDupStatusConnectionManagerQueryStatusData DejaDupStatusConnectionManagerQueryStatusData;

#define DEJA_DUP_TYPE_NETWORK (deja_dup_network_get_type ())
#define DEJA_DUP_NETWORK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEJA_DUP_TYPE_NETWORK, DejaDupNetwork))
#define DEJA_DUP_NETWORK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEJA_DUP_TYPE_NETWORK, DejaDupNetworkClass))
#define DEJA_DUP_IS_NETWORK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEJA_DUP_TYPE_NETWORK))
#define DEJA_DUP_IS_NETWORK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEJA_DUP_TYPE_NETWORK))
#define DEJA_DUP_NETWORK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEJA_DUP_TYPE_NETWORK, DejaDupNetworkClass))

typedef struct _DejaDupNetwork DejaDupNetwork;
typedef struct _DejaDupNetworkClass DejaDupNetworkClass;
typedef struct _DejaDupNetworkPrivate DejaDupNetworkPrivate;
#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))
typedef struct _DejaDupNetworkEnsureStatusData DejaDupNetworkEnsureStatusData;

typedef enum  {
	DEJA_DUP_STATUS_PROVIDER_STATUS_ONLINE,
	DEJA_DUP_STATUS_PROVIDER_STATUS_OFFLINE,
	DEJA_DUP_STATUS_PROVIDER_STATUS_UNKNOWN,
	DEJA_DUP_STATUS_PROVIDER_STATUS_UNINITIALIZED
} DejaDupStatusProviderStatus;

struct _DejaDupStatusProvider {
	GObject parent_instance;
	DejaDupStatusProviderPrivate * priv;
};

struct _DejaDupStatusProviderClass {
	GObjectClass parent_class;
	GDBusProxy* (*create_proxy) (DejaDupStatusProvider* self, GError** error);
	void (*query_status) (DejaDupStatusProvider* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	DejaDupStatusProviderStatus (*query_status_finish) (DejaDupStatusProvider* self, GAsyncResult* _res_, GError** error);
	void (*handle_signal) (DejaDupStatusProvider* self, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
};

struct _DejaDupStatusProviderPrivate {
	DejaDupStatusProviderStatus _status;
	GDBusProxy* _proxy;
};

struct _DejaDupStatusProviderCheckOwnerStatusData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	DejaDupStatusProvider* self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_;
	DejaDupStatusProviderStatus status;
	DejaDupStatusProviderStatus _tmp3_;
	DejaDupStatusProviderStatus _tmp4_;
	GError * e;
	GError * _inner_error_;
};

struct _DejaDupStatusNetworkManager {
	DejaDupStatusProvider parent_instance;
	DejaDupStatusNetworkManagerPrivate * priv;
};

struct _DejaDupStatusNetworkManagerClass {
	DejaDupStatusProviderClass parent_class;
};

struct _DejaDupStatusNetworkManagerQueryStatusData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	DejaDupStatusNetworkManager* self;
	DejaDupStatusProviderStatus result;
	GDBusProxy* _tmp0_;
	GVariant* _tmp1_;
	GVariant* _tmp2_;
	GVariant* state_val;
	gboolean _tmp3_;
	gboolean _tmp4_;
	guint32 _tmp5_;
	guint32 state;
	gboolean _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp8_;
};

struct _DejaDupStatusConnectionManager {
	DejaDupStatusProvider parent_instance;
	DejaDupStatusConnectionManagerPrivate * priv;
};

struct _DejaDupStatusConnectionManagerClass {
	DejaDupStatusProviderClass parent_class;
};

struct _DejaDupStatusConnectionManagerQueryStatusData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	DejaDupStatusConnectionManager* self;
	DejaDupStatusProviderStatus result;
	GDBusProxy* _tmp0_;
	GVariant* _tmp1_;
	GVariant* state_val;
	gchar* state;
	GError * _inner_error_;
};

struct _DejaDupNetwork {
	GObject parent_instance;
	DejaDupNetworkPrivate * priv;
};

struct _DejaDupNetworkClass {
	GObjectClass parent_class;
};

struct _DejaDupNetworkPrivate {
	gboolean _connected;
	GList* providers;
};

struct _DejaDupNetworkEnsureStatusData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	DejaDupNetwork* _tmp0_;
	DejaDupNetwork* nm;
	GList* p_collection;
	GList* p_it;
	DejaDupStatusProvider* _tmp1_;
	DejaDupStatusProvider* p;
	DejaDupStatusProviderStatus _tmp2_;
};


static gpointer deja_dup_status_provider_parent_class = NULL;
static gpointer deja_dup_status_network_manager_parent_class = NULL;
static gpointer deja_dup_status_connection_manager_parent_class = NULL;
static gpointer deja_dup_network_parent_class = NULL;
static DejaDupNetwork* deja_dup_network_singleton;
static DejaDupNetwork* deja_dup_network_singleton = NULL;

GType deja_dup_status_provider_get_type (void) G_GNUC_CONST;
GType deja_dup_status_provider_status_get_type (void) G_GNUC_CONST;
#define DEJA_DUP_STATUS_PROVIDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DEJA_DUP_TYPE_STATUS_PROVIDER, DejaDupStatusProviderPrivate))
enum  {
	DEJA_DUP_STATUS_PROVIDER_DUMMY_PROPERTY,
	DEJA_DUP_STATUS_PROVIDER_STATUS,
	DEJA_DUP_STATUS_PROVIDER_PROXY
};
void deja_dup_status_provider_update_status (DejaDupStatusProvider* self, DejaDupStatusProviderStatus new_status);
DejaDupStatusProviderStatus deja_dup_status_provider_get_status (DejaDupStatusProvider* self);
void deja_dup_status_provider_set_status (DejaDupStatusProvider* self, DejaDupStatusProviderStatus value);
static void deja_dup_status_provider_owner_changed (DejaDupStatusProvider* self);
void deja_dup_status_provider_check_owner_status (DejaDupStatusProvider* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void deja_dup_status_provider_check_owner_status_finish (DejaDupStatusProvider* self, GAsyncResult* _res_);
static void deja_dup_status_provider_check_owner_status_data_free (gpointer _data);
static gboolean deja_dup_status_provider_check_owner_status_co (DejaDupStatusProviderCheckOwnerStatusData* data);
GDBusProxy* deja_dup_status_provider_get_proxy (DejaDupStatusProvider* self);
void deja_dup_status_provider_query_status (DejaDupStatusProvider* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
DejaDupStatusProviderStatus deja_dup_status_provider_query_status_finish (DejaDupStatusProvider* self, GAsyncResult* _res_, GError** error);
static void deja_dup_status_provider_check_owner_status_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
GDBusProxy* deja_dup_status_provider_create_proxy (DejaDupStatusProvider* self, GError** error);
static GDBusProxy* deja_dup_status_provider_real_create_proxy (DejaDupStatusProvider* self, GError** error);
void deja_dup_status_provider_handle_signal (DejaDupStatusProvider* self, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
static void deja_dup_status_provider_real_handle_signal (DejaDupStatusProvider* self, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
DejaDupStatusProvider* deja_dup_status_provider_construct (GType object_type);
static void deja_dup_status_provider_set_proxy (DejaDupStatusProvider* self, GDBusProxy* value);
static GObject * deja_dup_status_provider_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void _deja_dup_status_provider_owner_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void _deja_dup_status_provider_handle_signal_g_dbus_proxy_g_signal (GDBusProxy* _sender, const gchar* sender_name, const gchar* signal_name, GVariant* parameters, gpointer self);
static void deja_dup_status_provider_finalize (GObject* obj);
static void _vala_deja_dup_status_provider_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_deja_dup_status_provider_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
GType deja_dup_status_network_manager_get_type (void) G_GNUC_CONST;
enum  {
	DEJA_DUP_STATUS_NETWORK_MANAGER_DUMMY_PROPERTY
};
#define DEJA_DUP_STATUS_NETWORK_MANAGER_NM_OLD_STATE_CONNECTED ((guint32) 3)
#define DEJA_DUP_STATUS_NETWORK_MANAGER_NM_STATE_CONNECTED_LOCAL ((guint32) 50)
#define DEJA_DUP_STATUS_NETWORK_MANAGER_NM_STATE_CONNECTED_SITE ((guint32) 60)
#define DEJA_DUP_STATUS_NETWORK_MANAGER_NM_STATE_CONNECTED_GLOBAL ((guint32) 70)
static GDBusProxy* deja_dup_status_network_manager_real_create_proxy (DejaDupStatusProvider* base, GError** error);
static void deja_dup_status_network_manager_real_query_status_data_free (gpointer _data);
static void deja_dup_status_network_manager_real_query_status (DejaDupStatusProvider* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean deja_dup_status_network_manager_real_query_status_co (DejaDupStatusNetworkManagerQueryStatusData* data);
static void deja_dup_status_network_manager_real_handle_signal (DejaDupStatusProvider* base, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
DejaDupStatusNetworkManager* deja_dup_status_network_manager_new (void);
DejaDupStatusNetworkManager* deja_dup_status_network_manager_construct (GType object_type);
GType deja_dup_status_connection_manager_get_type (void) G_GNUC_CONST;
enum  {
	DEJA_DUP_STATUS_CONNECTION_MANAGER_DUMMY_PROPERTY
};
#define DEJA_DUP_STATUS_CONNECTION_MANAGER_CM_STATE_CONNECTED "online"
static GDBusProxy* deja_dup_status_connection_manager_real_create_proxy (DejaDupStatusProvider* base, GError** error);
static void deja_dup_status_connection_manager_real_query_status_data_free (gpointer _data);
static void deja_dup_status_connection_manager_real_query_status (DejaDupStatusProvider* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean deja_dup_status_connection_manager_real_query_status_co (DejaDupStatusConnectionManagerQueryStatusData* data);
static void deja_dup_status_connection_manager_query_status_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void deja_dup_status_connection_manager_real_handle_signal (DejaDupStatusProvider* base, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
DejaDupStatusConnectionManager* deja_dup_status_connection_manager_new (void);
DejaDupStatusConnectionManager* deja_dup_status_connection_manager_construct (GType object_type);
GType deja_dup_network_get_type (void) G_GNUC_CONST;
#define DEJA_DUP_NETWORK_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DEJA_DUP_TYPE_NETWORK, DejaDupNetworkPrivate))
enum  {
	DEJA_DUP_NETWORK_DUMMY_PROPERTY,
	DEJA_DUP_NETWORK_CONNECTED
};
static void _g_object_unref0_ (gpointer var);
static void _g_list_free__g_object_unref0_ (GList* self);
DejaDupNetwork* deja_dup_network_get (void);
DejaDupNetwork* deja_dup_network_new (void);
DejaDupNetwork* deja_dup_network_construct (GType object_type);
static void deja_dup_network_ensure_status_data_free (gpointer _data);
void deja_dup_network_ensure_status (GAsyncReadyCallback _callback_, gpointer _user_data_);
void deja_dup_network_ensure_status_finish (GAsyncResult* _res_);
static gboolean deja_dup_network_ensure_status_co (DejaDupNetworkEnsureStatusData* data);
static void deja_dup_network_ensure_status_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void deja_dup_network_add_provider (DejaDupNetwork* self, DejaDupStatusProvider* p);
static void deja_dup_network_update_status (DejaDupNetwork* self);
static void _deja_dup_network_update_status_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
gboolean deja_dup_network_get_connected (DejaDupNetwork* self);
void deja_dup_network_set_connected (DejaDupNetwork* self, gboolean value);
static GObject * deja_dup_network_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void deja_dup_network_finalize (GObject* obj);
static void _vala_deja_dup_network_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_deja_dup_network_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


GType deja_dup_status_provider_status_get_type (void) {
	static volatile gsize deja_dup_status_provider_status_type_id__volatile = 0;
	if (g_once_init_enter (&deja_dup_status_provider_status_type_id__volatile)) {
		static const GEnumValue values[] = {{DEJA_DUP_STATUS_PROVIDER_STATUS_ONLINE, "DEJA_DUP_STATUS_PROVIDER_STATUS_ONLINE", "online"}, {DEJA_DUP_STATUS_PROVIDER_STATUS_OFFLINE, "DEJA_DUP_STATUS_PROVIDER_STATUS_OFFLINE", "offline"}, {DEJA_DUP_STATUS_PROVIDER_STATUS_UNKNOWN, "DEJA_DUP_STATUS_PROVIDER_STATUS_UNKNOWN", "unknown"}, {DEJA_DUP_STATUS_PROVIDER_STATUS_UNINITIALIZED, "DEJA_DUP_STATUS_PROVIDER_STATUS_UNINITIALIZED", "uninitialized"}, {0, NULL, NULL}};
		GType deja_dup_status_provider_status_type_id;
		deja_dup_status_provider_status_type_id = g_enum_register_static ("DejaDupStatusProviderStatus", values);
		g_once_init_leave (&deja_dup_status_provider_status_type_id__volatile, deja_dup_status_provider_status_type_id);
	}
	return deja_dup_status_provider_status_type_id__volatile;
}


void deja_dup_status_provider_update_status (DejaDupStatusProvider* self, DejaDupStatusProviderStatus new_status) {
	g_return_if_fail (self != NULL);
	if (self->priv->_status != new_status) {
		deja_dup_status_provider_set_status (self, new_status);
	}
}


static void deja_dup_status_provider_owner_changed (DejaDupStatusProvider* self) {
	g_return_if_fail (self != NULL);
	deja_dup_status_provider_check_owner_status (self, NULL, NULL);
}


static void deja_dup_status_provider_check_owner_status_data_free (gpointer _data) {
	DejaDupStatusProviderCheckOwnerStatusData* data;
	data = _data;
	_g_object_unref0 (data->self);
	g_slice_free (DejaDupStatusProviderCheckOwnerStatusData, data);
}


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


void deja_dup_status_provider_check_owner_status (DejaDupStatusProvider* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	DejaDupStatusProviderCheckOwnerStatusData* _data_;
	_data_ = g_slice_new0 (DejaDupStatusProviderCheckOwnerStatusData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, deja_dup_status_provider_check_owner_status);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, deja_dup_status_provider_check_owner_status_data_free);
	_data_->self = _g_object_ref0 (self);
	deja_dup_status_provider_check_owner_status_co (_data_);
}


void deja_dup_status_provider_check_owner_status_finish (DejaDupStatusProvider* self, GAsyncResult* _res_) {
	DejaDupStatusProviderCheckOwnerStatusData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void deja_dup_status_provider_check_owner_status_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	DejaDupStatusProviderCheckOwnerStatusData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	deja_dup_status_provider_check_owner_status_co (data);
}


static gboolean deja_dup_status_provider_check_owner_status_co (DejaDupStatusProviderCheckOwnerStatusData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	g_object_get (data->self->priv->_proxy, "g-name-owner", &data->_tmp0_, NULL);
	data->_tmp1_ = data->_tmp0_;
	data->_tmp2_ = data->_tmp1_ == NULL;
	_g_free0 (data->_tmp1_);
	if (data->_tmp2_) {
		deja_dup_status_provider_update_status (data->self, DEJA_DUP_STATUS_PROVIDER_STATUS_UNKNOWN);
	} else {
		data->status = DEJA_DUP_STATUS_PROVIDER_STATUS_UNKNOWN;
		data->_state_ = 1;
		deja_dup_status_provider_query_status (data->self, deja_dup_status_provider_check_owner_status_ready, data);
		return FALSE;
		_state_1:
		data->_tmp3_ = deja_dup_status_provider_query_status_finish (data->self, data->_res_, &data->_inner_error_);
		data->_tmp4_ = data->_tmp3_;
		if (data->_inner_error_ != NULL) {
			goto __catch37_g_error;
		}
		data->status = data->_tmp4_;
		goto __finally37;
		__catch37_g_error:
		{
			data->e = data->_inner_error_;
			data->_inner_error_ = NULL;
			g_warning ("Network.vala:63: %s\n", data->e->message);
			_g_error_free0 (data->e);
		}
		__finally37:
		if (data->_inner_error_ != NULL) {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
			g_clear_error (&data->_inner_error_);
			return FALSE;
		}
		deja_dup_status_provider_update_status (data->self, data->status);
	}
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static GDBusProxy* deja_dup_status_provider_real_create_proxy (DejaDupStatusProvider* self, GError** error) {
	g_return_val_if_fail (self != NULL, NULL);
	g_critical ("Type `%s' does not implement abstract method `deja_dup_status_provider_create_proxy'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}


GDBusProxy* deja_dup_status_provider_create_proxy (DejaDupStatusProvider* self, GError** error) {
	return DEJA_DUP_STATUS_PROVIDER_GET_CLASS (self)->create_proxy (self, error);
}


void deja_dup_status_provider_query_status (DejaDupStatusProvider* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	DEJA_DUP_STATUS_PROVIDER_GET_CLASS (self)->query_status (self, _callback_, _user_data_);
}


DejaDupStatusProviderStatus deja_dup_status_provider_query_status_finish (DejaDupStatusProvider* self, GAsyncResult* _res_, GError** error) {
	return DEJA_DUP_STATUS_PROVIDER_GET_CLASS (self)->query_status_finish (self, _res_, error);
}


static void deja_dup_status_provider_real_handle_signal (DejaDupStatusProvider* self, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
	g_return_if_fail (self != NULL);
	g_critical ("Type `%s' does not implement abstract method `deja_dup_status_provider_handle_signal'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return;
}


void deja_dup_status_provider_handle_signal (DejaDupStatusProvider* self, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
	DEJA_DUP_STATUS_PROVIDER_GET_CLASS (self)->handle_signal (self, sender_name, signal_name, parameters);
}


DejaDupStatusProvider* deja_dup_status_provider_construct (GType object_type) {
	DejaDupStatusProvider * self = NULL;
	self = (DejaDupStatusProvider*) g_object_new (object_type, NULL);
	return self;
}


DejaDupStatusProviderStatus deja_dup_status_provider_get_status (DejaDupStatusProvider* self) {
	DejaDupStatusProviderStatus result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_status;
	return result;
}


void deja_dup_status_provider_set_status (DejaDupStatusProvider* self, DejaDupStatusProviderStatus value) {
	g_return_if_fail (self != NULL);
	self->priv->_status = value;
	g_object_notify ((GObject *) self, "status");
}


GDBusProxy* deja_dup_status_provider_get_proxy (DejaDupStatusProvider* self) {
	GDBusProxy* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_proxy;
	return result;
}


static void deja_dup_status_provider_set_proxy (DejaDupStatusProvider* self, GDBusProxy* value) {
	GDBusProxy* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_proxy);
	self->priv->_proxy = _tmp0_;
	g_object_notify ((GObject *) self, "proxy");
}


static void _deja_dup_status_provider_owner_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	deja_dup_status_provider_owner_changed (self);
}


static void _deja_dup_status_provider_handle_signal_g_dbus_proxy_g_signal (GDBusProxy* _sender, const gchar* sender_name, const gchar* signal_name, GVariant* parameters, gpointer self) {
	deja_dup_status_provider_handle_signal (self, sender_name, signal_name, parameters);
}


static GObject * deja_dup_status_provider_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	DejaDupStatusProvider * self;
	GDBusProxy* _tmp0_ = NULL;
	GDBusProxy* _tmp1_;
	GDBusProxy* _tmp2_;
	GError * _inner_error_ = NULL;
	parent_class = G_OBJECT_CLASS (deja_dup_status_provider_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = DEJA_DUP_STATUS_PROVIDER (obj);
	_tmp0_ = deja_dup_status_provider_create_proxy (self, &_inner_error_);
	_tmp1_ = _tmp0_;
	if (_inner_error_ != NULL) {
		goto __catch38_g_error;
	}
	_tmp2_ = _tmp1_;
	deja_dup_status_provider_set_proxy (self, _tmp2_);
	_g_object_unref0 (_tmp2_);
	g_signal_connect_object ((GObject*) self->priv->_proxy, "notify::g-name-owner", (GCallback) _deja_dup_status_provider_owner_changed_g_object_notify, self, 0);
	g_signal_connect_object (self->priv->_proxy, "g-signal", (GCallback) _deja_dup_status_provider_handle_signal_g_dbus_proxy_g_signal, self, 0);
	goto __finally38;
	__catch38_g_error:
	{
		GError * e;
		e = _inner_error_;
		_inner_error_ = NULL;
		g_warning ("Network.vala:38: %s\n", e->message);
		_g_error_free0 (e);
	}
	__finally38:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
	}
	return obj;
}


static void deja_dup_status_provider_class_init (DejaDupStatusProviderClass * klass) {
	deja_dup_status_provider_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (DejaDupStatusProviderPrivate));
	DEJA_DUP_STATUS_PROVIDER_CLASS (klass)->create_proxy = deja_dup_status_provider_real_create_proxy;
	DEJA_DUP_STATUS_PROVIDER_CLASS (klass)->handle_signal = deja_dup_status_provider_real_handle_signal;
	G_OBJECT_CLASS (klass)->get_property = _vala_deja_dup_status_provider_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_deja_dup_status_provider_set_property;
	G_OBJECT_CLASS (klass)->constructor = deja_dup_status_provider_constructor;
	G_OBJECT_CLASS (klass)->finalize = deja_dup_status_provider_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DEJA_DUP_STATUS_PROVIDER_STATUS, g_param_spec_enum ("status", "status", "status", DEJA_DUP_STATUS_PROVIDER_TYPE_STATUS, DEJA_DUP_STATUS_PROVIDER_STATUS_UNINITIALIZED, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DEJA_DUP_STATUS_PROVIDER_PROXY, g_param_spec_object ("proxy", "proxy", "proxy", G_TYPE_DBUS_PROXY, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void deja_dup_status_provider_instance_init (DejaDupStatusProvider * self) {
	self->priv = DEJA_DUP_STATUS_PROVIDER_GET_PRIVATE (self);
	self->priv->_status = DEJA_DUP_STATUS_PROVIDER_STATUS_UNINITIALIZED;
}


static void deja_dup_status_provider_finalize (GObject* obj) {
	DejaDupStatusProvider * self;
	self = DEJA_DUP_STATUS_PROVIDER (obj);
	_g_object_unref0 (self->priv->_proxy);
	G_OBJECT_CLASS (deja_dup_status_provider_parent_class)->finalize (obj);
}


GType deja_dup_status_provider_get_type (void) {
	static volatile gsize deja_dup_status_provider_type_id__volatile = 0;
	if (g_once_init_enter (&deja_dup_status_provider_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (DejaDupStatusProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) deja_dup_status_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DejaDupStatusProvider), 0, (GInstanceInitFunc) deja_dup_status_provider_instance_init, NULL };
		GType deja_dup_status_provider_type_id;
		deja_dup_status_provider_type_id = g_type_register_static (G_TYPE_OBJECT, "DejaDupStatusProvider", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
		g_once_init_leave (&deja_dup_status_provider_type_id__volatile, deja_dup_status_provider_type_id);
	}
	return deja_dup_status_provider_type_id__volatile;
}


static void _vala_deja_dup_status_provider_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	DejaDupStatusProvider * self;
	self = DEJA_DUP_STATUS_PROVIDER (object);
	switch (property_id) {
		case DEJA_DUP_STATUS_PROVIDER_STATUS:
		g_value_set_enum (value, deja_dup_status_provider_get_status (self));
		break;
		case DEJA_DUP_STATUS_PROVIDER_PROXY:
		g_value_set_object (value, deja_dup_status_provider_get_proxy (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_deja_dup_status_provider_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	DejaDupStatusProvider * self;
	self = DEJA_DUP_STATUS_PROVIDER (object);
	switch (property_id) {
		case DEJA_DUP_STATUS_PROVIDER_STATUS:
		deja_dup_status_provider_set_status (self, g_value_get_enum (value));
		break;
		case DEJA_DUP_STATUS_PROVIDER_PROXY:
		deja_dup_status_provider_set_proxy (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static GDBusProxy* deja_dup_status_network_manager_real_create_proxy (DejaDupStatusProvider* base, GError** error) {
	DejaDupStatusNetworkManager * self;
	GDBusProxy* result = NULL;
	GDBusProxy* _tmp0_ = NULL;
	GDBusProxy* _tmp1_;
	GError * _inner_error_ = NULL;
	self = (DejaDupStatusNetworkManager*) base;
	_tmp0_ = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.NetworkManager", NULL, &_inner_error_);
	_tmp1_ = _tmp0_;
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		return NULL;
	}
	result = _tmp1_;
	return result;
}


static void deja_dup_status_network_manager_real_query_status_data_free (gpointer _data) {
	DejaDupStatusNetworkManagerQueryStatusData* data;
	data = _data;
	_g_object_unref0 (data->self);
	g_slice_free (DejaDupStatusNetworkManagerQueryStatusData, data);
}


static void deja_dup_status_network_manager_real_query_status (DejaDupStatusProvider* base, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	DejaDupStatusNetworkManager * self;
	DejaDupStatusNetworkManagerQueryStatusData* _data_;
	self = (DejaDupStatusNetworkManager*) base;
	_data_ = g_slice_new0 (DejaDupStatusNetworkManagerQueryStatusData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, deja_dup_status_network_manager_real_query_status);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, deja_dup_status_network_manager_real_query_status_data_free);
	_data_->self = _g_object_ref0 (self);
	deja_dup_status_network_manager_real_query_status_co (_data_);
}


static DejaDupStatusProviderStatus deja_dup_status_network_manager_real_query_status_finish (DejaDupStatusProvider* base, GAsyncResult* _res_, GError** error) {
	DejaDupStatusProviderStatus result;
	DejaDupStatusNetworkManagerQueryStatusData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return 0;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	return result;
}


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


static gboolean deja_dup_status_network_manager_real_query_status_co (DejaDupStatusNetworkManagerQueryStatusData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = deja_dup_status_provider_get_proxy ((DejaDupStatusProvider*) data->self);
	data->_tmp1_ = NULL;
	data->_tmp1_ = g_dbus_proxy_get_cached_property (data->_tmp0_, "State");
	data->_tmp2_ = _g_variant_ref0 (data->_tmp1_);
	data->state_val = data->_tmp2_;
	if (data->state_val == NULL) {
		data->_tmp3_ = TRUE;
	} else {
		data->_tmp4_ = g_variant_is_of_type (data->state_val, G_VARIANT_TYPE_UINT32);
		data->_tmp3_ = !data->_tmp4_;
	}
	if (data->_tmp3_) {
		data->result = DEJA_DUP_STATUS_PROVIDER_STATUS_UNKNOWN;
		_g_variant_unref0 (data->state_val);
		if (data->_state_ == 0) {
			g_simple_async_result_complete_in_idle (data->_async_result);
		} else {
			g_simple_async_result_complete (data->_async_result);
		}
		g_object_unref (data->_async_result);
		return FALSE;
	}
	data->_tmp5_ = g_variant_get_uint32 (data->state_val);
	data->state = data->_tmp5_;
	if (data->state == DEJA_DUP_STATUS_NETWORK_MANAGER_NM_OLD_STATE_CONNECTED) {
		data->_tmp8_ = TRUE;
	} else {
		data->_tmp8_ = data->state == DEJA_DUP_STATUS_NETWORK_MANAGER_NM_STATE_CONNECTED_LOCAL;
	}
	if (data->_tmp8_) {
		data->_tmp7_ = TRUE;
	} else {
		data->_tmp7_ = data->state == DEJA_DUP_STATUS_NETWORK_MANAGER_NM_STATE_CONNECTED_SITE;
	}
	if (data->_tmp7_) {
		data->_tmp6_ = TRUE;
	} else {
		data->_tmp6_ = data->state == DEJA_DUP_STATUS_NETWORK_MANAGER_NM_STATE_CONNECTED_GLOBAL;
	}
	if (data->_tmp6_) {
		data->result = DEJA_DUP_STATUS_PROVIDER_STATUS_ONLINE;
		_g_variant_unref0 (data->state_val);
		if (data->_state_ == 0) {
			g_simple_async_result_complete_in_idle (data->_async_result);
		} else {
			g_simple_async_result_complete (data->_async_result);
		}
		g_object_unref (data->_async_result);
		return FALSE;
	} else {
		data->result = DEJA_DUP_STATUS_PROVIDER_STATUS_OFFLINE;
		_g_variant_unref0 (data->state_val);
		if (data->_state_ == 0) {
			g_simple_async_result_complete_in_idle (data->_async_result);
		} else {
			g_simple_async_result_complete (data->_async_result);
		}
		g_object_unref (data->_async_result);
		return FALSE;
	}
	_g_variant_unref0 (data->state_val);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void deja_dup_status_network_manager_real_handle_signal (DejaDupStatusProvider* base, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
	DejaDupStatusNetworkManager * self;
	self = (DejaDupStatusNetworkManager*) base;
	g_return_if_fail (sender_name != NULL);
	g_return_if_fail (signal_name != NULL);
	g_return_if_fail (parameters != NULL);
	if (g_strcmp0 (signal_name, "StateChanged") == 0) {
		guint32 state = 0U;
		gboolean _tmp0_ = FALSE;
		gboolean _tmp1_ = FALSE;
		gboolean _tmp2_ = FALSE;
		g_variant_get (parameters, "(u)", &state, NULL);
		if (state == DEJA_DUP_STATUS_NETWORK_MANAGER_NM_OLD_STATE_CONNECTED) {
			_tmp2_ = TRUE;
		} else {
			_tmp2_ = state == DEJA_DUP_STATUS_NETWORK_MANAGER_NM_STATE_CONNECTED_LOCAL;
		}
		if (_tmp2_) {
			_tmp1_ = TRUE;
		} else {
			_tmp1_ = state == DEJA_DUP_STATUS_NETWORK_MANAGER_NM_STATE_CONNECTED_SITE;
		}
		if (_tmp1_) {
			_tmp0_ = TRUE;
		} else {
			_tmp0_ = state == DEJA_DUP_STATUS_NETWORK_MANAGER_NM_STATE_CONNECTED_GLOBAL;
		}
		if (_tmp0_) {
			deja_dup_status_provider_update_status ((DejaDupStatusProvider*) self, DEJA_DUP_STATUS_PROVIDER_STATUS_ONLINE);
		} else {
			deja_dup_status_provider_update_status ((DejaDupStatusProvider*) self, DEJA_DUP_STATUS_PROVIDER_STATUS_OFFLINE);
		}
	}
}


DejaDupStatusNetworkManager* deja_dup_status_network_manager_construct (GType object_type) {
	DejaDupStatusNetworkManager * self = NULL;
	self = (DejaDupStatusNetworkManager*) deja_dup_status_provider_construct (object_type);
	return self;
}


DejaDupStatusNetworkManager* deja_dup_status_network_manager_new (void) {
	return deja_dup_status_network_manager_construct (DEJA_DUP_TYPE_STATUS_NETWORK_MANAGER);
}


static void deja_dup_status_network_manager_class_init (DejaDupStatusNetworkManagerClass * klass) {
	deja_dup_status_network_manager_parent_class = g_type_class_peek_parent (klass);
	DEJA_DUP_STATUS_PROVIDER_CLASS (klass)->create_proxy = deja_dup_status_network_manager_real_create_proxy;
	DEJA_DUP_STATUS_PROVIDER_CLASS (klass)->query_status = deja_dup_status_network_manager_real_query_status;
	DEJA_DUP_STATUS_PROVIDER_CLASS (klass)->query_status_finish = deja_dup_status_network_manager_real_query_status_finish;
	DEJA_DUP_STATUS_PROVIDER_CLASS (klass)->handle_signal = deja_dup_status_network_manager_real_handle_signal;
}


static void deja_dup_status_network_manager_instance_init (DejaDupStatusNetworkManager * self) {
}


GType deja_dup_status_network_manager_get_type (void) {
	static volatile gsize deja_dup_status_network_manager_type_id__volatile = 0;
	if (g_once_init_enter (&deja_dup_status_network_manager_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (DejaDupStatusNetworkManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) deja_dup_status_network_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DejaDupStatusNetworkManager), 0, (GInstanceInitFunc) deja_dup_status_network_manager_instance_init, NULL };
		GType deja_dup_status_network_manager_type_id;
		deja_dup_status_network_manager_type_id = g_type_register_static (DEJA_DUP_TYPE_STATUS_PROVIDER, "DejaDupStatusNetworkManager", &g_define_type_info, 0);
		g_once_init_leave (&deja_dup_status_network_manager_type_id__volatile, deja_dup_status_network_manager_type_id);
	}
	return deja_dup_status_network_manager_type_id__volatile;
}


static GDBusProxy* deja_dup_status_connection_manager_real_create_proxy (DejaDupStatusProvider* base, GError** error) {
	DejaDupStatusConnectionManager * self;
	GDBusProxy* result = NULL;
	GDBusProxy* _tmp0_ = NULL;
	GDBusProxy* _tmp1_;
	GError * _inner_error_ = NULL;
	self = (DejaDupStatusConnectionManager*) base;
	_tmp0_ = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.moblin.connman", "/", "org.moblin.connman.Manager", NULL, &_inner_error_);
	_tmp1_ = _tmp0_;
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		return NULL;
	}
	result = _tmp1_;
	return result;
}


static void deja_dup_status_connection_manager_real_query_status_data_free (gpointer _data) {
	DejaDupStatusConnectionManagerQueryStatusData* data;
	data = _data;
	_g_object_unref0 (data->self);
	g_slice_free (DejaDupStatusConnectionManagerQueryStatusData, data);
}


static void deja_dup_status_connection_manager_real_query_status (DejaDupStatusProvider* base, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	DejaDupStatusConnectionManager * self;
	DejaDupStatusConnectionManagerQueryStatusData* _data_;
	self = (DejaDupStatusConnectionManager*) base;
	_data_ = g_slice_new0 (DejaDupStatusConnectionManagerQueryStatusData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, deja_dup_status_connection_manager_real_query_status);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, deja_dup_status_connection_manager_real_query_status_data_free);
	_data_->self = _g_object_ref0 (self);
	deja_dup_status_connection_manager_real_query_status_co (_data_);
}


static DejaDupStatusProviderStatus deja_dup_status_connection_manager_real_query_status_finish (DejaDupStatusProvider* base, GAsyncResult* _res_, GError** error) {
	DejaDupStatusProviderStatus result;
	DejaDupStatusConnectionManagerQueryStatusData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return 0;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	return result;
}


static void deja_dup_status_connection_manager_query_status_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	DejaDupStatusConnectionManagerQueryStatusData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	deja_dup_status_connection_manager_real_query_status_co (data);
}


static gboolean deja_dup_status_connection_manager_real_query_status_co (DejaDupStatusConnectionManagerQueryStatusData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = deja_dup_status_provider_get_proxy ((DejaDupStatusProvider*) data->self);
	data->_state_ = 1;
	g_dbus_proxy_call (data->_tmp0_, "GetState", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, deja_dup_status_connection_manager_query_status_ready, data);
	return FALSE;
	_state_1:
	data->_tmp1_ = NULL;
	data->_tmp1_ = g_dbus_proxy_call_finish (data->_tmp0_, data->_res_, &data->_inner_error_);
	data->state_val = data->_tmp1_;
	if (data->_inner_error_ != NULL) {
		g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
		g_error_free (data->_inner_error_);
		if (data->_state_ == 0) {
			g_simple_async_result_complete_in_idle (data->_async_result);
		} else {
			g_simple_async_result_complete (data->_async_result);
		}
		g_object_unref (data->_async_result);
		return FALSE;
	}
	if (data->state_val == NULL) {
		data->result = DEJA_DUP_STATUS_PROVIDER_STATUS_UNKNOWN;
		_g_variant_unref0 (data->state_val);
		if (data->_state_ == 0) {
			g_simple_async_result_complete_in_idle (data->_async_result);
		} else {
			g_simple_async_result_complete (data->_async_result);
		}
		g_object_unref (data->_async_result);
		return FALSE;
	}
	g_variant_get (data->state_val, "(s)", &data->state, NULL);
	if (g_strcmp0 (data->state, DEJA_DUP_STATUS_CONNECTION_MANAGER_CM_STATE_CONNECTED) == 0) {
		data->result = DEJA_DUP_STATUS_PROVIDER_STATUS_ONLINE;
		_g_free0 (data->state);
		_g_variant_unref0 (data->state_val);
		if (data->_state_ == 0) {
			g_simple_async_result_complete_in_idle (data->_async_result);
		} else {
			g_simple_async_result_complete (data->_async_result);
		}
		g_object_unref (data->_async_result);
		return FALSE;
	} else {
		if (data->state != NULL) {
			data->result = DEJA_DUP_STATUS_PROVIDER_STATUS_OFFLINE;
			_g_free0 (data->state);
			_g_variant_unref0 (data->state_val);
			if (data->_state_ == 0) {
				g_simple_async_result_complete_in_idle (data->_async_result);
			} else {
				g_simple_async_result_complete (data->_async_result);
			}
			g_object_unref (data->_async_result);
			return FALSE;
		} else {
			data->result = DEJA_DUP_STATUS_PROVIDER_STATUS_UNKNOWN;
			_g_free0 (data->state);
			_g_variant_unref0 (data->state_val);
			if (data->_state_ == 0) {
				g_simple_async_result_complete_in_idle (data->_async_result);
			} else {
				g_simple_async_result_complete (data->_async_result);
			}
			g_object_unref (data->_async_result);
			return FALSE;
		}
	}
	_g_free0 (data->state);
	_g_variant_unref0 (data->state_val);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void deja_dup_status_connection_manager_real_handle_signal (DejaDupStatusProvider* base, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
	DejaDupStatusConnectionManager * self;
	self = (DejaDupStatusConnectionManager*) base;
	g_return_if_fail (sender_name != NULL);
	g_return_if_fail (signal_name != NULL);
	g_return_if_fail (parameters != NULL);
	if (g_strcmp0 (signal_name, "StateChanged") == 0) {
		gchar* state = NULL;
		DejaDupStatusProviderStatus _tmp0_ = 0;
		g_variant_get (parameters, "(s)", &state, NULL);
		if (g_strcmp0 (state, DEJA_DUP_STATUS_CONNECTION_MANAGER_CM_STATE_CONNECTED) == 0) {
			_tmp0_ = DEJA_DUP_STATUS_PROVIDER_STATUS_ONLINE;
		} else {
			_tmp0_ = DEJA_DUP_STATUS_PROVIDER_STATUS_OFFLINE;
		}
		deja_dup_status_provider_update_status ((DejaDupStatusProvider*) self, _tmp0_);
		_g_free0 (state);
	}
}


DejaDupStatusConnectionManager* deja_dup_status_connection_manager_construct (GType object_type) {
	DejaDupStatusConnectionManager * self = NULL;
	self = (DejaDupStatusConnectionManager*) deja_dup_status_provider_construct (object_type);
	return self;
}


DejaDupStatusConnectionManager* deja_dup_status_connection_manager_new (void) {
	return deja_dup_status_connection_manager_construct (DEJA_DUP_TYPE_STATUS_CONNECTION_MANAGER);
}


static void deja_dup_status_connection_manager_class_init (DejaDupStatusConnectionManagerClass * klass) {
	deja_dup_status_connection_manager_parent_class = g_type_class_peek_parent (klass);
	DEJA_DUP_STATUS_PROVIDER_CLASS (klass)->create_proxy = deja_dup_status_connection_manager_real_create_proxy;
	DEJA_DUP_STATUS_PROVIDER_CLASS (klass)->query_status = deja_dup_status_connection_manager_real_query_status;
	DEJA_DUP_STATUS_PROVIDER_CLASS (klass)->query_status_finish = deja_dup_status_connection_manager_real_query_status_finish;
	DEJA_DUP_STATUS_PROVIDER_CLASS (klass)->handle_signal = deja_dup_status_connection_manager_real_handle_signal;
}


static void deja_dup_status_connection_manager_instance_init (DejaDupStatusConnectionManager * self) {
}


GType deja_dup_status_connection_manager_get_type (void) {
	static volatile gsize deja_dup_status_connection_manager_type_id__volatile = 0;
	if (g_once_init_enter (&deja_dup_status_connection_manager_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (DejaDupStatusConnectionManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) deja_dup_status_connection_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DejaDupStatusConnectionManager), 0, (GInstanceInitFunc) deja_dup_status_connection_manager_instance_init, NULL };
		GType deja_dup_status_connection_manager_type_id;
		deja_dup_status_connection_manager_type_id = g_type_register_static (DEJA_DUP_TYPE_STATUS_PROVIDER, "DejaDupStatusConnectionManager", &g_define_type_info, 0);
		g_once_init_leave (&deja_dup_status_connection_manager_type_id__volatile, deja_dup_status_connection_manager_type_id);
	}
	return deja_dup_status_connection_manager_type_id__volatile;
}


static void _g_object_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}


static void _g_list_free__g_object_unref0_ (GList* self) {
	g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
	g_list_free (self);
}


DejaDupNetwork* deja_dup_network_get (void) {
	DejaDupNetwork* result = NULL;
	DejaDupNetwork* _tmp1_;
	if (deja_dup_network_singleton == NULL) {
		DejaDupNetwork* _tmp0_ = NULL;
		_tmp0_ = deja_dup_network_new ();
		_g_object_unref0 (deja_dup_network_singleton);
		deja_dup_network_singleton = _tmp0_;
	}
	_tmp1_ = _g_object_ref0 (deja_dup_network_singleton);
	result = _tmp1_;
	return result;
}


static void deja_dup_network_ensure_status_data_free (gpointer _data) {
	DejaDupNetworkEnsureStatusData* data;
	data = _data;
	g_slice_free (DejaDupNetworkEnsureStatusData, data);
}


void deja_dup_network_ensure_status (GAsyncReadyCallback _callback_, gpointer _user_data_) {
	DejaDupNetworkEnsureStatusData* _data_;
	_data_ = g_slice_new0 (DejaDupNetworkEnsureStatusData);
	_data_->_async_result = g_simple_async_result_new (g_object_newv (G_TYPE_OBJECT, 0, NULL), _callback_, _user_data_, deja_dup_network_ensure_status);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, deja_dup_network_ensure_status_data_free);
	deja_dup_network_ensure_status_co (_data_);
}


void deja_dup_network_ensure_status_finish (GAsyncResult* _res_) {
	DejaDupNetworkEnsureStatusData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void deja_dup_network_ensure_status_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	DejaDupNetworkEnsureStatusData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	deja_dup_network_ensure_status_co (data);
}


static gboolean deja_dup_network_ensure_status_co (DejaDupNetworkEnsureStatusData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = deja_dup_network_get ();
	data->nm = data->_tmp0_;
	{
		data->p_collection = data->nm->priv->providers;
		for (data->p_it = data->p_collection; data->p_it != NULL; data->p_it = data->p_it->next) {
			data->_tmp1_ = _g_object_ref0 ((DejaDupStatusProvider*) data->p_it->data);
			data->p = data->_tmp1_;
			{
				data->_tmp2_ = deja_dup_status_provider_get_status (data->p);
				if (data->_tmp2_ == DEJA_DUP_STATUS_PROVIDER_STATUS_UNINITIALIZED) {
					data->_state_ = 1;
					deja_dup_status_provider_check_owner_status (data->p, deja_dup_network_ensure_status_ready, data);
					return FALSE;
					_state_1:
					deja_dup_status_provider_check_owner_status_finish (data->p, data->_res_);
				}
				_g_object_unref0 (data->p);
			}
		}
	}
	_g_object_unref0 (data->nm);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void _deja_dup_network_update_status_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	deja_dup_network_update_status (self);
}


static void deja_dup_network_add_provider (DejaDupNetwork* self, DejaDupStatusProvider* p) {
	DejaDupStatusProvider* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (p != NULL);
	_tmp0_ = _g_object_ref0 (p);
	self->priv->providers = g_list_prepend (self->priv->providers, _tmp0_);
	g_signal_connect_object ((GObject*) p, "notify::status", (GCallback) _deja_dup_network_update_status_g_object_notify, self, 0);
}


static void deja_dup_network_update_status (DejaDupNetwork* self) {
	gboolean offline;
	gboolean online;
	gboolean merged_status = FALSE;
	g_return_if_fail (self != NULL);
	offline = FALSE;
	online = FALSE;
	{
		GList* p_collection;
		GList* p_it;
		p_collection = self->priv->providers;
		for (p_it = p_collection; p_it != NULL; p_it = p_it->next) {
			DejaDupStatusProvider* _tmp0_;
			DejaDupStatusProvider* p;
			_tmp0_ = _g_object_ref0 ((DejaDupStatusProvider*) p_it->data);
			p = _tmp0_;
			{
				DejaDupStatusProviderStatus _tmp1_;
				_tmp1_ = deja_dup_status_provider_get_status (p);
				if (_tmp1_ == DEJA_DUP_STATUS_PROVIDER_STATUS_OFFLINE) {
					offline = TRUE;
				} else {
					DejaDupStatusProviderStatus _tmp2_;
					_tmp2_ = deja_dup_status_provider_get_status (p);
					if (_tmp2_ == DEJA_DUP_STATUS_PROVIDER_STATUS_ONLINE) {
						online = TRUE;
					}
				}
				_g_object_unref0 (p);
			}
		}
	}
	if (online) {
		merged_status = TRUE;
	} else {
		if (offline) {
			merged_status = FALSE;
		} else {
			merged_status = TRUE;
		}
	}
	if (merged_status != self->priv->_connected) {
		deja_dup_network_set_connected (self, merged_status);
	}
}


DejaDupNetwork* deja_dup_network_construct (GType object_type) {
	DejaDupNetwork * self = NULL;
	self = (DejaDupNetwork*) g_object_new (object_type, NULL);
	return self;
}


DejaDupNetwork* deja_dup_network_new (void) {
	return deja_dup_network_construct (DEJA_DUP_TYPE_NETWORK);
}


gboolean deja_dup_network_get_connected (DejaDupNetwork* self) {
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_connected;
	return result;
}


void deja_dup_network_set_connected (DejaDupNetwork* self, gboolean value) {
	g_return_if_fail (self != NULL);
	self->priv->_connected = value;
	g_object_notify ((GObject *) self, "connected");
}


static GObject * deja_dup_network_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	DejaDupNetwork * self;
	DejaDupStatusNetworkManager* _tmp0_ = NULL;
	DejaDupStatusNetworkManager* _tmp1_;
	DejaDupStatusConnectionManager* _tmp2_ = NULL;
	DejaDupStatusConnectionManager* _tmp3_;
	parent_class = G_OBJECT_CLASS (deja_dup_network_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = DEJA_DUP_NETWORK (obj);
	__g_list_free__g_object_unref0_0 (self->priv->providers);
	self->priv->providers = NULL;
	_tmp0_ = deja_dup_status_network_manager_new ();
	_tmp1_ = _tmp0_;
	deja_dup_network_add_provider (self, (DejaDupStatusProvider*) _tmp1_);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = deja_dup_status_connection_manager_new ();
	_tmp3_ = _tmp2_;
	deja_dup_network_add_provider (self, (DejaDupStatusProvider*) _tmp3_);
	_g_object_unref0 (_tmp3_);
	deja_dup_network_update_status (self);
	return obj;
}


static void deja_dup_network_class_init (DejaDupNetworkClass * klass) {
	deja_dup_network_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (DejaDupNetworkPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_deja_dup_network_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_deja_dup_network_set_property;
	G_OBJECT_CLASS (klass)->constructor = deja_dup_network_constructor;
	G_OBJECT_CLASS (klass)->finalize = deja_dup_network_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DEJA_DUP_NETWORK_CONNECTED, g_param_spec_boolean ("connected", "connected", "connected", TRUE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void deja_dup_network_instance_init (DejaDupNetwork * self) {
	self->priv = DEJA_DUP_NETWORK_GET_PRIVATE (self);
	self->priv->_connected = TRUE;
}


static void deja_dup_network_finalize (GObject* obj) {
	DejaDupNetwork * self;
	self = DEJA_DUP_NETWORK (obj);
	__g_list_free__g_object_unref0_0 (self->priv->providers);
	G_OBJECT_CLASS (deja_dup_network_parent_class)->finalize (obj);
}


GType deja_dup_network_get_type (void) {
	static volatile gsize deja_dup_network_type_id__volatile = 0;
	if (g_once_init_enter (&deja_dup_network_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (DejaDupNetworkClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) deja_dup_network_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DejaDupNetwork), 0, (GInstanceInitFunc) deja_dup_network_instance_init, NULL };
		GType deja_dup_network_type_id;
		deja_dup_network_type_id = g_type_register_static (G_TYPE_OBJECT, "DejaDupNetwork", &g_define_type_info, 0);
		g_once_init_leave (&deja_dup_network_type_id__volatile, deja_dup_network_type_id);
	}
	return deja_dup_network_type_id__volatile;
}


static void _vala_deja_dup_network_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	DejaDupNetwork * self;
	self = DEJA_DUP_NETWORK (object);
	switch (property_id) {
		case DEJA_DUP_NETWORK_CONNECTED:
		g_value_set_boolean (value, deja_dup_network_get_connected (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_deja_dup_network_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	DejaDupNetwork * self;
	self = DEJA_DUP_NETWORK (object);
	switch (property_id) {
		case DEJA_DUP_NETWORK_CONNECTED:
		deja_dup_network_set_connected (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



