[glib] In addition to /media and $HOME, also show mounts in $XDG_USER_DIR



commit 428f49b9c8d56ae18398d4bb33c70c80eda1d21d
Author: David Zeuthen <davidz redhat com>
Date:   Fri Aug 12 11:10:22 2011 -0400

    In addition to /media and $HOME, also show mounts in $XDG_USER_DIR
    
    Prepare for the future where udisks will use $XDG_USER_DIR/Volumes
    instead of /media when mounting filesystems on behalf of the user.
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 gio/gunixmounts.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c
index 3ab20fa..b753378 100644
--- a/gio/gunixmounts.c
+++ b/gio/gunixmounts.c
@@ -1975,15 +1975,19 @@ g_unix_mount_guess_should_display (GUnixMountEntry *mount_entry)
     return FALSE;
   
   /* Only display things in /media (which are generally user mountable)
-     and home dir (fuse stuff) */
+     and home dir (fuse stuff) and $XDG_RUNTIME_DIR */
   mount_path = mount_entry->mount_path;
   if (mount_path != NULL)
     {
+      gboolean is_in_runtime_dir = FALSE;
       /* Hide mounts within a dot path, suppose it was a purpose to hide this mount */
       if (g_strstr_len (mount_path, -1, "/.") != NULL)
         return FALSE;
 
-      if (g_str_has_prefix (mount_path, "/media/")) 
+      if (g_getenv ("XDG_RUNTIME_DIR") != NULL && g_str_has_prefix (mount_path, g_get_user_runtime_dir ()))
+        is_in_runtime_dir = TRUE;
+
+      if (is_in_runtime_dir || g_str_has_prefix (mount_path, "/media/"))
         {
           char *path;
           /* Avoid displaying mounts that are not accessible to the user.



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