Comment 21 for bug 191512

Revision history for this message
Philip Walls (ubuntu-rabidgeek) wrote :

Sebastien,

I didn't think of this until after you signed off IRC.

DISCLAIMER: code might crash, I'm not a C/glib guru and haven't tested this specific patch.

You could solve both problems reported at http://bugzilla.gnome.org/show_bug.cgi?id=525866 by doing something like this:

__SNIP__

/* mount_path never has trailing separator, and neither does g_get_home_dir().
    We append a separator to g_get_home_dir() and require mount_path to match
    that prefix. This ensures that /home/user1 doesn't see mounts for /home/user123
    and also that the user's actual homedir doesn't get displayed (only subdirs) */

if (g_str_has_prefix (mount_path, g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR, NULL)))
  return TRUE;

__SNIP__

Also, the comparison for /.gvfs (just above the one we're talking about) is a bit disconcerting, as mounts relative to that path would show up on all users' desktops. Should this instead be:

__SNIP__

if (g_str_has_prefix (mount_path, g_strconcat(g_get_home_dir, G_DIR_SEPARATOR, "/.gvfs/")))
  return TRUE;

__SNIP__

In which case, it would be a bit redundant as these mounts would already be picked up by the other conditional.

Thanks,

-P