~ubuntu-branches/ubuntu/saucy/activity-log-manager/saucy-proposed

« back to all changes in this revision

Viewing changes to .pc/03_use_libwhoopsie-preferences.patch/src/diagnostics/whoopsie-generated.c

  • Committer: Package Import Robot
  • Author(s): Evan Dandrea
  • Date: 2013-07-25 10:49:10 UTC
  • Revision ID: package-import@ubuntu.com-20130725104910-oaxqq01vekygs54y
Tags: 0.9.7-0ubuntu4
* debian/patches/03_use_libwhoopsie-preferences.patch:
  - Use libwhoopsie-preferences0 instead of building it in tree. Taken
    from trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Generated by gdbus-codegen 2.37.4. DO NOT EDIT.
 
3
 *
 
4
 * The license of this code is the same as for the source it was derived from.
 
5
 */
 
6
 
 
7
#ifdef HAVE_CONFIG_H
 
8
#  include "config.h"
 
9
#endif
 
10
 
 
11
#include "whoopsie-generated.h"
 
12
 
 
13
#include <string.h>
 
14
#ifdef G_OS_UNIX
 
15
#  include <gio/gunixfdlist.h>
 
16
#endif
 
17
 
 
18
typedef struct
 
19
{
 
20
  GDBusArgInfo parent_struct;
 
21
  gboolean use_gvariant;
 
22
} _ExtendedGDBusArgInfo;
 
23
 
 
24
typedef struct
 
25
{
 
26
  GDBusMethodInfo parent_struct;
 
27
  const gchar *signal_name;
 
28
  gboolean pass_fdlist;
 
29
} _ExtendedGDBusMethodInfo;
 
30
 
 
31
typedef struct
 
32
{
 
33
  GDBusSignalInfo parent_struct;
 
34
  const gchar *signal_name;
 
35
} _ExtendedGDBusSignalInfo;
 
36
 
 
37
typedef struct
 
38
{
 
39
  GDBusPropertyInfo parent_struct;
 
40
  const gchar *hyphen_name;
 
41
  gboolean use_gvariant;
 
42
} _ExtendedGDBusPropertyInfo;
 
43
 
 
44
typedef struct
 
45
{
 
46
  GDBusInterfaceInfo parent_struct;
 
47
  const gchar *hyphen_name;
 
48
} _ExtendedGDBusInterfaceInfo;
 
49
 
 
50
typedef struct
 
51
{
 
52
  const _ExtendedGDBusPropertyInfo *info;
 
53
  guint prop_id;
 
54
  GValue orig_value; /* the value before the change */
 
55
} ChangedProperty;
 
56
 
 
57
static void
 
58
_changed_property_free (ChangedProperty *data)
 
59
{
 
60
  g_value_unset (&data->orig_value);
 
61
  g_free (data);
 
62
}
 
63
 
 
64
static gboolean
 
65
_g_strv_equal0 (gchar **a, gchar **b)
 
66
{
 
67
  gboolean ret = FALSE;
 
68
  guint n;
 
69
  if (a == NULL && b == NULL)
 
70
    {
 
71
      ret = TRUE;
 
72
      goto out;
 
73
    }
 
74
  if (a == NULL || b == NULL)
 
75
    goto out;
 
76
  if (g_strv_length (a) != g_strv_length (b))
 
77
    goto out;
 
78
  for (n = 0; a[n] != NULL; n++)
 
79
    if (g_strcmp0 (a[n], b[n]) != 0)
 
80
      goto out;
 
81
  ret = TRUE;
 
82
out:
 
83
  return ret;
 
84
}
 
85
 
 
86
static gboolean
 
87
_g_variant_equal0 (GVariant *a, GVariant *b)
 
88
{
 
89
  gboolean ret = FALSE;
 
90
  if (a == NULL && b == NULL)
 
91
    {
 
92
      ret = TRUE;
 
93
      goto out;
 
94
    }
 
95
  if (a == NULL || b == NULL)
 
96
    goto out;
 
97
  ret = g_variant_equal (a, b);
 
98
out:
 
99
  return ret;
 
100
}
 
101
 
 
102
G_GNUC_UNUSED static gboolean
 
103
_g_value_equal (const GValue *a, const GValue *b)
 
104
{
 
105
  gboolean ret = FALSE;
 
106
  g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
 
107
  switch (G_VALUE_TYPE (a))
 
108
    {
 
109
      case G_TYPE_BOOLEAN:
 
110
        ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
 
111
        break;
 
112
      case G_TYPE_UCHAR:
 
113
        ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
 
114
        break;
 
115
      case G_TYPE_INT:
 
116
        ret = (g_value_get_int (a) == g_value_get_int (b));
 
117
        break;
 
118
      case G_TYPE_UINT:
 
119
        ret = (g_value_get_uint (a) == g_value_get_uint (b));
 
120
        break;
 
121
      case G_TYPE_INT64:
 
122
        ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
 
123
        break;
 
124
      case G_TYPE_UINT64:
 
125
        ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
 
126
        break;
 
127
      case G_TYPE_DOUBLE:
 
128
        {
 
129
          /* Avoid -Wfloat-equal warnings by doing a direct bit compare */
 
130
          gdouble da = g_value_get_double (a);
 
131
          gdouble db = g_value_get_double (b);
 
132
          ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
 
133
        }
 
134
        break;
 
135
      case G_TYPE_STRING:
 
136
        ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
 
137
        break;
 
138
      case G_TYPE_VARIANT:
 
139
        ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
 
140
        break;
 
141
      default:
 
142
        if (G_VALUE_TYPE (a) == G_TYPE_STRV)
 
143
          ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
 
144
        else
 
145
          g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
 
146
        break;
 
147
    }
 
148
  return ret;
 
149
}
 
150
 
 
151
/* ------------------------------------------------------------------------
 
152
 * Code for interface com.ubuntu.WhoopsiePreferences
 
153
 * ------------------------------------------------------------------------
 
154
 */
 
155
 
 
156
/**
 
157
 * SECTION:WhoopsiePreferences
 
158
 * @title: WhoopsiePreferences
 
159
 * @short_description: Generated C code for the com.ubuntu.WhoopsiePreferences D-Bus interface
 
160
 *
 
161
 * This section contains code for working with the <link linkend="gdbus-interface-com-ubuntu-WhoopsiePreferences.top_of_page">com.ubuntu.WhoopsiePreferences</link> D-Bus interface in C.
 
162
 */
 
163
 
 
164
/* ---- Introspection data for com.ubuntu.WhoopsiePreferences ---- */
 
165
 
 
166
static const _ExtendedGDBusArgInfo _whoopsie_preferences_method_info_set_report_crashes_IN_ARG_report =
 
167
{
 
168
  {
 
169
    -1,
 
170
    (gchar *) "report",
 
171
    (gchar *) "b",
 
172
    NULL
 
173
  },
 
174
  FALSE
 
175
};
 
176
 
 
177
static const _ExtendedGDBusArgInfo * const _whoopsie_preferences_method_info_set_report_crashes_IN_ARG_pointers[] =
 
178
{
 
179
  &_whoopsie_preferences_method_info_set_report_crashes_IN_ARG_report,
 
180
  NULL
 
181
};
 
182
 
 
183
static const _ExtendedGDBusMethodInfo _whoopsie_preferences_method_info_set_report_crashes =
 
184
{
 
185
  {
 
186
    -1,
 
187
    (gchar *) "SetReportCrashes",
 
188
    (GDBusArgInfo **) &_whoopsie_preferences_method_info_set_report_crashes_IN_ARG_pointers,
 
189
    NULL,
 
190
    NULL
 
191
  },
 
192
  "handle-set-report-crashes",
 
193
  FALSE
 
194
};
 
195
 
 
196
static const _ExtendedGDBusArgInfo _whoopsie_preferences_method_info_set_report_metrics_IN_ARG_report =
 
197
{
 
198
  {
 
199
    -1,
 
200
    (gchar *) "report",
 
201
    (gchar *) "b",
 
202
    NULL
 
203
  },
 
204
  FALSE
 
205
};
 
206
 
 
207
static const _ExtendedGDBusArgInfo * const _whoopsie_preferences_method_info_set_report_metrics_IN_ARG_pointers[] =
 
208
{
 
209
  &_whoopsie_preferences_method_info_set_report_metrics_IN_ARG_report,
 
210
  NULL
 
211
};
 
212
 
 
213
static const _ExtendedGDBusMethodInfo _whoopsie_preferences_method_info_set_report_metrics =
 
214
{
 
215
  {
 
216
    -1,
 
217
    (gchar *) "SetReportMetrics",
 
218
    (GDBusArgInfo **) &_whoopsie_preferences_method_info_set_report_metrics_IN_ARG_pointers,
 
219
    NULL,
 
220
    NULL
 
221
  },
 
222
  "handle-set-report-metrics",
 
223
  FALSE
 
224
};
 
225
 
 
226
static const _ExtendedGDBusArgInfo _whoopsie_preferences_method_info_get_identifier_OUT_ARG_identifier =
 
227
{
 
228
  {
 
229
    -1,
 
230
    (gchar *) "identifier",
 
231
    (gchar *) "s",
 
232
    NULL
 
233
  },
 
234
  FALSE
 
235
};
 
236
 
 
237
static const _ExtendedGDBusArgInfo * const _whoopsie_preferences_method_info_get_identifier_OUT_ARG_pointers[] =
 
238
{
 
239
  &_whoopsie_preferences_method_info_get_identifier_OUT_ARG_identifier,
 
240
  NULL
 
241
};
 
242
 
 
243
static const _ExtendedGDBusMethodInfo _whoopsie_preferences_method_info_get_identifier =
 
244
{
 
245
  {
 
246
    -1,
 
247
    (gchar *) "GetIdentifier",
 
248
    NULL,
 
249
    (GDBusArgInfo **) &_whoopsie_preferences_method_info_get_identifier_OUT_ARG_pointers,
 
250
    NULL
 
251
  },
 
252
  "handle-get-identifier",
 
253
  FALSE
 
254
};
 
255
 
 
256
static const _ExtendedGDBusMethodInfo * const _whoopsie_preferences_method_info_pointers[] =
 
257
{
 
258
  &_whoopsie_preferences_method_info_set_report_crashes,
 
259
  &_whoopsie_preferences_method_info_set_report_metrics,
 
260
  &_whoopsie_preferences_method_info_get_identifier,
 
261
  NULL
 
262
};
 
263
 
 
264
static const _ExtendedGDBusPropertyInfo _whoopsie_preferences_property_info_report_crashes =
 
265
{
 
266
  {
 
267
    -1,
 
268
    (gchar *) "ReportCrashes",
 
269
    (gchar *) "b",
 
270
    G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
 
271
    NULL
 
272
  },
 
273
  "report-crashes",
 
274
  FALSE
 
275
};
 
276
 
 
277
static const _ExtendedGDBusPropertyInfo _whoopsie_preferences_property_info_report_metrics =
 
278
{
 
279
  {
 
280
    -1,
 
281
    (gchar *) "ReportMetrics",
 
282
    (gchar *) "b",
 
283
    G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
 
284
    NULL
 
285
  },
 
286
  "report-metrics",
 
287
  FALSE
 
288
};
 
289
 
 
290
static const _ExtendedGDBusPropertyInfo * const _whoopsie_preferences_property_info_pointers[] =
 
291
{
 
292
  &_whoopsie_preferences_property_info_report_crashes,
 
293
  &_whoopsie_preferences_property_info_report_metrics,
 
294
  NULL
 
295
};
 
296
 
 
297
static const _ExtendedGDBusInterfaceInfo _whoopsie_preferences_interface_info =
 
298
{
 
299
  {
 
300
    -1,
 
301
    (gchar *) "com.ubuntu.WhoopsiePreferences",
 
302
    (GDBusMethodInfo **) &_whoopsie_preferences_method_info_pointers,
 
303
    NULL,
 
304
    (GDBusPropertyInfo **) &_whoopsie_preferences_property_info_pointers,
 
305
    NULL
 
306
  },
 
307
  "whoopsie-preferences",
 
308
};
 
309
 
 
310
 
 
311
/**
 
312
 * whoopsie_preferences_interface_info:
 
313
 *
 
314
 * Gets a machine-readable description of the <link linkend="gdbus-interface-com-ubuntu-WhoopsiePreferences.top_of_page">com.ubuntu.WhoopsiePreferences</link> D-Bus interface.
 
315
 *
 
316
 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
 
317
 */
 
318
GDBusInterfaceInfo *
 
319
whoopsie_preferences_interface_info (void)
 
320
{
 
321
  return (GDBusInterfaceInfo *) &_whoopsie_preferences_interface_info.parent_struct;
 
322
}
 
323
 
 
324
/**
 
325
 * whoopsie_preferences_override_properties:
 
326
 * @klass: The class structure for a #GObject<!-- -->-derived class.
 
327
 * @property_id_begin: The property id to assign to the first overridden property.
 
328
 *
 
329
 * Overrides all #GObject properties in the #WhoopsiePreferences interface for a concrete class.
 
330
 * The properties are overridden in the order they are defined.
 
331
 *
 
332
 * Returns: The last property id.
 
333
 */
 
334
guint
 
335
whoopsie_preferences_override_properties (GObjectClass *klass, guint property_id_begin)
 
336
{
 
337
  g_object_class_override_property (klass, property_id_begin++, "report-crashes");
 
338
  g_object_class_override_property (klass, property_id_begin++, "report-metrics");
 
339
  return property_id_begin - 1;
 
340
}
 
341
 
 
342
 
 
343
 
 
344
/**
 
345
 * WhoopsiePreferences:
 
346
 *
 
347
 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-com-ubuntu-WhoopsiePreferences.top_of_page">com.ubuntu.WhoopsiePreferences</link>.
 
348
 */
 
349
 
 
350
/**
 
351
 * WhoopsiePreferencesIface:
 
352
 * @parent_iface: The parent interface.
 
353
 * @handle_get_identifier: Handler for the #WhoopsiePreferences::handle-get-identifier signal.
 
354
 * @handle_set_report_crashes: Handler for the #WhoopsiePreferences::handle-set-report-crashes signal.
 
355
 * @handle_set_report_metrics: Handler for the #WhoopsiePreferences::handle-set-report-metrics signal.
 
356
 * @get_report_crashes: Getter for the #WhoopsiePreferences:report-crashes property.
 
357
 * @get_report_metrics: Getter for the #WhoopsiePreferences:report-metrics property.
 
358
 *
 
359
 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-com-ubuntu-WhoopsiePreferences.top_of_page">com.ubuntu.WhoopsiePreferences</link>.
 
360
 */
 
361
 
 
362
typedef WhoopsiePreferencesIface WhoopsiePreferencesInterface;
 
363
G_DEFINE_INTERFACE (WhoopsiePreferences, whoopsie_preferences, G_TYPE_OBJECT);
 
364
 
 
365
static void
 
366
whoopsie_preferences_default_init (WhoopsiePreferencesIface *iface)
 
367
{
 
368
  /* GObject signals for incoming D-Bus method calls: */
 
369
  /**
 
370
   * WhoopsiePreferences::handle-set-report-crashes:
 
371
   * @object: A #WhoopsiePreferences.
 
372
   * @invocation: A #GDBusMethodInvocation.
 
373
   * @arg_report: Argument passed by remote caller.
 
374
   *
 
375
   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-com-ubuntu-WhoopsiePreferences.SetReportCrashes">SetReportCrashes()</link> D-Bus method.
 
376
   *
 
377
   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call whoopsie_preferences_complete_set_report_crashes() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
 
378
   *
 
379
   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
 
380
   */
 
381
  g_signal_new ("handle-set-report-crashes",
 
382
    G_TYPE_FROM_INTERFACE (iface),
 
383
    G_SIGNAL_RUN_LAST,
 
384
    G_STRUCT_OFFSET (WhoopsiePreferencesIface, handle_set_report_crashes),
 
385
    g_signal_accumulator_true_handled,
 
386
    NULL,
 
387
    g_cclosure_marshal_generic,
 
388
    G_TYPE_BOOLEAN,
 
389
    2,
 
390
    G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_BOOLEAN);
 
391
 
 
392
  /**
 
393
   * WhoopsiePreferences::handle-set-report-metrics:
 
394
   * @object: A #WhoopsiePreferences.
 
395
   * @invocation: A #GDBusMethodInvocation.
 
396
   * @arg_report: Argument passed by remote caller.
 
397
   *
 
398
   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-com-ubuntu-WhoopsiePreferences.SetReportMetrics">SetReportMetrics()</link> D-Bus method.
 
399
   *
 
400
   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call whoopsie_preferences_complete_set_report_metrics() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
 
401
   *
 
402
   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
 
403
   */
 
404
  g_signal_new ("handle-set-report-metrics",
 
405
    G_TYPE_FROM_INTERFACE (iface),
 
406
    G_SIGNAL_RUN_LAST,
 
407
    G_STRUCT_OFFSET (WhoopsiePreferencesIface, handle_set_report_metrics),
 
408
    g_signal_accumulator_true_handled,
 
409
    NULL,
 
410
    g_cclosure_marshal_generic,
 
411
    G_TYPE_BOOLEAN,
 
412
    2,
 
413
    G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_BOOLEAN);
 
414
 
 
415
  /**
 
416
   * WhoopsiePreferences::handle-get-identifier:
 
417
   * @object: A #WhoopsiePreferences.
 
418
   * @invocation: A #GDBusMethodInvocation.
 
419
   *
 
420
   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-com-ubuntu-WhoopsiePreferences.GetIdentifier">GetIdentifier()</link> D-Bus method.
 
421
   *
 
422
   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call whoopsie_preferences_complete_get_identifier() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
 
423
   *
 
424
   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
 
425
   */
 
426
  g_signal_new ("handle-get-identifier",
 
427
    G_TYPE_FROM_INTERFACE (iface),
 
428
    G_SIGNAL_RUN_LAST,
 
429
    G_STRUCT_OFFSET (WhoopsiePreferencesIface, handle_get_identifier),
 
430
    g_signal_accumulator_true_handled,
 
431
    NULL,
 
432
    g_cclosure_marshal_generic,
 
433
    G_TYPE_BOOLEAN,
 
434
    1,
 
435
    G_TYPE_DBUS_METHOD_INVOCATION);
 
436
 
 
437
  /* GObject properties for D-Bus properties: */
 
438
  /**
 
439
   * WhoopsiePreferences:report-crashes:
 
440
   *
 
441
   * Represents the D-Bus property <link linkend="gdbus-property-com-ubuntu-WhoopsiePreferences.ReportCrashes">"ReportCrashes"</link>.
 
442
   *
 
443
   * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
 
444
   */
 
445
  g_object_interface_install_property (iface,
 
446
    g_param_spec_boolean ("report-crashes", "ReportCrashes", "ReportCrashes", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
447
  /**
 
448
   * WhoopsiePreferences:report-metrics:
 
449
   *
 
450
   * Represents the D-Bus property <link linkend="gdbus-property-com-ubuntu-WhoopsiePreferences.ReportMetrics">"ReportMetrics"</link>.
 
451
   *
 
452
   * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
 
453
   */
 
454
  g_object_interface_install_property (iface,
 
455
    g_param_spec_boolean ("report-metrics", "ReportMetrics", "ReportMetrics", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
456
}
 
457
 
 
458
/**
 
459
 * whoopsie_preferences_get_report_crashes: (skip)
 
460
 * @object: A #WhoopsiePreferences.
 
461
 *
 
462
 * Gets the value of the <link linkend="gdbus-property-com-ubuntu-WhoopsiePreferences.ReportCrashes">"ReportCrashes"</link> D-Bus property.
 
463
 *
 
464
 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
 
465
 *
 
466
 * Returns: The property value.
 
467
 */
 
468
gboolean 
 
469
whoopsie_preferences_get_report_crashes (WhoopsiePreferences *object)
 
470
{
 
471
  return WHOOPSIE_PREFERENCES_GET_IFACE (object)->get_report_crashes (object);
 
472
}
 
473
 
 
474
/**
 
475
 * whoopsie_preferences_set_report_crashes: (skip)
 
476
 * @object: A #WhoopsiePreferences.
 
477
 * @value: The value to set.
 
478
 *
 
479
 * Sets the <link linkend="gdbus-property-com-ubuntu-WhoopsiePreferences.ReportCrashes">"ReportCrashes"</link> D-Bus property to @value.
 
480
 *
 
481
 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
 
482
 */
 
483
void
 
484
whoopsie_preferences_set_report_crashes (WhoopsiePreferences *object, gboolean value)
 
485
{
 
486
  g_object_set (G_OBJECT (object), "report-crashes", value, NULL);
 
487
}
 
488
 
 
489
/**
 
490
 * whoopsie_preferences_get_report_metrics: (skip)
 
491
 * @object: A #WhoopsiePreferences.
 
492
 *
 
493
 * Gets the value of the <link linkend="gdbus-property-com-ubuntu-WhoopsiePreferences.ReportMetrics">"ReportMetrics"</link> D-Bus property.
 
494
 *
 
495
 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
 
496
 *
 
497
 * Returns: The property value.
 
498
 */
 
499
gboolean 
 
500
whoopsie_preferences_get_report_metrics (WhoopsiePreferences *object)
 
501
{
 
502
  return WHOOPSIE_PREFERENCES_GET_IFACE (object)->get_report_metrics (object);
 
503
}
 
504
 
 
505
/**
 
506
 * whoopsie_preferences_set_report_metrics: (skip)
 
507
 * @object: A #WhoopsiePreferences.
 
508
 * @value: The value to set.
 
509
 *
 
510
 * Sets the <link linkend="gdbus-property-com-ubuntu-WhoopsiePreferences.ReportMetrics">"ReportMetrics"</link> D-Bus property to @value.
 
511
 *
 
512
 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
 
513
 */
 
514
void
 
515
whoopsie_preferences_set_report_metrics (WhoopsiePreferences *object, gboolean value)
 
516
{
 
517
  g_object_set (G_OBJECT (object), "report-metrics", value, NULL);
 
518
}
 
519
 
 
520
/**
 
521
 * whoopsie_preferences_call_set_report_crashes:
 
522
 * @proxy: A #WhoopsiePreferencesProxy.
 
523
 * @arg_report: Argument to pass with the method invocation.
 
524
 * @cancellable: (allow-none): A #GCancellable or %NULL.
 
525
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
 
526
 * @user_data: User data to pass to @callback.
 
527
 *
 
528
 * Asynchronously invokes the <link linkend="gdbus-method-com-ubuntu-WhoopsiePreferences.SetReportCrashes">SetReportCrashes()</link> D-Bus method on @proxy.
 
529
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
 
530
 * You can then call whoopsie_preferences_call_set_report_crashes_finish() to get the result of the operation.
 
531
 *
 
532
 * See whoopsie_preferences_call_set_report_crashes_sync() for the synchronous, blocking version of this method.
 
533
 */
 
534
void
 
535
whoopsie_preferences_call_set_report_crashes (
 
536
    WhoopsiePreferences *proxy,
 
537
    gboolean arg_report,
 
538
    GCancellable *cancellable,
 
539
    GAsyncReadyCallback callback,
 
540
    gpointer user_data)
 
541
{
 
542
  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
 
543
    "SetReportCrashes",
 
544
    g_variant_new ("(b)",
 
545
                   arg_report),
 
546
    G_DBUS_CALL_FLAGS_NONE,
 
547
    -1,
 
548
    cancellable,
 
549
    callback,
 
550
    user_data);
 
551
}
 
552
 
 
553
/**
 
554
 * whoopsie_preferences_call_set_report_crashes_finish:
 
555
 * @proxy: A #WhoopsiePreferencesProxy.
 
556
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to whoopsie_preferences_call_set_report_crashes().
 
557
 * @error: Return location for error or %NULL.
 
558
 *
 
559
 * Finishes an operation started with whoopsie_preferences_call_set_report_crashes().
 
560
 *
 
561
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
 
562
 */
 
563
gboolean
 
564
whoopsie_preferences_call_set_report_crashes_finish (
 
565
    WhoopsiePreferences *proxy,
 
566
    GAsyncResult *res,
 
567
    GError **error)
 
568
{
 
569
  GVariant *_ret;
 
570
  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
 
571
  if (_ret == NULL)
 
572
    goto _out;
 
573
  g_variant_get (_ret,
 
574
                 "()");
 
575
  g_variant_unref (_ret);
 
576
_out:
 
577
  return _ret != NULL;
 
578
}
 
579
 
 
580
/**
 
581
 * whoopsie_preferences_call_set_report_crashes_sync:
 
582
 * @proxy: A #WhoopsiePreferencesProxy.
 
583
 * @arg_report: Argument to pass with the method invocation.
 
584
 * @cancellable: (allow-none): A #GCancellable or %NULL.
 
585
 * @error: Return location for error or %NULL.
 
586
 *
 
587
 * Synchronously invokes the <link linkend="gdbus-method-com-ubuntu-WhoopsiePreferences.SetReportCrashes">SetReportCrashes()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
 
588
 *
 
589
 * See whoopsie_preferences_call_set_report_crashes() for the asynchronous version of this method.
 
590
 *
 
591
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
 
592
 */
 
593
gboolean
 
594
whoopsie_preferences_call_set_report_crashes_sync (
 
595
    WhoopsiePreferences *proxy,
 
596
    gboolean arg_report,
 
597
    GCancellable *cancellable,
 
598
    GError **error)
 
599
{
 
600
  GVariant *_ret;
 
601
  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
 
602
    "SetReportCrashes",
 
603
    g_variant_new ("(b)",
 
604
                   arg_report),
 
605
    G_DBUS_CALL_FLAGS_NONE,
 
606
    -1,
 
607
    cancellable,
 
608
    error);
 
609
  if (_ret == NULL)
 
610
    goto _out;
 
611
  g_variant_get (_ret,
 
612
                 "()");
 
613
  g_variant_unref (_ret);
 
614
_out:
 
615
  return _ret != NULL;
 
616
}
 
617
 
 
618
/**
 
619
 * whoopsie_preferences_call_set_report_metrics:
 
620
 * @proxy: A #WhoopsiePreferencesProxy.
 
621
 * @arg_report: Argument to pass with the method invocation.
 
622
 * @cancellable: (allow-none): A #GCancellable or %NULL.
 
623
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
 
624
 * @user_data: User data to pass to @callback.
 
625
 *
 
626
 * Asynchronously invokes the <link linkend="gdbus-method-com-ubuntu-WhoopsiePreferences.SetReportMetrics">SetReportMetrics()</link> D-Bus method on @proxy.
 
627
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
 
628
 * You can then call whoopsie_preferences_call_set_report_metrics_finish() to get the result of the operation.
 
629
 *
 
630
 * See whoopsie_preferences_call_set_report_metrics_sync() for the synchronous, blocking version of this method.
 
631
 */
 
632
void
 
633
whoopsie_preferences_call_set_report_metrics (
 
634
    WhoopsiePreferences *proxy,
 
635
    gboolean arg_report,
 
636
    GCancellable *cancellable,
 
637
    GAsyncReadyCallback callback,
 
638
    gpointer user_data)
 
639
{
 
640
  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
 
641
    "SetReportMetrics",
 
642
    g_variant_new ("(b)",
 
643
                   arg_report),
 
644
    G_DBUS_CALL_FLAGS_NONE,
 
645
    -1,
 
646
    cancellable,
 
647
    callback,
 
648
    user_data);
 
649
}
 
650
 
 
651
/**
 
652
 * whoopsie_preferences_call_set_report_metrics_finish:
 
653
 * @proxy: A #WhoopsiePreferencesProxy.
 
654
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to whoopsie_preferences_call_set_report_metrics().
 
655
 * @error: Return location for error or %NULL.
 
656
 *
 
657
 * Finishes an operation started with whoopsie_preferences_call_set_report_metrics().
 
658
 *
 
659
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
 
660
 */
 
661
gboolean
 
662
whoopsie_preferences_call_set_report_metrics_finish (
 
663
    WhoopsiePreferences *proxy,
 
664
    GAsyncResult *res,
 
665
    GError **error)
 
666
{
 
667
  GVariant *_ret;
 
668
  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
 
669
  if (_ret == NULL)
 
670
    goto _out;
 
671
  g_variant_get (_ret,
 
672
                 "()");
 
673
  g_variant_unref (_ret);
 
674
_out:
 
675
  return _ret != NULL;
 
676
}
 
677
 
 
678
/**
 
679
 * whoopsie_preferences_call_set_report_metrics_sync:
 
680
 * @proxy: A #WhoopsiePreferencesProxy.
 
681
 * @arg_report: Argument to pass with the method invocation.
 
682
 * @cancellable: (allow-none): A #GCancellable or %NULL.
 
683
 * @error: Return location for error or %NULL.
 
684
 *
 
685
 * Synchronously invokes the <link linkend="gdbus-method-com-ubuntu-WhoopsiePreferences.SetReportMetrics">SetReportMetrics()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
 
686
 *
 
687
 * See whoopsie_preferences_call_set_report_metrics() for the asynchronous version of this method.
 
688
 *
 
689
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
 
690
 */
 
691
gboolean
 
692
whoopsie_preferences_call_set_report_metrics_sync (
 
693
    WhoopsiePreferences *proxy,
 
694
    gboolean arg_report,
 
695
    GCancellable *cancellable,
 
696
    GError **error)
 
697
{
 
698
  GVariant *_ret;
 
699
  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
 
700
    "SetReportMetrics",
 
701
    g_variant_new ("(b)",
 
702
                   arg_report),
 
703
    G_DBUS_CALL_FLAGS_NONE,
 
704
    -1,
 
705
    cancellable,
 
706
    error);
 
707
  if (_ret == NULL)
 
708
    goto _out;
 
709
  g_variant_get (_ret,
 
710
                 "()");
 
711
  g_variant_unref (_ret);
 
712
_out:
 
713
  return _ret != NULL;
 
714
}
 
715
 
 
716
/**
 
717
 * whoopsie_preferences_call_get_identifier:
 
718
 * @proxy: A #WhoopsiePreferencesProxy.
 
719
 * @cancellable: (allow-none): A #GCancellable or %NULL.
 
720
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
 
721
 * @user_data: User data to pass to @callback.
 
722
 *
 
723
 * Asynchronously invokes the <link linkend="gdbus-method-com-ubuntu-WhoopsiePreferences.GetIdentifier">GetIdentifier()</link> D-Bus method on @proxy.
 
724
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
 
725
 * You can then call whoopsie_preferences_call_get_identifier_finish() to get the result of the operation.
 
726
 *
 
727
 * See whoopsie_preferences_call_get_identifier_sync() for the synchronous, blocking version of this method.
 
728
 */
 
729
void
 
730
whoopsie_preferences_call_get_identifier (
 
731
    WhoopsiePreferences *proxy,
 
732
    GCancellable *cancellable,
 
733
    GAsyncReadyCallback callback,
 
734
    gpointer user_data)
 
735
{
 
736
  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
 
737
    "GetIdentifier",
 
738
    g_variant_new ("()"),
 
739
    G_DBUS_CALL_FLAGS_NONE,
 
740
    -1,
 
741
    cancellable,
 
742
    callback,
 
743
    user_data);
 
744
}
 
745
 
 
746
/**
 
747
 * whoopsie_preferences_call_get_identifier_finish:
 
748
 * @proxy: A #WhoopsiePreferencesProxy.
 
749
 * @out_identifier: (out): Return location for return parameter or %NULL to ignore.
 
750
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to whoopsie_preferences_call_get_identifier().
 
751
 * @error: Return location for error or %NULL.
 
752
 *
 
753
 * Finishes an operation started with whoopsie_preferences_call_get_identifier().
 
754
 *
 
755
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
 
756
 */
 
757
gboolean
 
758
whoopsie_preferences_call_get_identifier_finish (
 
759
    WhoopsiePreferences *proxy,
 
760
    gchar **out_identifier,
 
761
    GAsyncResult *res,
 
762
    GError **error)
 
763
{
 
764
  GVariant *_ret;
 
765
  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
 
766
  if (_ret == NULL)
 
767
    goto _out;
 
768
  g_variant_get (_ret,
 
769
                 "(s)",
 
770
                 out_identifier);
 
771
  g_variant_unref (_ret);
 
772
_out:
 
773
  return _ret != NULL;
 
774
}
 
775
 
 
776
/**
 
777
 * whoopsie_preferences_call_get_identifier_sync:
 
778
 * @proxy: A #WhoopsiePreferencesProxy.
 
779
 * @out_identifier: (out): Return location for return parameter or %NULL to ignore.
 
780
 * @cancellable: (allow-none): A #GCancellable or %NULL.
 
781
 * @error: Return location for error or %NULL.
 
782
 *
 
783
 * Synchronously invokes the <link linkend="gdbus-method-com-ubuntu-WhoopsiePreferences.GetIdentifier">GetIdentifier()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
 
784
 *
 
785
 * See whoopsie_preferences_call_get_identifier() for the asynchronous version of this method.
 
786
 *
 
787
 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
 
788
 */
 
789
gboolean
 
790
whoopsie_preferences_call_get_identifier_sync (
 
791
    WhoopsiePreferences *proxy,
 
792
    gchar **out_identifier,
 
793
    GCancellable *cancellable,
 
794
    GError **error)
 
795
{
 
796
  GVariant *_ret;
 
797
  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
 
798
    "GetIdentifier",
 
799
    g_variant_new ("()"),
 
800
    G_DBUS_CALL_FLAGS_NONE,
 
801
    -1,
 
802
    cancellable,
 
803
    error);
 
804
  if (_ret == NULL)
 
805
    goto _out;
 
806
  g_variant_get (_ret,
 
807
                 "(s)",
 
808
                 out_identifier);
 
809
  g_variant_unref (_ret);
 
810
_out:
 
811
  return _ret != NULL;
 
812
}
 
813
 
 
814
/**
 
815
 * whoopsie_preferences_complete_set_report_crashes:
 
816
 * @object: A #WhoopsiePreferences.
 
817
 * @invocation: (transfer full): A #GDBusMethodInvocation.
 
818
 *
 
819
 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-com-ubuntu-WhoopsiePreferences.SetReportCrashes">SetReportCrashes()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
 
820
 *
 
821
 * This method will free @invocation, you cannot use it afterwards.
 
822
 */
 
823
void
 
824
whoopsie_preferences_complete_set_report_crashes (
 
825
    WhoopsiePreferences *object,
 
826
    GDBusMethodInvocation *invocation)
 
827
{
 
828
  g_dbus_method_invocation_return_value (invocation,
 
829
    g_variant_new ("()"));
 
830
}
 
831
 
 
832
/**
 
833
 * whoopsie_preferences_complete_set_report_metrics:
 
834
 * @object: A #WhoopsiePreferences.
 
835
 * @invocation: (transfer full): A #GDBusMethodInvocation.
 
836
 *
 
837
 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-com-ubuntu-WhoopsiePreferences.SetReportMetrics">SetReportMetrics()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
 
838
 *
 
839
 * This method will free @invocation, you cannot use it afterwards.
 
840
 */
 
841
void
 
842
whoopsie_preferences_complete_set_report_metrics (
 
843
    WhoopsiePreferences *object,
 
844
    GDBusMethodInvocation *invocation)
 
845
{
 
846
  g_dbus_method_invocation_return_value (invocation,
 
847
    g_variant_new ("()"));
 
848
}
 
849
 
 
850
/**
 
851
 * whoopsie_preferences_complete_get_identifier:
 
852
 * @object: A #WhoopsiePreferences.
 
853
 * @invocation: (transfer full): A #GDBusMethodInvocation.
 
854
 * @identifier: Parameter to return.
 
855
 *
 
856
 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-com-ubuntu-WhoopsiePreferences.GetIdentifier">GetIdentifier()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
 
857
 *
 
858
 * This method will free @invocation, you cannot use it afterwards.
 
859
 */
 
860
void
 
861
whoopsie_preferences_complete_get_identifier (
 
862
    WhoopsiePreferences *object,
 
863
    GDBusMethodInvocation *invocation,
 
864
    const gchar *identifier)
 
865
{
 
866
  g_dbus_method_invocation_return_value (invocation,
 
867
    g_variant_new ("(s)",
 
868
                   identifier));
 
869
}
 
870
 
 
871
/* ------------------------------------------------------------------------ */
 
872
 
 
873
/**
 
874
 * WhoopsiePreferencesProxy:
 
875
 *
 
876
 * The #WhoopsiePreferencesProxy structure contains only private data and should only be accessed using the provided API.
 
877
 */
 
878
 
 
879
/**
 
880
 * WhoopsiePreferencesProxyClass:
 
881
 * @parent_class: The parent class.
 
882
 *
 
883
 * Class structure for #WhoopsiePreferencesProxy.
 
884
 */
 
885
 
 
886
struct _WhoopsiePreferencesProxyPrivate
 
887
{
 
888
  GData *qdata;
 
889
};
 
890
 
 
891
static void whoopsie_preferences_proxy_iface_init (WhoopsiePreferencesIface *iface);
 
892
 
 
893
G_DEFINE_TYPE_WITH_CODE (WhoopsiePreferencesProxy, whoopsie_preferences_proxy, G_TYPE_DBUS_PROXY,
 
894
                         G_ADD_PRIVATE (WhoopsiePreferencesProxy)
 
895
                         G_IMPLEMENT_INTERFACE (TYPE_WHOOPSIE_PREFERENCES, whoopsie_preferences_proxy_iface_init));
 
896
 
 
897
static void
 
898
whoopsie_preferences_proxy_finalize (GObject *object)
 
899
{
 
900
  WhoopsiePreferencesProxy *proxy = WHOOPSIE_PREFERENCES_PROXY (object);
 
901
  g_datalist_clear (&proxy->priv->qdata);
 
902
  G_OBJECT_CLASS (whoopsie_preferences_proxy_parent_class)->finalize (object);
 
903
}
 
904
 
 
905
static void
 
906
whoopsie_preferences_proxy_get_property (GObject      *object,
 
907
  guint         prop_id,
 
908
  GValue       *value,
 
909
  GParamSpec   *pspec G_GNUC_UNUSED)
 
910
{
 
911
  const _ExtendedGDBusPropertyInfo *info;
 
912
  GVariant *variant;
 
913
  g_assert (prop_id != 0 && prop_id - 1 < 2);
 
914
  info = _whoopsie_preferences_property_info_pointers[prop_id - 1];
 
915
  variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
 
916
  if (info->use_gvariant)
 
917
    {
 
918
      g_value_set_variant (value, variant);
 
919
    }
 
920
  else
 
921
    {
 
922
      if (variant != NULL)
 
923
        g_dbus_gvariant_to_gvalue (variant, value);
 
924
    }
 
925
  if (variant != NULL)
 
926
    g_variant_unref (variant);
 
927
}
 
928
 
 
929
static void
 
930
whoopsie_preferences_proxy_set_property_cb (GDBusProxy *proxy,
 
931
  GAsyncResult *res,
 
932
  gpointer      user_data)
 
933
{
 
934
  const _ExtendedGDBusPropertyInfo *info = user_data;
 
935
  GError *error;
 
936
  error = NULL;
 
937
  if (!g_dbus_proxy_call_finish (proxy, res, &error))
 
938
    {
 
939
      g_warning ("Error setting property '%s' on interface com.ubuntu.WhoopsiePreferences: %s (%s, %d)",
 
940
                 info->parent_struct.name, 
 
941
                 error->message, g_quark_to_string (error->domain), error->code);
 
942
      g_error_free (error);
 
943
    }
 
944
}
 
945
 
 
946
static void
 
947
whoopsie_preferences_proxy_set_property (GObject      *object,
 
948
  guint         prop_id,
 
949
  const GValue *value,
 
950
  GParamSpec   *pspec G_GNUC_UNUSED)
 
951
{
 
952
  const _ExtendedGDBusPropertyInfo *info;
 
953
  GVariant *variant;
 
954
  g_assert (prop_id != 0 && prop_id - 1 < 2);
 
955
  info = _whoopsie_preferences_property_info_pointers[prop_id - 1];
 
956
  variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
 
957
  g_dbus_proxy_call (G_DBUS_PROXY (object),
 
958
    "org.freedesktop.DBus.Properties.Set",
 
959
    g_variant_new ("(ssv)", "com.ubuntu.WhoopsiePreferences", info->parent_struct.name, variant),
 
960
    G_DBUS_CALL_FLAGS_NONE,
 
961
    -1,
 
962
    NULL, (GAsyncReadyCallback) whoopsie_preferences_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
 
963
  g_variant_unref (variant);
 
964
}
 
965
 
 
966
static void
 
967
whoopsie_preferences_proxy_g_signal (GDBusProxy *proxy,
 
968
  const gchar *sender_name G_GNUC_UNUSED,
 
969
  const gchar *signal_name,
 
970
  GVariant *parameters)
 
971
{
 
972
  _ExtendedGDBusSignalInfo *info;
 
973
  GVariantIter iter;
 
974
  GVariant *child;
 
975
  GValue *paramv;
 
976
  guint num_params;
 
977
  guint n;
 
978
  guint signal_id;
 
979
  info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_whoopsie_preferences_interface_info.parent_struct, signal_name);
 
980
  if (info == NULL)
 
981
    return;
 
982
  num_params = g_variant_n_children (parameters);
 
983
  paramv = g_new0 (GValue, num_params + 1);
 
984
  g_value_init (&paramv[0], TYPE_WHOOPSIE_PREFERENCES);
 
985
  g_value_set_object (&paramv[0], proxy);
 
986
  g_variant_iter_init (&iter, parameters);
 
987
  n = 1;
 
988
  while ((child = g_variant_iter_next_value (&iter)) != NULL)
 
989
    {
 
990
      _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
 
991
      if (arg_info->use_gvariant)
 
992
        {
 
993
          g_value_init (&paramv[n], G_TYPE_VARIANT);
 
994
          g_value_set_variant (&paramv[n], child);
 
995
          n++;
 
996
        }
 
997
      else
 
998
        g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
 
999
      g_variant_unref (child);
 
1000
    }
 
1001
  signal_id = g_signal_lookup (info->signal_name, TYPE_WHOOPSIE_PREFERENCES);
 
1002
  g_signal_emitv (paramv, signal_id, 0, NULL);
 
1003
  for (n = 0; n < num_params + 1; n++)
 
1004
    g_value_unset (&paramv[n]);
 
1005
  g_free (paramv);
 
1006
}
 
1007
 
 
1008
static void
 
1009
whoopsie_preferences_proxy_g_properties_changed (GDBusProxy *_proxy,
 
1010
  GVariant *changed_properties,
 
1011
  const gchar *const *invalidated_properties)
 
1012
{
 
1013
  WhoopsiePreferencesProxy *proxy = WHOOPSIE_PREFERENCES_PROXY (_proxy);
 
1014
  guint n;
 
1015
  const gchar *key;
 
1016
  GVariantIter *iter;
 
1017
  _ExtendedGDBusPropertyInfo *info;
 
1018
  g_variant_get (changed_properties, "a{sv}", &iter);
 
1019
  while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
 
1020
    {
 
1021
      info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_whoopsie_preferences_interface_info.parent_struct, key);
 
1022
      g_datalist_remove_data (&proxy->priv->qdata, key);
 
1023
      if (info != NULL)
 
1024
        g_object_notify (G_OBJECT (proxy), info->hyphen_name);
 
1025
    }
 
1026
  g_variant_iter_free (iter);
 
1027
  for (n = 0; invalidated_properties[n] != NULL; n++)
 
1028
    {
 
1029
      info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_whoopsie_preferences_interface_info.parent_struct, invalidated_properties[n]);
 
1030
      g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
 
1031
      if (info != NULL)
 
1032
        g_object_notify (G_OBJECT (proxy), info->hyphen_name);
 
1033
    }
 
1034
}
 
1035
 
 
1036
static gboolean 
 
1037
whoopsie_preferences_proxy_get_report_crashes (WhoopsiePreferences *object)
 
1038
{
 
1039
  WhoopsiePreferencesProxy *proxy = WHOOPSIE_PREFERENCES_PROXY (object);
 
1040
  GVariant *variant;
 
1041
  gboolean value = 0;
 
1042
  variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ReportCrashes");
 
1043
  if (variant != NULL)
 
1044
    {
 
1045
      value = g_variant_get_boolean (variant);
 
1046
      g_variant_unref (variant);
 
1047
    }
 
1048
  return value;
 
1049
}
 
1050
 
 
1051
static gboolean 
 
1052
whoopsie_preferences_proxy_get_report_metrics (WhoopsiePreferences *object)
 
1053
{
 
1054
  WhoopsiePreferencesProxy *proxy = WHOOPSIE_PREFERENCES_PROXY (object);
 
1055
  GVariant *variant;
 
1056
  gboolean value = 0;
 
1057
  variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ReportMetrics");
 
1058
  if (variant != NULL)
 
1059
    {
 
1060
      value = g_variant_get_boolean (variant);
 
1061
      g_variant_unref (variant);
 
1062
    }
 
1063
  return value;
 
1064
}
 
1065
 
 
1066
static void
 
1067
whoopsie_preferences_proxy_init (WhoopsiePreferencesProxy *proxy)
 
1068
{
 
1069
  proxy->priv = whoopsie_preferences_proxy_get_instance_private (proxy);
 
1070
  g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), whoopsie_preferences_interface_info ());
 
1071
}
 
1072
 
 
1073
static void
 
1074
whoopsie_preferences_proxy_class_init (WhoopsiePreferencesProxyClass *klass)
 
1075
{
 
1076
  GObjectClass *gobject_class;
 
1077
  GDBusProxyClass *proxy_class;
 
1078
 
 
1079
  gobject_class = G_OBJECT_CLASS (klass);
 
1080
  gobject_class->finalize     = whoopsie_preferences_proxy_finalize;
 
1081
  gobject_class->get_property = whoopsie_preferences_proxy_get_property;
 
1082
  gobject_class->set_property = whoopsie_preferences_proxy_set_property;
 
1083
 
 
1084
  proxy_class = G_DBUS_PROXY_CLASS (klass);
 
1085
  proxy_class->g_signal = whoopsie_preferences_proxy_g_signal;
 
1086
  proxy_class->g_properties_changed = whoopsie_preferences_proxy_g_properties_changed;
 
1087
 
 
1088
 
 
1089
  whoopsie_preferences_override_properties (gobject_class, 1);
 
1090
}
 
1091
 
 
1092
static void
 
1093
whoopsie_preferences_proxy_iface_init (WhoopsiePreferencesIface *iface)
 
1094
{
 
1095
  iface->get_report_crashes = whoopsie_preferences_proxy_get_report_crashes;
 
1096
  iface->get_report_metrics = whoopsie_preferences_proxy_get_report_metrics;
 
1097
}
 
1098
 
 
1099
/**
 
1100
 * whoopsie_preferences_proxy_new:
 
1101
 * @connection: A #GDBusConnection.
 
1102
 * @flags: Flags from the #GDBusProxyFlags enumeration.
 
1103
 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
 
1104
 * @object_path: An object path.
 
1105
 * @cancellable: (allow-none): A #GCancellable or %NULL.
 
1106
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
 
1107
 * @user_data: User data to pass to @callback.
 
1108
 *
 
1109
 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-com-ubuntu-WhoopsiePreferences.top_of_page">com.ubuntu.WhoopsiePreferences</link>. See g_dbus_proxy_new() for more details.
 
1110
 *
 
1111
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
 
1112
 * You can then call whoopsie_preferences_proxy_new_finish() to get the result of the operation.
 
1113
 *
 
1114
 * See whoopsie_preferences_proxy_new_sync() for the synchronous, blocking version of this constructor.
 
1115
 */
 
1116
void
 
1117
whoopsie_preferences_proxy_new (
 
1118
    GDBusConnection     *connection,
 
1119
    GDBusProxyFlags      flags,
 
1120
    const gchar         *name,
 
1121
    const gchar         *object_path,
 
1122
    GCancellable        *cancellable,
 
1123
    GAsyncReadyCallback  callback,
 
1124
    gpointer             user_data)
 
1125
{
 
1126
  g_async_initable_new_async (TYPE_WHOOPSIE_PREFERENCES_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "com.ubuntu.WhoopsiePreferences", NULL);
 
1127
}
 
1128
 
 
1129
/**
 
1130
 * whoopsie_preferences_proxy_new_finish:
 
1131
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to whoopsie_preferences_proxy_new().
 
1132
 * @error: Return location for error or %NULL
 
1133
 *
 
1134
 * Finishes an operation started with whoopsie_preferences_proxy_new().
 
1135
 *
 
1136
 * Returns: (transfer full) (type WhoopsiePreferencesProxy): The constructed proxy object or %NULL if @error is set.
 
1137
 */
 
1138
WhoopsiePreferences *
 
1139
whoopsie_preferences_proxy_new_finish (
 
1140
    GAsyncResult        *res,
 
1141
    GError             **error)
 
1142
{
 
1143
  GObject *ret;
 
1144
  GObject *source_object;
 
1145
  source_object = g_async_result_get_source_object (res);
 
1146
  ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
 
1147
  g_object_unref (source_object);
 
1148
  if (ret != NULL)
 
1149
    return WHOOPSIE_PREFERENCES (ret);
 
1150
  else
 
1151
    return NULL;
 
1152
}
 
1153
 
 
1154
/**
 
1155
 * whoopsie_preferences_proxy_new_sync:
 
1156
 * @connection: A #GDBusConnection.
 
1157
 * @flags: Flags from the #GDBusProxyFlags enumeration.
 
1158
 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
 
1159
 * @object_path: An object path.
 
1160
 * @cancellable: (allow-none): A #GCancellable or %NULL.
 
1161
 * @error: Return location for error or %NULL
 
1162
 *
 
1163
 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-com-ubuntu-WhoopsiePreferences.top_of_page">com.ubuntu.WhoopsiePreferences</link>. See g_dbus_proxy_new_sync() for more details.
 
1164
 *
 
1165
 * The calling thread is blocked until a reply is received.
 
1166
 *
 
1167
 * See whoopsie_preferences_proxy_new() for the asynchronous version of this constructor.
 
1168
 *
 
1169
 * Returns: (transfer full) (type WhoopsiePreferencesProxy): The constructed proxy object or %NULL if @error is set.
 
1170
 */
 
1171
WhoopsiePreferences *
 
1172
whoopsie_preferences_proxy_new_sync (
 
1173
    GDBusConnection     *connection,
 
1174
    GDBusProxyFlags      flags,
 
1175
    const gchar         *name,
 
1176
    const gchar         *object_path,
 
1177
    GCancellable        *cancellable,
 
1178
    GError             **error)
 
1179
{
 
1180
  GInitable *ret;
 
1181
  ret = g_initable_new (TYPE_WHOOPSIE_PREFERENCES_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "com.ubuntu.WhoopsiePreferences", NULL);
 
1182
  if (ret != NULL)
 
1183
    return WHOOPSIE_PREFERENCES (ret);
 
1184
  else
 
1185
    return NULL;
 
1186
}
 
1187
 
 
1188
 
 
1189
/**
 
1190
 * whoopsie_preferences_proxy_new_for_bus:
 
1191
 * @bus_type: A #GBusType.
 
1192
 * @flags: Flags from the #GDBusProxyFlags enumeration.
 
1193
 * @name: A bus name (well-known or unique).
 
1194
 * @object_path: An object path.
 
1195
 * @cancellable: (allow-none): A #GCancellable or %NULL.
 
1196
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
 
1197
 * @user_data: User data to pass to @callback.
 
1198
 *
 
1199
 * Like whoopsie_preferences_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
 
1200
 *
 
1201
 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
 
1202
 * You can then call whoopsie_preferences_proxy_new_for_bus_finish() to get the result of the operation.
 
1203
 *
 
1204
 * See whoopsie_preferences_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
 
1205
 */
 
1206
void
 
1207
whoopsie_preferences_proxy_new_for_bus (
 
1208
    GBusType             bus_type,
 
1209
    GDBusProxyFlags      flags,
 
1210
    const gchar         *name,
 
1211
    const gchar         *object_path,
 
1212
    GCancellable        *cancellable,
 
1213
    GAsyncReadyCallback  callback,
 
1214
    gpointer             user_data)
 
1215
{
 
1216
  g_async_initable_new_async (TYPE_WHOOPSIE_PREFERENCES_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "com.ubuntu.WhoopsiePreferences", NULL);
 
1217
}
 
1218
 
 
1219
/**
 
1220
 * whoopsie_preferences_proxy_new_for_bus_finish:
 
1221
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to whoopsie_preferences_proxy_new_for_bus().
 
1222
 * @error: Return location for error or %NULL
 
1223
 *
 
1224
 * Finishes an operation started with whoopsie_preferences_proxy_new_for_bus().
 
1225
 *
 
1226
 * Returns: (transfer full) (type WhoopsiePreferencesProxy): The constructed proxy object or %NULL if @error is set.
 
1227
 */
 
1228
WhoopsiePreferences *
 
1229
whoopsie_preferences_proxy_new_for_bus_finish (
 
1230
    GAsyncResult        *res,
 
1231
    GError             **error)
 
1232
{
 
1233
  GObject *ret;
 
1234
  GObject *source_object;
 
1235
  source_object = g_async_result_get_source_object (res);
 
1236
  ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
 
1237
  g_object_unref (source_object);
 
1238
  if (ret != NULL)
 
1239
    return WHOOPSIE_PREFERENCES (ret);
 
1240
  else
 
1241
    return NULL;
 
1242
}
 
1243
 
 
1244
/**
 
1245
 * whoopsie_preferences_proxy_new_for_bus_sync:
 
1246
 * @bus_type: A #GBusType.
 
1247
 * @flags: Flags from the #GDBusProxyFlags enumeration.
 
1248
 * @name: A bus name (well-known or unique).
 
1249
 * @object_path: An object path.
 
1250
 * @cancellable: (allow-none): A #GCancellable or %NULL.
 
1251
 * @error: Return location for error or %NULL
 
1252
 *
 
1253
 * Like whoopsie_preferences_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
 
1254
 *
 
1255
 * The calling thread is blocked until a reply is received.
 
1256
 *
 
1257
 * See whoopsie_preferences_proxy_new_for_bus() for the asynchronous version of this constructor.
 
1258
 *
 
1259
 * Returns: (transfer full) (type WhoopsiePreferencesProxy): The constructed proxy object or %NULL if @error is set.
 
1260
 */
 
1261
WhoopsiePreferences *
 
1262
whoopsie_preferences_proxy_new_for_bus_sync (
 
1263
    GBusType             bus_type,
 
1264
    GDBusProxyFlags      flags,
 
1265
    const gchar         *name,
 
1266
    const gchar         *object_path,
 
1267
    GCancellable        *cancellable,
 
1268
    GError             **error)
 
1269
{
 
1270
  GInitable *ret;
 
1271
  ret = g_initable_new (TYPE_WHOOPSIE_PREFERENCES_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "com.ubuntu.WhoopsiePreferences", NULL);
 
1272
  if (ret != NULL)
 
1273
    return WHOOPSIE_PREFERENCES (ret);
 
1274
  else
 
1275
    return NULL;
 
1276
}
 
1277
 
 
1278
 
 
1279
/* ------------------------------------------------------------------------ */
 
1280
 
 
1281
/**
 
1282
 * WhoopsiePreferencesSkeleton:
 
1283
 *
 
1284
 * The #WhoopsiePreferencesSkeleton structure contains only private data and should only be accessed using the provided API.
 
1285
 */
 
1286
 
 
1287
/**
 
1288
 * WhoopsiePreferencesSkeletonClass:
 
1289
 * @parent_class: The parent class.
 
1290
 *
 
1291
 * Class structure for #WhoopsiePreferencesSkeleton.
 
1292
 */
 
1293
 
 
1294
struct _WhoopsiePreferencesSkeletonPrivate
 
1295
{
 
1296
  GValue *properties;
 
1297
  GList *changed_properties;
 
1298
  GSource *changed_properties_idle_source;
 
1299
  GMainContext *context;
 
1300
  GMutex lock;
 
1301
};
 
1302
 
 
1303
static void
 
1304
_whoopsie_preferences_skeleton_handle_method_call (
 
1305
  GDBusConnection *connection G_GNUC_UNUSED,
 
1306
  const gchar *sender G_GNUC_UNUSED,
 
1307
  const gchar *object_path G_GNUC_UNUSED,
 
1308
  const gchar *interface_name,
 
1309
  const gchar *method_name,
 
1310
  GVariant *parameters,
 
1311
  GDBusMethodInvocation *invocation,
 
1312
  gpointer user_data)
 
1313
{
 
1314
  WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (user_data);
 
1315
  _ExtendedGDBusMethodInfo *info;
 
1316
  GVariantIter iter;
 
1317
  GVariant *child;
 
1318
  GValue *paramv;
 
1319
  guint num_params;
 
1320
  guint num_extra;
 
1321
  guint n;
 
1322
  guint signal_id;
 
1323
  GValue return_value = G_VALUE_INIT;
 
1324
  info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
 
1325
  g_assert (info != NULL);
 
1326
  num_params = g_variant_n_children (parameters);
 
1327
  num_extra = info->pass_fdlist ? 3 : 2;  paramv = g_new0 (GValue, num_params + num_extra);
 
1328
  n = 0;
 
1329
  g_value_init (&paramv[n], TYPE_WHOOPSIE_PREFERENCES);
 
1330
  g_value_set_object (&paramv[n++], skeleton);
 
1331
  g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
 
1332
  g_value_set_object (&paramv[n++], invocation);
 
1333
  if (info->pass_fdlist)
 
1334
    {
 
1335
#ifdef G_OS_UNIX
 
1336
      g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
 
1337
      g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
 
1338
#else
 
1339
      g_assert_not_reached ();
 
1340
#endif
 
1341
    }
 
1342
  g_variant_iter_init (&iter, parameters);
 
1343
  while ((child = g_variant_iter_next_value (&iter)) != NULL)
 
1344
    {
 
1345
      _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
 
1346
      if (arg_info->use_gvariant)
 
1347
        {
 
1348
          g_value_init (&paramv[n], G_TYPE_VARIANT);
 
1349
          g_value_set_variant (&paramv[n], child);
 
1350
          n++;
 
1351
        }
 
1352
      else
 
1353
        g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
 
1354
      g_variant_unref (child);
 
1355
    }
 
1356
  signal_id = g_signal_lookup (info->signal_name, TYPE_WHOOPSIE_PREFERENCES);
 
1357
  g_value_init (&return_value, G_TYPE_BOOLEAN);
 
1358
  g_signal_emitv (paramv, signal_id, 0, &return_value);
 
1359
  if (!g_value_get_boolean (&return_value))
 
1360
    g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name);
 
1361
  g_value_unset (&return_value);
 
1362
  for (n = 0; n < num_params + num_extra; n++)
 
1363
    g_value_unset (&paramv[n]);
 
1364
  g_free (paramv);
 
1365
}
 
1366
 
 
1367
static GVariant *
 
1368
_whoopsie_preferences_skeleton_handle_get_property (
 
1369
  GDBusConnection *connection G_GNUC_UNUSED,
 
1370
  const gchar *sender G_GNUC_UNUSED,
 
1371
  const gchar *object_path G_GNUC_UNUSED,
 
1372
  const gchar *interface_name G_GNUC_UNUSED,
 
1373
  const gchar *property_name,
 
1374
  GError **error,
 
1375
  gpointer user_data)
 
1376
{
 
1377
  WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (user_data);
 
1378
  GValue value = G_VALUE_INIT;
 
1379
  GParamSpec *pspec;
 
1380
  _ExtendedGDBusPropertyInfo *info;
 
1381
  GVariant *ret;
 
1382
  ret = NULL;
 
1383
  info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_whoopsie_preferences_interface_info.parent_struct, property_name);
 
1384
  g_assert (info != NULL);
 
1385
  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
 
1386
  if (pspec == NULL)
 
1387
    {
 
1388
      g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
 
1389
    }
 
1390
  else
 
1391
    {
 
1392
      g_value_init (&value, pspec->value_type);
 
1393
      g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
 
1394
      ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
 
1395
      g_value_unset (&value);
 
1396
    }
 
1397
  return ret;
 
1398
}
 
1399
 
 
1400
static gboolean
 
1401
_whoopsie_preferences_skeleton_handle_set_property (
 
1402
  GDBusConnection *connection G_GNUC_UNUSED,
 
1403
  const gchar *sender G_GNUC_UNUSED,
 
1404
  const gchar *object_path G_GNUC_UNUSED,
 
1405
  const gchar *interface_name G_GNUC_UNUSED,
 
1406
  const gchar *property_name,
 
1407
  GVariant *variant,
 
1408
  GError **error,
 
1409
  gpointer user_data)
 
1410
{
 
1411
  WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (user_data);
 
1412
  GValue value = G_VALUE_INIT;
 
1413
  GParamSpec *pspec;
 
1414
  _ExtendedGDBusPropertyInfo *info;
 
1415
  gboolean ret;
 
1416
  ret = FALSE;
 
1417
  info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_whoopsie_preferences_interface_info.parent_struct, property_name);
 
1418
  g_assert (info != NULL);
 
1419
  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
 
1420
  if (pspec == NULL)
 
1421
    {
 
1422
      g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
 
1423
    }
 
1424
  else
 
1425
    {
 
1426
      if (info->use_gvariant)
 
1427
        g_value_set_variant (&value, variant);
 
1428
      else
 
1429
        g_dbus_gvariant_to_gvalue (variant, &value);
 
1430
      g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
 
1431
      g_value_unset (&value);
 
1432
      ret = TRUE;
 
1433
    }
 
1434
  return ret;
 
1435
}
 
1436
 
 
1437
static const GDBusInterfaceVTable _whoopsie_preferences_skeleton_vtable =
 
1438
{
 
1439
  _whoopsie_preferences_skeleton_handle_method_call,
 
1440
  _whoopsie_preferences_skeleton_handle_get_property,
 
1441
  _whoopsie_preferences_skeleton_handle_set_property,
 
1442
  {NULL}
 
1443
};
 
1444
 
 
1445
static GDBusInterfaceInfo *
 
1446
whoopsie_preferences_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
 
1447
{
 
1448
  return whoopsie_preferences_interface_info ();
 
1449
}
 
1450
 
 
1451
static GDBusInterfaceVTable *
 
1452
whoopsie_preferences_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
 
1453
{
 
1454
  return (GDBusInterfaceVTable *) &_whoopsie_preferences_skeleton_vtable;
 
1455
}
 
1456
 
 
1457
static GVariant *
 
1458
whoopsie_preferences_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
 
1459
{
 
1460
  WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (_skeleton);
 
1461
 
 
1462
  GVariantBuilder builder;
 
1463
  guint n;
 
1464
  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
 
1465
  if (_whoopsie_preferences_interface_info.parent_struct.properties == NULL)
 
1466
    goto out;
 
1467
  for (n = 0; _whoopsie_preferences_interface_info.parent_struct.properties[n] != NULL; n++)
 
1468
    {
 
1469
      GDBusPropertyInfo *info = _whoopsie_preferences_interface_info.parent_struct.properties[n];
 
1470
      if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
 
1471
        {
 
1472
          GVariant *value;
 
1473
          value = _whoopsie_preferences_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "com.ubuntu.WhoopsiePreferences", info->name, NULL, skeleton);
 
1474
          if (value != NULL)
 
1475
            {
 
1476
              g_variant_take_ref (value);
 
1477
              g_variant_builder_add (&builder, "{sv}", info->name, value);
 
1478
              g_variant_unref (value);
 
1479
            }
 
1480
        }
 
1481
    }
 
1482
out:
 
1483
  return g_variant_builder_end (&builder);
 
1484
}
 
1485
 
 
1486
static gboolean _whoopsie_preferences_emit_changed (gpointer user_data);
 
1487
 
 
1488
static void
 
1489
whoopsie_preferences_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
 
1490
{
 
1491
  WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (_skeleton);
 
1492
  gboolean emit_changed = FALSE;
 
1493
 
 
1494
  g_mutex_lock (&skeleton->priv->lock);
 
1495
  if (skeleton->priv->changed_properties_idle_source != NULL)
 
1496
    {
 
1497
      g_source_destroy (skeleton->priv->changed_properties_idle_source);
 
1498
      skeleton->priv->changed_properties_idle_source = NULL;
 
1499
      emit_changed = TRUE;
 
1500
    }
 
1501
  g_mutex_unlock (&skeleton->priv->lock);
 
1502
 
 
1503
  if (emit_changed)
 
1504
    _whoopsie_preferences_emit_changed (skeleton);
 
1505
}
 
1506
 
 
1507
static void whoopsie_preferences_skeleton_iface_init (WhoopsiePreferencesIface *iface);
 
1508
G_DEFINE_TYPE_WITH_CODE (WhoopsiePreferencesSkeleton, whoopsie_preferences_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
 
1509
                         G_ADD_PRIVATE (WhoopsiePreferencesSkeleton)
 
1510
                         G_IMPLEMENT_INTERFACE (TYPE_WHOOPSIE_PREFERENCES, whoopsie_preferences_skeleton_iface_init));
 
1511
 
 
1512
static void
 
1513
whoopsie_preferences_skeleton_finalize (GObject *object)
 
1514
{
 
1515
  WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (object);
 
1516
  guint n;
 
1517
  for (n = 0; n < 2; n++)
 
1518
    g_value_unset (&skeleton->priv->properties[n]);
 
1519
  g_free (skeleton->priv->properties);
 
1520
  g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
 
1521
  if (skeleton->priv->changed_properties_idle_source != NULL)
 
1522
    g_source_destroy (skeleton->priv->changed_properties_idle_source);
 
1523
  g_main_context_unref (skeleton->priv->context);
 
1524
  g_mutex_clear (&skeleton->priv->lock);
 
1525
  G_OBJECT_CLASS (whoopsie_preferences_skeleton_parent_class)->finalize (object);
 
1526
}
 
1527
 
 
1528
static void
 
1529
whoopsie_preferences_skeleton_get_property (GObject      *object,
 
1530
  guint         prop_id,
 
1531
  GValue       *value,
 
1532
  GParamSpec   *pspec G_GNUC_UNUSED)
 
1533
{
 
1534
  WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (object);
 
1535
  g_assert (prop_id != 0 && prop_id - 1 < 2);
 
1536
  g_mutex_lock (&skeleton->priv->lock);
 
1537
  g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
 
1538
  g_mutex_unlock (&skeleton->priv->lock);
 
1539
}
 
1540
 
 
1541
static gboolean
 
1542
_whoopsie_preferences_emit_changed (gpointer user_data)
 
1543
{
 
1544
  WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (user_data);
 
1545
  GList *l;
 
1546
  GVariantBuilder builder;
 
1547
  GVariantBuilder invalidated_builder;
 
1548
  guint num_changes;
 
1549
 
 
1550
  g_mutex_lock (&skeleton->priv->lock);
 
1551
  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
 
1552
  g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
 
1553
  for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
 
1554
    {
 
1555
      ChangedProperty *cp = l->data;
 
1556
      GVariant *variant;
 
1557
      const GValue *cur_value;
 
1558
 
 
1559
      cur_value = &skeleton->priv->properties[cp->prop_id - 1];
 
1560
      if (!_g_value_equal (cur_value, &cp->orig_value))
 
1561
        {
 
1562
          variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
 
1563
          g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
 
1564
          g_variant_unref (variant);
 
1565
          num_changes++;
 
1566
        }
 
1567
    }
 
1568
  if (num_changes > 0)
 
1569
    {
 
1570
      GList *connections, *ll;
 
1571
      GVariant *signal_variant;
 
1572
      signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "com.ubuntu.WhoopsiePreferences",
 
1573
                                           &builder, &invalidated_builder));
 
1574
      connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
 
1575
      for (ll = connections; ll != NULL; ll = ll->next)
 
1576
        {
 
1577
          GDBusConnection *connection = ll->data;
 
1578
 
 
1579
          g_dbus_connection_emit_signal (connection,
 
1580
                                         NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
 
1581
                                         "org.freedesktop.DBus.Properties",
 
1582
                                         "PropertiesChanged",
 
1583
                                         signal_variant,
 
1584
                                         NULL);
 
1585
        }
 
1586
      g_variant_unref (signal_variant);
 
1587
      g_list_free_full (connections, g_object_unref);
 
1588
    }
 
1589
  else
 
1590
    {
 
1591
      g_variant_builder_clear (&builder);
 
1592
      g_variant_builder_clear (&invalidated_builder);
 
1593
    }
 
1594
  g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
 
1595
  skeleton->priv->changed_properties = NULL;
 
1596
  skeleton->priv->changed_properties_idle_source = NULL;
 
1597
  g_mutex_unlock (&skeleton->priv->lock);
 
1598
  return FALSE;
 
1599
}
 
1600
 
 
1601
static void
 
1602
_whoopsie_preferences_schedule_emit_changed (WhoopsiePreferencesSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
 
1603
{
 
1604
  ChangedProperty *cp;
 
1605
  GList *l;
 
1606
  cp = NULL;
 
1607
  for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
 
1608
    {
 
1609
      ChangedProperty *i_cp = l->data;
 
1610
      if (i_cp->info == info)
 
1611
        {
 
1612
          cp = i_cp;
 
1613
          break;
 
1614
        }
 
1615
    }
 
1616
  if (cp == NULL)
 
1617
    {
 
1618
      cp = g_new0 (ChangedProperty, 1);
 
1619
      cp->prop_id = prop_id;
 
1620
      cp->info = info;
 
1621
      skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
 
1622
      g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
 
1623
      g_value_copy (orig_value, &cp->orig_value);
 
1624
    }
 
1625
}
 
1626
 
 
1627
static void
 
1628
whoopsie_preferences_skeleton_notify (GObject      *object,
 
1629
  GParamSpec *pspec G_GNUC_UNUSED)
 
1630
{
 
1631
  WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (object);
 
1632
  g_mutex_lock (&skeleton->priv->lock);
 
1633
  if (skeleton->priv->changed_properties != NULL &&
 
1634
      skeleton->priv->changed_properties_idle_source == NULL)
 
1635
    {
 
1636
      skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
 
1637
      g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
 
1638
      g_source_set_callback (skeleton->priv->changed_properties_idle_source, _whoopsie_preferences_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
 
1639
      g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
 
1640
      g_source_unref (skeleton->priv->changed_properties_idle_source);
 
1641
    }
 
1642
  g_mutex_unlock (&skeleton->priv->lock);
 
1643
}
 
1644
 
 
1645
static void
 
1646
whoopsie_preferences_skeleton_set_property (GObject      *object,
 
1647
  guint         prop_id,
 
1648
  const GValue *value,
 
1649
  GParamSpec   *pspec)
 
1650
{
 
1651
  WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (object);
 
1652
  g_assert (prop_id != 0 && prop_id - 1 < 2);
 
1653
  g_mutex_lock (&skeleton->priv->lock);
 
1654
  g_object_freeze_notify (object);
 
1655
  if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
 
1656
    {
 
1657
      if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
 
1658
        _whoopsie_preferences_schedule_emit_changed (skeleton, _whoopsie_preferences_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
 
1659
      g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
 
1660
      g_object_notify_by_pspec (object, pspec);
 
1661
    }
 
1662
  g_mutex_unlock (&skeleton->priv->lock);
 
1663
  g_object_thaw_notify (object);
 
1664
}
 
1665
 
 
1666
static void
 
1667
whoopsie_preferences_skeleton_init (WhoopsiePreferencesSkeleton *skeleton)
 
1668
{
 
1669
  skeleton->priv = whoopsie_preferences_skeleton_get_instance_private (skeleton);
 
1670
  g_mutex_init (&skeleton->priv->lock);
 
1671
  skeleton->priv->context = g_main_context_ref_thread_default ();
 
1672
  skeleton->priv->properties = g_new0 (GValue, 2);
 
1673
  g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
 
1674
  g_value_init (&skeleton->priv->properties[1], G_TYPE_BOOLEAN);
 
1675
}
 
1676
 
 
1677
static gboolean 
 
1678
whoopsie_preferences_skeleton_get_report_crashes (WhoopsiePreferences *object)
 
1679
{
 
1680
  WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (object);
 
1681
  gboolean value;
 
1682
  g_mutex_lock (&skeleton->priv->lock);
 
1683
  value = g_value_get_boolean (&(skeleton->priv->properties[0]));
 
1684
  g_mutex_unlock (&skeleton->priv->lock);
 
1685
  return value;
 
1686
}
 
1687
 
 
1688
static gboolean 
 
1689
whoopsie_preferences_skeleton_get_report_metrics (WhoopsiePreferences *object)
 
1690
{
 
1691
  WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (object);
 
1692
  gboolean value;
 
1693
  g_mutex_lock (&skeleton->priv->lock);
 
1694
  value = g_value_get_boolean (&(skeleton->priv->properties[1]));
 
1695
  g_mutex_unlock (&skeleton->priv->lock);
 
1696
  return value;
 
1697
}
 
1698
 
 
1699
static void
 
1700
whoopsie_preferences_skeleton_class_init (WhoopsiePreferencesSkeletonClass *klass)
 
1701
{
 
1702
  GObjectClass *gobject_class;
 
1703
  GDBusInterfaceSkeletonClass *skeleton_class;
 
1704
 
 
1705
  gobject_class = G_OBJECT_CLASS (klass);
 
1706
  gobject_class->finalize = whoopsie_preferences_skeleton_finalize;
 
1707
  gobject_class->get_property = whoopsie_preferences_skeleton_get_property;
 
1708
  gobject_class->set_property = whoopsie_preferences_skeleton_set_property;
 
1709
  gobject_class->notify       = whoopsie_preferences_skeleton_notify;
 
1710
 
 
1711
 
 
1712
  whoopsie_preferences_override_properties (gobject_class, 1);
 
1713
 
 
1714
  skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
 
1715
  skeleton_class->get_info = whoopsie_preferences_skeleton_dbus_interface_get_info;
 
1716
  skeleton_class->get_properties = whoopsie_preferences_skeleton_dbus_interface_get_properties;
 
1717
  skeleton_class->flush = whoopsie_preferences_skeleton_dbus_interface_flush;
 
1718
  skeleton_class->get_vtable = whoopsie_preferences_skeleton_dbus_interface_get_vtable;
 
1719
}
 
1720
 
 
1721
static void
 
1722
whoopsie_preferences_skeleton_iface_init (WhoopsiePreferencesIface *iface)
 
1723
{
 
1724
  iface->get_report_crashes = whoopsie_preferences_skeleton_get_report_crashes;
 
1725
  iface->get_report_metrics = whoopsie_preferences_skeleton_get_report_metrics;
 
1726
}
 
1727
 
 
1728
/**
 
1729
 * whoopsie_preferences_skeleton_new:
 
1730
 *
 
1731
 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-com-ubuntu-WhoopsiePreferences.top_of_page">com.ubuntu.WhoopsiePreferences</link>.
 
1732
 *
 
1733
 * Returns: (transfer full) (type WhoopsiePreferencesSkeleton): The skeleton object.
 
1734
 */
 
1735
WhoopsiePreferences *
 
1736
whoopsie_preferences_skeleton_new (void)
 
1737
{
 
1738
  return WHOOPSIE_PREFERENCES (g_object_new (TYPE_WHOOPSIE_PREFERENCES_SKELETON, NULL));
 
1739
}
 
1740