appDisplay: Do not duplicate "New Window" action

We assume that applications that export a 'new-window' action can open
a new window, so we add an appropriate entry to the context menu.
However this duplicates functionality if the application already
exposes the action via the desktop file - don't add our own entry
in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=744446
This commit is contained in:
Florian Müllner 2015-02-13 02:03:33 +01:00
parent 299ec4f368
commit 12cb023050

View File

@ -1820,7 +1820,10 @@ const AppIconMenu = new Lang.Class({
if (!this._source.app.is_window_backed()) {
this._appendSeparator();
if (this._source.app.can_open_new_window()) {
let appInfo = this._source.app.get_app_info();
let actions = appInfo.list_actions();
if (this._source.app.can_open_new_window() &&
actions.indexOf('new-window') == -1) {
this._newWindowMenuItem = this._appendMenuItem(_("New Window"));
this._newWindowMenuItem.connect('activate', Lang.bind(this, function() {
if (this._source.app.state == Shell.AppState.STOPPED)
@ -1832,8 +1835,6 @@ const AppIconMenu = new Lang.Class({
this._appendSeparator();
}
let appInfo = this._source.app.get_app_info();
let actions = appInfo.list_actions();
for (let i = 0; i < actions.length; i++) {
let action = actions[i];
let item = this._appendMenuItem(appInfo.get_action_name(action));