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

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

#define BUILD_DOMAIN "dev.geopjr.Tuba"
#define BUILD_NAME "Tuba"
#define BUILD_PROFILE "production"
#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_DIALOGS_TYPE_SAVEABLE (tuba_dialogs_saveable_get_type ())
#define TUBA_DIALOGS_SAVEABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_DIALOGS_TYPE_SAVEABLE, TubaDialogsSaveable))
#define TUBA_DIALOGS_IS_SAVEABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_DIALOGS_TYPE_SAVEABLE))
#define TUBA_DIALOGS_SAVEABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TUBA_DIALOGS_TYPE_SAVEABLE, TubaDialogsSaveableIface))

typedef struct _TubaDialogsSaveable TubaDialogsSaveable;
typedef struct _TubaDialogsSaveableIface TubaDialogsSaveableIface;

#define TUBA_DIALOGS_TYPE_MAIN_WINDOW (tuba_dialogs_main_window_get_type ())
#define TUBA_DIALOGS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_DIALOGS_TYPE_MAIN_WINDOW, TubaDialogsMainWindow))
#define TUBA_DIALOGS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_DIALOGS_TYPE_MAIN_WINDOW, TubaDialogsMainWindowClass))
#define TUBA_DIALOGS_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_DIALOGS_TYPE_MAIN_WINDOW))
#define TUBA_DIALOGS_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_DIALOGS_TYPE_MAIN_WINDOW))
#define TUBA_DIALOGS_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_DIALOGS_TYPE_MAIN_WINDOW, TubaDialogsMainWindowClass))

typedef struct _TubaDialogsMainWindow TubaDialogsMainWindow;
typedef struct _TubaDialogsMainWindowClass TubaDialogsMainWindowClass;
typedef struct _TubaDialogsMainWindowPrivate TubaDialogsMainWindowPrivate;

#define TUBA_VIEWS_TYPE_SIDEBAR (tuba_views_sidebar_get_type ())
#define TUBA_VIEWS_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_VIEWS_TYPE_SIDEBAR, TubaViewsSidebar))
#define TUBA_VIEWS_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_VIEWS_TYPE_SIDEBAR, TubaViewsSidebarClass))
#define TUBA_VIEWS_IS_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_VIEWS_TYPE_SIDEBAR))
#define TUBA_VIEWS_IS_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_VIEWS_TYPE_SIDEBAR))
#define TUBA_VIEWS_SIDEBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_VIEWS_TYPE_SIDEBAR, TubaViewsSidebarClass))

typedef struct _TubaViewsSidebar TubaViewsSidebar;
typedef struct _TubaViewsSidebarClass TubaViewsSidebarClass;

#define TUBA_VIEWS_TYPE_MEDIA_VIEWER (tuba_views_media_viewer_get_type ())
#define TUBA_VIEWS_MEDIA_VIEWER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_VIEWS_TYPE_MEDIA_VIEWER, TubaViewsMediaViewer))
#define TUBA_VIEWS_MEDIA_VIEWER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_VIEWS_TYPE_MEDIA_VIEWER, TubaViewsMediaViewerClass))
#define TUBA_VIEWS_IS_MEDIA_VIEWER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_VIEWS_TYPE_MEDIA_VIEWER))
#define TUBA_VIEWS_IS_MEDIA_VIEWER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_VIEWS_TYPE_MEDIA_VIEWER))
#define TUBA_VIEWS_MEDIA_VIEWER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_VIEWS_TYPE_MEDIA_VIEWER, TubaViewsMediaViewerClass))

typedef struct _TubaViewsMediaViewer TubaViewsMediaViewer;
typedef struct _TubaViewsMediaViewerClass TubaViewsMediaViewerClass;

#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;
enum  {
	TUBA_DIALOGS_MAIN_WINDOW_0_PROPERTY,
	TUBA_DIALOGS_MAIN_WINDOW_IS_HOME_PROPERTY,
	TUBA_DIALOGS_MAIN_WINDOW_IS_MEDIA_VIEWER_VISIBLE_PROPERTY,
	TUBA_DIALOGS_MAIN_WINDOW_NUM_PROPERTIES
};
static GParamSpec* tuba_dialogs_main_window_properties[TUBA_DIALOGS_MAIN_WINDOW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TUBA_TYPE_APPLICATION (tuba_application_get_type ())
#define TUBA_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_APPLICATION, TubaApplication))
#define TUBA_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_APPLICATION, TubaApplicationClass))
#define TUBA_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_APPLICATION))
#define TUBA_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_APPLICATION))
#define TUBA_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_APPLICATION, TubaApplicationClass))

typedef struct _TubaApplication TubaApplication;
typedef struct _TubaApplicationClass TubaApplicationClass;

#define TUBA_TYPE_SETTINGS (tuba_settings_get_type ())
#define TUBA_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_SETTINGS, TubaSettings))
#define TUBA_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_SETTINGS, TubaSettingsClass))
#define TUBA_IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_SETTINGS))
#define TUBA_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_SETTINGS))
#define TUBA_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_SETTINGS, TubaSettingsClass))

typedef struct _TubaSettings TubaSettings;
typedef struct _TubaSettingsClass TubaSettingsClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

#define TUBA_VIEWS_TYPE_TABBED_BASE (tuba_views_tabbed_base_get_type ())
#define TUBA_VIEWS_TABBED_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_VIEWS_TYPE_TABBED_BASE, TubaViewsTabbedBase))
#define TUBA_VIEWS_TABBED_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_VIEWS_TYPE_TABBED_BASE, TubaViewsTabbedBaseClass))
#define TUBA_VIEWS_IS_TABBED_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_VIEWS_TYPE_TABBED_BASE))
#define TUBA_VIEWS_IS_TABBED_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_VIEWS_TYPE_TABBED_BASE))
#define TUBA_VIEWS_TABBED_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_VIEWS_TYPE_TABBED_BASE, TubaViewsTabbedBaseClass))

typedef struct _TubaViewsTabbedBase TubaViewsTabbedBase;
typedef struct _TubaViewsTabbedBaseClass TubaViewsTabbedBaseClass;

#define TUBA_VIEWS_TYPE_MAIN (tuba_views_main_get_type ())
#define TUBA_VIEWS_MAIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_VIEWS_TYPE_MAIN, TubaViewsMain))
#define TUBA_VIEWS_MAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_VIEWS_TYPE_MAIN, TubaViewsMainClass))
#define TUBA_VIEWS_IS_MAIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_VIEWS_TYPE_MAIN))
#define TUBA_VIEWS_IS_MAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_VIEWS_TYPE_MAIN))
#define TUBA_VIEWS_MAIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_VIEWS_TYPE_MAIN, TubaViewsMainClass))

typedef struct _TubaViewsMain TubaViewsMain;
typedef struct _TubaViewsMainClass TubaViewsMainClass;
typedef enum  {
	TUBA_ATTACHMENT_MEDIA_TYPE_IMAGE,
	TUBA_ATTACHMENT_MEDIA_TYPE_VIDEO,
	TUBA_ATTACHMENT_MEDIA_TYPE_GIFV,
	TUBA_ATTACHMENT_MEDIA_TYPE_AUDIO,
	TUBA_ATTACHMENT_MEDIA_TYPE_UNKNOWN
} TubaAttachmentMediaType;

#define TUBA_ATTACHMENT_TYPE_MEDIA_TYPE (tuba_attachment_media_type_get_type ())

#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_BOOK_WYRM (tuba_api_book_wyrm_get_type ())
#define TUBA_API_BOOK_WYRM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_BOOK_WYRM, TubaAPIBookWyrm))
#define TUBA_API_BOOK_WYRM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_BOOK_WYRM, TubaAPIBookWyrmClass))
#define TUBA_API_IS_BOOK_WYRM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_BOOK_WYRM))
#define TUBA_API_IS_BOOK_WYRM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_BOOK_WYRM))
#define TUBA_API_BOOK_WYRM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_BOOK_WYRM, TubaAPIBookWyrmClass))

typedef struct _TubaAPIBookWyrm TubaAPIBookWyrm;
typedef struct _TubaAPIBookWyrmClass TubaAPIBookWyrmClass;

#define TUBA_TYPE_WIDGETIZABLE (tuba_widgetizable_get_type ())
#define TUBA_WIDGETIZABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_WIDGETIZABLE, TubaWidgetizable))
#define TUBA_IS_WIDGETIZABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_WIDGETIZABLE))
#define TUBA_WIDGETIZABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TUBA_TYPE_WIDGETIZABLE, TubaWidgetizableIface))

typedef struct _TubaWidgetizable TubaWidgetizable;
typedef struct _TubaWidgetizableIface TubaWidgetizableIface;

#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_WIDGETS_TYPE_BOOK_WYRM_PAGE (tuba_widgets_book_wyrm_page_get_type ())
#define TUBA_WIDGETS_BOOK_WYRM_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_TYPE_BOOK_WYRM_PAGE, TubaWidgetsBookWyrmPage))
#define TUBA_WIDGETS_BOOK_WYRM_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_TYPE_BOOK_WYRM_PAGE, TubaWidgetsBookWyrmPageClass))
#define TUBA_WIDGETS_IS_BOOK_WYRM_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_TYPE_BOOK_WYRM_PAGE))
#define TUBA_WIDGETS_IS_BOOK_WYRM_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_TYPE_BOOK_WYRM_PAGE))
#define TUBA_WIDGETS_BOOK_WYRM_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_TYPE_BOOK_WYRM_PAGE, TubaWidgetsBookWyrmPageClass))

typedef struct _TubaWidgetsBookWyrmPage TubaWidgetsBookWyrmPage;
typedef struct _TubaWidgetsBookWyrmPageClass TubaWidgetsBookWyrmPageClass;
#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))

struct _TubaDialogsSaveableIface {
	GTypeInterface parent_iface;
};

struct _TubaDialogsMainWindow {
	AdwApplicationWindow parent_instance;
	TubaDialogsMainWindowPrivate * priv;
	AdwOverlaySplitView* split_view;
	AdwNavigationPage* main_page;
};

struct _TubaDialogsMainWindowClass {
	AdwApplicationWindowClass parent_class;
};

struct _TubaDialogsMainWindowPrivate {
	AdwNavigationView* navigation_view;
	TubaViewsSidebar* sidebar;
	TubaViewsMediaViewer* media_viewer;
	AdwBreakpoint* breakpoint;
	AdwToastOverlay* toast_overlay;
	TubaViewsBase* last_view;
	GtkWidget* media_viewer_source_widget;
};

struct _TubaWidgetizableIface {
	GTypeInterface parent_iface;
	GtkWidget* (*to_widget) (TubaWidgetizable* self);
	void (*open) (TubaWidgetizable* self);
	void (*resolve_open) (TubaWidgetizable* self, TubaInstanceAccount* account);
};

static gint TubaDialogsMainWindow_private_offset;
static gpointer tuba_dialogs_main_window_parent_class = NULL;
VALA_EXTERN TubaApplication* tuba_app;
VALA_EXTERN TubaSettings* tuba_settings;
static TubaDialogsSaveableIface * tuba_dialogs_main_window_tuba_dialogs_saveable_parent_iface = NULL;

VALA_EXTERN GType tuba_dialogs_saveable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaDialogsSaveable, g_object_unref)
VALA_EXTERN GType tuba_dialogs_main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaDialogsMainWindow, g_object_unref)
VALA_EXTERN GType tuba_views_sidebar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaViewsSidebar, g_object_unref)
VALA_EXTERN GType tuba_views_media_viewer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaViewsMediaViewer, g_object_unref)
VALA_EXTERN GType tuba_views_base_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaViewsBase, g_object_unref)
VALA_EXTERN void tuba_dialogs_main_window_set_sidebar_selected_item (TubaDialogsMainWindow* self,
                                                         gint pos);
VALA_EXTERN void tuba_views_sidebar_set_sidebar_selected_item (TubaViewsSidebar* self,
                                                   gint index);
static gboolean tuba_dialogs_main_window_update_times (TubaDialogsMainWindow* self);
VALA_EXTERN GType tuba_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaApplication, g_object_unref)
static void tuba_dialogs_main_window_settings_updated (TubaDialogsMainWindow* self);
VALA_EXTERN void tuba_toggle_css (GtkWidget* wdg,
                      gboolean state,
                      const gchar* style);
VALA_EXTERN GType tuba_settings_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaSettings, g_object_unref)
VALA_EXTERN gboolean tuba_settings_get_darken_images_on_dark_mode (TubaSettings* self);
static void tuba_dialogs_main_window_add_toast (TubaDialogsMainWindow* self,
                                         const gchar* content,
                                         guint timeout,
                                         const gchar* action_name,
                                         GVariant* action_target,
                                         const gchar* action_label);
static void tuba_dialogs_main_window_add_real_toast (TubaDialogsMainWindow* self,
                                              AdwToast* toast);
static void tuba_dialogs_main_window_on_media_viewer_toggle (TubaDialogsMainWindow* self);
VALA_EXTERN gboolean tuba_dialogs_main_window_get_is_media_viewer_visible (TubaDialogsMainWindow* self);
VALA_EXTERN TubaDialogsMainWindow* tuba_dialogs_main_window_new (AdwApplication* app);
VALA_EXTERN TubaDialogsMainWindow* tuba_dialogs_main_window_construct (GType object_type,
                                                           AdwApplication* app);
VALA_EXTERN void tuba_dialogs_main_window_on_popped (TubaDialogsMainWindow* self);
static void _tuba_dialogs_main_window_on_popped_adw_navigation_view_popped (AdwNavigationView* _sender,
                                                                     AdwNavigationPage* page,
                                                                     gpointer self);
VALA_EXTERN TubaViewsMain* tuba_views_main_new (void);
VALA_EXTERN TubaViewsMain* tuba_views_main_construct (GType object_type);
VALA_EXTERN GType tuba_views_tabbed_base_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaViewsTabbedBase, g_object_unref)
VALA_EXTERN GType tuba_views_main_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaViewsMain, g_object_unref)
VALA_EXTERN void tuba_dialogs_main_window_scroll_media_viewer (TubaDialogsMainWindow* self,
                                                   gint pos);
VALA_EXTERN void tuba_views_media_viewer_scroll_to (TubaViewsMediaViewer* self,
                                        gint pos,
                                        gboolean animate);
VALA_EXTERN GType tuba_attachment_media_type_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void tuba_dialogs_main_window_show_media_viewer (TubaDialogsMainWindow* self,
                                                 const gchar* url,
                                                 TubaAttachmentMediaType media_type,
                                                 GdkPaintable* preview,
                                                 GtkWidget* source_widget,
                                                 gboolean as_is,
                                                 const gchar* alt_text,
                                                 const gchar* user_friendly_url,
                                                 const gchar* blurhash,
                                                 gboolean stream,
                                                 gboolean* load_and_scroll,
                                                 gboolean reveal_media_viewer);
VALA_EXTERN void tuba_views_media_viewer_add_media (TubaViewsMediaViewer* self,
                                        const gchar* url,
                                        TubaAttachmentMediaType media_type,
                                        GdkPaintable* preview,
                                        gboolean as_is,
                                        const gchar* alt_text,
                                        const gchar* user_friendly_url,
                                        const gchar* blurhash,
                                        gboolean stream,
                                        GtkWidget* revealer_widget,
                                        gboolean* load_and_scroll);
VALA_EXTERN TubaDialogsMainWindow* tuba_application_get_main_window (TubaApplication* self);
VALA_EXTERN void tuba_views_media_viewer_reveal (TubaViewsMediaViewer* self,
                                     GtkWidget* widget);
VALA_EXTERN void tuba_dialogs_main_window_reveal_media_viewer_manually (TubaDialogsMainWindow* self,
                                                            GtkWidget* source_widget);
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_book_wyrm_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIBookWyrm, g_object_unref)
VALA_EXTERN void tuba_dialogs_main_window_show_book (TubaDialogsMainWindow* self,
                                         TubaAPIBookWyrm* book,
                                         const gchar* fallback);
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_widgetizable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetizable, g_object_unref)
VALA_EXTERN GtkWidget* tuba_widgetizable_to_widget (TubaWidgetizable* self);
VALA_EXTERN const gchar* tuba_api_book_wyrm_get_title (TubaAPIBookWyrm* self);
VALA_EXTERN GType tuba_widgets_book_wyrm_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsBookWyrmPage, g_object_unref)
VALA_EXTERN void tuba_widgets_book_wyrm_page_set_selectable (TubaWidgetsBookWyrmPage* self,
                                                 gboolean value);
VALA_EXTERN TubaViewsBase* tuba_dialogs_main_window_open_view (TubaDialogsMainWindow* self,
                                                   TubaViewsBase* view);
VALA_EXTERN const gchar* tuba_views_base_get_label (TubaViewsBase* self);
VALA_EXTERN gboolean tuba_views_base_get_allow_nesting (TubaViewsBase* self);
VALA_EXTERN gint tuba_views_base_get_uid (TubaViewsBase* self);
VALA_EXTERN gboolean tuba_views_base_get_is_sidebar_item (TubaViewsBase* self);
VALA_EXTERN void tuba_views_base_update_last_widget (TubaViewsBase* self,
                                         gboolean clear);
VALA_EXTERN GtkWidget* tuba_views_base_get_last_widget (TubaViewsBase* self);
VALA_EXTERN gboolean tuba_dialogs_main_window_back (TubaDialogsMainWindow* self);
VALA_EXTERN void tuba_views_media_viewer_clear (TubaViewsMediaViewer* self);
VALA_EXTERN void tuba_dialogs_main_window_go_back_to_start (TubaDialogsMainWindow* self);
VALA_EXTERN void tuba_views_tabbed_base_change_page_to_named (TubaViewsTabbedBase* self,
                                                  const gchar* page_name);
VALA_EXTERN void tuba_dialogs_main_window_scroll_view_page (TubaDialogsMainWindow* self,
                                                gboolean up);
VALA_EXTERN void tuba_views_base_scroll_page (TubaViewsBase* self,
                                  gboolean up);
VALA_EXTERN void tuba_dialogs_main_window_switch_timeline (TubaDialogsMainWindow* self,
                                               gint32 num);
VALA_EXTERN void tuba_dialogs_main_window_update_selected_home_item (TubaDialogsMainWindow* self);
VALA_EXTERN gboolean tuba_dialogs_main_window_get_is_home (TubaDialogsMainWindow* self);
VALA_EXTERN gboolean tuba_application_get_is_mobile (TubaApplication* self);
VALA_EXTERN const gchar* tuba_views_main_get_visible_child_name (TubaViewsMain* self);
static void tuba_dialogs_main_window_on_visible_page_changed (TubaDialogsMainWindow* self);
VALA_EXTERN gboolean tuba_views_base_get_is_main (TubaViewsBase* self);
VALA_EXTERN void tuba_views_base_set_current (TubaViewsBase* self,
                                  gboolean value);
VALA_EXTERN void tuba_views_base_on_hidden (TubaViewsBase* self);
VALA_EXTERN void tuba_views_base_on_shown (TubaViewsBase* self);
static void _tuba_dialogs_main_window_on_visible_page_changed_g_object_notify (GObject* _sender,
                                                                        GParamSpec* pspec,
                                                                        gpointer self);
static GObject * tuba_dialogs_main_window_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
VALA_EXTERN void tuba_dialogs_saveable_construct_saveable (TubaDialogsSaveable* self,
                                               GSettings* settings);
static void _vala_GValue_free (GValue* self);
static void _tuba_dialogs_main_window_update_selected_home_item_g_object_notify (GObject* _sender,
                                                                          GParamSpec* pspec,
                                                                          gpointer self);
static void _tuba_dialogs_main_window_on_media_viewer_toggle_g_object_notify (GObject* _sender,
                                                                       GParamSpec* pspec,
                                                                       gpointer self);
static void _tuba_dialogs_main_window_settings_updated_g_object_notify (GObject* _sender,
                                                                 GParamSpec* pspec,
                                                                 gpointer self);
static void _tuba_dialogs_main_window_add_toast_tuba_application_toast (TubaApplication* _sender,
                                                                 const gchar* title,
                                                                 guint timeout,
                                                                 const gchar* action_name,
                                                                 GVariant* action_target,
                                                                 const gchar* action_label,
                                                                 gpointer self);
static void _tuba_dialogs_main_window_add_real_toast_tuba_application_toast_object (TubaApplication* _sender,
                                                                             AdwToast* toast_obj,
                                                                             gpointer self);
static gboolean _tuba_dialogs_main_window_update_times_gsource_func (gpointer self);
static void tuba_dialogs_main_window_finalize (GObject * obj);
static GType tuba_dialogs_main_window_get_type_once (void);
static void _vala_tuba_dialogs_main_window_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
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
tuba_dialogs_main_window_get_instance_private (TubaDialogsMainWindow* self)
{
	return G_STRUCT_MEMBER_P (self, TubaDialogsMainWindow_private_offset);
}

void
tuba_dialogs_main_window_set_sidebar_selected_item (TubaDialogsMainWindow* self,
                                                    gint pos)
{
	TubaViewsSidebar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->sidebar;
	tuba_views_sidebar_set_sidebar_selected_item (_tmp0_, pos);
}

static gboolean
tuba_dialogs_main_window_update_times (TubaDialogsMainWindow* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (gtk_widget_get_mapped ((GtkWidget*) self)) {
		TubaApplication* _tmp0_;
		_tmp0_ = tuba_app;
		g_signal_emit_by_name (_tmp0_, "time-update");
	}
	result = G_SOURCE_CONTINUE;
	return result;
}

static void
tuba_dialogs_main_window_settings_updated (TubaDialogsMainWindow* self)
{
	AdwOverlaySplitView* _tmp0_;
	TubaSettings* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->split_view;
	_tmp1_ = tuba_settings;
	_tmp2_ = tuba_settings_get_darken_images_on_dark_mode (_tmp1_);
	_tmp3_ = _tmp2_;
	tuba_toggle_css ((GtkWidget*) _tmp0_, _tmp3_, "ttl-darken-images");
}

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

static void
tuba_dialogs_main_window_add_toast (TubaDialogsMainWindow* self,
                                    const gchar* content,
                                    guint timeout,
                                    const gchar* action_name,
                                    GVariant* action_target,
                                    const gchar* action_label)
{
	AdwToastOverlay* _tmp0_;
	gchar* _tmp1_;
	GVariant* _tmp2_;
	gchar* _tmp3_;
	AdwToast* _tmp4_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content != NULL);
	_tmp0_ = self->priv->toast_overlay;
	_tmp1_ = g_strdup (action_name);
	_tmp2_ = _g_variant_ref0 (action_target);
	_tmp3_ = g_strdup (action_label);
	_tmp4_ = adw_toast_new (content);
	adw_toast_set_timeout (_tmp4_, timeout);
	adw_toast_set_action_name (_tmp4_, _tmp1_);
	_g_free0 (_tmp1_);
	g_object_set (_tmp4_, "action-target", _tmp2_, NULL);
	_g_variant_unref0 (_tmp2_);
	adw_toast_set_button_label (_tmp4_, _tmp3_);
	_g_free0 (_tmp3_);
	adw_toast_overlay_add_toast (_tmp0_, _tmp4_);
}

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

static void
tuba_dialogs_main_window_add_real_toast (TubaDialogsMainWindow* self,
                                         AdwToast* toast)
{
	AdwToastOverlay* _tmp0_;
	AdwToast* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (toast != NULL);
	_tmp0_ = self->priv->toast_overlay;
	_tmp1_ = _g_object_ref0 (toast);
	adw_toast_overlay_add_toast (_tmp0_, _tmp1_);
}

static void
tuba_dialogs_main_window_on_media_viewer_toggle (TubaDialogsMainWindow* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	gboolean _tmp2_;
	GtkWidget* focusable_widget = NULL;
	GtkWidget* _tmp4_;
	GtkWidget* _tmp5_;
	GtkWidget* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp1_ = tuba_dialogs_main_window_get_is_media_viewer_visible (self);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		_tmp0_ = TRUE;
	} else {
		GtkWidget* _tmp3_;
		_tmp3_ = self->priv->media_viewer_source_widget;
		_tmp0_ = _tmp3_ == NULL;
	}
	if (_tmp0_) {
		return;
	}
	_tmp4_ = self->priv->media_viewer_source_widget;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	focusable_widget = _tmp5_;
	_tmp6_ = focusable_widget;
	if (_tmp6_ != NULL) {
		GtkWidget* _tmp7_;
		_tmp7_ = focusable_widget;
		gtk_widget_grab_focus (_tmp7_);
	}
	_g_object_unref0 (self->priv->media_viewer_source_widget);
	self->priv->media_viewer_source_widget = NULL;
	_g_object_unref0 (focusable_widget);
}

static void
_tuba_dialogs_main_window_on_popped_adw_navigation_view_popped (AdwNavigationView* _sender,
                                                                AdwNavigationPage* page,
                                                                gpointer self)
{
	tuba_dialogs_main_window_on_popped ((TubaDialogsMainWindow*) self);
}

TubaDialogsMainWindow*
tuba_dialogs_main_window_construct (GType object_type,
                                    AdwApplication* app)
{
	TubaDialogsMainWindow * self = NULL;
	AdwNavigationView* _tmp0_;
	TubaViewsMain* _tmp1_;
	TubaViewsMain* _tmp2_;
	AdwNavigationPage* _tmp3_;
	AdwNavigationView* _tmp4_;
	AdwNavigationPage* _tmp5_;
	g_return_val_if_fail (app != NULL, NULL);
	self = (TubaDialogsMainWindow*) g_object_new (object_type, "application", app, "icon-name", BUILD_DOMAIN, "title", BUILD_NAME, "resizable", TRUE, NULL);
	tuba_dialogs_main_window_set_sidebar_selected_item (self, 0);
	_tmp0_ = self->priv->navigation_view;
	g_signal_connect_object (_tmp0_, "popped", (GCallback) _tuba_dialogs_main_window_on_popped_adw_navigation_view_popped, self, 0);
	_tmp1_ = tuba_views_main_new ();
	g_object_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	_tmp3_ = adw_navigation_page_new ((GtkWidget*) _tmp2_, _ ("Home"));
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->main_page);
	self->main_page = _tmp3_;
	_g_object_unref0 (_tmp2_);
	_tmp4_ = self->priv->navigation_view;
	_tmp5_ = self->main_page;
	adw_navigation_view_add (_tmp4_, _tmp5_);
	if (g_strcmp0 (BUILD_PROFILE, "development") == 0) {
		gtk_widget_add_css_class ((GtkWidget*) self, "devel");
	}
	return self;
}

TubaDialogsMainWindow*
tuba_dialogs_main_window_new (AdwApplication* app)
{
	return tuba_dialogs_main_window_construct (TUBA_DIALOGS_TYPE_MAIN_WINDOW, app);
}

void
tuba_dialogs_main_window_scroll_media_viewer (TubaDialogsMainWindow* self,
                                              gint pos)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	TubaViewsMediaViewer* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = tuba_dialogs_main_window_get_is_media_viewer_visible (self);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		return;
	}
	_tmp2_ = self->priv->media_viewer;
	tuba_views_media_viewer_scroll_to (_tmp2_, pos, FALSE);
}

void
tuba_dialogs_main_window_show_media_viewer (TubaDialogsMainWindow* self,
                                            const gchar* url,
                                            TubaAttachmentMediaType media_type,
                                            GdkPaintable* preview,
                                            GtkWidget* source_widget,
                                            gboolean as_is,
                                            const gchar* alt_text,
                                            const gchar* user_friendly_url,
                                            const gchar* blurhash,
                                            gboolean stream,
                                            gboolean* load_and_scroll,
                                            gboolean reveal_media_viewer)
{
	gboolean _tmp0_ = FALSE;
	TubaViewsMediaViewer* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (url != NULL);
	if (as_is) {
		_tmp0_ = preview == NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	}
	_tmp1_ = self->priv->media_viewer;
	tuba_views_media_viewer_add_media (_tmp1_, url, media_type, preview, as_is, alt_text, user_friendly_url, blurhash, stream, source_widget, load_and_scroll);
	if (reveal_media_viewer) {
		TubaApplication* _tmp2_;
		TubaDialogsMainWindow* _tmp3_;
		TubaDialogsMainWindow* _tmp4_;
		GtkWidget* _tmp5_;
		GtkWidget* _tmp6_;
		TubaViewsMediaViewer* _tmp7_;
		_tmp2_ = tuba_app;
		_tmp3_ = tuba_application_get_main_window (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = gtk_root_get_focus ((GtkRoot*) _tmp4_);
		_tmp6_ = _g_object_ref0 (_tmp5_);
		_g_object_unref0 (self->priv->media_viewer_source_widget);
		self->priv->media_viewer_source_widget = _tmp6_;
		_tmp7_ = self->priv->media_viewer;
		tuba_views_media_viewer_reveal (_tmp7_, source_widget);
	}
}

void
tuba_dialogs_main_window_reveal_media_viewer_manually (TubaDialogsMainWindow* self,
                                                       GtkWidget* source_widget)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	TubaApplication* _tmp2_;
	TubaDialogsMainWindow* _tmp3_;
	TubaDialogsMainWindow* _tmp4_;
	GtkWidget* _tmp5_;
	GtkWidget* _tmp6_;
	TubaViewsMediaViewer* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = tuba_dialogs_main_window_get_is_media_viewer_visible (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		return;
	}
	_tmp2_ = tuba_app;
	_tmp3_ = tuba_application_get_main_window (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = gtk_root_get_focus ((GtkRoot*) _tmp4_);
	_tmp6_ = _g_object_ref0 (_tmp5_);
	_g_object_unref0 (self->priv->media_viewer_source_widget);
	self->priv->media_viewer_source_widget = _tmp6_;
	_tmp7_ = self->priv->media_viewer;
	tuba_views_media_viewer_reveal (_tmp7_, source_widget);
}

void
tuba_dialogs_main_window_show_book (TubaDialogsMainWindow* self,
                                    TubaAPIBookWyrm* book,
                                    const gchar* fallback)
{
	GtkWidget* book_widget = NULL;
	GtkWidget* _tmp0_;
	AdwClamp* clamp = NULL;
	GtkWidget* _tmp1_;
	AdwClamp* _tmp2_ = NULL;
	GtkScrolledWindow* scroller = NULL;
	GtkScrolledWindow* _tmp3_ = NULL;
	AdwToolbarView* toolbar_view = NULL;
	AdwToolbarView* _tmp4_;
	AdwHeaderBar* headerbar = NULL;
	AdwHeaderBar* _tmp5_;
	AdwDialog* book_dialog = NULL;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	GtkWidget* _tmp9_;
	AdwDialog* _tmp10_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (book != NULL);
	_tmp0_ = tuba_widgetizable_to_widget ((TubaWidgetizable*) book);
	book_widget = _tmp0_;
	_tmp1_ = _g_object_ref0 (book_widget);
	_tmp2_ = (AdwClamp*) adw_clamp_new ();
	adw_clamp_set_child (_tmp2_, _tmp1_);
	_g_object_unref0 (_tmp1_);
	adw_clamp_set_tightening_threshold (_tmp2_, 100);
	gtk_widget_set_valign ((GtkWidget*) _tmp2_, GTK_ALIGN_START);
	g_object_ref_sink (_tmp2_);
	clamp = _tmp2_;
	_tmp3_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp3_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp3_, TRUE);
	g_object_ref_sink (_tmp3_);
	scroller = _tmp3_;
	gtk_scrolled_window_set_child (scroller, (GtkWidget*) clamp);
	_tmp4_ = (AdwToolbarView*) adw_toolbar_view_new ();
	g_object_ref_sink (_tmp4_);
	toolbar_view = _tmp4_;
	_tmp5_ = (AdwHeaderBar*) adw_header_bar_new ();
	g_object_ref_sink (_tmp5_);
	headerbar = _tmp5_;
	adw_toolbar_view_add_top_bar (toolbar_view, (GtkWidget*) headerbar);
	adw_toolbar_view_set_content (toolbar_view, (GtkWidget*) scroller);
	_tmp6_ = tuba_api_book_wyrm_get_title (book);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strdup (_tmp7_);
	_tmp9_ = _g_object_ref0 ((GtkWidget*) toolbar_view);
	_tmp10_ = adw_dialog_new ();
	adw_dialog_set_title (_tmp10_, _tmp8_);
	_g_free0 (_tmp8_);
	adw_dialog_set_child (_tmp10_, _tmp9_);
	_g_object_unref0 (_tmp9_);
	adw_dialog_set_content_width (_tmp10_, 460);
	adw_dialog_set_content_height (_tmp10_, 640);
	g_object_ref_sink (_tmp10_);
	book_dialog = _tmp10_;
	adw_dialog_present (book_dialog, (GtkWidget*) self);
	tuba_widgets_book_wyrm_page_set_selectable (G_TYPE_CHECK_INSTANCE_CAST (book_widget, TUBA_WIDGETS_TYPE_BOOK_WYRM_PAGE, TubaWidgetsBookWyrmPage), TRUE);
	_g_object_unref0 (book_dialog);
	_g_object_unref0 (headerbar);
	_g_object_unref0 (toolbar_view);
	_g_object_unref0 (scroller);
	_g_object_unref0 (clamp);
	_g_object_unref0 (book_widget);
}

TubaViewsBase*
tuba_dialogs_main_window_open_view (TubaDialogsMainWindow* self,
                                    TubaViewsBase* view)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	AdwNavigationView* _tmp3_;
	AdwNavigationPage* page = NULL;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	AdwNavigationPage* _tmp31_;
	gboolean _tmp32_;
	gboolean _tmp33_;
	TubaViewsBase* _tmp45_;
	TubaViewsBase* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (view != NULL, NULL);
	_tmp3_ = self->priv->navigation_view;
	if (_tmp3_ != NULL) {
		AdwNavigationView* _tmp4_;
		AdwNavigationPage* _tmp5_;
		AdwNavigationPage* _tmp6_;
		_tmp4_ = self->priv->navigation_view;
		_tmp5_ = adw_navigation_view_get_visible_page (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp2_ = _tmp6_ != NULL;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		AdwNavigationView* _tmp7_;
		AdwNavigationPage* _tmp8_;
		AdwNavigationPage* _tmp9_;
		GtkWidget* _tmp10_;
		GtkWidget* _tmp11_;
		_tmp7_ = self->priv->navigation_view;
		_tmp8_ = adw_navigation_view_get_visible_page (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = adw_navigation_page_get_child (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp1_ = _tmp11_ == G_TYPE_CHECK_INSTANCE_CAST (view, gtk_widget_get_type (), GtkWidget);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp12_ = FALSE;
		gboolean _tmp13_ = FALSE;
		gboolean _tmp14_ = FALSE;
		TubaViewsBase* _tmp15_;
		_tmp15_ = self->priv->last_view;
		if (_tmp15_ != NULL) {
			TubaViewsBase* _tmp16_;
			const gchar* _tmp17_;
			const gchar* _tmp18_;
			const gchar* _tmp19_;
			const gchar* _tmp20_;
			_tmp16_ = self->priv->last_view;
			_tmp17_ = tuba_views_base_get_label (_tmp16_);
			_tmp18_ = _tmp17_;
			_tmp19_ = tuba_views_base_get_label (view);
			_tmp20_ = _tmp19_;
			_tmp14_ = g_strcmp0 (_tmp18_, _tmp20_) == 0;
		} else {
			_tmp14_ = FALSE;
		}
		if (_tmp14_) {
			gboolean _tmp21_;
			gboolean _tmp22_;
			_tmp21_ = tuba_views_base_get_allow_nesting (view);
			_tmp22_ = _tmp21_;
			_tmp13_ = !_tmp22_;
		} else {
			_tmp13_ = FALSE;
		}
		if (_tmp13_) {
			gint _tmp23_;
			gint _tmp24_;
			TubaViewsBase* _tmp25_;
			gint _tmp26_;
			gint _tmp27_;
			_tmp23_ = tuba_views_base_get_uid (view);
			_tmp24_ = _tmp23_;
			_tmp25_ = self->priv->last_view;
			_tmp26_ = tuba_views_base_get_uid (_tmp25_);
			_tmp27_ = _tmp26_;
			_tmp12_ = _tmp24_ == _tmp27_;
		} else {
			_tmp12_ = FALSE;
		}
		_tmp0_ = _tmp12_;
	}
	if (_tmp0_) {
		TubaViewsBase* _tmp28_;
		_tmp28_ = _g_object_ref0 (view);
		result = _tmp28_;
		return result;
	}
	_tmp29_ = tuba_views_base_get_label (view);
	_tmp30_ = _tmp29_;
	_tmp31_ = adw_navigation_page_new ((GtkWidget*) view, _tmp30_);
	g_object_ref_sink (_tmp31_);
	page = _tmp31_;
	_tmp32_ = tuba_views_base_get_is_sidebar_item (view);
	_tmp33_ = _tmp32_;
	if (_tmp33_) {
		AdwNavigationView* _tmp34_;
		AdwNavigationPage* _tmp35_;
		AdwNavigationPage* _tmp36_;
		AdwNavigationPage* _tmp37_;
		AdwNavigationPage* _tmp38_;
		AdwNavigationPage** _tmp39_;
		AdwNavigationPage** _tmp40_;
		gint _tmp40__length1;
		_tmp34_ = self->priv->navigation_view;
		_tmp35_ = self->main_page;
		_tmp36_ = _g_object_ref0 (_tmp35_);
		_tmp37_ = page;
		_tmp38_ = _g_object_ref0 (_tmp37_);
		_tmp39_ = g_new0 (AdwNavigationPage*, 2 + 1);
		_tmp39_[0] = _tmp36_;
		_tmp39_[1] = _tmp38_;
		_tmp40_ = _tmp39_;
		_tmp40__length1 = 2;
		adw_navigation_view_replace (_tmp34_, _tmp40_, (gint) 2);
		_tmp40_ = (_vala_array_free (_tmp40_, _tmp40__length1, (GDestroyNotify) g_object_unref), NULL);
	} else {
		TubaViewsBase* _tmp41_;
		AdwNavigationView* _tmp43_;
		AdwNavigationPage* _tmp44_;
		_tmp41_ = self->priv->last_view;
		if (_tmp41_ != NULL) {
			TubaViewsBase* _tmp42_;
			_tmp42_ = self->priv->last_view;
			tuba_views_base_update_last_widget (_tmp42_, FALSE);
		}
		_tmp43_ = self->priv->navigation_view;
		_tmp44_ = page;
		adw_navigation_view_push (_tmp43_, _tmp44_);
	}
	_tmp45_ = _g_object_ref0 (view);
	result = _tmp45_;
	_g_object_unref0 (page);
	return result;
}

void
tuba_dialogs_main_window_on_popped (TubaDialogsMainWindow* self)
{
	TubaViewsBase* content_base = NULL;
	AdwNavigationView* _tmp0_;
	AdwNavigationPage* _tmp1_;
	AdwNavigationPage* _tmp2_;
	GtkWidget* _tmp3_;
	GtkWidget* _tmp4_;
	TubaViewsBase* _tmp5_;
	gboolean _tmp6_ = FALSE;
	TubaViewsBase* _tmp7_;
	TubaViewsBase* _tmp14_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->navigation_view;
	_tmp1_ = adw_navigation_view_get_visible_page (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = adw_navigation_page_get_child (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (TUBA_VIEWS_IS_BASE (_tmp4_) ? ((TubaViewsBase*) _tmp4_) : NULL);
	content_base = _tmp5_;
	_tmp7_ = content_base;
	if (_tmp7_ != NULL) {
		TubaViewsBase* _tmp8_;
		GtkWidget* _tmp9_;
		GtkWidget* _tmp10_;
		_tmp8_ = content_base;
		_tmp9_ = tuba_views_base_get_last_widget (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp6_ = _tmp10_ != NULL;
	} else {
		_tmp6_ = FALSE;
	}
	if (_tmp6_) {
		TubaViewsBase* _tmp11_;
		GtkWidget* _tmp12_;
		GtkWidget* _tmp13_;
		_tmp11_ = content_base;
		_tmp12_ = tuba_views_base_get_last_widget (_tmp11_);
		_tmp13_ = _tmp12_;
		gtk_widget_grab_focus (_tmp13_);
	}
	_tmp14_ = content_base;
	tuba_views_base_update_last_widget (_tmp14_, TRUE);
	_g_object_unref0 (content_base);
}

gboolean
tuba_dialogs_main_window_back (TubaDialogsMainWindow* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	TubaViewsBase* _tmp3_;
	AdwNavigationView* _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = tuba_dialogs_main_window_get_is_media_viewer_visible (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		TubaViewsMediaViewer* _tmp2_;
		_tmp2_ = self->priv->media_viewer;
		tuba_views_media_viewer_clear (_tmp2_);
		result = TRUE;
		return result;
	}
	_tmp3_ = self->priv->last_view;
	if (_tmp3_ == NULL) {
		result = TRUE;
		return result;
	}
	_tmp4_ = self->priv->navigation_view;
	adw_navigation_view_pop (_tmp4_);
	result = TRUE;
	return result;
}

void
tuba_dialogs_main_window_go_back_to_start (TubaDialogsMainWindow* self)
{
	AdwNavigationView* _tmp0_;
	AdwNavigationPage* _tmp1_;
	AdwNavigationPage* _tmp2_;
	AdwNavigationPage** _tmp3_;
	AdwNavigationPage** _tmp4_;
	gint _tmp4__length1;
	AdwNavigationPage* _tmp5_;
	GtkWidget* _tmp6_;
	GtkWidget* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->navigation_view;
	_tmp1_ = self->main_page;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_tmp3_ = g_new0 (AdwNavigationPage*, 1 + 1);
	_tmp3_[0] = _tmp2_;
	_tmp4_ = _tmp3_;
	_tmp4__length1 = 1;
	adw_navigation_view_replace (_tmp0_, _tmp4_, (gint) 1);
	_tmp4_ = (_vala_array_free (_tmp4_, _tmp4__length1, (GDestroyNotify) g_object_unref), NULL);
	_tmp5_ = self->main_page;
	_tmp6_ = adw_navigation_page_get_child (_tmp5_);
	_tmp7_ = _tmp6_;
	tuba_views_tabbed_base_change_page_to_named (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, TUBA_VIEWS_TYPE_TABBED_BASE, TubaViewsTabbedBase), "1");
}

void
tuba_dialogs_main_window_scroll_view_page (TubaDialogsMainWindow* self,
                                           gboolean up)
{
	TubaViewsBase* c_view = NULL;
	AdwNavigationView* _tmp0_;
	AdwNavigationPage* _tmp1_;
	AdwNavigationPage* _tmp2_;
	GtkWidget* _tmp3_;
	GtkWidget* _tmp4_;
	TubaViewsBase* _tmp5_;
	TubaViewsBase* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->navigation_view;
	_tmp1_ = adw_navigation_view_get_visible_page (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = adw_navigation_page_get_child (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (TUBA_VIEWS_IS_BASE (_tmp4_) ? ((TubaViewsBase*) _tmp4_) : NULL);
	c_view = _tmp5_;
	_tmp6_ = c_view;
	if (_tmp6_ != NULL) {
		TubaViewsBase* _tmp7_;
		_tmp7_ = c_view;
		tuba_views_base_scroll_page (_tmp7_, up);
	}
	_g_object_unref0 (c_view);
}

void
tuba_dialogs_main_window_switch_timeline (TubaDialogsMainWindow* self,
                                          gint32 num)
{
	g_return_if_fail (self != NULL);
}

void
tuba_dialogs_main_window_update_selected_home_item (TubaDialogsMainWindow* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = tuba_dialogs_main_window_get_is_home (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		TubaApplication* _tmp2_;
		gboolean _tmp3_;
		gboolean _tmp4_;
		_tmp2_ = tuba_app;
		_tmp3_ = tuba_application_get_is_mobile (_tmp2_);
		_tmp4_ = _tmp3_;
		if (_tmp4_) {
			tuba_dialogs_main_window_set_sidebar_selected_item (self, 0);
		} else {
			TubaViewsMain* main_view = NULL;
			AdwNavigationPage* _tmp5_;
			GtkWidget* _tmp6_;
			GtkWidget* _tmp7_;
			TubaViewsMain* _tmp8_;
			TubaViewsMain* _tmp9_;
			TubaViewsMain* _tmp10_;
			const gchar* _tmp11_;
			const gchar* _tmp12_;
			const gchar* _tmp13_;
			GQuark _tmp15_ = 0U;
			static GQuark _tmp14_label0 = 0;
			static GQuark _tmp14_label1 = 0;
			static GQuark _tmp14_label2 = 0;
			_tmp5_ = self->main_page;
			_tmp6_ = adw_navigation_page_get_child (_tmp5_);
			_tmp7_ = _tmp6_;
			_tmp8_ = _g_object_ref0 (TUBA_VIEWS_IS_MAIN (_tmp7_) ? ((TubaViewsMain*) _tmp7_) : NULL);
			main_view = _tmp8_;
			_tmp9_ = main_view;
			if (_tmp9_ == NULL) {
				_g_object_unref0 (main_view);
				return;
			}
			_tmp10_ = main_view;
			_tmp11_ = tuba_views_main_get_visible_child_name (_tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = _tmp12_;
			_tmp15_ = (NULL == _tmp13_) ? 0 : g_quark_from_string (_tmp13_);
			if (_tmp15_ == ((0 != _tmp14_label0) ? _tmp14_label0 : (_tmp14_label0 = g_quark_from_static_string ("1")))) {
				switch (0) {
					default:
					{
						tuba_dialogs_main_window_set_sidebar_selected_item (self, 0);
						break;
					}
				}
			} else if (_tmp15_ == ((0 != _tmp14_label1) ? _tmp14_label1 : (_tmp14_label1 = g_quark_from_static_string ("2")))) {
				switch (0) {
					default:
					{
						tuba_dialogs_main_window_set_sidebar_selected_item (self, 1);
						break;
					}
				}
			} else if (_tmp15_ == ((0 != _tmp14_label2) ? _tmp14_label2 : (_tmp14_label2 = g_quark_from_static_string ("3")))) {
				switch (0) {
					default:
					{
						tuba_dialogs_main_window_set_sidebar_selected_item (self, 2);
						break;
					}
				}
			}
			_g_object_unref0 (main_view);
		}
	}
}

static void
tuba_dialogs_main_window_on_visible_page_changed (TubaDialogsMainWindow* self)
{
	TubaViewsBase* view = NULL;
	AdwNavigationView* _tmp0_;
	AdwNavigationPage* _tmp1_;
	AdwNavigationPage* _tmp2_;
	GtkWidget* _tmp3_;
	GtkWidget* _tmp4_;
	TubaViewsBase* _tmp5_;
	TubaViewsBase* _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp8_;
	TubaViewsBase* _tmp9_;
	TubaViewsBase* _tmp12_;
	TubaViewsBase* _tmp15_;
	TubaViewsBase* _tmp16_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->navigation_view;
	_tmp1_ = adw_navigation_view_get_visible_page (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = adw_navigation_page_get_child (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (TUBA_VIEWS_IS_BASE (_tmp4_) ? ((TubaViewsBase*) _tmp4_) : NULL);
	view = _tmp5_;
	_tmp6_ = view;
	_tmp7_ = tuba_views_base_get_is_main (_tmp6_);
	_tmp8_ = _tmp7_;
	if (_tmp8_) {
		tuba_dialogs_main_window_update_selected_home_item (self);
	}
	_tmp9_ = self->priv->last_view;
	if (_tmp9_ != NULL) {
		TubaViewsBase* _tmp10_;
		TubaViewsBase* _tmp11_;
		_tmp10_ = self->priv->last_view;
		tuba_views_base_set_current (_tmp10_, FALSE);
		_tmp11_ = self->priv->last_view;
		tuba_views_base_on_hidden (_tmp11_);
	}
	_tmp12_ = view;
	if (_tmp12_ != NULL) {
		TubaViewsBase* _tmp13_;
		TubaViewsBase* _tmp14_;
		_tmp13_ = view;
		tuba_views_base_set_current (_tmp13_, TRUE);
		_tmp14_ = view;
		tuba_views_base_on_shown (_tmp14_);
	}
	_tmp15_ = view;
	_tmp16_ = _g_object_ref0 (_tmp15_);
	_g_object_unref0 (self->priv->last_view);
	self->priv->last_view = _tmp16_;
	_g_object_unref0 (view);
}

static void
_tuba_dialogs_main_window_on_visible_page_changed_g_object_notify (GObject* _sender,
                                                                   GParamSpec* pspec,
                                                                   gpointer self)
{
	tuba_dialogs_main_window_on_visible_page_changed ((TubaDialogsMainWindow*) self);
}

gboolean
tuba_dialogs_main_window_get_is_home (TubaDialogsMainWindow* self)
{
	gboolean result;
	AdwNavigationView* _tmp0_;
	GListModel* _tmp1_;
	GListModel* _tmp2_;
	GListModel* _tmp3_;
	gboolean _tmp4_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->navigation_view;
	_tmp1_ = adw_navigation_view_get_navigation_stack (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = g_list_model_get_n_items (_tmp3_) == ((guint) 1);
	_g_object_unref0 (_tmp3_);
	result = _tmp4_;
	return result;
}

gboolean
tuba_dialogs_main_window_get_is_media_viewer_visible (TubaDialogsMainWindow* self)
{
	gboolean result;
	TubaViewsMediaViewer* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->media_viewer;
	_tmp1_ = gtk_widget_get_visible ((GtkWidget*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static void
_vala_GValue_free (GValue* self)
{
	g_boxed_free (G_TYPE_VALUE, self);
}

static void
_tuba_dialogs_main_window_update_selected_home_item_g_object_notify (GObject* _sender,
                                                                     GParamSpec* pspec,
                                                                     gpointer self)
{
	tuba_dialogs_main_window_update_selected_home_item ((TubaDialogsMainWindow*) self);
}

static void
_tuba_dialogs_main_window_on_media_viewer_toggle_g_object_notify (GObject* _sender,
                                                                  GParamSpec* pspec,
                                                                  gpointer self)
{
	tuba_dialogs_main_window_on_media_viewer_toggle ((TubaDialogsMainWindow*) self);
}

static void
_tuba_dialogs_main_window_settings_updated_g_object_notify (GObject* _sender,
                                                            GParamSpec* pspec,
                                                            gpointer self)
{
	tuba_dialogs_main_window_settings_updated ((TubaDialogsMainWindow*) self);
}

static void
_tuba_dialogs_main_window_add_toast_tuba_application_toast (TubaApplication* _sender,
                                                            const gchar* title,
                                                            guint timeout,
                                                            const gchar* action_name,
                                                            GVariant* action_target,
                                                            const gchar* action_label,
                                                            gpointer self)
{
	tuba_dialogs_main_window_add_toast ((TubaDialogsMainWindow*) self, title, timeout, action_name, action_target, action_label);
}

static void
_tuba_dialogs_main_window_add_real_toast_tuba_application_toast_object (TubaApplication* _sender,
                                                                        AdwToast* toast_obj,
                                                                        gpointer self)
{
	tuba_dialogs_main_window_add_real_toast ((TubaDialogsMainWindow*) self, toast_obj);
}

static gboolean
_tuba_dialogs_main_window_update_times_gsource_func (gpointer self)
{
	gboolean result;
	result = tuba_dialogs_main_window_update_times ((TubaDialogsMainWindow*) self);
	return result;
}

static GObject *
tuba_dialogs_main_window_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TubaDialogsMainWindow * self;
	TubaSettings* _tmp0_;
	GtkSettings* gtk_settings = NULL;
	GtkSettings* _tmp1_;
	GtkSettings* _tmp2_;
	GtkSettings* _tmp3_;
	AdwBreakpoint* _tmp5_;
	TubaApplication* _tmp6_;
	GValue* _tmp7_ = NULL;
	TubaApplication* _tmp8_;
	TubaViewsMediaViewer* _tmp9_;
	AdwOverlaySplitView* _tmp10_;
	TubaViewsMediaViewer* _tmp11_;
	TubaSettings* _tmp12_;
	TubaApplication* _tmp13_;
	TubaApplication* _tmp14_;
	parent_class = G_OBJECT_CLASS (tuba_dialogs_main_window_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_DIALOGS_TYPE_MAIN_WINDOW, TubaDialogsMainWindow);
	_tmp0_ = tuba_settings;
	tuba_dialogs_saveable_construct_saveable ((TubaDialogsSaveable*) self, (GSettings*) _tmp0_);
	_tmp1_ = gtk_settings_get_default ();
	_tmp2_ = _g_object_ref0 (_tmp1_);
	gtk_settings = _tmp2_;
	_tmp3_ = gtk_settings;
	if (_tmp3_ != NULL) {
		GtkSettings* _tmp4_;
		_tmp4_ = gtk_settings;
		g_object_set (_tmp4_, "gtk-label-select-on-focus", FALSE, NULL);
	}
	_tmp5_ = self->priv->breakpoint;
	_tmp6_ = tuba_app;
	_tmp7_ = g_new0 (GValue, 1);
	g_value_init (_tmp7_, G_TYPE_BOOLEAN);
	g_value_set_boolean (_tmp7_, TRUE);
	adw_breakpoint_add_setter (_tmp5_, (GObject*) _tmp6_, "is-mobile", _tmp7_);
	__vala_GValue_free0 (_tmp7_);
	_tmp8_ = tuba_app;
	g_signal_connect_object ((GObject*) _tmp8_, "notify::is-mobile", (GCallback) _tuba_dialogs_main_window_update_selected_home_item_g_object_notify, self, 0);
	_tmp9_ = self->priv->media_viewer;
	_tmp10_ = self->split_view;
	g_object_bind_property_with_closures ((GObject*) _tmp9_, "visible", (GObject*) _tmp10_, "can-focus", G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp11_ = self->priv->media_viewer;
	g_signal_connect_object ((GObject*) _tmp11_, "notify::visible", (GCallback) _tuba_dialogs_main_window_on_media_viewer_toggle_g_object_notify, self, 0);
	_tmp12_ = tuba_settings;
	g_signal_connect_object ((GObject*) _tmp12_, "notify::darken-images-on-dark-mode", (GCallback) _tuba_dialogs_main_window_settings_updated_g_object_notify, self, 0);
	_tmp13_ = tuba_app;
	g_signal_connect_object (_tmp13_, "toast", (GCallback) _tuba_dialogs_main_window_add_toast_tuba_application_toast, self, 0);
	_tmp14_ = tuba_app;
	g_signal_connect_object (_tmp14_, "toast-object", (GCallback) _tuba_dialogs_main_window_add_real_toast_tuba_application_toast_object, self, 0);
	g_timeout_add_full (G_PRIORITY_LOW, (guint) ((5 * 60) * 1000), _tuba_dialogs_main_window_update_times_gsource_func, g_object_ref (self), g_object_unref);
	_g_object_unref0 (gtk_settings);
	return obj;
}

static void
tuba_dialogs_main_window_class_init (TubaDialogsMainWindowClass * klass,
                                     gpointer klass_data)
{
	tuba_dialogs_main_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaDialogsMainWindow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_dialogs_main_window_get_property;
	G_OBJECT_CLASS (klass)->constructor = tuba_dialogs_main_window_constructor;
	G_OBJECT_CLASS (klass)->finalize = tuba_dialogs_main_window_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_MAIN_WINDOW_IS_HOME_PROPERTY, tuba_dialogs_main_window_properties[TUBA_DIALOGS_MAIN_WINDOW_IS_HOME_PROPERTY] = g_param_spec_boolean ("is-home", "is-home", "is-home", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_MAIN_WINDOW_IS_MEDIA_VIEWER_VISIBLE_PROPERTY, tuba_dialogs_main_window_properties[TUBA_DIALOGS_MAIN_WINDOW_IS_MEDIA_VIEWER_VISIBLE_PROPERTY] = g_param_spec_boolean ("is-media-viewer-visible", "is-media-viewer-visible", "is-media-viewer-visible", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/dev/geopjr/Tuba/ui/dialogs/main.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "navigation_view", FALSE, TubaDialogsMainWindow_private_offset + G_STRUCT_OFFSET (TubaDialogsMainWindowPrivate, navigation_view));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "split_view", FALSE, G_STRUCT_OFFSET (TubaDialogsMainWindow, split_view));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "sidebar", FALSE, TubaDialogsMainWindow_private_offset + G_STRUCT_OFFSET (TubaDialogsMainWindowPrivate, sidebar));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "media_viewer", FALSE, TubaDialogsMainWindow_private_offset + G_STRUCT_OFFSET (TubaDialogsMainWindowPrivate, media_viewer));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "breakpoint", FALSE, TubaDialogsMainWindow_private_offset + G_STRUCT_OFFSET (TubaDialogsMainWindowPrivate, breakpoint));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "toast_overlay", FALSE, TubaDialogsMainWindow_private_offset + G_STRUCT_OFFSET (TubaDialogsMainWindowPrivate, toast_overlay));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_visible_page_changed", G_CALLBACK(_tuba_dialogs_main_window_on_visible_page_changed_g_object_notify));
	g_type_ensure (TUBA_VIEWS_TYPE_MEDIA_VIEWER);
	g_type_ensure (TUBA_VIEWS_TYPE_SIDEBAR);
}

static void
tuba_dialogs_main_window_tuba_dialogs_saveable_interface_init (TubaDialogsSaveableIface * iface,
                                                               gpointer iface_data)
{
	tuba_dialogs_main_window_tuba_dialogs_saveable_parent_iface = g_type_interface_peek_parent (iface);
}

static void
tuba_dialogs_main_window_instance_init (TubaDialogsMainWindow * self,
                                        gpointer klass)
{
	self->priv = tuba_dialogs_main_window_get_instance_private (self);
	self->priv->last_view = NULL;
	g_type_ensure (TUBA_VIEWS_TYPE_SIDEBAR);
	g_type_ensure (TUBA_VIEWS_TYPE_MEDIA_VIEWER);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
tuba_dialogs_main_window_finalize (GObject * obj)
{
	TubaDialogsMainWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_DIALOGS_TYPE_MAIN_WINDOW, TubaDialogsMainWindow);
	_g_object_unref0 (self->priv->last_view);
	_g_object_unref0 (self->priv->media_viewer_source_widget);
	_g_object_unref0 (self->main_page);
	G_OBJECT_CLASS (tuba_dialogs_main_window_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_dialogs_main_window_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaDialogsMainWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_dialogs_main_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaDialogsMainWindow), 0, (GInstanceInitFunc) tuba_dialogs_main_window_instance_init, NULL };
	static const GInterfaceInfo tuba_dialogs_saveable_info = { (GInterfaceInitFunc) tuba_dialogs_main_window_tuba_dialogs_saveable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType tuba_dialogs_main_window_type_id;
	tuba_dialogs_main_window_type_id = g_type_register_static (adw_application_window_get_type (), "TubaDialogsMainWindow", &g_define_type_info, G_TYPE_FLAG_NONE);
	g_type_add_interface_static (tuba_dialogs_main_window_type_id, TUBA_DIALOGS_TYPE_SAVEABLE, &tuba_dialogs_saveable_info);
	TubaDialogsMainWindow_private_offset = g_type_add_instance_private (tuba_dialogs_main_window_type_id, sizeof (TubaDialogsMainWindowPrivate));
	return tuba_dialogs_main_window_type_id;
}

GType
tuba_dialogs_main_window_get_type (void)
{
	static GType tuba_dialogs_main_window_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_dialogs_main_window_type_id__once)) {
		GType tuba_dialogs_main_window_type_id;
		tuba_dialogs_main_window_type_id = tuba_dialogs_main_window_get_type_once ();
		g_once_init_leave_pointer (&tuba_dialogs_main_window_type_id__once, tuba_dialogs_main_window_type_id);
	}
	return tuba_dialogs_main_window_type_id__once;
}

static void
_vala_tuba_dialogs_main_window_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	TubaDialogsMainWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_DIALOGS_TYPE_MAIN_WINDOW, TubaDialogsMainWindow);
	switch (property_id) {
		case TUBA_DIALOGS_MAIN_WINDOW_IS_HOME_PROPERTY:
		g_value_set_boolean (value, tuba_dialogs_main_window_get_is_home (self));
		break;
		case TUBA_DIALOGS_MAIN_WINDOW_IS_MEDIA_VIEWER_VISIBLE_PROPERTY:
		g_value_set_boolean (value, tuba_dialogs_main_window_get_is_media_viewer_visible (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

