mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-01 13:23:07 +02:00
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>
This commit is contained in:
parent
9fafa34345
commit
428f49b9c8
@ -1975,15 +1975,19 @@ g_unix_mount_guess_should_display (GUnixMountEntry *mount_entry)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Only display things in /media (which are generally user mountable)
|
/* 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;
|
mount_path = mount_entry->mount_path;
|
||||||
if (mount_path != NULL)
|
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 */
|
/* Hide mounts within a dot path, suppose it was a purpose to hide this mount */
|
||||||
if (g_strstr_len (mount_path, -1, "/.") != NULL)
|
if (g_strstr_len (mount_path, -1, "/.") != NULL)
|
||||||
return FALSE;
|
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;
|
char *path;
|
||||||
/* Avoid displaying mounts that are not accessible to the user.
|
/* Avoid displaying mounts that are not accessible to the user.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user