Ditto on Iggy's comment and site.
In California (assuming you don't have the elusive Cali CCW permit), it must be in a locked container and unloaded. Unloaded means no round in the chamber and no magazine containing ammunition lodged in the gun. Forgive me if this sounds political, but it's really a lawyer's comment on the law: it is downright confusing to try to work through California's mash of gun laws. Worse, you can get two different cops (or lawyers) to give you two different answers on a lot of fine points about Cali's gun laws because of it.
I've heard it both ways from lay (but knowledgable gun) sources in California -- that the loaded mags must be in a separate case and separated, and NOT. I haven't exhaustively researched it (so this is worth exactly what you're paying for it), but I think the better interpretation is "NOT" -- that the mags do not have to be in a separate case/location**. But the handgun must be in a locked container and it must not have any ammunition in it. If you want maximum avoidance of potential hassle (e.g., the green kid cop who thinks they have to be separate), then carry them separate. It can still cost you time, money and aggravation to go to court to prove you're right if you and a cop have differing opinions on what the law requires.
** IIRC, there's maybe some enhancement for another gun crime if the ammunition is within reach, but I don't believe it has any bearing on the question you're asking. It's late, I don't remember the esoteric circumstance, and I'm not going to go dig it out.