diff options
Diffstat (limited to 'tests/dbus/structs_client.c-expected')
-rw-r--r-- | tests/dbus/structs_client.c-expected | 718 |
1 files changed, 718 insertions, 0 deletions
diff --git a/tests/dbus/structs_client.c-expected b/tests/dbus/structs_client.c-expected new file mode 100644 index 000000000..91c61053a --- /dev/null +++ b/tests/dbus/structs_client.c-expected @@ -0,0 +1,718 @@ +/* dbus_structs_client.c generated by valac, the Vala compiler + * generated from dbus_structs_client.vala, do not modify */ + +#include <glib-object.h> +#include <glib.h> +#include <stdlib.h> +#include <string.h> +#include <gio/gio.h> + +#if !defined(VALA_EXTERN) +#if defined(_MSC_VER) +#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_FOO_STRUCT (foo_struct_get_type ()) +typedef struct _FooStruct FooStruct; +#define _g_free0(var) (var = (g_free (var), NULL)) + +#define TYPE_TEST (test_get_type ()) +#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test)) +#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST)) +#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface)) + +typedef struct _Test Test; +typedef struct _TestIface TestIface; + +#define TYPE_TEST_PROXY (test_proxy_get_type ()) +typedef GDBusProxy TestProxy; +typedef GDBusProxyClass TestProxyClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_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 _FooStruct { + gint i; + gchar* s; +}; + +struct _TestIface { + GTypeInterface parent_iface; + void (*test_struct) (Test* self, FooStruct* f, FooStruct* g, FooStruct* result, GError** error); + void (*get_test_property) (Test* self, FooStruct * result); + void (*set_test_property) (Test* self, FooStruct * value); +}; + +VALA_EXTERN GType foo_struct_get_type (void) G_GNUC_CONST ; +VALA_EXTERN FooStruct* foo_struct_dup (const FooStruct* self); +VALA_EXTERN void foo_struct_free (FooStruct* self); +VALA_EXTERN void foo_struct_copy (const FooStruct* self, + FooStruct* dest); +VALA_EXTERN void foo_struct_destroy (FooStruct* self); +VALA_EXTERN void foo_struct_init (FooStruct *self, + gint i, + const gchar* s); +VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ; +VALA_EXTERN guint test_register_object (void* object, + GDBusConnection* connection, + const gchar* path, + GError** error); +VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ; +VALA_EXTERN void test_test_struct (Test* self, + FooStruct* f, + FooStruct* g, + FooStruct* result, + GError** error); +VALA_EXTERN void test_get_test_property (Test* self, + FooStruct * result); +VALA_EXTERN void test_set_test_property (Test* self, + FooStruct * value); +static GType test_get_type_once (void); +static void test_proxy_g_signal (GDBusProxy* proxy, + const gchar* sender_name, + const gchar* signal_name, + GVariant* parameters); +static void test_proxy_test_struct (Test* self, + FooStruct* f, + FooStruct* g, + FooStruct* result, + GError** error); +static void test_dbus_proxy_get_test_property (Test* self, + FooStruct* result); +static void test_dbus_proxy_set_test_property (Test* self, + FooStruct* value); +static void test_proxy_test_interface_init (TestIface* iface); +static void _dbus_test_test_struct (Test* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation); +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 GVariant* _dbus_test_get_test_property (Test* self); +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 _dbus_test_set_test_property (Test* self, + GVariant* _value); +static void _test_unregister_object (gpointer user_data); +static void _vala_main (void); + +static const GDBusArgInfo _test_dbus_arg_info_test_struct_f = {-1, "f", "(is)", NULL}; +static const GDBusArgInfo _test_dbus_arg_info_test_struct_g = {-1, "g", "(is)", NULL}; +static const GDBusArgInfo _test_dbus_arg_info_test_struct_result = {-1, "result", "(is)", NULL}; +static const GDBusArgInfo * const _test_dbus_arg_info_test_struct_in[] = {&_test_dbus_arg_info_test_struct_f, NULL}; +static const GDBusArgInfo * const _test_dbus_arg_info_test_struct_out[] = {&_test_dbus_arg_info_test_struct_g, &_test_dbus_arg_info_test_struct_result, NULL}; +static const GDBusMethodInfo _test_dbus_method_info_test_struct = {-1, "TestStruct", (GDBusArgInfo **) (&_test_dbus_arg_info_test_struct_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_struct_out), NULL}; +static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_struct, NULL}; +static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL}; +static const GDBusPropertyInfo _test_dbus_property_info_test_property = {-1, "TestProperty", "(is)", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL}; +static const GDBusPropertyInfo * const _test_dbus_property_info[] = {&_test_dbus_property_info_test_property, 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}; + +void +foo_struct_init (FooStruct *self, + gint i, + const gchar* s) +{ + gchar* _tmp0_; + g_return_if_fail (s != NULL); + memset (self, 0, sizeof (FooStruct)); + (*self).i = i; + _tmp0_ = g_strdup (s); + _g_free0 ((*self).s); + (*self).s = _tmp0_; +} + +void +foo_struct_copy (const FooStruct* self, + FooStruct* dest) +{ + const gchar* _tmp0_; + gchar* _tmp1_; + (*dest).i = (*self).i; + _tmp0_ = (*self).s; + _tmp1_ = g_strdup (_tmp0_); + _g_free0 ((*dest).s); + (*dest).s = _tmp1_; +} + +void +foo_struct_destroy (FooStruct* self) +{ + _g_free0 ((*self).s); +} + +FooStruct* +foo_struct_dup (const FooStruct* self) +{ + FooStruct* dup; + dup = g_new0 (FooStruct, 1); + foo_struct_copy (self, dup); + return dup; +} + +void +foo_struct_free (FooStruct* self) +{ + foo_struct_destroy (self); + g_free (self); +} + +static GType +foo_struct_get_type_once (void) +{ + GType foo_struct_type_id; + foo_struct_type_id = g_boxed_type_register_static ("FooStruct", (GBoxedCopyFunc) foo_struct_dup, (GBoxedFreeFunc) foo_struct_free); + return foo_struct_type_id; +} + +GType +foo_struct_get_type (void) +{ + static volatile gsize foo_struct_type_id__volatile = 0; + if (g_once_init_enter (&foo_struct_type_id__volatile)) { + GType foo_struct_type_id; + foo_struct_type_id = foo_struct_get_type_once (); + g_once_init_leave (&foo_struct_type_id__volatile, foo_struct_type_id); + } + return foo_struct_type_id__volatile; +} + +void +test_test_struct (Test* self, + FooStruct* f, + FooStruct* g, + FooStruct* result, + GError** error) +{ + TestIface* _iface_; + g_return_if_fail (IS_TEST (self)); + _iface_ = TEST_GET_INTERFACE (self); + if (_iface_->test_struct) { + _iface_->test_struct (self, f, g, result, error); + } +} + +void +test_get_test_property (Test* self, + FooStruct * result) +{ + TestIface* _iface_; + g_return_if_fail (IS_TEST (self)); + _iface_ = TEST_GET_INTERFACE (self); + if (_iface_->get_test_property) { + _iface_->get_test_property (self, result); + } + return; +} + +void +test_set_test_property (Test* self, + FooStruct * value) +{ + TestIface* _iface_; + g_return_if_fail (IS_TEST (self)); + _iface_ = TEST_GET_INTERFACE (self); + if (_iface_->set_test_property) { + _iface_->set_test_property (self, value); + } +} + +static void +test_default_init (TestIface * iface, + gpointer iface_data) +{ +} + +static GType +test_get_type_once (void) +{ + static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType test_type_id; + test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0); + g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT); + g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) test_proxy_get_type); + g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.example.Test"); + g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_test_dbus_interface_info)); + 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__volatile = 0; + if (g_once_init_enter (&test_type_id__volatile)) { + GType test_type_id; + test_type_id = test_get_type_once (); + g_once_init_leave (&test_type_id__volatile, test_type_id); + } + return test_type_id__volatile; +} + +G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, test_proxy_test_interface_init) ) +static void +test_proxy_class_init (TestProxyClass* klass) +{ + G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal; +} + +static void +test_proxy_g_signal (GDBusProxy* proxy, + const gchar* sender_name, + const gchar* signal_name, + GVariant* parameters) +{ +} + +static void +test_proxy_init (TestProxy* self) +{ + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) (&_test_dbus_interface_info)); +} + +static void +test_proxy_test_struct (Test* self, + FooStruct* f, + FooStruct* g, + FooStruct* result, + GError** error) +{ + GDBusMessage *_message; + GVariant *_arguments; + GVariantBuilder _arguments_builder; + GVariantBuilder _tmp0_; + GDBusMessage *_reply_message; + GVariant *_reply; + GVariantIter _reply_iter; + FooStruct _vala_g = {0}; + GVariant* _tmp1_; + FooStruct _tmp2_; + GVariantIter _tmp3_; + GVariant* _tmp4_; + GVariant* _tmp5_; + GVariant* _tmp6_; + FooStruct _tmp7_; + GVariantIter _tmp8_; + GVariant* _tmp9_; + GVariant* _tmp10_; + G_IO_ERROR; + _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestStruct"); + g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE); + g_variant_builder_init (&_tmp0_, G_VARIANT_TYPE_TUPLE); + g_variant_builder_add_value (&_tmp0_, g_variant_new_int32 ((*f).i)); + g_variant_builder_add_value (&_tmp0_, g_variant_new_string ((*f).s)); + g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp0_)); + _arguments = g_variant_builder_end (&_arguments_builder); + g_dbus_message_set_body (_message, _arguments); + _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, error); + g_object_unref (_message); + if (!_reply_message) { + return; + } + if (g_dbus_message_to_gerror (_reply_message, error)) { + g_object_unref (_reply_message); + return; + } + _reply = g_dbus_message_get_body (_reply_message); + g_variant_iter_init (&_reply_iter, _reply); + _tmp1_ = g_variant_iter_next_value (&_reply_iter); + g_variant_iter_init (&_tmp3_, _tmp1_); + _tmp4_ = g_variant_iter_next_value (&_tmp3_); + _tmp2_.i = g_variant_get_int32 (_tmp4_); + g_variant_unref (_tmp4_); + _tmp5_ = g_variant_iter_next_value (&_tmp3_); + _tmp2_.s = g_variant_dup_string (_tmp5_, NULL); + g_variant_unref (_tmp5_); + _vala_g = _tmp2_; + g_variant_unref (_tmp1_); + *g = _vala_g; + _tmp6_ = g_variant_iter_next_value (&_reply_iter); + g_variant_iter_init (&_tmp8_, _tmp6_); + _tmp9_ = g_variant_iter_next_value (&_tmp8_); + _tmp7_.i = g_variant_get_int32 (_tmp9_); + g_variant_unref (_tmp9_); + _tmp10_ = g_variant_iter_next_value (&_tmp8_); + _tmp7_.s = g_variant_dup_string (_tmp10_, NULL); + g_variant_unref (_tmp10_); + *result = _tmp7_; + g_variant_unref (_tmp6_); + g_object_unref (_reply_message); +} + +static void +test_dbus_proxy_get_test_property (Test* self, + FooStruct* result) +{ + GVariant *_inner_reply; + FooStruct _tmp11_; + GVariantIter _tmp12_; + GVariant* _tmp13_; + GVariant* _tmp14_; + _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "TestProperty"); + if (!_inner_reply) { + GVariant *_arguments; + GVariant *_reply; + GVariantBuilder _arguments_builder; + g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE); + g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test")); + g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestProperty")); + _arguments = g_variant_builder_end (&_arguments_builder); + _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL); + if (!_reply) { + return; + } + g_variant_get (_reply, "(v)", &_inner_reply); + g_variant_unref (_reply); + } + g_variant_iter_init (&_tmp12_, _inner_reply); + _tmp13_ = g_variant_iter_next_value (&_tmp12_); + _tmp11_.i = g_variant_get_int32 (_tmp13_); + g_variant_unref (_tmp13_); + _tmp14_ = g_variant_iter_next_value (&_tmp12_); + _tmp11_.s = g_variant_dup_string (_tmp14_, NULL); + g_variant_unref (_tmp14_); + *result = _tmp11_; + g_variant_unref (_inner_reply); + return; +} + +static void +test_dbus_proxy_set_test_property (Test* self, + FooStruct* value) +{ + GVariant *_arguments; + GVariant *_reply; + GVariantBuilder _arguments_builder; + GVariantBuilder _tmp15_; + g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE); + g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test")); + g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestProperty")); + g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT); + g_variant_builder_init (&_tmp15_, G_VARIANT_TYPE_TUPLE); + g_variant_builder_add_value (&_tmp15_, g_variant_new_int32 ((*value).i)); + g_variant_builder_add_value (&_tmp15_, g_variant_new_string ((*value).s)); + g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp15_)); + g_variant_builder_close (&_arguments_builder); + _arguments = g_variant_builder_end (&_arguments_builder); + _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL); + if (!_reply) { + return; + } + g_variant_unref (_reply); +} + +static void +test_proxy_test_interface_init (TestIface* iface) +{ + iface->test_struct = test_proxy_test_struct; + iface->get_test_property = test_dbus_proxy_get_test_property; + iface->set_test_property = test_dbus_proxy_set_test_property; +} + +static void +_dbus_test_test_struct (Test* self, + GVariant* _parameters_, + GDBusMethodInvocation* invocation) +{ + GError* error = NULL; + GVariantIter _arguments_iter; + FooStruct f = {0}; + GVariant* _tmp16_; + FooStruct _tmp17_; + GVariantIter _tmp18_; + GVariant* _tmp19_; + GVariant* _tmp20_; + GDBusMessage* _reply_message = NULL; + GVariant* _reply; + GVariantBuilder _reply_builder; + FooStruct g = {0}; + GVariantBuilder _tmp21_; + FooStruct result = {0}; + GVariantBuilder _tmp22_; + g_variant_iter_init (&_arguments_iter, _parameters_); + _tmp16_ = g_variant_iter_next_value (&_arguments_iter); + g_variant_iter_init (&_tmp18_, _tmp16_); + _tmp19_ = g_variant_iter_next_value (&_tmp18_); + _tmp17_.i = g_variant_get_int32 (_tmp19_); + g_variant_unref (_tmp19_); + _tmp20_ = g_variant_iter_next_value (&_tmp18_); + _tmp17_.s = g_variant_dup_string (_tmp20_, NULL); + g_variant_unref (_tmp20_); + f = _tmp17_; + g_variant_unref (_tmp16_); + test_test_struct (self, &f, &g, &result, &error); + if (error) { + g_dbus_method_invocation_return_gerror (invocation, error); + g_error_free (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_init (&_tmp21_, G_VARIANT_TYPE_TUPLE); + g_variant_builder_add_value (&_tmp21_, g_variant_new_int32 (g.i)); + g_variant_builder_add_value (&_tmp21_, g_variant_new_string (g.s)); + g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp21_)); + g_variant_builder_init (&_tmp22_, G_VARIANT_TYPE_TUPLE); + g_variant_builder_add_value (&_tmp22_, g_variant_new_int32 (result.i)); + g_variant_builder_add_value (&_tmp22_, g_variant_new_string (result.s)); + g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp22_)); + foo_struct_destroy (&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: + foo_struct_destroy (&f); + foo_struct_destroy (&g); + ; +} + +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, "TestStruct") == 0) { + _dbus_test_test_struct (object, parameters, invocation); + } else { + g_object_unref (invocation); + } +} + +static GVariant* +_dbus_test_get_test_property (Test* self) +{ + FooStruct result = {0}; + GVariant* _reply; + GVariantBuilder _tmp23_; + test_get_test_property (self, &result); + g_variant_builder_init (&_tmp23_, G_VARIANT_TYPE_TUPLE); + g_variant_builder_add_value (&_tmp23_, g_variant_new_int32 (result.i)); + g_variant_builder_add_value (&_tmp23_, g_variant_new_string (result.s)); + _reply = g_variant_builder_end (&_tmp23_); + foo_struct_destroy (&result); + return _reply; +} + +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]; + if (strcmp (property_name, "TestProperty") == 0) { + return _dbus_test_get_test_property (object); + } + return NULL; +} + +static void +_dbus_test_set_test_property (Test* self, + GVariant* _value) +{ + FooStruct value = {0}; + FooStruct _tmp24_; + GVariantIter _tmp25_; + GVariant* _tmp26_; + GVariant* _tmp27_; + g_variant_iter_init (&_tmp25_, _value); + _tmp26_ = g_variant_iter_next_value (&_tmp25_); + _tmp24_.i = g_variant_get_int32 (_tmp26_); + g_variant_unref (_tmp26_); + _tmp27_ = g_variant_iter_next_value (&_tmp25_); + _tmp24_.s = g_variant_dup_string (_tmp27_, NULL); + g_variant_unref (_tmp27_); + value = _tmp24_; + test_set_test_property (self, &value); + foo_struct_destroy (&value); +} + +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]; + if (strcmp (property_name, "TestProperty") == 0) { + _dbus_test_set_test_property (object, value); + return TRUE; + } + 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); +} + +static void +_vala_main (void) +{ + Test* test = NULL; + Test* _tmp0_; + FooStruct f = {0}; + FooStruct g = {0}; + FooStruct h = {0}; + FooStruct _tmp1_ = {0}; + Test* _tmp2_; + FooStruct _tmp3_; + FooStruct _tmp4_ = {0}; + FooStruct _tmp5_ = {0}; + FooStruct _tmp6_; + FooStruct _tmp7_; + FooStruct _tmp8_; + const gchar* _tmp9_; + FooStruct _tmp10_; + FooStruct _tmp11_; + const gchar* _tmp12_; + Test* _tmp13_; + FooStruct _tmp14_; + Test* _tmp15_; + FooStruct _tmp16_ = {0}; + FooStruct _tmp17_; + FooStruct _tmp18_; + FooStruct _tmp19_; + const gchar* _tmp20_; + GError* _inner_error0_ = NULL; + _tmp0_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", "org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/test", "g-interface-name", "org.example.Test", NULL); + test = (Test*) _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; + } + foo_struct_destroy (&f); + foo_struct_init (&f, 42, "hello"); + _tmp2_ = test; + _tmp3_ = f; + test_test_struct (_tmp2_, &_tmp3_, &_tmp4_, &_tmp5_, &_inner_error0_); + foo_struct_destroy (&g); + g = _tmp4_; + _tmp1_ = _tmp5_; + if (G_UNLIKELY (_inner_error0_ != NULL)) { + foo_struct_destroy (&h); + foo_struct_destroy (&g); + foo_struct_destroy (&f); + _g_object_unref0 (test); + 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; + } + _tmp6_ = _tmp1_; + memset (&_tmp1_, 0, sizeof (FooStruct)); + foo_struct_destroy (&h); + h = _tmp6_; + _tmp7_ = g; + _vala_assert (_tmp7_.i == 23, "g.i == 23"); + _tmp8_ = g; + _tmp9_ = _tmp8_.s; + _vala_assert (g_strcmp0 (_tmp9_, "world") == 0, "g.s == \"world\""); + _tmp10_ = h; + _vala_assert (_tmp10_.i == 11, "h.i == 11"); + _tmp11_ = h; + _tmp12_ = _tmp11_.s; + _vala_assert (g_strcmp0 (_tmp12_, "vala") == 0, "h.s == \"vala\""); + _tmp13_ = test; + _tmp14_ = f; + test_set_test_property (_tmp13_, &_tmp14_); + _tmp15_ = test; + test_get_test_property (_tmp15_, &_tmp16_); + _tmp17_ = _tmp16_; + foo_struct_destroy (&g); + g = _tmp17_; + _tmp18_ = g; + _vala_assert (_tmp18_.i == 42, "g.i == 42"); + _tmp19_ = g; + _tmp20_ = _tmp19_.s; + _vala_assert (g_strcmp0 (_tmp20_, "hello") == 0, "g.s == \"hello\""); + foo_struct_destroy (&_tmp1_); + foo_struct_destroy (&h); + foo_struct_destroy (&g); + foo_struct_destroy (&f); + _g_object_unref0 (test); +} + +int +main (int argc, + char ** argv) +{ + _vala_main (); + return 0; +} + |