[nautilus] places: Don't show available space for / when running in a flatpak



commit b17d6b290a6b663015f87de5e6b1e3c95e6efcd1
Author: Corey Berla <corey berla me>
Date:   Mon May 9 12:57:01 2022 -0700

    places: Don't show available space for / when running in a flatpak
    
    The available space is incorrect when running in a flatpak.
    Don't show available space for "/" when the
    /.flatpak-info file exists
    
    Related to: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1997

 src/gtk/nautilusgtkplacesviewrow.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/src/gtk/nautilusgtkplacesviewrow.c b/src/gtk/nautilusgtkplacesviewrow.c
index 0fe87ec10..64d889659 100644
--- a/src/gtk/nautilusgtkplacesviewrow.c
+++ b/src/gtk/nautilusgtkplacesviewrow.c
@@ -19,6 +19,7 @@
 #include "config.h"
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
+#include "nautilus-application.h"
 #include "nautilus-enum-types.h"
 
 #include <gio/gio.h>
@@ -141,9 +142,20 @@ out:
 static void
 measure_available_space (NautilusGtkPlacesViewRow *row)
 {
+  gboolean skip_measure;
   gboolean should_measure;
+  g_autoptr (GFile) root = NULL;
 
-  should_measure = (!row->is_network && (row->volume || row->mount || row->file));
+  skip_measure = FALSE;
+  if (nautilus_application_is_sandboxed ())
+    {
+      root = g_file_new_for_uri ("file:///");
+      if (row->file != NULL)
+        skip_measure = g_file_equal (root, row->file);
+    }
+
+  should_measure = ((row->volume || row->mount || row->file) &&
+                    !row->is_network && !skip_measure);
 
   gtk_label_set_label (row->available_space_label, "");
   gtk_widget_set_visible (GTK_WIDGET (row->available_space_label), should_measure);


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