diff options
author | Eric Daigle <49949-edaigle@users.noreply.gitlab.gnome.org> | 2022-08-23 18:06:18 +0000 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-08-23 18:06:18 +0000 |
commit | 462cc1a0b6e63671c828704a3ba660219ea7a88c (patch) | |
tree | ec723a12c531e0f8629ee8a579d58d0b2a78cebb | |
parent | 2ac420316bd9c8560fa2cdeba0e5f5b0092243b7 (diff) | |
download | nautilus-462cc1a0b6e63671c828704a3ba660219ea7a88c.tar.gz |
gtkplacesview: Do not show properties menu for unmounted drives
As described in #2412, the Other Locations context menu currently shows a useless
Properties option when an unmounted drive is right-clicked. Adds a check
when enabling the Properties widget to ensure it is only enabled if a drive is mounted
and/or is the root filesystem (the root case must be handled separately as the mount
field is not set in the GtkPlacesViewRow representing the root filesystem)
Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2412
-rw-r--r-- | src/gtk/nautilusgtkplacesview.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gtk/nautilusgtkplacesview.c b/src/gtk/nautilusgtkplacesview.c index 4d470eff7..0d062c9ee 100644 --- a/src/gtk/nautilusgtkplacesview.c +++ b/src/gtk/nautilusgtkplacesview.c @@ -28,6 +28,7 @@ #include "nautilusgtkplacesviewprivate.h" #include "nautilusgtkplacesviewrowprivate.h" #include "nautilus-file.h" +#include "nautilus-file-utilities.h" #include "nautilus-properties-window.h" /*< private > @@ -1768,13 +1769,14 @@ real_popup_menu (GtkWidget *widget, NautilusGtkPlacesView *view; GMount *mount; GFile *file; - gboolean is_network; + gboolean is_root, is_network; double x_in_view, y_in_view; view = NAUTILUS_GTK_PLACES_VIEW (gtk_widget_get_ancestor (GTK_WIDGET (row), NAUTILUS_TYPE_GTK_PLACES_VIEW)); mount = nautilus_gtk_places_view_row_get_mount (row); file = nautilus_gtk_places_view_row_get_file (row); + is_root = file && nautilus_is_root_directory (file); is_network = nautilus_gtk_places_view_row_get_is_network (row); gtk_widget_action_set_enabled (GTK_WIDGET (view), "location.disconnect", @@ -1786,7 +1788,8 @@ real_popup_menu (GtkWidget *widget, gtk_widget_action_set_enabled (GTK_WIDGET (view), "location.mount", !file && !mount && !is_network); gtk_widget_action_set_enabled (GTK_WIDGET (view), "location.properties", - !(file && is_network)); + (is_root || + (mount && !(file && is_network)))); if (!view->popup_menu) { |