diff options
author | Corey Berla <corey@berla.me> | 2022-05-03 15:43:36 -0700 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-09-04 00:17:22 +0100 |
commit | ab1d3019edfcf12411537d2bf716db5f187627f9 (patch) | |
tree | 6f7f83dc4c69f7462163359eeeaa9ff08d21b6bd | |
parent | 05d97aec624d0673e86b439cf892f27c505ac0dd (diff) | |
download | nautilus-ab1d3019edfcf12411537d2bf716db5f187627f9.tar.gz |
sidebar: Hide format command for mtp devices
Format option is displayed for mtp devices even though gnome-disks
doesn't support them. Hide format option if uri starts with mtp://
This applies to MTP and PTP (gphoto2)
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1358
-rw-r--r-- | src/gtk/nautilusgtkplacessidebar.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gtk/nautilusgtkplacessidebar.c b/src/gtk/nautilusgtkplacessidebar.c index e3e4966e3..06e3c20c6 100644 --- a/src/gtk/nautilusgtkplacessidebar.c +++ b/src/gtk/nautilusgtkplacessidebar.c @@ -3160,12 +3160,13 @@ static GActionEntry entries[] = { }; static gboolean -should_show_format_command (GVolume *volume) +should_show_format_command (GVolume *volume, + gchar *uri) { g_autofree gchar *unix_device_id = NULL; gboolean disks_available; - if (volume == NULL || !G_IS_VOLUME (volume)) + if (volume == NULL || !G_IS_VOLUME (volume) || g_str_has_prefix (uri, "mtp://")) return FALSE; unix_device_id = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE); @@ -3437,7 +3438,7 @@ create_row_popover (NautilusGtkPlacesSidebar *sidebar, g_object_unref (item); } - if (should_show_format_command (volume)) + if (should_show_format_command (volume, uri)) { item = g_menu_item_new (_("Format…"), "row.format"); g_menu_append_item (section, item); |