GtkApplication: use resources for loading menus

Use the new ::resource-base-path property on #GApplication to attempt to
load the menu layout of the application.

We look first at gtk/menus-appmenu.ui or gtk/menus-traditional.ui
depending on the setting of gtk_application_prefers_app_menu().  Failing
that, we fall back to the common case of gtk/menus.ui (which should
always be given).  This provides a convenient way for application
authors to provide a different set of menus, depending on the desktop
environment they find themselves in.

As is the intention with other resources, if the resource base path is
unset, nothing will be loaded.  Additionally, if the expected files are not
found, it is not an error -- just nothing happens.

https://bugzilla.gnome.org/show_bug.cgi?id=722092
This commit is contained in:
Ryan Lortie
2014-07-04 09:44:12 -04:00
parent 59f3211b61
commit 868ee07f49
2 changed files with 90 additions and 10 deletions

View File

@ -154,6 +154,10 @@ void gtk_application_set_accels_for_action (GtkApplication
GDK_AVAILABLE_IN_3_14
gboolean gtk_application_prefers_app_menu (GtkApplication *application);
GDK_AVAILABLE_IN_3_14
GMenu * gtk_application_get_menu_by_id (GtkApplication *application,
const gchar *id);
G_END_DECLS
#endif /* __GTK_APPLICATION_H__ */