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

/*      parameters.vala*/
/*      */
/*      Copyright 2011 Hong Jen Yee (PCMan) <pcman.tw@pcman.tw@gmail.com>*/
/*      */
/*      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 "fm-actions.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <fm-file-info.h>
#include <fm-path.h>
#include <fm-mime-type.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_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))

static gchar
string_get (const gchar* self,
            glong index)
{
	gchar _tmp0_;
	gchar result;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = ((gchar*) self)[index];
	result = _tmp0_;
	return result;
}

static gint
string_last_index_of_char (const gchar* self,
                           gunichar c,
                           gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = g_utf8_strrchr (((gchar*) self) + start_index, (gssize) -1, c);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

gchar*
fm_file_action_parameters_expand (const gchar* templ,
                                  GList* files,
                                  gboolean for_display,
                                  FmFileInfo* first_file)
{
	GString* _result_ = NULL;
	GString* _tmp0_;
	gint len = 0;
	gint _tmp1_;
	gint _tmp2_;
	GString* _tmp175_;
	gchar* _tmp176_;
	gchar* result;
	if (templ == NULL) {
		result = NULL;
		return result;
	}
	_tmp0_ = g_string_new ("");
	_result_ = _tmp0_;
	_tmp1_ = strlen (templ);
	_tmp2_ = _tmp1_;
	len = _tmp2_;
	if (first_file == NULL) {
		GList* _tmp3_;
		gconstpointer _tmp4_;
		_tmp3_ = g_list_first (files);
		_tmp4_ = _tmp3_->data;
		first_file = (FmFileInfo*) _tmp4_;
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				gchar ch = '\0';
				if (!_tmp5_) {
					gint _tmp6_;
					i = i + 1;
					_tmp6_ = i;
				}
				_tmp5_ = FALSE;
				if (!(i < len)) {
					break;
				}
				ch = string_get (templ, (glong) i);
				if (ch == '%') {
					gint _tmp7_;
					i = i + 1;
					_tmp7_ = i;
					ch = string_get (templ, (glong) i);
					switch (ch) {
						case 'b':
						{
							if (for_display) {
								GString* _tmp8_;
								const gchar* _tmp9_;
								gchar* _tmp10_;
								gchar* _tmp11_;
								_tmp8_ = _result_;
								_tmp9_ = fm_file_info_get_name (first_file);
								_tmp10_ = g_filename_display_name (_tmp9_);
								_tmp11_ = _tmp10_;
								g_string_append (_tmp8_, _tmp11_);
								_g_free0 (_tmp11_);
							} else {
								GString* _tmp12_;
								const gchar* _tmp13_;
								gchar* _tmp14_;
								gchar* _tmp15_;
								_tmp12_ = _result_;
								_tmp13_ = fm_file_info_get_name (first_file);
								_tmp14_ = g_shell_quote (_tmp13_);
								_tmp15_ = _tmp14_;
								g_string_append (_tmp12_, _tmp15_);
								_g_free0 (_tmp15_);
							}
							break;
						}
						case 'B':
						{
							GString* _tmp29_;
							const gchar* _tmp30_;
							GString* _tmp31_;
							{
								GList* fi_collection = NULL;
								GList* fi_it = NULL;
								fi_collection = files;
								for (fi_it = fi_collection; fi_it != NULL; fi_it = fi_it->next) {
									FmFileInfo* fi = NULL;
									fi = (FmFileInfo*) fi_it->data;
									{
										GString* _tmp28_;
										if (for_display) {
											GString* _tmp16_;
											FmFileInfo* _tmp17_;
											const gchar* _tmp18_;
											gchar* _tmp19_;
											gchar* _tmp20_;
											gchar* _tmp21_;
											gchar* _tmp22_;
											_tmp16_ = _result_;
											_tmp17_ = fi;
											_tmp18_ = fm_file_info_get_name (_tmp17_);
											_tmp19_ = g_filename_display_name (_tmp18_);
											_tmp20_ = _tmp19_;
											_tmp21_ = g_shell_quote (_tmp20_);
											_tmp22_ = _tmp21_;
											g_string_append (_tmp16_, _tmp22_);
											_g_free0 (_tmp22_);
											_g_free0 (_tmp20_);
										} else {
											GString* _tmp23_;
											FmFileInfo* _tmp24_;
											const gchar* _tmp25_;
											gchar* _tmp26_;
											gchar* _tmp27_;
											_tmp23_ = _result_;
											_tmp24_ = fi;
											_tmp25_ = fm_file_info_get_name (_tmp24_);
											_tmp26_ = g_shell_quote (_tmp25_);
											_tmp27_ = _tmp26_;
											g_string_append (_tmp23_, _tmp27_);
											_g_free0 (_tmp27_);
										}
										_tmp28_ = _result_;
										g_string_append_c (_tmp28_, ' ');
									}
								}
							}
							_tmp29_ = _result_;
							_tmp30_ = _tmp29_->str;
							_tmp31_ = _result_;
							if (string_get (_tmp30_, (glong) (_tmp31_->len - 1)) == ' ') {
								GString* _tmp32_;
								GString* _tmp33_;
								_tmp32_ = _result_;
								_tmp33_ = _result_;
								g_string_truncate (_tmp32_, (gsize) (_tmp33_->len - 1));
							}
							break;
						}
						case 'c':
						{
							GString* _tmp34_;
							_tmp34_ = _result_;
							g_string_append_printf (_tmp34_, "%u", g_list_length (files));
							break;
						}
						case 'd':
						{
							FmPath* base_dir = NULL;
							FmPath* _tmp35_;
							FmPath* _tmp36_;
							gchar* str = NULL;
							FmPath* _tmp37_;
							gchar* _tmp38_;
							GString* _tmp41_;
							const gchar* _tmp42_;
							gchar* _tmp43_;
							gchar* _tmp44_;
							_tmp35_ = fm_file_info_get_path (first_file);
							_tmp36_ = fm_path_get_parent (_tmp35_);
							base_dir = _tmp36_;
							_tmp37_ = base_dir;
							_tmp38_ = fm_path_to_str (_tmp37_);
							str = _tmp38_;
							if (for_display) {
								const gchar* _tmp39_;
								gchar* _tmp40_;
								_tmp39_ = str;
								_tmp40_ = g_filename_display_name (_tmp39_);
								_g_free0 (str);
								str = _tmp40_;
							}
							_tmp41_ = _result_;
							_tmp42_ = str;
							_tmp43_ = g_shell_quote (_tmp42_);
							_tmp44_ = _tmp43_;
							g_string_append (_tmp41_, _tmp44_);
							_g_free0 (_tmp44_);
							_g_free0 (str);
							break;
						}
						case 'D':
						{
							GString* _tmp57_;
							const gchar* _tmp58_;
							GString* _tmp59_;
							{
								GList* fi_collection = NULL;
								GList* fi_it = NULL;
								fi_collection = files;
								for (fi_it = fi_collection; fi_it != NULL; fi_it = fi_it->next) {
									FmFileInfo* fi = NULL;
									fi = (FmFileInfo*) fi_it->data;
									{
										FmPath* base_dir = NULL;
										FmFileInfo* _tmp45_;
										FmPath* _tmp46_;
										FmPath* _tmp47_;
										gchar* str = NULL;
										FmPath* _tmp48_;
										gchar* _tmp49_;
										GString* _tmp52_;
										const gchar* _tmp53_;
										gchar* _tmp54_;
										gchar* _tmp55_;
										GString* _tmp56_;
										_tmp45_ = fi;
										_tmp46_ = fm_file_info_get_path (_tmp45_);
										_tmp47_ = fm_path_get_parent (_tmp46_);
										base_dir = _tmp47_;
										_tmp48_ = base_dir;
										_tmp49_ = fm_path_to_str (_tmp48_);
										str = _tmp49_;
										if (for_display) {
											const gchar* _tmp50_;
											gchar* _tmp51_;
											_tmp50_ = str;
											_tmp51_ = g_filename_display_name (_tmp50_);
											_g_free0 (str);
											str = _tmp51_;
										}
										_tmp52_ = _result_;
										_tmp53_ = str;
										_tmp54_ = g_shell_quote (_tmp53_);
										_tmp55_ = _tmp54_;
										g_string_append (_tmp52_, _tmp55_);
										_g_free0 (_tmp55_);
										_tmp56_ = _result_;
										g_string_append_c (_tmp56_, ' ');
										_g_free0 (str);
									}
								}
							}
							_tmp57_ = _result_;
							_tmp58_ = _tmp57_->str;
							_tmp59_ = _result_;
							if (string_get (_tmp58_, (glong) (_tmp59_->len - 1)) == ' ') {
								GString* _tmp60_;
								GString* _tmp61_;
								_tmp60_ = _result_;
								_tmp61_ = _result_;
								g_string_truncate (_tmp60_, (gsize) (_tmp61_->len - 1));
							}
							break;
						}
						case 'f':
						{
							gchar* filename = NULL;
							FmPath* _tmp62_;
							gchar* _tmp63_;
							GString* _tmp66_;
							const gchar* _tmp67_;
							gchar* _tmp68_;
							gchar* _tmp69_;
							_tmp62_ = fm_file_info_get_path (first_file);
							_tmp63_ = fm_path_to_str (_tmp62_);
							filename = _tmp63_;
							if (for_display) {
								const gchar* _tmp64_;
								gchar* _tmp65_;
								_tmp64_ = filename;
								_tmp65_ = g_filename_display_name (_tmp64_);
								_g_free0 (filename);
								filename = _tmp65_;
							}
							_tmp66_ = _result_;
							_tmp67_ = filename;
							_tmp68_ = g_shell_quote (_tmp67_);
							_tmp69_ = _tmp68_;
							g_string_append (_tmp66_, _tmp69_);
							_g_free0 (_tmp69_);
							_g_free0 (filename);
							break;
						}
						case 'F':
						{
							GString* _tmp80_;
							const gchar* _tmp81_;
							GString* _tmp82_;
							{
								GList* fi_collection = NULL;
								GList* fi_it = NULL;
								fi_collection = files;
								for (fi_it = fi_collection; fi_it != NULL; fi_it = fi_it->next) {
									FmFileInfo* fi = NULL;
									fi = (FmFileInfo*) fi_it->data;
									{
										gchar* filename = NULL;
										FmFileInfo* _tmp70_;
										FmPath* _tmp71_;
										gchar* _tmp72_;
										GString* _tmp75_;
										const gchar* _tmp76_;
										gchar* _tmp77_;
										gchar* _tmp78_;
										GString* _tmp79_;
										_tmp70_ = fi;
										_tmp71_ = fm_file_info_get_path (_tmp70_);
										_tmp72_ = fm_path_to_str (_tmp71_);
										filename = _tmp72_;
										if (for_display) {
											const gchar* _tmp73_;
											gchar* _tmp74_;
											_tmp73_ = filename;
											_tmp74_ = g_filename_display_name (_tmp73_);
											_g_free0 (filename);
											filename = _tmp74_;
										}
										_tmp75_ = _result_;
										_tmp76_ = filename;
										_tmp77_ = g_shell_quote (_tmp76_);
										_tmp78_ = _tmp77_;
										g_string_append (_tmp75_, _tmp78_);
										_g_free0 (_tmp78_);
										_tmp79_ = _result_;
										g_string_append_c (_tmp79_, ' ');
										_g_free0 (filename);
									}
								}
							}
							_tmp80_ = _result_;
							_tmp81_ = _tmp80_->str;
							_tmp82_ = _result_;
							if (string_get (_tmp81_, (glong) (_tmp82_->len - 1)) == ' ') {
								GString* _tmp83_;
								GString* _tmp84_;
								_tmp83_ = _result_;
								_tmp84_ = _result_;
								g_string_truncate (_tmp83_, (gsize) (_tmp84_->len - 1));
							}
							break;
						}
						case 'h':
						{
							GString* _tmp85_;
							const gchar* _tmp86_;
							_tmp85_ = _result_;
							_tmp86_ = g_get_host_name ();
							g_string_append (_tmp85_, _tmp86_);
							break;
						}
						case 'm':
						{
							FmFileInfo* fi = NULL;
							GList* _tmp87_;
							gconstpointer _tmp88_;
							GString* _tmp89_;
							FmFileInfo* _tmp90_;
							FmMimeType* _tmp91_;
							const gchar* _tmp92_;
							_tmp87_ = g_list_first (files);
							_tmp88_ = _tmp87_->data;
							fi = (FmFileInfo*) _tmp88_;
							_tmp89_ = _result_;
							_tmp90_ = fi;
							_tmp91_ = fm_file_info_get_mime_type (_tmp90_);
							_tmp92_ = fm_mime_type_get_type (_tmp91_);
							g_string_append (_tmp89_, _tmp92_);
							break;
						}
						case 'M':
						{
							{
								GList* fi_collection = NULL;
								GList* fi_it = NULL;
								fi_collection = files;
								for (fi_it = fi_collection; fi_it != NULL; fi_it = fi_it->next) {
									FmFileInfo* fi = NULL;
									fi = (FmFileInfo*) fi_it->data;
									{
										GString* _tmp93_;
										FmFileInfo* _tmp94_;
										FmMimeType* _tmp95_;
										const gchar* _tmp96_;
										GString* _tmp97_;
										_tmp93_ = _result_;
										_tmp94_ = fi;
										_tmp95_ = fm_file_info_get_mime_type (_tmp94_);
										_tmp96_ = fm_mime_type_get_type (_tmp95_);
										g_string_append (_tmp93_, _tmp96_);
										_tmp97_ = _result_;
										g_string_append_c (_tmp97_, ' ');
									}
								}
							}
							break;
						}
						case 'n':
						{
							GString* _tmp98_;
							const gchar* _tmp99_;
							_tmp98_ = _result_;
							_tmp99_ = g_get_user_name ();
							g_string_append (_tmp98_, _tmp99_);
							break;
						}
						case 'o':
						case 'O':
						{
							break;
						}
						case 'p':
						{
							break;
						}
						case 's':
						{
							gchar* uri = NULL;
							FmPath* _tmp100_;
							gchar* _tmp101_;
							GString* _tmp102_;
							const gchar* _tmp103_;
							gchar* _tmp104_;
							gchar* _tmp105_;
							_tmp100_ = fm_file_info_get_path (first_file);
							_tmp101_ = fm_path_to_uri (_tmp100_);
							uri = _tmp101_;
							_tmp102_ = _result_;
							_tmp103_ = uri;
							_tmp104_ = g_uri_parse_scheme (_tmp103_);
							_tmp105_ = _tmp104_;
							g_string_append (_tmp102_, _tmp105_);
							_g_free0 (_tmp105_);
							_g_free0 (uri);
							break;
						}
						case 'u':
						{
							GString* _tmp106_;
							FmPath* _tmp107_;
							gchar* _tmp108_;
							gchar* _tmp109_;
							_tmp106_ = _result_;
							_tmp107_ = fm_file_info_get_path (first_file);
							_tmp108_ = fm_path_to_uri (_tmp107_);
							_tmp109_ = _tmp108_;
							g_string_append (_tmp106_, _tmp109_);
							_g_free0 (_tmp109_);
							break;
						}
						case 'U':
						{
							GString* _tmp116_;
							const gchar* _tmp117_;
							GString* _tmp118_;
							{
								GList* fi_collection = NULL;
								GList* fi_it = NULL;
								fi_collection = files;
								for (fi_it = fi_collection; fi_it != NULL; fi_it = fi_it->next) {
									FmFileInfo* fi = NULL;
									fi = (FmFileInfo*) fi_it->data;
									{
										GString* _tmp110_;
										FmFileInfo* _tmp111_;
										FmPath* _tmp112_;
										gchar* _tmp113_;
										gchar* _tmp114_;
										GString* _tmp115_;
										_tmp110_ = _result_;
										_tmp111_ = fi;
										_tmp112_ = fm_file_info_get_path (_tmp111_);
										_tmp113_ = fm_path_to_uri (_tmp112_);
										_tmp114_ = _tmp113_;
										g_string_append (_tmp110_, _tmp114_);
										_g_free0 (_tmp114_);
										_tmp115_ = _result_;
										g_string_append_c (_tmp115_, ' ');
									}
								}
							}
							_tmp116_ = _result_;
							_tmp117_ = _tmp116_->str;
							_tmp118_ = _result_;
							if (string_get (_tmp117_, (glong) (_tmp118_->len - 1)) == ' ') {
								GString* _tmp119_;
								GString* _tmp120_;
								_tmp119_ = _result_;
								_tmp120_ = _result_;
								g_string_truncate (_tmp119_, (gsize) (_tmp120_->len - 1));
							}
							break;
						}
						case 'w':
						{
							const gchar* basename = NULL;
							const gchar* _tmp121_;
							gint pos = 0;
							const gchar* _tmp122_;
							_tmp121_ = fm_file_info_get_name (first_file);
							basename = _tmp121_;
							_tmp122_ = basename;
							pos = string_last_index_of_char (_tmp122_, (gunichar) '.', 0);
							if (pos == -1) {
								GString* _tmp123_;
								const gchar* _tmp124_;
								gchar* _tmp125_;
								gchar* _tmp126_;
								_tmp123_ = _result_;
								_tmp124_ = basename;
								_tmp125_ = g_shell_quote (_tmp124_);
								_tmp126_ = _tmp125_;
								g_string_append (_tmp123_, _tmp126_);
								_g_free0 (_tmp126_);
							} else {
								GString* _tmp127_;
								const gchar* _tmp128_;
								gchar* _tmp129_;
								gchar* _tmp130_;
								gchar* _tmp131_;
								gchar* _tmp132_;
								_tmp127_ = _result_;
								_tmp128_ = basename;
								_tmp129_ = string_slice (_tmp128_, (glong) 0, (glong) pos);
								_tmp130_ = _tmp129_;
								_tmp131_ = g_shell_quote (_tmp130_);
								_tmp132_ = _tmp131_;
								g_string_append (_tmp127_, _tmp132_);
								_g_free0 (_tmp132_);
								_g_free0 (_tmp130_);
							}
							break;
						}
						case 'W':
						{
							GString* _tmp147_;
							const gchar* _tmp148_;
							GString* _tmp149_;
							{
								GList* fi_collection = NULL;
								GList* fi_it = NULL;
								fi_collection = files;
								for (fi_it = fi_collection; fi_it != NULL; fi_it = fi_it->next) {
									FmFileInfo* fi = NULL;
									fi = (FmFileInfo*) fi_it->data;
									{
										const gchar* basename = NULL;
										FmFileInfo* _tmp133_;
										const gchar* _tmp134_;
										gint pos = 0;
										const gchar* _tmp135_;
										GString* _tmp146_;
										_tmp133_ = fi;
										_tmp134_ = fm_file_info_get_name (_tmp133_);
										basename = _tmp134_;
										_tmp135_ = basename;
										pos = string_last_index_of_char (_tmp135_, (gunichar) '.', 0);
										if (pos == -1) {
											GString* _tmp136_;
											const gchar* _tmp137_;
											gchar* _tmp138_;
											gchar* _tmp139_;
											_tmp136_ = _result_;
											_tmp137_ = basename;
											_tmp138_ = g_shell_quote (_tmp137_);
											_tmp139_ = _tmp138_;
											g_string_append (_tmp136_, _tmp139_);
											_g_free0 (_tmp139_);
										} else {
											GString* _tmp140_;
											const gchar* _tmp141_;
											gchar* _tmp142_;
											gchar* _tmp143_;
											gchar* _tmp144_;
											gchar* _tmp145_;
											_tmp140_ = _result_;
											_tmp141_ = basename;
											_tmp142_ = string_slice (_tmp141_, (glong) 0, (glong) pos);
											_tmp143_ = _tmp142_;
											_tmp144_ = g_shell_quote (_tmp143_);
											_tmp145_ = _tmp144_;
											g_string_append (_tmp140_, _tmp145_);
											_g_free0 (_tmp145_);
											_g_free0 (_tmp143_);
										}
										_tmp146_ = _result_;
										g_string_append_c (_tmp146_, ' ');
									}
								}
							}
							_tmp147_ = _result_;
							_tmp148_ = _tmp147_->str;
							_tmp149_ = _result_;
							if (string_get (_tmp148_, (glong) (_tmp149_->len - 1)) == ' ') {
								GString* _tmp150_;
								GString* _tmp151_;
								_tmp150_ = _result_;
								_tmp151_ = _result_;
								g_string_truncate (_tmp150_, (gsize) (_tmp151_->len - 1));
							}
							break;
						}
						case 'x':
						{
							const gchar* basename = NULL;
							const gchar* _tmp152_;
							gint pos = 0;
							const gchar* _tmp153_;
							const gchar* ext = NULL;
							GString* _tmp155_;
							const gchar* _tmp156_;
							gchar* _tmp157_;
							gchar* _tmp158_;
							_tmp152_ = fm_file_info_get_name (first_file);
							basename = _tmp152_;
							_tmp153_ = basename;
							pos = string_last_index_of_char (_tmp153_, (gunichar) '.', 0);
							if (pos >= 0) {
								const gchar* _tmp154_;
								_tmp154_ = basename;
								ext = (const gchar*) ((((guint8*) _tmp154_) + pos) + 1);
							} else {
								ext = "";
							}
							_tmp155_ = _result_;
							_tmp156_ = ext;
							_tmp157_ = g_shell_quote (_tmp156_);
							_tmp158_ = _tmp157_;
							g_string_append (_tmp155_, _tmp158_);
							_g_free0 (_tmp158_);
							break;
						}
						case 'X':
						{
							GString* _tmp168_;
							const gchar* _tmp169_;
							GString* _tmp170_;
							{
								GList* fi_collection = NULL;
								GList* fi_it = NULL;
								fi_collection = files;
								for (fi_it = fi_collection; fi_it != NULL; fi_it = fi_it->next) {
									FmFileInfo* fi = NULL;
									fi = (FmFileInfo*) fi_it->data;
									{
										const gchar* basename = NULL;
										FmFileInfo* _tmp159_;
										const gchar* _tmp160_;
										gint pos = 0;
										const gchar* _tmp161_;
										const gchar* ext = NULL;
										GString* _tmp163_;
										const gchar* _tmp164_;
										gchar* _tmp165_;
										gchar* _tmp166_;
										GString* _tmp167_;
										_tmp159_ = fi;
										_tmp160_ = fm_file_info_get_name (_tmp159_);
										basename = _tmp160_;
										_tmp161_ = basename;
										pos = string_last_index_of_char (_tmp161_, (gunichar) '.', 0);
										if (pos >= 0) {
											const gchar* _tmp162_;
											_tmp162_ = basename;
											ext = (const gchar*) ((((guint8*) _tmp162_) + pos) + 1);
										} else {
											ext = "";
										}
										_tmp163_ = _result_;
										_tmp164_ = ext;
										_tmp165_ = g_shell_quote (_tmp164_);
										_tmp166_ = _tmp165_;
										g_string_append (_tmp163_, _tmp166_);
										_g_free0 (_tmp166_);
										_tmp167_ = _result_;
										g_string_append_c (_tmp167_, ' ');
									}
								}
							}
							_tmp168_ = _result_;
							_tmp169_ = _tmp168_->str;
							_tmp170_ = _result_;
							if (string_get (_tmp169_, (glong) (_tmp170_->len - 1)) == ' ') {
								GString* _tmp171_;
								GString* _tmp172_;
								_tmp171_ = _result_;
								_tmp172_ = _result_;
								g_string_truncate (_tmp171_, (gsize) (_tmp172_->len - 1));
							}
							break;
						}
						case '%':
						{
							GString* _tmp173_;
							_tmp173_ = _result_;
							g_string_append_c (_tmp173_, '%');
							break;
						}
						case '\0':
						{
							break;
						}
						default:
						break;
					}
				} else {
					GString* _tmp174_;
					_tmp174_ = _result_;
					g_string_append_c (_tmp174_, ch);
				}
			}
		}
	}
	_tmp175_ = _result_;
	_tmp176_ = _tmp175_->str;
	_tmp175_->str = NULL;
	result = _tmp176_;
	_g_string_free0 (_result_);
	return result;
}

gboolean
fm_file_action_parameters_is_plural (const gchar* exec)
{
	GString* _result_ = NULL;
	GString* _tmp0_;
	gint len = 0;
	gint _tmp1_;
	gint _tmp2_;
	gboolean result;
	if (exec == NULL) {
		result = FALSE;
		return result;
	}
	_tmp0_ = g_string_new ("");
	_result_ = _tmp0_;
	_tmp1_ = strlen (exec);
	_tmp2_ = _tmp1_;
	len = _tmp2_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp3_ = FALSE;
			_tmp3_ = TRUE;
			while (TRUE) {
				gchar ch = '\0';
				if (!_tmp3_) {
					gint _tmp4_;
					i = i + 1;
					_tmp4_ = i;
				}
				_tmp3_ = FALSE;
				if (!(i < len)) {
					break;
				}
				ch = string_get (exec, (glong) i);
				if (ch == '%') {
					gint _tmp5_;
					i = i + 1;
					_tmp5_ = i;
					ch = string_get (exec, (glong) i);
					switch (ch) {
						case 'B':
						case 'D':
						case 'F':
						case 'M':
						case 'O':
						case 'U':
						case 'W':
						case 'X':
						{
							result = TRUE;
							_g_string_free0 (_result_);
							return result;
						}
						case 'b':
						case 'd':
						case 'f':
						case 'm':
						case 'o':
						case 'u':
						case 'w':
						case 'x':
						{
							result = FALSE;
							_g_string_free0 (_result_);
							return result;
						}
						default:
						{
							break;
						}
					}
				}
			}
		}
	}
	result = FALSE;
	_g_string_free0 (_result_);
	return result;
}

