I have to see if JoomGallery continues to be loaded to some page ( "option=com_joomgallery" in URL), to load module within this condition. Parsing URL is not recommended. (in PHP )

I personally use Advanced Module Manager for module control. This will help you to load modules conditionally whether you've got a food selection for that component or otherwise.

http://extensions.joomla.org/extensions/access-a-security/modules-management/10307

if (JRequest::getCmd( 'option' ) == 'com_joomgallery'){
        echo ' JoomGalery extension in use';
}