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

#include <glib-object.h>
#include "libdino.h"
#include <adwaita.h>
#include <glib.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <gee.h>
#include "xmpp-vala.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 DINO_UI_TYPE_MAIN_WINDOW_CONTROLLER (dino_ui_main_window_controller_get_type ())
#define DINO_UI_MAIN_WINDOW_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_MAIN_WINDOW_CONTROLLER, DinoUiMainWindowController))
#define DINO_UI_MAIN_WINDOW_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_MAIN_WINDOW_CONTROLLER, DinoUiMainWindowControllerClass))
#define DINO_UI_IS_MAIN_WINDOW_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_MAIN_WINDOW_CONTROLLER))
#define DINO_UI_IS_MAIN_WINDOW_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_MAIN_WINDOW_CONTROLLER))
#define DINO_UI_MAIN_WINDOW_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_MAIN_WINDOW_CONTROLLER, DinoUiMainWindowControllerClass))

typedef struct _DinoUiMainWindowController DinoUiMainWindowController;
typedef struct _DinoUiMainWindowControllerClass DinoUiMainWindowControllerClass;
typedef struct _DinoUiMainWindowControllerPrivate DinoUiMainWindowControllerPrivate;

#define DINO_UI_TYPE_APPLICATION (dino_ui_application_get_type ())
#define DINO_UI_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_APPLICATION, DinoUiApplication))
#define DINO_UI_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_APPLICATION, DinoUiApplicationClass))
#define DINO_UI_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_APPLICATION))
#define DINO_UI_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_APPLICATION))
#define DINO_UI_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_APPLICATION, DinoUiApplicationClass))

typedef struct _DinoUiApplication DinoUiApplication;
typedef struct _DinoUiApplicationClass DinoUiApplicationClass;

#define DINO_UI_TYPE_MAIN_WINDOW (dino_ui_main_window_get_type ())
#define DINO_UI_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_MAIN_WINDOW, DinoUiMainWindow))
#define DINO_UI_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_MAIN_WINDOW, DinoUiMainWindowClass))
#define DINO_UI_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_MAIN_WINDOW))
#define DINO_UI_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_MAIN_WINDOW))
#define DINO_UI_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_MAIN_WINDOW, DinoUiMainWindowClass))

typedef struct _DinoUiMainWindow DinoUiMainWindow;
typedef struct _DinoUiMainWindowClass DinoUiMainWindowClass;

#define DINO_UI_TYPE_CONVERSATION_VIEW_CONTROLLER (dino_ui_conversation_view_controller_get_type ())
#define DINO_UI_CONVERSATION_VIEW_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_CONVERSATION_VIEW_CONTROLLER, DinoUiConversationViewController))
#define DINO_UI_CONVERSATION_VIEW_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_CONVERSATION_VIEW_CONTROLLER, DinoUiConversationViewControllerClass))
#define DINO_UI_IS_CONVERSATION_VIEW_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_CONVERSATION_VIEW_CONTROLLER))
#define DINO_UI_IS_CONVERSATION_VIEW_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_CONVERSATION_VIEW_CONTROLLER))
#define DINO_UI_CONVERSATION_VIEW_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_CONVERSATION_VIEW_CONTROLLER, DinoUiConversationViewControllerClass))

typedef struct _DinoUiConversationViewController DinoUiConversationViewController;
typedef struct _DinoUiConversationViewControllerClass DinoUiConversationViewControllerClass;
enum  {
	DINO_UI_MAIN_WINDOW_CONTROLLER_0_PROPERTY,
	DINO_UI_MAIN_WINDOW_CONTROLLER_NUM_PROPERTIES
};
static GParamSpec* dino_ui_main_window_controller_properties[DINO_UI_MAIN_WINDOW_CONTROLLER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _qlite_database_unref0(var) ((var == NULL) ? NULL : (var = (qlite_database_unref (var), NULL)))
typedef struct _Block61Data Block61Data;
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _DinoUiMainWindowPrivate DinoUiMainWindowPrivate;

#define DINO_UI_TYPE_MAIN_WINDOW_PLACEHOLDER (dino_ui_main_window_placeholder_get_type ())
#define DINO_UI_MAIN_WINDOW_PLACEHOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_MAIN_WINDOW_PLACEHOLDER, DinoUiMainWindowPlaceholder))
#define DINO_UI_MAIN_WINDOW_PLACEHOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_MAIN_WINDOW_PLACEHOLDER, DinoUiMainWindowPlaceholderClass))
#define DINO_UI_IS_MAIN_WINDOW_PLACEHOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_MAIN_WINDOW_PLACEHOLDER))
#define DINO_UI_IS_MAIN_WINDOW_PLACEHOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_MAIN_WINDOW_PLACEHOLDER))
#define DINO_UI_MAIN_WINDOW_PLACEHOLDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_MAIN_WINDOW_PLACEHOLDER, DinoUiMainWindowPlaceholderClass))

typedef struct _DinoUiMainWindowPlaceholder DinoUiMainWindowPlaceholder;
typedef struct _DinoUiMainWindowPlaceholderClass DinoUiMainWindowPlaceholderClass;

#define DINO_UI_TYPE_WELCOME_PLACEHOLDER (dino_ui_welcome_placeholder_get_type ())
#define DINO_UI_WELCOME_PLACEHOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_WELCOME_PLACEHOLDER, DinoUiWelcomePlaceholder))
#define DINO_UI_WELCOME_PLACEHOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_WELCOME_PLACEHOLDER, DinoUiWelcomePlaceholderClass))
#define DINO_UI_IS_WELCOME_PLACEHOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_WELCOME_PLACEHOLDER))
#define DINO_UI_IS_WELCOME_PLACEHOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_WELCOME_PLACEHOLDER))
#define DINO_UI_WELCOME_PLACEHOLDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_WELCOME_PLACEHOLDER, DinoUiWelcomePlaceholderClass))

typedef struct _DinoUiWelcomePlaceholder DinoUiWelcomePlaceholder;
typedef struct _DinoUiWelcomePlaceholderClass DinoUiWelcomePlaceholderClass;

#define DINO_UI_TYPE_NO_ACCOUNTS_PLACEHOLDER (dino_ui_no_accounts_placeholder_get_type ())
#define DINO_UI_NO_ACCOUNTS_PLACEHOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_NO_ACCOUNTS_PLACEHOLDER, DinoUiNoAccountsPlaceholder))
#define DINO_UI_NO_ACCOUNTS_PLACEHOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_NO_ACCOUNTS_PLACEHOLDER, DinoUiNoAccountsPlaceholderClass))
#define DINO_UI_IS_NO_ACCOUNTS_PLACEHOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_NO_ACCOUNTS_PLACEHOLDER))
#define DINO_UI_IS_NO_ACCOUNTS_PLACEHOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_NO_ACCOUNTS_PLACEHOLDER))
#define DINO_UI_NO_ACCOUNTS_PLACEHOLDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_NO_ACCOUNTS_PLACEHOLDER, DinoUiNoAccountsPlaceholderClass))

typedef struct _DinoUiNoAccountsPlaceholder DinoUiNoAccountsPlaceholder;
typedef struct _DinoUiNoAccountsPlaceholderClass DinoUiNoAccountsPlaceholderClass;

#define DINO_UI_TYPE_CONVERSATION_VIEW (dino_ui_conversation_view_get_type ())
#define DINO_UI_CONVERSATION_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_CONVERSATION_VIEW, DinoUiConversationView))
#define DINO_UI_CONVERSATION_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_CONVERSATION_VIEW, DinoUiConversationViewClass))
#define DINO_UI_IS_CONVERSATION_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_CONVERSATION_VIEW))
#define DINO_UI_IS_CONVERSATION_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_CONVERSATION_VIEW))
#define DINO_UI_CONVERSATION_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_CONVERSATION_VIEW, DinoUiConversationViewClass))

typedef struct _DinoUiConversationView DinoUiConversationView;
typedef struct _DinoUiConversationViewClass DinoUiConversationViewClass;

#define DINO_UI_TYPE_CONVERSATION_SELECTOR (dino_ui_conversation_selector_get_type ())
#define DINO_UI_CONVERSATION_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_CONVERSATION_SELECTOR, DinoUiConversationSelector))
#define DINO_UI_CONVERSATION_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_CONVERSATION_SELECTOR, DinoUiConversationSelectorClass))
#define DINO_UI_IS_CONVERSATION_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_CONVERSATION_SELECTOR))
#define DINO_UI_IS_CONVERSATION_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_CONVERSATION_SELECTOR))
#define DINO_UI_CONVERSATION_SELECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_CONVERSATION_SELECTOR, DinoUiConversationSelectorClass))

typedef struct _DinoUiConversationSelector DinoUiConversationSelector;
typedef struct _DinoUiConversationSelectorClass DinoUiConversationSelectorClass;

#define DINO_UI_TYPE_CONVERSATION_TITLEBAR (dino_ui_conversation_titlebar_get_type ())
#define DINO_UI_CONVERSATION_TITLEBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_CONVERSATION_TITLEBAR, DinoUiConversationTitlebar))
#define DINO_UI_CONVERSATION_TITLEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_CONVERSATION_TITLEBAR, DinoUiConversationTitlebarClass))
#define DINO_UI_IS_CONVERSATION_TITLEBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_CONVERSATION_TITLEBAR))
#define DINO_UI_IS_CONVERSATION_TITLEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_CONVERSATION_TITLEBAR))
#define DINO_UI_CONVERSATION_TITLEBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_CONVERSATION_TITLEBAR, DinoUiConversationTitlebarClass))

typedef struct _DinoUiConversationTitlebar DinoUiConversationTitlebar;
typedef struct _DinoUiConversationTitlebarClass DinoUiConversationTitlebarClass;

#define DINO_UI_TYPE_GLOBAL_SEARCH (dino_ui_global_search_get_type ())
#define DINO_UI_GLOBAL_SEARCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_GLOBAL_SEARCH, DinoUiGlobalSearch))
#define DINO_UI_GLOBAL_SEARCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_GLOBAL_SEARCH, DinoUiGlobalSearchClass))
#define DINO_UI_IS_GLOBAL_SEARCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_GLOBAL_SEARCH))
#define DINO_UI_IS_GLOBAL_SEARCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_GLOBAL_SEARCH))
#define DINO_UI_GLOBAL_SEARCH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_GLOBAL_SEARCH, DinoUiGlobalSearchClass))

typedef struct _DinoUiGlobalSearch DinoUiGlobalSearch;
typedef struct _DinoUiGlobalSearchClass DinoUiGlobalSearchClass;
typedef struct _DinoUiConversationViewPrivate DinoUiConversationViewPrivate;

#define DINO_UI_CHAT_INPUT_TYPE_VIEW (dino_ui_chat_input_view_get_type ())
#define DINO_UI_CHAT_INPUT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_CHAT_INPUT_TYPE_VIEW, DinoUiChatInputView))
#define DINO_UI_CHAT_INPUT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_CHAT_INPUT_TYPE_VIEW, DinoUiChatInputViewClass))
#define DINO_UI_CHAT_INPUT_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_CHAT_INPUT_TYPE_VIEW))
#define DINO_UI_CHAT_INPUT_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_CHAT_INPUT_TYPE_VIEW))
#define DINO_UI_CHAT_INPUT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_CHAT_INPUT_TYPE_VIEW, DinoUiChatInputViewClass))

typedef struct _DinoUiChatInputView DinoUiChatInputView;
typedef struct _DinoUiChatInputViewClass DinoUiChatInputViewClass;

#define DINO_UI_CONVERSATION_SUMMARY_TYPE_CONVERSATION_VIEW (dino_ui_conversation_summary_conversation_view_get_type ())
#define DINO_UI_CONVERSATION_SUMMARY_CONVERSATION_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_CONVERSATION_SUMMARY_TYPE_CONVERSATION_VIEW, DinoUiConversationSummaryConversationView))
#define DINO_UI_CONVERSATION_SUMMARY_CONVERSATION_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_CONVERSATION_SUMMARY_TYPE_CONVERSATION_VIEW, DinoUiConversationSummaryConversationViewClass))
#define DINO_UI_CONVERSATION_SUMMARY_IS_CONVERSATION_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_CONVERSATION_SUMMARY_TYPE_CONVERSATION_VIEW))
#define DINO_UI_CONVERSATION_SUMMARY_IS_CONVERSATION_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_CONVERSATION_SUMMARY_TYPE_CONVERSATION_VIEW))
#define DINO_UI_CONVERSATION_SUMMARY_CONVERSATION_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_CONVERSATION_SUMMARY_TYPE_CONVERSATION_VIEW, DinoUiConversationSummaryConversationViewClass))

typedef struct _DinoUiConversationSummaryConversationView DinoUiConversationSummaryConversationView;
typedef struct _DinoUiConversationSummaryConversationViewClass DinoUiConversationSummaryConversationViewClass;
typedef struct _Block62Data Block62Data;
typedef struct _DinoUiConversationViewControllerPrivate DinoUiConversationViewControllerPrivate;

#define DINO_UI_TYPE_SEARCH_MENU_ENTRY (dino_ui_search_menu_entry_get_type ())
#define DINO_UI_SEARCH_MENU_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_SEARCH_MENU_ENTRY, DinoUiSearchMenuEntry))
#define DINO_UI_SEARCH_MENU_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_SEARCH_MENU_ENTRY, DinoUiSearchMenuEntryClass))
#define DINO_UI_IS_SEARCH_MENU_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_SEARCH_MENU_ENTRY))
#define DINO_UI_IS_SEARCH_MENU_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_SEARCH_MENU_ENTRY))
#define DINO_UI_SEARCH_MENU_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_SEARCH_MENU_ENTRY, DinoUiSearchMenuEntryClass))

typedef struct _DinoUiSearchMenuEntry DinoUiSearchMenuEntry;
typedef struct _DinoUiSearchMenuEntryClass DinoUiSearchMenuEntryClass;
typedef struct _DinoUiSearchMenuEntryPrivate DinoUiSearchMenuEntryPrivate;
typedef struct _DinoUiGlobalSearchPrivate DinoUiGlobalSearchPrivate;
typedef struct _DinoUiMainWindowPlaceholderPrivate DinoUiMainWindowPlaceholderPrivate;

#define DINO_UI_MANAGE_ACCOUNTS_TYPE_ADD_ACCOUNT_DIALOG (dino_ui_manage_accounts_add_account_dialog_get_type ())
#define DINO_UI_MANAGE_ACCOUNTS_ADD_ACCOUNT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_MANAGE_ACCOUNTS_TYPE_ADD_ACCOUNT_DIALOG, DinoUiManageAccountsAddAccountDialog))
#define DINO_UI_MANAGE_ACCOUNTS_ADD_ACCOUNT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_MANAGE_ACCOUNTS_TYPE_ADD_ACCOUNT_DIALOG, DinoUiManageAccountsAddAccountDialogClass))
#define DINO_UI_MANAGE_ACCOUNTS_IS_ADD_ACCOUNT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_MANAGE_ACCOUNTS_TYPE_ADD_ACCOUNT_DIALOG))
#define DINO_UI_MANAGE_ACCOUNTS_IS_ADD_ACCOUNT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_MANAGE_ACCOUNTS_TYPE_ADD_ACCOUNT_DIALOG))
#define DINO_UI_MANAGE_ACCOUNTS_ADD_ACCOUNT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_MANAGE_ACCOUNTS_TYPE_ADD_ACCOUNT_DIALOG, DinoUiManageAccountsAddAccountDialogClass))

typedef struct _DinoUiManageAccountsAddAccountDialog DinoUiManageAccountsAddAccountDialog;
typedef struct _DinoUiManageAccountsAddAccountDialogClass DinoUiManageAccountsAddAccountDialogClass;
typedef enum  {
	DINO_UI_MAIN_WINDOW_STACK_STATE_CLEAN_START,
	DINO_UI_MAIN_WINDOW_STACK_STATE_NO_ACTIVE_ACCOUNTS,
	DINO_UI_MAIN_WINDOW_STACK_STATE_NO_ACTIVE_CONVERSATIONS,
	DINO_UI_MAIN_WINDOW_STACK_STATE_CONVERSATION
} DinoUiMainWindowStackState;

#define DINO_UI_MAIN_WINDOW_TYPE_STACK_STATE (dino_ui_main_window_stack_state_get_type ())
#define _g_free0(var) (var = (g_free (var), NULL))

struct _DinoUiMainWindowController {
	GObject parent_instance;
	DinoUiMainWindowControllerPrivate * priv;
};

struct _DinoUiMainWindowControllerClass {
	GObjectClass parent_class;
};

struct _DinoUiMainWindowControllerPrivate {
	DinoStreamInteractor* stream_interactor;
	DinoEntitiesConversation* conversation;
	DinoUiApplication* app;
	DinoDatabase* db;
	DinoUiMainWindow* window;
	DinoUiConversationViewController* conversation_view_controller;
};

struct _Block61Data {
	int _ref_count_;
	DinoUiMainWindowController* self;
	DinoStreamInteractor* stream_interactor;
};

struct _DinoUiMainWindow {
	AdwApplicationWindow parent_instance;
	DinoUiMainWindowPrivate * priv;
	DinoUiWelcomePlaceholder* welcome_placeholder;
	DinoUiNoAccountsPlaceholder* accounts_placeholder;
	DinoUiConversationView* conversation_view;
	DinoUiConversationSelector* conversation_selector;
	DinoUiConversationTitlebar* conversation_titlebar;
	GtkWidget* conversation_list_titlebar;
	GtkBox* box;
	GtkBox* left_box;
	GtkBox* right_box;
	AdwFlap* search_flap;
	DinoUiGlobalSearch* global_search;
};

struct _DinoUiMainWindowClass {
	AdwApplicationWindowClass parent_class;
};

struct _DinoUiConversationView {
	GtkWidget parent_instance;
	DinoUiConversationViewPrivate * priv;
	GtkOverlay* overlay;
	GtkRevealer* goto_end_revealer;
	GtkButton* goto_end_button;
	DinoUiChatInputView* chat_input;
	DinoUiConversationSummaryConversationView* conversation_frame;
	GtkRevealer* white_revealer;
	GtkRevealer* content_revealer;
	GtkListView* list_view;
	gboolean at_current_content;
};

struct _DinoUiConversationViewClass {
	GtkWidgetClass parent_class;
};

struct _Block62Data {
	int _ref_count_;
	DinoUiMainWindowController* self;
	DinoUiMainWindow* window;
};

struct _DinoUiConversationViewController {
	GObject parent_instance;
	DinoUiConversationViewControllerPrivate * priv;
	DinoUiSearchMenuEntry* search_menu_entry;
	GtkListView* list_view;
};

struct _DinoUiConversationViewControllerClass {
	GObjectClass parent_class;
};

struct _DinoUiSearchMenuEntry {
	GObject parent_instance;
	DinoUiSearchMenuEntryPrivate * priv;
	GtkToggleButton* button;
};

struct _DinoUiSearchMenuEntryClass {
	GObjectClass parent_class;
};

struct _DinoUiGlobalSearch {
	GTypeInstance parent_instance;
	volatile int ref_count;
	DinoUiGlobalSearchPrivate * priv;
	GtkOverlay* overlay;
	GtkSearchEntry* search_entry;
	GtkLabel* entry_number_label;
	GtkScrolledWindow* results_scrolled;
	GtkBox* results_box;
	GtkStack* results_empty_stack;
	GtkFrame* auto_complete_overlay;
	GtkListBox* auto_complete_list;
};

struct _DinoUiGlobalSearchClass {
	GTypeClass parent_class;
	void (*finalize) (DinoUiGlobalSearch *self);
};

struct _DinoUiMainWindowPlaceholder {
	GtkBox parent_instance;
	DinoUiMainWindowPlaceholderPrivate * priv;
	AdwStatusPage* status_page;
	GtkButton* primary_button;
	GtkButton* secondary_button;
};

struct _DinoUiMainWindowPlaceholderClass {
	GtkBoxClass parent_class;
};

static gint DinoUiMainWindowController_private_offset;
static gpointer dino_ui_main_window_controller_parent_class = NULL;

VALA_EXTERN GType dino_ui_main_window_controller_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiMainWindowController, g_object_unref)
VALA_EXTERN GType dino_ui_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiApplication, g_object_unref)
VALA_EXTERN GType dino_ui_main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiMainWindow, g_object_unref)
VALA_EXTERN GType dino_ui_conversation_view_controller_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiConversationViewController, g_object_unref)
VALA_EXTERN DinoUiMainWindowController* dino_ui_main_window_controller_new (DinoUiApplication* application,
                                                                DinoStreamInteractor* stream_interactor,
                                                                DinoDatabase* db);
VALA_EXTERN DinoUiMainWindowController* dino_ui_main_window_controller_construct (GType object_type,
                                                                      DinoUiApplication* application,
                                                                      DinoStreamInteractor* stream_interactor,
                                                                      DinoDatabase* db);
static Block61Data* block61_data_ref (Block61Data* _data61_);
static void block61_data_unref (void * _userdata_);
static void dino_ui_main_window_controller_check_unset_conversation (DinoUiMainWindowController* self);
static void _dino_ui_main_window_controller_check_unset_conversation_dino_conversation_manager_conversation_deactivated (DinoConversationManager* _sender,
                                                                                                                  DinoEntitiesConversation* conversation,
                                                                                                                  gpointer self);
static void _dino_ui_main_window_controller_check_unset_conversation_dino_stream_interactor_account_removed (DinoStreamInteractor* _sender,
                                                                                                      DinoEntitiesAccount* account,
                                                                                                      gpointer self);
static void __lambda230_ (Block61Data* _data61_,
                   GVariant* variant);
VALA_EXTERN void dino_ui_main_window_controller_select_conversation (DinoUiMainWindowController* self,
                                                         DinoEntitiesConversation* conversation,
                                                         gboolean do_reset_search,
                                                         gboolean default_initialize_conversation);
VALA_EXTERN GType dino_ui_main_window_placeholder_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiMainWindowPlaceholder, g_object_unref)
VALA_EXTERN GType dino_ui_welcome_placeholder_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiWelcomePlaceholder, g_object_unref)
VALA_EXTERN GType dino_ui_no_accounts_placeholder_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiNoAccountsPlaceholder, g_object_unref)
VALA_EXTERN GType dino_ui_conversation_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiConversationView, g_object_unref)
VALA_EXTERN GType dino_ui_conversation_selector_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiConversationSelector, g_object_unref)
VALA_EXTERN GType dino_ui_conversation_titlebar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiConversationTitlebar, g_object_unref)
VALA_EXTERN gpointer dino_ui_global_search_ref (gpointer instance);
VALA_EXTERN void dino_ui_global_search_unref (gpointer instance);
VALA_EXTERN GParamSpec* dino_ui_param_spec_global_search (const gchar* name,
                                              const gchar* nick,
                                              const gchar* blurb,
                                              GType object_type,
                                              GParamFlags flags);
VALA_EXTERN void dino_ui_value_set_global_search (GValue* value,
                                      gpointer v_object);
VALA_EXTERN void dino_ui_value_take_global_search (GValue* value,
                                       gpointer v_object);
VALA_EXTERN gpointer dino_ui_value_get_global_search (const GValue* value);
VALA_EXTERN GType dino_ui_global_search_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiGlobalSearch, dino_ui_global_search_unref)
VALA_EXTERN GType dino_ui_chat_input_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiChatInputView, g_object_unref)
VALA_EXTERN GType dino_ui_conversation_summary_conversation_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiConversationSummaryConversationView, g_object_unref)
VALA_EXTERN void dino_ui_conversation_summary_conversation_view_initialize_around_message (DinoUiConversationSummaryConversationView* self,
                                                                               DinoEntitiesConversation* conversation,
                                                                               DinoContentItem* content_item);
static void ___lambda230__g_simple_action_activate (GSimpleAction* _sender,
                                             GVariant* parameter,
                                             gpointer self);
VALA_EXTERN void dino_ui_main_window_controller_set_window (DinoUiMainWindowController* self,
                                                DinoUiMainWindow* window);
static Block62Data* block62_data_ref (Block62Data* _data62_);
static void block62_data_unref (void * _userdata_);
VALA_EXTERN DinoUiConversationViewController* dino_ui_conversation_view_controller_new (DinoUiConversationView* view,
                                                                            DinoUiConversationTitlebar* titlebar,
                                                                            DinoStreamInteractor* stream_interactor);
VALA_EXTERN DinoUiConversationViewController* dino_ui_conversation_view_controller_construct (GType object_type,
                                                                                  DinoUiConversationView* view,
                                                                                  DinoUiConversationTitlebar* titlebar,
                                                                                  DinoStreamInteractor* stream_interactor);
VALA_EXTERN GType dino_ui_search_menu_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiSearchMenuEntry, g_object_unref)
static void __lambda231_ (Block62Data* _data62_);
VALA_EXTERN DinoEntitiesConversation* dino_ui_conversation_summary_conversation_view_get_conversation (DinoUiConversationSummaryConversationView* self);
static void dino_ui_main_window_controller_reset_search_entry (DinoUiMainWindowController* self);
static void ___lambda231__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda232_ (Block62Data* _data62_,
                   DinoMessageItem* item);
static void dino_ui_main_window_controller_close_search (DinoUiMainWindowController* self);
static void ___lambda232__dino_ui_global_search_selected_item (DinoUiGlobalSearch* _sender,
                                                        DinoMessageItem* item,
                                                        gpointer self);
static void __lambda233_ (DinoUiMainWindowController* self);
VALA_EXTERN GType dino_ui_manage_accounts_add_account_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiManageAccountsAddAccountDialog, g_object_unref)
VALA_EXTERN DinoUiManageAccountsAddAccountDialog* dino_ui_manage_accounts_add_account_dialog_new (DinoStreamInteractor* stream_interactor,
                                                                                      DinoDatabase* db);
VALA_EXTERN DinoUiManageAccountsAddAccountDialog* dino_ui_manage_accounts_add_account_dialog_construct (GType object_type,
                                                                                            DinoStreamInteractor* stream_interactor,
                                                                                            DinoDatabase* db);
static void ___lambda233__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda241_ (DinoUiMainWindowController* self);
static void ___lambda241__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda242_ (DinoUiMainWindowController* self,
                   DinoEntitiesConversation* conversation);
static void ___lambda242__dino_ui_conversation_selector_conversation_selected (DinoUiConversationSelector* _sender,
                                                                        DinoEntitiesConversation* conversation,
                                                                        gpointer self);
static void __lambda243_ (DinoUiMainWindowController* self,
                   guint keyval);
static void ___lambda243__gtk_event_controller_key_key_released (GtkEventControllerKey* _sender,
                                                          guint keyval,
                                                          guint keycode,
                                                          GdkModifierType state,
                                                          gpointer self);
static void __lambda244_ (DinoUiMainWindowController* self);
static void ___lambda244__gtk_event_controller_focus_enter (GtkEventControllerFocus* _sender,
                                                     gpointer self);
static void __lambda245_ (DinoUiMainWindowController* self);
static void ___lambda245__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                     gpointer self);
static void __lambda246_ (DinoUiMainWindowController* self,
                   DinoEntitiesConversation* conversation);
static void ___lambda246__dino_ui_main_window_conversation_selected (DinoUiMainWindow* _sender,
                                                              DinoEntitiesConversation* conversation,
                                                              gpointer self);
static void __lambda247_ (DinoUiMainWindowController* self,
                   DinoEntitiesAccount* account);
static void dino_ui_main_window_controller_update_stack_state (DinoUiMainWindowController* self,
                                                        gboolean know_exists);
static void ___lambda247__dino_stream_interactor_account_added (DinoStreamInteractor* _sender,
                                                         DinoEntitiesAccount* account,
                                                         gpointer self);
static void __lambda248_ (DinoUiMainWindowController* self,
                   DinoEntitiesAccount* account);
static void ___lambda248__dino_stream_interactor_account_removed (DinoStreamInteractor* _sender,
                                                           DinoEntitiesAccount* account,
                                                           gpointer self);
static void __lambda249_ (DinoUiMainWindowController* self);
static void ___lambda249__dino_conversation_manager_conversation_activated (DinoConversationManager* _sender,
                                                                     DinoEntitiesConversation* conversation,
                                                                     gpointer self);
static void __lambda250_ (DinoUiMainWindowController* self);
static void ___lambda250__dino_conversation_manager_conversation_deactivated (DinoConversationManager* _sender,
                                                                       DinoEntitiesConversation* conversation,
                                                                       gpointer self);
VALA_EXTERN void dino_ui_conversation_view_controller_select_conversation (DinoUiConversationViewController* self,
                                                               DinoEntitiesConversation* conversation,
                                                               gboolean default_initialize_conversation);
VALA_EXTERN void dino_ui_conversation_selector_on_conversation_selected (DinoUiConversationSelector* self,
                                                             DinoEntitiesConversation* conversation);
static void dino_ui_main_window_controller_unset_conversation (DinoUiMainWindowController* self);
VALA_EXTERN void dino_ui_conversation_view_controller_unset_conversation (DinoUiConversationViewController* self);
VALA_EXTERN GType dino_ui_main_window_stack_state_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void dino_ui_main_window_set_stack_state (DinoUiMainWindow* self,
                                          DinoUiMainWindowStackState stack_state);
static void dino_ui_main_window_controller_finalize (GObject * obj);
static GType dino_ui_main_window_controller_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dino_ui_main_window_controller_get_instance_private (DinoUiMainWindowController* self)
{
	return G_STRUCT_MEMBER_P (self, DinoUiMainWindowController_private_offset);
}

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

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_)) {
		DinoUiMainWindowController* self;
		self = _data61_->self;
		_g_object_unref0 (_data61_->stream_interactor);
		_g_object_unref0 (self);
		g_slice_free (Block61Data, _data61_);
	}
}

static gpointer
_qlite_database_ref0 (gpointer self)
{
	return self ? qlite_database_ref (self) : NULL;
}

static void
_dino_ui_main_window_controller_check_unset_conversation_dino_conversation_manager_conversation_deactivated (DinoConversationManager* _sender,
                                                                                                             DinoEntitiesConversation* conversation,
                                                                                                             gpointer self)
{
	dino_ui_main_window_controller_check_unset_conversation ((DinoUiMainWindowController*) self);
}

static void
_dino_ui_main_window_controller_check_unset_conversation_dino_stream_interactor_account_removed (DinoStreamInteractor* _sender,
                                                                                                 DinoEntitiesAccount* account,
                                                                                                 gpointer self)
{
	dino_ui_main_window_controller_check_unset_conversation ((DinoUiMainWindowController*) self);
}

static gpointer
_g_variant_type_copy0 (gpointer self)
{
	return self ? g_variant_type_copy (self) : NULL;
}

static void
__lambda230_ (Block61Data* _data61_,
              GVariant* variant)
{
	DinoUiMainWindowController* self;
	gint conversation_id = 0;
	GVariant* _tmp0_;
	GVariant* _tmp1_;
	gint _tmp2_;
	DinoEntitiesConversation* conversation = NULL;
	DinoModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	DinoConversationManager* _tmp5_;
	DinoEntitiesConversation* _tmp6_;
	DinoEntitiesConversation* _tmp7_;
	gboolean _tmp8_ = FALSE;
	DinoEntitiesConversation* _tmp9_;
	gint item_id = 0;
	GVariant* _tmp12_;
	GVariant* _tmp13_;
	gint _tmp14_;
	DinoContentItem* content_item = NULL;
	DinoModuleIdentity* _tmp15_;
	gpointer _tmp16_;
	DinoContentItemStore* _tmp17_;
	DinoEntitiesConversation* _tmp18_;
	DinoContentItem* _tmp19_;
	DinoContentItem* _tmp20_;
	DinoEntitiesConversation* _tmp21_;
	DinoUiMainWindow* _tmp22_;
	DinoUiConversationView* _tmp23_;
	DinoUiConversationSummaryConversationView* _tmp24_;
	DinoEntitiesConversation* _tmp25_;
	DinoContentItem* _tmp26_;
	self = _data61_->self;
	_tmp0_ = g_variant_get_child_value (variant, (gsize) 0);
	_tmp1_ = _tmp0_;
	_tmp2_ = (gint) g_variant_get_int32 (_tmp1_);
	_g_variant_unref0 (_tmp1_);
	conversation_id = _tmp2_;
	_tmp3_ = dino_conversation_manager_IDENTITY;
	_tmp4_ = dino_stream_interactor_get_module (_data61_->stream_interactor, DINO_TYPE_CONVERSATION_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp3_);
	_tmp5_ = (DinoConversationManager*) _tmp4_;
	_tmp6_ = dino_conversation_manager_get_conversation_by_id (_tmp5_, conversation_id);
	_tmp7_ = _tmp6_;
	_g_object_unref0 (_tmp5_);
	conversation = _tmp7_;
	_tmp9_ = conversation;
	if (_tmp9_ == NULL) {
		_tmp8_ = TRUE;
	} else {
		DinoEntitiesConversation* _tmp10_;
		DinoEntitiesConversation* _tmp11_;
		_tmp10_ = self->priv->conversation;
		_tmp11_ = conversation;
		_tmp8_ = !dino_entities_conversation_equals (_tmp10_, _tmp11_);
	}
	if (_tmp8_) {
		_g_object_unref0 (conversation);
		return;
	}
	_tmp12_ = g_variant_get_child_value (variant, (gsize) 1);
	_tmp13_ = _tmp12_;
	_tmp14_ = (gint) g_variant_get_int32 (_tmp13_);
	_g_variant_unref0 (_tmp13_);
	item_id = _tmp14_;
	_tmp15_ = dino_content_item_store_IDENTITY;
	_tmp16_ = dino_stream_interactor_get_module (_data61_->stream_interactor, DINO_TYPE_CONTENT_ITEM_STORE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp15_);
	_tmp17_ = (DinoContentItemStore*) _tmp16_;
	_tmp18_ = conversation;
	_tmp19_ = dino_content_item_store_get_item_by_id (_tmp17_, _tmp18_, item_id);
	_tmp20_ = _tmp19_;
	_g_object_unref0 (_tmp17_);
	content_item = _tmp20_;
	_tmp21_ = conversation;
	dino_ui_main_window_controller_select_conversation (self, _tmp21_, FALSE, FALSE);
	_tmp22_ = self->priv->window;
	_tmp23_ = _tmp22_->conversation_view;
	_tmp24_ = _tmp23_->conversation_frame;
	_tmp25_ = conversation;
	_tmp26_ = content_item;
	dino_ui_conversation_summary_conversation_view_initialize_around_message (_tmp24_, _tmp25_, _tmp26_);
	_g_object_unref0 (content_item);
	_g_object_unref0 (conversation);
}

static void
___lambda230__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda230_ (self, parameter);
}

DinoUiMainWindowController*
dino_ui_main_window_controller_construct (GType object_type,
                                          DinoUiApplication* application,
                                          DinoStreamInteractor* stream_interactor,
                                          DinoDatabase* db)
{
	DinoUiMainWindowController * self = NULL;
	Block61Data* _data61_;
	DinoStreamInteractor* _tmp0_;
	DinoUiApplication* _tmp1_;
	DinoStreamInteractor* _tmp2_;
	DinoDatabase* _tmp3_;
	DinoModuleIdentity* _tmp4_;
	gpointer _tmp5_;
	DinoConversationManager* _tmp6_;
	GSimpleAction* jump_to_conversatio_message_action = NULL;
	const GVariantType* _tmp7_;
	GVariantType* _tmp8_;
	const GVariantType* _tmp9_;
	GVariantType* _tmp10_;
	GVariantType** _tmp11_;
	GVariantType** _tmp12_;
	gint _tmp12__length1;
	GVariantType* _tmp13_;
	GVariantType* _tmp14_;
	GSimpleAction* _tmp15_;
	GSimpleAction* _tmp16_;
	DinoUiApplication* _tmp17_;
	g_return_val_if_fail (application != NULL, NULL);
	g_return_val_if_fail (stream_interactor != NULL, NULL);
	g_return_val_if_fail (db != NULL, NULL);
	_data61_ = g_slice_new0 (Block61Data);
	_data61_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (stream_interactor);
	_g_object_unref0 (_data61_->stream_interactor);
	_data61_->stream_interactor = _tmp0_;
	self = (DinoUiMainWindowController*) g_object_new (object_type, NULL);
	_data61_->self = g_object_ref (self);
	_tmp1_ = _g_object_ref0 (application);
	_g_object_unref0 (self->priv->app);
	self->priv->app = _tmp1_;
	_tmp2_ = _g_object_ref0 (_data61_->stream_interactor);
	_g_object_unref0 (self->priv->stream_interactor);
	self->priv->stream_interactor = _tmp2_;
	_tmp3_ = _qlite_database_ref0 (db);
	_qlite_database_unref0 (self->priv->db);
	self->priv->db = _tmp3_;
	_tmp4_ = dino_conversation_manager_IDENTITY;
	_tmp5_ = dino_stream_interactor_get_module (_data61_->stream_interactor, DINO_TYPE_CONVERSATION_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp4_);
	_tmp6_ = (DinoConversationManager*) _tmp5_;
	g_signal_connect_object (_tmp6_, "conversation-deactivated", (GCallback) _dino_ui_main_window_controller_check_unset_conversation_dino_conversation_manager_conversation_deactivated, self, 0);
	_g_object_unref0 (_tmp6_);
	g_signal_connect_object (_data61_->stream_interactor, "account-removed", (GCallback) _dino_ui_main_window_controller_check_unset_conversation_dino_stream_interactor_account_removed, self, 0);
	_tmp7_ = G_VARIANT_TYPE_INT32;
	_tmp8_ = _g_variant_type_copy0 (_tmp7_);
	_tmp9_ = G_VARIANT_TYPE_INT32;
	_tmp10_ = _g_variant_type_copy0 (_tmp9_);
	_tmp11_ = g_new0 (GVariantType*, 2 + 1);
	_tmp11_[0] = _tmp8_;
	_tmp11_[1] = _tmp10_;
	_tmp12_ = _tmp11_;
	_tmp12__length1 = 2;
	_tmp13_ = g_variant_type_new_tuple (_tmp12_, 2);
	_tmp14_ = _tmp13_;
	_tmp15_ = g_simple_action_new ("jump-to-conversation-message", _tmp14_);
	_tmp16_ = _tmp15_;
	_g_variant_type_free0 (_tmp14_);
	_tmp12_ = (_vala_array_free (_tmp12_, _tmp12__length1, (GDestroyNotify) g_variant_type_free), NULL);
	jump_to_conversatio_message_action = _tmp16_;
	g_signal_connect_data (jump_to_conversatio_message_action, "activate", (GCallback) ___lambda230__g_simple_action_activate, block61_data_ref (_data61_), (GClosureNotify) block61_data_unref, 0);
	_tmp17_ = self->priv->app;
	g_action_map_add_action ((GActionMap*) _tmp17_, (GAction*) jump_to_conversatio_message_action);
	_g_object_unref0 (jump_to_conversatio_message_action);
	block61_data_unref (_data61_);
	_data61_ = NULL;
	return self;
}

DinoUiMainWindowController*
dino_ui_main_window_controller_new (DinoUiApplication* application,
                                    DinoStreamInteractor* stream_interactor,
                                    DinoDatabase* db)
{
	return dino_ui_main_window_controller_construct (DINO_UI_TYPE_MAIN_WINDOW_CONTROLLER, application, stream_interactor, db);
}

static Block62Data*
block62_data_ref (Block62Data* _data62_)
{
	g_atomic_int_inc (&_data62_->_ref_count_);
	return _data62_;
}

static void
block62_data_unref (void * _userdata_)
{
	Block62Data* _data62_;
	_data62_ = (Block62Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data62_->_ref_count_)) {
		DinoUiMainWindowController* self;
		self = _data62_->self;
		_g_object_unref0 (_data62_->window);
		_g_object_unref0 (self);
		g_slice_free (Block62Data, _data62_);
	}
}

static void
__lambda231_ (Block62Data* _data62_)
{
	DinoUiMainWindowController* self;
	AdwFlap* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data62_->self;
	_tmp0_ = _data62_->window->search_flap;
	_tmp1_ = adw_flap_get_reveal_flap (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		gboolean _tmp3_ = FALSE;
		DinoUiConversationView* _tmp4_;
		DinoUiConversationSummaryConversationView* _tmp5_;
		DinoEntitiesConversation* _tmp6_;
		DinoEntitiesConversation* _tmp7_;
		DinoUiGlobalSearch* _tmp12_;
		GtkSearchEntry* _tmp13_;
		DinoUiGlobalSearch* _tmp14_;
		GtkSearchEntry* _tmp15_;
		DinoUiGlobalSearch* _tmp16_;
		GtkSearchEntry* _tmp17_;
		const gchar* _tmp18_;
		const gchar* _tmp19_;
		gint _tmp20_;
		gint _tmp21_;
		_tmp4_ = _data62_->window->conversation_view;
		_tmp5_ = _tmp4_->conversation_frame;
		_tmp6_ = dino_ui_conversation_summary_conversation_view_get_conversation (_tmp5_);
		_tmp7_ = _tmp6_;
		if (_tmp7_ != NULL) {
			DinoUiGlobalSearch* _tmp8_;
			GtkSearchEntry* _tmp9_;
			const gchar* _tmp10_;
			const gchar* _tmp11_;
			_tmp8_ = _data62_->window->global_search;
			_tmp9_ = _tmp8_->search_entry;
			_tmp10_ = gtk_editable_get_text ((GtkEditable*) _tmp9_);
			_tmp11_ = _tmp10_;
			_tmp3_ = g_strcmp0 (_tmp11_, "") == 0;
		} else {
			_tmp3_ = FALSE;
		}
		if (_tmp3_) {
			dino_ui_main_window_controller_reset_search_entry (self);
		}
		_tmp12_ = _data62_->window->global_search;
		_tmp13_ = _tmp12_->search_entry;
		gtk_widget_grab_focus ((GtkWidget*) _tmp13_);
		_tmp14_ = _data62_->window->global_search;
		_tmp15_ = _tmp14_->search_entry;
		_tmp16_ = _data62_->window->global_search;
		_tmp17_ = _tmp16_->search_entry;
		_tmp18_ = gtk_editable_get_text ((GtkEditable*) _tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = strlen (_tmp19_);
		_tmp21_ = _tmp20_;
		gtk_editable_set_position ((GtkEditable*) _tmp15_, (gint) _tmp21_);
	}
}

static void
___lambda231__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda231_ (self);
}

static void
__lambda232_ (Block62Data* _data62_,
              DinoMessageItem* item)
{
	DinoUiMainWindowController* self;
	DinoEntitiesConversation* _tmp0_;
	DinoUiConversationView* _tmp1_;
	DinoUiConversationSummaryConversationView* _tmp2_;
	DinoEntitiesConversation* _tmp3_;
	AdwFlap* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	self = _data62_->self;
	g_return_if_fail (item != NULL);
	_tmp0_ = item->conversation;
	dino_ui_main_window_controller_select_conversation (self, _tmp0_, FALSE, FALSE);
	_tmp1_ = _data62_->window->conversation_view;
	_tmp2_ = _tmp1_->conversation_frame;
	_tmp3_ = item->conversation;
	dino_ui_conversation_summary_conversation_view_initialize_around_message (_tmp2_, _tmp3_, (DinoContentItem*) item);
	_tmp4_ = _data62_->window->search_flap;
	_tmp5_ = adw_flap_get_folded (_tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_) {
		dino_ui_main_window_controller_close_search (self);
	}
}

static void
___lambda232__dino_ui_global_search_selected_item (DinoUiGlobalSearch* _sender,
                                                   DinoMessageItem* item,
                                                   gpointer self)
{
	__lambda232_ (self, item);
}

static void
__lambda233_ (DinoUiMainWindowController* self)
{
	DinoUiManageAccountsAddAccountDialog* dialog = NULL;
	DinoStreamInteractor* _tmp0_;
	DinoDatabase* _tmp1_;
	DinoUiManageAccountsAddAccountDialog* _tmp2_;
	DinoUiApplication* _tmp3_;
	GtkWindow* _tmp4_;
	_tmp0_ = self->priv->stream_interactor;
	_tmp1_ = self->priv->db;
	_tmp2_ = dino_ui_manage_accounts_add_account_dialog_new (_tmp0_, _tmp1_);
	g_object_ref_sink (_tmp2_);
	dialog = _tmp2_;
	_tmp3_ = self->priv->app;
	_tmp4_ = gtk_application_get_active_window ((GtkApplication*) _tmp3_);
	gtk_window_set_transient_for ((GtkWindow*) dialog, _tmp4_);
	gtk_window_present ((GtkWindow*) dialog);
	_g_object_unref0 (dialog);
}

static void
___lambda233__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda233_ ((DinoUiMainWindowController*) self);
}

static void
__lambda241_ (DinoUiMainWindowController* self)
{
	DinoUiApplication* _tmp0_;
	_tmp0_ = self->priv->app;
	g_action_group_activate_action ((GActionGroup*) _tmp0_, "preferences", NULL);
}

static void
___lambda241__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda241_ ((DinoUiMainWindowController*) self);
}

static void
__lambda242_ (DinoUiMainWindowController* self,
              DinoEntitiesConversation* conversation)
{
	g_return_if_fail (conversation != NULL);
	dino_ui_main_window_controller_select_conversation (self, conversation, TRUE, TRUE);
}

static void
___lambda242__dino_ui_conversation_selector_conversation_selected (DinoUiConversationSelector* _sender,
                                                                   DinoEntitiesConversation* conversation,
                                                                   gpointer self)
{
	__lambda242_ ((DinoUiMainWindowController*) self, conversation);
}

static void
__lambda243_ (DinoUiMainWindowController* self,
              guint keyval)
{
	if (keyval == GDK_KEY_Escape) {
		dino_ui_main_window_controller_close_search (self);
	}
}

static void
___lambda243__gtk_event_controller_key_key_released (GtkEventControllerKey* _sender,
                                                     guint keyval,
                                                     guint keycode,
                                                     GdkModifierType state,
                                                     gpointer self)
{
	__lambda243_ ((DinoUiMainWindowController*) self, keyval);
}

static void
__lambda244_ (DinoUiMainWindowController* self)
{
	DinoStreamInteractor* _tmp0_;
	DinoModuleIdentity* _tmp1_;
	gpointer _tmp2_;
	DinoChatInteraction* _tmp3_;
	DinoEntitiesConversation* _tmp4_;
	_tmp0_ = self->priv->stream_interactor;
	_tmp1_ = dino_chat_interaction_IDENTITY;
	_tmp2_ = dino_stream_interactor_get_module (_tmp0_, DINO_TYPE_CHAT_INTERACTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp1_);
	_tmp3_ = (DinoChatInteraction*) _tmp2_;
	_tmp4_ = self->priv->conversation;
	dino_chat_interaction_on_window_focus_in (_tmp3_, _tmp4_);
	_g_object_unref0 (_tmp3_);
}

static void
___lambda244__gtk_event_controller_focus_enter (GtkEventControllerFocus* _sender,
                                                gpointer self)
{
	__lambda244_ ((DinoUiMainWindowController*) self);
}

static void
__lambda245_ (DinoUiMainWindowController* self)
{
	DinoStreamInteractor* _tmp0_;
	DinoModuleIdentity* _tmp1_;
	gpointer _tmp2_;
	DinoChatInteraction* _tmp3_;
	DinoEntitiesConversation* _tmp4_;
	_tmp0_ = self->priv->stream_interactor;
	_tmp1_ = dino_chat_interaction_IDENTITY;
	_tmp2_ = dino_stream_interactor_get_module (_tmp0_, DINO_TYPE_CHAT_INTERACTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp1_);
	_tmp3_ = (DinoChatInteraction*) _tmp2_;
	_tmp4_ = self->priv->conversation;
	dino_chat_interaction_on_window_focus_out (_tmp3_, _tmp4_);
	_g_object_unref0 (_tmp3_);
}

static void
___lambda245__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                gpointer self)
{
	__lambda245_ ((DinoUiMainWindowController*) self);
}

static void
__lambda246_ (DinoUiMainWindowController* self,
              DinoEntitiesConversation* conversation)
{
	g_return_if_fail (conversation != NULL);
	dino_ui_main_window_controller_select_conversation (self, conversation, TRUE, TRUE);
}

static void
___lambda246__dino_ui_main_window_conversation_selected (DinoUiMainWindow* _sender,
                                                         DinoEntitiesConversation* conversation,
                                                         gpointer self)
{
	__lambda246_ ((DinoUiMainWindowController*) self, conversation);
}

static void
__lambda247_ (DinoUiMainWindowController* self,
              DinoEntitiesAccount* account)
{
	g_return_if_fail (account != NULL);
	dino_ui_main_window_controller_update_stack_state (self, TRUE);
}

static void
___lambda247__dino_stream_interactor_account_added (DinoStreamInteractor* _sender,
                                                    DinoEntitiesAccount* account,
                                                    gpointer self)
{
	__lambda247_ ((DinoUiMainWindowController*) self, account);
}

static void
__lambda248_ (DinoUiMainWindowController* self,
              DinoEntitiesAccount* account)
{
	g_return_if_fail (account != NULL);
	dino_ui_main_window_controller_update_stack_state (self, FALSE);
}

static void
___lambda248__dino_stream_interactor_account_removed (DinoStreamInteractor* _sender,
                                                      DinoEntitiesAccount* account,
                                                      gpointer self)
{
	__lambda248_ ((DinoUiMainWindowController*) self, account);
}

static void
__lambda249_ (DinoUiMainWindowController* self)
{
	dino_ui_main_window_controller_update_stack_state (self, FALSE);
}

static void
___lambda249__dino_conversation_manager_conversation_activated (DinoConversationManager* _sender,
                                                                DinoEntitiesConversation* conversation,
                                                                gpointer self)
{
	__lambda249_ ((DinoUiMainWindowController*) self);
}

static void
__lambda250_ (DinoUiMainWindowController* self)
{
	dino_ui_main_window_controller_update_stack_state (self, FALSE);
}

static void
___lambda250__dino_conversation_manager_conversation_deactivated (DinoConversationManager* _sender,
                                                                  DinoEntitiesConversation* conversation,
                                                                  gpointer self)
{
	__lambda250_ ((DinoUiMainWindowController*) self);
}

void
dino_ui_main_window_controller_set_window (DinoUiMainWindowController* self,
                                           DinoUiMainWindow* window)
{
	Block62Data* _data62_;
	DinoUiMainWindow* _tmp0_;
	DinoUiMainWindow* _tmp1_;
	DinoUiConversationView* _tmp2_;
	DinoUiConversationTitlebar* _tmp3_;
	DinoStreamInteractor* _tmp4_;
	DinoUiConversationViewController* _tmp5_;
	DinoUiConversationViewController* _tmp6_;
	DinoUiSearchMenuEntry* _tmp7_;
	GtkToggleButton* _tmp8_;
	AdwFlap* _tmp9_;
	AdwFlap* _tmp10_;
	DinoUiGlobalSearch* _tmp11_;
	DinoUiWelcomePlaceholder* _tmp12_;
	GtkButton* _tmp13_;
	DinoUiNoAccountsPlaceholder* _tmp14_;
	GtkButton* _tmp15_;
	DinoUiConversationSelector* _tmp16_;
	GtkWidget* window_widget = NULL;
	GtkWidget* _tmp17_;
	GtkEventControllerKey* key_event_controller = NULL;
	GtkEventControllerKey* _tmp18_;
	GtkEventController* _tmp19_;
	GtkEventControllerFocus* focus_event_controller = NULL;
	GtkEventControllerFocus* _tmp20_;
	GtkEventController* _tmp21_;
	DinoStreamInteractor* _tmp22_;
	DinoStreamInteractor* _tmp23_;
	DinoStreamInteractor* _tmp24_;
	DinoModuleIdentity* _tmp25_;
	gpointer _tmp26_;
	DinoConversationManager* _tmp27_;
	DinoStreamInteractor* _tmp28_;
	DinoModuleIdentity* _tmp29_;
	gpointer _tmp30_;
	DinoConversationManager* _tmp31_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (window != NULL);
	_data62_ = g_slice_new0 (Block62Data);
	_data62_->_ref_count_ = 1;
	_data62_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (window);
	_g_object_unref0 (_data62_->window);
	_data62_->window = _tmp0_;
	_tmp1_ = _g_object_ref0 (_data62_->window);
	_g_object_unref0 (self->priv->window);
	self->priv->window = _tmp1_;
	_tmp2_ = _data62_->window->conversation_view;
	_tmp3_ = _data62_->window->conversation_titlebar;
	_tmp4_ = self->priv->stream_interactor;
	_tmp5_ = dino_ui_conversation_view_controller_new (_tmp2_, _tmp3_, _tmp4_);
	_g_object_unref0 (self->priv->conversation_view_controller);
	self->priv->conversation_view_controller = _tmp5_;
	_tmp6_ = self->priv->conversation_view_controller;
	_tmp7_ = _tmp6_->search_menu_entry;
	_tmp8_ = _tmp7_->button;
	_tmp9_ = _data62_->window->search_flap;
	g_object_bind_property_with_closures ((GObject*) _tmp8_, "active", (GObject*) _tmp9_, "reveal-flap", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp10_ = _data62_->window->search_flap;
	g_signal_connect_data ((GObject*) _tmp10_, "notify::reveal-flap", (GCallback) ___lambda231__g_object_notify, block62_data_ref (_data62_), (GClosureNotify) block62_data_unref, 0);
	_tmp11_ = _data62_->window->global_search;
	g_signal_connect_data (_tmp11_, "selected-item", (GCallback) ___lambda232__dino_ui_global_search_selected_item, block62_data_ref (_data62_), (GClosureNotify) block62_data_unref, 0);
	_tmp12_ = _data62_->window->welcome_placeholder;
	_tmp13_ = ((DinoUiMainWindowPlaceholder*) _tmp12_)->primary_button;
	g_signal_connect_object (_tmp13_, "clicked", (GCallback) ___lambda233__gtk_button_clicked, self, 0);
	_tmp14_ = _data62_->window->accounts_placeholder;
	_tmp15_ = ((DinoUiMainWindowPlaceholder*) _tmp14_)->primary_button;
	g_signal_connect_object (_tmp15_, "clicked", (GCallback) ___lambda241__gtk_button_clicked, self, 0);
	_tmp16_ = _data62_->window->conversation_selector;
	g_signal_connect_object (_tmp16_, "conversation-selected", (GCallback) ___lambda242__dino_ui_conversation_selector_conversation_selected, self, 0);
	_tmp17_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_data62_->window, gtk_widget_get_type (), GtkWidget));
	window_widget = _tmp17_;
	_tmp18_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	key_event_controller = _tmp18_;
	_tmp19_ = _g_object_ref0 ((GtkEventController*) key_event_controller);
	gtk_widget_add_controller (window_widget, _tmp19_);
	g_signal_connect_object (key_event_controller, "key-released", (GCallback) ___lambda243__gtk_event_controller_key_key_released, self, 0);
	_tmp20_ = (GtkEventControllerFocus*) gtk_event_controller_focus_new ();
	focus_event_controller = _tmp20_;
	_tmp21_ = _g_object_ref0 ((GtkEventController*) focus_event_controller);
	gtk_widget_add_controller (window_widget, _tmp21_);
	g_signal_connect_object (focus_event_controller, "enter", (GCallback) ___lambda244__gtk_event_controller_focus_enter, self, 0);
	g_signal_connect_object (focus_event_controller, "leave", (GCallback) ___lambda245__gtk_event_controller_focus_leave, self, 0);
	g_signal_connect_object (_data62_->window, "conversation-selected", (GCallback) ___lambda246__dino_ui_main_window_conversation_selected, self, 0);
	_tmp22_ = self->priv->stream_interactor;
	g_signal_connect_object (_tmp22_, "account-added", (GCallback) ___lambda247__dino_stream_interactor_account_added, self, 0);
	_tmp23_ = self->priv->stream_interactor;
	g_signal_connect_object (_tmp23_, "account-removed", (GCallback) ___lambda248__dino_stream_interactor_account_removed, self, 0);
	_tmp24_ = self->priv->stream_interactor;
	_tmp25_ = dino_conversation_manager_IDENTITY;
	_tmp26_ = dino_stream_interactor_get_module (_tmp24_, DINO_TYPE_CONVERSATION_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp25_);
	_tmp27_ = (DinoConversationManager*) _tmp26_;
	g_signal_connect_object (_tmp27_, "conversation-activated", (GCallback) ___lambda249__dino_conversation_manager_conversation_activated, self, 0);
	_g_object_unref0 (_tmp27_);
	_tmp28_ = self->priv->stream_interactor;
	_tmp29_ = dino_conversation_manager_IDENTITY;
	_tmp30_ = dino_stream_interactor_get_module (_tmp28_, DINO_TYPE_CONVERSATION_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp29_);
	_tmp31_ = (DinoConversationManager*) _tmp30_;
	g_signal_connect_object (_tmp31_, "conversation-deactivated", (GCallback) ___lambda250__dino_conversation_manager_conversation_deactivated, self, 0);
	_g_object_unref0 (_tmp31_);
	dino_ui_main_window_controller_update_stack_state (self, FALSE);
	_g_object_unref0 (focus_event_controller);
	_g_object_unref0 (key_event_controller);
	_g_object_unref0 (window_widget);
	block62_data_unref (_data62_);
	_data62_ = NULL;
}

void
dino_ui_main_window_controller_select_conversation (DinoUiMainWindowController* self,
                                                    DinoEntitiesConversation* conversation,
                                                    gboolean do_reset_search,
                                                    gboolean default_initialize_conversation)
{
	DinoEntitiesConversation* _tmp0_;
	DinoUiConversationViewController* _tmp1_;
	DinoStreamInteractor* _tmp2_;
	DinoModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	DinoChatInteraction* _tmp5_;
	DinoUiMainWindow* _tmp6_;
	DinoUiConversationSelector* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (conversation);
	_g_object_unref0 (self->priv->conversation);
	self->priv->conversation = _tmp0_;
	_tmp1_ = self->priv->conversation_view_controller;
	dino_ui_conversation_view_controller_select_conversation (_tmp1_, conversation, default_initialize_conversation);
	_tmp2_ = self->priv->stream_interactor;
	_tmp3_ = dino_chat_interaction_IDENTITY;
	_tmp4_ = dino_stream_interactor_get_module (_tmp2_, DINO_TYPE_CHAT_INTERACTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp3_);
	_tmp5_ = (DinoChatInteraction*) _tmp4_;
	dino_chat_interaction_on_conversation_selected (_tmp5_, conversation);
	_g_object_unref0 (_tmp5_);
	dino_entities_conversation_set_active (conversation, TRUE);
	_tmp6_ = self->priv->window;
	_tmp7_ = _tmp6_->conversation_selector;
	dino_ui_conversation_selector_on_conversation_selected (_tmp7_, conversation);
	if (do_reset_search) {
		dino_ui_main_window_controller_reset_search_entry (self);
	}
}

static void
dino_ui_main_window_controller_check_unset_conversation (DinoUiMainWindowController* self)
{
	DinoStreamInteractor* _tmp0_;
	DinoModuleIdentity* _tmp1_;
	gpointer _tmp2_;
	DinoConversationManager* _tmp3_;
	GeeList* _tmp4_;
	GeeList* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	gboolean _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->stream_interactor;
	_tmp1_ = dino_conversation_manager_IDENTITY;
	_tmp2_ = dino_stream_interactor_get_module (_tmp0_, DINO_TYPE_CONVERSATION_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp1_);
	_tmp3_ = (DinoConversationManager*) _tmp2_;
	_tmp4_ = dino_conversation_manager_get_active_conversations (_tmp3_, NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = gee_collection_get_size ((GeeCollection*) _tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_ == 0;
	_g_object_unref0 (_tmp5_);
	_g_object_unref0 (_tmp3_);
	if (_tmp8_) {
		dino_ui_main_window_controller_unset_conversation (self);
	}
}

static void
dino_ui_main_window_controller_unset_conversation (DinoUiMainWindowController* self)
{
	DinoUiConversationViewController* _tmp0_;
	g_return_if_fail (self != NULL);
	_g_object_unref0 (self->priv->conversation);
	self->priv->conversation = NULL;
	_tmp0_ = self->priv->conversation_view_controller;
	dino_ui_conversation_view_controller_unset_conversation (_tmp0_);
	{
		GeeIterator* _e_it = NULL;
		DinoUiApplication* _tmp1_;
		DinoPluginsRegistry* _tmp2_;
		DinoPluginsRegistry* _tmp3_;
		GeeCollection* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp1_ = self->priv->app;
		_tmp2_ = dino_application_get_plugin_registry ((DinoApplication*) _tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = _tmp3_->conversation_titlebar_entries;
		_tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_);
		_e_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			DinoPluginsConversationTitlebarEntry* e = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			DinoPluginsConversationTitlebarEntry* _tmp9_;
			_tmp6_ = _e_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _e_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			e = (DinoPluginsConversationTitlebarEntry*) _tmp8_;
			_tmp9_ = e;
			dino_plugins_conversation_titlebar_entry_unset_conversation (_tmp9_);
			_g_object_unref0 (e);
		}
		_g_object_unref0 (_e_it);
	}
}

static void
dino_ui_main_window_controller_update_stack_state (DinoUiMainWindowController* self,
                                                   gboolean know_exists)
{
	GeeArrayList* accounts = NULL;
	DinoStreamInteractor* _tmp0_;
	GeeArrayList* _tmp1_;
	gboolean _tmp2_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->stream_interactor;
	_tmp1_ = dino_stream_interactor_get_accounts (_tmp0_);
	accounts = _tmp1_;
	if (!know_exists) {
		GeeArrayList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		_tmp3_ = accounts;
		_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_tmp2_ = _tmp5_ == 0;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		DinoDatabase* _tmp6_;
		GeeArrayList* _tmp7_;
		GeeArrayList* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		gboolean _tmp11_;
		_tmp6_ = self->priv->db;
		_tmp7_ = dino_database_get_accounts (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = _tmp10_ == 0;
		_g_object_unref0 (_tmp8_);
		if (_tmp11_) {
			DinoUiMainWindow* _tmp12_;
			_tmp12_ = self->priv->window;
			dino_ui_main_window_set_stack_state (_tmp12_, DINO_UI_MAIN_WINDOW_STACK_STATE_CLEAN_START);
		} else {
			DinoUiMainWindow* _tmp13_;
			_tmp13_ = self->priv->window;
			dino_ui_main_window_set_stack_state (_tmp13_, DINO_UI_MAIN_WINDOW_STACK_STATE_NO_ACTIVE_ACCOUNTS);
		}
	} else {
		DinoStreamInteractor* _tmp14_;
		DinoModuleIdentity* _tmp15_;
		gpointer _tmp16_;
		DinoConversationManager* _tmp17_;
		GeeList* _tmp18_;
		GeeList* _tmp19_;
		gint _tmp20_;
		gint _tmp21_;
		gboolean _tmp22_;
		_tmp14_ = self->priv->stream_interactor;
		_tmp15_ = dino_conversation_manager_IDENTITY;
		_tmp16_ = dino_stream_interactor_get_module (_tmp14_, DINO_TYPE_CONVERSATION_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp15_);
		_tmp17_ = (DinoConversationManager*) _tmp16_;
		_tmp18_ = dino_conversation_manager_get_active_conversations (_tmp17_, NULL);
		_tmp19_ = _tmp18_;
		_tmp20_ = gee_collection_get_size ((GeeCollection*) _tmp19_);
		_tmp21_ = _tmp20_;
		_tmp22_ = _tmp21_ == 0;
		_g_object_unref0 (_tmp19_);
		_g_object_unref0 (_tmp17_);
		if (_tmp22_) {
			DinoUiMainWindow* _tmp23_;
			_tmp23_ = self->priv->window;
			dino_ui_main_window_set_stack_state (_tmp23_, DINO_UI_MAIN_WINDOW_STACK_STATE_NO_ACTIVE_CONVERSATIONS);
		} else {
			DinoUiMainWindow* _tmp24_;
			_tmp24_ = self->priv->window;
			dino_ui_main_window_set_stack_state (_tmp24_, DINO_UI_MAIN_WINDOW_STACK_STATE_CONVERSATION);
		}
	}
	_g_object_unref0 (accounts);
}

static void
dino_ui_main_window_controller_reset_search_entry (DinoUiMainWindowController* self)
{
	DinoUiMainWindow* _tmp0_;
	DinoUiConversationView* _tmp1_;
	DinoUiConversationSummaryConversationView* _tmp2_;
	DinoEntitiesConversation* _tmp3_;
	DinoEntitiesConversation* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->window;
	_tmp1_ = _tmp0_->conversation_view;
	_tmp2_ = _tmp1_->conversation_frame;
	_tmp3_ = dino_ui_conversation_summary_conversation_view_get_conversation (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_ != NULL) {
		DinoEntitiesConversation* _tmp5_;
		DinoEntitiesConversationType _tmp6_;
		DinoEntitiesConversationType _tmp7_;
		_tmp5_ = self->priv->conversation;
		_tmp6_ = dino_entities_conversation_get_type_ (_tmp5_);
		_tmp7_ = _tmp6_;
		switch (_tmp7_) {
			case DINO_ENTITIES_CONVERSATION_TYPE_CHAT:
			case DINO_ENTITIES_CONVERSATION_TYPE_GROUPCHAT_PM:
			{
				DinoUiMainWindow* _tmp8_;
				DinoUiGlobalSearch* _tmp9_;
				GtkSearchEntry* _tmp10_;
				DinoEntitiesConversation* _tmp11_;
				XmppJid* _tmp12_;
				XmppJid* _tmp13_;
				gchar* _tmp14_;
				gchar* _tmp15_;
				gchar* _tmp16_;
				gchar* _tmp17_;
				_tmp8_ = self->priv->window;
				_tmp9_ = _tmp8_->global_search;
				_tmp10_ = _tmp9_->search_entry;
				_tmp11_ = self->priv->conversation;
				_tmp12_ = dino_entities_conversation_get_counterpart (_tmp11_);
				_tmp13_ = _tmp12_;
				_tmp14_ = xmpp_jid_to_string (_tmp13_);
				_tmp15_ = _tmp14_;
				_tmp16_ = g_strconcat ("with:", _tmp15_, " ", NULL);
				_tmp17_ = _tmp16_;
				gtk_editable_set_text ((GtkEditable*) _tmp10_, _tmp17_);
				_g_free0 (_tmp17_);
				_g_free0 (_tmp15_);
				break;
			}
			case DINO_ENTITIES_CONVERSATION_TYPE_GROUPCHAT:
			{
				DinoUiMainWindow* _tmp18_;
				DinoUiGlobalSearch* _tmp19_;
				GtkSearchEntry* _tmp20_;
				DinoEntitiesConversation* _tmp21_;
				XmppJid* _tmp22_;
				XmppJid* _tmp23_;
				gchar* _tmp24_;
				gchar* _tmp25_;
				gchar* _tmp26_;
				gchar* _tmp27_;
				_tmp18_ = self->priv->window;
				_tmp19_ = _tmp18_->global_search;
				_tmp20_ = _tmp19_->search_entry;
				_tmp21_ = self->priv->conversation;
				_tmp22_ = dino_entities_conversation_get_counterpart (_tmp21_);
				_tmp23_ = _tmp22_;
				_tmp24_ = xmpp_jid_to_string (_tmp23_);
				_tmp25_ = _tmp24_;
				_tmp26_ = g_strconcat ("in:", _tmp25_, " ", NULL);
				_tmp27_ = _tmp26_;
				gtk_editable_set_text ((GtkEditable*) _tmp20_, _tmp27_);
				_g_free0 (_tmp27_);
				_g_free0 (_tmp25_);
				break;
			}
			default:
			break;
		}
	}
}

static void
dino_ui_main_window_controller_close_search (DinoUiMainWindowController* self)
{
	DinoUiConversationViewController* _tmp0_;
	DinoUiSearchMenuEntry* _tmp1_;
	GtkToggleButton* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->conversation_view_controller;
	_tmp1_ = _tmp0_->search_menu_entry;
	_tmp2_ = _tmp1_->button;
	gtk_toggle_button_set_active (_tmp2_, FALSE);
}

static void
dino_ui_main_window_controller_class_init (DinoUiMainWindowControllerClass * klass,
                                           gpointer klass_data)
{
	dino_ui_main_window_controller_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoUiMainWindowController_private_offset);
	G_OBJECT_CLASS (klass)->finalize = dino_ui_main_window_controller_finalize;
}

static void
dino_ui_main_window_controller_instance_init (DinoUiMainWindowController * self,
                                              gpointer klass)
{
	self->priv = dino_ui_main_window_controller_get_instance_private (self);
}

static void
dino_ui_main_window_controller_finalize (GObject * obj)
{
	DinoUiMainWindowController * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_MAIN_WINDOW_CONTROLLER, DinoUiMainWindowController);
	_g_object_unref0 (self->priv->stream_interactor);
	_g_object_unref0 (self->priv->conversation);
	_g_object_unref0 (self->priv->app);
	_qlite_database_unref0 (self->priv->db);
	_g_object_unref0 (self->priv->window);
	_g_object_unref0 (self->priv->conversation_view_controller);
	G_OBJECT_CLASS (dino_ui_main_window_controller_parent_class)->finalize (obj);
}

static GType
dino_ui_main_window_controller_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoUiMainWindowControllerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_ui_main_window_controller_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoUiMainWindowController), 0, (GInstanceInitFunc) dino_ui_main_window_controller_instance_init, NULL };
	GType dino_ui_main_window_controller_type_id;
	dino_ui_main_window_controller_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoUiMainWindowController", &g_define_type_info, 0);
	DinoUiMainWindowController_private_offset = g_type_add_instance_private (dino_ui_main_window_controller_type_id, sizeof (DinoUiMainWindowControllerPrivate));
	return dino_ui_main_window_controller_type_id;
}

GType
dino_ui_main_window_controller_get_type (void)
{
	static volatile gsize dino_ui_main_window_controller_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_main_window_controller_type_id__once)) {
		GType dino_ui_main_window_controller_type_id;
		dino_ui_main_window_controller_type_id = dino_ui_main_window_controller_get_type_once ();
		g_once_init_leave (&dino_ui_main_window_controller_type_id__once, dino_ui_main_window_controller_type_id);
	}
	return dino_ui_main_window_controller_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

