/* folder-list-folder-entry.c generated by valac 0.56.3, the Vala compiler
 * generated from folder-list-folder-entry.vala, do not modify */

/* Copyright 2016 Software Freedom Conservancy Inc.
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */
/* A folder of any type in the folder list.*/

#include "geary-client-43.0.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>
#include "geary-engine.h"
#include <glib/gi18n-lib.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>

enum  {
	FOLDER_LIST_FOLDER_ENTRY_0_PROPERTY,
	FOLDER_LIST_FOLDER_ENTRY_NUM_PROPERTIES
};
static GParamSpec* folder_list_folder_entry_properties[FOLDER_LIST_FOLDER_ENTRY_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _FolderListFolderEntryPrivate {
	ApplicationFolderContext* context;
	gboolean has_new;
};

static gint FolderListFolderEntry_private_offset;
static gpointer folder_list_folder_entry_parent_class = NULL;
static SidebarInternalDropTargetEntryIface * folder_list_folder_entry_sidebar_internal_drop_target_entry_parent_iface = NULL;
static SidebarEmphasizableEntryIface * folder_list_folder_entry_sidebar_emphasizable_entry_parent_iface = NULL;

static void folder_list_folder_entry_on_context_changed (FolderListFolderEntry* self);
static void _folder_list_folder_entry_on_context_changed_g_object_notify (GObject* _sender,
                                                                   GParamSpec* pspec,
                                                                   gpointer self);
static void folder_list_folder_entry_on_counts_changed (FolderListFolderEntry* self);
static void _folder_list_folder_entry_on_counts_changed_g_object_notify (GObject* _sender,
                                                                  GParamSpec* pspec,
                                                                  gpointer self);
static gchar* folder_list_folder_entry_real_get_sidebar_name (FolderListAbstractFolderEntry* base);
static gchar* folder_list_folder_entry_real_get_sidebar_tooltip (FolderListAbstractFolderEntry* base);
static gchar* folder_list_folder_entry_real_get_sidebar_icon (FolderListAbstractFolderEntry* base);
static gchar* folder_list_folder_entry_real_to_string (FolderListAbstractFolderEntry* base);
static gboolean folder_list_folder_entry_real_is_emphasized (SidebarEmphasizableEntry* base);
static gboolean folder_list_folder_entry_real_internal_drop_received (SidebarInternalDropTargetEntry* base,
                                                               SidebarTree* parent,
                                                               GdkDragContext* context,
                                                               GtkSelectionData* data);
static gint folder_list_folder_entry_real_get_count (FolderListAbstractFolderEntry* base);
static void folder_list_folder_entry_finalize (GObject * obj);
static GType folder_list_folder_entry_get_type_once (void);

static inline gpointer
folder_list_folder_entry_get_instance_private (FolderListFolderEntry* self)
{
	return G_STRUCT_MEMBER_P (self, FolderListFolderEntry_private_offset);
}

static void
_folder_list_folder_entry_on_context_changed_g_object_notify (GObject* _sender,
                                                              GParamSpec* pspec,
                                                              gpointer self)
{
	folder_list_folder_entry_on_context_changed ((FolderListFolderEntry*) self);
}

static void
_folder_list_folder_entry_on_counts_changed_g_object_notify (GObject* _sender,
                                                             GParamSpec* pspec,
                                                             gpointer self)
{
	folder_list_folder_entry_on_counts_changed ((FolderListFolderEntry*) self);
}

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

FolderListFolderEntry*
folder_list_folder_entry_construct (GType object_type,
                                    ApplicationFolderContext* context)
{
	FolderListFolderEntry * self = NULL;
	GearyFolder* _tmp0_;
	GearyFolder* _tmp1_;
	ApplicationFolderContext* _tmp2_;
	ApplicationFolderContext* _tmp3_;
	GearyFolder* _tmp4_;
	GearyFolder* _tmp5_;
	GearyFolderProperties* _tmp6_;
	GearyFolderProperties* _tmp7_;
	gchar* _tmp8_;
	GearyFolder* _tmp9_;
	GearyFolder* _tmp10_;
	GearyFolderProperties* _tmp11_;
	GearyFolderProperties* _tmp12_;
	gchar* _tmp13_;
	g_return_val_if_fail (APPLICATION_IS_FOLDER_CONTEXT (context), NULL);
	_tmp0_ = application_folder_context_get_folder (context);
	_tmp1_ = _tmp0_;
	self = (FolderListFolderEntry*) folder_list_abstract_folder_entry_construct (object_type, _tmp1_);
	_tmp2_ = _g_object_ref0 (context);
	_g_object_unref0 (self->priv->context);
	self->priv->context = _tmp2_;
	_tmp3_ = self->priv->context;
	g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, G_TYPE_OBJECT, GObject), "notify", (GCallback) _folder_list_folder_entry_on_context_changed_g_object_notify, self, 0);
	self->priv->has_new = FALSE;
	_tmp4_ = folder_list_abstract_folder_entry_get_folder (G_TYPE_CHECK_INSTANCE_CAST (self, FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, FolderListAbstractFolderEntry));
	_tmp5_ = _tmp4_;
	_tmp6_ = geary_folder_get_properties (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strconcat ("notify::", GEARY_FOLDER_PROPERTIES_PROP_NAME_EMAIL_TOTAL, NULL);
	g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, G_TYPE_OBJECT, GObject), _tmp8_, (GCallback) _folder_list_folder_entry_on_counts_changed_g_object_notify, self, 0);
	_g_free0 (_tmp8_);
	_tmp9_ = folder_list_abstract_folder_entry_get_folder (G_TYPE_CHECK_INSTANCE_CAST (self, FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, FolderListAbstractFolderEntry));
	_tmp10_ = _tmp9_;
	_tmp11_ = geary_folder_get_properties (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = g_strconcat ("notify::", GEARY_FOLDER_PROPERTIES_PROP_NAME_EMAIL_UNREAD, NULL);
	g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, G_TYPE_OBJECT, GObject), _tmp13_, (GCallback) _folder_list_folder_entry_on_counts_changed_g_object_notify, self, 0);
	_g_free0 (_tmp13_);
	return self;
}

FolderListFolderEntry*
folder_list_folder_entry_new (ApplicationFolderContext* context)
{
	return folder_list_folder_entry_construct (FOLDER_LIST_TYPE_FOLDER_ENTRY, context);
}

static gchar*
folder_list_folder_entry_real_get_sidebar_name (FolderListAbstractFolderEntry* base)
{
	FolderListFolderEntry * self;
	ApplicationFolderContext* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, FOLDER_LIST_TYPE_FOLDER_ENTRY, FolderListFolderEntry);
	_tmp0_ = self->priv->context;
	_tmp1_ = application_folder_context_get_display_name (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

static gchar*
folder_list_folder_entry_real_get_sidebar_tooltip (FolderListAbstractFolderEntry* base)
{
	FolderListFolderEntry * self;
	gchar* total_msg = NULL;
	GearyFolder* _tmp0_;
	GearyFolder* _tmp1_;
	GearyFolderProperties* _tmp2_;
	GearyFolderProperties* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	GearyFolder* _tmp6_;
	GearyFolder* _tmp7_;
	GearyFolderProperties* _tmp8_;
	GearyFolderProperties* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	gchar* _tmp12_;
	GearyFolder* _tmp13_;
	GearyFolder* _tmp14_;
	GearyFolderProperties* _tmp15_;
	GearyFolderProperties* _tmp16_;
	gint _tmp17_;
	gint _tmp18_;
	gchar* unread_msg = NULL;
	GearyFolder* _tmp19_;
	GearyFolder* _tmp20_;
	GearyFolderProperties* _tmp21_;
	GearyFolderProperties* _tmp22_;
	gint _tmp23_;
	gint _tmp24_;
	GearyFolder* _tmp25_;
	GearyFolder* _tmp26_;
	GearyFolderProperties* _tmp27_;
	GearyFolderProperties* _tmp28_;
	gint _tmp29_;
	gint _tmp30_;
	gchar* _tmp31_;
	const gchar* _tmp32_;
	const gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, FOLDER_LIST_TYPE_FOLDER_ENTRY, FolderListFolderEntry);
	_tmp0_ = folder_list_abstract_folder_entry_get_folder (G_TYPE_CHECK_INSTANCE_CAST (self, FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, FolderListAbstractFolderEntry));
	_tmp1_ = _tmp0_;
	_tmp2_ = geary_folder_get_properties (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = geary_folder_properties_get_email_total (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = folder_list_abstract_folder_entry_get_folder (G_TYPE_CHECK_INSTANCE_CAST (self, FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, FolderListAbstractFolderEntry));
	_tmp7_ = _tmp6_;
	_tmp8_ = geary_folder_get_properties (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = geary_folder_properties_get_email_total (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = g_strdup_printf (ngettext ("%d message", "%d messages", (gulong) _tmp5_), _tmp11_);
	total_msg = _tmp12_;
	_tmp13_ = folder_list_abstract_folder_entry_get_folder (G_TYPE_CHECK_INSTANCE_CAST (self, FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, FolderListAbstractFolderEntry));
	_tmp14_ = _tmp13_;
	_tmp15_ = geary_folder_get_properties (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = geary_folder_properties_get_email_unread (_tmp16_);
	_tmp18_ = _tmp17_;
	if (_tmp18_ == 0) {
		result = total_msg;
		return result;
	}
	_tmp19_ = folder_list_abstract_folder_entry_get_folder (G_TYPE_CHECK_INSTANCE_CAST (self, FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, FolderListAbstractFolderEntry));
	_tmp20_ = _tmp19_;
	_tmp21_ = geary_folder_get_properties (_tmp20_);
	_tmp22_ = _tmp21_;
	_tmp23_ = geary_folder_properties_get_email_unread (_tmp22_);
	_tmp24_ = _tmp23_;
	_tmp25_ = folder_list_abstract_folder_entry_get_folder (G_TYPE_CHECK_INSTANCE_CAST (self, FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, FolderListAbstractFolderEntry));
	_tmp26_ = _tmp25_;
	_tmp27_ = geary_folder_get_properties (_tmp26_);
	_tmp28_ = _tmp27_;
	_tmp29_ = geary_folder_properties_get_email_unread (_tmp28_);
	_tmp30_ = _tmp29_;
	_tmp31_ = g_strdup_printf (ngettext ("%d unread", "%d unread", (gulong) _tmp24_), _tmp30_);
	unread_msg = _tmp31_;
	_tmp32_ = total_msg;
	_tmp33_ = unread_msg;
	_tmp34_ = g_strdup_printf (_ ("%s, %s"), _tmp32_, _tmp33_);
	result = _tmp34_;
	_g_free0 (unread_msg);
	_g_free0 (total_msg);
	return result;
}

static gchar*
folder_list_folder_entry_real_get_sidebar_icon (FolderListAbstractFolderEntry* base)
{
	FolderListFolderEntry * self;
	ApplicationFolderContext* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, FOLDER_LIST_TYPE_FOLDER_ENTRY, FolderListFolderEntry);
	_tmp0_ = self->priv->context;
	_tmp1_ = application_folder_context_get_icon_name (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

static gchar*
folder_list_folder_entry_real_to_string (FolderListAbstractFolderEntry* base)
{
	FolderListFolderEntry * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, FOLDER_LIST_TYPE_FOLDER_ENTRY, FolderListFolderEntry);
	_tmp0_ = folder_list_abstract_folder_entry_get_sidebar_name (G_TYPE_CHECK_INSTANCE_CAST (self, FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, FolderListAbstractFolderEntry));
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strconcat ("FolderEntry: ", _tmp1_, NULL);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	result = _tmp3_;
	return result;
}

static gboolean
folder_list_folder_entry_real_is_emphasized (SidebarEmphasizableEntry* base)
{
	FolderListFolderEntry * self;
	gboolean result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, FOLDER_LIST_TYPE_FOLDER_ENTRY, FolderListFolderEntry);
	result = self->priv->has_new;
	return result;
}

void
folder_list_folder_entry_set_has_new (FolderListFolderEntry* self,
                                      gboolean has_new)
{
	g_return_if_fail (FOLDER_LIST_IS_FOLDER_ENTRY (self));
	if (self->priv->has_new == has_new) {
		return;
	}
	self->priv->has_new = has_new;
	g_signal_emit_by_name (G_TYPE_CHECK_INSTANCE_CAST (self, SIDEBAR_TYPE_ENTRY, SidebarEntry), "entry-changed");
}

static gboolean
folder_list_folder_entry_real_internal_drop_received (SidebarInternalDropTargetEntry* base,
                                                      SidebarTree* parent,
                                                      GdkDragContext* context,
                                                      GtkSelectionData* data)
{
	FolderListFolderEntry * self;
	gboolean handled = FALSE;
	FolderListTree* folders = NULL;
	FolderListTree* _tmp0_;
	FolderListTree* _tmp1_;
	gboolean result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, FOLDER_LIST_TYPE_FOLDER_ENTRY, FolderListFolderEntry);
	g_return_val_if_fail (SIDEBAR_IS_TREE (parent), FALSE);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (context, gdk_drag_context_get_type ()), FALSE);
	g_return_val_if_fail (data != NULL, FALSE);
	handled = FALSE;
	_tmp0_ = _g_object_ref0 (FOLDER_LIST_IS_TREE (parent) ? ((FolderListTree*) parent) : NULL);
	folders = _tmp0_;
	_tmp1_ = folders;
	if (_tmp1_ != NULL) {
		switch (gdk_drag_context_get_selected_action (context)) {
			case GDK_ACTION_MOVE:
			{
				FolderListTree* _tmp2_;
				GearyFolder* _tmp3_;
				GearyFolder* _tmp4_;
				_tmp2_ = folders;
				_tmp3_ = folder_list_abstract_folder_entry_get_folder (G_TYPE_CHECK_INSTANCE_CAST (self, FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, FolderListAbstractFolderEntry));
				_tmp4_ = _tmp3_;
				g_signal_emit_by_name (_tmp2_, "move-conversation", _tmp4_);
				handled = TRUE;
				break;
			}
			case GDK_ACTION_COPY:
			{
				FolderListTree* _tmp5_;
				GearyFolder* _tmp6_;
				GearyFolder* _tmp7_;
				_tmp5_ = folders;
				_tmp6_ = folder_list_abstract_folder_entry_get_folder (G_TYPE_CHECK_INSTANCE_CAST (self, FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, FolderListAbstractFolderEntry));
				_tmp7_ = _tmp6_;
				g_signal_emit_by_name (_tmp5_, "copy-conversation", _tmp7_);
				handled = TRUE;
				break;
			}
			default:
			{
				break;
			}
		}
	}
	result = handled;
	_g_object_unref0 (folders);
	return result;
}

static gint
folder_list_folder_entry_real_get_count (FolderListAbstractFolderEntry* base)
{
	FolderListFolderEntry * self;
	ApplicationFolderContext* _tmp0_;
	ApplicationFolderContextEmailCount _tmp1_;
	ApplicationFolderContextEmailCount _tmp2_;
	gint result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, FOLDER_LIST_TYPE_FOLDER_ENTRY, FolderListFolderEntry);
	_tmp0_ = self->priv->context;
	_tmp1_ = application_folder_context_get_displayed_count (_tmp0_);
	_tmp2_ = _tmp1_;
	switch (_tmp2_) {
		case APPLICATION_FOLDER_CONTEXT_EMAIL_COUNT_TOTAL:
		{
			GearyFolder* _tmp3_;
			GearyFolder* _tmp4_;
			GearyFolderProperties* _tmp5_;
			GearyFolderProperties* _tmp6_;
			gint _tmp7_;
			gint _tmp8_;
			_tmp3_ = folder_list_abstract_folder_entry_get_folder (G_TYPE_CHECK_INSTANCE_CAST (self, FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, FolderListAbstractFolderEntry));
			_tmp4_ = _tmp3_;
			_tmp5_ = geary_folder_get_properties (_tmp4_);
			_tmp6_ = _tmp5_;
			_tmp7_ = geary_folder_properties_get_email_total (_tmp6_);
			_tmp8_ = _tmp7_;
			result = _tmp8_;
			return result;
		}
		case APPLICATION_FOLDER_CONTEXT_EMAIL_COUNT_UNREAD:
		{
			GearyFolder* _tmp9_;
			GearyFolder* _tmp10_;
			GearyFolderProperties* _tmp11_;
			GearyFolderProperties* _tmp12_;
			gint _tmp13_;
			gint _tmp14_;
			_tmp9_ = folder_list_abstract_folder_entry_get_folder (G_TYPE_CHECK_INSTANCE_CAST (self, FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, FolderListAbstractFolderEntry));
			_tmp10_ = _tmp9_;
			_tmp11_ = geary_folder_get_properties (_tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = geary_folder_properties_get_email_unread (_tmp12_);
			_tmp14_ = _tmp13_;
			result = _tmp14_;
			return result;
		}
		default:
		{
			result = 0;
			return result;
		}
	}
}

static void
folder_list_folder_entry_on_counts_changed (FolderListFolderEntry* self)
{
	g_return_if_fail (FOLDER_LIST_IS_FOLDER_ENTRY (self));
	g_signal_emit_by_name (G_TYPE_CHECK_INSTANCE_CAST (self, SIDEBAR_TYPE_ENTRY, SidebarEntry), "entry-changed");
}

static void
folder_list_folder_entry_on_context_changed (FolderListFolderEntry* self)
{
	g_return_if_fail (FOLDER_LIST_IS_FOLDER_ENTRY (self));
	g_signal_emit_by_name (G_TYPE_CHECK_INSTANCE_CAST (self, SIDEBAR_TYPE_ENTRY, SidebarEntry), "entry-changed");
}

static void
folder_list_folder_entry_class_init (FolderListFolderEntryClass * klass,
                                     gpointer klass_data)
{
	folder_list_folder_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FolderListFolderEntry_private_offset);
	((FolderListAbstractFolderEntryClass *) klass)->get_sidebar_name = (gchar* (*) (FolderListAbstractFolderEntry*)) folder_list_folder_entry_real_get_sidebar_name;
	((FolderListAbstractFolderEntryClass *) klass)->get_sidebar_tooltip = (gchar* (*) (FolderListAbstractFolderEntry*)) folder_list_folder_entry_real_get_sidebar_tooltip;
	((FolderListAbstractFolderEntryClass *) klass)->get_sidebar_icon = (gchar* (*) (FolderListAbstractFolderEntry*)) folder_list_folder_entry_real_get_sidebar_icon;
	((FolderListAbstractFolderEntryClass *) klass)->to_string = (gchar* (*) (FolderListAbstractFolderEntry*)) folder_list_folder_entry_real_to_string;
	((FolderListAbstractFolderEntryClass *) klass)->get_count = (gint (*) (FolderListAbstractFolderEntry*)) folder_list_folder_entry_real_get_count;
	G_OBJECT_CLASS (klass)->finalize = folder_list_folder_entry_finalize;
}

static void
folder_list_folder_entry_sidebar_internal_drop_target_entry_interface_init (SidebarInternalDropTargetEntryIface * iface,
                                                                            gpointer iface_data)
{
	folder_list_folder_entry_sidebar_internal_drop_target_entry_parent_iface = g_type_interface_peek_parent (iface);
	iface->internal_drop_received = (gboolean (*) (SidebarInternalDropTargetEntry*, SidebarTree*, GdkDragContext*, GtkSelectionData*)) folder_list_folder_entry_real_internal_drop_received;
}

static void
folder_list_folder_entry_sidebar_emphasizable_entry_interface_init (SidebarEmphasizableEntryIface * iface,
                                                                    gpointer iface_data)
{
	folder_list_folder_entry_sidebar_emphasizable_entry_parent_iface = g_type_interface_peek_parent (iface);
	iface->is_emphasized = (gboolean (*) (SidebarEmphasizableEntry*)) folder_list_folder_entry_real_is_emphasized;
}

static void
folder_list_folder_entry_instance_init (FolderListFolderEntry * self,
                                        gpointer klass)
{
	self->priv = folder_list_folder_entry_get_instance_private (self);
}

static void
folder_list_folder_entry_finalize (GObject * obj)
{
	FolderListFolderEntry * self;
	ApplicationFolderContext* _tmp0_;
	guint _tmp1_;
	GearyFolder* _tmp2_;
	GearyFolder* _tmp3_;
	GearyFolderProperties* _tmp4_;
	GearyFolderProperties* _tmp5_;
	gchar* _tmp6_;
	guint _tmp7_;
	GQuark _tmp8_;
	GearyFolder* _tmp9_;
	GearyFolder* _tmp10_;
	GearyFolderProperties* _tmp11_;
	GearyFolderProperties* _tmp12_;
	gchar* _tmp13_;
	guint _tmp14_;
	GQuark _tmp15_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FOLDER_LIST_TYPE_FOLDER_ENTRY, FolderListFolderEntry);
	_tmp0_ = self->priv->context;
	g_signal_parse_name ("notify", G_TYPE_OBJECT, &_tmp1_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, G_TYPE_OBJECT, GObject), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _folder_list_folder_entry_on_context_changed_g_object_notify, self);
	_tmp2_ = folder_list_abstract_folder_entry_get_folder (G_TYPE_CHECK_INSTANCE_CAST (self, FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, FolderListAbstractFolderEntry));
	_tmp3_ = _tmp2_;
	_tmp4_ = geary_folder_get_properties (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strconcat ("notify::", GEARY_FOLDER_PROPERTIES_PROP_NAME_EMAIL_TOTAL, NULL);
	g_signal_parse_name (_tmp6_, G_TYPE_OBJECT, &_tmp7_, &_tmp8_, TRUE);
	g_signal_handlers_disconnect_matched (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, G_TYPE_OBJECT, GObject), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp7_, _tmp8_, NULL, (GCallback) _folder_list_folder_entry_on_counts_changed_g_object_notify, self);
	_g_free0 (_tmp6_);
	_tmp9_ = folder_list_abstract_folder_entry_get_folder (G_TYPE_CHECK_INSTANCE_CAST (self, FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, FolderListAbstractFolderEntry));
	_tmp10_ = _tmp9_;
	_tmp11_ = geary_folder_get_properties (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = g_strconcat ("notify::", GEARY_FOLDER_PROPERTIES_PROP_NAME_EMAIL_UNREAD, NULL);
	g_signal_parse_name (_tmp13_, G_TYPE_OBJECT, &_tmp14_, &_tmp15_, TRUE);
	g_signal_handlers_disconnect_matched (G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, G_TYPE_OBJECT, GObject), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp14_, _tmp15_, NULL, (GCallback) _folder_list_folder_entry_on_counts_changed_g_object_notify, self);
	_g_free0 (_tmp13_);
	_g_object_unref0 (self->priv->context);
	G_OBJECT_CLASS (folder_list_folder_entry_parent_class)->finalize (obj);
}

static GType
folder_list_folder_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FolderListFolderEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folder_list_folder_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FolderListFolderEntry), 0, (GInstanceInitFunc) folder_list_folder_entry_instance_init, NULL };
	static const GInterfaceInfo sidebar_internal_drop_target_entry_info = { (GInterfaceInitFunc) folder_list_folder_entry_sidebar_internal_drop_target_entry_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo sidebar_emphasizable_entry_info = { (GInterfaceInitFunc) folder_list_folder_entry_sidebar_emphasizable_entry_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType folder_list_folder_entry_type_id;
	folder_list_folder_entry_type_id = g_type_register_static (FOLDER_LIST_TYPE_ABSTRACT_FOLDER_ENTRY, "FolderListFolderEntry", &g_define_type_info, 0);
	g_type_add_interface_static (folder_list_folder_entry_type_id, SIDEBAR_TYPE_INTERNAL_DROP_TARGET_ENTRY, &sidebar_internal_drop_target_entry_info);
	g_type_add_interface_static (folder_list_folder_entry_type_id, SIDEBAR_TYPE_EMPHASIZABLE_ENTRY, &sidebar_emphasizable_entry_info);
	FolderListFolderEntry_private_offset = g_type_add_instance_private (folder_list_folder_entry_type_id, sizeof (FolderListFolderEntryPrivate));
	return folder_list_folder_entry_type_id;
}

GType
folder_list_folder_entry_get_type (void)
{
	static volatile gsize folder_list_folder_entry_type_id__once = 0;
	if (g_once_init_enter (&folder_list_folder_entry_type_id__once)) {
		GType folder_list_folder_entry_type_id;
		folder_list_folder_entry_type_id = folder_list_folder_entry_get_type_once ();
		g_once_init_leave (&folder_list_folder_entry_type_id__once, folder_list_folder_entry_type_id);
	}
	return folder_list_folder_entry_type_id__once;
}

