2 * Generated by gdbus-codegen 2.40.0. DO NOT EDIT.
4 * The license of this code is the same as for the source it was derived from.
11 #include "src/interfaces/hostnamed/hostnamed-gen.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 org.freedesktop.hostname1
153 * ------------------------------------------------------------------------
159 * @short_description: Generated C code for the org.freedesktop.hostname1 D-Bus interface
161 * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link> D-Bus interface in C.
164 /* ---- Introspection data for org.freedesktop.hostname1 ---- */
166 static const _ExtendedGDBusArgInfo _hostname1_method_info_set_hostname_IN_ARG_name
=
177 static const _ExtendedGDBusArgInfo _hostname1_method_info_set_hostname_IN_ARG_user_interaction
=
181 (gchar
*) "user_interaction",
188 static const _ExtendedGDBusArgInfo
* const _hostname1_method_info_set_hostname_IN_ARG_pointers
[] =
190 &_hostname1_method_info_set_hostname_IN_ARG_name
,
191 &_hostname1_method_info_set_hostname_IN_ARG_user_interaction
,
195 static const _ExtendedGDBusMethodInfo _hostname1_method_info_set_hostname
=
199 (gchar
*) "SetHostname",
200 (GDBusArgInfo
**) &_hostname1_method_info_set_hostname_IN_ARG_pointers
,
204 "handle-set-hostname",
208 static const _ExtendedGDBusArgInfo _hostname1_method_info_set_static_hostname_IN_ARG_name
=
219 static const _ExtendedGDBusArgInfo _hostname1_method_info_set_static_hostname_IN_ARG_user_interaction
=
223 (gchar
*) "user_interaction",
230 static const _ExtendedGDBusArgInfo
* const _hostname1_method_info_set_static_hostname_IN_ARG_pointers
[] =
232 &_hostname1_method_info_set_static_hostname_IN_ARG_name
,
233 &_hostname1_method_info_set_static_hostname_IN_ARG_user_interaction
,
237 static const _ExtendedGDBusMethodInfo _hostname1_method_info_set_static_hostname
=
241 (gchar
*) "SetStaticHostname",
242 (GDBusArgInfo
**) &_hostname1_method_info_set_static_hostname_IN_ARG_pointers
,
246 "handle-set-static-hostname",
250 static const _ExtendedGDBusArgInfo _hostname1_method_info_set_pretty_hostname_IN_ARG_name
=
261 static const _ExtendedGDBusArgInfo _hostname1_method_info_set_pretty_hostname_IN_ARG_user_interaction
=
265 (gchar
*) "user_interaction",
272 static const _ExtendedGDBusArgInfo
* const _hostname1_method_info_set_pretty_hostname_IN_ARG_pointers
[] =
274 &_hostname1_method_info_set_pretty_hostname_IN_ARG_name
,
275 &_hostname1_method_info_set_pretty_hostname_IN_ARG_user_interaction
,
279 static const _ExtendedGDBusMethodInfo _hostname1_method_info_set_pretty_hostname
=
283 (gchar
*) "SetPrettyHostname",
284 (GDBusArgInfo
**) &_hostname1_method_info_set_pretty_hostname_IN_ARG_pointers
,
288 "handle-set-pretty-hostname",
292 static const _ExtendedGDBusArgInfo _hostname1_method_info_set_icon_name_IN_ARG_name
=
303 static const _ExtendedGDBusArgInfo _hostname1_method_info_set_icon_name_IN_ARG_user_interaction
=
307 (gchar
*) "user_interaction",
314 static const _ExtendedGDBusArgInfo
* const _hostname1_method_info_set_icon_name_IN_ARG_pointers
[] =
316 &_hostname1_method_info_set_icon_name_IN_ARG_name
,
317 &_hostname1_method_info_set_icon_name_IN_ARG_user_interaction
,
321 static const _ExtendedGDBusMethodInfo _hostname1_method_info_set_icon_name
=
325 (gchar
*) "SetIconName",
326 (GDBusArgInfo
**) &_hostname1_method_info_set_icon_name_IN_ARG_pointers
,
330 "handle-set-icon-name",
334 static const _ExtendedGDBusMethodInfo
* const _hostname1_method_info_pointers
[] =
336 &_hostname1_method_info_set_hostname
,
337 &_hostname1_method_info_set_static_hostname
,
338 &_hostname1_method_info_set_pretty_hostname
,
339 &_hostname1_method_info_set_icon_name
,
343 static const _ExtendedGDBusPropertyInfo _hostname1_property_info_hostname
=
347 (gchar
*) "Hostname",
349 G_DBUS_PROPERTY_INFO_FLAGS_READABLE
,
356 static const _ExtendedGDBusPropertyInfo _hostname1_property_info_static_hostname
=
360 (gchar
*) "StaticHostname",
362 G_DBUS_PROPERTY_INFO_FLAGS_READABLE
,
369 static const _ExtendedGDBusPropertyInfo _hostname1_property_info_pretty_hostname
=
373 (gchar
*) "PrettyHostname",
375 G_DBUS_PROPERTY_INFO_FLAGS_READABLE
,
382 static const _ExtendedGDBusPropertyInfo _hostname1_property_info_icon_name
=
386 (gchar
*) "IconName",
388 G_DBUS_PROPERTY_INFO_FLAGS_READABLE
,
395 static const _ExtendedGDBusPropertyInfo
* const _hostname1_property_info_pointers
[] =
397 &_hostname1_property_info_hostname
,
398 &_hostname1_property_info_static_hostname
,
399 &_hostname1_property_info_pretty_hostname
,
400 &_hostname1_property_info_icon_name
,
404 static const _ExtendedGDBusInterfaceInfo _hostname1_interface_info
=
408 (gchar
*) "org.freedesktop.hostname1",
409 (GDBusMethodInfo
**) &_hostname1_method_info_pointers
,
411 (GDBusPropertyInfo
**) &_hostname1_property_info_pointers
,
419 * hostname1_interface_info:
421 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link> D-Bus interface.
423 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
426 hostname1_interface_info (void)
428 return (GDBusInterfaceInfo
*) &_hostname1_interface_info
.parent_struct
;
432 * hostname1_override_properties:
433 * @klass: The class structure for a #GObject<!-- -->-derived class.
434 * @property_id_begin: The property id to assign to the first overridden property.
436 * Overrides all #GObject properties in the #Hostname1 interface for a concrete class.
437 * The properties are overridden in the order they are defined.
439 * Returns: The last property id.
442 hostname1_override_properties (GObjectClass
*klass
, guint property_id_begin
)
444 g_object_class_override_property (klass
, property_id_begin
++, "hostname");
445 g_object_class_override_property (klass
, property_id_begin
++, "static-hostname");
446 g_object_class_override_property (klass
, property_id_begin
++, "pretty-hostname");
447 g_object_class_override_property (klass
, property_id_begin
++, "icon-name");
448 return property_id_begin
- 1;
456 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link>.
461 * @parent_iface: The parent interface.
462 * @handle_set_hostname: Handler for the #Hostname1::handle-set-hostname signal.
463 * @handle_set_icon_name: Handler for the #Hostname1::handle-set-icon-name signal.
464 * @handle_set_pretty_hostname: Handler for the #Hostname1::handle-set-pretty-hostname signal.
465 * @handle_set_static_hostname: Handler for the #Hostname1::handle-set-static-hostname signal.
466 * @get_hostname: Getter for the #Hostname1:hostname property.
467 * @get_icon_name: Getter for the #Hostname1:icon-name property.
468 * @get_pretty_hostname: Getter for the #Hostname1:pretty-hostname property.
469 * @get_static_hostname: Getter for the #Hostname1:static-hostname property.
471 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link>.
474 typedef Hostname1Iface Hostname1Interface
;
475 G_DEFINE_INTERFACE (Hostname1
, hostname1
, G_TYPE_OBJECT
);
478 hostname1_default_init (Hostname1Iface
*iface
)
480 /* GObject signals for incoming D-Bus method calls: */
482 * Hostname1::handle-set-hostname:
483 * @object: A #Hostname1.
484 * @invocation: A #GDBusMethodInvocation.
485 * @arg_name: Argument passed by remote caller.
486 * @arg_user_interaction: Argument passed by remote caller.
488 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-hostname1.SetHostname">SetHostname()</link> D-Bus method.
490 * 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 hostname1_complete_set_hostname() 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.
492 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
494 g_signal_new ("handle-set-hostname",
495 G_TYPE_FROM_INTERFACE (iface
),
497 G_STRUCT_OFFSET (Hostname1Iface
, handle_set_hostname
),
498 g_signal_accumulator_true_handled
,
500 g_cclosure_marshal_generic
,
503 G_TYPE_DBUS_METHOD_INVOCATION
, G_TYPE_STRING
, G_TYPE_BOOLEAN
);
506 * Hostname1::handle-set-static-hostname:
507 * @object: A #Hostname1.
508 * @invocation: A #GDBusMethodInvocation.
509 * @arg_name: Argument passed by remote caller.
510 * @arg_user_interaction: Argument passed by remote caller.
512 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-hostname1.SetStaticHostname">SetStaticHostname()</link> D-Bus method.
514 * 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 hostname1_complete_set_static_hostname() 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.
516 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
518 g_signal_new ("handle-set-static-hostname",
519 G_TYPE_FROM_INTERFACE (iface
),
521 G_STRUCT_OFFSET (Hostname1Iface
, handle_set_static_hostname
),
522 g_signal_accumulator_true_handled
,
524 g_cclosure_marshal_generic
,
527 G_TYPE_DBUS_METHOD_INVOCATION
, G_TYPE_STRING
, G_TYPE_BOOLEAN
);
530 * Hostname1::handle-set-pretty-hostname:
531 * @object: A #Hostname1.
532 * @invocation: A #GDBusMethodInvocation.
533 * @arg_name: Argument passed by remote caller.
534 * @arg_user_interaction: Argument passed by remote caller.
536 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-hostname1.SetPrettyHostname">SetPrettyHostname()</link> D-Bus method.
538 * 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 hostname1_complete_set_pretty_hostname() 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.
540 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
542 g_signal_new ("handle-set-pretty-hostname",
543 G_TYPE_FROM_INTERFACE (iface
),
545 G_STRUCT_OFFSET (Hostname1Iface
, handle_set_pretty_hostname
),
546 g_signal_accumulator_true_handled
,
548 g_cclosure_marshal_generic
,
551 G_TYPE_DBUS_METHOD_INVOCATION
, G_TYPE_STRING
, G_TYPE_BOOLEAN
);
554 * Hostname1::handle-set-icon-name:
555 * @object: A #Hostname1.
556 * @invocation: A #GDBusMethodInvocation.
557 * @arg_name: Argument passed by remote caller.
558 * @arg_user_interaction: Argument passed by remote caller.
560 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-hostname1.SetIconName">SetIconName()</link> D-Bus method.
562 * 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 hostname1_complete_set_icon_name() 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.
564 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
566 g_signal_new ("handle-set-icon-name",
567 G_TYPE_FROM_INTERFACE (iface
),
569 G_STRUCT_OFFSET (Hostname1Iface
, handle_set_icon_name
),
570 g_signal_accumulator_true_handled
,
572 g_cclosure_marshal_generic
,
575 G_TYPE_DBUS_METHOD_INVOCATION
, G_TYPE_STRING
, G_TYPE_BOOLEAN
);
577 /* GObject properties for D-Bus properties: */
579 * Hostname1:hostname:
581 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.Hostname">"Hostname"</link>.
583 * 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.
585 g_object_interface_install_property (iface
,
586 g_param_spec_string ("hostname", "Hostname", "Hostname", NULL
, G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
));
588 * Hostname1:static-hostname:
590 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.StaticHostname">"StaticHostname"</link>.
592 * 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.
594 g_object_interface_install_property (iface
,
595 g_param_spec_string ("static-hostname", "StaticHostname", "StaticHostname", NULL
, G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
));
597 * Hostname1:pretty-hostname:
599 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.PrettyHostname">"PrettyHostname"</link>.
601 * 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.
603 g_object_interface_install_property (iface
,
604 g_param_spec_string ("pretty-hostname", "PrettyHostname", "PrettyHostname", NULL
, G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
));
606 * Hostname1:icon-name:
608 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.IconName">"IconName"</link>.
610 * 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.
612 g_object_interface_install_property (iface
,
613 g_param_spec_string ("icon-name", "IconName", "IconName", NULL
, G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS
));
617 * hostname1_get_hostname: (skip)
618 * @object: A #Hostname1.
620 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.Hostname">"Hostname"</link> D-Bus property.
622 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
624 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use hostname1_dup_hostname() if on another thread.</warning>
626 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
629 hostname1_get_hostname (Hostname1
*object
)
631 return HOSTNAME1_GET_IFACE (object
)->get_hostname (object
);
635 * hostname1_dup_hostname: (skip)
636 * @object: A #Hostname1.
638 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.Hostname">"Hostname"</link> D-Bus property.
640 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
642 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
645 hostname1_dup_hostname (Hostname1
*object
)
648 g_object_get (G_OBJECT (object
), "hostname", &value
, NULL
);
653 * hostname1_set_hostname: (skip)
654 * @object: A #Hostname1.
655 * @value: The value to set.
657 * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.Hostname">"Hostname"</link> D-Bus property to @value.
659 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
662 hostname1_set_hostname (Hostname1
*object
, const gchar
*value
)
664 g_object_set (G_OBJECT (object
), "hostname", value
, NULL
);
668 * hostname1_get_static_hostname: (skip)
669 * @object: A #Hostname1.
671 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.StaticHostname">"StaticHostname"</link> D-Bus property.
673 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
675 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use hostname1_dup_static_hostname() if on another thread.</warning>
677 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
680 hostname1_get_static_hostname (Hostname1
*object
)
682 return HOSTNAME1_GET_IFACE (object
)->get_static_hostname (object
);
686 * hostname1_dup_static_hostname: (skip)
687 * @object: A #Hostname1.
689 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.StaticHostname">"StaticHostname"</link> D-Bus property.
691 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
693 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
696 hostname1_dup_static_hostname (Hostname1
*object
)
699 g_object_get (G_OBJECT (object
), "static-hostname", &value
, NULL
);
704 * hostname1_set_static_hostname: (skip)
705 * @object: A #Hostname1.
706 * @value: The value to set.
708 * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.StaticHostname">"StaticHostname"</link> D-Bus property to @value.
710 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
713 hostname1_set_static_hostname (Hostname1
*object
, const gchar
*value
)
715 g_object_set (G_OBJECT (object
), "static-hostname", value
, NULL
);
719 * hostname1_get_pretty_hostname: (skip)
720 * @object: A #Hostname1.
722 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.PrettyHostname">"PrettyHostname"</link> D-Bus property.
724 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
726 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use hostname1_dup_pretty_hostname() if on another thread.</warning>
728 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
731 hostname1_get_pretty_hostname (Hostname1
*object
)
733 return HOSTNAME1_GET_IFACE (object
)->get_pretty_hostname (object
);
737 * hostname1_dup_pretty_hostname: (skip)
738 * @object: A #Hostname1.
740 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.PrettyHostname">"PrettyHostname"</link> D-Bus property.
742 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
744 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
747 hostname1_dup_pretty_hostname (Hostname1
*object
)
750 g_object_get (G_OBJECT (object
), "pretty-hostname", &value
, NULL
);
755 * hostname1_set_pretty_hostname: (skip)
756 * @object: A #Hostname1.
757 * @value: The value to set.
759 * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.PrettyHostname">"PrettyHostname"</link> D-Bus property to @value.
761 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
764 hostname1_set_pretty_hostname (Hostname1
*object
, const gchar
*value
)
766 g_object_set (G_OBJECT (object
), "pretty-hostname", value
, NULL
);
770 * hostname1_get_icon_name: (skip)
771 * @object: A #Hostname1.
773 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.IconName">"IconName"</link> D-Bus property.
775 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
777 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use hostname1_dup_icon_name() if on another thread.</warning>
779 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
782 hostname1_get_icon_name (Hostname1
*object
)
784 return HOSTNAME1_GET_IFACE (object
)->get_icon_name (object
);
788 * hostname1_dup_icon_name: (skip)
789 * @object: A #Hostname1.
791 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.IconName">"IconName"</link> D-Bus property.
793 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
795 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
798 hostname1_dup_icon_name (Hostname1
*object
)
801 g_object_get (G_OBJECT (object
), "icon-name", &value
, NULL
);
806 * hostname1_set_icon_name: (skip)
807 * @object: A #Hostname1.
808 * @value: The value to set.
810 * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.IconName">"IconName"</link> D-Bus property to @value.
812 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
815 hostname1_set_icon_name (Hostname1
*object
, const gchar
*value
)
817 g_object_set (G_OBJECT (object
), "icon-name", value
, NULL
);
821 * hostname1_call_set_hostname:
822 * @proxy: A #Hostname1Proxy.
823 * @arg_name: Argument to pass with the method invocation.
824 * @arg_user_interaction: Argument to pass with the method invocation.
825 * @cancellable: (allow-none): A #GCancellable or %NULL.
826 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
827 * @user_data: User data to pass to @callback.
829 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetHostname">SetHostname()</link> D-Bus method on @proxy.
830 * 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.
831 * You can then call hostname1_call_set_hostname_finish() to get the result of the operation.
833 * See hostname1_call_set_hostname_sync() for the synchronous, blocking version of this method.
836 hostname1_call_set_hostname (
838 const gchar
*arg_name
,
839 gboolean arg_user_interaction
,
840 GCancellable
*cancellable
,
841 GAsyncReadyCallback callback
,
844 g_dbus_proxy_call (G_DBUS_PROXY (proxy
),
846 g_variant_new ("(sb)",
848 arg_user_interaction
),
849 G_DBUS_CALL_FLAGS_NONE
,
857 * hostname1_call_set_hostname_finish:
858 * @proxy: A #Hostname1Proxy.
859 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_call_set_hostname().
860 * @error: Return location for error or %NULL.
862 * Finishes an operation started with hostname1_call_set_hostname().
864 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
867 hostname1_call_set_hostname_finish (
873 _ret
= g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy
), res
, error
);
878 g_variant_unref (_ret
);
884 * hostname1_call_set_hostname_sync:
885 * @proxy: A #Hostname1Proxy.
886 * @arg_name: Argument to pass with the method invocation.
887 * @arg_user_interaction: Argument to pass with the method invocation.
888 * @cancellable: (allow-none): A #GCancellable or %NULL.
889 * @error: Return location for error or %NULL.
891 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetHostname">SetHostname()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
893 * See hostname1_call_set_hostname() for the asynchronous version of this method.
895 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
898 hostname1_call_set_hostname_sync (
900 const gchar
*arg_name
,
901 gboolean arg_user_interaction
,
902 GCancellable
*cancellable
,
906 _ret
= g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy
),
908 g_variant_new ("(sb)",
910 arg_user_interaction
),
911 G_DBUS_CALL_FLAGS_NONE
,
919 g_variant_unref (_ret
);
925 * hostname1_call_set_static_hostname:
926 * @proxy: A #Hostname1Proxy.
927 * @arg_name: Argument to pass with the method invocation.
928 * @arg_user_interaction: Argument to pass with the method invocation.
929 * @cancellable: (allow-none): A #GCancellable or %NULL.
930 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
931 * @user_data: User data to pass to @callback.
933 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetStaticHostname">SetStaticHostname()</link> D-Bus method on @proxy.
934 * 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.
935 * You can then call hostname1_call_set_static_hostname_finish() to get the result of the operation.
937 * See hostname1_call_set_static_hostname_sync() for the synchronous, blocking version of this method.
940 hostname1_call_set_static_hostname (
942 const gchar
*arg_name
,
943 gboolean arg_user_interaction
,
944 GCancellable
*cancellable
,
945 GAsyncReadyCallback callback
,
948 g_dbus_proxy_call (G_DBUS_PROXY (proxy
),
950 g_variant_new ("(sb)",
952 arg_user_interaction
),
953 G_DBUS_CALL_FLAGS_NONE
,
961 * hostname1_call_set_static_hostname_finish:
962 * @proxy: A #Hostname1Proxy.
963 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_call_set_static_hostname().
964 * @error: Return location for error or %NULL.
966 * Finishes an operation started with hostname1_call_set_static_hostname().
968 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
971 hostname1_call_set_static_hostname_finish (
977 _ret
= g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy
), res
, error
);
982 g_variant_unref (_ret
);
988 * hostname1_call_set_static_hostname_sync:
989 * @proxy: A #Hostname1Proxy.
990 * @arg_name: Argument to pass with the method invocation.
991 * @arg_user_interaction: Argument to pass with the method invocation.
992 * @cancellable: (allow-none): A #GCancellable or %NULL.
993 * @error: Return location for error or %NULL.
995 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetStaticHostname">SetStaticHostname()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
997 * See hostname1_call_set_static_hostname() for the asynchronous version of this method.
999 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1002 hostname1_call_set_static_hostname_sync (
1004 const gchar
*arg_name
,
1005 gboolean arg_user_interaction
,
1006 GCancellable
*cancellable
,
1010 _ret
= g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy
),
1011 "SetStaticHostname",
1012 g_variant_new ("(sb)",
1014 arg_user_interaction
),
1015 G_DBUS_CALL_FLAGS_NONE
,
1021 g_variant_get (_ret
,
1023 g_variant_unref (_ret
);
1025 return _ret
!= NULL
;
1029 * hostname1_call_set_pretty_hostname:
1030 * @proxy: A #Hostname1Proxy.
1031 * @arg_name: Argument to pass with the method invocation.
1032 * @arg_user_interaction: Argument to pass with the method invocation.
1033 * @cancellable: (allow-none): A #GCancellable or %NULL.
1034 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1035 * @user_data: User data to pass to @callback.
1037 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetPrettyHostname">SetPrettyHostname()</link> D-Bus method on @proxy.
1038 * 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.
1039 * You can then call hostname1_call_set_pretty_hostname_finish() to get the result of the operation.
1041 * See hostname1_call_set_pretty_hostname_sync() for the synchronous, blocking version of this method.
1044 hostname1_call_set_pretty_hostname (
1046 const gchar
*arg_name
,
1047 gboolean arg_user_interaction
,
1048 GCancellable
*cancellable
,
1049 GAsyncReadyCallback callback
,
1052 g_dbus_proxy_call (G_DBUS_PROXY (proxy
),
1053 "SetPrettyHostname",
1054 g_variant_new ("(sb)",
1056 arg_user_interaction
),
1057 G_DBUS_CALL_FLAGS_NONE
,
1065 * hostname1_call_set_pretty_hostname_finish:
1066 * @proxy: A #Hostname1Proxy.
1067 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_call_set_pretty_hostname().
1068 * @error: Return location for error or %NULL.
1070 * Finishes an operation started with hostname1_call_set_pretty_hostname().
1072 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1075 hostname1_call_set_pretty_hostname_finish (
1081 _ret
= g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy
), res
, error
);
1084 g_variant_get (_ret
,
1086 g_variant_unref (_ret
);
1088 return _ret
!= NULL
;
1092 * hostname1_call_set_pretty_hostname_sync:
1093 * @proxy: A #Hostname1Proxy.
1094 * @arg_name: Argument to pass with the method invocation.
1095 * @arg_user_interaction: Argument to pass with the method invocation.
1096 * @cancellable: (allow-none): A #GCancellable or %NULL.
1097 * @error: Return location for error or %NULL.
1099 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetPrettyHostname">SetPrettyHostname()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1101 * See hostname1_call_set_pretty_hostname() for the asynchronous version of this method.
1103 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1106 hostname1_call_set_pretty_hostname_sync (
1108 const gchar
*arg_name
,
1109 gboolean arg_user_interaction
,
1110 GCancellable
*cancellable
,
1114 _ret
= g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy
),
1115 "SetPrettyHostname",
1116 g_variant_new ("(sb)",
1118 arg_user_interaction
),
1119 G_DBUS_CALL_FLAGS_NONE
,
1125 g_variant_get (_ret
,
1127 g_variant_unref (_ret
);
1129 return _ret
!= NULL
;
1133 * hostname1_call_set_icon_name:
1134 * @proxy: A #Hostname1Proxy.
1135 * @arg_name: Argument to pass with the method invocation.
1136 * @arg_user_interaction: Argument to pass with the method invocation.
1137 * @cancellable: (allow-none): A #GCancellable or %NULL.
1138 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1139 * @user_data: User data to pass to @callback.
1141 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetIconName">SetIconName()</link> D-Bus method on @proxy.
1142 * 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.
1143 * You can then call hostname1_call_set_icon_name_finish() to get the result of the operation.
1145 * See hostname1_call_set_icon_name_sync() for the synchronous, blocking version of this method.
1148 hostname1_call_set_icon_name (
1150 const gchar
*arg_name
,
1151 gboolean arg_user_interaction
,
1152 GCancellable
*cancellable
,
1153 GAsyncReadyCallback callback
,
1156 g_dbus_proxy_call (G_DBUS_PROXY (proxy
),
1158 g_variant_new ("(sb)",
1160 arg_user_interaction
),
1161 G_DBUS_CALL_FLAGS_NONE
,
1169 * hostname1_call_set_icon_name_finish:
1170 * @proxy: A #Hostname1Proxy.
1171 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_call_set_icon_name().
1172 * @error: Return location for error or %NULL.
1174 * Finishes an operation started with hostname1_call_set_icon_name().
1176 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1179 hostname1_call_set_icon_name_finish (
1185 _ret
= g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy
), res
, error
);
1188 g_variant_get (_ret
,
1190 g_variant_unref (_ret
);
1192 return _ret
!= NULL
;
1196 * hostname1_call_set_icon_name_sync:
1197 * @proxy: A #Hostname1Proxy.
1198 * @arg_name: Argument to pass with the method invocation.
1199 * @arg_user_interaction: Argument to pass with the method invocation.
1200 * @cancellable: (allow-none): A #GCancellable or %NULL.
1201 * @error: Return location for error or %NULL.
1203 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetIconName">SetIconName()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1205 * See hostname1_call_set_icon_name() for the asynchronous version of this method.
1207 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1210 hostname1_call_set_icon_name_sync (
1212 const gchar
*arg_name
,
1213 gboolean arg_user_interaction
,
1214 GCancellable
*cancellable
,
1218 _ret
= g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy
),
1220 g_variant_new ("(sb)",
1222 arg_user_interaction
),
1223 G_DBUS_CALL_FLAGS_NONE
,
1229 g_variant_get (_ret
,
1231 g_variant_unref (_ret
);
1233 return _ret
!= NULL
;
1237 * hostname1_complete_set_hostname:
1238 * @object: A #Hostname1.
1239 * @invocation: (transfer full): A #GDBusMethodInvocation.
1241 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-hostname1.SetHostname">SetHostname()</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.
1243 * This method will free @invocation, you cannot use it afterwards.
1246 hostname1_complete_set_hostname (
1248 GDBusMethodInvocation
*invocation
)
1250 g_dbus_method_invocation_return_value (invocation
,
1251 g_variant_new ("()"));
1255 * hostname1_complete_set_static_hostname:
1256 * @object: A #Hostname1.
1257 * @invocation: (transfer full): A #GDBusMethodInvocation.
1259 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-hostname1.SetStaticHostname">SetStaticHostname()</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.
1261 * This method will free @invocation, you cannot use it afterwards.
1264 hostname1_complete_set_static_hostname (
1266 GDBusMethodInvocation
*invocation
)
1268 g_dbus_method_invocation_return_value (invocation
,
1269 g_variant_new ("()"));
1273 * hostname1_complete_set_pretty_hostname:
1274 * @object: A #Hostname1.
1275 * @invocation: (transfer full): A #GDBusMethodInvocation.
1277 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-hostname1.SetPrettyHostname">SetPrettyHostname()</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.
1279 * This method will free @invocation, you cannot use it afterwards.
1282 hostname1_complete_set_pretty_hostname (
1284 GDBusMethodInvocation
*invocation
)
1286 g_dbus_method_invocation_return_value (invocation
,
1287 g_variant_new ("()"));
1291 * hostname1_complete_set_icon_name:
1292 * @object: A #Hostname1.
1293 * @invocation: (transfer full): A #GDBusMethodInvocation.
1295 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-hostname1.SetIconName">SetIconName()</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.
1297 * This method will free @invocation, you cannot use it afterwards.
1300 hostname1_complete_set_icon_name (
1302 GDBusMethodInvocation
*invocation
)
1304 g_dbus_method_invocation_return_value (invocation
,
1305 g_variant_new ("()"));
1308 /* ------------------------------------------------------------------------ */
1313 * The #Hostname1Proxy structure contains only private data and should only be accessed using the provided API.
1317 * Hostname1ProxyClass:
1318 * @parent_class: The parent class.
1320 * Class structure for #Hostname1Proxy.
1323 struct _Hostname1ProxyPrivate
1328 static void hostname1_proxy_iface_init (Hostname1Iface
*iface
);
1330 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1331 G_DEFINE_TYPE_WITH_CODE (Hostname1Proxy
, hostname1_proxy
, G_TYPE_DBUS_PROXY
,
1332 G_ADD_PRIVATE (Hostname1Proxy
)
1333 G_IMPLEMENT_INTERFACE (TYPE_HOSTNAME1
, hostname1_proxy_iface_init
));
1336 G_DEFINE_TYPE_WITH_CODE (Hostname1Proxy
, hostname1_proxy
, G_TYPE_DBUS_PROXY
,
1337 G_IMPLEMENT_INTERFACE (TYPE_HOSTNAME1
, hostname1_proxy_iface_init
));
1341 hostname1_proxy_finalize (GObject
*object
)
1343 Hostname1Proxy
*proxy
= HOSTNAME1_PROXY (object
);
1344 g_datalist_clear (&proxy
->priv
->qdata
);
1345 G_OBJECT_CLASS (hostname1_proxy_parent_class
)->finalize (object
);
1349 hostname1_proxy_get_property (GObject
*object
,
1352 GParamSpec
*pspec G_GNUC_UNUSED
)
1354 const _ExtendedGDBusPropertyInfo
*info
;
1356 g_assert (prop_id
!= 0 && prop_id
- 1 < 4);
1357 info
= _hostname1_property_info_pointers
[prop_id
- 1];
1358 variant
= g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object
), info
->parent_struct
.name
);
1359 if (info
->use_gvariant
)
1361 g_value_set_variant (value
, variant
);
1365 if (variant
!= NULL
)
1366 g_dbus_gvariant_to_gvalue (variant
, value
);
1368 if (variant
!= NULL
)
1369 g_variant_unref (variant
);
1373 hostname1_proxy_set_property_cb (GDBusProxy
*proxy
,
1377 const _ExtendedGDBusPropertyInfo
*info
= user_data
;
1381 _ret
= g_dbus_proxy_call_finish (proxy
, res
, &error
);
1384 g_warning ("Error setting property '%s' on interface org.freedesktop.hostname1: %s (%s, %d)",
1385 info
->parent_struct
.name
,
1386 error
->message
, g_quark_to_string (error
->domain
), error
->code
);
1387 g_error_free (error
);
1391 g_variant_unref (_ret
);
1396 hostname1_proxy_set_property (GObject
*object
,
1398 const GValue
*value
,
1399 GParamSpec
*pspec G_GNUC_UNUSED
)
1401 const _ExtendedGDBusPropertyInfo
*info
;
1403 g_assert (prop_id
!= 0 && prop_id
- 1 < 4);
1404 info
= _hostname1_property_info_pointers
[prop_id
- 1];
1405 variant
= g_dbus_gvalue_to_gvariant (value
, G_VARIANT_TYPE (info
->parent_struct
.signature
));
1406 g_dbus_proxy_call (G_DBUS_PROXY (object
),
1407 "org.freedesktop.DBus.Properties.Set",
1408 g_variant_new ("(ssv)", "org.freedesktop.hostname1", info
->parent_struct
.name
, variant
),
1409 G_DBUS_CALL_FLAGS_NONE
,
1411 NULL
, (GAsyncReadyCallback
) hostname1_proxy_set_property_cb
, (GDBusPropertyInfo
*) &info
->parent_struct
);
1412 g_variant_unref (variant
);
1416 hostname1_proxy_g_signal (GDBusProxy
*proxy
,
1417 const gchar
*sender_name G_GNUC_UNUSED
,
1418 const gchar
*signal_name
,
1419 GVariant
*parameters
)
1421 _ExtendedGDBusSignalInfo
*info
;
1428 info
= (_ExtendedGDBusSignalInfo
*) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo
*) &_hostname1_interface_info
.parent_struct
, signal_name
);
1431 num_params
= g_variant_n_children (parameters
);
1432 paramv
= g_new0 (GValue
, num_params
+ 1);
1433 g_value_init (¶mv
[0], TYPE_HOSTNAME1
);
1434 g_value_set_object (¶mv
[0], proxy
);
1435 g_variant_iter_init (&iter
, parameters
);
1437 while ((child
= g_variant_iter_next_value (&iter
)) != NULL
)
1439 _ExtendedGDBusArgInfo
*arg_info
= (_ExtendedGDBusArgInfo
*) info
->parent_struct
.args
[n
- 1];
1440 if (arg_info
->use_gvariant
)
1442 g_value_init (¶mv
[n
], G_TYPE_VARIANT
);
1443 g_value_set_variant (¶mv
[n
], child
);
1447 g_dbus_gvariant_to_gvalue (child
, ¶mv
[n
++]);
1448 g_variant_unref (child
);
1450 signal_id
= g_signal_lookup (info
->signal_name
, TYPE_HOSTNAME1
);
1451 g_signal_emitv (paramv
, signal_id
, 0, NULL
);
1452 for (n
= 0; n
< num_params
+ 1; n
++)
1453 g_value_unset (¶mv
[n
]);
1458 hostname1_proxy_g_properties_changed (GDBusProxy
*_proxy
,
1459 GVariant
*changed_properties
,
1460 const gchar
*const *invalidated_properties
)
1462 Hostname1Proxy
*proxy
= HOSTNAME1_PROXY (_proxy
);
1466 _ExtendedGDBusPropertyInfo
*info
;
1467 g_variant_get (changed_properties
, "a{sv}", &iter
);
1468 while (g_variant_iter_next (iter
, "{&sv}", &key
, NULL
))
1470 info
= (_ExtendedGDBusPropertyInfo
*) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo
*) &_hostname1_interface_info
.parent_struct
, key
);
1471 g_datalist_remove_data (&proxy
->priv
->qdata
, key
);
1473 g_object_notify (G_OBJECT (proxy
), info
->hyphen_name
);
1475 g_variant_iter_free (iter
);
1476 for (n
= 0; invalidated_properties
[n
] != NULL
; n
++)
1478 info
= (_ExtendedGDBusPropertyInfo
*) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo
*) &_hostname1_interface_info
.parent_struct
, invalidated_properties
[n
]);
1479 g_datalist_remove_data (&proxy
->priv
->qdata
, invalidated_properties
[n
]);
1481 g_object_notify (G_OBJECT (proxy
), info
->hyphen_name
);
1485 static const gchar
*
1486 hostname1_proxy_get_hostname (Hostname1
*object
)
1488 Hostname1Proxy
*proxy
= HOSTNAME1_PROXY (object
);
1490 const gchar
*value
= NULL
;
1491 variant
= g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy
), "Hostname");
1492 if (variant
!= NULL
)
1494 value
= g_variant_get_string (variant
, NULL
);
1495 g_variant_unref (variant
);
1500 static const gchar
*
1501 hostname1_proxy_get_static_hostname (Hostname1
*object
)
1503 Hostname1Proxy
*proxy
= HOSTNAME1_PROXY (object
);
1505 const gchar
*value
= NULL
;
1506 variant
= g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy
), "StaticHostname");
1507 if (variant
!= NULL
)
1509 value
= g_variant_get_string (variant
, NULL
);
1510 g_variant_unref (variant
);
1515 static const gchar
*
1516 hostname1_proxy_get_pretty_hostname (Hostname1
*object
)
1518 Hostname1Proxy
*proxy
= HOSTNAME1_PROXY (object
);
1520 const gchar
*value
= NULL
;
1521 variant
= g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy
), "PrettyHostname");
1522 if (variant
!= NULL
)
1524 value
= g_variant_get_string (variant
, NULL
);
1525 g_variant_unref (variant
);
1530 static const gchar
*
1531 hostname1_proxy_get_icon_name (Hostname1
*object
)
1533 Hostname1Proxy
*proxy
= HOSTNAME1_PROXY (object
);
1535 const gchar
*value
= NULL
;
1536 variant
= g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy
), "IconName");
1537 if (variant
!= NULL
)
1539 value
= g_variant_get_string (variant
, NULL
);
1540 g_variant_unref (variant
);
1546 hostname1_proxy_init (Hostname1Proxy
*proxy
)
1548 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1549 proxy
->priv
= hostname1_proxy_get_instance_private (proxy
);
1551 proxy
->priv
= G_TYPE_INSTANCE_GET_PRIVATE (proxy
, TYPE_HOSTNAME1_PROXY
, Hostname1ProxyPrivate
);
1554 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy
), hostname1_interface_info ());
1558 hostname1_proxy_class_init (Hostname1ProxyClass
*klass
)
1560 GObjectClass
*gobject_class
;
1561 GDBusProxyClass
*proxy_class
;
1563 gobject_class
= G_OBJECT_CLASS (klass
);
1564 gobject_class
->finalize
= hostname1_proxy_finalize
;
1565 gobject_class
->get_property
= hostname1_proxy_get_property
;
1566 gobject_class
->set_property
= hostname1_proxy_set_property
;
1568 proxy_class
= G_DBUS_PROXY_CLASS (klass
);
1569 proxy_class
->g_signal
= hostname1_proxy_g_signal
;
1570 proxy_class
->g_properties_changed
= hostname1_proxy_g_properties_changed
;
1572 hostname1_override_properties (gobject_class
, 1);
1574 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1575 g_type_class_add_private (klass
, sizeof (Hostname1ProxyPrivate
));
1580 hostname1_proxy_iface_init (Hostname1Iface
*iface
)
1582 iface
->get_hostname
= hostname1_proxy_get_hostname
;
1583 iface
->get_static_hostname
= hostname1_proxy_get_static_hostname
;
1584 iface
->get_pretty_hostname
= hostname1_proxy_get_pretty_hostname
;
1585 iface
->get_icon_name
= hostname1_proxy_get_icon_name
;
1589 * hostname1_proxy_new:
1590 * @connection: A #GDBusConnection.
1591 * @flags: Flags from the #GDBusProxyFlags enumeration.
1592 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1593 * @object_path: An object path.
1594 * @cancellable: (allow-none): A #GCancellable or %NULL.
1595 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1596 * @user_data: User data to pass to @callback.
1598 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link>. See g_dbus_proxy_new() for more details.
1600 * 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.
1601 * You can then call hostname1_proxy_new_finish() to get the result of the operation.
1603 * See hostname1_proxy_new_sync() for the synchronous, blocking version of this constructor.
1606 hostname1_proxy_new (
1607 GDBusConnection
*connection
,
1608 GDBusProxyFlags flags
,
1610 const gchar
*object_path
,
1611 GCancellable
*cancellable
,
1612 GAsyncReadyCallback callback
,
1615 g_async_initable_new_async (TYPE_HOSTNAME1_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", "org.freedesktop.hostname1", NULL
);
1619 * hostname1_proxy_new_finish:
1620 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_proxy_new().
1621 * @error: Return location for error or %NULL
1623 * Finishes an operation started with hostname1_proxy_new().
1625 * Returns: (transfer full) (type Hostname1Proxy): The constructed proxy object or %NULL if @error is set.
1628 hostname1_proxy_new_finish (
1633 GObject
*source_object
;
1634 source_object
= g_async_result_get_source_object (res
);
1635 ret
= g_async_initable_new_finish (G_ASYNC_INITABLE (source_object
), res
, error
);
1636 g_object_unref (source_object
);
1638 return HOSTNAME1 (ret
);
1644 * hostname1_proxy_new_sync:
1645 * @connection: A #GDBusConnection.
1646 * @flags: Flags from the #GDBusProxyFlags enumeration.
1647 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1648 * @object_path: An object path.
1649 * @cancellable: (allow-none): A #GCancellable or %NULL.
1650 * @error: Return location for error or %NULL
1652 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link>. See g_dbus_proxy_new_sync() for more details.
1654 * The calling thread is blocked until a reply is received.
1656 * See hostname1_proxy_new() for the asynchronous version of this constructor.
1658 * Returns: (transfer full) (type Hostname1Proxy): The constructed proxy object or %NULL if @error is set.
1661 hostname1_proxy_new_sync (
1662 GDBusConnection
*connection
,
1663 GDBusProxyFlags flags
,
1665 const gchar
*object_path
,
1666 GCancellable
*cancellable
,
1670 ret
= g_initable_new (TYPE_HOSTNAME1_PROXY
, cancellable
, error
, "g-flags", flags
, "g-name", name
, "g-connection", connection
, "g-object-path", object_path
, "g-interface-name", "org.freedesktop.hostname1", NULL
);
1672 return HOSTNAME1 (ret
);
1679 * hostname1_proxy_new_for_bus:
1680 * @bus_type: A #GBusType.
1681 * @flags: Flags from the #GDBusProxyFlags enumeration.
1682 * @name: A bus name (well-known or unique).
1683 * @object_path: An object path.
1684 * @cancellable: (allow-none): A #GCancellable or %NULL.
1685 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1686 * @user_data: User data to pass to @callback.
1688 * Like hostname1_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1690 * 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.
1691 * You can then call hostname1_proxy_new_for_bus_finish() to get the result of the operation.
1693 * See hostname1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1696 hostname1_proxy_new_for_bus (
1698 GDBusProxyFlags flags
,
1700 const gchar
*object_path
,
1701 GCancellable
*cancellable
,
1702 GAsyncReadyCallback callback
,
1705 g_async_initable_new_async (TYPE_HOSTNAME1_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", "org.freedesktop.hostname1", NULL
);
1709 * hostname1_proxy_new_for_bus_finish:
1710 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_proxy_new_for_bus().
1711 * @error: Return location for error or %NULL
1713 * Finishes an operation started with hostname1_proxy_new_for_bus().
1715 * Returns: (transfer full) (type Hostname1Proxy): The constructed proxy object or %NULL if @error is set.
1718 hostname1_proxy_new_for_bus_finish (
1723 GObject
*source_object
;
1724 source_object
= g_async_result_get_source_object (res
);
1725 ret
= g_async_initable_new_finish (G_ASYNC_INITABLE (source_object
), res
, error
);
1726 g_object_unref (source_object
);
1728 return HOSTNAME1 (ret
);
1734 * hostname1_proxy_new_for_bus_sync:
1735 * @bus_type: A #GBusType.
1736 * @flags: Flags from the #GDBusProxyFlags enumeration.
1737 * @name: A bus name (well-known or unique).
1738 * @object_path: An object path.
1739 * @cancellable: (allow-none): A #GCancellable or %NULL.
1740 * @error: Return location for error or %NULL
1742 * Like hostname1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1744 * The calling thread is blocked until a reply is received.
1746 * See hostname1_proxy_new_for_bus() for the asynchronous version of this constructor.
1748 * Returns: (transfer full) (type Hostname1Proxy): The constructed proxy object or %NULL if @error is set.
1751 hostname1_proxy_new_for_bus_sync (
1753 GDBusProxyFlags flags
,
1755 const gchar
*object_path
,
1756 GCancellable
*cancellable
,
1760 ret
= g_initable_new (TYPE_HOSTNAME1_PROXY
, cancellable
, error
, "g-flags", flags
, "g-name", name
, "g-bus-type", bus_type
, "g-object-path", object_path
, "g-interface-name", "org.freedesktop.hostname1", NULL
);
1762 return HOSTNAME1 (ret
);
1768 /* ------------------------------------------------------------------------ */
1771 * Hostname1Skeleton:
1773 * The #Hostname1Skeleton structure contains only private data and should only be accessed using the provided API.
1777 * Hostname1SkeletonClass:
1778 * @parent_class: The parent class.
1780 * Class structure for #Hostname1Skeleton.
1783 struct _Hostname1SkeletonPrivate
1786 GList
*changed_properties
;
1787 GSource
*changed_properties_idle_source
;
1788 GMainContext
*context
;
1793 _hostname1_skeleton_handle_method_call (
1794 GDBusConnection
*connection G_GNUC_UNUSED
,
1795 const gchar
*sender G_GNUC_UNUSED
,
1796 const gchar
*object_path G_GNUC_UNUSED
,
1797 const gchar
*interface_name
,
1798 const gchar
*method_name
,
1799 GVariant
*parameters
,
1800 GDBusMethodInvocation
*invocation
,
1803 Hostname1Skeleton
*skeleton
= HOSTNAME1_SKELETON (user_data
);
1804 _ExtendedGDBusMethodInfo
*info
;
1812 GValue return_value
= G_VALUE_INIT
;
1813 info
= (_ExtendedGDBusMethodInfo
*) g_dbus_method_invocation_get_method_info (invocation
);
1814 g_assert (info
!= NULL
);
1815 num_params
= g_variant_n_children (parameters
);
1816 num_extra
= info
->pass_fdlist
? 3 : 2; paramv
= g_new0 (GValue
, num_params
+ num_extra
);
1818 g_value_init (¶mv
[n
], TYPE_HOSTNAME1
);
1819 g_value_set_object (¶mv
[n
++], skeleton
);
1820 g_value_init (¶mv
[n
], G_TYPE_DBUS_METHOD_INVOCATION
);
1821 g_value_set_object (¶mv
[n
++], invocation
);
1822 if (info
->pass_fdlist
)
1825 g_value_init (¶mv
[n
], G_TYPE_UNIX_FD_LIST
);
1826 g_value_set_object (¶mv
[n
++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation
)));
1828 g_assert_not_reached ();
1831 g_variant_iter_init (&iter
, parameters
);
1832 while ((child
= g_variant_iter_next_value (&iter
)) != NULL
)
1834 _ExtendedGDBusArgInfo
*arg_info
= (_ExtendedGDBusArgInfo
*) info
->parent_struct
.in_args
[n
- num_extra
];
1835 if (arg_info
->use_gvariant
)
1837 g_value_init (¶mv
[n
], G_TYPE_VARIANT
);
1838 g_value_set_variant (¶mv
[n
], child
);
1842 g_dbus_gvariant_to_gvalue (child
, ¶mv
[n
++]);
1843 g_variant_unref (child
);
1845 signal_id
= g_signal_lookup (info
->signal_name
, TYPE_HOSTNAME1
);
1846 g_value_init (&return_value
, G_TYPE_BOOLEAN
);
1847 g_signal_emitv (paramv
, signal_id
, 0, &return_value
);
1848 if (!g_value_get_boolean (&return_value
))
1849 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
);
1850 g_value_unset (&return_value
);
1851 for (n
= 0; n
< num_params
+ num_extra
; n
++)
1852 g_value_unset (¶mv
[n
]);
1857 _hostname1_skeleton_handle_get_property (
1858 GDBusConnection
*connection G_GNUC_UNUSED
,
1859 const gchar
*sender G_GNUC_UNUSED
,
1860 const gchar
*object_path G_GNUC_UNUSED
,
1861 const gchar
*interface_name G_GNUC_UNUSED
,
1862 const gchar
*property_name
,
1866 Hostname1Skeleton
*skeleton
= HOSTNAME1_SKELETON (user_data
);
1867 GValue value
= G_VALUE_INIT
;
1869 _ExtendedGDBusPropertyInfo
*info
;
1872 info
= (_ExtendedGDBusPropertyInfo
*) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo
*) &_hostname1_interface_info
.parent_struct
, property_name
);
1873 g_assert (info
!= NULL
);
1874 pspec
= g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton
), info
->hyphen_name
);
1877 g_set_error (error
, G_DBUS_ERROR
, G_DBUS_ERROR_INVALID_ARGS
, "No property with name %s", property_name
);
1881 g_value_init (&value
, pspec
->value_type
);
1882 g_object_get_property (G_OBJECT (skeleton
), info
->hyphen_name
, &value
);
1883 ret
= g_dbus_gvalue_to_gvariant (&value
, G_VARIANT_TYPE (info
->parent_struct
.signature
));
1884 g_value_unset (&value
);
1890 _hostname1_skeleton_handle_set_property (
1891 GDBusConnection
*connection G_GNUC_UNUSED
,
1892 const gchar
*sender G_GNUC_UNUSED
,
1893 const gchar
*object_path G_GNUC_UNUSED
,
1894 const gchar
*interface_name G_GNUC_UNUSED
,
1895 const gchar
*property_name
,
1900 Hostname1Skeleton
*skeleton
= HOSTNAME1_SKELETON (user_data
);
1901 GValue value
= G_VALUE_INIT
;
1903 _ExtendedGDBusPropertyInfo
*info
;
1906 info
= (_ExtendedGDBusPropertyInfo
*) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo
*) &_hostname1_interface_info
.parent_struct
, property_name
);
1907 g_assert (info
!= NULL
);
1908 pspec
= g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton
), info
->hyphen_name
);
1911 g_set_error (error
, G_DBUS_ERROR
, G_DBUS_ERROR_INVALID_ARGS
, "No property with name %s", property_name
);
1915 if (info
->use_gvariant
)
1916 g_value_set_variant (&value
, variant
);
1918 g_dbus_gvariant_to_gvalue (variant
, &value
);
1919 g_object_set_property (G_OBJECT (skeleton
), info
->hyphen_name
, &value
);
1920 g_value_unset (&value
);
1926 static const GDBusInterfaceVTable _hostname1_skeleton_vtable
=
1928 _hostname1_skeleton_handle_method_call
,
1929 _hostname1_skeleton_handle_get_property
,
1930 _hostname1_skeleton_handle_set_property
,
1934 static GDBusInterfaceInfo
*
1935 hostname1_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton
*skeleton G_GNUC_UNUSED
)
1937 return hostname1_interface_info ();
1940 static GDBusInterfaceVTable
*
1941 hostname1_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton
*skeleton G_GNUC_UNUSED
)
1943 return (GDBusInterfaceVTable
*) &_hostname1_skeleton_vtable
;
1947 hostname1_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton
*_skeleton
)
1949 Hostname1Skeleton
*skeleton
= HOSTNAME1_SKELETON (_skeleton
);
1951 GVariantBuilder builder
;
1953 g_variant_builder_init (&builder
, G_VARIANT_TYPE ("a{sv}"));
1954 if (_hostname1_interface_info
.parent_struct
.properties
== NULL
)
1956 for (n
= 0; _hostname1_interface_info
.parent_struct
.properties
[n
] != NULL
; n
++)
1958 GDBusPropertyInfo
*info
= _hostname1_interface_info
.parent_struct
.properties
[n
];
1959 if (info
->flags
& G_DBUS_PROPERTY_INFO_FLAGS_READABLE
)
1962 value
= _hostname1_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
)), "org.freedesktop.hostname1", info
->name
, NULL
, skeleton
);
1965 g_variant_take_ref (value
);
1966 g_variant_builder_add (&builder
, "{sv}", info
->name
, value
);
1967 g_variant_unref (value
);
1972 return g_variant_builder_end (&builder
);
1975 static gboolean
_hostname1_emit_changed (gpointer user_data
);
1978 hostname1_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton
*_skeleton
)
1980 Hostname1Skeleton
*skeleton
= HOSTNAME1_SKELETON (_skeleton
);
1981 gboolean emit_changed
= FALSE
;
1983 g_mutex_lock (&skeleton
->priv
->lock
);
1984 if (skeleton
->priv
->changed_properties_idle_source
!= NULL
)
1986 g_source_destroy (skeleton
->priv
->changed_properties_idle_source
);
1987 skeleton
->priv
->changed_properties_idle_source
= NULL
;
1988 emit_changed
= TRUE
;
1990 g_mutex_unlock (&skeleton
->priv
->lock
);
1993 _hostname1_emit_changed (skeleton
);
1996 static void hostname1_skeleton_iface_init (Hostname1Iface
*iface
);
1997 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1998 G_DEFINE_TYPE_WITH_CODE (Hostname1Skeleton
, hostname1_skeleton
, G_TYPE_DBUS_INTERFACE_SKELETON
,
1999 G_ADD_PRIVATE (Hostname1Skeleton
)
2000 G_IMPLEMENT_INTERFACE (TYPE_HOSTNAME1
, hostname1_skeleton_iface_init
));
2003 G_DEFINE_TYPE_WITH_CODE (Hostname1Skeleton
, hostname1_skeleton
, G_TYPE_DBUS_INTERFACE_SKELETON
,
2004 G_IMPLEMENT_INTERFACE (TYPE_HOSTNAME1
, hostname1_skeleton_iface_init
));
2008 hostname1_skeleton_finalize (GObject
*object
)
2010 Hostname1Skeleton
*skeleton
= HOSTNAME1_SKELETON (object
);
2012 for (n
= 0; n
< 4; n
++)
2013 g_value_unset (&skeleton
->priv
->properties
[n
]);
2014 g_free (skeleton
->priv
->properties
);
2015 g_list_free_full (skeleton
->priv
->changed_properties
, (GDestroyNotify
) _changed_property_free
);
2016 if (skeleton
->priv
->changed_properties_idle_source
!= NULL
)
2017 g_source_destroy (skeleton
->priv
->changed_properties_idle_source
);
2018 g_main_context_unref (skeleton
->priv
->context
);
2019 g_mutex_clear (&skeleton
->priv
->lock
);
2020 G_OBJECT_CLASS (hostname1_skeleton_parent_class
)->finalize (object
);
2024 hostname1_skeleton_get_property (GObject
*object
,
2027 GParamSpec
*pspec G_GNUC_UNUSED
)
2029 Hostname1Skeleton
*skeleton
= HOSTNAME1_SKELETON (object
);
2030 g_assert (prop_id
!= 0 && prop_id
- 1 < 4);
2031 g_mutex_lock (&skeleton
->priv
->lock
);
2032 g_value_copy (&skeleton
->priv
->properties
[prop_id
- 1], value
);
2033 g_mutex_unlock (&skeleton
->priv
->lock
);
2037 _hostname1_emit_changed (gpointer user_data
)
2039 Hostname1Skeleton
*skeleton
= HOSTNAME1_SKELETON (user_data
);
2041 GVariantBuilder builder
;
2042 GVariantBuilder invalidated_builder
;
2045 g_mutex_lock (&skeleton
->priv
->lock
);
2046 g_variant_builder_init (&builder
, G_VARIANT_TYPE ("a{sv}"));
2047 g_variant_builder_init (&invalidated_builder
, G_VARIANT_TYPE ("as"));
2048 for (l
= skeleton
->priv
->changed_properties
, num_changes
= 0; l
!= NULL
; l
= l
->next
)
2050 ChangedProperty
*cp
= l
->data
;
2052 const GValue
*cur_value
;
2054 cur_value
= &skeleton
->priv
->properties
[cp
->prop_id
- 1];
2055 if (!_g_value_equal (cur_value
, &cp
->orig_value
))
2057 variant
= g_dbus_gvalue_to_gvariant (cur_value
, G_VARIANT_TYPE (cp
->info
->parent_struct
.signature
));
2058 g_variant_builder_add (&builder
, "{sv}", cp
->info
->parent_struct
.name
, variant
);
2059 g_variant_unref (variant
);
2063 if (num_changes
> 0)
2065 GList
*connections
, *ll
;
2066 GVariant
*signal_variant
;
2067 signal_variant
= g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.hostname1",
2068 &builder
, &invalidated_builder
));
2069 connections
= g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton
));
2070 for (ll
= connections
; ll
!= NULL
; ll
= ll
->next
)
2072 GDBusConnection
*connection
= ll
->data
;
2074 g_dbus_connection_emit_signal (connection
,
2075 NULL
, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton
)),
2076 "org.freedesktop.DBus.Properties",
2077 "PropertiesChanged",
2081 g_variant_unref (signal_variant
);
2082 g_list_free_full (connections
, g_object_unref
);
2086 g_variant_builder_clear (&builder
);
2087 g_variant_builder_clear (&invalidated_builder
);
2089 g_list_free_full (skeleton
->priv
->changed_properties
, (GDestroyNotify
) _changed_property_free
);
2090 skeleton
->priv
->changed_properties
= NULL
;
2091 skeleton
->priv
->changed_properties_idle_source
= NULL
;
2092 g_mutex_unlock (&skeleton
->priv
->lock
);
2097 _hostname1_schedule_emit_changed (Hostname1Skeleton
*skeleton
, const _ExtendedGDBusPropertyInfo
*info
, guint prop_id
, const GValue
*orig_value
)
2099 ChangedProperty
*cp
;
2102 for (l
= skeleton
->priv
->changed_properties
; l
!= NULL
; l
= l
->next
)
2104 ChangedProperty
*i_cp
= l
->data
;
2105 if (i_cp
->info
== info
)
2113 cp
= g_new0 (ChangedProperty
, 1);
2114 cp
->prop_id
= prop_id
;
2116 skeleton
->priv
->changed_properties
= g_list_prepend (skeleton
->priv
->changed_properties
, cp
);
2117 g_value_init (&cp
->orig_value
, G_VALUE_TYPE (orig_value
));
2118 g_value_copy (orig_value
, &cp
->orig_value
);
2123 hostname1_skeleton_notify (GObject
*object
,
2124 GParamSpec
*pspec G_GNUC_UNUSED
)
2126 Hostname1Skeleton
*skeleton
= HOSTNAME1_SKELETON (object
);
2127 g_mutex_lock (&skeleton
->priv
->lock
);
2128 if (skeleton
->priv
->changed_properties
!= NULL
&&
2129 skeleton
->priv
->changed_properties_idle_source
== NULL
)
2131 skeleton
->priv
->changed_properties_idle_source
= g_idle_source_new ();
2132 g_source_set_priority (skeleton
->priv
->changed_properties_idle_source
, G_PRIORITY_DEFAULT
);
2133 g_source_set_callback (skeleton
->priv
->changed_properties_idle_source
, _hostname1_emit_changed
, g_object_ref (skeleton
), (GDestroyNotify
) g_object_unref
);
2134 g_source_attach (skeleton
->priv
->changed_properties_idle_source
, skeleton
->priv
->context
);
2135 g_source_unref (skeleton
->priv
->changed_properties_idle_source
);
2137 g_mutex_unlock (&skeleton
->priv
->lock
);
2141 hostname1_skeleton_set_property (GObject
*object
,
2143 const GValue
*value
,
2146 Hostname1Skeleton
*skeleton
= HOSTNAME1_SKELETON (object
);
2147 g_assert (prop_id
!= 0 && prop_id
- 1 < 4);
2148 g_mutex_lock (&skeleton
->priv
->lock
);
2149 g_object_freeze_notify (object
);
2150 if (!_g_value_equal (value
, &skeleton
->priv
->properties
[prop_id
- 1]))
2152 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton
)) != NULL
)
2153 _hostname1_schedule_emit_changed (skeleton
, _hostname1_property_info_pointers
[prop_id
- 1], prop_id
, &skeleton
->priv
->properties
[prop_id
- 1]);
2154 g_value_copy (value
, &skeleton
->priv
->properties
[prop_id
- 1]);
2155 g_object_notify_by_pspec (object
, pspec
);
2157 g_mutex_unlock (&skeleton
->priv
->lock
);
2158 g_object_thaw_notify (object
);
2162 hostname1_skeleton_init (Hostname1Skeleton
*skeleton
)
2164 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2165 skeleton
->priv
= hostname1_skeleton_get_instance_private (skeleton
);
2167 skeleton
->priv
= G_TYPE_INSTANCE_GET_PRIVATE (skeleton
, TYPE_HOSTNAME1_SKELETON
, Hostname1SkeletonPrivate
);
2170 g_mutex_init (&skeleton
->priv
->lock
);
2171 skeleton
->priv
->context
= g_main_context_ref_thread_default ();
2172 skeleton
->priv
->properties
= g_new0 (GValue
, 4);
2173 g_value_init (&skeleton
->priv
->properties
[0], G_TYPE_STRING
);
2174 g_value_init (&skeleton
->priv
->properties
[1], G_TYPE_STRING
);
2175 g_value_init (&skeleton
->priv
->properties
[2], G_TYPE_STRING
);
2176 g_value_init (&skeleton
->priv
->properties
[3], G_TYPE_STRING
);
2179 static const gchar
*
2180 hostname1_skeleton_get_hostname (Hostname1
*object
)
2182 Hostname1Skeleton
*skeleton
= HOSTNAME1_SKELETON (object
);
2184 g_mutex_lock (&skeleton
->priv
->lock
);
2185 value
= g_value_get_string (&(skeleton
->priv
->properties
[0]));
2186 g_mutex_unlock (&skeleton
->priv
->lock
);
2190 static const gchar
*
2191 hostname1_skeleton_get_static_hostname (Hostname1
*object
)
2193 Hostname1Skeleton
*skeleton
= HOSTNAME1_SKELETON (object
);
2195 g_mutex_lock (&skeleton
->priv
->lock
);
2196 value
= g_value_get_string (&(skeleton
->priv
->properties
[1]));
2197 g_mutex_unlock (&skeleton
->priv
->lock
);
2201 static const gchar
*
2202 hostname1_skeleton_get_pretty_hostname (Hostname1
*object
)
2204 Hostname1Skeleton
*skeleton
= HOSTNAME1_SKELETON (object
);
2206 g_mutex_lock (&skeleton
->priv
->lock
);
2207 value
= g_value_get_string (&(skeleton
->priv
->properties
[2]));
2208 g_mutex_unlock (&skeleton
->priv
->lock
);
2212 static const gchar
*
2213 hostname1_skeleton_get_icon_name (Hostname1
*object
)
2215 Hostname1Skeleton
*skeleton
= HOSTNAME1_SKELETON (object
);
2217 g_mutex_lock (&skeleton
->priv
->lock
);
2218 value
= g_value_get_string (&(skeleton
->priv
->properties
[3]));
2219 g_mutex_unlock (&skeleton
->priv
->lock
);
2224 hostname1_skeleton_class_init (Hostname1SkeletonClass
*klass
)
2226 GObjectClass
*gobject_class
;
2227 GDBusInterfaceSkeletonClass
*skeleton_class
;
2229 gobject_class
= G_OBJECT_CLASS (klass
);
2230 gobject_class
->finalize
= hostname1_skeleton_finalize
;
2231 gobject_class
->get_property
= hostname1_skeleton_get_property
;
2232 gobject_class
->set_property
= hostname1_skeleton_set_property
;
2233 gobject_class
->notify
= hostname1_skeleton_notify
;
2236 hostname1_override_properties (gobject_class
, 1);
2238 skeleton_class
= G_DBUS_INTERFACE_SKELETON_CLASS (klass
);
2239 skeleton_class
->get_info
= hostname1_skeleton_dbus_interface_get_info
;
2240 skeleton_class
->get_properties
= hostname1_skeleton_dbus_interface_get_properties
;
2241 skeleton_class
->flush
= hostname1_skeleton_dbus_interface_flush
;
2242 skeleton_class
->get_vtable
= hostname1_skeleton_dbus_interface_get_vtable
;
2244 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2245 g_type_class_add_private (klass
, sizeof (Hostname1SkeletonPrivate
));
2250 hostname1_skeleton_iface_init (Hostname1Iface
*iface
)
2252 iface
->get_hostname
= hostname1_skeleton_get_hostname
;
2253 iface
->get_static_hostname
= hostname1_skeleton_get_static_hostname
;
2254 iface
->get_pretty_hostname
= hostname1_skeleton_get_pretty_hostname
;
2255 iface
->get_icon_name
= hostname1_skeleton_get_icon_name
;
2259 * hostname1_skeleton_new:
2261 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link>.
2263 * Returns: (transfer full) (type Hostname1Skeleton): The skeleton object.
2266 hostname1_skeleton_new (void)
2268 return HOSTNAME1 (g_object_new (TYPE_HOSTNAME1_SKELETON
, NULL
));