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

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * 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, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "planify.h"
#include <adwaita.h>
#include <gio/gio.h>
#include <gdk/gdk.h>
#include <float.h>
#include <math.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
#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 LAYOUTS_TYPE_SIDEBAR_SOURCE_ROW (layouts_sidebar_source_row_get_type ())
#define LAYOUTS_SIDEBAR_SOURCE_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LAYOUTS_TYPE_SIDEBAR_SOURCE_ROW, LayoutsSidebarSourceRow))
#define LAYOUTS_SIDEBAR_SOURCE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LAYOUTS_TYPE_SIDEBAR_SOURCE_ROW, LayoutsSidebarSourceRowClass))
#define LAYOUTS_IS_SIDEBAR_SOURCE_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LAYOUTS_TYPE_SIDEBAR_SOURCE_ROW))
#define LAYOUTS_IS_SIDEBAR_SOURCE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LAYOUTS_TYPE_SIDEBAR_SOURCE_ROW))
#define LAYOUTS_SIDEBAR_SOURCE_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LAYOUTS_TYPE_SIDEBAR_SOURCE_ROW, LayoutsSidebarSourceRowClass))

typedef struct _LayoutsSidebarSourceRow LayoutsSidebarSourceRow;
typedef struct _LayoutsSidebarSourceRowClass LayoutsSidebarSourceRowClass;
typedef struct _LayoutsSidebarSourceRowPrivate LayoutsSidebarSourceRowPrivate;

#define LAYOUTS_TYPE_PROJECT_ROW (layouts_project_row_get_type ())
#define LAYOUTS_PROJECT_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LAYOUTS_TYPE_PROJECT_ROW, LayoutsProjectRow))
#define LAYOUTS_PROJECT_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LAYOUTS_TYPE_PROJECT_ROW, LayoutsProjectRowClass))
#define LAYOUTS_IS_PROJECT_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LAYOUTS_TYPE_PROJECT_ROW))
#define LAYOUTS_IS_PROJECT_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LAYOUTS_TYPE_PROJECT_ROW))
#define LAYOUTS_PROJECT_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LAYOUTS_TYPE_PROJECT_ROW, LayoutsProjectRowClass))

typedef struct _LayoutsProjectRow LayoutsProjectRow;
typedef struct _LayoutsProjectRowClass LayoutsProjectRowClass;
enum  {
	LAYOUTS_SIDEBAR_SOURCE_ROW_0_PROPERTY,
	LAYOUTS_SIDEBAR_SOURCE_ROW_SOURCE_PROPERTY,
	LAYOUTS_SIDEBAR_SOURCE_ROW_NUM_PROPERTIES
};
static GParamSpec* layouts_sidebar_source_row_properties[LAYOUTS_SIDEBAR_SOURCE_ROW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define DIALOGS_TYPE_PROJECT (dialogs_project_get_type ())
#define DIALOGS_PROJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_TYPE_PROJECT, DialogsProject))
#define DIALOGS_PROJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_TYPE_PROJECT, DialogsProjectClass))
#define DIALOGS_IS_PROJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_TYPE_PROJECT))
#define DIALOGS_IS_PROJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_TYPE_PROJECT))
#define DIALOGS_PROJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_TYPE_PROJECT, DialogsProjectClass))

typedef struct _DialogsProject DialogsProject;
typedef struct _DialogsProjectClass DialogsProjectClass;

#define TYPE_PLANIFY (planify_get_type ())
#define PLANIFY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLANIFY, Planify))
#define PLANIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLANIFY, PlanifyClass))
#define IS_PLANIFY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLANIFY))
#define IS_PLANIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLANIFY))
#define PLANIFY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLANIFY, PlanifyClass))

typedef struct _Planify Planify;
typedef struct _PlanifyClass PlanifyClass;
typedef struct _PlanifyPrivate PlanifyPrivate;

#define TYPE_MAIN_WINDOW (main_window_get_type ())
#define MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN_WINDOW, MainWindow))
#define MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN_WINDOW, MainWindowClass))
#define IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN_WINDOW))
#define IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN_WINDOW))
#define MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN_WINDOW, MainWindowClass))

typedef struct _MainWindow MainWindow;
typedef struct _MainWindowClass MainWindowClass;
typedef struct _Block48Data Block48Data;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _http_response_unref0(var) ((var == NULL) ? NULL : (var = (http_response_unref (var), NULL)))

#define WIDGETS_TYPE_SYNC_BUTTON (widgets_sync_button_get_type ())
#define WIDGETS_SYNC_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_TYPE_SYNC_BUTTON, WidgetsSyncButton))
#define WIDGETS_SYNC_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_TYPE_SYNC_BUTTON, WidgetsSyncButtonClass))
#define WIDGETS_IS_SYNC_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_TYPE_SYNC_BUTTON))
#define WIDGETS_IS_SYNC_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_TYPE_SYNC_BUTTON))
#define WIDGETS_SYNC_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_TYPE_SYNC_BUTTON, WidgetsSyncButtonClass))

typedef struct _WidgetsSyncButton WidgetsSyncButton;
typedef struct _WidgetsSyncButtonClass WidgetsSyncButtonClass;
typedef struct _Block49Data Block49Data;

#define DIALOGS_PREFERENCES_TYPE_PREFERENCES_WINDOW (dialogs_preferences_preferences_window_get_type ())
#define DIALOGS_PREFERENCES_PREFERENCES_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_PREFERENCES_TYPE_PREFERENCES_WINDOW, DialogsPreferencesPreferencesWindow))
#define DIALOGS_PREFERENCES_PREFERENCES_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_PREFERENCES_TYPE_PREFERENCES_WINDOW, DialogsPreferencesPreferencesWindowClass))
#define DIALOGS_PREFERENCES_IS_PREFERENCES_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_PREFERENCES_TYPE_PREFERENCES_WINDOW))
#define DIALOGS_PREFERENCES_IS_PREFERENCES_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_PREFERENCES_TYPE_PREFERENCES_WINDOW))
#define DIALOGS_PREFERENCES_PREFERENCES_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_PREFERENCES_TYPE_PREFERENCES_WINDOW, DialogsPreferencesPreferencesWindowClass))

typedef struct _DialogsPreferencesPreferencesWindow DialogsPreferencesPreferencesWindow;
typedef struct _DialogsPreferencesPreferencesWindowClass DialogsPreferencesPreferencesWindowClass;

struct _LayoutsSidebarSourceRow {
	GtkListBoxRow parent_instance;
	LayoutsSidebarSourceRowPrivate * priv;
	GeeHashMap* projects_hashmap;
};

struct _LayoutsSidebarSourceRowClass {
	GtkListBoxRowClass parent_class;
};

struct _LayoutsSidebarSourceRowPrivate {
	ObjectsSource* _source;
	LayoutsHeaderItem* group;
	GtkRevealer* main_revealer;
};

struct _Planify {
	AdwApplication parent_instance;
	PlanifyPrivate * priv;
	MainWindow* main_window;
};

struct _PlanifyClass {
	AdwApplicationClass parent_class;
};

struct _Block48Data {
	int _ref_count_;
	LayoutsSidebarSourceRow* self;
	LayoutsProjectRow* picked_widget;
	ObjectsProject* picked_project;
	gchar* old_parent_id;
};

struct _Block49Data {
	int _ref_count_;
	LayoutsSidebarSourceRow* self;
	WidgetsSyncButton* sync_button;
};

static gint LayoutsSidebarSourceRow_private_offset;
static gpointer layouts_sidebar_source_row_parent_class = NULL;
VALA_EXTERN Planify* planify__instance;

VALA_EXTERN GType layouts_sidebar_source_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (LayoutsSidebarSourceRow, g_object_unref)
VALA_EXTERN GType layouts_project_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (LayoutsProjectRow, g_object_unref)
VALA_EXTERN LayoutsSidebarSourceRow* layouts_sidebar_source_row_new (ObjectsSource* source);
VALA_EXTERN LayoutsSidebarSourceRow* layouts_sidebar_source_row_construct (GType object_type,
                                                               ObjectsSource* source);
VALA_EXTERN void layouts_sidebar_source_row_hide_destroy (LayoutsSidebarSourceRow* self);
static gboolean __lambda263_ (LayoutsSidebarSourceRow* self);
static gboolean ___lambda263__gsource_func (gpointer self);
static void layouts_sidebar_source_row_prepare_new_project (LayoutsSidebarSourceRow* self,
                                                     const gchar* id);
VALA_EXTERN GType dialogs_project_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsProject, g_object_unref)
VALA_EXTERN DialogsProject* dialogs_project_new_new (const gchar* source_id,
                                         gboolean backend_picker,
                                         const gchar* parent_id);
VALA_EXTERN DialogsProject* dialogs_project_construct_new (GType object_type,
                                               const gchar* source_id,
                                               gboolean backend_picker,
                                               const gchar* parent_id);
VALA_EXTERN GType planify_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Planify, g_object_unref)
VALA_EXTERN GType main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MainWindow, g_object_unref)
static void layouts_sidebar_source_row_add_all_projects (LayoutsSidebarSourceRow* self);
VALA_EXTERN ObjectsSource* layouts_sidebar_source_row_get_source (LayoutsSidebarSourceRow* self);
static void layouts_sidebar_source_row_add_row_project (LayoutsSidebarSourceRow* self,
                                                 ObjectsProject* project);
VALA_EXTERN LayoutsProjectRow* layouts_project_row_new (ObjectsProject* project,
                                            gboolean show_subprojects,
                                            gboolean drag_n_drop);
VALA_EXTERN LayoutsProjectRow* layouts_project_row_construct (GType object_type,
                                                  ObjectsProject* project,
                                                  gboolean show_subprojects,
                                                  gboolean drag_n_drop);
static void layouts_sidebar_source_row_update_projects_sort (LayoutsSidebarSourceRow* self);
static gint layouts_sidebar_source_row_projects_sort_func (LayoutsSidebarSourceRow* self,
                                                    GtkListBoxRow* lbrow,
                                                    GtkListBoxRow* lbbefore);
static gint _layouts_sidebar_source_row_projects_sort_func_gtk_list_box_sort_func (GtkListBoxRow* row1,
                                                                            GtkListBoxRow* row2,
                                                                            gpointer self);
VALA_EXTERN ObjectsProject* layouts_project_row_get_project (LayoutsProjectRow* self);
static void layouts_sidebar_source_row_build_last_drag_and_drop (LayoutsSidebarSourceRow* self);
static gboolean __lambda264_ (LayoutsSidebarSourceRow* self,
                       GValue* value,
                       gdouble x,
                       gdouble y);
static Block48Data* block48_data_ref (Block48Data* _data48_);
static void block48_data_unref (void * _userdata_);
static void ____lambda265_ (Block48Data* _data48_,
                     GObject* obj,
                     GAsyncResult* res);
static void _____lambda265__gasync_ready_callback (GObject* source_object,
                                            GAsyncResult* res,
                                            gpointer self);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static void layouts_sidebar_source_row_update_projects_child_order (LayoutsSidebarSourceRow* self,
                                                             GtkListBox* listbox);
static gboolean ___lambda264__gtk_drop_target_drop (GtkDropTarget* _sender,
                                             GValue* value,
                                             gdouble x,
                                             gdouble y,
                                             gpointer self);
static void layouts_sidebar_source_row_set_source (LayoutsSidebarSourceRow* self,
                                            ObjectsSource* value);
static GObject * layouts_sidebar_source_row_constructor (GType type,
                                                  guint n_construct_properties,
                                                  GObjectConstructParam * construct_properties);
VALA_EXTERN GType widgets_sync_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WidgetsSyncButton, g_object_unref)
static Block49Data* block49_data_ref (Block49Data* _data49_);
static void block49_data_unref (void * _userdata_);
VALA_EXTERN WidgetsSyncButton* widgets_sync_button_new (void);
VALA_EXTERN WidgetsSyncButton* widgets_sync_button_construct (GType object_type);
VALA_EXTERN void widgets_sync_button_set_reveal_child (WidgetsSyncButton* self,
                                           gboolean value);
static void _layouts_sidebar_source_row____lambda269_ (LayoutsSidebarSourceRow* self);
VALA_EXTERN GType dialogs_preferences_preferences_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsPreferencesPreferencesWindow, g_object_unref)
VALA_EXTERN DialogsPreferencesPreferencesWindow* dialogs_preferences_preferences_window_new (void);
VALA_EXTERN DialogsPreferencesPreferencesWindow* dialogs_preferences_preferences_window_construct (GType object_type);
VALA_EXTERN void dialogs_preferences_preferences_window_show_page (DialogsPreferencesPreferencesWindow* self,
                                                       const gchar* page_key);
static void __layouts_sidebar_source_row____lambda269__widgets_sync_button_clicked (WidgetsSyncButton* _sender,
                                                                             gpointer self);
static void _layouts_sidebar_source_row____lambda452_ (Block49Data* _data49_);
VALA_EXTERN void widgets_sync_button_sync_started (WidgetsSyncButton* self);
static void __layouts_sidebar_source_row____lambda452__objects_source_sync_started (ObjectsSource* _sender,
                                                                             gpointer self);
static void _layouts_sidebar_source_row____lambda453_ (Block49Data* _data49_);
VALA_EXTERN void widgets_sync_button_sync_finished (WidgetsSyncButton* self);
static void __layouts_sidebar_source_row____lambda453__objects_source_sync_finished (ObjectsSource* _sender,
                                                                              gpointer self);
static void _layouts_sidebar_source_row____lambda454_ (Block49Data* _data49_,
                                                SyncStatus* status);
VALA_EXTERN void widgets_sync_button_sync_failed (WidgetsSyncButton* self,
                                      const gchar* custom_message);
static void __layouts_sidebar_source_row____lambda454__objects_source_sync_failed (ObjectsSource* _sender,
                                                                            SyncStatus* status,
                                                                            gpointer self);
static gboolean _layouts_sidebar_source_row___lambda455_ (LayoutsSidebarSourceRow* self);
static gboolean __layouts_sidebar_source_row___lambda455__gsource_func (gpointer self);
static void _layouts_sidebar_source_row___lambda456_ (LayoutsSidebarSourceRow* self);
static void __layouts_sidebar_source_row___lambda456__objects_base_object_updated (ObjectsBaseObject* _sender,
                                                                            const gchar* update_id,
                                                                            gpointer self);
static void _layouts_sidebar_source_row___lambda457_ (LayoutsSidebarSourceRow* self);
static void __layouts_sidebar_source_row___lambda457__gtk_button_clicked (GtkButton* _sender,
                                                                   gpointer self);
static void _layouts_sidebar_source_row_add_row_project_services_store_project_added (ServicesStore* _sender,
                                                                               ObjectsProject* project,
                                                                               gpointer self);
static void _layouts_sidebar_source_row_update_projects_sort_services_store_project_updated (ServicesStore* _sender,
                                                                                      ObjectsProject* project,
                                                                                      gpointer self);
static void _layouts_sidebar_source_row_add_row_project_services_store_project_unarchived (ServicesStore* _sender,
                                                                                    ObjectsProject* project,
                                                                                    gpointer self);
static void _layouts_sidebar_source_row___lambda458_ (LayoutsSidebarSourceRow* self,
                                               ObjectsProject* project);
static void __layouts_sidebar_source_row___lambda458__services_store_project_deleted (ServicesStore* _sender,
                                                                               ObjectsProject* project,
                                                                               gpointer self);
static void _layouts_sidebar_source_row___lambda459_ (LayoutsSidebarSourceRow* self,
                                               ObjectsProject* project);
static void __layouts_sidebar_source_row___lambda459__services_store_project_archived (ServicesStore* _sender,
                                                                                ObjectsProject* project,
                                                                                gpointer self);
static void _layouts_sidebar_source_row___lambda460_ (LayoutsSidebarSourceRow* self,
                                               ObjectsProject* project,
                                               const gchar* old_parent_id);
VALA_EXTERN void layouts_project_row_hide_destroy (LayoutsProjectRow* self);
static void __layouts_sidebar_source_row___lambda460__services_event_bus_project_parent_changed (ServicesEventBus* _sender,
                                                                                          ObjectsProject* project,
                                                                                          const gchar* old_parent_id,
                                                                                          gboolean collapsed,
                                                                                          gpointer self);
static void _layouts_sidebar_source_row___lambda461_ (LayoutsSidebarSourceRow* self,
                                               GtkWidget* _row,
                                               const gchar* old_parent_id);
static void __layouts_sidebar_source_row___lambda461__services_event_bus_update_inserted_project_map (ServicesEventBus* _sender,
                                                                                               GtkWidget* row,
                                                                                               const gchar* old_parent_id,
                                                                                               gpointer self);
static void _layouts_sidebar_source_row_update_projects_sort_g_settings_changed (GSettings* _sender,
                                                                          const gchar* key,
                                                                          gpointer self);
static void _layouts_sidebar_source_row___lambda462_ (LayoutsSidebarSourceRow* self,
                                               const gchar* source_id);
static void __layouts_sidebar_source_row___lambda462__services_event_bus_projects_drag_begin (ServicesEventBus* _sender,
                                                                                       const gchar* source_id,
                                                                                       gpointer self);
static void _layouts_sidebar_source_row___lambda463_ (LayoutsSidebarSourceRow* self,
                                               const gchar* source_id);
static void __layouts_sidebar_source_row___lambda463__services_event_bus_projects_drag_end (ServicesEventBus* _sender,
                                                                                     const gchar* source_id,
                                                                                     gpointer self);
static void layouts_sidebar_source_row_finalize (GObject * obj);
static GType layouts_sidebar_source_row_get_type_once (void);
static void _vala_layouts_sidebar_source_row_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec);
static void _vala_layouts_sidebar_source_row_set_property (GObject * object,
                                                    guint property_id,
                                                    const GValue * value,
                                                    GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
layouts_sidebar_source_row_get_instance_private (LayoutsSidebarSourceRow* self)
{
	return G_STRUCT_MEMBER_P (self, LayoutsSidebarSourceRow_private_offset);
}

LayoutsSidebarSourceRow*
layouts_sidebar_source_row_construct (GType object_type,
                                      ObjectsSource* source)
{
	LayoutsSidebarSourceRow * self = NULL;
	g_return_val_if_fail (source != NULL, NULL);
	self = (LayoutsSidebarSourceRow*) g_object_new (object_type, "source", source, NULL);
	return self;
}

LayoutsSidebarSourceRow*
layouts_sidebar_source_row_new (ObjectsSource* source)
{
	return layouts_sidebar_source_row_construct (LAYOUTS_TYPE_SIDEBAR_SOURCE_ROW, source);
}

static gboolean
__lambda263_ (LayoutsSidebarSourceRow* self)
{
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	gboolean result;
	_tmp0_ = gtk_widget_get_parent ((GtkWidget*) self);
	_tmp1_ = _tmp0_;
	gtk_list_box_remove (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_list_box_get_type (), GtkListBox), (GtkWidget*) self);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda263__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda263_ ((LayoutsSidebarSourceRow*) self);
	return result;
}

void
layouts_sidebar_source_row_hide_destroy (LayoutsSidebarSourceRow* self)
{
	GtkRevealer* _tmp0_;
	GtkRevealer* _tmp1_;
	guint _tmp2_;
	guint _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->main_revealer;
	gtk_revealer_set_reveal_child (_tmp0_, FALSE);
	_tmp1_ = self->priv->main_revealer;
	_tmp2_ = gtk_revealer_get_transition_duration (_tmp1_);
	_tmp3_ = _tmp2_;
	g_timeout_add_full (G_PRIORITY_DEFAULT, _tmp3_, ___lambda263__gsource_func, g_object_ref (self), g_object_unref);
}

static void
layouts_sidebar_source_row_prepare_new_project (LayoutsSidebarSourceRow* self,
                                                const gchar* id)
{
	DialogsProject* dialog = NULL;
	DialogsProject* _tmp0_;
	Planify* _tmp1_;
	MainWindow* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (id != NULL);
	_tmp0_ = dialogs_project_new_new (id, FALSE, "");
	g_object_ref_sink (_tmp0_);
	dialog = _tmp0_;
	_tmp1_ = planify__instance;
	_tmp2_ = _tmp1_->main_window;
	adw_dialog_present ((AdwDialog*) dialog, (GtkWidget*) _tmp2_);
	_g_object_unref0 (dialog);
}

static void
layouts_sidebar_source_row_add_all_projects (LayoutsSidebarSourceRow* self)
{
	g_return_if_fail (self != NULL);
	{
		GeeArrayList* _project_list = NULL;
		ServicesStore* _tmp0_;
		ObjectsSource* _tmp1_;
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		GeeArrayList* _tmp4_;
		gint _project_size = 0;
		GeeArrayList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _project_index = 0;
		_tmp0_ = services_store_instance ();
		_tmp1_ = self->priv->_source;
		_tmp2_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = services_store_get_projects_by_source (_tmp0_, _tmp3_);
		_project_list = _tmp4_;
		_tmp5_ = _project_list;
		_tmp6_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		_project_size = _tmp7_;
		_project_index = -1;
		while (TRUE) {
			gint _tmp8_;
			gint _tmp9_;
			ObjectsProject* project = NULL;
			GeeArrayList* _tmp10_;
			gpointer _tmp11_;
			ObjectsProject* _tmp12_;
			_project_index = _project_index + 1;
			_tmp8_ = _project_index;
			_tmp9_ = _project_size;
			if (!(_tmp8_ < _tmp9_)) {
				break;
			}
			_tmp10_ = _project_list;
			_tmp11_ = gee_abstract_list_get ((GeeAbstractList*) _tmp10_, _project_index);
			project = (ObjectsProject*) _tmp11_;
			_tmp12_ = project;
			layouts_sidebar_source_row_add_row_project (self, _tmp12_);
			_g_object_unref0 (project);
		}
		_g_object_unref0 (_project_list);
	}
}

static void
layouts_sidebar_source_row_add_row_project (LayoutsSidebarSourceRow* self,
                                            ObjectsProject* project)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	ObjectsSource* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	_tmp2_ = objects_project_get_source_id (project);
	_tmp3_ = _tmp2_;
	_tmp4_ = self->priv->_source;
	_tmp5_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp4_);
	_tmp6_ = _tmp5_;
	if (g_strcmp0 (_tmp3_, _tmp6_) == 0) {
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		_tmp7_ = objects_project_get_parent_id (project);
		_tmp8_ = _tmp7_;
		_tmp1_ = g_strcmp0 (_tmp8_, "") == 0;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		gboolean _tmp9_;
		gboolean _tmp10_;
		_tmp9_ = objects_project_get_is_archived (project);
		_tmp10_ = _tmp9_;
		_tmp0_ = !_tmp10_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GeeHashMap* _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		_tmp11_ = self->projects_hashmap;
		_tmp12_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
		_tmp13_ = _tmp12_;
		if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp11_, _tmp13_)) {
			GeeHashMap* _tmp14_;
			const gchar* _tmp15_;
			const gchar* _tmp16_;
			LayoutsProjectRow* _tmp17_;
			LayoutsProjectRow* _tmp18_;
			LayoutsHeaderItem* _tmp19_;
			GeeHashMap* _tmp20_;
			const gchar* _tmp21_;
			const gchar* _tmp22_;
			gpointer _tmp23_;
			LayoutsProjectRow* _tmp24_;
			_tmp14_ = self->projects_hashmap;
			_tmp15_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
			_tmp16_ = _tmp15_;
			_tmp17_ = layouts_project_row_new (project, TRUE, TRUE);
			g_object_ref_sink (_tmp17_);
			_tmp18_ = _tmp17_;
			gee_abstract_map_set ((GeeAbstractMap*) _tmp14_, _tmp16_, _tmp18_);
			_g_object_unref0 (_tmp18_);
			_tmp19_ = self->priv->group;
			_tmp20_ = self->projects_hashmap;
			_tmp21_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
			_tmp22_ = _tmp21_;
			_tmp23_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp20_, _tmp22_);
			_tmp24_ = (LayoutsProjectRow*) _tmp23_;
			layouts_header_item_add_child (_tmp19_, (GtkWidget*) _tmp24_);
			_g_object_unref0 (_tmp24_);
		}
	}
}

static gint
_layouts_sidebar_source_row_projects_sort_func_gtk_list_box_sort_func (GtkListBoxRow* row1,
                                                                       GtkListBoxRow* row2,
                                                                       gpointer self)
{
	gint result;
	result = layouts_sidebar_source_row_projects_sort_func ((LayoutsSidebarSourceRow*) self, row1, row2);
	return result;
}

static void
layouts_sidebar_source_row_update_projects_sort (LayoutsSidebarSourceRow* self)
{
	ServicesSettings* _tmp0_;
	ServicesSettings* _tmp1_;
	GSettings* _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = services_settings_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = g_settings_get_enum (_tmp2_, "projects-sort-by") == 1;
	_g_object_unref0 (_tmp1_);
	if (_tmp3_) {
		LayoutsHeaderItem* _tmp4_;
		_tmp4_ = self->priv->group;
		layouts_header_item_set_sort_func (_tmp4_, _layouts_sidebar_source_row_projects_sort_func_gtk_list_box_sort_func, g_object_ref (self), g_object_unref);
	} else {
		LayoutsHeaderItem* _tmp5_;
		_tmp5_ = self->priv->group;
		layouts_header_item_set_sort_func (_tmp5_, NULL, NULL, NULL);
	}
}

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

static gint
layouts_sidebar_source_row_projects_sort_func (LayoutsSidebarSourceRow* self,
                                               GtkListBoxRow* lbrow,
                                               GtkListBoxRow* lbbefore)
{
	ObjectsProject* project1 = NULL;
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	ObjectsProject* _tmp2_;
	ObjectsProject* project2 = NULL;
	ObjectsProject* _tmp3_;
	ObjectsProject* _tmp4_;
	ObjectsProject* _tmp5_;
	gint ordered = 0;
	ServicesSettings* _tmp6_;
	ServicesSettings* _tmp7_;
	GSettings* _tmp8_;
	gint _tmp9_;
	gint _tmp10_ = 0;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (lbrow != NULL, -1);
	g_return_val_if_fail (lbbefore != NULL, -1);
	_tmp0_ = layouts_project_row_get_project (G_TYPE_CHECK_INSTANCE_CAST (lbrow, LAYOUTS_TYPE_PROJECT_ROW, LayoutsProjectRow));
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	project1 = _tmp2_;
	_tmp3_ = layouts_project_row_get_project (G_TYPE_CHECK_INSTANCE_CAST (lbbefore, LAYOUTS_TYPE_PROJECT_ROW, LayoutsProjectRow));
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	project2 = _tmp5_;
	_tmp6_ = services_settings_get_default ();
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_->settings;
	_tmp9_ = g_settings_get_enum (_tmp8_, "projects-ordered");
	_g_object_unref0 (_tmp7_);
	ordered = _tmp9_;
	if (ordered == 0) {
		ObjectsProject* _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		ObjectsProject* _tmp14_;
		const gchar* _tmp15_;
		const gchar* _tmp16_;
		_tmp11_ = project2;
		_tmp12_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = project1;
		_tmp15_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp14_);
		_tmp16_ = _tmp15_;
		_tmp10_ = g_utf8_collate (_tmp13_, _tmp16_);
	} else {
		ObjectsProject* _tmp17_;
		const gchar* _tmp18_;
		const gchar* _tmp19_;
		ObjectsProject* _tmp20_;
		const gchar* _tmp21_;
		const gchar* _tmp22_;
		_tmp17_ = project1;
		_tmp18_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = project2;
		_tmp21_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp20_);
		_tmp22_ = _tmp21_;
		_tmp10_ = g_utf8_collate (_tmp19_, _tmp22_);
	}
	result = _tmp10_;
	_g_object_unref0 (project2);
	_g_object_unref0 (project1);
	return result;
}

static Block48Data*
block48_data_ref (Block48Data* _data48_)
{
	g_atomic_int_inc (&_data48_->_ref_count_);
	return _data48_;
}

static void
block48_data_unref (void * _userdata_)
{
	Block48Data* _data48_;
	_data48_ = (Block48Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data48_->_ref_count_)) {
		LayoutsSidebarSourceRow* self;
		self = _data48_->self;
		_g_free0 (_data48_->old_parent_id);
		_g_object_unref0 (_data48_->picked_project);
		_g_object_unref0 (_data48_->picked_widget);
		_g_object_unref0 (self);
		g_slice_free (Block48Data, _data48_);
	}
}

static void
____lambda265_ (Block48Data* _data48_,
                GObject* obj,
                GAsyncResult* res)
{
	LayoutsSidebarSourceRow* self;
	ServicesTodoist* _tmp0_;
	ServicesTodoist* _tmp1_;
	HttpResponse* _tmp2_;
	HttpResponse* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	self = _data48_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = services_todoist_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_todoist_move_project_section_finish (_tmp1_, res);
	_tmp3_ = _tmp2_;
	_tmp4_ = http_response_get_status (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_;
	_http_response_unref0 (_tmp3_);
	_g_object_unref0 (_tmp1_);
	if (_tmp6_) {
		ServicesStore* _tmp7_;
		ObjectsProject* _tmp8_;
		ServicesEventBus* _tmp9_;
		ServicesEventBus* _tmp10_;
		LayoutsProjectRow* _tmp11_;
		const gchar* _tmp12_;
		_tmp7_ = services_store_instance ();
		_tmp8_ = _data48_->picked_project;
		services_store_update_project (_tmp7_, _tmp8_);
		_tmp9_ = services_event_bus_get_default ();
		_tmp10_ = _tmp9_;
		_tmp11_ = _data48_->picked_widget;
		_tmp12_ = _data48_->old_parent_id;
		g_signal_emit_by_name (_tmp10_, "update-inserted-project-map", (GtkWidget*) _tmp11_, _tmp12_);
		_g_object_unref0 (_tmp10_);
	}
}

static void
_____lambda265__gasync_ready_callback (GObject* source_object,
                                       GAsyncResult* res,
                                       gpointer self)
{
	____lambda265_ (self, source_object, res);
	block48_data_unref (self);
}

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

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

static gboolean
__lambda264_ (LayoutsSidebarSourceRow* self,
              GValue* value,
              gdouble x,
              gdouble y)
{
	Block48Data* _data48_;
	GValue _tmp0_;
	LayoutsProjectRow* _tmp1_;
	LayoutsProjectRow* _tmp2_;
	ObjectsProject* _tmp3_;
	ObjectsProject* _tmp4_;
	ObjectsProject* _tmp5_;
	gint projects_sort = 0;
	ServicesSettings* _tmp6_;
	ServicesSettings* _tmp7_;
	GSettings* _tmp8_;
	gint _tmp9_;
	GtkListBox* source_list = NULL;
	LayoutsProjectRow* _tmp19_;
	GtkWidget* _tmp20_;
	GtkWidget* _tmp21_;
	GtkListBox* _tmp22_;
	GtkListBox* target_list = NULL;
	LayoutsHeaderItem* _tmp23_;
	GtkListBox* _tmp24_;
	GtkListBox* _tmp25_;
	ObjectsProject* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	gchar* _tmp29_;
	ObjectsProject* _tmp30_;
	const gchar* _tmp31_;
	const gchar* _tmp32_;
	GtkListBox* _tmp46_;
	LayoutsProjectRow* _tmp47_;
	gint children_count = 0;
	Util* _tmp48_;
	Util* _tmp49_;
	GtkListBox* _tmp50_;
	GList* _tmp51_;
	GList* _tmp52_;
	gint _tmp53_;
	GtkListBox* _tmp54_;
	LayoutsProjectRow* _tmp55_;
	GtkListBox* _tmp56_;
	gboolean result;
	g_return_val_if_fail (value != NULL, FALSE);
	_data48_ = g_slice_new0 (Block48Data);
	_data48_->_ref_count_ = 1;
	_data48_->self = g_object_ref (self);
	_tmp0_ = *value;
	_tmp1_ = _g_object_ref0 (g_value_get_object (&_tmp0_));
	_data48_->picked_widget = _tmp1_;
	_tmp2_ = _data48_->picked_widget;
	_tmp3_ = layouts_project_row_get_project (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	_data48_->picked_project = _tmp5_;
	_tmp6_ = services_settings_get_default ();
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_->settings;
	_tmp9_ = g_settings_get_enum (_tmp8_, "projects-sort-by");
	_g_object_unref0 (_tmp7_);
	projects_sort = _tmp9_;
	if (projects_sort != 0) {
		ServicesSettings* _tmp10_;
		ServicesSettings* _tmp11_;
		GSettings* _tmp12_;
		ServicesEventBus* _tmp13_;
		ServicesEventBus* _tmp14_;
		Util* _tmp15_;
		Util* _tmp16_;
		AdwToast* _tmp17_;
		AdwToast* _tmp18_;
		_tmp10_ = services_settings_get_default ();
		_tmp11_ = _tmp10_;
		_tmp12_ = _tmp11_->settings;
		g_settings_set_enum (_tmp12_, "projects-sort-by", 0);
		_g_object_unref0 (_tmp11_);
		_tmp13_ = services_event_bus_get_default ();
		_tmp14_ = _tmp13_;
		_tmp15_ = util_get_default ();
		_tmp16_ = _tmp15_;
		_tmp17_ = util_create_toast (_tmp16_, _ ("Projects sort changed to 'Custom sort order'"), (guint) 2, ADW_TOAST_PRIORITY_NORMAL);
		_tmp18_ = _tmp17_;
		g_signal_emit_by_name (_tmp14_, "send-toast", _tmp18_);
		_g_object_unref0 (_tmp18_);
		_g_object_unref0 (_tmp16_);
		_g_object_unref0 (_tmp14_);
	}
	_tmp19_ = _data48_->picked_widget;
	_tmp20_ = gtk_widget_get_parent ((GtkWidget*) _tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, gtk_list_box_get_type (), GtkListBox));
	source_list = _tmp22_;
	_tmp23_ = self->priv->group;
	_tmp24_ = _tmp23_->listbox;
	_tmp25_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp24_, gtk_list_box_get_type (), GtkListBox));
	target_list = _tmp25_;
	_tmp26_ = _data48_->picked_project;
	_tmp27_ = objects_project_get_parent_id (_tmp26_);
	_tmp28_ = _tmp27_;
	_tmp29_ = g_strdup (_tmp28_);
	_data48_->old_parent_id = _tmp29_;
	_tmp30_ = _data48_->picked_project;
	_tmp31_ = objects_project_get_parent_id (_tmp30_);
	_tmp32_ = _tmp31_;
	if (g_strcmp0 (_tmp32_, "") != 0) {
		ObjectsProject* _tmp33_;
		ObjectsProject* _tmp34_;
		SourceType _tmp35_;
		SourceType _tmp36_;
		_tmp33_ = _data48_->picked_project;
		objects_project_set_parent_id (_tmp33_, "");
		_tmp34_ = _data48_->picked_project;
		_tmp35_ = objects_project_get_source_type (_tmp34_);
		_tmp36_ = _tmp35_;
		if (_tmp36_ == SOURCE_TYPE_TODOIST) {
			ServicesTodoist* _tmp37_;
			ServicesTodoist* _tmp38_;
			ObjectsProject* _tmp39_;
			_tmp37_ = services_todoist_get_default ();
			_tmp38_ = _tmp37_;
			_tmp39_ = _data48_->picked_project;
			services_todoist_move_project_section (_tmp38_, (ObjectsBaseObject*) _tmp39_, "", _____lambda265__gasync_ready_callback, block48_data_ref (_data48_));
			_g_object_unref0 (_tmp38_);
		} else {
			ServicesStore* _tmp40_;
			ObjectsProject* _tmp41_;
			ServicesEventBus* _tmp42_;
			ServicesEventBus* _tmp43_;
			LayoutsProjectRow* _tmp44_;
			const gchar* _tmp45_;
			_tmp40_ = services_store_instance ();
			_tmp41_ = _data48_->picked_project;
			services_store_update_project (_tmp40_, _tmp41_);
			_tmp42_ = services_event_bus_get_default ();
			_tmp43_ = _tmp42_;
			_tmp44_ = _data48_->picked_widget;
			_tmp45_ = _data48_->old_parent_id;
			g_signal_emit_by_name (_tmp43_, "update-inserted-project-map", (GtkWidget*) _tmp44_, _tmp45_);
			_g_object_unref0 (_tmp43_);
		}
	}
	_tmp46_ = source_list;
	_tmp47_ = _data48_->picked_widget;
	gtk_list_box_remove (_tmp46_, (GtkWidget*) _tmp47_);
	_tmp48_ = util_get_default ();
	_tmp49_ = _tmp48_;
	_tmp50_ = target_list;
	_tmp51_ = util_get_children (_tmp49_, _tmp50_);
	_tmp52_ = _tmp51_;
	_tmp53_ = (gint) g_list_length (_tmp52_);
	(_tmp52_ == NULL) ? NULL : (_tmp52_ = (_g_list_free__g_object_unref0_ (_tmp52_), NULL));
	_g_object_unref0 (_tmp49_);
	children_count = _tmp53_;
	_tmp54_ = target_list;
	_tmp55_ = _data48_->picked_widget;
	gtk_list_box_insert (_tmp54_, (GtkWidget*) _tmp55_, children_count);
	_tmp56_ = target_list;
	layouts_sidebar_source_row_update_projects_child_order (self, _tmp56_);
	result = TRUE;
	_g_object_unref0 (target_list);
	_g_object_unref0 (source_list);
	block48_data_unref (_data48_);
	_data48_ = NULL;
	return result;
}

static gboolean
___lambda264__gtk_drop_target_drop (GtkDropTarget* _sender,
                                    GValue* value,
                                    gdouble x,
                                    gdouble y,
                                    gpointer self)
{
	gboolean result;
	result = __lambda264_ ((LayoutsSidebarSourceRow*) self, value, x, y);
	return result;
}

static void
layouts_sidebar_source_row_build_last_drag_and_drop (LayoutsSidebarSourceRow* self)
{
	GtkDropTarget* drop_order_target = NULL;
	GtkDropTarget* _tmp0_;
	LayoutsHeaderItem* _tmp1_;
	GtkGrid* _tmp2_;
	GtkEventController* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_drop_target_new (LAYOUTS_TYPE_PROJECT_ROW, GDK_ACTION_MOVE);
	drop_order_target = _tmp0_;
	_tmp1_ = self->priv->group;
	_tmp2_ = _tmp1_->drop_target_end;
	_tmp3_ = _g_object_ref0 ((GtkEventController*) drop_order_target);
	gtk_widget_add_controller ((GtkWidget*) _tmp2_, _tmp3_);
	g_signal_connect_object (drop_order_target, "drop", (GCallback) ___lambda264__gtk_drop_target_drop, self, 0);
	_g_object_unref0 (drop_order_target);
}

static void
layouts_sidebar_source_row_update_projects_child_order (LayoutsSidebarSourceRow* self,
                                                        GtkListBox* listbox)
{
	LayoutsProjectRow* project_row = NULL;
	gint row_index = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (listbox != NULL);
	project_row = NULL;
	row_index = 0;
	{
		gboolean _tmp0_ = FALSE;
		_tmp0_ = TRUE;
		while (TRUE) {
			GtkListBoxRow* _tmp2_;
			LayoutsProjectRow* _tmp3_;
			gint _tmp11_;
			if (!_tmp0_) {
				LayoutsProjectRow* _tmp1_;
				_tmp1_ = project_row;
				if (!(_tmp1_ != NULL)) {
					break;
				}
			}
			_tmp0_ = FALSE;
			_tmp2_ = gtk_list_box_get_row_at_index (listbox, row_index);
			project_row = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, LAYOUTS_TYPE_PROJECT_ROW, LayoutsProjectRow);
			_tmp3_ = project_row;
			if (_tmp3_ != NULL) {
				LayoutsProjectRow* _tmp4_;
				ObjectsProject* _tmp5_;
				ObjectsProject* _tmp6_;
				ServicesStore* _tmp7_;
				LayoutsProjectRow* _tmp8_;
				ObjectsProject* _tmp9_;
				ObjectsProject* _tmp10_;
				_tmp4_ = project_row;
				_tmp5_ = layouts_project_row_get_project (_tmp4_);
				_tmp6_ = _tmp5_;
				objects_project_set_child_order (_tmp6_, row_index);
				_tmp7_ = services_store_instance ();
				_tmp8_ = project_row;
				_tmp9_ = layouts_project_row_get_project (_tmp8_);
				_tmp10_ = _tmp9_;
				services_store_update_project (_tmp7_, _tmp10_);
			}
			_tmp11_ = row_index;
			row_index = _tmp11_ + 1;
		}
	}
}

ObjectsSource*
layouts_sidebar_source_row_get_source (LayoutsSidebarSourceRow* self)
{
	ObjectsSource* result;
	ObjectsSource* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_source;
	result = _tmp0_;
	return result;
}

static void
layouts_sidebar_source_row_set_source (LayoutsSidebarSourceRow* self,
                                       ObjectsSource* value)
{
	ObjectsSource* old_value;
	g_return_if_fail (self != NULL);
	old_value = layouts_sidebar_source_row_get_source (self);
	if (old_value != value) {
		ObjectsSource* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_source);
		self->priv->_source = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, layouts_sidebar_source_row_properties[LAYOUTS_SIDEBAR_SOURCE_ROW_SOURCE_PROPERTY]);
	}
}

static Block49Data*
block49_data_ref (Block49Data* _data49_)
{
	g_atomic_int_inc (&_data49_->_ref_count_);
	return _data49_;
}

static void
block49_data_unref (void * _userdata_)
{
	Block49Data* _data49_;
	_data49_ = (Block49Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data49_->_ref_count_)) {
		LayoutsSidebarSourceRow* self;
		self = _data49_->self;
		_g_object_unref0 (_data49_->sync_button);
		_g_object_unref0 (self);
		g_slice_free (Block49Data, _data49_);
	}
}

static void
_layouts_sidebar_source_row____lambda269_ (LayoutsSidebarSourceRow* self)
{
	ObjectsSource* _tmp0_;
	SourceType _tmp1_;
	SourceType _tmp2_;
	_tmp0_ = self->priv->_source;
	_tmp1_ = objects_source_get_source_type (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == SOURCE_TYPE_TODOIST) {
		ObjectsSource* _tmp3_;
		ServicesTodoist* _tmp9_;
		ServicesTodoist* _tmp10_;
		ObjectsSource* _tmp11_;
		_tmp3_ = self->priv->_source;
		if (objects_source_needs_migration (_tmp3_)) {
			DialogsPreferencesPreferencesWindow* preferences_dialog = NULL;
			DialogsPreferencesPreferencesWindow* _tmp4_;
			DialogsPreferencesPreferencesWindow* _tmp5_;
			DialogsPreferencesPreferencesWindow* _tmp6_;
			Planify* _tmp7_;
			MainWindow* _tmp8_;
			_tmp4_ = dialogs_preferences_preferences_window_new ();
			g_object_ref_sink (_tmp4_);
			preferences_dialog = _tmp4_;
			_tmp5_ = preferences_dialog;
			dialogs_preferences_preferences_window_show_page (_tmp5_, "accounts");
			_tmp6_ = preferences_dialog;
			_tmp7_ = planify__instance;
			_tmp8_ = _tmp7_->main_window;
			adw_dialog_present ((AdwDialog*) _tmp6_, (GtkWidget*) _tmp8_);
			_g_object_unref0 (preferences_dialog);
			return;
		}
		_tmp9_ = services_todoist_get_default ();
		_tmp10_ = _tmp9_;
		_tmp11_ = self->priv->_source;
		services_todoist_sync (_tmp10_, _tmp11_, NULL, NULL);
		_g_object_unref0 (_tmp10_);
	} else {
		ObjectsSource* _tmp12_;
		SourceType _tmp13_;
		SourceType _tmp14_;
		_tmp12_ = self->priv->_source;
		_tmp13_ = objects_source_get_source_type (_tmp12_);
		_tmp14_ = _tmp13_;
		if (_tmp14_ == SOURCE_TYPE_CALDAV) {
			ServicesCalDAVCore* _tmp15_;
			ServicesCalDAVCore* _tmp16_;
			ObjectsSource* _tmp17_;
			_tmp15_ = services_cal_dav_core_get_default ();
			_tmp16_ = _tmp15_;
			_tmp17_ = self->priv->_source;
			services_cal_dav_core_sync (_tmp16_, _tmp17_, NULL, NULL);
			_g_object_unref0 (_tmp16_);
		}
	}
}

static void
__layouts_sidebar_source_row____lambda269__widgets_sync_button_clicked (WidgetsSyncButton* _sender,
                                                                        gpointer self)
{
	_layouts_sidebar_source_row____lambda269_ ((LayoutsSidebarSourceRow*) self);
}

static void
_layouts_sidebar_source_row____lambda452_ (Block49Data* _data49_)
{
	LayoutsSidebarSourceRow* self;
	WidgetsSyncButton* _tmp0_;
	self = _data49_->self;
	_tmp0_ = _data49_->sync_button;
	widgets_sync_button_sync_started (_tmp0_);
}

static void
__layouts_sidebar_source_row____lambda452__objects_source_sync_started (ObjectsSource* _sender,
                                                                        gpointer self)
{
	_layouts_sidebar_source_row____lambda452_ (self);
}

static void
_layouts_sidebar_source_row____lambda453_ (Block49Data* _data49_)
{
	LayoutsSidebarSourceRow* self;
	WidgetsSyncButton* _tmp0_;
	self = _data49_->self;
	_tmp0_ = _data49_->sync_button;
	widgets_sync_button_sync_finished (_tmp0_);
}

static void
__layouts_sidebar_source_row____lambda453__objects_source_sync_finished (ObjectsSource* _sender,
                                                                         gpointer self)
{
	_layouts_sidebar_source_row____lambda453_ (self);
}

static void
_layouts_sidebar_source_row____lambda454_ (Block49Data* _data49_,
                                           SyncStatus* status)
{
	LayoutsSidebarSourceRow* self;
	self = _data49_->self;
	if (status != NULL) {
		WidgetsSyncButton* _tmp0_;
		const gchar* _tmp1_;
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp0_ = _data49_->sync_button;
		_tmp1_ = sync_status_get_title (status);
		_tmp2_ = _tmp1_;
		_tmp3_ = sync_status_get_description (status);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_strdup_printf ("<b>%s</b>\n%s", _tmp2_, _tmp4_);
		_tmp6_ = _tmp5_;
		widgets_sync_button_sync_failed (_tmp0_, _tmp6_);
		_g_free0 (_tmp6_);
	} else {
		gboolean _tmp7_ = FALSE;
		ObjectsSource* _tmp8_;
		SourceType _tmp9_;
		SourceType _tmp10_;
		_tmp8_ = self->priv->_source;
		_tmp9_ = objects_source_get_source_type (_tmp8_);
		_tmp10_ = _tmp9_;
		if (_tmp10_ == SOURCE_TYPE_TODOIST) {
			ObjectsSource* _tmp11_;
			_tmp11_ = self->priv->_source;
			_tmp7_ = objects_source_needs_migration (_tmp11_);
		} else {
			_tmp7_ = FALSE;
		}
		if (_tmp7_) {
			WidgetsSyncButton* _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			_tmp12_ = _data49_->sync_button;
			_tmp13_ = g_strdup_printf ("<b>%s</b>\n%s", _ ("Account Migration Required"), _ ("Todoist has updated their API. Please reconnect your account in Prefer" \
"ences to continue syncing."));
			_tmp14_ = _tmp13_;
			widgets_sync_button_sync_failed (_tmp12_, _tmp14_);
			_g_free0 (_tmp14_);
		} else {
			WidgetsSyncButton* _tmp15_;
			_tmp15_ = _data49_->sync_button;
			widgets_sync_button_sync_failed (_tmp15_, NULL);
		}
	}
}

static void
__layouts_sidebar_source_row____lambda454__objects_source_sync_failed (ObjectsSource* _sender,
                                                                       SyncStatus* status,
                                                                       gpointer self)
{
	_layouts_sidebar_source_row____lambda454_ (self, status);
}

static gboolean
_layouts_sidebar_source_row___lambda455_ (LayoutsSidebarSourceRow* self)
{
	GtkRevealer* _tmp0_;
	ObjectsSource* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	_tmp0_ = self->priv->main_revealer;
	_tmp1_ = self->priv->_source;
	_tmp2_ = objects_source_get_is_visible (_tmp1_);
	_tmp3_ = _tmp2_;
	gtk_revealer_set_reveal_child (_tmp0_, _tmp3_);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
__layouts_sidebar_source_row___lambda455__gsource_func (gpointer self)
{
	gboolean result;
	result = _layouts_sidebar_source_row___lambda455_ ((LayoutsSidebarSourceRow*) self);
	return result;
}

static void
_layouts_sidebar_source_row___lambda456_ (LayoutsSidebarSourceRow* self)
{
	LayoutsHeaderItem* _tmp0_;
	ObjectsSource* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	GtkRevealer* _tmp4_;
	ObjectsSource* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	_tmp0_ = self->priv->group;
	_tmp1_ = self->priv->_source;
	_tmp2_ = objects_source_get_display_name (_tmp1_);
	_tmp3_ = _tmp2_;
	layouts_header_item_set_header_title (_tmp0_, _tmp3_);
	_tmp4_ = self->priv->main_revealer;
	_tmp5_ = self->priv->_source;
	_tmp6_ = objects_source_get_is_visible (_tmp5_);
	_tmp7_ = _tmp6_;
	gtk_revealer_set_reveal_child (_tmp4_, _tmp7_);
}

static void
__layouts_sidebar_source_row___lambda456__objects_base_object_updated (ObjectsBaseObject* _sender,
                                                                       const gchar* update_id,
                                                                       gpointer self)
{
	_layouts_sidebar_source_row___lambda456_ ((LayoutsSidebarSourceRow*) self);
}

static void
_layouts_sidebar_source_row___lambda457_ (LayoutsSidebarSourceRow* self)
{
	ObjectsSource* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	_tmp0_ = self->priv->_source;
	_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp0_);
	_tmp2_ = _tmp1_;
	layouts_sidebar_source_row_prepare_new_project (self, _tmp2_);
}

static void
__layouts_sidebar_source_row___lambda457__gtk_button_clicked (GtkButton* _sender,
                                                              gpointer self)
{
	_layouts_sidebar_source_row___lambda457_ ((LayoutsSidebarSourceRow*) self);
}

static void
_layouts_sidebar_source_row_add_row_project_services_store_project_added (ServicesStore* _sender,
                                                                          ObjectsProject* project,
                                                                          gpointer self)
{
	layouts_sidebar_source_row_add_row_project ((LayoutsSidebarSourceRow*) self, project);
}

static void
_layouts_sidebar_source_row_update_projects_sort_services_store_project_updated (ServicesStore* _sender,
                                                                                 ObjectsProject* project,
                                                                                 gpointer self)
{
	layouts_sidebar_source_row_update_projects_sort ((LayoutsSidebarSourceRow*) self);
}

static void
_layouts_sidebar_source_row_add_row_project_services_store_project_unarchived (ServicesStore* _sender,
                                                                               ObjectsProject* project,
                                                                               gpointer self)
{
	layouts_sidebar_source_row_add_row_project ((LayoutsSidebarSourceRow*) self, project);
}

static void
_layouts_sidebar_source_row___lambda458_ (LayoutsSidebarSourceRow* self,
                                          ObjectsProject* project)
{
	GeeHashMap* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (project != NULL);
	_tmp0_ = self->projects_hashmap;
	_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp2_ = _tmp1_;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, _tmp2_)) {
		GeeHashMap* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp3_ = self->projects_hashmap;
		_tmp4_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
		_tmp5_ = _tmp4_;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp3_, _tmp5_, NULL);
	}
}

static void
__layouts_sidebar_source_row___lambda458__services_store_project_deleted (ServicesStore* _sender,
                                                                          ObjectsProject* project,
                                                                          gpointer self)
{
	_layouts_sidebar_source_row___lambda458_ ((LayoutsSidebarSourceRow*) self, project);
}

static void
_layouts_sidebar_source_row___lambda459_ (LayoutsSidebarSourceRow* self,
                                          ObjectsProject* project)
{
	GeeHashMap* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (project != NULL);
	_tmp0_ = self->projects_hashmap;
	_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp2_ = _tmp1_;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, _tmp2_)) {
		GeeHashMap* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp3_ = self->projects_hashmap;
		_tmp4_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
		_tmp5_ = _tmp4_;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp3_, _tmp5_, NULL);
	}
}

static void
__layouts_sidebar_source_row___lambda459__services_store_project_archived (ServicesStore* _sender,
                                                                           ObjectsProject* project,
                                                                           gpointer self)
{
	_layouts_sidebar_source_row___lambda459_ ((LayoutsSidebarSourceRow*) self, project);
}

static void
_layouts_sidebar_source_row___lambda460_ (LayoutsSidebarSourceRow* self,
                                          ObjectsProject* project,
                                          const gchar* old_parent_id)
{
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	g_return_if_fail (project != NULL);
	g_return_if_fail (old_parent_id != NULL);
	if (g_strcmp0 (old_parent_id, "") == 0) {
		GeeHashMap* _tmp0_;
		const gchar* _tmp1_;
		const gchar* _tmp2_;
		_tmp0_ = self->projects_hashmap;
		_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
		_tmp2_ = _tmp1_;
		if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, _tmp2_)) {
			GeeHashMap* _tmp3_;
			const gchar* _tmp4_;
			const gchar* _tmp5_;
			gpointer _tmp6_;
			LayoutsProjectRow* _tmp7_;
			GeeHashMap* _tmp8_;
			const gchar* _tmp9_;
			const gchar* _tmp10_;
			_tmp3_ = self->projects_hashmap;
			_tmp4_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
			_tmp5_ = _tmp4_;
			_tmp6_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp3_, _tmp5_);
			_tmp7_ = (LayoutsProjectRow*) _tmp6_;
			layouts_project_row_hide_destroy (_tmp7_);
			_g_object_unref0 (_tmp7_);
			_tmp8_ = self->projects_hashmap;
			_tmp9_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
			_tmp10_ = _tmp9_;
			gee_abstract_map_unset ((GeeAbstractMap*) _tmp8_, _tmp10_, NULL);
		}
	}
	_tmp11_ = objects_project_get_parent_id (project);
	_tmp12_ = _tmp11_;
	if (g_strcmp0 (_tmp12_, "") == 0) {
		layouts_sidebar_source_row_add_row_project (self, project);
	}
}

static void
__layouts_sidebar_source_row___lambda460__services_event_bus_project_parent_changed (ServicesEventBus* _sender,
                                                                                     ObjectsProject* project,
                                                                                     const gchar* old_parent_id,
                                                                                     gboolean collapsed,
                                                                                     gpointer self)
{
	_layouts_sidebar_source_row___lambda460_ ((LayoutsSidebarSourceRow*) self, project, old_parent_id);
}

static void
_layouts_sidebar_source_row___lambda461_ (LayoutsSidebarSourceRow* self,
                                          GtkWidget* _row,
                                          const gchar* old_parent_id)
{
	LayoutsProjectRow* row = NULL;
	LayoutsProjectRow* _tmp0_;
	gboolean _tmp13_ = FALSE;
	LayoutsProjectRow* _tmp14_;
	ObjectsProject* _tmp15_;
	ObjectsProject* _tmp16_;
	gboolean _tmp17_;
	gboolean _tmp18_;
	g_return_if_fail (_row != NULL);
	g_return_if_fail (old_parent_id != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_row, LAYOUTS_TYPE_PROJECT_ROW, LayoutsProjectRow));
	row = _tmp0_;
	if (g_strcmp0 (old_parent_id, "") == 0) {
		GeeHashMap* _tmp1_;
		LayoutsProjectRow* _tmp2_;
		ObjectsProject* _tmp3_;
		ObjectsProject* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		_tmp1_ = self->projects_hashmap;
		_tmp2_ = row;
		_tmp3_ = layouts_project_row_get_project (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp4_);
		_tmp6_ = _tmp5_;
		if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp1_, _tmp6_)) {
			GeeHashMap* _tmp7_;
			LayoutsProjectRow* _tmp8_;
			ObjectsProject* _tmp9_;
			ObjectsProject* _tmp10_;
			const gchar* _tmp11_;
			const gchar* _tmp12_;
			_tmp7_ = self->projects_hashmap;
			_tmp8_ = row;
			_tmp9_ = layouts_project_row_get_project (_tmp8_);
			_tmp10_ = _tmp9_;
			_tmp11_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp10_);
			_tmp12_ = _tmp11_;
			gee_abstract_map_unset ((GeeAbstractMap*) _tmp7_, _tmp12_, NULL);
		}
	}
	_tmp14_ = row;
	_tmp15_ = layouts_project_row_get_project (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = objects_project_get_is_inbox_project (_tmp16_);
	_tmp18_ = _tmp17_;
	if (!_tmp18_) {
		LayoutsProjectRow* _tmp19_;
		ObjectsProject* _tmp20_;
		ObjectsProject* _tmp21_;
		const gchar* _tmp22_;
		const gchar* _tmp23_;
		_tmp19_ = row;
		_tmp20_ = layouts_project_row_get_project (_tmp19_);
		_tmp21_ = _tmp20_;
		_tmp22_ = objects_project_get_parent_id (_tmp21_);
		_tmp23_ = _tmp22_;
		_tmp13_ = g_strcmp0 (_tmp23_, "") == 0;
	} else {
		_tmp13_ = FALSE;
	}
	if (_tmp13_) {
		LayoutsProjectRow* _tmp24_;
		ObjectsProject* _tmp25_;
		ObjectsProject* _tmp26_;
		const gchar* _tmp27_;
		const gchar* _tmp28_;
		ObjectsSource* _tmp29_;
		const gchar* _tmp30_;
		const gchar* _tmp31_;
		_tmp24_ = row;
		_tmp25_ = layouts_project_row_get_project (_tmp24_);
		_tmp26_ = _tmp25_;
		_tmp27_ = objects_project_get_source_id (_tmp26_);
		_tmp28_ = _tmp27_;
		_tmp29_ = self->priv->_source;
		_tmp30_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp29_);
		_tmp31_ = _tmp30_;
		if (g_strcmp0 (_tmp28_, _tmp31_) == 0) {
			GeeHashMap* _tmp32_;
			LayoutsProjectRow* _tmp33_;
			ObjectsProject* _tmp34_;
			ObjectsProject* _tmp35_;
			const gchar* _tmp36_;
			const gchar* _tmp37_;
			_tmp32_ = self->projects_hashmap;
			_tmp33_ = row;
			_tmp34_ = layouts_project_row_get_project (_tmp33_);
			_tmp35_ = _tmp34_;
			_tmp36_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp35_);
			_tmp37_ = _tmp36_;
			if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp32_, _tmp37_)) {
				GeeHashMap* _tmp38_;
				LayoutsProjectRow* _tmp39_;
				ObjectsProject* _tmp40_;
				ObjectsProject* _tmp41_;
				const gchar* _tmp42_;
				const gchar* _tmp43_;
				LayoutsProjectRow* _tmp44_;
				_tmp38_ = self->projects_hashmap;
				_tmp39_ = row;
				_tmp40_ = layouts_project_row_get_project (_tmp39_);
				_tmp41_ = _tmp40_;
				_tmp42_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp41_);
				_tmp43_ = _tmp42_;
				_tmp44_ = row;
				gee_abstract_map_set ((GeeAbstractMap*) _tmp38_, _tmp43_, _tmp44_);
			}
		}
	}
	_g_object_unref0 (row);
}

static void
__layouts_sidebar_source_row___lambda461__services_event_bus_update_inserted_project_map (ServicesEventBus* _sender,
                                                                                          GtkWidget* row,
                                                                                          const gchar* old_parent_id,
                                                                                          gpointer self)
{
	_layouts_sidebar_source_row___lambda461_ ((LayoutsSidebarSourceRow*) self, row, old_parent_id);
}

static void
_layouts_sidebar_source_row_update_projects_sort_g_settings_changed (GSettings* _sender,
                                                                     const gchar* key,
                                                                     gpointer self)
{
	layouts_sidebar_source_row_update_projects_sort ((LayoutsSidebarSourceRow*) self);
}

static void
_layouts_sidebar_source_row___lambda462_ (LayoutsSidebarSourceRow* self,
                                          const gchar* source_id)
{
	ObjectsSource* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (source_id != NULL);
	_tmp0_ = self->priv->_source;
	_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (source_id, _tmp2_) == 0) {
		LayoutsHeaderItem* _tmp3_;
		GtkRevealer* _tmp4_;
		_tmp3_ = self->priv->group;
		_tmp4_ = _tmp3_->drop_target_end_revealer;
		gtk_revealer_set_reveal_child (_tmp4_, TRUE);
	}
}

static void
__layouts_sidebar_source_row___lambda462__services_event_bus_projects_drag_begin (ServicesEventBus* _sender,
                                                                                  const gchar* source_id,
                                                                                  gpointer self)
{
	_layouts_sidebar_source_row___lambda462_ ((LayoutsSidebarSourceRow*) self, source_id);
}

static void
_layouts_sidebar_source_row___lambda463_ (LayoutsSidebarSourceRow* self,
                                          const gchar* source_id)
{
	ObjectsSource* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (source_id != NULL);
	_tmp0_ = self->priv->_source;
	_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (source_id, _tmp2_) == 0) {
		LayoutsHeaderItem* _tmp3_;
		GtkRevealer* _tmp4_;
		_tmp3_ = self->priv->group;
		_tmp4_ = _tmp3_->drop_target_end_revealer;
		gtk_revealer_set_reveal_child (_tmp4_, FALSE);
	}
}

static void
__layouts_sidebar_source_row___lambda463__services_event_bus_projects_drag_end (ServicesEventBus* _sender,
                                                                                const gchar* source_id,
                                                                                gpointer self)
{
	_layouts_sidebar_source_row___lambda463_ ((LayoutsSidebarSourceRow*) self, source_id);
}

static GObject *
layouts_sidebar_source_row_constructor (GType type,
                                        guint n_construct_properties,
                                        GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	LayoutsSidebarSourceRow * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	ObjectsSource* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	ObjectsSource* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	LayoutsHeaderItem* _tmp11_ = NULL;
	LayoutsHeaderItem* _tmp12_;
	LayoutsHeaderItem* _tmp13_;
	gboolean _tmp14_ = FALSE;
	ObjectsSource* _tmp15_;
	SourceType _tmp16_;
	SourceType _tmp17_;
	GtkButton* add_button = NULL;
	gchar* _tmp28_;
	gchar* _tmp29_;
	gchar** _tmp30_;
	GtkButton* _tmp31_ = NULL;
	LayoutsHeaderItem* _tmp32_;
	GtkButton* _tmp33_;
	LayoutsHeaderItem* _tmp34_;
	GtkWidget* _tmp35_;
	GtkRevealer* _tmp36_ = NULL;
	GtkRevealer* _tmp37_;
	GtkRevealer* _tmp38_;
	guint _tmp39_;
	guint _tmp40_;
	ObjectsSource* _tmp41_;
	GtkButton* _tmp42_;
	ServicesStore* _tmp43_;
	ServicesStore* _tmp44_;
	ServicesStore* _tmp45_;
	ServicesStore* _tmp46_;
	ServicesStore* _tmp47_;
	ServicesEventBus* _tmp48_;
	ServicesEventBus* _tmp49_;
	ServicesEventBus* _tmp50_;
	ServicesEventBus* _tmp51_;
	ServicesSettings* _tmp52_;
	ServicesSettings* _tmp53_;
	GSettings* _tmp54_;
	ServicesSettings* _tmp55_;
	ServicesSettings* _tmp56_;
	GSettings* _tmp57_;
	ServicesEventBus* _tmp58_;
	ServicesEventBus* _tmp59_;
	ServicesEventBus* _tmp60_;
	ServicesEventBus* _tmp61_;
	parent_class = G_OBJECT_CLASS (layouts_sidebar_source_row_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, LAYOUTS_TYPE_SIDEBAR_SOURCE_ROW, LayoutsSidebarSourceRow);
	_tmp0_ = g_strdup ("no-selectable");
	_tmp1_ = g_strdup ("no-padding");
	_tmp2_ = g_new0 (gchar*, 2 + 1);
	_tmp2_[0] = _tmp0_;
	_tmp2_[1] = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp3__length1 = 2;
	gtk_widget_set_css_classes ((GtkWidget*) self, _tmp3_);
	_tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL);
	_tmp4_ = self->priv->_source;
	_tmp5_ = objects_source_get_display_name (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = self->priv->_source;
	_tmp8_ = objects_source_get_subheader_text (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = g_strdup (_tmp9_);
	_tmp11_ = layouts_header_item_new (_tmp6_);
	layouts_header_item_set_reveal (_tmp11_, TRUE);
	layouts_header_item_set_show_separator (_tmp11_, TRUE);
	layouts_header_item_set_subheader_title (_tmp11_, _tmp10_);
	_g_free0 (_tmp10_);
	g_object_ref_sink (_tmp11_);
	_g_object_unref0 (self->priv->group);
	self->priv->group = _tmp11_;
	_tmp12_ = self->priv->group;
	layouts_header_item_set_placeholder_message (_tmp12_, _ ("No project available. Create one by clicking on the '+' button"));
	_tmp13_ = self->priv->group;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp13_, 12);
	_tmp15_ = self->priv->_source;
	_tmp16_ = objects_source_get_source_type (_tmp15_);
	_tmp17_ = _tmp16_;
	if (_tmp17_ == SOURCE_TYPE_TODOIST) {
		_tmp14_ = TRUE;
	} else {
		ObjectsSource* _tmp18_;
		SourceType _tmp19_;
		SourceType _tmp20_;
		_tmp18_ = self->priv->_source;
		_tmp19_ = objects_source_get_source_type (_tmp18_);
		_tmp20_ = _tmp19_;
		_tmp14_ = _tmp20_ == SOURCE_TYPE_CALDAV;
	}
	if (_tmp14_) {
		Block49Data* _data49_;
		WidgetsSyncButton* _tmp21_ = NULL;
		LayoutsHeaderItem* _tmp22_;
		WidgetsSyncButton* _tmp23_;
		WidgetsSyncButton* _tmp24_;
		ObjectsSource* _tmp25_;
		ObjectsSource* _tmp26_;
		ObjectsSource* _tmp27_;
		_data49_ = g_slice_new0 (Block49Data);
		_data49_->_ref_count_ = 1;
		_data49_->self = g_object_ref (self);
		_tmp21_ = widgets_sync_button_new ();
		widgets_sync_button_set_reveal_child (_tmp21_, TRUE);
		g_object_ref_sink (_tmp21_);
		_data49_->sync_button = _tmp21_;
		_tmp22_ = self->priv->group;
		_tmp23_ = _data49_->sync_button;
		layouts_header_item_add_widget_end (_tmp22_, (GtkWidget*) _tmp23_);
		_tmp24_ = _data49_->sync_button;
		g_signal_connect_object (_tmp24_, "clicked", (GCallback) __layouts_sidebar_source_row____lambda269__widgets_sync_button_clicked, self, 0);
		_tmp25_ = self->priv->_source;
		g_signal_connect_data (_tmp25_, "sync-started", (GCallback) __layouts_sidebar_source_row____lambda452__objects_source_sync_started, block49_data_ref (_data49_), (GClosureNotify) block49_data_unref, 0);
		_tmp26_ = self->priv->_source;
		g_signal_connect_data (_tmp26_, "sync-finished", (GCallback) __layouts_sidebar_source_row____lambda453__objects_source_sync_finished, block49_data_ref (_data49_), (GClosureNotify) block49_data_unref, 0);
		_tmp27_ = self->priv->_source;
		g_signal_connect_data (_tmp27_, "sync-failed", (GCallback) __layouts_sidebar_source_row____lambda454__objects_source_sync_failed, block49_data_ref (_data49_), (GClosureNotify) block49_data_unref, 0);
		block49_data_unref (_data49_);
		_data49_ = NULL;
	}
	_tmp28_ = g_strdup ("flat");
	_tmp29_ = g_strdup ("header-item-button");
	_tmp30_ = g_new0 (gchar*, 2 + 1);
	_tmp30_[0] = _tmp28_;
	_tmp30_[1] = _tmp29_;
	_tmp31_ = (GtkButton*) gtk_button_new_from_icon_name ("plus-large-symbolic");
	gtk_widget_set_valign ((GtkWidget*) _tmp31_, GTK_ALIGN_CENTER);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp31_, _tmp30_);
	_tmp30_ = (_vala_array_free (_tmp30_, 2, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp31_);
	add_button = _tmp31_;
	_tmp32_ = self->priv->group;
	_tmp33_ = add_button;
	layouts_header_item_add_widget_end (_tmp32_, (GtkWidget*) _tmp33_);
	_tmp34_ = self->priv->group;
	_tmp35_ = _g_object_ref0 ((GtkWidget*) _tmp34_);
	_tmp36_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_transition_type (_tmp36_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
	gtk_revealer_set_child (_tmp36_, _tmp35_);
	_g_object_unref0 (_tmp35_);
	g_object_ref_sink (_tmp36_);
	_g_object_unref0 (self->priv->main_revealer);
	self->priv->main_revealer = _tmp36_;
	_tmp37_ = self->priv->main_revealer;
	gtk_list_box_row_set_child ((GtkListBoxRow*) self, (GtkWidget*) _tmp37_);
	layouts_sidebar_source_row_build_last_drag_and_drop (self);
	_tmp38_ = self->priv->main_revealer;
	_tmp39_ = gtk_revealer_get_transition_duration (_tmp38_);
	_tmp40_ = _tmp39_;
	g_timeout_add_full (G_PRIORITY_DEFAULT, _tmp40_, __layouts_sidebar_source_row___lambda455__gsource_func, g_object_ref (self), g_object_unref);
	layouts_sidebar_source_row_add_all_projects (self);
	layouts_sidebar_source_row_update_projects_sort (self);
	_tmp41_ = self->priv->_source;
	g_signal_connect_object ((ObjectsBaseObject*) _tmp41_, "updated", (GCallback) __layouts_sidebar_source_row___lambda456__objects_base_object_updated, self, 0);
	_tmp42_ = add_button;
	g_signal_connect_object (_tmp42_, "clicked", (GCallback) __layouts_sidebar_source_row___lambda457__gtk_button_clicked, self, 0);
	_tmp43_ = services_store_instance ();
	g_signal_connect_object (_tmp43_, "project-added", (GCallback) _layouts_sidebar_source_row_add_row_project_services_store_project_added, self, 0);
	_tmp44_ = services_store_instance ();
	g_signal_connect_object (_tmp44_, "project-updated", (GCallback) _layouts_sidebar_source_row_update_projects_sort_services_store_project_updated, self, 0);
	_tmp45_ = services_store_instance ();
	g_signal_connect_object (_tmp45_, "project-unarchived", (GCallback) _layouts_sidebar_source_row_add_row_project_services_store_project_unarchived, self, 0);
	_tmp46_ = services_store_instance ();
	g_signal_connect_object (_tmp46_, "project-deleted", (GCallback) __layouts_sidebar_source_row___lambda458__services_store_project_deleted, self, 0);
	_tmp47_ = services_store_instance ();
	g_signal_connect_object (_tmp47_, "project-archived", (GCallback) __layouts_sidebar_source_row___lambda459__services_store_project_archived, self, 0);
	_tmp48_ = services_event_bus_get_default ();
	_tmp49_ = _tmp48_;
	g_signal_connect_object (_tmp49_, "project-parent-changed", (GCallback) __layouts_sidebar_source_row___lambda460__services_event_bus_project_parent_changed, self, 0);
	_g_object_unref0 (_tmp49_);
	_tmp50_ = services_event_bus_get_default ();
	_tmp51_ = _tmp50_;
	g_signal_connect_object (_tmp51_, "update-inserted-project-map", (GCallback) __layouts_sidebar_source_row___lambda461__services_event_bus_update_inserted_project_map, self, 0);
	_g_object_unref0 (_tmp51_);
	_tmp52_ = services_settings_get_default ();
	_tmp53_ = _tmp52_;
	_tmp54_ = _tmp53_->settings;
	g_signal_connect_object (_tmp54_, "changed::projects-sort-by", (GCallback) _layouts_sidebar_source_row_update_projects_sort_g_settings_changed, self, 0);
	_g_object_unref0 (_tmp53_);
	_tmp55_ = services_settings_get_default ();
	_tmp56_ = _tmp55_;
	_tmp57_ = _tmp56_->settings;
	g_signal_connect_object (_tmp57_, "changed::projects-ordered", (GCallback) _layouts_sidebar_source_row_update_projects_sort_g_settings_changed, self, 0);
	_g_object_unref0 (_tmp56_);
	_tmp58_ = services_event_bus_get_default ();
	_tmp59_ = _tmp58_;
	g_signal_connect_object (_tmp59_, "projects-drag-begin", (GCallback) __layouts_sidebar_source_row___lambda462__services_event_bus_projects_drag_begin, self, 0);
	_g_object_unref0 (_tmp59_);
	_tmp60_ = services_event_bus_get_default ();
	_tmp61_ = _tmp60_;
	g_signal_connect_object (_tmp61_, "projects-drag-end", (GCallback) __layouts_sidebar_source_row___lambda463__services_event_bus_projects_drag_end, self, 0);
	_g_object_unref0 (_tmp61_);
	_g_object_unref0 (add_button);
	return obj;
}

static void
layouts_sidebar_source_row_class_init (LayoutsSidebarSourceRowClass * klass,
                                       gpointer klass_data)
{
	layouts_sidebar_source_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &LayoutsSidebarSourceRow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_layouts_sidebar_source_row_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_layouts_sidebar_source_row_set_property;
	G_OBJECT_CLASS (klass)->constructor = layouts_sidebar_source_row_constructor;
	G_OBJECT_CLASS (klass)->finalize = layouts_sidebar_source_row_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), LAYOUTS_SIDEBAR_SOURCE_ROW_SOURCE_PROPERTY, layouts_sidebar_source_row_properties[LAYOUTS_SIDEBAR_SOURCE_ROW_SOURCE_PROPERTY] = g_param_spec_object ("source", "source", "source", OBJECTS_TYPE_SOURCE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
layouts_sidebar_source_row_instance_init (LayoutsSidebarSourceRow * self,
                                          gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = layouts_sidebar_source_row_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, LAYOUTS_TYPE_PROJECT_ROW, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->projects_hashmap = _tmp0_;
}

static void
layouts_sidebar_source_row_finalize (GObject * obj)
{
	LayoutsSidebarSourceRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, LAYOUTS_TYPE_SIDEBAR_SOURCE_ROW, LayoutsSidebarSourceRow);
	_g_object_unref0 (self->priv->_source);
	_g_object_unref0 (self->priv->group);
	_g_object_unref0 (self->priv->main_revealer);
	_g_object_unref0 (self->projects_hashmap);
	G_OBJECT_CLASS (layouts_sidebar_source_row_parent_class)->finalize (obj);
}

static GType
layouts_sidebar_source_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (LayoutsSidebarSourceRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) layouts_sidebar_source_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LayoutsSidebarSourceRow), 0, (GInstanceInitFunc) layouts_sidebar_source_row_instance_init, NULL };
	GType layouts_sidebar_source_row_type_id;
	layouts_sidebar_source_row_type_id = g_type_register_static (gtk_list_box_row_get_type (), "LayoutsSidebarSourceRow", &g_define_type_info, 0);
	LayoutsSidebarSourceRow_private_offset = g_type_add_instance_private (layouts_sidebar_source_row_type_id, sizeof (LayoutsSidebarSourceRowPrivate));
	return layouts_sidebar_source_row_type_id;
}

GType
layouts_sidebar_source_row_get_type (void)
{
	static volatile gsize layouts_sidebar_source_row_type_id__once = 0;
	if (g_once_init_enter (&layouts_sidebar_source_row_type_id__once)) {
		GType layouts_sidebar_source_row_type_id;
		layouts_sidebar_source_row_type_id = layouts_sidebar_source_row_get_type_once ();
		g_once_init_leave (&layouts_sidebar_source_row_type_id__once, layouts_sidebar_source_row_type_id);
	}
	return layouts_sidebar_source_row_type_id__once;
}

static void
_vala_layouts_sidebar_source_row_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec)
{
	LayoutsSidebarSourceRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, LAYOUTS_TYPE_SIDEBAR_SOURCE_ROW, LayoutsSidebarSourceRow);
	switch (property_id) {
		case LAYOUTS_SIDEBAR_SOURCE_ROW_SOURCE_PROPERTY:
		g_value_set_object (value, layouts_sidebar_source_row_get_source (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_layouts_sidebar_source_row_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec)
{
	LayoutsSidebarSourceRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, LAYOUTS_TYPE_SIDEBAR_SOURCE_ROW, LayoutsSidebarSourceRow);
	switch (property_id) {
		case LAYOUTS_SIDEBAR_SOURCE_ROW_SOURCE_PROPERTY:
		layouts_sidebar_source_row_set_source (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

