/* WelcomePage.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from WelcomePage.vala, do not modify */

/*
 * Copyright 2013-2020 elementary, Inc. (https://elementary.io)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#include <adwaita.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <granite-7.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 AUDIENCE_TYPE_WELCOME_PAGE (audience_welcome_page_get_type ())
#define AUDIENCE_WELCOME_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AUDIENCE_TYPE_WELCOME_PAGE, AudienceWelcomePage))
#define AUDIENCE_WELCOME_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AUDIENCE_TYPE_WELCOME_PAGE, AudienceWelcomePageClass))
#define AUDIENCE_IS_WELCOME_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AUDIENCE_TYPE_WELCOME_PAGE))
#define AUDIENCE_IS_WELCOME_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AUDIENCE_TYPE_WELCOME_PAGE))
#define AUDIENCE_WELCOME_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AUDIENCE_TYPE_WELCOME_PAGE, AudienceWelcomePageClass))

typedef struct _AudienceWelcomePage AudienceWelcomePage;
typedef struct _AudienceWelcomePageClass AudienceWelcomePageClass;
typedef struct _AudienceWelcomePagePrivate AudienceWelcomePagePrivate;
enum  {
	AUDIENCE_WELCOME_PAGE_0_PROPERTY,
	AUDIENCE_WELCOME_PAGE_NUM_PROPERTIES
};
static GParamSpec* audience_welcome_page_properties[AUDIENCE_WELCOME_PAGE_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define AUDIENCE_SERVICES_TYPE_LIBRARY_MANAGER (audience_services_library_manager_get_type ())
#define AUDIENCE_SERVICES_LIBRARY_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AUDIENCE_SERVICES_TYPE_LIBRARY_MANAGER, AudienceServicesLibraryManager))
#define AUDIENCE_SERVICES_LIBRARY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AUDIENCE_SERVICES_TYPE_LIBRARY_MANAGER, AudienceServicesLibraryManagerClass))
#define AUDIENCE_SERVICES_IS_LIBRARY_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AUDIENCE_SERVICES_TYPE_LIBRARY_MANAGER))
#define AUDIENCE_SERVICES_IS_LIBRARY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AUDIENCE_SERVICES_TYPE_LIBRARY_MANAGER))
#define AUDIENCE_SERVICES_LIBRARY_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AUDIENCE_SERVICES_TYPE_LIBRARY_MANAGER, AudienceServicesLibraryManagerClass))

typedef struct _AudienceServicesLibraryManager AudienceServicesLibraryManager;
typedef struct _AudienceServicesLibraryManagerClass AudienceServicesLibraryManagerClass;
typedef struct _Block12Data Block12Data;

#define AUDIENCE_TYPE_HEADER_BAR (audience_header_bar_get_type ())
#define AUDIENCE_HEADER_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AUDIENCE_TYPE_HEADER_BAR, AudienceHeaderBar))
#define AUDIENCE_HEADER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AUDIENCE_TYPE_HEADER_BAR, AudienceHeaderBarClass))
#define AUDIENCE_IS_HEADER_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AUDIENCE_TYPE_HEADER_BAR))
#define AUDIENCE_IS_HEADER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AUDIENCE_TYPE_HEADER_BAR))
#define AUDIENCE_HEADER_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AUDIENCE_TYPE_HEADER_BAR, AudienceHeaderBarClass))

typedef struct _AudienceHeaderBar AudienceHeaderBar;
typedef struct _AudienceHeaderBarClass AudienceHeaderBarClass;

#define AUDIENCE_TYPE_WINDOW (audience_window_get_type ())
#define AUDIENCE_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AUDIENCE_TYPE_WINDOW, AudienceWindow))
#define AUDIENCE_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AUDIENCE_TYPE_WINDOW, AudienceWindowClass))
#define AUDIENCE_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AUDIENCE_TYPE_WINDOW))
#define AUDIENCE_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AUDIENCE_TYPE_WINDOW))
#define AUDIENCE_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AUDIENCE_TYPE_WINDOW, AudienceWindowClass))

typedef struct _AudienceWindow AudienceWindow;
typedef struct _AudienceWindowClass AudienceWindowClass;

#define AUDIENCE_TYPE_PLAYBACK_MANAGER (audience_playback_manager_get_type ())
#define AUDIENCE_PLAYBACK_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AUDIENCE_TYPE_PLAYBACK_MANAGER, AudiencePlaybackManager))
#define AUDIENCE_PLAYBACK_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AUDIENCE_TYPE_PLAYBACK_MANAGER, AudiencePlaybackManagerClass))
#define AUDIENCE_IS_PLAYBACK_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AUDIENCE_TYPE_PLAYBACK_MANAGER))
#define AUDIENCE_IS_PLAYBACK_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AUDIENCE_TYPE_PLAYBACK_MANAGER))
#define AUDIENCE_PLAYBACK_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AUDIENCE_TYPE_PLAYBACK_MANAGER, AudiencePlaybackManagerClass))

typedef struct _AudiencePlaybackManager AudiencePlaybackManager;
typedef struct _AudiencePlaybackManagerClass AudiencePlaybackManagerClass;

struct _AudienceWelcomePage {
	AdwNavigationPage parent_instance;
	AudienceWelcomePagePrivate * priv;
};

struct _AudienceWelcomePageClass {
	AdwNavigationPageClass parent_class;
};

struct _AudienceWelcomePagePrivate {
	gchar* current_video;
	GtkButton* replay_button;
	GtkImage* replay_button_image;
	GtkLabel* replay_button_title;
	GtkLabel* replay_button_description;
};

struct _Block12Data {
	int _ref_count_;
	AudienceWelcomePage* self;
	GtkButton* library_button;
	AudienceServicesLibraryManager* library_manager;
};

static gint AudienceWelcomePage_private_offset;
static gpointer audience_welcome_page_parent_class = NULL;
VALA_EXTERN GSettings* audience_settings;

VALA_EXTERN GType audience_welcome_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AudienceWelcomePage, g_object_unref)
static void audience_welcome_page_update_replay_button (AudienceWelcomePage* self);
VALA_EXTERN gchar* audience_get_title (const gchar* filename);
static void audience_welcome_page_update_replay_title (AudienceWelcomePage* self);
VALA_EXTERN AudienceWelcomePage* audience_welcome_page_new (void);
VALA_EXTERN AudienceWelcomePage* audience_welcome_page_construct (GType object_type);
static GObject * audience_welcome_page_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties);
VALA_EXTERN GType audience_services_library_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AudienceServicesLibraryManager, g_object_unref)
static Block12Data* block12_data_ref (Block12Data* _data12_);
static void block12_data_unref (void * _userdata_);
VALA_EXTERN AudienceHeaderBar* audience_header_bar_new (void);
VALA_EXTERN AudienceHeaderBar* audience_header_bar_construct (GType object_type);
VALA_EXTERN GType audience_header_bar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AudienceHeaderBar, g_object_unref)
VALA_EXTERN AudienceServicesLibraryManager* audience_services_library_manager_get_instance (void);
VALA_EXTERN GListStore* audience_services_library_manager_get_library_items (AudienceServicesLibraryManager* self);
static void _audience_welcome_page___lambda66_ (AudienceWelcomePage* self);
VALA_EXTERN GType audience_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AudienceWindow, g_object_unref)
VALA_EXTERN void audience_window_run_open_file (AudienceWindow* self,
                                    gboolean clear_playlist,
                                    gboolean force_play);
static void __audience_welcome_page___lambda66__gtk_button_clicked (GtkButton* _sender,
                                                             gpointer self);
static void _audience_welcome_page___lambda67_ (AudienceWelcomePage* self);
VALA_EXTERN GType audience_playback_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AudiencePlaybackManager, g_object_unref)
VALA_EXTERN AudiencePlaybackManager* audience_playback_manager_get_default (void);
VALA_EXTERN void audience_playback_manager_append_to_playlist (AudiencePlaybackManager* self,
                                                   gchar** uris,
                                                   gint uris_length1);
VALA_EXTERN void audience_window_resume_last_videos (AudienceWindow* self);
static void __audience_welcome_page___lambda67__gtk_button_clicked (GtkButton* _sender,
                                                             gpointer self);
static void _audience_welcome_page___lambda68_ (AudienceWelcomePage* self);
VALA_EXTERN void audience_window_show_library (AudienceWindow* self);
static void __audience_welcome_page___lambda68__gtk_button_clicked (GtkButton* _sender,
                                                             gpointer self);
static void _audience_welcome_page_update_replay_button_g_settings_changed (GSettings* _sender,
                                                                     const gchar* key,
                                                                     gpointer self);
static void _audience_welcome_page_update_replay_title_g_settings_changed (GSettings* _sender,
                                                                    const gchar* key,
                                                                    gpointer self);
static void _audience_welcome_page___lambda69_ (Block12Data* _data12_);
static void __audience_welcome_page___lambda69__g_list_model_items_changed (GListModel* _sender,
                                                                     guint position,
                                                                     guint removed,
                                                                     guint added,
                                                                     gpointer self);
static void audience_welcome_page_finalize (GObject * obj);
static GType audience_welcome_page_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
audience_welcome_page_get_instance_private (AudienceWelcomePage* self)
{
	return G_STRUCT_MEMBER_P (self, AudienceWelcomePage_private_offset);
}

static void
audience_welcome_page_update_replay_button (AudienceWelcomePage* self)
{
	gboolean show_replay_button = FALSE;
	GSettings* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	GtkButton* _tmp12_;
	g_return_if_fail (self != NULL);
	show_replay_button = FALSE;
	_tmp0_ = audience_settings;
	_tmp1_ = g_settings_get_string (_tmp0_, "current-video");
	_g_free0 (self->priv->current_video);
	self->priv->current_video = _tmp1_;
	_tmp2_ = self->priv->current_video;
	if (g_strcmp0 (_tmp2_, "") != 0) {
		GFile* last_file = NULL;
		const gchar* _tmp3_;
		GFile* _tmp4_;
		GFile* _tmp5_;
		_tmp3_ = self->priv->current_video;
		_tmp4_ = g_file_new_for_uri (_tmp3_);
		last_file = _tmp4_;
		_tmp5_ = last_file;
		if (g_file_query_exists (_tmp5_, NULL)) {
			GtkLabel* _tmp6_;
			GFile* _tmp7_;
			gchar* _tmp8_;
			gchar* _tmp9_;
			gchar* _tmp10_;
			gchar* _tmp11_;
			_tmp6_ = self->priv->replay_button_description;
			_tmp7_ = last_file;
			_tmp8_ = g_file_get_basename (_tmp7_);
			_tmp9_ = _tmp8_;
			_tmp10_ = audience_get_title (_tmp9_);
			_tmp11_ = _tmp10_;
			gtk_label_set_label (_tmp6_, _tmp11_);
			_g_free0 (_tmp11_);
			_g_free0 (_tmp9_);
			show_replay_button = TRUE;
		}
		_g_object_unref0 (last_file);
	}
	_tmp12_ = self->priv->replay_button;
	gtk_widget_set_visible ((GtkWidget*) _tmp12_, show_replay_button);
}

static void
audience_welcome_page_update_replay_title (AudienceWelcomePage* self)
{
	GSettings* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = audience_settings;
	if (g_settings_get_int64 (_tmp0_, "last-stopped") == ((gint64) 0)) {
		GtkLabel* _tmp1_;
		GtkImage* _tmp2_;
		_tmp1_ = self->priv->replay_button_title;
		gtk_label_set_label (_tmp1_, _ ("Replay last video"));
		_tmp2_ = self->priv->replay_button_image;
		gtk_image_set_from_icon_name (_tmp2_, "media-playlist-repeat");
	} else {
		GtkLabel* _tmp3_;
		GtkImage* _tmp4_;
		_tmp3_ = self->priv->replay_button_title;
		gtk_label_set_label (_tmp3_, _ ("Resume last video"));
		_tmp4_ = self->priv->replay_button_image;
		gtk_image_set_from_icon_name (_tmp4_, "media-playback-start");
	}
}

AudienceWelcomePage*
audience_welcome_page_construct (GType object_type)
{
	AudienceWelcomePage * self = NULL;
	self = (AudienceWelcomePage*) g_object_new (object_type, NULL);
	return self;
}

AudienceWelcomePage*
audience_welcome_page_new (void)
{
	return audience_welcome_page_construct (AUDIENCE_TYPE_WELCOME_PAGE);
}

static Block12Data*
block12_data_ref (Block12Data* _data12_)
{
	g_atomic_int_inc (&_data12_->_ref_count_);
	return _data12_;
}

static void
block12_data_unref (void * _userdata_)
{
	Block12Data* _data12_;
	_data12_ = (Block12Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data12_->_ref_count_)) {
		AudienceWelcomePage* self;
		self = _data12_->self;
		_g_object_unref0 (_data12_->library_manager);
		_g_object_unref0 (_data12_->library_button);
		_g_object_unref0 (self);
		g_slice_free (Block12Data, _data12_);
	}
}

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

static void
_audience_welcome_page___lambda66_ (AudienceWelcomePage* self)
{
	AudienceWindow* window = NULL;
	GtkRoot* _tmp0_;
	AudienceWindow* _tmp1_;
	AudienceWindow* _tmp2_;
	_tmp0_ = gtk_widget_get_root ((GtkWidget*) self);
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, AUDIENCE_TYPE_WINDOW, AudienceWindow));
	window = _tmp1_;
	_tmp2_ = window;
	audience_window_run_open_file (_tmp2_, FALSE, TRUE);
	_g_object_unref0 (window);
}

static void
__audience_welcome_page___lambda66__gtk_button_clicked (GtkButton* _sender,
                                                        gpointer self)
{
	_audience_welcome_page___lambda66_ ((AudienceWelcomePage*) self);
}

static void
_audience_welcome_page___lambda67_ (AudienceWelcomePage* self)
{
	AudienceWindow* window = NULL;
	GtkRoot* _tmp0_;
	AudienceWindow* _tmp1_;
	AudiencePlaybackManager* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar** _tmp5_;
	gchar** _tmp6_;
	gint _tmp6__length1;
	AudienceWindow* _tmp7_;
	_tmp0_ = gtk_widget_get_root ((GtkWidget*) self);
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, AUDIENCE_TYPE_WINDOW, AudienceWindow));
	window = _tmp1_;
	_tmp2_ = audience_playback_manager_get_default ();
	_tmp3_ = self->priv->current_video;
	_tmp4_ = g_strdup (_tmp3_);
	_tmp5_ = g_new0 (gchar*, 1 + 1);
	_tmp5_[0] = _tmp4_;
	_tmp6_ = _tmp5_;
	_tmp6__length1 = 1;
	audience_playback_manager_append_to_playlist (_tmp2_, _tmp6_, (gint) 1);
	_tmp6_ = (_vala_array_free (_tmp6_, _tmp6__length1, (GDestroyNotify) g_free), NULL);
	_tmp7_ = window;
	audience_window_resume_last_videos (_tmp7_);
	_g_object_unref0 (window);
}

static void
__audience_welcome_page___lambda67__gtk_button_clicked (GtkButton* _sender,
                                                        gpointer self)
{
	_audience_welcome_page___lambda67_ ((AudienceWelcomePage*) self);
}

static void
_audience_welcome_page___lambda68_ (AudienceWelcomePage* self)
{
	AudienceWindow* window = NULL;
	GtkRoot* _tmp0_;
	AudienceWindow* _tmp1_;
	AudienceWindow* _tmp2_;
	_tmp0_ = gtk_widget_get_root ((GtkWidget*) self);
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, AUDIENCE_TYPE_WINDOW, AudienceWindow));
	window = _tmp1_;
	_tmp2_ = window;
	audience_window_show_library (_tmp2_);
	_g_object_unref0 (window);
}

static void
__audience_welcome_page___lambda68__gtk_button_clicked (GtkButton* _sender,
                                                        gpointer self)
{
	_audience_welcome_page___lambda68_ ((AudienceWelcomePage*) self);
}

static void
_audience_welcome_page_update_replay_button_g_settings_changed (GSettings* _sender,
                                                                const gchar* key,
                                                                gpointer self)
{
	audience_welcome_page_update_replay_button ((AudienceWelcomePage*) self);
}

static void
_audience_welcome_page_update_replay_title_g_settings_changed (GSettings* _sender,
                                                               const gchar* key,
                                                               gpointer self)
{
	audience_welcome_page_update_replay_title ((AudienceWelcomePage*) self);
}

static void
_audience_welcome_page___lambda69_ (Block12Data* _data12_)
{
	AudienceWelcomePage* self;
	GtkButton* _tmp0_;
	AudienceServicesLibraryManager* _tmp1_;
	GListStore* _tmp2_;
	GListStore* _tmp3_;
	self = _data12_->self;
	_tmp0_ = _data12_->library_button;
	_tmp1_ = _data12_->library_manager;
	_tmp2_ = audience_services_library_manager_get_library_items (_tmp1_);
	_tmp3_ = _tmp2_;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, g_list_model_get_n_items ((GListModel*) _tmp3_) > ((guint) 0));
}

static void
__audience_welcome_page___lambda69__g_list_model_items_changed (GListModel* _sender,
                                                                guint position,
                                                                guint removed,
                                                                guint added,
                                                                gpointer self)
{
	_audience_welcome_page___lambda69_ (self);
}

static GObject *
audience_welcome_page_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	AudienceWelcomePage * self;
	Block12Data* _data12_;
	GranitePlaceholder* placeholder = NULL;
	gchar* _tmp0_;
	GranitePlaceholder* _tmp1_ = NULL;
	GtkButton* open_button = NULL;
	GranitePlaceholder* _tmp2_;
	GThemedIcon* _tmp3_;
	GThemedIcon* _tmp4_;
	GtkButton* _tmp5_;
	GtkButton* _tmp6_;
	GranitePlaceholder* _tmp7_;
	GThemedIcon* _tmp8_;
	GThemedIcon* _tmp9_;
	GtkButton* _tmp10_;
	GranitePlaceholder* _tmp11_;
	GThemedIcon* _tmp12_;
	GThemedIcon* _tmp13_;
	GtkButton* _tmp14_;
	GtkButton* _tmp15_;
	GtkBox* box = NULL;
	GtkBox* _tmp16_;
	GtkBox* _tmp17_;
	AudienceHeaderBar* _tmp18_;
	AudienceHeaderBar* _tmp19_;
	GtkBox* _tmp20_;
	GranitePlaceholder* _tmp21_;
	GtkBox* _tmp22_;
	GtkBox* _tmp23_;
	GtkGrid* replay_button_grid = NULL;
	GtkButton* _tmp24_;
	GtkWidget* _tmp25_;
	GtkWidget* _tmp26_;
	GtkGrid* _tmp27_;
	GtkGrid* _tmp28_;
	GtkWidget* _tmp29_;
	GtkImage* _tmp30_;
	GtkImage* _tmp31_;
	GtkWidget* _tmp32_;
	GtkLabel* _tmp33_;
	GtkLabel* _tmp34_;
	GtkWidget* _tmp35_;
	GtkLabel* _tmp36_;
	AudienceServicesLibraryManager* _tmp37_;
	GtkButton* _tmp38_;
	AudienceServicesLibraryManager* _tmp39_;
	GListStore* _tmp40_;
	GListStore* _tmp41_;
	GtkButton* _tmp42_;
	GtkButton* _tmp43_;
	GtkButton* _tmp44_;
	GSettings* _tmp45_;
	GSettings* _tmp46_;
	AudienceServicesLibraryManager* _tmp47_;
	GListStore* _tmp48_;
	GListStore* _tmp49_;
	parent_class = G_OBJECT_CLASS (audience_welcome_page_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, AUDIENCE_TYPE_WELCOME_PAGE, AudienceWelcomePage);
	_data12_ = g_slice_new0 (Block12Data);
	_data12_->_ref_count_ = 1;
	_data12_->self = g_object_ref (self);
	_tmp0_ = g_strdup (_ ("Select a source to begin playing."));
	_tmp1_ = granite_placeholder_new (_ ("No Videos Open"));
	granite_placeholder_set_description (_tmp1_, _tmp0_);
	_g_free0 (_tmp0_);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp1_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp1_, TRUE);
	g_object_ref_sink (_tmp1_);
	placeholder = _tmp1_;
	_tmp2_ = placeholder;
	_tmp3_ = (GThemedIcon*) g_themed_icon_new ("document-open");
	_tmp4_ = _tmp3_;
	_tmp5_ = granite_placeholder_append_button (_tmp2_, (GIcon*) _tmp4_, _ ("Open file"), _ ("Open a saved file."));
	_tmp6_ = _tmp5_;
	_g_object_unref0 (_tmp4_);
	open_button = _tmp6_;
	_tmp7_ = placeholder;
	_tmp8_ = (GThemedIcon*) g_themed_icon_new ("media-playlist-repeat");
	_tmp9_ = _tmp8_;
	_tmp10_ = granite_placeholder_append_button (_tmp7_, (GIcon*) _tmp9_, _ ("Replay last video"), "");
	_g_object_unref0 (self->priv->replay_button);
	self->priv->replay_button = _tmp10_;
	_g_object_unref0 (_tmp9_);
	_tmp11_ = placeholder;
	_tmp12_ = (GThemedIcon*) g_themed_icon_new ("folder-videos");
	_tmp13_ = _tmp12_;
	_tmp14_ = granite_placeholder_append_button (_tmp11_, (GIcon*) _tmp13_, _ ("Browse Library"), _ ("Watch a movie from your library"));
	_tmp15_ = _tmp14_;
	_g_object_unref0 (_tmp13_);
	_data12_->library_button = _tmp15_;
	_tmp16_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp16_);
	box = _tmp16_;
	_tmp17_ = box;
	_tmp18_ = audience_header_bar_new ();
	g_object_ref_sink (_tmp18_);
	_tmp19_ = _tmp18_;
	gtk_box_append (_tmp17_, (GtkWidget*) _tmp19_);
	_g_object_unref0 (_tmp19_);
	_tmp20_ = box;
	_tmp21_ = placeholder;
	gtk_box_append (_tmp20_, (GtkWidget*) _tmp21_);
	_tmp22_ = box;
	gtk_widget_add_css_class ((GtkWidget*) _tmp22_, GRANITE_STYLE_CLASS_VIEW);
	_tmp23_ = box;
	adw_navigation_page_set_child ((AdwNavigationPage*) self, (GtkWidget*) _tmp23_);
	adw_navigation_page_set_title ((AdwNavigationPage*) self, _ ("Home"));
	_tmp24_ = self->priv->replay_button;
	_tmp25_ = gtk_button_get_child (_tmp24_);
	_tmp26_ = _tmp25_;
	_tmp27_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp26_, gtk_grid_get_type (), GtkGrid));
	replay_button_grid = _tmp27_;
	_tmp28_ = replay_button_grid;
	_tmp29_ = gtk_widget_get_first_child ((GtkWidget*) _tmp28_);
	_tmp30_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp29_, gtk_image_get_type (), GtkImage));
	_g_object_unref0 (self->priv->replay_button_image);
	self->priv->replay_button_image = _tmp30_;
	_tmp31_ = self->priv->replay_button_image;
	_tmp32_ = gtk_widget_get_next_sibling ((GtkWidget*) _tmp31_);
	_tmp33_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp32_, gtk_label_get_type (), GtkLabel));
	_g_object_unref0 (self->priv->replay_button_title);
	self->priv->replay_button_title = _tmp33_;
	_tmp34_ = self->priv->replay_button_title;
	_tmp35_ = gtk_widget_get_next_sibling ((GtkWidget*) _tmp34_);
	_tmp36_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp35_, gtk_label_get_type (), GtkLabel));
	_g_object_unref0 (self->priv->replay_button_description);
	self->priv->replay_button_description = _tmp36_;
	_tmp37_ = audience_services_library_manager_get_instance ();
	_data12_->library_manager = _tmp37_;
	_tmp38_ = _data12_->library_button;
	_tmp39_ = _data12_->library_manager;
	_tmp40_ = audience_services_library_manager_get_library_items (_tmp39_);
	_tmp41_ = _tmp40_;
	gtk_widget_set_visible ((GtkWidget*) _tmp38_, g_list_model_get_n_items ((GListModel*) _tmp41_) > ((guint) 0));
	audience_welcome_page_update_replay_button (self);
	audience_welcome_page_update_replay_title (self);
	_tmp42_ = open_button;
	g_signal_connect_object (_tmp42_, "clicked", (GCallback) __audience_welcome_page___lambda66__gtk_button_clicked, self, 0);
	_tmp43_ = self->priv->replay_button;
	g_signal_connect_object (_tmp43_, "clicked", (GCallback) __audience_welcome_page___lambda67__gtk_button_clicked, self, 0);
	_tmp44_ = _data12_->library_button;
	g_signal_connect_object (_tmp44_, "clicked", (GCallback) __audience_welcome_page___lambda68__gtk_button_clicked, self, 0);
	_tmp45_ = audience_settings;
	g_signal_connect_object (_tmp45_, "changed::current-video", (GCallback) _audience_welcome_page_update_replay_button_g_settings_changed, self, 0);
	_tmp46_ = audience_settings;
	g_signal_connect_object (_tmp46_, "changed::last-stopped", (GCallback) _audience_welcome_page_update_replay_title_g_settings_changed, self, 0);
	_tmp47_ = _data12_->library_manager;
	_tmp48_ = audience_services_library_manager_get_library_items (_tmp47_);
	_tmp49_ = _tmp48_;
	g_signal_connect_data ((GListModel*) _tmp49_, "items-changed", (GCallback) __audience_welcome_page___lambda69__g_list_model_items_changed, block12_data_ref (_data12_), (GClosureNotify) block12_data_unref, 0);
	_g_object_unref0 (replay_button_grid);
	_g_object_unref0 (box);
	_g_object_unref0 (open_button);
	_g_object_unref0 (placeholder);
	block12_data_unref (_data12_);
	_data12_ = NULL;
	return obj;
}

static void
audience_welcome_page_class_init (AudienceWelcomePageClass * klass,
                                  gpointer klass_data)
{
	audience_welcome_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &AudienceWelcomePage_private_offset);
	G_OBJECT_CLASS (klass)->constructor = audience_welcome_page_constructor;
	G_OBJECT_CLASS (klass)->finalize = audience_welcome_page_finalize;
}

static void
audience_welcome_page_instance_init (AudienceWelcomePage * self,
                                     gpointer klass)
{
	self->priv = audience_welcome_page_get_instance_private (self);
}

static void
audience_welcome_page_finalize (GObject * obj)
{
	AudienceWelcomePage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, AUDIENCE_TYPE_WELCOME_PAGE, AudienceWelcomePage);
	_g_free0 (self->priv->current_video);
	_g_object_unref0 (self->priv->replay_button);
	_g_object_unref0 (self->priv->replay_button_image);
	_g_object_unref0 (self->priv->replay_button_title);
	_g_object_unref0 (self->priv->replay_button_description);
	G_OBJECT_CLASS (audience_welcome_page_parent_class)->finalize (obj);
}

static GType
audience_welcome_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (AudienceWelcomePageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) audience_welcome_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AudienceWelcomePage), 0, (GInstanceInitFunc) audience_welcome_page_instance_init, NULL };
	GType audience_welcome_page_type_id;
	audience_welcome_page_type_id = g_type_register_static (adw_navigation_page_get_type (), "AudienceWelcomePage", &g_define_type_info, 0);
	AudienceWelcomePage_private_offset = g_type_add_instance_private (audience_welcome_page_type_id, sizeof (AudienceWelcomePagePrivate));
	return audience_welcome_page_type_id;
}

GType
audience_welcome_page_get_type (void)
{
	static volatile gsize audience_welcome_page_type_id__once = 0;
	if (g_once_init_enter (&audience_welcome_page_type_id__once)) {
		GType audience_welcome_page_type_id;
		audience_welcome_page_type_id = audience_welcome_page_get_type_once ();
		g_once_init_leave (&audience_welcome_page_type_id__once, audience_welcome_page_type_id);
	}
	return audience_welcome_page_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);
}

