Number of permutations of $D,D,D,O,O,O,G,G,G$ such that no two $D$ are adjacent and no two $G$ are adjacent

I don't know if there is a slicker way to do this but it can be simpler, even using your approach.

Permutations of "DD D G G G O O O" cover all cases of adjacent D's and adjacent G's except where G's are adjacent but D's are not.

$i)$ Permutations of "DD D G G G O O O" $= \dfrac{8!}{3!3!} - \dfrac{7!}{3!3!} = 980$

[The subtraction is to take care of adjacent DD D and D DD considered different. So DDD permutations are counted twice and need to be taken out once.]

$ $

$ii)$ Permutations of "GG G O O O" and placing $3$ D's in $3$ of the non-adjacent $6$ places

$$= \dfrac{5!}{3!}.{^6}C_3 - \dfrac{4!}{3!}.{^5}C_3 = 360$$

[The subtraction is to take care of adjacent GG G and G GG considered different. So GGG permutations and placing D in $3$ out of $5$ places have been counted twice and need to be counted out once.]

$ $

That gives you the desired arrangements $= 1680 - 980 - 360 = 340$