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

/**/
/*  Copyright (C) 2011-2012 Maxwell Barvian*/
/**/
/*  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, see <http://www.gnu.org/licenses/>.*/
/**/

#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <langinfo.h>
#include <granite.h>
#include <gio/gio.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 _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

VALA_EXTERN gchar* maya_settings_time_format (void);

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

gchar*
maya_settings_time_format (void)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	GSettings* setting = NULL;
	GSettings* _tmp4_;
	GVariant* clockformat = NULL;
	GSettings* _tmp5_;
	GVariant* _tmp6_;
	GVariant* _tmp7_;
	GVariant* _tmp9_;
	const gchar* _tmp10_;
	gchar* result;
	_tmp1_ = nl_langinfo (AM_STR);
	if (_tmp1_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp2_;
		_tmp2_ = nl_langinfo (AM_STR);
		_tmp0_ = g_strcmp0 (_tmp2_, "") == 0;
	}
	if (_tmp0_) {
		gchar* _tmp3_;
		_tmp3_ = granite_date_time_get_default_time_format (FALSE, FALSE);
		result = _tmp3_;
		return result;
	}
	_tmp4_ = g_settings_new ("org.gnome.desktop.interface");
	setting = _tmp4_;
	_tmp5_ = setting;
	_tmp6_ = g_settings_get_user_value (_tmp5_, "clock-format");
	clockformat = _tmp6_;
	_tmp7_ = clockformat;
	if (_tmp7_ == NULL) {
		gchar* _tmp8_;
		_tmp8_ = granite_date_time_get_default_time_format (TRUE, FALSE);
		result = _tmp8_;
		_g_variant_unref0 (clockformat);
		_g_object_unref0 (setting);
		return result;
	}
	_tmp9_ = clockformat;
	_tmp10_ = g_variant_get_string (_tmp9_, NULL);
	if (string_contains (_tmp10_, "12h")) {
		gchar* _tmp11_;
		_tmp11_ = granite_date_time_get_default_time_format (TRUE, FALSE);
		result = _tmp11_;
		_g_variant_unref0 (clockformat);
		_g_object_unref0 (setting);
		return result;
	} else {
		gchar* _tmp12_;
		_tmp12_ = granite_date_time_get_default_time_format (FALSE, FALSE);
		result = _tmp12_;
		_g_variant_unref0 (clockformat);
		_g_object_unref0 (setting);
		return result;
	}
}

