diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index fbcbf17eb2..578ca458f8 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -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); diff --git a/src/settings/plugins/ifcfg-rh/plugin.c b/src/settings/plugins/ifcfg-rh/plugin.c index e7494826e7..fac70c4e5e 100644 --- a/src/settings/plugins/ifcfg-rh/plugin.c +++ b/src/settings/plugins/ifcfg-rh/plugin.c @@ -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);