GNOME Bugzilla – Bug 696425
gedit fails to display fallback application menu items
Last modified: 2013-03-25 08:02:54 UTC
gedit contains code which attempts to display fallback menu items in environments in which the shell does not display an application menu, i.e. when gtk-shell-shows-app-menu is false. Unfortunately currently this fails: when I run gedit 3.7.6 on Ubuntu 13.04 (Raring) under Unity, the application menu items (Edit->Preferences, Help->About and so on) are missing. I investigated by stepping through in a debugger. The problem is that _gedit_app_has_app_menu() returns true, so the code in create_menu_bar_and_toolbar() which is supposed to add the fallback items never runs. I *believe* the problem is that _gedit_app_has_app_menu() queries the default GTK settings rather the settings for the screen we are on. In other words, both Nautilus and Epiphany do this (which works, returning false under Unity): settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window))); g_object_get (settings, "gtk-shell-shows-app-menu", &shows_app_menu, NULL); But currently gedit does this (in _gedit_app_has_app_menu): gtk_settings = gtk_settings_get_default (); g_object_get (G_OBJECT (gtk_settings), "gtk-shell-shows-app-menu", &show_app_menu, NULL);
Created attachment 239582 [details] [review] app menu Thanks Adam, I guess something like this would do it. Mind to test it?
Thanks for the quick turnaround! Unfortunately this patch does not help. :( I now believe I was wrong when I thought we needed to query settings for the screen we're on. Indeed, with this patch gtk-shell-shows-app-menu still evaluates to TRUE. I stepped through the corresponding code in Epiphany and found that gtk-shell-shows-app-menu is TRUE there too! So it appears that Unity actually *can* display the app menu, and does so correctly with Epiphany and Nautilus, but fails to display the app menu in gedit. Perhaps that's because the app menu is the only top-level menu in Epiphany and Nautilus, but gedit has other top-level menus too, which might confuse Unity? If that's true then presumably this would be a Unity bug. I'll try to see if I get can someone from Ubuntu to look at this and/or comment.
I created an Ubuntu bug at https://bugs.launchpad.net/ubuntu/+source/gedit/+bug/1159036
I think the problem is that ubuntu _does_ set ShellShowsAppMenu to true (since it does). It also sets ShellShowsMenubar to true, though.... I've advised people in the past that the better thing to do in this case is to check if shell-shows-appmenu != shell-shows-menubar ie: - on GNOME 2, both are false: show old menus - on GNOME 3, only one is true: show new style - on Unity, both are true: show old menus so you should show the gnome2-style menu layout in any case where the two are equal.
Created attachment 239689 [details] [review] patch This implements Ryan's suggestion. Works as expected with gnome-shell and metacity. Could you guys test it with Unity?
Works as expected with Unity, thanks Paolo!
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.