/* gmpc-metadata-appearance.c generated by valac 0.12.0, the Vala compiler
 * generated from gmpc-metadata-appearance.vala, do not modify */

/* Gnome Music Player Client (GMPC)
 * Copyright (C) 2004-2011 Qball Cow <qball@gmpclient.org>
 * Project homepage: http://gmpclient.org/

 * 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 2 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.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <gtktransition.h>
#include <stdlib.h>
#include <string.h>
#include <config.h>
#include "gmpc-extras.h"
#include <plugin.h>
#include <config1.h>
#include <stdio.h>

#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL)))


static gpointer gmpc_tools_metadata_appearance_parent_class = NULL;
static GmpcPluginPreferencesIfaceIface* gmpc_tools_metadata_appearance_gmpc_plugin_preferences_iface_parent_iface = NULL;

#define use_transition_tma TRUE
#define some_unique_name_tma VERSION
enum  {
	GMPC_TOOLS_METADATA_APPEARANCE_DUMMY_PROPERTY
};
static gint* gmpc_tools_metadata_appearance_real_get_version (GmpcPluginBase* base, int* result_length1);
static const gchar* gmpc_tools_metadata_appearance_real_get_name (GmpcPluginBase* base);
static void gmpc_tools_metadata_appearance_real_preferences_pane_construct (GmpcPluginPreferencesIface* base, GtkContainer* container);
static void gmpc_tools_metadata_appearance_real_preferences_pane_destroy (GmpcPluginPreferencesIface* base, GtkContainer* container);
static GObject * gmpc_tools_metadata_appearance_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);

static const gint GMPC_TOOLS_METADATA_APPEARANCE_version[3] = {0, 0, 0};

static gint* gmpc_tools_metadata_appearance_real_get_version (GmpcPluginBase* base, int* result_length1) {
	GmpcToolsMetadataAppearance * self;
	gint* result = NULL;
	gint* _tmp0_;
	self = (GmpcToolsMetadataAppearance*) base;
	_tmp0_ = GMPC_TOOLS_METADATA_APPEARANCE_version;
	*result_length1 = G_N_ELEMENTS (GMPC_TOOLS_METADATA_APPEARANCE_version);
	result = _tmp0_;
	return result;
}


static const gchar* gmpc_tools_metadata_appearance_real_get_name (GmpcPluginBase* base) {
	GmpcToolsMetadataAppearance * self;
	const gchar* result = NULL;
	self = (GmpcToolsMetadataAppearance*) base;
	result = "Metadata Appearance";
	return result;
}


void gmpc_tools_metadata_appearance_on_checkbutton_show_lyrics_toggled (GtkCheckButton* source) {
	gboolean _tmp0_;
	g_return_if_fail (source != NULL);
	_tmp0_ = gtk_toggle_button_get_active ((GtkToggleButton*) source);
	cfg_set_single_value_as_int (config, "MetaData", "show-lyrics", (gint) _tmp0_);
}


void gmpc_tools_metadata_appearance_on_checkbutton_show_artist_information_toggled (GtkCheckButton* source) {
	gboolean _tmp0_;
	g_return_if_fail (source != NULL);
	_tmp0_ = gtk_toggle_button_get_active ((GtkToggleButton*) source);
	cfg_set_single_value_as_int (config, "MetaData", "show-artist-information", (gint) _tmp0_);
}


void gmpc_tools_metadata_appearance_on_checkbutton_show_web_links_toggled (GtkCheckButton* source) {
	gboolean _tmp0_;
	g_return_if_fail (source != NULL);
	_tmp0_ = gtk_toggle_button_get_active ((GtkToggleButton*) source);
	cfg_set_single_value_as_int (config, "MetaData", "show-web-links", (gint) _tmp0_);
}


void gmpc_tools_metadata_appearance_on_checkbutton_show_similar_artists_toggled (GtkCheckButton* source) {
	gboolean _tmp0_;
	g_return_if_fail (source != NULL);
	_tmp0_ = gtk_toggle_button_get_active ((GtkToggleButton*) source);
	cfg_set_single_value_as_int (config, "MetaData", "show-similar-artist", (gint) _tmp0_);
}


void gmpc_tools_metadata_appearance_on_checkbutton_show_similar_songs_toggled (GtkCheckButton* source) {
	gboolean _tmp0_;
	g_return_if_fail (source != NULL);
	_tmp0_ = gtk_toggle_button_get_active ((GtkToggleButton*) source);
	cfg_set_single_value_as_int (config, "MetaData", "show-similar-songs", (gint) _tmp0_);
}


void gmpc_tools_metadata_appearance_on_checkbutton_show_guitar_tabs_toggled (GtkCheckButton* source) {
	gboolean _tmp0_;
	g_return_if_fail (source != NULL);
	_tmp0_ = gtk_toggle_button_get_active ((GtkToggleButton*) source);
	cfg_set_single_value_as_int (config, "MetaData", "show-guitar-tabs", (gint) _tmp0_);
}


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


static void gmpc_tools_metadata_appearance_real_preferences_pane_construct (GmpcPluginPreferencesIface* base, GtkContainer* container) {
	GmpcToolsMetadataAppearance * self;
	GtkBuilder* _tmp0_ = NULL;
	GtkBuilder* builder;
	gchar* _tmp1_ = NULL;
	gchar* preferences_ui_file;
	GObject* _tmp2_ = NULL;
	GObject* _tmp3_;
	GtkWidget* _tmp4_;
	GtkWidget* builderWidget;
	GObject* _tmp5_ = NULL;
	GObject* _tmp6_;
	GtkWidget* _tmp7_;
	gint _tmp8_;
	GObject* _tmp9_ = NULL;
	GObject* _tmp10_;
	GtkWidget* _tmp11_;
	gint _tmp12_;
	GObject* _tmp13_ = NULL;
	GObject* _tmp14_;
	GtkWidget* _tmp15_;
	gint _tmp16_;
	GObject* _tmp17_ = NULL;
	GObject* _tmp18_;
	GtkWidget* _tmp19_;
	gint _tmp20_;
	GObject* _tmp21_ = NULL;
	GObject* _tmp22_;
	GtkWidget* _tmp23_;
	gint _tmp24_;
	GObject* _tmp25_ = NULL;
	GObject* _tmp26_;
	GtkWidget* _tmp27_;
	gint _tmp28_;
	GError * _inner_error_ = NULL;
	self = (GmpcToolsMetadataAppearance*) base;
	g_return_if_fail (container != NULL);
	_tmp0_ = gtk_builder_new ();
	builder = _tmp0_;
	_tmp1_ = gmpc_get_full_glade_path ("preferences-metadata-appearance.ui");
	preferences_ui_file = _tmp1_;
	gtk_builder_add_from_file (builder, preferences_ui_file, &_inner_error_);
	if (_inner_error_ != NULL) {
		_g_free0 (preferences_ui_file);
		_g_object_unref0 (builder);
		goto __catch15_g_error;
	}
	gtk_builder_connect_signals (builder, NULL);
	_tmp2_ = gtk_builder_get_object (builder, "frame_metadata_appearance_settings");
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 ((GtkWidget*) (GTK_IS_FRAME (_tmp3_) ? ((GtkFrame*) _tmp3_) : NULL));
	builderWidget = _tmp4_;
	gtk_container_add (container, builderWidget);
	gtk_widget_show_all (builderWidget);
	_tmp5_ = gtk_builder_get_object (builder, "checkbutton_show_lyrics");
	_tmp6_ = _tmp5_;
	_tmp7_ = _g_object_ref0 ((GtkWidget*) (GTK_IS_CHECK_BUTTON (_tmp6_) ? ((GtkCheckButton*) _tmp6_) : NULL));
	_g_object_unref0 (builderWidget);
	builderWidget = _tmp7_;
	_tmp8_ = cfg_get_single_value_as_int_with_default (config, "MetaData", "show-lyrics", 1);
	gtk_toggle_button_set_active ((GtkToggleButton*) GTK_CHECK_BUTTON (builderWidget), (gboolean) _tmp8_);
	_tmp9_ = gtk_builder_get_object (builder, "checkbutton_show_artist_information");
	_tmp10_ = _tmp9_;
	_tmp11_ = _g_object_ref0 ((GtkWidget*) (GTK_IS_CHECK_BUTTON (_tmp10_) ? ((GtkCheckButton*) _tmp10_) : NULL));
	_g_object_unref0 (builderWidget);
	builderWidget = _tmp11_;
	_tmp12_ = cfg_get_single_value_as_int_with_default (config, "MetaData", "show-artist-information", 1);
	gtk_toggle_button_set_active ((GtkToggleButton*) GTK_CHECK_BUTTON (builderWidget), (gboolean) _tmp12_);
	_tmp13_ = gtk_builder_get_object (builder, "checkbutton_show_web_links");
	_tmp14_ = _tmp13_;
	_tmp15_ = _g_object_ref0 ((GtkWidget*) (GTK_IS_CHECK_BUTTON (_tmp14_) ? ((GtkCheckButton*) _tmp14_) : NULL));
	_g_object_unref0 (builderWidget);
	builderWidget = _tmp15_;
	_tmp16_ = cfg_get_single_value_as_int_with_default (config, "MetaData", "show-web-links", 1);
	gtk_toggle_button_set_active ((GtkToggleButton*) GTK_CHECK_BUTTON (builderWidget), (gboolean) _tmp16_);
	_tmp17_ = gtk_builder_get_object (builder, "checkbutton_show_similar_artists");
	_tmp18_ = _tmp17_;
	_tmp19_ = _g_object_ref0 ((GtkWidget*) (GTK_IS_CHECK_BUTTON (_tmp18_) ? ((GtkCheckButton*) _tmp18_) : NULL));
	_g_object_unref0 (builderWidget);
	builderWidget = _tmp19_;
	_tmp20_ = cfg_get_single_value_as_int_with_default (config, "MetaData", "show-similar-artist", 1);
	gtk_toggle_button_set_active ((GtkToggleButton*) GTK_CHECK_BUTTON (builderWidget), (gboolean) _tmp20_);
	_tmp21_ = gtk_builder_get_object (builder, "checkbutton_show_similar_songs");
	_tmp22_ = _tmp21_;
	_tmp23_ = _g_object_ref0 ((GtkWidget*) (GTK_IS_CHECK_BUTTON (_tmp22_) ? ((GtkCheckButton*) _tmp22_) : NULL));
	_g_object_unref0 (builderWidget);
	builderWidget = _tmp23_;
	_tmp24_ = cfg_get_single_value_as_int_with_default (config, "MetaData", "show-similar-songs", 1);
	gtk_toggle_button_set_active ((GtkToggleButton*) GTK_CHECK_BUTTON (builderWidget), (gboolean) _tmp24_);
	_tmp25_ = gtk_builder_get_object (builder, "checkbutton_show_guitar_tabs");
	_tmp26_ = _tmp25_;
	_tmp27_ = _g_object_ref0 ((GtkWidget*) (GTK_IS_CHECK_BUTTON (_tmp26_) ? ((GtkCheckButton*) _tmp26_) : NULL));
	_g_object_unref0 (builderWidget);
	builderWidget = _tmp27_;
	_tmp28_ = cfg_get_single_value_as_int_with_default (config, "MetaData", "show-guitar-tabs", 1);
	gtk_toggle_button_set_active ((GtkToggleButton*) GTK_CHECK_BUTTON (builderWidget), (gboolean) _tmp28_);
	_g_object_unref0 (builderWidget);
	_g_free0 (preferences_ui_file);
	_g_object_unref0 (builder);
	goto __finally15;
	__catch15_g_error:
	{
		GError * e;
		e = _inner_error_;
		_inner_error_ = NULL;
		fprintf (stderr, "Could not load UI: %s\n", e->message);
		_g_error_free0 (e);
	}
	__finally15:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


static void gmpc_tools_metadata_appearance_real_preferences_pane_destroy (GmpcPluginPreferencesIface* base, GtkContainer* container) {
	GmpcToolsMetadataAppearance * self;
	GList* _tmp0_ = NULL;
	self = (GmpcToolsMetadataAppearance*) base;
	g_return_if_fail (container != NULL);
	_tmp0_ = gtk_container_get_children (container);
	{
		GList* child_collection;
		GList* child_it;
		child_collection = _tmp0_;
		for (child_it = child_collection; child_it != NULL; child_it = child_it->next) {
			GtkWidget* _tmp1_;
			GtkWidget* child;
			_tmp1_ = _g_object_ref0 ((GtkWidget*) child_it->data);
			child = _tmp1_;
			{
				gtk_container_remove (container, child);
				_g_object_unref0 (child);
			}
		}
		_g_list_free0 (child_collection);
	}
}


GmpcToolsMetadataAppearance* gmpc_tools_metadata_appearance_construct (GType object_type) {
	GmpcToolsMetadataAppearance * self = NULL;
	self = (GmpcToolsMetadataAppearance*) gmpc_plugin_base_construct (object_type);
	return self;
}


GmpcToolsMetadataAppearance* gmpc_tools_metadata_appearance_new (void) {
	return gmpc_tools_metadata_appearance_construct (GMPC_TOOLS_TYPE_METADATA_APPEARANCE);
}


static GObject * gmpc_tools_metadata_appearance_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	GmpcToolsMetadataAppearance * self;
	parent_class = G_OBJECT_CLASS (gmpc_tools_metadata_appearance_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = GMPC_TOOLS_METADATA_APPEARANCE (obj);
	((GmpcPluginBase*) self)->plugin_type = 8 + 4;
	return obj;
}


static void gmpc_tools_metadata_appearance_class_init (GmpcToolsMetadataAppearanceClass * klass) {
	gmpc_tools_metadata_appearance_parent_class = g_type_class_peek_parent (klass);
	GMPC_PLUGIN_BASE_CLASS (klass)->get_version = gmpc_tools_metadata_appearance_real_get_version;
	GMPC_PLUGIN_BASE_CLASS (klass)->get_name = gmpc_tools_metadata_appearance_real_get_name;
	G_OBJECT_CLASS (klass)->constructor = gmpc_tools_metadata_appearance_constructor;
}


static void gmpc_tools_metadata_appearance_gmpc_plugin_preferences_iface_interface_init (GmpcPluginPreferencesIfaceIface * iface) {
	gmpc_tools_metadata_appearance_gmpc_plugin_preferences_iface_parent_iface = g_type_interface_peek_parent (iface);
	iface->preferences_pane_construct = (void (*)(GmpcPluginPreferencesIface* ,GtkContainer*)) gmpc_tools_metadata_appearance_real_preferences_pane_construct;
	iface->preferences_pane_destroy = (void (*)(GmpcPluginPreferencesIface* ,GtkContainer*)) gmpc_tools_metadata_appearance_real_preferences_pane_destroy;
}


static void gmpc_tools_metadata_appearance_instance_init (GmpcToolsMetadataAppearance * self) {
}


GType gmpc_tools_metadata_appearance_get_type (void) {
	static volatile gsize gmpc_tools_metadata_appearance_type_id__volatile = 0;
	if (g_once_init_enter (&gmpc_tools_metadata_appearance_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GmpcToolsMetadataAppearanceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gmpc_tools_metadata_appearance_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GmpcToolsMetadataAppearance), 0, (GInstanceInitFunc) gmpc_tools_metadata_appearance_instance_init, NULL };
		static const GInterfaceInfo gmpc_plugin_preferences_iface_info = { (GInterfaceInitFunc) gmpc_tools_metadata_appearance_gmpc_plugin_preferences_iface_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType gmpc_tools_metadata_appearance_type_id;
		gmpc_tools_metadata_appearance_type_id = g_type_register_static (GMPC_PLUGIN_TYPE_BASE, "GmpcToolsMetadataAppearance", &g_define_type_info, 0);
		g_type_add_interface_static (gmpc_tools_metadata_appearance_type_id, GMPC_PLUGIN_TYPE_PREFERENCES_IFACE, &gmpc_plugin_preferences_iface_info);
		g_once_init_leave (&gmpc_tools_metadata_appearance_type_id__volatile, gmpc_tools_metadata_appearance_type_id);
	}
	return gmpc_tools_metadata_appearance_type_id__volatile;
}



