1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
|
/* dbus_bug735437_server.c generated by valac, the Vala compiler
* generated from dbus_bug735437_server.vala, do not modify */
#include <glib-object.h>
#include <gio/gio.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.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_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)))
#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;
};
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 gdouble* test_array (Test* self,
gint* result_length1);
VALA_EXTERN gdouble* test_multi_array (Test* self,
gint* result_length1,
gint* result_length2);
VALA_EXTERN gchar** test_multi_array2 (Test* self,
gint* result_length1,
gint* result_length2,
gint* result_length3);
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_array (Test* self,
GVariant* _parameters_,
GDBusMethodInvocation* invocation);
static void _dbus_test_multi_array (Test* self,
GVariant* _parameters_,
GDBusMethodInvocation* invocation);
static void _dbus_test_multi_array2 (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 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_array_result = {-1, "result", "ad", NULL};
static const GDBusArgInfo * const _test_dbus_arg_info_array_in[] = {NULL};
static const GDBusArgInfo * const _test_dbus_arg_info_array_out[] = {&_test_dbus_arg_info_array_result, NULL};
static const GDBusMethodInfo _test_dbus_method_info_array = {-1, "Array", (GDBusArgInfo **) (&_test_dbus_arg_info_array_in), (GDBusArgInfo **) (&_test_dbus_arg_info_array_out), NULL};
static const GDBusArgInfo _test_dbus_arg_info_multi_array_result = {-1, "result", "aad", NULL};
static const GDBusArgInfo * const _test_dbus_arg_info_multi_array_in[] = {NULL};
static const GDBusArgInfo * const _test_dbus_arg_info_multi_array_out[] = {&_test_dbus_arg_info_multi_array_result, NULL};
static const GDBusMethodInfo _test_dbus_method_info_multi_array = {-1, "MultiArray", (GDBusArgInfo **) (&_test_dbus_arg_info_multi_array_in), (GDBusArgInfo **) (&_test_dbus_arg_info_multi_array_out), NULL};
static const GDBusArgInfo _test_dbus_arg_info_multi_array2_result = {-1, "result", "aaas", NULL};
static const GDBusArgInfo * const _test_dbus_arg_info_multi_array2_in[] = {NULL};
static const GDBusArgInfo * const _test_dbus_arg_info_multi_array2_out[] = {&_test_dbus_arg_info_multi_array2_result, NULL};
static const GDBusMethodInfo _test_dbus_method_info_multi_array2 = {-1, "MultiArray2", (GDBusArgInfo **) (&_test_dbus_arg_info_multi_array2_in), (GDBusArgInfo **) (&_test_dbus_arg_info_multi_array2_out), NULL};
static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_array, &_test_dbus_method_info_multi_array, &_test_dbus_method_info_multi_array2, 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};
gdouble*
test_array (Test* self,
gint* result_length1)
{
gdouble* _tmp0_;
gdouble* _tmp1_;
gint _tmp1__length1;
gdouble* result;
g_return_val_if_fail (IS_TEST (self), NULL);
_tmp0_ = g_new0 (gdouble, 2);
_tmp0_[0] = 2.0;
_tmp0_[1] = 3.0;
_tmp1_ = _tmp0_;
_tmp1__length1 = 2;
if (result_length1) {
*result_length1 = _tmp1__length1;
}
result = _tmp1_;
return result;
}
gdouble*
test_multi_array (Test* self,
gint* result_length1,
gint* result_length2)
{
gdouble* _tmp0_;
gdouble* _tmp1_;
gint _tmp1__length1;
gint _tmp1__length2;
gdouble* result;
g_return_val_if_fail (IS_TEST (self), NULL);
_tmp0_ = g_new0 (gdouble, 2 * 2);
_tmp0_[0] = 2.0;
_tmp0_[1] = 3.0;
_tmp0_[2] = 4.0;
_tmp0_[3] = 5.0;
_tmp1_ = _tmp0_;
_tmp1__length1 = 2;
_tmp1__length2 = 2;
if (result_length1) {
*result_length1 = _tmp1__length1;
}
if (result_length2) {
*result_length2 = _tmp1__length2;
}
result = _tmp1_;
return result;
}
gchar**
test_multi_array2 (Test* self,
gint* result_length1,
gint* result_length2,
gint* result_length3)
{
gchar* _tmp0_;
gchar* _tmp1_;
gchar* _tmp2_;
gchar* _tmp3_;
gchar* _tmp4_;
gchar* _tmp5_;
gchar* _tmp6_;
gchar* _tmp7_;
gchar** _tmp8_;
gchar** _tmp9_;
gint _tmp9__length1;
gint _tmp9__length2;
gint _tmp9__length3;
gchar** result;
g_return_val_if_fail (IS_TEST (self), NULL);
_tmp0_ = g_strdup ("foo");
_tmp1_ = g_strdup ("bar");
_tmp2_ = g_strdup ("baz");
_tmp3_ = g_strdup ("man");
_tmp4_ = g_strdup ("foo2");
_tmp5_ = g_strdup ("bar2");
_tmp6_ = g_strdup ("baz2");
_tmp7_ = g_strdup ("man2");
_tmp8_ = g_new0 (gchar*, ((2 * 2) * 2) + 1);
_tmp8_[0] = _tmp0_;
_tmp8_[1] = _tmp1_;
_tmp8_[2] = _tmp2_;
_tmp8_[3] = _tmp3_;
_tmp8_[4] = _tmp4_;
_tmp8_[5] = _tmp5_;
_tmp8_[6] = _tmp6_;
_tmp8_[7] = _tmp7_;
_tmp9_ = _tmp8_;
_tmp9__length1 = 2;
_tmp9__length2 = 2;
_tmp9__length3 = 2;
if (result_length1) {
*result_length1 = _tmp9__length1;
}
if (result_length2) {
*result_length2 = _tmp9__length2;
}
if (result_length3) {
*result_length3 = _tmp9__length3;
}
result = _tmp9_;
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__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;
}
static void
_dbus_test_array (Test* self,
GVariant* _parameters_,
GDBusMethodInvocation* invocation)
{
GError* error = NULL;
GVariantIter _arguments_iter;
GDBusMessage* _reply_message = NULL;
GVariant* _reply;
GVariantBuilder _reply_builder;
gdouble* result;
gint result_length1 = 0;
gdouble* _tmp0_;
GVariantBuilder _tmp1_;
gint _tmp2_;
g_variant_iter_init (&_arguments_iter, _parameters_);
result = test_array (self, &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);
_tmp0_ = result;
g_variant_builder_init (&_tmp1_, G_VARIANT_TYPE ("ad"));
for (_tmp2_ = 0; _tmp2_ < result_length1; _tmp2_++) {
g_variant_builder_add_value (&_tmp1_, g_variant_new_double (*_tmp0_));
_tmp0_++;
}
g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp1_));
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);
}
static void
_dbus_test_multi_array (Test* self,
GVariant* _parameters_,
GDBusMethodInvocation* invocation)
{
GError* error = NULL;
GVariantIter _arguments_iter;
GDBusMessage* _reply_message = NULL;
GVariant* _reply;
GVariantBuilder _reply_builder;
gdouble* result;
gint result_length1 = 0;
gint result_length2 = 0;
gdouble* _tmp3_;
GVariantBuilder _tmp4_;
gint _tmp5_;
g_variant_iter_init (&_arguments_iter, _parameters_);
result = test_multi_array (self, &result_length1, &result_length2);
_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);
_tmp3_ = result;
g_variant_builder_init (&_tmp4_, G_VARIANT_TYPE ("aad"));
for (_tmp5_ = 0; _tmp5_ < result_length1; _tmp5_++) {
GVariantBuilder _tmp6_;
gint _tmp7_;
g_variant_builder_init (&_tmp6_, G_VARIANT_TYPE ("ad"));
for (_tmp7_ = 0; _tmp7_ < result_length2; _tmp7_++) {
g_variant_builder_add_value (&_tmp6_, g_variant_new_double (*_tmp3_));
_tmp3_++;
}
g_variant_builder_add_value (&_tmp4_, g_variant_builder_end (&_tmp6_));
}
g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp4_));
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);
}
static void
_dbus_test_multi_array2 (Test* self,
GVariant* _parameters_,
GDBusMethodInvocation* invocation)
{
GError* error = NULL;
GVariantIter _arguments_iter;
GDBusMessage* _reply_message = NULL;
GVariant* _reply;
GVariantBuilder _reply_builder;
gchar** result;
gint result_length1 = 0;
gint result_length2 = 0;
gint result_length3 = 0;
gchar** _tmp8_;
GVariantBuilder _tmp9_;
gint _tmp10_;
g_variant_iter_init (&_arguments_iter, _parameters_);
result = test_multi_array2 (self, &result_length1, &result_length2, &result_length3);
_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);
_tmp8_ = result;
g_variant_builder_init (&_tmp9_, G_VARIANT_TYPE ("aaas"));
for (_tmp10_ = 0; _tmp10_ < result_length1; _tmp10_++) {
GVariantBuilder _tmp11_;
gint _tmp12_;
g_variant_builder_init (&_tmp11_, G_VARIANT_TYPE ("aas"));
for (_tmp12_ = 0; _tmp12_ < result_length2; _tmp12_++) {
GVariantBuilder _tmp13_;
gint _tmp14_;
g_variant_builder_init (&_tmp13_, G_VARIANT_TYPE ("as"));
for (_tmp14_ = 0; _tmp14_ < result_length3; _tmp14_++) {
g_variant_builder_add_value (&_tmp13_, g_variant_new_string (*_tmp8_));
_tmp8_++;
}
g_variant_builder_add_value (&_tmp11_, g_variant_builder_end (&_tmp13_));
}
g_variant_builder_add_value (&_tmp9_, g_variant_builder_end (&_tmp11_));
}
g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp9_));
result = (_vala_array_free (result, (result_length1 * result_length2) * result_length3, (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);
}
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, "Array") == 0) {
_dbus_test_array (object, parameters, invocation);
} else if (strcmp (method_name, "MultiArray") == 0) {
_dbus_test_multi_array (object, parameters, invocation);
} else if (strcmp (method_name, "MultiArray2") == 0) {
_dbus_test_multi_array2 (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_bug735437_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);
}
|