/* dbus_async_errors_server.c generated by valac, the Vala compiler * generated from dbus_async_errors_server.vala, do not modify */ #include #include #include #include #include #if !defined(VALA_EXTERN) #if defined(_WIN32) || defined(__CYGWIN__) #define VALA_EXTERN __declspec(dllexport) extern #elif __GNUC__ >= 4 #define VALA_EXTERN __attribute__((visibility("default"))) extern #else #define VALA_EXTERN extern #endif #endif #define TYPE_TEST (test_get_type ()) #define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test)) #define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass)) #define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST)) #define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST)) #define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass)) typedef struct _Test Test; typedef struct _TestClass TestClass; typedef struct _TestPrivate TestPrivate; enum { TEST_0_PROPERTY, TEST_NUM_PROPERTIES }; static GParamSpec* test_properties[TEST_NUM_PROPERTIES]; #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) typedef struct _TestTestVoidData TestTestVoidData; typedef struct _TestTestIntData TestTestIntData; #define _g_free0(var) (var = (g_free (var), NULL)) typedef struct _TestTestStringData TestTestStringData; typedef struct _TestTestCancellableData TestTestCancellableData; typedef struct _TestTestVoidReadyData TestTestVoidReadyData; typedef struct _TestTestIntReadyData TestTestIntReadyData; typedef struct _TestTestStringReadyData TestTestStringReadyData; typedef struct _TestTestCancellableReadyData TestTestCancellableReadyData; #define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL))) #define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL))) #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } #define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } #define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); struct _Test { GObject parent_instance; TestPrivate * priv; }; struct _TestClass { GObjectClass parent_class; }; struct _TestTestVoidData { int _state_; GObject* _source_object_; GAsyncResult* _res_; GTask* _async_result; Test* self; GError* _tmp0_; GError* _inner_error0_; }; struct _TestTestIntData { int _state_; GObject* _source_object_; GAsyncResult* _res_; GTask* _async_result; Test* self; gint i; gint j; gint result; GError* _tmp0_; GError* _inner_error0_; }; struct _TestTestStringData { int _state_; GObject* _source_object_; GAsyncResult* _res_; GTask* _async_result; Test* self; gchar* s; gchar* t; gchar* result; GError* _tmp0_; GError* _inner_error0_; }; struct _TestTestCancellableData { int _state_; GObject* _source_object_; GAsyncResult* _res_; GTask* _async_result; Test* self; GCancellable* cancellable; }; struct _TestTestVoidReadyData { GDBusMethodInvocation* _invocation_; }; struct _TestTestIntReadyData { GDBusMethodInvocation* _invocation_; gint i; }; struct _TestTestStringReadyData { GDBusMethodInvocation* _invocation_; gchar* s; }; struct _TestTestCancellableReadyData { GDBusMethodInvocation* _invocation_; }; static gpointer test_parent_class = NULL; VALA_EXTERN GMainLoop* main_loop; GMainLoop* main_loop = NULL; VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref) VALA_EXTERN guint test_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error); static void test_test_void_data_free (gpointer _data); VALA_EXTERN void test_test_void (Test* self, GAsyncReadyCallback _callback_, gpointer _user_data_); VALA_EXTERN void test_test_void_finish (Test* self, GAsyncResult* _res_, GError** error); static gboolean test_test_void_co (TestTestVoidData* _data_); static gboolean _test_test_void_co_gsource_func (gpointer self); static void test_test_int_data_free (gpointer _data); VALA_EXTERN void test_test_int (Test* self, gint i, GAsyncReadyCallback _callback_, gpointer _user_data_); VALA_EXTERN gint test_test_int_finish (Test* self, GAsyncResult* _res_, gint* j, GError** error); static gboolean test_test_int_co (TestTestIntData* _data_); static gboolean _test_test_int_co_gsource_func (gpointer self); static void test_test_string_data_free (gpointer _data); VALA_EXTERN void test_test_string (Test* self, const gchar* s, GAsyncReadyCallback _callback_, gpointer _user_data_); VALA_EXTERN gchar* test_test_string_finish (Test* self, GAsyncResult* _res_, gchar** t, GError** error); static gboolean test_test_string_co (TestTestStringData* _data_); static gboolean _test_test_string_co_gsource_func (gpointer self); static void test_test_cancellable_data_free (gpointer _data); VALA_EXTERN void test_test_cancellable (Test* self, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_); VALA_EXTERN void test_test_cancellable_finish (Test* self, GAsyncResult* _res_, GError** error); static gboolean test_test_cancellable_co (TestTestCancellableData* _data_); static gboolean _test_test_cancellable_co_gsource_func (gpointer self); VALA_EXTERN Test* test_new (void); VALA_EXTERN Test* test_construct (GType object_type); static GType test_get_type_once (void); static void _dbus_test_test_void (Test* self, GVariant* _parameters_, GDBusMethodInvocation* invocation); static void _dbus_test_test_void_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_); static void _dbus_test_test_int (Test* self, GVariant* _parameters_, GDBusMethodInvocation* invocation); static void _dbus_test_test_int_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_); static void _dbus_test_test_string (Test* self, GVariant* _parameters_, GDBusMethodInvocation* invocation); static void _dbus_test_test_string_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_); static void _dbus_test_test_cancellable (Test* self, GVariant* _parameters_, GDBusMethodInvocation* invocation); static void _dbus_test_test_cancellable_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_); static void test_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data); static GVariant* test_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data); static gboolean test_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data); static void _test_unregister_object (gpointer user_data); VALA_EXTERN void client_exit (GPid pid, gint status); static void _vala_main (void); static guint _variant_get1 (GVariant* value); static void _client_exit_gchild_watch_func (GPid pid, gint wait_status, gpointer self); static void _vala_array_destroy (gpointer array, gssize array_length, GDestroyNotify destroy_func); static void _vala_array_free (gpointer array, gssize array_length, GDestroyNotify destroy_func); static const GDBusArgInfo * const _test_dbus_arg_info_test_void_in[] = {NULL}; static const GDBusArgInfo * const _test_dbus_arg_info_test_void_out[] = {NULL}; static const GDBusMethodInfo _test_dbus_method_info_test_void = {-1, "TestVoid", (GDBusArgInfo **) (&_test_dbus_arg_info_test_void_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_void_out), NULL}; static const GDBusArgInfo _test_dbus_arg_info_test_int_i = {-1, "i", "i", NULL}; static const GDBusArgInfo _test_dbus_arg_info_test_int_j = {-1, "j", "i", NULL}; static const GDBusArgInfo _test_dbus_arg_info_test_int_result = {-1, "result", "i", NULL}; static const GDBusArgInfo * const _test_dbus_arg_info_test_int_in[] = {&_test_dbus_arg_info_test_int_i, NULL}; static const GDBusArgInfo * const _test_dbus_arg_info_test_int_out[] = {&_test_dbus_arg_info_test_int_j, &_test_dbus_arg_info_test_int_result, NULL}; static const GDBusMethodInfo _test_dbus_method_info_test_int = {-1, "TestInt", (GDBusArgInfo **) (&_test_dbus_arg_info_test_int_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_int_out), NULL}; static const GDBusArgInfo _test_dbus_arg_info_test_string_s = {-1, "s", "s", NULL}; static const GDBusArgInfo _test_dbus_arg_info_test_string_t = {-1, "t", "s", NULL}; static const GDBusArgInfo _test_dbus_arg_info_test_string_result = {-1, "result", "s", NULL}; static const GDBusArgInfo * const _test_dbus_arg_info_test_string_in[] = {&_test_dbus_arg_info_test_string_s, NULL}; static const GDBusArgInfo * const _test_dbus_arg_info_test_string_out[] = {&_test_dbus_arg_info_test_string_t, &_test_dbus_arg_info_test_string_result, NULL}; static const GDBusMethodInfo _test_dbus_method_info_test_string = {-1, "TestString", (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_out), NULL}; static const GDBusArgInfo * const _test_dbus_arg_info_test_cancellable_in[] = {NULL}; static const GDBusArgInfo * const _test_dbus_arg_info_test_cancellable_out[] = {NULL}; static const GDBusMethodInfo _test_dbus_method_info_test_cancellable = {-1, "TestCancellable", (GDBusArgInfo **) (&_test_dbus_arg_info_test_cancellable_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_cancellable_out), NULL}; static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_void, &_test_dbus_method_info_test_int, &_test_dbus_method_info_test_string, &_test_dbus_method_info_test_cancellable, NULL}; static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL}; static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL}; static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) (&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) (&_test_dbus_property_info), NULL}; static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, test_dbus_interface_get_property, test_dbus_interface_set_property}; static void test_test_void_data_free (gpointer _data) { TestTestVoidData* _data_; _data_ = _data; _g_object_unref0 (_data_->self); g_slice_free (TestTestVoidData, _data_); } static gpointer _g_object_ref0 (gpointer self) { return self ? g_object_ref (self) : NULL; } void test_test_void (Test* self, GAsyncReadyCallback _callback_, gpointer _user_data_) { TestTestVoidData* _data_; Test* _tmp0_; g_return_if_fail (IS_TEST (self)); _data_ = g_slice_new0 (TestTestVoidData); _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_); g_task_set_task_data (_data_->_async_result, _data_, test_test_void_data_free); _tmp0_ = _g_object_ref0 (self); _data_->self = _tmp0_; test_test_void_co (_data_); } void test_test_void_finish (Test* self, GAsyncResult* _res_, GError** error) { TestTestVoidData* _data_; _data_ = g_task_propagate_pointer (G_TASK (_res_), error); if (NULL == _data_) { return; } } static gboolean _test_test_void_co_gsource_func (gpointer self) { gboolean result; result = test_test_void_co (self); return result; } static gboolean test_test_void_co (TestTestVoidData* _data_) { switch (_data_->_state_) { case 0: goto _state_0; case 1: goto _state_1; default: g_assert_not_reached (); } _state_0: g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _test_test_void_co_gsource_func, _data_, NULL); _data_->_state_ = 1; return FALSE; _state_1: ; _data_->_tmp0_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "Operation failed"); _data_->_inner_error0_ = _data_->_tmp0_; g_task_return_error (_data_->_async_result, _data_->_inner_error0_); g_object_unref (_data_->_async_result); return FALSE; g_task_return_pointer (_data_->_async_result, _data_, NULL); if (_data_->_state_ != 0) { while (!g_task_get_completed (_data_->_async_result)) { g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE); } } g_object_unref (_data_->_async_result); return FALSE; } static void test_test_int_data_free (gpointer _data) { TestTestIntData* _data_; _data_ = _data; _g_object_unref0 (_data_->self); g_slice_free (TestTestIntData, _data_); } void test_test_int (Test* self, gint i, GAsyncReadyCallback _callback_, gpointer _user_data_) { TestTestIntData* _data_; Test* _tmp0_; g_return_if_fail (IS_TEST (self)); _data_ = g_slice_new0 (TestTestIntData); _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_); g_task_set_task_data (_data_->_async_result, _data_, test_test_int_data_free); _tmp0_ = _g_object_ref0 (self); _data_->self = _tmp0_; _data_->i = i; test_test_int_co (_data_); } gint test_test_int_finish (Test* self, GAsyncResult* _res_, gint* j, GError** error) { gint result; TestTestIntData* _data_; _data_ = g_task_propagate_pointer (G_TASK (_res_), error); if (NULL == _data_) { gint _tmp0_ = 0; return _tmp0_; } if (j) { *j = _data_->j; } result = _data_->result; return result; } static gboolean _test_test_int_co_gsource_func (gpointer self) { gboolean result; result = test_test_int_co (self); return result; } static gboolean test_test_int_co (TestTestIntData* _data_) { switch (_data_->_state_) { case 0: goto _state_0; case 1: goto _state_1; default: g_assert_not_reached (); } _state_0: g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _test_test_int_co_gsource_func, _data_, NULL); _data_->_state_ = 1; return FALSE; _state_1: ; _data_->_tmp0_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "Operation failed"); _data_->_inner_error0_ = _data_->_tmp0_; g_task_return_error (_data_->_async_result, _data_->_inner_error0_); g_object_unref (_data_->_async_result); return FALSE; } static void test_test_string_data_free (gpointer _data) { TestTestStringData* _data_; _data_ = _data; _g_free0 (_data_->s); _g_free0 (_data_->result); _g_object_unref0 (_data_->self); g_slice_free (TestTestStringData, _data_); } void test_test_string (Test* self, const gchar* s, GAsyncReadyCallback _callback_, gpointer _user_data_) { TestTestStringData* _data_; Test* _tmp0_; gchar* _tmp1_; g_return_if_fail (IS_TEST (self)); g_return_if_fail (s != NULL); _data_ = g_slice_new0 (TestTestStringData); _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_); g_task_set_task_data (_data_->_async_result, _data_, test_test_string_data_free); _tmp0_ = _g_object_ref0 (self); _data_->self = _tmp0_; _tmp1_ = g_strdup (s); _g_free0 (_data_->s); _data_->s = _tmp1_; test_test_string_co (_data_); } gchar* test_test_string_finish (Test* self, GAsyncResult* _res_, gchar** t, GError** error) { gchar* result; TestTestStringData* _data_; _data_ = g_task_propagate_pointer (G_TASK (_res_), error); if (NULL == _data_) { return NULL; } if (t) { *t = _data_->t; } else { _g_free0 (_data_->t); } _data_->t = NULL; result = _data_->result; _data_->result = NULL; return result; } static gboolean _test_test_string_co_gsource_func (gpointer self) { gboolean result; result = test_test_string_co (self); return result; } static gboolean test_test_string_co (TestTestStringData* _data_) { switch (_data_->_state_) { case 0: goto _state_0; case 1: goto _state_1; default: g_assert_not_reached (); } _state_0: g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _test_test_string_co_gsource_func, _data_, NULL); _data_->_state_ = 1; return FALSE; _state_1: ; _data_->_tmp0_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "Operation failed"); _data_->_inner_error0_ = _data_->_tmp0_; g_task_return_error (_data_->_async_result, _data_->_inner_error0_); _g_free0 (_data_->t); g_object_unref (_data_->_async_result); return FALSE; } static void test_test_cancellable_data_free (gpointer _data) { TestTestCancellableData* _data_; _data_ = _data; _g_object_unref0 (_data_->cancellable); _g_object_unref0 (_data_->self); g_slice_free (TestTestCancellableData, _data_); } void test_test_cancellable (Test* self, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) { TestTestCancellableData* _data_; Test* _tmp0_; GCancellable* _tmp1_; g_return_if_fail (IS_TEST (self)); g_return_if_fail ((cancellable == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (cancellable, g_cancellable_get_type ())); _data_ = g_slice_new0 (TestTestCancellableData); _data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_); g_task_set_task_data (_data_->_async_result, _data_, test_test_cancellable_data_free); _tmp0_ = _g_object_ref0 (self); _data_->self = _tmp0_; _tmp1_ = _g_object_ref0 (cancellable); _g_object_unref0 (_data_->cancellable); _data_->cancellable = _tmp1_; test_test_cancellable_co (_data_); } void test_test_cancellable_finish (Test* self, GAsyncResult* _res_, GError** error) { TestTestCancellableData* _data_; _data_ = g_task_propagate_pointer (G_TASK (_res_), error); if (NULL == _data_) { return; } } static gboolean _test_test_cancellable_co_gsource_func (gpointer self) { gboolean result; result = test_test_cancellable_co (self); return result; } static gboolean test_test_cancellable_co (TestTestCancellableData* _data_) { switch (_data_->_state_) { case 0: goto _state_0; case 1: goto _state_1; default: g_assert_not_reached (); } _state_0: g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _test_test_cancellable_co_gsource_func, _data_, NULL); _data_->_state_ = 1; return FALSE; _state_1: ; g_task_return_pointer (_data_->_async_result, _data_, NULL); if (_data_->_state_ != 0) { while (!g_task_get_completed (_data_->_async_result)) { g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE); } } g_object_unref (_data_->_async_result); return FALSE; } Test* test_construct (GType object_type) { Test * self = NULL; self = (Test*) g_object_new (object_type, NULL); return self; } Test* test_new (void) { return test_construct (TYPE_TEST); } static void test_class_init (TestClass * klass, gpointer klass_data) { test_parent_class = g_type_class_peek_parent (klass); } static void test_instance_init (Test * self, gpointer klass) { } static GType test_get_type_once (void) { static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 0, (GInstanceInitFunc) test_instance_init, NULL }; GType test_type_id; test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0); g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) test_register_object); return test_type_id; } GType test_get_type (void) { static volatile gsize test_type_id__once = 0; if (g_once_init_enter (&test_type_id__once)) { GType test_type_id; test_type_id = test_get_type_once (); g_once_init_leave (&test_type_id__once, test_type_id); } return test_type_id__once; } static void _dbus_test_test_void (Test* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) { GVariantIter _arguments_iter; TestTestVoidReadyData* _ready_data; g_variant_iter_init (&_arguments_iter, _parameters_); _ready_data = g_slice_new0 (TestTestVoidReadyData); _ready_data->_invocation_ = invocation; test_test_void (self, (GAsyncReadyCallback) _dbus_test_test_void_ready, _ready_data); } static void _dbus_test_test_void_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) { TestTestVoidReadyData* _ready_data; GDBusMethodInvocation* invocation; GError* error = NULL; GDBusMessage* _reply_message = NULL; GVariant* _reply; GVariantBuilder _reply_builder; _ready_data = _user_data_; invocation = _ready_data->_invocation_; test_test_void_finish ((Test*) source_object, _res_, &error); if (error) { g_dbus_method_invocation_take_error (invocation, error); goto _error; } _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); _reply = g_variant_builder_end (&_reply_builder); g_dbus_message_set_body (_reply_message, _reply); g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); g_object_unref (invocation); g_object_unref (_reply_message); _error: g_slice_free (TestTestVoidReadyData, _ready_data); } static void _dbus_test_test_int (Test* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) { GVariantIter _arguments_iter; TestTestIntReadyData* _ready_data; GVariant* _tmp0_; g_variant_iter_init (&_arguments_iter, _parameters_); _ready_data = g_slice_new0 (TestTestIntReadyData); _ready_data->_invocation_ = invocation; _tmp0_ = g_variant_iter_next_value (&_arguments_iter); _ready_data->i = g_variant_get_int32 (_tmp0_); g_variant_unref (_tmp0_); test_test_int (self, _ready_data->i, (GAsyncReadyCallback) _dbus_test_test_int_ready, _ready_data); } static void _dbus_test_test_int_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) { TestTestIntReadyData* _ready_data; GDBusMethodInvocation* invocation; GError* error = NULL; GDBusMessage* _reply_message = NULL; GVariant* _reply; GVariantBuilder _reply_builder; gint j = 0; gint result; _ready_data = _user_data_; invocation = _ready_data->_invocation_; result = test_test_int_finish ((Test*) source_object, _res_, &j, &error); if (error) { g_dbus_method_invocation_take_error (invocation, error); goto _error; } _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (j)); g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result)); _reply = g_variant_builder_end (&_reply_builder); g_dbus_message_set_body (_reply_message, _reply); g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); g_object_unref (invocation); g_object_unref (_reply_message); _error: g_slice_free (TestTestIntReadyData, _ready_data); } static void _dbus_test_test_string (Test* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) { GVariantIter _arguments_iter; TestTestStringReadyData* _ready_data; GVariant* _tmp1_; g_variant_iter_init (&_arguments_iter, _parameters_); _ready_data = g_slice_new0 (TestTestStringReadyData); _ready_data->_invocation_ = invocation; _tmp1_ = g_variant_iter_next_value (&_arguments_iter); _ready_data->s = g_variant_dup_string (_tmp1_, NULL); g_variant_unref (_tmp1_); test_test_string (self, _ready_data->s, (GAsyncReadyCallback) _dbus_test_test_string_ready, _ready_data); _error: ; } static void _dbus_test_test_string_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) { TestTestStringReadyData* _ready_data; GDBusMethodInvocation* invocation; GError* error = NULL; GDBusMessage* _reply_message = NULL; GVariant* _reply; GVariantBuilder _reply_builder; gchar* t = NULL; gchar* result; _ready_data = _user_data_; invocation = _ready_data->_invocation_; result = test_test_string_finish ((Test*) source_object, _res_, &t, &error); if (error) { g_dbus_method_invocation_take_error (invocation, error); goto _error; } _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); g_variant_builder_add_value (&_reply_builder, g_variant_new_string (t)); g_variant_builder_add_value (&_reply_builder, g_variant_new_string (result)); _g_free0 (result); _reply = g_variant_builder_end (&_reply_builder); g_dbus_message_set_body (_reply_message, _reply); g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); g_object_unref (invocation); g_object_unref (_reply_message); _error: _g_free0 (_ready_data->s); _g_free0 (t); g_slice_free (TestTestStringReadyData, _ready_data); } static void _dbus_test_test_cancellable (Test* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) { GVariantIter _arguments_iter; TestTestCancellableReadyData* _ready_data; g_variant_iter_init (&_arguments_iter, _parameters_); _ready_data = g_slice_new0 (TestTestCancellableReadyData); _ready_data->_invocation_ = invocation; test_test_cancellable (self, NULL, (GAsyncReadyCallback) _dbus_test_test_cancellable_ready, _ready_data); } static void _dbus_test_test_cancellable_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) { TestTestCancellableReadyData* _ready_data; GDBusMethodInvocation* invocation; GError* error = NULL; GDBusMessage* _reply_message = NULL; GVariant* _reply; GVariantBuilder _reply_builder; _ready_data = _user_data_; invocation = _ready_data->_invocation_; test_test_cancellable_finish ((Test*) source_object, _res_, &error); if (error) { g_dbus_method_invocation_take_error (invocation, error); goto _error; } _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); _reply = g_variant_builder_end (&_reply_builder); g_dbus_message_set_body (_reply_message, _reply); g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); g_object_unref (invocation); g_object_unref (_reply_message); _error: g_slice_free (TestTestCancellableReadyData, _ready_data); } static void test_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) { gpointer* data; gpointer object; data = user_data; object = data[0]; if (strcmp (method_name, "TestVoid") == 0) { _dbus_test_test_void (object, parameters, invocation); } else if (strcmp (method_name, "TestInt") == 0) { _dbus_test_test_int (object, parameters, invocation); } else if (strcmp (method_name, "TestString") == 0) { _dbus_test_test_string (object, parameters, invocation); } else if (strcmp (method_name, "TestCancellable") == 0) { _dbus_test_test_cancellable (object, parameters, invocation); } else { g_object_unref (invocation); } } static GVariant* test_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) { gpointer* data; gpointer object; data = user_data; object = data[0]; return NULL; } static gboolean test_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) { gpointer* data; gpointer object; data = user_data; object = data[0]; return FALSE; } guint test_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) { guint result; gpointer *data; data = g_new (gpointer, 3); data[0] = g_object_ref (object); data[1] = g_object_ref (connection); data[2] = g_strdup (path); result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error); if (!result) { return 0; } return result; } static void _test_unregister_object (gpointer user_data) { gpointer* data; data = user_data; g_object_unref (data[0]); g_object_unref (data[1]); g_free (data[2]); g_free (data); } void client_exit (GPid pid, gint status) { GMainLoop* _tmp0_; _vala_assert (status == 0, "status == 0"); _tmp0_ = main_loop; g_main_loop_quit (_tmp0_); } static guint _variant_get1 (GVariant* value) { return g_variant_get_uint32 (value); } static void _client_exit_gchild_watch_func (GPid pid, gint wait_status, gpointer self) { client_exit (pid, wait_status); } static void _vala_main (void) { GDBusConnection* conn = NULL; GDBusConnection* _tmp0_; GDBusConnection* _tmp1_; Test* _tmp2_; Test* _tmp3_; GVariant* request_result = NULL; GDBusConnection* _tmp4_; GVariant* _tmp5_; GVariant* _tmp6_; GVariant* _tmp7_; GVariant* _tmp8_; GVariant* _tmp9_; GVariant* _tmp10_; GVariant* _tmp11_; guint _tmp12_; GPid client_pid = 0; gchar* _tmp13_; gchar** _tmp14_; gchar** _tmp15_; gint _tmp15__length1; GPid _tmp16_ = 0; GMainLoop* _tmp17_; GMainLoop* _tmp18_; GError* _inner_error0_ = NULL; _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_); conn = _tmp0_; if (G_UNLIKELY (_inner_error0_ != NULL)) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); g_clear_error (&_inner_error0_); return; } _tmp1_ = conn; _tmp2_ = test_new (); _tmp3_ = _tmp2_; test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_); _g_object_unref0 (_tmp3_); if (G_UNLIKELY (_inner_error0_ != NULL)) { _g_object_unref0 (conn); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); g_clear_error (&_inner_error0_); return; } _tmp4_ = conn; _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL); g_variant_ref_sink (_tmp5_); _tmp6_ = _tmp5_; _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_); _tmp8_ = _tmp7_; _g_variant_unref0 (_tmp6_); request_result = _tmp8_; if (G_UNLIKELY (_inner_error0_ != NULL)) { _g_object_unref0 (conn); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); g_clear_error (&_inner_error0_); return; } _tmp9_ = request_result; _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0); _tmp11_ = _tmp10_; _tmp12_ = _variant_get1 (_tmp11_); _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1"); _g_variant_unref0 (_tmp11_); _tmp13_ = g_strdup ("dbus_async_errors_client"); _tmp14_ = g_new0 (gchar*, 1 + 1); _tmp14_[0] = _tmp13_; _tmp15_ = _tmp14_; _tmp15__length1 = 1; g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_); client_pid = _tmp16_; _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL); if (G_UNLIKELY (_inner_error0_ != NULL)) { _g_variant_unref0 (request_result); _g_object_unref0 (conn); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); g_clear_error (&_inner_error0_); return; } g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, NULL); _tmp17_ = g_main_loop_new (NULL, FALSE); _g_main_loop_unref0 (main_loop); main_loop = _tmp17_; _tmp18_ = main_loop; g_main_loop_run (_tmp18_); _g_variant_unref0 (request_result); _g_object_unref0 (conn); } int main (int argc, char ** argv) { _vala_main (); return 0; } static void _vala_array_destroy (gpointer array, gssize array_length, GDestroyNotify destroy_func) { if ((array != NULL) && (destroy_func != NULL)) { gssize i; for (i = 0; i < array_length; i = i + 1) { if (((gpointer*) array)[i] != NULL) { destroy_func (((gpointer*) array)[i]); } } } } static void _vala_array_free (gpointer array, gssize array_length, GDestroyNotify destroy_func) { _vala_array_destroy (array, array_length, destroy_func); g_free (array); }