Commit 4b74009b authored by Dan Winship's avatar Dan Winship

settings: don't connect to plugin signals until after initial load

Some plugins may emit :new-connection or :unmanaged-specs-changed
while reading connections, so don't connect to those signals until
after the initial load_connections() (and just unconditionally emit
:unmanaged-specs-changed at that point).

In ifcfg-rh's get_unmanaged_specs(), don't bother to try to read the
connections first; if they haven't been read yet, just return NULL;
NMSettings will call it again after the connections have been read.
parent 84468ad6
......@@ -159,6 +159,14 @@ enum {
LAST_PROP
};
static void
plugin_connection_added (NMSystemConfigInterface *config,
NMSettingsConnection *connection,
gpointer user_data)
{
claim_connection (NM_SETTINGS (user_data), connection, TRUE);
}
static void
load_connections (NMSettings *self)
{
......@@ -183,11 +191,15 @@ load_connections (NMSettings *self)
claim_connection (self, NM_SETTINGS_CONNECTION (elt->data), TRUE);
g_slist_free (plugin_connections);
g_signal_connect (plugin, NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED,
G_CALLBACK (plugin_connection_added), self);
g_signal_connect (plugin, NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED,
G_CALLBACK (unmanaged_specs_changed), self);
}
priv->connections_loaded = TRUE;
/* FIXME: Bad hack */
unmanaged_specs_changed (NULL, self);
g_signal_emit (self, signals[CONNECTIONS_LOADED], 0);
......@@ -449,14 +461,6 @@ nm_settings_get_hostname (NMSettings *self)
return NULL;
}
static void
plugin_connection_added (NMSystemConfigInterface *config,
NMSettingsConnection *connection,
gpointer user_data)
{
claim_connection (NM_SETTINGS (user_data), connection, TRUE);
}
static gboolean
find_unmanaged_device (NMSettings *self, const char *needle)
{
......@@ -520,8 +524,6 @@ add_plugin (NMSettings *self, NMSystemConfigInterface *plugin)
priv->plugins = g_slist_append (priv->plugins, g_object_ref (plugin));
g_signal_connect (plugin, NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED,
G_CALLBACK (plugin_connection_added), self);
g_signal_connect (plugin, "notify::hostname", G_CALLBACK (hostname_changed), self);
nm_system_config_interface_init (plugin, NULL);
......@@ -531,9 +533,6 @@ add_plugin (NMSettings *self, NMSystemConfigInterface *plugin)
NM_SYSTEM_CONFIG_INTERFACE_INFO, &pinfo,
NULL);
g_signal_connect (plugin, NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED,
G_CALLBACK (unmanaged_specs_changed), self);
nm_log_info (LOGD_SETTINGS, "Loaded plugin %s: %s", pname, pinfo);
g_free (pname);
g_free (pinfo);
......
......@@ -426,7 +426,6 @@ get_connections (NMSystemConfigInterface *config)
static GSList *
get_unmanaged_specs (NMSystemConfigInterface *config)
{
SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (config);
SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (config);
GSList *list = NULL, *list_iter;
GHashTableIter iter;
......@@ -434,12 +433,6 @@ get_unmanaged_specs (NMSystemConfigInterface *config)
const char *spec;
gboolean found;
if (!priv->initialized) {
setup_ifcfg_monitoring (plugin);
read_connections (plugin);
priv->initialized = TRUE;
}
g_hash_table_iter_init (&iter, priv->connections);
while (g_hash_table_iter_next (&iter, NULL, (gpointer) &connection)) {
spec = nm_ifcfg_connection_get_unmanaged_spec (connection);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment