If you really want to take the train on this route, Chani's suggestion of bus from Granada to Cordoba, then train from Cordoba to Madrid and train from Madrid to Barcelona is probably the best way to go. Note that when changing trains in Madrid you shouldn't have to go through security again; if you will have to change from the upper level platforms to the lower level ones or vice versa, ask where to find the elevator that connects them directly. If you don't take this elevator, you will have to go through security again, as well as waste a lot of time in the confusing Atocha station.
I understand being a train buff, but in Spain it really works better to take trains on the routes they work well on, such as Madrid-Cordoba-Seville, Madrid-Barcelona, Madrid-Toledo (notice the theme?). Trains also work fine for shorter segments, such as Barcelona to Sitges or Girona. Note that buses in Spain are not like Greyhound in the US - you get an assigned seat and both the buses and the stations are much more pleasant. Once the AVE starts running to Granada, that will work well too, but until then, I'd take the bus (for closer places like Cordoba or Seville or Malaga) or fly (for farther destinations like Barcelona).