Callbacks¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- NM.KeyfileReadHandler(keyfile, connection, handler_type, handler_data, *user_data)¶
- Parameters:
keyfile (
GLib.KeyFile
) – theGLib.KeyFile
that is currently readconnection (
NM.Connection
) – theNM.Connection
that is being constructed.handler_type (
NM.KeyfileHandlerType
) – theNM.KeyfileHandlerType
that indicates which type the request is.handler_data (
NM.KeyfileHandlerData
) – theNM.KeyfileHandlerData
. What you can do with it depends on the handler_type.user_data (
object
orNone
) – the user-data argument toNM.keyfile_read
().
- Returns:
the callee should return
True
, if the event was handled and/or recognized. Otherwise, a default action will be performed that depends on the type. ForNM.KeyfileHandlerType.WARN
type, the default action is doing nothing.- Return type:
Hook to
NM.keyfile_read
().The callee may abort the reading by setting an error via
NM.KeyfileHandlerData.fail_with_error
().New in version 1.30.
- NM.KeyfileWriteHandler(connection, keyfile, handler_type, handler_data, *user_data)¶
- Parameters:
connection (
NM.Connection
) – theNM.Connection
that is currently written.keyfile (
GLib.KeyFile
) – theGLib.KeyFile
that is currently constructed.handler_type (
NM.KeyfileHandlerType
) – theNM.KeyfileHandlerType
that indicates which type the request is.handler_data (
NM.KeyfileHandlerData
) – theNM.KeyfileHandlerData
. What you can do with it depends on the handler_type.user_data (
object
orNone
) – the user-data argument toNM.keyfile_read
().
- Returns:
the callee should return
True
if the event was handled. If the event was unhandled, a default action will be performed that depends on the handler_type.- Return type:
This is a hook to tweak the serialization.
Handler for certain properties or events that are not entirely contained within the keyfile or that might be serialized differently. The type and handler_data arguments tell which kind of argument we have at hand.
Currently only the type
NM.KeyfileHandlerType.WRITE_CERT
is supported.The callee may call
NM.KeyfileHandlerData.fail_with_error
() to abort the writing with error.New in version 1.30.
- NM.SecretAgentOldDeleteSecretsFunc(agent, connection, error, *user_data)¶
- Parameters:
agent (
NM.SecretAgentOld
) – the secret agent objectconnection (
NM.Connection
) – the connection for which secrets were to be deleted, note that this object will be unrefed after the callback has returned, useGObject.Object.ref
()/GObject.Object.unref
() if you want to use this object after the callback has returnederror (
GLib.Error
) – if the deleting secrets failed, give a descriptive error hereuser_data (
object
orNone
) – caller-specific data to be passed to the function
Called as a result of a request by NM to delete secrets. When the
NM.SecretAgentOld
subclass has finished deleting the secrets, this function should be called.
- NM.SecretAgentOldGetSecretsFunc(agent, connection, secrets, error, *user_data)¶
- Parameters:
agent (
NM.SecretAgentOld
) – the secret agent objectconnection (
NM.Connection
) – the connection for which secrets were requested, note that this object will be unrefed after the callback has returned, useGObject.Object.ref
()/GObject.Object.unref
() if you want to use this object after the callback has returnedsecrets (
GLib.Variant
) – theGLib.Variant
of type %NM_VARIANT_TYPE_CONNECTION containing the requested secrets (as created byNM.Connection.to_dbus
() for example). Each key in secrets should be the name of aNM.Setting
object (like “802-11-wireless-security”) and each value should be an %NM_VARIANT_TYPE_SETTING variant. The sub-dicts map string:value, where the string is the setting property name (like “psk”) and the value is the secreterror (
GLib.Error
) – if the secrets request failed, give a descriptive error hereuser_data (
object
orNone
) – caller-specific data to be passed to the function
Called as a result of a request by NM to retrieve secrets. When the
NM.SecretAgentOld
subclass has finished retrieving secrets and is ready to return them, or to return an error, this function should be called with those secrets or the error.To easily create the dictionary to return the Wi-Fi PSK, you could do something like this:
- Creating a secrets dictionary
NMConnection *secrets; NMSettingWirelessSecurity *s_wsec; GVariant *secrets_dict; secrets = nm_simple_connection_new (); s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); g_object_set (G_OBJECT (s_wsec), NM_SETTING_WIRELESS_SECURITY_PSK, "my really cool PSK", NULL); nm_connection_add_setting (secrets, NM_SETTING (s_wsec)); secrets_dict = nm_connection_to_dbus (secrets, NM_CONNECTION_SERIALIZE_ALL); (call the NMSecretAgentOldGetSecretsFunc with secrets_dict) g_object_unref (secrets); g_variant_unref (secrets_dict);
- NM.SecretAgentOldSaveSecretsFunc(agent, connection, error, *user_data)¶
- Parameters:
agent (
NM.SecretAgentOld
) – the secret agent objectconnection (
NM.Connection
) – the connection for which secrets were to be saved, note that this object will be unrefed after the callback has returned, useGObject.Object.ref
()/GObject.Object.unref
() if you want to use this object after the callback has returnederror (
GLib.Error
) – if the saving secrets failed, give a descriptive error hereuser_data (
object
orNone
) – caller-specific data to be passed to the function
Called as a result of a request by NM to save secrets. When the
NM.SecretAgentOld
subclass has finished saving the secrets, this function should be called.
- NM.SettingClearSecretsWithFlagsFn(setting, secret, flags, *user_data)¶
- Parameters:
setting (
NM.Setting
) – The setting for which secrets are being iteratedsecret (
str
) – The secret’s nameflags (
NM.SettingSecretFlags
) – The secret’s flags, egNM.SettingSecretFlags.AGENT_OWNED
user_data (
object
orNone
) – User data passed toNM.Connection.clear_secrets_with_flags
()
- Returns:
- Return type:
- NM.SettingValueIterFn(setting, key, value, flags, *user_data)¶
- Parameters:
setting (
NM.Setting
) – The setting for which properties are being iterated, given toNM.Setting.enumerate_values
()key (
str
) – The value/property namevalue (
GObject.Value
) – The property’s valueflags (
GObject.ParamFlags
) – The property’s flags, likeNM.SETTING_PARAM_SECRET
user_data (
object
orNone
) – User data passed toNM.Setting.enumerate_values
()
- NM.UtilsCheckFilePredicate(filename, stat, *user_data)¶
- NM.UtilsFileSearchInPathsPredicate(filename, *user_data)¶
- NM.UtilsPredicateStr(str)¶
- Parameters:
str (
str
) – the name to check.- Returns:
True
if the predicate function matches.- Return type:
This function takes a string argument and returns either
True
orFalse
. It is a general purpose predicate, for example used byNM.Setting.option_clear_by_name
().New in version 1.26.
- NM.VpnIterFunc(key, value, *user_data)¶
- Parameters:
key (
str
) – the name of the data or secret itemvalue (
str
) – the value of the data or secret itemuser_data (
object
orNone
) – User data passed toNM.SettingVpn.foreach_data_item
() orNM.SettingVpn.foreach_secret
()