In addition to /media and $HOME, also show mounts in $XDG_USER_DIR
authorDavid Zeuthen <davidz@redhat.com>
Fri, 12 Aug 2011 15:10:22 +0000 (11:10 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Fri, 12 Aug 2011 15:10:22 +0000 (11:10 -0400)
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

index 3ab20fa..b753378 100644 (file)
@@ -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.