2
* Generated by gdbus-codegen 2.37.4. DO NOT EDIT.
4
* The license of this code is the same as for the source it was derived from.
11
#include "whoopsie-generated.h"
15
# include <gio/gunixfdlist.h>
20
GDBusArgInfo parent_struct;
21
gboolean use_gvariant;
22
} _ExtendedGDBusArgInfo;
26
GDBusMethodInfo parent_struct;
27
const gchar *signal_name;
29
} _ExtendedGDBusMethodInfo;
33
GDBusSignalInfo parent_struct;
34
const gchar *signal_name;
35
} _ExtendedGDBusSignalInfo;
39
GDBusPropertyInfo parent_struct;
40
const gchar *hyphen_name;
41
gboolean use_gvariant;
42
} _ExtendedGDBusPropertyInfo;
46
GDBusInterfaceInfo parent_struct;
47
const gchar *hyphen_name;
48
} _ExtendedGDBusInterfaceInfo;
52
const _ExtendedGDBusPropertyInfo *info;
54
GValue orig_value; /* the value before the change */
58
_changed_property_free (ChangedProperty *data)
60
g_value_unset (&data->orig_value);
65
_g_strv_equal0 (gchar **a, gchar **b)
69
if (a == NULL && b == NULL)
74
if (a == NULL || b == NULL)
76
if (g_strv_length (a) != g_strv_length (b))
78
for (n = 0; a[n] != NULL; n++)
79
if (g_strcmp0 (a[n], b[n]) != 0)
87
_g_variant_equal0 (GVariant *a, GVariant *b)
90
if (a == NULL && b == NULL)
95
if (a == NULL || b == NULL)
97
ret = g_variant_equal (a, b);
102
G_GNUC_UNUSED static gboolean
103
_g_value_equal (const GValue *a, const GValue *b)
105
gboolean ret = FALSE;
106
g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
107
switch (G_VALUE_TYPE (a))
110
ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
113
ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
116
ret = (g_value_get_int (a) == g_value_get_int (b));
119
ret = (g_value_get_uint (a) == g_value_get_uint (b));
122
ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
125
ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
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;
136
ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
139
ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
142
if (G_VALUE_TYPE (a) == G_TYPE_STRV)
143
ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
145
g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
151
/* ------------------------------------------------------------------------
152
* Code for interface com.ubuntu.WhoopsiePreferences
153
* ------------------------------------------------------------------------
157
* SECTION:WhoopsiePreferences
158
* @title: WhoopsiePreferences
159
* @short_description: Generated C code for the com.ubuntu.WhoopsiePreferences D-Bus interface
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.
164
/* ---- Introspection data for com.ubuntu.WhoopsiePreferences ---- */
166
static const _ExtendedGDBusArgInfo _whoopsie_preferences_method_info_set_report_crashes_IN_ARG_report =
177
static const _ExtendedGDBusArgInfo * const _whoopsie_preferences_method_info_set_report_crashes_IN_ARG_pointers[] =
179
&_whoopsie_preferences_method_info_set_report_crashes_IN_ARG_report,
183
static const _ExtendedGDBusMethodInfo _whoopsie_preferences_method_info_set_report_crashes =
187
(gchar *) "SetReportCrashes",
188
(GDBusArgInfo **) &_whoopsie_preferences_method_info_set_report_crashes_IN_ARG_pointers,
192
"handle-set-report-crashes",
196
static const _ExtendedGDBusArgInfo _whoopsie_preferences_method_info_set_report_metrics_IN_ARG_report =
207
static const _ExtendedGDBusArgInfo * const _whoopsie_preferences_method_info_set_report_metrics_IN_ARG_pointers[] =
209
&_whoopsie_preferences_method_info_set_report_metrics_IN_ARG_report,
213
static const _ExtendedGDBusMethodInfo _whoopsie_preferences_method_info_set_report_metrics =
217
(gchar *) "SetReportMetrics",
218
(GDBusArgInfo **) &_whoopsie_preferences_method_info_set_report_metrics_IN_ARG_pointers,
222
"handle-set-report-metrics",
226
static const _ExtendedGDBusArgInfo _whoopsie_preferences_method_info_get_identifier_OUT_ARG_identifier =
230
(gchar *) "identifier",
237
static const _ExtendedGDBusArgInfo * const _whoopsie_preferences_method_info_get_identifier_OUT_ARG_pointers[] =
239
&_whoopsie_preferences_method_info_get_identifier_OUT_ARG_identifier,
243
static const _ExtendedGDBusMethodInfo _whoopsie_preferences_method_info_get_identifier =
247
(gchar *) "GetIdentifier",
249
(GDBusArgInfo **) &_whoopsie_preferences_method_info_get_identifier_OUT_ARG_pointers,
252
"handle-get-identifier",
256
static const _ExtendedGDBusMethodInfo * const _whoopsie_preferences_method_info_pointers[] =
258
&_whoopsie_preferences_method_info_set_report_crashes,
259
&_whoopsie_preferences_method_info_set_report_metrics,
260
&_whoopsie_preferences_method_info_get_identifier,
264
static const _ExtendedGDBusPropertyInfo _whoopsie_preferences_property_info_report_crashes =
268
(gchar *) "ReportCrashes",
270
G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
277
static const _ExtendedGDBusPropertyInfo _whoopsie_preferences_property_info_report_metrics =
281
(gchar *) "ReportMetrics",
283
G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
290
static const _ExtendedGDBusPropertyInfo * const _whoopsie_preferences_property_info_pointers[] =
292
&_whoopsie_preferences_property_info_report_crashes,
293
&_whoopsie_preferences_property_info_report_metrics,
297
static const _ExtendedGDBusInterfaceInfo _whoopsie_preferences_interface_info =
301
(gchar *) "com.ubuntu.WhoopsiePreferences",
302
(GDBusMethodInfo **) &_whoopsie_preferences_method_info_pointers,
304
(GDBusPropertyInfo **) &_whoopsie_preferences_property_info_pointers,
307
"whoopsie-preferences",
312
* whoopsie_preferences_interface_info:
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.
316
* Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
319
whoopsie_preferences_interface_info (void)
321
return (GDBusInterfaceInfo *) &_whoopsie_preferences_interface_info.parent_struct;
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.
329
* Overrides all #GObject properties in the #WhoopsiePreferences interface for a concrete class.
330
* The properties are overridden in the order they are defined.
332
* Returns: The last property id.
335
whoopsie_preferences_override_properties (GObjectClass *klass, guint property_id_begin)
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;
345
* WhoopsiePreferences:
347
* Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-com-ubuntu-WhoopsiePreferences.top_of_page">com.ubuntu.WhoopsiePreferences</link>.
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.
359
* Virtual table for the D-Bus interface <link linkend="gdbus-interface-com-ubuntu-WhoopsiePreferences.top_of_page">com.ubuntu.WhoopsiePreferences</link>.
362
typedef WhoopsiePreferencesIface WhoopsiePreferencesInterface;
363
G_DEFINE_INTERFACE (WhoopsiePreferences, whoopsie_preferences, G_TYPE_OBJECT);
366
whoopsie_preferences_default_init (WhoopsiePreferencesIface *iface)
368
/* GObject signals for incoming D-Bus method calls: */
370
* WhoopsiePreferences::handle-set-report-crashes:
371
* @object: A #WhoopsiePreferences.
372
* @invocation: A #GDBusMethodInvocation.
373
* @arg_report: Argument passed by remote caller.
375
* Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-com-ubuntu-WhoopsiePreferences.SetReportCrashes">SetReportCrashes()</link> D-Bus method.
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.
379
* Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
381
g_signal_new ("handle-set-report-crashes",
382
G_TYPE_FROM_INTERFACE (iface),
384
G_STRUCT_OFFSET (WhoopsiePreferencesIface, handle_set_report_crashes),
385
g_signal_accumulator_true_handled,
387
g_cclosure_marshal_generic,
390
G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_BOOLEAN);
393
* WhoopsiePreferences::handle-set-report-metrics:
394
* @object: A #WhoopsiePreferences.
395
* @invocation: A #GDBusMethodInvocation.
396
* @arg_report: Argument passed by remote caller.
398
* Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-com-ubuntu-WhoopsiePreferences.SetReportMetrics">SetReportMetrics()</link> D-Bus method.
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.
402
* Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
404
g_signal_new ("handle-set-report-metrics",
405
G_TYPE_FROM_INTERFACE (iface),
407
G_STRUCT_OFFSET (WhoopsiePreferencesIface, handle_set_report_metrics),
408
g_signal_accumulator_true_handled,
410
g_cclosure_marshal_generic,
413
G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_BOOLEAN);
416
* WhoopsiePreferences::handle-get-identifier:
417
* @object: A #WhoopsiePreferences.
418
* @invocation: A #GDBusMethodInvocation.
420
* Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-com-ubuntu-WhoopsiePreferences.GetIdentifier">GetIdentifier()</link> D-Bus method.
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.
424
* Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
426
g_signal_new ("handle-get-identifier",
427
G_TYPE_FROM_INTERFACE (iface),
429
G_STRUCT_OFFSET (WhoopsiePreferencesIface, handle_get_identifier),
430
g_signal_accumulator_true_handled,
432
g_cclosure_marshal_generic,
435
G_TYPE_DBUS_METHOD_INVOCATION);
437
/* GObject properties for D-Bus properties: */
439
* WhoopsiePreferences:report-crashes:
441
* Represents the D-Bus property <link linkend="gdbus-property-com-ubuntu-WhoopsiePreferences.ReportCrashes">"ReportCrashes"</link>.
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.
445
g_object_interface_install_property (iface,
446
g_param_spec_boolean ("report-crashes", "ReportCrashes", "ReportCrashes", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
448
* WhoopsiePreferences:report-metrics:
450
* Represents the D-Bus property <link linkend="gdbus-property-com-ubuntu-WhoopsiePreferences.ReportMetrics">"ReportMetrics"</link>.
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.
454
g_object_interface_install_property (iface,
455
g_param_spec_boolean ("report-metrics", "ReportMetrics", "ReportMetrics", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
459
* whoopsie_preferences_get_report_crashes: (skip)
460
* @object: A #WhoopsiePreferences.
462
* Gets the value of the <link linkend="gdbus-property-com-ubuntu-WhoopsiePreferences.ReportCrashes">"ReportCrashes"</link> D-Bus property.
464
* Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
466
* Returns: The property value.
469
whoopsie_preferences_get_report_crashes (WhoopsiePreferences *object)
471
return WHOOPSIE_PREFERENCES_GET_IFACE (object)->get_report_crashes (object);
475
* whoopsie_preferences_set_report_crashes: (skip)
476
* @object: A #WhoopsiePreferences.
477
* @value: The value to set.
479
* Sets the <link linkend="gdbus-property-com-ubuntu-WhoopsiePreferences.ReportCrashes">"ReportCrashes"</link> D-Bus property to @value.
481
* Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
484
whoopsie_preferences_set_report_crashes (WhoopsiePreferences *object, gboolean value)
486
g_object_set (G_OBJECT (object), "report-crashes", value, NULL);
490
* whoopsie_preferences_get_report_metrics: (skip)
491
* @object: A #WhoopsiePreferences.
493
* Gets the value of the <link linkend="gdbus-property-com-ubuntu-WhoopsiePreferences.ReportMetrics">"ReportMetrics"</link> D-Bus property.
495
* Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
497
* Returns: The property value.
500
whoopsie_preferences_get_report_metrics (WhoopsiePreferences *object)
502
return WHOOPSIE_PREFERENCES_GET_IFACE (object)->get_report_metrics (object);
506
* whoopsie_preferences_set_report_metrics: (skip)
507
* @object: A #WhoopsiePreferences.
508
* @value: The value to set.
510
* Sets the <link linkend="gdbus-property-com-ubuntu-WhoopsiePreferences.ReportMetrics">"ReportMetrics"</link> D-Bus property to @value.
512
* Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
515
whoopsie_preferences_set_report_metrics (WhoopsiePreferences *object, gboolean value)
517
g_object_set (G_OBJECT (object), "report-metrics", value, NULL);
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.
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.
532
* See whoopsie_preferences_call_set_report_crashes_sync() for the synchronous, blocking version of this method.
535
whoopsie_preferences_call_set_report_crashes (
536
WhoopsiePreferences *proxy,
538
GCancellable *cancellable,
539
GAsyncReadyCallback callback,
542
g_dbus_proxy_call (G_DBUS_PROXY (proxy),
544
g_variant_new ("(b)",
546
G_DBUS_CALL_FLAGS_NONE,
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.
559
* Finishes an operation started with whoopsie_preferences_call_set_report_crashes().
561
* Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
564
whoopsie_preferences_call_set_report_crashes_finish (
565
WhoopsiePreferences *proxy,
570
_ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
575
g_variant_unref (_ret);
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.
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.
589
* See whoopsie_preferences_call_set_report_crashes() for the asynchronous version of this method.
591
* Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
594
whoopsie_preferences_call_set_report_crashes_sync (
595
WhoopsiePreferences *proxy,
597
GCancellable *cancellable,
601
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
603
g_variant_new ("(b)",
605
G_DBUS_CALL_FLAGS_NONE,
613
g_variant_unref (_ret);
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.
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.
630
* See whoopsie_preferences_call_set_report_metrics_sync() for the synchronous, blocking version of this method.
633
whoopsie_preferences_call_set_report_metrics (
634
WhoopsiePreferences *proxy,
636
GCancellable *cancellable,
637
GAsyncReadyCallback callback,
640
g_dbus_proxy_call (G_DBUS_PROXY (proxy),
642
g_variant_new ("(b)",
644
G_DBUS_CALL_FLAGS_NONE,
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.
657
* Finishes an operation started with whoopsie_preferences_call_set_report_metrics().
659
* Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
662
whoopsie_preferences_call_set_report_metrics_finish (
663
WhoopsiePreferences *proxy,
668
_ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
673
g_variant_unref (_ret);
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.
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.
687
* See whoopsie_preferences_call_set_report_metrics() for the asynchronous version of this method.
689
* Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
692
whoopsie_preferences_call_set_report_metrics_sync (
693
WhoopsiePreferences *proxy,
695
GCancellable *cancellable,
699
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
701
g_variant_new ("(b)",
703
G_DBUS_CALL_FLAGS_NONE,
711
g_variant_unref (_ret);
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.
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.
727
* See whoopsie_preferences_call_get_identifier_sync() for the synchronous, blocking version of this method.
730
whoopsie_preferences_call_get_identifier (
731
WhoopsiePreferences *proxy,
732
GCancellable *cancellable,
733
GAsyncReadyCallback callback,
736
g_dbus_proxy_call (G_DBUS_PROXY (proxy),
738
g_variant_new ("()"),
739
G_DBUS_CALL_FLAGS_NONE,
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.
753
* Finishes an operation started with whoopsie_preferences_call_get_identifier().
755
* Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
758
whoopsie_preferences_call_get_identifier_finish (
759
WhoopsiePreferences *proxy,
760
gchar **out_identifier,
765
_ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
771
g_variant_unref (_ret);
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.
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.
785
* See whoopsie_preferences_call_get_identifier() for the asynchronous version of this method.
787
* Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
790
whoopsie_preferences_call_get_identifier_sync (
791
WhoopsiePreferences *proxy,
792
gchar **out_identifier,
793
GCancellable *cancellable,
797
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
799
g_variant_new ("()"),
800
G_DBUS_CALL_FLAGS_NONE,
809
g_variant_unref (_ret);
815
* whoopsie_preferences_complete_set_report_crashes:
816
* @object: A #WhoopsiePreferences.
817
* @invocation: (transfer full): A #GDBusMethodInvocation.
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.
821
* This method will free @invocation, you cannot use it afterwards.
824
whoopsie_preferences_complete_set_report_crashes (
825
WhoopsiePreferences *object,
826
GDBusMethodInvocation *invocation)
828
g_dbus_method_invocation_return_value (invocation,
829
g_variant_new ("()"));
833
* whoopsie_preferences_complete_set_report_metrics:
834
* @object: A #WhoopsiePreferences.
835
* @invocation: (transfer full): A #GDBusMethodInvocation.
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.
839
* This method will free @invocation, you cannot use it afterwards.
842
whoopsie_preferences_complete_set_report_metrics (
843
WhoopsiePreferences *object,
844
GDBusMethodInvocation *invocation)
846
g_dbus_method_invocation_return_value (invocation,
847
g_variant_new ("()"));
851
* whoopsie_preferences_complete_get_identifier:
852
* @object: A #WhoopsiePreferences.
853
* @invocation: (transfer full): A #GDBusMethodInvocation.
854
* @identifier: Parameter to return.
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.
858
* This method will free @invocation, you cannot use it afterwards.
861
whoopsie_preferences_complete_get_identifier (
862
WhoopsiePreferences *object,
863
GDBusMethodInvocation *invocation,
864
const gchar *identifier)
866
g_dbus_method_invocation_return_value (invocation,
867
g_variant_new ("(s)",
871
/* ------------------------------------------------------------------------ */
874
* WhoopsiePreferencesProxy:
876
* The #WhoopsiePreferencesProxy structure contains only private data and should only be accessed using the provided API.
880
* WhoopsiePreferencesProxyClass:
881
* @parent_class: The parent class.
883
* Class structure for #WhoopsiePreferencesProxy.
886
struct _WhoopsiePreferencesProxyPrivate
891
static void whoopsie_preferences_proxy_iface_init (WhoopsiePreferencesIface *iface);
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));
898
whoopsie_preferences_proxy_finalize (GObject *object)
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);
906
whoopsie_preferences_proxy_get_property (GObject *object,
909
GParamSpec *pspec G_GNUC_UNUSED)
911
const _ExtendedGDBusPropertyInfo *info;
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)
918
g_value_set_variant (value, variant);
923
g_dbus_gvariant_to_gvalue (variant, value);
926
g_variant_unref (variant);
930
whoopsie_preferences_proxy_set_property_cb (GDBusProxy *proxy,
934
const _ExtendedGDBusPropertyInfo *info = user_data;
937
if (!g_dbus_proxy_call_finish (proxy, res, &error))
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);
947
whoopsie_preferences_proxy_set_property (GObject *object,
950
GParamSpec *pspec G_GNUC_UNUSED)
952
const _ExtendedGDBusPropertyInfo *info;
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,
962
NULL, (GAsyncReadyCallback) whoopsie_preferences_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
963
g_variant_unref (variant);
967
whoopsie_preferences_proxy_g_signal (GDBusProxy *proxy,
968
const gchar *sender_name G_GNUC_UNUSED,
969
const gchar *signal_name,
970
GVariant *parameters)
972
_ExtendedGDBusSignalInfo *info;
979
info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_whoopsie_preferences_interface_info.parent_struct, signal_name);
982
num_params = g_variant_n_children (parameters);
983
paramv = g_new0 (GValue, num_params + 1);
984
g_value_init (¶mv[0], TYPE_WHOOPSIE_PREFERENCES);
985
g_value_set_object (¶mv[0], proxy);
986
g_variant_iter_init (&iter, parameters);
988
while ((child = g_variant_iter_next_value (&iter)) != NULL)
990
_ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
991
if (arg_info->use_gvariant)
993
g_value_init (¶mv[n], G_TYPE_VARIANT);
994
g_value_set_variant (¶mv[n], child);
998
g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
999
g_variant_unref (child);
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 (¶mv[n]);
1009
whoopsie_preferences_proxy_g_properties_changed (GDBusProxy *_proxy,
1010
GVariant *changed_properties,
1011
const gchar *const *invalidated_properties)
1013
WhoopsiePreferencesProxy *proxy = WHOOPSIE_PREFERENCES_PROXY (_proxy);
1017
_ExtendedGDBusPropertyInfo *info;
1018
g_variant_get (changed_properties, "a{sv}", &iter);
1019
while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
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);
1024
g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1026
g_variant_iter_free (iter);
1027
for (n = 0; invalidated_properties[n] != NULL; n++)
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]);
1032
g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1037
whoopsie_preferences_proxy_get_report_crashes (WhoopsiePreferences *object)
1039
WhoopsiePreferencesProxy *proxy = WHOOPSIE_PREFERENCES_PROXY (object);
1042
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ReportCrashes");
1043
if (variant != NULL)
1045
value = g_variant_get_boolean (variant);
1046
g_variant_unref (variant);
1052
whoopsie_preferences_proxy_get_report_metrics (WhoopsiePreferences *object)
1054
WhoopsiePreferencesProxy *proxy = WHOOPSIE_PREFERENCES_PROXY (object);
1057
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ReportMetrics");
1058
if (variant != NULL)
1060
value = g_variant_get_boolean (variant);
1061
g_variant_unref (variant);
1067
whoopsie_preferences_proxy_init (WhoopsiePreferencesProxy *proxy)
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 ());
1074
whoopsie_preferences_proxy_class_init (WhoopsiePreferencesProxyClass *klass)
1076
GObjectClass *gobject_class;
1077
GDBusProxyClass *proxy_class;
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;
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;
1089
whoopsie_preferences_override_properties (gobject_class, 1);
1093
whoopsie_preferences_proxy_iface_init (WhoopsiePreferencesIface *iface)
1095
iface->get_report_crashes = whoopsie_preferences_proxy_get_report_crashes;
1096
iface->get_report_metrics = whoopsie_preferences_proxy_get_report_metrics;
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.
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.
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.
1114
* See whoopsie_preferences_proxy_new_sync() for the synchronous, blocking version of this constructor.
1117
whoopsie_preferences_proxy_new (
1118
GDBusConnection *connection,
1119
GDBusProxyFlags flags,
1121
const gchar *object_path,
1122
GCancellable *cancellable,
1123
GAsyncReadyCallback callback,
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);
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
1134
* Finishes an operation started with whoopsie_preferences_proxy_new().
1136
* Returns: (transfer full) (type WhoopsiePreferencesProxy): The constructed proxy object or %NULL if @error is set.
1138
WhoopsiePreferences *
1139
whoopsie_preferences_proxy_new_finish (
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);
1149
return WHOOPSIE_PREFERENCES (ret);
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
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.
1165
* The calling thread is blocked until a reply is received.
1167
* See whoopsie_preferences_proxy_new() for the asynchronous version of this constructor.
1169
* Returns: (transfer full) (type WhoopsiePreferencesProxy): The constructed proxy object or %NULL if @error is set.
1171
WhoopsiePreferences *
1172
whoopsie_preferences_proxy_new_sync (
1173
GDBusConnection *connection,
1174
GDBusProxyFlags flags,
1176
const gchar *object_path,
1177
GCancellable *cancellable,
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);
1183
return WHOOPSIE_PREFERENCES (ret);
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.
1199
* Like whoopsie_preferences_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
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.
1204
* See whoopsie_preferences_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1207
whoopsie_preferences_proxy_new_for_bus (
1209
GDBusProxyFlags flags,
1211
const gchar *object_path,
1212
GCancellable *cancellable,
1213
GAsyncReadyCallback callback,
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);
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
1224
* Finishes an operation started with whoopsie_preferences_proxy_new_for_bus().
1226
* Returns: (transfer full) (type WhoopsiePreferencesProxy): The constructed proxy object or %NULL if @error is set.
1228
WhoopsiePreferences *
1229
whoopsie_preferences_proxy_new_for_bus_finish (
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);
1239
return WHOOPSIE_PREFERENCES (ret);
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
1253
* Like whoopsie_preferences_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1255
* The calling thread is blocked until a reply is received.
1257
* See whoopsie_preferences_proxy_new_for_bus() for the asynchronous version of this constructor.
1259
* Returns: (transfer full) (type WhoopsiePreferencesProxy): The constructed proxy object or %NULL if @error is set.
1261
WhoopsiePreferences *
1262
whoopsie_preferences_proxy_new_for_bus_sync (
1264
GDBusProxyFlags flags,
1266
const gchar *object_path,
1267
GCancellable *cancellable,
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);
1273
return WHOOPSIE_PREFERENCES (ret);
1279
/* ------------------------------------------------------------------------ */
1282
* WhoopsiePreferencesSkeleton:
1284
* The #WhoopsiePreferencesSkeleton structure contains only private data and should only be accessed using the provided API.
1288
* WhoopsiePreferencesSkeletonClass:
1289
* @parent_class: The parent class.
1291
* Class structure for #WhoopsiePreferencesSkeleton.
1294
struct _WhoopsiePreferencesSkeletonPrivate
1297
GList *changed_properties;
1298
GSource *changed_properties_idle_source;
1299
GMainContext *context;
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,
1314
WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (user_data);
1315
_ExtendedGDBusMethodInfo *info;
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);
1329
g_value_init (¶mv[n], TYPE_WHOOPSIE_PREFERENCES);
1330
g_value_set_object (¶mv[n++], skeleton);
1331
g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1332
g_value_set_object (¶mv[n++], invocation);
1333
if (info->pass_fdlist)
1336
g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
1337
g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1339
g_assert_not_reached ();
1342
g_variant_iter_init (&iter, parameters);
1343
while ((child = g_variant_iter_next_value (&iter)) != NULL)
1345
_ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1346
if (arg_info->use_gvariant)
1348
g_value_init (¶mv[n], G_TYPE_VARIANT);
1349
g_value_set_variant (¶mv[n], child);
1353
g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
1354
g_variant_unref (child);
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 (¶mv[n]);
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,
1377
WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (user_data);
1378
GValue value = G_VALUE_INIT;
1380
_ExtendedGDBusPropertyInfo *info;
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);
1388
g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
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);
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,
1411
WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (user_data);
1412
GValue value = G_VALUE_INIT;
1414
_ExtendedGDBusPropertyInfo *info;
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);
1422
g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1426
if (info->use_gvariant)
1427
g_value_set_variant (&value, variant);
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);
1437
static const GDBusInterfaceVTable _whoopsie_preferences_skeleton_vtable =
1439
_whoopsie_preferences_skeleton_handle_method_call,
1440
_whoopsie_preferences_skeleton_handle_get_property,
1441
_whoopsie_preferences_skeleton_handle_set_property,
1445
static GDBusInterfaceInfo *
1446
whoopsie_preferences_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1448
return whoopsie_preferences_interface_info ();
1451
static GDBusInterfaceVTable *
1452
whoopsie_preferences_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1454
return (GDBusInterfaceVTable *) &_whoopsie_preferences_skeleton_vtable;
1458
whoopsie_preferences_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1460
WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (_skeleton);
1462
GVariantBuilder builder;
1464
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1465
if (_whoopsie_preferences_interface_info.parent_struct.properties == NULL)
1467
for (n = 0; _whoopsie_preferences_interface_info.parent_struct.properties[n] != NULL; n++)
1469
GDBusPropertyInfo *info = _whoopsie_preferences_interface_info.parent_struct.properties[n];
1470
if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
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);
1476
g_variant_take_ref (value);
1477
g_variant_builder_add (&builder, "{sv}", info->name, value);
1478
g_variant_unref (value);
1483
return g_variant_builder_end (&builder);
1486
static gboolean _whoopsie_preferences_emit_changed (gpointer user_data);
1489
whoopsie_preferences_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1491
WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (_skeleton);
1492
gboolean emit_changed = FALSE;
1494
g_mutex_lock (&skeleton->priv->lock);
1495
if (skeleton->priv->changed_properties_idle_source != NULL)
1497
g_source_destroy (skeleton->priv->changed_properties_idle_source);
1498
skeleton->priv->changed_properties_idle_source = NULL;
1499
emit_changed = TRUE;
1501
g_mutex_unlock (&skeleton->priv->lock);
1504
_whoopsie_preferences_emit_changed (skeleton);
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));
1513
whoopsie_preferences_skeleton_finalize (GObject *object)
1515
WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (object);
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);
1529
whoopsie_preferences_skeleton_get_property (GObject *object,
1532
GParamSpec *pspec G_GNUC_UNUSED)
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);
1542
_whoopsie_preferences_emit_changed (gpointer user_data)
1544
WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (user_data);
1546
GVariantBuilder builder;
1547
GVariantBuilder invalidated_builder;
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)
1555
ChangedProperty *cp = l->data;
1557
const GValue *cur_value;
1559
cur_value = &skeleton->priv->properties[cp->prop_id - 1];
1560
if (!_g_value_equal (cur_value, &cp->orig_value))
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);
1568
if (num_changes > 0)
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)
1577
GDBusConnection *connection = ll->data;
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",
1586
g_variant_unref (signal_variant);
1587
g_list_free_full (connections, g_object_unref);
1591
g_variant_builder_clear (&builder);
1592
g_variant_builder_clear (&invalidated_builder);
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);
1602
_whoopsie_preferences_schedule_emit_changed (WhoopsiePreferencesSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
1604
ChangedProperty *cp;
1607
for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
1609
ChangedProperty *i_cp = l->data;
1610
if (i_cp->info == info)
1618
cp = g_new0 (ChangedProperty, 1);
1619
cp->prop_id = prop_id;
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);
1628
whoopsie_preferences_skeleton_notify (GObject *object,
1629
GParamSpec *pspec G_GNUC_UNUSED)
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)
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);
1642
g_mutex_unlock (&skeleton->priv->lock);
1646
whoopsie_preferences_skeleton_set_property (GObject *object,
1648
const GValue *value,
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]))
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);
1662
g_mutex_unlock (&skeleton->priv->lock);
1663
g_object_thaw_notify (object);
1667
whoopsie_preferences_skeleton_init (WhoopsiePreferencesSkeleton *skeleton)
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);
1678
whoopsie_preferences_skeleton_get_report_crashes (WhoopsiePreferences *object)
1680
WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (object);
1682
g_mutex_lock (&skeleton->priv->lock);
1683
value = g_value_get_boolean (&(skeleton->priv->properties[0]));
1684
g_mutex_unlock (&skeleton->priv->lock);
1689
whoopsie_preferences_skeleton_get_report_metrics (WhoopsiePreferences *object)
1691
WhoopsiePreferencesSkeleton *skeleton = WHOOPSIE_PREFERENCES_SKELETON (object);
1693
g_mutex_lock (&skeleton->priv->lock);
1694
value = g_value_get_boolean (&(skeleton->priv->properties[1]));
1695
g_mutex_unlock (&skeleton->priv->lock);
1700
whoopsie_preferences_skeleton_class_init (WhoopsiePreferencesSkeletonClass *klass)
1702
GObjectClass *gobject_class;
1703
GDBusInterfaceSkeletonClass *skeleton_class;
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;
1712
whoopsie_preferences_override_properties (gobject_class, 1);
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;
1722
whoopsie_preferences_skeleton_iface_init (WhoopsiePreferencesIface *iface)
1724
iface->get_report_crashes = whoopsie_preferences_skeleton_get_report_crashes;
1725
iface->get_report_metrics = whoopsie_preferences_skeleton_get_report_metrics;
1729
* whoopsie_preferences_skeleton_new:
1731
* Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-com-ubuntu-WhoopsiePreferences.top_of_page">com.ubuntu.WhoopsiePreferences</link>.
1733
* Returns: (transfer full) (type WhoopsiePreferencesSkeleton): The skeleton object.
1735
WhoopsiePreferences *
1736
whoopsie_preferences_skeleton_new (void)
1738
return WHOOPSIE_PREFERENCES (g_object_new (TYPE_WHOOPSIE_PREFERENCES_SKELETON, NULL));