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

/*
 * SPDX-License-Identifier: GPL-3.0-or-later
 * SPDX-FileCopyrightText: 2014-2025 elementary, Inc. (https://elementary.io)
 *
 * Authored by: Corentin Noël <corentin@elementaryos.org>
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <libedataserver/libedataserver.h>
#include "elementary-calendar.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 MAYA_VIEW_WIDGETS_TYPE_DYNAMIC_SPINNER (maya_view_widgets_dynamic_spinner_get_type ())
#define MAYA_VIEW_WIDGETS_DYNAMIC_SPINNER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAYA_VIEW_WIDGETS_TYPE_DYNAMIC_SPINNER, MayaViewWidgetsDynamicSpinner))
#define MAYA_VIEW_WIDGETS_DYNAMIC_SPINNER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAYA_VIEW_WIDGETS_TYPE_DYNAMIC_SPINNER, MayaViewWidgetsDynamicSpinnerClass))
#define MAYA_VIEW_WIDGETS_IS_DYNAMIC_SPINNER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAYA_VIEW_WIDGETS_TYPE_DYNAMIC_SPINNER))
#define MAYA_VIEW_WIDGETS_IS_DYNAMIC_SPINNER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAYA_VIEW_WIDGETS_TYPE_DYNAMIC_SPINNER))
#define MAYA_VIEW_WIDGETS_DYNAMIC_SPINNER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAYA_VIEW_WIDGETS_TYPE_DYNAMIC_SPINNER, MayaViewWidgetsDynamicSpinnerClass))

typedef struct _MayaViewWidgetsDynamicSpinner MayaViewWidgetsDynamicSpinner;
typedef struct _MayaViewWidgetsDynamicSpinnerClass MayaViewWidgetsDynamicSpinnerClass;
typedef struct _MayaViewWidgetsDynamicSpinnerPrivate MayaViewWidgetsDynamicSpinnerPrivate;
enum  {
	MAYA_VIEW_WIDGETS_DYNAMIC_SPINNER_0_PROPERTY,
	MAYA_VIEW_WIDGETS_DYNAMIC_SPINNER_NUM_PROPERTIES
};
static GParamSpec* maya_view_widgets_dynamic_spinner_properties[MAYA_VIEW_WIDGETS_DYNAMIC_SPINNER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef struct _Block30Data Block30Data;
typedef struct _MayaViewWidgetsDynamicSpinnerAddSourceData MayaViewWidgetsDynamicSpinnerAddSourceData;
typedef struct _Block31Data Block31Data;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _MayaViewWidgetsDynamicSpinnerRemoveSourceData MayaViewWidgetsDynamicSpinnerRemoveSourceData;

struct _MayaViewWidgetsDynamicSpinner {
	GtkBin parent_instance;
	MayaViewWidgetsDynamicSpinnerPrivate * priv;
};

struct _MayaViewWidgetsDynamicSpinnerClass {
	GtkBinClass parent_class;
};

struct _MayaViewWidgetsDynamicSpinnerPrivate {
	GtkListBox* list_box;
	GtkRevealer* revealer;
	GHashTable* children_matcher;
	GRecMutex __lock_children_matcher;
};

struct _Block30Data {
	int _ref_count_;
	MayaViewWidgetsDynamicSpinner* self;
	ESource* source;
	GCancellable* cancellable;
	gpointer _async_data_;
};

struct _MayaViewWidgetsDynamicSpinnerAddSourceData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	MayaViewWidgetsDynamicSpinner* self;
	ESource* source;
	GCancellable* cancellable;
	Block30Data* _data30_;
};

struct _Block31Data {
	int _ref_count_;
	MayaViewWidgetsDynamicSpinner* self;
	ESource* source;
	gpointer _async_data_;
};

struct _MayaViewWidgetsDynamicSpinnerRemoveSourceData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	MayaViewWidgetsDynamicSpinner* self;
	ESource* source;
	Block31Data* _data31_;
};

static gint MayaViewWidgetsDynamicSpinner_private_offset;
static gpointer maya_view_widgets_dynamic_spinner_parent_class = NULL;

VALA_EXTERN GType maya_view_widgets_dynamic_spinner_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MayaViewWidgetsDynamicSpinner, g_object_unref)
static void maya_view_widgets_dynamic_spinner_add_source_data_free (gpointer _data);
VALA_EXTERN void maya_view_widgets_dynamic_spinner_add_source (MayaViewWidgetsDynamicSpinner* self,
                                                   ESource* source,
                                                   GCancellable* cancellable,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_);
VALA_EXTERN void maya_view_widgets_dynamic_spinner_add_source_finish (MayaViewWidgetsDynamicSpinner* self,
                                                          GAsyncResult* _res_);
static gboolean maya_view_widgets_dynamic_spinner_add_source_co (MayaViewWidgetsDynamicSpinnerAddSourceData* _data_);
static Block30Data* block30_data_ref (Block30Data* _data30_);
static void block30_data_unref (void * _userdata_);
static gboolean __lambda141_ (Block30Data* _data30_);
static void __lambda142_ (Block30Data* _data30_);
static void ___lambda142__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static gboolean ___lambda141__gsource_func (gpointer self);
static void maya_view_widgets_dynamic_spinner_remove_source_data_free (gpointer _data);
VALA_EXTERN void maya_view_widgets_dynamic_spinner_remove_source (MayaViewWidgetsDynamicSpinner* self,
                                                      ESource* source,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_);
VALA_EXTERN void maya_view_widgets_dynamic_spinner_remove_source_finish (MayaViewWidgetsDynamicSpinner* self,
                                                             GAsyncResult* _res_);
static gboolean maya_view_widgets_dynamic_spinner_remove_source_co (MayaViewWidgetsDynamicSpinnerRemoveSourceData* _data_);
static Block31Data* block31_data_ref (Block31Data* _data31_);
static void block31_data_unref (void * _userdata_);
static gboolean __lambda143_ (Block31Data* _data31_);
static gboolean ___lambda143__gsource_func (gpointer self);
VALA_EXTERN MayaViewWidgetsDynamicSpinner* maya_view_widgets_dynamic_spinner_new (void);
VALA_EXTERN MayaViewWidgetsDynamicSpinner* maya_view_widgets_dynamic_spinner_construct (GType object_type);
static GObject * maya_view_widgets_dynamic_spinner_constructor (GType type,
                                                         guint n_construct_properties,
                                                         GObjectConstructParam * construct_properties);
static void _g_free0_ (gpointer var);
static void _g_object_unref0_ (gpointer var);
static void _maya_view_widgets_dynamic_spinner___lambda144_ (MayaViewWidgetsDynamicSpinner* self,
                                                      ESource* source,
                                                      GCancellable* cancellable);
static void __maya_view_widgets_dynamic_spinner___lambda144__calendar_event_store_connecting (CalendarEventStore* _sender,
                                                                                       ESource* source,
                                                                                       GCancellable* cancellable,
                                                                                       gpointer self);
static void _maya_view_widgets_dynamic_spinner___lambda145_ (MayaViewWidgetsDynamicSpinner* self,
                                                      ESource* source);
static void __maya_view_widgets_dynamic_spinner___lambda145__calendar_event_store_connected (CalendarEventStore* _sender,
                                                                                      ESource* source,
                                                                                      gpointer self);
static void maya_view_widgets_dynamic_spinner_finalize (GObject * obj);
static GType maya_view_widgets_dynamic_spinner_get_type_once (void);

static inline gpointer
maya_view_widgets_dynamic_spinner_get_instance_private (MayaViewWidgetsDynamicSpinner* self)
{
	return G_STRUCT_MEMBER_P (self, MayaViewWidgetsDynamicSpinner_private_offset);
}

static void
maya_view_widgets_dynamic_spinner_add_source_data_free (gpointer _data)
{
	MayaViewWidgetsDynamicSpinnerAddSourceData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (MayaViewWidgetsDynamicSpinnerAddSourceData, _data_);
}

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

void
maya_view_widgets_dynamic_spinner_add_source (MayaViewWidgetsDynamicSpinner* self,
                                              ESource* source,
                                              GCancellable* cancellable,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_)
{
	MayaViewWidgetsDynamicSpinnerAddSourceData* _data_;
	MayaViewWidgetsDynamicSpinner* _tmp0_;
	ESource* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (MayaViewWidgetsDynamicSpinnerAddSourceData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, maya_view_widgets_dynamic_spinner_add_source_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (source);
	_g_object_unref0 (_data_->source);
	_data_->source = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	maya_view_widgets_dynamic_spinner_add_source_co (_data_);
}

void
maya_view_widgets_dynamic_spinner_add_source_finish (MayaViewWidgetsDynamicSpinner* self,
                                                     GAsyncResult* _res_)
{
	MayaViewWidgetsDynamicSpinnerAddSourceData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (NULL == _data_) {
		return;
	}
}

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_)) {
		MayaViewWidgetsDynamicSpinner* self;
		self = _data30_->self;
		_g_object_unref0 (_data30_->source);
		_g_object_unref0 (_data30_->cancellable);
		_g_object_unref0 (self);
		g_slice_free (Block30Data, _data30_);
	}
}

static void
__lambda142_ (Block30Data* _data30_)
{
	MayaViewWidgetsDynamicSpinner* self;
	self = _data30_->self;
	g_cancellable_cancel (_data30_->cancellable);
}

static void
___lambda142__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda142_ (self);
}

static gboolean
__lambda141_ (Block30Data* _data30_)
{
	MayaViewWidgetsDynamicSpinner* self;
	GtkRevealer* _tmp0_;
	GtkLabel* label = NULL;
	const gchar* _tmp1_;
	GtkLabel* _tmp2_;
	GtkButton* stop_button = NULL;
	GtkButton* _tmp3_;
	GtkStyleContext* _tmp4_;
	GtkBox* box = NULL;
	GtkBox* _tmp5_ = NULL;
	GtkListBox* _tmp12_;
	GtkListBox* _tmp13_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	self = _data30_->self;
	_tmp0_ = self->priv->revealer;
	gtk_revealer_set_reveal_child (_tmp0_, TRUE);
	_tmp1_ = e_source_get_display_name (_data30_->source);
	_tmp2_ = (GtkLabel*) gtk_label_new (_tmp1_);
	g_object_ref_sink (_tmp2_);
	label = _tmp2_;
	_tmp3_ = (GtkButton*) gtk_button_new_from_icon_name ("process-stop-symbolic", (GtkIconSize) GTK_ICON_SIZE_BUTTON);
	g_object_ref_sink (_tmp3_);
	stop_button = _tmp3_;
	_tmp4_ = gtk_widget_get_style_context ((GtkWidget*) stop_button);
	gtk_style_context_add_class (_tmp4_, GTK_STYLE_CLASS_FLAT);
	g_signal_connect_data (stop_button, "clicked", (GCallback) ___lambda142__gtk_button_clicked, block30_data_ref (_data30_), (GClosureNotify) block30_data_unref, 0);
	_tmp5_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp5_, 6);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp5_, 6);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp5_, 6);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp5_, 6);
	g_object_ref_sink (_tmp5_);
	box = _tmp5_;
	gtk_container_add ((GtkContainer*) box, (GtkWidget*) label);
	gtk_container_add ((GtkContainer*) box, (GtkWidget*) stop_button);
	{
		GHashTable* _tmp6_;
		_tmp6_ = self->priv->children_matcher;
		g_rec_mutex_lock (&self->priv->__lock_children_matcher);
		{
			GHashTable* _tmp7_;
			gchar* _tmp8_;
			GtkWidget* _tmp9_;
			_tmp7_ = self->priv->children_matcher;
			_tmp8_ = e_source_dup_uid (_data30_->source);
			_tmp9_ = _g_object_ref0 ((GtkWidget*) box);
			g_hash_table_insert (_tmp7_, _tmp8_, _tmp9_);
		}
		__finally0:
		{
			GHashTable* _tmp10_;
			_tmp10_ = self->priv->children_matcher;
			g_rec_mutex_unlock (&self->priv->__lock_children_matcher);
		}
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gboolean _tmp11_ = FALSE;
			_g_object_unref0 (box);
			_g_object_unref0 (stop_button);
			_g_object_unref0 (label);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp11_;
		}
	}
	_tmp12_ = self->priv->list_box;
	gtk_container_add ((GtkContainer*) _tmp12_, (GtkWidget*) box);
	_tmp13_ = self->priv->list_box;
	gtk_widget_show_all ((GtkWidget*) _tmp13_);
	result = FALSE;
	_g_object_unref0 (box);
	_g_object_unref0 (stop_button);
	_g_object_unref0 (label);
	return result;
}

static gboolean
___lambda141__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda141_ (self);
	return result;
}

static gboolean
maya_view_widgets_dynamic_spinner_add_source_co (MayaViewWidgetsDynamicSpinnerAddSourceData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data30_ = g_slice_new0 (Block30Data);
	_data_->_data30_->_ref_count_ = 1;
	_data_->_data30_->self = g_object_ref (_data_->self);
	_g_object_unref0 (_data_->_data30_->source);
	_data_->_data30_->source = _data_->source;
	_g_object_unref0 (_data_->_data30_->cancellable);
	_data_->_data30_->cancellable = _data_->cancellable;
	_data_->_data30_->_async_data_ = _data_;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda141__gsource_func, block30_data_ref (_data_->_data30_), block30_data_unref);
	block30_data_unref (_data_->_data30_);
	_data_->_data30_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
maya_view_widgets_dynamic_spinner_remove_source_data_free (gpointer _data)
{
	MayaViewWidgetsDynamicSpinnerRemoveSourceData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (MayaViewWidgetsDynamicSpinnerRemoveSourceData, _data_);
}

void
maya_view_widgets_dynamic_spinner_remove_source (MayaViewWidgetsDynamicSpinner* self,
                                                 ESource* source,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_)
{
	MayaViewWidgetsDynamicSpinnerRemoveSourceData* _data_;
	MayaViewWidgetsDynamicSpinner* _tmp0_;
	ESource* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	_data_ = g_slice_new0 (MayaViewWidgetsDynamicSpinnerRemoveSourceData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, maya_view_widgets_dynamic_spinner_remove_source_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (source);
	_g_object_unref0 (_data_->source);
	_data_->source = _tmp1_;
	maya_view_widgets_dynamic_spinner_remove_source_co (_data_);
}

void
maya_view_widgets_dynamic_spinner_remove_source_finish (MayaViewWidgetsDynamicSpinner* self,
                                                        GAsyncResult* _res_)
{
	MayaViewWidgetsDynamicSpinnerRemoveSourceData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static Block31Data*
block31_data_ref (Block31Data* _data31_)
{
	g_atomic_int_inc (&_data31_->_ref_count_);
	return _data31_;
}

static void
block31_data_unref (void * _userdata_)
{
	Block31Data* _data31_;
	_data31_ = (Block31Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data31_->_ref_count_)) {
		MayaViewWidgetsDynamicSpinner* self;
		self = _data31_->self;
		_g_object_unref0 (_data31_->source);
		_g_object_unref0 (self);
		g_slice_free (Block31Data, _data31_);
	}
}

static gboolean
__lambda143_ (Block31Data* _data31_)
{
	MayaViewWidgetsDynamicSpinner* self;
	GError* _inner_error0_ = NULL;
	gboolean result;
	self = _data31_->self;
	{
		GHashTable* _tmp0_;
		_tmp0_ = self->priv->children_matcher;
		g_rec_mutex_lock (&self->priv->__lock_children_matcher);
		{
			GtkWidget* widget = NULL;
			GHashTable* _tmp1_;
			gchar* _tmp2_;
			gchar* _tmp3_;
			gconstpointer _tmp4_;
			GtkWidget* _tmp5_;
			GtkWidget* _tmp6_;
			GHashTable* _tmp7_;
			gchar* _tmp8_;
			gchar* _tmp9_;
			GtkWidget* _tmp10_;
			GHashTable* _tmp12_;
			_tmp1_ = self->priv->children_matcher;
			_tmp2_ = e_source_dup_uid (_data31_->source);
			_tmp3_ = _tmp2_;
			_tmp4_ = g_hash_table_lookup (_tmp1_, _tmp3_);
			_tmp5_ = _g_object_ref0 ((GtkWidget*) _tmp4_);
			_tmp6_ = _tmp5_;
			_g_free0 (_tmp3_);
			widget = _tmp6_;
			_tmp7_ = self->priv->children_matcher;
			_tmp8_ = e_source_dup_uid (_data31_->source);
			_tmp9_ = _tmp8_;
			g_hash_table_remove (_tmp7_, _tmp9_);
			_g_free0 (_tmp9_);
			_tmp10_ = widget;
			if (_tmp10_ != NULL) {
				GtkWidget* _tmp11_;
				_tmp11_ = widget;
				gtk_widget_destroy (_tmp11_);
			}
			_tmp12_ = self->priv->children_matcher;
			if (g_hash_table_size (_tmp12_) == ((guint) 0)) {
				GtkRevealer* _tmp13_;
				_tmp13_ = self->priv->revealer;
				gtk_revealer_set_reveal_child (_tmp13_, FALSE);
			}
			_g_object_unref0 (widget);
		}
		__finally0:
		{
			GHashTable* _tmp14_;
			_tmp14_ = self->priv->children_matcher;
			g_rec_mutex_unlock (&self->priv->__lock_children_matcher);
		}
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gboolean _tmp15_ = FALSE;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp15_;
		}
	}
	result = FALSE;
	return result;
}

static gboolean
___lambda143__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda143_ (self);
	return result;
}

static gboolean
maya_view_widgets_dynamic_spinner_remove_source_co (MayaViewWidgetsDynamicSpinnerRemoveSourceData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data31_ = g_slice_new0 (Block31Data);
	_data_->_data31_->_ref_count_ = 1;
	_data_->_data31_->self = g_object_ref (_data_->self);
	_g_object_unref0 (_data_->_data31_->source);
	_data_->_data31_->source = _data_->source;
	_data_->_data31_->_async_data_ = _data_;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda143__gsource_func, block31_data_ref (_data_->_data31_), block31_data_unref);
	block31_data_unref (_data_->_data31_);
	_data_->_data31_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

MayaViewWidgetsDynamicSpinner*
maya_view_widgets_dynamic_spinner_construct (GType object_type)
{
	MayaViewWidgetsDynamicSpinner * self = NULL;
	self = (MayaViewWidgetsDynamicSpinner*) g_object_new (object_type, NULL);
	return self;
}

MayaViewWidgetsDynamicSpinner*
maya_view_widgets_dynamic_spinner_new (void)
{
	return maya_view_widgets_dynamic_spinner_construct (MAYA_VIEW_WIDGETS_TYPE_DYNAMIC_SPINNER);
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static void
_maya_view_widgets_dynamic_spinner___lambda144_ (MayaViewWidgetsDynamicSpinner* self,
                                                 ESource* source,
                                                 GCancellable* cancellable)
{
	g_return_if_fail (source != NULL);
	g_return_if_fail (cancellable != NULL);
	maya_view_widgets_dynamic_spinner_add_source (self, source, cancellable, NULL, NULL);
}

static void
__maya_view_widgets_dynamic_spinner___lambda144__calendar_event_store_connecting (CalendarEventStore* _sender,
                                                                                  ESource* source,
                                                                                  GCancellable* cancellable,
                                                                                  gpointer self)
{
	_maya_view_widgets_dynamic_spinner___lambda144_ ((MayaViewWidgetsDynamicSpinner*) self, source, cancellable);
}

static void
_maya_view_widgets_dynamic_spinner___lambda145_ (MayaViewWidgetsDynamicSpinner* self,
                                                 ESource* source)
{
	g_return_if_fail (source != NULL);
	maya_view_widgets_dynamic_spinner_remove_source (self, source, NULL, NULL);
}

static void
__maya_view_widgets_dynamic_spinner___lambda145__calendar_event_store_connected (CalendarEventStore* _sender,
                                                                                 ESource* source,
                                                                                 gpointer self)
{
	_maya_view_widgets_dynamic_spinner___lambda145_ ((MayaViewWidgetsDynamicSpinner*) self, source);
}

static GObject *
maya_view_widgets_dynamic_spinner_constructor (GType type,
                                               guint n_construct_properties,
                                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	MayaViewWidgetsDynamicSpinner * self;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	GtkSpinner* spinner = NULL;
	GtkSpinner* _tmp3_;
	GtkSpinner* _tmp4_;
	GtkListBox* _tmp5_ = NULL;
	GtkPopover* info_popover = NULL;
	GtkListBox* _tmp6_;
	GtkWidget* _tmp7_;
	GtkPopover* _tmp8_ = NULL;
	GtkMenuButton* button = NULL;
	GtkSpinner* _tmp9_;
	GtkWidget* _tmp10_;
	GtkPopover* _tmp11_;
	GtkPopover* _tmp12_;
	GtkMenuButton* _tmp13_ = NULL;
	CalendarEventStore* calmodel = NULL;
	CalendarEventStore* _tmp14_;
	CalendarEventStore* _tmp15_;
	CalendarEventStore* _tmp16_;
	GtkMenuButton* _tmp17_;
	GtkWidget* _tmp18_;
	GtkRevealer* _tmp19_ = NULL;
	GtkRevealer* _tmp20_;
	parent_class = G_OBJECT_CLASS (maya_view_widgets_dynamic_spinner_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAYA_VIEW_WIDGETS_TYPE_DYNAMIC_SPINNER, MayaViewWidgetsDynamicSpinner);
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _g_object_unref0_);
	_g_hash_table_unref0 (self->priv->children_matcher);
	self->priv->children_matcher = _tmp2_;
	_tmp3_ = (GtkSpinner*) gtk_spinner_new ();
	g_object_ref_sink (_tmp3_);
	spinner = _tmp3_;
	_tmp4_ = spinner;
	gtk_spinner_start (_tmp4_);
	_tmp5_ = (GtkListBox*) gtk_list_box_new ();
	gtk_list_box_set_selection_mode (_tmp5_, GTK_SELECTION_NONE);
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (self->priv->list_box);
	self->priv->list_box = _tmp5_;
	_tmp6_ = self->priv->list_box;
	_tmp7_ = _g_object_ref0 ((GtkWidget*) _tmp6_);
	_tmp8_ = (GtkPopover*) gtk_popover_new (NULL);
	g_object_set ((GtkContainer*) _tmp8_, "child", _tmp7_, NULL);
	_g_object_unref0 (_tmp7_);
	gtk_popover_set_position (_tmp8_, GTK_POS_BOTTOM);
	g_object_ref_sink (_tmp8_);
	info_popover = _tmp8_;
	_tmp9_ = spinner;
	_tmp10_ = _g_object_ref0 ((GtkWidget*) _tmp9_);
	_tmp11_ = info_popover;
	_tmp12_ = _g_object_ref0 (_tmp11_);
	_tmp13_ = (GtkMenuButton*) gtk_menu_button_new ();
	g_object_set ((GtkContainer*) _tmp13_, "child", _tmp10_, NULL);
	_g_object_unref0 (_tmp10_);
	gtk_menu_button_set_popover (_tmp13_, _tmp12_);
	_g_object_unref0 (_tmp12_);
	gtk_widget_set_valign ((GtkWidget*) _tmp13_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp13_);
	button = _tmp13_;
	_tmp14_ = calendar_event_store_get_default ();
	calmodel = _tmp14_;
	_tmp15_ = calmodel;
	g_signal_connect_object (_tmp15_, "connecting", (GCallback) __maya_view_widgets_dynamic_spinner___lambda144__calendar_event_store_connecting, self, 0);
	_tmp16_ = calmodel;
	g_signal_connect_object (_tmp16_, "connected", (GCallback) __maya_view_widgets_dynamic_spinner___lambda145__calendar_event_store_connected, self, 0);
	_tmp17_ = button;
	_tmp18_ = _g_object_ref0 ((GtkWidget*) _tmp17_);
	_tmp19_ = (GtkRevealer*) gtk_revealer_new ();
	g_object_set ((GtkContainer*) _tmp19_, "child", _tmp18_, NULL);
	_g_object_unref0 (_tmp18_);
	gtk_revealer_set_transition_type (_tmp19_, GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
	g_object_ref_sink (_tmp19_);
	_g_object_unref0 (self->priv->revealer);
	self->priv->revealer = _tmp19_;
	_tmp20_ = self->priv->revealer;
	g_object_set ((GtkContainer*) self, "child", (GtkWidget*) _tmp20_, NULL);
	gtk_widget_show_all ((GtkWidget*) self);
	_g_object_unref0 (calmodel);
	_g_object_unref0 (button);
	_g_object_unref0 (info_popover);
	_g_object_unref0 (spinner);
	return obj;
}

static void
maya_view_widgets_dynamic_spinner_class_init (MayaViewWidgetsDynamicSpinnerClass * klass,
                                              gpointer klass_data)
{
	maya_view_widgets_dynamic_spinner_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &MayaViewWidgetsDynamicSpinner_private_offset);
	G_OBJECT_CLASS (klass)->constructor = maya_view_widgets_dynamic_spinner_constructor;
	G_OBJECT_CLASS (klass)->finalize = maya_view_widgets_dynamic_spinner_finalize;
}

static void
maya_view_widgets_dynamic_spinner_instance_init (MayaViewWidgetsDynamicSpinner * self,
                                                 gpointer klass)
{
	self->priv = maya_view_widgets_dynamic_spinner_get_instance_private (self);
	g_rec_mutex_init (&self->priv->__lock_children_matcher);
}

static void
maya_view_widgets_dynamic_spinner_finalize (GObject * obj)
{
	MayaViewWidgetsDynamicSpinner * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAYA_VIEW_WIDGETS_TYPE_DYNAMIC_SPINNER, MayaViewWidgetsDynamicSpinner);
	_g_object_unref0 (self->priv->list_box);
	_g_object_unref0 (self->priv->revealer);
	g_rec_mutex_clear (&self->priv->__lock_children_matcher);
	_g_hash_table_unref0 (self->priv->children_matcher);
	G_OBJECT_CLASS (maya_view_widgets_dynamic_spinner_parent_class)->finalize (obj);
}

static GType
maya_view_widgets_dynamic_spinner_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MayaViewWidgetsDynamicSpinnerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) maya_view_widgets_dynamic_spinner_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MayaViewWidgetsDynamicSpinner), 0, (GInstanceInitFunc) maya_view_widgets_dynamic_spinner_instance_init, NULL };
	GType maya_view_widgets_dynamic_spinner_type_id;
	maya_view_widgets_dynamic_spinner_type_id = g_type_register_static (gtk_bin_get_type (), "MayaViewWidgetsDynamicSpinner", &g_define_type_info, 0);
	MayaViewWidgetsDynamicSpinner_private_offset = g_type_add_instance_private (maya_view_widgets_dynamic_spinner_type_id, sizeof (MayaViewWidgetsDynamicSpinnerPrivate));
	return maya_view_widgets_dynamic_spinner_type_id;
}

GType
maya_view_widgets_dynamic_spinner_get_type (void)
{
	static volatile gsize maya_view_widgets_dynamic_spinner_type_id__once = 0;
	if (g_once_init_enter (&maya_view_widgets_dynamic_spinner_type_id__once)) {
		GType maya_view_widgets_dynamic_spinner_type_id;
		maya_view_widgets_dynamic_spinner_type_id = maya_view_widgets_dynamic_spinner_get_type_once ();
		g_once_init_leave (&maya_view_widgets_dynamic_spinner_type_id__once, maya_view_widgets_dynamic_spinner_type_id);
	}
	return maya_view_widgets_dynamic_spinner_type_id__once;
}

