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

#include <adwaita.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <gee.h>
#include <json-glib/json-glib.h>
#include <glib/gi18n-lib.h>

#define TUBA_INSTANCE_ACCOUNT_EVENT_CONVERSATION "conversation"
#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_VIEWS_TYPE_BASE (tuba_views_base_get_type ())
#define TUBA_VIEWS_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_VIEWS_TYPE_BASE, TubaViewsBase))
#define TUBA_VIEWS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_VIEWS_TYPE_BASE, TubaViewsBaseClass))
#define TUBA_VIEWS_IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_VIEWS_TYPE_BASE))
#define TUBA_VIEWS_IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_VIEWS_TYPE_BASE))
#define TUBA_VIEWS_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_VIEWS_TYPE_BASE, TubaViewsBaseClass))

typedef struct _TubaViewsBase TubaViewsBase;
typedef struct _TubaViewsBaseClass TubaViewsBaseClass;
typedef struct _TubaViewsBasePrivate TubaViewsBasePrivate;

#define TUBA_VIEWS_TYPE_CONTENT_BASE (tuba_views_content_base_get_type ())
#define TUBA_VIEWS_CONTENT_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_VIEWS_TYPE_CONTENT_BASE, TubaViewsContentBase))
#define TUBA_VIEWS_CONTENT_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_VIEWS_TYPE_CONTENT_BASE, TubaViewsContentBaseClass))
#define TUBA_VIEWS_IS_CONTENT_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_VIEWS_TYPE_CONTENT_BASE))
#define TUBA_VIEWS_IS_CONTENT_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_VIEWS_TYPE_CONTENT_BASE))
#define TUBA_VIEWS_CONTENT_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_VIEWS_TYPE_CONTENT_BASE, TubaViewsContentBaseClass))

typedef struct _TubaViewsContentBase TubaViewsContentBase;
typedef struct _TubaViewsContentBaseClass TubaViewsContentBaseClass;
typedef struct _TubaViewsContentBasePrivate TubaViewsContentBasePrivate;

#define TUBA_TYPE_ACCOUNT_HOLDER (tuba_account_holder_get_type ())
#define TUBA_ACCOUNT_HOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_ACCOUNT_HOLDER, TubaAccountHolder))
#define TUBA_IS_ACCOUNT_HOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_ACCOUNT_HOLDER))
#define TUBA_ACCOUNT_HOLDER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TUBA_TYPE_ACCOUNT_HOLDER, TubaAccountHolderIface))

typedef struct _TubaAccountHolder TubaAccountHolder;
typedef struct _TubaAccountHolderIface TubaAccountHolderIface;

#define TUBA_TYPE_ENTITY (tuba_entity_get_type ())
#define TUBA_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_ENTITY, TubaEntity))
#define TUBA_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_ENTITY, TubaEntityClass))
#define TUBA_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_ENTITY))
#define TUBA_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_ENTITY))
#define TUBA_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_ENTITY, TubaEntityClass))

typedef struct _TubaEntity TubaEntity;
typedef struct _TubaEntityClass TubaEntityClass;

#define TUBA_API_TYPE_ACCOUNT (tuba_api_account_get_type ())
#define TUBA_API_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccount))
#define TUBA_API_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))
#define TUBA_API_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))

typedef struct _TubaAPIAccount TubaAPIAccount;
typedef struct _TubaAPIAccountClass TubaAPIAccountClass;

#define TUBA_TYPE_INSTANCE_ACCOUNT (tuba_instance_account_get_type ())
#define TUBA_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccount))
#define TUBA_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccountClass))
#define TUBA_IS_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_INSTANCE_ACCOUNT))
#define TUBA_IS_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_INSTANCE_ACCOUNT))
#define TUBA_INSTANCE_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccountClass))

typedef struct _TubaInstanceAccount TubaInstanceAccount;
typedef struct _TubaInstanceAccountClass TubaInstanceAccountClass;

#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 TUBA_VIEWS_TYPE_TIMELINE (tuba_views_timeline_get_type ())
#define TUBA_VIEWS_TIMELINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_VIEWS_TYPE_TIMELINE, TubaViewsTimeline))
#define TUBA_VIEWS_TIMELINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_VIEWS_TYPE_TIMELINE, TubaViewsTimelineClass))
#define TUBA_VIEWS_IS_TIMELINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_VIEWS_TYPE_TIMELINE))
#define TUBA_VIEWS_IS_TIMELINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_VIEWS_TYPE_TIMELINE))
#define TUBA_VIEWS_TIMELINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_VIEWS_TYPE_TIMELINE, TubaViewsTimelineClass))

typedef struct _TubaViewsTimeline TubaViewsTimeline;
typedef struct _TubaViewsTimelineClass TubaViewsTimelineClass;
typedef struct _TubaViewsTimelinePrivate TubaViewsTimelinePrivate;

#define TUBA_TYPE_REQUEST_V2 (tuba_request_v2_get_type ())
#define TUBA_REQUEST_V2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_REQUEST_V2, TubaRequestV2))
#define TUBA_REQUEST_V2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_REQUEST_V2, TubaRequestV2Class))
#define TUBA_IS_REQUEST_V2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_REQUEST_V2))
#define TUBA_IS_REQUEST_V2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_REQUEST_V2))
#define TUBA_REQUEST_V2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_REQUEST_V2, TubaRequestV2Class))

typedef struct _TubaRequestV2 TubaRequestV2;
typedef struct _TubaRequestV2Class TubaRequestV2Class;

#define TUBA_STREAMABLE_TYPE_EVENT (tuba_streamable_event_get_type ())
typedef struct _TubaStreamableEvent TubaStreamableEvent;

#define TUBA_VIEWS_TYPE_CONVERSATIONS (tuba_views_conversations_get_type ())
#define TUBA_VIEWS_CONVERSATIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_VIEWS_TYPE_CONVERSATIONS, TubaViewsConversations))
#define TUBA_VIEWS_CONVERSATIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_VIEWS_TYPE_CONVERSATIONS, TubaViewsConversationsClass))
#define TUBA_VIEWS_IS_CONVERSATIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_VIEWS_TYPE_CONVERSATIONS))
#define TUBA_VIEWS_IS_CONVERSATIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_VIEWS_TYPE_CONVERSATIONS))
#define TUBA_VIEWS_CONVERSATIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_VIEWS_TYPE_CONVERSATIONS, TubaViewsConversationsClass))

typedef struct _TubaViewsConversations TubaViewsConversations;
typedef struct _TubaViewsConversationsClass TubaViewsConversationsClass;
typedef struct _TubaViewsConversationsPrivate TubaViewsConversationsPrivate;
enum  {
	TUBA_VIEWS_CONVERSATIONS_0_PROPERTY,
	TUBA_VIEWS_CONVERSATIONS_NUM_PROPERTIES
};
static GParamSpec* tuba_views_conversations_properties[TUBA_VIEWS_CONVERSATIONS_NUM_PROPERTIES];

#define TUBA_API_TYPE_CONVERSATION (tuba_api_conversation_get_type ())
#define TUBA_API_CONVERSATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_CONVERSATION, TubaAPIConversation))
#define TUBA_API_CONVERSATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_CONVERSATION, TubaAPIConversationClass))
#define TUBA_API_IS_CONVERSATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_CONVERSATION))
#define TUBA_API_IS_CONVERSATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_CONVERSATION))
#define TUBA_API_CONVERSATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_CONVERSATION, TubaAPIConversationClass))

typedef struct _TubaAPIConversation TubaAPIConversation;
typedef struct _TubaAPIConversationClass TubaAPIConversationClass;

#define TUBA_API_TYPE_STATUS (tuba_api_status_get_type ())
#define TUBA_API_STATUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_STATUS, TubaAPIStatus))
#define TUBA_API_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_STATUS, TubaAPIStatusClass))
#define TUBA_API_IS_STATUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_STATUS))
#define TUBA_API_IS_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_STATUS))
#define TUBA_API_STATUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_STATUS, TubaAPIStatusClass))

typedef struct _TubaAPIStatus TubaAPIStatus;
typedef struct _TubaAPIStatusClass TubaAPIStatusClass;
#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)))

struct _TubaViewsBase {
	AdwBreakpointBin parent_instance;
	TubaViewsBasePrivate * priv;
	AdwHeaderBar* header;
	AdwToolbarView* toolbar_view;
	GtkScrolledWindow* scrolled;
	GtkOverlay* scrolled_overlay;
	GtkRevealer* scroll_to_top_rev;
	GtkButton* scroll_to_top;
	GtkStack* states;
	AdwClamp* content_box;
	GtkButton* status_button;
};

struct _TubaViewsBaseClass {
	AdwBreakpointBinClass parent_class;
	void (*scroll_page) (TubaViewsBase* self, gboolean up);
	void (*unbind_listboxes) (TubaViewsBase* self);
	void (*build_actions) (TubaViewsBase* self);
	void (*build_header) (TubaViewsBase* self);
	void (*clear) (TubaViewsBase* self);
	void (*on_shown) (TubaViewsBase* self);
	void (*on_hidden) (TubaViewsBase* self);
	void (*on_content_changed) (TubaViewsBase* self);
	void (*on_error) (TubaViewsBase* self, gint32 code, const gchar* reason);
};

struct _TubaViewsContentBase {
	TubaViewsBase parent_instance;
	TubaViewsContentBasePrivate * priv;
	GtkListBox* content;
	GListStore* model;
};

struct _TubaViewsContentBaseClass {
	TubaViewsBaseClass parent_class;
	void (*on_scrolled_vadjustment_value_change) (TubaViewsContentBase* self);
	void (*clear_all_but_first) (TubaViewsContentBase* self, gint i);
	void (*attempt_focus_grab) (TubaViewsContentBase* self);
	GtkWidget* (*on_create_model_widget) (TubaViewsContentBase* self, GObject* obj);
	void (*on_bottom_reached) (TubaViewsContentBase* self);
	void (*on_content_item_activated) (TubaViewsContentBase* self, GtkListBoxRow* row);
	gboolean (*get_empty) (TubaViewsContentBase* self);
};

struct _TubaAccountHolderIface {
	GTypeInterface parent_iface;
	void (*on_account_changed) (TubaAccountHolder* self, TubaInstanceAccount* acc);
	void (*on_accounts_changed) (TubaAccountHolder* self, GeeArrayList* accounts);
	TubaInstanceAccount* (*get_account) (TubaAccountHolder* self);
	void (*set_account) (TubaAccountHolder* self, TubaInstanceAccount* value);
};

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 _TubaViewsTimeline {
	TubaViewsContentBase parent_instance;
	TubaViewsTimelinePrivate * priv;
};

struct _TubaViewsTimelineClass {
	TubaViewsContentBaseClass parent_class;
	gchar* (*get_req_url) (TubaViewsTimeline* self);
	void (*append_params_v2) (TubaViewsTimeline* self, TubaRequestV2* req);
	void (*on_request_finish) (TubaViewsTimeline* self);
	void (*request) (TubaViewsTimeline* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*request_finish) (TubaViewsTimeline* self, GAsyncResult* _res_);
	void (*on_refresh) (TubaViewsTimeline* self);
	void (*on_manual_refresh) (TubaViewsTimeline* self);
	void (*on_account_changed) (TubaViewsTimeline* self, TubaInstanceAccount* acc);
	gchar* (*get_stream_url) (TubaViewsTimeline* self);
	gboolean (*should_hide) (TubaViewsTimeline* self, TubaEntity* entity);
	void (*on_new_post) (TubaViewsTimeline* self, TubaStreamableEvent* ev);
	void (*on_edit_post) (TubaViewsTimeline* self, TubaStreamableEvent* ev);
	void (*on_delete_post) (TubaViewsTimeline* self, TubaStreamableEvent* ev);
	void (*on_remove_user) (TubaViewsTimeline* self, const gchar* user_id);
};

struct _TubaViewsConversations {
	TubaViewsTimeline parent_instance;
	TubaViewsConversationsPrivate * priv;
};

struct _TubaViewsConversationsClass {
	TubaViewsTimelineClass parent_class;
};

static gpointer tuba_views_conversations_parent_class = NULL;

VALA_EXTERN GType tuba_views_base_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaViewsBase, g_object_unref)
VALA_EXTERN GType tuba_views_content_base_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaViewsContentBase, g_object_unref)
VALA_EXTERN GType tuba_entity_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaEntity, g_object_unref)
VALA_EXTERN GType tuba_api_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIAccount, g_object_unref)
VALA_EXTERN GType tuba_instance_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaInstanceAccount, g_object_unref)
VALA_EXTERN GType tuba_account_holder_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAccountHolder, g_object_unref)
VALA_EXTERN GType tuba_streamable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaStreamable, g_object_unref)
VALA_EXTERN GType tuba_views_timeline_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaViewsTimeline, g_object_unref)
VALA_EXTERN GType tuba_request_v2_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaRequestV2, g_object_unref)
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 GType tuba_views_conversations_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaViewsConversations, g_object_unref)
VALA_EXTERN gboolean tuba_views_timeline_should_hide (TubaViewsTimeline* self,
                                          TubaEntity* entity);
VALA_EXTERN gchar* tuba_views_timeline_get_stream_url (TubaViewsTimeline* self);
VALA_EXTERN void tuba_views_base_on_content_changed (TubaViewsBase* self);
VALA_EXTERN void tuba_views_timeline_on_delete_post (TubaViewsTimeline* self,
                                         TubaStreamableEvent* ev);
VALA_EXTERN TubaViewsConversations* tuba_views_conversations_new (void);
VALA_EXTERN TubaViewsConversations* tuba_views_conversations_construct (GType object_type);
static gboolean tuba_views_conversations_real_should_hide (TubaViewsTimeline* base,
                                                    TubaEntity* entity);
VALA_EXTERN GType tuba_api_conversation_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIConversation, g_object_unref)
VALA_EXTERN GType tuba_api_status_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIStatus, g_object_unref)
VALA_EXTERN TubaAPIStatus* tuba_api_conversation_get_last_status (TubaAPIConversation* self);
static gchar* tuba_views_conversations_real_get_stream_url (TubaViewsTimeline* base);
VALA_EXTERN TubaInstanceAccount* tuba_account_holder_get_account (TubaAccountHolder* self);
VALA_EXTERN const gchar* tuba_instance_account_get_tuba_streaming_url (TubaInstanceAccount* self);
VALA_EXTERN const gchar* tuba_instance_account_get_access_token (TubaInstanceAccount* self);
static void tuba_views_conversations_real_on_content_changed (TubaViewsBase* base);
static void tuba_views_conversations_real_on_delete_post (TubaViewsTimeline* base,
                                                   TubaStreamableEvent* ev);
VALA_EXTERN gchar* tuba_streamable_event_get_string (TubaStreamableEvent *self,
                                         GError** error);
VALA_EXTERN const gchar* tuba_api_status_get_id (TubaAPIStatus* self);
VALA_EXTERN void tuba_views_timeline_safely_remove (TubaViewsTimeline* self,
                                        gint i);
static GObject * tuba_views_conversations_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
VALA_EXTERN void tuba_views_timeline_set_accepts (TubaViewsTimeline* self,
                                      GType value);
VALA_EXTERN void tuba_views_timeline_on_new_post (TubaViewsTimeline* self,
                                      TubaStreamableEvent* ev);
static void _tuba_views_timeline_on_new_post_tuba_streamable_stream_event (TubaStreamable* _sender,
                                                                    TubaStreamableEvent* ev,
                                                                    gpointer self);
static GType tuba_views_conversations_get_type_once (void);

TubaViewsConversations*
tuba_views_conversations_construct (GType object_type)
{
	TubaViewsConversations * self = NULL;
	self = (TubaViewsConversations*) g_object_new (object_type, "url", "/api/v1/conversations", "label", _ ("Conversations"), "icon", "tuba-mail-unread-symbolic", "empty-state-title", _ ("No Conversations"), NULL);
	return self;
}

TubaViewsConversations*
tuba_views_conversations_new (void)
{
	return tuba_views_conversations_construct (TUBA_VIEWS_TYPE_CONVERSATIONS);
}

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

static gboolean
tuba_views_conversations_real_should_hide (TubaViewsTimeline* base,
                                           TubaEntity* entity)
{
	TubaViewsConversations * self;
	TubaAPIConversation* conversation_entity = NULL;
	TubaAPIConversation* _tmp0_;
	gboolean _tmp1_ = FALSE;
	TubaAPIConversation* _tmp2_;
	gboolean result;
	self = (TubaViewsConversations*) base;
	g_return_val_if_fail (entity != NULL, FALSE);
	_tmp0_ = _g_object_ref0 (TUBA_API_IS_CONVERSATION (entity) ? ((TubaAPIConversation*) entity) : NULL);
	conversation_entity = _tmp0_;
	_tmp2_ = conversation_entity;
	if (_tmp2_ != NULL) {
		TubaAPIConversation* _tmp3_;
		TubaAPIStatus* _tmp4_;
		TubaAPIStatus* _tmp5_;
		_tmp3_ = conversation_entity;
		_tmp4_ = tuba_api_conversation_get_last_status (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp1_ = _tmp5_ != NULL;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		TubaAPIConversation* _tmp6_;
		TubaAPIStatus* _tmp7_;
		TubaAPIStatus* _tmp8_;
		_tmp6_ = conversation_entity;
		_tmp7_ = tuba_api_conversation_get_last_status (_tmp6_);
		_tmp8_ = _tmp7_;
		result = TUBA_VIEWS_TIMELINE_CLASS (tuba_views_conversations_parent_class)->should_hide (G_TYPE_CHECK_INSTANCE_CAST (self, TUBA_VIEWS_TYPE_TIMELINE, TubaViewsTimeline), (TubaEntity*) _tmp8_);
		_g_object_unref0 (conversation_entity);
		return result;
	}
	result = TRUE;
	_g_object_unref0 (conversation_entity);
	return result;
}

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 gchar*
tuba_views_conversations_real_get_stream_url (TubaViewsTimeline* base)
{
	TubaViewsConversations * self;
	gchar* _tmp0_ = NULL;
	TubaInstanceAccount* _tmp1_;
	TubaInstanceAccount* _tmp2_;
	gchar* _tmp14_;
	gchar* result;
	self = (TubaViewsConversations*) base;
	_tmp1_ = tuba_account_holder_get_account ((TubaAccountHolder*) self);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		TubaInstanceAccount* _tmp3_;
		TubaInstanceAccount* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		TubaInstanceAccount* _tmp8_;
		TubaInstanceAccount* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		_tmp3_ = tuba_account_holder_get_account ((TubaAccountHolder*) self);
		_tmp4_ = _tmp3_;
		_tmp5_ = tuba_instance_account_get_tuba_streaming_url (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = string_to_string (_tmp6_);
		_tmp8_ = tuba_account_holder_get_account ((TubaAccountHolder*) self);
		_tmp9_ = _tmp8_;
		_tmp10_ = tuba_instance_account_get_access_token (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = string_to_string (_tmp11_);
		_tmp13_ = g_strconcat (_tmp7_, "/api/v1/streaming?stream=direct&access_token=", _tmp12_, NULL);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp13_;
	} else {
		_g_free0 (_tmp0_);
		_tmp0_ = NULL;
	}
	_tmp14_ = _tmp0_;
	_tmp0_ = NULL;
	result = _tmp14_;
	_g_free0 (_tmp0_);
	return result;
}

static void
tuba_views_conversations_real_on_content_changed (TubaViewsBase* base)
{
	TubaViewsConversations * self;
	self = (TubaViewsConversations*) base;
	TUBA_VIEWS_BASE_CLASS (tuba_views_conversations_parent_class)->on_content_changed ((TubaViewsBase*) G_TYPE_CHECK_INSTANCE_CAST (self, TUBA_VIEWS_TYPE_TIMELINE, TubaViewsTimeline));
}

static void
tuba_views_conversations_real_on_delete_post (TubaViewsTimeline* base,
                                              TubaStreamableEvent* ev)
{
	TubaViewsConversations * self;
	GError* _inner_error0_ = NULL;
	self = (TubaViewsConversations*) base;
	g_return_if_fail (ev != NULL);
	{
		gchar* convo_id = NULL;
		gchar* _tmp0_;
		_tmp0_ = tuba_streamable_event_get_string (ev, &_inner_error0_);
		convo_id = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		{
			guint i = 0U;
			i = (guint) 0;
			{
				gboolean _tmp1_ = FALSE;
				_tmp1_ = TRUE;
				while (TRUE) {
					GListStore* _tmp3_;
					TubaAPIConversation* convo_obj = NULL;
					GListStore* _tmp4_;
					GObject* _tmp5_;
					gboolean _tmp6_ = FALSE;
					TubaAPIConversation* _tmp7_;
					TubaAPIStatus* _tmp8_;
					TubaAPIStatus* _tmp9_;
					if (!_tmp1_) {
						guint _tmp2_;
						_tmp2_ = i;
						i = _tmp2_ + 1;
					}
					_tmp1_ = FALSE;
					_tmp3_ = ((TubaViewsContentBase*) self)->model;
					if (!(i < g_list_model_get_n_items ((GListModel*) _tmp3_))) {
						break;
					}
					_tmp4_ = ((TubaViewsContentBase*) self)->model;
					_tmp5_ = g_list_model_get_item ((GListModel*) _tmp4_, i);
					convo_obj = G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, TUBA_API_TYPE_CONVERSATION, TubaAPIConversation);
					_tmp7_ = convo_obj;
					_tmp8_ = tuba_api_conversation_get_last_status (_tmp7_);
					_tmp9_ = _tmp8_;
					if (_tmp9_ != NULL) {
						TubaAPIConversation* _tmp10_;
						TubaAPIStatus* _tmp11_;
						TubaAPIStatus* _tmp12_;
						const gchar* _tmp13_;
						const gchar* _tmp14_;
						_tmp10_ = convo_obj;
						_tmp11_ = tuba_api_conversation_get_last_status (_tmp10_);
						_tmp12_ = _tmp11_;
						_tmp13_ = tuba_api_status_get_id (_tmp12_);
						_tmp14_ = _tmp13_;
						_tmp6_ = g_strcmp0 (_tmp14_, convo_id) == 0;
					} else {
						_tmp6_ = FALSE;
					}
					if (_tmp6_) {
						tuba_views_timeline_safely_remove ((TubaViewsTimeline*) self, (gint) i);
						_g_object_unref0 (convo_obj);
						break;
					}
					_g_object_unref0 (convo_obj);
				}
			}
		}
		_g_free0 (convo_id);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp15_;
		const gchar* _tmp16_;
		const gchar* _tmp17_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp15_ = e;
		_tmp16_ = _tmp15_->message;
		_tmp17_ = string_to_string (_tmp16_);
		_tmp18_ = g_strconcat ("Error getting String from json: ", _tmp17_, NULL);
		_tmp19_ = _tmp18_;
		g_warning ("Conversations.vala:50: %s", _tmp19_);
		_g_free0 (_tmp19_);
		_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;
	}
}

static void
_tuba_views_timeline_on_new_post_tuba_streamable_stream_event (TubaStreamable* _sender,
                                                               TubaStreamableEvent* ev,
                                                               gpointer self)
{
	tuba_views_timeline_on_new_post ((TubaViewsTimeline*) self, ev);
}

static GObject *
tuba_views_conversations_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TubaViewsConversations * self;
	gchar* _tmp0_;
	parent_class = G_OBJECT_CLASS (tuba_views_conversations_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_VIEWS_TYPE_CONVERSATIONS, TubaViewsConversations);
	tuba_views_timeline_set_accepts ((TubaViewsTimeline*) self, TUBA_API_TYPE_CONVERSATION);
	_tmp0_ = g_strconcat ("stream-event::", TUBA_INSTANCE_ACCOUNT_EVENT_CONVERSATION, NULL);
	g_signal_connect_object ((TubaStreamable*) self, _tmp0_, (GCallback) _tuba_views_timeline_on_new_post_tuba_streamable_stream_event, (TubaViewsTimeline*) self, 0);
	_g_free0 (_tmp0_);
	return obj;
}

static void
tuba_views_conversations_class_init (TubaViewsConversationsClass * klass,
                                     gpointer klass_data)
{
	tuba_views_conversations_parent_class = g_type_class_peek_parent (klass);
	((TubaViewsTimelineClass *) klass)->should_hide = (gboolean (*) (TubaViewsTimeline*, TubaEntity*)) tuba_views_conversations_real_should_hide;
	((TubaViewsTimelineClass *) klass)->get_stream_url = (gchar* (*) (TubaViewsTimeline*)) tuba_views_conversations_real_get_stream_url;
	((TubaViewsBaseClass *) klass)->on_content_changed = (void (*) (TubaViewsBase*)) tuba_views_conversations_real_on_content_changed;
	((TubaViewsTimelineClass *) klass)->on_delete_post = (void (*) (TubaViewsTimeline*, TubaStreamableEvent*)) tuba_views_conversations_real_on_delete_post;
	G_OBJECT_CLASS (klass)->constructor = tuba_views_conversations_constructor;
}

static void
tuba_views_conversations_instance_init (TubaViewsConversations * self,
                                        gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
tuba_views_conversations_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaViewsConversationsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_views_conversations_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaViewsConversations), 0, (GInstanceInitFunc) tuba_views_conversations_instance_init, NULL };
	GType tuba_views_conversations_type_id;
	tuba_views_conversations_type_id = g_type_register_static (TUBA_VIEWS_TYPE_TIMELINE, "TubaViewsConversations", &g_define_type_info, G_TYPE_FLAG_NONE);
	return tuba_views_conversations_type_id;
}

GType
tuba_views_conversations_get_type (void)
{
	static GType tuba_views_conversations_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_views_conversations_type_id__once)) {
		GType tuba_views_conversations_type_id;
		tuba_views_conversations_type_id = tuba_views_conversations_get_type_once ();
		g_once_init_leave_pointer (&tuba_views_conversations_type_id__once, tuba_views_conversations_type_id);
	}
	return tuba_views_conversations_type_id__once;
}

