/* dbus_arrays_server.c generated by valac, the Vala compiler * generated from dbus_arrays_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_TEST_PROPERTY_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))) #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 _TestPrivate { gchar** _test_property; gint _test_property_length1; gint __test_property_size_; }; static gint Test_private_offset; 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); VALA_EXTERN gint* test_test_int (Test* self, gint* i, gint i_length1, gint** j, gint* j_length1, gint* result_length1); VALA_EXTERN gchar** test_test_string (Test* self, gchar** s, gint s_length1, gchar*** t, gint* t_length1, gint* result_length1); VALA_EXTERN Test* test_new (void); VALA_EXTERN Test* test_construct (GType object_type); VALA_EXTERN gchar** test_get_test_property (Test* self, gint* result_length1); static gchar** _vala_array_dup1 (gchar** self, gssize length); VALA_EXTERN void test_set_test_property (Test* self, gchar** value, gint value_length1); static gchar** _vala_array_dup2 (gchar** self, gssize length); static void test_finalize (GObject * obj); static GType test_get_type_once (void); static void _vala_test_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); static void _vala_test_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); static void _dbus_test_test_int (Test* self, GVariant* _parameters_, GDBusMethodInvocation* invocation); static void _dbus_test_test_string (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); 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 _test_dbus_arg_info_test_int_i = {-1, "i", "ai", NULL}; static const GDBusArgInfo _test_dbus_arg_info_test_int_j = {-1, "j", "ai", NULL}; static const GDBusArgInfo _test_dbus_arg_info_test_int_result = {-1, "result", "ai", 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", "as", NULL}; static const GDBusArgInfo _test_dbus_arg_info_test_string_t = {-1, "t", "as", NULL}; static const GDBusArgInfo _test_dbus_arg_info_test_string_result = {-1, "result", "as", 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 GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_int, &_test_dbus_method_info_test_string, NULL}; static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL}; static const GDBusPropertyInfo _test_dbus_property_info_test_property = {-1, "TestProperty", "as", 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}; static inline gpointer test_get_instance_private (Test* self) { return G_STRUCT_MEMBER_P (self, Test_private_offset); } gint* test_test_int (Test* self, gint* i, gint i_length1, gint** j, gint* j_length1, gint* result_length1) { gint* _vala_j = NULL; gint _vala_j_length1 = 0; gboolean _tmp0_ = FALSE; gint* _tmp2_; gint* _tmp3_; gint* _tmp4_; gint _tmp4__length1; gint* result; g_return_val_if_fail (IS_TEST (self), NULL); if (i_length1 == 1) { gint _tmp1_; _tmp1_ = i[0]; _tmp0_ = _tmp1_ == 42; } else { _tmp0_ = FALSE; } _vala_assert (_tmp0_, "i.length == 1 && i[0] == 42"); _tmp2_ = g_new0 (gint, 1); _tmp2_[0] = 23; _vala_j = (g_free (_vala_j), NULL); _vala_j = _tmp2_; _vala_j_length1 = 1; _tmp3_ = g_new0 (gint, 1); _tmp3_[0] = 11; _tmp4_ = _tmp3_; _tmp4__length1 = 1; if (result_length1) { *result_length1 = _tmp4__length1; } result = _tmp4_; if (j) { *j = _vala_j; } else { _vala_j = (g_free (_vala_j), NULL); } if (j_length1) { *j_length1 = _vala_j_length1; } return result; } gchar** test_test_string (Test* self, gchar** s, gint s_length1, gchar*** t, gint* t_length1, gint* result_length1) { gchar** _vala_t = NULL; gint _vala_t_length1 = 0; gboolean _tmp0_ = FALSE; gchar* _tmp2_; gchar** _tmp3_; gchar* _tmp4_; gchar** _tmp5_; gchar** _tmp6_; gint _tmp6__length1; gchar** result; g_return_val_if_fail (IS_TEST (self), NULL); if (s_length1 == 1) { const gchar* _tmp1_; _tmp1_ = s[0]; _tmp0_ = g_strcmp0 (_tmp1_, "hello") == 0; } else { _tmp0_ = FALSE; } _vala_assert (_tmp0_, "s.length == 1 && s[0] == \"hello\""); _tmp2_ = g_strdup ("world"); _tmp3_ = g_new0 (gchar*, 1 + 1); _tmp3_[0] = _tmp2_; _vala_t = (_vala_array_free (_vala_t, _vala_t_length1, (GDestroyNotify) g_free), NULL); _vala_t = _tmp3_; _vala_t_length1 = 1; _tmp4_ = g_strdup ("vala"); _tmp5_ = g_new0 (gchar*, 1 + 1); _tmp5_[0] = _tmp4_; _tmp6_ = _tmp5_; _tmp6__length1 = 1; if (result_length1) { *result_length1 = _tmp6__length1; } result = _tmp6_; if (t) { *t = _vala_t; } else { _vala_t = (_vala_array_free (_vala_t, _vala_t_length1, (GDestroyNotify) g_free), NULL); } if (t_length1) { *t_length1 = _vala_t_length1; } return result; } 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 gchar** _vala_array_dup1 (gchar** self, gssize length) { if (length >= 0) { gchar** result; gssize i; result = g_new0 (gchar*, length + 1); for (i = 0; i < length; i++) { gchar* _tmp0_; _tmp0_ = g_strdup (self[i]); result[i] = _tmp0_; } return result; } return NULL; } gchar** test_get_test_property (Test* self, gint* result_length1) { gchar** result; gchar** _tmp0_; gint _tmp0__length1; gchar** _tmp1_; gint _tmp1__length1; gchar** _tmp2_; gint _tmp2__length1; g_return_val_if_fail (IS_TEST (self), NULL); _tmp0_ = self->priv->_test_property; _tmp0__length1 = self->priv->_test_property_length1; _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup1 (_tmp0_, _tmp0__length1) : _tmp0_; _tmp1__length1 = _tmp0__length1; _tmp2_ = _tmp1_; _tmp2__length1 = _tmp1__length1; if (result_length1) { *result_length1 = _tmp2__length1; } result = _tmp2_; return result; } static gchar** _vala_array_dup2 (gchar** self, gssize length) { if (length >= 0) { gchar** result; gssize i; result = g_new0 (gchar*, length + 1); for (i = 0; i < length; i++) { gchar* _tmp0_; _tmp0_ = g_strdup (self[i]); result[i] = _tmp0_; } return result; } return NULL; } void test_set_test_property (Test* self, gchar** value, gint value_length1) { gchar** old_value; gint old_value_length; g_return_if_fail (IS_TEST (self)); old_value = test_get_test_property (self, &old_value_length); if (old_value != value) { gchar** _tmp0_; gint _tmp0__length1; _tmp0_ = (value != NULL) ? _vala_array_dup2 (value, value_length1) : value; _tmp0__length1 = value_length1; self->priv->_test_property = (_vala_array_free (self->priv->_test_property, self->priv->_test_property_length1, (GDestroyNotify) g_free), NULL); self->priv->_test_property = _tmp0_; self->priv->_test_property_length1 = _tmp0__length1; self->priv->__test_property_size_ = self->priv->_test_property_length1; g_object_notify_by_pspec ((GObject *) self, test_properties[TEST_TEST_PROPERTY_PROPERTY]); } old_value = (_vala_array_free (old_value, old_value_length, (GDestroyNotify) g_free), NULL); } static void test_class_init (TestClass * klass, gpointer klass_data) { test_parent_class = g_type_class_peek_parent (klass); g_type_class_adjust_private_offset (klass, &Test_private_offset); G_OBJECT_CLASS (klass)->get_property = _vala_test_get_property; G_OBJECT_CLASS (klass)->set_property = _vala_test_set_property; G_OBJECT_CLASS (klass)->finalize = test_finalize; g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_TEST_PROPERTY_PROPERTY, test_properties[TEST_TEST_PROPERTY_PROPERTY] = g_param_spec_boxed ("test-property", "test-property", "test-property", G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); } static void test_instance_init (Test * self, gpointer klass) { self->priv = test_get_instance_private (self); } static void test_finalize (GObject * obj) { Test * self; self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST, Test); self->priv->_test_property = (_vala_array_free (self->priv->_test_property, self->priv->_test_property_length1, (GDestroyNotify) g_free), NULL); G_OBJECT_CLASS (test_parent_class)->finalize (obj); } 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); Test_private_offset = g_type_add_instance_private (test_type_id, sizeof (TestPrivate)); 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 _vala_test_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { Test * self; self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test); switch (property_id) { case TEST_TEST_PROPERTY_PROPERTY: { int length; g_value_take_boxed (value, test_get_test_property (self, &length)); } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void _vala_test_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { Test * self; self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test); switch (property_id) { case TEST_TEST_PROPERTY_PROPERTY: { gpointer boxed; boxed = g_value_get_boxed (value); test_set_test_property (self, boxed, (boxed == NULL) ? 0 : g_strv_length (boxed)); } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void _dbus_test_test_int (Test* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) { GError* error = NULL; GVariantIter _arguments_iter; gint* i = NULL; gint i_length1 = 0; GVariant* _tmp0_; gint* _tmp1_; gint _tmp1__length; gint _tmp1__size; gint _tmp1__length1; GVariantIter _tmp2_; GVariant* _tmp3_; GDBusMessage* _reply_message = NULL; GVariant* _reply; GVariantBuilder _reply_builder; gint* j = NULL; gint j_length1 = 0; gint* _tmp4_; GVariantBuilder _tmp5_; gint _tmp6_; gint* result; gint result_length1 = 0; gint* _tmp7_; GVariantBuilder _tmp8_; gint _tmp9_; g_variant_iter_init (&_arguments_iter, _parameters_); _tmp0_ = g_variant_iter_next_value (&_arguments_iter); _tmp1_ = g_new (gint, 5); _tmp1__length = 0; _tmp1__size = 4; _tmp1__length1 = 0; g_variant_iter_init (&_tmp2_, _tmp0_); for (; (_tmp3_ = g_variant_iter_next_value (&_tmp2_)) != NULL; _tmp1__length1++) { if (_tmp1__size == _tmp1__length) { _tmp1__size = 2 * _tmp1__size; _tmp1_ = g_renew (gint, _tmp1_, _tmp1__size + 1); } _tmp1_[_tmp1__length++] = g_variant_get_int32 (_tmp3_); g_variant_unref (_tmp3_); } i_length1 = _tmp1__length1; i = _tmp1_; g_variant_unref (_tmp0_); result = test_test_int (self, i, i_length1, &j, &j_length1, &result_length1); _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); _tmp4_ = j; g_variant_builder_init (&_tmp5_, G_VARIANT_TYPE ("ai")); for (_tmp6_ = 0; _tmp6_ < j_length1; _tmp6_++) { g_variant_builder_add_value (&_tmp5_, g_variant_new_int32 (*_tmp4_)); _tmp4_++; } g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp5_)); _tmp7_ = result; g_variant_builder_init (&_tmp8_, G_VARIANT_TYPE ("ai")); for (_tmp9_ = 0; _tmp9_ < result_length1; _tmp9_++) { g_variant_builder_add_value (&_tmp8_, g_variant_new_int32 (*_tmp7_)); _tmp7_++; } g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp8_)); result = (g_free (result), NULL); _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); i = (g_free (i), NULL); j = (g_free (j), NULL); } static void _dbus_test_test_string (Test* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) { GError* error = NULL; GVariantIter _arguments_iter; gchar** s = NULL; gint s_length1 = 0; GVariant* _tmp10_; gchar** _tmp11_; gint _tmp11__length; gint _tmp11__size; gint _tmp11__length1; GVariantIter _tmp12_; GVariant* _tmp13_; GDBusMessage* _reply_message = NULL; GVariant* _reply; GVariantBuilder _reply_builder; gchar** t = NULL; gint t_length1 = 0; gchar** _tmp14_; GVariantBuilder _tmp15_; gint _tmp16_; gchar** result; gint result_length1 = 0; gchar** _tmp17_; GVariantBuilder _tmp18_; gint _tmp19_; g_variant_iter_init (&_arguments_iter, _parameters_); _tmp10_ = g_variant_iter_next_value (&_arguments_iter); _tmp11_ = g_new (gchar*, 5); _tmp11__length = 0; _tmp11__size = 4; _tmp11__length1 = 0; g_variant_iter_init (&_tmp12_, _tmp10_); for (; (_tmp13_ = g_variant_iter_next_value (&_tmp12_)) != NULL; _tmp11__length1++) { if (_tmp11__size == _tmp11__length) { _tmp11__size = 2 * _tmp11__size; _tmp11_ = g_renew (gchar*, _tmp11_, _tmp11__size + 1); } _tmp11_[_tmp11__length++] = g_variant_dup_string (_tmp13_, NULL); g_variant_unref (_tmp13_); } s_length1 = _tmp11__length1; _tmp11_[_tmp11__length] = NULL; s = _tmp11_; g_variant_unref (_tmp10_); result = test_test_string (self, s, s_length1, &t, &t_length1, &result_length1); _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); _tmp14_ = t; g_variant_builder_init (&_tmp15_, G_VARIANT_TYPE ("as")); for (_tmp16_ = 0; _tmp16_ < t_length1; _tmp16_++) { g_variant_builder_add_value (&_tmp15_, g_variant_new_string (*_tmp14_)); _tmp14_++; } g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp15_)); _tmp17_ = result; g_variant_builder_init (&_tmp18_, G_VARIANT_TYPE ("as")); for (_tmp19_ = 0; _tmp19_ < result_length1; _tmp19_++) { g_variant_builder_add_value (&_tmp18_, g_variant_new_string (*_tmp17_)); _tmp17_++; } g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp18_)); result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL); _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); s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL); t = (_vala_array_free (t, t_length1, (GDestroyNotify) g_free), NULL); } 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, "TestInt") == 0) { _dbus_test_test_int (object, parameters, invocation); } else if (strcmp (method_name, "TestString") == 0) { _dbus_test_test_string (object, parameters, invocation); } else { g_object_unref (invocation); } } static GVariant* _dbus_test_get_test_property (Test* self) { gchar** result; gint result_length1 = 0; GVariant* _reply; gchar** _tmp20_; GVariantBuilder _tmp21_; gint _tmp22_; result = test_get_test_property (self, &result_length1); _tmp20_ = result; g_variant_builder_init (&_tmp21_, G_VARIANT_TYPE ("as")); for (_tmp22_ = 0; _tmp22_ < result_length1; _tmp22_++) { g_variant_builder_add_value (&_tmp21_, g_variant_new_string (*_tmp20_)); _tmp20_++; } _reply = g_variant_builder_end (&_tmp21_); result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL); 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) { gchar** value = NULL; gint value_length1; gchar** _tmp23_; gint _tmp23__length; gint _tmp23__size; gint _tmp23__length1; GVariantIter _tmp24_; GVariant* _tmp25_; _tmp23_ = g_new (gchar*, 5); _tmp23__length = 0; _tmp23__size = 4; _tmp23__length1 = 0; g_variant_iter_init (&_tmp24_, _value); for (; (_tmp25_ = g_variant_iter_next_value (&_tmp24_)) != NULL; _tmp23__length1++) { if (_tmp23__size == _tmp23__length) { _tmp23__size = 2 * _tmp23__size; _tmp23_ = g_renew (gchar*, _tmp23_, _tmp23__size + 1); } _tmp23_[_tmp23__length++] = g_variant_dup_string (_tmp25_, NULL); g_variant_unref (_tmp25_); } value_length1 = _tmp23__length1; _tmp23_[_tmp23__length] = NULL; value = _tmp23_; test_set_test_property (self, value, value_length1); value = (_vala_array_free (value, value_length1, (GDestroyNotify) g_free), 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]; 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); } 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_arrays_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); }