[nautilus] sidebar: Hide format command for mtp devices



commit ab1d3019edfcf12411537d2bf716db5f187627f9
Author: Corey Berla <corey berla me>
Date:   Tue May 3 15:43:36 2022 -0700

    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

 src/gtk/nautilusgtkplacessidebar.c | 7 ++++---
 1 file 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]