static NMSettingsConnectionInterface * get_connection_by_path (NMSettingsInterface *settings, const char *path) { NMExportedConnection *connection = NULL; GSList *list = NULL, *iter; list = list_connections (settings); for (iter = list; iter; iter = g_slist_next (iter)) { if (!strcmp (nm_connection_get_path (NM_CONNECTION (iter->data)), path)) { connection = NM_EXPORTED_CONNECTION (iter->data); break; } } g_slist_free (list); return (NMSettingsConnectionInterface *) connection; }
static void SCPluginIfnet_init (NMSystemConfigInterface * config) { SCPluginIfnet *self = SC_PLUGIN_IFNET (config); SCPluginIfnetPrivate *priv = SC_PLUGIN_IFNET_GET_PRIVATE (self); PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Initializing!"); if (!priv->config_connections) priv->config_connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); priv->unmanaged_well_known = !is_managed_plugin (); PLUGIN_PRINT (IFNET_PLUGIN_NAME, "management mode: %s", priv->unmanaged_well_known ? "unmanaged" : "managed"); // GFileMonitor setup setup_monitors (NULL, config); reload_connections (config); /* Now if we're running in managed mode, let NM know there are new connections */ if (!priv->unmanaged_well_known) { GHashTableIter iter; gpointer key; gpointer value; g_hash_table_iter_init (&iter, priv->config_connections); while (g_hash_table_iter_next (&iter, &key, &value)) { if (is_managed ((gchar *) key)) g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED, NM_EXPORTED_CONNECTION (value)); } } /* Read hostname */ update_system_hostname (self); PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Initialzation complete!"); }