remove nm-settings-connection-interface
NMSettingsConnectionInterface was created to allow the daemon and NM clients to have common code that handled both system and user connections. It's no longer needed now that user settings services are gone. This concludes the flattening of libnm-glib.
This commit is contained in:
@@ -32,13 +32,7 @@
|
||||
#include "nm-ifupdown-connection.h"
|
||||
#include "parser.h"
|
||||
|
||||
static NMSettingsConnectionInterface *parent_settings_connection_iface;
|
||||
|
||||
static void settings_connection_interface_init (NMSettingsConnectionInterface *klass);
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (NMIfupdownConnection, nm_ifupdown_connection, NM_TYPE_SYSCONFIG_CONNECTION, 0,
|
||||
G_IMPLEMENT_INTERFACE (NM_TYPE_SETTINGS_CONNECTION_INTERFACE,
|
||||
settings_connection_interface_init))
|
||||
G_DEFINE_TYPE (NMIfupdownConnection, nm_ifupdown_connection, NM_TYPE_SYSCONFIG_CONNECTION)
|
||||
|
||||
#define NM_IFUPDOWN_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IFUPDOWN_CONNECTION, NMIfupdownConnectionPrivate))
|
||||
|
||||
@@ -63,12 +57,12 @@ nm_ifupdown_connection_new (if_block *block)
|
||||
NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_secrets (NMSettingsConnectionInterface *connection,
|
||||
static void
|
||||
get_secrets (NMSysconfigConnection *connection,
|
||||
const gchar *setting_name,
|
||||
const gchar **hints,
|
||||
gboolean request_new,
|
||||
NMSettingsConnectionInterfaceGetSecretsFunc callback,
|
||||
NMSysconfigConnectionGetSecretsFunc callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
@@ -85,22 +79,15 @@ get_secrets (NMSettingsConnectionInterface *connection,
|
||||
PLUGIN_PRINT ("SCPlugin-Ifupdown", "%s", error->message);
|
||||
callback (connection, NULL, error, user_data);
|
||||
g_error_free (error);
|
||||
return FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
return parent_settings_connection_iface->get_secrets (connection,
|
||||
setting_name,
|
||||
hints,
|
||||
request_new,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
settings_connection_interface_init (NMSettingsConnectionInterface *iface)
|
||||
{
|
||||
parent_settings_connection_iface = g_type_interface_peek_parent (iface);
|
||||
iface->get_secrets = get_secrets;
|
||||
NM_SYSCONFIG_CONNECTION_CLASS (nm_ifupdown_connection_parent_class)->get_secrets (connection,
|
||||
setting_name,
|
||||
hints,
|
||||
request_new,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -184,6 +171,7 @@ static void
|
||||
nm_ifupdown_connection_class_init (NMIfupdownConnectionClass *ifupdown_connection_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (ifupdown_connection_class);
|
||||
NMSysconfigConnectionClass *connection_class = NM_SYSCONFIG_CONNECTION_CLASS (ifupdown_connection_class);
|
||||
|
||||
g_type_class_add_private (ifupdown_connection_class, sizeof (NMIfupdownConnectionPrivate));
|
||||
|
||||
@@ -192,6 +180,8 @@ nm_ifupdown_connection_class_init (NMIfupdownConnectionClass *ifupdown_connectio
|
||||
object_class->set_property = set_property;
|
||||
object_class->get_property = get_property;
|
||||
|
||||
connection_class->get_secrets = get_secrets;
|
||||
|
||||
/* Properties */
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_IFBLOCK,
|
||||
|
@@ -177,7 +177,7 @@ sc_plugin_ifupdown_class_init (SCPluginIfupdownClass *req_class)
|
||||
}
|
||||
|
||||
static void
|
||||
ignore_cb (NMSettingsConnectionInterface *connection,
|
||||
ignore_cb (NMSysconfigConnection *connection,
|
||||
GError *error,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -227,9 +227,9 @@ bind_device_to_connection (SCPluginIfupdown *self,
|
||||
}
|
||||
g_byte_array_free (mac_address, TRUE);
|
||||
|
||||
nm_settings_connection_interface_update (NM_SETTINGS_CONNECTION_INTERFACE (exported),
|
||||
ignore_cb,
|
||||
NULL);
|
||||
nm_sysconfig_connection_commit_changes (NM_SYSCONFIG_CONNECTION (exported),
|
||||
ignore_cb,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -366,9 +366,9 @@ SCPluginIfupdown_init (NMSystemConfigInterface *config)
|
||||
/* Remove any connection for this block that was previously found */
|
||||
exported = g_hash_table_lookup (priv->iface_connections, block->name);
|
||||
if (exported) {
|
||||
nm_settings_connection_interface_delete (NM_SETTINGS_CONNECTION_INTERFACE (exported),
|
||||
ignore_cb,
|
||||
NULL);
|
||||
nm_sysconfig_connection_delete (NM_SYSCONFIG_CONNECTION (exported),
|
||||
ignore_cb,
|
||||
NULL);
|
||||
g_hash_table_remove (priv->iface_connections, block->name);
|
||||
}
|
||||
|
||||
@@ -397,9 +397,9 @@ SCPluginIfupdown_init (NMSystemConfigInterface *config)
|
||||
setting = NM_SETTING (nm_connection_get_setting (NM_CONNECTION (exported), NM_TYPE_SETTING_CONNECTION));
|
||||
g_object_set (setting, NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, NULL);
|
||||
|
||||
nm_settings_connection_interface_update (NM_SETTINGS_CONNECTION_INTERFACE (exported),
|
||||
ignore_cb,
|
||||
NULL);
|
||||
nm_sysconfig_connection_commit_changes (NM_SYSCONFIG_CONNECTION (exported),
|
||||
ignore_cb,
|
||||
NULL);
|
||||
|
||||
PLUGIN_PRINT("SCPlugin-Ifupdown", "autoconnect");
|
||||
}
|
||||
|
Reference in New Issue
Block a user