Hi Dan.
All things are done for the glory of God. Everything we do, say, think, pray and the way we live our lives, are to bring glory to God. When we pray, God knows our hearts and so if we're praying with the wrong motivation (self seeking, in a way that would bring glory to us, for worldly things...just anything that would not bring glory to God) then those prayers will not be answered.
Also this will help us to know how to pray and what prayers WILL be answered. All the ones that bring Glory to His name. So it gives us hope when we pray for a long time and the prays are not yet being answered, we are encouraged to keep praying and trusting that these prayers WILL be answered in His perfect timing.
As far as I can see, your interpretation is correct.