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

/*
 *  Copyright (c) 2009-2010 Mike Massonnet <mmassonnet@xfce.org>
 *  Copyright (c) 2009-2010 Vincent Legout <vincent@xfce.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-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include "xfmpc.h"
#include <libxfce4util/libxfce4util.h>
#include <xfce-revision.h>
#include <gtk/gtk.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 _g_free0(var) (var = (g_free (var), NULL))
#define _g_type_class_unref0(var) ((var == NULL) ? NULL : (var = (g_type_class_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

VALA_EXTERN void xfmpc_transform_string_to_int (GValue* src,
                                    GValue* dst);
VALA_EXTERN void xfmpc_transform_string_to_boolean (GValue* src,
                                        GValue* dst);
VALA_EXTERN void xfmpc_transform_string_to_enum (GValue* src,
                                     GValue* dst);

void
xfmpc_transform_string_to_int (GValue* src,
                               GValue* dst)
{
	const gchar* _tmp0_;
	g_return_if_fail (src != NULL);
	g_return_if_fail (dst != NULL);
	_tmp0_ = g_value_get_string (src);
	g_value_set_int (dst, atoi (_tmp0_));
}

void
xfmpc_transform_string_to_boolean (GValue* src,
                                   GValue* dst)
{
	const gchar* _tmp0_;
	g_return_if_fail (src != NULL);
	g_return_if_fail (dst != NULL);
	_tmp0_ = g_value_get_string (src);
	g_value_set_boolean (dst, g_utf8_collate (_tmp0_, "FALSE") != 0);
}

void
xfmpc_transform_string_to_enum (GValue* src,
                                GValue* dst)
{
	GEnumClass* klass = NULL;
	GTypeClass* _tmp0_;
	gint i = 0;
	GEnumValue enum_value = {0};
	g_return_if_fail (src != NULL);
	g_return_if_fail (dst != NULL);
	_tmp0_ = g_type_class_ref (G_VALUE_TYPE (dst));
	klass = (GEnumClass*) _tmp0_;
	i = 0;
	while (TRUE) {
		GEnumClass* _tmp1_;
		GEnumClass* _tmp2_;
		GCompareFunc _tmp3_;
		GEnumValue _tmp4_;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		gboolean _tmp11_;
		gint _tmp13_;
		_tmp1_ = klass;
		if (!(g_enum_get_value (_tmp1_, i) != NULL)) {
			break;
		}
		_tmp2_ = klass;
		enum_value = *g_enum_get_value (_tmp2_, i);
		_tmp3_ = ((GCompareFunc) g_strcmp0);
		_tmp4_ = enum_value;
		_tmp5_ = _tmp4_.value_name;
		_tmp6_ = g_utf8_casefold (_tmp5_, (gssize) -1);
		_tmp7_ = _tmp6_;
		_tmp8_ = g_value_get_string (src);
		_tmp9_ = g_utf8_casefold (_tmp8_, (gssize) -1);
		_tmp10_ = _tmp9_;
		_tmp11_ = _tmp3_ (_tmp7_, _tmp10_) == 0;
		_g_free0 (_tmp10_);
		_g_free0 (_tmp7_);
		if (_tmp11_) {
			GEnumValue _tmp12_;
			_tmp12_ = enum_value;
			g_value_set_enum (dst, _tmp12_.value);
			break;
		}
		_tmp13_ = i;
		i = _tmp13_ + 1;
	}
	_g_type_class_unref0 (klass);
}

static gint
xfmpc_main (gchar** args,
            gint args_length1)
{
	XfmpcMainWindow* window = NULL;
	XfmpcMainWindow* _tmp0_;
	gint result;
	xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
	gtk_init ((gint*) (&args_length1), &args);
	g_value_register_transform_func (G_TYPE_STRING, G_TYPE_INT, (GValueTransform) xfmpc_transform_string_to_int);
	g_value_register_transform_func (G_TYPE_STRING, G_TYPE_BOOLEAN, (GValueTransform) xfmpc_transform_string_to_boolean);
	g_value_register_transform_func (G_TYPE_STRING, XFMPC_PREFERENCES_TYPE_SONG_FORMAT, (GValueTransform) xfmpc_transform_string_to_enum);
	_tmp0_ = xfmpc_main_window_new ();
	g_object_ref_sink (_tmp0_);
	window = _tmp0_;
	gtk_widget_show_all ((GtkWidget*) window);
	gtk_main ();
	result = 0;
	_g_object_unref0 (window);
	return result;
}

int
main (int argc,
      char ** argv)
{
	return xfmpc_main (argv, argc);
}

