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

/*
* Copyright 2021 elementary, Inc. (https://elementary.io)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/

#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <camel/camel.h>
#include <gee.h>
#include <glib/gi18n-lib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#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 MAIL_SOURCE_LIST_TYPE_ITEM (mail_source_list_item_get_type ())
#define MAIL_SOURCE_LIST_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAIL_SOURCE_LIST_TYPE_ITEM, MailSourceListItem))
#define MAIL_SOURCE_LIST_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAIL_SOURCE_LIST_TYPE_ITEM, MailSourceListItemClass))
#define MAIL_SOURCE_LIST_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAIL_SOURCE_LIST_TYPE_ITEM))
#define MAIL_SOURCE_LIST_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAIL_SOURCE_LIST_TYPE_ITEM))
#define MAIL_SOURCE_LIST_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAIL_SOURCE_LIST_TYPE_ITEM, MailSourceListItemClass))

typedef struct _MailSourceListItem MailSourceListItem;
typedef struct _MailSourceListItemClass MailSourceListItemClass;
typedef struct _MailSourceListItemPrivate MailSourceListItemPrivate;

#define MAIL_SOURCE_LIST_TYPE_EXPANDABLE_ITEM (mail_source_list_expandable_item_get_type ())
#define MAIL_SOURCE_LIST_EXPANDABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAIL_SOURCE_LIST_TYPE_EXPANDABLE_ITEM, MailSourceListExpandableItem))
#define MAIL_SOURCE_LIST_EXPANDABLE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAIL_SOURCE_LIST_TYPE_EXPANDABLE_ITEM, MailSourceListExpandableItemClass))
#define MAIL_SOURCE_LIST_IS_EXPANDABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAIL_SOURCE_LIST_TYPE_EXPANDABLE_ITEM))
#define MAIL_SOURCE_LIST_IS_EXPANDABLE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAIL_SOURCE_LIST_TYPE_EXPANDABLE_ITEM))
#define MAIL_SOURCE_LIST_EXPANDABLE_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAIL_SOURCE_LIST_TYPE_EXPANDABLE_ITEM, MailSourceListExpandableItemClass))

typedef struct _MailSourceListExpandableItem MailSourceListExpandableItem;
typedef struct _MailSourceListExpandableItemClass MailSourceListExpandableItemClass;
typedef struct _MailSourceListExpandableItemPrivate MailSourceListExpandableItemPrivate;

#define MAIL_TYPE_SESSION_SOURCE_ITEM (mail_session_source_item_get_type ())
#define MAIL_SESSION_SOURCE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAIL_TYPE_SESSION_SOURCE_ITEM, MailSessionSourceItem))
#define MAIL_SESSION_SOURCE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAIL_TYPE_SESSION_SOURCE_ITEM, MailSessionSourceItemClass))
#define MAIL_IS_SESSION_SOURCE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAIL_TYPE_SESSION_SOURCE_ITEM))
#define MAIL_IS_SESSION_SOURCE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAIL_TYPE_SESSION_SOURCE_ITEM))
#define MAIL_SESSION_SOURCE_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAIL_TYPE_SESSION_SOURCE_ITEM, MailSessionSourceItemClass))

typedef struct _MailSessionSourceItem MailSessionSourceItem;
typedef struct _MailSessionSourceItemClass MailSessionSourceItemClass;
typedef struct _MailSessionSourceItemPrivate MailSessionSourceItemPrivate;

#define MAIL_BACKEND_TYPE_SESSION (mail_backend_session_get_type ())
#define MAIL_BACKEND_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAIL_BACKEND_TYPE_SESSION, MailBackendSession))
#define MAIL_BACKEND_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAIL_BACKEND_TYPE_SESSION, MailBackendSessionClass))
#define MAIL_BACKEND_IS_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAIL_BACKEND_TYPE_SESSION))
#define MAIL_BACKEND_IS_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAIL_BACKEND_TYPE_SESSION))
#define MAIL_BACKEND_SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAIL_BACKEND_TYPE_SESSION, MailBackendSessionClass))

typedef struct _MailBackendSession MailBackendSession;
typedef struct _MailBackendSessionClass MailBackendSessionClass;
enum  {
	MAIL_SESSION_SOURCE_ITEM_0_PROPERTY,
	MAIL_SESSION_SOURCE_ITEM_SESSION_PROPERTY,
	MAIL_SESSION_SOURCE_ITEM_NUM_PROPERTIES
};
static GParamSpec* mail_session_source_item_properties[MAIL_SESSION_SOURCE_ITEM_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define MAIL_BACKEND_TYPE_ACCOUNT (mail_backend_account_get_type ())
#define MAIL_BACKEND_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAIL_BACKEND_TYPE_ACCOUNT, MailBackendAccount))
#define MAIL_BACKEND_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAIL_BACKEND_TYPE_ACCOUNT, MailBackendAccountClass))
#define MAIL_BACKEND_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAIL_BACKEND_TYPE_ACCOUNT))
#define MAIL_BACKEND_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAIL_BACKEND_TYPE_ACCOUNT))
#define MAIL_BACKEND_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAIL_BACKEND_TYPE_ACCOUNT, MailBackendAccountClass))

typedef struct _MailBackendAccount MailBackendAccount;
typedef struct _MailBackendAccountClass MailBackendAccountClass;

#define MAIL_TYPE_GROUPED_FOLDER_SOURCE_ITEM (mail_grouped_folder_source_item_get_type ())
#define MAIL_GROUPED_FOLDER_SOURCE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAIL_TYPE_GROUPED_FOLDER_SOURCE_ITEM, MailGroupedFolderSourceItem))
#define MAIL_GROUPED_FOLDER_SOURCE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAIL_TYPE_GROUPED_FOLDER_SOURCE_ITEM, MailGroupedFolderSourceItemClass))
#define MAIL_IS_GROUPED_FOLDER_SOURCE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAIL_TYPE_GROUPED_FOLDER_SOURCE_ITEM))
#define MAIL_IS_GROUPED_FOLDER_SOURCE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAIL_TYPE_GROUPED_FOLDER_SOURCE_ITEM))
#define MAIL_GROUPED_FOLDER_SOURCE_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAIL_TYPE_GROUPED_FOLDER_SOURCE_ITEM, MailGroupedFolderSourceItemClass))

typedef struct _MailGroupedFolderSourceItem MailGroupedFolderSourceItem;
typedef struct _MailGroupedFolderSourceItemClass MailGroupedFolderSourceItemClass;

struct _MailSourceListItem {
	GObject parent_instance;
	MailSourceListItemPrivate * priv;
};

struct _MailSourceListItemClass {
	GObjectClass parent_class;
	GtkMenu* (*get_context_menu) (MailSourceListItem* self);
	void (*edited) (MailSourceListItem* self, const gchar* new_name);
	void (*action_activated) (MailSourceListItem* self);
	void (*activated) (MailSourceListItem* self);
};

struct _MailSourceListExpandableItem {
	MailSourceListItem parent_instance;
	MailSourceListExpandableItemPrivate * priv;
};

struct _MailSourceListExpandableItemClass {
	MailSourceListItemClass parent_class;
	void (*toggled) (MailSourceListExpandableItem* self);
};

struct _MailSessionSourceItem {
	MailSourceListExpandableItem parent_instance;
	MailSessionSourceItemPrivate * priv;
};

struct _MailSessionSourceItemClass {
	MailSourceListExpandableItemClass parent_class;
};

struct _MailSessionSourceItemPrivate {
	MailBackendSession* _session;
};

static gint MailSessionSourceItem_private_offset;
static gpointer mail_session_source_item_parent_class = NULL;

VALA_EXTERN GType mail_source_list_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MailSourceListItem, g_object_unref)
VALA_EXTERN GType mail_source_list_expandable_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MailSourceListExpandableItem, g_object_unref)
VALA_EXTERN GType mail_session_source_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MailSessionSourceItem, g_object_unref)
VALA_EXTERN GType mail_backend_session_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MailBackendSession, g_object_unref)
VALA_EXTERN MailSessionSourceItem* mail_session_source_item_new (MailBackendSession* session);
VALA_EXTERN MailSessionSourceItem* mail_session_source_item_construct (GType object_type,
                                                           MailBackendSession* session);
VALA_EXTERN GType mail_backend_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MailBackendAccount, g_object_unref)
static void mail_session_source_item_added_account (MailSessionSourceItem* self,
                                             MailBackendAccount* account);
VALA_EXTERN MailBackendSession* mail_session_source_item_get_session (MailSessionSourceItem* self);
VALA_EXTERN GeeLinkedList* mail_backend_session_get_accounts (MailBackendSession* self);
VALA_EXTERN void mail_source_list_item_set_visible (MailSourceListItem* self,
                                        gboolean value);
static void mail_session_source_item_removed_account (MailSessionSourceItem* self,
                                               MailBackendAccount* account);
static void mail_session_source_item_set_session (MailSessionSourceItem* self,
                                           MailBackendSession* value);
static GObject * mail_session_source_item_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
VALA_EXTERN void mail_source_list_item_set_name (MailSourceListItem* self,
                                     const gchar* value);
VALA_EXTERN void mail_source_list_expandable_item_set_expanded (MailSourceListExpandableItem* self,
                                                    gboolean value);
VALA_EXTERN void mail_source_list_expandable_item_set_collapsible (MailSourceListExpandableItem* self,
                                                       gboolean value);
VALA_EXTERN void mail_source_list_expandable_item_add (MailSourceListExpandableItem* self,
                                           MailSourceListItem* item);
VALA_EXTERN MailGroupedFolderSourceItem* mail_grouped_folder_source_item_new (MailBackendSession* session,
                                                                  CamelFolderInfoFlags folder_type);
VALA_EXTERN MailGroupedFolderSourceItem* mail_grouped_folder_source_item_construct (GType object_type,
                                                                        MailBackendSession* session,
                                                                        CamelFolderInfoFlags folder_type);
VALA_EXTERN GType mail_grouped_folder_source_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MailGroupedFolderSourceItem, g_object_unref)
static void _mail_session_source_item_added_account_mail_backend_session_account_added (MailBackendSession* _sender,
                                                                                 MailBackendAccount* account,
                                                                                 gpointer self);
static void _mail_session_source_item_removed_account_mail_backend_session_account_removed (MailBackendSession* _sender,
                                                                                     MailBackendAccount* account,
                                                                                     gpointer self);
static void mail_session_source_item_finalize (GObject * obj);
static GType mail_session_source_item_get_type_once (void);
static void _vala_mail_session_source_item_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
static void _vala_mail_session_source_item_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec);

static inline gpointer
mail_session_source_item_get_instance_private (MailSessionSourceItem* self)
{
	return G_STRUCT_MEMBER_P (self, MailSessionSourceItem_private_offset);
}

MailSessionSourceItem*
mail_session_source_item_construct (GType object_type,
                                    MailBackendSession* session)
{
	MailSessionSourceItem * self = NULL;
	g_return_val_if_fail (session != NULL, NULL);
	self = (MailSessionSourceItem*) g_object_new (object_type, "session", session, NULL);
	return self;
}

MailSessionSourceItem*
mail_session_source_item_new (MailBackendSession* session)
{
	return mail_session_source_item_construct (MAIL_TYPE_SESSION_SOURCE_ITEM, session);
}

static void
mail_session_source_item_added_account (MailSessionSourceItem* self,
                                        MailBackendAccount* account)
{
	MailBackendSession* _tmp0_;
	GeeLinkedList* _tmp1_;
	GeeLinkedList* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gboolean _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (account != NULL);
	_tmp0_ = self->priv->_session;
	_tmp1_ = mail_backend_session_get_accounts (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ > 1;
	_g_object_unref0 (_tmp2_);
	if (_tmp5_) {
		mail_source_list_item_set_visible ((MailSourceListItem*) self, TRUE);
	}
}

static void
mail_session_source_item_removed_account (MailSessionSourceItem* self,
                                          MailBackendAccount* account)
{
	MailBackendSession* _tmp0_;
	GeeLinkedList* _tmp1_;
	GeeLinkedList* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gboolean _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (account != NULL);
	_tmp0_ = self->priv->_session;
	_tmp1_ = mail_backend_session_get_accounts (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ < 2;
	_g_object_unref0 (_tmp2_);
	if (_tmp5_) {
		mail_source_list_item_set_visible ((MailSourceListItem*) self, FALSE);
	}
}

MailBackendSession*
mail_session_source_item_get_session (MailSessionSourceItem* self)
{
	MailBackendSession* result;
	MailBackendSession* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_session;
	result = _tmp0_;
	return result;
}

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

static void
mail_session_source_item_set_session (MailSessionSourceItem* self,
                                      MailBackendSession* value)
{
	MailBackendSession* old_value;
	g_return_if_fail (self != NULL);
	old_value = mail_session_source_item_get_session (self);
	if (old_value != value) {
		MailBackendSession* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_session);
		self->priv->_session = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, mail_session_source_item_properties[MAIL_SESSION_SOURCE_ITEM_SESSION_PROPERTY]);
	}
}

static void
_mail_session_source_item_added_account_mail_backend_session_account_added (MailBackendSession* _sender,
                                                                            MailBackendAccount* account,
                                                                            gpointer self)
{
	mail_session_source_item_added_account ((MailSessionSourceItem*) self, account);
}

static void
_mail_session_source_item_removed_account_mail_backend_session_account_removed (MailBackendSession* _sender,
                                                                                MailBackendAccount* account,
                                                                                gpointer self)
{
	mail_session_source_item_removed_account ((MailSessionSourceItem*) self, account);
}

static GObject *
mail_session_source_item_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	MailSessionSourceItem * self;
	MailBackendSession* _tmp0_;
	GeeLinkedList* _tmp1_;
	GeeLinkedList* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	MailBackendSession* _tmp5_;
	MailGroupedFolderSourceItem* _tmp6_;
	MailGroupedFolderSourceItem* _tmp7_;
	MailBackendSession* _tmp8_;
	MailGroupedFolderSourceItem* _tmp9_;
	MailGroupedFolderSourceItem* _tmp10_;
	MailBackendSession* _tmp11_;
	MailGroupedFolderSourceItem* _tmp12_;
	MailGroupedFolderSourceItem* _tmp13_;
	MailBackendSession* _tmp14_;
	MailBackendSession* _tmp15_;
	parent_class = G_OBJECT_CLASS (mail_session_source_item_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAIL_TYPE_SESSION_SOURCE_ITEM, MailSessionSourceItem);
	mail_source_list_item_set_name ((MailSourceListItem*) self, _ ("All Mailboxes"));
	_tmp0_ = self->priv->_session;
	_tmp1_ = mail_backend_session_get_accounts (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
	_tmp4_ = _tmp3_;
	mail_source_list_item_set_visible ((MailSourceListItem*) self, _tmp4_ > 1);
	_g_object_unref0 (_tmp2_);
	mail_source_list_expandable_item_set_expanded ((MailSourceListExpandableItem*) self, TRUE);
	mail_source_list_expandable_item_set_collapsible ((MailSourceListExpandableItem*) self, FALSE);
	_tmp5_ = self->priv->_session;
	_tmp6_ = mail_grouped_folder_source_item_new (_tmp5_, CAMEL_FOLDER_TYPE_INBOX);
	_tmp7_ = _tmp6_;
	mail_source_list_expandable_item_add ((MailSourceListExpandableItem*) self, (MailSourceListItem*) _tmp7_);
	_g_object_unref0 (_tmp7_);
	_tmp8_ = self->priv->_session;
	_tmp9_ = mail_grouped_folder_source_item_new (_tmp8_, CAMEL_FOLDER_TYPE_ARCHIVE);
	_tmp10_ = _tmp9_;
	mail_source_list_expandable_item_add ((MailSourceListExpandableItem*) self, (MailSourceListItem*) _tmp10_);
	_g_object_unref0 (_tmp10_);
	_tmp11_ = self->priv->_session;
	_tmp12_ = mail_grouped_folder_source_item_new (_tmp11_, CAMEL_FOLDER_TYPE_SENT);
	_tmp13_ = _tmp12_;
	mail_source_list_expandable_item_add ((MailSourceListExpandableItem*) self, (MailSourceListItem*) _tmp13_);
	_g_object_unref0 (_tmp13_);
	_tmp14_ = self->priv->_session;
	g_signal_connect_object (_tmp14_, "account-added", (GCallback) _mail_session_source_item_added_account_mail_backend_session_account_added, self, 0);
	_tmp15_ = self->priv->_session;
	g_signal_connect_object (_tmp15_, "account-removed", (GCallback) _mail_session_source_item_removed_account_mail_backend_session_account_removed, self, 0);
	return obj;
}

static void
mail_session_source_item_class_init (MailSessionSourceItemClass * klass,
                                     gpointer klass_data)
{
	mail_session_source_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &MailSessionSourceItem_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_mail_session_source_item_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_mail_session_source_item_set_property;
	G_OBJECT_CLASS (klass)->constructor = mail_session_source_item_constructor;
	G_OBJECT_CLASS (klass)->finalize = mail_session_source_item_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), MAIL_SESSION_SOURCE_ITEM_SESSION_PROPERTY, mail_session_source_item_properties[MAIL_SESSION_SOURCE_ITEM_SESSION_PROPERTY] = g_param_spec_object ("session", "session", "session", MAIL_BACKEND_TYPE_SESSION, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
mail_session_source_item_instance_init (MailSessionSourceItem * self,
                                        gpointer klass)
{
	self->priv = mail_session_source_item_get_instance_private (self);
}

static void
mail_session_source_item_finalize (GObject * obj)
{
	MailSessionSourceItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAIL_TYPE_SESSION_SOURCE_ITEM, MailSessionSourceItem);
	_g_object_unref0 (self->priv->_session);
	G_OBJECT_CLASS (mail_session_source_item_parent_class)->finalize (obj);
}

static GType
mail_session_source_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MailSessionSourceItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) mail_session_source_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MailSessionSourceItem), 0, (GInstanceInitFunc) mail_session_source_item_instance_init, NULL };
	GType mail_session_source_item_type_id;
	mail_session_source_item_type_id = g_type_register_static (MAIL_SOURCE_LIST_TYPE_EXPANDABLE_ITEM, "MailSessionSourceItem", &g_define_type_info, 0);
	MailSessionSourceItem_private_offset = g_type_add_instance_private (mail_session_source_item_type_id, sizeof (MailSessionSourceItemPrivate));
	return mail_session_source_item_type_id;
}

GType
mail_session_source_item_get_type (void)
{
	static volatile gsize mail_session_source_item_type_id__once = 0;
	if (g_once_init_enter (&mail_session_source_item_type_id__once)) {
		GType mail_session_source_item_type_id;
		mail_session_source_item_type_id = mail_session_source_item_get_type_once ();
		g_once_init_leave (&mail_session_source_item_type_id__once, mail_session_source_item_type_id);
	}
	return mail_session_source_item_type_id__once;
}

static void
_vala_mail_session_source_item_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	MailSessionSourceItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, MAIL_TYPE_SESSION_SOURCE_ITEM, MailSessionSourceItem);
	switch (property_id) {
		case MAIL_SESSION_SOURCE_ITEM_SESSION_PROPERTY:
		g_value_set_object (value, mail_session_source_item_get_session (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_mail_session_source_item_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec)
{
	MailSessionSourceItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, MAIL_TYPE_SESSION_SOURCE_ITEM, MailSessionSourceItem);
	switch (property_id) {
		case MAIL_SESSION_SOURCE_ITEM_SESSION_PROPERTY:
		mail_session_source_item_set_session (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

