Beispiel #1
0
gint _vala_main (gchar** args, int args_length1) {
	gint result = 0;
	gboolean _tmp12_;
	GBusType _tmp16_ = 0;
	gboolean _tmp17_;
	GBusType _tmp18_;
	GBusType bus_type;
	GBusType _tmp19_;
	FsoFrameworkDBusSubsystem* _tmp20_;
	FsoFrameworkSubsystem* _tmp21_;
	FsoFrameworkSubsystem* _tmp22_;
	guint _tmp23_ = 0U;
	guint count;
	FsoFrameworkLogger* _tmp24_;
	guint _tmp25_;
	gchar* _tmp26_ = NULL;
	gchar* _tmp27_;
	guint _tmp28_;
	FsoFrameworkLogger* _tmp33_;
	GError * _inner_error_ = NULL;
	{
		GOptionContext* _tmp0_;
		GOptionContext* opt_context;
		GOptionContext* _tmp1_;
		GOptionContext* _tmp2_;
		GOptionContext* _tmp3_;
		GOptionContext* _tmp4_;
		GOptionContext* _tmp5_;
		_tmp0_ = g_option_context_new ("");
		opt_context = _tmp0_;
		_tmp1_ = opt_context;
		g_option_context_set_summary (_tmp1_, "FreeSmartphone.org Usage daemon");
		_tmp2_ = opt_context;
		g_option_context_set_description (_tmp2_, "This daemon implements the freesmartphone.org Usage API");
		_tmp3_ = opt_context;
		g_option_context_set_help_enabled (_tmp3_, TRUE);
		_tmp4_ = opt_context;
		g_option_context_add_main_entries (_tmp4_, options, NULL);
		_tmp5_ = opt_context;
		g_option_context_parse (_tmp5_, &args_length1, &args, &_inner_error_);
		if (_inner_error_ != NULL) {
			_g_option_context_free0 (opt_context);
			if (_inner_error_->domain == G_OPTION_ERROR) {
				goto __catch0_g_option_error;
			}
			_g_option_context_free0 (opt_context);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return 0;
		}
		_g_option_context_free0 (opt_context);
	}
	goto __finally0;
	__catch0_g_option_error:
	{
		GError* e = NULL;
		FILE* _tmp6_;
		GError* _tmp7_;
		const gchar* _tmp8_;
		FILE* _tmp9_;
		gchar** _tmp10_;
		gint _tmp10__length1;
		const gchar* _tmp11_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp6_ = stdout;
		_tmp7_ = e;
		_tmp8_ = _tmp7_->message;
		fprintf (_tmp6_, "%s\n", _tmp8_);
		_tmp9_ = stdout;
		_tmp10_ = args;
		_tmp10__length1 = args_length1;
		_tmp11_ = _tmp10_[0];
		fprintf (_tmp9_, "Run '%s --help' to see a full list of available command line options.\n", _tmp11_);
		result = 1;
		_g_error_free0 (e);
		return result;
	}
	__finally0:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return 0;
	}
	_tmp12_ = show_version;
	if (_tmp12_) {
		FILE* _tmp13_;
		gchar* _tmp14_ = NULL;
		gchar* _tmp15_;
		_tmp13_ = stdout;
		_tmp14_ = g_strdup_printf ("fsousaged %s\n", PACKAGE_VERSION);
		_tmp15_ = _tmp14_;
		fprintf (_tmp13_, "%s", _tmp15_);
		_g_free0 (_tmp15_);
		result = 1;
		return result;
	}
	_tmp17_ = use_session_bus;
	if (_tmp17_) {
		_tmp16_ = G_BUS_TYPE_SESSION;
	} else {
		_tmp16_ = G_BUS_TYPE_SYSTEM;
	}
	_tmp18_ = _tmp16_;
	bus_type = _tmp18_;
	_tmp19_ = bus_type;
	_tmp20_ = fso_framework_dbus_subsystem_new ("fsousage", _tmp19_);
	_g_object_unref0 (subsystem);
	subsystem = (FsoFrameworkSubsystem*) _tmp20_;
	_tmp21_ = subsystem;
	fso_framework_subsystem_registerPlugins (_tmp21_);
	_tmp22_ = subsystem;
	_tmp23_ = fso_framework_subsystem_loadPlugins (_tmp22_);
	count = _tmp23_;
	_tmp24_ = fso_framework_theLogger;
	_tmp25_ = count;
	_tmp26_ = g_strdup_printf ("loaded %u plugins", _tmp25_);
	_tmp27_ = _tmp26_;
	fso_framework_logger_info (_tmp24_, _tmp27_);
	_g_free0 (_tmp27_);
	_tmp28_ = count;
	if (_tmp28_ > ((guint) 0)) {
		GMainLoop* _tmp29_;
		FsoFrameworkLogger* _tmp30_;
		GMainLoop* _tmp31_;
		FsoFrameworkLogger* _tmp32_;
		_tmp29_ = g_main_loop_new (NULL, FALSE);
		_g_main_loop_unref0 (mainloop);
		mainloop = _tmp29_;
		_tmp30_ = fso_framework_theLogger;
		fso_framework_logger_info (_tmp30_, "fsousaged => mainloop");
		signal (SIGINT, _sighandler_sighandler_t);
		signal (SIGTERM, _sighandler_sighandler_t);
		signal (SIGBUS, _sighandler_sighandler_t);
		signal (SIGSEGV, _sighandler_sighandler_t);
		_tmp31_ = mainloop;
		g_main_loop_run (_tmp31_);
		_tmp32_ = fso_framework_theLogger;
		fso_framework_logger_info (_tmp32_, "mainloop => fsousaged");
	}
	_tmp33_ = fso_framework_theLogger;
	fso_framework_logger_info (_tmp33_, "fsousaged exit");
	result = 0;
	return result;
}
gint _vala_main (char** args, int args_length1) {
	gint result = 0;
	GError * _inner_error_;
	GOptionContext* context;
	gint retval;
	_inner_error_ = NULL;
	g_setenv ("GLOBALMENU_MATE_ARGS", "--disable", TRUE);
	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
	context = g_option_context_new ("- GlobalMenu.MatePanelApplet");
	g_option_context_set_help_enabled (context, TRUE);
	g_option_context_add_main_entries (context, options, NULL);
	g_option_context_add_group (context, gtk_get_option_group (TRUE));
	g_option_context_add_group (context, matecomponent_activation_get_goption_group ());
	{
		g_option_context_parse (context, &args_length1, &args, &_inner_error_);
		if (_inner_error_ != NULL) {
			goto __catch20_g_error;
		}
	}
	goto __finally20;
	__catch20_g_error:
	{
		GError * e;
		e = _inner_error_;
		_inner_error_ = NULL;
		{
			g_error ("main.vala:25: parsing options failed: %s", e->message);
			_g_error_free0 (e);
		}
	}
	__finally20:
	if (_inner_error_ != NULL) {
		_g_option_context_free0 (context);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return 0;
	}
	if (!verbose) {
		GLogFunc _tmp0_;
		GDestroyNotify handler_target_destroy_notify = NULL;
		void* handler_target = NULL;
		GLogFunc handler;
		handler = (_tmp0_ = __lambda7__glog_func, handler_target = NULL, handler_target_destroy_notify = NULL, _tmp0_);
		g_log_set_handler ("libmatenu", G_LOG_LEVEL_DEBUG, handler, handler_target);
		g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, handler, handler_target);
		(handler_target_destroy_notify == NULL) ? NULL : (handler_target_destroy_notify (handler_target), NULL);
		handler = NULL;
		handler_target = NULL;
		handler_target_destroy_notify = NULL;
	}
	gtk_rc_parse_string ("\n" \
"\t\tstyle \"globalmenu_event_box_style\"\n" \
"\t\t{\n" \
"\t\t\tGtkWidget::focus-line-width=0\n" \
"\t\t\tGtkWidget::focus-padding=0\n" \
"\t\t}\n" \
"\t\tstyle \"globalmenu_menu_bar_style\"\n" \
"\t\t{\n" \
"\t\t\tythickness = 0\n" \
"\t\t\tGtkMenuBar::shadow-type = none\n" \
"\t\t\tGtkMenuBar::internal-padding = 0\n" \
"\t\t}\n" \
"\t\tclass \"GtkEventBox\" style \"globalmenu_event_box_style\"\n" \
"\t\tclass \"MatenuMenuBar\" style:highest \"globalmenu_menu_bar_style" \
"\"\n");
	gtk_init (&args_length1, &args);
	if (!matecomponent_init (&args_length1, args)) {
		g_error ("main.vala:52: Cannot initialize matecomponent.");
	}
	retval = mate_panel_applet_factory_main (FACTORY_IID, TYPE_APPLET, __lambda8__mate_panel_applet_factory_callback, NULL);
	result = retval;
	_g_option_context_free0 (context);
	return result;
}
Beispiel #3
0
void usage (gchar** args, int args_length1, FILE* output) {
	GOptionContext* o = NULL;
	const gchar* _tmp0_ = NULL;
	GOptionContext* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	gchar** _tmp3_ = NULL;
	gint _tmp3__length1 = 0;
	const gchar* _tmp4_ = NULL;
	gchar* _tmp5_ = NULL;
	gchar* _tmp6_ = NULL;
	gchar* _tmp7_ = NULL;
	gchar* _tmp8_ = NULL;
	gchar* s = NULL;
	gchar* _tmp9_ = NULL;
	FILE* _tmp10_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_if_fail (output != NULL);
	_tmp0_ = _ ("COMMAND");
	_tmp1_ = g_option_context_new (_tmp0_);
	o = _tmp1_;
	g_option_context_set_help_enabled (o, FALSE);
	{
		g_option_context_parse (o, &args_length1, &args, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_option_context_free0 (o);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp2_ = _ ("Commands:\n" \
"  help         Shows this information\n" \
"  decoder      Run decoder\n" \
"  context      Run context\n" \
"\n" \
"  Use \"%s COMMAND --help\" to get help on each command.\n");
	_tmp3_ = args;
	_tmp3__length1 = args_length1;
	_tmp4_ = _tmp3_[0];
	_tmp5_ = g_path_get_basename (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_strdup_printf (_tmp2_, _tmp6_);
	_tmp8_ = _tmp7_;
	g_option_context_set_description (o, _tmp8_);
	_g_free0 (_tmp8_);
	_g_free0 (_tmp6_);
	_tmp9_ = g_option_context_get_help (o, FALSE, NULL);
	s = _tmp9_;
	_tmp10_ = output;
	fprintf (_tmp10_, "%s", s);
	_g_free0 (s);
	_g_option_context_free0 (o);
}
Beispiel #4
0
gint ease_main_main (char** args, int args_length1) {
#line 383 "ease-main.c"
	gint result = 0;
	GOptionContext* context;
	UniqueApp* _tmp1_;
	gboolean _tmp2_;
	gboolean running;
	gboolean _tmp7_ = FALSE;
	GError * _inner_error_ = NULL;
#line 61 "ease-main.vala"
	g_set_application_name ("Ease");
#line 62 "ease-main.vala"
	gtk_window_set_default_icon_name ("ease");
#line 65 "ease-main.vala"
	context = g_option_context_new (_ (" - a presentation editor"));
#line 68 "ease-main.vala"
	g_option_context_add_main_entries (context, EASE_MAIN_options, NULL);
#line 71 "ease-main.vala"
	g_option_context_add_group (context, gtk_get_option_group (TRUE));
#line 72 "ease-main.vala"
	g_option_context_add_group (context, clutter_get_option_group ());
#line 403 "ease-main.c"
	{
		gboolean _tmp0_;
#line 76 "ease-main.vala"
		_tmp0_ = g_option_context_parse (context, &args_length1, &args, &_inner_error_);
#line 408 "ease-main.c"
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_OPTION_ERROR) {
				goto __catch12_g_option_error;
			}
			_g_option_context_free0 (context);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return 0;
		}
#line 76 "ease-main.vala"
		if (!_tmp0_) {
#line 420 "ease-main.c"
			result = 1;
			_g_option_context_free0 (context);
#line 76 "ease-main.vala"
			return result;
#line 425 "ease-main.c"
		}
	}
	goto __finally12;
	__catch12_g_option_error:
	{
		GError * e;
		e = _inner_error_;
		_inner_error_ = NULL;
		{
#line 80 "ease-main.vala"
			fprintf (stdout, _ ("error parsing options: %s\n"), e->message);
#line 437 "ease-main.c"
			result = 1;
			_g_error_free0 (e);
			_g_option_context_free0 (context);
#line 81 "ease-main.vala"
			return result;
#line 443 "ease-main.c"
		}
	}
	__finally12:
	if (_inner_error_ != NULL) {
		_g_option_context_free0 (context);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return 0;
	}
#line 85 "ease-main.vala"
	ease_main_app = (_tmp1_ = unique_app_new ("org.ease-project.ease", NULL), _g_object_unref0 (ease_main_app), _tmp1_);
#line 86 "ease-main.vala"
	unique_app_add_command (ease_main_app, "Open document", (gint) EASE_MAIN_UNIQUE_COMMAND_OPEN_FILE);
#line 87 "ease-main.vala"
	unique_app_add_command (ease_main_app, "Play document", (gint) EASE_MAIN_UNIQUE_COMMAND_PLAY_FILE);
#line 88 "ease-main.vala"
	unique_app_add_command (ease_main_app, "Create new document", (gint) EASE_MAIN_UNIQUE_COMMAND_SHOW_WELCOME);
#line 91 "ease-main.vala"
	running = (g_object_get (ease_main_app, "is-running", &_tmp2_, NULL), _tmp2_);
#line 93 "ease-main.vala"
	if (!running) {
#line 465 "ease-main.c"
		GeeArrayList* _tmp3_;
		ClutterBackend* backend;
		GtkSettings* settings;
		gint _tmp4_;
		gint _tmp5_;
#line 96 "ease-main.vala"
		g_signal_connect (ease_main_app, "message-received", (GCallback) __lambda65__unique_app_message_received, NULL);
#line 120 "ease-main.vala"
		gst_init (&args_length1, &args);
#line 123 "ease-main.vala"
		ease_undo_controller_set_enable_debug (ease_main_debug_undo);
#line 126 "ease-main.vala"
		ease_main_windows = (_tmp3_ = gee_array_list_new (EASE_MAIN_TYPE_EDITOR_WINDOW_INFO, (GBoxedCopyFunc) ease_main_editor_window_info_ref, ease_main_editor_window_info_unref, NULL), _g_object_unref0 (ease_main_windows), _tmp3_);
#line 129 "ease-main.vala"
		backend = _g_object_ref0 (clutter_get_default_backend ());
#line 130 "ease-main.vala"
		settings = _g_object_ref0 (gtk_settings_get_default ());
#line 131 "ease-main.vala"
		clutter_backend_set_double_click_time (backend, (guint) (g_object_get (settings, "gtk-double-click-time", &_tmp4_, NULL), _tmp4_));
#line 132 "ease-main.vala"
		clutter_backend_set_double_click_distance (backend, (guint) (g_object_get (settings, "gtk-double-click-distance", &_tmp5_, NULL), _tmp5_));
#line 487 "ease-main.c"
		_g_object_unref0 (settings);
		_g_object_unref0 (backend);
	}
#line 137 "ease-main.vala"
	if (ease_main_filenames != NULL) {
#line 139 "ease-main.vala"
		if (!running) {
#line 495 "ease-main.c"
			{
				gint i;
#line 141 "ease-main.vala"
				i = 0;
#line 500 "ease-main.c"
				{
					gboolean _tmp6_;
#line 141 "ease-main.vala"
					_tmp6_ = TRUE;
#line 141 "ease-main.vala"
					while (TRUE) {
#line 141 "ease-main.vala"
						if (!_tmp6_) {
#line 141 "ease-main.vala"
							i++;
#line 511 "ease-main.c"
						}
#line 141 "ease-main.vala"
						_tmp6_ = FALSE;
#line 141 "ease-main.vala"
						if (!(ease_main_filenames[i] != NULL)) {
#line 141 "ease-main.vala"
							break;
#line 519 "ease-main.c"
						}
#line 143 "ease-main.vala"
						ease_main_open_file (ease_main_filenames[i]);
#line 523 "ease-main.c"
					}
				}
			}
		} else {
			UniqueMessageData* data;
#line 148 "ease-main.vala"
			data = unique_message_data_new ();
#line 149 "ease-main.vala"
			unique_message_data_set_uris (data, ease_main_filenames);
#line 150 "ease-main.vala"
			unique_app_send_message (ease_main_app, (gint) EASE_MAIN_UNIQUE_COMMAND_OPEN_FILE, data);
#line 535 "ease-main.c"
			_unique_message_data_free0 (data);
		}
	}
#line 155 "ease-main.vala"
	if (ease_main_play_filename != NULL) {
#line 157 "ease-main.vala"
		if (!running) {
#line 159 "ease-main.vala"
			ease_main_play_file (ease_main_play_filename, ease_main_filenames == NULL);
#line 545 "ease-main.c"
		} else {
			UniqueMessageData* data;
#line 163 "ease-main.vala"
			data = unique_message_data_new ();
#line 164 "ease-main.vala"
			unique_message_data_set_filename (data, ease_main_play_filename);
#line 165 "ease-main.vala"
			unique_app_send_message (ease_main_app, (gint) EASE_MAIN_UNIQUE_COMMAND_PLAY_FILE, data);
#line 554 "ease-main.c"
			_unique_message_data_free0 (data);
		}
	}
#line 170 "ease-main.vala"
	if (ease_main_filenames == NULL) {
#line 170 "ease-main.vala"
		_tmp7_ = ease_main_play_filename == NULL;
#line 562 "ease-main.c"
	} else {
#line 170 "ease-main.vala"
		_tmp7_ = FALSE;
#line 566 "ease-main.c"
	}
#line 170 "ease-main.vala"
	if (_tmp7_) {
#line 172 "ease-main.vala"
		if (!running) {
#line 172 "ease-main.vala"
			ease_main_show_welcome ();
#line 574 "ease-main.c"
		} else {
#line 173 "ease-main.vala"
			unique_app_send_message (ease_main_app, (gint) EASE_MAIN_UNIQUE_COMMAND_SHOW_WELCOME, NULL);
#line 578 "ease-main.c"
		}
	}
#line 177 "ease-main.vala"
	if (running) {
#line 583 "ease-main.c"
		result = 0;
		_g_option_context_free0 (context);
#line 177 "ease-main.vala"
		return result;
#line 588 "ease-main.c"
	}
#line 179 "ease-main.vala"
	gtk_main ();
#line 181 "ease-main.vala"
	ease_temp_clean ();
#line 594 "ease-main.c"
	result = 0;
	_g_option_context_free0 (context);
#line 183 "ease-main.vala"
	return result;
#line 599 "ease-main.c"
}
Beispiel #5
0
gint skk_tool_main (gchar** args, int args_length1) {
	gint result = 0;
	const gchar* _tmp0_ = NULL;
	GOptionContext* _tmp1_;
	GOptionContext* option_context;
	GOptionContext* _tmp2_;
	gboolean _tmp7_;
	GeeArrayList* _tmp19_;
	GeeArrayList* dictionaries;
	const gchar* _tmp20_;
	const gchar* _tmp30_;
	const gchar* _tmp58_;
	GeeArrayList* _tmp86_;
	gint _tmp87_ = 0;
	gpointer* _tmp88_ = NULL;
	SkkDict** _tmp89_;
	gint _tmp89__length1;
	SkkContext* _tmp90_;
	SkkContext* _tmp91_;
	SkkContext* context;
	const gchar* _tmp92_;
	SkkContext* _tmp102_;
	SkkSkkTool* _tmp103_;
	SkkSkkTool* tool;
	SkkSkkTool* _tmp104_;
	gboolean _tmp105_ = FALSE;
	GError * _inner_error_ = NULL;
	setlocale (LC_ALL, "");
	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
	_tmp0_ = _ ("- emulate SKK input method on the command line");
	_tmp1_ = g_option_context_new (_tmp0_);
	option_context = _tmp1_;
	_tmp2_ = option_context;
	g_option_context_add_main_entries (_tmp2_, SKK_TOOL_options, "libskk");
	{
		GOptionContext* _tmp3_;
		_tmp3_ = option_context;
		g_option_context_parse (_tmp3_, &args_length1, &args, &_inner_error_);
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_OPTION_ERROR) {
				goto __catch0_g_option_error;
			}
			_g_option_context_free0 (option_context);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return 0;
		}
	}
	goto __finally0;
	__catch0_g_option_error:
	{
		GError* e = NULL;
		FILE* _tmp4_;
		GError* _tmp5_;
		const gchar* _tmp6_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp4_ = stderr;
		_tmp5_ = e;
		_tmp6_ = _tmp5_->message;
		fprintf (_tmp4_, "%s\n", _tmp6_);
		result = 1;
		_g_error_free0 (e);
		_g_option_context_free0 (option_context);
		return result;
	}
	__finally0:
	if (_inner_error_ != NULL) {
		_g_option_context_free0 (option_context);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return 0;
	}
	skk_init ();
	_tmp7_ = skk_tool_list_typing_rules;
	if (_tmp7_) {
		gint _tmp8_ = 0;
		SkkRuleMetadata* _tmp9_ = NULL;
		SkkRuleMetadata* rules;
		gint rules_length1;
		gint _rules_size_;
		SkkRuleMetadata* _tmp10_;
		gint _tmp10__length1;
		_tmp9_ = skk_rule_list (&_tmp8_);
		rules = _tmp9_;
		rules_length1 = _tmp8_;
		_rules_size_ = rules_length1;
		_tmp10_ = rules;
		_tmp10__length1 = rules_length1;
		{
			SkkRuleMetadata* rule_collection = NULL;
			gint rule_collection_length1 = 0;
			gint _rule_collection_size_ = 0;
			gint rule_it = 0;
			rule_collection = _tmp10_;
			rule_collection_length1 = _tmp10__length1;
			for (rule_it = 0; rule_it < _tmp10__length1; rule_it = rule_it + 1) {
				SkkRuleMetadata _tmp11_ = {0};
				SkkRuleMetadata rule = {0};
				skk_rule_metadata_copy (&rule_collection[rule_it], &_tmp11_);
				rule = _tmp11_;
				{
					FILE* _tmp12_;
					SkkRuleMetadata _tmp13_;
					const gchar* _tmp14_;
					SkkRuleMetadata _tmp15_;
					const gchar* _tmp16_;
					SkkRuleMetadata _tmp17_;
					const gchar* _tmp18_;
					_tmp12_ = stdout;
					_tmp13_ = rule;
					_tmp14_ = _tmp13_.name;
					_tmp15_ = rule;
					_tmp16_ = _tmp15_.label;
					_tmp17_ = rule;
					_tmp18_ = _tmp17_.description;
					fprintf (_tmp12_, "%s - %s: %s\n", _tmp14_, _tmp16_, _tmp18_);
					skk_rule_metadata_destroy (&rule);
				}
			}
		}
		result = 0;
		rules = (_vala_SkkRuleMetadata_array_free (rules, rules_length1), NULL);
		_g_option_context_free0 (option_context);
		return result;
	}
	_tmp19_ = gee_array_list_new (SKK_TYPE_DICT, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL);
	dictionaries = _tmp19_;
	_tmp20_ = skk_tool_user_dict;
	if (_tmp20_ != NULL) {
		{
			const gchar* _tmp21_;
			SkkUserDict* _tmp22_;
			SkkUserDict* _tmp23_;
			GeeArrayList* _tmp24_;
			SkkUserDict* _tmp25_;
			_tmp21_ = skk_tool_user_dict;
			_tmp22_ = skk_user_dict_new (_tmp21_, "UTF-8", &_inner_error_);
			_tmp23_ = _tmp22_;
			if (_inner_error_ != NULL) {
				goto __catch1_g_error;
			}
			_tmp24_ = dictionaries;
			_tmp25_ = _tmp23_;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp24_, (SkkDict*) _tmp25_);
			_g_object_unref0 (_tmp25_);
		}
		goto __finally1;
		__catch1_g_error:
		{
			GError* e = NULL;
			FILE* _tmp26_;
			const gchar* _tmp27_;
			GError* _tmp28_;
			const gchar* _tmp29_;
			e = _inner_error_;
			_inner_error_ = NULL;
			_tmp26_ = stderr;
			_tmp27_ = skk_tool_user_dict;
			_tmp28_ = e;
			_tmp29_ = _tmp28_->message;
			fprintf (_tmp26_, "can't open user dict %s: %s", _tmp27_, _tmp29_);
			result = 1;
			_g_error_free0 (e);
			_g_object_unref0 (dictionaries);
			_g_option_context_free0 (option_context);
			return result;
		}
		__finally1:
		if (_inner_error_ != NULL) {
			_g_object_unref0 (dictionaries);
			_g_option_context_free0 (option_context);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return 0;
		}
	}
	_tmp30_ = skk_tool_file_dict;
	if (_tmp30_ != NULL) {
		const gchar* _tmp31_;
		gboolean _tmp32_ = FALSE;
		_tmp31_ = skk_tool_file_dict;
		_tmp32_ = g_str_has_suffix (_tmp31_, ".cdb");
		if (_tmp32_) {
			{
				const gchar* _tmp33_;
				SkkCdbDict* _tmp34_;
				SkkCdbDict* _tmp35_;
				GeeArrayList* _tmp36_;
				SkkCdbDict* _tmp37_;
				_tmp33_ = skk_tool_file_dict;
				_tmp34_ = skk_cdb_dict_new (_tmp33_, "EUC-JP", &_inner_error_);
				_tmp35_ = _tmp34_;
				if (_inner_error_ != NULL) {
					goto __catch2_g_error;
				}
				_tmp36_ = dictionaries;
				_tmp37_ = _tmp35_;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp36_, (SkkDict*) _tmp37_);
				_g_object_unref0 (_tmp37_);
			}
			goto __finally2;
			__catch2_g_error:
			{
				GError* e = NULL;
				FILE* _tmp38_;
				const gchar* _tmp39_;
				GError* _tmp40_;
				const gchar* _tmp41_;
				e = _inner_error_;
				_inner_error_ = NULL;
				_tmp38_ = stderr;
				_tmp39_ = skk_tool_file_dict;
				_tmp40_ = e;
				_tmp41_ = _tmp40_->message;
				fprintf (_tmp38_, "can't open CDB dict %s: %s", _tmp39_, _tmp41_);
				result = 1;
				_g_error_free0 (e);
				_g_object_unref0 (dictionaries);
				_g_option_context_free0 (option_context);
				return result;
			}
			__finally2:
			if (_inner_error_ != NULL) {
				_g_object_unref0 (dictionaries);
				_g_option_context_free0 (option_context);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
				g_clear_error (&_inner_error_);
				return 0;
			}
		} else {
			{
				const gchar* _tmp42_;
				SkkFileDict* _tmp43_;
				SkkFileDict* _tmp44_;
				GeeArrayList* _tmp45_;
				SkkFileDict* _tmp46_;
				_tmp42_ = skk_tool_file_dict;
				_tmp43_ = skk_file_dict_new (_tmp42_, "EUC-JP", &_inner_error_);
				_tmp44_ = _tmp43_;
				if (_inner_error_ != NULL) {
					goto __catch3_g_error;
				}
				_tmp45_ = dictionaries;
				_tmp46_ = _tmp44_;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp45_, (SkkDict*) _tmp46_);
				_g_object_unref0 (_tmp46_);
			}
			goto __finally3;
			__catch3_g_error:
			{
				GError* e = NULL;
				FILE* _tmp47_;
				const gchar* _tmp48_;
				GError* _tmp49_;
				const gchar* _tmp50_;
				e = _inner_error_;
				_inner_error_ = NULL;
				_tmp47_ = stderr;
				_tmp48_ = skk_tool_file_dict;
				_tmp49_ = e;
				_tmp50_ = _tmp49_->message;
				fprintf (_tmp47_, "can't open file dict %s: %s", _tmp48_, _tmp50_);
				result = 1;
				_g_error_free0 (e);
				_g_object_unref0 (dictionaries);
				_g_option_context_free0 (option_context);
				return result;
			}
			__finally3:
			if (_inner_error_ != NULL) {
				_g_object_unref0 (dictionaries);
				_g_option_context_free0 (option_context);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
				g_clear_error (&_inner_error_);
				return 0;
			}
		}
	} else {
		gchar* _tmp51_ = NULL;
		gchar* _tmp52_;
		SkkFileDict* _tmp53_;
		SkkFileDict* _tmp54_;
		SkkFileDict* _tmp55_;
		GeeArrayList* _tmp56_;
		SkkFileDict* _tmp57_;
		_tmp51_ = g_build_filename (DATADIR, "skk", "SKK-JISYO.L", NULL);
		_tmp52_ = _tmp51_;
		_tmp53_ = skk_file_dict_new (_tmp52_, "EUC-JP", &_inner_error_);
		_tmp54_ = _tmp53_;
		_g_free0 (_tmp52_);
		_tmp55_ = _tmp54_;
		if (_inner_error_ != NULL) {
			_g_object_unref0 (dictionaries);
			_g_option_context_free0 (option_context);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return 0;
		}
		_tmp56_ = dictionaries;
		_tmp57_ = _tmp55_;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp56_, (SkkDict*) _tmp57_);
		_g_object_unref0 (_tmp57_);
	}
	_tmp58_ = skk_tool_skkserv;
	if (_tmp58_ != NULL) {
		const gchar* _tmp59_;
		gint _tmp60_ = 0;
		gint index;
		gchar* host = NULL;
		guint16 port = 0U;
		gint _tmp61_;
		_tmp59_ = skk_tool_skkserv;
		_tmp60_ = string_last_index_of (_tmp59_, ":", 0);
		index = _tmp60_;
		_tmp61_ = index;
		if (_tmp61_ < 0) {
			const gchar* _tmp62_;
			gchar* _tmp63_;
			_tmp62_ = skk_tool_skkserv;
			_tmp63_ = g_strdup (_tmp62_);
			_g_free0 (host);
			host = _tmp63_;
			port = (guint16) 1178;
		} else {
			const gchar* _tmp64_;
			gint _tmp65_;
			gchar* _tmp66_ = NULL;
			const gchar* _tmp67_;
			gint _tmp68_;
			const gchar* _tmp69_;
			gint _tmp70_;
			gint _tmp71_;
			gchar* _tmp72_ = NULL;
			gchar* _tmp73_;
			gint _tmp74_ = 0;
			_tmp64_ = skk_tool_skkserv;
			_tmp65_ = index;
			_tmp66_ = string_slice (_tmp64_, (glong) 0, (glong) _tmp65_);
			_g_free0 (host);
			host = _tmp66_;
			_tmp67_ = skk_tool_skkserv;
			_tmp68_ = index;
			_tmp69_ = skk_tool_skkserv;
			_tmp70_ = strlen (_tmp69_);
			_tmp71_ = _tmp70_;
			_tmp72_ = string_slice (_tmp67_, (glong) (_tmp68_ + 1), (glong) _tmp71_);
			_tmp73_ = _tmp72_;
			_tmp74_ = atoi (_tmp73_);
			port = (guint16) _tmp74_;
			_g_free0 (_tmp73_);
		}
		{
			const gchar* _tmp75_;
			guint16 _tmp76_;
			SkkSkkServ* _tmp77_;
			SkkSkkServ* _tmp78_;
			GeeArrayList* _tmp79_;
			SkkSkkServ* _tmp80_;
			_tmp75_ = host;
			_tmp76_ = port;
			_tmp77_ = skk_skk_serv_new (_tmp75_, _tmp76_, "EUC-JP", &_inner_error_);
			_tmp78_ = _tmp77_;
			if (_inner_error_ != NULL) {
				goto __catch4_g_error;
			}
			_tmp79_ = dictionaries;
			_tmp80_ = _tmp78_;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp79_, (SkkDict*) _tmp80_);
			_g_object_unref0 (_tmp80_);
		}
		goto __finally4;
		__catch4_g_error:
		{
			GError* e = NULL;
			FILE* _tmp81_;
			const gchar* _tmp82_;
			guint16 _tmp83_;
			GError* _tmp84_;
			const gchar* _tmp85_;
			e = _inner_error_;
			_inner_error_ = NULL;
			_tmp81_ = stderr;
			_tmp82_ = host;
			_tmp83_ = port;
			_tmp84_ = e;
			_tmp85_ = _tmp84_->message;
			fprintf (_tmp81_, "can't connect to skkserv at %s:%d: %s", _tmp82_, (gint) _tmp83_, _tmp85_);
			result = 1;
			_g_error_free0 (e);
			_g_free0 (host);
			_g_object_unref0 (dictionaries);
			_g_option_context_free0 (option_context);
			return result;
		}
		__finally4:
		if (_inner_error_ != NULL) {
			_g_free0 (host);
			_g_object_unref0 (dictionaries);
			_g_option_context_free0 (option_context);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return 0;
		}
		_g_free0 (host);
	}
	_tmp86_ = dictionaries;
	_tmp88_ = gee_abstract_collection_to_array ((GeeAbstractCollection*) _tmp86_, &_tmp87_);
	_tmp89_ = _tmp88_;
	_tmp89__length1 = _tmp87_;
	_tmp90_ = skk_context_new (_tmp89_, _tmp87_);
	_tmp91_ = _tmp90_;
	_tmp89_ = (_vala_array_free (_tmp89_, _tmp89__length1, (GDestroyNotify) g_object_unref), NULL);
	context = _tmp91_;
	_tmp92_ = skk_tool_typing_rule;
	if (_tmp92_ != NULL) {
		{
			const gchar* _tmp93_;
			SkkRule* _tmp94_;
			SkkRule* _tmp95_;
			SkkContext* _tmp96_;
			SkkRule* _tmp97_;
			_tmp93_ = skk_tool_typing_rule;
			_tmp94_ = skk_rule_new (_tmp93_, &_inner_error_);
			_tmp95_ = _tmp94_;
			if (_inner_error_ != NULL) {
				if (_inner_error_->domain == SKK_RULE_PARSE_ERROR) {
					goto __catch5_skk_rule_parse_error;
				}
				_g_object_unref0 (context);
				_g_object_unref0 (dictionaries);
				_g_option_context_free0 (option_context);
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
				g_clear_error (&_inner_error_);
				return 0;
			}
			_tmp96_ = context;
			_tmp97_ = _tmp95_;
			skk_context_set_typing_rule (_tmp96_, _tmp97_);
			_g_object_unref0 (_tmp97_);
		}
		goto __finally5;
		__catch5_skk_rule_parse_error:
		{
			GError* e = NULL;
			FILE* _tmp98_;
			const gchar* _tmp99_;
			GError* _tmp100_;
			const gchar* _tmp101_;
			e = _inner_error_;
			_inner_error_ = NULL;
			_tmp98_ = stderr;
			_tmp99_ = skk_tool_typing_rule;
			_tmp100_ = e;
			_tmp101_ = _tmp100_->message;
			fprintf (_tmp98_, "can't load rule \"%s\": %s\n", _tmp99_, _tmp101_);
			result = 1;
			_g_error_free0 (e);
			_g_object_unref0 (context);
			_g_object_unref0 (dictionaries);
			_g_option_context_free0 (option_context);
			return result;
		}
		__finally5:
		if (_inner_error_ != NULL) {
			_g_object_unref0 (context);
			_g_object_unref0 (dictionaries);
			_g_option_context_free0 (option_context);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return 0;
		}
	}
	_tmp102_ = context;
	_tmp103_ = skk_skk_tool_new (_tmp102_);
	tool = _tmp103_;
	_tmp104_ = tool;
	_tmp105_ = skk_tool_run ((SkkTool*) _tmp104_);
	if (!_tmp105_) {
		result = 1;
		_g_object_unref0 (tool);
		_g_object_unref0 (context);
		_g_object_unref0 (dictionaries);
		_g_option_context_free0 (option_context);
		return result;
	}
	result = 0;
	_g_object_unref0 (tool);
	_g_object_unref0 (context);
	_g_object_unref0 (dictionaries);
	_g_option_context_free0 (option_context);
	return result;
}
gint dock_manager_preferences_bin_main (gchar** argv, int argv_length1) {
	gint result = 0;
	GOptionContext* _tmp0_ = NULL;
	GOptionContext* context;
	GOptionGroup* _tmp1_ = NULL;
	DockManagerPreferencesBin* _tmp2_ = NULL;
	DockManagerPreferencesBin* prefs_bin;
	GError * _inner_error_ = NULL;
	_tmp0_ = g_option_context_new (" - Dockmanager-settings Options");
	context = _tmp0_;
	g_option_context_add_main_entries (context, DOCK_MANAGER_options, NULL);
	_tmp1_ = gtk_get_option_group (FALSE);
	g_option_context_add_group (context, _tmp1_);
	g_option_context_parse (context, &argv_length1, &argv, &_inner_error_);
	if (_inner_error_ != NULL) {
		_g_option_context_free0 (context);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return 0;
	}
	gtk_init (&argv_length1, &argv);
	desktop_agnostic_vfs_init (&_inner_error_);
	if (_inner_error_ != NULL) {
		goto __catch1_g_error;
	}
	_tmp2_ = dock_manager_preferences_bin_new ();
	prefs_bin = g_object_ref_sink (_tmp2_);
	gtk_widget_show ((GtkWidget*) prefs_bin);
	if (dock_manager_EMBED_XID == 0) {
		GtkWindow* _tmp3_ = NULL;
		GtkWindow* window;
		_tmp3_ = (GtkWindow*) gtk_window_new (GTK_WINDOW_TOPLEVEL);
		window = g_object_ref_sink (_tmp3_);
		gtk_window_set_title (window, "Dockmanager preferences");
		gtk_container_add ((GtkContainer*) window, (GtkWidget*) prefs_bin);
		gtk_window_set_default_size (window, 400, 450);
		gtk_container_set_border_width ((GtkContainer*) window, (guint) 12);
		g_signal_connect ((GtkObject*) window, "destroy", (GCallback) _gtk_main_quit_gtk_object_destroy, NULL);
		gtk_widget_show ((GtkWidget*) window);
		_g_object_unref0 (window);
	} else {
		GtkPlug* _tmp4_ = NULL;
		GtkPlug* plug;
		_tmp4_ = (GtkPlug*) gtk_plug_new ((GdkNativeWindow) 0);
		plug = g_object_ref_sink (_tmp4_);
		g_signal_connect ((GtkWidget*) plug, "delete-event", (GCallback) __lambda4__gtk_widget_delete_event, NULL);
		gtk_container_add ((GtkContainer*) plug, (GtkWidget*) prefs_bin);
		gtk_plug_construct (plug, (GdkNativeWindow) dock_manager_EMBED_XID);
		gtk_widget_show ((GtkWidget*) plug);
		_g_object_unref0 (plug);
	}
	gtk_main ();
	desktop_agnostic_vfs_shutdown (&_inner_error_);
	if (_inner_error_ != NULL) {
		_g_object_unref0 (prefs_bin);
		goto __catch1_g_error;
	}
	_g_object_unref0 (prefs_bin);
	goto __finally1;
	__catch1_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		g_warning ("dockmanager-settings.vala:327: %s", err->message);
		_g_error_free0 (err);
	}
	__finally1:
	if (_inner_error_ != NULL) {
		_g_option_context_free0 (context);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return 0;
	}
	result = 0;
	_g_option_context_free0 (context);
	return result;
}
Beispiel #7
0
gint preferences_app_main (gchar** args, int args_length1) {
	gint result = 0;
	const gchar* _tmp0_ = NULL;
	GOptionContext* _tmp1_;
	GOptionContext* context;
	GOptionContext* _tmp2_;
	GOptionContext* _tmp3_;
	GOptionGroup* _tmp4_ = NULL;
	gint status = 0;
	gint _tmp11_ = 0;
	gboolean _tmp12_ = FALSE;
	GtkIconTheme* _tmp13_ = NULL;
	gboolean _tmp14_ = FALSE;
	GtkApplication* _tmp15_;
	GtkApplication* app;
	GtkApplication* _tmp16_;
	GtkApplication* _tmp17_;
	gint _tmp18_ = 0;
	GError * _inner_error_ = NULL;
	deja_dup_i18n_setup ();
	_tmp0_ = _ ("Backup");
	g_set_application_name (_tmp0_);
	_tmp1_ = g_option_context_new ("");
	context = _tmp1_;
	_tmp2_ = context;
	g_option_context_add_main_entries (_tmp2_, PREFERENCES_APP_options, GETTEXT_PACKAGE);
	_tmp3_ = context;
	_tmp4_ = gtk_get_option_group (FALSE);
	g_option_context_add_group (_tmp3_, _tmp4_);
	{
		GOptionContext* _tmp5_;
		_tmp5_ = context;
		g_option_context_parse (_tmp5_, &args_length1, &args, &_inner_error_);
		if (_inner_error_ != NULL) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp6_;
		const gchar* _tmp7_;
		GOptionContext* _tmp8_;
		gchar* _tmp9_ = NULL;
		gchar* _tmp10_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp6_ = e;
		_tmp7_ = _tmp6_->message;
		_tmp8_ = context;
		_tmp9_ = g_option_context_get_help (_tmp8_, TRUE, NULL);
		_tmp10_ = _tmp9_;
		g_printerr ("%s\n\n%s", _tmp7_, _tmp10_);
		_g_free0 (_tmp10_);
		result = 1;
		_g_error_free0 (e);
		_g_option_context_free0 (context);
		return result;
	}
	__finally0:
	if (_inner_error_ != NULL) {
		_g_option_context_free0 (context);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return 0;
	}
	_tmp12_ = preferences_app_handle_console_options (&_tmp11_);
	status = _tmp11_;
	if (!_tmp12_) {
		result = status;
		_g_option_context_free0 (context);
		return result;
	}
	gtk_init (&args_length1, &args);
	_tmp13_ = gtk_icon_theme_get_default ();
	gtk_icon_theme_append_search_path (_tmp13_, THEME_DIR);
	gtk_window_set_default_icon_name (PACKAGE);
	_tmp14_ = deja_dup_gui_initialize (NULL, TRUE);
	if (!_tmp14_) {
		result = 1;
		_g_option_context_free0 (context);
		return result;
	}
	_tmp15_ = gtk_application_new ("org.gnome.DejaDup.Preferences", 0);
	app = _tmp15_;
	_tmp16_ = app;
	g_signal_connect ((GApplication*) _tmp16_, "activate", (GCallback) ___lambda9__g_application_activate, NULL);
	_tmp17_ = app;
	_tmp18_ = g_application_run ((GApplication*) _tmp17_, 0, NULL);
	result = _tmp18_;
	_g_object_unref0 (app);
	_g_option_context_free0 (context);
	return result;
}