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

/*
 * Copyright (C) 2025  Adrien Plazas <aplazas@gnome.org>
 *
 * 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 2
 * 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

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

#define CLOCKS_SOUND_CHOOSER_SILENT_SOUND_URI "resource:///org/gnome/clocks/sounds/silent"
#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 CLOCKS_TYPE_SOUND_CHOOSER (clocks_sound_chooser_get_type ())
#define CLOCKS_SOUND_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TYPE_SOUND_CHOOSER, ClocksSoundChooser))
#define CLOCKS_SOUND_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_TYPE_SOUND_CHOOSER, ClocksSoundChooserClass))
#define CLOCKS_IS_SOUND_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TYPE_SOUND_CHOOSER))
#define CLOCKS_IS_SOUND_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_TYPE_SOUND_CHOOSER))
#define CLOCKS_SOUND_CHOOSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_TYPE_SOUND_CHOOSER, ClocksSoundChooserClass))

typedef struct _ClocksSoundChooser ClocksSoundChooser;
typedef struct _ClocksSoundChooserClass ClocksSoundChooserClass;
typedef struct _ClocksSoundChooserPrivate ClocksSoundChooserPrivate;

#define CLOCKS_TYPE_SOUND (clocks_sound_get_type ())
#define CLOCKS_SOUND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TYPE_SOUND, ClocksSound))
#define CLOCKS_SOUND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_TYPE_SOUND, ClocksSoundClass))
#define CLOCKS_IS_SOUND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TYPE_SOUND))
#define CLOCKS_IS_SOUND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_TYPE_SOUND))
#define CLOCKS_SOUND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_TYPE_SOUND, ClocksSoundClass))

typedef struct _ClocksSound ClocksSound;
typedef struct _ClocksSoundClass ClocksSoundClass;

#define CLOCKS_TYPE_SOUND_CHOOSER_ROW (clocks_sound_chooser_row_get_type ())
#define CLOCKS_SOUND_CHOOSER_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TYPE_SOUND_CHOOSER_ROW, ClocksSoundChooserRow))
#define CLOCKS_SOUND_CHOOSER_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_TYPE_SOUND_CHOOSER_ROW, ClocksSoundChooserRowClass))
#define CLOCKS_IS_SOUND_CHOOSER_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TYPE_SOUND_CHOOSER_ROW))
#define CLOCKS_IS_SOUND_CHOOSER_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_TYPE_SOUND_CHOOSER_ROW))
#define CLOCKS_SOUND_CHOOSER_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_TYPE_SOUND_CHOOSER_ROW, ClocksSoundChooserRowClass))

typedef struct _ClocksSoundChooserRow ClocksSoundChooserRow;
typedef struct _ClocksSoundChooserRowClass ClocksSoundChooserRowClass;

#define CLOCKS_UTILS_TYPE_BELL (clocks_utils_bell_get_type ())
#define CLOCKS_UTILS_BELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_UTILS_TYPE_BELL, ClocksUtilsBell))
#define CLOCKS_UTILS_BELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_UTILS_TYPE_BELL, ClocksUtilsBellClass))
#define CLOCKS_UTILS_IS_BELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_UTILS_TYPE_BELL))
#define CLOCKS_UTILS_IS_BELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_UTILS_TYPE_BELL))
#define CLOCKS_UTILS_BELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_UTILS_TYPE_BELL, ClocksUtilsBellClass))

typedef struct _ClocksUtilsBell ClocksUtilsBell;
typedef struct _ClocksUtilsBellClass ClocksUtilsBellClass;
enum  {
	CLOCKS_SOUND_CHOOSER_0_PROPERTY,
	CLOCKS_SOUND_CHOOSER_MODEL_PROPERTY,
	CLOCKS_SOUND_CHOOSER_SILENT_SOUND_PROPERTY,
	CLOCKS_SOUND_CHOOSER_SOUND_PROPERTY,
	CLOCKS_SOUND_CHOOSER_NUM_PROPERTIES
};
static GParamSpec* clocks_sound_chooser_properties[CLOCKS_SOUND_CHOOSER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block7Data Block7Data;
enum  {
	CLOCKS_SOUND_CHOOSER_UPDATE_SIGNAL,
	CLOCKS_SOUND_CHOOSER_NUM_SIGNALS
};
static guint clocks_sound_chooser_signals[CLOCKS_SOUND_CHOOSER_NUM_SIGNALS] = {0};

struct _ClocksSoundChooser {
	AdwNavigationPage parent_instance;
	ClocksSoundChooserPrivate * priv;
};

struct _ClocksSoundChooserClass {
	AdwNavigationPageClass parent_class;
};

struct _ClocksSoundChooserPrivate {
	GListModel* _model;
	ClocksSound* _sound;
	ClocksSoundChooserRow* silent_row;
	AdwPreferencesGroup* sound_group;
	ClocksUtilsBell* bell;
};

struct _Block7Data {
	int _ref_count_;
	ClocksSoundChooser* self;
	ClocksSoundChooserRow* row;
};

static gint ClocksSoundChooser_private_offset;
static gpointer clocks_sound_chooser_parent_class = NULL;

VALA_EXTERN GType clocks_sound_chooser_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksSoundChooser, g_object_unref)
static void clocks_sound_chooser_update (ClocksSoundChooser* self);
VALA_EXTERN GType clocks_sound_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksSound, g_object_unref)
VALA_EXTERN GType clocks_sound_chooser_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksSoundChooserRow, g_object_unref)
VALA_EXTERN GType clocks_utils_bell_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksUtilsBell, g_object_unref)
static void clocks_sound_chooser_ring_bell (ClocksSoundChooser* self);
VALA_EXTERN ClocksSound* clocks_sound_chooser_get_sound (ClocksSoundChooser* self);
VALA_EXTERN const gchar* clocks_sound_get_uri (ClocksSound* self);
VALA_EXTERN ClocksUtilsBell* clocks_utils_bell_new (GFile* sound);
VALA_EXTERN ClocksUtilsBell* clocks_utils_bell_construct (GType object_type,
                                              GFile* sound);
VALA_EXTERN void clocks_utils_bell_ring (ClocksUtilsBell* self);
static gboolean clocks_sound_chooser_stop_bell (ClocksSoundChooser* self);
VALA_EXTERN void clocks_utils_bell_stop (ClocksUtilsBell* self);
static void clocks_sound_chooser_row_activated (ClocksSoundChooser* self,
                                         AdwActionRow* row);
VALA_EXTERN ClocksSound* clocks_sound_chooser_row_get_sound (ClocksSoundChooserRow* self);
VALA_EXTERN void clocks_sound_chooser_set_sound (ClocksSoundChooser* self,
                                     ClocksSound* value);
static void _clocks_sound_chooser_row_activated_adw_action_row_activated (AdwActionRow* _sender,
                                                                   gpointer self);
static void clocks_sound_chooser_update_row (ClocksSoundChooser* self,
                                      ClocksSoundChooserRow* row);
VALA_EXTERN void clocks_sound_chooser_row_set_selected (ClocksSoundChooserRow* self,
                                            gboolean value);
VALA_EXTERN void clocks_sound_chooser_row_set_ringing (ClocksSoundChooserRow* self,
                                           gboolean value);
VALA_EXTERN ClocksSoundChooser* clocks_sound_chooser_new (void);
VALA_EXTERN ClocksSoundChooser* clocks_sound_chooser_construct (GType object_type);
VALA_EXTERN GListModel* clocks_sound_chooser_get_model (ClocksSoundChooser* self);
static void clocks_sound_chooser_set_model (ClocksSoundChooser* self,
                                     GListModel* value);
VALA_EXTERN ClocksSound* clocks_sound_chooser_get_silent_sound (ClocksSoundChooser* self);
static GObject * clocks_sound_chooser_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties);
static void _clocks_sound_chooser___lambda74_ (ClocksSoundChooser* self);
static void __clocks_sound_chooser___lambda74__g_object_notify (GObject* _sender,
                                                         GParamSpec* pspec,
                                                         gpointer self);
static void _clocks_sound_chooser___lambda75_ (ClocksSoundChooser* self);
static void __clocks_sound_chooser___lambda75__g_object_notify (GObject* _sender,
                                                         GParamSpec* pspec,
                                                         gpointer self);
static void _clocks_sound_chooser___lambda76_ (ClocksSoundChooser* self);
static void __clocks_sound_chooser___lambda76__adw_navigation_page_hiding (AdwNavigationPage* _sender,
                                                                    gpointer self);
static GtkWidget* _clocks_sound_chooser___lambda77_ (ClocksSoundChooser* self,
                                              GObject* item);
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (void * _userdata_);
VALA_EXTERN ClocksSoundChooserRow* clocks_sound_chooser_row_new (ClocksSound* sound);
VALA_EXTERN ClocksSoundChooserRow* clocks_sound_chooser_row_construct (GType object_type,
                                                           ClocksSound* sound);
static void __lambda78_ (Block7Data* _data7_);
static void ___lambda78__clocks_sound_chooser_update (ClocksSoundChooser* _sender,
                                               gpointer self);
static GtkWidget* __clocks_sound_chooser___lambda77__gtk_list_box_create_widget_func (GObject* item,
                                                                               gpointer self);
static void clocks_sound_chooser_finalize (GObject * obj);
static GType clocks_sound_chooser_get_type_once (void);
static void _vala_clocks_sound_chooser_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);
static void _vala_clocks_sound_chooser_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec);

static inline gpointer
clocks_sound_chooser_get_instance_private (ClocksSoundChooser* self)
{
	return G_STRUCT_MEMBER_P (self, ClocksSoundChooser_private_offset);
}

static void
clocks_sound_chooser_ring_bell (ClocksSoundChooser* self)
{
	ClocksSound* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_sound;
	_tmp1_ = clocks_sound_get_uri (_tmp0_);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (_tmp2_, CLOCKS_SOUND_CHOOSER_SILENT_SOUND_URI) != 0) {
		ClocksSound* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		GFile* _tmp6_;
		GFile* _tmp7_;
		ClocksUtilsBell* _tmp8_;
		ClocksUtilsBell* _tmp9_;
		_tmp3_ = self->priv->_sound;
		_tmp4_ = clocks_sound_get_uri (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = g_file_new_for_uri (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = clocks_utils_bell_new (_tmp7_);
		_g_object_unref0 (self->priv->bell);
		self->priv->bell = _tmp8_;
		_g_object_unref0 (_tmp7_);
		_tmp9_ = self->priv->bell;
		clocks_utils_bell_ring (_tmp9_);
	}
}

static gboolean
clocks_sound_chooser_stop_bell (ClocksSoundChooser* self)
{
	ClocksUtilsBell* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->bell;
	if (_tmp0_ != NULL) {
		ClocksUtilsBell* _tmp1_;
		_tmp1_ = self->priv->bell;
		clocks_utils_bell_stop (_tmp1_);
		_g_object_unref0 (self->priv->bell);
		self->priv->bell = NULL;
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

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

static void
clocks_sound_chooser_row_activated (ClocksSoundChooser* self,
                                    AdwActionRow* row)
{
	ClocksSoundChooserRow* sound_chooser_row = NULL;
	ClocksSoundChooserRow* _tmp0_;
	ClocksSound* activated_sound = NULL;
	ClocksSoundChooserRow* _tmp1_;
	ClocksSound* _tmp2_;
	ClocksSound* _tmp3_;
	ClocksSound* _tmp4_;
	ClocksSound* _tmp5_;
	ClocksSound* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (row != NULL);
	_tmp0_ = _g_object_ref0 (CLOCKS_IS_SOUND_CHOOSER_ROW (row) ? ((ClocksSoundChooserRow*) row) : NULL);
	sound_chooser_row = _tmp0_;
	_tmp1_ = sound_chooser_row;
	_tmp2_ = clocks_sound_chooser_row_get_sound (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	activated_sound = _tmp4_;
	_tmp5_ = self->priv->_sound;
	_tmp6_ = activated_sound;
	if (_tmp5_ == _tmp6_) {
		if (!clocks_sound_chooser_stop_bell (self)) {
			clocks_sound_chooser_ring_bell (self);
		}
		g_signal_emit (self, clocks_sound_chooser_signals[CLOCKS_SOUND_CHOOSER_UPDATE_SIGNAL], 0);
	} else {
		ClocksSound* _tmp7_;
		g_object_freeze_notify ((GObject*) self);
		_tmp7_ = activated_sound;
		clocks_sound_chooser_set_sound (self, _tmp7_);
		clocks_sound_chooser_stop_bell (self);
		clocks_sound_chooser_ring_bell (self);
		g_object_thaw_notify ((GObject*) self);
	}
	_g_object_unref0 (activated_sound);
	_g_object_unref0 (sound_chooser_row);
}

static void
_clocks_sound_chooser_row_activated_adw_action_row_activated (AdwActionRow* _sender,
                                                              gpointer self)
{
	clocks_sound_chooser_row_activated ((ClocksSoundChooser*) self, _sender);
}

static void
clocks_sound_chooser_update_row (ClocksSoundChooser* self,
                                 ClocksSoundChooserRow* row)
{
	ClocksSound* _tmp0_;
	ClocksSound* _tmp1_;
	ClocksSound* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (row != NULL);
	_tmp0_ = clocks_sound_chooser_row_get_sound (row);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->_sound;
	if (_tmp1_ == _tmp2_) {
		ClocksUtilsBell* _tmp3_;
		clocks_sound_chooser_row_set_selected (row, TRUE);
		_tmp3_ = self->priv->bell;
		clocks_sound_chooser_row_set_ringing (row, _tmp3_ != NULL);
	} else {
		clocks_sound_chooser_row_set_selected (row, FALSE);
		clocks_sound_chooser_row_set_ringing (row, FALSE);
	}
}

ClocksSoundChooser*
clocks_sound_chooser_construct (GType object_type)
{
	ClocksSoundChooser * self = NULL;
	self = (ClocksSoundChooser*) g_object_new (object_type, NULL);
	return self;
}

ClocksSoundChooser*
clocks_sound_chooser_new (void)
{
	return clocks_sound_chooser_construct (CLOCKS_TYPE_SOUND_CHOOSER);
}

GListModel*
clocks_sound_chooser_get_model (ClocksSoundChooser* self)
{
	GListModel* result;
	GListModel* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_model;
	result = _tmp0_;
	return result;
}

static void
clocks_sound_chooser_set_model (ClocksSoundChooser* self,
                                GListModel* value)
{
	GListModel* old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_sound_chooser_get_model (self);
	if (old_value != value) {
		GListModel* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_model);
		self->priv->_model = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, clocks_sound_chooser_properties[CLOCKS_SOUND_CHOOSER_MODEL_PROPERTY]);
	}
}

ClocksSound*
clocks_sound_chooser_get_silent_sound (ClocksSoundChooser* self)
{
	ClocksSound* result;
	ClocksSoundChooserRow* _tmp0_;
	ClocksSound* _tmp1_;
	ClocksSound* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->silent_row;
	_tmp1_ = clocks_sound_chooser_row_get_sound (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

ClocksSound*
clocks_sound_chooser_get_sound (ClocksSoundChooser* self)
{
	ClocksSound* result;
	ClocksSound* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_sound;
	result = _tmp0_;
	return result;
}

void
clocks_sound_chooser_set_sound (ClocksSoundChooser* self,
                                ClocksSound* value)
{
	ClocksSound* old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_sound_chooser_get_sound (self);
	if (old_value != value) {
		ClocksSound* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_sound);
		self->priv->_sound = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, clocks_sound_chooser_properties[CLOCKS_SOUND_CHOOSER_SOUND_PROPERTY]);
	}
}

static void
clocks_sound_chooser_real_update (ClocksSoundChooser* self)
{
	ClocksSoundChooserRow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->silent_row;
	clocks_sound_chooser_update_row (self, _tmp0_);
}

static void
_clocks_sound_chooser___lambda74_ (ClocksSoundChooser* self)
{
	g_signal_emit (self, clocks_sound_chooser_signals[CLOCKS_SOUND_CHOOSER_UPDATE_SIGNAL], 0);
}

static void
__clocks_sound_chooser___lambda74__g_object_notify (GObject* _sender,
                                                    GParamSpec* pspec,
                                                    gpointer self)
{
	_clocks_sound_chooser___lambda74_ ((ClocksSoundChooser*) self);
}

static void
_clocks_sound_chooser___lambda75_ (ClocksSoundChooser* self)
{
	clocks_sound_chooser_stop_bell (self);
	g_signal_emit (self, clocks_sound_chooser_signals[CLOCKS_SOUND_CHOOSER_UPDATE_SIGNAL], 0);
}

static void
__clocks_sound_chooser___lambda75__g_object_notify (GObject* _sender,
                                                    GParamSpec* pspec,
                                                    gpointer self)
{
	_clocks_sound_chooser___lambda75_ ((ClocksSoundChooser*) self);
}

static void
_clocks_sound_chooser___lambda76_ (ClocksSoundChooser* self)
{
	clocks_sound_chooser_stop_bell (self);
	g_signal_emit (self, clocks_sound_chooser_signals[CLOCKS_SOUND_CHOOSER_UPDATE_SIGNAL], 0);
}

static void
__clocks_sound_chooser___lambda76__adw_navigation_page_hiding (AdwNavigationPage* _sender,
                                                               gpointer self)
{
	_clocks_sound_chooser___lambda76_ ((ClocksSoundChooser*) self);
}

static Block7Data*
block7_data_ref (Block7Data* _data7_)
{
	g_atomic_int_inc (&_data7_->_ref_count_);
	return _data7_;
}

static void
block7_data_unref (void * _userdata_)
{
	Block7Data* _data7_;
	_data7_ = (Block7Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
		ClocksSoundChooser* self;
		self = _data7_->self;
		_g_object_unref0 (_data7_->row);
		_g_object_unref0 (self);
		g_slice_free (Block7Data, _data7_);
	}
}

static void
__lambda78_ (Block7Data* _data7_)
{
	ClocksSoundChooser* self;
	ClocksSoundChooserRow* _tmp0_;
	self = _data7_->self;
	_tmp0_ = _data7_->row;
	clocks_sound_chooser_update_row (self, _tmp0_);
}

static void
___lambda78__clocks_sound_chooser_update (ClocksSoundChooser* _sender,
                                          gpointer self)
{
	__lambda78_ (self);
}

static GtkWidget*
_clocks_sound_chooser___lambda77_ (ClocksSoundChooser* self,
                                   GObject* item)
{
	Block7Data* _data7_;
	ClocksSoundChooserRow* _tmp0_;
	ClocksSoundChooserRow* _tmp1_;
	ClocksSoundChooserRow* _tmp2_;
	GtkWidget* _tmp3_;
	GtkWidget* result;
	g_return_val_if_fail (item != NULL, NULL);
	_data7_ = g_slice_new0 (Block7Data);
	_data7_->_ref_count_ = 1;
	_data7_->self = g_object_ref (self);
	_tmp0_ = clocks_sound_chooser_row_new (G_TYPE_CHECK_INSTANCE_CAST (item, CLOCKS_TYPE_SOUND, ClocksSound));
	g_object_ref_sink (_tmp0_);
	_data7_->row = _tmp0_;
	_tmp1_ = _data7_->row;
	g_signal_connect_object ((AdwActionRow*) _tmp1_, "activated", (GCallback) _clocks_sound_chooser_row_activated_adw_action_row_activated, self, 0);
	g_signal_connect_data (self, "update", (GCallback) ___lambda78__clocks_sound_chooser_update, block7_data_ref (_data7_), (GClosureNotify) block7_data_unref, 0);
	_tmp2_ = _data7_->row;
	_tmp3_ = _g_object_ref0 ((GtkWidget*) _tmp2_);
	result = _tmp3_;
	block7_data_unref (_data7_);
	_data7_ = NULL;
	return result;
}

static GtkWidget*
__clocks_sound_chooser___lambda77__gtk_list_box_create_widget_func (GObject* item,
                                                                    gpointer self)
{
	GtkWidget* result;
	result = _clocks_sound_chooser___lambda77_ ((ClocksSoundChooser*) self, item);
	return result;
}

static GObject *
clocks_sound_chooser_constructor (GType type,
                                  guint n_construct_properties,
                                  GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ClocksSoundChooser * self;
	AdwPreferencesGroup* _tmp0_;
	GListModel* _tmp1_;
	parent_class = G_OBJECT_CLASS (clocks_sound_chooser_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_TYPE_SOUND_CHOOSER, ClocksSoundChooser);
	g_signal_connect_object ((GObject*) self, "notify::sound", (GCallback) __clocks_sound_chooser___lambda74__g_object_notify, self, 0);
	g_signal_connect_object ((GObject*) self, "notify::parent", (GCallback) __clocks_sound_chooser___lambda75__g_object_notify, self, 0);
	g_signal_connect_object ((AdwNavigationPage*) self, "hiding", (GCallback) __clocks_sound_chooser___lambda76__adw_navigation_page_hiding, self, 0);
	_tmp0_ = self->priv->sound_group;
	_tmp1_ = self->priv->_model;
	adw_preferences_group_bind_model (_tmp0_, _tmp1_, __clocks_sound_chooser___lambda77__gtk_list_box_create_widget_func, g_object_ref (self), g_object_unref);
	g_signal_emit (self, clocks_sound_chooser_signals[CLOCKS_SOUND_CHOOSER_UPDATE_SIGNAL], 0);
	return obj;
}

static void
clocks_sound_chooser_class_init (ClocksSoundChooserClass * klass,
                                 gpointer klass_data)
{
	clocks_sound_chooser_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ClocksSoundChooser_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_clocks_sound_chooser_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_clocks_sound_chooser_set_property;
	G_OBJECT_CLASS (klass)->constructor = clocks_sound_chooser_constructor;
	G_OBJECT_CLASS (klass)->finalize = clocks_sound_chooser_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_SOUND_CHOOSER_MODEL_PROPERTY, clocks_sound_chooser_properties[CLOCKS_SOUND_CHOOSER_MODEL_PROPERTY] = g_param_spec_object ("model", "model", "model", g_list_model_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_SOUND_CHOOSER_SILENT_SOUND_PROPERTY, clocks_sound_chooser_properties[CLOCKS_SOUND_CHOOSER_SILENT_SOUND_PROPERTY] = g_param_spec_object ("silent-sound", "silent-sound", "silent-sound", CLOCKS_TYPE_SOUND, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_SOUND_CHOOSER_SOUND_PROPERTY, clocks_sound_chooser_properties[CLOCKS_SOUND_CHOOSER_SOUND_PROPERTY] = g_param_spec_object ("sound", "sound", "sound", CLOCKS_TYPE_SOUND, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/clocks/ui/sound-chooser.ui");
	clocks_sound_chooser_signals[CLOCKS_SOUND_CHOOSER_UPDATE_SIGNAL] = g_signal_new_class_handler ("update", CLOCKS_TYPE_SOUND_CHOOSER, G_SIGNAL_RUN_LAST, (GCallback) clocks_sound_chooser_real_update, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "silent_row", FALSE, ClocksSoundChooser_private_offset + G_STRUCT_OFFSET (ClocksSoundChooserPrivate, silent_row));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "sound_group", FALSE, ClocksSoundChooser_private_offset + G_STRUCT_OFFSET (ClocksSoundChooserPrivate, sound_group));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "row_activated", G_CALLBACK(_clocks_sound_chooser_row_activated_adw_action_row_activated));
	g_type_ensure (CLOCKS_TYPE_SOUND_CHOOSER_ROW);
}

static void
clocks_sound_chooser_instance_init (ClocksSoundChooser * self,
                                    gpointer klass)
{
	self->priv = clocks_sound_chooser_get_instance_private (self);
	g_type_ensure (CLOCKS_TYPE_SOUND_CHOOSER_ROW);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
clocks_sound_chooser_finalize (GObject * obj)
{
	ClocksSoundChooser * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_TYPE_SOUND_CHOOSER, ClocksSoundChooser);
	_g_object_unref0 (self->priv->_model);
	_g_object_unref0 (self->priv->_sound);
	_g_object_unref0 (self->priv->bell);
	G_OBJECT_CLASS (clocks_sound_chooser_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
clocks_sound_chooser_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ClocksSoundChooserClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) clocks_sound_chooser_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ClocksSoundChooser), 0, (GInstanceInitFunc) clocks_sound_chooser_instance_init, NULL };
	GType clocks_sound_chooser_type_id;
	clocks_sound_chooser_type_id = g_type_register_static (adw_navigation_page_get_type (), "ClocksSoundChooser", &g_define_type_info, 0);
	ClocksSoundChooser_private_offset = g_type_add_instance_private (clocks_sound_chooser_type_id, sizeof (ClocksSoundChooserPrivate));
	return clocks_sound_chooser_type_id;
}

GType
clocks_sound_chooser_get_type (void)
{
	static gsize clocks_sound_chooser_type_id__once = 0;
	if (g_once_init_enter (&clocks_sound_chooser_type_id__once)) {
		GType clocks_sound_chooser_type_id;
		clocks_sound_chooser_type_id = clocks_sound_chooser_get_type_once ();
		g_once_init_leave (&clocks_sound_chooser_type_id__once, clocks_sound_chooser_type_id);
	}
	return clocks_sound_chooser_type_id__once;
}

static void
_vala_clocks_sound_chooser_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	ClocksSoundChooser * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_TYPE_SOUND_CHOOSER, ClocksSoundChooser);
	switch (property_id) {
		case CLOCKS_SOUND_CHOOSER_MODEL_PROPERTY:
		g_value_set_object (value, clocks_sound_chooser_get_model (self));
		break;
		case CLOCKS_SOUND_CHOOSER_SILENT_SOUND_PROPERTY:
		g_value_set_object (value, clocks_sound_chooser_get_silent_sound (self));
		break;
		case CLOCKS_SOUND_CHOOSER_SOUND_PROPERTY:
		g_value_set_object (value, clocks_sound_chooser_get_sound (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_clocks_sound_chooser_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec)
{
	ClocksSoundChooser * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_TYPE_SOUND_CHOOSER, ClocksSoundChooser);
	switch (property_id) {
		case CLOCKS_SOUND_CHOOSER_MODEL_PROPERTY:
		clocks_sound_chooser_set_model (self, g_value_get_object (value));
		break;
		case CLOCKS_SOUND_CHOOSER_SOUND_PROPERTY:
		clocks_sound_chooser_set_sound (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

