GNOME Bugzilla – Bug 703674
Provide an app menu
Last modified: 2013-07-09 20:45:48 UTC
Is Anjuta planning to add an app menu in time for 3.10? As of 3.8, almost every major GNOME app has one, and Anjuta sticks out badly in GNOME Shell for its lack. I don't think app menus are optional for GNOME apps; certainly not for the flagship IDE. Fortunately this should be really easy, as almost all of Anjuta's current menu options are window-specific. My suggested menu is minimal, because I can't find other global options to add: New Window --- Preferences --- Help > Manual FAQ About Anjuta Quit Basically the only thing (besides Edit -> Preferences) we'd need to remove from the menu bar (the plan is to move options there, not to duplicate them; some 3.8 apps did this wrong) is the Help menu. I don't really think "report bug" and "email developer" need to go in the app menu; I'd rather add a page to the Mallard docs describing how to do so. "About Plugins" could ideally be removed if we give plugins an "About" button under Preferences -> Installed Plugins, though it'd be easier to make a nested menu for that as well. We should absolutely implement this in time for 3.10; UI freeze is in a month and a half. I can do this if needed (but I'm sure the developers would rather).
Updated bug report id for Anjuta at https://wiki.gnome.org/GnomeGoals/PortToGMenu
I will look at this in two weeks but if someone want to do it before that's fine.
Created attachment 248541 [details] [review] Add application menu (first try) This patch should show the application menu but it doesn't show it here - hints appreciated
I think AnjutaWindow needs to become a GtkApplicationWindow?
Created attachment 248561 [details] [review] Add application menu and switch to GtkApplicationWindow (second try) Changed this (see attached patch) but it doesn't make any difference. Note that we cannot easily use gtk_application_set_menubar() because anjuta uses GtkUIManager heavily and this doesn't really play well with GtkMenuShell at the moment.
The second patch is almost right. It works when I modify anjuta_application_startup() to chain up to its parent at the start of the function, instead of at the end. I.e. I have #ifdef ENABLE_NLS .... #endif G_APPLICATION_CLASS (anjuta_application_parent_class)->startup (application); ... And that works. One more thing: currently it's expected that items placed into the app menu are removed from the traditional menubar, so that still needs to be done. There's some resistance to this though and many apps just don't [1] [2] so... just a heads-up. [1] https://mail.gnome.org/archives/desktop-devel-list/2013-July/msg00015.html [2] https://bugzilla.gnome.org/show_bug.cgi?id=675154
(In reply to comment #5) > Note that we cannot easily use gtk_application_set_menubar() because anjuta > uses GtkUIManager heavily and this doesn't really play well with GtkMenuShell > at the moment. (In reply to comment #6) > One more thing: currently it's expected that items placed into the app menu are > removed from the traditional menubar, so that still needs to be done. There's > some resistance to this though and many apps just don't [1] [2] so... just a > heads-up. > > [1] https://mail.gnome.org/archives/desktop-devel-list/2013-July/msg00015.html > [2] https://bugzilla.gnome.org/show_bug.cgi?id=675154 I think it could be done like this: If app menu is supported, move the menus out of the window menu into the app bar. If it is not supported, let them stay in the window menu. This way, we won't end up having two menu bars when app menu is not supported (XFCE, MS Windows, etc.). I saw an application that do something like this (gWaei, though the window menus are in a menu button instead just like in GNOME Documents, and it is not a GNOME project). We will then remove this once Anjuta is ported from GtkUIManager to GMenu (there is currently no easy way to add/remove items at runtime).
OK - commited this now! Discussion: * "New window" was removed because it is totally uncommon and anjuta simple opens a new window when needed (New Project, etc.) * No help submenu for now but not against it if somebody wants to add it * Items are not removed from traditional menu mainly because providing a fallback seems kinda pointless regarding the huge number of menu items we have anyway.
You probably want Help; that's something all the other apps are putting there. Anyway thanks for responding so quickly to this; it looks great! (In reply to comment #8) > * Items are not removed from traditional menu mainly because providing a > fallback seems kinda pointless regarding the huge number of menu items we have > anyway. In that case you probably want to use gtk_application_set_app_menu only if gtk-shell-shows-app-menu is true. [1] Otherwise I imagine Anjuta will not look terribly good outside of GNOME... haven't tried it yet. [1] https://developer.gnome.org/gtk3/stable/GtkSettings.html#GtkSettings--gtk-shell-shows-app-menu
(In reply to comment #8) > * No help submenu for now but not against it if somebody wants to add it Sorry, since the Help menu is retained in the menu bar, I agree there's no point.
> In that case you probably want to use gtk_application_set_app_menu only if > gtk-shell-shows-app-menu is true. [1] Otherwise I imagine Anjuta will not look > terribly good outside of GNOME... haven't tried it yet. > > [1] > https://developer.gnome.org/gtk3/stable/GtkSettings.html#GtkSettings--gtk-shell-shows-app-menu Done!