/* dbus_dicts_server.c generated by valac, the Vala compiler * generated from dbus_dicts_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_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) #define TEST_INTERFACE_TYPE_BAR (test_interface_bar_get_type ()) #define TEST_INTERFACE_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_INTERFACE_TYPE_BAR, TestInterfaceBar)) #define TEST_INTERFACE_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_INTERFACE_TYPE_BAR)) #define TEST_INTERFACE_BAR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TEST_INTERFACE_TYPE_BAR, TestInterfaceBarIface)) typedef struct _TestInterfaceBar TestInterfaceBar; typedef struct _TestInterfaceBarIface TestInterfaceBarIface; #define TEST_INTERFACE_TYPE_BAR_PROXY (test_interface_bar_proxy_get_type ()) typedef GDBusProxy TestInterfaceBarProxy; typedef GDBusProxyClass TestInterfaceBarProxyClass; #define TEST_INTERFACE_TYPE_FOO (test_interface_foo_get_type ()) #define TEST_INTERFACE_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_INTERFACE_TYPE_FOO, TestInterfaceFoo)) #define TEST_INTERFACE_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_INTERFACE_TYPE_FOO, TestInterfaceFooClass)) #define TEST_INTERFACE_IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_INTERFACE_TYPE_FOO)) #define TEST_INTERFACE_IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEST_INTERFACE_TYPE_FOO)) #define TEST_INTERFACE_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_INTERFACE_TYPE_FOO, TestInterfaceFooClass)) typedef struct _TestInterfaceFoo TestInterfaceFoo; typedef struct _TestInterfaceFooClass TestInterfaceFooClass; typedef struct _TestInterfaceFooPrivate TestInterfaceFooPrivate; enum { TEST_INTERFACE_FOO_0_PROPERTY, TEST_INTERFACE_FOO_NUM_PROPERTIES }; static GParamSpec* test_interface_foo_properties[TEST_INTERFACE_FOO_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 _TestInterfaceBarIface { GTypeInterface parent_iface; GHashTable* (*foo) (TestInterfaceBar* self, GError** error); }; struct _TestInterfaceFoo { GDBusProxy parent_instance; TestInterfaceFooPrivate * priv; }; struct _TestInterfaceFooClass { GDBusProxyClass parent_class; }; static gpointer test_parent_class = NULL; static gpointer test_interface_foo_parent_class = NULL; static TestInterfaceBarIface * test_interface_foo_test_interface_bar_parent_iface = 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 GHashTable* test_test_dict (Test* self); static void _g_free0_ (gpointer var); static void _g_variant_unref0_ (gpointer var); static GVariant* _variant_new1 (gchar** value, gint value_length1); 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_dict (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 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 GType test_interface_bar_proxy_get_type (void) G_GNUC_CONST ; VALA_EXTERN guint test_interface_bar_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error); VALA_EXTERN GType test_interface_bar_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (TestInterfaceBar, g_object_unref) VALA_EXTERN GHashTable* test_interface_bar_foo (TestInterfaceBar* self, GError** error); static GType test_interface_bar_get_type_once (void); static void test_interface_bar_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters); static GHashTable* test_interface_bar_proxy_foo (TestInterfaceBar* self, GError** error); static void test_interface_bar_proxy_test_interface_bar_interface_init (TestInterfaceBarIface* iface); static void _dbus_test_interface_bar_foo (TestInterfaceBar* self, GVariant* _parameters_, GDBusMethodInvocation* invocation); static void test_interface_bar_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_interface_bar_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_interface_bar_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_interface_bar_unregister_object (gpointer user_data); VALA_EXTERN GType test_interface_foo_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (TestInterfaceFoo, g_object_unref) static GHashTable* test_interface_foo_real_foo (TestInterfaceBar* base, GError** error); VALA_EXTERN TestInterfaceFoo* test_interface_foo_new (void); VALA_EXTERN TestInterfaceFoo* test_interface_foo_construct (GType object_type); static GType test_interface_foo_get_type_once (void); 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_dict_result = {-1, "result", "a{sv}", NULL}; static const GDBusArgInfo * const _test_dbus_arg_info_test_dict_in[] = {NULL}; static const GDBusArgInfo * const _test_dbus_arg_info_test_dict_out[] = {&_test_dbus_arg_info_test_dict_result, NULL}; static const GDBusMethodInfo _test_dbus_method_info_test_dict = {-1, "TestDict", (GDBusArgInfo **) (&_test_dbus_arg_info_test_dict_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_dict_out), NULL}; static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_dict, 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 const GDBusArgInfo _test_interface_bar_dbus_arg_info_foo_result = {-1, "result", "a{sv}", NULL}; static const GDBusArgInfo * const _test_interface_bar_dbus_arg_info_foo_in[] = {NULL}; static const GDBusArgInfo * const _test_interface_bar_dbus_arg_info_foo_out[] = {&_test_interface_bar_dbus_arg_info_foo_result, NULL}; static const GDBusMethodInfo _test_interface_bar_dbus_method_info_foo = {-1, "Foo", (GDBusArgInfo **) (&_test_interface_bar_dbus_arg_info_foo_in), (GDBusArgInfo **) (&_test_interface_bar_dbus_arg_info_foo_out), NULL}; static const GDBusMethodInfo * const _test_interface_bar_dbus_method_info[] = {&_test_interface_bar_dbus_method_info_foo, NULL}; static const GDBusSignalInfo * const _test_interface_bar_dbus_signal_info[] = {NULL}; static const GDBusPropertyInfo * const _test_interface_bar_dbus_property_info[] = {NULL}; static const GDBusInterfaceInfo _test_interface_bar_dbus_interface_info = {-1, "org.vala.Test.Bar", (GDBusMethodInfo **) (&_test_interface_bar_dbus_method_info), (GDBusSignalInfo **) (&_test_interface_bar_dbus_signal_info), (GDBusPropertyInfo **) (&_test_interface_bar_dbus_property_info), NULL}; static const GDBusInterfaceVTable _test_interface_bar_dbus_interface_vtable = {test_interface_bar_dbus_interface_method_call, test_interface_bar_dbus_interface_get_property, test_interface_bar_dbus_interface_set_property}; static void _g_free0_ (gpointer var) { var = (g_free (var), NULL); } static void _g_variant_unref0_ (gpointer var) { (var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)); } static GVariant* _variant_new1 (gchar** value, gint value_length1) { gchar** _tmp5_; GVariantBuilder _tmp6_; gint _tmp7_; _tmp5_ = value; g_variant_builder_init (&_tmp6_, G_VARIANT_TYPE ("as")); for (_tmp7_ = 0; _tmp7_ < value_length1; _tmp7_++) { g_variant_builder_add_value (&_tmp6_, g_variant_new_string (*_tmp5_)); _tmp5_++; } return g_variant_ref_sink (g_variant_builder_end (&_tmp6_)); } GHashTable* test_test_dict (Test* self) { gchar** s = NULL; gchar* _tmp0_; gchar** _tmp1_; gint s_length1; gint _s_size_; GHashTable* dict = NULL; GHashFunc _tmp2_; GHashTable* _tmp3_; gchar* _tmp4_; GVariant* _tmp8_; GHashTable* result; g_return_val_if_fail (IS_TEST (self), NULL); _tmp0_ = g_strdup ("hello"); _tmp1_ = g_new0 (gchar*, 1 + 1); _tmp1_[0] = _tmp0_; s = _tmp1_; s_length1 = 1; _s_size_ = s_length1; _tmp2_ = g_str_hash; _tmp3_ = g_hash_table_new_full (_tmp2_, NULL, _g_free0_, _g_variant_unref0_); dict = _tmp3_; _tmp4_ = g_strdup ("hello"); _tmp8_ = _variant_new1 (s, s_length1); g_hash_table_insert (dict, _tmp4_, _tmp8_); result = dict; s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL); 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 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_dict (Test* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) { GError* error = NULL; GVariantIter _arguments_iter; GDBusMessage* _reply_message = NULL; GVariant* _reply; GVariantBuilder _reply_builder; GHashTable* result; GVariantBuilder _tmp0_; GHashTableIter _tmp1_; gpointer _tmp2_; gpointer _tmp3_; g_variant_iter_init (&_arguments_iter, _parameters_); result = test_test_dict (self); _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_hash_table_iter_init (&_tmp1_, result); g_variant_builder_init (&_tmp0_, G_VARIANT_TYPE ("a{sv}")); while (g_hash_table_iter_next (&_tmp1_, &_tmp2_, &_tmp3_)) { gchar* _key; GVariant* _value; _key = (gchar*) _tmp2_; _value = (GVariant*) _tmp3_; g_variant_builder_add (&_tmp0_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value)); } g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp0_)); _g_hash_table_unref0 (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); } 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, "TestDict") == 0) { _dbus_test_test_dict (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); } GHashTable* test_interface_bar_foo (TestInterfaceBar* self, GError** error) { TestInterfaceBarIface* _iface_; g_return_val_if_fail (TEST_INTERFACE_IS_BAR (self), NULL); _iface_ = TEST_INTERFACE_BAR_GET_INTERFACE (self); if (_iface_->foo) { return _iface_->foo (self, error); } return NULL; } static void test_interface_bar_default_init (TestInterfaceBarIface * iface, gpointer iface_data) { } static GType test_interface_bar_get_type_once (void) { static const GTypeInfo g_define_type_info = { sizeof (TestInterfaceBarIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) test_interface_bar_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; GType test_interface_bar_type_id; test_interface_bar_type_id = g_type_register_static (G_TYPE_INTERFACE, "TestInterfaceBar", &g_define_type_info, 0); g_type_interface_add_prerequisite (test_interface_bar_type_id, G_TYPE_OBJECT); g_type_set_qdata (test_interface_bar_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) test_interface_bar_proxy_get_type); g_type_set_qdata (test_interface_bar_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.vala.Test.Bar"); g_type_set_qdata (test_interface_bar_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_test_interface_bar_dbus_interface_info)); g_type_set_qdata (test_interface_bar_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) test_interface_bar_register_object); return test_interface_bar_type_id; } GType test_interface_bar_get_type (void) { static volatile gsize test_interface_bar_type_id__once = 0; if (g_once_init_enter (&test_interface_bar_type_id__once)) { GType test_interface_bar_type_id; test_interface_bar_type_id = test_interface_bar_get_type_once (); g_once_init_leave (&test_interface_bar_type_id__once, test_interface_bar_type_id); } return test_interface_bar_type_id__once; } G_DEFINE_TYPE_EXTENDED (TestInterfaceBarProxy, test_interface_bar_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TEST_INTERFACE_TYPE_BAR, test_interface_bar_proxy_test_interface_bar_interface_init) ) static void test_interface_bar_proxy_class_init (TestInterfaceBarProxyClass* klass) { G_DBUS_PROXY_CLASS (klass)->g_signal = test_interface_bar_proxy_g_signal; } static void test_interface_bar_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) { } static void test_interface_bar_proxy_init (TestInterfaceBarProxy* self) { g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) (&_test_interface_bar_dbus_interface_info)); } static GHashTable* test_interface_bar_proxy_foo (TestInterfaceBar* self, GError** error) { GDBusMessage *_message; GVariant *_arguments; GVariantBuilder _arguments_builder; GDBusMessage *_reply_message; GVariant *_reply; GVariantIter _reply_iter; GHashTable* _result = NULL; GVariant* _tmp4_; GHashTable* _tmp5_; GVariantIter _tmp6_; GVariant* _tmp7_; GVariant* _tmp8_; 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.vala.Test.Bar", "Foo"); g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE); _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 NULL; } if (g_dbus_message_to_gerror (_reply_message, error)) { g_object_unref (_reply_message); return NULL; } _reply = g_dbus_message_get_body (_reply_message); g_variant_iter_init (&_reply_iter, _reply); _tmp4_ = g_variant_iter_next_value (&_reply_iter); _tmp5_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref); g_variant_iter_init (&_tmp6_, _tmp4_); while (g_variant_iter_loop (&_tmp6_, "{?*}", &_tmp7_, &_tmp8_)) { g_hash_table_insert (_tmp5_, g_variant_dup_string (_tmp7_, NULL), g_variant_get_variant (_tmp8_)); } _result = _tmp5_; g_variant_unref (_tmp4_); g_object_unref (_reply_message); return _result; } static void test_interface_bar_proxy_test_interface_bar_interface_init (TestInterfaceBarIface* iface) { iface->foo = test_interface_bar_proxy_foo; } static void _dbus_test_interface_bar_foo (TestInterfaceBar* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) { GError* error = NULL; GVariantIter _arguments_iter; GDBusMessage* _reply_message = NULL; GVariant* _reply; GVariantBuilder _reply_builder; GHashTable* result; GVariantBuilder _tmp9_; GHashTableIter _tmp10_; gpointer _tmp11_; gpointer _tmp12_; g_variant_iter_init (&_arguments_iter, _parameters_); result = test_interface_bar_foo (self, &error); if (error) { g_dbus_method_invocation_take_error (invocation, error); return; } _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_hash_table_iter_init (&_tmp10_, result); g_variant_builder_init (&_tmp9_, G_VARIANT_TYPE ("a{sv}")); while (g_hash_table_iter_next (&_tmp10_, &_tmp11_, &_tmp12_)) { gchar* _key; GVariant* _value; _key = (gchar*) _tmp11_; _value = (GVariant*) _tmp12_; g_variant_builder_add (&_tmp9_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value)); } g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp9_)); _g_hash_table_unref0 (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); } static void test_interface_bar_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, "Foo") == 0) { _dbus_test_interface_bar_foo (object, parameters, invocation); } else { g_object_unref (invocation); } } static GVariant* test_interface_bar_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_interface_bar_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_interface_bar_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_interface_bar_dbus_interface_info), &_test_interface_bar_dbus_interface_vtable, data, _test_interface_bar_unregister_object, error); if (!result) { return 0; } return result; } static void _test_interface_bar_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 GHashTable* test_interface_foo_real_foo (TestInterfaceBar* base, GError** error) { TestInterfaceFoo * self; GHashFunc _tmp0_; GEqualFunc _tmp1_; GHashTable* _tmp2_; GHashTable* result; self = G_TYPE_CHECK_INSTANCE_CAST (base, TEST_INTERFACE_TYPE_FOO, TestInterfaceFoo); _tmp0_ = g_str_hash; _tmp1_ = g_str_equal; _tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _g_variant_unref0_); result = _tmp2_; return result; } TestInterfaceFoo* test_interface_foo_construct (GType object_type) { TestInterfaceFoo * self = NULL; self = (TestInterfaceFoo*) g_object_new (object_type, NULL); return self; } TestInterfaceFoo* test_interface_foo_new (void) { return test_interface_foo_construct (TEST_INTERFACE_TYPE_FOO); } static void test_interface_foo_class_init (TestInterfaceFooClass * klass, gpointer klass_data) { test_interface_foo_parent_class = g_type_class_peek_parent (klass); } static void test_interface_foo_test_interface_bar_interface_init (TestInterfaceBarIface * iface, gpointer iface_data) { test_interface_foo_test_interface_bar_parent_iface = g_type_interface_peek_parent (iface); iface->foo = (GHashTable* (*) (TestInterfaceBar*, GError**)) test_interface_foo_real_foo; } static void test_interface_foo_instance_init (TestInterfaceFoo * self, gpointer klass) { } static GType test_interface_foo_get_type_once (void) { static const GTypeInfo g_define_type_info = { sizeof (TestInterfaceFooClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) test_interface_foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TestInterfaceFoo), 0, (GInstanceInitFunc) test_interface_foo_instance_init, NULL }; static const GInterfaceInfo test_interface_bar_info = { (GInterfaceInitFunc) test_interface_foo_test_interface_bar_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; GType test_interface_foo_type_id; test_interface_foo_type_id = g_type_register_static (g_dbus_proxy_get_type (), "TestInterfaceFoo", &g_define_type_info, 0); g_type_add_interface_static (test_interface_foo_type_id, TEST_INTERFACE_TYPE_BAR, &test_interface_bar_info); return test_interface_foo_type_id; } GType test_interface_foo_get_type (void) { static volatile gsize test_interface_foo_type_id__once = 0; if (g_once_init_enter (&test_interface_foo_type_id__once)) { GType test_interface_foo_type_id; test_interface_foo_type_id = test_interface_foo_get_type_once (); g_once_init_leave (&test_interface_foo_type_id__once, test_interface_foo_type_id); } return test_interface_foo_type_id__once; } 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_dicts_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); }