Callbacks

  SecretAgentOldDeleteSecretsFunc (agent, connection, error, *user_data)
  SecretAgentOldGetSecretsFunc (agent, connection, secrets, error, *user_data)
  SecretAgentOldSaveSecretsFunc (agent, connection, error, *user_data)
  SettingClearSecretsWithFlagsFn (setting, secret, flags, *user_data)
  SettingValueIterFn (setting, key, value, flags, *user_data)
  UtilsCheckFilePredicate (filename, stat, *user_data)
  UtilsFileSearchInPathsPredicate (filename, *user_data)
  UtilsPredicateStr (str)
  VpnIterFunc (key, value, *user_data)

Details

NM.SecretAgentOldDeleteSecretsFunc(agent, connection, error, *user_data)
Parameters:
  • agent (NM.SecretAgentOld) – the secret agent object
  • connection (NM.Connection) – the connection for which secrets were to be deleted, note that this object will be unrefed after the callback has returned, use GObject.Object.ref()/GObject.Object.unref() if you want to use this object after the callback has returned
  • error (GLib.Error) – if the deleting secrets failed, give a descriptive error here
  • user_data (object or None) – 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 object
  • connection (NM.Connection) – the connection for which secrets were requested, note that this object will be unrefed after the callback has returned, use GObject.Object.ref()/GObject.Object.unref() if you want to use this object after the callback has returned
  • secrets (GLib.Variant) – the GLib.Variant of type %NM_VARIANT_TYPE_CONNECTION containing the requested secrets (as created by NM.Connection.to_dbus() for example). Each key in secrets should be the name of a NM.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 secret
  • error (GLib.Error) – if the secrets request failed, give a descriptive error here
  • user_data (object or None) – 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 object
  • connection (NM.Connection) – the connection for which secrets were to be saved, note that this object will be unrefed after the callback has returned, use GObject.Object.ref()/GObject.Object.unref() if you want to use this object after the callback has returned
  • error (GLib.Error) – if the saving secrets failed, give a descriptive error here
  • user_data (object or None) – 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:
Returns:

True to clear the secret, False to not clear the secret

Return type:

bool

NM.SettingValueIterFn(setting, key, value, flags, *user_data)
Parameters:
NM.UtilsCheckFilePredicate(filename, stat, *user_data)
Parameters:
Return type:

bool

NM.UtilsFileSearchInPathsPredicate(filename, *user_data)
Parameters:
Return type:

bool

NM.UtilsPredicateStr(str)
Parameters:str (str) – the name to check.
Returns:True if the predicate function matches.
Return type:bool

This function takes a string argument and returns either True or False. It is a general purpose predicate, for example used by NM.Setting.option_clear_by_name().

New in version 1.26.

NM.VpnIterFunc(key, value, *user_data)
Parameters: