/* * Generated by gdbus-codegen 2.39.0. DO NOT EDIT. * * The license of this code is the same as for the source it was derived from. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "um-realm-generated.h" #include #ifdef G_OS_UNIX # include #endif typedef struct { GDBusArgInfo parent_struct; gboolean use_gvariant; } _ExtendedGDBusArgInfo; typedef struct { GDBusMethodInfo parent_struct; const gchar *signal_name; gboolean pass_fdlist; } _ExtendedGDBusMethodInfo; typedef struct { GDBusSignalInfo parent_struct; const gchar *signal_name; } _ExtendedGDBusSignalInfo; typedef struct { GDBusPropertyInfo parent_struct; const gchar *hyphen_name; gboolean use_gvariant; } _ExtendedGDBusPropertyInfo; typedef struct { GDBusInterfaceInfo parent_struct; const gchar *hyphen_name; } _ExtendedGDBusInterfaceInfo; typedef struct { const _ExtendedGDBusPropertyInfo *info; guint prop_id; GValue orig_value; /* the value before the change */ } ChangedProperty; static void _changed_property_free (ChangedProperty *data) { g_value_unset (&data->orig_value); g_free (data); } static gboolean _g_strv_equal0 (gchar **a, gchar **b) { gboolean ret = FALSE; guint n; if (a == NULL && b == NULL) { ret = TRUE; goto out; } if (a == NULL || b == NULL) goto out; if (g_strv_length (a) != g_strv_length (b)) goto out; for (n = 0; a[n] != NULL; n++) if (g_strcmp0 (a[n], b[n]) != 0) goto out; ret = TRUE; out: return ret; } static gboolean _g_variant_equal0 (GVariant *a, GVariant *b) { gboolean ret = FALSE; if (a == NULL && b == NULL) { ret = TRUE; goto out; } if (a == NULL || b == NULL) goto out; ret = g_variant_equal (a, b); out: return ret; } G_GNUC_UNUSED static gboolean _g_value_equal (const GValue *a, const GValue *b) { gboolean ret = FALSE; g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); switch (G_VALUE_TYPE (a)) { case G_TYPE_BOOLEAN: ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); break; case G_TYPE_UCHAR: ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); break; case G_TYPE_INT: ret = (g_value_get_int (a) == g_value_get_int (b)); break; case G_TYPE_UINT: ret = (g_value_get_uint (a) == g_value_get_uint (b)); break; case G_TYPE_INT64: ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); break; case G_TYPE_UINT64: ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); break; case G_TYPE_DOUBLE: { /* Avoid -Wfloat-equal warnings by doing a direct bit compare */ gdouble da = g_value_get_double (a); gdouble db = g_value_get_double (b); ret = memcmp (&da, &db, sizeof (gdouble)) == 0; } break; case G_TYPE_STRING: ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); break; case G_TYPE_VARIANT: ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); break; default: if (G_VALUE_TYPE (a) == G_TYPE_STRV) ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); else g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); break; } return ret; } /* ------------------------------------------------------------------------ * Code for interface org.freedesktop.realmd.Provider * ------------------------------------------------------------------------ */ /** * SECTION:UmRealmProvider * @title: UmRealmProvider * @short_description: Generated C code for the org.freedesktop.realmd.Provider D-Bus interface * * This section contains code for working with the org.freedesktop.realmd.Provider D-Bus interface in C. */ /* ---- Introspection data for org.freedesktop.realmd.Provider ---- */ static const _ExtendedGDBusArgInfo _um_realm_provider_method_info_discover_IN_ARG_string = { { -1, (gchar *) "string", (gchar *) "s", NULL }, FALSE }; static const _ExtendedGDBusArgInfo _um_realm_provider_method_info_discover_IN_ARG_options = { { -1, (gchar *) "options", (gchar *) "a{sv}", NULL }, FALSE }; static const _ExtendedGDBusArgInfo * const _um_realm_provider_method_info_discover_IN_ARG_pointers[] = { &_um_realm_provider_method_info_discover_IN_ARG_string, &_um_realm_provider_method_info_discover_IN_ARG_options, NULL }; static const _ExtendedGDBusArgInfo _um_realm_provider_method_info_discover_OUT_ARG_relevance = { { -1, (gchar *) "relevance", (gchar *) "i", NULL }, FALSE }; static const _ExtendedGDBusArgInfo _um_realm_provider_method_info_discover_OUT_ARG_realm = { { -1, (gchar *) "realm", (gchar *) "ao", NULL }, FALSE }; static const _ExtendedGDBusArgInfo * const _um_realm_provider_method_info_discover_OUT_ARG_pointers[] = { &_um_realm_provider_method_info_discover_OUT_ARG_relevance, &_um_realm_provider_method_info_discover_OUT_ARG_realm, NULL }; static const _ExtendedGDBusMethodInfo _um_realm_provider_method_info_discover = { { -1, (gchar *) "Discover", (GDBusArgInfo **) &_um_realm_provider_method_info_discover_IN_ARG_pointers, (GDBusArgInfo **) &_um_realm_provider_method_info_discover_OUT_ARG_pointers, NULL }, "handle-discover", FALSE }; static const _ExtendedGDBusMethodInfo * const _um_realm_provider_method_info_pointers[] = { &_um_realm_provider_method_info_discover, NULL }; static const _ExtendedGDBusPropertyInfo _um_realm_provider_property_info_name = { { -1, (gchar *) "Name", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "name", FALSE }; static const _ExtendedGDBusPropertyInfo _um_realm_provider_property_info_version = { { -1, (gchar *) "Version", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "version", FALSE }; static const _ExtendedGDBusPropertyInfo _um_realm_provider_property_info_realms = { { -1, (gchar *) "Realms", (gchar *) "ao", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "realms", FALSE }; static const _ExtendedGDBusPropertyInfo * const _um_realm_provider_property_info_pointers[] = { &_um_realm_provider_property_info_name, &_um_realm_provider_property_info_version, &_um_realm_provider_property_info_realms, NULL }; static const _ExtendedGDBusInterfaceInfo _um_realm_provider_interface_info = { { -1, (gchar *) "org.freedesktop.realmd.Provider", (GDBusMethodInfo **) &_um_realm_provider_method_info_pointers, NULL, (GDBusPropertyInfo **) &_um_realm_provider_property_info_pointers, NULL }, "provider", }; /** * um_realm_provider_interface_info: * * Gets a machine-readable description of the org.freedesktop.realmd.Provider D-Bus interface. * * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. */ GDBusInterfaceInfo * um_realm_provider_interface_info (void) { return (GDBusInterfaceInfo *) &_um_realm_provider_interface_info.parent_struct; } /** * um_realm_provider_override_properties: * @klass: The class structure for a #GObject-derived class. * @property_id_begin: The property id to assign to the first overridden property. * * Overrides all #GObject properties in the #UmRealmProvider interface for a concrete class. * The properties are overridden in the order they are defined. * * Returns: The last property id. */ guint um_realm_provider_override_properties (GObjectClass *klass, guint property_id_begin) { g_object_class_override_property (klass, property_id_begin++, "name"); g_object_class_override_property (klass, property_id_begin++, "version"); g_object_class_override_property (klass, property_id_begin++, "realms"); return property_id_begin - 1; } /** * UmRealmProvider: * * Abstract interface type for the D-Bus interface org.freedesktop.realmd.Provider. */ /** * UmRealmProviderIface: * @parent_iface: The parent interface. * @handle_discover: Handler for the #UmRealmProvider::handle-discover signal. * @get_name: Getter for the #UmRealmProvider:name property. * @get_realms: Getter for the #UmRealmProvider:realms property. * @get_version: Getter for the #UmRealmProvider:version property. * * Virtual table for the D-Bus interface org.freedesktop.realmd.Provider. */ typedef UmRealmProviderIface UmRealmProviderInterface; G_DEFINE_INTERFACE (UmRealmProvider, um_realm_provider, G_TYPE_OBJECT); static void um_realm_provider_default_init (UmRealmProviderIface *iface) { /* GObject signals for incoming D-Bus method calls: */ /** * UmRealmProvider::handle-discover: * @object: A #UmRealmProvider. * @invocation: A #GDBusMethodInvocation. * @arg_string: Argument passed by remote caller. * @arg_options: Argument passed by remote caller. * * Signal emitted when a remote caller is invoking the Discover() D-Bus method. * * 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 um_realm_provider_complete_discover() 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. * * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. */ g_signal_new ("handle-discover", G_TYPE_FROM_INTERFACE (iface), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (UmRealmProviderIface, handle_discover), g_signal_accumulator_true_handled, NULL, g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 3, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_VARIANT); /* GObject properties for D-Bus properties: */ /** * UmRealmProvider:name: * * Represents the D-Bus property "Name". * * 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. */ g_object_interface_install_property (iface, g_param_spec_string ("name", "Name", "Name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * UmRealmProvider:version: * * Represents the D-Bus property "Version". * * 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. */ g_object_interface_install_property (iface, g_param_spec_string ("version", "Version", "Version", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * UmRealmProvider:realms: * * Represents the D-Bus property "Realms". * * 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. */ g_object_interface_install_property (iface, g_param_spec_boxed ("realms", "Realms", "Realms", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } /** * um_realm_provider_get_name: (skip) * @object: A #UmRealmProvider. * * Gets the value of the "Name" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * 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 um_realm_provider_dup_name() if on another thread. * * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. */ const gchar * um_realm_provider_get_name (UmRealmProvider *object) { return UM_REALM_PROVIDER_GET_IFACE (object)->get_name (object); } /** * um_realm_provider_dup_name: (skip) * @object: A #UmRealmProvider. * * Gets a copy of the "Name" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). */ gchar * um_realm_provider_dup_name (UmRealmProvider *object) { gchar *value; g_object_get (G_OBJECT (object), "name", &value, NULL); return value; } /** * um_realm_provider_set_name: (skip) * @object: A #UmRealmProvider. * @value: The value to set. * * Sets the "Name" D-Bus property to @value. * * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. */ void um_realm_provider_set_name (UmRealmProvider *object, const gchar *value) { g_object_set (G_OBJECT (object), "name", value, NULL); } /** * um_realm_provider_get_version: (skip) * @object: A #UmRealmProvider. * * Gets the value of the "Version" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * 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 um_realm_provider_dup_version() if on another thread. * * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. */ const gchar * um_realm_provider_get_version (UmRealmProvider *object) { return UM_REALM_PROVIDER_GET_IFACE (object)->get_version (object); } /** * um_realm_provider_dup_version: (skip) * @object: A #UmRealmProvider. * * Gets a copy of the "Version" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). */ gchar * um_realm_provider_dup_version (UmRealmProvider *object) { gchar *value; g_object_get (G_OBJECT (object), "version", &value, NULL); return value; } /** * um_realm_provider_set_version: (skip) * @object: A #UmRealmProvider. * @value: The value to set. * * Sets the "Version" D-Bus property to @value. * * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. */ void um_realm_provider_set_version (UmRealmProvider *object, const gchar *value) { g_object_set (G_OBJECT (object), "version", value, NULL); } /** * um_realm_provider_get_realms: (skip) * @object: A #UmRealmProvider. * * Gets the value of the "Realms" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * 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 um_realm_provider_dup_realms() if on another thread. * * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. */ const gchar *const * um_realm_provider_get_realms (UmRealmProvider *object) { return UM_REALM_PROVIDER_GET_IFACE (object)->get_realms (object); } /** * um_realm_provider_dup_realms: (skip) * @object: A #UmRealmProvider. * * Gets a copy of the "Realms" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). */ gchar ** um_realm_provider_dup_realms (UmRealmProvider *object) { gchar **value; g_object_get (G_OBJECT (object), "realms", &value, NULL); return value; } /** * um_realm_provider_set_realms: (skip) * @object: A #UmRealmProvider. * @value: The value to set. * * Sets the "Realms" D-Bus property to @value. * * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. */ void um_realm_provider_set_realms (UmRealmProvider *object, const gchar *const *value) { g_object_set (G_OBJECT (object), "realms", value, NULL); } /** * um_realm_provider_call_discover: * @proxy: A #UmRealmProviderProxy. * @arg_string: Argument to pass with the method invocation. * @arg_options: Argument to pass with the method invocation. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. * @user_data: User data to pass to @callback. * * Asynchronously invokes the Discover() D-Bus method on @proxy. * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_provider_call_discover_finish() to get the result of the operation. * * See um_realm_provider_call_discover_sync() for the synchronous, blocking version of this method. */ void um_realm_provider_call_discover ( UmRealmProvider *proxy, const gchar *arg_string, GVariant *arg_options, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_dbus_proxy_call (G_DBUS_PROXY (proxy), "Discover", g_variant_new ("(s@a{sv})", arg_string, arg_options), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); } /** * um_realm_provider_call_discover_finish: * @proxy: A #UmRealmProviderProxy. * @out_relevance: (out): Return location for return parameter or %NULL to ignore. * @out_realm: (out): Return location for return parameter or %NULL to ignore. * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_provider_call_discover(). * @error: Return location for error or %NULL. * * Finishes an operation started with um_realm_provider_call_discover(). * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean um_realm_provider_call_discover_finish ( UmRealmProvider *proxy, gint *out_relevance, gchar ***out_realm, GAsyncResult *res, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "(i^ao)", out_relevance, out_realm); g_variant_unref (_ret); _out: return _ret != NULL; } /** * um_realm_provider_call_discover_sync: * @proxy: A #UmRealmProviderProxy. * @arg_string: Argument to pass with the method invocation. * @arg_options: Argument to pass with the method invocation. * @out_relevance: (out): Return location for return parameter or %NULL to ignore. * @out_realm: (out): Return location for return parameter or %NULL to ignore. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL. * * Synchronously invokes the Discover() D-Bus method on @proxy. The calling thread is blocked until a reply is received. * * See um_realm_provider_call_discover() for the asynchronous version of this method. * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean um_realm_provider_call_discover_sync ( UmRealmProvider *proxy, const gchar *arg_string, GVariant *arg_options, gint *out_relevance, gchar ***out_realm, GCancellable *cancellable, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), "Discover", g_variant_new ("(s@a{sv})", arg_string, arg_options), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "(i^ao)", out_relevance, out_realm); g_variant_unref (_ret); _out: return _ret != NULL; } /** * um_realm_provider_complete_discover: * @object: A #UmRealmProvider. * @invocation: (transfer full): A #GDBusMethodInvocation. * @relevance: Parameter to return. * @realm: Parameter to return. * * Helper function used in service implementations to finish handling invocations of the Discover() 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. * * This method will free @invocation, you cannot use it afterwards. */ void um_realm_provider_complete_discover ( UmRealmProvider *object, GDBusMethodInvocation *invocation, gint relevance, const gchar *const *realm) { g_dbus_method_invocation_return_value (invocation, g_variant_new ("(i^ao)", relevance, realm)); } /* ------------------------------------------------------------------------ */ /** * UmRealmProviderProxy: * * The #UmRealmProviderProxy structure contains only private data and should only be accessed using the provided API. */ /** * UmRealmProviderProxyClass: * @parent_class: The parent class. * * Class structure for #UmRealmProviderProxy. */ struct _UmRealmProviderProxyPrivate { GData *qdata; }; static void um_realm_provider_proxy_iface_init (UmRealmProviderIface *iface); G_DEFINE_TYPE_WITH_CODE (UmRealmProviderProxy, um_realm_provider_proxy, G_TYPE_DBUS_PROXY, G_ADD_PRIVATE (UmRealmProviderProxy) G_IMPLEMENT_INTERFACE (UM_REALM_TYPE_PROVIDER, um_realm_provider_proxy_iface_init)); static void um_realm_provider_proxy_finalize (GObject *object) { UmRealmProviderProxy *proxy = UM_REALM_PROVIDER_PROXY (object); g_datalist_clear (&proxy->priv->qdata); G_OBJECT_CLASS (um_realm_provider_proxy_parent_class)->finalize (object); } static void um_realm_provider_proxy_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec G_GNUC_UNUSED) { const _ExtendedGDBusPropertyInfo *info; GVariant *variant; g_assert (prop_id != 0 && prop_id - 1 < 3); info = _um_realm_provider_property_info_pointers[prop_id - 1]; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); if (info->use_gvariant) { g_value_set_variant (value, variant); } else { if (variant != NULL) g_dbus_gvariant_to_gvalue (variant, value); } if (variant != NULL) g_variant_unref (variant); } static void um_realm_provider_proxy_set_property_cb (GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) { const _ExtendedGDBusPropertyInfo *info = user_data; GError *error; error = NULL; if (!g_dbus_proxy_call_finish (proxy, res, &error)) { g_warning ("Error setting property '%s' on interface org.freedesktop.realmd.Provider: %s (%s, %d)", info->parent_struct.name, error->message, g_quark_to_string (error->domain), error->code); g_error_free (error); } } static void um_realm_provider_proxy_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec G_GNUC_UNUSED) { const _ExtendedGDBusPropertyInfo *info; GVariant *variant; g_assert (prop_id != 0 && prop_id - 1 < 3); info = _um_realm_provider_property_info_pointers[prop_id - 1]; variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); g_dbus_proxy_call (G_DBUS_PROXY (object), "org.freedesktop.DBus.Properties.Set", g_variant_new ("(ssv)", "org.freedesktop.realmd.Provider", info->parent_struct.name, variant), G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) um_realm_provider_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); g_variant_unref (variant); } static void um_realm_provider_proxy_g_signal (GDBusProxy *proxy, const gchar *sender_name G_GNUC_UNUSED, const gchar *signal_name, GVariant *parameters) { _ExtendedGDBusSignalInfo *info; GVariantIter iter; GVariant *child; GValue *paramv; guint num_params; guint n; guint signal_id; info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_um_realm_provider_interface_info.parent_struct, signal_name); if (info == NULL) return; num_params = g_variant_n_children (parameters); paramv = g_new0 (GValue, num_params + 1); g_value_init (¶mv[0], UM_REALM_TYPE_PROVIDER); g_value_set_object (¶mv[0], proxy); g_variant_iter_init (&iter, parameters); n = 1; while ((child = g_variant_iter_next_value (&iter)) != NULL) { _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; if (arg_info->use_gvariant) { g_value_init (¶mv[n], G_TYPE_VARIANT); g_value_set_variant (¶mv[n], child); n++; } else g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); g_variant_unref (child); } signal_id = g_signal_lookup (info->signal_name, UM_REALM_TYPE_PROVIDER); g_signal_emitv (paramv, signal_id, 0, NULL); for (n = 0; n < num_params + 1; n++) g_value_unset (¶mv[n]); g_free (paramv); } static void um_realm_provider_proxy_g_properties_changed (GDBusProxy *_proxy, GVariant *changed_properties, const gchar *const *invalidated_properties) { UmRealmProviderProxy *proxy = UM_REALM_PROVIDER_PROXY (_proxy); guint n; const gchar *key; GVariantIter *iter; _ExtendedGDBusPropertyInfo *info; g_variant_get (changed_properties, "a{sv}", &iter); while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) { info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_provider_interface_info.parent_struct, key); g_datalist_remove_data (&proxy->priv->qdata, key); if (info != NULL) g_object_notify (G_OBJECT (proxy), info->hyphen_name); } g_variant_iter_free (iter); for (n = 0; invalidated_properties[n] != NULL; n++) { info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_provider_interface_info.parent_struct, invalidated_properties[n]); g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); if (info != NULL) g_object_notify (G_OBJECT (proxy), info->hyphen_name); } } static const gchar * um_realm_provider_proxy_get_name (UmRealmProvider *object) { UmRealmProviderProxy *proxy = UM_REALM_PROVIDER_PROXY (object); GVariant *variant; const gchar *value = NULL; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Name"); if (variant != NULL) { value = g_variant_get_string (variant, NULL); g_variant_unref (variant); } return value; } static const gchar * um_realm_provider_proxy_get_version (UmRealmProvider *object) { UmRealmProviderProxy *proxy = UM_REALM_PROVIDER_PROXY (object); GVariant *variant; const gchar *value = NULL; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Version"); if (variant != NULL) { value = g_variant_get_string (variant, NULL); g_variant_unref (variant); } return value; } static const gchar *const * um_realm_provider_proxy_get_realms (UmRealmProvider *object) { UmRealmProviderProxy *proxy = UM_REALM_PROVIDER_PROXY (object); GVariant *variant; const gchar *const *value = NULL; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Realms"); if (variant != NULL) { value = g_variant_get_objv (variant, NULL); g_variant_unref (variant); } return value; } static void um_realm_provider_proxy_init (UmRealmProviderProxy *proxy) { proxy->priv = um_realm_provider_proxy_get_instance_private (proxy); g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), um_realm_provider_interface_info ()); } static void um_realm_provider_proxy_class_init (UmRealmProviderProxyClass *klass) { GObjectClass *gobject_class; GDBusProxyClass *proxy_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = um_realm_provider_proxy_finalize; gobject_class->get_property = um_realm_provider_proxy_get_property; gobject_class->set_property = um_realm_provider_proxy_set_property; proxy_class = G_DBUS_PROXY_CLASS (klass); proxy_class->g_signal = um_realm_provider_proxy_g_signal; proxy_class->g_properties_changed = um_realm_provider_proxy_g_properties_changed; um_realm_provider_override_properties (gobject_class, 1); } static void um_realm_provider_proxy_iface_init (UmRealmProviderIface *iface) { iface->get_name = um_realm_provider_proxy_get_name; iface->get_version = um_realm_provider_proxy_get_version; iface->get_realms = um_realm_provider_proxy_get_realms; } /** * um_realm_provider_proxy_new: * @connection: A #GDBusConnection. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied. * @user_data: User data to pass to @callback. * * Asynchronously creates a proxy for the D-Bus interface org.freedesktop.realmd.Provider. See g_dbus_proxy_new() for more details. * * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_provider_proxy_new_finish() to get the result of the operation. * * See um_realm_provider_proxy_new_sync() for the synchronous, blocking version of this constructor. */ void um_realm_provider_proxy_new ( GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_async_initable_new_async (UM_REALM_TYPE_PROVIDER_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.realmd.Provider", NULL); } /** * um_realm_provider_proxy_new_finish: * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_provider_proxy_new(). * @error: Return location for error or %NULL * * Finishes an operation started with um_realm_provider_proxy_new(). * * Returns: (transfer full) (type UmRealmProviderProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmProvider * um_realm_provider_proxy_new_finish ( GAsyncResult *res, GError **error) { GObject *ret; GObject *source_object; source_object = g_async_result_get_source_object (res); ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); g_object_unref (source_object); if (ret != NULL) return UM_REALM_PROVIDER (ret); else return NULL; } /** * um_realm_provider_proxy_new_sync: * @connection: A #GDBusConnection. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL * * Synchronously creates a proxy for the D-Bus interface org.freedesktop.realmd.Provider. See g_dbus_proxy_new_sync() for more details. * * The calling thread is blocked until a reply is received. * * See um_realm_provider_proxy_new() for the asynchronous version of this constructor. * * Returns: (transfer full) (type UmRealmProviderProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmProvider * um_realm_provider_proxy_new_sync ( GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error) { GInitable *ret; ret = g_initable_new (UM_REALM_TYPE_PROVIDER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.Provider", NULL); if (ret != NULL) return UM_REALM_PROVIDER (ret); else return NULL; } /** * um_realm_provider_proxy_new_for_bus: * @bus_type: A #GBusType. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: A bus name (well-known or unique). * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied. * @user_data: User data to pass to @callback. * * Like um_realm_provider_proxy_new() but takes a #GBusType instead of a #GDBusConnection. * * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_provider_proxy_new_for_bus_finish() to get the result of the operation. * * See um_realm_provider_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. */ void um_realm_provider_proxy_new_for_bus ( GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_async_initable_new_async (UM_REALM_TYPE_PROVIDER_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.realmd.Provider", NULL); } /** * um_realm_provider_proxy_new_for_bus_finish: * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_provider_proxy_new_for_bus(). * @error: Return location for error or %NULL * * Finishes an operation started with um_realm_provider_proxy_new_for_bus(). * * Returns: (transfer full) (type UmRealmProviderProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmProvider * um_realm_provider_proxy_new_for_bus_finish ( GAsyncResult *res, GError **error) { GObject *ret; GObject *source_object; source_object = g_async_result_get_source_object (res); ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); g_object_unref (source_object); if (ret != NULL) return UM_REALM_PROVIDER (ret); else return NULL; } /** * um_realm_provider_proxy_new_for_bus_sync: * @bus_type: A #GBusType. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: A bus name (well-known or unique). * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL * * Like um_realm_provider_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. * * The calling thread is blocked until a reply is received. * * See um_realm_provider_proxy_new_for_bus() for the asynchronous version of this constructor. * * Returns: (transfer full) (type UmRealmProviderProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmProvider * um_realm_provider_proxy_new_for_bus_sync ( GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error) { GInitable *ret; ret = g_initable_new (UM_REALM_TYPE_PROVIDER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.Provider", NULL); if (ret != NULL) return UM_REALM_PROVIDER (ret); else return NULL; } /* ------------------------------------------------------------------------ */ /** * UmRealmProviderSkeleton: * * The #UmRealmProviderSkeleton structure contains only private data and should only be accessed using the provided API. */ /** * UmRealmProviderSkeletonClass: * @parent_class: The parent class. * * Class structure for #UmRealmProviderSkeleton. */ struct _UmRealmProviderSkeletonPrivate { GValue *properties; GList *changed_properties; GSource *changed_properties_idle_source; GMainContext *context; GMutex lock; }; static void _um_realm_provider_skeleton_handle_method_call ( GDBusConnection *connection G_GNUC_UNUSED, const gchar *sender G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, const gchar *method_name, GVariant *parameters, GDBusMethodInvocation *invocation, gpointer user_data) { UmRealmProviderSkeleton *skeleton = UM_REALM_PROVIDER_SKELETON (user_data); _ExtendedGDBusMethodInfo *info; GVariantIter iter; GVariant *child; GValue *paramv; guint num_params; guint num_extra; guint n; guint signal_id; GValue return_value = G_VALUE_INIT; info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); g_assert (info != NULL); num_params = g_variant_n_children (parameters); num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); n = 0; g_value_init (¶mv[n], UM_REALM_TYPE_PROVIDER); g_value_set_object (¶mv[n++], skeleton); g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); g_value_set_object (¶mv[n++], invocation); if (info->pass_fdlist) { #ifdef G_OS_UNIX g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); #else g_assert_not_reached (); #endif } g_variant_iter_init (&iter, parameters); while ((child = g_variant_iter_next_value (&iter)) != NULL) { _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; if (arg_info->use_gvariant) { g_value_init (¶mv[n], G_TYPE_VARIANT); g_value_set_variant (¶mv[n], child); n++; } else g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); g_variant_unref (child); } signal_id = g_signal_lookup (info->signal_name, UM_REALM_TYPE_PROVIDER); g_value_init (&return_value, G_TYPE_BOOLEAN); g_signal_emitv (paramv, signal_id, 0, &return_value); if (!g_value_get_boolean (&return_value)) 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); g_value_unset (&return_value); for (n = 0; n < num_params + num_extra; n++) g_value_unset (¶mv[n]); g_free (paramv); } static GVariant * _um_realm_provider_skeleton_handle_get_property ( GDBusConnection *connection G_GNUC_UNUSED, const gchar *sender G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name G_GNUC_UNUSED, const gchar *property_name, GError **error, gpointer user_data) { UmRealmProviderSkeleton *skeleton = UM_REALM_PROVIDER_SKELETON (user_data); GValue value = G_VALUE_INIT; GParamSpec *pspec; _ExtendedGDBusPropertyInfo *info; GVariant *ret; ret = NULL; info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_provider_interface_info.parent_struct, property_name); g_assert (info != NULL); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); if (pspec == NULL) { g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); } else { g_value_init (&value, pspec->value_type); g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); g_value_unset (&value); } return ret; } static gboolean _um_realm_provider_skeleton_handle_set_property ( GDBusConnection *connection G_GNUC_UNUSED, const gchar *sender G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name G_GNUC_UNUSED, const gchar *property_name, GVariant *variant, GError **error, gpointer user_data) { UmRealmProviderSkeleton *skeleton = UM_REALM_PROVIDER_SKELETON (user_data); GValue value = G_VALUE_INIT; GParamSpec *pspec; _ExtendedGDBusPropertyInfo *info; gboolean ret; ret = FALSE; info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_provider_interface_info.parent_struct, property_name); g_assert (info != NULL); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); if (pspec == NULL) { g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); } else { if (info->use_gvariant) g_value_set_variant (&value, variant); else g_dbus_gvariant_to_gvalue (variant, &value); g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); g_value_unset (&value); ret = TRUE; } return ret; } static const GDBusInterfaceVTable _um_realm_provider_skeleton_vtable = { _um_realm_provider_skeleton_handle_method_call, _um_realm_provider_skeleton_handle_get_property, _um_realm_provider_skeleton_handle_set_property, {NULL} }; static GDBusInterfaceInfo * um_realm_provider_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) { return um_realm_provider_interface_info (); } static GDBusInterfaceVTable * um_realm_provider_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) { return (GDBusInterfaceVTable *) &_um_realm_provider_skeleton_vtable; } static GVariant * um_realm_provider_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) { UmRealmProviderSkeleton *skeleton = UM_REALM_PROVIDER_SKELETON (_skeleton); GVariantBuilder builder; guint n; g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); if (_um_realm_provider_interface_info.parent_struct.properties == NULL) goto out; for (n = 0; _um_realm_provider_interface_info.parent_struct.properties[n] != NULL; n++) { GDBusPropertyInfo *info = _um_realm_provider_interface_info.parent_struct.properties[n]; if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) { GVariant *value; value = _um_realm_provider_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.realmd.Provider", info->name, NULL, skeleton); if (value != NULL) { g_variant_take_ref (value); g_variant_builder_add (&builder, "{sv}", info->name, value); g_variant_unref (value); } } } out: return g_variant_builder_end (&builder); } static gboolean _um_realm_provider_emit_changed (gpointer user_data); static void um_realm_provider_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) { UmRealmProviderSkeleton *skeleton = UM_REALM_PROVIDER_SKELETON (_skeleton); gboolean emit_changed = FALSE; g_mutex_lock (&skeleton->priv->lock); if (skeleton->priv->changed_properties_idle_source != NULL) { g_source_destroy (skeleton->priv->changed_properties_idle_source); skeleton->priv->changed_properties_idle_source = NULL; emit_changed = TRUE; } g_mutex_unlock (&skeleton->priv->lock); if (emit_changed) _um_realm_provider_emit_changed (skeleton); } static void um_realm_provider_skeleton_iface_init (UmRealmProviderIface *iface); G_DEFINE_TYPE_WITH_CODE (UmRealmProviderSkeleton, um_realm_provider_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, G_ADD_PRIVATE (UmRealmProviderSkeleton) G_IMPLEMENT_INTERFACE (UM_REALM_TYPE_PROVIDER, um_realm_provider_skeleton_iface_init)); static void um_realm_provider_skeleton_finalize (GObject *object) { UmRealmProviderSkeleton *skeleton = UM_REALM_PROVIDER_SKELETON (object); guint n; for (n = 0; n < 3; n++) g_value_unset (&skeleton->priv->properties[n]); g_free (skeleton->priv->properties); g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); if (skeleton->priv->changed_properties_idle_source != NULL) g_source_destroy (skeleton->priv->changed_properties_idle_source); g_main_context_unref (skeleton->priv->context); g_mutex_clear (&skeleton->priv->lock); G_OBJECT_CLASS (um_realm_provider_skeleton_parent_class)->finalize (object); } static void um_realm_provider_skeleton_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec G_GNUC_UNUSED) { UmRealmProviderSkeleton *skeleton = UM_REALM_PROVIDER_SKELETON (object); g_assert (prop_id != 0 && prop_id - 1 < 3); g_mutex_lock (&skeleton->priv->lock); g_value_copy (&skeleton->priv->properties[prop_id - 1], value); g_mutex_unlock (&skeleton->priv->lock); } static gboolean _um_realm_provider_emit_changed (gpointer user_data) { UmRealmProviderSkeleton *skeleton = UM_REALM_PROVIDER_SKELETON (user_data); GList *l; GVariantBuilder builder; GVariantBuilder invalidated_builder; guint num_changes; g_mutex_lock (&skeleton->priv->lock); g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) { ChangedProperty *cp = l->data; GVariant *variant; const GValue *cur_value; cur_value = &skeleton->priv->properties[cp->prop_id - 1]; if (!_g_value_equal (cur_value, &cp->orig_value)) { variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); g_variant_unref (variant); num_changes++; } } if (num_changes > 0) { GList *connections, *ll; GVariant *signal_variant; signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.realmd.Provider", &builder, &invalidated_builder)); connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); for (ll = connections; ll != NULL; ll = ll->next) { GDBusConnection *connection = ll->data; g_dbus_connection_emit_signal (connection, NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.DBus.Properties", "PropertiesChanged", signal_variant, NULL); } g_variant_unref (signal_variant); g_list_free_full (connections, g_object_unref); } else { g_variant_builder_clear (&builder); g_variant_builder_clear (&invalidated_builder); } g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); skeleton->priv->changed_properties = NULL; skeleton->priv->changed_properties_idle_source = NULL; g_mutex_unlock (&skeleton->priv->lock); return FALSE; } static void _um_realm_provider_schedule_emit_changed (UmRealmProviderSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) { ChangedProperty *cp; GList *l; cp = NULL; for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) { ChangedProperty *i_cp = l->data; if (i_cp->info == info) { cp = i_cp; break; } } if (cp == NULL) { cp = g_new0 (ChangedProperty, 1); cp->prop_id = prop_id; cp->info = info; skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); g_value_copy (orig_value, &cp->orig_value); } } static void um_realm_provider_skeleton_notify (GObject *object, GParamSpec *pspec G_GNUC_UNUSED) { UmRealmProviderSkeleton *skeleton = UM_REALM_PROVIDER_SKELETON (object); g_mutex_lock (&skeleton->priv->lock); if (skeleton->priv->changed_properties != NULL && skeleton->priv->changed_properties_idle_source == NULL) { skeleton->priv->changed_properties_idle_source = g_idle_source_new (); g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); g_source_set_callback (skeleton->priv->changed_properties_idle_source, _um_realm_provider_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); g_source_unref (skeleton->priv->changed_properties_idle_source); } g_mutex_unlock (&skeleton->priv->lock); } static void um_realm_provider_skeleton_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { UmRealmProviderSkeleton *skeleton = UM_REALM_PROVIDER_SKELETON (object); g_assert (prop_id != 0 && prop_id - 1 < 3); g_mutex_lock (&skeleton->priv->lock); g_object_freeze_notify (object); if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) { if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) _um_realm_provider_schedule_emit_changed (skeleton, _um_realm_provider_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); g_object_notify_by_pspec (object, pspec); } g_mutex_unlock (&skeleton->priv->lock); g_object_thaw_notify (object); } static void um_realm_provider_skeleton_init (UmRealmProviderSkeleton *skeleton) { skeleton->priv = um_realm_provider_skeleton_get_instance_private (skeleton); g_mutex_init (&skeleton->priv->lock); skeleton->priv->context = g_main_context_ref_thread_default (); skeleton->priv->properties = g_new0 (GValue, 3); g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); g_value_init (&skeleton->priv->properties[2], G_TYPE_STRV); } static const gchar * um_realm_provider_skeleton_get_name (UmRealmProvider *object) { UmRealmProviderSkeleton *skeleton = UM_REALM_PROVIDER_SKELETON (object); const gchar *value; g_mutex_lock (&skeleton->priv->lock); value = g_value_get_string (&(skeleton->priv->properties[0])); g_mutex_unlock (&skeleton->priv->lock); return value; } static const gchar * um_realm_provider_skeleton_get_version (UmRealmProvider *object) { UmRealmProviderSkeleton *skeleton = UM_REALM_PROVIDER_SKELETON (object); const gchar *value; g_mutex_lock (&skeleton->priv->lock); value = g_value_get_string (&(skeleton->priv->properties[1])); g_mutex_unlock (&skeleton->priv->lock); return value; } static const gchar *const * um_realm_provider_skeleton_get_realms (UmRealmProvider *object) { UmRealmProviderSkeleton *skeleton = UM_REALM_PROVIDER_SKELETON (object); const gchar *const *value; g_mutex_lock (&skeleton->priv->lock); value = g_value_get_boxed (&(skeleton->priv->properties[2])); g_mutex_unlock (&skeleton->priv->lock); return value; } static void um_realm_provider_skeleton_class_init (UmRealmProviderSkeletonClass *klass) { GObjectClass *gobject_class; GDBusInterfaceSkeletonClass *skeleton_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = um_realm_provider_skeleton_finalize; gobject_class->get_property = um_realm_provider_skeleton_get_property; gobject_class->set_property = um_realm_provider_skeleton_set_property; gobject_class->notify = um_realm_provider_skeleton_notify; um_realm_provider_override_properties (gobject_class, 1); skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); skeleton_class->get_info = um_realm_provider_skeleton_dbus_interface_get_info; skeleton_class->get_properties = um_realm_provider_skeleton_dbus_interface_get_properties; skeleton_class->flush = um_realm_provider_skeleton_dbus_interface_flush; skeleton_class->get_vtable = um_realm_provider_skeleton_dbus_interface_get_vtable; } static void um_realm_provider_skeleton_iface_init (UmRealmProviderIface *iface) { iface->get_name = um_realm_provider_skeleton_get_name; iface->get_version = um_realm_provider_skeleton_get_version; iface->get_realms = um_realm_provider_skeleton_get_realms; } /** * um_realm_provider_skeleton_new: * * Creates a skeleton object for the D-Bus interface org.freedesktop.realmd.Provider. * * Returns: (transfer full) (type UmRealmProviderSkeleton): The skeleton object. */ UmRealmProvider * um_realm_provider_skeleton_new (void) { return UM_REALM_PROVIDER (g_object_new (UM_REALM_TYPE_PROVIDER_SKELETON, NULL)); } /* ------------------------------------------------------------------------ * Code for interface org.freedesktop.realmd.Service * ------------------------------------------------------------------------ */ /** * SECTION:UmRealmService * @title: UmRealmService * @short_description: Generated C code for the org.freedesktop.realmd.Service D-Bus interface * * This section contains code for working with the org.freedesktop.realmd.Service D-Bus interface in C. */ /* ---- Introspection data for org.freedesktop.realmd.Service ---- */ static const _ExtendedGDBusArgInfo _um_realm_service_method_info_cancel_IN_ARG_operation = { { -1, (gchar *) "operation", (gchar *) "s", NULL }, FALSE }; static const _ExtendedGDBusArgInfo * const _um_realm_service_method_info_cancel_IN_ARG_pointers[] = { &_um_realm_service_method_info_cancel_IN_ARG_operation, NULL }; static const _ExtendedGDBusMethodInfo _um_realm_service_method_info_cancel = { { -1, (gchar *) "Cancel", (GDBusArgInfo **) &_um_realm_service_method_info_cancel_IN_ARG_pointers, NULL, NULL }, "handle-cancel", FALSE }; static const _ExtendedGDBusArgInfo _um_realm_service_method_info_set_locale_IN_ARG_locale = { { -1, (gchar *) "locale", (gchar *) "s", NULL }, FALSE }; static const _ExtendedGDBusArgInfo * const _um_realm_service_method_info_set_locale_IN_ARG_pointers[] = { &_um_realm_service_method_info_set_locale_IN_ARG_locale, NULL }; static const _ExtendedGDBusMethodInfo _um_realm_service_method_info_set_locale = { { -1, (gchar *) "SetLocale", (GDBusArgInfo **) &_um_realm_service_method_info_set_locale_IN_ARG_pointers, NULL, NULL }, "handle-set-locale", FALSE }; static const _ExtendedGDBusMethodInfo _um_realm_service_method_info_release = { { -1, (gchar *) "Release", NULL, NULL, NULL }, "handle-release", FALSE }; static const _ExtendedGDBusMethodInfo * const _um_realm_service_method_info_pointers[] = { &_um_realm_service_method_info_cancel, &_um_realm_service_method_info_set_locale, &_um_realm_service_method_info_release, NULL }; static const _ExtendedGDBusArgInfo _um_realm_service_signal_info_diagnostics_ARG_data = { { -1, (gchar *) "data", (gchar *) "s", NULL }, FALSE }; static const _ExtendedGDBusArgInfo _um_realm_service_signal_info_diagnostics_ARG_operation = { { -1, (gchar *) "operation", (gchar *) "s", NULL }, FALSE }; static const _ExtendedGDBusArgInfo * const _um_realm_service_signal_info_diagnostics_ARG_pointers[] = { &_um_realm_service_signal_info_diagnostics_ARG_data, &_um_realm_service_signal_info_diagnostics_ARG_operation, NULL }; static const _ExtendedGDBusSignalInfo _um_realm_service_signal_info_diagnostics = { { -1, (gchar *) "Diagnostics", (GDBusArgInfo **) &_um_realm_service_signal_info_diagnostics_ARG_pointers, NULL }, "diagnostics" }; static const _ExtendedGDBusSignalInfo * const _um_realm_service_signal_info_pointers[] = { &_um_realm_service_signal_info_diagnostics, NULL }; static const _ExtendedGDBusInterfaceInfo _um_realm_service_interface_info = { { -1, (gchar *) "org.freedesktop.realmd.Service", (GDBusMethodInfo **) &_um_realm_service_method_info_pointers, (GDBusSignalInfo **) &_um_realm_service_signal_info_pointers, NULL, NULL }, "service", }; /** * um_realm_service_interface_info: * * Gets a machine-readable description of the org.freedesktop.realmd.Service D-Bus interface. * * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. */ GDBusInterfaceInfo * um_realm_service_interface_info (void) { return (GDBusInterfaceInfo *) &_um_realm_service_interface_info.parent_struct; } /** * um_realm_service_override_properties: * @klass: The class structure for a #GObject-derived class. * @property_id_begin: The property id to assign to the first overridden property. * * Overrides all #GObject properties in the #UmRealmService interface for a concrete class. * The properties are overridden in the order they are defined. * * Returns: The last property id. */ guint um_realm_service_override_properties (GObjectClass *klass, guint property_id_begin) { return property_id_begin - 1; } /** * UmRealmService: * * Abstract interface type for the D-Bus interface org.freedesktop.realmd.Service. */ /** * UmRealmServiceIface: * @parent_iface: The parent interface. * @handle_cancel: Handler for the #UmRealmService::handle-cancel signal. * @handle_release: Handler for the #UmRealmService::handle-release signal. * @handle_set_locale: Handler for the #UmRealmService::handle-set-locale signal. * @diagnostics: Handler for the #UmRealmService::diagnostics signal. * * Virtual table for the D-Bus interface org.freedesktop.realmd.Service. */ typedef UmRealmServiceIface UmRealmServiceInterface; G_DEFINE_INTERFACE (UmRealmService, um_realm_service, G_TYPE_OBJECT); static void um_realm_service_default_init (UmRealmServiceIface *iface) { /* GObject signals for incoming D-Bus method calls: */ /** * UmRealmService::handle-cancel: * @object: A #UmRealmService. * @invocation: A #GDBusMethodInvocation. * @arg_operation: Argument passed by remote caller. * * Signal emitted when a remote caller is invoking the Cancel() D-Bus method. * * 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 um_realm_service_complete_cancel() 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. * * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. */ g_signal_new ("handle-cancel", G_TYPE_FROM_INTERFACE (iface), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (UmRealmServiceIface, handle_cancel), g_signal_accumulator_true_handled, NULL, g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 2, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); /** * UmRealmService::handle-set-locale: * @object: A #UmRealmService. * @invocation: A #GDBusMethodInvocation. * @arg_locale: Argument passed by remote caller. * * Signal emitted when a remote caller is invoking the SetLocale() D-Bus method. * * 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 um_realm_service_complete_set_locale() 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. * * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. */ g_signal_new ("handle-set-locale", G_TYPE_FROM_INTERFACE (iface), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (UmRealmServiceIface, handle_set_locale), g_signal_accumulator_true_handled, NULL, g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 2, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); /** * UmRealmService::handle-release: * @object: A #UmRealmService. * @invocation: A #GDBusMethodInvocation. * * Signal emitted when a remote caller is invoking the Release() D-Bus method. * * 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 um_realm_service_complete_release() 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. * * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. */ g_signal_new ("handle-release", G_TYPE_FROM_INTERFACE (iface), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (UmRealmServiceIface, handle_release), g_signal_accumulator_true_handled, NULL, g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 1, G_TYPE_DBUS_METHOD_INVOCATION); /* GObject signals for received D-Bus signals: */ /** * UmRealmService::diagnostics: * @object: A #UmRealmService. * @arg_data: Argument. * @arg_operation: Argument. * * On the client-side, this signal is emitted whenever the D-Bus signal "Diagnostics" is received. * * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. */ g_signal_new ("diagnostics", G_TYPE_FROM_INTERFACE (iface), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (UmRealmServiceIface, diagnostics), NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); } /** * um_realm_service_emit_diagnostics: * @object: A #UmRealmService. * @arg_data: Argument to pass with the signal. * @arg_operation: Argument to pass with the signal. * * Emits the "Diagnostics" D-Bus signal. */ void um_realm_service_emit_diagnostics ( UmRealmService *object, const gchar *arg_data, const gchar *arg_operation) { g_signal_emit_by_name (object, "diagnostics", arg_data, arg_operation); } /** * um_realm_service_call_cancel: * @proxy: A #UmRealmServiceProxy. * @arg_operation: Argument to pass with the method invocation. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. * @user_data: User data to pass to @callback. * * Asynchronously invokes the Cancel() D-Bus method on @proxy. * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_service_call_cancel_finish() to get the result of the operation. * * See um_realm_service_call_cancel_sync() for the synchronous, blocking version of this method. */ void um_realm_service_call_cancel ( UmRealmService *proxy, const gchar *arg_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_dbus_proxy_call (G_DBUS_PROXY (proxy), "Cancel", g_variant_new ("(s)", arg_operation), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); } /** * um_realm_service_call_cancel_finish: * @proxy: A #UmRealmServiceProxy. * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_service_call_cancel(). * @error: Return location for error or %NULL. * * Finishes an operation started with um_realm_service_call_cancel(). * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean um_realm_service_call_cancel_finish ( UmRealmService *proxy, GAsyncResult *res, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "()"); g_variant_unref (_ret); _out: return _ret != NULL; } /** * um_realm_service_call_cancel_sync: * @proxy: A #UmRealmServiceProxy. * @arg_operation: Argument to pass with the method invocation. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL. * * Synchronously invokes the Cancel() D-Bus method on @proxy. The calling thread is blocked until a reply is received. * * See um_realm_service_call_cancel() for the asynchronous version of this method. * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean um_realm_service_call_cancel_sync ( UmRealmService *proxy, const gchar *arg_operation, GCancellable *cancellable, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), "Cancel", g_variant_new ("(s)", arg_operation), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "()"); g_variant_unref (_ret); _out: return _ret != NULL; } /** * um_realm_service_call_set_locale: * @proxy: A #UmRealmServiceProxy. * @arg_locale: Argument to pass with the method invocation. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. * @user_data: User data to pass to @callback. * * Asynchronously invokes the SetLocale() D-Bus method on @proxy. * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_service_call_set_locale_finish() to get the result of the operation. * * See um_realm_service_call_set_locale_sync() for the synchronous, blocking version of this method. */ void um_realm_service_call_set_locale ( UmRealmService *proxy, const gchar *arg_locale, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_dbus_proxy_call (G_DBUS_PROXY (proxy), "SetLocale", g_variant_new ("(s)", arg_locale), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); } /** * um_realm_service_call_set_locale_finish: * @proxy: A #UmRealmServiceProxy. * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_service_call_set_locale(). * @error: Return location for error or %NULL. * * Finishes an operation started with um_realm_service_call_set_locale(). * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean um_realm_service_call_set_locale_finish ( UmRealmService *proxy, GAsyncResult *res, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "()"); g_variant_unref (_ret); _out: return _ret != NULL; } /** * um_realm_service_call_set_locale_sync: * @proxy: A #UmRealmServiceProxy. * @arg_locale: Argument to pass with the method invocation. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL. * * Synchronously invokes the SetLocale() D-Bus method on @proxy. The calling thread is blocked until a reply is received. * * See um_realm_service_call_set_locale() for the asynchronous version of this method. * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean um_realm_service_call_set_locale_sync ( UmRealmService *proxy, const gchar *arg_locale, GCancellable *cancellable, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), "SetLocale", g_variant_new ("(s)", arg_locale), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "()"); g_variant_unref (_ret); _out: return _ret != NULL; } /** * um_realm_service_call_release: * @proxy: A #UmRealmServiceProxy. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. * @user_data: User data to pass to @callback. * * Asynchronously invokes the Release() D-Bus method on @proxy. * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_service_call_release_finish() to get the result of the operation. * * See um_realm_service_call_release_sync() for the synchronous, blocking version of this method. */ void um_realm_service_call_release ( UmRealmService *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_dbus_proxy_call (G_DBUS_PROXY (proxy), "Release", g_variant_new ("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); } /** * um_realm_service_call_release_finish: * @proxy: A #UmRealmServiceProxy. * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_service_call_release(). * @error: Return location for error or %NULL. * * Finishes an operation started with um_realm_service_call_release(). * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean um_realm_service_call_release_finish ( UmRealmService *proxy, GAsyncResult *res, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "()"); g_variant_unref (_ret); _out: return _ret != NULL; } /** * um_realm_service_call_release_sync: * @proxy: A #UmRealmServiceProxy. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL. * * Synchronously invokes the Release() D-Bus method on @proxy. The calling thread is blocked until a reply is received. * * See um_realm_service_call_release() for the asynchronous version of this method. * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean um_realm_service_call_release_sync ( UmRealmService *proxy, GCancellable *cancellable, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), "Release", g_variant_new ("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "()"); g_variant_unref (_ret); _out: return _ret != NULL; } /** * um_realm_service_complete_cancel: * @object: A #UmRealmService. * @invocation: (transfer full): A #GDBusMethodInvocation. * * Helper function used in service implementations to finish handling invocations of the Cancel() 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. * * This method will free @invocation, you cannot use it afterwards. */ void um_realm_service_complete_cancel ( UmRealmService *object, GDBusMethodInvocation *invocation) { g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); } /** * um_realm_service_complete_set_locale: * @object: A #UmRealmService. * @invocation: (transfer full): A #GDBusMethodInvocation. * * Helper function used in service implementations to finish handling invocations of the SetLocale() 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. * * This method will free @invocation, you cannot use it afterwards. */ void um_realm_service_complete_set_locale ( UmRealmService *object, GDBusMethodInvocation *invocation) { g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); } /** * um_realm_service_complete_release: * @object: A #UmRealmService. * @invocation: (transfer full): A #GDBusMethodInvocation. * * Helper function used in service implementations to finish handling invocations of the Release() 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. * * This method will free @invocation, you cannot use it afterwards. */ void um_realm_service_complete_release ( UmRealmService *object, GDBusMethodInvocation *invocation) { g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); } /* ------------------------------------------------------------------------ */ /** * UmRealmServiceProxy: * * The #UmRealmServiceProxy structure contains only private data and should only be accessed using the provided API. */ /** * UmRealmServiceProxyClass: * @parent_class: The parent class. * * Class structure for #UmRealmServiceProxy. */ struct _UmRealmServiceProxyPrivate { GData *qdata; }; static void um_realm_service_proxy_iface_init (UmRealmServiceIface *iface); G_DEFINE_TYPE_WITH_CODE (UmRealmServiceProxy, um_realm_service_proxy, G_TYPE_DBUS_PROXY, G_ADD_PRIVATE (UmRealmServiceProxy) G_IMPLEMENT_INTERFACE (UM_REALM_TYPE_SERVICE, um_realm_service_proxy_iface_init)); static void um_realm_service_proxy_finalize (GObject *object) { UmRealmServiceProxy *proxy = UM_REALM_SERVICE_PROXY (object); g_datalist_clear (&proxy->priv->qdata); G_OBJECT_CLASS (um_realm_service_proxy_parent_class)->finalize (object); } static void um_realm_service_proxy_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec G_GNUC_UNUSED) { } static void um_realm_service_proxy_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec G_GNUC_UNUSED) { } static void um_realm_service_proxy_g_signal (GDBusProxy *proxy, const gchar *sender_name G_GNUC_UNUSED, const gchar *signal_name, GVariant *parameters) { _ExtendedGDBusSignalInfo *info; GVariantIter iter; GVariant *child; GValue *paramv; guint num_params; guint n; guint signal_id; info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_um_realm_service_interface_info.parent_struct, signal_name); if (info == NULL) return; num_params = g_variant_n_children (parameters); paramv = g_new0 (GValue, num_params + 1); g_value_init (¶mv[0], UM_REALM_TYPE_SERVICE); g_value_set_object (¶mv[0], proxy); g_variant_iter_init (&iter, parameters); n = 1; while ((child = g_variant_iter_next_value (&iter)) != NULL) { _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; if (arg_info->use_gvariant) { g_value_init (¶mv[n], G_TYPE_VARIANT); g_value_set_variant (¶mv[n], child); n++; } else g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); g_variant_unref (child); } signal_id = g_signal_lookup (info->signal_name, UM_REALM_TYPE_SERVICE); g_signal_emitv (paramv, signal_id, 0, NULL); for (n = 0; n < num_params + 1; n++) g_value_unset (¶mv[n]); g_free (paramv); } static void um_realm_service_proxy_g_properties_changed (GDBusProxy *_proxy, GVariant *changed_properties, const gchar *const *invalidated_properties) { UmRealmServiceProxy *proxy = UM_REALM_SERVICE_PROXY (_proxy); guint n; const gchar *key; GVariantIter *iter; _ExtendedGDBusPropertyInfo *info; g_variant_get (changed_properties, "a{sv}", &iter); while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) { info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_service_interface_info.parent_struct, key); g_datalist_remove_data (&proxy->priv->qdata, key); if (info != NULL) g_object_notify (G_OBJECT (proxy), info->hyphen_name); } g_variant_iter_free (iter); for (n = 0; invalidated_properties[n] != NULL; n++) { info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_service_interface_info.parent_struct, invalidated_properties[n]); g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); if (info != NULL) g_object_notify (G_OBJECT (proxy), info->hyphen_name); } } static void um_realm_service_proxy_init (UmRealmServiceProxy *proxy) { proxy->priv = um_realm_service_proxy_get_instance_private (proxy); g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), um_realm_service_interface_info ()); } static void um_realm_service_proxy_class_init (UmRealmServiceProxyClass *klass) { GObjectClass *gobject_class; GDBusProxyClass *proxy_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = um_realm_service_proxy_finalize; gobject_class->get_property = um_realm_service_proxy_get_property; gobject_class->set_property = um_realm_service_proxy_set_property; proxy_class = G_DBUS_PROXY_CLASS (klass); proxy_class->g_signal = um_realm_service_proxy_g_signal; proxy_class->g_properties_changed = um_realm_service_proxy_g_properties_changed; } static void um_realm_service_proxy_iface_init (UmRealmServiceIface *iface) { } /** * um_realm_service_proxy_new: * @connection: A #GDBusConnection. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied. * @user_data: User data to pass to @callback. * * Asynchronously creates a proxy for the D-Bus interface org.freedesktop.realmd.Service. See g_dbus_proxy_new() for more details. * * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_service_proxy_new_finish() to get the result of the operation. * * See um_realm_service_proxy_new_sync() for the synchronous, blocking version of this constructor. */ void um_realm_service_proxy_new ( GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_async_initable_new_async (UM_REALM_TYPE_SERVICE_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.realmd.Service", NULL); } /** * um_realm_service_proxy_new_finish: * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_service_proxy_new(). * @error: Return location for error or %NULL * * Finishes an operation started with um_realm_service_proxy_new(). * * Returns: (transfer full) (type UmRealmServiceProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmService * um_realm_service_proxy_new_finish ( GAsyncResult *res, GError **error) { GObject *ret; GObject *source_object; source_object = g_async_result_get_source_object (res); ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); g_object_unref (source_object); if (ret != NULL) return UM_REALM_SERVICE (ret); else return NULL; } /** * um_realm_service_proxy_new_sync: * @connection: A #GDBusConnection. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL * * Synchronously creates a proxy for the D-Bus interface org.freedesktop.realmd.Service. See g_dbus_proxy_new_sync() for more details. * * The calling thread is blocked until a reply is received. * * See um_realm_service_proxy_new() for the asynchronous version of this constructor. * * Returns: (transfer full) (type UmRealmServiceProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmService * um_realm_service_proxy_new_sync ( GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error) { GInitable *ret; ret = g_initable_new (UM_REALM_TYPE_SERVICE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.Service", NULL); if (ret != NULL) return UM_REALM_SERVICE (ret); else return NULL; } /** * um_realm_service_proxy_new_for_bus: * @bus_type: A #GBusType. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: A bus name (well-known or unique). * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied. * @user_data: User data to pass to @callback. * * Like um_realm_service_proxy_new() but takes a #GBusType instead of a #GDBusConnection. * * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_service_proxy_new_for_bus_finish() to get the result of the operation. * * See um_realm_service_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. */ void um_realm_service_proxy_new_for_bus ( GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_async_initable_new_async (UM_REALM_TYPE_SERVICE_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.realmd.Service", NULL); } /** * um_realm_service_proxy_new_for_bus_finish: * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_service_proxy_new_for_bus(). * @error: Return location for error or %NULL * * Finishes an operation started with um_realm_service_proxy_new_for_bus(). * * Returns: (transfer full) (type UmRealmServiceProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmService * um_realm_service_proxy_new_for_bus_finish ( GAsyncResult *res, GError **error) { GObject *ret; GObject *source_object; source_object = g_async_result_get_source_object (res); ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); g_object_unref (source_object); if (ret != NULL) return UM_REALM_SERVICE (ret); else return NULL; } /** * um_realm_service_proxy_new_for_bus_sync: * @bus_type: A #GBusType. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: A bus name (well-known or unique). * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL * * Like um_realm_service_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. * * The calling thread is blocked until a reply is received. * * See um_realm_service_proxy_new_for_bus() for the asynchronous version of this constructor. * * Returns: (transfer full) (type UmRealmServiceProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmService * um_realm_service_proxy_new_for_bus_sync ( GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error) { GInitable *ret; ret = g_initable_new (UM_REALM_TYPE_SERVICE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.Service", NULL); if (ret != NULL) return UM_REALM_SERVICE (ret); else return NULL; } /* ------------------------------------------------------------------------ */ /** * UmRealmServiceSkeleton: * * The #UmRealmServiceSkeleton structure contains only private data and should only be accessed using the provided API. */ /** * UmRealmServiceSkeletonClass: * @parent_class: The parent class. * * Class structure for #UmRealmServiceSkeleton. */ struct _UmRealmServiceSkeletonPrivate { GValue *properties; GList *changed_properties; GSource *changed_properties_idle_source; GMainContext *context; GMutex lock; }; static void _um_realm_service_skeleton_handle_method_call ( GDBusConnection *connection G_GNUC_UNUSED, const gchar *sender G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, const gchar *method_name, GVariant *parameters, GDBusMethodInvocation *invocation, gpointer user_data) { UmRealmServiceSkeleton *skeleton = UM_REALM_SERVICE_SKELETON (user_data); _ExtendedGDBusMethodInfo *info; GVariantIter iter; GVariant *child; GValue *paramv; guint num_params; guint num_extra; guint n; guint signal_id; GValue return_value = G_VALUE_INIT; info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); g_assert (info != NULL); num_params = g_variant_n_children (parameters); num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); n = 0; g_value_init (¶mv[n], UM_REALM_TYPE_SERVICE); g_value_set_object (¶mv[n++], skeleton); g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); g_value_set_object (¶mv[n++], invocation); if (info->pass_fdlist) { #ifdef G_OS_UNIX g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); #else g_assert_not_reached (); #endif } g_variant_iter_init (&iter, parameters); while ((child = g_variant_iter_next_value (&iter)) != NULL) { _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; if (arg_info->use_gvariant) { g_value_init (¶mv[n], G_TYPE_VARIANT); g_value_set_variant (¶mv[n], child); n++; } else g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); g_variant_unref (child); } signal_id = g_signal_lookup (info->signal_name, UM_REALM_TYPE_SERVICE); g_value_init (&return_value, G_TYPE_BOOLEAN); g_signal_emitv (paramv, signal_id, 0, &return_value); if (!g_value_get_boolean (&return_value)) 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); g_value_unset (&return_value); for (n = 0; n < num_params + num_extra; n++) g_value_unset (¶mv[n]); g_free (paramv); } static GVariant * _um_realm_service_skeleton_handle_get_property ( GDBusConnection *connection G_GNUC_UNUSED, const gchar *sender G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name G_GNUC_UNUSED, const gchar *property_name, GError **error, gpointer user_data) { UmRealmServiceSkeleton *skeleton = UM_REALM_SERVICE_SKELETON (user_data); GValue value = G_VALUE_INIT; GParamSpec *pspec; _ExtendedGDBusPropertyInfo *info; GVariant *ret; ret = NULL; info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_service_interface_info.parent_struct, property_name); g_assert (info != NULL); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); if (pspec == NULL) { g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); } else { g_value_init (&value, pspec->value_type); g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); g_value_unset (&value); } return ret; } static gboolean _um_realm_service_skeleton_handle_set_property ( GDBusConnection *connection G_GNUC_UNUSED, const gchar *sender G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name G_GNUC_UNUSED, const gchar *property_name, GVariant *variant, GError **error, gpointer user_data) { UmRealmServiceSkeleton *skeleton = UM_REALM_SERVICE_SKELETON (user_data); GValue value = G_VALUE_INIT; GParamSpec *pspec; _ExtendedGDBusPropertyInfo *info; gboolean ret; ret = FALSE; info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_service_interface_info.parent_struct, property_name); g_assert (info != NULL); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); if (pspec == NULL) { g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); } else { if (info->use_gvariant) g_value_set_variant (&value, variant); else g_dbus_gvariant_to_gvalue (variant, &value); g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); g_value_unset (&value); ret = TRUE; } return ret; } static const GDBusInterfaceVTable _um_realm_service_skeleton_vtable = { _um_realm_service_skeleton_handle_method_call, _um_realm_service_skeleton_handle_get_property, _um_realm_service_skeleton_handle_set_property, {NULL} }; static GDBusInterfaceInfo * um_realm_service_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) { return um_realm_service_interface_info (); } static GDBusInterfaceVTable * um_realm_service_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) { return (GDBusInterfaceVTable *) &_um_realm_service_skeleton_vtable; } static GVariant * um_realm_service_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) { UmRealmServiceSkeleton *skeleton = UM_REALM_SERVICE_SKELETON (_skeleton); GVariantBuilder builder; guint n; g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); if (_um_realm_service_interface_info.parent_struct.properties == NULL) goto out; for (n = 0; _um_realm_service_interface_info.parent_struct.properties[n] != NULL; n++) { GDBusPropertyInfo *info = _um_realm_service_interface_info.parent_struct.properties[n]; if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) { GVariant *value; value = _um_realm_service_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.realmd.Service", info->name, NULL, skeleton); if (value != NULL) { g_variant_take_ref (value); g_variant_builder_add (&builder, "{sv}", info->name, value); g_variant_unref (value); } } } out: return g_variant_builder_end (&builder); } static void um_realm_service_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) { } static void _um_realm_service_on_signal_diagnostics ( UmRealmService *object, const gchar *arg_data, const gchar *arg_operation) { UmRealmServiceSkeleton *skeleton = UM_REALM_SERVICE_SKELETON (object); GList *connections, *l; GVariant *signal_variant; connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); signal_variant = g_variant_ref_sink (g_variant_new ("(ss)", arg_data, arg_operation)); for (l = connections; l != NULL; l = l->next) { GDBusConnection *connection = l->data; g_dbus_connection_emit_signal (connection, NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.realmd.Service", "Diagnostics", signal_variant, NULL); } g_variant_unref (signal_variant); g_list_free_full (connections, g_object_unref); } static void um_realm_service_skeleton_iface_init (UmRealmServiceIface *iface); G_DEFINE_TYPE_WITH_CODE (UmRealmServiceSkeleton, um_realm_service_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, G_ADD_PRIVATE (UmRealmServiceSkeleton) G_IMPLEMENT_INTERFACE (UM_REALM_TYPE_SERVICE, um_realm_service_skeleton_iface_init)); static void um_realm_service_skeleton_finalize (GObject *object) { UmRealmServiceSkeleton *skeleton = UM_REALM_SERVICE_SKELETON (object); g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); if (skeleton->priv->changed_properties_idle_source != NULL) g_source_destroy (skeleton->priv->changed_properties_idle_source); g_main_context_unref (skeleton->priv->context); g_mutex_clear (&skeleton->priv->lock); G_OBJECT_CLASS (um_realm_service_skeleton_parent_class)->finalize (object); } static void um_realm_service_skeleton_init (UmRealmServiceSkeleton *skeleton) { skeleton->priv = um_realm_service_skeleton_get_instance_private (skeleton); g_mutex_init (&skeleton->priv->lock); skeleton->priv->context = g_main_context_ref_thread_default (); } static void um_realm_service_skeleton_class_init (UmRealmServiceSkeletonClass *klass) { GObjectClass *gobject_class; GDBusInterfaceSkeletonClass *skeleton_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = um_realm_service_skeleton_finalize; skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); skeleton_class->get_info = um_realm_service_skeleton_dbus_interface_get_info; skeleton_class->get_properties = um_realm_service_skeleton_dbus_interface_get_properties; skeleton_class->flush = um_realm_service_skeleton_dbus_interface_flush; skeleton_class->get_vtable = um_realm_service_skeleton_dbus_interface_get_vtable; } static void um_realm_service_skeleton_iface_init (UmRealmServiceIface *iface) { iface->diagnostics = _um_realm_service_on_signal_diagnostics; } /** * um_realm_service_skeleton_new: * * Creates a skeleton object for the D-Bus interface org.freedesktop.realmd.Service. * * Returns: (transfer full) (type UmRealmServiceSkeleton): The skeleton object. */ UmRealmService * um_realm_service_skeleton_new (void) { return UM_REALM_SERVICE (g_object_new (UM_REALM_TYPE_SERVICE_SKELETON, NULL)); } /* ------------------------------------------------------------------------ * Code for interface org.freedesktop.realmd.Realm * ------------------------------------------------------------------------ */ /** * SECTION:UmRealmCommon * @title: UmRealmCommon * @short_description: Generated C code for the org.freedesktop.realmd.Realm D-Bus interface * * This section contains code for working with the org.freedesktop.realmd.Realm D-Bus interface in C. */ /* ---- Introspection data for org.freedesktop.realmd.Realm ---- */ static const _ExtendedGDBusArgInfo _um_realm_common_method_info_deconfigure_IN_ARG_options = { { -1, (gchar *) "options", (gchar *) "a{sv}", NULL }, FALSE }; static const _ExtendedGDBusArgInfo * const _um_realm_common_method_info_deconfigure_IN_ARG_pointers[] = { &_um_realm_common_method_info_deconfigure_IN_ARG_options, NULL }; static const _ExtendedGDBusMethodInfo _um_realm_common_method_info_deconfigure = { { -1, (gchar *) "Deconfigure", (GDBusArgInfo **) &_um_realm_common_method_info_deconfigure_IN_ARG_pointers, NULL, NULL }, "handle-deconfigure", FALSE }; static const _ExtendedGDBusArgInfo _um_realm_common_method_info_change_login_policy_IN_ARG_login_policy = { { -1, (gchar *) "login_policy", (gchar *) "s", NULL }, FALSE }; static const _ExtendedGDBusArgInfo _um_realm_common_method_info_change_login_policy_IN_ARG_permitted_add = { { -1, (gchar *) "permitted_add", (gchar *) "as", NULL }, FALSE }; static const _ExtendedGDBusArgInfo _um_realm_common_method_info_change_login_policy_IN_ARG_permitted_remove = { { -1, (gchar *) "permitted_remove", (gchar *) "as", NULL }, FALSE }; static const _ExtendedGDBusArgInfo _um_realm_common_method_info_change_login_policy_IN_ARG_options = { { -1, (gchar *) "options", (gchar *) "a{sv}", NULL }, FALSE }; static const _ExtendedGDBusArgInfo * const _um_realm_common_method_info_change_login_policy_IN_ARG_pointers[] = { &_um_realm_common_method_info_change_login_policy_IN_ARG_login_policy, &_um_realm_common_method_info_change_login_policy_IN_ARG_permitted_add, &_um_realm_common_method_info_change_login_policy_IN_ARG_permitted_remove, &_um_realm_common_method_info_change_login_policy_IN_ARG_options, NULL }; static const _ExtendedGDBusMethodInfo _um_realm_common_method_info_change_login_policy = { { -1, (gchar *) "ChangeLoginPolicy", (GDBusArgInfo **) &_um_realm_common_method_info_change_login_policy_IN_ARG_pointers, NULL, NULL }, "handle-change-login-policy", FALSE }; static const _ExtendedGDBusMethodInfo * const _um_realm_common_method_info_pointers[] = { &_um_realm_common_method_info_deconfigure, &_um_realm_common_method_info_change_login_policy, NULL }; static const _ExtendedGDBusPropertyInfo _um_realm_common_property_info_name = { { -1, (gchar *) "Name", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "name", FALSE }; static const _ExtendedGDBusPropertyInfo _um_realm_common_property_info_configured = { { -1, (gchar *) "Configured", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "configured", FALSE }; static const _ExtendedGDBusPropertyInfo _um_realm_common_property_info_supported_interfaces = { { -1, (gchar *) "SupportedInterfaces", (gchar *) "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "supported-interfaces", FALSE }; static const _ExtendedGDBusPropertyInfo _um_realm_common_property_info_details = { { -1, (gchar *) "Details", (gchar *) "a(ss)", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "details", FALSE }; static const _ExtendedGDBusPropertyInfo _um_realm_common_property_info_login_formats = { { -1, (gchar *) "LoginFormats", (gchar *) "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "login-formats", FALSE }; static const _ExtendedGDBusPropertyInfo _um_realm_common_property_info_login_policy = { { -1, (gchar *) "LoginPolicy", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "login-policy", FALSE }; static const _ExtendedGDBusPropertyInfo _um_realm_common_property_info_permitted_logins = { { -1, (gchar *) "PermittedLogins", (gchar *) "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "permitted-logins", FALSE }; static const _ExtendedGDBusPropertyInfo * const _um_realm_common_property_info_pointers[] = { &_um_realm_common_property_info_name, &_um_realm_common_property_info_configured, &_um_realm_common_property_info_supported_interfaces, &_um_realm_common_property_info_details, &_um_realm_common_property_info_login_formats, &_um_realm_common_property_info_login_policy, &_um_realm_common_property_info_permitted_logins, NULL }; static const _ExtendedGDBusInterfaceInfo _um_realm_common_interface_info = { { -1, (gchar *) "org.freedesktop.realmd.Realm", (GDBusMethodInfo **) &_um_realm_common_method_info_pointers, NULL, (GDBusPropertyInfo **) &_um_realm_common_property_info_pointers, NULL }, "common", }; /** * um_realm_common_interface_info: * * Gets a machine-readable description of the org.freedesktop.realmd.Realm D-Bus interface. * * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. */ GDBusInterfaceInfo * um_realm_common_interface_info (void) { return (GDBusInterfaceInfo *) &_um_realm_common_interface_info.parent_struct; } /** * um_realm_common_override_properties: * @klass: The class structure for a #GObject-derived class. * @property_id_begin: The property id to assign to the first overridden property. * * Overrides all #GObject properties in the #UmRealmCommon interface for a concrete class. * The properties are overridden in the order they are defined. * * Returns: The last property id. */ guint um_realm_common_override_properties (GObjectClass *klass, guint property_id_begin) { g_object_class_override_property (klass, property_id_begin++, "name"); g_object_class_override_property (klass, property_id_begin++, "configured"); g_object_class_override_property (klass, property_id_begin++, "supported-interfaces"); g_object_class_override_property (klass, property_id_begin++, "details"); g_object_class_override_property (klass, property_id_begin++, "login-formats"); g_object_class_override_property (klass, property_id_begin++, "login-policy"); g_object_class_override_property (klass, property_id_begin++, "permitted-logins"); return property_id_begin - 1; } /** * UmRealmCommon: * * Abstract interface type for the D-Bus interface org.freedesktop.realmd.Realm. */ /** * UmRealmCommonIface: * @parent_iface: The parent interface. * @handle_change_login_policy: Handler for the #UmRealmCommon::handle-change-login-policy signal. * @handle_deconfigure: Handler for the #UmRealmCommon::handle-deconfigure signal. * @get_configured: Getter for the #UmRealmCommon:configured property. * @get_details: Getter for the #UmRealmCommon:details property. * @get_login_formats: Getter for the #UmRealmCommon:login-formats property. * @get_login_policy: Getter for the #UmRealmCommon:login-policy property. * @get_name: Getter for the #UmRealmCommon:name property. * @get_permitted_logins: Getter for the #UmRealmCommon:permitted-logins property. * @get_supported_interfaces: Getter for the #UmRealmCommon:supported-interfaces property. * * Virtual table for the D-Bus interface org.freedesktop.realmd.Realm. */ typedef UmRealmCommonIface UmRealmCommonInterface; G_DEFINE_INTERFACE (UmRealmCommon, um_realm_common, G_TYPE_OBJECT); static void um_realm_common_default_init (UmRealmCommonIface *iface) { /* GObject signals for incoming D-Bus method calls: */ /** * UmRealmCommon::handle-deconfigure: * @object: A #UmRealmCommon. * @invocation: A #GDBusMethodInvocation. * @arg_options: Argument passed by remote caller. * * Signal emitted when a remote caller is invoking the Deconfigure() D-Bus method. * * 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 um_realm_common_complete_deconfigure() 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. * * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. */ g_signal_new ("handle-deconfigure", G_TYPE_FROM_INTERFACE (iface), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (UmRealmCommonIface, handle_deconfigure), g_signal_accumulator_true_handled, NULL, g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 2, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); /** * UmRealmCommon::handle-change-login-policy: * @object: A #UmRealmCommon. * @invocation: A #GDBusMethodInvocation. * @arg_login_policy: Argument passed by remote caller. * @arg_permitted_add: Argument passed by remote caller. * @arg_permitted_remove: Argument passed by remote caller. * @arg_options: Argument passed by remote caller. * * Signal emitted when a remote caller is invoking the ChangeLoginPolicy() D-Bus method. * * 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 um_realm_common_complete_change_login_policy() 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. * * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. */ g_signal_new ("handle-change-login-policy", G_TYPE_FROM_INTERFACE (iface), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (UmRealmCommonIface, handle_change_login_policy), g_signal_accumulator_true_handled, NULL, g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 5, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRV, G_TYPE_STRV, G_TYPE_VARIANT); /* GObject properties for D-Bus properties: */ /** * UmRealmCommon:name: * * Represents the D-Bus property "Name". * * 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. */ g_object_interface_install_property (iface, g_param_spec_string ("name", "Name", "Name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * UmRealmCommon:configured: * * Represents the D-Bus property "Configured". * * 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. */ g_object_interface_install_property (iface, g_param_spec_string ("configured", "Configured", "Configured", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * UmRealmCommon:supported-interfaces: * * Represents the D-Bus property "SupportedInterfaces". * * 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. */ g_object_interface_install_property (iface, g_param_spec_boxed ("supported-interfaces", "SupportedInterfaces", "SupportedInterfaces", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * UmRealmCommon:details: * * Represents the D-Bus property "Details". * * 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. */ g_object_interface_install_property (iface, g_param_spec_variant ("details", "Details", "Details", G_VARIANT_TYPE ("a(ss)"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * UmRealmCommon:login-formats: * * Represents the D-Bus property "LoginFormats". * * 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. */ g_object_interface_install_property (iface, g_param_spec_boxed ("login-formats", "LoginFormats", "LoginFormats", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * UmRealmCommon:login-policy: * * Represents the D-Bus property "LoginPolicy". * * 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. */ g_object_interface_install_property (iface, g_param_spec_string ("login-policy", "LoginPolicy", "LoginPolicy", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * UmRealmCommon:permitted-logins: * * Represents the D-Bus property "PermittedLogins". * * 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. */ g_object_interface_install_property (iface, g_param_spec_boxed ("permitted-logins", "PermittedLogins", "PermittedLogins", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } /** * um_realm_common_get_name: (skip) * @object: A #UmRealmCommon. * * Gets the value of the "Name" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * 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 um_realm_common_dup_name() if on another thread. * * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. */ const gchar * um_realm_common_get_name (UmRealmCommon *object) { return UM_REALM_COMMON_GET_IFACE (object)->get_name (object); } /** * um_realm_common_dup_name: (skip) * @object: A #UmRealmCommon. * * Gets a copy of the "Name" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). */ gchar * um_realm_common_dup_name (UmRealmCommon *object) { gchar *value; g_object_get (G_OBJECT (object), "name", &value, NULL); return value; } /** * um_realm_common_set_name: (skip) * @object: A #UmRealmCommon. * @value: The value to set. * * Sets the "Name" D-Bus property to @value. * * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. */ void um_realm_common_set_name (UmRealmCommon *object, const gchar *value) { g_object_set (G_OBJECT (object), "name", value, NULL); } /** * um_realm_common_get_configured: (skip) * @object: A #UmRealmCommon. * * Gets the value of the "Configured" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * 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 um_realm_common_dup_configured() if on another thread. * * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. */ const gchar * um_realm_common_get_configured (UmRealmCommon *object) { return UM_REALM_COMMON_GET_IFACE (object)->get_configured (object); } /** * um_realm_common_dup_configured: (skip) * @object: A #UmRealmCommon. * * Gets a copy of the "Configured" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). */ gchar * um_realm_common_dup_configured (UmRealmCommon *object) { gchar *value; g_object_get (G_OBJECT (object), "configured", &value, NULL); return value; } /** * um_realm_common_set_configured: (skip) * @object: A #UmRealmCommon. * @value: The value to set. * * Sets the "Configured" D-Bus property to @value. * * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. */ void um_realm_common_set_configured (UmRealmCommon *object, const gchar *value) { g_object_set (G_OBJECT (object), "configured", value, NULL); } /** * um_realm_common_get_supported_interfaces: (skip) * @object: A #UmRealmCommon. * * Gets the value of the "SupportedInterfaces" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * 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 um_realm_common_dup_supported_interfaces() if on another thread. * * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. */ const gchar *const * um_realm_common_get_supported_interfaces (UmRealmCommon *object) { return UM_REALM_COMMON_GET_IFACE (object)->get_supported_interfaces (object); } /** * um_realm_common_dup_supported_interfaces: (skip) * @object: A #UmRealmCommon. * * Gets a copy of the "SupportedInterfaces" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). */ gchar ** um_realm_common_dup_supported_interfaces (UmRealmCommon *object) { gchar **value; g_object_get (G_OBJECT (object), "supported-interfaces", &value, NULL); return value; } /** * um_realm_common_set_supported_interfaces: (skip) * @object: A #UmRealmCommon. * @value: The value to set. * * Sets the "SupportedInterfaces" D-Bus property to @value. * * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. */ void um_realm_common_set_supported_interfaces (UmRealmCommon *object, const gchar *const *value) { g_object_set (G_OBJECT (object), "supported-interfaces", value, NULL); } /** * um_realm_common_get_details: (skip) * @object: A #UmRealmCommon. * * Gets the value of the "Details" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * 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 um_realm_common_dup_details() if on another thread. * * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. */ GVariant * um_realm_common_get_details (UmRealmCommon *object) { return UM_REALM_COMMON_GET_IFACE (object)->get_details (object); } /** * um_realm_common_dup_details: (skip) * @object: A #UmRealmCommon. * * Gets a copy of the "Details" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). */ GVariant * um_realm_common_dup_details (UmRealmCommon *object) { GVariant *value; g_object_get (G_OBJECT (object), "details", &value, NULL); return value; } /** * um_realm_common_set_details: (skip) * @object: A #UmRealmCommon. * @value: The value to set. * * Sets the "Details" D-Bus property to @value. * * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. */ void um_realm_common_set_details (UmRealmCommon *object, GVariant *value) { g_object_set (G_OBJECT (object), "details", value, NULL); } /** * um_realm_common_get_login_formats: (skip) * @object: A #UmRealmCommon. * * Gets the value of the "LoginFormats" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * 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 um_realm_common_dup_login_formats() if on another thread. * * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. */ const gchar *const * um_realm_common_get_login_formats (UmRealmCommon *object) { return UM_REALM_COMMON_GET_IFACE (object)->get_login_formats (object); } /** * um_realm_common_dup_login_formats: (skip) * @object: A #UmRealmCommon. * * Gets a copy of the "LoginFormats" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). */ gchar ** um_realm_common_dup_login_formats (UmRealmCommon *object) { gchar **value; g_object_get (G_OBJECT (object), "login-formats", &value, NULL); return value; } /** * um_realm_common_set_login_formats: (skip) * @object: A #UmRealmCommon. * @value: The value to set. * * Sets the "LoginFormats" D-Bus property to @value. * * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. */ void um_realm_common_set_login_formats (UmRealmCommon *object, const gchar *const *value) { g_object_set (G_OBJECT (object), "login-formats", value, NULL); } /** * um_realm_common_get_login_policy: (skip) * @object: A #UmRealmCommon. * * Gets the value of the "LoginPolicy" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * 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 um_realm_common_dup_login_policy() if on another thread. * * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. */ const gchar * um_realm_common_get_login_policy (UmRealmCommon *object) { return UM_REALM_COMMON_GET_IFACE (object)->get_login_policy (object); } /** * um_realm_common_dup_login_policy: (skip) * @object: A #UmRealmCommon. * * Gets a copy of the "LoginPolicy" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). */ gchar * um_realm_common_dup_login_policy (UmRealmCommon *object) { gchar *value; g_object_get (G_OBJECT (object), "login-policy", &value, NULL); return value; } /** * um_realm_common_set_login_policy: (skip) * @object: A #UmRealmCommon. * @value: The value to set. * * Sets the "LoginPolicy" D-Bus property to @value. * * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. */ void um_realm_common_set_login_policy (UmRealmCommon *object, const gchar *value) { g_object_set (G_OBJECT (object), "login-policy", value, NULL); } /** * um_realm_common_get_permitted_logins: (skip) * @object: A #UmRealmCommon. * * Gets the value of the "PermittedLogins" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * 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 um_realm_common_dup_permitted_logins() if on another thread. * * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. */ const gchar *const * um_realm_common_get_permitted_logins (UmRealmCommon *object) { return UM_REALM_COMMON_GET_IFACE (object)->get_permitted_logins (object); } /** * um_realm_common_dup_permitted_logins: (skip) * @object: A #UmRealmCommon. * * Gets a copy of the "PermittedLogins" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). */ gchar ** um_realm_common_dup_permitted_logins (UmRealmCommon *object) { gchar **value; g_object_get (G_OBJECT (object), "permitted-logins", &value, NULL); return value; } /** * um_realm_common_set_permitted_logins: (skip) * @object: A #UmRealmCommon. * @value: The value to set. * * Sets the "PermittedLogins" D-Bus property to @value. * * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. */ void um_realm_common_set_permitted_logins (UmRealmCommon *object, const gchar *const *value) { g_object_set (G_OBJECT (object), "permitted-logins", value, NULL); } /** * um_realm_common_call_deconfigure: * @proxy: A #UmRealmCommonProxy. * @arg_options: Argument to pass with the method invocation. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. * @user_data: User data to pass to @callback. * * Asynchronously invokes the Deconfigure() D-Bus method on @proxy. * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_common_call_deconfigure_finish() to get the result of the operation. * * See um_realm_common_call_deconfigure_sync() for the synchronous, blocking version of this method. */ void um_realm_common_call_deconfigure ( UmRealmCommon *proxy, GVariant *arg_options, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_dbus_proxy_call (G_DBUS_PROXY (proxy), "Deconfigure", g_variant_new ("(@a{sv})", arg_options), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); } /** * um_realm_common_call_deconfigure_finish: * @proxy: A #UmRealmCommonProxy. * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_common_call_deconfigure(). * @error: Return location for error or %NULL. * * Finishes an operation started with um_realm_common_call_deconfigure(). * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean um_realm_common_call_deconfigure_finish ( UmRealmCommon *proxy, GAsyncResult *res, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "()"); g_variant_unref (_ret); _out: return _ret != NULL; } /** * um_realm_common_call_deconfigure_sync: * @proxy: A #UmRealmCommonProxy. * @arg_options: Argument to pass with the method invocation. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL. * * Synchronously invokes the Deconfigure() D-Bus method on @proxy. The calling thread is blocked until a reply is received. * * See um_realm_common_call_deconfigure() for the asynchronous version of this method. * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean um_realm_common_call_deconfigure_sync ( UmRealmCommon *proxy, GVariant *arg_options, GCancellable *cancellable, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), "Deconfigure", g_variant_new ("(@a{sv})", arg_options), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "()"); g_variant_unref (_ret); _out: return _ret != NULL; } /** * um_realm_common_call_change_login_policy: * @proxy: A #UmRealmCommonProxy. * @arg_login_policy: Argument to pass with the method invocation. * @arg_permitted_add: Argument to pass with the method invocation. * @arg_permitted_remove: Argument to pass with the method invocation. * @arg_options: Argument to pass with the method invocation. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. * @user_data: User data to pass to @callback. * * Asynchronously invokes the ChangeLoginPolicy() D-Bus method on @proxy. * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_common_call_change_login_policy_finish() to get the result of the operation. * * See um_realm_common_call_change_login_policy_sync() for the synchronous, blocking version of this method. */ void um_realm_common_call_change_login_policy ( UmRealmCommon *proxy, const gchar *arg_login_policy, const gchar *const *arg_permitted_add, const gchar *const *arg_permitted_remove, GVariant *arg_options, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_dbus_proxy_call (G_DBUS_PROXY (proxy), "ChangeLoginPolicy", g_variant_new ("(s^as^as@a{sv})", arg_login_policy, arg_permitted_add, arg_permitted_remove, arg_options), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); } /** * um_realm_common_call_change_login_policy_finish: * @proxy: A #UmRealmCommonProxy. * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_common_call_change_login_policy(). * @error: Return location for error or %NULL. * * Finishes an operation started with um_realm_common_call_change_login_policy(). * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean um_realm_common_call_change_login_policy_finish ( UmRealmCommon *proxy, GAsyncResult *res, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "()"); g_variant_unref (_ret); _out: return _ret != NULL; } /** * um_realm_common_call_change_login_policy_sync: * @proxy: A #UmRealmCommonProxy. * @arg_login_policy: Argument to pass with the method invocation. * @arg_permitted_add: Argument to pass with the method invocation. * @arg_permitted_remove: Argument to pass with the method invocation. * @arg_options: Argument to pass with the method invocation. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL. * * Synchronously invokes the ChangeLoginPolicy() D-Bus method on @proxy. The calling thread is blocked until a reply is received. * * See um_realm_common_call_change_login_policy() for the asynchronous version of this method. * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean um_realm_common_call_change_login_policy_sync ( UmRealmCommon *proxy, const gchar *arg_login_policy, const gchar *const *arg_permitted_add, const gchar *const *arg_permitted_remove, GVariant *arg_options, GCancellable *cancellable, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), "ChangeLoginPolicy", g_variant_new ("(s^as^as@a{sv})", arg_login_policy, arg_permitted_add, arg_permitted_remove, arg_options), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "()"); g_variant_unref (_ret); _out: return _ret != NULL; } /** * um_realm_common_complete_deconfigure: * @object: A #UmRealmCommon. * @invocation: (transfer full): A #GDBusMethodInvocation. * * Helper function used in service implementations to finish handling invocations of the Deconfigure() 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. * * This method will free @invocation, you cannot use it afterwards. */ void um_realm_common_complete_deconfigure ( UmRealmCommon *object, GDBusMethodInvocation *invocation) { g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); } /** * um_realm_common_complete_change_login_policy: * @object: A #UmRealmCommon. * @invocation: (transfer full): A #GDBusMethodInvocation. * * Helper function used in service implementations to finish handling invocations of the ChangeLoginPolicy() 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. * * This method will free @invocation, you cannot use it afterwards. */ void um_realm_common_complete_change_login_policy ( UmRealmCommon *object, GDBusMethodInvocation *invocation) { g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); } /* ------------------------------------------------------------------------ */ /** * UmRealmCommonProxy: * * The #UmRealmCommonProxy structure contains only private data and should only be accessed using the provided API. */ /** * UmRealmCommonProxyClass: * @parent_class: The parent class. * * Class structure for #UmRealmCommonProxy. */ struct _UmRealmCommonProxyPrivate { GData *qdata; }; static void um_realm_common_proxy_iface_init (UmRealmCommonIface *iface); G_DEFINE_TYPE_WITH_CODE (UmRealmCommonProxy, um_realm_common_proxy, G_TYPE_DBUS_PROXY, G_ADD_PRIVATE (UmRealmCommonProxy) G_IMPLEMENT_INTERFACE (UM_REALM_TYPE_COMMON, um_realm_common_proxy_iface_init)); static void um_realm_common_proxy_finalize (GObject *object) { UmRealmCommonProxy *proxy = UM_REALM_COMMON_PROXY (object); g_datalist_clear (&proxy->priv->qdata); G_OBJECT_CLASS (um_realm_common_proxy_parent_class)->finalize (object); } static void um_realm_common_proxy_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec G_GNUC_UNUSED) { const _ExtendedGDBusPropertyInfo *info; GVariant *variant; g_assert (prop_id != 0 && prop_id - 1 < 7); info = _um_realm_common_property_info_pointers[prop_id - 1]; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); if (info->use_gvariant) { g_value_set_variant (value, variant); } else { if (variant != NULL) g_dbus_gvariant_to_gvalue (variant, value); } if (variant != NULL) g_variant_unref (variant); } static void um_realm_common_proxy_set_property_cb (GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) { const _ExtendedGDBusPropertyInfo *info = user_data; GError *error; error = NULL; if (!g_dbus_proxy_call_finish (proxy, res, &error)) { g_warning ("Error setting property '%s' on interface org.freedesktop.realmd.Realm: %s (%s, %d)", info->parent_struct.name, error->message, g_quark_to_string (error->domain), error->code); g_error_free (error); } } static void um_realm_common_proxy_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec G_GNUC_UNUSED) { const _ExtendedGDBusPropertyInfo *info; GVariant *variant; g_assert (prop_id != 0 && prop_id - 1 < 7); info = _um_realm_common_property_info_pointers[prop_id - 1]; variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); g_dbus_proxy_call (G_DBUS_PROXY (object), "org.freedesktop.DBus.Properties.Set", g_variant_new ("(ssv)", "org.freedesktop.realmd.Realm", info->parent_struct.name, variant), G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) um_realm_common_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); g_variant_unref (variant); } static void um_realm_common_proxy_g_signal (GDBusProxy *proxy, const gchar *sender_name G_GNUC_UNUSED, const gchar *signal_name, GVariant *parameters) { _ExtendedGDBusSignalInfo *info; GVariantIter iter; GVariant *child; GValue *paramv; guint num_params; guint n; guint signal_id; info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_um_realm_common_interface_info.parent_struct, signal_name); if (info == NULL) return; num_params = g_variant_n_children (parameters); paramv = g_new0 (GValue, num_params + 1); g_value_init (¶mv[0], UM_REALM_TYPE_COMMON); g_value_set_object (¶mv[0], proxy); g_variant_iter_init (&iter, parameters); n = 1; while ((child = g_variant_iter_next_value (&iter)) != NULL) { _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; if (arg_info->use_gvariant) { g_value_init (¶mv[n], G_TYPE_VARIANT); g_value_set_variant (¶mv[n], child); n++; } else g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); g_variant_unref (child); } signal_id = g_signal_lookup (info->signal_name, UM_REALM_TYPE_COMMON); g_signal_emitv (paramv, signal_id, 0, NULL); for (n = 0; n < num_params + 1; n++) g_value_unset (¶mv[n]); g_free (paramv); } static void um_realm_common_proxy_g_properties_changed (GDBusProxy *_proxy, GVariant *changed_properties, const gchar *const *invalidated_properties) { UmRealmCommonProxy *proxy = UM_REALM_COMMON_PROXY (_proxy); guint n; const gchar *key; GVariantIter *iter; _ExtendedGDBusPropertyInfo *info; g_variant_get (changed_properties, "a{sv}", &iter); while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) { info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_common_interface_info.parent_struct, key); g_datalist_remove_data (&proxy->priv->qdata, key); if (info != NULL) g_object_notify (G_OBJECT (proxy), info->hyphen_name); } g_variant_iter_free (iter); for (n = 0; invalidated_properties[n] != NULL; n++) { info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_common_interface_info.parent_struct, invalidated_properties[n]); g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); if (info != NULL) g_object_notify (G_OBJECT (proxy), info->hyphen_name); } } static const gchar * um_realm_common_proxy_get_name (UmRealmCommon *object) { UmRealmCommonProxy *proxy = UM_REALM_COMMON_PROXY (object); GVariant *variant; const gchar *value = NULL; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Name"); if (variant != NULL) { value = g_variant_get_string (variant, NULL); g_variant_unref (variant); } return value; } static const gchar * um_realm_common_proxy_get_configured (UmRealmCommon *object) { UmRealmCommonProxy *proxy = UM_REALM_COMMON_PROXY (object); GVariant *variant; const gchar *value = NULL; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Configured"); if (variant != NULL) { value = g_variant_get_string (variant, NULL); g_variant_unref (variant); } return value; } static const gchar *const * um_realm_common_proxy_get_supported_interfaces (UmRealmCommon *object) { UmRealmCommonProxy *proxy = UM_REALM_COMMON_PROXY (object); GVariant *variant; const gchar *const *value = NULL; value = g_datalist_get_data (&proxy->priv->qdata, "SupportedInterfaces"); if (value != NULL) return value; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "SupportedInterfaces"); if (variant != NULL) { value = g_variant_get_strv (variant, NULL); g_datalist_set_data_full (&proxy->priv->qdata, "SupportedInterfaces", (gpointer) value, g_free); g_variant_unref (variant); } return value; } static GVariant * um_realm_common_proxy_get_details (UmRealmCommon *object) { UmRealmCommonProxy *proxy = UM_REALM_COMMON_PROXY (object); GVariant *variant; GVariant *value = NULL; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Details"); value = variant; if (variant != NULL) g_variant_unref (variant); return value; } static const gchar *const * um_realm_common_proxy_get_login_formats (UmRealmCommon *object) { UmRealmCommonProxy *proxy = UM_REALM_COMMON_PROXY (object); GVariant *variant; const gchar *const *value = NULL; value = g_datalist_get_data (&proxy->priv->qdata, "LoginFormats"); if (value != NULL) return value; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "LoginFormats"); if (variant != NULL) { value = g_variant_get_strv (variant, NULL); g_datalist_set_data_full (&proxy->priv->qdata, "LoginFormats", (gpointer) value, g_free); g_variant_unref (variant); } return value; } static const gchar * um_realm_common_proxy_get_login_policy (UmRealmCommon *object) { UmRealmCommonProxy *proxy = UM_REALM_COMMON_PROXY (object); GVariant *variant; const gchar *value = NULL; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "LoginPolicy"); if (variant != NULL) { value = g_variant_get_string (variant, NULL); g_variant_unref (variant); } return value; } static const gchar *const * um_realm_common_proxy_get_permitted_logins (UmRealmCommon *object) { UmRealmCommonProxy *proxy = UM_REALM_COMMON_PROXY (object); GVariant *variant; const gchar *const *value = NULL; value = g_datalist_get_data (&proxy->priv->qdata, "PermittedLogins"); if (value != NULL) return value; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "PermittedLogins"); if (variant != NULL) { value = g_variant_get_strv (variant, NULL); g_datalist_set_data_full (&proxy->priv->qdata, "PermittedLogins", (gpointer) value, g_free); g_variant_unref (variant); } return value; } static void um_realm_common_proxy_init (UmRealmCommonProxy *proxy) { proxy->priv = um_realm_common_proxy_get_instance_private (proxy); g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), um_realm_common_interface_info ()); } static void um_realm_common_proxy_class_init (UmRealmCommonProxyClass *klass) { GObjectClass *gobject_class; GDBusProxyClass *proxy_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = um_realm_common_proxy_finalize; gobject_class->get_property = um_realm_common_proxy_get_property; gobject_class->set_property = um_realm_common_proxy_set_property; proxy_class = G_DBUS_PROXY_CLASS (klass); proxy_class->g_signal = um_realm_common_proxy_g_signal; proxy_class->g_properties_changed = um_realm_common_proxy_g_properties_changed; um_realm_common_override_properties (gobject_class, 1); } static void um_realm_common_proxy_iface_init (UmRealmCommonIface *iface) { iface->get_name = um_realm_common_proxy_get_name; iface->get_configured = um_realm_common_proxy_get_configured; iface->get_supported_interfaces = um_realm_common_proxy_get_supported_interfaces; iface->get_details = um_realm_common_proxy_get_details; iface->get_login_formats = um_realm_common_proxy_get_login_formats; iface->get_login_policy = um_realm_common_proxy_get_login_policy; iface->get_permitted_logins = um_realm_common_proxy_get_permitted_logins; } /** * um_realm_common_proxy_new: * @connection: A #GDBusConnection. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied. * @user_data: User data to pass to @callback. * * Asynchronously creates a proxy for the D-Bus interface org.freedesktop.realmd.Realm. See g_dbus_proxy_new() for more details. * * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_common_proxy_new_finish() to get the result of the operation. * * See um_realm_common_proxy_new_sync() for the synchronous, blocking version of this constructor. */ void um_realm_common_proxy_new ( GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_async_initable_new_async (UM_REALM_TYPE_COMMON_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.realmd.Realm", NULL); } /** * um_realm_common_proxy_new_finish: * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_common_proxy_new(). * @error: Return location for error or %NULL * * Finishes an operation started with um_realm_common_proxy_new(). * * Returns: (transfer full) (type UmRealmCommonProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmCommon * um_realm_common_proxy_new_finish ( GAsyncResult *res, GError **error) { GObject *ret; GObject *source_object; source_object = g_async_result_get_source_object (res); ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); g_object_unref (source_object); if (ret != NULL) return UM_REALM_COMMON (ret); else return NULL; } /** * um_realm_common_proxy_new_sync: * @connection: A #GDBusConnection. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL * * Synchronously creates a proxy for the D-Bus interface org.freedesktop.realmd.Realm. See g_dbus_proxy_new_sync() for more details. * * The calling thread is blocked until a reply is received. * * See um_realm_common_proxy_new() for the asynchronous version of this constructor. * * Returns: (transfer full) (type UmRealmCommonProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmCommon * um_realm_common_proxy_new_sync ( GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error) { GInitable *ret; ret = g_initable_new (UM_REALM_TYPE_COMMON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.Realm", NULL); if (ret != NULL) return UM_REALM_COMMON (ret); else return NULL; } /** * um_realm_common_proxy_new_for_bus: * @bus_type: A #GBusType. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: A bus name (well-known or unique). * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied. * @user_data: User data to pass to @callback. * * Like um_realm_common_proxy_new() but takes a #GBusType instead of a #GDBusConnection. * * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_common_proxy_new_for_bus_finish() to get the result of the operation. * * See um_realm_common_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. */ void um_realm_common_proxy_new_for_bus ( GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_async_initable_new_async (UM_REALM_TYPE_COMMON_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.realmd.Realm", NULL); } /** * um_realm_common_proxy_new_for_bus_finish: * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_common_proxy_new_for_bus(). * @error: Return location for error or %NULL * * Finishes an operation started with um_realm_common_proxy_new_for_bus(). * * Returns: (transfer full) (type UmRealmCommonProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmCommon * um_realm_common_proxy_new_for_bus_finish ( GAsyncResult *res, GError **error) { GObject *ret; GObject *source_object; source_object = g_async_result_get_source_object (res); ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); g_object_unref (source_object); if (ret != NULL) return UM_REALM_COMMON (ret); else return NULL; } /** * um_realm_common_proxy_new_for_bus_sync: * @bus_type: A #GBusType. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: A bus name (well-known or unique). * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL * * Like um_realm_common_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. * * The calling thread is blocked until a reply is received. * * See um_realm_common_proxy_new_for_bus() for the asynchronous version of this constructor. * * Returns: (transfer full) (type UmRealmCommonProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmCommon * um_realm_common_proxy_new_for_bus_sync ( GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error) { GInitable *ret; ret = g_initable_new (UM_REALM_TYPE_COMMON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.Realm", NULL); if (ret != NULL) return UM_REALM_COMMON (ret); else return NULL; } /* ------------------------------------------------------------------------ */ /** * UmRealmCommonSkeleton: * * The #UmRealmCommonSkeleton structure contains only private data and should only be accessed using the provided API. */ /** * UmRealmCommonSkeletonClass: * @parent_class: The parent class. * * Class structure for #UmRealmCommonSkeleton. */ struct _UmRealmCommonSkeletonPrivate { GValue *properties; GList *changed_properties; GSource *changed_properties_idle_source; GMainContext *context; GMutex lock; }; static void _um_realm_common_skeleton_handle_method_call ( GDBusConnection *connection G_GNUC_UNUSED, const gchar *sender G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, const gchar *method_name, GVariant *parameters, GDBusMethodInvocation *invocation, gpointer user_data) { UmRealmCommonSkeleton *skeleton = UM_REALM_COMMON_SKELETON (user_data); _ExtendedGDBusMethodInfo *info; GVariantIter iter; GVariant *child; GValue *paramv; guint num_params; guint num_extra; guint n; guint signal_id; GValue return_value = G_VALUE_INIT; info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); g_assert (info != NULL); num_params = g_variant_n_children (parameters); num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); n = 0; g_value_init (¶mv[n], UM_REALM_TYPE_COMMON); g_value_set_object (¶mv[n++], skeleton); g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); g_value_set_object (¶mv[n++], invocation); if (info->pass_fdlist) { #ifdef G_OS_UNIX g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); #else g_assert_not_reached (); #endif } g_variant_iter_init (&iter, parameters); while ((child = g_variant_iter_next_value (&iter)) != NULL) { _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; if (arg_info->use_gvariant) { g_value_init (¶mv[n], G_TYPE_VARIANT); g_value_set_variant (¶mv[n], child); n++; } else g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); g_variant_unref (child); } signal_id = g_signal_lookup (info->signal_name, UM_REALM_TYPE_COMMON); g_value_init (&return_value, G_TYPE_BOOLEAN); g_signal_emitv (paramv, signal_id, 0, &return_value); if (!g_value_get_boolean (&return_value)) 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); g_value_unset (&return_value); for (n = 0; n < num_params + num_extra; n++) g_value_unset (¶mv[n]); g_free (paramv); } static GVariant * _um_realm_common_skeleton_handle_get_property ( GDBusConnection *connection G_GNUC_UNUSED, const gchar *sender G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name G_GNUC_UNUSED, const gchar *property_name, GError **error, gpointer user_data) { UmRealmCommonSkeleton *skeleton = UM_REALM_COMMON_SKELETON (user_data); GValue value = G_VALUE_INIT; GParamSpec *pspec; _ExtendedGDBusPropertyInfo *info; GVariant *ret; ret = NULL; info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_common_interface_info.parent_struct, property_name); g_assert (info != NULL); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); if (pspec == NULL) { g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); } else { g_value_init (&value, pspec->value_type); g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); g_value_unset (&value); } return ret; } static gboolean _um_realm_common_skeleton_handle_set_property ( GDBusConnection *connection G_GNUC_UNUSED, const gchar *sender G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name G_GNUC_UNUSED, const gchar *property_name, GVariant *variant, GError **error, gpointer user_data) { UmRealmCommonSkeleton *skeleton = UM_REALM_COMMON_SKELETON (user_data); GValue value = G_VALUE_INIT; GParamSpec *pspec; _ExtendedGDBusPropertyInfo *info; gboolean ret; ret = FALSE; info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_common_interface_info.parent_struct, property_name); g_assert (info != NULL); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); if (pspec == NULL) { g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); } else { if (info->use_gvariant) g_value_set_variant (&value, variant); else g_dbus_gvariant_to_gvalue (variant, &value); g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); g_value_unset (&value); ret = TRUE; } return ret; } static const GDBusInterfaceVTable _um_realm_common_skeleton_vtable = { _um_realm_common_skeleton_handle_method_call, _um_realm_common_skeleton_handle_get_property, _um_realm_common_skeleton_handle_set_property, {NULL} }; static GDBusInterfaceInfo * um_realm_common_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) { return um_realm_common_interface_info (); } static GDBusInterfaceVTable * um_realm_common_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) { return (GDBusInterfaceVTable *) &_um_realm_common_skeleton_vtable; } static GVariant * um_realm_common_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) { UmRealmCommonSkeleton *skeleton = UM_REALM_COMMON_SKELETON (_skeleton); GVariantBuilder builder; guint n; g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); if (_um_realm_common_interface_info.parent_struct.properties == NULL) goto out; for (n = 0; _um_realm_common_interface_info.parent_struct.properties[n] != NULL; n++) { GDBusPropertyInfo *info = _um_realm_common_interface_info.parent_struct.properties[n]; if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) { GVariant *value; value = _um_realm_common_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.realmd.Realm", info->name, NULL, skeleton); if (value != NULL) { g_variant_take_ref (value); g_variant_builder_add (&builder, "{sv}", info->name, value); g_variant_unref (value); } } } out: return g_variant_builder_end (&builder); } static gboolean _um_realm_common_emit_changed (gpointer user_data); static void um_realm_common_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) { UmRealmCommonSkeleton *skeleton = UM_REALM_COMMON_SKELETON (_skeleton); gboolean emit_changed = FALSE; g_mutex_lock (&skeleton->priv->lock); if (skeleton->priv->changed_properties_idle_source != NULL) { g_source_destroy (skeleton->priv->changed_properties_idle_source); skeleton->priv->changed_properties_idle_source = NULL; emit_changed = TRUE; } g_mutex_unlock (&skeleton->priv->lock); if (emit_changed) _um_realm_common_emit_changed (skeleton); } static void um_realm_common_skeleton_iface_init (UmRealmCommonIface *iface); G_DEFINE_TYPE_WITH_CODE (UmRealmCommonSkeleton, um_realm_common_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, G_ADD_PRIVATE (UmRealmCommonSkeleton) G_IMPLEMENT_INTERFACE (UM_REALM_TYPE_COMMON, um_realm_common_skeleton_iface_init)); static void um_realm_common_skeleton_finalize (GObject *object) { UmRealmCommonSkeleton *skeleton = UM_REALM_COMMON_SKELETON (object); guint n; for (n = 0; n < 7; n++) g_value_unset (&skeleton->priv->properties[n]); g_free (skeleton->priv->properties); g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); if (skeleton->priv->changed_properties_idle_source != NULL) g_source_destroy (skeleton->priv->changed_properties_idle_source); g_main_context_unref (skeleton->priv->context); g_mutex_clear (&skeleton->priv->lock); G_OBJECT_CLASS (um_realm_common_skeleton_parent_class)->finalize (object); } static void um_realm_common_skeleton_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec G_GNUC_UNUSED) { UmRealmCommonSkeleton *skeleton = UM_REALM_COMMON_SKELETON (object); g_assert (prop_id != 0 && prop_id - 1 < 7); g_mutex_lock (&skeleton->priv->lock); g_value_copy (&skeleton->priv->properties[prop_id - 1], value); g_mutex_unlock (&skeleton->priv->lock); } static gboolean _um_realm_common_emit_changed (gpointer user_data) { UmRealmCommonSkeleton *skeleton = UM_REALM_COMMON_SKELETON (user_data); GList *l; GVariantBuilder builder; GVariantBuilder invalidated_builder; guint num_changes; g_mutex_lock (&skeleton->priv->lock); g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) { ChangedProperty *cp = l->data; GVariant *variant; const GValue *cur_value; cur_value = &skeleton->priv->properties[cp->prop_id - 1]; if (!_g_value_equal (cur_value, &cp->orig_value)) { variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); g_variant_unref (variant); num_changes++; } } if (num_changes > 0) { GList *connections, *ll; GVariant *signal_variant; signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.realmd.Realm", &builder, &invalidated_builder)); connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); for (ll = connections; ll != NULL; ll = ll->next) { GDBusConnection *connection = ll->data; g_dbus_connection_emit_signal (connection, NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.DBus.Properties", "PropertiesChanged", signal_variant, NULL); } g_variant_unref (signal_variant); g_list_free_full (connections, g_object_unref); } else { g_variant_builder_clear (&builder); g_variant_builder_clear (&invalidated_builder); } g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); skeleton->priv->changed_properties = NULL; skeleton->priv->changed_properties_idle_source = NULL; g_mutex_unlock (&skeleton->priv->lock); return FALSE; } static void _um_realm_common_schedule_emit_changed (UmRealmCommonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) { ChangedProperty *cp; GList *l; cp = NULL; for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) { ChangedProperty *i_cp = l->data; if (i_cp->info == info) { cp = i_cp; break; } } if (cp == NULL) { cp = g_new0 (ChangedProperty, 1); cp->prop_id = prop_id; cp->info = info; skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); g_value_copy (orig_value, &cp->orig_value); } } static void um_realm_common_skeleton_notify (GObject *object, GParamSpec *pspec G_GNUC_UNUSED) { UmRealmCommonSkeleton *skeleton = UM_REALM_COMMON_SKELETON (object); g_mutex_lock (&skeleton->priv->lock); if (skeleton->priv->changed_properties != NULL && skeleton->priv->changed_properties_idle_source == NULL) { skeleton->priv->changed_properties_idle_source = g_idle_source_new (); g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); g_source_set_callback (skeleton->priv->changed_properties_idle_source, _um_realm_common_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); g_source_unref (skeleton->priv->changed_properties_idle_source); } g_mutex_unlock (&skeleton->priv->lock); } static void um_realm_common_skeleton_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { UmRealmCommonSkeleton *skeleton = UM_REALM_COMMON_SKELETON (object); g_assert (prop_id != 0 && prop_id - 1 < 7); g_mutex_lock (&skeleton->priv->lock); g_object_freeze_notify (object); if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) { if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) _um_realm_common_schedule_emit_changed (skeleton, _um_realm_common_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); g_object_notify_by_pspec (object, pspec); } g_mutex_unlock (&skeleton->priv->lock); g_object_thaw_notify (object); } static void um_realm_common_skeleton_init (UmRealmCommonSkeleton *skeleton) { skeleton->priv = um_realm_common_skeleton_get_instance_private (skeleton); g_mutex_init (&skeleton->priv->lock); skeleton->priv->context = g_main_context_ref_thread_default (); skeleton->priv->properties = g_new0 (GValue, 7); g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); g_value_init (&skeleton->priv->properties[2], G_TYPE_STRV); g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT); g_value_init (&skeleton->priv->properties[4], G_TYPE_STRV); g_value_init (&skeleton->priv->properties[5], G_TYPE_STRING); g_value_init (&skeleton->priv->properties[6], G_TYPE_STRV); } static const gchar * um_realm_common_skeleton_get_name (UmRealmCommon *object) { UmRealmCommonSkeleton *skeleton = UM_REALM_COMMON_SKELETON (object); const gchar *value; g_mutex_lock (&skeleton->priv->lock); value = g_value_get_string (&(skeleton->priv->properties[0])); g_mutex_unlock (&skeleton->priv->lock); return value; } static const gchar * um_realm_common_skeleton_get_configured (UmRealmCommon *object) { UmRealmCommonSkeleton *skeleton = UM_REALM_COMMON_SKELETON (object); const gchar *value; g_mutex_lock (&skeleton->priv->lock); value = g_value_get_string (&(skeleton->priv->properties[1])); g_mutex_unlock (&skeleton->priv->lock); return value; } static const gchar *const * um_realm_common_skeleton_get_supported_interfaces (UmRealmCommon *object) { UmRealmCommonSkeleton *skeleton = UM_REALM_COMMON_SKELETON (object); const gchar *const *value; g_mutex_lock (&skeleton->priv->lock); value = g_value_get_boxed (&(skeleton->priv->properties[2])); g_mutex_unlock (&skeleton->priv->lock); return value; } static GVariant * um_realm_common_skeleton_get_details (UmRealmCommon *object) { UmRealmCommonSkeleton *skeleton = UM_REALM_COMMON_SKELETON (object); GVariant *value; g_mutex_lock (&skeleton->priv->lock); value = g_value_get_variant (&(skeleton->priv->properties[3])); g_mutex_unlock (&skeleton->priv->lock); return value; } static const gchar *const * um_realm_common_skeleton_get_login_formats (UmRealmCommon *object) { UmRealmCommonSkeleton *skeleton = UM_REALM_COMMON_SKELETON (object); const gchar *const *value; g_mutex_lock (&skeleton->priv->lock); value = g_value_get_boxed (&(skeleton->priv->properties[4])); g_mutex_unlock (&skeleton->priv->lock); return value; } static const gchar * um_realm_common_skeleton_get_login_policy (UmRealmCommon *object) { UmRealmCommonSkeleton *skeleton = UM_REALM_COMMON_SKELETON (object); const gchar *value; g_mutex_lock (&skeleton->priv->lock); value = g_value_get_string (&(skeleton->priv->properties[5])); g_mutex_unlock (&skeleton->priv->lock); return value; } static const gchar *const * um_realm_common_skeleton_get_permitted_logins (UmRealmCommon *object) { UmRealmCommonSkeleton *skeleton = UM_REALM_COMMON_SKELETON (object); const gchar *const *value; g_mutex_lock (&skeleton->priv->lock); value = g_value_get_boxed (&(skeleton->priv->properties[6])); g_mutex_unlock (&skeleton->priv->lock); return value; } static void um_realm_common_skeleton_class_init (UmRealmCommonSkeletonClass *klass) { GObjectClass *gobject_class; GDBusInterfaceSkeletonClass *skeleton_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = um_realm_common_skeleton_finalize; gobject_class->get_property = um_realm_common_skeleton_get_property; gobject_class->set_property = um_realm_common_skeleton_set_property; gobject_class->notify = um_realm_common_skeleton_notify; um_realm_common_override_properties (gobject_class, 1); skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); skeleton_class->get_info = um_realm_common_skeleton_dbus_interface_get_info; skeleton_class->get_properties = um_realm_common_skeleton_dbus_interface_get_properties; skeleton_class->flush = um_realm_common_skeleton_dbus_interface_flush; skeleton_class->get_vtable = um_realm_common_skeleton_dbus_interface_get_vtable; } static void um_realm_common_skeleton_iface_init (UmRealmCommonIface *iface) { iface->get_name = um_realm_common_skeleton_get_name; iface->get_configured = um_realm_common_skeleton_get_configured; iface->get_supported_interfaces = um_realm_common_skeleton_get_supported_interfaces; iface->get_details = um_realm_common_skeleton_get_details; iface->get_login_formats = um_realm_common_skeleton_get_login_formats; iface->get_login_policy = um_realm_common_skeleton_get_login_policy; iface->get_permitted_logins = um_realm_common_skeleton_get_permitted_logins; } /** * um_realm_common_skeleton_new: * * Creates a skeleton object for the D-Bus interface org.freedesktop.realmd.Realm. * * Returns: (transfer full) (type UmRealmCommonSkeleton): The skeleton object. */ UmRealmCommon * um_realm_common_skeleton_new (void) { return UM_REALM_COMMON (g_object_new (UM_REALM_TYPE_COMMON_SKELETON, NULL)); } /* ------------------------------------------------------------------------ * Code for interface org.freedesktop.realmd.Kerberos * ------------------------------------------------------------------------ */ /** * SECTION:UmRealmKerberos * @title: UmRealmKerberos * @short_description: Generated C code for the org.freedesktop.realmd.Kerberos D-Bus interface * * This section contains code for working with the org.freedesktop.realmd.Kerberos D-Bus interface in C. */ /* ---- Introspection data for org.freedesktop.realmd.Kerberos ---- */ static const _ExtendedGDBusPropertyInfo _um_realm_kerberos_property_info_realm_name = { { -1, (gchar *) "RealmName", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "realm-name", FALSE }; static const _ExtendedGDBusPropertyInfo _um_realm_kerberos_property_info_domain_name = { { -1, (gchar *) "DomainName", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "domain-name", FALSE }; static const _ExtendedGDBusPropertyInfo * const _um_realm_kerberos_property_info_pointers[] = { &_um_realm_kerberos_property_info_realm_name, &_um_realm_kerberos_property_info_domain_name, NULL }; static const _ExtendedGDBusInterfaceInfo _um_realm_kerberos_interface_info = { { -1, (gchar *) "org.freedesktop.realmd.Kerberos", NULL, NULL, (GDBusPropertyInfo **) &_um_realm_kerberos_property_info_pointers, NULL }, "kerberos", }; /** * um_realm_kerberos_interface_info: * * Gets a machine-readable description of the org.freedesktop.realmd.Kerberos D-Bus interface. * * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. */ GDBusInterfaceInfo * um_realm_kerberos_interface_info (void) { return (GDBusInterfaceInfo *) &_um_realm_kerberos_interface_info.parent_struct; } /** * um_realm_kerberos_override_properties: * @klass: The class structure for a #GObject-derived class. * @property_id_begin: The property id to assign to the first overridden property. * * Overrides all #GObject properties in the #UmRealmKerberos interface for a concrete class. * The properties are overridden in the order they are defined. * * Returns: The last property id. */ guint um_realm_kerberos_override_properties (GObjectClass *klass, guint property_id_begin) { g_object_class_override_property (klass, property_id_begin++, "realm-name"); g_object_class_override_property (klass, property_id_begin++, "domain-name"); return property_id_begin - 1; } /** * UmRealmKerberos: * * Abstract interface type for the D-Bus interface org.freedesktop.realmd.Kerberos. */ /** * UmRealmKerberosIface: * @parent_iface: The parent interface. * @get_domain_name: Getter for the #UmRealmKerberos:domain-name property. * @get_realm_name: Getter for the #UmRealmKerberos:realm-name property. * * Virtual table for the D-Bus interface org.freedesktop.realmd.Kerberos. */ typedef UmRealmKerberosIface UmRealmKerberosInterface; G_DEFINE_INTERFACE (UmRealmKerberos, um_realm_kerberos, G_TYPE_OBJECT); static void um_realm_kerberos_default_init (UmRealmKerberosIface *iface) { /* GObject properties for D-Bus properties: */ /** * UmRealmKerberos:realm-name: * * Represents the D-Bus property "RealmName". * * 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. */ g_object_interface_install_property (iface, g_param_spec_string ("realm-name", "RealmName", "RealmName", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * UmRealmKerberos:domain-name: * * Represents the D-Bus property "DomainName". * * 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. */ g_object_interface_install_property (iface, g_param_spec_string ("domain-name", "DomainName", "DomainName", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } /** * um_realm_kerberos_get_realm_name: (skip) * @object: A #UmRealmKerberos. * * Gets the value of the "RealmName" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * 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 um_realm_kerberos_dup_realm_name() if on another thread. * * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. */ const gchar * um_realm_kerberos_get_realm_name (UmRealmKerberos *object) { return UM_REALM_KERBEROS_GET_IFACE (object)->get_realm_name (object); } /** * um_realm_kerberos_dup_realm_name: (skip) * @object: A #UmRealmKerberos. * * Gets a copy of the "RealmName" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). */ gchar * um_realm_kerberos_dup_realm_name (UmRealmKerberos *object) { gchar *value; g_object_get (G_OBJECT (object), "realm-name", &value, NULL); return value; } /** * um_realm_kerberos_set_realm_name: (skip) * @object: A #UmRealmKerberos. * @value: The value to set. * * Sets the "RealmName" D-Bus property to @value. * * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. */ void um_realm_kerberos_set_realm_name (UmRealmKerberos *object, const gchar *value) { g_object_set (G_OBJECT (object), "realm-name", value, NULL); } /** * um_realm_kerberos_get_domain_name: (skip) * @object: A #UmRealmKerberos. * * Gets the value of the "DomainName" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * 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 um_realm_kerberos_dup_domain_name() if on another thread. * * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. */ const gchar * um_realm_kerberos_get_domain_name (UmRealmKerberos *object) { return UM_REALM_KERBEROS_GET_IFACE (object)->get_domain_name (object); } /** * um_realm_kerberos_dup_domain_name: (skip) * @object: A #UmRealmKerberos. * * Gets a copy of the "DomainName" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). */ gchar * um_realm_kerberos_dup_domain_name (UmRealmKerberos *object) { gchar *value; g_object_get (G_OBJECT (object), "domain-name", &value, NULL); return value; } /** * um_realm_kerberos_set_domain_name: (skip) * @object: A #UmRealmKerberos. * @value: The value to set. * * Sets the "DomainName" D-Bus property to @value. * * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. */ void um_realm_kerberos_set_domain_name (UmRealmKerberos *object, const gchar *value) { g_object_set (G_OBJECT (object), "domain-name", value, NULL); } /* ------------------------------------------------------------------------ */ /** * UmRealmKerberosProxy: * * The #UmRealmKerberosProxy structure contains only private data and should only be accessed using the provided API. */ /** * UmRealmKerberosProxyClass: * @parent_class: The parent class. * * Class structure for #UmRealmKerberosProxy. */ struct _UmRealmKerberosProxyPrivate { GData *qdata; }; static void um_realm_kerberos_proxy_iface_init (UmRealmKerberosIface *iface); G_DEFINE_TYPE_WITH_CODE (UmRealmKerberosProxy, um_realm_kerberos_proxy, G_TYPE_DBUS_PROXY, G_ADD_PRIVATE (UmRealmKerberosProxy) G_IMPLEMENT_INTERFACE (UM_REALM_TYPE_KERBEROS, um_realm_kerberos_proxy_iface_init)); static void um_realm_kerberos_proxy_finalize (GObject *object) { UmRealmKerberosProxy *proxy = UM_REALM_KERBEROS_PROXY (object); g_datalist_clear (&proxy->priv->qdata); G_OBJECT_CLASS (um_realm_kerberos_proxy_parent_class)->finalize (object); } static void um_realm_kerberos_proxy_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec G_GNUC_UNUSED) { const _ExtendedGDBusPropertyInfo *info; GVariant *variant; g_assert (prop_id != 0 && prop_id - 1 < 2); info = _um_realm_kerberos_property_info_pointers[prop_id - 1]; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); if (info->use_gvariant) { g_value_set_variant (value, variant); } else { if (variant != NULL) g_dbus_gvariant_to_gvalue (variant, value); } if (variant != NULL) g_variant_unref (variant); } static void um_realm_kerberos_proxy_set_property_cb (GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) { const _ExtendedGDBusPropertyInfo *info = user_data; GError *error; error = NULL; if (!g_dbus_proxy_call_finish (proxy, res, &error)) { g_warning ("Error setting property '%s' on interface org.freedesktop.realmd.Kerberos: %s (%s, %d)", info->parent_struct.name, error->message, g_quark_to_string (error->domain), error->code); g_error_free (error); } } static void um_realm_kerberos_proxy_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec G_GNUC_UNUSED) { const _ExtendedGDBusPropertyInfo *info; GVariant *variant; g_assert (prop_id != 0 && prop_id - 1 < 2); info = _um_realm_kerberos_property_info_pointers[prop_id - 1]; variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); g_dbus_proxy_call (G_DBUS_PROXY (object), "org.freedesktop.DBus.Properties.Set", g_variant_new ("(ssv)", "org.freedesktop.realmd.Kerberos", info->parent_struct.name, variant), G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) um_realm_kerberos_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); g_variant_unref (variant); } static void um_realm_kerberos_proxy_g_signal (GDBusProxy *proxy, const gchar *sender_name G_GNUC_UNUSED, const gchar *signal_name, GVariant *parameters) { _ExtendedGDBusSignalInfo *info; GVariantIter iter; GVariant *child; GValue *paramv; guint num_params; guint n; guint signal_id; info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_um_realm_kerberos_interface_info.parent_struct, signal_name); if (info == NULL) return; num_params = g_variant_n_children (parameters); paramv = g_new0 (GValue, num_params + 1); g_value_init (¶mv[0], UM_REALM_TYPE_KERBEROS); g_value_set_object (¶mv[0], proxy); g_variant_iter_init (&iter, parameters); n = 1; while ((child = g_variant_iter_next_value (&iter)) != NULL) { _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; if (arg_info->use_gvariant) { g_value_init (¶mv[n], G_TYPE_VARIANT); g_value_set_variant (¶mv[n], child); n++; } else g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); g_variant_unref (child); } signal_id = g_signal_lookup (info->signal_name, UM_REALM_TYPE_KERBEROS); g_signal_emitv (paramv, signal_id, 0, NULL); for (n = 0; n < num_params + 1; n++) g_value_unset (¶mv[n]); g_free (paramv); } static void um_realm_kerberos_proxy_g_properties_changed (GDBusProxy *_proxy, GVariant *changed_properties, const gchar *const *invalidated_properties) { UmRealmKerberosProxy *proxy = UM_REALM_KERBEROS_PROXY (_proxy); guint n; const gchar *key; GVariantIter *iter; _ExtendedGDBusPropertyInfo *info; g_variant_get (changed_properties, "a{sv}", &iter); while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) { info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_kerberos_interface_info.parent_struct, key); g_datalist_remove_data (&proxy->priv->qdata, key); if (info != NULL) g_object_notify (G_OBJECT (proxy), info->hyphen_name); } g_variant_iter_free (iter); for (n = 0; invalidated_properties[n] != NULL; n++) { info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_kerberos_interface_info.parent_struct, invalidated_properties[n]); g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); if (info != NULL) g_object_notify (G_OBJECT (proxy), info->hyphen_name); } } static const gchar * um_realm_kerberos_proxy_get_realm_name (UmRealmKerberos *object) { UmRealmKerberosProxy *proxy = UM_REALM_KERBEROS_PROXY (object); GVariant *variant; const gchar *value = NULL; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "RealmName"); if (variant != NULL) { value = g_variant_get_string (variant, NULL); g_variant_unref (variant); } return value; } static const gchar * um_realm_kerberos_proxy_get_domain_name (UmRealmKerberos *object) { UmRealmKerberosProxy *proxy = UM_REALM_KERBEROS_PROXY (object); GVariant *variant; const gchar *value = NULL; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "DomainName"); if (variant != NULL) { value = g_variant_get_string (variant, NULL); g_variant_unref (variant); } return value; } static void um_realm_kerberos_proxy_init (UmRealmKerberosProxy *proxy) { proxy->priv = um_realm_kerberos_proxy_get_instance_private (proxy); g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), um_realm_kerberos_interface_info ()); } static void um_realm_kerberos_proxy_class_init (UmRealmKerberosProxyClass *klass) { GObjectClass *gobject_class; GDBusProxyClass *proxy_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = um_realm_kerberos_proxy_finalize; gobject_class->get_property = um_realm_kerberos_proxy_get_property; gobject_class->set_property = um_realm_kerberos_proxy_set_property; proxy_class = G_DBUS_PROXY_CLASS (klass); proxy_class->g_signal = um_realm_kerberos_proxy_g_signal; proxy_class->g_properties_changed = um_realm_kerberos_proxy_g_properties_changed; um_realm_kerberos_override_properties (gobject_class, 1); } static void um_realm_kerberos_proxy_iface_init (UmRealmKerberosIface *iface) { iface->get_realm_name = um_realm_kerberos_proxy_get_realm_name; iface->get_domain_name = um_realm_kerberos_proxy_get_domain_name; } /** * um_realm_kerberos_proxy_new: * @connection: A #GDBusConnection. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied. * @user_data: User data to pass to @callback. * * Asynchronously creates a proxy for the D-Bus interface org.freedesktop.realmd.Kerberos. See g_dbus_proxy_new() for more details. * * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_kerberos_proxy_new_finish() to get the result of the operation. * * See um_realm_kerberos_proxy_new_sync() for the synchronous, blocking version of this constructor. */ void um_realm_kerberos_proxy_new ( GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_async_initable_new_async (UM_REALM_TYPE_KERBEROS_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.realmd.Kerberos", NULL); } /** * um_realm_kerberos_proxy_new_finish: * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_kerberos_proxy_new(). * @error: Return location for error or %NULL * * Finishes an operation started with um_realm_kerberos_proxy_new(). * * Returns: (transfer full) (type UmRealmKerberosProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmKerberos * um_realm_kerberos_proxy_new_finish ( GAsyncResult *res, GError **error) { GObject *ret; GObject *source_object; source_object = g_async_result_get_source_object (res); ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); g_object_unref (source_object); if (ret != NULL) return UM_REALM_KERBEROS (ret); else return NULL; } /** * um_realm_kerberos_proxy_new_sync: * @connection: A #GDBusConnection. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL * * Synchronously creates a proxy for the D-Bus interface org.freedesktop.realmd.Kerberos. See g_dbus_proxy_new_sync() for more details. * * The calling thread is blocked until a reply is received. * * See um_realm_kerberos_proxy_new() for the asynchronous version of this constructor. * * Returns: (transfer full) (type UmRealmKerberosProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmKerberos * um_realm_kerberos_proxy_new_sync ( GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error) { GInitable *ret; ret = g_initable_new (UM_REALM_TYPE_KERBEROS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.Kerberos", NULL); if (ret != NULL) return UM_REALM_KERBEROS (ret); else return NULL; } /** * um_realm_kerberos_proxy_new_for_bus: * @bus_type: A #GBusType. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: A bus name (well-known or unique). * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied. * @user_data: User data to pass to @callback. * * Like um_realm_kerberos_proxy_new() but takes a #GBusType instead of a #GDBusConnection. * * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_kerberos_proxy_new_for_bus_finish() to get the result of the operation. * * See um_realm_kerberos_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. */ void um_realm_kerberos_proxy_new_for_bus ( GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_async_initable_new_async (UM_REALM_TYPE_KERBEROS_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.realmd.Kerberos", NULL); } /** * um_realm_kerberos_proxy_new_for_bus_finish: * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_kerberos_proxy_new_for_bus(). * @error: Return location for error or %NULL * * Finishes an operation started with um_realm_kerberos_proxy_new_for_bus(). * * Returns: (transfer full) (type UmRealmKerberosProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmKerberos * um_realm_kerberos_proxy_new_for_bus_finish ( GAsyncResult *res, GError **error) { GObject *ret; GObject *source_object; source_object = g_async_result_get_source_object (res); ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); g_object_unref (source_object); if (ret != NULL) return UM_REALM_KERBEROS (ret); else return NULL; } /** * um_realm_kerberos_proxy_new_for_bus_sync: * @bus_type: A #GBusType. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: A bus name (well-known or unique). * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL * * Like um_realm_kerberos_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. * * The calling thread is blocked until a reply is received. * * See um_realm_kerberos_proxy_new_for_bus() for the asynchronous version of this constructor. * * Returns: (transfer full) (type UmRealmKerberosProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmKerberos * um_realm_kerberos_proxy_new_for_bus_sync ( GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error) { GInitable *ret; ret = g_initable_new (UM_REALM_TYPE_KERBEROS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.Kerberos", NULL); if (ret != NULL) return UM_REALM_KERBEROS (ret); else return NULL; } /* ------------------------------------------------------------------------ */ /** * UmRealmKerberosSkeleton: * * The #UmRealmKerberosSkeleton structure contains only private data and should only be accessed using the provided API. */ /** * UmRealmKerberosSkeletonClass: * @parent_class: The parent class. * * Class structure for #UmRealmKerberosSkeleton. */ struct _UmRealmKerberosSkeletonPrivate { GValue *properties; GList *changed_properties; GSource *changed_properties_idle_source; GMainContext *context; GMutex lock; }; static void _um_realm_kerberos_skeleton_handle_method_call ( GDBusConnection *connection G_GNUC_UNUSED, const gchar *sender G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, const gchar *method_name, GVariant *parameters, GDBusMethodInvocation *invocation, gpointer user_data) { UmRealmKerberosSkeleton *skeleton = UM_REALM_KERBEROS_SKELETON (user_data); _ExtendedGDBusMethodInfo *info; GVariantIter iter; GVariant *child; GValue *paramv; guint num_params; guint num_extra; guint n; guint signal_id; GValue return_value = G_VALUE_INIT; info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); g_assert (info != NULL); num_params = g_variant_n_children (parameters); num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); n = 0; g_value_init (¶mv[n], UM_REALM_TYPE_KERBEROS); g_value_set_object (¶mv[n++], skeleton); g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); g_value_set_object (¶mv[n++], invocation); if (info->pass_fdlist) { #ifdef G_OS_UNIX g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); #else g_assert_not_reached (); #endif } g_variant_iter_init (&iter, parameters); while ((child = g_variant_iter_next_value (&iter)) != NULL) { _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; if (arg_info->use_gvariant) { g_value_init (¶mv[n], G_TYPE_VARIANT); g_value_set_variant (¶mv[n], child); n++; } else g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); g_variant_unref (child); } signal_id = g_signal_lookup (info->signal_name, UM_REALM_TYPE_KERBEROS); g_value_init (&return_value, G_TYPE_BOOLEAN); g_signal_emitv (paramv, signal_id, 0, &return_value); if (!g_value_get_boolean (&return_value)) 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); g_value_unset (&return_value); for (n = 0; n < num_params + num_extra; n++) g_value_unset (¶mv[n]); g_free (paramv); } static GVariant * _um_realm_kerberos_skeleton_handle_get_property ( GDBusConnection *connection G_GNUC_UNUSED, const gchar *sender G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name G_GNUC_UNUSED, const gchar *property_name, GError **error, gpointer user_data) { UmRealmKerberosSkeleton *skeleton = UM_REALM_KERBEROS_SKELETON (user_data); GValue value = G_VALUE_INIT; GParamSpec *pspec; _ExtendedGDBusPropertyInfo *info; GVariant *ret; ret = NULL; info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_kerberos_interface_info.parent_struct, property_name); g_assert (info != NULL); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); if (pspec == NULL) { g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); } else { g_value_init (&value, pspec->value_type); g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); g_value_unset (&value); } return ret; } static gboolean _um_realm_kerberos_skeleton_handle_set_property ( GDBusConnection *connection G_GNUC_UNUSED, const gchar *sender G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name G_GNUC_UNUSED, const gchar *property_name, GVariant *variant, GError **error, gpointer user_data) { UmRealmKerberosSkeleton *skeleton = UM_REALM_KERBEROS_SKELETON (user_data); GValue value = G_VALUE_INIT; GParamSpec *pspec; _ExtendedGDBusPropertyInfo *info; gboolean ret; ret = FALSE; info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_kerberos_interface_info.parent_struct, property_name); g_assert (info != NULL); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); if (pspec == NULL) { g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); } else { if (info->use_gvariant) g_value_set_variant (&value, variant); else g_dbus_gvariant_to_gvalue (variant, &value); g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); g_value_unset (&value); ret = TRUE; } return ret; } static const GDBusInterfaceVTable _um_realm_kerberos_skeleton_vtable = { _um_realm_kerberos_skeleton_handle_method_call, _um_realm_kerberos_skeleton_handle_get_property, _um_realm_kerberos_skeleton_handle_set_property, {NULL} }; static GDBusInterfaceInfo * um_realm_kerberos_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) { return um_realm_kerberos_interface_info (); } static GDBusInterfaceVTable * um_realm_kerberos_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) { return (GDBusInterfaceVTable *) &_um_realm_kerberos_skeleton_vtable; } static GVariant * um_realm_kerberos_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) { UmRealmKerberosSkeleton *skeleton = UM_REALM_KERBEROS_SKELETON (_skeleton); GVariantBuilder builder; guint n; g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); if (_um_realm_kerberos_interface_info.parent_struct.properties == NULL) goto out; for (n = 0; _um_realm_kerberos_interface_info.parent_struct.properties[n] != NULL; n++) { GDBusPropertyInfo *info = _um_realm_kerberos_interface_info.parent_struct.properties[n]; if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) { GVariant *value; value = _um_realm_kerberos_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.realmd.Kerberos", info->name, NULL, skeleton); if (value != NULL) { g_variant_take_ref (value); g_variant_builder_add (&builder, "{sv}", info->name, value); g_variant_unref (value); } } } out: return g_variant_builder_end (&builder); } static gboolean _um_realm_kerberos_emit_changed (gpointer user_data); static void um_realm_kerberos_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) { UmRealmKerberosSkeleton *skeleton = UM_REALM_KERBEROS_SKELETON (_skeleton); gboolean emit_changed = FALSE; g_mutex_lock (&skeleton->priv->lock); if (skeleton->priv->changed_properties_idle_source != NULL) { g_source_destroy (skeleton->priv->changed_properties_idle_source); skeleton->priv->changed_properties_idle_source = NULL; emit_changed = TRUE; } g_mutex_unlock (&skeleton->priv->lock); if (emit_changed) _um_realm_kerberos_emit_changed (skeleton); } static void um_realm_kerberos_skeleton_iface_init (UmRealmKerberosIface *iface); G_DEFINE_TYPE_WITH_CODE (UmRealmKerberosSkeleton, um_realm_kerberos_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, G_ADD_PRIVATE (UmRealmKerberosSkeleton) G_IMPLEMENT_INTERFACE (UM_REALM_TYPE_KERBEROS, um_realm_kerberos_skeleton_iface_init)); static void um_realm_kerberos_skeleton_finalize (GObject *object) { UmRealmKerberosSkeleton *skeleton = UM_REALM_KERBEROS_SKELETON (object); guint n; for (n = 0; n < 2; n++) g_value_unset (&skeleton->priv->properties[n]); g_free (skeleton->priv->properties); g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); if (skeleton->priv->changed_properties_idle_source != NULL) g_source_destroy (skeleton->priv->changed_properties_idle_source); g_main_context_unref (skeleton->priv->context); g_mutex_clear (&skeleton->priv->lock); G_OBJECT_CLASS (um_realm_kerberos_skeleton_parent_class)->finalize (object); } static void um_realm_kerberos_skeleton_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec G_GNUC_UNUSED) { UmRealmKerberosSkeleton *skeleton = UM_REALM_KERBEROS_SKELETON (object); g_assert (prop_id != 0 && prop_id - 1 < 2); g_mutex_lock (&skeleton->priv->lock); g_value_copy (&skeleton->priv->properties[prop_id - 1], value); g_mutex_unlock (&skeleton->priv->lock); } static gboolean _um_realm_kerberos_emit_changed (gpointer user_data) { UmRealmKerberosSkeleton *skeleton = UM_REALM_KERBEROS_SKELETON (user_data); GList *l; GVariantBuilder builder; GVariantBuilder invalidated_builder; guint num_changes; g_mutex_lock (&skeleton->priv->lock); g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) { ChangedProperty *cp = l->data; GVariant *variant; const GValue *cur_value; cur_value = &skeleton->priv->properties[cp->prop_id - 1]; if (!_g_value_equal (cur_value, &cp->orig_value)) { variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); g_variant_unref (variant); num_changes++; } } if (num_changes > 0) { GList *connections, *ll; GVariant *signal_variant; signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.realmd.Kerberos", &builder, &invalidated_builder)); connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); for (ll = connections; ll != NULL; ll = ll->next) { GDBusConnection *connection = ll->data; g_dbus_connection_emit_signal (connection, NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.DBus.Properties", "PropertiesChanged", signal_variant, NULL); } g_variant_unref (signal_variant); g_list_free_full (connections, g_object_unref); } else { g_variant_builder_clear (&builder); g_variant_builder_clear (&invalidated_builder); } g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); skeleton->priv->changed_properties = NULL; skeleton->priv->changed_properties_idle_source = NULL; g_mutex_unlock (&skeleton->priv->lock); return FALSE; } static void _um_realm_kerberos_schedule_emit_changed (UmRealmKerberosSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) { ChangedProperty *cp; GList *l; cp = NULL; for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) { ChangedProperty *i_cp = l->data; if (i_cp->info == info) { cp = i_cp; break; } } if (cp == NULL) { cp = g_new0 (ChangedProperty, 1); cp->prop_id = prop_id; cp->info = info; skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); g_value_copy (orig_value, &cp->orig_value); } } static void um_realm_kerberos_skeleton_notify (GObject *object, GParamSpec *pspec G_GNUC_UNUSED) { UmRealmKerberosSkeleton *skeleton = UM_REALM_KERBEROS_SKELETON (object); g_mutex_lock (&skeleton->priv->lock); if (skeleton->priv->changed_properties != NULL && skeleton->priv->changed_properties_idle_source == NULL) { skeleton->priv->changed_properties_idle_source = g_idle_source_new (); g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); g_source_set_callback (skeleton->priv->changed_properties_idle_source, _um_realm_kerberos_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); g_source_unref (skeleton->priv->changed_properties_idle_source); } g_mutex_unlock (&skeleton->priv->lock); } static void um_realm_kerberos_skeleton_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { UmRealmKerberosSkeleton *skeleton = UM_REALM_KERBEROS_SKELETON (object); g_assert (prop_id != 0 && prop_id - 1 < 2); g_mutex_lock (&skeleton->priv->lock); g_object_freeze_notify (object); if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) { if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) _um_realm_kerberos_schedule_emit_changed (skeleton, _um_realm_kerberos_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); g_object_notify_by_pspec (object, pspec); } g_mutex_unlock (&skeleton->priv->lock); g_object_thaw_notify (object); } static void um_realm_kerberos_skeleton_init (UmRealmKerberosSkeleton *skeleton) { skeleton->priv = um_realm_kerberos_skeleton_get_instance_private (skeleton); g_mutex_init (&skeleton->priv->lock); skeleton->priv->context = g_main_context_ref_thread_default (); skeleton->priv->properties = g_new0 (GValue, 2); g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); } static const gchar * um_realm_kerberos_skeleton_get_realm_name (UmRealmKerberos *object) { UmRealmKerberosSkeleton *skeleton = UM_REALM_KERBEROS_SKELETON (object); const gchar *value; g_mutex_lock (&skeleton->priv->lock); value = g_value_get_string (&(skeleton->priv->properties[0])); g_mutex_unlock (&skeleton->priv->lock); return value; } static const gchar * um_realm_kerberos_skeleton_get_domain_name (UmRealmKerberos *object) { UmRealmKerberosSkeleton *skeleton = UM_REALM_KERBEROS_SKELETON (object); const gchar *value; g_mutex_lock (&skeleton->priv->lock); value = g_value_get_string (&(skeleton->priv->properties[1])); g_mutex_unlock (&skeleton->priv->lock); return value; } static void um_realm_kerberos_skeleton_class_init (UmRealmKerberosSkeletonClass *klass) { GObjectClass *gobject_class; GDBusInterfaceSkeletonClass *skeleton_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = um_realm_kerberos_skeleton_finalize; gobject_class->get_property = um_realm_kerberos_skeleton_get_property; gobject_class->set_property = um_realm_kerberos_skeleton_set_property; gobject_class->notify = um_realm_kerberos_skeleton_notify; um_realm_kerberos_override_properties (gobject_class, 1); skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); skeleton_class->get_info = um_realm_kerberos_skeleton_dbus_interface_get_info; skeleton_class->get_properties = um_realm_kerberos_skeleton_dbus_interface_get_properties; skeleton_class->flush = um_realm_kerberos_skeleton_dbus_interface_flush; skeleton_class->get_vtable = um_realm_kerberos_skeleton_dbus_interface_get_vtable; } static void um_realm_kerberos_skeleton_iface_init (UmRealmKerberosIface *iface) { iface->get_realm_name = um_realm_kerberos_skeleton_get_realm_name; iface->get_domain_name = um_realm_kerberos_skeleton_get_domain_name; } /** * um_realm_kerberos_skeleton_new: * * Creates a skeleton object for the D-Bus interface org.freedesktop.realmd.Kerberos. * * Returns: (transfer full) (type UmRealmKerberosSkeleton): The skeleton object. */ UmRealmKerberos * um_realm_kerberos_skeleton_new (void) { return UM_REALM_KERBEROS (g_object_new (UM_REALM_TYPE_KERBEROS_SKELETON, NULL)); } /* ------------------------------------------------------------------------ * Code for interface org.freedesktop.realmd.KerberosMembership * ------------------------------------------------------------------------ */ /** * SECTION:UmRealmKerberosMembership * @title: UmRealmKerberosMembership * @short_description: Generated C code for the org.freedesktop.realmd.KerberosMembership D-Bus interface * * This section contains code for working with the org.freedesktop.realmd.KerberosMembership D-Bus interface in C. */ /* ---- Introspection data for org.freedesktop.realmd.KerberosMembership ---- */ static const _ExtendedGDBusArgInfo _um_realm_kerberos_membership_method_info_join_IN_ARG_credentials = { { -1, (gchar *) "credentials", (gchar *) "(ssv)", NULL }, FALSE }; static const _ExtendedGDBusArgInfo _um_realm_kerberos_membership_method_info_join_IN_ARG_options = { { -1, (gchar *) "options", (gchar *) "a{sv}", NULL }, FALSE }; static const _ExtendedGDBusArgInfo * const _um_realm_kerberos_membership_method_info_join_IN_ARG_pointers[] = { &_um_realm_kerberos_membership_method_info_join_IN_ARG_credentials, &_um_realm_kerberos_membership_method_info_join_IN_ARG_options, NULL }; static const _ExtendedGDBusMethodInfo _um_realm_kerberos_membership_method_info_join = { { -1, (gchar *) "Join", (GDBusArgInfo **) &_um_realm_kerberos_membership_method_info_join_IN_ARG_pointers, NULL, NULL }, "handle-join", FALSE }; static const _ExtendedGDBusArgInfo _um_realm_kerberos_membership_method_info_leave_IN_ARG_credentials = { { -1, (gchar *) "credentials", (gchar *) "(ssv)", NULL }, FALSE }; static const _ExtendedGDBusArgInfo _um_realm_kerberos_membership_method_info_leave_IN_ARG_options = { { -1, (gchar *) "options", (gchar *) "a{sv}", NULL }, FALSE }; static const _ExtendedGDBusArgInfo * const _um_realm_kerberos_membership_method_info_leave_IN_ARG_pointers[] = { &_um_realm_kerberos_membership_method_info_leave_IN_ARG_credentials, &_um_realm_kerberos_membership_method_info_leave_IN_ARG_options, NULL }; static const _ExtendedGDBusMethodInfo _um_realm_kerberos_membership_method_info_leave = { { -1, (gchar *) "Leave", (GDBusArgInfo **) &_um_realm_kerberos_membership_method_info_leave_IN_ARG_pointers, NULL, NULL }, "handle-leave", FALSE }; static const _ExtendedGDBusMethodInfo * const _um_realm_kerberos_membership_method_info_pointers[] = { &_um_realm_kerberos_membership_method_info_join, &_um_realm_kerberos_membership_method_info_leave, NULL }; static const _ExtendedGDBusPropertyInfo _um_realm_kerberos_membership_property_info_suggested_administrator = { { -1, (gchar *) "SuggestedAdministrator", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "suggested-administrator", FALSE }; static const _ExtendedGDBusPropertyInfo _um_realm_kerberos_membership_property_info_supported_join_credentials = { { -1, (gchar *) "SupportedJoinCredentials", (gchar *) "a(ss)", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "supported-join-credentials", FALSE }; static const _ExtendedGDBusPropertyInfo _um_realm_kerberos_membership_property_info_supported_leave_credentials = { { -1, (gchar *) "SupportedLeaveCredentials", (gchar *) "a(ss)", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "supported-leave-credentials", FALSE }; static const _ExtendedGDBusPropertyInfo * const _um_realm_kerberos_membership_property_info_pointers[] = { &_um_realm_kerberos_membership_property_info_suggested_administrator, &_um_realm_kerberos_membership_property_info_supported_join_credentials, &_um_realm_kerberos_membership_property_info_supported_leave_credentials, NULL }; static const _ExtendedGDBusInterfaceInfo _um_realm_kerberos_membership_interface_info = { { -1, (gchar *) "org.freedesktop.realmd.KerberosMembership", (GDBusMethodInfo **) &_um_realm_kerberos_membership_method_info_pointers, NULL, (GDBusPropertyInfo **) &_um_realm_kerberos_membership_property_info_pointers, NULL }, "kerberos-membership", }; /** * um_realm_kerberos_membership_interface_info: * * Gets a machine-readable description of the org.freedesktop.realmd.KerberosMembership D-Bus interface. * * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. */ GDBusInterfaceInfo * um_realm_kerberos_membership_interface_info (void) { return (GDBusInterfaceInfo *) &_um_realm_kerberos_membership_interface_info.parent_struct; } /** * um_realm_kerberos_membership_override_properties: * @klass: The class structure for a #GObject-derived class. * @property_id_begin: The property id to assign to the first overridden property. * * Overrides all #GObject properties in the #UmRealmKerberosMembership interface for a concrete class. * The properties are overridden in the order they are defined. * * Returns: The last property id. */ guint um_realm_kerberos_membership_override_properties (GObjectClass *klass, guint property_id_begin) { g_object_class_override_property (klass, property_id_begin++, "suggested-administrator"); g_object_class_override_property (klass, property_id_begin++, "supported-join-credentials"); g_object_class_override_property (klass, property_id_begin++, "supported-leave-credentials"); return property_id_begin - 1; } /** * UmRealmKerberosMembership: * * Abstract interface type for the D-Bus interface org.freedesktop.realmd.KerberosMembership. */ /** * UmRealmKerberosMembershipIface: * @parent_iface: The parent interface. * @handle_join: Handler for the #UmRealmKerberosMembership::handle-join signal. * @handle_leave: Handler for the #UmRealmKerberosMembership::handle-leave signal. * @get_suggested_administrator: Getter for the #UmRealmKerberosMembership:suggested-administrator property. * @get_supported_join_credentials: Getter for the #UmRealmKerberosMembership:supported-join-credentials property. * @get_supported_leave_credentials: Getter for the #UmRealmKerberosMembership:supported-leave-credentials property. * * Virtual table for the D-Bus interface org.freedesktop.realmd.KerberosMembership. */ typedef UmRealmKerberosMembershipIface UmRealmKerberosMembershipInterface; G_DEFINE_INTERFACE (UmRealmKerberosMembership, um_realm_kerberos_membership, G_TYPE_OBJECT); static void um_realm_kerberos_membership_default_init (UmRealmKerberosMembershipIface *iface) { /* GObject signals for incoming D-Bus method calls: */ /** * UmRealmKerberosMembership::handle-join: * @object: A #UmRealmKerberosMembership. * @invocation: A #GDBusMethodInvocation. * @arg_credentials: Argument passed by remote caller. * @arg_options: Argument passed by remote caller. * * Signal emitted when a remote caller is invoking the Join() D-Bus method. * * 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 um_realm_kerberos_membership_complete_join() 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. * * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. */ g_signal_new ("handle-join", G_TYPE_FROM_INTERFACE (iface), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (UmRealmKerberosMembershipIface, handle_join), g_signal_accumulator_true_handled, NULL, g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 3, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT, G_TYPE_VARIANT); /** * UmRealmKerberosMembership::handle-leave: * @object: A #UmRealmKerberosMembership. * @invocation: A #GDBusMethodInvocation. * @arg_credentials: Argument passed by remote caller. * @arg_options: Argument passed by remote caller. * * Signal emitted when a remote caller is invoking the Leave() D-Bus method. * * 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 um_realm_kerberos_membership_complete_leave() 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. * * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. */ g_signal_new ("handle-leave", G_TYPE_FROM_INTERFACE (iface), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (UmRealmKerberosMembershipIface, handle_leave), g_signal_accumulator_true_handled, NULL, g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 3, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT, G_TYPE_VARIANT); /* GObject properties for D-Bus properties: */ /** * UmRealmKerberosMembership:suggested-administrator: * * Represents the D-Bus property "SuggestedAdministrator". * * 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. */ g_object_interface_install_property (iface, g_param_spec_string ("suggested-administrator", "SuggestedAdministrator", "SuggestedAdministrator", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * UmRealmKerberosMembership:supported-join-credentials: * * Represents the D-Bus property "SupportedJoinCredentials". * * 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. */ g_object_interface_install_property (iface, g_param_spec_variant ("supported-join-credentials", "SupportedJoinCredentials", "SupportedJoinCredentials", G_VARIANT_TYPE ("a(ss)"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * UmRealmKerberosMembership:supported-leave-credentials: * * Represents the D-Bus property "SupportedLeaveCredentials". * * 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. */ g_object_interface_install_property (iface, g_param_spec_variant ("supported-leave-credentials", "SupportedLeaveCredentials", "SupportedLeaveCredentials", G_VARIANT_TYPE ("a(ss)"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } /** * um_realm_kerberos_membership_get_suggested_administrator: (skip) * @object: A #UmRealmKerberosMembership. * * Gets the value of the "SuggestedAdministrator" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * 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 um_realm_kerberos_membership_dup_suggested_administrator() if on another thread. * * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. */ const gchar * um_realm_kerberos_membership_get_suggested_administrator (UmRealmKerberosMembership *object) { return UM_REALM_KERBEROS_MEMBERSHIP_GET_IFACE (object)->get_suggested_administrator (object); } /** * um_realm_kerberos_membership_dup_suggested_administrator: (skip) * @object: A #UmRealmKerberosMembership. * * Gets a copy of the "SuggestedAdministrator" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). */ gchar * um_realm_kerberos_membership_dup_suggested_administrator (UmRealmKerberosMembership *object) { gchar *value; g_object_get (G_OBJECT (object), "suggested-administrator", &value, NULL); return value; } /** * um_realm_kerberos_membership_set_suggested_administrator: (skip) * @object: A #UmRealmKerberosMembership. * @value: The value to set. * * Sets the "SuggestedAdministrator" D-Bus property to @value. * * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. */ void um_realm_kerberos_membership_set_suggested_administrator (UmRealmKerberosMembership *object, const gchar *value) { g_object_set (G_OBJECT (object), "suggested-administrator", value, NULL); } /** * um_realm_kerberos_membership_get_supported_join_credentials: (skip) * @object: A #UmRealmKerberosMembership. * * Gets the value of the "SupportedJoinCredentials" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * 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 um_realm_kerberos_membership_dup_supported_join_credentials() if on another thread. * * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. */ GVariant * um_realm_kerberos_membership_get_supported_join_credentials (UmRealmKerberosMembership *object) { return UM_REALM_KERBEROS_MEMBERSHIP_GET_IFACE (object)->get_supported_join_credentials (object); } /** * um_realm_kerberos_membership_dup_supported_join_credentials: (skip) * @object: A #UmRealmKerberosMembership. * * Gets a copy of the "SupportedJoinCredentials" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). */ GVariant * um_realm_kerberos_membership_dup_supported_join_credentials (UmRealmKerberosMembership *object) { GVariant *value; g_object_get (G_OBJECT (object), "supported-join-credentials", &value, NULL); return value; } /** * um_realm_kerberos_membership_set_supported_join_credentials: (skip) * @object: A #UmRealmKerberosMembership. * @value: The value to set. * * Sets the "SupportedJoinCredentials" D-Bus property to @value. * * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. */ void um_realm_kerberos_membership_set_supported_join_credentials (UmRealmKerberosMembership *object, GVariant *value) { g_object_set (G_OBJECT (object), "supported-join-credentials", value, NULL); } /** * um_realm_kerberos_membership_get_supported_leave_credentials: (skip) * @object: A #UmRealmKerberosMembership. * * Gets the value of the "SupportedLeaveCredentials" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * 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 um_realm_kerberos_membership_dup_supported_leave_credentials() if on another thread. * * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. */ GVariant * um_realm_kerberos_membership_get_supported_leave_credentials (UmRealmKerberosMembership *object) { return UM_REALM_KERBEROS_MEMBERSHIP_GET_IFACE (object)->get_supported_leave_credentials (object); } /** * um_realm_kerberos_membership_dup_supported_leave_credentials: (skip) * @object: A #UmRealmKerberosMembership. * * Gets a copy of the "SupportedLeaveCredentials" D-Bus property. * * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). */ GVariant * um_realm_kerberos_membership_dup_supported_leave_credentials (UmRealmKerberosMembership *object) { GVariant *value; g_object_get (G_OBJECT (object), "supported-leave-credentials", &value, NULL); return value; } /** * um_realm_kerberos_membership_set_supported_leave_credentials: (skip) * @object: A #UmRealmKerberosMembership. * @value: The value to set. * * Sets the "SupportedLeaveCredentials" D-Bus property to @value. * * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. */ void um_realm_kerberos_membership_set_supported_leave_credentials (UmRealmKerberosMembership *object, GVariant *value) { g_object_set (G_OBJECT (object), "supported-leave-credentials", value, NULL); } /** * um_realm_kerberos_membership_call_join: * @proxy: A #UmRealmKerberosMembershipProxy. * @arg_credentials: Argument to pass with the method invocation. * @arg_options: Argument to pass with the method invocation. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. * @user_data: User data to pass to @callback. * * Asynchronously invokes the Join() D-Bus method on @proxy. * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_kerberos_membership_call_join_finish() to get the result of the operation. * * See um_realm_kerberos_membership_call_join_sync() for the synchronous, blocking version of this method. */ void um_realm_kerberos_membership_call_join ( UmRealmKerberosMembership *proxy, GVariant *arg_credentials, GVariant *arg_options, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_dbus_proxy_call (G_DBUS_PROXY (proxy), "Join", g_variant_new ("(@(ssv)@a{sv})", arg_credentials, arg_options), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); } /** * um_realm_kerberos_membership_call_join_finish: * @proxy: A #UmRealmKerberosMembershipProxy. * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_kerberos_membership_call_join(). * @error: Return location for error or %NULL. * * Finishes an operation started with um_realm_kerberos_membership_call_join(). * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean um_realm_kerberos_membership_call_join_finish ( UmRealmKerberosMembership *proxy, GAsyncResult *res, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "()"); g_variant_unref (_ret); _out: return _ret != NULL; } /** * um_realm_kerberos_membership_call_join_sync: * @proxy: A #UmRealmKerberosMembershipProxy. * @arg_credentials: Argument to pass with the method invocation. * @arg_options: Argument to pass with the method invocation. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL. * * Synchronously invokes the Join() D-Bus method on @proxy. The calling thread is blocked until a reply is received. * * See um_realm_kerberos_membership_call_join() for the asynchronous version of this method. * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean um_realm_kerberos_membership_call_join_sync ( UmRealmKerberosMembership *proxy, GVariant *arg_credentials, GVariant *arg_options, GCancellable *cancellable, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), "Join", g_variant_new ("(@(ssv)@a{sv})", arg_credentials, arg_options), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "()"); g_variant_unref (_ret); _out: return _ret != NULL; } /** * um_realm_kerberos_membership_call_leave: * @proxy: A #UmRealmKerberosMembershipProxy. * @arg_credentials: Argument to pass with the method invocation. * @arg_options: Argument to pass with the method invocation. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. * @user_data: User data to pass to @callback. * * Asynchronously invokes the Leave() D-Bus method on @proxy. * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_kerberos_membership_call_leave_finish() to get the result of the operation. * * See um_realm_kerberos_membership_call_leave_sync() for the synchronous, blocking version of this method. */ void um_realm_kerberos_membership_call_leave ( UmRealmKerberosMembership *proxy, GVariant *arg_credentials, GVariant *arg_options, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_dbus_proxy_call (G_DBUS_PROXY (proxy), "Leave", g_variant_new ("(@(ssv)@a{sv})", arg_credentials, arg_options), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); } /** * um_realm_kerberos_membership_call_leave_finish: * @proxy: A #UmRealmKerberosMembershipProxy. * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_kerberos_membership_call_leave(). * @error: Return location for error or %NULL. * * Finishes an operation started with um_realm_kerberos_membership_call_leave(). * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean um_realm_kerberos_membership_call_leave_finish ( UmRealmKerberosMembership *proxy, GAsyncResult *res, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "()"); g_variant_unref (_ret); _out: return _ret != NULL; } /** * um_realm_kerberos_membership_call_leave_sync: * @proxy: A #UmRealmKerberosMembershipProxy. * @arg_credentials: Argument to pass with the method invocation. * @arg_options: Argument to pass with the method invocation. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL. * * Synchronously invokes the Leave() D-Bus method on @proxy. The calling thread is blocked until a reply is received. * * See um_realm_kerberos_membership_call_leave() for the asynchronous version of this method. * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean um_realm_kerberos_membership_call_leave_sync ( UmRealmKerberosMembership *proxy, GVariant *arg_credentials, GVariant *arg_options, GCancellable *cancellable, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), "Leave", g_variant_new ("(@(ssv)@a{sv})", arg_credentials, arg_options), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "()"); g_variant_unref (_ret); _out: return _ret != NULL; } /** * um_realm_kerberos_membership_complete_join: * @object: A #UmRealmKerberosMembership. * @invocation: (transfer full): A #GDBusMethodInvocation. * * Helper function used in service implementations to finish handling invocations of the Join() 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. * * This method will free @invocation, you cannot use it afterwards. */ void um_realm_kerberos_membership_complete_join ( UmRealmKerberosMembership *object, GDBusMethodInvocation *invocation) { g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); } /** * um_realm_kerberos_membership_complete_leave: * @object: A #UmRealmKerberosMembership. * @invocation: (transfer full): A #GDBusMethodInvocation. * * Helper function used in service implementations to finish handling invocations of the Leave() 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. * * This method will free @invocation, you cannot use it afterwards. */ void um_realm_kerberos_membership_complete_leave ( UmRealmKerberosMembership *object, GDBusMethodInvocation *invocation) { g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); } /* ------------------------------------------------------------------------ */ /** * UmRealmKerberosMembershipProxy: * * The #UmRealmKerberosMembershipProxy structure contains only private data and should only be accessed using the provided API. */ /** * UmRealmKerberosMembershipProxyClass: * @parent_class: The parent class. * * Class structure for #UmRealmKerberosMembershipProxy. */ struct _UmRealmKerberosMembershipProxyPrivate { GData *qdata; }; static void um_realm_kerberos_membership_proxy_iface_init (UmRealmKerberosMembershipIface *iface); G_DEFINE_TYPE_WITH_CODE (UmRealmKerberosMembershipProxy, um_realm_kerberos_membership_proxy, G_TYPE_DBUS_PROXY, G_ADD_PRIVATE (UmRealmKerberosMembershipProxy) G_IMPLEMENT_INTERFACE (UM_REALM_TYPE_KERBEROS_MEMBERSHIP, um_realm_kerberos_membership_proxy_iface_init)); static void um_realm_kerberos_membership_proxy_finalize (GObject *object) { UmRealmKerberosMembershipProxy *proxy = UM_REALM_KERBEROS_MEMBERSHIP_PROXY (object); g_datalist_clear (&proxy->priv->qdata); G_OBJECT_CLASS (um_realm_kerberos_membership_proxy_parent_class)->finalize (object); } static void um_realm_kerberos_membership_proxy_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec G_GNUC_UNUSED) { const _ExtendedGDBusPropertyInfo *info; GVariant *variant; g_assert (prop_id != 0 && prop_id - 1 < 3); info = _um_realm_kerberos_membership_property_info_pointers[prop_id - 1]; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); if (info->use_gvariant) { g_value_set_variant (value, variant); } else { if (variant != NULL) g_dbus_gvariant_to_gvalue (variant, value); } if (variant != NULL) g_variant_unref (variant); } static void um_realm_kerberos_membership_proxy_set_property_cb (GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) { const _ExtendedGDBusPropertyInfo *info = user_data; GError *error; error = NULL; if (!g_dbus_proxy_call_finish (proxy, res, &error)) { g_warning ("Error setting property '%s' on interface org.freedesktop.realmd.KerberosMembership: %s (%s, %d)", info->parent_struct.name, error->message, g_quark_to_string (error->domain), error->code); g_error_free (error); } } static void um_realm_kerberos_membership_proxy_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec G_GNUC_UNUSED) { const _ExtendedGDBusPropertyInfo *info; GVariant *variant; g_assert (prop_id != 0 && prop_id - 1 < 3); info = _um_realm_kerberos_membership_property_info_pointers[prop_id - 1]; variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); g_dbus_proxy_call (G_DBUS_PROXY (object), "org.freedesktop.DBus.Properties.Set", g_variant_new ("(ssv)", "org.freedesktop.realmd.KerberosMembership", info->parent_struct.name, variant), G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) um_realm_kerberos_membership_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); g_variant_unref (variant); } static void um_realm_kerberos_membership_proxy_g_signal (GDBusProxy *proxy, const gchar *sender_name G_GNUC_UNUSED, const gchar *signal_name, GVariant *parameters) { _ExtendedGDBusSignalInfo *info; GVariantIter iter; GVariant *child; GValue *paramv; guint num_params; guint n; guint signal_id; info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_um_realm_kerberos_membership_interface_info.parent_struct, signal_name); if (info == NULL) return; num_params = g_variant_n_children (parameters); paramv = g_new0 (GValue, num_params + 1); g_value_init (¶mv[0], UM_REALM_TYPE_KERBEROS_MEMBERSHIP); g_value_set_object (¶mv[0], proxy); g_variant_iter_init (&iter, parameters); n = 1; while ((child = g_variant_iter_next_value (&iter)) != NULL) { _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; if (arg_info->use_gvariant) { g_value_init (¶mv[n], G_TYPE_VARIANT); g_value_set_variant (¶mv[n], child); n++; } else g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); g_variant_unref (child); } signal_id = g_signal_lookup (info->signal_name, UM_REALM_TYPE_KERBEROS_MEMBERSHIP); g_signal_emitv (paramv, signal_id, 0, NULL); for (n = 0; n < num_params + 1; n++) g_value_unset (¶mv[n]); g_free (paramv); } static void um_realm_kerberos_membership_proxy_g_properties_changed (GDBusProxy *_proxy, GVariant *changed_properties, const gchar *const *invalidated_properties) { UmRealmKerberosMembershipProxy *proxy = UM_REALM_KERBEROS_MEMBERSHIP_PROXY (_proxy); guint n; const gchar *key; GVariantIter *iter; _ExtendedGDBusPropertyInfo *info; g_variant_get (changed_properties, "a{sv}", &iter); while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) { info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_kerberos_membership_interface_info.parent_struct, key); g_datalist_remove_data (&proxy->priv->qdata, key); if (info != NULL) g_object_notify (G_OBJECT (proxy), info->hyphen_name); } g_variant_iter_free (iter); for (n = 0; invalidated_properties[n] != NULL; n++) { info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_kerberos_membership_interface_info.parent_struct, invalidated_properties[n]); g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); if (info != NULL) g_object_notify (G_OBJECT (proxy), info->hyphen_name); } } static const gchar * um_realm_kerberos_membership_proxy_get_suggested_administrator (UmRealmKerberosMembership *object) { UmRealmKerberosMembershipProxy *proxy = UM_REALM_KERBEROS_MEMBERSHIP_PROXY (object); GVariant *variant; const gchar *value = NULL; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "SuggestedAdministrator"); if (variant != NULL) { value = g_variant_get_string (variant, NULL); g_variant_unref (variant); } return value; } static GVariant * um_realm_kerberos_membership_proxy_get_supported_join_credentials (UmRealmKerberosMembership *object) { UmRealmKerberosMembershipProxy *proxy = UM_REALM_KERBEROS_MEMBERSHIP_PROXY (object); GVariant *variant; GVariant *value = NULL; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "SupportedJoinCredentials"); value = variant; if (variant != NULL) g_variant_unref (variant); return value; } static GVariant * um_realm_kerberos_membership_proxy_get_supported_leave_credentials (UmRealmKerberosMembership *object) { UmRealmKerberosMembershipProxy *proxy = UM_REALM_KERBEROS_MEMBERSHIP_PROXY (object); GVariant *variant; GVariant *value = NULL; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "SupportedLeaveCredentials"); value = variant; if (variant != NULL) g_variant_unref (variant); return value; } static void um_realm_kerberos_membership_proxy_init (UmRealmKerberosMembershipProxy *proxy) { proxy->priv = um_realm_kerberos_membership_proxy_get_instance_private (proxy); g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), um_realm_kerberos_membership_interface_info ()); } static void um_realm_kerberos_membership_proxy_class_init (UmRealmKerberosMembershipProxyClass *klass) { GObjectClass *gobject_class; GDBusProxyClass *proxy_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = um_realm_kerberos_membership_proxy_finalize; gobject_class->get_property = um_realm_kerberos_membership_proxy_get_property; gobject_class->set_property = um_realm_kerberos_membership_proxy_set_property; proxy_class = G_DBUS_PROXY_CLASS (klass); proxy_class->g_signal = um_realm_kerberos_membership_proxy_g_signal; proxy_class->g_properties_changed = um_realm_kerberos_membership_proxy_g_properties_changed; um_realm_kerberos_membership_override_properties (gobject_class, 1); } static void um_realm_kerberos_membership_proxy_iface_init (UmRealmKerberosMembershipIface *iface) { iface->get_suggested_administrator = um_realm_kerberos_membership_proxy_get_suggested_administrator; iface->get_supported_join_credentials = um_realm_kerberos_membership_proxy_get_supported_join_credentials; iface->get_supported_leave_credentials = um_realm_kerberos_membership_proxy_get_supported_leave_credentials; } /** * um_realm_kerberos_membership_proxy_new: * @connection: A #GDBusConnection. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied. * @user_data: User data to pass to @callback. * * Asynchronously creates a proxy for the D-Bus interface org.freedesktop.realmd.KerberosMembership. See g_dbus_proxy_new() for more details. * * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_kerberos_membership_proxy_new_finish() to get the result of the operation. * * See um_realm_kerberos_membership_proxy_new_sync() for the synchronous, blocking version of this constructor. */ void um_realm_kerberos_membership_proxy_new ( GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_async_initable_new_async (UM_REALM_TYPE_KERBEROS_MEMBERSHIP_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.realmd.KerberosMembership", NULL); } /** * um_realm_kerberos_membership_proxy_new_finish: * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_kerberos_membership_proxy_new(). * @error: Return location for error or %NULL * * Finishes an operation started with um_realm_kerberos_membership_proxy_new(). * * Returns: (transfer full) (type UmRealmKerberosMembershipProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmKerberosMembership * um_realm_kerberos_membership_proxy_new_finish ( GAsyncResult *res, GError **error) { GObject *ret; GObject *source_object; source_object = g_async_result_get_source_object (res); ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); g_object_unref (source_object); if (ret != NULL) return UM_REALM_KERBEROS_MEMBERSHIP (ret); else return NULL; } /** * um_realm_kerberos_membership_proxy_new_sync: * @connection: A #GDBusConnection. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL * * Synchronously creates a proxy for the D-Bus interface org.freedesktop.realmd.KerberosMembership. See g_dbus_proxy_new_sync() for more details. * * The calling thread is blocked until a reply is received. * * See um_realm_kerberos_membership_proxy_new() for the asynchronous version of this constructor. * * Returns: (transfer full) (type UmRealmKerberosMembershipProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmKerberosMembership * um_realm_kerberos_membership_proxy_new_sync ( GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error) { GInitable *ret; ret = g_initable_new (UM_REALM_TYPE_KERBEROS_MEMBERSHIP_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.KerberosMembership", NULL); if (ret != NULL) return UM_REALM_KERBEROS_MEMBERSHIP (ret); else return NULL; } /** * um_realm_kerberos_membership_proxy_new_for_bus: * @bus_type: A #GBusType. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: A bus name (well-known or unique). * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied. * @user_data: User data to pass to @callback. * * Like um_realm_kerberos_membership_proxy_new() but takes a #GBusType instead of a #GDBusConnection. * * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_kerberos_membership_proxy_new_for_bus_finish() to get the result of the operation. * * See um_realm_kerberos_membership_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. */ void um_realm_kerberos_membership_proxy_new_for_bus ( GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_async_initable_new_async (UM_REALM_TYPE_KERBEROS_MEMBERSHIP_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.realmd.KerberosMembership", NULL); } /** * um_realm_kerberos_membership_proxy_new_for_bus_finish: * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_kerberos_membership_proxy_new_for_bus(). * @error: Return location for error or %NULL * * Finishes an operation started with um_realm_kerberos_membership_proxy_new_for_bus(). * * Returns: (transfer full) (type UmRealmKerberosMembershipProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmKerberosMembership * um_realm_kerberos_membership_proxy_new_for_bus_finish ( GAsyncResult *res, GError **error) { GObject *ret; GObject *source_object; source_object = g_async_result_get_source_object (res); ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); g_object_unref (source_object); if (ret != NULL) return UM_REALM_KERBEROS_MEMBERSHIP (ret); else return NULL; } /** * um_realm_kerberos_membership_proxy_new_for_bus_sync: * @bus_type: A #GBusType. * @flags: Flags from the #GDBusProxyFlags enumeration. * @name: A bus name (well-known or unique). * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL * * Like um_realm_kerberos_membership_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. * * The calling thread is blocked until a reply is received. * * See um_realm_kerberos_membership_proxy_new_for_bus() for the asynchronous version of this constructor. * * Returns: (transfer full) (type UmRealmKerberosMembershipProxy): The constructed proxy object or %NULL if @error is set. */ UmRealmKerberosMembership * um_realm_kerberos_membership_proxy_new_for_bus_sync ( GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error) { GInitable *ret; ret = g_initable_new (UM_REALM_TYPE_KERBEROS_MEMBERSHIP_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.KerberosMembership", NULL); if (ret != NULL) return UM_REALM_KERBEROS_MEMBERSHIP (ret); else return NULL; } /* ------------------------------------------------------------------------ */ /** * UmRealmKerberosMembershipSkeleton: * * The #UmRealmKerberosMembershipSkeleton structure contains only private data and should only be accessed using the provided API. */ /** * UmRealmKerberosMembershipSkeletonClass: * @parent_class: The parent class. * * Class structure for #UmRealmKerberosMembershipSkeleton. */ struct _UmRealmKerberosMembershipSkeletonPrivate { GValue *properties; GList *changed_properties; GSource *changed_properties_idle_source; GMainContext *context; GMutex lock; }; static void _um_realm_kerberos_membership_skeleton_handle_method_call ( GDBusConnection *connection G_GNUC_UNUSED, const gchar *sender G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, const gchar *method_name, GVariant *parameters, GDBusMethodInvocation *invocation, gpointer user_data) { UmRealmKerberosMembershipSkeleton *skeleton = UM_REALM_KERBEROS_MEMBERSHIP_SKELETON (user_data); _ExtendedGDBusMethodInfo *info; GVariantIter iter; GVariant *child; GValue *paramv; guint num_params; guint num_extra; guint n; guint signal_id; GValue return_value = G_VALUE_INIT; info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); g_assert (info != NULL); num_params = g_variant_n_children (parameters); num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); n = 0; g_value_init (¶mv[n], UM_REALM_TYPE_KERBEROS_MEMBERSHIP); g_value_set_object (¶mv[n++], skeleton); g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); g_value_set_object (¶mv[n++], invocation); if (info->pass_fdlist) { #ifdef G_OS_UNIX g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); #else g_assert_not_reached (); #endif } g_variant_iter_init (&iter, parameters); while ((child = g_variant_iter_next_value (&iter)) != NULL) { _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; if (arg_info->use_gvariant) { g_value_init (¶mv[n], G_TYPE_VARIANT); g_value_set_variant (¶mv[n], child); n++; } else g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); g_variant_unref (child); } signal_id = g_signal_lookup (info->signal_name, UM_REALM_TYPE_KERBEROS_MEMBERSHIP); g_value_init (&return_value, G_TYPE_BOOLEAN); g_signal_emitv (paramv, signal_id, 0, &return_value); if (!g_value_get_boolean (&return_value)) 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); g_value_unset (&return_value); for (n = 0; n < num_params + num_extra; n++) g_value_unset (¶mv[n]); g_free (paramv); } static GVariant * _um_realm_kerberos_membership_skeleton_handle_get_property ( GDBusConnection *connection G_GNUC_UNUSED, const gchar *sender G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name G_GNUC_UNUSED, const gchar *property_name, GError **error, gpointer user_data) { UmRealmKerberosMembershipSkeleton *skeleton = UM_REALM_KERBEROS_MEMBERSHIP_SKELETON (user_data); GValue value = G_VALUE_INIT; GParamSpec *pspec; _ExtendedGDBusPropertyInfo *info; GVariant *ret; ret = NULL; info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_kerberos_membership_interface_info.parent_struct, property_name); g_assert (info != NULL); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); if (pspec == NULL) { g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); } else { g_value_init (&value, pspec->value_type); g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); g_value_unset (&value); } return ret; } static gboolean _um_realm_kerberos_membership_skeleton_handle_set_property ( GDBusConnection *connection G_GNUC_UNUSED, const gchar *sender G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name G_GNUC_UNUSED, const gchar *property_name, GVariant *variant, GError **error, gpointer user_data) { UmRealmKerberosMembershipSkeleton *skeleton = UM_REALM_KERBEROS_MEMBERSHIP_SKELETON (user_data); GValue value = G_VALUE_INIT; GParamSpec *pspec; _ExtendedGDBusPropertyInfo *info; gboolean ret; ret = FALSE; info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_um_realm_kerberos_membership_interface_info.parent_struct, property_name); g_assert (info != NULL); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); if (pspec == NULL) { g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); } else { if (info->use_gvariant) g_value_set_variant (&value, variant); else g_dbus_gvariant_to_gvalue (variant, &value); g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); g_value_unset (&value); ret = TRUE; } return ret; } static const GDBusInterfaceVTable _um_realm_kerberos_membership_skeleton_vtable = { _um_realm_kerberos_membership_skeleton_handle_method_call, _um_realm_kerberos_membership_skeleton_handle_get_property, _um_realm_kerberos_membership_skeleton_handle_set_property, {NULL} }; static GDBusInterfaceInfo * um_realm_kerberos_membership_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) { return um_realm_kerberos_membership_interface_info (); } static GDBusInterfaceVTable * um_realm_kerberos_membership_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) { return (GDBusInterfaceVTable *) &_um_realm_kerberos_membership_skeleton_vtable; } static GVariant * um_realm_kerberos_membership_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) { UmRealmKerberosMembershipSkeleton *skeleton = UM_REALM_KERBEROS_MEMBERSHIP_SKELETON (_skeleton); GVariantBuilder builder; guint n; g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); if (_um_realm_kerberos_membership_interface_info.parent_struct.properties == NULL) goto out; for (n = 0; _um_realm_kerberos_membership_interface_info.parent_struct.properties[n] != NULL; n++) { GDBusPropertyInfo *info = _um_realm_kerberos_membership_interface_info.parent_struct.properties[n]; if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) { GVariant *value; value = _um_realm_kerberos_membership_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.realmd.KerberosMembership", info->name, NULL, skeleton); if (value != NULL) { g_variant_take_ref (value); g_variant_builder_add (&builder, "{sv}", info->name, value); g_variant_unref (value); } } } out: return g_variant_builder_end (&builder); } static gboolean _um_realm_kerberos_membership_emit_changed (gpointer user_data); static void um_realm_kerberos_membership_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) { UmRealmKerberosMembershipSkeleton *skeleton = UM_REALM_KERBEROS_MEMBERSHIP_SKELETON (_skeleton); gboolean emit_changed = FALSE; g_mutex_lock (&skeleton->priv->lock); if (skeleton->priv->changed_properties_idle_source != NULL) { g_source_destroy (skeleton->priv->changed_properties_idle_source); skeleton->priv->changed_properties_idle_source = NULL; emit_changed = TRUE; } g_mutex_unlock (&skeleton->priv->lock); if (emit_changed) _um_realm_kerberos_membership_emit_changed (skeleton); } static void um_realm_kerberos_membership_skeleton_iface_init (UmRealmKerberosMembershipIface *iface); G_DEFINE_TYPE_WITH_CODE (UmRealmKerberosMembershipSkeleton, um_realm_kerberos_membership_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, G_ADD_PRIVATE (UmRealmKerberosMembershipSkeleton) G_IMPLEMENT_INTERFACE (UM_REALM_TYPE_KERBEROS_MEMBERSHIP, um_realm_kerberos_membership_skeleton_iface_init)); static void um_realm_kerberos_membership_skeleton_finalize (GObject *object) { UmRealmKerberosMembershipSkeleton *skeleton = UM_REALM_KERBEROS_MEMBERSHIP_SKELETON (object); guint n; for (n = 0; n < 3; n++) g_value_unset (&skeleton->priv->properties[n]); g_free (skeleton->priv->properties); g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); if (skeleton->priv->changed_properties_idle_source != NULL) g_source_destroy (skeleton->priv->changed_properties_idle_source); g_main_context_unref (skeleton->priv->context); g_mutex_clear (&skeleton->priv->lock); G_OBJECT_CLASS (um_realm_kerberos_membership_skeleton_parent_class)->finalize (object); } static void um_realm_kerberos_membership_skeleton_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec G_GNUC_UNUSED) { UmRealmKerberosMembershipSkeleton *skeleton = UM_REALM_KERBEROS_MEMBERSHIP_SKELETON (object); g_assert (prop_id != 0 && prop_id - 1 < 3); g_mutex_lock (&skeleton->priv->lock); g_value_copy (&skeleton->priv->properties[prop_id - 1], value); g_mutex_unlock (&skeleton->priv->lock); } static gboolean _um_realm_kerberos_membership_emit_changed (gpointer user_data) { UmRealmKerberosMembershipSkeleton *skeleton = UM_REALM_KERBEROS_MEMBERSHIP_SKELETON (user_data); GList *l; GVariantBuilder builder; GVariantBuilder invalidated_builder; guint num_changes; g_mutex_lock (&skeleton->priv->lock); g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) { ChangedProperty *cp = l->data; GVariant *variant; const GValue *cur_value; cur_value = &skeleton->priv->properties[cp->prop_id - 1]; if (!_g_value_equal (cur_value, &cp->orig_value)) { variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); g_variant_unref (variant); num_changes++; } } if (num_changes > 0) { GList *connections, *ll; GVariant *signal_variant; signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.realmd.KerberosMembership", &builder, &invalidated_builder)); connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); for (ll = connections; ll != NULL; ll = ll->next) { GDBusConnection *connection = ll->data; g_dbus_connection_emit_signal (connection, NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.DBus.Properties", "PropertiesChanged", signal_variant, NULL); } g_variant_unref (signal_variant); g_list_free_full (connections, g_object_unref); } else { g_variant_builder_clear (&builder); g_variant_builder_clear (&invalidated_builder); } g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); skeleton->priv->changed_properties = NULL; skeleton->priv->changed_properties_idle_source = NULL; g_mutex_unlock (&skeleton->priv->lock); return FALSE; } static void _um_realm_kerberos_membership_schedule_emit_changed (UmRealmKerberosMembershipSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) { ChangedProperty *cp; GList *l; cp = NULL; for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) { ChangedProperty *i_cp = l->data; if (i_cp->info == info) { cp = i_cp; break; } } if (cp == NULL) { cp = g_new0 (ChangedProperty, 1); cp->prop_id = prop_id; cp->info = info; skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); g_value_copy (orig_value, &cp->orig_value); } } static void um_realm_kerberos_membership_skeleton_notify (GObject *object, GParamSpec *pspec G_GNUC_UNUSED) { UmRealmKerberosMembershipSkeleton *skeleton = UM_REALM_KERBEROS_MEMBERSHIP_SKELETON (object); g_mutex_lock (&skeleton->priv->lock); if (skeleton->priv->changed_properties != NULL && skeleton->priv->changed_properties_idle_source == NULL) { skeleton->priv->changed_properties_idle_source = g_idle_source_new (); g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); g_source_set_callback (skeleton->priv->changed_properties_idle_source, _um_realm_kerberos_membership_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); g_source_unref (skeleton->priv->changed_properties_idle_source); } g_mutex_unlock (&skeleton->priv->lock); } static void um_realm_kerberos_membership_skeleton_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { UmRealmKerberosMembershipSkeleton *skeleton = UM_REALM_KERBEROS_MEMBERSHIP_SKELETON (object); g_assert (prop_id != 0 && prop_id - 1 < 3); g_mutex_lock (&skeleton->priv->lock); g_object_freeze_notify (object); if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) { if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) _um_realm_kerberos_membership_schedule_emit_changed (skeleton, _um_realm_kerberos_membership_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); g_object_notify_by_pspec (object, pspec); } g_mutex_unlock (&skeleton->priv->lock); g_object_thaw_notify (object); } static void um_realm_kerberos_membership_skeleton_init (UmRealmKerberosMembershipSkeleton *skeleton) { skeleton->priv = um_realm_kerberos_membership_skeleton_get_instance_private (skeleton); g_mutex_init (&skeleton->priv->lock); skeleton->priv->context = g_main_context_ref_thread_default (); skeleton->priv->properties = g_new0 (GValue, 3); g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT); g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT); } static const gchar * um_realm_kerberos_membership_skeleton_get_suggested_administrator (UmRealmKerberosMembership *object) { UmRealmKerberosMembershipSkeleton *skeleton = UM_REALM_KERBEROS_MEMBERSHIP_SKELETON (object); const gchar *value; g_mutex_lock (&skeleton->priv->lock); value = g_value_get_string (&(skeleton->priv->properties[0])); g_mutex_unlock (&skeleton->priv->lock); return value; } static GVariant * um_realm_kerberos_membership_skeleton_get_supported_join_credentials (UmRealmKerberosMembership *object) { UmRealmKerberosMembershipSkeleton *skeleton = UM_REALM_KERBEROS_MEMBERSHIP_SKELETON (object); GVariant *value; g_mutex_lock (&skeleton->priv->lock); value = g_value_get_variant (&(skeleton->priv->properties[1])); g_mutex_unlock (&skeleton->priv->lock); return value; } static GVariant * um_realm_kerberos_membership_skeleton_get_supported_leave_credentials (UmRealmKerberosMembership *object) { UmRealmKerberosMembershipSkeleton *skeleton = UM_REALM_KERBEROS_MEMBERSHIP_SKELETON (object); GVariant *value; g_mutex_lock (&skeleton->priv->lock); value = g_value_get_variant (&(skeleton->priv->properties[2])); g_mutex_unlock (&skeleton->priv->lock); return value; } static void um_realm_kerberos_membership_skeleton_class_init (UmRealmKerberosMembershipSkeletonClass *klass) { GObjectClass *gobject_class; GDBusInterfaceSkeletonClass *skeleton_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = um_realm_kerberos_membership_skeleton_finalize; gobject_class->get_property = um_realm_kerberos_membership_skeleton_get_property; gobject_class->set_property = um_realm_kerberos_membership_skeleton_set_property; gobject_class->notify = um_realm_kerberos_membership_skeleton_notify; um_realm_kerberos_membership_override_properties (gobject_class, 1); skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); skeleton_class->get_info = um_realm_kerberos_membership_skeleton_dbus_interface_get_info; skeleton_class->get_properties = um_realm_kerberos_membership_skeleton_dbus_interface_get_properties; skeleton_class->flush = um_realm_kerberos_membership_skeleton_dbus_interface_flush; skeleton_class->get_vtable = um_realm_kerberos_membership_skeleton_dbus_interface_get_vtable; } static void um_realm_kerberos_membership_skeleton_iface_init (UmRealmKerberosMembershipIface *iface) { iface->get_suggested_administrator = um_realm_kerberos_membership_skeleton_get_suggested_administrator; iface->get_supported_join_credentials = um_realm_kerberos_membership_skeleton_get_supported_join_credentials; iface->get_supported_leave_credentials = um_realm_kerberos_membership_skeleton_get_supported_leave_credentials; } /** * um_realm_kerberos_membership_skeleton_new: * * Creates a skeleton object for the D-Bus interface org.freedesktop.realmd.KerberosMembership. * * Returns: (transfer full) (type UmRealmKerberosMembershipSkeleton): The skeleton object. */ UmRealmKerberosMembership * um_realm_kerberos_membership_skeleton_new (void) { return UM_REALM_KERBEROS_MEMBERSHIP (g_object_new (UM_REALM_TYPE_KERBEROS_MEMBERSHIP_SKELETON, NULL)); } /* ------------------------------------------------------------------------ * Code for Object, ObjectProxy and ObjectSkeleton * ------------------------------------------------------------------------ */ /** * SECTION:UmRealmObject * @title: UmRealmObject * @short_description: Specialized GDBusObject types * * This section contains the #UmRealmObject, #UmRealmObjectProxy, and #UmRealmObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces. */ /** * UmRealmObject: * * The #UmRealmObject type is a specialized container of interfaces. */ /** * UmRealmObjectIface: * @parent_iface: The parent interface. * * Virtual table for the #UmRealmObject interface. */ typedef UmRealmObjectIface UmRealmObjectInterface; G_DEFINE_INTERFACE_WITH_CODE (UmRealmObject, um_realm_object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT)); static void um_realm_object_default_init (UmRealmObjectIface *iface) { /** * UmRealmObject:provider: * * The #UmRealmProvider instance corresponding to the D-Bus interface org.freedesktop.realmd.Provider, if any. * * Connect to the #GObject::notify signal to get informed of property changes. */ g_object_interface_install_property (iface, g_param_spec_object ("provider", "provider", "provider", UM_REALM_TYPE_PROVIDER, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); /** * UmRealmObject:service: * * The #UmRealmService instance corresponding to the D-Bus interface org.freedesktop.realmd.Service, if any. * * Connect to the #GObject::notify signal to get informed of property changes. */ g_object_interface_install_property (iface, g_param_spec_object ("service", "service", "service", UM_REALM_TYPE_SERVICE, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); /** * UmRealmObject:common: * * The #UmRealmCommon instance corresponding to the D-Bus interface org.freedesktop.realmd.Realm, if any. * * Connect to the #GObject::notify signal to get informed of property changes. */ g_object_interface_install_property (iface, g_param_spec_object ("common", "common", "common", UM_REALM_TYPE_COMMON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); /** * UmRealmObject:kerberos: * * The #UmRealmKerberos instance corresponding to the D-Bus interface org.freedesktop.realmd.Kerberos, if any. * * Connect to the #GObject::notify signal to get informed of property changes. */ g_object_interface_install_property (iface, g_param_spec_object ("kerberos", "kerberos", "kerberos", UM_REALM_TYPE_KERBEROS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); /** * UmRealmObject:kerberos-membership: * * The #UmRealmKerberosMembership instance corresponding to the D-Bus interface org.freedesktop.realmd.KerberosMembership, if any. * * Connect to the #GObject::notify signal to get informed of property changes. */ g_object_interface_install_property (iface, g_param_spec_object ("kerberos-membership", "kerberos-membership", "kerberos-membership", UM_REALM_TYPE_KERBEROS_MEMBERSHIP, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); } /** * um_realm_object_get_provider: * @object: A #UmRealmObject. * * Gets the #UmRealmProvider instance for the D-Bus interface org.freedesktop.realmd.Provider on @object, if any. * * Returns: (transfer full): A #UmRealmProvider that must be freed with g_object_unref() or %NULL if @object does not implement the interface. */ UmRealmProvider *um_realm_object_get_provider (UmRealmObject *object) { GDBusInterface *ret; ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Provider"); if (ret == NULL) return NULL; return UM_REALM_PROVIDER (ret); } /** * um_realm_object_get_service: * @object: A #UmRealmObject. * * Gets the #UmRealmService instance for the D-Bus interface org.freedesktop.realmd.Service on @object, if any. * * Returns: (transfer full): A #UmRealmService that must be freed with g_object_unref() or %NULL if @object does not implement the interface. */ UmRealmService *um_realm_object_get_service (UmRealmObject *object) { GDBusInterface *ret; ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Service"); if (ret == NULL) return NULL; return UM_REALM_SERVICE (ret); } /** * um_realm_object_get_common: * @object: A #UmRealmObject. * * Gets the #UmRealmCommon instance for the D-Bus interface org.freedesktop.realmd.Realm on @object, if any. * * Returns: (transfer full): A #UmRealmCommon that must be freed with g_object_unref() or %NULL if @object does not implement the interface. */ UmRealmCommon *um_realm_object_get_common (UmRealmObject *object) { GDBusInterface *ret; ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Realm"); if (ret == NULL) return NULL; return UM_REALM_COMMON (ret); } /** * um_realm_object_get_kerberos: * @object: A #UmRealmObject. * * Gets the #UmRealmKerberos instance for the D-Bus interface org.freedesktop.realmd.Kerberos on @object, if any. * * Returns: (transfer full): A #UmRealmKerberos that must be freed with g_object_unref() or %NULL if @object does not implement the interface. */ UmRealmKerberos *um_realm_object_get_kerberos (UmRealmObject *object) { GDBusInterface *ret; ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Kerberos"); if (ret == NULL) return NULL; return UM_REALM_KERBEROS (ret); } /** * um_realm_object_get_kerberos_membership: * @object: A #UmRealmObject. * * Gets the #UmRealmKerberosMembership instance for the D-Bus interface org.freedesktop.realmd.KerberosMembership on @object, if any. * * Returns: (transfer full): A #UmRealmKerberosMembership that must be freed with g_object_unref() or %NULL if @object does not implement the interface. */ UmRealmKerberosMembership *um_realm_object_get_kerberos_membership (UmRealmObject *object) { GDBusInterface *ret; ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.KerberosMembership"); if (ret == NULL) return NULL; return UM_REALM_KERBEROS_MEMBERSHIP (ret); } /** * um_realm_object_peek_provider: (skip) * @object: A #UmRealmObject. * * Like um_realm_object_get_provider() but doesn't increase the reference count on the returned object. * * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running. * * Returns: (transfer none): A #UmRealmProvider or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. */ UmRealmProvider *um_realm_object_peek_provider (UmRealmObject *object) { GDBusInterface *ret; ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Provider"); if (ret == NULL) return NULL; g_object_unref (ret); return UM_REALM_PROVIDER (ret); } /** * um_realm_object_peek_service: (skip) * @object: A #UmRealmObject. * * Like um_realm_object_get_service() but doesn't increase the reference count on the returned object. * * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running. * * Returns: (transfer none): A #UmRealmService or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. */ UmRealmService *um_realm_object_peek_service (UmRealmObject *object) { GDBusInterface *ret; ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Service"); if (ret == NULL) return NULL; g_object_unref (ret); return UM_REALM_SERVICE (ret); } /** * um_realm_object_peek_common: (skip) * @object: A #UmRealmObject. * * Like um_realm_object_get_common() but doesn't increase the reference count on the returned object. * * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running. * * Returns: (transfer none): A #UmRealmCommon or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. */ UmRealmCommon *um_realm_object_peek_common (UmRealmObject *object) { GDBusInterface *ret; ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Realm"); if (ret == NULL) return NULL; g_object_unref (ret); return UM_REALM_COMMON (ret); } /** * um_realm_object_peek_kerberos: (skip) * @object: A #UmRealmObject. * * Like um_realm_object_get_kerberos() but doesn't increase the reference count on the returned object. * * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running. * * Returns: (transfer none): A #UmRealmKerberos or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. */ UmRealmKerberos *um_realm_object_peek_kerberos (UmRealmObject *object) { GDBusInterface *ret; ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Kerberos"); if (ret == NULL) return NULL; g_object_unref (ret); return UM_REALM_KERBEROS (ret); } /** * um_realm_object_peek_kerberos_membership: (skip) * @object: A #UmRealmObject. * * Like um_realm_object_get_kerberos_membership() but doesn't increase the reference count on the returned object. * * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running. * * Returns: (transfer none): A #UmRealmKerberosMembership or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. */ UmRealmKerberosMembership *um_realm_object_peek_kerberos_membership (UmRealmObject *object) { GDBusInterface *ret; ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.KerberosMembership"); if (ret == NULL) return NULL; g_object_unref (ret); return UM_REALM_KERBEROS_MEMBERSHIP (ret); } static void um_realm_object_notify (GDBusObject *object, GDBusInterface *interface) { g_object_notify (G_OBJECT (object), ((_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface))->hyphen_name); } /** * UmRealmObjectProxy: * * The #UmRealmObjectProxy structure contains only private data and should only be accessed using the provided API. */ /** * UmRealmObjectProxyClass: * @parent_class: The parent class. * * Class structure for #UmRealmObjectProxy. */ static void um_realm_object_proxy__um_realm_object_iface_init (UmRealmObjectIface *iface G_GNUC_UNUSED) { } static void um_realm_object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface) { iface->interface_added = um_realm_object_notify; iface->interface_removed = um_realm_object_notify; } G_DEFINE_TYPE_WITH_CODE (UmRealmObjectProxy, um_realm_object_proxy, G_TYPE_DBUS_OBJECT_PROXY, G_IMPLEMENT_INTERFACE (UM_REALM_TYPE_OBJECT, um_realm_object_proxy__um_realm_object_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, um_realm_object_proxy__g_dbus_object_iface_init)); static void um_realm_object_proxy_init (UmRealmObjectProxy *object G_GNUC_UNUSED) { } static void um_realm_object_proxy_set_property (GObject *gobject, guint prop_id, const GValue *value G_GNUC_UNUSED, GParamSpec *pspec) { G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); } static void um_realm_object_proxy_get_property (GObject *gobject, guint prop_id, GValue *value, GParamSpec *pspec) { UmRealmObjectProxy *object = UM_REALM_OBJECT_PROXY (gobject); GDBusInterface *interface; switch (prop_id) { case 1: interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Provider"); g_value_take_object (value, interface); break; case 2: interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Service"); g_value_take_object (value, interface); break; case 3: interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Realm"); g_value_take_object (value, interface); break; case 4: interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Kerberos"); g_value_take_object (value, interface); break; case 5: interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.KerberosMembership"); g_value_take_object (value, interface); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; } } static void um_realm_object_proxy_class_init (UmRealmObjectProxyClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gobject_class->set_property = um_realm_object_proxy_set_property; gobject_class->get_property = um_realm_object_proxy_get_property; g_object_class_override_property (gobject_class, 1, "provider"); g_object_class_override_property (gobject_class, 2, "service"); g_object_class_override_property (gobject_class, 3, "common"); g_object_class_override_property (gobject_class, 4, "kerberos"); g_object_class_override_property (gobject_class, 5, "kerberos-membership"); } /** * um_realm_object_proxy_new: * @connection: A #GDBusConnection. * @object_path: An object path. * * Creates a new proxy object. * * Returns: (transfer full): The proxy object. */ UmRealmObjectProxy * um_realm_object_proxy_new (GDBusConnection *connection, const gchar *object_path) { g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL); g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); return UM_REALM_OBJECT_PROXY (g_object_new (UM_REALM_TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL)); } /** * UmRealmObjectSkeleton: * * The #UmRealmObjectSkeleton structure contains only private data and should only be accessed using the provided API. */ /** * UmRealmObjectSkeletonClass: * @parent_class: The parent class. * * Class structure for #UmRealmObjectSkeleton. */ static void um_realm_object_skeleton__um_realm_object_iface_init (UmRealmObjectIface *iface G_GNUC_UNUSED) { } static void um_realm_object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface) { iface->interface_added = um_realm_object_notify; iface->interface_removed = um_realm_object_notify; } G_DEFINE_TYPE_WITH_CODE (UmRealmObjectSkeleton, um_realm_object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON, G_IMPLEMENT_INTERFACE (UM_REALM_TYPE_OBJECT, um_realm_object_skeleton__um_realm_object_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, um_realm_object_skeleton__g_dbus_object_iface_init)); static void um_realm_object_skeleton_init (UmRealmObjectSkeleton *object G_GNUC_UNUSED) { } static void um_realm_object_skeleton_set_property (GObject *gobject, guint prop_id, const GValue *value, GParamSpec *pspec) { UmRealmObjectSkeleton *object = UM_REALM_OBJECT_SKELETON (gobject); GDBusInterfaceSkeleton *interface; switch (prop_id) { case 1: interface = g_value_get_object (value); if (interface != NULL) { g_warn_if_fail (UM_REALM_IS_PROVIDER (interface)); g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); } else { g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.freedesktop.realmd.Provider"); } break; case 2: interface = g_value_get_object (value); if (interface != NULL) { g_warn_if_fail (UM_REALM_IS_SERVICE (interface)); g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); } else { g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.freedesktop.realmd.Service"); } break; case 3: interface = g_value_get_object (value); if (interface != NULL) { g_warn_if_fail (UM_REALM_IS_COMMON (interface)); g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); } else { g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.freedesktop.realmd.Realm"); } break; case 4: interface = g_value_get_object (value); if (interface != NULL) { g_warn_if_fail (UM_REALM_IS_KERBEROS (interface)); g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); } else { g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.freedesktop.realmd.Kerberos"); } break; case 5: interface = g_value_get_object (value); if (interface != NULL) { g_warn_if_fail (UM_REALM_IS_KERBEROS_MEMBERSHIP (interface)); g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); } else { g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.freedesktop.realmd.KerberosMembership"); } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; } } static void um_realm_object_skeleton_get_property (GObject *gobject, guint prop_id, GValue *value, GParamSpec *pspec) { UmRealmObjectSkeleton *object = UM_REALM_OBJECT_SKELETON (gobject); GDBusInterface *interface; switch (prop_id) { case 1: interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Provider"); g_value_take_object (value, interface); break; case 2: interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Service"); g_value_take_object (value, interface); break; case 3: interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Realm"); g_value_take_object (value, interface); break; case 4: interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Kerberos"); g_value_take_object (value, interface); break; case 5: interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.KerberosMembership"); g_value_take_object (value, interface); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; } } static void um_realm_object_skeleton_class_init (UmRealmObjectSkeletonClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gobject_class->set_property = um_realm_object_skeleton_set_property; gobject_class->get_property = um_realm_object_skeleton_get_property; g_object_class_override_property (gobject_class, 1, "provider"); g_object_class_override_property (gobject_class, 2, "service"); g_object_class_override_property (gobject_class, 3, "common"); g_object_class_override_property (gobject_class, 4, "kerberos"); g_object_class_override_property (gobject_class, 5, "kerberos-membership"); } /** * um_realm_object_skeleton_new: * @object_path: An object path. * * Creates a new skeleton object. * * Returns: (transfer full): The skeleton object. */ UmRealmObjectSkeleton * um_realm_object_skeleton_new (const gchar *object_path) { g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); return UM_REALM_OBJECT_SKELETON (g_object_new (UM_REALM_TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL)); } /** * um_realm_object_skeleton_set_provider: * @object: A #UmRealmObjectSkeleton. * @interface_: (allow-none): A #UmRealmProvider or %NULL to clear the interface. * * Sets the #UmRealmProvider instance for the D-Bus interface org.freedesktop.realmd.Provider on @object. */ void um_realm_object_skeleton_set_provider (UmRealmObjectSkeleton *object, UmRealmProvider *interface_) { g_object_set (G_OBJECT (object), "provider", interface_, NULL); } /** * um_realm_object_skeleton_set_service: * @object: A #UmRealmObjectSkeleton. * @interface_: (allow-none): A #UmRealmService or %NULL to clear the interface. * * Sets the #UmRealmService instance for the D-Bus interface org.freedesktop.realmd.Service on @object. */ void um_realm_object_skeleton_set_service (UmRealmObjectSkeleton *object, UmRealmService *interface_) { g_object_set (G_OBJECT (object), "service", interface_, NULL); } /** * um_realm_object_skeleton_set_common: * @object: A #UmRealmObjectSkeleton. * @interface_: (allow-none): A #UmRealmCommon or %NULL to clear the interface. * * Sets the #UmRealmCommon instance for the D-Bus interface org.freedesktop.realmd.Realm on @object. */ void um_realm_object_skeleton_set_common (UmRealmObjectSkeleton *object, UmRealmCommon *interface_) { g_object_set (G_OBJECT (object), "common", interface_, NULL); } /** * um_realm_object_skeleton_set_kerberos: * @object: A #UmRealmObjectSkeleton. * @interface_: (allow-none): A #UmRealmKerberos or %NULL to clear the interface. * * Sets the #UmRealmKerberos instance for the D-Bus interface org.freedesktop.realmd.Kerberos on @object. */ void um_realm_object_skeleton_set_kerberos (UmRealmObjectSkeleton *object, UmRealmKerberos *interface_) { g_object_set (G_OBJECT (object), "kerberos", interface_, NULL); } /** * um_realm_object_skeleton_set_kerberos_membership: * @object: A #UmRealmObjectSkeleton. * @interface_: (allow-none): A #UmRealmKerberosMembership or %NULL to clear the interface. * * Sets the #UmRealmKerberosMembership instance for the D-Bus interface org.freedesktop.realmd.KerberosMembership on @object. */ void um_realm_object_skeleton_set_kerberos_membership (UmRealmObjectSkeleton *object, UmRealmKerberosMembership *interface_) { g_object_set (G_OBJECT (object), "kerberos-membership", interface_, NULL); } /* ------------------------------------------------------------------------ * Code for ObjectManager client * ------------------------------------------------------------------------ */ /** * SECTION:UmRealmObjectManagerClient * @title: UmRealmObjectManagerClient * @short_description: Generated GDBusObjectManagerClient type * * This section contains a #GDBusObjectManagerClient that uses um_realm_object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. */ /** * UmRealmObjectManagerClient: * * The #UmRealmObjectManagerClient structure contains only private data and should only be accessed using the provided API. */ /** * UmRealmObjectManagerClientClass: * @parent_class: The parent class. * * Class structure for #UmRealmObjectManagerClient. */ G_DEFINE_TYPE (UmRealmObjectManagerClient, um_realm_object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT); static void um_realm_object_manager_client_init (UmRealmObjectManagerClient *manager G_GNUC_UNUSED) { } static void um_realm_object_manager_client_class_init (UmRealmObjectManagerClientClass *klass G_GNUC_UNUSED) { } /** * um_realm_object_manager_client_get_proxy_type: * @manager: A #GDBusObjectManagerClient. * @object_path: The object path of the remote object (unused). * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType. * @user_data: User data (unused). * * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy- and #GDBusProxy-derived types. * * Returns: A #GDBusProxy-derived #GType if @interface_name is not %NULL, otherwise the #GType for #UmRealmObjectProxy. */ GType um_realm_object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, gpointer user_data G_GNUC_UNUSED) { static gsize once_init_value = 0; static GHashTable *lookup_hash; GType ret; if (interface_name == NULL) return UM_REALM_TYPE_OBJECT_PROXY; if (g_once_init_enter (&once_init_value)) { lookup_hash = g_hash_table_new (g_str_hash, g_str_equal); g_hash_table_insert (lookup_hash, (gpointer) "org.freedesktop.realmd.Provider", GSIZE_TO_POINTER (UM_REALM_TYPE_PROVIDER_PROXY)); g_hash_table_insert (lookup_hash, (gpointer) "org.freedesktop.realmd.Service", GSIZE_TO_POINTER (UM_REALM_TYPE_SERVICE_PROXY)); g_hash_table_insert (lookup_hash, (gpointer) "org.freedesktop.realmd.Realm", GSIZE_TO_POINTER (UM_REALM_TYPE_COMMON_PROXY)); g_hash_table_insert (lookup_hash, (gpointer) "org.freedesktop.realmd.Kerberos", GSIZE_TO_POINTER (UM_REALM_TYPE_KERBEROS_PROXY)); g_hash_table_insert (lookup_hash, (gpointer) "org.freedesktop.realmd.KerberosMembership", GSIZE_TO_POINTER (UM_REALM_TYPE_KERBEROS_MEMBERSHIP_PROXY)); g_once_init_leave (&once_init_value, 1); } ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name)); if (ret == (GType) 0) ret = G_TYPE_DBUS_PROXY; return ret; } /** * um_realm_object_manager_client_new: * @connection: A #GDBusConnection. * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied. * @user_data: User data to pass to @callback. * * Asynchronously creates #GDBusObjectManagerClient using um_realm_object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details. * * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_object_manager_client_new_finish() to get the result of the operation. * * See um_realm_object_manager_client_new_sync() for the synchronous, blocking version of this constructor. */ void um_realm_object_manager_client_new ( GDBusConnection *connection, GDBusObjectManagerClientFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_async_initable_new_async (UM_REALM_TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", um_realm_object_manager_client_get_proxy_type, NULL); } /** * um_realm_object_manager_client_new_finish: * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_object_manager_client_new(). * @error: Return location for error or %NULL * * Finishes an operation started with um_realm_object_manager_client_new(). * * Returns: (transfer full) (type UmRealmObjectManagerClient): The constructed object manager client or %NULL if @error is set. */ GDBusObjectManager * um_realm_object_manager_client_new_finish ( GAsyncResult *res, GError **error) { GObject *ret; GObject *source_object; source_object = g_async_result_get_source_object (res); ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); g_object_unref (source_object); if (ret != NULL) return G_DBUS_OBJECT_MANAGER (ret); else return NULL; } /** * um_realm_object_manager_client_new_sync: * @connection: A #GDBusConnection. * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL * * Synchronously creates #GDBusObjectManagerClient using um_realm_object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details. * * The calling thread is blocked until a reply is received. * * See um_realm_object_manager_client_new() for the asynchronous version of this constructor. * * Returns: (transfer full) (type UmRealmObjectManagerClient): The constructed object manager client or %NULL if @error is set. */ GDBusObjectManager * um_realm_object_manager_client_new_sync ( GDBusConnection *connection, GDBusObjectManagerClientFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error) { GInitable *ret; ret = g_initable_new (UM_REALM_TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", um_realm_object_manager_client_get_proxy_type, NULL); if (ret != NULL) return G_DBUS_OBJECT_MANAGER (ret); else return NULL; } /** * um_realm_object_manager_client_new_for_bus: * @bus_type: A #GBusType. * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. * @name: A bus name (well-known or unique). * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied. * @user_data: User data to pass to @callback. * * Like um_realm_object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection. * * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. * You can then call um_realm_object_manager_client_new_for_bus_finish() to get the result of the operation. * * See um_realm_object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor. */ void um_realm_object_manager_client_new_for_bus ( GBusType bus_type, GDBusObjectManagerClientFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_async_initable_new_async (UM_REALM_TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", um_realm_object_manager_client_get_proxy_type, NULL); } /** * um_realm_object_manager_client_new_for_bus_finish: * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to um_realm_object_manager_client_new_for_bus(). * @error: Return location for error or %NULL * * Finishes an operation started with um_realm_object_manager_client_new_for_bus(). * * Returns: (transfer full) (type UmRealmObjectManagerClient): The constructed object manager client or %NULL if @error is set. */ GDBusObjectManager * um_realm_object_manager_client_new_for_bus_finish ( GAsyncResult *res, GError **error) { GObject *ret; GObject *source_object; source_object = g_async_result_get_source_object (res); ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); g_object_unref (source_object); if (ret != NULL) return G_DBUS_OBJECT_MANAGER (ret); else return NULL; } /** * um_realm_object_manager_client_new_for_bus_sync: * @bus_type: A #GBusType. * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. * @name: A bus name (well-known or unique). * @object_path: An object path. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL * * Like um_realm_object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection. * * The calling thread is blocked until a reply is received. * * See um_realm_object_manager_client_new_for_bus() for the asynchronous version of this constructor. * * Returns: (transfer full) (type UmRealmObjectManagerClient): The constructed object manager client or %NULL if @error is set. */ GDBusObjectManager * um_realm_object_manager_client_new_for_bus_sync ( GBusType bus_type, GDBusObjectManagerClientFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error) { GInitable *ret; ret = g_initable_new (UM_REALM_TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", um_realm_object_manager_client_get_proxy_type, NULL); if (ret != NULL) return G_DBUS_OBJECT_MANAGER (ret); else return NULL; }