/* parameters.c generated by valac 0.16.1, 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 <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <fm-file-info.h>
#include <fm-path.h>
#include <fm-mime-type.h>

#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))



gchar* fm_file_action_parameters_expand (const gchar* templ, GList* files, gboolean for_display, FmFileInfo* first_file);
gboolean fm_file_action_parameters_is_plural (const gchar* exec);


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


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


static gchar* string_slice (const gchar* self, glong start, glong end) {
	gchar* result = NULL;
	gint _tmp0_;
	gint _tmp1_;
	glong string_length;
	glong _tmp2_;
	glong _tmp5_;
	gboolean _tmp8_ = FALSE;
	glong _tmp9_;
	gboolean _tmp12_;
	gboolean _tmp13_ = FALSE;
	glong _tmp14_;
	gboolean _tmp17_;
	glong _tmp18_;
	glong _tmp19_;
	glong _tmp20_;
	glong _tmp21_;
	glong _tmp22_;
	gchar* _tmp23_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	_tmp2_ = start;
	if (_tmp2_ < ((glong) 0)) {
		glong _tmp3_;
		glong _tmp4_;
		_tmp3_ = string_length;
		_tmp4_ = start;
		start = _tmp3_ + _tmp4_;
	}
	_tmp5_ = end;
	if (_tmp5_ < ((glong) 0)) {
		glong _tmp6_;
		glong _tmp7_;
		_tmp6_ = string_length;
		_tmp7_ = end;
		end = _tmp6_ + _tmp7_;
	}
	_tmp9_ = start;
	if (_tmp9_ >= ((glong) 0)) {
		glong _tmp10_;
		glong _tmp11_;
		_tmp10_ = start;
		_tmp11_ = string_length;
		_tmp8_ = _tmp10_ <= _tmp11_;
	} else {
		_tmp8_ = FALSE;
	}
	_tmp12_ = _tmp8_;
	g_return_val_if_fail (_tmp12_, NULL);
	_tmp14_ = end;
	if (_tmp14_ >= ((glong) 0)) {
		glong _tmp15_;
		glong _tmp16_;
		_tmp15_ = end;
		_tmp16_ = string_length;
		_tmp13_ = _tmp15_ <= _tmp16_;
	} else {
		_tmp13_ = FALSE;
	}
	_tmp17_ = _tmp13_;
	g_return_val_if_fail (_tmp17_, NULL);
	_tmp18_ = start;
	_tmp19_ = end;
	g_return_val_if_fail (_tmp18_ <= _tmp19_, NULL);
	_tmp20_ = start;
	_tmp21_ = end;
	_tmp22_ = start;
	_tmp23_ = g_strndup (((gchar*) self) + _tmp20_, (gsize) (_tmp21_ - _tmp22_));
	result = _tmp23_;
	return result;
}


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


gboolean fm_file_action_parameters_is_plural (const gchar* exec) {
	gboolean result = FALSE;
	const gchar* _tmp0_;
	GString* _tmp1_;
	GString* _result_;
	const gchar* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gint len;
	_tmp0_ = exec;
	if (_tmp0_ == NULL) {
		result = FALSE;
		return result;
	}
	_tmp1_ = g_string_new ("");
	_result_ = _tmp1_;
	_tmp2_ = exec;
	_tmp3_ = strlen (_tmp2_);
	_tmp4_ = _tmp3_;
	len = _tmp4_;
	{
		gint i;
		i = 0;
		{
			gboolean _tmp5_;
			_tmp5_ = TRUE;
			while (TRUE) {
				gboolean _tmp6_;
				gint _tmp8_;
				gint _tmp9_;
				const gchar* _tmp10_;
				gint _tmp11_;
				gchar _tmp12_ = '\0';
				gchar ch;
				gchar _tmp13_;
				_tmp6_ = _tmp5_;
				if (!_tmp6_) {
					gint _tmp7_;
					_tmp7_ = i;
					i = _tmp7_ + 1;
				}
				_tmp5_ = FALSE;
				_tmp8_ = i;
				_tmp9_ = len;
				if (!(_tmp8_ < _tmp9_)) {
					break;
				}
				_tmp10_ = exec;
				_tmp11_ = i;
				_tmp12_ = string_get (_tmp10_, (glong) _tmp11_);
				ch = _tmp12_;
				_tmp13_ = ch;
				if (_tmp13_ == '%') {
					gint _tmp14_;
					const gchar* _tmp15_;
					gint _tmp16_;
					gchar _tmp17_ = '\0';
					gchar _tmp18_;
					_tmp14_ = i;
					i = _tmp14_ + 1;
					_tmp15_ = exec;
					_tmp16_ = i;
					_tmp17_ = string_get (_tmp15_, (glong) _tmp16_);
					ch = _tmp17_;
					_tmp18_ = ch;
					switch (_tmp18_) {
						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;
}



