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

/*
* Copyright (c) 2011-2014 Yorba Foundation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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 "io.elementary.photos.h"
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <gee.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdk.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

#define TYPE_LIBRARY_PROPERTIES (library_properties_get_type ())
#define LIBRARY_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LIBRARY_PROPERTIES, LibraryProperties))
#define LIBRARY_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LIBRARY_PROPERTIES, LibraryPropertiesClass))
#define IS_LIBRARY_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LIBRARY_PROPERTIES))
#define IS_LIBRARY_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LIBRARY_PROPERTIES))
#define LIBRARY_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LIBRARY_PROPERTIES, LibraryPropertiesClass))

typedef struct _LibraryProperties LibraryProperties;
typedef struct _LibraryPropertiesClass LibraryPropertiesClass;
typedef struct _LibraryPropertiesPrivate LibraryPropertiesPrivate;

#define LIBRARY_PROPERTIES_TYPE_PLACE_HOLDER_TEXT_VIEW (library_properties_place_holder_text_view_get_type ())
#define LIBRARY_PROPERTIES_PLACE_HOLDER_TEXT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LIBRARY_PROPERTIES_TYPE_PLACE_HOLDER_TEXT_VIEW, LibraryPropertiesPlaceHolderTextView))
#define LIBRARY_PROPERTIES_PLACE_HOLDER_TEXT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LIBRARY_PROPERTIES_TYPE_PLACE_HOLDER_TEXT_VIEW, LibraryPropertiesPlaceHolderTextViewClass))
#define LIBRARY_PROPERTIES_IS_PLACE_HOLDER_TEXT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LIBRARY_PROPERTIES_TYPE_PLACE_HOLDER_TEXT_VIEW))
#define LIBRARY_PROPERTIES_IS_PLACE_HOLDER_TEXT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LIBRARY_PROPERTIES_TYPE_PLACE_HOLDER_TEXT_VIEW))
#define LIBRARY_PROPERTIES_PLACE_HOLDER_TEXT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LIBRARY_PROPERTIES_TYPE_PLACE_HOLDER_TEXT_VIEW, LibraryPropertiesPlaceHolderTextViewClass))

typedef struct _LibraryPropertiesPlaceHolderTextView LibraryPropertiesPlaceHolderTextView;
typedef struct _LibraryPropertiesPlaceHolderTextViewClass LibraryPropertiesPlaceHolderTextViewClass;
enum  {
	LIBRARY_PROPERTIES_0_PROPERTY,
	LIBRARY_PROPERTIES_NUM_PROPERTIES
};
static GParamSpec* library_properties_properties[LIBRARY_PROPERTIES_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _command_manager_unref0(var) ((var == NULL) ? NULL : (var = (command_manager_unref (var), NULL)))
#define _hierarchical_tag_index_unref0(var) ((var == NULL) ? NULL : (var = (hierarchical_tag_index_unref (var), NULL)))
typedef struct _LibraryPropertiesPlaceHolderTextViewPrivate LibraryPropertiesPlaceHolderTextViewPrivate;
enum  {
	LIBRARY_PROPERTIES_PLACE_HOLDER_TEXT_VIEW_0_PROPERTY,
	LIBRARY_PROPERTIES_PLACE_HOLDER_TEXT_VIEW_NUM_PROPERTIES
};
static GParamSpec* library_properties_place_holder_text_view_properties[LIBRARY_PROPERTIES_PLACE_HOLDER_TEXT_VIEW_NUM_PROPERTIES];

struct _LibraryProperties {
	Properties parent_instance;
	LibraryPropertiesPrivate * priv;
};

struct _LibraryPropertiesClass {
	PropertiesClass parent_class;
};

struct _LibraryPropertiesPrivate {
	MediaSource* media_source;
	gchar* comment;
	GtkEntry* tags_entry;
	LibraryPropertiesPlaceHolderTextView* comment_entry;
	gboolean is_media;
	gchar* tags;
};

struct _LibraryPropertiesPlaceHolderTextView {
	GtkTextView parent_instance;
	LibraryPropertiesPlaceHolderTextViewPrivate * priv;
	gchar* placeholder_text;
	GtkTextBuffer* original_buffer;
};

struct _LibraryPropertiesPlaceHolderTextViewClass {
	GtkTextViewClass parent_class;
};

struct _LibraryPropertiesPlaceHolderTextViewPrivate {
	GtkTextBuffer* placeholder_buffer;
};

static gint LibraryProperties_private_offset;
static gpointer library_properties_parent_class = NULL;
static gint LibraryPropertiesPlaceHolderTextView_private_offset;
static gpointer library_properties_place_holder_text_view_parent_class = NULL;

VALA_EXTERN GType library_properties_get_type (void) G_GNUC_CONST ;
static GType library_properties_place_holder_text_view_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static void library_properties_on_tag_contents_altered (LibraryProperties* self,
                                                 ContainerSource* container,
                                                 GeeCollection* added,
                                                 gboolean relinking,
                                                 GeeCollection* removed,
                                                 gboolean unlinking);
static void _library_properties_on_tag_contents_altered_container_source_collection_container_contents_altered (ContainerSourceCollection* _sender,
                                                                                                         ContainerSource* container,
                                                                                                         GeeCollection* added,
                                                                                                         gboolean relinked,
                                                                                                         GeeCollection* removed,
                                                                                                         gboolean unlinked,
                                                                                                         gpointer self);
VALA_EXTERN LibraryProperties* library_properties_new (void);
VALA_EXTERN LibraryProperties* library_properties_construct (GType object_type);
static void library_properties_real_clear_properties (Properties* base);
static void library_properties_real_update_properties (Properties* base,
                                                Page* page);
static void library_properties_real_get_single_properties (Properties* base,
                                                    DataView* view);
static gchar* library_properties_get_initial_tag_text (MediaSource* source);
static void library_properties_real_internal_update_properties (Properties* base,
                                                         Page* page);
static LibraryPropertiesPlaceHolderTextView* library_properties_place_holder_text_view_new (const gchar* text,
                                                                                     const gchar* placeholder_text);
static LibraryPropertiesPlaceHolderTextView* library_properties_place_holder_text_view_construct (GType object_type,
                                                                                           const gchar* text,
                                                                                           const gchar* placeholder_text);
static void library_properties_tags_entry_changed (LibraryProperties* self);
static void _library_properties_tags_entry_changed_gtk_editable_changed (GtkEditable* _sender,
                                                                  gpointer self);
static void library_properties_tags_entry_activate (LibraryProperties* self);
static void _library_properties_tags_entry_activate_gtk_entry_activate (GtkEntry* _sender,
                                                                 gpointer self);
static void library_properties_real_save_changes_to_source (Properties* base);
static gchar* library_properties_place_holder_text_view_get_text (LibraryPropertiesPlaceHolderTextView* self);
static GeeArrayList* library_properties_tag_entry_to_array (LibraryProperties* self);
VALA_EXTERN gchar* hierarchical_tag_utilities_get_basename (const gchar* in_path);
static gboolean library_properties_place_holder_text_view_focus_in (LibraryPropertiesPlaceHolderTextView* self,
                                                             GdkEventFocus* event);
static gboolean _library_properties_place_holder_text_view_focus_in_gtk_widget_focus_in_event (GtkWidget* _sender,
                                                                                        GdkEventFocus* event,
                                                                                        gpointer self);
static gboolean library_properties_place_holder_text_view_focus_out (LibraryPropertiesPlaceHolderTextView* self,
                                                              GdkEventFocus* event);
static gboolean _library_properties_place_holder_text_view_focus_out_gtk_widget_focus_out_event (GtkWidget* _sender,
                                                                                          GdkEventFocus* event,
                                                                                          gpointer self);
static void __lambda122_ (LibraryPropertiesPlaceHolderTextView* self);
static void ___lambda122__gtk_text_view_paste_clipboard (GtkTextView* _sender,
                                                  gpointer self);
static void library_properties_place_holder_text_view_finalize (GObject * obj);
static GType library_properties_place_holder_text_view_get_type_once (void);
static void library_properties_finalize (GObject * obj);
static GType library_properties_get_type_once (void);
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 gssize _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
library_properties_get_instance_private (LibraryProperties* self)
{
	return G_STRUCT_MEMBER_P (self, LibraryProperties_private_offset);
}

static void
_library_properties_on_tag_contents_altered_container_source_collection_container_contents_altered (ContainerSourceCollection* _sender,
                                                                                                    ContainerSource* container,
                                                                                                    GeeCollection* added,
                                                                                                    gboolean relinked,
                                                                                                    GeeCollection* removed,
                                                                                                    gboolean unlinked,
                                                                                                    gpointer self)
{
	library_properties_on_tag_contents_altered ((LibraryProperties*) self, container, added, relinked, removed, unlinked);
}

LibraryProperties*
library_properties_construct (GType object_type)
{
	LibraryProperties * self = NULL;
	TagSourceCollection* _tmp0_;
	self = (LibraryProperties*) properties_construct (object_type);
	_tmp0_ = tag_global;
	g_signal_connect_object ((ContainerSourceCollection*) _tmp0_, "container-contents-altered", (GCallback) _library_properties_on_tag_contents_altered_container_source_collection_container_contents_altered, self, 0);
	return self;
}

LibraryProperties*
library_properties_new (void)
{
	return library_properties_construct (TYPE_LIBRARY_PROPERTIES);
}

static void
library_properties_real_clear_properties (Properties* base)
{
	LibraryProperties * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	self = (LibraryProperties*) base;
	PROPERTIES_CLASS (library_properties_parent_class)->clear_properties (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PROPERTIES, Properties));
	_tmp0_ = g_strdup ("");
	_g_free0 (self->priv->comment);
	self->priv->comment = _tmp0_;
	_tmp1_ = g_strdup ("");
	_g_free0 (self->priv->tags);
	self->priv->tags = _tmp1_;
	self->priv->is_media = FALSE;
}

static void
library_properties_real_update_properties (Properties* base,
                                           Page* page)
{
	LibraryProperties * self;
	self = (LibraryProperties*) base;
	g_return_if_fail (page != NULL);
	properties_internal_update_properties ((Properties*) self, page);
	gtk_widget_show_all ((GtkWidget*) self);
}

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

static void
library_properties_real_get_single_properties (Properties* base,
                                               DataView* view)
{
	LibraryProperties * self;
	MediaSource* source = NULL;
	DataSource* _tmp0_;
	DataSource* _tmp1_;
	MediaSource* _tmp2_;
	MediaSource* _tmp3_;
	MediaSource* _tmp4_;
	MediaSource* _tmp5_;
	MediaSource* _tmp6_;
	Flaggable* flaggable = NULL;
	MediaSource* _tmp7_;
	Flaggable* _tmp8_;
	gboolean _tmp9_ = FALSE;
	MediaSource* _tmp10_;
	self = (LibraryProperties*) base;
	g_return_if_fail (view != NULL);
	PROPERTIES_CLASS (library_properties_parent_class)->get_single_properties (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PROPERTIES, Properties), view);
	_tmp0_ = data_view_get_source (view);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (IS_MEDIA_SOURCE (_tmp1_) ? ((MediaSource*) _tmp1_) : NULL);
	source = _tmp2_;
	_tmp3_ = source;
	_tmp4_ = self->priv->media_source;
	if (_tmp3_ != _tmp4_) {
		properties_save_changes_to_source ((Properties*) self);
	}
	properties_clear_properties ((Properties*) self);
	_tmp5_ = source;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	_g_object_unref0 (self->priv->media_source);
	self->priv->media_source = _tmp6_;
	_tmp7_ = self->priv->media_source;
	_tmp8_ = _g_object_ref0 (IS_FLAGGABLE (_tmp7_) ? ((Flaggable*) _tmp7_) : NULL);
	flaggable = _tmp8_;
	_tmp10_ = self->priv->media_source;
	if (_tmp10_ != NULL) {
		Flaggable* _tmp11_;
		_tmp11_ = flaggable;
		_tmp9_ = _tmp11_ != NULL;
	} else {
		_tmp9_ = FALSE;
	}
	if (_tmp9_) {
		MediaSource* _tmp12_;
		gchar* _tmp13_;
		MediaSource* _tmp14_;
		gchar* _tmp15_;
		_tmp12_ = self->priv->media_source;
		_tmp13_ = library_properties_get_initial_tag_text (_tmp12_);
		_g_free0 (self->priv->tags);
		self->priv->tags = _tmp13_;
		_tmp14_ = self->priv->media_source;
		_tmp15_ = media_source_get_comment (_tmp14_);
		_g_free0 (self->priv->comment);
		self->priv->comment = _tmp15_;
		self->priv->is_media = TRUE;
	}
	_g_object_unref0 (flaggable);
	_g_object_unref0 (source);
}

static void
_library_properties_tags_entry_changed_gtk_editable_changed (GtkEditable* _sender,
                                                             gpointer self)
{
	library_properties_tags_entry_changed ((LibraryProperties*) self);
}

static void
_library_properties_tags_entry_activate_gtk_entry_activate (GtkEntry* _sender,
                                                            gpointer self)
{
	library_properties_tags_entry_activate ((LibraryProperties*) self);
}

static void
library_properties_real_internal_update_properties (Properties* base,
                                                    Page* page)
{
	LibraryProperties * self;
	self = (LibraryProperties*) base;
	g_return_if_fail (page != NULL);
	PROPERTIES_CLASS (library_properties_parent_class)->internal_update_properties (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PROPERTIES, Properties), page);
	gtk_grid_set_row_spacing ((GtkGrid*) self, 12);
	if (self->priv->is_media) {
		const gchar* _tmp0_;
		LibraryPropertiesPlaceHolderTextView* _tmp1_;
		LibraryPropertiesPlaceHolderTextView* _tmp2_;
		LibraryPropertiesPlaceHolderTextView* _tmp3_;
		GtkFrame* frame = NULL;
		GtkFrame* _tmp4_;
		GtkFrame* _tmp5_;
		GtkFrame* _tmp6_;
		LibraryPropertiesPlaceHolderTextView* _tmp7_;
		GtkEntry* _tmp8_;
		GtkEntry* _tmp9_;
		const gchar* _tmp10_;
		GtkFrame* _tmp13_;
		GtkEntry* _tmp14_;
		GtkEntry* _tmp15_;
		GtkEntry* _tmp16_;
		_tmp0_ = self->priv->comment;
		_tmp1_ = library_properties_place_holder_text_view_new (_tmp0_, _ ("Comment"));
		g_object_ref_sink (_tmp1_);
		_g_object_unref0 (self->priv->comment_entry);
		self->priv->comment_entry = _tmp1_;
		_tmp2_ = self->priv->comment_entry;
		gtk_text_view_set_wrap_mode ((GtkTextView*) _tmp2_, GTK_WRAP_WORD);
		_tmp3_ = self->priv->comment_entry;
		g_object_set ((GtkWidget*) _tmp3_, "height-request", 50, NULL);
		_tmp4_ = (GtkFrame*) gtk_frame_new (NULL);
		g_object_ref_sink (_tmp4_);
		frame = _tmp4_;
		_tmp5_ = frame;
		gtk_widget_set_hexpand ((GtkWidget*) _tmp5_, TRUE);
		_tmp6_ = frame;
		_tmp7_ = self->priv->comment_entry;
		gtk_container_add ((GtkContainer*) _tmp6_, (GtkWidget*) _tmp7_);
		_tmp8_ = (GtkEntry*) gtk_entry_new ();
		g_object_ref_sink (_tmp8_);
		_g_object_unref0 (self->priv->tags_entry);
		self->priv->tags_entry = _tmp8_;
		_tmp9_ = self->priv->tags_entry;
		gtk_entry_set_placeholder_text (_tmp9_, _ ("Tags, separated by commas"));
		_tmp10_ = self->priv->tags;
		if (_tmp10_ != NULL) {
			GtkEntry* _tmp11_;
			const gchar* _tmp12_;
			_tmp11_ = self->priv->tags_entry;
			_tmp12_ = self->priv->tags;
			gtk_entry_set_text (_tmp11_, _tmp12_);
		}
		_tmp13_ = frame;
		gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp13_, 0, 0, 1, 1);
		_tmp14_ = self->priv->tags_entry;
		gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp14_, 0, 1, 1, 1);
		_tmp15_ = self->priv->tags_entry;
		g_signal_connect_object ((GtkEditable*) _tmp15_, "changed", (GCallback) _library_properties_tags_entry_changed_gtk_editable_changed, self, 0);
		_tmp16_ = self->priv->tags_entry;
		g_signal_connect_object (_tmp16_, "activate", (GCallback) _library_properties_tags_entry_activate_gtk_entry_activate, self, 0);
		_g_object_unref0 (frame);
	}
}

static void
library_properties_tags_entry_changed (LibraryProperties* self)
{
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->tags_entry;
	_tmp1_ = gtk_entry_get_text (_tmp0_);
	_tmp2_ = g_strdup (_tmp1_);
	_g_free0 (self->priv->tags);
	self->priv->tags = _tmp2_;
}

static void
library_properties_tags_entry_activate (LibraryProperties* self)
{
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->tags_entry;
	_tmp1_ = gtk_entry_get_text (_tmp0_);
	_tmp2_ = g_strdup (_tmp1_);
	_g_free0 (self->priv->tags);
	self->priv->tags = _tmp2_;
	properties_save_changes_to_source ((Properties*) self);
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static void
library_properties_real_save_changes_to_source (Properties* base)
{
	LibraryProperties * self;
	gboolean _tmp0_ = FALSE;
	MediaSource* _tmp1_;
	self = (LibraryProperties*) base;
	_tmp1_ = self->priv->media_source;
	if (_tmp1_ != NULL) {
		_tmp0_ = self->priv->is_media;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		LibraryPropertiesPlaceHolderTextView* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		gboolean _tmp6_ = FALSE;
		const gchar* _tmp7_;
		GeeArrayList* new_tags = NULL;
		GeeArrayList* _tmp18_;
		gboolean _tmp19_ = FALSE;
		GeeArrayList* _tmp20_;
		_tmp2_ = self->priv->comment_entry;
		_tmp3_ = library_properties_place_holder_text_view_get_text (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = string_strip (_tmp4_);
		_g_free0 (self->priv->comment);
		self->priv->comment = _tmp5_;
		_g_free0 (_tmp4_);
		_tmp7_ = self->priv->comment;
		if (_tmp7_ != NULL) {
			const gchar* _tmp8_;
			MediaSource* _tmp9_;
			gchar* _tmp10_;
			gchar* _tmp11_;
			_tmp8_ = self->priv->comment;
			_tmp9_ = self->priv->media_source;
			_tmp10_ = media_source_get_comment (_tmp9_);
			_tmp11_ = _tmp10_;
			_tmp6_ = g_strcmp0 (_tmp8_, _tmp11_) != 0;
			_g_free0 (_tmp11_);
		} else {
			_tmp6_ = FALSE;
		}
		if (_tmp6_) {
			CommandManager* _tmp12_;
			CommandManager* _tmp13_;
			MediaSource* _tmp14_;
			const gchar* _tmp15_;
			EditCommentCommand* _tmp16_;
			EditCommentCommand* _tmp17_;
			_tmp12_ = app_window_get_command_manager ();
			_tmp13_ = _tmp12_;
			_tmp14_ = self->priv->media_source;
			_tmp15_ = self->priv->comment;
			_tmp16_ = edit_comment_command_new (_tmp14_, _tmp15_);
			_tmp17_ = _tmp16_;
			command_manager_execute (_tmp13_, (Command*) _tmp17_);
			_g_object_unref0 (_tmp17_);
			_command_manager_unref0 (_tmp13_);
		}
		_tmp18_ = library_properties_tag_entry_to_array (self);
		new_tags = _tmp18_;
		_tmp20_ = new_tags;
		if (_tmp20_ != NULL) {
			const gchar* _tmp21_;
			MediaSource* _tmp22_;
			gchar* _tmp23_;
			gchar* _tmp24_;
			_tmp21_ = self->priv->tags;
			_tmp22_ = self->priv->media_source;
			_tmp23_ = library_properties_get_initial_tag_text (_tmp22_);
			_tmp24_ = _tmp23_;
			_tmp19_ = g_strcmp0 (_tmp21_, _tmp24_) != 0;
			_g_free0 (_tmp24_);
		} else {
			_tmp19_ = FALSE;
		}
		if (_tmp19_) {
			CommandManager* _tmp25_;
			CommandManager* _tmp26_;
			MediaSource* _tmp27_;
			GeeArrayList* _tmp28_;
			ModifyTagsCommand* _tmp29_;
			ModifyTagsCommand* _tmp30_;
			_tmp25_ = app_window_get_command_manager ();
			_tmp26_ = _tmp25_;
			_tmp27_ = self->priv->media_source;
			_tmp28_ = new_tags;
			_tmp29_ = modify_tags_command_new (_tmp27_, (GeeCollection*) _tmp28_);
			_tmp30_ = _tmp29_;
			command_manager_execute (_tmp26_, (Command*) _tmp30_);
			_g_object_unref0 (_tmp30_);
			_command_manager_unref0 (_tmp26_);
		}
		_g_object_unref0 (new_tags);
	}
}

static gchar*
library_properties_get_initial_tag_text (MediaSource* source)
{
	GeeCollection* source_tags = NULL;
	TagSourceCollection* _tmp0_;
	GeeList* _tmp1_;
	GeeCollection* _tmp2_;
	GeeCollection* terminal_tags = NULL;
	GeeCollection* _tmp3_;
	GeeCollection* _tmp4_;
	GeeSortedSet* tag_basenames = NULL;
	GeeTreeSet* _tmp5_;
	gchar* text = NULL;
	gchar* result;
	g_return_val_if_fail (source != NULL, NULL);
	_tmp0_ = tag_global;
	_tmp1_ = tag_source_collection_fetch_for_source (_tmp0_, source);
	source_tags = (GeeCollection*) _tmp1_;
	_tmp2_ = source_tags;
	if (_tmp2_ == NULL) {
		result = NULL;
		_g_object_unref0 (source_tags);
		return result;
	}
	_tmp3_ = source_tags;
	_tmp4_ = tag_get_terminal_tags (_tmp3_);
	terminal_tags = _tmp4_;
	_tmp5_ = gee_tree_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	tag_basenames = (GeeSortedSet*) _tmp5_;
	{
		GeeIterator* _tag_it = NULL;
		GeeCollection* _tmp6_;
		GeeIterator* _tmp7_;
		_tmp6_ = terminal_tags;
		_tmp7_ = gee_iterable_iterator ((GeeIterable*) _tmp6_);
		_tag_it = _tmp7_;
		while (TRUE) {
			GeeIterator* _tmp8_;
			Tag* tag = NULL;
			GeeIterator* _tmp9_;
			gpointer _tmp10_;
			GeeSortedSet* _tmp11_;
			Tag* _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			gchar* _tmp15_;
			gchar* _tmp16_;
			_tmp8_ = _tag_it;
			if (!gee_iterator_next (_tmp8_)) {
				break;
			}
			_tmp9_ = _tag_it;
			_tmp10_ = gee_iterator_get (_tmp9_);
			tag = (Tag*) _tmp10_;
			_tmp11_ = tag_basenames;
			_tmp12_ = tag;
			_tmp13_ = tag_get_path (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp15_ = hierarchical_tag_utilities_get_basename (_tmp14_);
			_tmp16_ = _tmp15_;
			gee_collection_add ((GeeCollection*) _tmp11_, _tmp16_);
			_g_free0 (_tmp16_);
			_g_free0 (_tmp14_);
			_g_object_unref0 (tag);
		}
		_g_object_unref0 (_tag_it);
	}
	text = NULL;
	{
		GeeIterator* _name_it = NULL;
		GeeSortedSet* _tmp17_;
		GeeIterator* _tmp18_;
		_tmp17_ = tag_basenames;
		_tmp18_ = gee_iterable_iterator ((GeeIterable*) _tmp17_);
		_name_it = _tmp18_;
		while (TRUE) {
			GeeIterator* _tmp19_;
			gchar* name = NULL;
			GeeIterator* _tmp20_;
			gpointer _tmp21_;
			const gchar* _tmp22_;
			const gchar* _tmp26_;
			const gchar* _tmp27_;
			gchar* _tmp28_;
			_tmp19_ = _name_it;
			if (!gee_iterator_next (_tmp19_)) {
				break;
			}
			_tmp20_ = _name_it;
			_tmp21_ = gee_iterator_get (_tmp20_);
			name = (gchar*) _tmp21_;
			_tmp22_ = text;
			if (_tmp22_ == NULL) {
				gchar* _tmp23_;
				_tmp23_ = g_strdup ("");
				_g_free0 (text);
				text = _tmp23_;
			} else {
				const gchar* _tmp24_;
				gchar* _tmp25_;
				_tmp24_ = text;
				_tmp25_ = g_strconcat (_tmp24_, ", ", NULL);
				_g_free0 (text);
				text = _tmp25_;
			}
			_tmp26_ = text;
			_tmp27_ = name;
			_tmp28_ = g_strconcat (_tmp26_, _tmp27_, NULL);
			_g_free0 (text);
			text = _tmp28_;
			_g_free0 (name);
		}
		_g_object_unref0 (_name_it);
	}
	result = text;
	_g_object_unref0 (tag_basenames);
	_g_object_unref0 (terminal_tags);
	_g_object_unref0 (source_tags);
	return result;
}

static GeeArrayList*
library_properties_tag_entry_to_array (LibraryProperties* self)
{
	gchar* text = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	GeeArrayList* new_tags = NULL;
	GeeArrayList* _tmp3_;
	const gchar* _tmp4_;
	gchar** tag_names = NULL;
	const gchar* _tmp5_;
	gchar** _tmp6_;
	gchar** _tmp7_;
	gchar** _tmp8_;
	gint _tmp8__length1;
	gint _tmp9_ = 0;
	gchar** _tmp10_;
	gchar** _tmp11_;
	gint _tmp11__length1;
	gint tag_names_length1;
	gint _tag_names_size_;
	HierarchicalTagIndex* _tmp12_;
	HierarchicalTagIndex* _tmp13_;
	gchar** _tmp14_;
	gint _tmp14__length1;
	gint _tmp15_ = 0;
	gchar** _tmp16_;
	gchar** _tmp17_;
	gint _tmp17__length1;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->tags;
	_tmp1_ = g_strdup (_tmp0_);
	text = _tmp1_;
	_tmp2_ = text;
	if (_tmp2_ == NULL) {
		result = NULL;
		_g_free0 (text);
		return result;
	}
	_tmp3_ = gee_array_list_new (TYPE_TAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	new_tags = _tmp3_;
	_tmp4_ = text;
	if (is_string_empty (_tmp4_)) {
		result = new_tags;
		_g_free0 (text);
		return result;
	}
	_tmp5_ = text;
	_tmp7_ = _tmp6_ = g_strsplit (_tmp5_, ",", 0);
	_tmp8_ = _tmp7_;
	_tmp8__length1 = _vala_array_length (_tmp6_);
	_tmp10_ = tag_prep_tag_names (_tmp8_, (gint) _vala_array_length (_tmp6_), &_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp11__length1 = _tmp9_;
	_tmp8_ = (_vala_array_free (_tmp8_, _tmp8__length1, (GDestroyNotify) g_free), NULL);
	tag_names = _tmp11_;
	tag_names_length1 = _tmp11__length1;
	_tag_names_size_ = tag_names_length1;
	_tmp12_ = hierarchical_tag_index_get_global_index ();
	_tmp13_ = _tmp12_;
	_tmp14_ = tag_names;
	_tmp14__length1 = tag_names_length1;
	_tmp16_ = hierarchical_tag_index_get_paths_for_names_array (_tmp13_, _tmp14_, (gint) _tmp14__length1, &_tmp15_);
	tag_names = (_vala_array_free (tag_names, tag_names_length1, (GDestroyNotify) g_free), NULL);
	tag_names = _tmp16_;
	tag_names_length1 = _tmp15_;
	_tag_names_size_ = tag_names_length1;
	_hierarchical_tag_index_unref0 (_tmp13_);
	_tmp17_ = tag_names;
	_tmp17__length1 = tag_names_length1;
	{
		gchar** name_collection = NULL;
		gint name_collection_length1 = 0;
		gint _name_collection_size_ = 0;
		gint name_it = 0;
		name_collection = _tmp17_;
		name_collection_length1 = _tmp17__length1;
		for (name_it = 0; name_it < name_collection_length1; name_it = name_it + 1) {
			gchar* _tmp18_;
			gchar* name = NULL;
			_tmp18_ = g_strdup (name_collection[name_it]);
			name = _tmp18_;
			{
				GeeArrayList* _tmp19_;
				const gchar* _tmp20_;
				Tag* _tmp21_;
				Tag* _tmp22_;
				_tmp19_ = new_tags;
				_tmp20_ = name;
				_tmp21_ = tag_for_path (_tmp20_);
				_tmp22_ = _tmp21_;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp19_, _tmp22_);
				_g_object_unref0 (_tmp22_);
				_g_free0 (name);
			}
		}
	}
	result = new_tags;
	tag_names = (_vala_array_free (tag_names, tag_names_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (text);
	return result;
}

static void
library_properties_on_tag_contents_altered (LibraryProperties* self,
                                            ContainerSource* container,
                                            GeeCollection* added,
                                            gboolean relinking,
                                            GeeCollection* removed,
                                            gboolean unlinking)
{
	Flaggable* flaggable = NULL;
	MediaSource* _tmp0_;
	Flaggable* _tmp1_;
	gboolean _tmp2_ = FALSE;
	MediaSource* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (container != NULL);
	_tmp0_ = self->priv->media_source;
	_tmp1_ = _g_object_ref0 (IS_FLAGGABLE (_tmp0_) ? ((Flaggable*) _tmp0_) : NULL);
	flaggable = _tmp1_;
	_tmp3_ = self->priv->media_source;
	if (_tmp3_ != NULL) {
		Flaggable* _tmp4_;
		_tmp4_ = flaggable;
		_tmp2_ = _tmp4_ != NULL;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		MediaSource* _tmp5_;
		gchar* _tmp6_;
		const gchar* _tmp7_;
		_tmp5_ = self->priv->media_source;
		_tmp6_ = library_properties_get_initial_tag_text (_tmp5_);
		_g_free0 (self->priv->tags);
		self->priv->tags = _tmp6_;
		_tmp7_ = self->priv->tags;
		if (_tmp7_ != NULL) {
			GtkEntry* _tmp8_;
			const gchar* _tmp9_;
			_tmp8_ = self->priv->tags_entry;
			_tmp9_ = self->priv->tags;
			gtk_entry_set_text (_tmp8_, _tmp9_);
		} else {
			GtkEntry* _tmp10_;
			_tmp10_ = self->priv->tags_entry;
			gtk_entry_set_text (_tmp10_, "");
		}
	}
	_g_object_unref0 (flaggable);
}

static inline gpointer
library_properties_place_holder_text_view_get_instance_private (LibraryPropertiesPlaceHolderTextView* self)
{
	return G_STRUCT_MEMBER_P (self, LibraryPropertiesPlaceHolderTextView_private_offset);
}

static gboolean
_library_properties_place_holder_text_view_focus_in_gtk_widget_focus_in_event (GtkWidget* _sender,
                                                                               GdkEventFocus* event,
                                                                               gpointer self)
{
	gboolean result;
	result = library_properties_place_holder_text_view_focus_in ((LibraryPropertiesPlaceHolderTextView*) self, event);
	return result;
}

static gboolean
_library_properties_place_holder_text_view_focus_out_gtk_widget_focus_out_event (GtkWidget* _sender,
                                                                                 GdkEventFocus* event,
                                                                                 gpointer self)
{
	gboolean result;
	result = library_properties_place_holder_text_view_focus_out ((LibraryPropertiesPlaceHolderTextView*) self, event);
	return result;
}

static void
__lambda122_ (LibraryPropertiesPlaceHolderTextView* self)
{
	GtkTextBuffer* _tmp0_;
	GtkTextBuffer* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	GtkClipboard* clipboard = NULL;
	GdkDisplay* _tmp6_;
	GtkClipboard* _tmp7_;
	GtkClipboard* _tmp8_;
	GtkTextBuffer* _tmp9_;
	GtkTextBuffer* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	_tmp0_ = gtk_text_view_get_buffer ((GtkTextView*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = gtk_text_buffer_get_has_selection (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		GtkTextBuffer* _tmp4_;
		GtkTextBuffer* _tmp5_;
		_tmp4_ = gtk_text_view_get_buffer ((GtkTextView*) self);
		_tmp5_ = _tmp4_;
		gtk_text_buffer_delete_selection (_tmp5_, TRUE, TRUE);
	}
	_tmp6_ = gdk_display_get_default ();
	_tmp7_ = gtk_clipboard_get_for_display (_tmp6_, GDK_SELECTION_PRIMARY);
	_tmp8_ = _g_object_ref0 (_tmp7_);
	clipboard = _tmp8_;
	_tmp9_ = gtk_text_view_get_buffer ((GtkTextView*) self);
	_tmp10_ = _tmp9_;
	_tmp11_ = gtk_clipboard_wait_for_text (clipboard);
	_tmp12_ = _tmp11_;
	g_object_set (_tmp10_, "text", _tmp12_, NULL);
	_g_free0 (_tmp12_);
	_g_object_unref0 (clipboard);
}

static void
___lambda122__gtk_text_view_paste_clipboard (GtkTextView* _sender,
                                             gpointer self)
{
	__lambda122_ ((LibraryPropertiesPlaceHolderTextView*) self);
}

static LibraryPropertiesPlaceHolderTextView*
library_properties_place_holder_text_view_construct (GType object_type,
                                                     const gchar* text,
                                                     const gchar* placeholder_text)
{
	LibraryPropertiesPlaceHolderTextView * self = NULL;
	GtkTextBuffer* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean _tmp3_ = FALSE;
	g_return_val_if_fail (placeholder_text != NULL, NULL);
	self = (LibraryPropertiesPlaceHolderTextView*) g_object_new (object_type, NULL);
	_tmp0_ = self->priv->placeholder_buffer;
	_tmp1_ = g_strdup (placeholder_text);
	_g_free0 (self->placeholder_text);
	self->placeholder_text = _tmp1_;
	_tmp2_ = self->placeholder_text;
	g_object_set (_tmp0_, "text", _tmp2_, NULL);
	if (text == NULL) {
		_tmp3_ = TRUE;
	} else {
		_tmp3_ = g_strcmp0 (text, "") == 0;
	}
	if (_tmp3_) {
		GtkTextBuffer* _tmp4_;
		GtkTextBuffer* _tmp5_;
		_tmp4_ = self->priv->placeholder_buffer;
		gtk_text_view_set_buffer ((GtkTextView*) self, _tmp4_);
		_tmp5_ = self->original_buffer;
		g_object_set (_tmp5_, "text", "", NULL);
	} else {
		GtkTextBuffer* _tmp6_;
		GtkTextBuffer* _tmp7_;
		GtkTextBuffer* _tmp8_;
		_tmp6_ = self->original_buffer;
		gtk_text_view_set_buffer ((GtkTextView*) self, _tmp6_);
		_tmp7_ = gtk_text_view_get_buffer ((GtkTextView*) self);
		_tmp8_ = _tmp7_;
		g_object_set (_tmp8_, "text", text, NULL);
	}
	g_signal_connect_object ((GtkWidget*) self, "focus-in-event", (GCallback) _library_properties_place_holder_text_view_focus_in_gtk_widget_focus_in_event, self, 0);
	g_signal_connect_object ((GtkWidget*) self, "focus-out-event", (GCallback) _library_properties_place_holder_text_view_focus_out_gtk_widget_focus_out_event, self, 0);
	g_signal_connect_object ((GtkTextView*) self, "paste-clipboard", (GCallback) ___lambda122__gtk_text_view_paste_clipboard, self, 0);
	return self;
}

static LibraryPropertiesPlaceHolderTextView*
library_properties_place_holder_text_view_new (const gchar* text,
                                               const gchar* placeholder_text)
{
	return library_properties_place_holder_text_view_construct (LIBRARY_PROPERTIES_TYPE_PLACE_HOLDER_TEXT_VIEW, text, placeholder_text);
}

static gchar*
library_properties_place_holder_text_view_get_text (LibraryPropertiesPlaceHolderTextView* self)
{
	gboolean _tmp0_ = FALSE;
	GtkTextBuffer* _tmp1_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = self->original_buffer;
	if (_tmp1_ != NULL) {
		GtkTextBuffer* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp2_ = self->original_buffer;
		g_object_get (_tmp2_, "text", &_tmp3_, NULL);
		_tmp4_ = _tmp3_;
		_tmp5_ = _tmp4_;
		_tmp0_ = _tmp5_ != NULL;
		_g_free0 (_tmp5_);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GtkTextBuffer* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp6_ = self->original_buffer;
		g_object_get (_tmp6_, "text", &_tmp7_, NULL);
		_tmp8_ = _tmp7_;
		result = _tmp8_;
		return result;
	} else {
		gchar* _tmp9_;
		_tmp9_ = g_strdup ("");
		result = _tmp9_;
		return result;
	}
}

static gboolean
library_properties_place_holder_text_view_focus_in (LibraryPropertiesPlaceHolderTextView* self,
                                                    GdkEventFocus* event)
{
	GtkTextBuffer* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = self->original_buffer;
	gtk_text_view_set_buffer ((GtkTextView*) self, _tmp0_);
	result = FALSE;
	return result;
}

static gboolean
library_properties_place_holder_text_view_focus_out (LibraryPropertiesPlaceHolderTextView* self,
                                                     GdkEventFocus* event)
{
	gboolean _tmp0_ = FALSE;
	GtkTextBuffer* _tmp1_;
	GtkTextBuffer* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gboolean _tmp6_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp1_ = gtk_text_view_get_buffer ((GtkTextView*) self);
	_tmp2_ = _tmp1_;
	g_object_get (_tmp2_, "text", &_tmp3_, NULL);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_ == NULL;
	_g_free0 (_tmp5_);
	if (_tmp6_) {
		_tmp0_ = TRUE;
	} else {
		GtkTextBuffer* _tmp7_;
		GtkTextBuffer* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp7_ = gtk_text_view_get_buffer ((GtkTextView*) self);
		_tmp8_ = _tmp7_;
		g_object_get (_tmp8_, "text", &_tmp9_, NULL);
		_tmp10_ = _tmp9_;
		_tmp11_ = _tmp10_;
		_tmp0_ = g_strcmp0 (_tmp11_, "") == 0;
		_g_free0 (_tmp11_);
	}
	if (_tmp0_) {
		GtkTextBuffer* _tmp12_;
		_tmp12_ = self->priv->placeholder_buffer;
		gtk_text_view_set_buffer ((GtkTextView*) self, _tmp12_);
	}
	result = FALSE;
	return result;
}

static void
library_properties_place_holder_text_view_class_init (LibraryPropertiesPlaceHolderTextViewClass * klass,
                                                      gpointer klass_data)
{
	library_properties_place_holder_text_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &LibraryPropertiesPlaceHolderTextView_private_offset);
	G_OBJECT_CLASS (klass)->finalize = library_properties_place_holder_text_view_finalize;
}

static void
library_properties_place_holder_text_view_instance_init (LibraryPropertiesPlaceHolderTextView * self,
                                                         gpointer klass)
{
	GtkTextBuffer* _tmp0_;
	GtkTextBuffer* _tmp1_;
	self->priv = library_properties_place_holder_text_view_get_instance_private (self);
	_tmp0_ = gtk_text_buffer_new (NULL);
	self->priv->placeholder_buffer = _tmp0_;
	_tmp1_ = gtk_text_buffer_new (NULL);
	self->original_buffer = _tmp1_;
}

static void
library_properties_place_holder_text_view_finalize (GObject * obj)
{
	LibraryPropertiesPlaceHolderTextView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, LIBRARY_PROPERTIES_TYPE_PLACE_HOLDER_TEXT_VIEW, LibraryPropertiesPlaceHolderTextView);
	_g_free0 (self->placeholder_text);
	_g_object_unref0 (self->priv->placeholder_buffer);
	_g_object_unref0 (self->original_buffer);
	G_OBJECT_CLASS (library_properties_place_holder_text_view_parent_class)->finalize (obj);
}

static GType
library_properties_place_holder_text_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (LibraryPropertiesPlaceHolderTextViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) library_properties_place_holder_text_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LibraryPropertiesPlaceHolderTextView), 0, (GInstanceInitFunc) library_properties_place_holder_text_view_instance_init, NULL };
	GType library_properties_place_holder_text_view_type_id;
	library_properties_place_holder_text_view_type_id = g_type_register_static (gtk_text_view_get_type (), "LibraryPropertiesPlaceHolderTextView", &g_define_type_info, 0);
	LibraryPropertiesPlaceHolderTextView_private_offset = g_type_add_instance_private (library_properties_place_holder_text_view_type_id, sizeof (LibraryPropertiesPlaceHolderTextViewPrivate));
	return library_properties_place_holder_text_view_type_id;
}

static GType
library_properties_place_holder_text_view_get_type (void)
{
	static volatile gsize library_properties_place_holder_text_view_type_id__once = 0;
	if (g_once_init_enter (&library_properties_place_holder_text_view_type_id__once)) {
		GType library_properties_place_holder_text_view_type_id;
		library_properties_place_holder_text_view_type_id = library_properties_place_holder_text_view_get_type_once ();
		g_once_init_leave (&library_properties_place_holder_text_view_type_id__once, library_properties_place_holder_text_view_type_id);
	}
	return library_properties_place_holder_text_view_type_id__once;
}

static void
library_properties_class_init (LibraryPropertiesClass * klass,
                               gpointer klass_data)
{
	library_properties_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &LibraryProperties_private_offset);
	((PropertiesClass *) klass)->clear_properties = (void (*) (Properties*)) library_properties_real_clear_properties;
	((PropertiesClass *) klass)->update_properties = (void (*) (Properties*, Page*)) library_properties_real_update_properties;
	((PropertiesClass *) klass)->get_single_properties = (void (*) (Properties*, DataView*)) library_properties_real_get_single_properties;
	((PropertiesClass *) klass)->internal_update_properties = (void (*) (Properties*, Page*)) library_properties_real_internal_update_properties;
	((PropertiesClass *) klass)->save_changes_to_source = (void (*) (Properties*)) library_properties_real_save_changes_to_source;
	G_OBJECT_CLASS (klass)->finalize = library_properties_finalize;
}

static void
library_properties_instance_init (LibraryProperties * self,
                                  gpointer klass)
{
	self->priv = library_properties_get_instance_private (self);
}

static void
library_properties_finalize (GObject * obj)
{
	LibraryProperties * self;
	TagSourceCollection* _tmp0_;
	guint _tmp1_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_LIBRARY_PROPERTIES, LibraryProperties);
	_tmp0_ = tag_global;
	g_signal_parse_name ("container-contents-altered", TYPE_CONTAINER_SOURCE_COLLECTION, &_tmp1_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((ContainerSourceCollection*) _tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _library_properties_on_tag_contents_altered_container_source_collection_container_contents_altered, self);
	_g_object_unref0 (self->priv->media_source);
	_g_free0 (self->priv->comment);
	_g_object_unref0 (self->priv->tags_entry);
	_g_object_unref0 (self->priv->comment_entry);
	_g_free0 (self->priv->tags);
	G_OBJECT_CLASS (library_properties_parent_class)->finalize (obj);
}

static GType
library_properties_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (LibraryPropertiesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) library_properties_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LibraryProperties), 0, (GInstanceInitFunc) library_properties_instance_init, NULL };
	GType library_properties_type_id;
	library_properties_type_id = g_type_register_static (TYPE_PROPERTIES, "LibraryProperties", &g_define_type_info, 0);
	LibraryProperties_private_offset = g_type_add_instance_private (library_properties_type_id, sizeof (LibraryPropertiesPrivate));
	return library_properties_type_id;
}

GType
library_properties_get_type (void)
{
	static volatile gsize library_properties_type_id__once = 0;
	if (g_once_init_enter (&library_properties_type_id__once)) {
		GType library_properties_type_id;
		library_properties_type_id = library_properties_get_type_once ();
		g_once_init_leave (&library_properties_type_id__once, library_properties_type_id);
	}
	return library_properties_type_id__once;
}

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);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

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

