Being married does take time and energy. Add kids into the mix and it takes even more. Having the support of a wonderful partner can be an awesome boost, but you do have to make sacrifices and manage your time better. You can't just get married in order to have an emotional crutch to prop up your mood; it just doesn't work that way, not long-term at any rate. If you're miserable alone, you'll be miserable in company, only then you'll be making somebody else miserable as well.
If you are depressed, and the depression is making it hard for you to work, then I suggest that you take a bit of a break from your coding. Not completely, anyway, but somewhat. The absolute number one thing that I, personally, can do to ward off depression is exercise. Hike a mountain, ride my bike, even just 45 minutes on the Wii Fit, can all make a huge difference. I am not even kidding, the difference is phenomenal. Watch your eating as well; despite the stereotype that coders are fueled by pizza and Mountain Dew, these kinds of lifestyle choices can make or break you. Sure, you sacrifice some of the pleasure in eating, but I promise you that the mood-elevation and overall well-being are more than worth it. It really is amazing the difference that simple diet and exercise can provide. And if changing your lifestyle still doesn't help your depression, then you might want to seek out professional counseling. Occasional depression due to crappy things happening is normal; but ever-present depression that saps your enjoyment of life is probably a disorder that should be handled.
And programming doesn't have to be counter-girl. It's just a hobby. You could just as well say that playing fantasy football is counter-girl, or that rebuilding cars and trucks is counter-girl. It's kind of a non-sequitur. If you pour all your emotional energy into one thing then, yes, that thing can shut out any possibility of having a meaningful relationship. But if you have a girlfriend/boyfriend/spouse, they shouldn't have to compete with your hobby (or profession) for every speck of your attention. If you can't spare any time from coding to be nice to someone, then you probably shouldn't be in a relationship. However, if you pour all of your emotional energy into something like coding, or fantasy football, or automotive restoration, then don't be surprised when those parts of your being that cry out for emotional closeness with another human being cause you to feel lonely, spiritually broken, and depressed. These hobby activities are great, don't get me wrong. (Well, not fantasy football, so much; but to each his own.) But life isn't about just pouring your heart and soul into one single hobby. That is a narrow and non-fulfilling way to live, for creatures who have been made or have evolved (whatever your beliefs) to be social animals.
I've lived that way before, spending 8 hours a day working and another 8 coding before crashing down from the Mt. Dew high and grabbing a couple hours of sleep, pouring everything I had into projects (incidentally, projects which are now long-dead, all that effort amounting to nothing more than a few magnetic spots on a dust-covered hard-drive sitting in a box in the garage) and thinking that there could be nothing better than the life I was living, despite the constant depression and anxiety and loneliness. I have much less free time now that I have a wife and kids and a mortgage to pay, but I honestly would not even consider going back to the "freedom" of being single and coding long into the night on a wave of Mountain Dew euphoria.
Still, marriage isn't for everyone. You can have a fulfilling life without it. Just don't neglect the social aspects completely. Pull your head out of your monitor for three hours and go catch a movie with some friends. Or, better, climb a mountain or ride your bike with friends. Getting your exercise and your social interaction at the same time can save you more time for your coding.