shell-app: Consider desktop actions in can_open_new_window()
We currently only consider a remote "app.new-window" action when running, but not a fixed "new-window" action in the .desktop file. The latter is clearly useful as well, in particular as open_new_window() already does, so add it. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/665
This commit is contained in:
parent
213d10bf4e
commit
1e6cb43815
@ -601,6 +601,8 @@ shell_app_can_open_new_window (ShellApp *app)
|
||||
{
|
||||
ShellAppRunningState *state;
|
||||
MetaWindow *window;
|
||||
GDesktopAppInfo *desktop_info;
|
||||
const char * const *desktop_actions;
|
||||
|
||||
/* Apps that are not running can always open new windows, because
|
||||
activating them would open the first one */
|
||||
@ -619,12 +621,18 @@ shell_app_can_open_new_window (ShellApp *app)
|
||||
if (!app->info)
|
||||
return FALSE;
|
||||
|
||||
desktop_info = G_DESKTOP_APP_INFO (app->info);
|
||||
|
||||
/* If the app is explicitly telling us, then we know for sure */
|
||||
if (g_desktop_app_info_has_key (G_DESKTOP_APP_INFO (app->info),
|
||||
"X-GNOME-SingleWindow"))
|
||||
return !g_desktop_app_info_get_boolean (G_DESKTOP_APP_INFO (app->info),
|
||||
if (g_desktop_app_info_has_key (desktop_info, "X-GNOME-SingleWindow"))
|
||||
return !g_desktop_app_info_get_boolean (desktop_info,
|
||||
"X-GNOME-SingleWindow");
|
||||
|
||||
/* If it has a new-window desktop action, it should be able to */
|
||||
desktop_actions = g_desktop_app_info_list_actions (desktop_info);
|
||||
if (desktop_actions && g_strv_contains (desktop_actions, "new-window"))
|
||||
return TRUE;
|
||||
|
||||
/* If this is a unique GtkApplication, and we don't have a new-window, then
|
||||
probably we can't
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user