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

/* -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-*/
/*-
 * Copyright (c) 2017 elementary LLC. (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/>.
 *
 * Authored by: David Hewitt <davidmhewitt@gmail.com>
 */

#include "io.elementary.photos.h"
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <gee.h>
#include <glib/gi18n-lib.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

enum  {
	TRANSITION_EFFECT_SELECTOR_0_PROPERTY,
	TRANSITION_EFFECT_SELECTOR_NUM_PROPERTIES
};
static GParamSpec* transition_effect_selector_properties[TRANSITION_EFFECT_SELECTOR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _transition_effects_manager_unref0(var) ((var == NULL) ? NULL : (var = (transition_effects_manager_unref (var), NULL)))

#define TRANSITION_EFFECT_SELECTOR_TYPE_LIST_STORE_ITEM (transition_effect_selector_list_store_item_get_type ())
#define TRANSITION_EFFECT_SELECTOR_LIST_STORE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRANSITION_EFFECT_SELECTOR_TYPE_LIST_STORE_ITEM, TransitionEffectSelectorListStoreItem))
#define TRANSITION_EFFECT_SELECTOR_LIST_STORE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRANSITION_EFFECT_SELECTOR_TYPE_LIST_STORE_ITEM, TransitionEffectSelectorListStoreItemClass))
#define TRANSITION_EFFECT_SELECTOR_IS_LIST_STORE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRANSITION_EFFECT_SELECTOR_TYPE_LIST_STORE_ITEM))
#define TRANSITION_EFFECT_SELECTOR_IS_LIST_STORE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRANSITION_EFFECT_SELECTOR_TYPE_LIST_STORE_ITEM))
#define TRANSITION_EFFECT_SELECTOR_LIST_STORE_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRANSITION_EFFECT_SELECTOR_TYPE_LIST_STORE_ITEM, TransitionEffectSelectorListStoreItemClass))

typedef struct _TransitionEffectSelectorListStoreItem TransitionEffectSelectorListStoreItem;
typedef struct _TransitionEffectSelectorListStoreItemClass TransitionEffectSelectorListStoreItemClass;
typedef struct _TransitionEffectSelectorListStoreItemPrivate TransitionEffectSelectorListStoreItemPrivate;
enum  {
	TRANSITION_EFFECT_SELECTOR_LIST_STORE_ITEM_0_PROPERTY,
	TRANSITION_EFFECT_SELECTOR_LIST_STORE_ITEM_NUM_PROPERTIES
};
static GParamSpec* transition_effect_selector_list_store_item_properties[TRANSITION_EFFECT_SELECTOR_LIST_STORE_ITEM_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

#define TRANSITION_EFFECT_SELECTOR_TYPE_LAYOUT_ROW (transition_effect_selector_layout_row_get_type ())
#define TRANSITION_EFFECT_SELECTOR_LAYOUT_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRANSITION_EFFECT_SELECTOR_TYPE_LAYOUT_ROW, TransitionEffectSelectorLayoutRow))
#define TRANSITION_EFFECT_SELECTOR_LAYOUT_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRANSITION_EFFECT_SELECTOR_TYPE_LAYOUT_ROW, TransitionEffectSelectorLayoutRowClass))
#define TRANSITION_EFFECT_SELECTOR_IS_LAYOUT_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRANSITION_EFFECT_SELECTOR_TYPE_LAYOUT_ROW))
#define TRANSITION_EFFECT_SELECTOR_IS_LAYOUT_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRANSITION_EFFECT_SELECTOR_TYPE_LAYOUT_ROW))
#define TRANSITION_EFFECT_SELECTOR_LAYOUT_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRANSITION_EFFECT_SELECTOR_TYPE_LAYOUT_ROW, TransitionEffectSelectorLayoutRowClass))

typedef struct _TransitionEffectSelectorLayoutRow TransitionEffectSelectorLayoutRow;
typedef struct _TransitionEffectSelectorLayoutRowClass TransitionEffectSelectorLayoutRowClass;
typedef struct _TransitionEffectSelectorLayoutRowPrivate TransitionEffectSelectorLayoutRowPrivate;
enum  {
	TRANSITION_EFFECT_SELECTOR_LAYOUT_ROW_0_PROPERTY,
	TRANSITION_EFFECT_SELECTOR_LAYOUT_ROW_NUM_PROPERTIES
};
static GParamSpec* transition_effect_selector_layout_row_properties[TRANSITION_EFFECT_SELECTOR_LAYOUT_ROW_NUM_PROPERTIES];
typedef struct _Block30Data Block30Data;

struct _TransitionEffectSelectorPrivate {
	GtkListBox* effect_list_box;
	GSettings* slideshow_settings;
	TransitionEffectsManager* effect_manager;
};

struct _TransitionEffectSelectorListStoreItem {
	GObject parent_instance;
	TransitionEffectSelectorListStoreItemPrivate * priv;
	gchar* id;
	gchar* name;
};

struct _TransitionEffectSelectorListStoreItemClass {
	GObjectClass parent_class;
};

struct _TransitionEffectSelectorLayoutRow {
	GtkListBoxRow parent_instance;
	TransitionEffectSelectorLayoutRowPrivate * priv;
};

struct _TransitionEffectSelectorLayoutRowClass {
	GtkListBoxRowClass parent_class;
};

struct _Block30Data {
	int _ref_count_;
	TransitionEffectSelector* self;
	GListStore* effect_list_store;
	GtkLabel* effect_label;
	GtkToggleButton* button;
	GtkPopover* popover;
};

static gint TransitionEffectSelector_private_offset;
static gpointer transition_effect_selector_parent_class = NULL;
static gpointer transition_effect_selector_list_store_item_parent_class = NULL;
static gpointer transition_effect_selector_layout_row_parent_class = NULL;

static GType transition_effect_selector_list_store_item_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static TransitionEffectSelectorListStoreItem* transition_effect_selector_list_store_item_new (const gchar* id,
                                                                                       const gchar* name);
static TransitionEffectSelectorListStoreItem* transition_effect_selector_list_store_item_construct (GType object_type,
                                                                                             const gchar* id,
                                                                                             const gchar* name);
static void transition_effect_selector_list_store_item_finalize (GObject * obj);
static GType transition_effect_selector_list_store_item_get_type_once (void);
static GType transition_effect_selector_layout_row_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static TransitionEffectSelectorLayoutRow* transition_effect_selector_layout_row_new (const gchar* name);
static TransitionEffectSelectorLayoutRow* transition_effect_selector_layout_row_construct (GType object_type,
                                                                                    const gchar* name);
static GType transition_effect_selector_layout_row_get_type_once (void);
static GObject * transition_effect_selector_constructor (GType type,
                                                  guint n_construct_properties,
                                                  GObjectConstructParam * construct_properties);
static Block30Data* block30_data_ref (Block30Data* _data30_);
static void block30_data_unref (void * _userdata_);
static gint _transition_effect_selector___lambda33_ (TransitionEffectSelector* self,
                                              GObject* a,
                                              GObject* b);
static gint __transition_effect_selector___lambda33__gcompare_data_func (gconstpointer a,
                                                                  gconstpointer b,
                                                                  gpointer self);
static GtkWidget* _transition_effect_selector___lambda34_ (TransitionEffectSelector* self,
                                                    GObject* item);
static GtkWidget* __transition_effect_selector___lambda34__gtk_list_box_create_widget_func (GObject* item,
                                                                                     gpointer self);
static void _transition_effect_selector___lambda35_ (Block30Data* _data30_,
                                              GtkListBoxRow* row);
static void __transition_effect_selector___lambda35__gtk_list_box_row_activated (GtkListBox* _sender,
                                                                          GtkListBoxRow* row,
                                                                          gpointer self);
static void _transition_effect_selector___lambda36_ (Block30Data* _data30_);
static void __transition_effect_selector___lambda36__gtk_popover_closed (GtkPopover* _sender,
                                                                  gpointer self);
static void _transition_effect_selector___lambda37_ (Block30Data* _data30_);
static void __transition_effect_selector___lambda37__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                         gpointer self);
static void transition_effect_selector_finalize (GObject * obj);
static GType transition_effect_selector_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
transition_effect_selector_get_instance_private (TransitionEffectSelector* self)
{
	return G_STRUCT_MEMBER_P (self, TransitionEffectSelector_private_offset);
}

TransitionEffectSelector*
transition_effect_selector_construct (GType object_type)
{
	TransitionEffectSelector * self = NULL;
	self = (TransitionEffectSelector*) g_object_new (object_type, NULL);
	return self;
}

TransitionEffectSelector*
transition_effect_selector_new (void)
{
	return transition_effect_selector_construct (TYPE_TRANSITION_EFFECT_SELECTOR);
}

static TransitionEffectSelectorListStoreItem*
transition_effect_selector_list_store_item_construct (GType object_type,
                                                      const gchar* id,
                                                      const gchar* name)
{
	TransitionEffectSelectorListStoreItem * self = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (id != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	self = (TransitionEffectSelectorListStoreItem*) g_object_new (object_type, NULL);
	_tmp0_ = g_strdup (id);
	_g_free0 (self->id);
	self->id = _tmp0_;
	_tmp1_ = g_strdup (name);
	_g_free0 (self->name);
	self->name = _tmp1_;
	return self;
}

static TransitionEffectSelectorListStoreItem*
transition_effect_selector_list_store_item_new (const gchar* id,
                                                const gchar* name)
{
	return transition_effect_selector_list_store_item_construct (TRANSITION_EFFECT_SELECTOR_TYPE_LIST_STORE_ITEM, id, name);
}

static void
transition_effect_selector_list_store_item_class_init (TransitionEffectSelectorListStoreItemClass * klass,
                                                       gpointer klass_data)
{
	transition_effect_selector_list_store_item_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = transition_effect_selector_list_store_item_finalize;
}

static void
transition_effect_selector_list_store_item_instance_init (TransitionEffectSelectorListStoreItem * self,
                                                          gpointer klass)
{
}

static void
transition_effect_selector_list_store_item_finalize (GObject * obj)
{
	TransitionEffectSelectorListStoreItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TRANSITION_EFFECT_SELECTOR_TYPE_LIST_STORE_ITEM, TransitionEffectSelectorListStoreItem);
	_g_free0 (self->id);
	_g_free0 (self->name);
	G_OBJECT_CLASS (transition_effect_selector_list_store_item_parent_class)->finalize (obj);
}

static GType
transition_effect_selector_list_store_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TransitionEffectSelectorListStoreItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) transition_effect_selector_list_store_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TransitionEffectSelectorListStoreItem), 0, (GInstanceInitFunc) transition_effect_selector_list_store_item_instance_init, NULL };
	GType transition_effect_selector_list_store_item_type_id;
	transition_effect_selector_list_store_item_type_id = g_type_register_static (G_TYPE_OBJECT, "TransitionEffectSelectorListStoreItem", &g_define_type_info, 0);
	return transition_effect_selector_list_store_item_type_id;
}

static GType
transition_effect_selector_list_store_item_get_type (void)
{
	static volatile gsize transition_effect_selector_list_store_item_type_id__once = 0;
	if (g_once_init_enter (&transition_effect_selector_list_store_item_type_id__once)) {
		GType transition_effect_selector_list_store_item_type_id;
		transition_effect_selector_list_store_item_type_id = transition_effect_selector_list_store_item_get_type_once ();
		g_once_init_leave (&transition_effect_selector_list_store_item_type_id__once, transition_effect_selector_list_store_item_type_id);
	}
	return transition_effect_selector_list_store_item_type_id__once;
}

static TransitionEffectSelectorLayoutRow*
transition_effect_selector_layout_row_construct (GType object_type,
                                                 const gchar* name)
{
	TransitionEffectSelectorLayoutRow * self = NULL;
	GtkLabel* label = NULL;
	GtkLabel* _tmp0_;
	GtkStyleContext* _tmp1_;
	g_return_val_if_fail (name != NULL, NULL);
	self = (TransitionEffectSelectorLayoutRow*) g_object_new (object_type, NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new (name);
	g_object_ref_sink (_tmp0_);
	label = _tmp0_;
	gtk_label_set_xalign (label, (gfloat) 0);
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) label);
	_tmp1_ = gtk_widget_get_style_context ((GtkWidget*) self);
	gtk_style_context_add_class (_tmp1_, GTK_STYLE_CLASS_MENUITEM);
	_g_object_unref0 (label);
	return self;
}

static TransitionEffectSelectorLayoutRow*
transition_effect_selector_layout_row_new (const gchar* name)
{
	return transition_effect_selector_layout_row_construct (TRANSITION_EFFECT_SELECTOR_TYPE_LAYOUT_ROW, name);
}

static void
transition_effect_selector_layout_row_class_init (TransitionEffectSelectorLayoutRowClass * klass,
                                                  gpointer klass_data)
{
	transition_effect_selector_layout_row_parent_class = g_type_class_peek_parent (klass);
}

static void
transition_effect_selector_layout_row_instance_init (TransitionEffectSelectorLayoutRow * self,
                                                     gpointer klass)
{
}

static GType
transition_effect_selector_layout_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TransitionEffectSelectorLayoutRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) transition_effect_selector_layout_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TransitionEffectSelectorLayoutRow), 0, (GInstanceInitFunc) transition_effect_selector_layout_row_instance_init, NULL };
	GType transition_effect_selector_layout_row_type_id;
	transition_effect_selector_layout_row_type_id = g_type_register_static (gtk_list_box_row_get_type (), "TransitionEffectSelectorLayoutRow", &g_define_type_info, 0);
	return transition_effect_selector_layout_row_type_id;
}

static GType
transition_effect_selector_layout_row_get_type (void)
{
	static volatile gsize transition_effect_selector_layout_row_type_id__once = 0;
	if (g_once_init_enter (&transition_effect_selector_layout_row_type_id__once)) {
		GType transition_effect_selector_layout_row_type_id;
		transition_effect_selector_layout_row_type_id = transition_effect_selector_layout_row_get_type_once ();
		g_once_init_leave (&transition_effect_selector_layout_row_type_id__once, transition_effect_selector_layout_row_type_id);
	}
	return transition_effect_selector_layout_row_type_id__once;
}

static Block30Data*
block30_data_ref (Block30Data* _data30_)
{
	g_atomic_int_inc (&_data30_->_ref_count_);
	return _data30_;
}

static void
block30_data_unref (void * _userdata_)
{
	Block30Data* _data30_;
	_data30_ = (Block30Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data30_->_ref_count_)) {
		TransitionEffectSelector* self;
		self = _data30_->self;
		_g_object_unref0 (_data30_->popover);
		_g_object_unref0 (_data30_->button);
		_g_object_unref0 (_data30_->effect_label);
		_g_object_unref0 (_data30_->effect_list_store);
		_g_object_unref0 (self);
		g_slice_free (Block30Data, _data30_);
	}
}

static gint
_transition_effect_selector___lambda33_ (TransitionEffectSelector* self,
                                         GObject* a,
                                         GObject* b)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gint result;
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	_tmp0_ = G_TYPE_CHECK_INSTANCE_CAST (a, TRANSITION_EFFECT_SELECTOR_TYPE_LIST_STORE_ITEM, TransitionEffectSelectorListStoreItem)->id;
	if (g_strcmp0 (_tmp0_, TRANSITION_EFFECTS_MANAGER_NULL_EFFECT_ID) == 0) {
		result = -1;
		return result;
	}
	_tmp1_ = G_TYPE_CHECK_INSTANCE_CAST (b, TRANSITION_EFFECT_SELECTOR_TYPE_LIST_STORE_ITEM, TransitionEffectSelectorListStoreItem)->id;
	if (g_strcmp0 (_tmp1_, TRANSITION_EFFECTS_MANAGER_NULL_EFFECT_ID) == 0) {
		result = 1;
		return result;
	}
	_tmp2_ = G_TYPE_CHECK_INSTANCE_CAST (a, TRANSITION_EFFECT_SELECTOR_TYPE_LIST_STORE_ITEM, TransitionEffectSelectorListStoreItem)->name;
	_tmp3_ = G_TYPE_CHECK_INSTANCE_CAST (b, TRANSITION_EFFECT_SELECTOR_TYPE_LIST_STORE_ITEM, TransitionEffectSelectorListStoreItem)->name;
	result = g_utf8_collate (_tmp2_, _tmp3_);
	return result;
}

static gint
__transition_effect_selector___lambda33__gcompare_data_func (gconstpointer a,
                                                             gconstpointer b,
                                                             gpointer self)
{
	gint result;
	result = _transition_effect_selector___lambda33_ ((TransitionEffectSelector*) self, (GObject*) a, (GObject*) b);
	return result;
}

static GtkWidget*
_transition_effect_selector___lambda34_ (TransitionEffectSelector* self,
                                         GObject* item)
{
	const gchar* _tmp0_;
	TransitionEffectSelectorLayoutRow* _tmp1_;
	GtkWidget* result;
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = G_TYPE_CHECK_INSTANCE_CAST (item, TRANSITION_EFFECT_SELECTOR_TYPE_LIST_STORE_ITEM, TransitionEffectSelectorListStoreItem)->name;
	_tmp1_ = transition_effect_selector_layout_row_new (_tmp0_);
	g_object_ref_sink (_tmp1_);
	result = (GtkWidget*) _tmp1_;
	return result;
}

static GtkWidget*
__transition_effect_selector___lambda34__gtk_list_box_create_widget_func (GObject* item,
                                                                          gpointer self)
{
	GtkWidget* result;
	result = _transition_effect_selector___lambda34_ ((TransitionEffectSelector*) self, item);
	return result;
}

static void
_transition_effect_selector___lambda35_ (Block30Data* _data30_,
                                         GtkListBoxRow* row)
{
	TransitionEffectSelector* self;
	TransitionEffectSelectorListStoreItem* item = NULL;
	GListStore* _tmp0_;
	GObject* _tmp1_;
	TransitionEffectSelectorListStoreItem* _tmp2_;
	TransitionEffectSelectorListStoreItem* _tmp3_;
	GtkPopover* _tmp10_;
	self = _data30_->self;
	g_return_if_fail (row != NULL);
	_tmp0_ = _data30_->effect_list_store;
	_tmp1_ = g_list_model_get_item ((GListModel*) _tmp0_, (guint) gtk_list_box_row_get_index (row));
	_tmp2_ = TRANSITION_EFFECT_SELECTOR_IS_LIST_STORE_ITEM (_tmp1_) ? ((TransitionEffectSelectorListStoreItem*) _tmp1_) : NULL;
	if (_tmp2_ == NULL) {
		_g_object_unref0 (_tmp1_);
	}
	item = _tmp2_;
	_tmp3_ = item;
	if (_tmp3_ != NULL) {
		GtkLabel* _tmp4_;
		TransitionEffectSelectorListStoreItem* _tmp5_;
		const gchar* _tmp6_;
		GSettings* _tmp7_;
		TransitionEffectSelectorListStoreItem* _tmp8_;
		const gchar* _tmp9_;
		_tmp4_ = _data30_->effect_label;
		_tmp5_ = item;
		_tmp6_ = _tmp5_->name;
		gtk_label_set_label (_tmp4_, _tmp6_);
		_tmp7_ = self->priv->slideshow_settings;
		_tmp8_ = item;
		_tmp9_ = _tmp8_->id;
		g_settings_set_string (_tmp7_, "transition-effect-id", _tmp9_);
	}
	_tmp10_ = _data30_->popover;
	gtk_widget_hide ((GtkWidget*) _tmp10_);
	_g_object_unref0 (item);
}

static void
__transition_effect_selector___lambda35__gtk_list_box_row_activated (GtkListBox* _sender,
                                                                     GtkListBoxRow* row,
                                                                     gpointer self)
{
	_transition_effect_selector___lambda35_ (self, row);
}

static void
_transition_effect_selector___lambda36_ (Block30Data* _data30_)
{
	TransitionEffectSelector* self;
	FullscreenWindow* _tmp0_;
	FullscreenWindow* _tmp1_;
	GtkToggleButton* _tmp2_;
	self = _data30_->self;
	_tmp0_ = app_window_get_fullscreen ();
	_tmp1_ = _tmp0_;
	fullscreen_window_set_auto_dismiss_toolbar (_tmp1_, TRUE);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = _data30_->button;
	gtk_toggle_button_set_active (_tmp2_, FALSE);
}

static void
__transition_effect_selector___lambda36__gtk_popover_closed (GtkPopover* _sender,
                                                             gpointer self)
{
	_transition_effect_selector___lambda36_ (self);
}

static void
_transition_effect_selector___lambda37_ (Block30Data* _data30_)
{
	TransitionEffectSelector* self;
	GtkToggleButton* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data30_->self;
	_tmp0_ = _data30_->button;
	_tmp1_ = gtk_toggle_button_get_active (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		GtkPopover* _tmp3_;
		GtkToggleButton* _tmp4_;
		GtkPopover* _tmp5_;
		FullscreenWindow* _tmp6_;
		FullscreenWindow* _tmp7_;
		_tmp3_ = _data30_->popover;
		_tmp4_ = _data30_->button;
		gtk_popover_set_relative_to (_tmp3_, (GtkWidget*) _tmp4_);
		_tmp5_ = _data30_->popover;
		gtk_widget_show_all ((GtkWidget*) _tmp5_);
		_tmp6_ = app_window_get_fullscreen ();
		_tmp7_ = _tmp6_;
		fullscreen_window_set_auto_dismiss_toolbar (_tmp7_, FALSE);
		_g_object_unref0 (_tmp7_);
	} else {
		GtkPopover* _tmp8_;
		_tmp8_ = _data30_->popover;
		gtk_widget_hide ((GtkWidget*) _tmp8_);
	}
}

static void
__transition_effect_selector___lambda37__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                    gpointer self)
{
	_transition_effect_selector___lambda37_ (self);
}

static GObject *
transition_effect_selector_constructor (GType type,
                                        guint n_construct_properties,
                                        GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TransitionEffectSelector * self;
	Block30Data* _data30_;
	GSettings* _tmp0_;
	TransitionEffectsManager* _tmp1_;
	gchar* selected_effect = NULL;
	TransitionEffectsManager* _tmp2_;
	GSettings* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GListStore* _tmp8_;
	GListStore* _tmp25_;
	const gchar* _tmp26_;
	GtkLabel* _tmp27_;
	GtkLabel* _tmp28_;
	GtkLabel* _tmp29_;
	GtkGrid* button_grid = NULL;
	GtkGrid* _tmp30_;
	GtkGrid* _tmp31_;
	GtkGrid* _tmp32_;
	GtkGrid* _tmp33_;
	GtkLabel* _tmp34_;
	GtkGrid* _tmp35_;
	GtkImage* _tmp36_;
	GtkImage* _tmp37_;
	GtkToggleButton* _tmp38_;
	GtkToggleButton* _tmp39_;
	GtkToggleButton* _tmp40_;
	GtkToggleButton* _tmp41_;
	GtkGrid* _tmp42_;
	GtkToggleButton* _tmp43_;
	GtkPopover* _tmp44_;
	GtkListBox* _tmp45_;
	GtkListBox* _tmp46_;
	GListStore* _tmp47_;
	GtkListBox* _tmp48_;
	GtkScrolledWindow* layout_scrolled = NULL;
	GtkScrolledWindow* _tmp49_;
	GtkScrolledWindow* _tmp50_;
	GtkScrolledWindow* _tmp51_;
	GtkScrolledWindow* _tmp52_;
	GtkScrolledWindow* _tmp53_;
	GtkScrolledWindow* _tmp54_;
	GtkListBox* _tmp55_;
	GtkPopover* _tmp56_;
	GtkPopover* _tmp57_;
	GtkPopover* _tmp58_;
	GtkPopover* _tmp59_;
	GtkPopover* _tmp60_;
	GtkScrolledWindow* _tmp61_;
	GtkToggleButton* _tmp62_;
	GtkToggleButton* _tmp63_;
	parent_class = G_OBJECT_CLASS (transition_effect_selector_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TRANSITION_EFFECT_SELECTOR, TransitionEffectSelector);
	_data30_ = g_slice_new0 (Block30Data);
	_data30_->_ref_count_ = 1;
	_data30_->self = g_object_ref (self);
	_tmp0_ = g_settings_new (GSETTINGS_CONFIGURATION_ENGINE_SLIDESHOW_PREFS_SCHEMA_NAME);
	_g_object_unref0 (self->priv->slideshow_settings);
	self->priv->slideshow_settings = _tmp0_;
	_tmp1_ = transition_effects_manager_get_instance ();
	_transition_effects_manager_unref0 (self->priv->effect_manager);
	self->priv->effect_manager = _tmp1_;
	gtk_widget_set_valign ((GtkWidget*) self, GTK_ALIGN_CENTER);
	_tmp2_ = self->priv->effect_manager;
	_tmp3_ = self->priv->slideshow_settings;
	_tmp4_ = g_settings_get_string (_tmp3_, "transition-effect-id");
	_tmp5_ = _tmp4_;
	_tmp6_ = transition_effects_manager_get_effect_name (_tmp2_, _tmp5_);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp5_);
	selected_effect = _tmp7_;
	_tmp8_ = g_list_store_new (TRANSITION_EFFECT_SELECTOR_TYPE_LIST_STORE_ITEM);
	_data30_->effect_list_store = _tmp8_;
	{
		GeeIterator* _id_it = NULL;
		TransitionEffectsManager* _tmp9_;
		GeeCollection* _tmp10_;
		GeeCollection* _tmp11_;
		GeeIterator* _tmp12_;
		GeeIterator* _tmp13_;
		_tmp9_ = self->priv->effect_manager;
		_tmp10_ = transition_effects_manager_get_effect_ids (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = gee_iterable_iterator ((GeeIterable*) _tmp11_);
		_tmp13_ = _tmp12_;
		_g_object_unref0 (_tmp11_);
		_id_it = _tmp13_;
		while (TRUE) {
			GeeIterator* _tmp14_;
			gchar* id = NULL;
			GeeIterator* _tmp15_;
			gpointer _tmp16_;
			gchar* name = NULL;
			TransitionEffectsManager* _tmp17_;
			const gchar* _tmp18_;
			gchar* _tmp19_;
			GListStore* _tmp20_;
			const gchar* _tmp21_;
			const gchar* _tmp22_;
			TransitionEffectSelectorListStoreItem* _tmp23_;
			TransitionEffectSelectorListStoreItem* _tmp24_;
			_tmp14_ = _id_it;
			if (!gee_iterator_next (_tmp14_)) {
				break;
			}
			_tmp15_ = _id_it;
			_tmp16_ = gee_iterator_get (_tmp15_);
			id = (gchar*) _tmp16_;
			_tmp17_ = self->priv->effect_manager;
			_tmp18_ = id;
			_tmp19_ = transition_effects_manager_get_effect_name (_tmp17_, _tmp18_);
			name = _tmp19_;
			_tmp20_ = _data30_->effect_list_store;
			_tmp21_ = id;
			_tmp22_ = name;
			_tmp23_ = transition_effect_selector_list_store_item_new (_tmp21_, _tmp22_);
			_tmp24_ = _tmp23_;
			g_list_store_append (_tmp20_, (GObject*) _tmp24_);
			_g_object_unref0 (_tmp24_);
			_g_free0 (name);
			_g_free0 (id);
		}
		_g_object_unref0 (_id_it);
	}
	_tmp25_ = _data30_->effect_list_store;
	g_list_store_sort (_tmp25_, __transition_effect_selector___lambda33__gcompare_data_func, self);
	_tmp26_ = selected_effect;
	_tmp27_ = (GtkLabel*) gtk_label_new (_tmp26_);
	g_object_ref_sink (_tmp27_);
	_data30_->effect_label = _tmp27_;
	_tmp28_ = _data30_->effect_label;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp28_, TRUE);
	_tmp29_ = _data30_->effect_label;
	gtk_label_set_xalign (_tmp29_, (gfloat) 0);
	_tmp30_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp30_);
	button_grid = _tmp30_;
	_tmp31_ = button_grid;
	gtk_grid_set_column_spacing (_tmp31_, 6);
	_tmp32_ = button_grid;
	gtk_widget_set_valign ((GtkWidget*) _tmp32_, GTK_ALIGN_CENTER);
	_tmp33_ = button_grid;
	_tmp34_ = _data30_->effect_label;
	gtk_container_add ((GtkContainer*) _tmp33_, (GtkWidget*) _tmp34_);
	_tmp35_ = button_grid;
	_tmp36_ = (GtkImage*) gtk_image_new_from_icon_name ("pan-down-symbolic", (GtkIconSize) GTK_ICON_SIZE_MENU);
	g_object_ref_sink (_tmp36_);
	_tmp37_ = _tmp36_;
	gtk_container_add ((GtkContainer*) _tmp35_, (GtkWidget*) _tmp37_);
	_g_object_unref0 (_tmp37_);
	_tmp38_ = (GtkToggleButton*) gtk_toggle_button_new ();
	g_object_ref_sink (_tmp38_);
	_data30_->button = _tmp38_;
	_tmp39_ = _data30_->button;
	g_object_set ((GtkWidget*) _tmp39_, "width-request", 175, NULL);
	_tmp40_ = _data30_->button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp40_, _ ("Transition Effect"));
	_tmp41_ = _data30_->button;
	_tmp42_ = button_grid;
	gtk_container_add ((GtkContainer*) _tmp41_, (GtkWidget*) _tmp42_);
	_tmp43_ = _data30_->button;
	_tmp44_ = (GtkPopover*) gtk_popover_new ((GtkWidget*) _tmp43_);
	g_object_ref_sink (_tmp44_);
	_data30_->popover = _tmp44_;
	_tmp45_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp45_);
	_g_object_unref0 (self->priv->effect_list_box);
	self->priv->effect_list_box = _tmp45_;
	_tmp46_ = self->priv->effect_list_box;
	_tmp47_ = _data30_->effect_list_store;
	gtk_list_box_bind_model (_tmp46_, (GListModel*) _tmp47_, __transition_effect_selector___lambda34__gtk_list_box_create_widget_func, g_object_ref (self), g_object_unref);
	_tmp48_ = self->priv->effect_list_box;
	g_signal_connect_data (_tmp48_, "row-activated", (GCallback) __transition_effect_selector___lambda35__gtk_list_box_row_activated, block30_data_ref (_data30_), (GClosureNotify) block30_data_unref, 0);
	_tmp49_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL);
	g_object_ref_sink (_tmp49_);
	layout_scrolled = _tmp49_;
	_tmp50_ = layout_scrolled;
	g_object_set (_tmp50_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	_tmp51_ = layout_scrolled;
	g_object_set ((GtkWidget*) _tmp51_, "expand", TRUE, NULL);
	_tmp52_ = layout_scrolled;
	_tmp53_ = layout_scrolled;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp53_, 3);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp52_, 3);
	_tmp54_ = layout_scrolled;
	_tmp55_ = self->priv->effect_list_box;
	gtk_container_add ((GtkContainer*) _tmp54_, (GtkWidget*) _tmp55_);
	_tmp56_ = _data30_->popover;
	g_object_set ((GtkWidget*) _tmp56_, "height-request", 300, NULL);
	_tmp57_ = _data30_->popover;
	g_object_set ((GtkWidget*) _tmp57_, "width-request", 200, NULL);
	_tmp58_ = _data30_->popover;
	g_signal_connect_data (_tmp58_, "closed", (GCallback) __transition_effect_selector___lambda36__gtk_popover_closed, block30_data_ref (_data30_), (GClosureNotify) block30_data_unref, 0);
	_tmp59_ = _data30_->popover;
	gtk_popover_set_position (_tmp59_, GTK_POS_TOP);
	_tmp60_ = _data30_->popover;
	_tmp61_ = layout_scrolled;
	gtk_container_add ((GtkContainer*) _tmp60_, (GtkWidget*) _tmp61_);
	_tmp62_ = _data30_->button;
	g_signal_connect_data (_tmp62_, "toggled", (GCallback) __transition_effect_selector___lambda37__gtk_toggle_button_toggled, block30_data_ref (_data30_), (GClosureNotify) block30_data_unref, 0);
	_tmp63_ = _data30_->button;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp63_);
	_g_object_unref0 (layout_scrolled);
	_g_object_unref0 (button_grid);
	_g_free0 (selected_effect);
	block30_data_unref (_data30_);
	_data30_ = NULL;
	return obj;
}

static void
transition_effect_selector_class_init (TransitionEffectSelectorClass * klass,
                                       gpointer klass_data)
{
	transition_effect_selector_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TransitionEffectSelector_private_offset);
	G_OBJECT_CLASS (klass)->constructor = transition_effect_selector_constructor;
	G_OBJECT_CLASS (klass)->finalize = transition_effect_selector_finalize;
}

static void
transition_effect_selector_instance_init (TransitionEffectSelector * self,
                                          gpointer klass)
{
	self->priv = transition_effect_selector_get_instance_private (self);
}

static void
transition_effect_selector_finalize (GObject * obj)
{
	TransitionEffectSelector * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TRANSITION_EFFECT_SELECTOR, TransitionEffectSelector);
	_g_object_unref0 (self->priv->effect_list_box);
	_g_object_unref0 (self->priv->slideshow_settings);
	_transition_effects_manager_unref0 (self->priv->effect_manager);
	G_OBJECT_CLASS (transition_effect_selector_parent_class)->finalize (obj);
}

static GType
transition_effect_selector_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TransitionEffectSelectorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) transition_effect_selector_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TransitionEffectSelector), 0, (GInstanceInitFunc) transition_effect_selector_instance_init, NULL };
	GType transition_effect_selector_type_id;
	transition_effect_selector_type_id = g_type_register_static (gtk_tool_item_get_type (), "TransitionEffectSelector", &g_define_type_info, 0);
	TransitionEffectSelector_private_offset = g_type_add_instance_private (transition_effect_selector_type_id, sizeof (TransitionEffectSelectorPrivate));
	return transition_effect_selector_type_id;
}

GType
transition_effect_selector_get_type (void)
{
	static volatile gsize transition_effect_selector_type_id__once = 0;
	if (g_once_init_enter (&transition_effect_selector_type_id__once)) {
		GType transition_effect_selector_type_id;
		transition_effect_selector_type_id = transition_effect_selector_get_type_once ();
		g_once_init_leave (&transition_effect_selector_type_id__once, transition_effect_selector_type_id);
	}
	return transition_effect_selector_type_id__once;
}

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

