Package: gtk

Function gtk-application-prefers-app-menu

Lambda List

gtk-application-prefers-app-menu (application)

Arguments

application -- a gtk-application instance

Return Value

A boolean that is true if the desktop enviroment would prefer an application menu be shown.

Details

Determines if the desktop environment in which the application is running would prefer an application menu be shown.

If this function returns true then the application should call the gtk-application-app-menu function with the contents of an application menu, which will be shown by the desktop environment. If it returns false then you should consider using an alternate approach, such as a menubar.

The value returned by this function is purely advisory and you are free to ignore it. If you call the gtk-application-app-menu function even if the desktop environment does not support application menus, then a fallback will be provided.

Applications are similarly free not to set an application menu even if the desktop environment wants to show one. In that case, a fallback will also be created by the desktop environment. GNOME, for example, uses a menu with only a "Quit" item in it.

The value returned by this function never changes. Once it returns a particular value, it is guaranteed to always return the same value.

You may only call this function after the application has been registered and after the base "startup" handler has run. You are most likely to want to use this from your own "startup" handler. It may also make sense to consult this function in an "activate", "open" or an action activation handler, while constructing the UI in order to determine if you should show a gear menu or not.

This function will return false on Mac OS and a default application menu will be created automatically with the contents of that menu typical to most Mac OS applications. If you call the gtk-application-app-menu function anyway, then this menu will be replaced with your own.
 

See also

2021-9-3