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

/*
* 2019-2020 elementary, Inc. (https://elementary.io)
*
* 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 <https://www.gnu.org/licenses/>.
*/

#include <ibus.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include "keyboard.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))

VALA_EXTERN gchar* keyboard_input_method_page_utils_gettext_engine_longname (IBusEngineDesc* engine);

gchar*
keyboard_input_method_page_utils_gettext_engine_longname (IBusEngineDesc* engine)
{
	gchar* name = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* textdomain = NULL;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* result;
	g_return_val_if_fail (engine != NULL, NULL);
	_tmp0_ = ibus_engine_desc_get_name (engine);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup (_tmp1_);
	name = _tmp2_;
	_tmp3_ = name;
	if (g_str_has_prefix (_tmp3_, "xkb:")) {
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp4_ = ibus_engine_desc_get_longname (engine);
		_tmp5_ = _tmp4_;
		_tmp6_ = g_strdup (g_dgettext ("xkeyboard-config", _tmp5_));
		result = _tmp6_;
		_g_free0 (name);
		return result;
	}
	_tmp7_ = ibus_engine_desc_get_textdomain (engine);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_strdup (_tmp8_);
	textdomain = _tmp9_;
	_tmp10_ = textdomain;
	if (g_strcmp0 (_tmp10_, "") == 0) {
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		_tmp11_ = ibus_engine_desc_get_longname (engine);
		_tmp12_ = _tmp11_;
		_tmp13_ = g_strdup (_tmp12_);
		result = _tmp13_;
		_g_free0 (textdomain);
		_g_free0 (name);
		return result;
	}
	_tmp14_ = textdomain;
	_tmp15_ = ibus_engine_desc_get_longname (engine);
	_tmp16_ = _tmp15_;
	_tmp17_ = g_strdup (g_dgettext (_tmp14_, _tmp16_));
	result = _tmp17_;
	_g_free0 (textdomain);
	_g_free0 (name);
	return result;
}

