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

#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <json-glib/json-glib.h>
#include <gee.h>
#include <libsoup/soup.h>
#include <gio/gio.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TUBA_TYPE_STREAMS (tuba_streams_get_type ())
#define TUBA_STREAMS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_STREAMS, TubaStreams))
#define TUBA_STREAMS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_STREAMS, TubaStreamsClass))
#define TUBA_IS_STREAMS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_STREAMS))
#define TUBA_IS_STREAMS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_STREAMS))
#define TUBA_STREAMS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_STREAMS, TubaStreamsClass))

typedef struct _TubaStreams TubaStreams;
typedef struct _TubaStreamsClass TubaStreamsClass;
typedef struct _TubaStreamsPrivate TubaStreamsPrivate;

#define TUBA_STREAMS_TYPE_CONNECTION (tuba_streams_connection_get_type ())
#define TUBA_STREAMS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_STREAMS_TYPE_CONNECTION, TubaStreamsConnection))
#define TUBA_STREAMS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_STREAMS_TYPE_CONNECTION, TubaStreamsConnectionClass))
#define TUBA_STREAMS_IS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_STREAMS_TYPE_CONNECTION))
#define TUBA_STREAMS_IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_STREAMS_TYPE_CONNECTION))
#define TUBA_STREAMS_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_STREAMS_TYPE_CONNECTION, TubaStreamsConnectionClass))

typedef struct _TubaStreamsConnection TubaStreamsConnection;
typedef struct _TubaStreamsConnectionClass TubaStreamsConnectionClass;
enum  {
	TUBA_STREAMS_0_PROPERTY,
	TUBA_STREAMS_CONNECTIONS_PROPERTY,
	TUBA_STREAMS_NUM_PROPERTIES
};
static GParamSpec* tuba_streams_properties[TUBA_STREAMS_NUM_PROPERTIES];
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))

#define TUBA_TYPE_STREAMABLE (tuba_streamable_get_type ())
#define TUBA_STREAMABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_STREAMABLE, TubaStreamable))
#define TUBA_IS_STREAMABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_STREAMABLE))
#define TUBA_STREAMABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TUBA_TYPE_STREAMABLE, TubaStreamableIface))

typedef struct _TubaStreamable TubaStreamable;
typedef struct _TubaStreamableIface TubaStreamableIface;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TUBA_STREAMABLE_TYPE_EVENT (tuba_streamable_event_get_type ())
typedef struct _TubaStreamableEvent TubaStreamableEvent;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block60Data Block60Data;
typedef struct _TubaStreamsConnectionPrivate TubaStreamsConnectionPrivate;
enum  {
	TUBA_STREAMS_CONNECTION_0_PROPERTY,
	TUBA_STREAMS_CONNECTION_URL_PROPERTY,
	TUBA_STREAMS_CONNECTION_NAME_PROPERTY,
	TUBA_STREAMS_CONNECTION_NUM_PROPERTIES
};
static GParamSpec* tuba_streams_connection_properties[TUBA_STREAMS_CONNECTION_NUM_PROPERTIES];

#define TUBA_TYPE_NETWORK (tuba_network_get_type ())
#define TUBA_NETWORK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_NETWORK, TubaNetwork))
#define TUBA_NETWORK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_NETWORK, TubaNetworkClass))
#define TUBA_IS_NETWORK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_NETWORK))
#define TUBA_IS_NETWORK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_NETWORK))
#define TUBA_NETWORK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_NETWORK, TubaNetworkClass))

typedef struct _TubaNetwork TubaNetwork;
typedef struct _TubaNetworkClass TubaNetworkClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _TubaStreamsConnectionStartRealData TubaStreamsConnectionStartRealData;
typedef struct _Block61Data Block61Data;
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))

#define TUBA_TYPE_OOPSIE (tuba_oopsie_get_type ())
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
#define _g_uri_unref0(var) ((var == NULL) ? NULL : (var = (g_uri_unref (var), NULL)))

struct _TubaStreams {
	GObject parent_instance;
	TubaStreamsPrivate * priv;
};

struct _TubaStreamsClass {
	GObjectClass parent_class;
};

struct _TubaStreamsPrivate {
	GHashTable* _connections;
};

struct _TubaStreamableIface {
	GTypeInterface parent_iface;
	gchar* (*get_stream_url) (TubaStreamable* self);
	void (*on_streaming_policy_changed) (TubaStreamable* self);
	const gchar* (*get_t_connection_url) (TubaStreamable* self);
	void (*set_t_connection_url) (TubaStreamable* self, const gchar* value);
	gboolean (*get_subscribed) (TubaStreamable* self);
	void (*set_subscribed) (TubaStreamable* self, gboolean value);
};

struct _TubaStreamableEvent {
	gchar* type;
	JsonNode* payload;
};

struct _Block60Data {
	int _ref_count_;
	TubaStreams* self;
	gchar* old_url;
	gchar* new_url;
};

struct _TubaStreamsConnection {
	GObject parent_instance;
	TubaStreamsConnectionPrivate * priv;
	GeeArrayList* subscribers;
	SoupWebsocketConnection* socket;
	gboolean closing;
	gint timeout;
};

struct _TubaStreamsConnectionClass {
	GObjectClass parent_class;
	void (*on_message) (TubaStreamsConnection* self, gint i, GBytes* bytes);
};

struct _TubaStreamsConnectionPrivate {
	gchar* _url;
	GCancellable* socket_cancellable;
};

struct _TubaStreamsConnectionStartRealData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TubaStreamsConnection* self;
	GCancellable* _tmp0_;
	GCancellable* _tmp1_;
	GCancellable* _tmp2_;
	SoupWebsocketConnection* _tmp3_;
	SoupWebsocketConnection* _tmp4_;
	guint _tmp5_;
	SoupWebsocketConnection* _tmp6_;
	guint _tmp7_;
	SoupWebsocketConnection* _tmp8_;
	guint _tmp9_;
	SoupWebsocketConnection* _tmp10_;
	TubaNetwork* _tmp11_;
	SoupSession* _tmp12_;
	SoupSession* _tmp13_;
	const gchar* _tmp14_;
	SoupMessage* _tmp15_;
	SoupMessage* _tmp16_;
	GCancellable* _tmp17_;
	SoupWebsocketConnection* _tmp18_;
	SoupWebsocketConnection* _tmp19_;
	SoupWebsocketConnection* _tmp20_;
	SoupWebsocketConnection* _tmp21_;
	SoupWebsocketConnection* _tmp22_;
	GValue _tmp23_;
	SoupWebsocketConnection* _tmp24_;
	SoupWebsocketConnection* _tmp25_;
	SoupWebsocketConnection* _tmp26_;
	GError* e;
	GError* _tmp27_;
	const gchar* _tmp28_;
	const gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	gboolean _tmp32_;
	GError* _tmp33_;
	GError* _tmp34_;
	GError* _inner_error0_;
};

struct _Block61Data {
	int _ref_count_;
	TubaStreamsConnection* self;
	TubaStreamableEvent ev;
};

typedef enum  {
	TUBA_OOPSIE_USER,
	TUBA_OOPSIE_PARSING,
	TUBA_OOPSIE_INSTANCE,
	TUBA_OOPSIE_INTERNAL,
	TUBA_OOPSIE_HTTP_401 = 401,
	TUBA_OOPSIE_HTTP_403 = 403,
	TUBA_OOPSIE_HTTP_404 = 404,
	TUBA_OOPSIE_HTTP_410 = 410,
	TUBA_OOPSIE_HTTP_422 = 422,
	TUBA_OOPSIE_HTTP_429 = 429,
	TUBA_OOPSIE_HTTP_500 = 500,
	TUBA_OOPSIE_HTTP_503 = 503
} TubaOopsie;
#define TUBA_OOPSIE tuba_oopsie_quark ()

static gint TubaStreams_private_offset;
static gpointer tuba_streams_parent_class = NULL;
static gint TubaStreamsConnection_private_offset;
static gpointer tuba_streams_connection_parent_class = NULL;
VALA_EXTERN TubaNetwork* tuba_network;

VALA_EXTERN GType tuba_streams_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaStreams, g_object_unref)
VALA_EXTERN GType tuba_streams_connection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaStreamsConnection, g_object_unref)
static void _g_free0_ (gpointer var);
static void _g_object_unref0_ (gpointer var);
VALA_EXTERN GType tuba_streamable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaStreamable, g_object_unref)
VALA_EXTERN void tuba_streams_subscribe (TubaStreams* self,
                             const gchar* url,
                             TubaStreamable* s);
VALA_EXTERN GHashTable* tuba_streams_get_connections (TubaStreams* self);
VALA_EXTERN void tuba_streams_connection_add (TubaStreamsConnection* self,
                                  TubaStreamable* s);
VALA_EXTERN TubaStreamsConnection* tuba_streams_connection_new (const gchar* url);
VALA_EXTERN TubaStreamsConnection* tuba_streams_connection_construct (GType object_type,
                                                          const gchar* url);
VALA_EXTERN gboolean tuba_streams_connection_start (TubaStreamsConnection* self);
VALA_EXTERN void tuba_streams_unsubscribe (TubaStreams* self,
                               const gchar* url,
                               TubaStreamable* s);
VALA_EXTERN gboolean tuba_streams_connection_remove (TubaStreamsConnection* self,
                                         TubaStreamable* s);
VALA_EXTERN GType tuba_streamable_event_get_type (void) G_GNUC_CONST ;
VALA_EXTERN TubaStreamableEvent* tuba_streamable_event_dup (const TubaStreamableEvent* self);
VALA_EXTERN void tuba_streamable_event_free (TubaStreamableEvent* self);
VALA_EXTERN void tuba_streamable_event_copy (const TubaStreamableEvent* self,
                                 TubaStreamableEvent* dest);
VALA_EXTERN void tuba_streamable_event_destroy (TubaStreamableEvent* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (TubaStreamableEvent, tuba_streamable_event_destroy)
VALA_EXTERN void tuba_streams_forward (TubaStreams* self,
                           const gchar* url,
                           TubaStreamableEvent* ev);
VALA_EXTERN void tuba_streams_connection_push_event (TubaStreamsConnection* self,
                                         TubaStreamableEvent* ev);
VALA_EXTERN void tuba_streams_force_reconnect (TubaStreams* self,
                                   const gchar* url);
VALA_EXTERN void tuba_streams_connection_force_reconnect (TubaStreamsConnection* self);
VALA_EXTERN void tuba_streams_upgrade (TubaStreams* self,
                           const gchar* old_url,
                           const gchar* new_url);
static Block60Data* block60_data_ref (Block60Data* _data60_);
static void block60_data_unref (void * _userdata_);
static void __lambda25_ (Block60Data* _data60_,
                  const gchar* key,
                  TubaStreamsConnection* val);
VALA_EXTERN void tuba_streams_connection_upgrade (TubaStreamsConnection* self,
                                      const gchar* new_url);
static void ___lambda25__gh_func (gconstpointer key,
                           gconstpointer value,
                           gpointer self);
VALA_EXTERN TubaStreams* tuba_streams_new (void);
VALA_EXTERN TubaStreams* tuba_streams_construct (GType object_type);
VALA_EXTERN void tuba_streams_set_connections (TubaStreams* self,
                                   GHashTable* value);
VALA_EXTERN void tuba_streams_connection_on_message (TubaStreamsConnection* self,
                                         gint i,
                                         GBytes* bytes);
static void tuba_streams_connection_set_url (TubaStreamsConnection* self,
                                      const gchar* value);
static void tuba_streams_connection_on_closed (TubaStreamsConnection* self);
VALA_EXTERN gchar* tuba_streams_connection_get_name (TubaStreamsConnection* self);
static void tuba_streams_connection_start_real (TubaStreamsConnection* self,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static void tuba_streams_connection_start_real_finish (TubaStreamsConnection* self,
                                                GAsyncResult* _res_);
static void tuba_streams_connection_start_real_data_free (gpointer _data);
static gboolean tuba_streams_connection_start_real_co (TubaStreamsConnectionStartRealData* _data_);
static void tuba_streams_connection_on_error (TubaStreamsConnection* self,
                                       GError* e);
static void _tuba_streams_connection_on_error_soup_websocket_connection_error (SoupWebsocketConnection* _sender,
                                                                        GError* _error_,
                                                                        gpointer self);
static void _tuba_streams_connection_on_closed_soup_websocket_connection_closed (SoupWebsocketConnection* _sender,
                                                                          gpointer self);
static void _tuba_streams_connection_on_message_soup_websocket_connection_message (SoupWebsocketConnection* _sender,
                                                                            gint type,
                                                                            GBytes* message,
                                                                            gpointer self);
VALA_EXTERN GType tuba_network_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaNetwork, g_object_unref)
VALA_EXTERN SoupSession* tuba_network_get_session (TubaNetwork* self);
VALA_EXTERN const gchar* tuba_streams_connection_get_url (TubaStreamsConnection* self);
static void tuba_streams_connection_start_real_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
VALA_EXTERN gchar* tuba_streamable_get_subscriber_name (TubaStreamable* self);
static gboolean _tuba_streams_connection_start_gsource_func (gpointer self);
static void tuba_streams_connection_real_on_message (TubaStreamsConnection* self,
                                              gint i,
                                              GBytes* bytes);
static void tuba_streams_connection_decode (TubaStreamsConnection* self,
                                     GBytes* bytes,
                                     TubaStreamableEvent* event,
                                     GError** error);
static Block61Data* block61_data_ref (Block61Data* _data61_);
static void block61_data_unref (void * _userdata_);
static gboolean __lambda24_ (Block61Data* _data61_,
                      TubaStreamable* s);
static gboolean ___lambda24__gee_forall_func (gpointer g,
                                       gpointer self);
static void _vala_JsonNode_free (JsonNode* self);
VALA_EXTERN GQuark tuba_oopsie_quark (void);
VALA_EXTERN GType tuba_oopsie_get_type (void) G_GNUC_CONST ;
static JsonNode* _vala_JsonNode_copy (JsonNode* self);
static void tuba_streams_connection_finalize (GObject * obj);
static GType tuba_streams_connection_get_type_once (void);
static void _vala_tuba_streams_connection_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec);
static void _vala_tuba_streams_connection_set_property (GObject * object,
                                                 guint property_id,
                                                 const GValue * value,
                                                 GParamSpec * pspec);
static void tuba_streams_finalize (GObject * obj);
static GType tuba_streams_get_type_once (void);
static void _vala_tuba_streams_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec);
static void _vala_tuba_streams_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec);

static inline gpointer
tuba_streams_get_instance_private (TubaStreams* self)
{
	return G_STRUCT_MEMBER_P (self, TubaStreams_private_offset);
}

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

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

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

void
tuba_streams_subscribe (TubaStreams* self,
                        const gchar* url,
                        TubaStreamable* s)
{
	GHashTable* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (s != NULL);
	if (url == NULL) {
		return;
	}
	_tmp0_ = self->priv->_connections;
	if (g_hash_table_contains (_tmp0_, url)) {
		GHashTable* _tmp1_;
		gconstpointer _tmp2_;
		_tmp1_ = self->priv->_connections;
		_tmp2_ = g_hash_table_lookup (_tmp1_, url);
		tuba_streams_connection_add ((TubaStreamsConnection*) _tmp2_, s);
	} else {
		TubaStreamsConnection* con = NULL;
		TubaStreamsConnection* _tmp3_;
		GHashTable* _tmp4_;
		gchar* _tmp5_;
		TubaStreamsConnection* _tmp6_;
		TubaStreamsConnection* _tmp7_;
		TubaStreamsConnection* _tmp8_;
		TubaStreamsConnection* _tmp9_;
		_tmp3_ = tuba_streams_connection_new (url);
		con = _tmp3_;
		_tmp4_ = self->priv->_connections;
		_tmp5_ = g_strdup (url);
		_tmp6_ = con;
		_tmp7_ = _g_object_ref0 (_tmp6_);
		g_hash_table_insert (_tmp4_, _tmp5_, _tmp7_);
		_tmp8_ = con;
		tuba_streams_connection_add (_tmp8_, s);
		_tmp9_ = con;
		tuba_streams_connection_start (_tmp9_);
		_g_object_unref0 (con);
	}
}

void
tuba_streams_unsubscribe (TubaStreams* self,
                          const gchar* url,
                          TubaStreamable* s)
{
	GHashTable* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (s != NULL);
	if (url == NULL) {
		return;
	}
	_tmp0_ = self->priv->_connections;
	if (g_hash_table_contains (_tmp0_, url)) {
		gboolean unused = FALSE;
		GHashTable* _tmp1_;
		gconstpointer _tmp2_;
		_tmp1_ = self->priv->_connections;
		_tmp2_ = g_hash_table_lookup (_tmp1_, url);
		unused = tuba_streams_connection_remove ((TubaStreamsConnection*) _tmp2_, s);
		if (unused) {
			GHashTable* _tmp3_;
			_tmp3_ = self->priv->_connections;
			g_hash_table_remove (_tmp3_, url);
		}
	}
}

void
tuba_streams_forward (TubaStreams* self,
                      const gchar* url,
                      TubaStreamableEvent* ev)
{
	GHashTable* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (ev != NULL);
	if (url == NULL) {
		return;
	}
	_tmp0_ = self->priv->_connections;
	if (g_hash_table_contains (_tmp0_, url)) {
		GHashTable* _tmp1_;
		gconstpointer _tmp2_;
		TubaStreamableEvent _tmp3_;
		_tmp1_ = self->priv->_connections;
		_tmp2_ = g_hash_table_lookup (_tmp1_, url);
		_tmp3_ = *ev;
		tuba_streams_connection_push_event ((TubaStreamsConnection*) _tmp2_, &_tmp3_);
	}
}

void
tuba_streams_force_reconnect (TubaStreams* self,
                              const gchar* url)
{
	GHashTable* _tmp0_;
	g_return_if_fail (self != NULL);
	if (url == NULL) {
		return;
	}
	_tmp0_ = self->priv->_connections;
	if (g_hash_table_contains (_tmp0_, url)) {
		GHashTable* _tmp1_;
		gconstpointer _tmp2_;
		_tmp1_ = self->priv->_connections;
		_tmp2_ = g_hash_table_lookup (_tmp1_, url);
		tuba_streams_connection_force_reconnect ((TubaStreamsConnection*) _tmp2_);
	}
}

static Block60Data*
block60_data_ref (Block60Data* _data60_)
{
	g_atomic_int_inc (&_data60_->_ref_count_);
	return _data60_;
}

static void
block60_data_unref (void * _userdata_)
{
	Block60Data* _data60_;
	_data60_ = (Block60Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data60_->_ref_count_)) {
		TubaStreams* self;
		self = _data60_->self;
		_g_free0 (_data60_->old_url);
		_g_free0 (_data60_->new_url);
		_g_object_unref0 (self);
		g_slice_free (Block60Data, _data60_);
	}
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

static void
__lambda25_ (Block60Data* _data60_,
             const gchar* key,
             TubaStreamsConnection* val)
{
	TubaStreams* self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gboolean _tmp3_;
	self = _data60_->self;
	g_return_if_fail (key != NULL);
	g_return_if_fail (val != NULL);
	_tmp0_ = string_to_string (_data60_->old_url);
	_tmp1_ = g_strconcat (_tmp0_, "/", NULL);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_str_has_prefix (key, _tmp2_);
	_g_free0 (_tmp2_);
	if (_tmp3_) {
		tuba_streams_connection_upgrade (val, _data60_->new_url);
	}
}

static void
___lambda25__gh_func (gconstpointer key,
                      gconstpointer value,
                      gpointer self)
{
	__lambda25_ (self, (const gchar*) key, (TubaStreamsConnection*) value);
}

void
tuba_streams_upgrade (TubaStreams* self,
                      const gchar* old_url,
                      const gchar* new_url)
{
	Block60Data* _data60_;
	gchar* _tmp0_;
	gchar* _tmp1_;
	GHashTable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (old_url != NULL);
	g_return_if_fail (new_url != NULL);
	_data60_ = g_slice_new0 (Block60Data);
	_data60_->_ref_count_ = 1;
	_data60_->self = g_object_ref (self);
	_tmp0_ = g_strdup (old_url);
	_g_free0 (_data60_->old_url);
	_data60_->old_url = _tmp0_;
	_tmp1_ = g_strdup (new_url);
	_g_free0 (_data60_->new_url);
	_data60_->new_url = _tmp1_;
	_tmp2_ = self->priv->_connections;
	g_hash_table_foreach (_tmp2_, ___lambda25__gh_func, _data60_);
	block60_data_unref (_data60_);
	_data60_ = NULL;
}

TubaStreams*
tuba_streams_construct (GType object_type)
{
	TubaStreams * self = NULL;
	self = (TubaStreams*) g_object_new (object_type, NULL);
	return self;
}

TubaStreams*
tuba_streams_new (void)
{
	return tuba_streams_construct (TUBA_TYPE_STREAMS);
}

GHashTable*
tuba_streams_get_connections (TubaStreams* self)
{
	GHashTable* result;
	GHashTable* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_connections;
	result = _tmp0_;
	return result;
}

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

void
tuba_streams_set_connections (TubaStreams* self,
                              GHashTable* value)
{
	GHashTable* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_streams_get_connections (self);
	if (old_value != value) {
		GHashTable* _tmp0_;
		_tmp0_ = _g_hash_table_ref0 (value);
		_g_hash_table_unref0 (self->priv->_connections);
		self->priv->_connections = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_streams_properties[TUBA_STREAMS_CONNECTIONS_PROPERTY]);
	}
}

static inline gpointer
tuba_streams_connection_get_instance_private (TubaStreamsConnection* self)
{
	return G_STRUCT_MEMBER_P (self, TubaStreamsConnection_private_offset);
}

TubaStreamsConnection*
tuba_streams_connection_construct (GType object_type,
                                   const gchar* url)
{
	TubaStreamsConnection * self = NULL;
	GeeArrayList* _tmp0_;
	g_return_val_if_fail (url != NULL, NULL);
	self = (TubaStreamsConnection*) g_object_new (object_type, NULL);
	_tmp0_ = gee_array_list_new (TUBA_TYPE_STREAMABLE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->subscribers);
	self->subscribers = _tmp0_;
	tuba_streams_connection_set_url (self, url);
	return self;
}

TubaStreamsConnection*
tuba_streams_connection_new (const gchar* url)
{
	return tuba_streams_connection_construct (TUBA_STREAMS_TYPE_CONNECTION, url);
}

void
tuba_streams_connection_force_reconnect (TubaStreamsConnection* self)
{
	g_return_if_fail (self != NULL);
	tuba_streams_connection_on_closed (self);
}

gboolean
tuba_streams_connection_start (TubaStreamsConnection* self)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = tuba_streams_connection_get_name (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = string_to_string (_tmp2_);
	_tmp4_ = g_strconcat ("Opening stream: ", _tmp3_, NULL);
	_tmp5_ = _tmp4_;
	g_debug ("Streams.vala:87: %s", _tmp5_);
	_g_free0 (_tmp5_);
	_g_free0 (_tmp2_);
	tuba_streams_connection_start_real (self, NULL, NULL);
	result = FALSE;
	return result;
}

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

static void
tuba_streams_connection_start_real (TubaStreamsConnection* self,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	TubaStreamsConnectionStartRealData* _data_;
	TubaStreamsConnection* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (TubaStreamsConnectionStartRealData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tuba_streams_connection_start_real_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	tuba_streams_connection_start_real_co (_data_);
}

static void
tuba_streams_connection_start_real_finish (TubaStreamsConnection* self,
                                           GAsyncResult* _res_)
{
	TubaStreamsConnectionStartRealData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
_tuba_streams_connection_on_error_soup_websocket_connection_error (SoupWebsocketConnection* _sender,
                                                                   GError* _error_,
                                                                   gpointer self)
{
	tuba_streams_connection_on_error ((TubaStreamsConnection*) self, _error_);
}

static void
_tuba_streams_connection_on_closed_soup_websocket_connection_closed (SoupWebsocketConnection* _sender,
                                                                     gpointer self)
{
	tuba_streams_connection_on_closed ((TubaStreamsConnection*) self);
}

static void
_tuba_streams_connection_on_message_soup_websocket_connection_message (SoupWebsocketConnection* _sender,
                                                                       gint type,
                                                                       GBytes* message,
                                                                       gpointer self)
{
	tuba_streams_connection_on_message ((TubaStreamsConnection*) self, type, message);
}

static void
tuba_streams_connection_start_real_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	TubaStreamsConnectionStartRealData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tuba_streams_connection_start_real_co (_data_);
}

static gboolean
tuba_streams_connection_start_real_co (TubaStreamsConnectionStartRealData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->socket_cancellable;
	if (_data_->_tmp0_ != NULL) {
		_data_->_tmp1_ = _data_->self->priv->socket_cancellable;
		g_cancellable_cancel (_data_->_tmp1_);
	}
	_data_->_tmp2_ = g_cancellable_new ();
	_g_object_unref0 (_data_->self->priv->socket_cancellable);
	_data_->self->priv->socket_cancellable = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->self->socket;
	if (_data_->_tmp3_ != NULL) {
		_data_->_tmp4_ = _data_->self->socket;
		g_signal_parse_name ("error", soup_websocket_connection_get_type (), &_data_->_tmp5_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_data_->_tmp4_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _data_->_tmp5_, 0, NULL, (GCallback) _tuba_streams_connection_on_error_soup_websocket_connection_error, _data_->self);
		_data_->_tmp6_ = _data_->self->socket;
		g_signal_parse_name ("closed", soup_websocket_connection_get_type (), &_data_->_tmp7_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_data_->_tmp6_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _data_->_tmp7_, 0, NULL, (GCallback) _tuba_streams_connection_on_closed_soup_websocket_connection_closed, _data_->self);
		_data_->_tmp8_ = _data_->self->socket;
		g_signal_parse_name ("message", soup_websocket_connection_get_type (), &_data_->_tmp9_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_data_->_tmp8_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _data_->_tmp9_, 0, NULL, (GCallback) _tuba_streams_connection_on_message_soup_websocket_connection_message, _data_->self);
	}
	{
		_data_->_tmp11_ = tuba_network;
		_data_->_tmp12_ = tuba_network_get_session (_data_->_tmp11_);
		_data_->_tmp13_ = _data_->_tmp12_;
		_data_->_tmp14_ = _data_->self->priv->_url;
		_data_->_tmp15_ = soup_message_new ("GET", _data_->_tmp14_);
		_data_->_tmp16_ = _data_->_tmp15_;
		_data_->_tmp17_ = _data_->self->priv->socket_cancellable;
		_data_->_state_ = 1;
		soup_session_websocket_connect_async (_data_->_tmp13_, _data_->_tmp16_, NULL, NULL, 0, _data_->_tmp17_, tuba_streams_connection_start_real_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp18_ = soup_session_websocket_connect_finish (_data_->_tmp13_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp19_ = _data_->_tmp18_;
		_g_object_unref0 (_data_->_tmp16_);
		_data_->_tmp10_ = _data_->_tmp19_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp20_ = _data_->_tmp10_;
		_data_->_tmp10_ = NULL;
		_g_object_unref0 (_data_->self->socket);
		_data_->self->socket = _data_->_tmp20_;
		_data_->_tmp21_ = _data_->self->socket;
		soup_websocket_connection_set_keepalive_interval (_data_->_tmp21_, (guint) 30);
		_data_->_tmp22_ = _data_->self->socket;
		memset (&_data_->_tmp23_, 0, sizeof (GValue));
		g_value_init (&_data_->_tmp23_, G_TYPE_INT);
		g_value_set_int (&_data_->_tmp23_, 30);
		g_object_set_property ((GObject*) _data_->_tmp22_, "keepalive-pong-timeout", &_data_->_tmp23_);
		G_IS_VALUE (&_data_->_tmp23_) ? (g_value_unset (&_data_->_tmp23_), NULL) : NULL;
		_data_->_tmp24_ = _data_->self->socket;
		g_signal_connect_object (_data_->_tmp24_, "error", (GCallback) _tuba_streams_connection_on_error_soup_websocket_connection_error, _data_->self, 0);
		_data_->_tmp25_ = _data_->self->socket;
		g_signal_connect_object (_data_->_tmp25_, "closed", (GCallback) _tuba_streams_connection_on_closed_soup_websocket_connection_closed, _data_->self, 0);
		_data_->_tmp26_ = _data_->self->socket;
		g_signal_connect_object (_data_->_tmp26_, "message", (GCallback) _tuba_streams_connection_on_message_soup_websocket_connection_message, _data_->self, 0);
		_g_object_unref0 (_data_->_tmp10_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp27_ = _data_->e;
		_data_->_tmp28_ = _data_->_tmp27_->message;
		_data_->_tmp29_ = string_to_string (_data_->_tmp28_);
		_data_->_tmp30_ = g_strconcat ("Error opening stream: ", _data_->_tmp29_, NULL);
		_data_->_tmp31_ = _data_->_tmp30_;
		g_warning ("Streams.vala:117: %s", _data_->_tmp31_);
		_g_free0 (_data_->_tmp31_);
		_data_->_tmp33_ = _data_->e;
		if (g_error_matches (_data_->_tmp33_, g_quark_from_string ("g-tls-error-quark"), 3)) {
			_data_->_tmp32_ = TRUE;
		} else {
			_data_->_tmp34_ = _data_->e;
			_data_->_tmp32_ = g_error_matches (_data_->_tmp34_, g_quark_from_string ("g-io-error-quark"), 44);
		}
		if (_data_->_tmp32_) {
			tuba_streams_connection_on_closed (_data_->self);
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != 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_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;
}

void
tuba_streams_connection_add (TubaStreamsConnection* self,
                             TubaStreamable* s)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GeeArrayList* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (s != NULL);
	_tmp0_ = tuba_streamable_get_subscriber_name (s);
	_tmp1_ = _tmp0_;
	_tmp2_ = tuba_streams_connection_get_name (self);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_;
	g_info ("Streams.vala:125: %s > %s", _tmp1_, _tmp4_);
	_g_free0 (_tmp4_);
	_g_free0 (_tmp1_);
	_tmp5_ = self->subscribers;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp5_, s);
}

gboolean
tuba_streams_connection_remove (TubaStreamsConnection* self,
                                TubaStreamable* s)
{
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (s != NULL, FALSE);
	_tmp0_ = self->subscribers;
	if (gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp0_, s)) {
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		GeeArrayList* _tmp6_;
		_tmp1_ = tuba_streamable_get_subscriber_name (s);
		_tmp2_ = _tmp1_;
		_tmp3_ = tuba_streams_connection_get_name (self);
		_tmp4_ = _tmp3_;
		_tmp5_ = _tmp4_;
		g_info ("Streams.vala:131: %s X %s", _tmp2_, _tmp5_);
		_g_free0 (_tmp5_);
		_g_free0 (_tmp2_);
		_tmp6_ = self->subscribers;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp6_, s);
	}
	_tmp7_ = self->subscribers;
	_tmp8_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp7_);
	_tmp9_ = _tmp8_;
	if (_tmp9_ <= 0) {
		gchar* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		const gchar* _tmp13_;
		gchar* _tmp14_;
		gchar* _tmp15_;
		SoupWebsocketConnection* _tmp16_;
		_tmp10_ = tuba_streams_connection_get_name (self);
		_tmp11_ = _tmp10_;
		_tmp12_ = _tmp11_;
		_tmp13_ = string_to_string (_tmp12_);
		_tmp14_ = g_strconcat ("Closing: ", _tmp13_, NULL);
		_tmp15_ = _tmp14_;
		g_debug ("Streams.vala:136: %s", _tmp15_);
		_g_free0 (_tmp15_);
		_g_free0 (_tmp12_);
		self->closing = TRUE;
		_tmp16_ = self->socket;
		if (_tmp16_ != NULL) {
			SoupWebsocketConnection* _tmp17_;
			_tmp17_ = self->socket;
			soup_websocket_connection_close (_tmp17_, (gushort) 0, NULL);
		}
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static void
tuba_streams_connection_on_error (TubaStreamsConnection* self,
                                  GError* e)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (e != NULL);
	if (self->closing) {
		return;
	}
	_tmp0_ = tuba_streams_connection_get_name (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = string_to_string (_tmp2_);
	_tmp4_ = e->message;
	_tmp5_ = string_to_string (_tmp4_);
	_tmp6_ = g_strconcat ("Error in ", _tmp3_, ": ", _tmp5_, NULL);
	_tmp7_ = _tmp6_;
	g_warning ("Streams.vala:149: %s", _tmp7_);
	_g_free0 (_tmp7_);
	_g_free0 (_tmp2_);
}

static gboolean
_tuba_streams_connection_start_gsource_func (gpointer self)
{
	gboolean result;
	result = tuba_streams_connection_start ((TubaStreamsConnection*) self);
	return result;
}

static void
tuba_streams_connection_on_closed (TubaStreamsConnection* self)
{
	SoupWebsocketConnection* _tmp0_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	const gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->socket;
	if (_tmp0_ != NULL) {
		SoupWebsocketConnection* _tmp1_;
		guint _tmp2_;
		SoupWebsocketConnection* _tmp3_;
		guint _tmp4_;
		SoupWebsocketConnection* _tmp5_;
		guint _tmp6_;
		_tmp1_ = self->socket;
		g_signal_parse_name ("error", soup_websocket_connection_get_type (), &_tmp2_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _tuba_streams_connection_on_error_soup_websocket_connection_error, self);
		_tmp3_ = self->socket;
		g_signal_parse_name ("closed", soup_websocket_connection_get_type (), &_tmp4_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp4_, 0, NULL, (GCallback) _tuba_streams_connection_on_closed_soup_websocket_connection_closed, self);
		_tmp5_ = self->socket;
		g_signal_parse_name ("message", soup_websocket_connection_get_type (), &_tmp6_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp5_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp6_, 0, NULL, (GCallback) _tuba_streams_connection_on_message_soup_websocket_connection_message, self);
	}
	_g_object_unref0 (self->socket);
	self->socket = NULL;
	if (!self->closing) {
		gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		const gchar* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		_tmp7_ = tuba_streams_connection_get_name (self);
		_tmp8_ = _tmp7_;
		_tmp9_ = _tmp8_;
		_tmp10_ = string_to_string (_tmp9_);
		_tmp11_ = g_strdup_printf ("%i", self->timeout);
		_tmp12_ = _tmp11_;
		_tmp13_ = g_strconcat ("DISCONNECTED: ", _tmp10_, ". Reconnecting in ", _tmp12_, " seconds.", NULL);
		_tmp14_ = _tmp13_;
		g_warning ("Streams.vala:161: %s", _tmp14_);
		_g_free0 (_tmp14_);
		_g_free0 (_tmp12_);
		_g_free0 (_tmp9_);
		g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) self->timeout, _tuba_streams_connection_start_gsource_func, g_object_ref (self), g_object_unref);
		self->timeout = MIN (self->timeout * 2, 6);
	}
	_tmp15_ = tuba_streams_connection_get_name (self);
	_tmp16_ = _tmp15_;
	_tmp17_ = _tmp16_;
	_tmp18_ = string_to_string (_tmp17_);
	_tmp19_ = g_strconcat ("Closing stream: ", _tmp18_, NULL);
	_tmp20_ = _tmp19_;
	g_debug ("Streams.vala:165: %s", _tmp20_);
	_g_free0 (_tmp20_);
	_g_free0 (_tmp17_);
}

static void
tuba_streams_connection_real_on_message (TubaStreamsConnection* self,
                                         gint i,
                                         GBytes* bytes)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (bytes != NULL);
	{
		TubaStreamableEvent ev = {0};
		TubaStreamableEvent _tmp0_ = {0};
		TubaStreamableEvent _tmp1_;
		tuba_streams_connection_decode (self, bytes, &_tmp0_, &_inner_error0_);
		tuba_streamable_event_destroy (&ev);
		ev = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			tuba_streamable_event_destroy (&ev);
			goto __catch0_g_error;
		}
		_tmp1_ = ev;
		tuba_streams_connection_push_event (self, &_tmp1_);
		tuba_streamable_event_destroy (&ev);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp2_;
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp2_ = e;
		_tmp3_ = _tmp2_->message;
		_tmp4_ = string_to_string (_tmp3_);
		_tmp5_ = g_strconcat ("Failed to handle websocket message. Reason: ", _tmp4_, NULL);
		_tmp6_ = _tmp5_;
		g_warning ("Streams.vala:174: %s", _tmp6_);
		_g_free0 (_tmp6_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

void
tuba_streams_connection_on_message (TubaStreamsConnection* self,
                                    gint i,
                                    GBytes* bytes)
{
	TubaStreamsConnectionClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = TUBA_STREAMS_CONNECTION_GET_CLASS (self);
	if (_klass_->on_message) {
		_klass_->on_message (self, i, bytes);
	}
}

static Block61Data*
block61_data_ref (Block61Data* _data61_)
{
	g_atomic_int_inc (&_data61_->_ref_count_);
	return _data61_;
}

static void
block61_data_unref (void * _userdata_)
{
	Block61Data* _data61_;
	_data61_ = (Block61Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data61_->_ref_count_)) {
		TubaStreamsConnection* self;
		self = _data61_->self;
		tuba_streamable_event_destroy (&_data61_->ev);
		_g_object_unref0 (self);
		g_slice_free (Block61Data, _data61_);
	}
}

static gboolean
__lambda24_ (Block61Data* _data61_,
             TubaStreamable* s)
{
	TubaStreamsConnection* self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	TubaStreamableEvent _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	TubaStreamableEvent _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	TubaStreamableEvent _tmp15_;
	gboolean result;
	self = _data61_->self;
	g_return_val_if_fail (s != NULL, FALSE);
	_tmp0_ = tuba_streams_connection_get_name (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = string_to_string (_tmp2_);
	_tmp4_ = _data61_->ev;
	_tmp5_ = _tmp4_.type;
	_tmp6_ = string_to_string (_tmp5_);
	_tmp7_ = tuba_streamable_get_subscriber_name (s);
	_tmp8_ = _tmp7_;
	_tmp9_ = string_to_string (_tmp8_);
	_tmp10_ = g_strconcat (_tmp3_, ": ", _tmp6_, " for ", _tmp9_, NULL);
	_tmp11_ = _tmp10_;
	g_debug ("Streams.vala:180: %s", _tmp11_);
	_g_free0 (_tmp11_);
	_g_free0 (_tmp8_);
	_g_free0 (_tmp2_);
	_tmp12_ = _data61_->ev;
	_tmp13_ = _tmp12_.type;
	_tmp14_ = g_strconcat ("stream-event::", _tmp13_, NULL);
	_tmp15_ = _data61_->ev;
	g_signal_emit_by_name (s, _tmp14_, &_tmp15_);
	_g_free0 (_tmp14_);
	result = TRUE;
	_g_object_unref0 (s);
	return result;
}

static gboolean
___lambda24__gee_forall_func (gpointer g,
                              gpointer self)
{
	gboolean result;
	result = __lambda24_ (self, (TubaStreamable*) g);
	return result;
}

void
tuba_streams_connection_push_event (TubaStreamsConnection* self,
                                    TubaStreamableEvent* ev)
{
	Block61Data* _data61_;
	TubaStreamableEvent _tmp0_;
	TubaStreamableEvent _tmp1_;
	TubaStreamableEvent _tmp2_ = {0};
	GeeArrayList* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (ev != NULL);
	_data61_ = g_slice_new0 (Block61Data);
	_data61_->_ref_count_ = 1;
	_data61_->self = g_object_ref (self);
	_tmp0_ = *ev;
	_tmp1_ = _tmp0_;
	tuba_streamable_event_copy (&_tmp1_, &_tmp2_);
	tuba_streamable_event_destroy (&_data61_->ev);
	_data61_->ev = _tmp2_;
	_tmp3_ = self->subscribers;
	gee_abstract_collection_foreach ((GeeAbstractCollection*) _tmp3_, ___lambda24__gee_forall_func, _data61_);
	block61_data_unref (_data61_);
	_data61_ = NULL;
}

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

static void
_vala_JsonNode_free (JsonNode* self)
{
	g_boxed_free (json_node_get_type (), self);
}

static JsonNode*
_vala_JsonNode_copy (JsonNode* self)
{
	return g_boxed_copy (json_node_get_type (), self);
}

static gpointer
__vala_JsonNode_copy0 (gpointer self)
{
	return self ? _vala_JsonNode_copy (self) : NULL;
}

static void
tuba_streams_connection_decode (TubaStreamsConnection* self,
                                GBytes* bytes,
                                TubaStreamableEvent* event,
                                GError** error)
{
	TubaStreamableEvent _vala_event = {0};
	gchar* msg = NULL;
	gsize _tmp0_ = 0;
	guint8* _tmp1_;
	gchar* _tmp2_;
	JsonParser* parser = NULL;
	JsonParser* _tmp3_;
	JsonParser* _tmp4_;
	const gchar* _tmp5_;
	JsonObject* obj = NULL;
	JsonParser* _tmp6_;
	JsonNode* _tmp7_;
	JsonNode* _tmp8_;
	JsonObject* _tmp9_;
	JsonObject* _tmp10_;
	JsonObject* _tmp11_;
	JsonObject* _tmp12_;
	JsonObject* _tmp14_;
	JsonObject* _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	JsonObject* _tmp19_;
	JsonNode* _tmp20_;
	JsonNode* _tmp21_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (bytes != NULL);
	_tmp1_ = g_bytes_get_data (bytes, &_tmp0_);
	_tmp2_ = g_strdup ((const gchar*) _tmp1_);
	msg = _tmp2_;
	_tmp3_ = json_parser_new ();
	parser = _tmp3_;
	_tmp4_ = parser;
	_tmp5_ = msg;
	json_parser_load_from_data (_tmp4_, _tmp5_, (gssize) -1, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		_g_free0 (msg);
		tuba_streamable_event_destroy (&_vala_event);
		return;
	}
	_tmp6_ = parser;
	_tmp7_ = json_parser_steal_root (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = json_node_get_object (_tmp8_);
	_tmp10_ = _json_object_ref0 (_tmp9_);
	_tmp11_ = _tmp10_;
	__vala_JsonNode_free0 (_tmp8_);
	obj = _tmp11_;
	_tmp12_ = obj;
	if (_tmp12_ == NULL) {
		GError* _tmp13_;
		_tmp13_ = g_error_new_literal (TUBA_OOPSIE, TUBA_OOPSIE_INSTANCE, "Failed to decode message as an Object");
		_inner_error0_ = _tmp13_;
		g_propagate_error (error, _inner_error0_);
		_json_object_unref0 (obj);
		_g_object_unref0 (parser);
		_g_free0 (msg);
		tuba_streamable_event_destroy (&_vala_event);
		return;
	}
	_tmp14_ = obj;
	if (!json_object_has_member (_tmp14_, "event")) {
		GError* _tmp15_;
		_tmp15_ = g_error_new_literal (TUBA_OOPSIE, TUBA_OOPSIE_INSTANCE, "No event specified");
		_inner_error0_ = _tmp15_;
		g_propagate_error (error, _inner_error0_);
		_json_object_unref0 (obj);
		_g_object_unref0 (parser);
		_g_free0 (msg);
		tuba_streamable_event_destroy (&_vala_event);
		return;
	}
	tuba_streamable_event_destroy (&_vala_event);
	memset (&_vala_event, 0, sizeof (TubaStreamableEvent));
	_tmp16_ = obj;
	_tmp17_ = json_object_get_string_member (_tmp16_, "event");
	_tmp18_ = g_strdup (_tmp17_);
	_g_free0 (_vala_event.type);
	_vala_event.type = _tmp18_;
	_tmp19_ = obj;
	_tmp20_ = json_object_get_member (_tmp19_, "payload");
	_tmp21_ = __vala_JsonNode_copy0 (_tmp20_);
	__vala_JsonNode_free0 (_vala_event.payload);
	_vala_event.payload = _tmp21_;
	_json_object_unref0 (obj);
	_g_object_unref0 (parser);
	_g_free0 (msg);
	if (event) {
		*event = _vala_event;
	} else {
		tuba_streamable_event_destroy (&_vala_event);
	}
}

void
tuba_streams_connection_upgrade (TubaStreamsConnection* self,
                                 const gchar* new_url)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (new_url != NULL);
	{
		GUri* uri = NULL;
		const gchar* _tmp0_;
		GUri* _tmp1_;
		GUri* new_uri = NULL;
		GUri* _tmp2_;
		GUri* _tmp3_;
		GUri* _tmp4_;
		const gchar* _tmp5_;
		GUri* _tmp6_;
		const gchar* _tmp7_;
		GUri* _tmp8_;
		const gchar* _tmp9_;
		GUri* _tmp10_;
		GUri* _tmp11_;
		const gchar* _tmp12_;
		GUri* _tmp13_;
		const gchar* _tmp14_;
		GUri* _tmp15_;
		const gchar* _tmp16_;
		GUri* _tmp17_;
		GUri* _tmp18_;
		gchar* _tmp19_;
		gchar* _tmp20_;
		SoupWebsocketConnection* _tmp21_;
		_tmp0_ = self->priv->_url;
		_tmp1_ = g_uri_parse (_tmp0_, G_URI_FLAGS_NONE, &_inner_error0_);
		uri = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp2_ = g_uri_parse (new_url, G_URI_FLAGS_NONE, &_inner_error0_);
		new_uri = _tmp2_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_uri_unref0 (uri);
			goto __catch0_g_error;
		}
		_tmp3_ = uri;
		_tmp4_ = new_uri;
		_tmp5_ = g_uri_get_scheme (_tmp4_);
		_tmp6_ = new_uri;
		_tmp7_ = g_uri_get_userinfo (_tmp6_);
		_tmp8_ = new_uri;
		_tmp9_ = g_uri_get_host (_tmp8_);
		_tmp10_ = new_uri;
		_tmp11_ = uri;
		_tmp12_ = g_uri_get_path (_tmp11_);
		_tmp13_ = uri;
		_tmp14_ = g_uri_get_query (_tmp13_);
		_tmp15_ = uri;
		_tmp16_ = g_uri_get_fragment (_tmp15_);
		_tmp17_ = g_uri_build (g_uri_get_flags (_tmp3_), _tmp5_, _tmp7_, _tmp9_, g_uri_get_port (_tmp10_), _tmp12_, _tmp14_, _tmp16_);
		_tmp18_ = _tmp17_;
		_tmp19_ = g_uri_to_string (_tmp18_);
		_tmp20_ = _tmp19_;
		tuba_streams_connection_set_url (self, _tmp20_);
		_g_free0 (_tmp20_);
		_g_uri_unref0 (_tmp18_);
		_tmp21_ = self->socket;
		if (_tmp21_ != NULL) {
			SoupWebsocketConnection* _tmp22_;
			_tmp22_ = self->socket;
			soup_websocket_connection_close (_tmp22_, (gushort) 0, NULL);
		}
		_g_uri_unref0 (new_uri);
		_g_uri_unref0 (uri);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		const gchar* _tmp23_;
		const gchar* _tmp24_;
		const gchar* _tmp25_;
		GError* _tmp26_;
		gchar* _tmp27_;
		gchar* _tmp28_;
		GError* _tmp29_;
		const gchar* _tmp30_;
		const gchar* _tmp31_;
		gchar* _tmp32_;
		gchar* _tmp33_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp23_ = self->priv->_url;
		_tmp24_ = string_to_string (_tmp23_);
		_tmp25_ = string_to_string (new_url);
		_tmp26_ = e;
		_tmp27_ = g_strdup_printf ("%i", _tmp26_->code);
		_tmp28_ = _tmp27_;
		_tmp29_ = e;
		_tmp30_ = _tmp29_->message;
		_tmp31_ = string_to_string (_tmp30_);
		_tmp32_ = g_strconcat ("Error while upgrading ", _tmp24_, " to ", _tmp25_, ": ", _tmp28_, " ", _tmp31_, NULL);
		_tmp33_ = _tmp32_;
		g_warning ("Streams.vala:217: %s", _tmp33_);
		_g_free0 (_tmp33_);
		_g_free0 (_tmp28_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

const gchar*
tuba_streams_connection_get_url (TubaStreamsConnection* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_url;
	result = _tmp0_;
	return result;
}

static void
tuba_streams_connection_set_url (TubaStreamsConnection* self,
                                 const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_streams_connection_get_url (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_url);
		self->priv->_url = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_streams_connection_properties[TUBA_STREAMS_CONNECTION_URL_PROPERTY]);
	}
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

static gint
string_last_index_of (const gchar* self,
                      const gchar* needle,
                      gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (needle != NULL, -1);
	_tmp0_ = g_strrstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

gchar*
tuba_streams_connection_get_name (TubaStreamsConnection* self)
{
	gchar* result;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_url;
	_tmp1_ = self->priv->_url;
	_tmp2_ = string_slice (_tmp0_, (glong) 0, (glong) string_last_index_of (_tmp1_, "&access_token", 0));
	result = _tmp2_;
	return result;
}

static void
tuba_streams_connection_class_init (TubaStreamsConnectionClass * klass,
                                    gpointer klass_data)
{
	tuba_streams_connection_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaStreamsConnection_private_offset);
	((TubaStreamsConnectionClass *) klass)->on_message = (void (*) (TubaStreamsConnection*, gint, GBytes*)) tuba_streams_connection_real_on_message;
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_streams_connection_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_streams_connection_set_property;
	G_OBJECT_CLASS (klass)->finalize = tuba_streams_connection_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_STREAMS_CONNECTION_URL_PROPERTY, tuba_streams_connection_properties[TUBA_STREAMS_CONNECTION_URL_PROPERTY] = g_param_spec_string ("url", "url", "url", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_STREAMS_CONNECTION_NAME_PROPERTY, tuba_streams_connection_properties[TUBA_STREAMS_CONNECTION_NAME_PROPERTY] = g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
tuba_streams_connection_instance_init (TubaStreamsConnection * self,
                                       gpointer klass)
{
	self->priv = tuba_streams_connection_get_instance_private (self);
	self->closing = FALSE;
	self->timeout = 1;
	self->priv->socket_cancellable = NULL;
}

static void
tuba_streams_connection_finalize (GObject * obj)
{
	TubaStreamsConnection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_STREAMS_TYPE_CONNECTION, TubaStreamsConnection);
	_g_object_unref0 (self->subscribers);
	_g_object_unref0 (self->socket);
	_g_free0 (self->priv->_url);
	_g_object_unref0 (self->priv->socket_cancellable);
	G_OBJECT_CLASS (tuba_streams_connection_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_streams_connection_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaStreamsConnectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_streams_connection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaStreamsConnection), 0, (GInstanceInitFunc) tuba_streams_connection_instance_init, NULL };
	GType tuba_streams_connection_type_id;
	tuba_streams_connection_type_id = g_type_register_static (G_TYPE_OBJECT, "TubaStreamsConnection", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaStreamsConnection_private_offset = g_type_add_instance_private (tuba_streams_connection_type_id, sizeof (TubaStreamsConnectionPrivate));
	return tuba_streams_connection_type_id;
}

GType
tuba_streams_connection_get_type (void)
{
	static GType tuba_streams_connection_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_streams_connection_type_id__once)) {
		GType tuba_streams_connection_type_id;
		tuba_streams_connection_type_id = tuba_streams_connection_get_type_once ();
		g_once_init_leave_pointer (&tuba_streams_connection_type_id__once, tuba_streams_connection_type_id);
	}
	return tuba_streams_connection_type_id__once;
}

static void
_vala_tuba_streams_connection_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec)
{
	TubaStreamsConnection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_STREAMS_TYPE_CONNECTION, TubaStreamsConnection);
	switch (property_id) {
		case TUBA_STREAMS_CONNECTION_URL_PROPERTY:
		g_value_set_string (value, tuba_streams_connection_get_url (self));
		break;
		case TUBA_STREAMS_CONNECTION_NAME_PROPERTY:
		g_value_take_string (value, tuba_streams_connection_get_name (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_streams_connection_set_property (GObject * object,
                                            guint property_id,
                                            const GValue * value,
                                            GParamSpec * pspec)
{
	TubaStreamsConnection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_STREAMS_TYPE_CONNECTION, TubaStreamsConnection);
	switch (property_id) {
		case TUBA_STREAMS_CONNECTION_URL_PROPERTY:
		tuba_streams_connection_set_url (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
tuba_streams_class_init (TubaStreamsClass * klass,
                         gpointer klass_data)
{
	tuba_streams_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaStreams_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_streams_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_streams_set_property;
	G_OBJECT_CLASS (klass)->finalize = tuba_streams_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_STREAMS_CONNECTIONS_PROPERTY, tuba_streams_properties[TUBA_STREAMS_CONNECTIONS_PROPERTY] = g_param_spec_boxed ("connections", "connections", "connections", G_TYPE_HASH_TABLE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
tuba_streams_instance_init (TubaStreams * self,
                            gpointer klass)
{
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	self->priv = tuba_streams_get_instance_private (self);
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _g_object_unref0_);
	self->priv->_connections = _tmp2_;
}

static void
tuba_streams_finalize (GObject * obj)
{
	TubaStreams * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_TYPE_STREAMS, TubaStreams);
	_g_hash_table_unref0 (self->priv->_connections);
	G_OBJECT_CLASS (tuba_streams_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_streams_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaStreamsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_streams_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaStreams), 0, (GInstanceInitFunc) tuba_streams_instance_init, NULL };
	GType tuba_streams_type_id;
	tuba_streams_type_id = g_type_register_static (G_TYPE_OBJECT, "TubaStreams", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaStreams_private_offset = g_type_add_instance_private (tuba_streams_type_id, sizeof (TubaStreamsPrivate));
	return tuba_streams_type_id;
}

GType
tuba_streams_get_type (void)
{
	static GType tuba_streams_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_streams_type_id__once)) {
		GType tuba_streams_type_id;
		tuba_streams_type_id = tuba_streams_get_type_once ();
		g_once_init_leave_pointer (&tuba_streams_type_id__once, tuba_streams_type_id);
	}
	return tuba_streams_type_id__once;
}

static void
_vala_tuba_streams_get_property (GObject * object,
                                 guint property_id,
                                 GValue * value,
                                 GParamSpec * pspec)
{
	TubaStreams * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_TYPE_STREAMS, TubaStreams);
	switch (property_id) {
		case TUBA_STREAMS_CONNECTIONS_PROPERTY:
		g_value_set_boxed (value, tuba_streams_get_connections (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_streams_set_property (GObject * object,
                                 guint property_id,
                                 const GValue * value,
                                 GParamSpec * pspec)
{
	TubaStreams * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_TYPE_STREAMS, TubaStreams);
	switch (property_id) {
		case TUBA_STREAMS_CONNECTIONS_PROPERTY:
		tuba_streams_set_connections (self, g_value_get_boxed (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

