diff options
Diffstat (limited to 'monitor/udisks2')
-rw-r--r-- | monitor/udisks2/gvfsudisks2volumemonitor.c | 21 | ||||
-rw-r--r-- | monitor/udisks2/what-is-shown.txt | 7 |
2 files changed, 14 insertions, 14 deletions
diff --git a/monitor/udisks2/gvfsudisks2volumemonitor.c b/monitor/udisks2/gvfsudisks2volumemonitor.c index ae3711cb..58d121c8 100644 --- a/monitor/udisks2/gvfsudisks2volumemonitor.c +++ b/monitor/udisks2/gvfsudisks2volumemonitor.c @@ -604,6 +604,8 @@ should_include (const gchar *mount_path, { gboolean ret = FALSE; const gchar *home_dir = NULL; + const gchar *user_name; + gsize user_name_len; g_return_val_if_fail (mount_path != NULL, FALSE); @@ -634,7 +636,7 @@ should_include (const gchar *mount_path, /* Only display things in * - /media; and * - $HOME; and - * - $XDG_RUNTIME_DIR + * - /run/media/$USER */ /* Hide mounts within a subdirectory starting with a "." - suppose it was a purpose to hide this mount */ @@ -659,16 +661,15 @@ should_include (const gchar *mount_path, } } - /* Check runtime dir */ - if (g_getenv ("XDG_RUNTIME_DIR") != NULL) + /* Check /run/media/$USER/ */ + user_name = g_get_user_name (); + user_name_len = strlen (user_name); + if (strncmp (mount_path, "/run/media/", sizeof ("/run/media/") - 1) == 0 && + strncmp (mount_path + sizeof ("/run/media/") - 1, user_name, user_name_len) == 0 && + mount_path[sizeof ("/run/media/") - 1 + user_name_len] == '/') { - const gchar *run_dir = g_get_user_runtime_dir (); - if (g_str_has_prefix (mount_path, run_dir) && - strncmp ("/media/", mount_path + strlen (run_dir), sizeof ("/media/") - 1) == 0) - { - ret = TRUE; - goto out; - } + ret = TRUE; + goto out; } out: diff --git a/monitor/udisks2/what-is-shown.txt b/monitor/udisks2/what-is-shown.txt index 409ecf04..91d933c1 100644 --- a/monitor/udisks2/what-is-shown.txt +++ b/monitor/udisks2/what-is-shown.txt @@ -20,10 +20,9 @@ with, or if not mounted, the options from its /etc/fstab entry, if any. If the directory for a device is known and outside /media, $HOME -(typically /home/foo) or $XDG_RUNTIME_DIR/media (typically -/run/user/foo/media) then the device is not shown in the user -interface. Additionally, if any of component directories in its -directory starts with a dot ("."), the device is not shown +(typically /home/foo) or /run/media/$USER then the device is not shown +in the user interface. Additionally, if any of component directories +in its directory starts with a dot ("."), the device is not shown either. This policy may be overriden by use of the options x-gvfs-show and x-gvfs-hide. |