From d5e3a3b55fbfa7374b7df46bf853853ecb118919 Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Fri, 2 Apr 2021 10:57:26 -0400 Subject: [PATCH] nemo-window-menus.c: hide gvfs locations based on their actual availability, not strictly on the process uid. --- src/nemo-window-menus.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/nemo-window-menus.c b/src/nemo-window-menus.c index e9c98d7d1..f3d642e57 100644 --- a/src/nemo-window-menus.c +++ b/src/nemo-window-menus.c @@ -49,6 +49,7 @@ #include #include +#include #include #include @@ -1791,16 +1792,18 @@ nemo_window_initialize_menus (NemoWindow *window) window); /* if root then hide menu items that do not work */ - if (nemo_user_is_root () && !nemo_treating_root_as_normal ()) { - action_to_hide = gtk_action_group_get_action (action_group, "Go to Computer"); - gtk_action_set_visible (action_to_hide, FALSE); - action_to_hide = gtk_action_group_get_action (action_group, "Go to Templates"); - gtk_action_set_visible (action_to_hide, FALSE); - action_to_hide = gtk_action_group_get_action (action_group, "Go to Trash"); - gtk_action_set_visible (action_to_hide, FALSE); - action_to_hide = gtk_action_group_get_action (action_group, "Go to Network"); - gtk_action_set_visible (action_to_hide, FALSE); - } + if (nemo_user_is_root () && !nemo_treating_root_as_normal ()) { + action_to_hide = gtk_action_group_get_action (action_group, "Go to Templates"); + gtk_action_set_visible (action_to_hide, FALSE); + } + + /* hide menu items that are not currently supported by the vfs */ + action_to_hide = gtk_action_group_get_action (action_group, "Go to Computer"); + gtk_action_set_visible (action_to_hide, eel_vfs_supports_uri_scheme ("computer")); + action_to_hide = gtk_action_group_get_action (action_group, "Go to Trash"); + gtk_action_set_visible (action_to_hide, eel_vfs_supports_uri_scheme ("trash")); + action_to_hide = gtk_action_group_get_action (action_group, "Go to Network"); + gtk_action_set_visible (action_to_hide, eel_vfs_supports_uri_scheme ("network")); gtk_action_group_add_toggle_actions (action_group, main_toggle_entries, G_N_ELEMENTS (main_toggle_entries),