AppDisplay: don't show a "New Window" menu item if not possible

If the application reports itself as single window (through
an explicit indication in the desktop file or some heuristics),
not show a "New window" item that doesn't actually open a new window.

https://bugzilla.gnome.org/show_bug.cgi?id=722554
This commit is contained in:
Giovanni Campagna
2014-01-19 18:05:16 +01:00
parent e6339fbb45
commit 3182aba744
3 changed files with 75 additions and 6 deletions

View File

@ -1628,12 +1628,14 @@ const AppIconMenu = new Lang.Class({
if (!this._source.app.is_window_backed()) {
this._appendSeparator();
this._newWindowMenuItem = this._appendMenuItem(_("New Window"));
this._newWindowMenuItem.connect('activate', Lang.bind(this, function() {
this._source.app.open_new_window(-1);
this.emit('activate-window', null);
}));
this._appendSeparator();
if (this._source.app.can_open_new_window()) {
this._newWindowMenuItem = this._appendMenuItem(_("New Window"));
this._newWindowMenuItem.connect('activate', Lang.bind(this, function() {
this._source.app.open_new_window(-1);
this.emit('activate-window', null);
}));
this._appendSeparator();
}
let appInfo = this._source.app.get_app_info();
let actions = appInfo.list_actions();