Beispiel #1
0
gint _vala_main (gchar** args, int args_length1) {
	gint result = 0;
	GMainLoop* loop = NULL;
	GMainLoop* _tmp0_ = NULL;
	DPAPCopy* dmapcopy = NULL;
	DPAPCopy* _tmp1_ = NULL;
	GError * _inner_error_ = NULL;
	_tmp0_ = g_main_loop_new (NULL, FALSE);
	loop = _tmp0_;
	g_log_set_handler ("libdmapsharing", G_LOG_LEVEL_DEBUG, _debug_null_glog_func, NULL);
	g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, _debug_null_glog_func, NULL);
	_tmp1_ = dpap_copy_new (&_inner_error_);
	dmapcopy = _tmp1_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_main_loop_unref0 (loop);
		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_main_loop_run (loop);
	result = 0;
	_dpap_copy_unref0 (dmapcopy);
	_g_main_loop_unref0 (loop);
	return result;
}
static GObject * soy_controllers__controllerthread_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	soycontrollers_ControllerThread * self;
	gboolean _tmp0_ = FALSE;
	GMainContext* _tmp1_;
	GMainContext* _tmp2_;
	GMainLoop* _tmp3_;
	GThread* _tmp4_;
	parent_class = G_OBJECT_CLASS (soy_controllers__controllerthread_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SOY_CONTROLLERS_TYPE__CONTROLLERTHREAD, soycontrollers_ControllerThread);
	_tmp0_ = g_thread_supported ();
	if (!_tmp0_) {
		g_print ("ThreadError: Threading is unsupported\n");
		raise (15);
	}
	_tmp1_ = g_main_context_new ();
	_g_main_context_unref0 (self->context);
	self->context = _tmp1_;
	_tmp2_ = self->context;
	_tmp3_ = g_main_loop_new (_tmp2_, TRUE);
	_g_main_loop_unref0 (self->priv->_loop);
	self->priv->_loop = _tmp3_;
	_tmp4_ = g_thread_new ("Controllers", _soy_controllers__controllerthread_run_gthread_func, g_object_ref (self));
	_g_thread_unref0 (self->priv->_thread);
	self->priv->_thread = _tmp4_;
	return obj;
}
static void soy_controllers__controllerthread_finalize (GObject* obj) {
	soycontrollers_ControllerThread * self;
	GMainLoop* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SOY_CONTROLLERS_TYPE__CONTROLLERTHREAD, soycontrollers_ControllerThread);
	_tmp0_ = self->priv->_loop;
	g_main_loop_quit (_tmp0_);
	_g_main_loop_unref0 (self->priv->_loop);
	_g_thread_unref0 (self->priv->_thread);
	_g_main_context_unref0 (self->context);
	G_OBJECT_CLASS (soy_controllers__controllerthread_parent_class)->finalize (obj);
}
static void soy_net__networkthread_finalize (GObject* obj) {
	soynet_NetworkThread * self;
	GMainLoop* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SOY_NET_TYPE__NETWORKTHREAD, soynet_NetworkThread);
	_tmp0_ = self->priv->_loop;
	g_main_loop_quit (_tmp0_);
	_g_main_loop_unref0 (self->priv->_loop);
	_g_thread_unref0 (self->priv->_thread);
	_g_main_context_unref0 (self->context);
	G_OBJECT_CLASS (soy_net__networkthread_parent_class)->finalize (obj);
}
Beispiel #5
0
static GObject * deja_dup_async_command_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	DejaDupAsyncCommand * self;
	GMainLoop* _tmp0_;
	parent_class = G_OBJECT_CLASS (deja_dup_async_command_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = DEJA_DUP_ASYNC_COMMAND (obj);
	_tmp0_ = g_main_loop_new (NULL, FALSE);
	_g_main_loop_unref0 (self->priv->loop);
	self->priv->loop = _tmp0_;
	return obj;
}
Beispiel #6
0
static void deja_dup_async_command_finalize (GObject* obj) {
	DejaDupAsyncCommand * self;
	guint _tmp0_;
	GPid _tmp2_;
	self = DEJA_DUP_ASYNC_COMMAND (obj);
	_tmp0_ = self->priv->watch;
	if (_tmp0_ > ((guint) 0)) {
		guint _tmp1_;
		_tmp1_ = self->priv->watch;
		g_source_remove (_tmp1_);
	}
	_tmp2_ = self->priv->pid;
	if (_tmp2_ > ((GPid) 0)) {
		GPid _tmp3_;
		_tmp3_ = self->priv->pid;
		deja_dup_async_command_handle_done (self, _tmp3_, 1);
	}
	self->priv->_argv = (_vala_array_free (self->priv->_argv, self->priv->_argv_length1, (GDestroyNotify) g_free), NULL);
	_g_main_loop_unref0 (self->priv->loop);
	G_OBJECT_CLASS (deja_dup_async_command_parent_class)->finalize (obj);
}
Beispiel #7
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;
}