After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 703674 - Provide an app menu
Provide an app menu
Status: RESOLVED FIXED
Product: anjuta
Classification: Applications
Component: core application
3.9.x
Other Linux
: Normal major
: ---
Assigned To: Naba Kumar
Anjuta maintainers
Depends on:
Blocks: 674957
 
 
Reported: 2013-07-05 17:42 UTC by Michael Catanzaro
Modified: 2013-07-09 20:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add application menu (first try) (9.99 KB, patch)
2013-07-07 10:01 UTC, Johannes Schmid
none Details | Review
Add application menu and switch to GtkApplicationWindow (second try) (12.29 KB, patch)
2013-07-07 19:06 UTC, Johannes Schmid
needs-work Details | Review

Description Michael Catanzaro 2013-07-05 17:42:42 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).
Comment 1 Arnel Borja 2013-07-05 18:36:03 UTC
Updated bug report id for Anjuta at https://wiki.gnome.org/GnomeGoals/PortToGMenu
Comment 2 Sébastien Granjoux 2013-07-07 05:54:49 UTC
I will look at this in two weeks but if someone want to do it before that's fine.
Comment 3 Johannes Schmid 2013-07-07 10:01:51 UTC
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
Comment 4 Michael Catanzaro 2013-07-07 16:22:12 UTC
I think AnjutaWindow needs to become a GtkApplicationWindow?
Comment 5 Johannes Schmid 2013-07-07 19:06:56 UTC
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.
Comment 6 Michael Catanzaro 2013-07-07 22:12:08 UTC
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
Comment 7 Arnel Borja 2013-07-08 01:18:21 UTC
(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).
Comment 8 Johannes Schmid 2013-07-08 21:18:54 UTC
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.
Comment 9 Michael Catanzaro 2013-07-09 01:29:55 UTC
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
Comment 10 Michael Catanzaro 2013-07-09 01:57:59 UTC
(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.
Comment 11 Johannes Schmid 2013-07-09 20:45:48 UTC
> 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!