Q:

How to detect if appmenu is active? 

Is it possible to check from the application if its menu will be displayed in the window or in the panel (AppMenu)? 
I can of course check if the environment is Unity, but some people use AppMenu in KDE or in classic GNOME, so I'm looking for more universal way. 
I'll prefer a way suitable for C language and working in Ubuntu 11.10. 

A:

I have found a better solution here: https://wiki.ubuntu.com/MenuBar#Advertising_the_presence_of_the_menu_bar.